heyio 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,39 +2,39 @@
2
2
  * @vue/shared v3.5.34
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
- **/function Si(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ce={},ks=[],_t=()=>{},Ea=()=>!1,rn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),nn=t=>t.startsWith("onUpdate:"),xe=Object.assign,Ei=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},wc=Object.prototype.hasOwnProperty,ne=(t,e)=>wc.call(t,e),q=Array.isArray,Ts=t=>_r(t)==="[object Map]",ka=t=>_r(t)==="[object Set]",zi=t=>_r(t)==="[object Date]",J=t=>typeof t=="function",ve=t=>typeof t=="string",Xe=t=>typeof t=="symbol",ie=t=>t!==null&&typeof t=="object",Ta=t=>(ie(t)||J(t))&&J(t.then)&&J(t.catch),Aa=Object.prototype.toString,_r=t=>Aa.call(t),Sc=t=>_r(t).slice(8,-1),Ra=t=>_r(t)==="[object Object]",on=t=>ve(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Gs=Si(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),an=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},Ec=/-\w/g,st=an(t=>t.replace(Ec,e=>e.slice(1).toUpperCase())),kc=/\B([A-Z])/g,is=an(t=>t.replace(kc,"-$1").toLowerCase()),Oa=an(t=>t.charAt(0).toUpperCase()+t.slice(1)),An=an(t=>t?`on${Oa(t)}`:""),vt=(t,e)=>!Object.is(t,e),Dr=(t,...e)=>{for(let s=0;s<t.length;s++)t[s](...e)},xa=(t,e,s,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:s})},ki=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Yi;const ln=()=>Yi||(Yi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ti(t){if(q(t)){const e={};for(let s=0;s<t.length;s++){const r=t[s],n=ve(r)?Oc(r):Ti(r);if(n)for(const i in n)e[i]=n[i]}return e}else if(ve(t)||ie(t))return t}const Tc=/;(?![^(]*\))/g,Ac=/:([^]+)/,Rc=/\/\*[^]*?\*\//g;function Oc(t){const e={};return t.replace(Rc,"").split(Tc).forEach(s=>{if(s){const r=s.split(Ac);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function tt(t){let e="";if(ve(t))e=t;else if(q(t))for(let s=0;s<t.length;s++){const r=tt(t[s]);r&&(e+=r+" ")}else if(ie(t))for(const s in t)t[s]&&(e+=s+" ");return e.trim()}const xc="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Cc=Si(xc);function Ca(t){return!!t||t===""}function Pc(t,e){if(t.length!==e.length)return!1;let s=!0;for(let r=0;s&&r<t.length;r++)s=Ai(t[r],e[r]);return s}function Ai(t,e){if(t===e)return!0;let s=zi(t),r=zi(e);if(s||r)return s&&r?t.getTime()===e.getTime():!1;if(s=Xe(t),r=Xe(e),s||r)return t===e;if(s=q(t),r=q(e),s||r)return s&&r?Pc(t,e):!1;if(s=ie(t),r=ie(e),s||r){if(!s||!r)return!1;const n=Object.keys(t).length,i=Object.keys(e).length;if(n!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!Ai(t[o],e[o]))return!1}}return String(t)===String(e)}const Pa=t=>!!(t&&t.__v_isRef===!0),le=t=>ve(t)?t:t==null?"":q(t)||ie(t)&&(t.toString===Aa||!J(t.toString))?Pa(t)?le(t.value):JSON.stringify(t,Ia,2):String(t),Ia=(t,e)=>Pa(e)?Ia(t,e.value):Ts(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[r,n],i)=>(s[Rn(r,i)+" =>"]=n,s),{})}:ka(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Rn(s))}:Xe(e)?Rn(e):ie(e)&&!q(e)&&!Ra(e)?String(e):e,Rn=(t,e="")=>{var s;return Xe(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/**
5
+ **/function Si(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const ue={},ks=[],_t=()=>{},Ea=()=>!1,nn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),on=t=>t.startsWith("onUpdate:"),Oe=Object.assign,Ei=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},wc=Object.prototype.hasOwnProperty,ie=(t,e)=>wc.call(t,e),q=Array.isArray,Ts=t=>br(t)==="[object Map]",ka=t=>br(t)==="[object Set]",zi=t=>br(t)==="[object Date]",Y=t=>typeof t=="function",ve=t=>typeof t=="string",Ze=t=>typeof t=="symbol",oe=t=>t!==null&&typeof t=="object",Ta=t=>(oe(t)||Y(t))&&Y(t.then)&&Y(t.catch),Aa=Object.prototype.toString,br=t=>Aa.call(t),Sc=t=>br(t).slice(8,-1),Ra=t=>br(t)==="[object Object]",an=t=>ve(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Js=Si(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ln=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},Ec=/-\w/g,rt=ln(t=>t.replace(Ec,e=>e.slice(1).toUpperCase())),kc=/\B([A-Z])/g,is=ln(t=>t.replace(kc,"-$1").toLowerCase()),xa=ln(t=>t.charAt(0).toUpperCase()+t.slice(1)),An=ln(t=>t?`on${xa(t)}`:""),vt=(t,e)=>!Object.is(t,e),Br=(t,...e)=>{for(let s=0;s<t.length;s++)t[s](...e)},Oa=(t,e,s,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:s})},ki=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Yi;const cn=()=>Yi||(Yi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ti(t){if(q(t)){const e={};for(let s=0;s<t.length;s++){const r=t[s],n=ve(r)?xc(r):Ti(r);if(n)for(const i in n)e[i]=n[i]}return e}else if(ve(t)||oe(t))return t}const Tc=/;(?![^(]*\))/g,Ac=/:([^]+)/,Rc=/\/\*[^]*?\*\//g;function xc(t){const e={};return t.replace(Rc,"").split(Tc).forEach(s=>{if(s){const r=s.split(Ac);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function We(t){let e="";if(ve(t))e=t;else if(q(t))for(let s=0;s<t.length;s++){const r=We(t[s]);r&&(e+=r+" ")}else if(oe(t))for(const s in t)t[s]&&(e+=s+" ");return e.trim()}const Oc="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Cc=Si(Oc);function Ca(t){return!!t||t===""}function Pc(t,e){if(t.length!==e.length)return!1;let s=!0;for(let r=0;s&&r<t.length;r++)s=Ai(t[r],e[r]);return s}function Ai(t,e){if(t===e)return!0;let s=zi(t),r=zi(e);if(s||r)return s&&r?t.getTime()===e.getTime():!1;if(s=Ze(t),r=Ze(e),s||r)return t===e;if(s=q(t),r=q(e),s||r)return s&&r?Pc(t,e):!1;if(s=oe(t),r=oe(e),s||r){if(!s||!r)return!1;const n=Object.keys(t).length,i=Object.keys(e).length;if(n!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!Ai(t[o],e[o]))return!1}}return String(t)===String(e)}const Pa=t=>!!(t&&t.__v_isRef===!0),ee=t=>ve(t)?t:t==null?"":q(t)||oe(t)&&(t.toString===Aa||!Y(t.toString))?Pa(t)?ee(t.value):JSON.stringify(t,Ia,2):String(t),Ia=(t,e)=>Pa(e)?Ia(t,e.value):Ts(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[r,n],i)=>(s[Rn(r,i)+" =>"]=n,s),{})}:ka(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Rn(s))}:Ze(e)?Rn(e):oe(e)&&!q(e)&&!Ra(e)?String(e):e,Rn=(t,e="")=>{var s;return Ze(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/**
6
6
  * @vue/reactivity v3.5.34
7
7
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
8
  * @license MIT
9
- **/let Ee;class ja{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Ee&&(Ee.active?(this.parent=Ee,this.index=(Ee.scopes||(Ee.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].pause();for(e=0,s=this.effects.length;e<s;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].resume();for(e=0,s=this.effects.length;e<s;e++)this.effects[e].resume()}}run(e){if(this._active){const s=Ee;try{return Ee=this,e()}finally{Ee=s}}}on(){++this._on===1&&(this.prevScope=Ee,Ee=this)}off(){if(this._on>0&&--this._on===0){if(Ee===this)Ee=this.prevScope;else{let e=Ee;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let s,r;for(s=0,r=this.effects.length;s<r;s++)this.effects[s].stop();for(this.effects.length=0,s=0,r=this.cleanups.length;s<r;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,r=this.scopes.length;s<r;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Na(t){return new ja(t)}function $a(){return Ee}function Ic(t,e=!1){Ee&&Ee.cleanups.push(t)}let fe;const On=new WeakSet;class La{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ee&&(Ee.active?Ee.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,On.has(this)&&(On.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Da(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Xi(this),Ba(this);const e=fe,s=rt;fe=this,rt=!0;try{return this.fn()}finally{Ma(this),fe=e,rt=s,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)xi(e);this.deps=this.depsTail=void 0,Xi(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?On.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Gn(this)&&this.run()}get dirty(){return Gn(this)}}let Ua=0,Js,zs;function Da(t,e=!1){if(t.flags|=8,e){t.next=zs,zs=t;return}t.next=Js,Js=t}function Ri(){Ua++}function Oi(){if(--Ua>0)return;if(zs){let e=zs;for(zs=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;Js;){let e=Js;for(Js=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=s}}if(t)throw t}function Ba(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ma(t){let e,s=t.depsTail,r=s;for(;r;){const n=r.prevDep;r.version===-1?(r===s&&(s=n),xi(r),jc(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=s}function Gn(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Ha(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Ha(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===ir)||(t.globalVersion=ir,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Gn(t))))return;t.flags|=2;const e=t.dep,s=fe,r=rt;fe=t,rt=!0;try{Ba(t);const n=t.fn(t._value);(e.version===0||vt(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{fe=s,rt=r,Ma(t),t.flags&=-3}}function xi(t,e=!1){const{dep:s,prevSub:r,nextSub:n}=t;if(r&&(r.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=r,t.nextSub=void 0),s.subs===t&&(s.subs=r,!r&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)xi(i,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function jc(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let rt=!0;const Fa=[];function It(){Fa.push(rt),rt=!1}function jt(){const t=Fa.pop();rt=t===void 0?!0:t}function Xi(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=fe;fe=void 0;try{e()}finally{fe=s}}}let ir=0;class Nc{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ci{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!fe||!rt||fe===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==fe)s=this.activeLink=new Nc(fe,this),fe.deps?(s.prevDep=fe.depsTail,fe.depsTail.nextDep=s,fe.depsTail=s):fe.deps=fe.depsTail=s,qa(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const r=s.nextDep;r.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=r),s.prevDep=fe.depsTail,s.nextDep=void 0,fe.depsTail.nextDep=s,fe.depsTail=s,fe.deps===s&&(fe.deps=r)}return s}trigger(e){this.version++,ir++,this.notify(e)}notify(e){Ri();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{Oi()}}}function qa(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)qa(r)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const Fr=new WeakMap,rs=Symbol(""),Jn=Symbol(""),or=Symbol("");function Ce(t,e,s){if(rt&&fe){let r=Fr.get(t);r||Fr.set(t,r=new Map);let n=r.get(s);n||(r.set(s,n=new Ci),n.map=r,n.key=s),n.track()}}function xt(t,e,s,r,n,i){const o=Fr.get(t);if(!o){ir++;return}const a=l=>{l&&l.trigger()};if(Ri(),e==="clear")o.forEach(a);else{const l=q(t),c=l&&on(s);if(l&&s==="length"){const u=Number(r);o.forEach((h,d)=>{(d==="length"||d===or||!Xe(d)&&d>=u)&&a(h)})}else switch((s!==void 0||o.has(void 0))&&a(o.get(s)),c&&a(o.get(or)),e){case"add":l?c&&a(o.get("length")):(a(o.get(rs)),Ts(t)&&a(o.get(Jn)));break;case"delete":l||(a(o.get(rs)),Ts(t)&&a(o.get(Jn)));break;case"set":Ts(t)&&a(o.get(rs));break}}Oi()}function $c(t,e){const s=Fr.get(t);return s&&s.get(e)}function ls(t){const e=te(t);return e===t?e:(Ce(e,"iterate",or),We(t)?e:e.map(it))}function cn(t){return Ce(t=te(t),"iterate",or),t}function gt(t,e){return Nt(t)?Ps(Pt(t)?it(e):e):it(e)}const Lc={__proto__:null,[Symbol.iterator](){return xn(this,Symbol.iterator,t=>gt(this,t))},concat(...t){return ls(this).concat(...t.map(e=>q(e)?ls(e):e))},entries(){return xn(this,"entries",t=>(t[1]=gt(this,t[1]),t))},every(t,e){return St(this,"every",t,e,void 0,arguments)},filter(t,e){return St(this,"filter",t,e,s=>s.map(r=>gt(this,r)),arguments)},find(t,e){return St(this,"find",t,e,s=>gt(this,s),arguments)},findIndex(t,e){return St(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return St(this,"findLast",t,e,s=>gt(this,s),arguments)},findLastIndex(t,e){return St(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return St(this,"forEach",t,e,void 0,arguments)},includes(...t){return Cn(this,"includes",t)},indexOf(...t){return Cn(this,"indexOf",t)},join(t){return ls(this).join(t)},lastIndexOf(...t){return Cn(this,"lastIndexOf",t)},map(t,e){return St(this,"map",t,e,void 0,arguments)},pop(){return Us(this,"pop")},push(...t){return Us(this,"push",t)},reduce(t,...e){return Qi(this,"reduce",t,e)},reduceRight(t,...e){return Qi(this,"reduceRight",t,e)},shift(){return Us(this,"shift")},some(t,e){return St(this,"some",t,e,void 0,arguments)},splice(...t){return Us(this,"splice",t)},toReversed(){return ls(this).toReversed()},toSorted(t){return ls(this).toSorted(t)},toSpliced(...t){return ls(this).toSpliced(...t)},unshift(...t){return Us(this,"unshift",t)},values(){return xn(this,"values",t=>gt(this,t))}};function xn(t,e,s){const r=cn(t),n=r[e]();return r!==t&&!We(t)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.done||(i.value=s(i.value)),i}),n}const Uc=Array.prototype;function St(t,e,s,r,n,i){const o=cn(t),a=o!==t&&!We(t),l=o[e];if(l!==Uc[e]){const h=l.apply(t,i);return a?it(h):h}let c=s;o!==t&&(a?c=function(h,d){return s.call(this,gt(t,h),d,t)}:s.length>2&&(c=function(h,d){return s.call(this,h,d,t)}));const u=l.call(o,c,r);return a&&n?n(u):u}function Qi(t,e,s,r){const n=cn(t),i=n!==t&&!We(t);let o=s,a=!1;n!==t&&(i?(a=r.length===0,o=function(c,u,h){return a&&(a=!1,c=gt(t,c)),s.call(this,c,gt(t,u),h,t)}):s.length>3&&(o=function(c,u,h){return s.call(this,c,u,h,t)}));const l=n[e](o,...r);return a?gt(t,l):l}function Cn(t,e,s){const r=te(t);Ce(r,"iterate",or);const n=r[e](...s);return(n===-1||n===!1)&&un(s[0])?(s[0]=te(s[0]),r[e](...s)):n}function Us(t,e,s=[]){It(),Ri();const r=te(t)[e].apply(t,s);return Oi(),jt(),r}const Dc=Si("__proto__,__v_isRef,__isVue"),Va=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Xe));function Bc(t){Xe(t)||(t=String(t));const e=te(this);return Ce(e,"has",t),e.hasOwnProperty(t)}class Ka{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,r){if(s==="__v_skip")return e.__v_skip;const n=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!n;if(s==="__v_isReadonly")return n;if(s==="__v_isShallow")return i;if(s==="__v_raw")return r===(n?i?zc:za:i?Ja:Ga).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=q(e);if(!n){let l;if(o&&(l=Lc[s]))return l;if(s==="hasOwnProperty")return Bc}const a=Reflect.get(e,s,_e(e)?e:r);if((Xe(s)?Va.has(s):Dc(s))||(n||Ce(e,"get",s),i))return a;if(_e(a)){const l=o&&on(s)?a:a.value;return n&&ie(l)?Yn(l):l}return ie(a)?n?Yn(a):br(a):a}}class Wa extends Ka{constructor(e=!1){super(!1,e)}set(e,s,r,n){let i=e[s];const o=q(e)&&on(s);if(!this._isShallow){const c=Nt(i);if(!We(r)&&!Nt(r)&&(i=te(i),r=te(r)),!o&&_e(i)&&!_e(r))return c||(i.value=r),!0}const a=o?Number(s)<e.length:ne(e,s),l=Reflect.set(e,s,r,_e(e)?e:n);return e===te(n)&&(a?vt(r,i)&&xt(e,"set",s,r):xt(e,"add",s,r)),l}deleteProperty(e,s){const r=ne(e,s);e[s];const n=Reflect.deleteProperty(e,s);return n&&r&&xt(e,"delete",s,void 0),n}has(e,s){const r=Reflect.has(e,s);return(!Xe(s)||!Va.has(s))&&Ce(e,"has",s),r}ownKeys(e){return Ce(e,"iterate",q(e)?"length":rs),Reflect.ownKeys(e)}}class Mc extends Ka{constructor(e=!1){super(!0,e)}set(e,s){return!0}deleteProperty(e,s){return!0}}const Hc=new Wa,Fc=new Mc,qc=new Wa(!0);const zn=t=>t,Tr=t=>Reflect.getPrototypeOf(t);function Vc(t,e,s){return function(...r){const n=this.__v_raw,i=te(n),o=Ts(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...r),u=s?zn:e?Ps:it;return!e&&Ce(i,"iterate",l?Jn:rs),xe(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function Ar(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Kc(t,e){const s={get(n){const i=this.__v_raw,o=te(i),a=te(n);t||(vt(n,a)&&Ce(o,"get",n),Ce(o,"get",a));const{has:l}=Tr(o),c=e?zn:t?Ps:it;if(l.call(o,n))return c(i.get(n));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!t&&Ce(te(n),"iterate",rs),n.size},has(n){const i=this.__v_raw,o=te(i),a=te(n);return t||(vt(n,a)&&Ce(o,"has",n),Ce(o,"has",a)),n===a?i.has(n):i.has(n)||i.has(a)},forEach(n,i){const o=this,a=o.__v_raw,l=te(a),c=e?zn:t?Ps:it;return!t&&Ce(l,"iterate",rs),a.forEach((u,h)=>n.call(i,c(u),c(h),o))}};return xe(s,t?{add:Ar("add"),set:Ar("set"),delete:Ar("delete"),clear:Ar("clear")}:{add(n){const i=te(this),o=Tr(i),a=te(n),l=!e&&!We(n)&&!Nt(n)?a:n;return o.has.call(i,l)||vt(n,l)&&o.has.call(i,n)||vt(a,l)&&o.has.call(i,a)||(i.add(l),xt(i,"add",l,l)),this},set(n,i){!e&&!We(i)&&!Nt(i)&&(i=te(i));const o=te(this),{has:a,get:l}=Tr(o);let c=a.call(o,n);c||(n=te(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,i),c?vt(i,u)&&xt(o,"set",n,i):xt(o,"add",n,i),this},delete(n){const i=te(this),{has:o,get:a}=Tr(i);let l=o.call(i,n);l||(n=te(n),l=o.call(i,n)),a&&a.call(i,n);const c=i.delete(n);return l&&xt(i,"delete",n,void 0),c},clear(){const n=te(this),i=n.size!==0,o=n.clear();return i&&xt(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{s[n]=Vc(n,t,e)}),s}function Pi(t,e){const s=Kc(t,e);return(r,n,i)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(ne(s,n)&&n in r?s:r,n,i)}const Wc={get:Pi(!1,!1)},Gc={get:Pi(!1,!0)},Jc={get:Pi(!0,!1)};const Ga=new WeakMap,Ja=new WeakMap,za=new WeakMap,zc=new WeakMap;function Yc(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Xc(t){return t.__v_skip||!Object.isExtensible(t)?0:Yc(Sc(t))}function br(t){return Nt(t)?t:Ii(t,!1,Hc,Wc,Ga)}function Ya(t){return Ii(t,!1,qc,Gc,Ja)}function Yn(t){return Ii(t,!0,Fc,Jc,za)}function Ii(t,e,s,r,n){if(!ie(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Xc(t);if(i===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,i===2?r:s);return n.set(t,a),a}function Pt(t){return Nt(t)?Pt(t.__v_raw):!!(t&&t.__v_isReactive)}function Nt(t){return!!(t&&t.__v_isReadonly)}function We(t){return!!(t&&t.__v_isShallow)}function un(t){return t?!!t.__v_raw:!1}function te(t){const e=t&&t.__v_raw;return e?te(e):t}function ji(t){return!ne(t,"__v_skip")&&Object.isExtensible(t)&&xa(t,"__v_skip",!0),t}const it=t=>ie(t)?br(t):t,Ps=t=>ie(t)?Yn(t):t;function _e(t){return t?t.__v_isRef===!0:!1}function ue(t){return Xa(t,!1)}function Qc(t){return Xa(t,!0)}function Xa(t,e){return _e(t)?t:new Zc(t,e)}class Zc{constructor(e,s){this.dep=new Ci,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:te(e),this._value=s?e:it(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,r=this.__v_isShallow||We(e)||Nt(e);e=r?e:te(e),vt(e,s)&&(this._rawValue=e,this._value=r?e:it(e),this.dep.trigger())}}function ae(t){return _e(t)?t.value:t}const eu={get:(t,e,s)=>e==="__v_raw"?t:ae(Reflect.get(t,e,s)),set:(t,e,s,r)=>{const n=t[e];return _e(n)&&!_e(s)?(n.value=s,!0):Reflect.set(t,e,s,r)}};function Qa(t){return Pt(t)?t:new Proxy(t,eu)}function tu(t){const e=q(t)?new Array(t.length):{};for(const s in t)e[s]=ru(t,s);return e}class su{constructor(e,s,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=Xe(s)?s:String(s),this._raw=te(e);let n=!0,i=e;if(!q(e)||Xe(this._key)||!on(this._key))do n=!un(i)||We(i);while(n&&(i=i.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=ae(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&_e(this._raw[this._key])){const s=this._object[this._key];if(_e(s)){s.value=e;return}}this._object[this._key]=e}get dep(){return $c(this._raw,this._key)}}function ru(t,e,s){return new su(t,e,s)}class nu{constructor(e,s,r){this.fn=e,this.setter=s,this._value=void 0,this.dep=new Ci(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ir-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&fe!==this)return Da(this,!0),!0}get value(){const e=this.dep.track();return Ha(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function iu(t,e,s=!1){let r,n;return J(t)?r=t:(r=t.get,n=t.set),new nu(r,n,s)}const Rr={},qr=new WeakMap;let Zt;function ou(t,e=!1,s=Zt){if(s){let r=qr.get(s);r||qr.set(s,r=[]),r.push(t)}}function au(t,e,s=ce){const{immediate:r,deep:n,once:i,scheduler:o,augmentJob:a,call:l}=s,c=O=>n?O:We(O)||n===!1||n===0?Ct(O,1):Ct(O);let u,h,d,f,m=!1,v=!1;if(_e(t)?(h=()=>t.value,m=We(t)):Pt(t)?(h=()=>c(t),m=!0):q(t)?(v=!0,m=t.some(O=>Pt(O)||We(O)),h=()=>t.map(O=>{if(_e(O))return O.value;if(Pt(O))return c(O);if(J(O))return l?l(O,2):O()})):J(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){It();try{d()}finally{jt()}}const O=Zt;Zt=u;try{return l?l(t,3,[f]):t(f)}finally{Zt=O}}:h=_t,e&&n){const O=h,M=n===!0?1/0:n;h=()=>Ct(O(),M)}const A=$a(),T=()=>{u.stop(),A&&A.active&&Ei(A.effects,u)};if(i&&e){const O=e;e=(...M)=>{O(...M),T()}}let b=v?new Array(t.length).fill(Rr):Rr;const _=O=>{if(!(!(u.flags&1)||!u.dirty&&!O))if(e){const M=u.run();if(n||m||(v?M.some((G,V)=>vt(G,b[V])):vt(M,b))){d&&d();const G=Zt;Zt=u;try{const V=[M,b===Rr?void 0:v&&b[0]===Rr?[]:b,f];b=M,l?l(e,3,V):e(...V)}finally{Zt=G}}}else u.run()};return a&&a(_),u=new La(h),u.scheduler=o?()=>o(_,!1):_,f=O=>ou(O,!1,u),d=u.onStop=()=>{const O=qr.get(u);if(O){if(l)l(O,4);else for(const M of O)M();qr.delete(u)}},e?r?_(!0):b=u.run():o?o(_.bind(null,!0),!0):u.run(),T.pause=u.pause.bind(u),T.resume=u.resume.bind(u),T.stop=T,T}function Ct(t,e=1/0,s){if(e<=0||!ie(t)||t.__v_skip||(s=s||new Map,(s.get(t)||0)>=e))return t;if(s.set(t,e),e--,_e(t))Ct(t.value,e,s);else if(q(t))for(let r=0;r<t.length;r++)Ct(t[r],e,s);else if(ka(t)||Ts(t))t.forEach(r=>{Ct(r,e,s)});else if(Ra(t)){for(const r in t)Ct(t[r],e,s);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Ct(t[r],e,s)}return t}/**
9
+ **/let Ee;class ja{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Ee&&(Ee.active?(this.parent=Ee,this.index=(Ee.scopes||(Ee.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].pause();for(e=0,s=this.effects.length;e<s;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,s;if(this.scopes)for(e=0,s=this.scopes.length;e<s;e++)this.scopes[e].resume();for(e=0,s=this.effects.length;e<s;e++)this.effects[e].resume()}}run(e){if(this._active){const s=Ee;try{return Ee=this,e()}finally{Ee=s}}}on(){++this._on===1&&(this.prevScope=Ee,Ee=this)}off(){if(this._on>0&&--this._on===0){if(Ee===this)Ee=this.prevScope;else{let e=Ee;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let s,r;for(s=0,r=this.effects.length;s<r;s++)this.effects[s].stop();for(this.effects.length=0,s=0,r=this.cleanups.length;s<r;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,r=this.scopes.length;s<r;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Na(t){return new ja(t)}function $a(){return Ee}function Ic(t,e=!1){Ee&&Ee.cleanups.push(t)}let fe;const xn=new WeakSet;class La{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ee&&(Ee.active?Ee.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,xn.has(this)&&(xn.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Da(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Xi(this),Ba(this);const e=fe,s=nt;fe=this,nt=!0;try{return this.fn()}finally{Ma(this),fe=e,nt=s,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Oi(e);this.deps=this.depsTail=void 0,Xi(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?xn.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Gn(this)&&this.run()}get dirty(){return Gn(this)}}let Ua=0,zs,Ys;function Da(t,e=!1){if(t.flags|=8,e){t.next=Ys,Ys=t;return}t.next=zs,zs=t}function Ri(){Ua++}function xi(){if(--Ua>0)return;if(Ys){let e=Ys;for(Ys=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;zs;){let e=zs;for(zs=void 0;e;){const s=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=s}}if(t)throw t}function Ba(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Ma(t){let e,s=t.depsTail,r=s;for(;r;){const n=r.prevDep;r.version===-1?(r===s&&(s=n),Oi(r),jc(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=s}function Gn(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Ha(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Ha(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===or)||(t.globalVersion=or,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Gn(t))))return;t.flags|=2;const e=t.dep,s=fe,r=nt;fe=t,nt=!0;try{Ba(t);const n=t.fn(t._value);(e.version===0||vt(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{fe=s,nt=r,Ma(t),t.flags&=-3}}function Oi(t,e=!1){const{dep:s,prevSub:r,nextSub:n}=t;if(r&&(r.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=r,t.nextSub=void 0),s.subs===t&&(s.subs=r,!r&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)Oi(i,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function jc(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let nt=!0;const Fa=[];function It(){Fa.push(nt),nt=!1}function jt(){const t=Fa.pop();nt=t===void 0?!0:t}function Xi(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=fe;fe=void 0;try{e()}finally{fe=s}}}let or=0;class Nc{constructor(e,s){this.sub=e,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Ci{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!fe||!nt||fe===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==fe)s=this.activeLink=new Nc(fe,this),fe.deps?(s.prevDep=fe.depsTail,fe.depsTail.nextDep=s,fe.depsTail=s):fe.deps=fe.depsTail=s,qa(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const r=s.nextDep;r.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=r),s.prevDep=fe.depsTail,s.nextDep=void 0,fe.depsTail.nextDep=s,fe.depsTail=s,fe.deps===s&&(fe.deps=r)}return s}trigger(e){this.version++,or++,this.notify(e)}notify(e){Ri();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{xi()}}}function qa(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)qa(r)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const qr=new WeakMap,rs=Symbol(""),Jn=Symbol(""),ar=Symbol("");function Ce(t,e,s){if(nt&&fe){let r=qr.get(t);r||qr.set(t,r=new Map);let n=r.get(s);n||(r.set(s,n=new Ci),n.map=r,n.key=s),n.track()}}function Ot(t,e,s,r,n,i){const o=qr.get(t);if(!o){or++;return}const a=l=>{l&&l.trigger()};if(Ri(),e==="clear")o.forEach(a);else{const l=q(t),c=l&&an(s);if(l&&s==="length"){const u=Number(r);o.forEach((h,d)=>{(d==="length"||d===ar||!Ze(d)&&d>=u)&&a(h)})}else switch((s!==void 0||o.has(void 0))&&a(o.get(s)),c&&a(o.get(ar)),e){case"add":l?c&&a(o.get("length")):(a(o.get(rs)),Ts(t)&&a(o.get(Jn)));break;case"delete":l||(a(o.get(rs)),Ts(t)&&a(o.get(Jn)));break;case"set":Ts(t)&&a(o.get(rs));break}}xi()}function $c(t,e){const s=qr.get(t);return s&&s.get(e)}function ls(t){const e=se(t);return e===t?e:(Ce(e,"iterate",ar),Je(t)?e:e.map(it))}function un(t){return Ce(t=se(t),"iterate",ar),t}function gt(t,e){return Nt(t)?Is(Pt(t)?it(e):e):it(e)}const Lc={__proto__:null,[Symbol.iterator](){return On(this,Symbol.iterator,t=>gt(this,t))},concat(...t){return ls(this).concat(...t.map(e=>q(e)?ls(e):e))},entries(){return On(this,"entries",t=>(t[1]=gt(this,t[1]),t))},every(t,e){return St(this,"every",t,e,void 0,arguments)},filter(t,e){return St(this,"filter",t,e,s=>s.map(r=>gt(this,r)),arguments)},find(t,e){return St(this,"find",t,e,s=>gt(this,s),arguments)},findIndex(t,e){return St(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return St(this,"findLast",t,e,s=>gt(this,s),arguments)},findLastIndex(t,e){return St(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return St(this,"forEach",t,e,void 0,arguments)},includes(...t){return Cn(this,"includes",t)},indexOf(...t){return Cn(this,"indexOf",t)},join(t){return ls(this).join(t)},lastIndexOf(...t){return Cn(this,"lastIndexOf",t)},map(t,e){return St(this,"map",t,e,void 0,arguments)},pop(){return Ds(this,"pop")},push(...t){return Ds(this,"push",t)},reduce(t,...e){return Qi(this,"reduce",t,e)},reduceRight(t,...e){return Qi(this,"reduceRight",t,e)},shift(){return Ds(this,"shift")},some(t,e){return St(this,"some",t,e,void 0,arguments)},splice(...t){return Ds(this,"splice",t)},toReversed(){return ls(this).toReversed()},toSorted(t){return ls(this).toSorted(t)},toSpliced(...t){return ls(this).toSpliced(...t)},unshift(...t){return Ds(this,"unshift",t)},values(){return On(this,"values",t=>gt(this,t))}};function On(t,e,s){const r=un(t),n=r[e]();return r!==t&&!Je(t)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.done||(i.value=s(i.value)),i}),n}const Uc=Array.prototype;function St(t,e,s,r,n,i){const o=un(t),a=o!==t&&!Je(t),l=o[e];if(l!==Uc[e]){const h=l.apply(t,i);return a?it(h):h}let c=s;o!==t&&(a?c=function(h,d){return s.call(this,gt(t,h),d,t)}:s.length>2&&(c=function(h,d){return s.call(this,h,d,t)}));const u=l.call(o,c,r);return a&&n?n(u):u}function Qi(t,e,s,r){const n=un(t),i=n!==t&&!Je(t);let o=s,a=!1;n!==t&&(i?(a=r.length===0,o=function(c,u,h){return a&&(a=!1,c=gt(t,c)),s.call(this,c,gt(t,u),h,t)}):s.length>3&&(o=function(c,u,h){return s.call(this,c,u,h,t)}));const l=n[e](o,...r);return a?gt(t,l):l}function Cn(t,e,s){const r=se(t);Ce(r,"iterate",ar);const n=r[e](...s);return(n===-1||n===!1)&&hn(s[0])?(s[0]=se(s[0]),r[e](...s)):n}function Ds(t,e,s=[]){It(),Ri();const r=se(t)[e].apply(t,s);return xi(),jt(),r}const Dc=Si("__proto__,__v_isRef,__isVue"),Va=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Ze));function Bc(t){Ze(t)||(t=String(t));const e=se(this);return Ce(e,"has",t),e.hasOwnProperty(t)}class Ka{constructor(e=!1,s=!1){this._isReadonly=e,this._isShallow=s}get(e,s,r){if(s==="__v_skip")return e.__v_skip;const n=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!n;if(s==="__v_isReadonly")return n;if(s==="__v_isShallow")return i;if(s==="__v_raw")return r===(n?i?zc:za:i?Ja:Ga).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=q(e);if(!n){let l;if(o&&(l=Lc[s]))return l;if(s==="hasOwnProperty")return Bc}const a=Reflect.get(e,s,_e(e)?e:r);if((Ze(s)?Va.has(s):Dc(s))||(n||Ce(e,"get",s),i))return a;if(_e(a)){const l=o&&an(s)?a:a.value;return n&&oe(l)?Yn(l):l}return oe(a)?n?Yn(a):wr(a):a}}class Wa extends Ka{constructor(e=!1){super(!1,e)}set(e,s,r,n){let i=e[s];const o=q(e)&&an(s);if(!this._isShallow){const c=Nt(i);if(!Je(r)&&!Nt(r)&&(i=se(i),r=se(r)),!o&&_e(i)&&!_e(r))return c||(i.value=r),!0}const a=o?Number(s)<e.length:ie(e,s),l=Reflect.set(e,s,r,_e(e)?e:n);return e===se(n)&&(a?vt(r,i)&&Ot(e,"set",s,r):Ot(e,"add",s,r)),l}deleteProperty(e,s){const r=ie(e,s);e[s];const n=Reflect.deleteProperty(e,s);return n&&r&&Ot(e,"delete",s,void 0),n}has(e,s){const r=Reflect.has(e,s);return(!Ze(s)||!Va.has(s))&&Ce(e,"has",s),r}ownKeys(e){return Ce(e,"iterate",q(e)?"length":rs),Reflect.ownKeys(e)}}class Mc extends Ka{constructor(e=!1){super(!0,e)}set(e,s){return!0}deleteProperty(e,s){return!0}}const Hc=new Wa,Fc=new Mc,qc=new Wa(!0);const zn=t=>t,Ar=t=>Reflect.getPrototypeOf(t);function Vc(t,e,s){return function(...r){const n=this.__v_raw,i=se(n),o=Ts(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...r),u=s?zn:e?Is:it;return!e&&Ce(i,"iterate",l?Jn:rs),Oe(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function Rr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Kc(t,e){const s={get(n){const i=this.__v_raw,o=se(i),a=se(n);t||(vt(n,a)&&Ce(o,"get",n),Ce(o,"get",a));const{has:l}=Ar(o),c=e?zn:t?Is:it;if(l.call(o,n))return c(i.get(n));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(n)},get size(){const n=this.__v_raw;return!t&&Ce(se(n),"iterate",rs),n.size},has(n){const i=this.__v_raw,o=se(i),a=se(n);return t||(vt(n,a)&&Ce(o,"has",n),Ce(o,"has",a)),n===a?i.has(n):i.has(n)||i.has(a)},forEach(n,i){const o=this,a=o.__v_raw,l=se(a),c=e?zn:t?Is:it;return!t&&Ce(l,"iterate",rs),a.forEach((u,h)=>n.call(i,c(u),c(h),o))}};return Oe(s,t?{add:Rr("add"),set:Rr("set"),delete:Rr("delete"),clear:Rr("clear")}:{add(n){const i=se(this),o=Ar(i),a=se(n),l=!e&&!Je(n)&&!Nt(n)?a:n;return o.has.call(i,l)||vt(n,l)&&o.has.call(i,n)||vt(a,l)&&o.has.call(i,a)||(i.add(l),Ot(i,"add",l,l)),this},set(n,i){!e&&!Je(i)&&!Nt(i)&&(i=se(i));const o=se(this),{has:a,get:l}=Ar(o);let c=a.call(o,n);c||(n=se(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,i),c?vt(i,u)&&Ot(o,"set",n,i):Ot(o,"add",n,i),this},delete(n){const i=se(this),{has:o,get:a}=Ar(i);let l=o.call(i,n);l||(n=se(n),l=o.call(i,n)),a&&a.call(i,n);const c=i.delete(n);return l&&Ot(i,"delete",n,void 0),c},clear(){const n=se(this),i=n.size!==0,o=n.clear();return i&&Ot(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{s[n]=Vc(n,t,e)}),s}function Pi(t,e){const s=Kc(t,e);return(r,n,i)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(ie(s,n)&&n in r?s:r,n,i)}const Wc={get:Pi(!1,!1)},Gc={get:Pi(!1,!0)},Jc={get:Pi(!0,!1)};const Ga=new WeakMap,Ja=new WeakMap,za=new WeakMap,zc=new WeakMap;function Yc(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Xc(t){return t.__v_skip||!Object.isExtensible(t)?0:Yc(Sc(t))}function wr(t){return Nt(t)?t:Ii(t,!1,Hc,Wc,Ga)}function Ya(t){return Ii(t,!1,qc,Gc,Ja)}function Yn(t){return Ii(t,!0,Fc,Jc,za)}function Ii(t,e,s,r,n){if(!oe(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Xc(t);if(i===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,i===2?r:s);return n.set(t,a),a}function Pt(t){return Nt(t)?Pt(t.__v_raw):!!(t&&t.__v_isReactive)}function Nt(t){return!!(t&&t.__v_isReadonly)}function Je(t){return!!(t&&t.__v_isShallow)}function hn(t){return t?!!t.__v_raw:!1}function se(t){const e=t&&t.__v_raw;return e?se(e):t}function ji(t){return!ie(t,"__v_skip")&&Object.isExtensible(t)&&Oa(t,"__v_skip",!0),t}const it=t=>oe(t)?wr(t):t,Is=t=>oe(t)?Yn(t):t;function _e(t){return t?t.__v_isRef===!0:!1}function ae(t){return Xa(t,!1)}function Qc(t){return Xa(t,!0)}function Xa(t,e){return _e(t)?t:new Zc(t,e)}class Zc{constructor(e,s){this.dep=new Ci,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:se(e),this._value=s?e:it(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,r=this.__v_isShallow||Je(e)||Nt(e);e=r?e:se(e),vt(e,s)&&(this._rawValue=e,this._value=r?e:it(e),this.dep.trigger())}}function ce(t){return _e(t)?t.value:t}const eu={get:(t,e,s)=>e==="__v_raw"?t:ce(Reflect.get(t,e,s)),set:(t,e,s,r)=>{const n=t[e];return _e(n)&&!_e(s)?(n.value=s,!0):Reflect.set(t,e,s,r)}};function Qa(t){return Pt(t)?t:new Proxy(t,eu)}function tu(t){const e=q(t)?new Array(t.length):{};for(const s in t)e[s]=ru(t,s);return e}class su{constructor(e,s,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=Ze(s)?s:String(s),this._raw=se(e);let n=!0,i=e;if(!q(e)||Ze(this._key)||!an(this._key))do n=!hn(i)||Je(i);while(n&&(i=i.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=ce(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&_e(this._raw[this._key])){const s=this._object[this._key];if(_e(s)){s.value=e;return}}this._object[this._key]=e}get dep(){return $c(this._raw,this._key)}}function ru(t,e,s){return new su(t,e,s)}class nu{constructor(e,s,r){this.fn=e,this.setter=s,this._value=void 0,this.dep=new Ci(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=or-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&fe!==this)return Da(this,!0),!0}get value(){const e=this.dep.track();return Ha(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function iu(t,e,s=!1){let r,n;return Y(t)?r=t:(r=t.get,n=t.set),new nu(r,n,s)}const xr={},Vr=new WeakMap;let Zt;function ou(t,e=!1,s=Zt){if(s){let r=Vr.get(s);r||Vr.set(s,r=[]),r.push(t)}}function au(t,e,s=ue){const{immediate:r,deep:n,once:i,scheduler:o,augmentJob:a,call:l}=s,c=x=>n?x:Je(x)||n===!1||n===0?Ct(x,1):Ct(x);let u,h,d,f,m=!1,y=!1;if(_e(t)?(h=()=>t.value,m=Je(t)):Pt(t)?(h=()=>c(t),m=!0):q(t)?(y=!0,m=t.some(x=>Pt(x)||Je(x)),h=()=>t.map(x=>{if(_e(x))return x.value;if(Pt(x))return c(x);if(Y(x))return l?l(x,2):x()})):Y(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){It();try{d()}finally{jt()}}const x=Zt;Zt=u;try{return l?l(t,3,[f]):t(f)}finally{Zt=x}}:h=_t,e&&n){const x=h,M=n===!0?1/0:n;h=()=>Ct(x(),M)}const _=$a(),S=()=>{u.stop(),_&&_.active&&Ei(_.effects,u)};if(i&&e){const x=e;e=(...M)=>{x(...M),S()}}let w=y?new Array(t.length).fill(xr):xr;const b=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(e){const M=u.run();if(n||m||(y?M.some((z,V)=>vt(z,w[V])):vt(M,w))){d&&d();const z=Zt;Zt=u;try{const V=[M,w===xr?void 0:y&&w[0]===xr?[]:w,f];w=M,l?l(e,3,V):e(...V)}finally{Zt=z}}}else u.run()};return a&&a(b),u=new La(h),u.scheduler=o?()=>o(b,!1):b,f=x=>ou(x,!1,u),d=u.onStop=()=>{const x=Vr.get(u);if(x){if(l)l(x,4);else for(const M of x)M();Vr.delete(u)}},e?r?b(!0):w=u.run():o?o(b.bind(null,!0),!0):u.run(),S.pause=u.pause.bind(u),S.resume=u.resume.bind(u),S.stop=S,S}function Ct(t,e=1/0,s){if(e<=0||!oe(t)||t.__v_skip||(s=s||new Map,(s.get(t)||0)>=e))return t;if(s.set(t,e),e--,_e(t))Ct(t.value,e,s);else if(q(t))for(let r=0;r<t.length;r++)Ct(t[r],e,s);else if(ka(t)||Ts(t))t.forEach(r=>{Ct(r,e,s)});else if(Ra(t)){for(const r in t)Ct(t[r],e,s);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Ct(t[r],e,s)}return t}/**
10
10
  * @vue/runtime-core v3.5.34
11
11
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
12
  * @license MIT
13
- **/function wr(t,e,s,r){try{return r?t(...r):t()}catch(n){hn(n,e,s)}}function bt(t,e,s,r){if(J(t)){const n=wr(t,e,s,r);return n&&Ta(n)&&n.catch(i=>{hn(i,e,s)}),n}if(q(t)){const n=[];for(let i=0;i<t.length;i++)n.push(bt(t[i],e,s,r));return n}}function hn(t,e,s,r=!0){const n=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ce;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${s}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){It(),wr(i,null,10,[t,l,c]),jt();return}}lu(t,s,n,r,o)}function lu(t,e,s,r=!0,n=!1){if(n)throw t;console.error(t)}const Ne=[];let ft=-1;const As=[];let Ft=null,gs=0;const Za=Promise.resolve();let Vr=null;function dn(t){const e=Vr||Za;return t?e.then(this?t.bind(this):t):e}function cu(t){let e=ft+1,s=Ne.length;for(;e<s;){const r=e+s>>>1,n=Ne[r],i=ar(n);i<t||i===t&&n.flags&2?e=r+1:s=r}return e}function Ni(t){if(!(t.flags&1)){const e=ar(t),s=Ne[Ne.length-1];!s||!(t.flags&2)&&e>=ar(s)?Ne.push(t):Ne.splice(cu(e),0,t),t.flags|=1,el()}}function el(){Vr||(Vr=Za.then(sl))}function uu(t){q(t)?As.push(...t):Ft&&t.id===-1?Ft.splice(gs+1,0,t):t.flags&1||(As.push(t),t.flags|=1),el()}function Zi(t,e,s=ft+1){for(;s<Ne.length;s++){const r=Ne[s];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ne.splice(s,1),s--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function tl(t){if(As.length){const e=[...new Set(As)].sort((s,r)=>ar(s)-ar(r));if(As.length=0,Ft){Ft.push(...e);return}for(Ft=e,gs=0;gs<Ft.length;gs++){const s=Ft[gs];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}Ft=null,gs=0}}const ar=t=>t.id==null?t.flags&2?-1:1/0:t.id;function sl(t){try{for(ft=0;ft<Ne.length;ft++){const e=Ne[ft];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),wr(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;ft<Ne.length;ft++){const e=Ne[ft];e&&(e.flags&=-2)}ft=-1,Ne.length=0,tl(),Vr=null,(Ne.length||As.length)&&sl()}}let ze=null,rl=null;function Kr(t){const e=ze;return ze=t,rl=t&&t.type.__scopeId||null,e}function Hs(t,e=ze,s){if(!e||t._n)return t;const r=(...n)=>{r._d&&Jr(-1);const i=Kr(e);let o;try{o=t(...n)}finally{Kr(i),r._d&&Jr(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Rs(t,e){if(ze===null)return t;const s=vn(ze),r=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[i,o,a,l=ce]=e[n];i&&(J(i)&&(i={mounted:i,updated:i}),i.deep&&Ct(o),r.push({dir:i,instance:s,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function zt(t,e,s,r){const n=t.dirs,i=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];i&&(a.oldValue=i[o].value);let l=a.dir[r];l&&(It(),bt(l,s,8,[t.el,a,t,e]),jt())}}function Br(t,e){if($e){let s=$e.provides;const r=$e.parent&&$e.parent.provides;r===s&&(s=$e.provides=Object.create(r)),s[t]=e}}function Ye(t,e,s=!1){const r=Ol();if(r||ns){let n=ns?ns._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return s&&J(e)?e.call(r&&r.proxy):e}}function hu(){return!!(Ol()||ns)}const du=Symbol.for("v-scx"),fu=()=>Ye(du);function Os(t,e,s){return nl(t,e,s)}function nl(t,e,s=ce){const{immediate:r,deep:n,flush:i,once:o}=s,a=xe({},s),l=e&&r||!e&&i!=="post";let c;if(cr){if(i==="sync"){const f=fu();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=_t,f.resume=_t,f.pause=_t,f}}const u=$e;a.call=(f,m,v)=>bt(f,u,m,v);let h=!1;i==="post"?a.scheduler=f=>{Be(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,m)=>{m?f():Ni(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=au(t,e,a);return cr&&(c?c.push(d):l&&d()),d}function pu(t,e,s){const r=this.proxy,n=ve(t)?t.includes(".")?il(r,t):()=>r[t]:t.bind(r,r);let i;J(e)?i=e:(i=e.handler,s=e);const o=Sr(this),a=nl(n,i.bind(r),s);return o(),a}function il(t,e){const s=e.split(".");return()=>{let r=t;for(let n=0;n<s.length&&r;n++)r=r[s[n]];return r}}const gu=Symbol("_vte"),mu=t=>t.__isTeleport,yu=Symbol("_leaveCb");function $i(t,e){t.shapeFlag&6&&t.component?(t.transition=e,$i(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function $t(t,e){return J(t)?xe({name:t.name},e,{setup:t}):t}function ol(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function eo(t,e){let s;return!!((s=Object.getOwnPropertyDescriptor(t,e))&&!s.configurable)}const Wr=new WeakMap;function Ys(t,e,s,r,n=!1){if(q(t)){t.forEach((v,A)=>Ys(v,e&&(q(e)?e[A]:e),s,r,n));return}if(Xs(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ys(t,e,s,r.component.subTree);return}const i=r.shapeFlag&4?vn(r.component):r.el,o=n?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ce?a.refs={}:a.refs,h=a.setupState,d=te(h),f=h===ce?Ea:v=>eo(u,v)?!1:ne(d,v),m=(v,A)=>!(A&&eo(u,A));if(c!=null&&c!==l){if(to(e),ve(c))u[c]=null,f(c)&&(h[c]=null);else if(_e(c)){const v=e;m(c,v.k)&&(c.value=null),v.k&&(u[v.k]=null)}}if(J(l))wr(l,a,12,[o,u]);else{const v=ve(l),A=_e(l);if(v||A){const T=()=>{if(t.f){const b=v?f(l)?h[l]:u[l]:m()||!t.k?l.value:u[t.k];if(n)q(b)&&Ei(b,i);else if(q(b))b.includes(i)||b.push(i);else if(v)u[l]=[i],f(l)&&(h[l]=u[l]);else{const _=[i];m(l,t.k)&&(l.value=_),t.k&&(u[t.k]=_)}}else v?(u[l]=o,f(l)&&(h[l]=o)):A&&(m(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const b=()=>{T(),Wr.delete(t)};b.id=-1,Wr.set(t,b),Be(b,s)}else to(t),T()}}}function to(t){const e=Wr.get(t);e&&(e.flags|=8,Wr.delete(t))}ln().requestIdleCallback;ln().cancelIdleCallback;const Xs=t=>!!t.type.__asyncLoader,al=t=>t.type.__isKeepAlive;function vu(t,e){ll(t,"a",e)}function _u(t,e){ll(t,"da",e)}function ll(t,e,s=$e){const r=t.__wdc||(t.__wdc=()=>{let n=s;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(fn(e,r,s),s){let n=s.parent;for(;n&&n.parent;)al(n.parent.vnode)&&bu(r,e,s,n),n=n.parent}}function bu(t,e,s,r){const n=fn(e,t,r,!0);Li(()=>{Ei(r[e],n)},s)}function fn(t,e,s=$e,r=!1){if(s){const n=s[t]||(s[t]=[]),i=e.__weh||(e.__weh=(...o)=>{It();const a=Sr(s),l=bt(e,s,t,o);return a(),jt(),l});return r?n.unshift(i):n.push(i),i}}const Lt=t=>(e,s=$e)=>{(!cr||t==="sp")&&fn(t,(...r)=>e(...r),s)},wu=Lt("bm"),pn=Lt("m"),Su=Lt("bu"),Eu=Lt("u"),ku=Lt("bum"),Li=Lt("um"),Tu=Lt("sp"),Au=Lt("rtg"),Ru=Lt("rtc");function Ou(t,e=$e){fn("ec",t,e)}const xu=Symbol.for("v-ndc");function gn(t,e,s,r){let n;const i=s,o=q(t);if(o||ve(t)){const a=o&&Pt(t);let l=!1,c=!1;a&&(l=!We(t),c=Nt(t),t=cn(t)),n=new Array(t.length);for(let u=0,h=t.length;u<h;u++)n[u]=e(l?c?Ps(it(t[u])):it(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,i)}else if(ie(t))if(t[Symbol.iterator])n=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);n=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];n[l]=e(t[u],u,l,i)}}else n=[];return n}const Xn=t=>t?xl(t)?vn(t):Xn(t.parent):null,Qs=xe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Xn(t.parent),$root:t=>Xn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>ul(t),$forceUpdate:t=>t.f||(t.f=()=>{Ni(t.update)}),$nextTick:t=>t.n||(t.n=dn.bind(t.proxy)),$watch:t=>pu.bind(t)}),Pn=(t,e)=>t!==ce&&!t.__isScriptSetup&&ne(t,e),Cu={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:r,data:n,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return r[e];case 2:return n[e];case 4:return s[e];case 3:return i[e]}else{if(Pn(r,e))return o[e]=1,r[e];if(n!==ce&&ne(n,e))return o[e]=2,n[e];if(ne(i,e))return o[e]=3,i[e];if(s!==ce&&ne(s,e))return o[e]=4,s[e];Qn&&(o[e]=0)}}const c=Qs[e];let u,h;if(c)return e==="$attrs"&&Ce(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(s!==ce&&ne(s,e))return o[e]=4,s[e];if(h=l.config.globalProperties,ne(h,e))return h[e]},set({_:t},e,s){const{data:r,setupState:n,ctx:i}=t;return Pn(n,e)?(n[e]=s,!0):r!==ce&&ne(r,e)?(r[e]=s,!0):ne(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:r,appContext:n,props:i,type:o}},a){let l;return!!(s[a]||t!==ce&&a[0]!=="$"&&ne(t,a)||Pn(e,a)||ne(i,a)||ne(r,a)||ne(Qs,a)||ne(n.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:ne(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function so(t){return q(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let Qn=!0;function Pu(t){const e=ul(t),s=t.proxy,r=t.ctx;Qn=!1,e.beforeCreate&&ro(e.beforeCreate,t,"bc");const{data:n,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:m,activated:v,deactivated:A,beforeDestroy:T,beforeUnmount:b,destroyed:_,unmounted:O,render:M,renderTracked:G,renderTriggered:V,errorCaptured:Y,serverPrefetch:K,expose:ge,inheritAttrs:Pe,components:Me,directives:Le,filters:Gt}=e;if(c&&Iu(c,r,null),o)for(const z in o){const se=o[z];J(se)&&(r[z]=se.bind(s))}if(n){const z=n.call(s,s);ie(z)&&(t.data=br(z))}if(Qn=!0,i)for(const z in i){const se=i[z],wt=J(se)?se.bind(s,s):J(se.get)?se.get.bind(s,s):_t,Bt=!J(se)&&J(se.set)?se.set.bind(s):_t,at=qe({get:wt,set:Bt});Object.defineProperty(r,z,{enumerable:!0,configurable:!0,get:()=>at.value,set:Ue=>at.value=Ue})}if(a)for(const z in a)cl(a[z],r,s,z);if(l){const z=J(l)?l.call(s):l;Reflect.ownKeys(z).forEach(se=>{Br(se,z[se])})}u&&ro(u,t,"c");function pe(z,se){q(se)?se.forEach(wt=>z(wt.bind(s))):se&&z(se.bind(s))}if(pe(wu,h),pe(pn,d),pe(Su,f),pe(Eu,m),pe(vu,v),pe(_u,A),pe(Ou,Y),pe(Ru,G),pe(Au,V),pe(ku,b),pe(Li,O),pe(Tu,K),q(ge))if(ge.length){const z=t.exposed||(t.exposed={});ge.forEach(se=>{Object.defineProperty(z,se,{get:()=>s[se],set:wt=>s[se]=wt,enumerable:!0})})}else t.exposed||(t.exposed={});M&&t.render===_t&&(t.render=M),Pe!=null&&(t.inheritAttrs=Pe),Me&&(t.components=Me),Le&&(t.directives=Le),K&&ol(t)}function Iu(t,e,s=_t){q(t)&&(t=Zn(t));for(const r in t){const n=t[r];let i;ie(n)?"default"in n?i=Ye(n.from||r,n.default,!0):i=Ye(n.from||r):i=Ye(n),_e(i)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[r]=i}}function ro(t,e,s){bt(q(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,s)}function cl(t,e,s,r){let n=r.includes(".")?il(s,r):()=>s[r];if(ve(t)){const i=e[t];J(i)&&Os(n,i)}else if(J(t))Os(n,t.bind(s));else if(ie(t))if(q(t))t.forEach(i=>cl(i,e,s,r));else{const i=J(t.handler)?t.handler.bind(s):e[t.handler];J(i)&&Os(n,i,t)}}function ul(t){const e=t.type,{mixins:s,extends:r}=e,{mixins:n,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!n.length&&!s&&!r?l=e:(l={},n.length&&n.forEach(c=>Gr(l,c,o,!0)),Gr(l,e,o)),ie(e)&&i.set(e,l),l}function Gr(t,e,s,r=!1){const{mixins:n,extends:i}=e;i&&Gr(t,i,s,!0),n&&n.forEach(o=>Gr(t,o,s,!0));for(const o in e)if(!(r&&o==="expose")){const a=ju[o]||s&&s[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const ju={data:no,props:io,emits:io,methods:Fs,computed:Fs,beforeCreate:Ie,created:Ie,beforeMount:Ie,mounted:Ie,beforeUpdate:Ie,updated:Ie,beforeDestroy:Ie,beforeUnmount:Ie,destroyed:Ie,unmounted:Ie,activated:Ie,deactivated:Ie,errorCaptured:Ie,serverPrefetch:Ie,components:Fs,directives:Fs,watch:$u,provide:no,inject:Nu};function no(t,e){return e?t?function(){return xe(J(t)?t.call(this,this):t,J(e)?e.call(this,this):e)}:e:t}function Nu(t,e){return Fs(Zn(t),Zn(e))}function Zn(t){if(q(t)){const e={};for(let s=0;s<t.length;s++)e[t[s]]=t[s];return e}return t}function Ie(t,e){return t?[...new Set([].concat(t,e))]:e}function Fs(t,e){return t?xe(Object.create(null),t,e):e}function io(t,e){return t?q(t)&&q(e)?[...new Set([...t,...e])]:xe(Object.create(null),so(t),so(e??{})):e}function $u(t,e){if(!t)return e;if(!e)return t;const s=xe(Object.create(null),t);for(const r in e)s[r]=Ie(t[r],e[r]);return s}function hl(){return{app:null,config:{isNativeTag:Ea,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Lu=0;function Uu(t,e){return function(r,n=null){J(r)||(r=xe({},r)),n!=null&&!ie(n)&&(n=null);const i=hl(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Lu++,_component:r,_props:n,_container:null,_context:i,_instance:null,version:gh,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&J(u.install)?(o.add(u),u.install(c,...h)):J(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||ke(r,n);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,vn(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(bt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=ns;ns=c;try{return u()}finally{ns=h}}};return c}}let ns=null;const Du=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${st(e)}Modifiers`]||t[`${is(e)}Modifiers`];function Bu(t,e,...s){if(t.isUnmounted)return;const r=t.vnode.props||ce;let n=s;const i=e.startsWith("update:"),o=i&&Du(r,e.slice(7));o&&(o.trim&&(n=s.map(u=>ve(u)?u.trim():u)),o.number&&(n=s.map(ki)));let a,l=r[a=An(e)]||r[a=An(st(e))];!l&&i&&(l=r[a=An(is(e))]),l&&bt(l,t,6,n);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,bt(c,t,6,n)}}const Mu=new WeakMap;function dl(t,e,s=!1){const r=s?Mu:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const i=t.emits;let o={},a=!1;if(!J(t)){const l=c=>{const u=dl(c,e,!0);u&&(a=!0,xe(o,u))};!s&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(ie(t)&&r.set(t,null),null):(q(i)?i.forEach(l=>o[l]=null):xe(o,i),ie(t)&&r.set(t,o),o)}function mn(t,e){return!t||!rn(e)?!1:(e=e.slice(2).replace(/Once$/,""),ne(t,e[0].toLowerCase()+e.slice(1))||ne(t,is(e))||ne(t,e))}function oo(t){const{type:e,vnode:s,proxy:r,withProxy:n,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:m,inheritAttrs:v}=t,A=Kr(t);let T,b;try{if(s.shapeFlag&4){const O=n||r,M=O;T=mt(c.call(M,O,u,h,f,d,m)),b=a}else{const O=e;T=mt(O.length>1?O(h,{attrs:a,slots:o,emit:l}):O(h,null)),b=e.props?a:Hu(a)}}catch(O){Zs.length=0,hn(O,t,1),T=ke(Wt)}let _=T;if(b&&v!==!1){const O=Object.keys(b),{shapeFlag:M}=_;O.length&&M&7&&(i&&O.some(nn)&&(b=Fu(b,i)),_=Is(_,b,!1,!0))}return s.dirs&&(_=Is(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(s.dirs):s.dirs),s.transition&&$i(_,s.transition),T=_,Kr(A),T}const Hu=t=>{let e;for(const s in t)(s==="class"||s==="style"||rn(s))&&((e||(e={}))[s]=t[s]);return e},Fu=(t,e)=>{const s={};for(const r in t)(!nn(r)||!(r.slice(9)in e))&&(s[r]=t[r]);return s};function qu(t,e,s){const{props:r,children:n,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&l>=0){if(l&1024)return!0;if(l&16)return r?ao(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(fl(o,r,d)&&!mn(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?ao(r,o,c):!0:!!o;return!1}function ao(t,e,s){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let n=0;n<r.length;n++){const i=r[n];if(fl(e,t,i)&&!mn(s,i))return!0}return!1}function fl(t,e,s){const r=t[s],n=e[s];return s==="style"&&ie(r)&&ie(n)?!Ai(r,n):r!==n}function Vu({vnode:t,parent:e,suspense:s},r){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===t&&(n.suspense.vnode.el=n.el=r,t=n),n===t)(t=e.vnode).el=r,e=e.parent;else break}s&&s.activeBranch===t&&(s.vnode.el=r)}const pl={},gl=()=>Object.create(pl),ml=t=>Object.getPrototypeOf(t)===pl;function Ku(t,e,s,r=!1){const n={},i=gl();t.propsDefaults=Object.create(null),yl(t,e,n,i);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);s?t.props=r?n:Ya(n):t.type.props?t.props=n:t.props=i,t.attrs=i}function Wu(t,e,s,r){const{props:n,attrs:i,vnode:{patchFlag:o}}=t,a=te(n),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(mn(t.emitsOptions,d))continue;const f=e[d];if(l)if(ne(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const m=st(d);n[m]=ei(l,a,m,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{yl(t,e,n,i)&&(c=!0);let u;for(const h in a)(!e||!ne(e,h)&&((u=is(h))===h||!ne(e,u)))&&(l?s&&(s[h]!==void 0||s[u]!==void 0)&&(n[h]=ei(l,a,h,void 0,t,!0)):delete n[h]);if(i!==a)for(const h in i)(!e||!ne(e,h))&&(delete i[h],c=!0)}c&&xt(t.attrs,"set","")}function yl(t,e,s,r){const[n,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(Gs(l))continue;const c=e[l];let u;n&&ne(n,u=st(l))?!i||!i.includes(u)?s[u]=c:(a||(a={}))[u]=c:mn(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=te(s),c=a||ce;for(let u=0;u<i.length;u++){const h=i[u];s[h]=ei(n,l,h,c[h],t,!ne(c,h))}}return o}function ei(t,e,s,r,n,i){const o=t[s];if(o!=null){const a=ne(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&J(l)){const{propsDefaults:c}=n;if(s in c)r=c[s];else{const u=Sr(n);r=c[s]=l.call(null,e),u()}}else r=l;n.ce&&n.ce._setProp(s,r)}o[0]&&(i&&!a?r=!1:o[1]&&(r===""||r===is(s))&&(r=!0))}return r}const Gu=new WeakMap;function vl(t,e,s=!1){const r=s?Gu:e.propsCache,n=r.get(t);if(n)return n;const i=t.props,o={},a=[];let l=!1;if(!J(t)){const u=h=>{l=!0;const[d,f]=vl(h,e,!0);xe(o,d),f&&a.push(...f)};!s&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return ie(t)&&r.set(t,ks),ks;if(q(i))for(let u=0;u<i.length;u++){const h=st(i[u]);lo(h)&&(o[h]=ce)}else if(i)for(const u in i){const h=st(u);if(lo(h)){const d=i[u],f=o[h]=q(d)||J(d)?{type:d}:xe({},d),m=f.type;let v=!1,A=!0;if(q(m))for(let T=0;T<m.length;++T){const b=m[T],_=J(b)&&b.name;if(_==="Boolean"){v=!0;break}else _==="String"&&(A=!1)}else v=J(m)&&m.name==="Boolean";f[0]=v,f[1]=A,(v||ne(f,"default"))&&a.push(h)}}const c=[o,a];return ie(t)&&r.set(t,c),c}function lo(t){return t[0]!=="$"&&!Gs(t)}const Ui=t=>t==="_"||t==="_ctx"||t==="$stable",Di=t=>q(t)?t.map(mt):[mt(t)],Ju=(t,e,s)=>{if(e._n)return e;const r=Hs((...n)=>Di(e(...n)),s);return r._c=!1,r},_l=(t,e,s)=>{const r=t._ctx;for(const n in t){if(Ui(n))continue;const i=t[n];if(J(i))e[n]=Ju(n,i,r);else if(i!=null){const o=Di(i);e[n]=()=>o}}},bl=(t,e)=>{const s=Di(e);t.slots.default=()=>s},wl=(t,e,s)=>{for(const r in e)(s||!Ui(r))&&(t[r]=e[r])},zu=(t,e,s)=>{const r=t.slots=gl();if(t.vnode.shapeFlag&32){const n=e._;n?(wl(r,e,s),s&&xa(r,"_",n,!0)):_l(e,r)}else e&&bl(t,e)},Yu=(t,e,s)=>{const{vnode:r,slots:n}=t;let i=!0,o=ce;if(r.shapeFlag&32){const a=e._;a?s&&a===1?i=!1:wl(n,e,s):(i=!e.$stable,_l(e,n)),o=e}else e&&(bl(t,e),o={default:1});if(i)for(const a in n)!Ui(a)&&o[a]==null&&delete n[a]},Be=th;function Xu(t){return Qu(t)}function Qu(t,e){const s=ln();s.__VUE__=!0;const{insert:r,remove:n,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=_t,insertStaticContent:m}=t,v=(p,g,y,w=null,k=null,S=null,j=void 0,C=null,x=!!g.dynamicChildren)=>{if(p===g)return;p&&!Ds(p,g)&&(w=E(p),Ue(p,k,S,!0),p=null),g.patchFlag===-2&&(x=!1,g.dynamicChildren=null);const{type:R,ref:H,shapeFlag:$}=g;switch(R){case yn:A(p,g,y,w);break;case Wt:T(p,g,y,w);break;case jn:p==null&&b(g,y,w,j);break;case Fe:Me(p,g,y,w,k,S,j,C,x);break;default:$&1?M(p,g,y,w,k,S,j,C,x):$&6?Le(p,g,y,w,k,S,j,C,x):($&64||$&128)&&R.process(p,g,y,w,k,S,j,C,x,D)}H!=null&&k?Ys(H,p&&p.ref,S,g||p,!g):H==null&&p&&p.ref!=null&&Ys(p.ref,null,S,p,!0)},A=(p,g,y,w)=>{if(p==null)r(g.el=a(g.children),y,w);else{const k=g.el=p.el;g.children!==p.children&&c(k,g.children)}},T=(p,g,y,w)=>{p==null?r(g.el=l(g.children||""),y,w):g.el=p.el},b=(p,g,y,w)=>{[p.el,p.anchor]=m(p.children,g,y,w,p.el,p.anchor)},_=({el:p,anchor:g},y,w)=>{let k;for(;p&&p!==g;)k=d(p),r(p,y,w),p=k;r(g,y,w)},O=({el:p,anchor:g})=>{let y;for(;p&&p!==g;)y=d(p),n(p),p=y;n(g)},M=(p,g,y,w,k,S,j,C,x)=>{if(g.type==="svg"?j="svg":g.type==="math"&&(j="mathml"),p==null)G(g,y,w,k,S,j,C,x);else{const R=p.el&&p.el._isVueCE?p.el:null;try{R&&R._beginPatch(),K(p,g,k,S,j,C,x)}finally{R&&R._endPatch()}}},G=(p,g,y,w,k,S,j,C)=>{let x,R;const{props:H,shapeFlag:$,transition:B,dirs:W}=p;if(x=p.el=o(p.type,S,H&&H.is,H),$&8?u(x,p.children):$&16&&Y(p.children,x,null,w,k,In(p,S),j,C),W&&zt(p,null,w,"created"),V(x,p,p.scopeId,j,w),H){for(const oe in H)oe!=="value"&&!Gs(oe)&&i(x,oe,null,H[oe],S,w);"value"in H&&i(x,"value",null,H.value,S),(R=H.onVnodeBeforeMount)&&ht(R,w,p)}W&&zt(p,null,w,"beforeMount");const ee=Zu(k,B);ee&&B.beforeEnter(x),r(x,g,y),((R=H&&H.onVnodeMounted)||ee||W)&&Be(()=>{try{R&&ht(R,w,p),ee&&B.enter(x),W&&zt(p,null,w,"mounted")}finally{}},k)},V=(p,g,y,w,k)=>{if(y&&f(p,y),w)for(let S=0;S<w.length;S++)f(p,w[S]);if(k){let S=k.subTree;if(g===S||Tl(S.type)&&(S.ssContent===g||S.ssFallback===g)){const j=k.vnode;V(p,j,j.scopeId,j.slotScopeIds,k.parent)}}},Y=(p,g,y,w,k,S,j,C,x=0)=>{for(let R=x;R<p.length;R++){const H=p[R]=C?Ot(p[R]):mt(p[R]);v(null,H,g,y,w,k,S,j,C)}},K=(p,g,y,w,k,S,j)=>{const C=g.el=p.el;let{patchFlag:x,dynamicChildren:R,dirs:H}=g;x|=p.patchFlag&16;const $=p.props||ce,B=g.props||ce;let W;if(y&&Yt(y,!1),(W=B.onVnodeBeforeUpdate)&&ht(W,y,g,p),H&&zt(g,p,y,"beforeUpdate"),y&&Yt(y,!0),($.innerHTML&&B.innerHTML==null||$.textContent&&B.textContent==null)&&u(C,""),R?ge(p.dynamicChildren,R,C,y,w,In(g,k),S):j||se(p,g,C,null,y,w,In(g,k),S,!1),x>0){if(x&16)Pe(C,$,B,y,k);else if(x&2&&$.class!==B.class&&i(C,"class",null,B.class,k),x&4&&i(C,"style",$.style,B.style,k),x&8){const ee=g.dynamicProps;for(let oe=0;oe<ee.length;oe++){const he=ee[oe],be=$[he],Ae=B[he];(Ae!==be||he==="value")&&i(C,he,be,Ae,k,y)}}x&1&&p.children!==g.children&&u(C,g.children)}else!j&&R==null&&Pe(C,$,B,y,k);((W=B.onVnodeUpdated)||H)&&Be(()=>{W&&ht(W,y,g,p),H&&zt(g,p,y,"updated")},w)},ge=(p,g,y,w,k,S,j)=>{for(let C=0;C<g.length;C++){const x=p[C],R=g[C],H=x.el&&(x.type===Fe||!Ds(x,R)||x.shapeFlag&198)?h(x.el):y;v(x,R,H,null,w,k,S,j,!0)}},Pe=(p,g,y,w,k)=>{if(g!==y){if(g!==ce)for(const S in g)!Gs(S)&&!(S in y)&&i(p,S,g[S],null,k,w);for(const S in y){if(Gs(S))continue;const j=y[S],C=g[S];j!==C&&S!=="value"&&i(p,S,C,j,k,w)}"value"in y&&i(p,"value",g.value,y.value,k)}},Me=(p,g,y,w,k,S,j,C,x)=>{const R=g.el=p?p.el:a(""),H=g.anchor=p?p.anchor:a("");let{patchFlag:$,dynamicChildren:B,slotScopeIds:W}=g;W&&(C=C?C.concat(W):W),p==null?(r(R,y,w),r(H,y,w),Y(g.children||[],y,H,k,S,j,C,x)):$>0&&$&64&&B&&p.dynamicChildren&&p.dynamicChildren.length===B.length?(ge(p.dynamicChildren,B,y,k,S,j,C),(g.key!=null||k&&g===k.subTree)&&Sl(p,g,!0)):se(p,g,y,H,k,S,j,C,x)},Le=(p,g,y,w,k,S,j,C,x)=>{g.slotScopeIds=C,p==null?g.shapeFlag&512?k.ctx.activate(g,y,w,j,x):Gt(g,y,w,k,S,j,x):Dt(p,g,x)},Gt=(p,g,y,w,k,S,j)=>{const C=p.component=ch(p,w,k);if(al(p)&&(C.ctx.renderer=D),uh(C,!1,j),C.asyncDep){if(k&&k.registerDep(C,pe,j),!p.el){const x=C.subTree=ke(Wt);T(null,x,g,y),p.placeholder=x.el}}else pe(C,p,g,y,k,S,j)},Dt=(p,g,y)=>{const w=g.component=p.component;if(qu(p,g,y))if(w.asyncDep&&!w.asyncResolved){z(w,g,y);return}else w.next=g,w.update();else g.el=p.el,w.vnode=g},pe=(p,g,y,w,k,S,j)=>{const C=()=>{if(p.isMounted){let{next:$,bu:B,u:W,parent:ee,vnode:oe}=p;{const ct=El(p);if(ct){$&&($.el=oe.el,z(p,$,j)),ct.asyncDep.then(()=>{Be(()=>{p.isUnmounted||R()},k)});return}}let he=$,be;Yt(p,!1),$?($.el=oe.el,z(p,$,j)):$=oe,B&&Dr(B),(be=$.props&&$.props.onVnodeBeforeUpdate)&&ht(be,ee,$,oe),Yt(p,!0);const Ae=oo(p),lt=p.subTree;p.subTree=Ae,v(lt,Ae,h(lt.el),E(lt),p,k,S),$.el=Ae.el,he===null&&Vu(p,Ae.el),W&&Be(W,k),(be=$.props&&$.props.onVnodeUpdated)&&Be(()=>ht(be,ee,$,oe),k)}else{let $;const{el:B,props:W}=g,{bm:ee,m:oe,parent:he,root:be,type:Ae}=p,lt=Xs(g);Yt(p,!1),ee&&Dr(ee),!lt&&($=W&&W.onVnodeBeforeMount)&&ht($,he,g),Yt(p,!0);{be.ce&&be.ce._hasShadowRoot()&&be.ce._injectChildStyle(Ae,p.parent?p.parent.type:void 0);const ct=p.subTree=oo(p);v(null,ct,y,w,p,k,S),g.el=ct.el}if(oe&&Be(oe,k),!lt&&($=W&&W.onVnodeMounted)){const ct=g;Be(()=>ht($,he,ct),k)}(g.shapeFlag&256||he&&Xs(he.vnode)&&he.vnode.shapeFlag&256)&&p.a&&Be(p.a,k),p.isMounted=!0,g=y=w=null}};p.scope.on();const x=p.effect=new La(C);p.scope.off();const R=p.update=x.run.bind(x),H=p.job=x.runIfDirty.bind(x);H.i=p,H.id=p.uid,x.scheduler=()=>Ni(H),Yt(p,!0),R()},z=(p,g,y)=>{g.component=p;const w=p.vnode.props;p.vnode=g,p.next=null,Wu(p,g.props,w,y),Yu(p,g.children,y),It(),Zi(p),jt()},se=(p,g,y,w,k,S,j,C,x=!1)=>{const R=p&&p.children,H=p?p.shapeFlag:0,$=g.children,{patchFlag:B,shapeFlag:W}=g;if(B>0){if(B&128){Bt(R,$,y,w,k,S,j,C,x);return}else if(B&256){wt(R,$,y,w,k,S,j,C,x);return}}W&8?(H&16&&Ge(R,k,S),$!==R&&u(y,$)):H&16?W&16?Bt(R,$,y,w,k,S,j,C,x):Ge(R,k,S,!0):(H&8&&u(y,""),W&16&&Y($,y,w,k,S,j,C,x))},wt=(p,g,y,w,k,S,j,C,x)=>{p=p||ks,g=g||ks;const R=p.length,H=g.length,$=Math.min(R,H);let B;for(B=0;B<$;B++){const W=g[B]=x?Ot(g[B]):mt(g[B]);v(p[B],W,y,null,k,S,j,C,x)}R>H?Ge(p,k,S,!0,!1,$):Y(g,y,w,k,S,j,C,x,$)},Bt=(p,g,y,w,k,S,j,C,x)=>{let R=0;const H=g.length;let $=p.length-1,B=H-1;for(;R<=$&&R<=B;){const W=p[R],ee=g[R]=x?Ot(g[R]):mt(g[R]);if(Ds(W,ee))v(W,ee,y,null,k,S,j,C,x);else break;R++}for(;R<=$&&R<=B;){const W=p[$],ee=g[B]=x?Ot(g[B]):mt(g[B]);if(Ds(W,ee))v(W,ee,y,null,k,S,j,C,x);else break;$--,B--}if(R>$){if(R<=B){const W=B+1,ee=W<H?g[W].el:w;for(;R<=B;)v(null,g[R]=x?Ot(g[R]):mt(g[R]),y,ee,k,S,j,C,x),R++}}else if(R>B)for(;R<=$;)Ue(p[R],k,S,!0),R++;else{const W=R,ee=R,oe=new Map;for(R=ee;R<=B;R++){const He=g[R]=x?Ot(g[R]):mt(g[R]);He.key!=null&&oe.set(He.key,R)}let he,be=0;const Ae=B-ee+1;let lt=!1,ct=0;const Ls=new Array(Ae);for(R=0;R<Ae;R++)Ls[R]=0;for(R=W;R<=$;R++){const He=p[R];if(be>=Ae){Ue(He,k,S,!0);continue}let ut;if(He.key!=null)ut=oe.get(He.key);else for(he=ee;he<=B;he++)if(Ls[he-ee]===0&&Ds(He,g[he])){ut=he;break}ut===void 0?Ue(He,k,S,!0):(Ls[ut-ee]=R+1,ut>=ct?ct=ut:lt=!0,v(He,g[ut],y,null,k,S,j,C,x),be++)}const Wi=lt?eh(Ls):ks;for(he=Wi.length-1,R=Ae-1;R>=0;R--){const He=ee+R,ut=g[He],Gi=g[He+1],Ji=He+1<H?Gi.el||kl(Gi):w;Ls[R]===0?v(null,ut,y,Ji,k,S,j,C,x):lt&&(he<0||R!==Wi[he]?at(ut,y,Ji,2):he--)}}},at=(p,g,y,w,k=null)=>{const{el:S,type:j,transition:C,children:x,shapeFlag:R}=p;if(R&6){at(p.component.subTree,g,y,w);return}if(R&128){p.suspense.move(g,y,w);return}if(R&64){j.move(p,g,y,D);return}if(j===Fe){r(S,g,y);for(let $=0;$<x.length;$++)at(x[$],g,y,w);r(p.anchor,g,y);return}if(j===jn){_(p,g,y);return}if(w!==2&&R&1&&C)if(w===0)C.beforeEnter(S),r(S,g,y),Be(()=>C.enter(S),k);else{const{leave:$,delayLeave:B,afterLeave:W}=C,ee=()=>{p.ctx.isUnmounted?n(S):r(S,g,y)},oe=()=>{S._isLeaving&&S[yu](!0),$(S,()=>{ee(),W&&W()})};B?B(S,ee,oe):oe()}else r(S,g,y)},Ue=(p,g,y,w=!1,k=!1)=>{const{type:S,props:j,ref:C,children:x,dynamicChildren:R,shapeFlag:H,patchFlag:$,dirs:B,cacheIndex:W,memo:ee}=p;if($===-2&&(k=!1),C!=null&&(It(),Ys(C,null,y,p,!0),jt()),W!=null&&(g.renderCache[W]=void 0),H&256){g.ctx.deactivate(p);return}const oe=H&1&&B,he=!Xs(p);let be;if(he&&(be=j&&j.onVnodeBeforeUnmount)&&ht(be,g,p),H&6)Jt(p.component,y,w);else{if(H&128){p.suspense.unmount(y,w);return}oe&&zt(p,null,g,"beforeUnmount"),H&64?p.type.remove(p,g,y,D,w):R&&!R.hasOnce&&(S!==Fe||$>0&&$&64)?Ge(R,g,y,!1,!0):(S===Fe&&$&384||!k&&H&16)&&Ge(x,g,y),w&&os(p)}const Ae=ee!=null&&W==null;(he&&(be=j&&j.onVnodeUnmounted)||oe||Ae)&&Be(()=>{be&&ht(be,g,p),oe&&zt(p,null,g,"unmounted"),Ae&&(p.el=null)},y)},os=p=>{const{type:g,el:y,anchor:w,transition:k}=p;if(g===Fe){as(y,w);return}if(g===jn){O(p);return}const S=()=>{n(y),k&&!k.persisted&&k.afterLeave&&k.afterLeave()};if(p.shapeFlag&1&&k&&!k.persisted){const{leave:j,delayLeave:C}=k,x=()=>j(y,S);C?C(p.el,S,x):x()}else S()},as=(p,g)=>{let y;for(;p!==g;)y=d(p),n(p),p=y;n(g)},Jt=(p,g,y)=>{const{bum:w,scope:k,job:S,subTree:j,um:C,m:x,a:R}=p;co(x),co(R),w&&Dr(w),k.stop(),S&&(S.flags|=8,Ue(j,p,g,y)),C&&Be(C,g),Be(()=>{p.isUnmounted=!0},g)},Ge=(p,g,y,w=!1,k=!1,S=0)=>{for(let j=S;j<p.length;j++)Ue(p[j],g,y,w,k)},E=p=>{if(p.shapeFlag&6)return E(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const g=d(p.anchor||p.el),y=g&&g[gu];return y?d(y):g};let L=!1;const N=(p,g,y)=>{let w;p==null?g._vnode&&(Ue(g._vnode,null,null,!0),w=g._vnode.component):v(g._vnode||null,p,g,null,null,null,y),g._vnode=p,L||(L=!0,Zi(w),tl(),L=!1)},D={p:v,um:Ue,m:at,r:os,mt:Gt,mc:Y,pc:se,pbc:ge,n:E,o:t};return{render:N,hydrate:void 0,createApp:Uu(N)}}function In({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function Yt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Zu(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Sl(t,e,s=!1){const r=t.children,n=e.children;if(q(r)&&q(n))for(let i=0;i<r.length;i++){const o=r[i];let a=n[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[i]=Ot(n[i]),a.el=o.el),!s&&a.patchFlag!==-2&&Sl(o,a)),a.type===yn&&(a.patchFlag===-1&&(a=n[i]=Ot(a)),a.el=o.el),a.type===Wt&&!a.el&&(a.el=o.el)}}function eh(t){const e=t.slice(),s=[0];let r,n,i,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(n=s[s.length-1],t[n]<c){e[r]=n,s.push(r);continue}for(i=0,o=s.length-1;i<o;)a=i+o>>1,t[s[a]]<c?i=a+1:o=a;c<t[s[i]]&&(i>0&&(e[r]=s[i-1]),s[i]=r)}}for(i=s.length,o=s[i-1];i-- >0;)s[i]=o,o=e[o];return s}function El(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:El(e)}function co(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function kl(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?kl(e.subTree):null}const Tl=t=>t.__isSuspense;function th(t,e){e&&e.pendingBranch?q(t)?e.effects.push(...t):e.effects.push(t):uu(t)}const Fe=Symbol.for("v-fgt"),yn=Symbol.for("v-txt"),Wt=Symbol.for("v-cmt"),jn=Symbol.for("v-stc"),Zs=[];let Ke=null;function X(t=!1){Zs.push(Ke=t?null:[])}function sh(){Zs.pop(),Ke=Zs[Zs.length-1]||null}let lr=1;function Jr(t,e=!1){lr+=t,t<0&&Ke&&e&&(Ke.hasOnce=!0)}function Al(t){return t.dynamicChildren=lr>0?Ke||ks:null,sh(),lr>0&&Ke&&Ke.push(t),t}function Q(t,e,s,r,n,i){return Al(I(t,e,s,r,n,i,!0))}function rh(t,e,s,r,n){return Al(ke(t,e,s,r,n,!0))}function zr(t){return t?t.__v_isVNode===!0:!1}function Ds(t,e){return t.type===e.type&&t.key===e.key}const Rl=({key:t})=>t??null,Mr=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ve(t)||_e(t)||J(t)?{i:ze,r:t,k:e,f:!!s}:t:null);function I(t,e=null,s=null,r=0,n=null,i=t===Fe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Rl(e),ref:e&&Mr(e),scopeId:rl,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:ze};return a?(Bi(l,s),i&128&&t.normalize(l)):s&&(l.shapeFlag|=ve(s)?8:16),lr>0&&!o&&Ke&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Ke.push(l),l}const ke=nh;function nh(t,e=null,s=null,r=0,n=null,i=!1){if((!t||t===xu)&&(t=Wt),zr(t)){const a=Is(t,e,!0);return s&&Bi(a,s),lr>0&&!i&&Ke&&(a.shapeFlag&6?Ke[Ke.indexOf(t)]=a:Ke.push(a)),a.patchFlag=-2,a}if(ph(t)&&(t=t.__vccOpts),e){e=ih(e);let{class:a,style:l}=e;a&&!ve(a)&&(e.class=tt(a)),ie(l)&&(un(l)&&!q(l)&&(l=xe({},l)),e.style=Ti(l))}const o=ve(t)?1:Tl(t)?128:mu(t)?64:ie(t)?4:J(t)?2:0;return I(t,e,s,r,n,o,i,!0)}function ih(t){return t?un(t)||ml(t)?xe({},t):t:null}function Is(t,e,s=!1,r=!1){const{props:n,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?oh(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&Rl(c),ref:e&&e.ref?s&&i?q(i)?i.concat(Mr(e)):[i,Mr(e)]:Mr(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Fe?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Is(t.ssContent),ssFallback:t.ssFallback&&Is(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&$i(u,l.clone(u)),u}function Ss(t=" ",e=0){return ke(yn,null,t,e)}function nt(t="",e=!1){return e?(X(),rh(Wt,null,t)):ke(Wt,null,t)}function mt(t){return t==null||typeof t=="boolean"?ke(Wt):q(t)?ke(Fe,null,t.slice()):zr(t)?Ot(t):ke(yn,null,String(t))}function Ot(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Is(t)}function Bi(t,e){let s=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(q(e))s=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),Bi(t,n()),n._c&&(n._d=!0));return}else{s=32;const n=e._;!n&&!ml(e)?e._ctx=ze:n===3&&ze&&(ze.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else J(e)?(e={default:e,_ctx:ze},s=32):(e=String(e),r&64?(s=16,e=[Ss(e)]):s=8);t.children=e,t.shapeFlag|=s}function oh(...t){const e={};for(let s=0;s<t.length;s++){const r=t[s];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=tt([e.class,r.class]));else if(n==="style")e.style=Ti([e.style,r.style]);else if(rn(n)){const i=e[n],o=r[n];o&&i!==o&&!(q(i)&&i.includes(o))?e[n]=i?[].concat(i,o):o:o==null&&i==null&&!nn(n)&&(e[n]=o)}else n!==""&&(e[n]=r[n])}return e}function ht(t,e,s,r=null){bt(t,e,7,[s,r])}const ah=hl();let lh=0;function ch(t,e,s){const r=t.type,n=(e?e.appContext:t.appContext)||ah,i={uid:lh++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ja(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:vl(r,n),emitsOptions:dl(r,n),emit:null,emitted:null,propsDefaults:ce,inheritAttrs:r.inheritAttrs,ctx:ce,data:ce,props:ce,attrs:ce,slots:ce,refs:ce,setupState:ce,setupContext:null,suspense:s,suspenseId:s?s.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Bu.bind(null,i),t.ce&&t.ce(i),i}let $e=null;const Ol=()=>$e||ze;let Yr,ti;{const t=ln(),e=(s,r)=>{let n;return(n=t[s])||(n=t[s]=[]),n.push(r),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};Yr=e("__VUE_INSTANCE_SETTERS__",s=>$e=s),ti=e("__VUE_SSR_SETTERS__",s=>cr=s)}const Sr=t=>{const e=$e;return Yr(t),t.scope.on(),()=>{t.scope.off(),Yr(e)}},uo=()=>{$e&&$e.scope.off(),Yr(null)};function xl(t){return t.vnode.shapeFlag&4}let cr=!1;function uh(t,e=!1,s=!1){e&&ti(e);const{props:r,children:n}=t.vnode,i=xl(t);Ku(t,r,i,e),zu(t,n,s||e);const o=i?hh(t,e):void 0;return e&&ti(!1),o}function hh(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Cu);const{setup:r}=s;if(r){It();const n=t.setupContext=r.length>1?fh(t):null,i=Sr(t),o=wr(r,t,0,[t.props,n]),a=Ta(o);if(jt(),i(),(a||t.sp)&&!Xs(t)&&ol(t),a){if(o.then(uo,uo),e)return o.then(l=>{ho(t,l)}).catch(l=>{hn(l,t,0)});t.asyncDep=o}else ho(t,o)}else Cl(t)}function ho(t,e,s){J(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ie(e)&&(t.setupState=Qa(e)),Cl(t)}function Cl(t,e,s){const r=t.type;t.render||(t.render=r.render||_t);{const n=Sr(t);It();try{Pu(t)}finally{jt(),n()}}}const dh={get(t,e){return Ce(t,"get",""),t[e]}};function fh(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,dh),slots:t.slots,emit:t.emit,expose:e}}function vn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Qa(ji(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in Qs)return Qs[s](t)},has(e,s){return s in e||s in Qs}})):t.proxy}function ph(t){return J(t)&&"__vccOpts"in t}const qe=(t,e)=>iu(t,e,cr);function Pl(t,e,s){try{Jr(-1);const r=arguments.length;return r===2?ie(e)&&!q(e)?zr(e)?ke(t,null,[e]):ke(t,e):ke(t,null,e):(r>3?s=Array.prototype.slice.call(arguments,2):r===3&&zr(s)&&(s=[s]),ke(t,e,s))}finally{Jr(1)}}const gh="3.5.34";/**
13
+ **/function Sr(t,e,s,r){try{return r?t(...r):t()}catch(n){dn(n,e,s)}}function bt(t,e,s,r){if(Y(t)){const n=Sr(t,e,s,r);return n&&Ta(n)&&n.catch(i=>{dn(i,e,s)}),n}if(q(t)){const n=[];for(let i=0;i<t.length;i++)n.push(bt(t[i],e,s,r));return n}}function dn(t,e,s,r=!0){const n=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ue;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${s}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){It(),Sr(i,null,10,[t,l,c]),jt();return}}lu(t,s,n,r,o)}function lu(t,e,s,r=!0,n=!1){if(n)throw t;console.error(t)}const Ne=[];let ft=-1;const As=[];let Ft=null,gs=0;const Za=Promise.resolve();let Kr=null;function fn(t){const e=Kr||Za;return t?e.then(this?t.bind(this):t):e}function cu(t){let e=ft+1,s=Ne.length;for(;e<s;){const r=e+s>>>1,n=Ne[r],i=lr(n);i<t||i===t&&n.flags&2?e=r+1:s=r}return e}function Ni(t){if(!(t.flags&1)){const e=lr(t),s=Ne[Ne.length-1];!s||!(t.flags&2)&&e>=lr(s)?Ne.push(t):Ne.splice(cu(e),0,t),t.flags|=1,el()}}function el(){Kr||(Kr=Za.then(sl))}function uu(t){q(t)?As.push(...t):Ft&&t.id===-1?Ft.splice(gs+1,0,t):t.flags&1||(As.push(t),t.flags|=1),el()}function Zi(t,e,s=ft+1){for(;s<Ne.length;s++){const r=Ne[s];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ne.splice(s,1),s--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function tl(t){if(As.length){const e=[...new Set(As)].sort((s,r)=>lr(s)-lr(r));if(As.length=0,Ft){Ft.push(...e);return}for(Ft=e,gs=0;gs<Ft.length;gs++){const s=Ft[gs];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}Ft=null,gs=0}}const lr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function sl(t){try{for(ft=0;ft<Ne.length;ft++){const e=Ne[ft];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Sr(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;ft<Ne.length;ft++){const e=Ne[ft];e&&(e.flags&=-2)}ft=-1,Ne.length=0,tl(),Kr=null,(Ne.length||As.length)&&sl()}}let Xe=null,rl=null;function Wr(t){const e=Xe;return Xe=t,rl=t&&t.type.__scopeId||null,e}function Fs(t,e=Xe,s){if(!e||t._n)return t;const r=(...n)=>{r._d&&zr(-1);const i=Wr(e);let o;try{o=t(...n)}finally{Wr(i),r._d&&zr(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Rs(t,e){if(Xe===null)return t;const s=vn(Xe),r=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[i,o,a,l=ue]=e[n];i&&(Y(i)&&(i={mounted:i,updated:i}),i.deep&&Ct(o),r.push({dir:i,instance:s,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function zt(t,e,s,r){const n=t.dirs,i=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];i&&(a.oldValue=i[o].value);let l=a.dir[r];l&&(It(),bt(l,s,8,[t.el,a,t,e]),jt())}}function Mr(t,e){if($e){let s=$e.provides;const r=$e.parent&&$e.parent.provides;r===s&&(s=$e.provides=Object.create(r)),s[t]=e}}function Qe(t,e,s=!1){const r=xl();if(r||ns){let n=ns?ns._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return s&&Y(e)?e.call(r&&r.proxy):e}}function hu(){return!!(xl()||ns)}const du=Symbol.for("v-scx"),fu=()=>Qe(du);function xs(t,e,s){return nl(t,e,s)}function nl(t,e,s=ue){const{immediate:r,deep:n,flush:i,once:o}=s,a=Oe({},s),l=e&&r||!e&&i!=="post";let c;if(hr){if(i==="sync"){const f=fu();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=_t,f.resume=_t,f.pause=_t,f}}const u=$e;a.call=(f,m,y)=>bt(f,u,m,y);let h=!1;i==="post"?a.scheduler=f=>{Be(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,m)=>{m?f():Ni(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=au(t,e,a);return hr&&(c?c.push(d):l&&d()),d}function pu(t,e,s){const r=this.proxy,n=ve(t)?t.includes(".")?il(r,t):()=>r[t]:t.bind(r,r);let i;Y(e)?i=e:(i=e.handler,s=e);const o=Er(this),a=nl(n,i.bind(r),s);return o(),a}function il(t,e){const s=e.split(".");return()=>{let r=t;for(let n=0;n<s.length&&r;n++)r=r[s[n]];return r}}const gu=Symbol("_vte"),mu=t=>t.__isTeleport,yu=Symbol("_leaveCb");function $i(t,e){t.shapeFlag&6&&t.component?(t.transition=e,$i(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function $t(t,e){return Y(t)?Oe({name:t.name},e,{setup:t}):t}function ol(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function eo(t,e){let s;return!!((s=Object.getOwnPropertyDescriptor(t,e))&&!s.configurable)}const Gr=new WeakMap;function Xs(t,e,s,r,n=!1){if(q(t)){t.forEach((y,_)=>Xs(y,e&&(q(e)?e[_]:e),s,r,n));return}if(Qs(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Xs(t,e,s,r.component.subTree);return}const i=r.shapeFlag&4?vn(r.component):r.el,o=n?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ue?a.refs={}:a.refs,h=a.setupState,d=se(h),f=h===ue?Ea:y=>eo(u,y)?!1:ie(d,y),m=(y,_)=>!(_&&eo(u,_));if(c!=null&&c!==l){if(to(e),ve(c))u[c]=null,f(c)&&(h[c]=null);else if(_e(c)){const y=e;m(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(Y(l))Sr(l,a,12,[o,u]);else{const y=ve(l),_=_e(l);if(y||_){const S=()=>{if(t.f){const w=y?f(l)?h[l]:u[l]:m()||!t.k?l.value:u[t.k];if(n)q(w)&&Ei(w,i);else if(q(w))w.includes(i)||w.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const b=[i];m(l,t.k)&&(l.value=b),t.k&&(u[t.k]=b)}}else y?(u[l]=o,f(l)&&(h[l]=o)):_&&(m(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const w=()=>{S(),Gr.delete(t)};w.id=-1,Gr.set(t,w),Be(w,s)}else to(t),S()}}}function to(t){const e=Gr.get(t);e&&(e.flags|=8,Gr.delete(t))}cn().requestIdleCallback;cn().cancelIdleCallback;const Qs=t=>!!t.type.__asyncLoader,al=t=>t.type.__isKeepAlive;function vu(t,e){ll(t,"a",e)}function _u(t,e){ll(t,"da",e)}function ll(t,e,s=$e){const r=t.__wdc||(t.__wdc=()=>{let n=s;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(pn(e,r,s),s){let n=s.parent;for(;n&&n.parent;)al(n.parent.vnode)&&bu(r,e,s,n),n=n.parent}}function bu(t,e,s,r){const n=pn(e,t,r,!0);Li(()=>{Ei(r[e],n)},s)}function pn(t,e,s=$e,r=!1){if(s){const n=s[t]||(s[t]=[]),i=e.__weh||(e.__weh=(...o)=>{It();const a=Er(s),l=bt(e,s,t,o);return a(),jt(),l});return r?n.unshift(i):n.push(i),i}}const Lt=t=>(e,s=$e)=>{(!hr||t==="sp")&&pn(t,(...r)=>e(...r),s)},wu=Lt("bm"),gn=Lt("m"),Su=Lt("bu"),Eu=Lt("u"),ku=Lt("bum"),Li=Lt("um"),Tu=Lt("sp"),Au=Lt("rtg"),Ru=Lt("rtc");function xu(t,e=$e){pn("ec",t,e)}const Ou=Symbol.for("v-ndc");function cr(t,e,s,r){let n;const i=s,o=q(t);if(o||ve(t)){const a=o&&Pt(t);let l=!1,c=!1;a&&(l=!Je(t),c=Nt(t),t=un(t)),n=new Array(t.length);for(let u=0,h=t.length;u<h;u++)n[u]=e(l?c?Is(it(t[u])):it(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,i)}else if(oe(t))if(t[Symbol.iterator])n=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);n=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];n[l]=e(t[u],u,l,i)}}else n=[];return n}const Xn=t=>t?Ol(t)?vn(t):Xn(t.parent):null,Zs=Oe(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Xn(t.parent),$root:t=>Xn(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>ul(t),$forceUpdate:t=>t.f||(t.f=()=>{Ni(t.update)}),$nextTick:t=>t.n||(t.n=fn.bind(t.proxy)),$watch:t=>pu.bind(t)}),Pn=(t,e)=>t!==ue&&!t.__isScriptSetup&&ie(t,e),Cu={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:s,setupState:r,data:n,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return r[e];case 2:return n[e];case 4:return s[e];case 3:return i[e]}else{if(Pn(r,e))return o[e]=1,r[e];if(n!==ue&&ie(n,e))return o[e]=2,n[e];if(ie(i,e))return o[e]=3,i[e];if(s!==ue&&ie(s,e))return o[e]=4,s[e];Qn&&(o[e]=0)}}const c=Zs[e];let u,h;if(c)return e==="$attrs"&&Ce(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(s!==ue&&ie(s,e))return o[e]=4,s[e];if(h=l.config.globalProperties,ie(h,e))return h[e]},set({_:t},e,s){const{data:r,setupState:n,ctx:i}=t;return Pn(n,e)?(n[e]=s,!0):r!==ue&&ie(r,e)?(r[e]=s,!0):ie(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=s,!0)},has({_:{data:t,setupState:e,accessCache:s,ctx:r,appContext:n,props:i,type:o}},a){let l;return!!(s[a]||t!==ue&&a[0]!=="$"&&ie(t,a)||Pn(e,a)||ie(i,a)||ie(r,a)||ie(Zs,a)||ie(n.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:ie(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function so(t){return q(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let Qn=!0;function Pu(t){const e=ul(t),s=t.proxy,r=t.ctx;Qn=!1,e.beforeCreate&&ro(e.beforeCreate,t,"bc");const{data:n,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:m,activated:y,deactivated:_,beforeDestroy:S,beforeUnmount:w,destroyed:b,unmounted:x,render:M,renderTracked:z,renderTriggered:V,errorCaptured:Q,serverPrefetch:K,expose:ge,inheritAttrs:Pe,components:Fe,directives:Le,filters:Gt}=e;if(c&&Iu(c,r,null),o)for(const X in o){const re=o[X];Y(re)&&(r[X]=re.bind(s))}if(n){const X=n.call(s,s);oe(X)&&(t.data=wr(X))}if(Qn=!0,i)for(const X in i){const re=i[X],wt=Y(re)?re.bind(s,s):Y(re.get)?re.get.bind(s,s):_t,Bt=!Y(re)&&Y(re.set)?re.set.bind(s):_t,at=Ve({get:wt,set:Bt});Object.defineProperty(r,X,{enumerable:!0,configurable:!0,get:()=>at.value,set:Ue=>at.value=Ue})}if(a)for(const X in a)cl(a[X],r,s,X);if(l){const X=Y(l)?l.call(s):l;Reflect.ownKeys(X).forEach(re=>{Mr(re,X[re])})}u&&ro(u,t,"c");function pe(X,re){q(re)?re.forEach(wt=>X(wt.bind(s))):re&&X(re.bind(s))}if(pe(wu,h),pe(gn,d),pe(Su,f),pe(Eu,m),pe(vu,y),pe(_u,_),pe(xu,Q),pe(Ru,z),pe(Au,V),pe(ku,w),pe(Li,x),pe(Tu,K),q(ge))if(ge.length){const X=t.exposed||(t.exposed={});ge.forEach(re=>{Object.defineProperty(X,re,{get:()=>s[re],set:wt=>s[re]=wt,enumerable:!0})})}else t.exposed||(t.exposed={});M&&t.render===_t&&(t.render=M),Pe!=null&&(t.inheritAttrs=Pe),Fe&&(t.components=Fe),Le&&(t.directives=Le),K&&ol(t)}function Iu(t,e,s=_t){q(t)&&(t=Zn(t));for(const r in t){const n=t[r];let i;oe(n)?"default"in n?i=Qe(n.from||r,n.default,!0):i=Qe(n.from||r):i=Qe(n),_e(i)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[r]=i}}function ro(t,e,s){bt(q(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,s)}function cl(t,e,s,r){let n=r.includes(".")?il(s,r):()=>s[r];if(ve(t)){const i=e[t];Y(i)&&xs(n,i)}else if(Y(t))xs(n,t.bind(s));else if(oe(t))if(q(t))t.forEach(i=>cl(i,e,s,r));else{const i=Y(t.handler)?t.handler.bind(s):e[t.handler];Y(i)&&xs(n,i,t)}}function ul(t){const e=t.type,{mixins:s,extends:r}=e,{mixins:n,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!n.length&&!s&&!r?l=e:(l={},n.length&&n.forEach(c=>Jr(l,c,o,!0)),Jr(l,e,o)),oe(e)&&i.set(e,l),l}function Jr(t,e,s,r=!1){const{mixins:n,extends:i}=e;i&&Jr(t,i,s,!0),n&&n.forEach(o=>Jr(t,o,s,!0));for(const o in e)if(!(r&&o==="expose")){const a=ju[o]||s&&s[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const ju={data:no,props:io,emits:io,methods:qs,computed:qs,beforeCreate:Ie,created:Ie,beforeMount:Ie,mounted:Ie,beforeUpdate:Ie,updated:Ie,beforeDestroy:Ie,beforeUnmount:Ie,destroyed:Ie,unmounted:Ie,activated:Ie,deactivated:Ie,errorCaptured:Ie,serverPrefetch:Ie,components:qs,directives:qs,watch:$u,provide:no,inject:Nu};function no(t,e){return e?t?function(){return Oe(Y(t)?t.call(this,this):t,Y(e)?e.call(this,this):e)}:e:t}function Nu(t,e){return qs(Zn(t),Zn(e))}function Zn(t){if(q(t)){const e={};for(let s=0;s<t.length;s++)e[t[s]]=t[s];return e}return t}function Ie(t,e){return t?[...new Set([].concat(t,e))]:e}function qs(t,e){return t?Oe(Object.create(null),t,e):e}function io(t,e){return t?q(t)&&q(e)?[...new Set([...t,...e])]:Oe(Object.create(null),so(t),so(e??{})):e}function $u(t,e){if(!t)return e;if(!e)return t;const s=Oe(Object.create(null),t);for(const r in e)s[r]=Ie(t[r],e[r]);return s}function hl(){return{app:null,config:{isNativeTag:Ea,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Lu=0;function Uu(t,e){return function(r,n=null){Y(r)||(r=Oe({},r)),n!=null&&!oe(n)&&(n=null);const i=hl(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Lu++,_component:r,_props:n,_container:null,_context:i,_instance:null,version:gh,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&Y(u.install)?(o.add(u),u.install(c,...h)):Y(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||ke(r,n);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,vn(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(bt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=ns;ns=c;try{return u()}finally{ns=h}}};return c}}let ns=null;const Du=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${rt(e)}Modifiers`]||t[`${is(e)}Modifiers`];function Bu(t,e,...s){if(t.isUnmounted)return;const r=t.vnode.props||ue;let n=s;const i=e.startsWith("update:"),o=i&&Du(r,e.slice(7));o&&(o.trim&&(n=s.map(u=>ve(u)?u.trim():u)),o.number&&(n=s.map(ki)));let a,l=r[a=An(e)]||r[a=An(rt(e))];!l&&i&&(l=r[a=An(is(e))]),l&&bt(l,t,6,n);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,bt(c,t,6,n)}}const Mu=new WeakMap;function dl(t,e,s=!1){const r=s?Mu:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const i=t.emits;let o={},a=!1;if(!Y(t)){const l=c=>{const u=dl(c,e,!0);u&&(a=!0,Oe(o,u))};!s&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(oe(t)&&r.set(t,null),null):(q(i)?i.forEach(l=>o[l]=null):Oe(o,i),oe(t)&&r.set(t,o),o)}function mn(t,e){return!t||!nn(e)?!1:(e=e.slice(2).replace(/Once$/,""),ie(t,e[0].toLowerCase()+e.slice(1))||ie(t,is(e))||ie(t,e))}function oo(t){const{type:e,vnode:s,proxy:r,withProxy:n,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:m,inheritAttrs:y}=t,_=Wr(t);let S,w;try{if(s.shapeFlag&4){const x=n||r,M=x;S=mt(c.call(M,x,u,h,f,d,m)),w=a}else{const x=e;S=mt(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),w=e.props?a:Hu(a)}}catch(x){er.length=0,dn(x,t,1),S=ke(Wt)}let b=S;if(w&&y!==!1){const x=Object.keys(w),{shapeFlag:M}=b;x.length&&M&7&&(i&&x.some(on)&&(w=Fu(w,i)),b=js(b,w,!1,!0))}return s.dirs&&(b=js(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(s.dirs):s.dirs),s.transition&&$i(b,s.transition),S=b,Wr(_),S}const Hu=t=>{let e;for(const s in t)(s==="class"||s==="style"||nn(s))&&((e||(e={}))[s]=t[s]);return e},Fu=(t,e)=>{const s={};for(const r in t)(!on(r)||!(r.slice(9)in e))&&(s[r]=t[r]);return s};function qu(t,e,s){const{props:r,children:n,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(s&&l>=0){if(l&1024)return!0;if(l&16)return r?ao(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(fl(o,r,d)&&!mn(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?ao(r,o,c):!0:!!o;return!1}function ao(t,e,s){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let n=0;n<r.length;n++){const i=r[n];if(fl(e,t,i)&&!mn(s,i))return!0}return!1}function fl(t,e,s){const r=t[s],n=e[s];return s==="style"&&oe(r)&&oe(n)?!Ai(r,n):r!==n}function Vu({vnode:t,parent:e,suspense:s},r){for(;e;){const n=e.subTree;if(n.suspense&&n.suspense.activeBranch===t&&(n.suspense.vnode.el=n.el=r,t=n),n===t)(t=e.vnode).el=r,e=e.parent;else break}s&&s.activeBranch===t&&(s.vnode.el=r)}const pl={},gl=()=>Object.create(pl),ml=t=>Object.getPrototypeOf(t)===pl;function Ku(t,e,s,r=!1){const n={},i=gl();t.propsDefaults=Object.create(null),yl(t,e,n,i);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);s?t.props=r?n:Ya(n):t.type.props?t.props=n:t.props=i,t.attrs=i}function Wu(t,e,s,r){const{props:n,attrs:i,vnode:{patchFlag:o}}=t,a=se(n),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(mn(t.emitsOptions,d))continue;const f=e[d];if(l)if(ie(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const m=rt(d);n[m]=ei(l,a,m,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{yl(t,e,n,i)&&(c=!0);let u;for(const h in a)(!e||!ie(e,h)&&((u=is(h))===h||!ie(e,u)))&&(l?s&&(s[h]!==void 0||s[u]!==void 0)&&(n[h]=ei(l,a,h,void 0,t,!0)):delete n[h]);if(i!==a)for(const h in i)(!e||!ie(e,h))&&(delete i[h],c=!0)}c&&Ot(t.attrs,"set","")}function yl(t,e,s,r){const[n,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(Js(l))continue;const c=e[l];let u;n&&ie(n,u=rt(l))?!i||!i.includes(u)?s[u]=c:(a||(a={}))[u]=c:mn(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=se(s),c=a||ue;for(let u=0;u<i.length;u++){const h=i[u];s[h]=ei(n,l,h,c[h],t,!ie(c,h))}}return o}function ei(t,e,s,r,n,i){const o=t[s];if(o!=null){const a=ie(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Y(l)){const{propsDefaults:c}=n;if(s in c)r=c[s];else{const u=Er(n);r=c[s]=l.call(null,e),u()}}else r=l;n.ce&&n.ce._setProp(s,r)}o[0]&&(i&&!a?r=!1:o[1]&&(r===""||r===is(s))&&(r=!0))}return r}const Gu=new WeakMap;function vl(t,e,s=!1){const r=s?Gu:e.propsCache,n=r.get(t);if(n)return n;const i=t.props,o={},a=[];let l=!1;if(!Y(t)){const u=h=>{l=!0;const[d,f]=vl(h,e,!0);Oe(o,d),f&&a.push(...f)};!s&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return oe(t)&&r.set(t,ks),ks;if(q(i))for(let u=0;u<i.length;u++){const h=rt(i[u]);lo(h)&&(o[h]=ue)}else if(i)for(const u in i){const h=rt(u);if(lo(h)){const d=i[u],f=o[h]=q(d)||Y(d)?{type:d}:Oe({},d),m=f.type;let y=!1,_=!0;if(q(m))for(let S=0;S<m.length;++S){const w=m[S],b=Y(w)&&w.name;if(b==="Boolean"){y=!0;break}else b==="String"&&(_=!1)}else y=Y(m)&&m.name==="Boolean";f[0]=y,f[1]=_,(y||ie(f,"default"))&&a.push(h)}}const c=[o,a];return oe(t)&&r.set(t,c),c}function lo(t){return t[0]!=="$"&&!Js(t)}const Ui=t=>t==="_"||t==="_ctx"||t==="$stable",Di=t=>q(t)?t.map(mt):[mt(t)],Ju=(t,e,s)=>{if(e._n)return e;const r=Fs((...n)=>Di(e(...n)),s);return r._c=!1,r},_l=(t,e,s)=>{const r=t._ctx;for(const n in t){if(Ui(n))continue;const i=t[n];if(Y(i))e[n]=Ju(n,i,r);else if(i!=null){const o=Di(i);e[n]=()=>o}}},bl=(t,e)=>{const s=Di(e);t.slots.default=()=>s},wl=(t,e,s)=>{for(const r in e)(s||!Ui(r))&&(t[r]=e[r])},zu=(t,e,s)=>{const r=t.slots=gl();if(t.vnode.shapeFlag&32){const n=e._;n?(wl(r,e,s),s&&Oa(r,"_",n,!0)):_l(e,r)}else e&&bl(t,e)},Yu=(t,e,s)=>{const{vnode:r,slots:n}=t;let i=!0,o=ue;if(r.shapeFlag&32){const a=e._;a?s&&a===1?i=!1:wl(n,e,s):(i=!e.$stable,_l(e,n)),o=e}else e&&(bl(t,e),o={default:1});if(i)for(const a in n)!Ui(a)&&o[a]==null&&delete n[a]},Be=th;function Xu(t){return Qu(t)}function Qu(t,e){const s=cn();s.__VUE__=!0;const{insert:r,remove:n,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=_t,insertStaticContent:m}=t,y=(p,g,v,E=null,A=null,k=null,j=void 0,P=null,C=!!g.dynamicChildren)=>{if(p===g)return;p&&!Bs(p,g)&&(E=T(p),Ue(p,A,k,!0),p=null),g.patchFlag===-2&&(C=!1,g.dynamicChildren=null);const{type:R,ref:H,shapeFlag:$}=g;switch(R){case yn:_(p,g,v,E);break;case Wt:S(p,g,v,E);break;case jn:p==null&&w(g,v,E,j);break;case Me:Fe(p,g,v,E,A,k,j,P,C);break;default:$&1?M(p,g,v,E,A,k,j,P,C):$&6?Le(p,g,v,E,A,k,j,P,C):($&64||$&128)&&R.process(p,g,v,E,A,k,j,P,C,D)}H!=null&&A?Xs(H,p&&p.ref,k,g||p,!g):H==null&&p&&p.ref!=null&&Xs(p.ref,null,k,p,!0)},_=(p,g,v,E)=>{if(p==null)r(g.el=a(g.children),v,E);else{const A=g.el=p.el;g.children!==p.children&&c(A,g.children)}},S=(p,g,v,E)=>{p==null?r(g.el=l(g.children||""),v,E):g.el=p.el},w=(p,g,v,E)=>{[p.el,p.anchor]=m(p.children,g,v,E,p.el,p.anchor)},b=({el:p,anchor:g},v,E)=>{let A;for(;p&&p!==g;)A=d(p),r(p,v,E),p=A;r(g,v,E)},x=({el:p,anchor:g})=>{let v;for(;p&&p!==g;)v=d(p),n(p),p=v;n(g)},M=(p,g,v,E,A,k,j,P,C)=>{if(g.type==="svg"?j="svg":g.type==="math"&&(j="mathml"),p==null)z(g,v,E,A,k,j,P,C);else{const R=p.el&&p.el._isVueCE?p.el:null;try{R&&R._beginPatch(),K(p,g,A,k,j,P,C)}finally{R&&R._endPatch()}}},z=(p,g,v,E,A,k,j,P)=>{let C,R;const{props:H,shapeFlag:$,transition:B,dirs:W}=p;if(C=p.el=o(p.type,k,H&&H.is,H),$&8?u(C,p.children):$&16&&Q(p.children,C,null,E,A,In(p,k),j,P),W&&zt(p,null,E,"created"),V(C,p,p.scopeId,j,E),H){for(const le in H)le!=="value"&&!Js(le)&&i(C,le,null,H[le],k,E);"value"in H&&i(C,"value",null,H.value,k),(R=H.onVnodeBeforeMount)&&ht(R,E,p)}W&&zt(p,null,E,"beforeMount");const te=Zu(A,B);te&&B.beforeEnter(C),r(C,g,v),((R=H&&H.onVnodeMounted)||te||W)&&Be(()=>{try{R&&ht(R,E,p),te&&B.enter(C),W&&zt(p,null,E,"mounted")}finally{}},A)},V=(p,g,v,E,A)=>{if(v&&f(p,v),E)for(let k=0;k<E.length;k++)f(p,E[k]);if(A){let k=A.subTree;if(g===k||Tl(k.type)&&(k.ssContent===g||k.ssFallback===g)){const j=A.vnode;V(p,j,j.scopeId,j.slotScopeIds,A.parent)}}},Q=(p,g,v,E,A,k,j,P,C=0)=>{for(let R=C;R<p.length;R++){const H=p[R]=P?xt(p[R]):mt(p[R]);y(null,H,g,v,E,A,k,j,P)}},K=(p,g,v,E,A,k,j)=>{const P=g.el=p.el;let{patchFlag:C,dynamicChildren:R,dirs:H}=g;C|=p.patchFlag&16;const $=p.props||ue,B=g.props||ue;let W;if(v&&Yt(v,!1),(W=B.onVnodeBeforeUpdate)&&ht(W,v,g,p),H&&zt(g,p,v,"beforeUpdate"),v&&Yt(v,!0),($.innerHTML&&B.innerHTML==null||$.textContent&&B.textContent==null)&&u(P,""),R?ge(p.dynamicChildren,R,P,v,E,In(g,A),k):j||re(p,g,P,null,v,E,In(g,A),k,!1),C>0){if(C&16)Pe(P,$,B,v,A);else if(C&2&&$.class!==B.class&&i(P,"class",null,B.class,A),C&4&&i(P,"style",$.style,B.style,A),C&8){const te=g.dynamicProps;for(let le=0;le<te.length;le++){const he=te[le],be=$[he],Ae=B[he];(Ae!==be||he==="value")&&i(P,he,be,Ae,A,v)}}C&1&&p.children!==g.children&&u(P,g.children)}else!j&&R==null&&Pe(P,$,B,v,A);((W=B.onVnodeUpdated)||H)&&Be(()=>{W&&ht(W,v,g,p),H&&zt(g,p,v,"updated")},E)},ge=(p,g,v,E,A,k,j)=>{for(let P=0;P<g.length;P++){const C=p[P],R=g[P],H=C.el&&(C.type===Me||!Bs(C,R)||C.shapeFlag&198)?h(C.el):v;y(C,R,H,null,E,A,k,j,!0)}},Pe=(p,g,v,E,A)=>{if(g!==v){if(g!==ue)for(const k in g)!Js(k)&&!(k in v)&&i(p,k,g[k],null,A,E);for(const k in v){if(Js(k))continue;const j=v[k],P=g[k];j!==P&&k!=="value"&&i(p,k,P,j,A,E)}"value"in v&&i(p,"value",g.value,v.value,A)}},Fe=(p,g,v,E,A,k,j,P,C)=>{const R=g.el=p?p.el:a(""),H=g.anchor=p?p.anchor:a("");let{patchFlag:$,dynamicChildren:B,slotScopeIds:W}=g;W&&(P=P?P.concat(W):W),p==null?(r(R,v,E),r(H,v,E),Q(g.children||[],v,H,A,k,j,P,C)):$>0&&$&64&&B&&p.dynamicChildren&&p.dynamicChildren.length===B.length?(ge(p.dynamicChildren,B,v,A,k,j,P),(g.key!=null||A&&g===A.subTree)&&Sl(p,g,!0)):re(p,g,v,H,A,k,j,P,C)},Le=(p,g,v,E,A,k,j,P,C)=>{g.slotScopeIds=P,p==null?g.shapeFlag&512?A.ctx.activate(g,v,E,j,C):Gt(g,v,E,A,k,j,C):Dt(p,g,C)},Gt=(p,g,v,E,A,k,j)=>{const P=p.component=ch(p,E,A);if(al(p)&&(P.ctx.renderer=D),uh(P,!1,j),P.asyncDep){if(A&&A.registerDep(P,pe,j),!p.el){const C=P.subTree=ke(Wt);S(null,C,g,v),p.placeholder=C.el}}else pe(P,p,g,v,A,k,j)},Dt=(p,g,v)=>{const E=g.component=p.component;if(qu(p,g,v))if(E.asyncDep&&!E.asyncResolved){X(E,g,v);return}else E.next=g,E.update();else g.el=p.el,E.vnode=g},pe=(p,g,v,E,A,k,j)=>{const P=()=>{if(p.isMounted){let{next:$,bu:B,u:W,parent:te,vnode:le}=p;{const ct=El(p);if(ct){$&&($.el=le.el,X(p,$,j)),ct.asyncDep.then(()=>{Be(()=>{p.isUnmounted||R()},A)});return}}let he=$,be;Yt(p,!1),$?($.el=le.el,X(p,$,j)):$=le,B&&Br(B),(be=$.props&&$.props.onVnodeBeforeUpdate)&&ht(be,te,$,le),Yt(p,!0);const Ae=oo(p),lt=p.subTree;p.subTree=Ae,y(lt,Ae,h(lt.el),T(lt),p,A,k),$.el=Ae.el,he===null&&Vu(p,Ae.el),W&&Be(W,A),(be=$.props&&$.props.onVnodeUpdated)&&Be(()=>ht(be,te,$,le),A)}else{let $;const{el:B,props:W}=g,{bm:te,m:le,parent:he,root:be,type:Ae}=p,lt=Qs(g);Yt(p,!1),te&&Br(te),!lt&&($=W&&W.onVnodeBeforeMount)&&ht($,he,g),Yt(p,!0);{be.ce&&be.ce._hasShadowRoot()&&be.ce._injectChildStyle(Ae,p.parent?p.parent.type:void 0);const ct=p.subTree=oo(p);y(null,ct,v,E,p,A,k),g.el=ct.el}if(le&&Be(le,A),!lt&&($=W&&W.onVnodeMounted)){const ct=g;Be(()=>ht($,he,ct),A)}(g.shapeFlag&256||he&&Qs(he.vnode)&&he.vnode.shapeFlag&256)&&p.a&&Be(p.a,A),p.isMounted=!0,g=v=E=null}};p.scope.on();const C=p.effect=new La(P);p.scope.off();const R=p.update=C.run.bind(C),H=p.job=C.runIfDirty.bind(C);H.i=p,H.id=p.uid,C.scheduler=()=>Ni(H),Yt(p,!0),R()},X=(p,g,v)=>{g.component=p;const E=p.vnode.props;p.vnode=g,p.next=null,Wu(p,g.props,E,v),Yu(p,g.children,v),It(),Zi(p),jt()},re=(p,g,v,E,A,k,j,P,C=!1)=>{const R=p&&p.children,H=p?p.shapeFlag:0,$=g.children,{patchFlag:B,shapeFlag:W}=g;if(B>0){if(B&128){Bt(R,$,v,E,A,k,j,P,C);return}else if(B&256){wt(R,$,v,E,A,k,j,P,C);return}}W&8?(H&16&&ze(R,A,k),$!==R&&u(v,$)):H&16?W&16?Bt(R,$,v,E,A,k,j,P,C):ze(R,A,k,!0):(H&8&&u(v,""),W&16&&Q($,v,E,A,k,j,P,C))},wt=(p,g,v,E,A,k,j,P,C)=>{p=p||ks,g=g||ks;const R=p.length,H=g.length,$=Math.min(R,H);let B;for(B=0;B<$;B++){const W=g[B]=C?xt(g[B]):mt(g[B]);y(p[B],W,v,null,A,k,j,P,C)}R>H?ze(p,A,k,!0,!1,$):Q(g,v,E,A,k,j,P,C,$)},Bt=(p,g,v,E,A,k,j,P,C)=>{let R=0;const H=g.length;let $=p.length-1,B=H-1;for(;R<=$&&R<=B;){const W=p[R],te=g[R]=C?xt(g[R]):mt(g[R]);if(Bs(W,te))y(W,te,v,null,A,k,j,P,C);else break;R++}for(;R<=$&&R<=B;){const W=p[$],te=g[B]=C?xt(g[B]):mt(g[B]);if(Bs(W,te))y(W,te,v,null,A,k,j,P,C);else break;$--,B--}if(R>$){if(R<=B){const W=B+1,te=W<H?g[W].el:E;for(;R<=B;)y(null,g[R]=C?xt(g[R]):mt(g[R]),v,te,A,k,j,P,C),R++}}else if(R>B)for(;R<=$;)Ue(p[R],A,k,!0),R++;else{const W=R,te=R,le=new Map;for(R=te;R<=B;R++){const qe=g[R]=C?xt(g[R]):mt(g[R]);qe.key!=null&&le.set(qe.key,R)}let he,be=0;const Ae=B-te+1;let lt=!1,ct=0;const Us=new Array(Ae);for(R=0;R<Ae;R++)Us[R]=0;for(R=W;R<=$;R++){const qe=p[R];if(be>=Ae){Ue(qe,A,k,!0);continue}let ut;if(qe.key!=null)ut=le.get(qe.key);else for(he=te;he<=B;he++)if(Us[he-te]===0&&Bs(qe,g[he])){ut=he;break}ut===void 0?Ue(qe,A,k,!0):(Us[ut-te]=R+1,ut>=ct?ct=ut:lt=!0,y(qe,g[ut],v,null,A,k,j,P,C),be++)}const Wi=lt?eh(Us):ks;for(he=Wi.length-1,R=Ae-1;R>=0;R--){const qe=te+R,ut=g[qe],Gi=g[qe+1],Ji=qe+1<H?Gi.el||kl(Gi):E;Us[R]===0?y(null,ut,v,Ji,A,k,j,P,C):lt&&(he<0||R!==Wi[he]?at(ut,v,Ji,2):he--)}}},at=(p,g,v,E,A=null)=>{const{el:k,type:j,transition:P,children:C,shapeFlag:R}=p;if(R&6){at(p.component.subTree,g,v,E);return}if(R&128){p.suspense.move(g,v,E);return}if(R&64){j.move(p,g,v,D);return}if(j===Me){r(k,g,v);for(let $=0;$<C.length;$++)at(C[$],g,v,E);r(p.anchor,g,v);return}if(j===jn){b(p,g,v);return}if(E!==2&&R&1&&P)if(E===0)P.beforeEnter(k),r(k,g,v),Be(()=>P.enter(k),A);else{const{leave:$,delayLeave:B,afterLeave:W}=P,te=()=>{p.ctx.isUnmounted?n(k):r(k,g,v)},le=()=>{k._isLeaving&&k[yu](!0),$(k,()=>{te(),W&&W()})};B?B(k,te,le):le()}else r(k,g,v)},Ue=(p,g,v,E=!1,A=!1)=>{const{type:k,props:j,ref:P,children:C,dynamicChildren:R,shapeFlag:H,patchFlag:$,dirs:B,cacheIndex:W,memo:te}=p;if($===-2&&(A=!1),P!=null&&(It(),Xs(P,null,v,p,!0),jt()),W!=null&&(g.renderCache[W]=void 0),H&256){g.ctx.deactivate(p);return}const le=H&1&&B,he=!Qs(p);let be;if(he&&(be=j&&j.onVnodeBeforeUnmount)&&ht(be,g,p),H&6)Jt(p.component,v,E);else{if(H&128){p.suspense.unmount(v,E);return}le&&zt(p,null,g,"beforeUnmount"),H&64?p.type.remove(p,g,v,D,E):R&&!R.hasOnce&&(k!==Me||$>0&&$&64)?ze(R,g,v,!1,!0):(k===Me&&$&384||!A&&H&16)&&ze(C,g,v),E&&os(p)}const Ae=te!=null&&W==null;(he&&(be=j&&j.onVnodeUnmounted)||le||Ae)&&Be(()=>{be&&ht(be,g,p),le&&zt(p,null,g,"unmounted"),Ae&&(p.el=null)},v)},os=p=>{const{type:g,el:v,anchor:E,transition:A}=p;if(g===Me){as(v,E);return}if(g===jn){x(p);return}const k=()=>{n(v),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(p.shapeFlag&1&&A&&!A.persisted){const{leave:j,delayLeave:P}=A,C=()=>j(v,k);P?P(p.el,k,C):C()}else k()},as=(p,g)=>{let v;for(;p!==g;)v=d(p),n(p),p=v;n(g)},Jt=(p,g,v)=>{const{bum:E,scope:A,job:k,subTree:j,um:P,m:C,a:R}=p;co(C),co(R),E&&Br(E),A.stop(),k&&(k.flags|=8,Ue(j,p,g,v)),P&&Be(P,g),Be(()=>{p.isUnmounted=!0},g)},ze=(p,g,v,E=!1,A=!1,k=0)=>{for(let j=k;j<p.length;j++)Ue(p[j],g,v,E,A)},T=p=>{if(p.shapeFlag&6)return T(p.component.subTree);if(p.shapeFlag&128)return p.suspense.next();const g=d(p.anchor||p.el),v=g&&g[gu];return v?d(v):g};let L=!1;const N=(p,g,v)=>{let E;p==null?g._vnode&&(Ue(g._vnode,null,null,!0),E=g._vnode.component):y(g._vnode||null,p,g,null,null,null,v),g._vnode=p,L||(L=!0,Zi(E),tl(),L=!1)},D={p:y,um:Ue,m:at,r:os,mt:Gt,mc:Q,pc:re,pbc:ge,n:T,o:t};return{render:N,hydrate:void 0,createApp:Uu(N)}}function In({type:t,props:e},s){return s==="svg"&&t==="foreignObject"||s==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:s}function Yt({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Zu(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Sl(t,e,s=!1){const r=t.children,n=e.children;if(q(r)&&q(n))for(let i=0;i<r.length;i++){const o=r[i];let a=n[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[i]=xt(n[i]),a.el=o.el),!s&&a.patchFlag!==-2&&Sl(o,a)),a.type===yn&&(a.patchFlag===-1&&(a=n[i]=xt(a)),a.el=o.el),a.type===Wt&&!a.el&&(a.el=o.el)}}function eh(t){const e=t.slice(),s=[0];let r,n,i,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(n=s[s.length-1],t[n]<c){e[r]=n,s.push(r);continue}for(i=0,o=s.length-1;i<o;)a=i+o>>1,t[s[a]]<c?i=a+1:o=a;c<t[s[i]]&&(i>0&&(e[r]=s[i-1]),s[i]=r)}}for(i=s.length,o=s[i-1];i-- >0;)s[i]=o,o=e[o];return s}function El(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:El(e)}function co(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function kl(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?kl(e.subTree):null}const Tl=t=>t.__isSuspense;function th(t,e){e&&e.pendingBranch?q(t)?e.effects.push(...t):e.effects.push(t):uu(t)}const Me=Symbol.for("v-fgt"),yn=Symbol.for("v-txt"),Wt=Symbol.for("v-cmt"),jn=Symbol.for("v-stc"),er=[];let Ge=null;function G(t=!1){er.push(Ge=t?null:[])}function sh(){er.pop(),Ge=er[er.length-1]||null}let ur=1;function zr(t,e=!1){ur+=t,t<0&&Ge&&e&&(Ge.hasOnce=!0)}function Al(t){return t.dynamicChildren=ur>0?Ge||ks:null,sh(),ur>0&&Ge&&Ge.push(t),t}function J(t,e,s,r,n,i){return Al(O(t,e,s,r,n,i,!0))}function rh(t,e,s,r,n){return Al(ke(t,e,s,r,n,!0))}function Yr(t){return t?t.__v_isVNode===!0:!1}function Bs(t,e){return t.type===e.type&&t.key===e.key}const Rl=({key:t})=>t??null,Hr=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?ve(t)||_e(t)||Y(t)?{i:Xe,r:t,k:e,f:!!s}:t:null);function O(t,e=null,s=null,r=0,n=null,i=t===Me?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Rl(e),ref:e&&Hr(e),scopeId:rl,slotScopeIds:null,children:s,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:Xe};return a?(Bi(l,s),i&128&&t.normalize(l)):s&&(l.shapeFlag|=ve(s)?8:16),ur>0&&!o&&Ge&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Ge.push(l),l}const ke=nh;function nh(t,e=null,s=null,r=0,n=null,i=!1){if((!t||t===Ou)&&(t=Wt),Yr(t)){const a=js(t,e,!0);return s&&Bi(a,s),ur>0&&!i&&Ge&&(a.shapeFlag&6?Ge[Ge.indexOf(t)]=a:Ge.push(a)),a.patchFlag=-2,a}if(ph(t)&&(t=t.__vccOpts),e){e=ih(e);let{class:a,style:l}=e;a&&!ve(a)&&(e.class=We(a)),oe(l)&&(hn(l)&&!q(l)&&(l=Oe({},l)),e.style=Ti(l))}const o=ve(t)?1:Tl(t)?128:mu(t)?64:oe(t)?4:Y(t)?2:0;return O(t,e,s,r,n,o,i,!0)}function ih(t){return t?hn(t)||ml(t)?Oe({},t):t:null}function js(t,e,s=!1,r=!1){const{props:n,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?oh(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&Rl(c),ref:e&&e.ref?s&&i?q(i)?i.concat(Hr(e)):[i,Hr(e)]:Hr(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Me?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&js(t.ssContent),ssFallback:t.ssFallback&&js(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&$i(u,l.clone(u)),u}function Ss(t=" ",e=0){return ke(yn,null,t,e)}function He(t="",e=!1){return e?(G(),rh(Wt,null,t)):ke(Wt,null,t)}function mt(t){return t==null||typeof t=="boolean"?ke(Wt):q(t)?ke(Me,null,t.slice()):Yr(t)?xt(t):ke(yn,null,String(t))}function xt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:js(t)}function Bi(t,e){let s=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(q(e))s=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),Bi(t,n()),n._c&&(n._d=!0));return}else{s=32;const n=e._;!n&&!ml(e)?e._ctx=Xe:n===3&&Xe&&(Xe.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Y(e)?(e={default:e,_ctx:Xe},s=32):(e=String(e),r&64?(s=16,e=[Ss(e)]):s=8);t.children=e,t.shapeFlag|=s}function oh(...t){const e={};for(let s=0;s<t.length;s++){const r=t[s];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=We([e.class,r.class]));else if(n==="style")e.style=Ti([e.style,r.style]);else if(nn(n)){const i=e[n],o=r[n];o&&i!==o&&!(q(i)&&i.includes(o))?e[n]=i?[].concat(i,o):o:o==null&&i==null&&!on(n)&&(e[n]=o)}else n!==""&&(e[n]=r[n])}return e}function ht(t,e,s,r=null){bt(t,e,7,[s,r])}const ah=hl();let lh=0;function ch(t,e,s){const r=t.type,n=(e?e.appContext:t.appContext)||ah,i={uid:lh++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ja(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:vl(r,n),emitsOptions:dl(r,n),emit:null,emitted:null,propsDefaults:ue,inheritAttrs:r.inheritAttrs,ctx:ue,data:ue,props:ue,attrs:ue,slots:ue,refs:ue,setupState:ue,setupContext:null,suspense:s,suspenseId:s?s.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Bu.bind(null,i),t.ce&&t.ce(i),i}let $e=null;const xl=()=>$e||Xe;let Xr,ti;{const t=cn(),e=(s,r)=>{let n;return(n=t[s])||(n=t[s]=[]),n.push(r),i=>{n.length>1?n.forEach(o=>o(i)):n[0](i)}};Xr=e("__VUE_INSTANCE_SETTERS__",s=>$e=s),ti=e("__VUE_SSR_SETTERS__",s=>hr=s)}const Er=t=>{const e=$e;return Xr(t),t.scope.on(),()=>{t.scope.off(),Xr(e)}},uo=()=>{$e&&$e.scope.off(),Xr(null)};function Ol(t){return t.vnode.shapeFlag&4}let hr=!1;function uh(t,e=!1,s=!1){e&&ti(e);const{props:r,children:n}=t.vnode,i=Ol(t);Ku(t,r,i,e),zu(t,n,s||e);const o=i?hh(t,e):void 0;return e&&ti(!1),o}function hh(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Cu);const{setup:r}=s;if(r){It();const n=t.setupContext=r.length>1?fh(t):null,i=Er(t),o=Sr(r,t,0,[t.props,n]),a=Ta(o);if(jt(),i(),(a||t.sp)&&!Qs(t)&&ol(t),a){if(o.then(uo,uo),e)return o.then(l=>{ho(t,l)}).catch(l=>{dn(l,t,0)});t.asyncDep=o}else ho(t,o)}else Cl(t)}function ho(t,e,s){Y(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:oe(e)&&(t.setupState=Qa(e)),Cl(t)}function Cl(t,e,s){const r=t.type;t.render||(t.render=r.render||_t);{const n=Er(t);It();try{Pu(t)}finally{jt(),n()}}}const dh={get(t,e){return Ce(t,"get",""),t[e]}};function fh(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,dh),slots:t.slots,emit:t.emit,expose:e}}function vn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Qa(ji(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in Zs)return Zs[s](t)},has(e,s){return s in e||s in Zs}})):t.proxy}function ph(t){return Y(t)&&"__vccOpts"in t}const Ve=(t,e)=>iu(t,e,hr);function Pl(t,e,s){try{zr(-1);const r=arguments.length;return r===2?oe(e)&&!q(e)?Yr(e)?ke(t,null,[e]):ke(t,e):ke(t,null,e):(r>3?s=Array.prototype.slice.call(arguments,2):r===3&&Yr(s)&&(s=[s]),ke(t,e,s))}finally{zr(1)}}const gh="3.5.34";/**
14
14
  * @vue/runtime-dom v3.5.34
15
15
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
16
  * @license MIT
17
- **/let si;const fo=typeof window<"u"&&window.trustedTypes;if(fo)try{si=fo.createPolicy("vue",{createHTML:t=>t})}catch{}const Il=si?t=>si.createHTML(t):t=>t,mh="http://www.w3.org/2000/svg",yh="http://www.w3.org/1998/Math/MathML",Tt=typeof document<"u"?document:null,po=Tt&&Tt.createElement("template"),vh={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,r)=>{const n=e==="svg"?Tt.createElementNS(mh,t):e==="mathml"?Tt.createElementNS(yh,t):s?Tt.createElement(t,{is:s}):Tt.createElement(t);return t==="select"&&r&&r.multiple!=null&&n.setAttribute("multiple",r.multiple),n},createText:t=>Tt.createTextNode(t),createComment:t=>Tt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Tt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,r,n,i){const o=s?s.previousSibling:e.lastChild;if(n&&(n===i||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),s),!(n===i||!(n=n.nextSibling)););else{po.innerHTML=Il(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=po.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},_h=Symbol("_vtc");function bh(t,e,s){const r=t[_h];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const go=Symbol("_vod"),wh=Symbol("_vsh"),Sh=Symbol(""),Eh=/(?:^|;)\s*display\s*:/;function kh(t,e,s){const r=t.style,n=ve(s);let i=!1;if(s&&!n){if(e)if(ve(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();s[a]==null&&qs(r,a,"")}else for(const o in e)s[o]==null&&qs(r,o,"");for(const o in s){o==="display"&&(i=!0);const a=s[o];a!=null?Ah(t,o,!ve(e)&&e?e[o]:void 0,a)||qs(r,o,a):qs(r,o,"")}}else if(n){if(e!==s){const o=r[Sh];o&&(s+=";"+o),r.cssText=s,i=Eh.test(s)}}else e&&t.removeAttribute("style");go in t&&(t[go]=i?r.display:"",t[wh]&&(r.display="none"))}const mo=/\s*!important$/;function qs(t,e,s){if(q(s))s.forEach(r=>qs(t,e,r));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const r=Th(t,e);mo.test(s)?t.setProperty(is(r),s.replace(mo,""),"important"):t[r]=s}}const yo=["Webkit","Moz","ms"],Nn={};function Th(t,e){const s=Nn[e];if(s)return s;let r=st(e);if(r!=="filter"&&r in t)return Nn[e]=r;r=Oa(r);for(let n=0;n<yo.length;n++){const i=yo[n]+r;if(i in t)return Nn[e]=i}return e}function Ah(t,e,s,r){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&ve(r)&&s===r}const vo="http://www.w3.org/1999/xlink";function _o(t,e,s,r,n,i=Cc(e)){r&&e.startsWith("xlink:")?s==null?t.removeAttributeNS(vo,e.slice(6,e.length)):t.setAttributeNS(vo,e,s):s==null||i&&!Ca(s)?t.removeAttribute(e):t.setAttribute(e,i?"":Xe(s)?String(s):s)}function bo(t,e,s,r,n){if(e==="innerHTML"||e==="textContent"){s!=null&&(t[e]=e==="innerHTML"?Il(s):s);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=s==null?t.type==="checkbox"?"on":"":String(s);(a!==l||!("_value"in t))&&(t.value=l),s==null&&t.removeAttribute(e),t._value=s;return}let o=!1;if(s===""||s==null){const a=typeof t[e];a==="boolean"?s=Ca(s):s==null&&a==="string"?(s="",o=!0):a==="number"&&(s=0,o=!0)}try{t[e]=s}catch{}o&&t.removeAttribute(n||e)}function ms(t,e,s,r){t.addEventListener(e,s,r)}function Rh(t,e,s,r){t.removeEventListener(e,s,r)}const wo=Symbol("_vei");function Oh(t,e,s,r,n=null){const i=t[wo]||(t[wo]={}),o=i[e];if(r&&o)o.value=r;else{const[a,l]=xh(e);if(r){const c=i[e]=Ih(r,n);ms(t,a,c,l)}else o&&(Rh(t,a,o,l),i[e]=void 0)}}const So=/(?:Once|Passive|Capture)$/;function xh(t){let e;if(So.test(t)){e={};let r;for(;r=t.match(So);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):is(t.slice(2)),e]}let $n=0;const Ch=Promise.resolve(),Ph=()=>$n||(Ch.then(()=>$n=0),$n=Date.now());function Ih(t,e){const s=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=s.attached)return;bt(jh(r,s.value),e,5,[r])};return s.value=t,s.attached=Ph(),s}function jh(t,e){if(q(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(r=>n=>!n._stopped&&r&&r(n))}else return e}const Eo=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Nh=(t,e,s,r,n,i)=>{const o=n==="svg";e==="class"?bh(t,r,o):e==="style"?kh(t,s,r):rn(e)?nn(e)||Oh(t,e,s,r,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):$h(t,e,r,o))?(bo(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&_o(t,e,r,o,i,e!=="value")):t._isVueCE&&(Lh(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!ve(r)))?bo(t,st(e),r,i,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),_o(t,e,r,o))};function $h(t,e,s,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Eo(e)&&J(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=t.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return Eo(e)&&ve(s)?!1:e in t}function Lh(t,e){const s=t._def.props;if(!s)return!1;const r=st(e);return Array.isArray(s)?s.some(n=>st(n)===r):Object.keys(s).some(n=>st(n)===r)}const ko=t=>{const e=t.props["onUpdate:modelValue"]||!1;return q(e)?s=>Dr(e,s):e};function Uh(t){t.target.composing=!0}function To(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ln=Symbol("_assign");function Ao(t,e,s){return e&&(t=t.trim()),s&&(t=ki(t)),t}const xs={created(t,{modifiers:{lazy:e,trim:s,number:r}},n){t[Ln]=ko(n);const i=r||n.props&&n.props.type==="number";ms(t,e?"change":"input",o=>{o.target.composing||t[Ln](Ao(t.value,s,i))}),(s||i)&&ms(t,"change",()=>{t.value=Ao(t.value,s,i)}),e||(ms(t,"compositionstart",Uh),ms(t,"compositionend",To),ms(t,"change",To))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:s,modifiers:{lazy:r,trim:n,number:i}},o){if(t[Ln]=ko(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?ki(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(r&&e===s||n&&t.value.trim()===l)||(t.value=l)}},Dh=["ctrl","shift","alt","meta"],Bh={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>Dh.some(s=>t[`${s}Key`]&&!e.includes(s))},Mi=(t,e)=>{if(!t)return t;const s=t._withMods||(t._withMods={}),r=e.join(".");return s[r]||(s[r]=(n,...i)=>{for(let o=0;o<e.length;o++){const a=Bh[e[o]];if(a&&a(n,e))return}return t(n,...i)})},Mh=xe({patchProp:Nh},vh);let Ro;function Hh(){return Ro||(Ro=Xu(Mh))}const Fh=(...t)=>{const e=Hh().createApp(...t),{mount:s}=e;return e.mount=r=>{const n=Vh(r);if(!n)return;const i=e._component;!J(i)&&!i.render&&!i.template&&(i.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=s(n,!1,qh(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e};function qh(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Vh(t){return ve(t)?document.querySelector(t):t}/*!
17
+ **/let si;const fo=typeof window<"u"&&window.trustedTypes;if(fo)try{si=fo.createPolicy("vue",{createHTML:t=>t})}catch{}const Il=si?t=>si.createHTML(t):t=>t,mh="http://www.w3.org/2000/svg",yh="http://www.w3.org/1998/Math/MathML",Tt=typeof document<"u"?document:null,po=Tt&&Tt.createElement("template"),vh={insert:(t,e,s)=>{e.insertBefore(t,s||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,s,r)=>{const n=e==="svg"?Tt.createElementNS(mh,t):e==="mathml"?Tt.createElementNS(yh,t):s?Tt.createElement(t,{is:s}):Tt.createElement(t);return t==="select"&&r&&r.multiple!=null&&n.setAttribute("multiple",r.multiple),n},createText:t=>Tt.createTextNode(t),createComment:t=>Tt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Tt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,s,r,n,i){const o=s?s.previousSibling:e.lastChild;if(n&&(n===i||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),s),!(n===i||!(n=n.nextSibling)););else{po.innerHTML=Il(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=po.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,s)}return[o?o.nextSibling:e.firstChild,s?s.previousSibling:e.lastChild]}},_h=Symbol("_vtc");function bh(t,e,s){const r=t[_h];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const go=Symbol("_vod"),wh=Symbol("_vsh"),Sh=Symbol(""),Eh=/(?:^|;)\s*display\s*:/;function kh(t,e,s){const r=t.style,n=ve(s);let i=!1;if(s&&!n){if(e)if(ve(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();s[a]==null&&Vs(r,a,"")}else for(const o in e)s[o]==null&&Vs(r,o,"");for(const o in s){o==="display"&&(i=!0);const a=s[o];a!=null?Ah(t,o,!ve(e)&&e?e[o]:void 0,a)||Vs(r,o,a):Vs(r,o,"")}}else if(n){if(e!==s){const o=r[Sh];o&&(s+=";"+o),r.cssText=s,i=Eh.test(s)}}else e&&t.removeAttribute("style");go in t&&(t[go]=i?r.display:"",t[wh]&&(r.display="none"))}const mo=/\s*!important$/;function Vs(t,e,s){if(q(s))s.forEach(r=>Vs(t,e,r));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const r=Th(t,e);mo.test(s)?t.setProperty(is(r),s.replace(mo,""),"important"):t[r]=s}}const yo=["Webkit","Moz","ms"],Nn={};function Th(t,e){const s=Nn[e];if(s)return s;let r=rt(e);if(r!=="filter"&&r in t)return Nn[e]=r;r=xa(r);for(let n=0;n<yo.length;n++){const i=yo[n]+r;if(i in t)return Nn[e]=i}return e}function Ah(t,e,s,r){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&ve(r)&&s===r}const vo="http://www.w3.org/1999/xlink";function _o(t,e,s,r,n,i=Cc(e)){r&&e.startsWith("xlink:")?s==null?t.removeAttributeNS(vo,e.slice(6,e.length)):t.setAttributeNS(vo,e,s):s==null||i&&!Ca(s)?t.removeAttribute(e):t.setAttribute(e,i?"":Ze(s)?String(s):s)}function bo(t,e,s,r,n){if(e==="innerHTML"||e==="textContent"){s!=null&&(t[e]=e==="innerHTML"?Il(s):s);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=s==null?t.type==="checkbox"?"on":"":String(s);(a!==l||!("_value"in t))&&(t.value=l),s==null&&t.removeAttribute(e),t._value=s;return}let o=!1;if(s===""||s==null){const a=typeof t[e];a==="boolean"?s=Ca(s):s==null&&a==="string"?(s="",o=!0):a==="number"&&(s=0,o=!0)}try{t[e]=s}catch{}o&&t.removeAttribute(n||e)}function ms(t,e,s,r){t.addEventListener(e,s,r)}function Rh(t,e,s,r){t.removeEventListener(e,s,r)}const wo=Symbol("_vei");function xh(t,e,s,r,n=null){const i=t[wo]||(t[wo]={}),o=i[e];if(r&&o)o.value=r;else{const[a,l]=Oh(e);if(r){const c=i[e]=Ih(r,n);ms(t,a,c,l)}else o&&(Rh(t,a,o,l),i[e]=void 0)}}const So=/(?:Once|Passive|Capture)$/;function Oh(t){let e;if(So.test(t)){e={};let r;for(;r=t.match(So);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):is(t.slice(2)),e]}let $n=0;const Ch=Promise.resolve(),Ph=()=>$n||(Ch.then(()=>$n=0),$n=Date.now());function Ih(t,e){const s=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=s.attached)return;bt(jh(r,s.value),e,5,[r])};return s.value=t,s.attached=Ph(),s}function jh(t,e){if(q(e)){const s=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{s.call(t),t._stopped=!0},e.map(r=>n=>!n._stopped&&r&&r(n))}else return e}const Eo=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Nh=(t,e,s,r,n,i)=>{const o=n==="svg";e==="class"?bh(t,r,o):e==="style"?kh(t,s,r):nn(e)?on(e)||xh(t,e,s,r,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):$h(t,e,r,o))?(bo(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&_o(t,e,r,o,i,e!=="value")):t._isVueCE&&(Lh(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!ve(r)))?bo(t,rt(e),r,i,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),_o(t,e,r,o))};function $h(t,e,s,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Eo(e)&&Y(s));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=t.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return Eo(e)&&ve(s)?!1:e in t}function Lh(t,e){const s=t._def.props;if(!s)return!1;const r=rt(e);return Array.isArray(s)?s.some(n=>rt(n)===r):Object.keys(s).some(n=>rt(n)===r)}const ko=t=>{const e=t.props["onUpdate:modelValue"]||!1;return q(e)?s=>Br(e,s):e};function Uh(t){t.target.composing=!0}function To(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ln=Symbol("_assign");function Ao(t,e,s){return e&&(t=t.trim()),s&&(t=ki(t)),t}const Os={created(t,{modifiers:{lazy:e,trim:s,number:r}},n){t[Ln]=ko(n);const i=r||n.props&&n.props.type==="number";ms(t,e?"change":"input",o=>{o.target.composing||t[Ln](Ao(t.value,s,i))}),(s||i)&&ms(t,"change",()=>{t.value=Ao(t.value,s,i)}),e||(ms(t,"compositionstart",Uh),ms(t,"compositionend",To),ms(t,"change",To))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:s,modifiers:{lazy:r,trim:n,number:i}},o){if(t[Ln]=ko(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?ki(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(r&&e===s||n&&t.value.trim()===l)||(t.value=l)}},Dh=["ctrl","shift","alt","meta"],Bh={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>Dh.some(s=>t[`${s}Key`]&&!e.includes(s))},Mi=(t,e)=>{if(!t)return t;const s=t._withMods||(t._withMods={}),r=e.join(".");return s[r]||(s[r]=(n,...i)=>{for(let o=0;o<e.length;o++){const a=Bh[e[o]];if(a&&a(n,e))return}return t(n,...i)})},Mh=Oe({patchProp:Nh},vh);let Ro;function Hh(){return Ro||(Ro=Xu(Mh))}const Fh=(...t)=>{const e=Hh().createApp(...t),{mount:s}=e;return e.mount=r=>{const n=Vh(r);if(!n)return;const i=e._component;!Y(i)&&!i.render&&!i.template&&(i.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=s(n,!1,qh(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e};function qh(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Vh(t){return ve(t)?document.querySelector(t):t}/*!
18
18
  * pinia v2.3.1
19
19
  * (c) 2025 Eduardo San Martin Morote
20
20
  * @license MIT
21
- */let jl;const _n=t=>jl=t,Nl=Symbol();function ri(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var er;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(er||(er={}));function Kh(){const t=Na(!0),e=t.run(()=>ue({}));let s=[],r=[];const n=ji({install(i){_n(n),n._a=i,i.provide(Nl,n),i.config.globalProperties.$pinia=n,r.forEach(o=>s.push(o)),r=[]},use(i){return this._a?s.push(i):r.push(i),this},_p:s,_a:null,_e:t,_s:new Map,state:e});return n}const $l=()=>{};function Oo(t,e,s,r=$l){t.push(e);const n=()=>{const i=t.indexOf(e);i>-1&&(t.splice(i,1),r())};return!s&&$a()&&Ic(n),n}function cs(t,...e){t.slice().forEach(s=>{s(...e)})}const Wh=t=>t(),xo=Symbol(),Un=Symbol();function ni(t,e){t instanceof Map&&e instanceof Map?e.forEach((s,r)=>t.set(r,s)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const s in e){if(!e.hasOwnProperty(s))continue;const r=e[s],n=t[s];ri(n)&&ri(r)&&t.hasOwnProperty(s)&&!_e(r)&&!Pt(r)?t[s]=ni(n,r):t[s]=r}return t}const Gh=Symbol();function Jh(t){return!ri(t)||!t.hasOwnProperty(Gh)}const{assign:Ht}=Object;function zh(t){return!!(_e(t)&&t.effect)}function Yh(t,e,s,r){const{state:n,actions:i,getters:o}=e,a=s.state.value[t];let l;function c(){a||(s.state.value[t]=n?n():{});const u=tu(s.state.value[t]);return Ht(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=ji(qe(()=>{_n(s);const f=s._s.get(t);return o[d].call(f,f)})),h),{}))}return l=Ll(t,c,e,s,r,!0),l}function Ll(t,e,s={},r,n,i){let o;const a=Ht({actions:{}},s),l={deep:!0};let c,u,h=[],d=[],f;const m=r.state.value[t];!i&&!m&&(r.state.value[t]={});let v;function A(Y){let K;c=u=!1,typeof Y=="function"?(Y(r.state.value[t]),K={type:er.patchFunction,storeId:t,events:f}):(ni(r.state.value[t],Y),K={type:er.patchObject,payload:Y,storeId:t,events:f});const ge=v=Symbol();dn().then(()=>{v===ge&&(c=!0)}),u=!0,cs(h,K,r.state.value[t])}const T=i?function(){const{state:K}=s,ge=K?K():{};this.$patch(Pe=>{Ht(Pe,ge)})}:$l;function b(){o.stop(),h=[],d=[],r._s.delete(t)}const _=(Y,K="")=>{if(xo in Y)return Y[Un]=K,Y;const ge=function(){_n(r);const Pe=Array.from(arguments),Me=[],Le=[];function Gt(z){Me.push(z)}function Dt(z){Le.push(z)}cs(d,{args:Pe,name:ge[Un],store:M,after:Gt,onError:Dt});let pe;try{pe=Y.apply(this&&this.$id===t?this:M,Pe)}catch(z){throw cs(Le,z),z}return pe instanceof Promise?pe.then(z=>(cs(Me,z),z)).catch(z=>(cs(Le,z),Promise.reject(z))):(cs(Me,pe),pe)};return ge[xo]=!0,ge[Un]=K,ge},O={_p:r,$id:t,$onAction:Oo.bind(null,d),$patch:A,$reset:T,$subscribe(Y,K={}){const ge=Oo(h,Y,K.detached,()=>Pe()),Pe=o.run(()=>Os(()=>r.state.value[t],Me=>{(K.flush==="sync"?u:c)&&Y({storeId:t,type:er.direct,events:f},Me)},Ht({},l,K)));return ge},$dispose:b},M=br(O);r._s.set(t,M);const V=(r._a&&r._a.runWithContext||Wh)(()=>r._e.run(()=>(o=Na()).run(()=>e({action:_}))));for(const Y in V){const K=V[Y];if(_e(K)&&!zh(K)||Pt(K))i||(m&&Jh(K)&&(_e(K)?K.value=m[Y]:ni(K,m[Y])),r.state.value[t][Y]=K);else if(typeof K=="function"){const ge=_(K,Y);V[Y]=ge,a.actions[Y]=K}}return Ht(M,V),Ht(te(M),V),Object.defineProperty(M,"$state",{get:()=>r.state.value[t],set:Y=>{A(K=>{Ht(K,Y)})}}),r._p.forEach(Y=>{Ht(M,o.run(()=>Y({store:M,app:r._a,pinia:r,options:a})))}),m&&i&&s.hydrate&&s.hydrate(M.$state,m),c=!0,u=!0,M}/*! #__NO_SIDE_EFFECTS__ */function Ul(t,e,s){let r,n;const i=typeof e=="function";typeof t=="string"?(r=t,n=i?s:e):(n=t,r=t.id);function o(a,l){const c=hu();return a=a||(c?Ye(Nl,null):null),a&&_n(a),a=jl,a._s.has(r)||(i?Ll(r,e,n,a):Yh(r,n,a)),a._s.get(r)}return o.$id=r,o}/*!
21
+ */let jl;const _n=t=>jl=t,Nl=Symbol();function ri(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var tr;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(tr||(tr={}));function Kh(){const t=Na(!0),e=t.run(()=>ae({}));let s=[],r=[];const n=ji({install(i){_n(n),n._a=i,i.provide(Nl,n),i.config.globalProperties.$pinia=n,r.forEach(o=>s.push(o)),r=[]},use(i){return this._a?s.push(i):r.push(i),this},_p:s,_a:null,_e:t,_s:new Map,state:e});return n}const $l=()=>{};function xo(t,e,s,r=$l){t.push(e);const n=()=>{const i=t.indexOf(e);i>-1&&(t.splice(i,1),r())};return!s&&$a()&&Ic(n),n}function cs(t,...e){t.slice().forEach(s=>{s(...e)})}const Wh=t=>t(),Oo=Symbol(),Un=Symbol();function ni(t,e){t instanceof Map&&e instanceof Map?e.forEach((s,r)=>t.set(r,s)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const s in e){if(!e.hasOwnProperty(s))continue;const r=e[s],n=t[s];ri(n)&&ri(r)&&t.hasOwnProperty(s)&&!_e(r)&&!Pt(r)?t[s]=ni(n,r):t[s]=r}return t}const Gh=Symbol();function Jh(t){return!ri(t)||!t.hasOwnProperty(Gh)}const{assign:Ht}=Object;function zh(t){return!!(_e(t)&&t.effect)}function Yh(t,e,s,r){const{state:n,actions:i,getters:o}=e,a=s.state.value[t];let l;function c(){a||(s.state.value[t]=n?n():{});const u=tu(s.state.value[t]);return Ht(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=ji(Ve(()=>{_n(s);const f=s._s.get(t);return o[d].call(f,f)})),h),{}))}return l=Ll(t,c,e,s,r,!0),l}function Ll(t,e,s={},r,n,i){let o;const a=Ht({actions:{}},s),l={deep:!0};let c,u,h=[],d=[],f;const m=r.state.value[t];!i&&!m&&(r.state.value[t]={});let y;function _(Q){let K;c=u=!1,typeof Q=="function"?(Q(r.state.value[t]),K={type:tr.patchFunction,storeId:t,events:f}):(ni(r.state.value[t],Q),K={type:tr.patchObject,payload:Q,storeId:t,events:f});const ge=y=Symbol();fn().then(()=>{y===ge&&(c=!0)}),u=!0,cs(h,K,r.state.value[t])}const S=i?function(){const{state:K}=s,ge=K?K():{};this.$patch(Pe=>{Ht(Pe,ge)})}:$l;function w(){o.stop(),h=[],d=[],r._s.delete(t)}const b=(Q,K="")=>{if(Oo in Q)return Q[Un]=K,Q;const ge=function(){_n(r);const Pe=Array.from(arguments),Fe=[],Le=[];function Gt(X){Fe.push(X)}function Dt(X){Le.push(X)}cs(d,{args:Pe,name:ge[Un],store:M,after:Gt,onError:Dt});let pe;try{pe=Q.apply(this&&this.$id===t?this:M,Pe)}catch(X){throw cs(Le,X),X}return pe instanceof Promise?pe.then(X=>(cs(Fe,X),X)).catch(X=>(cs(Le,X),Promise.reject(X))):(cs(Fe,pe),pe)};return ge[Oo]=!0,ge[Un]=K,ge},x={_p:r,$id:t,$onAction:xo.bind(null,d),$patch:_,$reset:S,$subscribe(Q,K={}){const ge=xo(h,Q,K.detached,()=>Pe()),Pe=o.run(()=>xs(()=>r.state.value[t],Fe=>{(K.flush==="sync"?u:c)&&Q({storeId:t,type:tr.direct,events:f},Fe)},Ht({},l,K)));return ge},$dispose:w},M=wr(x);r._s.set(t,M);const V=(r._a&&r._a.runWithContext||Wh)(()=>r._e.run(()=>(o=Na()).run(()=>e({action:b}))));for(const Q in V){const K=V[Q];if(_e(K)&&!zh(K)||Pt(K))i||(m&&Jh(K)&&(_e(K)?K.value=m[Q]:ni(K,m[Q])),r.state.value[t][Q]=K);else if(typeof K=="function"){const ge=b(K,Q);V[Q]=ge,a.actions[Q]=K}}return Ht(M,V),Ht(se(M),V),Object.defineProperty(M,"$state",{get:()=>r.state.value[t],set:Q=>{_(K=>{Ht(K,Q)})}}),r._p.forEach(Q=>{Ht(M,o.run(()=>Q({store:M,app:r._a,pinia:r,options:a})))}),m&&i&&s.hydrate&&s.hydrate(M.$state,m),c=!0,u=!0,M}/*! #__NO_SIDE_EFFECTS__ */function Ul(t,e,s){let r,n;const i=typeof e=="function";typeof t=="string"?(r=t,n=i?s:e):(n=t,r=t.id);function o(a,l){const c=hu();return a=a||(c?Qe(Nl,null):null),a&&_n(a),a=jl,a._s.has(r)||(i?Ll(r,e,n,a):Yh(r,n,a)),a._s.get(r)}return o.$id=r,o}/*!
22
22
  * vue-router v4.6.4
23
23
  * (c) 2025 Eduardo San Martin Morote
24
24
  * @license MIT
25
- */const ys=typeof document<"u";function Dl(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Xh(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&Dl(t.default)}const re=Object.assign;function Dn(t,e){const s={};for(const r in e){const n=e[r];s[r]=ot(n)?n.map(t):t(n)}return s}const tr=()=>{},ot=Array.isArray;function Co(t,e){const s={};for(const r in t)s[r]=r in e?e[r]:t[r];return s}const Bl=/#/g,Qh=/&/g,Zh=/\//g,ed=/=/g,td=/\?/g,Ml=/\+/g,sd=/%5B/g,rd=/%5D/g,Hl=/%5E/g,nd=/%60/g,Fl=/%7B/g,id=/%7C/g,ql=/%7D/g,od=/%20/g;function Hi(t){return t==null?"":encodeURI(""+t).replace(id,"|").replace(sd,"[").replace(rd,"]")}function ad(t){return Hi(t).replace(Fl,"{").replace(ql,"}").replace(Hl,"^")}function ii(t){return Hi(t).replace(Ml,"%2B").replace(od,"+").replace(Bl,"%23").replace(Qh,"%26").replace(nd,"`").replace(Fl,"{").replace(ql,"}").replace(Hl,"^")}function ld(t){return ii(t).replace(ed,"%3D")}function cd(t){return Hi(t).replace(Bl,"%23").replace(td,"%3F")}function ud(t){return cd(t).replace(Zh,"%2F")}function ur(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const hd=/\/$/,dd=t=>t.replace(hd,"");function Bn(t,e,s="/"){let r,n={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=e.slice(0,l),i=e.slice(l,a>0?a:e.length),n=t(i.slice(1))),a>=0&&(r=r||e.slice(0,a),o=e.slice(a,e.length)),r=md(r??e,s),{fullPath:r+i+o,path:r,query:n,hash:ur(o)}}function fd(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function Po(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function pd(t,e,s){const r=e.matched.length-1,n=s.matched.length-1;return r>-1&&r===n&&js(e.matched[r],s.matched[n])&&Vl(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function js(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Vl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var s in t)if(!gd(t[s],e[s]))return!1;return!0}function gd(t,e){return ot(t)?Io(t,e):ot(e)?Io(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Io(t,e){return ot(e)?t.length===e.length&&t.every((s,r)=>s===e[r]):t.length===1&&t[0]===e}function md(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),r=t.split("/"),n=r[r.length-1];(n===".."||n===".")&&r.push("");let i=s.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")i>1&&i--;else break;return s.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const Mt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let oi=function(t){return t.pop="pop",t.push="push",t}({}),Mn=function(t){return t.back="back",t.forward="forward",t.unknown="",t}({});function yd(t){if(!t)if(ys){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),dd(t)}const vd=/^[^#]+#/;function _d(t,e){return t.replace(vd,"#")+e}function bd(t,e){const s=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{behavior:e.behavior,left:r.left-s.left-(e.left||0),top:r.top-s.top-(e.top||0)}}const bn=()=>({left:window.scrollX,top:window.scrollY});function wd(t){let e;if("el"in t){const s=t.el,r=typeof s=="string"&&s.startsWith("#"),n=typeof s=="string"?r?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!n)return;e=bd(n,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function jo(t,e){return(history.state?history.state.position-e:-1)+t}const ai=new Map;function Sd(t,e){ai.set(t,e)}function Ed(t){const e=ai.get(t);return ai.delete(t),e}function kd(t){return typeof t=="string"||t&&typeof t=="object"}function Kl(t){return typeof t=="string"||typeof t=="symbol"}let me=function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t}({});const Wl=Symbol("");me.MATCHER_NOT_FOUND+"",me.NAVIGATION_GUARD_REDIRECT+"",me.NAVIGATION_ABORTED+"",me.NAVIGATION_CANCELLED+"",me.NAVIGATION_DUPLICATED+"";function Ns(t,e){return re(new Error,{type:t,[Wl]:!0},e)}function Et(t,e){return t instanceof Error&&Wl in t&&(e==null||!!(t.type&e))}const Td=["params","query","hash"];function Ad(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const s of Td)s in t&&(e[s]=t[s]);return JSON.stringify(e,null,2)}function Rd(t){const e={};if(t===""||t==="?")return e;const s=(t[0]==="?"?t.slice(1):t).split("&");for(let r=0;r<s.length;++r){const n=s[r].replace(Ml," "),i=n.indexOf("="),o=ur(i<0?n:n.slice(0,i)),a=i<0?null:ur(n.slice(i+1));if(o in e){let l=e[o];ot(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function No(t){let e="";for(let s in t){const r=t[s];if(s=ld(s),r==null){r!==void 0&&(e+=(e.length?"&":"")+s);continue}(ot(r)?r.map(n=>n&&ii(n)):[r&&ii(r)]).forEach(n=>{n!==void 0&&(e+=(e.length?"&":"")+s,n!=null&&(e+="="+n))})}return e}function Od(t){const e={};for(const s in t){const r=t[s];r!==void 0&&(e[s]=ot(r)?r.map(n=>n==null?null:""+n):r==null?r:""+r)}return e}const xd=Symbol(""),$o=Symbol(""),wn=Symbol(""),Fi=Symbol(""),li=Symbol("");function Bs(){let t=[];function e(r){return t.push(r),()=>{const n=t.indexOf(r);n>-1&&t.splice(n,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function qt(t,e,s,r,n,i=o=>o()){const o=r&&(r.enterCallbacks[n]=r.enterCallbacks[n]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(Ns(me.NAVIGATION_ABORTED,{from:s,to:e})):d instanceof Error?l(d):kd(d)?l(Ns(me.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&r.enterCallbacks[n]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(r&&r.instances[n],e,s,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function Hn(t,e,s,r,n=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(Dl(l)){const c=(l.__vccOpts||l)[e];c&&i.push(qt(c,s,r,o,a,n))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=Xh(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&qt(d,s,r,o,a,n)()}))}}return i}function Cd(t,e){const s=[],r=[],n=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>js(c,a))?r.push(a):s.push(a));const l=t.matched[o];l&&(e.matched.find(c=>js(c,l))||n.push(l))}return[s,r,n]}/*!
25
+ */const ys=typeof document<"u";function Dl(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Xh(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&Dl(t.default)}const ne=Object.assign;function Dn(t,e){const s={};for(const r in e){const n=e[r];s[r]=ot(n)?n.map(t):t(n)}return s}const sr=()=>{},ot=Array.isArray;function Co(t,e){const s={};for(const r in t)s[r]=r in e?e[r]:t[r];return s}const Bl=/#/g,Qh=/&/g,Zh=/\//g,ed=/=/g,td=/\?/g,Ml=/\+/g,sd=/%5B/g,rd=/%5D/g,Hl=/%5E/g,nd=/%60/g,Fl=/%7B/g,id=/%7C/g,ql=/%7D/g,od=/%20/g;function Hi(t){return t==null?"":encodeURI(""+t).replace(id,"|").replace(sd,"[").replace(rd,"]")}function ad(t){return Hi(t).replace(Fl,"{").replace(ql,"}").replace(Hl,"^")}function ii(t){return Hi(t).replace(Ml,"%2B").replace(od,"+").replace(Bl,"%23").replace(Qh,"%26").replace(nd,"`").replace(Fl,"{").replace(ql,"}").replace(Hl,"^")}function ld(t){return ii(t).replace(ed,"%3D")}function cd(t){return Hi(t).replace(Bl,"%23").replace(td,"%3F")}function ud(t){return cd(t).replace(Zh,"%2F")}function dr(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const hd=/\/$/,dd=t=>t.replace(hd,"");function Bn(t,e,s="/"){let r,n={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=e.slice(0,l),i=e.slice(l,a>0?a:e.length),n=t(i.slice(1))),a>=0&&(r=r||e.slice(0,a),o=e.slice(a,e.length)),r=md(r??e,s),{fullPath:r+i+o,path:r,query:n,hash:dr(o)}}function fd(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function Po(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function pd(t,e,s){const r=e.matched.length-1,n=s.matched.length-1;return r>-1&&r===n&&Ns(e.matched[r],s.matched[n])&&Vl(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function Ns(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Vl(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var s in t)if(!gd(t[s],e[s]))return!1;return!0}function gd(t,e){return ot(t)?Io(t,e):ot(e)?Io(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Io(t,e){return ot(e)?t.length===e.length&&t.every((s,r)=>s===e[r]):t.length===1&&t[0]===e}function md(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),r=t.split("/"),n=r[r.length-1];(n===".."||n===".")&&r.push("");let i=s.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")i>1&&i--;else break;return s.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const Mt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let oi=function(t){return t.pop="pop",t.push="push",t}({}),Mn=function(t){return t.back="back",t.forward="forward",t.unknown="",t}({});function yd(t){if(!t)if(ys){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),dd(t)}const vd=/^[^#]+#/;function _d(t,e){return t.replace(vd,"#")+e}function bd(t,e){const s=document.documentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return{behavior:e.behavior,left:r.left-s.left-(e.left||0),top:r.top-s.top-(e.top||0)}}const bn=()=>({left:window.scrollX,top:window.scrollY});function wd(t){let e;if("el"in t){const s=t.el,r=typeof s=="string"&&s.startsWith("#"),n=typeof s=="string"?r?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!n)return;e=bd(n,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function jo(t,e){return(history.state?history.state.position-e:-1)+t}const ai=new Map;function Sd(t,e){ai.set(t,e)}function Ed(t){const e=ai.get(t);return ai.delete(t),e}function kd(t){return typeof t=="string"||t&&typeof t=="object"}function Kl(t){return typeof t=="string"||typeof t=="symbol"}let me=function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t}({});const Wl=Symbol("");me.MATCHER_NOT_FOUND+"",me.NAVIGATION_GUARD_REDIRECT+"",me.NAVIGATION_ABORTED+"",me.NAVIGATION_CANCELLED+"",me.NAVIGATION_DUPLICATED+"";function $s(t,e){return ne(new Error,{type:t,[Wl]:!0},e)}function Et(t,e){return t instanceof Error&&Wl in t&&(e==null||!!(t.type&e))}const Td=["params","query","hash"];function Ad(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const s of Td)s in t&&(e[s]=t[s]);return JSON.stringify(e,null,2)}function Rd(t){const e={};if(t===""||t==="?")return e;const s=(t[0]==="?"?t.slice(1):t).split("&");for(let r=0;r<s.length;++r){const n=s[r].replace(Ml," "),i=n.indexOf("="),o=dr(i<0?n:n.slice(0,i)),a=i<0?null:dr(n.slice(i+1));if(o in e){let l=e[o];ot(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function No(t){let e="";for(let s in t){const r=t[s];if(s=ld(s),r==null){r!==void 0&&(e+=(e.length?"&":"")+s);continue}(ot(r)?r.map(n=>n&&ii(n)):[r&&ii(r)]).forEach(n=>{n!==void 0&&(e+=(e.length?"&":"")+s,n!=null&&(e+="="+n))})}return e}function xd(t){const e={};for(const s in t){const r=t[s];r!==void 0&&(e[s]=ot(r)?r.map(n=>n==null?null:""+n):r==null?r:""+r)}return e}const Od=Symbol(""),$o=Symbol(""),wn=Symbol(""),Fi=Symbol(""),li=Symbol("");function Ms(){let t=[];function e(r){return t.push(r),()=>{const n=t.indexOf(r);n>-1&&t.splice(n,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function qt(t,e,s,r,n,i=o=>o()){const o=r&&(r.enterCallbacks[n]=r.enterCallbacks[n]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l($s(me.NAVIGATION_ABORTED,{from:s,to:e})):d instanceof Error?l(d):kd(d)?l($s(me.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&r.enterCallbacks[n]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(r&&r.instances[n],e,s,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function Hn(t,e,s,r,n=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(Dl(l)){const c=(l.__vccOpts||l)[e];c&&i.push(qt(c,s,r,o,a,n))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=Xh(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&qt(d,s,r,o,a,n)()}))}}return i}function Cd(t,e){const s=[],r=[],n=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>Ns(c,a))?r.push(a):s.push(a));const l=t.matched[o];l&&(e.matched.find(c=>Ns(c,l))||n.push(l))}return[s,r,n]}/*!
26
26
  * vue-router v4.6.4
27
27
  * (c) 2025 Eduardo San Martin Morote
28
28
  * @license MIT
29
- */let Pd=()=>location.protocol+"//"+location.host;function Gl(t,e){const{pathname:s,search:r,hash:n}=e,i=t.indexOf("#");if(i>-1){let o=n.includes(t.slice(i))?t.slice(i).length:1,a=n.slice(o);return a[0]!=="/"&&(a="/"+a),Po(a,"")}return Po(s,t)+r+n}function Id(t,e,s,r){let n=[],i=[],o=null;const a=({state:d})=>{const f=Gl(t,location),m=s.value,v=e.value;let A=0;if(d){if(s.value=f,e.value=d,o&&o===m){o=null;return}A=v?d.position-v.position:0}else r(f);n.forEach(T=>{T(s.value,m,{delta:A,type:oi.pop,direction:A?A>0?Mn.forward:Mn.back:Mn.unknown})})};function l(){o=s.value}function c(d){n.push(d);const f=()=>{const m=n.indexOf(d);m>-1&&n.splice(m,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(re({},d.state,{scroll:bn()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function Lo(t,e,s,r=!1,n=!1){return{back:t,current:e,forward:s,replaced:r,position:window.history.length,scroll:n?bn():null}}function jd(t){const{history:e,location:s}=window,r={value:Gl(t,s)},n={value:e.state};n.value||i(r.value,{back:null,current:r.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(s.host&&document.querySelector("base")?t:t.slice(h))+l:Pd()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),n.value=c}catch(f){console.error(f),s[u?"replace":"assign"](d)}}function o(l,c){i(l,re({},e.state,Lo(n.value.back,l,n.value.forward,!0),c,{position:n.value.position}),!0),r.value=l}function a(l,c){const u=re({},n.value,e.state,{forward:l,scroll:bn()});i(u.current,u,!0),i(l,re({},Lo(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:n,push:a,replace:o}}function Nd(t){t=yd(t);const e=jd(t),s=Id(t,e.state,e.location,e.replace);function r(i,o=!0){o||s.pauseListeners(),history.go(i)}const n=re({location:"",base:t,go:r,createHref:_d.bind(null,t)},e,s);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}let ts=function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t}({});var Se=function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t}(Se||{});const $d={type:ts.Static,value:""},Ld=/[a-zA-Z0-9_]/;function Ud(t){if(!t)return[[]];if(t==="/")return[[$d]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${s})/"${c}": ${f}`)}let s=Se.Static,r=s;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(s===Se.Static?i.push({type:ts.Static,value:c}):s===Se.Param||s===Se.ParamRegExp||s===Se.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:ts.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&s!==Se.ParamRegExp){r=s,s=Se.EscapeNext;continue}switch(s){case Se.Static:l==="/"?(c&&h(),o()):l===":"?(h(),s=Se.Param):d();break;case Se.EscapeNext:d(),s=r;break;case Se.Param:l==="("?s=Se.ParamRegExp:Ld.test(l)?d():(h(),s=Se.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Se.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=Se.ParamRegExpEnd:u+=l;break;case Se.ParamRegExpEnd:h(),s=Se.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return s===Se.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),n}const Uo="[^/]+?",Dd={sensitive:!1,strict:!1,start:!0,end:!0};var je=function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t}(je||{});const Bd=/[.+*?^${}()[\]/\\]/g;function Md(t,e){const s=re({},Dd,e),r=[];let n=s.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[je.Root];s.strict&&!c.length&&(n+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=je.Segment+(s.sensitive?je.BonusCaseSensitive:0);if(d.type===ts.Static)h||(n+="/"),n+=d.value.replace(Bd,"\\$&"),f+=je.Static;else if(d.type===ts.Param){const{value:m,repeatable:v,optional:A,regexp:T}=d;i.push({name:m,repeatable:v,optional:A});const b=T||Uo;if(b!==Uo){f+=je.BonusCustomRegExp;try{`${b}`}catch(O){throw new Error(`Invalid custom RegExp for param "${m}" (${b}): `+O.message)}}let _=v?`((?:${b})(?:/(?:${b}))*)`:`(${b})`;h||(_=A&&c.length<2?`(?:/${_})`:"/"+_),A&&(_+="?"),n+=_,f+=je.Dynamic,A&&(f+=je.BonusOptional),v&&(f+=je.BonusRepeatable),b===".*"&&(f+=je.BonusWildcard)}u.push(f)}r.push(u)}if(s.strict&&s.end){const c=r.length-1;r[c][r[c].length-1]+=je.BonusStrict}s.strict||(n+="/?"),s.end?n+="$":s.strict&&!n.endsWith("/")&&(n+="(?:/|$)");const o=new RegExp(n,s.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",m=i[d-1];h[m.name]=f&&m.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===ts.Static)u+=f.value;else if(f.type===ts.Param){const{value:m,repeatable:v,optional:A}=f,T=m in c?c[m]:"";if(ot(T)&&!v)throw new Error(`Provided param "${m}" is an array but it is not repeatable (* or + modifiers)`);const b=ot(T)?T.join("/"):T;if(!b)if(A)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${m}"`);u+=b}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function Hd(t,e){let s=0;for(;s<t.length&&s<e.length;){const r=e[s]-t[s];if(r)return r;s++}return t.length<e.length?t.length===1&&t[0]===je.Static+je.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===je.Static+je.Segment?1:-1:0}function Jl(t,e){let s=0;const r=t.score,n=e.score;for(;s<r.length&&s<n.length;){const i=Hd(r[s],n[s]);if(i)return i;s++}if(Math.abs(n.length-r.length)===1){if(Do(r))return 1;if(Do(n))return-1}return n.length-r.length}function Do(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Fd={strict:!1,end:!0,sensitive:!1};function qd(t,e,s){const r=Md(Ud(t.path),s),n=re(r,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function Vd(t,e){const s=[],r=new Map;e=Co(Fd,e);function n(h){return r.get(h)}function i(h,d,f){const m=!f,v=Mo(h);v.aliasOf=f&&f.record;const A=Co(e,h),T=[v];if("alias"in h){const O=typeof h.alias=="string"?[h.alias]:h.alias;for(const M of O)T.push(Mo(re({},v,{components:f?f.record.components:v.components,path:M,aliasOf:f?f.record:v})))}let b,_;for(const O of T){const{path:M}=O;if(d&&M[0]!=="/"){const G=d.record.path,V=G[G.length-1]==="/"?"":"/";O.path=d.record.path+(M&&V+M)}if(b=qd(O,d,A),f?f.alias.push(b):(_=_||b,_!==b&&_.alias.push(b),m&&h.name&&!Ho(b)&&o(h.name)),zl(b)&&l(b),v.children){const G=v.children;for(let V=0;V<G.length;V++)i(G[V],b,f&&f.children[V])}f=f||b}return _?()=>{o(_)}:tr}function o(h){if(Kl(h)){const d=r.get(h);d&&(r.delete(h),s.splice(s.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=s.indexOf(h);d>-1&&(s.splice(d,1),h.record.name&&r.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return s}function l(h){const d=Gd(h,s);s.splice(d,0,h),h.record.name&&!Ho(h)&&r.set(h.record.name,h)}function c(h,d){let f,m={},v,A;if("name"in h&&h.name){if(f=r.get(h.name),!f)throw Ns(me.MATCHER_NOT_FOUND,{location:h});A=f.record.name,m=re(Bo(d.params,f.keys.filter(_=>!_.optional).concat(f.parent?f.parent.keys.filter(_=>_.optional):[]).map(_=>_.name)),h.params&&Bo(h.params,f.keys.map(_=>_.name))),v=f.stringify(m)}else if(h.path!=null)v=h.path,f=s.find(_=>_.re.test(v)),f&&(m=f.parse(v),A=f.record.name);else{if(f=d.name?r.get(d.name):s.find(_=>_.re.test(d.path)),!f)throw Ns(me.MATCHER_NOT_FOUND,{location:h,currentLocation:d});A=f.record.name,m=re({},d.params,h.params),v=f.stringify(m)}const T=[];let b=f;for(;b;)T.unshift(b.record),b=b.parent;return{name:A,path:v,params:m,matched:T,meta:Wd(T)}}t.forEach(h=>i(h));function u(){s.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:n}}function Bo(t,e){const s={};for(const r of e)r in t&&(s[r]=t[r]);return s}function Mo(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Kd(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Kd(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const r in t.components)e[r]=typeof s=="object"?s[r]:s;return e}function Ho(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Wd(t){return t.reduce((e,s)=>re(e,s.meta),{})}function Gd(t,e){let s=0,r=e.length;for(;s!==r;){const i=s+r>>1;Jl(t,e[i])<0?r=i:s=i+1}const n=Jd(t);return n&&(r=e.lastIndexOf(n,r-1)),r}function Jd(t){let e=t;for(;e=e.parent;)if(zl(e)&&Jl(t,e)===0)return e}function zl({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Fo(t){const e=Ye(wn),s=Ye(Fi),r=qe(()=>{const l=ae(t.to);return e.resolve(l)}),n=qe(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],h=s.matched;if(!u||!h.length)return-1;const d=h.findIndex(js.bind(null,u));if(d>-1)return d;const f=qo(l[c-2]);return c>1&&qo(u)===f&&h[h.length-1].path!==f?h.findIndex(js.bind(null,l[c-2])):d}),i=qe(()=>n.value>-1&&Qd(s.params,r.value.params)),o=qe(()=>n.value>-1&&n.value===s.matched.length-1&&Vl(s.params,r.value.params));function a(l={}){if(Xd(l)){const c=e[ae(t.replace)?"replace":"push"](ae(t.to)).catch(tr);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:qe(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function zd(t){return t.length===1?t[0]:t}const Yd=$t({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Fo,setup(t,{slots:e}){const s=br(Fo(t)),{options:r}=Ye(wn),n=qe(()=>({[Vo(t.activeClass,r.linkActiveClass,"router-link-active")]:s.isActive,[Vo(t.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const i=e.default&&zd(e.default(s));return t.custom?i:Pl("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:n.value},i)}}}),Vs=Yd;function Xd(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Qd(t,e){for(const s in e){const r=e[s],n=t[s];if(typeof r=="string"){if(r!==n)return!1}else if(!ot(n)||n.length!==r.length||r.some((i,o)=>i.valueOf()!==n[o].valueOf()))return!1}return!0}function qo(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Vo=(t,e,s)=>t??e??s,Zd=$t({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const r=Ye(li),n=qe(()=>t.route||r.value),i=Ye($o,0),o=qe(()=>{let c=ae(i);const{matched:u}=n.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=qe(()=>n.value.matched[o.value]);Br($o,qe(()=>o.value+1)),Br(xd,a),Br(li,n);const l=ue();return Os(()=>[l.value,a.value,t.name],([c,u,h],[d,f,m])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!js(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(v=>v(c))},{flush:"post"}),()=>{const c=n.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return Ko(s.default,{Component:d,route:c});const f=h.props[u],m=f?f===!0?c.params:typeof f=="function"?f(c):f:null,A=Pl(d,re({},m,e,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Ko(s.default,{Component:A,route:c})||A}}});function Ko(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Yl=Zd;function ef(t){const e=Vd(t.routes,t),s=t.parseQuery||Rd,r=t.stringifyQuery||No,n=t.history,i=Bs(),o=Bs(),a=Bs(),l=Qc(Mt);let c=Mt;ys&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Dn.bind(null,E=>""+E),h=Dn.bind(null,ud),d=Dn.bind(null,ur);function f(E,L){let N,D;return Kl(E)?(N=e.getRecordMatcher(E),D=L):D=E,e.addRoute(D,N)}function m(E){const L=e.getRecordMatcher(E);L&&e.removeRoute(L)}function v(){return e.getRoutes().map(E=>E.record)}function A(E){return!!e.getRecordMatcher(E)}function T(E,L){if(L=re({},L||l.value),typeof E=="string"){const y=Bn(s,E,L.path),w=e.resolve({path:y.path},L),k=n.createHref(y.fullPath);return re(y,w,{params:d(w.params),hash:ur(y.hash),redirectedFrom:void 0,href:k})}let N;if(E.path!=null)N=re({},E,{path:Bn(s,E.path,L.path).path});else{const y=re({},E.params);for(const w in y)y[w]==null&&delete y[w];N=re({},E,{params:h(y)}),L.params=h(L.params)}const D=e.resolve(N,L),Z=E.hash||"";D.params=u(d(D.params));const p=fd(r,re({},E,{hash:ad(Z),path:D.path})),g=n.createHref(p);return re({fullPath:p,hash:Z,query:r===No?Od(E.query):E.query||{}},D,{redirectedFrom:void 0,href:g})}function b(E){return typeof E=="string"?Bn(s,E,l.value.path):re({},E)}function _(E,L){if(c!==E)return Ns(me.NAVIGATION_CANCELLED,{from:L,to:E})}function O(E){return V(E)}function M(E){return O(re(b(E),{replace:!0}))}function G(E,L){const N=E.matched[E.matched.length-1];if(N&&N.redirect){const{redirect:D}=N;let Z=typeof D=="function"?D(E,L):D;return typeof Z=="string"&&(Z=Z.includes("?")||Z.includes("#")?Z=b(Z):{path:Z},Z.params={}),re({query:E.query,hash:E.hash,params:Z.path!=null?{}:E.params},Z)}}function V(E,L){const N=c=T(E),D=l.value,Z=E.state,p=E.force,g=E.replace===!0,y=G(N,D);if(y)return V(re(b(y),{state:typeof y=="object"?re({},Z,y.state):Z,force:p,replace:g}),L||N);const w=N;w.redirectedFrom=L;let k;return!p&&pd(r,D,N)&&(k=Ns(me.NAVIGATION_DUPLICATED,{to:w,from:D}),at(D,D,!0,!1)),(k?Promise.resolve(k):ge(w,D)).catch(S=>Et(S)?Et(S,me.NAVIGATION_GUARD_REDIRECT)?S:Bt(S):se(S,w,D)).then(S=>{if(S){if(Et(S,me.NAVIGATION_GUARD_REDIRECT))return V(re({replace:g},b(S.to),{state:typeof S.to=="object"?re({},Z,S.to.state):Z,force:p}),L||w)}else S=Me(w,D,!0,g,Z);return Pe(w,D,S),S})}function Y(E,L){const N=_(E,L);return N?Promise.reject(N):Promise.resolve()}function K(E){const L=as.values().next().value;return L&&typeof L.runWithContext=="function"?L.runWithContext(E):E()}function ge(E,L){let N;const[D,Z,p]=Cd(E,L);N=Hn(D.reverse(),"beforeRouteLeave",E,L);for(const y of D)y.leaveGuards.forEach(w=>{N.push(qt(w,E,L))});const g=Y.bind(null,E,L);return N.push(g),Ge(N).then(()=>{N=[];for(const y of i.list())N.push(qt(y,E,L));return N.push(g),Ge(N)}).then(()=>{N=Hn(Z,"beforeRouteUpdate",E,L);for(const y of Z)y.updateGuards.forEach(w=>{N.push(qt(w,E,L))});return N.push(g),Ge(N)}).then(()=>{N=[];for(const y of p)if(y.beforeEnter)if(ot(y.beforeEnter))for(const w of y.beforeEnter)N.push(qt(w,E,L));else N.push(qt(y.beforeEnter,E,L));return N.push(g),Ge(N)}).then(()=>(E.matched.forEach(y=>y.enterCallbacks={}),N=Hn(p,"beforeRouteEnter",E,L,K),N.push(g),Ge(N))).then(()=>{N=[];for(const y of o.list())N.push(qt(y,E,L));return N.push(g),Ge(N)}).catch(y=>Et(y,me.NAVIGATION_CANCELLED)?y:Promise.reject(y))}function Pe(E,L,N){a.list().forEach(D=>K(()=>D(E,L,N)))}function Me(E,L,N,D,Z){const p=_(E,L);if(p)return p;const g=L===Mt,y=ys?history.state:{};N&&(D||g?n.replace(E.fullPath,re({scroll:g&&y&&y.scroll},Z)):n.push(E.fullPath,Z)),l.value=E,at(E,L,N,g),Bt()}let Le;function Gt(){Le||(Le=n.listen((E,L,N)=>{if(!Jt.listening)return;const D=T(E),Z=G(D,Jt.currentRoute.value);if(Z){V(re(Z,{replace:!0,force:!0}),D).catch(tr);return}c=D;const p=l.value;ys&&Sd(jo(p.fullPath,N.delta),bn()),ge(D,p).catch(g=>Et(g,me.NAVIGATION_ABORTED|me.NAVIGATION_CANCELLED)?g:Et(g,me.NAVIGATION_GUARD_REDIRECT)?(V(re(b(g.to),{force:!0}),D).then(y=>{Et(y,me.NAVIGATION_ABORTED|me.NAVIGATION_DUPLICATED)&&!N.delta&&N.type===oi.pop&&n.go(-1,!1)}).catch(tr),Promise.reject()):(N.delta&&n.go(-N.delta,!1),se(g,D,p))).then(g=>{g=g||Me(D,p,!1),g&&(N.delta&&!Et(g,me.NAVIGATION_CANCELLED)?n.go(-N.delta,!1):N.type===oi.pop&&Et(g,me.NAVIGATION_ABORTED|me.NAVIGATION_DUPLICATED)&&n.go(-1,!1)),Pe(D,p,g)}).catch(tr)}))}let Dt=Bs(),pe=Bs(),z;function se(E,L,N){Bt(E);const D=pe.list();return D.length?D.forEach(Z=>Z(E,L,N)):console.error(E),Promise.reject(E)}function wt(){return z&&l.value!==Mt?Promise.resolve():new Promise((E,L)=>{Dt.add([E,L])})}function Bt(E){return z||(z=!E,Gt(),Dt.list().forEach(([L,N])=>E?N(E):L()),Dt.reset()),E}function at(E,L,N,D){const{scrollBehavior:Z}=t;if(!ys||!Z)return Promise.resolve();const p=!N&&Ed(jo(E.fullPath,0))||(D||!N)&&history.state&&history.state.scroll||null;return dn().then(()=>Z(E,L,p)).then(g=>g&&wd(g)).catch(g=>se(g,E,L))}const Ue=E=>n.go(E);let os;const as=new Set,Jt={currentRoute:l,listening:!0,addRoute:f,removeRoute:m,clearRoutes:e.clearRoutes,hasRoute:A,getRoutes:v,resolve:T,options:t,push:O,replace:M,go:Ue,back:()=>Ue(-1),forward:()=>Ue(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:pe.add,isReady:wt,install(E){E.component("RouterLink",Vs),E.component("RouterView",Yl),E.config.globalProperties.$router=Jt,Object.defineProperty(E.config.globalProperties,"$route",{enumerable:!0,get:()=>ae(l)}),ys&&!os&&l.value===Mt&&(os=!0,O(n.location).catch(D=>{}));const L={};for(const D in Mt)Object.defineProperty(L,D,{get:()=>l.value[D],enumerable:!0});E.provide(wn,Jt),E.provide(Fi,Ya(L)),E.provide(li,l);const N=E.unmount;as.add(E),E.unmount=function(){as.delete(E),as.size<1&&(c=Mt,Le&&Le(),Le=null,l.value=Mt,os=!1,z=!1),N()}}};function Ge(E){return E.reduce((L,N)=>L.then(()=>K(N)),Promise.resolve())}return Jt}function Xl(){return Ye(wn)}function tf(t){return Ye(Fi)}function Sn(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(s[r[n]]=t[r[n]]);return s}function sf(t,e,s,r){function n(i){return i instanceof s?i:new s(function(o){o(i)})}return new(s||(s=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}const rf=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class qi extends Error{constructor(e,s="FunctionsError",r){super(e),this.name=s,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class nf extends qi{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Wo extends qi{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Go extends qi{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ci;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(ci||(ci={}));class of{constructor(e,{headers:s={},customFetch:r,region:n=ci.Any}={}){this.url=e,this.headers=s,this.region=n,this.fetch=rf(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return sf(this,arguments,void 0,function*(s,r={}){var n;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let d={},{region:f}=r;f||(f=this.region);const m=new URL(`${this.url}/${s}`);f&&f!=="any"&&(d["x-region"]=f,m.searchParams.set("forceFunctionRegion",f));let v;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(d["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(d["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let A=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(A=o.signal,u.addEventListener("abort",()=>o.abort())):A=o.signal);const T=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:v,signal:A}).catch(M=>{throw new nf(M)}),b=T.headers.get("x-relay-error");if(b&&b==="true")throw new Wo(T);if(!T.ok)throw new Go(T);let _=((n=T.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),O;return _==="application/json"?O=yield T.json():_==="application/octet-stream"||_==="application/pdf"?O=yield T.blob():_==="text/event-stream"?O=T:_==="multipart/form-data"?O=yield T.formData():O=yield T.text(),{data:O,error:null,response:T}}catch(a){return{data:null,error:a,response:a instanceof Go||a instanceof Wo?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Ql=3,Jo=t=>Math.min(1e3*2**t,3e4),af=[520,503],Zl=["GET","HEAD","OPTIONS"];var lf=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function zo(t,e){return new Promise(s=>{if(e!=null&&e.aborted){s();return}const r=setTimeout(()=>{e==null||e.removeEventListener("abort",n),s()},t);function n(){clearTimeout(r),s()}e==null||e.addEventListener("abort",n)})}function cf(t,e,s,r){return!(!r||s>=Ql||!Zl.includes(t)||!af.includes(e))}var uf=class{constructor(t){var e,s,r,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(s=t.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(r=t.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(n=t.urlLengthLimit)!==null&&n!==void 0?n:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var s=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(s.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await r(s.url.toString(),{method:s.method,headers:c,body:JSON.stringify(s.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:s.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Zl.includes(s.method))throw h;if(s.retryEnabled&&o<Ql){const d=Jo(o);o++,await zo(d,s.signal);continue}throw h}if(cf(s.method,u.status,o,s.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Jo(o);await u.text(),o++,await zo(d,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,m,v;const b=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",_=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(m=o==null?void 0:o.name)!==null&&m!==void 0?m:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
29
+ */let Pd=()=>location.protocol+"//"+location.host;function Gl(t,e){const{pathname:s,search:r,hash:n}=e,i=t.indexOf("#");if(i>-1){let o=n.includes(t.slice(i))?t.slice(i).length:1,a=n.slice(o);return a[0]!=="/"&&(a="/"+a),Po(a,"")}return Po(s,t)+r+n}function Id(t,e,s,r){let n=[],i=[],o=null;const a=({state:d})=>{const f=Gl(t,location),m=s.value,y=e.value;let _=0;if(d){if(s.value=f,e.value=d,o&&o===m){o=null;return}_=y?d.position-y.position:0}else r(f);n.forEach(S=>{S(s.value,m,{delta:_,type:oi.pop,direction:_?_>0?Mn.forward:Mn.back:Mn.unknown})})};function l(){o=s.value}function c(d){n.push(d);const f=()=>{const m=n.indexOf(d);m>-1&&n.splice(m,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(ne({},d.state,{scroll:bn()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function Lo(t,e,s,r=!1,n=!1){return{back:t,current:e,forward:s,replaced:r,position:window.history.length,scroll:n?bn():null}}function jd(t){const{history:e,location:s}=window,r={value:Gl(t,s)},n={value:e.state};n.value||i(r.value,{back:null,current:r.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(s.host&&document.querySelector("base")?t:t.slice(h))+l:Pd()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),n.value=c}catch(f){console.error(f),s[u?"replace":"assign"](d)}}function o(l,c){i(l,ne({},e.state,Lo(n.value.back,l,n.value.forward,!0),c,{position:n.value.position}),!0),r.value=l}function a(l,c){const u=ne({},n.value,e.state,{forward:l,scroll:bn()});i(u.current,u,!0),i(l,ne({},Lo(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:n,push:a,replace:o}}function Nd(t){t=yd(t);const e=jd(t),s=Id(t,e.state,e.location,e.replace);function r(i,o=!0){o||s.pauseListeners(),history.go(i)}const n=ne({location:"",base:t,go:r,createHref:_d.bind(null,t)},e,s);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}let ts=function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t}({});var Se=function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t}(Se||{});const $d={type:ts.Static,value:""},Ld=/[a-zA-Z0-9_]/;function Ud(t){if(!t)return[[]];if(t==="/")return[[$d]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${s})/"${c}": ${f}`)}let s=Se.Static,r=s;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(s===Se.Static?i.push({type:ts.Static,value:c}):s===Se.Param||s===Se.ParamRegExp||s===Se.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:ts.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&s!==Se.ParamRegExp){r=s,s=Se.EscapeNext;continue}switch(s){case Se.Static:l==="/"?(c&&h(),o()):l===":"?(h(),s=Se.Param):d();break;case Se.EscapeNext:d(),s=r;break;case Se.Param:l==="("?s=Se.ParamRegExp:Ld.test(l)?d():(h(),s=Se.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Se.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=Se.ParamRegExpEnd:u+=l;break;case Se.ParamRegExpEnd:h(),s=Se.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return s===Se.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),n}const Uo="[^/]+?",Dd={sensitive:!1,strict:!1,start:!0,end:!0};var je=function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t}(je||{});const Bd=/[.+*?^${}()[\]/\\]/g;function Md(t,e){const s=ne({},Dd,e),r=[];let n=s.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[je.Root];s.strict&&!c.length&&(n+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=je.Segment+(s.sensitive?je.BonusCaseSensitive:0);if(d.type===ts.Static)h||(n+="/"),n+=d.value.replace(Bd,"\\$&"),f+=je.Static;else if(d.type===ts.Param){const{value:m,repeatable:y,optional:_,regexp:S}=d;i.push({name:m,repeatable:y,optional:_});const w=S||Uo;if(w!==Uo){f+=je.BonusCustomRegExp;try{`${w}`}catch(x){throw new Error(`Invalid custom RegExp for param "${m}" (${w}): `+x.message)}}let b=y?`((?:${w})(?:/(?:${w}))*)`:`(${w})`;h||(b=_&&c.length<2?`(?:/${b})`:"/"+b),_&&(b+="?"),n+=b,f+=je.Dynamic,_&&(f+=je.BonusOptional),y&&(f+=je.BonusRepeatable),w===".*"&&(f+=je.BonusWildcard)}u.push(f)}r.push(u)}if(s.strict&&s.end){const c=r.length-1;r[c][r[c].length-1]+=je.BonusStrict}s.strict||(n+="/?"),s.end?n+="$":s.strict&&!n.endsWith("/")&&(n+="(?:/|$)");const o=new RegExp(n,s.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",m=i[d-1];h[m.name]=f&&m.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===ts.Static)u+=f.value;else if(f.type===ts.Param){const{value:m,repeatable:y,optional:_}=f,S=m in c?c[m]:"";if(ot(S)&&!y)throw new Error(`Provided param "${m}" is an array but it is not repeatable (* or + modifiers)`);const w=ot(S)?S.join("/"):S;if(!w)if(_)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${m}"`);u+=w}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function Hd(t,e){let s=0;for(;s<t.length&&s<e.length;){const r=e[s]-t[s];if(r)return r;s++}return t.length<e.length?t.length===1&&t[0]===je.Static+je.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===je.Static+je.Segment?1:-1:0}function Jl(t,e){let s=0;const r=t.score,n=e.score;for(;s<r.length&&s<n.length;){const i=Hd(r[s],n[s]);if(i)return i;s++}if(Math.abs(n.length-r.length)===1){if(Do(r))return 1;if(Do(n))return-1}return n.length-r.length}function Do(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Fd={strict:!1,end:!0,sensitive:!1};function qd(t,e,s){const r=Md(Ud(t.path),s),n=ne(r,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function Vd(t,e){const s=[],r=new Map;e=Co(Fd,e);function n(h){return r.get(h)}function i(h,d,f){const m=!f,y=Mo(h);y.aliasOf=f&&f.record;const _=Co(e,h),S=[y];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const M of x)S.push(Mo(ne({},y,{components:f?f.record.components:y.components,path:M,aliasOf:f?f.record:y})))}let w,b;for(const x of S){const{path:M}=x;if(d&&M[0]!=="/"){const z=d.record.path,V=z[z.length-1]==="/"?"":"/";x.path=d.record.path+(M&&V+M)}if(w=qd(x,d,_),f?f.alias.push(w):(b=b||w,b!==w&&b.alias.push(w),m&&h.name&&!Ho(w)&&o(h.name)),zl(w)&&l(w),y.children){const z=y.children;for(let V=0;V<z.length;V++)i(z[V],w,f&&f.children[V])}f=f||w}return b?()=>{o(b)}:sr}function o(h){if(Kl(h)){const d=r.get(h);d&&(r.delete(h),s.splice(s.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=s.indexOf(h);d>-1&&(s.splice(d,1),h.record.name&&r.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return s}function l(h){const d=Gd(h,s);s.splice(d,0,h),h.record.name&&!Ho(h)&&r.set(h.record.name,h)}function c(h,d){let f,m={},y,_;if("name"in h&&h.name){if(f=r.get(h.name),!f)throw $s(me.MATCHER_NOT_FOUND,{location:h});_=f.record.name,m=ne(Bo(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&Bo(h.params,f.keys.map(b=>b.name))),y=f.stringify(m)}else if(h.path!=null)y=h.path,f=s.find(b=>b.re.test(y)),f&&(m=f.parse(y),_=f.record.name);else{if(f=d.name?r.get(d.name):s.find(b=>b.re.test(d.path)),!f)throw $s(me.MATCHER_NOT_FOUND,{location:h,currentLocation:d});_=f.record.name,m=ne({},d.params,h.params),y=f.stringify(m)}const S=[];let w=f;for(;w;)S.unshift(w.record),w=w.parent;return{name:_,path:y,params:m,matched:S,meta:Wd(S)}}t.forEach(h=>i(h));function u(){s.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:n}}function Bo(t,e){const s={};for(const r of e)r in t&&(s[r]=t[r]);return s}function Mo(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Kd(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Kd(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const r in t.components)e[r]=typeof s=="object"?s[r]:s;return e}function Ho(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Wd(t){return t.reduce((e,s)=>ne(e,s.meta),{})}function Gd(t,e){let s=0,r=e.length;for(;s!==r;){const i=s+r>>1;Jl(t,e[i])<0?r=i:s=i+1}const n=Jd(t);return n&&(r=e.lastIndexOf(n,r-1)),r}function Jd(t){let e=t;for(;e=e.parent;)if(zl(e)&&Jl(t,e)===0)return e}function zl({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Fo(t){const e=Qe(wn),s=Qe(Fi),r=Ve(()=>{const l=ce(t.to);return e.resolve(l)}),n=Ve(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],h=s.matched;if(!u||!h.length)return-1;const d=h.findIndex(Ns.bind(null,u));if(d>-1)return d;const f=qo(l[c-2]);return c>1&&qo(u)===f&&h[h.length-1].path!==f?h.findIndex(Ns.bind(null,l[c-2])):d}),i=Ve(()=>n.value>-1&&Qd(s.params,r.value.params)),o=Ve(()=>n.value>-1&&n.value===s.matched.length-1&&Vl(s.params,r.value.params));function a(l={}){if(Xd(l)){const c=e[ce(t.replace)?"replace":"push"](ce(t.to)).catch(sr);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:Ve(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function zd(t){return t.length===1?t[0]:t}const Yd=$t({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Fo,setup(t,{slots:e}){const s=wr(Fo(t)),{options:r}=Qe(wn),n=Ve(()=>({[Vo(t.activeClass,r.linkActiveClass,"router-link-active")]:s.isActive,[Vo(t.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const i=e.default&&zd(e.default(s));return t.custom?i:Pl("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:n.value},i)}}}),Ks=Yd;function Xd(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Qd(t,e){for(const s in e){const r=e[s],n=t[s];if(typeof r=="string"){if(r!==n)return!1}else if(!ot(n)||n.length!==r.length||r.some((i,o)=>i.valueOf()!==n[o].valueOf()))return!1}return!0}function qo(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Vo=(t,e,s)=>t??e??s,Zd=$t({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const r=Qe(li),n=Ve(()=>t.route||r.value),i=Qe($o,0),o=Ve(()=>{let c=ce(i);const{matched:u}=n.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Ve(()=>n.value.matched[o.value]);Mr($o,Ve(()=>o.value+1)),Mr(Od,a),Mr(li,n);const l=ae();return xs(()=>[l.value,a.value,t.name],([c,u,h],[d,f,m])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!Ns(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(y=>y(c))},{flush:"post"}),()=>{const c=n.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return Ko(s.default,{Component:d,route:c});const f=h.props[u],m=f?f===!0?c.params:typeof f=="function"?f(c):f:null,_=Pl(d,ne({},m,e,{onVnodeUnmounted:S=>{S.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Ko(s.default,{Component:_,route:c})||_}}});function Ko(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Yl=Zd;function ef(t){const e=Vd(t.routes,t),s=t.parseQuery||Rd,r=t.stringifyQuery||No,n=t.history,i=Ms(),o=Ms(),a=Ms(),l=Qc(Mt);let c=Mt;ys&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Dn.bind(null,T=>""+T),h=Dn.bind(null,ud),d=Dn.bind(null,dr);function f(T,L){let N,D;return Kl(T)?(N=e.getRecordMatcher(T),D=L):D=T,e.addRoute(D,N)}function m(T){const L=e.getRecordMatcher(T);L&&e.removeRoute(L)}function y(){return e.getRoutes().map(T=>T.record)}function _(T){return!!e.getRecordMatcher(T)}function S(T,L){if(L=ne({},L||l.value),typeof T=="string"){const v=Bn(s,T,L.path),E=e.resolve({path:v.path},L),A=n.createHref(v.fullPath);return ne(v,E,{params:d(E.params),hash:dr(v.hash),redirectedFrom:void 0,href:A})}let N;if(T.path!=null)N=ne({},T,{path:Bn(s,T.path,L.path).path});else{const v=ne({},T.params);for(const E in v)v[E]==null&&delete v[E];N=ne({},T,{params:h(v)}),L.params=h(L.params)}const D=e.resolve(N,L),Z=T.hash||"";D.params=u(d(D.params));const p=fd(r,ne({},T,{hash:ad(Z),path:D.path})),g=n.createHref(p);return ne({fullPath:p,hash:Z,query:r===No?xd(T.query):T.query||{}},D,{redirectedFrom:void 0,href:g})}function w(T){return typeof T=="string"?Bn(s,T,l.value.path):ne({},T)}function b(T,L){if(c!==T)return $s(me.NAVIGATION_CANCELLED,{from:L,to:T})}function x(T){return V(T)}function M(T){return x(ne(w(T),{replace:!0}))}function z(T,L){const N=T.matched[T.matched.length-1];if(N&&N.redirect){const{redirect:D}=N;let Z=typeof D=="function"?D(T,L):D;return typeof Z=="string"&&(Z=Z.includes("?")||Z.includes("#")?Z=w(Z):{path:Z},Z.params={}),ne({query:T.query,hash:T.hash,params:Z.path!=null?{}:T.params},Z)}}function V(T,L){const N=c=S(T),D=l.value,Z=T.state,p=T.force,g=T.replace===!0,v=z(N,D);if(v)return V(ne(w(v),{state:typeof v=="object"?ne({},Z,v.state):Z,force:p,replace:g}),L||N);const E=N;E.redirectedFrom=L;let A;return!p&&pd(r,D,N)&&(A=$s(me.NAVIGATION_DUPLICATED,{to:E,from:D}),at(D,D,!0,!1)),(A?Promise.resolve(A):ge(E,D)).catch(k=>Et(k)?Et(k,me.NAVIGATION_GUARD_REDIRECT)?k:Bt(k):re(k,E,D)).then(k=>{if(k){if(Et(k,me.NAVIGATION_GUARD_REDIRECT))return V(ne({replace:g},w(k.to),{state:typeof k.to=="object"?ne({},Z,k.to.state):Z,force:p}),L||E)}else k=Fe(E,D,!0,g,Z);return Pe(E,D,k),k})}function Q(T,L){const N=b(T,L);return N?Promise.reject(N):Promise.resolve()}function K(T){const L=as.values().next().value;return L&&typeof L.runWithContext=="function"?L.runWithContext(T):T()}function ge(T,L){let N;const[D,Z,p]=Cd(T,L);N=Hn(D.reverse(),"beforeRouteLeave",T,L);for(const v of D)v.leaveGuards.forEach(E=>{N.push(qt(E,T,L))});const g=Q.bind(null,T,L);return N.push(g),ze(N).then(()=>{N=[];for(const v of i.list())N.push(qt(v,T,L));return N.push(g),ze(N)}).then(()=>{N=Hn(Z,"beforeRouteUpdate",T,L);for(const v of Z)v.updateGuards.forEach(E=>{N.push(qt(E,T,L))});return N.push(g),ze(N)}).then(()=>{N=[];for(const v of p)if(v.beforeEnter)if(ot(v.beforeEnter))for(const E of v.beforeEnter)N.push(qt(E,T,L));else N.push(qt(v.beforeEnter,T,L));return N.push(g),ze(N)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),N=Hn(p,"beforeRouteEnter",T,L,K),N.push(g),ze(N))).then(()=>{N=[];for(const v of o.list())N.push(qt(v,T,L));return N.push(g),ze(N)}).catch(v=>Et(v,me.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function Pe(T,L,N){a.list().forEach(D=>K(()=>D(T,L,N)))}function Fe(T,L,N,D,Z){const p=b(T,L);if(p)return p;const g=L===Mt,v=ys?history.state:{};N&&(D||g?n.replace(T.fullPath,ne({scroll:g&&v&&v.scroll},Z)):n.push(T.fullPath,Z)),l.value=T,at(T,L,N,g),Bt()}let Le;function Gt(){Le||(Le=n.listen((T,L,N)=>{if(!Jt.listening)return;const D=S(T),Z=z(D,Jt.currentRoute.value);if(Z){V(ne(Z,{replace:!0,force:!0}),D).catch(sr);return}c=D;const p=l.value;ys&&Sd(jo(p.fullPath,N.delta),bn()),ge(D,p).catch(g=>Et(g,me.NAVIGATION_ABORTED|me.NAVIGATION_CANCELLED)?g:Et(g,me.NAVIGATION_GUARD_REDIRECT)?(V(ne(w(g.to),{force:!0}),D).then(v=>{Et(v,me.NAVIGATION_ABORTED|me.NAVIGATION_DUPLICATED)&&!N.delta&&N.type===oi.pop&&n.go(-1,!1)}).catch(sr),Promise.reject()):(N.delta&&n.go(-N.delta,!1),re(g,D,p))).then(g=>{g=g||Fe(D,p,!1),g&&(N.delta&&!Et(g,me.NAVIGATION_CANCELLED)?n.go(-N.delta,!1):N.type===oi.pop&&Et(g,me.NAVIGATION_ABORTED|me.NAVIGATION_DUPLICATED)&&n.go(-1,!1)),Pe(D,p,g)}).catch(sr)}))}let Dt=Ms(),pe=Ms(),X;function re(T,L,N){Bt(T);const D=pe.list();return D.length?D.forEach(Z=>Z(T,L,N)):console.error(T),Promise.reject(T)}function wt(){return X&&l.value!==Mt?Promise.resolve():new Promise((T,L)=>{Dt.add([T,L])})}function Bt(T){return X||(X=!T,Gt(),Dt.list().forEach(([L,N])=>T?N(T):L()),Dt.reset()),T}function at(T,L,N,D){const{scrollBehavior:Z}=t;if(!ys||!Z)return Promise.resolve();const p=!N&&Ed(jo(T.fullPath,0))||(D||!N)&&history.state&&history.state.scroll||null;return fn().then(()=>Z(T,L,p)).then(g=>g&&wd(g)).catch(g=>re(g,T,L))}const Ue=T=>n.go(T);let os;const as=new Set,Jt={currentRoute:l,listening:!0,addRoute:f,removeRoute:m,clearRoutes:e.clearRoutes,hasRoute:_,getRoutes:y,resolve:S,options:t,push:x,replace:M,go:Ue,back:()=>Ue(-1),forward:()=>Ue(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:pe.add,isReady:wt,install(T){T.component("RouterLink",Ks),T.component("RouterView",Yl),T.config.globalProperties.$router=Jt,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>ce(l)}),ys&&!os&&l.value===Mt&&(os=!0,x(n.location).catch(D=>{}));const L={};for(const D in Mt)Object.defineProperty(L,D,{get:()=>l.value[D],enumerable:!0});T.provide(wn,Jt),T.provide(Fi,Ya(L)),T.provide(li,l);const N=T.unmount;as.add(T),T.unmount=function(){as.delete(T),as.size<1&&(c=Mt,Le&&Le(),Le=null,l.value=Mt,os=!1,X=!1),N()}}};function ze(T){return T.reduce((L,N)=>L.then(()=>K(N)),Promise.resolve())}return Jt}function Xl(){return Qe(wn)}function tf(t){return Qe(Fi)}function Sn(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(s[r[n]]=t[r[n]]);return s}function sf(t,e,s,r){function n(i){return i instanceof s?i:new s(function(o){o(i)})}return new(s||(s=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}const rf=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class qi extends Error{constructor(e,s="FunctionsError",r){super(e),this.name=s,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class nf extends qi{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Wo extends qi{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Go extends qi{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ci;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(ci||(ci={}));class of{constructor(e,{headers:s={},customFetch:r,region:n=ci.Any}={}){this.url=e,this.headers=s,this.region=n,this.fetch=rf(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return sf(this,arguments,void 0,function*(s,r={}){var n;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let d={},{region:f}=r;f||(f=this.region);const m=new URL(`${this.url}/${s}`);f&&f!=="any"&&(d["x-region"]=f,m.searchParams.set("forceFunctionRegion",f));let y;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?y=JSON.stringify(c):y=c;let _=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(_=o.signal,u.addEventListener("abort",()=>o.abort())):_=o.signal);const S=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:_}).catch(M=>{throw new nf(M)}),w=S.headers.get("x-relay-error");if(w&&w==="true")throw new Wo(S);if(!S.ok)throw new Go(S);let b=((n=S.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),x;return b==="application/json"?x=yield S.json():b==="application/octet-stream"||b==="application/pdf"?x=yield S.blob():b==="text/event-stream"?x=S:b==="multipart/form-data"?x=yield S.formData():x=yield S.text(),{data:x,error:null,response:S}}catch(a){return{data:null,error:a,response:a instanceof Go||a instanceof Wo?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Ql=3,Jo=t=>Math.min(1e3*2**t,3e4),af=[520,503],Zl=["GET","HEAD","OPTIONS"];var lf=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function zo(t,e){return new Promise(s=>{if(e!=null&&e.aborted){s();return}const r=setTimeout(()=>{e==null||e.removeEventListener("abort",n),s()},t);function n(){clearTimeout(r),s()}e==null||e.addEventListener("abort",n)})}function cf(t,e,s,r){return!(!r||s>=Ql||!Zl.includes(t)||!af.includes(e))}var uf=class{constructor(t){var e,s,r,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(s=t.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(r=t.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(n=t.urlLengthLimit)!==null&&n!==void 0?n:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var s=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(s.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await r(s.url.toString(),{method:s.method,headers:c,body:JSON.stringify(s.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:s.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Zl.includes(s.method))throw h;if(s.retryEnabled&&o<Ql){const d=Jo(o);o++,await zo(d,s.signal);continue}throw h}if(cf(s.method,u.status,o,s.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:Jo(o);await u.text(),o++,await zo(d,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,m,y;const w=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(m=o==null?void 0:o.name)!==null&&m!==void 0?m:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
30
30
 
31
- Caused by: ${(v=h==null?void 0:h.name)!==null&&v!==void 0?v:"Error"}: ${b}`,_&&(l+=` (${_})`),h!=null&&h.stack&&(l+=`
32
- ${h.stack}`)}else{var A;l=(A=o==null?void 0:o.stack)!==null&&A!==void 0?A:""}const T=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",T>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${T} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",T>this.urlLengthLimit&&(c+=`. Your request URL is ${T} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let s=null,r=null,n=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=d:r=JSON.parse(d))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(n=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(s={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,n=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await t.text();try{s=JSON.parse(u),Array.isArray(s)&&t.status===404&&(r=[],s=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):s={message:u}}if(s&&e.shouldThrowOnError)throw new lf(s)}return{success:s===null,error:s,data:r,count:n,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},hf=class extends uf{select(t){let e=!1;const s=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:s,foreignTable:r,referencedTable:n=r}={}){const i=n?`${n}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:s=e}={}){const r=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:s,referencedTable:r=s}={}){const n=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:s=!1,buffers:r=!1,wal:n=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,s?"settings":null,r?"buffers":null,n?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Yo=new RegExp("[,()]");var vs=class extends hf{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const s=Array.from(new Set(e)).map(r=>typeof r=="string"&&Yo.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${s})`),this}notIn(t,e){const s=Array.from(new Set(e)).map(r=>typeof r=="string"&&Yo.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${s})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:s,type:r}={}){let n="";r==="plain"?n="pl":r==="phrase"?n="ph":r==="websearch"&&(n="w");const i=s===void 0?"":`(${s})`;return this.url.searchParams.append(t,`${n}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,s])=>s!==void 0).forEach(([e,s])=>{this.url.searchParams.append(e,`eq.${s}`)}),this}not(t,e,s){return this.url.searchParams.append(t,`not.${e}.${s}`),this}or(t,{foreignTable:e,referencedTable:s=e}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,s){return this.url.searchParams.append(t,`${e}.${s}`),this}},df=class{constructor(t,{headers:e={},schema:s,fetch:r,urlLengthLimit:n=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=s,this.fetch=r,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:s=!1,count:r}=e??{},n=s?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new vs({method:n,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:s=!0}={}){var r;const n="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),s||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new vs({method:n,url:i,headers:o,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:s=!1,count:r,defaultToNull:n=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),r&&l.append("Prefer",`count=${r}`),n||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new vs({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var s;const r="PATCH",{url:n,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new vs({method:r,url:n,headers:i,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const s="DELETE",{url:r,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new vs({method:s,url:r,headers:n,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function hr(t){"@babel/helpers - typeof";return hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hr(t)}function ff(t,e){if(hr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(hr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pf(t){var e=ff(t,"string");return hr(e)=="symbol"?e:e+""}function gf(t,e,s){return(e=pf(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Xo(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function Or(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Xo(Object(s),!0).forEach(function(r){gf(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Xo(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}var mf=class ec{constructor(e,{headers:s={},schema:r,fetch:n,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(s),this.schemaName=r,this.urlLengthLimit=o;const l=n??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const m=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",m,{once:!0}),l(c,Or(Or({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",m)})}return l(c,Or(Or({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new df(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new ec(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,s={},{head:r=!1,get:n=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=r&&Object.values(s).some(u);h?(a="POST",c=s):r||n?(a=r?"HEAD":"GET",Object.entries(s).filter(([f,m])=>m!==void 0).map(([f,m])=>[f,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([f,m])=>{l.searchParams.append(f,m)})):(a="POST",c=s);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new vs({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class yf{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const s=globalThis;if(typeof globalThis<"u"&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof s.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&s.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const i=n.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
31
+ Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${w}`,b&&(l+=` (${b})`),h!=null&&h.stack&&(l+=`
32
+ ${h.stack}`)}else{var _;l=(_=o==null?void 0:o.stack)!==null&&_!==void 0?_:""}const S=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",S>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${S} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",S>this.urlLengthLimit&&(c+=`. Your request URL is ${S} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let s=null,r=null,n=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=d:r=JSON.parse(d))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(n=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(s={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,n=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await t.text();try{s=JSON.parse(u),Array.isArray(s)&&t.status===404&&(r=[],s=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):s={message:u}}if(s&&e.shouldThrowOnError)throw new lf(s)}return{success:s===null,error:s,data:r,count:n,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},hf=class extends uf{select(t){let e=!1;const s=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:s,foreignTable:r,referencedTable:n=r}={}){const i=n?`${n}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:s=e}={}){const r=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:s,referencedTable:r=s}={}){const n=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:s=!1,buffers:r=!1,wal:n=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,s?"settings":null,r?"buffers":null,n?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const Yo=new RegExp("[,()]");var vs=class extends hf{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const s=Array.from(new Set(e)).map(r=>typeof r=="string"&&Yo.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${s})`),this}notIn(t,e){const s=Array.from(new Set(e)).map(r=>typeof r=="string"&&Yo.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${s})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:s,type:r}={}){let n="";r==="plain"?n="pl":r==="phrase"?n="ph":r==="websearch"&&(n="w");const i=s===void 0?"":`(${s})`;return this.url.searchParams.append(t,`${n}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,s])=>s!==void 0).forEach(([e,s])=>{this.url.searchParams.append(e,`eq.${s}`)}),this}not(t,e,s){return this.url.searchParams.append(t,`not.${e}.${s}`),this}or(t,{foreignTable:e,referencedTable:s=e}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,s){return this.url.searchParams.append(t,`${e}.${s}`),this}},df=class{constructor(t,{headers:e={},schema:s,fetch:r,urlLengthLimit:n=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=s,this.fetch=r,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:s=!1,count:r}=e??{},n=s?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new vs({method:n,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:s=!0}={}){var r;const n="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),s||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new vs({method:n,url:i,headers:o,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:s=!1,count:r,defaultToNull:n=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),r&&l.append("Prefer",`count=${r}`),n||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new vs({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var s;const r="PATCH",{url:n,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new vs({method:r,url:n,headers:i,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const s="DELETE",{url:r,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new vs({method:s,url:r,headers:n,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function fr(t){"@babel/helpers - typeof";return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fr(t)}function ff(t,e){if(fr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(fr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pf(t){var e=ff(t,"string");return fr(e)=="symbol"?e:e+""}function gf(t,e,s){return(e=pf(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Xo(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function Or(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Xo(Object(s),!0).forEach(function(r){gf(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Xo(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}var mf=class ec{constructor(e,{headers:s={},schema:r,fetch:n,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(s),this.schemaName=r,this.urlLengthLimit=o;const l=n??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const m=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",m,{once:!0}),l(c,Or(Or({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",m)})}return l(c,Or(Or({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new df(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new ec(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,s={},{head:r=!1,get:n=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=r&&Object.values(s).some(u);h?(a="POST",c=s):r||n?(a=r?"HEAD":"GET",Object.entries(s).filter(([f,m])=>m!==void 0).map(([f,m])=>[f,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([f,m])=>{l.searchParams.append(f,m)})):(a="POST",c=s);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new vs({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class yf{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const s=globalThis;if(typeof globalThis<"u"&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof s.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&s.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const n=globalThis.process;if(n){const i=n.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
33
33
  import ws from "ws"
34
34
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let s=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(s+=`
35
35
 
36
- Suggested solution: ${e.workaround}`),new Error(s)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const vf="2.105.4",_f=`realtime-js/${vf}`,bf="1.0.0",tc="2.0.0",wf=tc,Sf=1e4,Ef=100,Vt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},sc={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ui={connecting:"connecting",closing:"closing",closed:"closed"};class kf{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,s){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return s(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var s;return this._isArrayBuffer((s=e.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var s,r;const n=(r=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var s,r;const n=(r=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,s,r){var n,i;const o=e.topic,a=(n=e.ref)!==null&&n!==void 0?n:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let m=new DataView(f),v=0;m.setUint8(v++,this.KINDS.userBroadcastPush),m.setUint8(v++,l.length),m.setUint8(v++,a.length),m.setUint8(v++,o.length),m.setUint8(v++,c.length),m.setUint8(v++,h.length),m.setUint8(v++,s),Array.from(l,T=>m.setUint8(v++,T.charCodeAt(0))),Array.from(a,T=>m.setUint8(v++,T.charCodeAt(0))),Array.from(o,T=>m.setUint8(v++,T.charCodeAt(0))),Array.from(c,T=>m.setUint8(v++,T.charCodeAt(0))),Array.from(h,T=>m.setUint8(v++,T.charCodeAt(0)));var A=new Uint8Array(f.byteLength+r.byteLength);return A.set(new Uint8Array(f),0),A.set(new Uint8Array(r),f.byteLength),A.buffer}decode(e,s){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return s(r)}if(typeof e=="string"){const r=JSON.parse(e),[n,i,o,a,l]=r;return s({join_ref:n,ref:i,topic:o,event:a,payload:l})}return s({})}_binaryDecode(e){const s=new DataView(e),r=s.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,s,n)}}_decodeUserBroadcast(e,s,r){const n=s.getUint8(1),i=s.getUint8(2),o=s.getUint8(3),a=s.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(e.slice(l,l+n));l=l+n;const u=r.decode(e.slice(l,l+i));l=l+i;const h=r.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(r.decode(d)):d,m={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var s;return e instanceof ArrayBuffer||((s=e==null?void 0:e.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(e,s){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>s.includes(r)))}}var de;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(de||(de={}));const Qo=(t,e,s={})=>{var r;const n=(r=s.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Tf(o,t,e,n),i),{}):{}},Tf=(t,e,s,r)=>{const n=e.find(a=>a.name===t),i=n==null?void 0:n.type,o=s[t];return i&&!r.includes(i)?rc(i,o):hi(o)},rc=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return xf(e,s)}switch(t){case de.bool:return Af(e);case de.float4:case de.float8:case de.int2:case de.int4:case de.int8:case de.numeric:case de.oid:return Rf(e);case de.json:case de.jsonb:return Of(e);case de.timestamp:return Cf(e);case de.abstime:case de.date:case de.daterange:case de.int4range:case de.int8range:case de.money:case de.reltime:case de.text:case de.time:case de.timestamptz:case de.timetz:case de.tsrange:case de.tstzrange:return hi(e);default:return hi(e)}},hi=t=>t,Af=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Rf=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Of=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},xf=(t,e)=>{if(typeof t!="string")return t;const s=t.length-1,r=t[s];if(t[0]==="{"&&r==="}"){let i;const o=t.slice(1,s);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>rc(e,a))}return t},Cf=t=>typeof t=="string"?t.replace(" ","T"):t,nc=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var sr=t=>typeof t=="function"?t:function(){return t},Pf=typeof self<"u"?self:null,_s=typeof window<"u"?window:null,pt=Pf||_s||globalThis,If="2.0.0",jf=1e4,Nf=1e3,yt={connecting:0,open:1,closing:2,closed:3},De={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},At={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},di={longpoll:"longpoll",websocket:"websocket"},$f={complete:4},fi="base64url.bearer.phx.",xr=class{constructor(t,e,s,r){this.channel=t,this.event=e,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),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()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:s}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},ic=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}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))}},Lf=class{constructor(t,e,s){this.state=De.closed,this.topic=t,this.params=sr(e||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new xr(this,At.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new ic(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=De.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=De.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=De.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=De.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new xr(this,At.leave,sr({}),this.timeout).send(),this.state=De.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(At.reply,(r,n)=>{this.trigger(this.replyEventName(n),r)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=De.closed,this.bindings=[]}onClose(t){this.on(At.close,t)}onError(t){return this.on(At.error,e=>t(e))}on(t,e){let s=this.bindingRef++;return this.bindings.push({event:t,ref:s,callback:e}),s}off(t,e){this.bindings=this.bindings.filter(s=>!(s.event===t&&(typeof e>"u"||e===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,s=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new xr(this,t,function(){return e},s);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=De.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(At.close,"leave")},s=new xr(this,At.leave,sr({}),t);return s.receive("ok",()=>e()).receive("timeout",()=>e()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(t,e,s){return e}filterBindings(t,e,s){return!0}isMember(t,e,s,r){return this.topic!==t?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:s,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=De.joining,this.joinPush.resend(t))}trigger(t,e,s,r){let n=this.onMessage(t,e,s,r);if(e&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,s));for(let o=0;o<i.length;o++)i[o].callback(n,s,r||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===De.closed}isErrored(){return this.state===De.errored}isJoined(){return this.state===De.joined}isJoining(){return this.state===De.joining}isLeaving(){return this.state===De.leaving}},Xr=class{static request(t,e,s,r,n,i,o){if(pt.XDomainRequest){let a=new pt.XDomainRequest;return this.xdomainRequest(a,t,e,r,n,i,o)}else if(pt.XMLHttpRequest){let a=new pt.XMLHttpRequest;return this.xhrRequest(a,t,e,s,r,n,i,o)}else{if(pt.fetch&&pt.AbortController)return this.fetchRequest(t,e,s,r,n,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,s,r,n,i,o){let a={method:t,headers:s,body:r},l=null;return n&&(l=new AbortController,setTimeout(()=>l.abort(),n),a.signal=l.signal),pt.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,s,r,n,i,o){return t.timeout=n,t.open(e,s),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(r),t}static xhrRequest(t,e,s,r,n,i,o,a){t.open(e,s,!0),t.timeout=i;for(let[l,c]of Object.entries(r))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===$f.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(n),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let s=[];for(var r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=e?`${e}[${r}]`:r,i=t[r];typeof i=="object"?s.push(this.serialize(i,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return s.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let s=t.match(/\?/)?"&":"?";return`${t}${s}${this.serialize(e)}`}},Uf=t=>{let e="",s=new Uint8Array(t),r=s.byteLength;for(let n=0;n<r;n++)e+=String.fromCharCode(s[n]);return btoa(e)},us=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(fi)&&(this.authToken=atob(e[1].slice(fi.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=yt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+di.websocket),"$1/"+di.longpoll)}endpointURL(){return Xr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,s){this.close(t,e,s),this.readyState=yt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===yt.open||this.readyState===yt.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:s,token:r,messages:n}=e;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else s=0;switch(s){case 200:n.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=yt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(t){typeof t!="string"&&(t=Uf(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
37
- `),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,s){for(let n of this.reqs)n.abort();this.readyState=yt.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(t,e,s,r,n){let i,o=()=>{this.reqs.delete(i),r()};i=Xr.request(t,this.endpointURL(),e,s,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&n(a)}),this.reqs.add(i)}},Df=class Ks{constructor(e,s={}){let r=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Ks.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=Ks.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=Ks.syncDiff(this.state,n,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Ks.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,s,r,n){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{s[l]||(a[l]=c)}),this.map(s,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(v=>v.phx_ref),d=u.metas.map(v=>v.phx_ref),f=c.metas.filter(v=>d.indexOf(v.phx_ref)<0),m=u.metas.filter(v=>h.indexOf(v.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),m.length>0&&(a[l]=this.clone(u),a[l].metas=m)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},r,n)}static syncDiff(e,s,r,n){let{joins:i,leaves:o}=this.clone(s);return r||(r=function(){}),n||(n=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),n(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,s){return s||(s=function(r,n){return n}),this.map(e,(r,n)=>s(r,n))}static map(e,s){return Object.getOwnPropertyNames(e).map(r=>s(r,e[r]))}static clone(e){return JSON.parse(JSON.stringify(e))}},Cr={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(s))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[s,r,n,i,o]=JSON.parse(t);return e({join_ref:s,ref:r,topic:n,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:s,event:r,topic:n,payload:i}=t,o=this.META_LENGTH+e.length+s.length+n.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,s.length),l.setUint8(c++,n.length),l.setUint8(c++,r.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),s=e.getUint8(0),r=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(t,e,r);case this.KINDS.reply:return this.decodeReply(t,e,r);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,r)}},decodePush(t,e,s){let r=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=s.decode(t.slice(o,o+r));o=o+r;let l=s.decode(t.slice(o,o+n));o=o+n;let c=s.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,s){let r=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(t.slice(a,a+r));a=a+r;let c=s.decode(t.slice(a,a+n));a=a+n;let u=s.decode(t.slice(a,a+i));a=a+i;let h=s.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:At.reply,payload:f}},decodeBroadcast(t,e,s){let r=e.getUint8(1),n=e.getUint8(2),i=this.HEADER_LENGTH+2,o=s.decode(t.slice(i,i+r));i=i+r;let a=s.decode(t.slice(i,i+n));i=i+n;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Bf=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||jf,this.transport=e.transport||pt.WebSocket||us,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=pt&&pt.sessionStorage}catch{}this.sessionStore=e.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=Cr.encode.bind(Cr),this.defaultDecoder=Cr.decode.bind(Cr),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==us?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;_s&&_s.addEventListener&&(_s.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),_s.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),_s.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(n,i,o)=>{console.log(`${n}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=sr(e.params||{}),this.endPoint=`${t}/${di.websocket}`,this.vsn=e.vsn||If,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new ic(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return us}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Xr.appendParams(Xr.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=sr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==us?this.connectWithFallback(us,this.longPollFallbackMs):this.transportConnect())}log(t,e,s){this.logger&&this.logger(t,e,s)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let r=this.onMessage(n=>{n.ref===e&&(this.off([r]),t(Date.now()-s))});return!0}transportName(t){switch(t){case us:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${fi}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let s=!1,r=!0,n,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([n,i]),r=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),r&&!s&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!r){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Nf,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,s){if(!this.conn)return t&&t();const r=this.conn;this.waitForBufferDone(r,()=>{e?r.close(e,s||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,s=1){if(s===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,s+1)},150*s)}waitForSocketClosed(t,e,s=1){if(s===5||t.readyState===yt.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,s+1)},150*s)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",t,e,s),(e===this.transport||s>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(At.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case yt.connecting:return"connecting";case yt.open:return"open";case yt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([s])=>t.indexOf(s)===-1)}channel(t,e={}){let s=new Lf(t,e,this);return this.channels.push(s),s}push(t){if(this.hasLogger()){let{topic:e,event:s,payload:r,ref:n,join_ref:i}=t;this.log("push",`${e} ${s} (${i}, ${n})`,r)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:s,event:r,payload:n,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(n.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${n.status||""} ${s} ${r} ${i&&"("+i+")"||""}`.trim(),n);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(s,r,n,o)&&l.trigger(r,n,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([s,r])=>{try{r(...e)}catch(n){this.log("error",`error in ${t} callback`,n)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}leaveOpenTopic(t){let e=this.channels.find(s=>s.topic===t&&(s.isJoined()||s.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class rr{constructor(e,s){const r=Hf(s);this.presence=new Df(e.getChannel(),r),this.presence.onJoin((n,i,o)=>{const a=rr.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=rr.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return rr.transformState(this.presence.state)}static transformState(e){return e=Mf(e),Object.getOwnPropertyNames(e).reduce((s,r)=>{const n=e[r];return s[r]=Hr(n),s},{})}static onJoinPayload(e,s,r){const n=Zo(s),i=Hr(r);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,s,r){const n=Zo(s),i=Hr(r);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function Hr(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Mf(t){return JSON.parse(JSON.stringify(t))}function Hf(t){return(t==null?void 0:t.events)&&{events:t.events}}function Zo(t){return t!=null&&t.metas?Hr(t):[]}var ea;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ea||(ea={}));class Ff{get state(){return this.presenceAdapter.state}constructor(e,s){this.channel=e,this.presenceAdapter=new rr(this.channel.channelAdapter,s)}}function qf(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const s=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${s}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Vf{constructor(e,s,r){const n=Kf(r);this.channel=e.getSocket().channel(s,n),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,s){return this.channel.on(e,s)}off(e,s){this.channel.off(e,s)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,s,r){let n;try{n=this.channel.push(e,s,r)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Ef){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return n}updateJoinPayload(e){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),e)}canPush(){return this.socket.isConnected()&&this.state===Vt.joined}isJoined(){return this.state===Vt.joined}isJoining(){return this.state===Vt.joining}isClosed(){return this.state===Vt.closed}isLeaving(){return this.state===Vt.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Kf(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var ta;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(ta||(ta={}));var Es;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Es||(Es={}));var Rt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Rt||(Rt={}));class nr{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,s={config:{}},r){var n,i;if(this.topic=e,this.params=s,this.socket=r,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new Vf(this.socket.socketAdapter,e,this.params),this.presence=new Ff(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=nc(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(n=this.params.config)===null||n===void 0?void 0:n.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,s=this.timeout){var r,n,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(n=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[Es.PRESENCE]&&this.bindings[Es.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(Rt.CHANNEL_ERROR,qf(f))}),this._onClose(()=>e==null?void 0:e(Rt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Rt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=Vt.errored;const m=Object.values(f).join(", ")||"error";e==null||e(Rt.CHANNEL_ERROR,new Error(m,{cause:f}))}).receive("timeout",()=>{e==null||e(Rt.TIMED_OUT)})}return this}_updatePostgresBindings(e,s){var r;const n=this.bindings.postgres_changes,i=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0,o=[];for(let a=0;a<i;a++){const l=n[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&nr.isFilterValueEqual(f.schema,u)&&nr.isFilterValueEqual(f.table,h)&&nr.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=Vt.errored,s==null||s(Rt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Vt.errored&&s&&s(Rt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,s={}){return await this.send({type:"presence",event:"track",payload:e},s.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,s,r){const n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Es.PRESENCE||e===Es.POSTGRES_CHANGES;if(n&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,s,r)}async httpSend(e,s,r={}){var n;if(s==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:s,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,s={}){var r,n;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=s.timeout)!==null&&r!==void 0?r:this.timeout);return await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(e.type,e,s.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(s=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,s,r){const n=new AbortController,i=setTimeout(()=>n.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},s),{signal:n.signal}));return clearTimeout(i),o}_on(e,s,r){const n=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,r),o={type:n,filter:s,callback:r,ref:i};return this.bindings[n]?this.bindings[n].push(o):this.bindings[n]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,s,r)=>{var n,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const d=(n=this.bindings[h])===null||n===void 0?void 0:n.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,m=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=s.ids)===null||o===void 0?void 0:o.includes(f))&&(m==="*"||(m==null?void 0:m.toLocaleLowerCase())===((a=s.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=s==null?void 0:s.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,s){const{close:r,error:n,leave:i,join:o}=sc;return s&&[r,n,i,o].includes(e)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,s,r)=>{if(typeof s=="object"&&"ids"in s){const n=s.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=n;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(n))}return s})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in e.bindings)for(const r of e.bindings[s])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,s){return(e??void 0)===(s??void 0)}_getPayloadRecords(e){const s={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(s.new=Qo(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=Qo(e.columns,e.old_record)),s}}class Wf{constructor(e,s){this.socket=new Bf(e,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,s,r,n=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),n),this.socket.disconnect(()=>{e(),i("ok")},s,r)})}push(e){this.socket.push(e)}log(e,s,r){this.socket.log(e,s,r)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==ui.connecting}isDisconnecting(){return this.socket.connectionState()==ui.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const sa={HEARTBEAT_INTERVAL:25e3},Gf=[1e3,2e3,5e3,1e4],Jf=1e4;function zf(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var s;return(s=Array.from(t.keys())[e])!==null&&s!==void 0?s:null},removeItem(e){t.delete(e)},setItem(e,s){t.set(e,String(s))}}}function Yf(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return zf()}const Xf=`
36
+ Suggested solution: ${e.workaround}`),new Error(s)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const vf="2.105.4",_f=`realtime-js/${vf}`,bf="1.0.0",tc="2.0.0",wf=tc,Sf=1e4,Ef=100,Vt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},sc={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ui={connecting:"connecting",closing:"closing",closed:"closed"};class kf{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,s){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return s(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var s;return this._isArrayBuffer((s=e.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var s,r;const n=(r=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,n)}_encodeJsonUserBroadcastPush(e){var s,r;const n=(r=(s=e.payload)===null||s===void 0?void 0:s.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(n)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,s,r){var n,i;const o=e.topic,a=(n=e.ref)!==null&&n!==void 0?n:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let m=new DataView(f),y=0;m.setUint8(y++,this.KINDS.userBroadcastPush),m.setUint8(y++,l.length),m.setUint8(y++,a.length),m.setUint8(y++,o.length),m.setUint8(y++,c.length),m.setUint8(y++,h.length),m.setUint8(y++,s),Array.from(l,S=>m.setUint8(y++,S.charCodeAt(0))),Array.from(a,S=>m.setUint8(y++,S.charCodeAt(0))),Array.from(o,S=>m.setUint8(y++,S.charCodeAt(0))),Array.from(c,S=>m.setUint8(y++,S.charCodeAt(0))),Array.from(h,S=>m.setUint8(y++,S.charCodeAt(0)));var _=new Uint8Array(f.byteLength+r.byteLength);return _.set(new Uint8Array(f),0),_.set(new Uint8Array(r),f.byteLength),_.buffer}decode(e,s){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return s(r)}if(typeof e=="string"){const r=JSON.parse(e),[n,i,o,a,l]=r;return s({join_ref:n,ref:i,topic:o,event:a,payload:l})}return s({})}_binaryDecode(e){const s=new DataView(e),r=s.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,s,n)}}_decodeUserBroadcast(e,s,r){const n=s.getUint8(1),i=s.getUint8(2),o=s.getUint8(3),a=s.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(e.slice(l,l+n));l=l+n;const u=r.decode(e.slice(l,l+i));l=l+i;const h=r.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(r.decode(d)):d,m={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var s;return e instanceof ArrayBuffer||((s=e==null?void 0:e.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(e,s){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>s.includes(r)))}}var de;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(de||(de={}));const Qo=(t,e,s={})=>{var r;const n=(r=s.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=Tf(o,t,e,n),i),{}):{}},Tf=(t,e,s,r)=>{const n=e.find(a=>a.name===t),i=n==null?void 0:n.type,o=s[t];return i&&!r.includes(i)?rc(i,o):hi(o)},rc=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return Of(e,s)}switch(t){case de.bool:return Af(e);case de.float4:case de.float8:case de.int2:case de.int4:case de.int8:case de.numeric:case de.oid:return Rf(e);case de.json:case de.jsonb:return xf(e);case de.timestamp:return Cf(e);case de.abstime:case de.date:case de.daterange:case de.int4range:case de.int8range:case de.money:case de.reltime:case de.text:case de.time:case de.timestamptz:case de.timetz:case de.tsrange:case de.tstzrange:return hi(e);default:return hi(e)}},hi=t=>t,Af=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Rf=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},xf=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Of=(t,e)=>{if(typeof t!="string")return t;const s=t.length-1,r=t[s];if(t[0]==="{"&&r==="}"){let i;const o=t.slice(1,s);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>rc(e,a))}return t},Cf=t=>typeof t=="string"?t.replace(" ","T"):t,nc=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var rr=t=>typeof t=="function"?t:function(){return t},Pf=typeof self<"u"?self:null,_s=typeof window<"u"?window:null,pt=Pf||_s||globalThis,If="2.0.0",jf=1e4,Nf=1e3,yt={connecting:0,open:1,closing:2,closed:3},De={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},At={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},di={longpoll:"longpoll",websocket:"websocket"},$f={complete:4},fi="base64url.bearer.phx.",Cr=class{constructor(t,e,s,r){this.channel=t,this.event=e,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),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()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:s}){this.recHooks.filter(r=>r.status===t).forEach(r=>r.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},ic=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}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))}},Lf=class{constructor(t,e,s){this.state=De.closed,this.topic=t,this.params=rr(e||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Cr(this,At.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new ic(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=De.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=De.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=De.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=De.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Cr(this,At.leave,rr({}),this.timeout).send(),this.state=De.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(At.reply,(r,n)=>{this.trigger(this.replyEventName(n),r)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=De.closed,this.bindings=[]}onClose(t){this.on(At.close,t)}onError(t){return this.on(At.error,e=>t(e))}on(t,e){let s=this.bindingRef++;return this.bindings.push({event:t,ref:s,callback:e}),s}off(t,e){this.bindings=this.bindings.filter(s=>!(s.event===t&&(typeof e>"u"||e===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,s=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Cr(this,t,function(){return e},s);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=De.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(At.close,"leave")},s=new Cr(this,At.leave,rr({}),t);return s.receive("ok",()=>e()).receive("timeout",()=>e()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(t,e,s){return e}filterBindings(t,e,s){return!0}isMember(t,e,s,r){return this.topic!==t?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:s,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=De.joining,this.joinPush.resend(t))}trigger(t,e,s,r){let n=this.onMessage(t,e,s,r);if(e&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,s));for(let o=0;o<i.length;o++)i[o].callback(n,s,r||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===De.closed}isErrored(){return this.state===De.errored}isJoined(){return this.state===De.joined}isJoining(){return this.state===De.joining}isLeaving(){return this.state===De.leaving}},Qr=class{static request(t,e,s,r,n,i,o){if(pt.XDomainRequest){let a=new pt.XDomainRequest;return this.xdomainRequest(a,t,e,r,n,i,o)}else if(pt.XMLHttpRequest){let a=new pt.XMLHttpRequest;return this.xhrRequest(a,t,e,s,r,n,i,o)}else{if(pt.fetch&&pt.AbortController)return this.fetchRequest(t,e,s,r,n,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,s,r,n,i,o){let a={method:t,headers:s,body:r},l=null;return n&&(l=new AbortController,setTimeout(()=>l.abort(),n),a.signal=l.signal),pt.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,s,r,n,i,o){return t.timeout=n,t.open(e,s),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(r),t}static xhrRequest(t,e,s,r,n,i,o,a){t.open(e,s,!0),t.timeout=i;for(let[l,c]of Object.entries(r))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===$f.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(n),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let s=[];for(var r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;let n=e?`${e}[${r}]`:r,i=t[r];typeof i=="object"?s.push(this.serialize(i,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}return s.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let s=t.match(/\?/)?"&":"?";return`${t}${s}${this.serialize(e)}`}},Uf=t=>{let e="",s=new Uint8Array(t),r=s.byteLength;for(let n=0;n<r;n++)e+=String.fromCharCode(s[n]);return btoa(e)},us=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(fi)&&(this.authToken=atob(e[1].slice(fi.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=yt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+di.websocket),"$1/"+di.longpoll)}endpointURL(){return Qr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,s){this.close(t,e,s),this.readyState=yt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===yt.open||this.readyState===yt.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:s,token:r,messages:n}=e;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else s=0;switch(s){case 200:n.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=yt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(t){typeof t!="string"&&(t=Uf(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
37
+ `),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,s){for(let n of this.reqs)n.abort();this.readyState=yt.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(t,e,s,r,n){let i,o=()=>{this.reqs.delete(i),r()};i=Qr.request(t,this.endpointURL(),e,s,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&n(a)}),this.reqs.add(i)}},Df=class Ws{constructor(e,s={}){let r=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Ws.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=Ws.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,n=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(n):(this.state=Ws.syncDiff(this.state,n,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return Ws.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,s,r,n){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{s[l]||(a[l]=c)}),this.map(s,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(y=>y.phx_ref),d=u.metas.map(y=>y.phx_ref),f=c.metas.filter(y=>d.indexOf(y.phx_ref)<0),m=u.metas.filter(y=>h.indexOf(y.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),m.length>0&&(a[l]=this.clone(u),a[l].metas=m)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},r,n)}static syncDiff(e,s,r,n){let{joins:i,leaves:o}=this.clone(s);return r||(r=function(){}),n||(n=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),n(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,s){return s||(s=function(r,n){return n}),this.map(e,(r,n)=>s(r,n))}static map(e,s){return Object.getOwnPropertyNames(e).map(r=>s(r,e[r]))}static clone(e){return JSON.parse(JSON.stringify(e))}},Pr={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(s))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[s,r,n,i,o]=JSON.parse(t);return e({join_ref:s,ref:r,topic:n,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:s,event:r,topic:n,payload:i}=t,o=this.META_LENGTH+e.length+s.length+n.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,s.length),l.setUint8(c++,n.length),l.setUint8(c++,r.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),s=e.getUint8(0),r=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(t,e,r);case this.KINDS.reply:return this.decodeReply(t,e,r);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,r)}},decodePush(t,e,s){let r=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=s.decode(t.slice(o,o+r));o=o+r;let l=s.decode(t.slice(o,o+n));o=o+n;let c=s.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,s){let r=e.getUint8(1),n=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(t.slice(a,a+r));a=a+r;let c=s.decode(t.slice(a,a+n));a=a+n;let u=s.decode(t.slice(a,a+i));a=a+i;let h=s.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:At.reply,payload:f}},decodeBroadcast(t,e,s){let r=e.getUint8(1),n=e.getUint8(2),i=this.HEADER_LENGTH+2,o=s.decode(t.slice(i,i+r));i=i+r;let a=s.decode(t.slice(i,i+n));i=i+n;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Bf=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||jf,this.transport=e.transport||pt.WebSocket||us,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=pt&&pt.sessionStorage}catch{}this.sessionStore=e.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=Pr.encode.bind(Pr),this.defaultDecoder=Pr.decode.bind(Pr),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==us?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;_s&&_s.addEventListener&&(_s.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),_s.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),_s.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=n=>e.rejoinAfterMs?e.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>e.reconnectAfterMs?e.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(n,i,o)=>{console.log(`${n}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=rr(e.params||{}),this.endPoint=`${t}/${di.websocket}`,this.vsn=e.vsn||If,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new ic(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return us}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Qr.appendParams(Qr.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=rr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==us?this.connectWithFallback(us,this.longPollFallbackMs):this.transportConnect())}log(t,e,s){this.logger&&this.logger(t,e,s)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let r=this.onMessage(n=>{n.ref===e&&(this.off([r]),t(Date.now()-s))});return!0}transportName(t){switch(t){case us:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${fi}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let s=!1,r=!0,n,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([n,i]),r=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),r&&!s&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!r){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Nf,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,s){if(!this.conn)return t&&t();const r=this.conn;this.waitForBufferDone(r,()=>{e?r.close(e,s||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,s=1){if(s===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,s+1)},150*s)}waitForSocketClosed(t,e,s=1){if(s===5||t.readyState===yt.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,s+1)},150*s)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",t,e,s),(e===this.transport||s>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(At.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case yt.connecting:return"connecting";case yt.open:return"open";case yt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([s])=>t.indexOf(s)===-1)}channel(t,e={}){let s=new Lf(t,e,this);return this.channels.push(s),s}push(t){if(this.hasLogger()){let{topic:e,event:s,payload:r,ref:n,join_ref:i}=t;this.log("push",`${e} ${s} (${i}, ${n})`,r)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:s,event:r,payload:n,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(n.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${n.status||""} ${s} ${r} ${i&&"("+i+")"||""}`.trim(),n);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(s,r,n,o)&&l.trigger(r,n,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([s,r])=>{try{r(...e)}catch(n){this.log("error",`error in ${t} callback`,n)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}leaveOpenTopic(t){let e=this.channels.find(s=>s.topic===t&&(s.isJoined()||s.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class nr{constructor(e,s){const r=Hf(s);this.presence=new Df(e.getChannel(),r),this.presence.onJoin((n,i,o)=>{const a=nr.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=nr.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return nr.transformState(this.presence.state)}static transformState(e){return e=Mf(e),Object.getOwnPropertyNames(e).reduce((s,r)=>{const n=e[r];return s[r]=Fr(n),s},{})}static onJoinPayload(e,s,r){const n=Zo(s),i=Fr(r);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,s,r){const n=Zo(s),i=Fr(r);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function Fr(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Mf(t){return JSON.parse(JSON.stringify(t))}function Hf(t){return(t==null?void 0:t.events)&&{events:t.events}}function Zo(t){return t!=null&&t.metas?Fr(t):[]}var ea;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ea||(ea={}));class Ff{get state(){return this.presenceAdapter.state}constructor(e,s){this.channel=e,this.presenceAdapter=new nr(this.channel.channelAdapter,s)}}function qf(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const s=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${s}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Vf{constructor(e,s,r){const n=Kf(r);this.channel=e.getSocket().channel(s,n),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,s){return this.channel.on(e,s)}off(e,s){this.channel.off(e,s)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,s,r){let n;try{n=this.channel.push(e,s,r)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Ef){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return n}updateJoinPayload(e){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),e)}canPush(){return this.socket.isConnected()&&this.state===Vt.joined}isJoined(){return this.state===Vt.joined}isJoining(){return this.state===Vt.joining}isClosed(){return this.state===Vt.closed}isLeaving(){return this.state===Vt.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Kf(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var ta;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(ta||(ta={}));var Es;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Es||(Es={}));var Rt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Rt||(Rt={}));class ir{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,s={config:{}},r){var n,i;if(this.topic=e,this.params=s,this.socket=r,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new Vf(this.socket.socketAdapter,e,this.params),this.presence=new Ff(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=nc(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(n=this.params.config)===null||n===void 0?void 0:n.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,s=this.timeout){var r,n,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(n=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[Es.PRESENCE]&&this.bindings[Es.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(Rt.CHANNEL_ERROR,qf(f))}),this._onClose(()=>e==null?void 0:e(Rt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Rt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=Vt.errored;const m=Object.values(f).join(", ")||"error";e==null||e(Rt.CHANNEL_ERROR,new Error(m,{cause:f}))}).receive("timeout",()=>{e==null||e(Rt.TIMED_OUT)})}return this}_updatePostgresBindings(e,s){var r;const n=this.bindings.postgres_changes,i=(r=n==null?void 0:n.length)!==null&&r!==void 0?r:0,o=[];for(let a=0;a<i;a++){const l=n[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&ir.isFilterValueEqual(f.schema,u)&&ir.isFilterValueEqual(f.table,h)&&ir.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=Vt.errored,s==null||s(Rt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=Vt.errored&&s&&s(Rt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,s={}){return await this.send({type:"presence",event:"track",payload:e},s.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,s,r){const n=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Es.PRESENCE||e===Es.POSTGRES_CHANGES;if(n&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,s,r)}async httpSend(e,s,r={}){var n;if(s==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:s,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,s={}){var r,n;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=s.timeout)!==null&&r!==void 0?r:this.timeout);return await((n=c.body)===null||n===void 0?void 0:n.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(e.type,e,s.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(s=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,s,r){const n=new AbortController,i=setTimeout(()=>n.abort(),r),o=await this.socket.fetch(e,Object.assign(Object.assign({},s),{signal:n.signal}));return clearTimeout(i),o}_on(e,s,r){const n=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,r),o={type:n,filter:s,callback:r,ref:i};return this.bindings[n]?this.bindings[n].push(o):this.bindings[n]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,s,r)=>{var n,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const d=(n=this.bindings[h])===null||n===void 0?void 0:n.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,m=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=s.ids)===null||o===void 0?void 0:o.includes(f))&&(m==="*"||(m==null?void 0:m.toLocaleLowerCase())===((a=s.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=s==null?void 0:s.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,s){const{close:r,error:n,leave:i,join:o}=sc;return s&&[r,n,i,o].includes(e)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,s,r)=>{if(typeof s=="object"&&"ids"in s){const n=s.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=n;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(n))}return s})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in e.bindings)for(const r of e.bindings[s])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(e,s){return(e??void 0)===(s??void 0)}_getPayloadRecords(e){const s={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(s.new=Qo(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=Qo(e.columns,e.old_record)),s}}class Wf{constructor(e,s){this.socket=new Bf(e,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,s,r,n=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),n),this.socket.disconnect(()=>{e(),i("ok")},s,r)})}push(e){this.socket.push(e)}log(e,s,r){this.socket.log(e,s,r)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==ui.connecting}isDisconnecting(){return this.socket.connectionState()==ui.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const sa={HEARTBEAT_INTERVAL:25e3},Gf=[1e3,2e3,5e3,1e4],Jf=1e4;function zf(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var s;return(s=Array.from(t.keys())[e])!==null&&s!==void 0?s:null},removeItem(e){t.delete(e)},setItem(e,s){t.set(e,String(s))}}}function Yf(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return zf()}const Xf=`
38
38
  addEventListener("message", (e) => {
39
39
  if (e.data.event === "start") {
40
40
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -52,23 +52,23 @@ Option 2: Install and provide the "ws" package:
52
52
  const client = new RealtimeClient(url, {
53
53
  ...options,
54
54
  transport: ws
55
- })`):new Error(`WebSocket not available: ${s}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,s)}getChannels(){return this.channels}async removeChannel(e){const s=await e.unsubscribe();return s==="ok"&&e.teardown(),s}async removeAllChannels(){const e=this.channels.map(async r=>{const n=await r.unsubscribe();return r.teardown(),n}),s=await Promise.all(e);return await this.disconnect(),s}log(e,s,r){this.socketAdapter.log(e,s,r)}connectionState(){return this.socketAdapter.connectionState()||ui.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,s={config:{}}){const r=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===r);if(n)return n;{const i=new nr(`realtime:${e}`,s,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(s=>s.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let s,r=!1;if(e)s=e,r=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(n){this.log("error","Error fetching access token from callback",n),s=this.accessTokenValue}else s=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(n=>{const i={access_token:s,version:_f};s&&n.updateJoinPayload(i),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(sc.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${e}`,s)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(s=>{this.log("error","error waiting for auth on connect",s)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(s,r)=>{s=="sent"&&this._setAuthSafely(),e&&e(s,r)}}_startWorkerHeartbeat(){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=s=>{this.log("worker","worker error",s.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let s;if(e)s=e;else{const r=new Blob([Xf],{type:"application/javascript"});s=URL.createObjectURL(r)}return s}_initializeOptions(e){var s,r,n,i,o,a,l,c,u,h,d,f;this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(r=e==null?void 0:e.accessToken)!==null&&r!==void 0?r:null;const m={};m.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Sf,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:sa.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:sa.HEARTBEAT_INTERVAL),m.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:yf.getWebSocketConstructor(),m.params=e==null?void 0:e.params,m.logger=e==null?void 0:e.logger,m.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),m.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:Yf(),m.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:b=>Gf[b-1]||Jf;let v,A;const T=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:wf;switch(T){case bf:v=(b,_)=>_(JSON.stringify(b)),A=(b,_)=>_(JSON.parse(b));break;case tc:v=this.serializer.encode.bind(this.serializer),A=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=T,m.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:v,m.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:A,m.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,m.params=Object.assign(Object.assign({},m.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,m.autoSendHeartbeat=!this.worker}return m}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var dr=class extends Error{constructor(t,e){var s;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((s=e.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Zf(t,e,s){const r=new URL(e,t);if(s)for(const[n,i]of Object.entries(s))i!==void 0&&r.searchParams.set(n,i);return r.toString()}async function ep(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function tp(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:r,query:n,body:i,headers:o}){const a=Zf(t.baseUrl,r,n),l=await ep(t.auth),c=await e(a,{method:s,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,m=f==null?void 0:f.error;throw new dr((m==null?void 0:m.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function Pr(t){return t.join("")}var sp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Pr(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const s={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Pr(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Pr(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Pr(t.namespace)}`}),!0}catch(e){if(e instanceof dr&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof dr&&s.status===409)return;throw s}}};function hs(t){return t.join("")}var rp=class{constructor(t,e="",s){this.client=t,this.prefix=e,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables`,body:e,headers:s})).data.metadata}async updateTable(t,e){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof dr&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof dr&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},np=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=tp({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new sp(this.client,e),this.tableOps=new rp(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function fr(t){"@babel/helpers - typeof";return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fr(t)}function ip(t,e){if(fr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(fr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function op(t){var e=ip(t,"string");return fr(e)=="symbol"?e:e+""}function ap(t,e,s){return(e=op(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ra(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function F(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ra(Object(s),!0).forEach(function(r){ap(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ra(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}var En=class extends Error{constructor(t,e="storage",s,r){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function kn(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var pi=class extends En{constructor(t,e,s,r="storage"){super(t,r,e,s),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=s}toJSON(){return F({},super.toJSON())}},oc=class extends En{constructor(t,e,s="storage"){super(t,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Qr(t,e,s){const r=F({},t),n=e.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===n&&delete r[i];return r[n]=s,r}function lp(t){const e={};for(const[s,r]of Object.entries(t))e[s.toLowerCase()]=r;return e}const cp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),up=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},gi=t=>{if(Array.isArray(t))return t.map(s=>gi(s));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([s,r])=>{const n=s.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=gi(r)}),e},hp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),na=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const s=e.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(t)},dp=async(t,e,s,r)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const n=t;let i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new pi(na(o),i,a,r))}).catch(()=>{const o=i+"";e(new pi(n.statusText||`HTTP ${i} error`,i,o,r))})}else e(new oc(na(t),t,r))},fp=(t,e,s,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!r)return F(F({},n),s);if(up(r)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);n.headers=Qr(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),n.body=JSON.stringify(r)}else n.body=r;return e!=null&&e.duplex&&(n.duplex=e.duplex),F(F({},n),s)};async function Ms(t,e,s,r,n,i,o){return new Promise((a,l)=>{t(s,fp(e,r,n,i)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>dp(c,l,r,o))})}function ac(t="storage"){return{get:async(e,s,r,n)=>Ms(e,"GET",s,r,n,void 0,t),post:async(e,s,r,n,i)=>Ms(e,"POST",s,n,i,r,t),put:async(e,s,r,n,i)=>Ms(e,"PUT",s,n,i,r,t),head:async(e,s,r,n)=>Ms(e,"HEAD",s,F(F({},r),{},{noResolveJson:!0}),n,void 0,t),remove:async(e,s,r,n,i)=>Ms(e,"DELETE",s,n,i,r,t)}}const pp=ac("storage"),{get:pr,post:Ze,put:mi,head:gp,remove:Vi}=pp,Ve=ac("vectors");var $s=class{constructor(t,e={},s,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=lp(e),this.fetch=cp(s),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Qr(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(kn(s))return{data:null,error:s};throw s}}},mp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(kn(e))return{data:null,error:e};throw e}}};let lc;lc=Symbol.toStringTag;var yp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[lc]="BlobDownloadBuilder",this.promise=null}asStream(){return new mp(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(kn(e))return{data:null,error:e};throw e}}};const vp={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ia={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var _p=class extends $s{constructor(t,e={},s,r){super(t,e,r,"storage"),this.bucketId=s}async uploadOrUpdate(t,e,s,r){var n=this;return n.handleOperation(async()=>{let i;const o=F(F({},ia),r);let a=F(F({},n.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",n.encodeMetadata(l)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",n.encodeMetadata(l))):(i=s,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=n.toBase64(n.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))a=Qr(a,d,f);const c=n._removeEmptyFolders(e),u=n._getFinalPath(c),h=await(t=="PUT"?mi:Ze)(n.fetch,`${n.url}/object/${u}`,i,F({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,s){return this.uploadOrUpdate("POST",t,e,s)}async uploadToSignedUrl(t,e,s,r){var n=this;const i=n._removeEmptyFolders(t),o=n._getFinalPath(i),a=new URL(n.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),n.handleOperation(async()=>{let l;const c=F(F({},ia),r);let u=F(F({},n.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&s instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",n.encodeMetadata(h)),l.append("",s)):typeof FormData<"u"&&s instanceof FormData?(l=s,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",n.encodeMetadata(h))):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=n.toBase64(n.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))u=Qr(u,d,f);return{path:i,fullPath:(await mi(n.fetch,a.toString(),l,F({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var s=this;return s.handleOperation(async()=>{let r=s._getFinalPath(t);const n=F({},s.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const i=await Ze(s.fetch,`${s.url}/object/upload/sign/${r}`,{},{headers:n}),o=new URL(s.url+i.url),a=o.searchParams.get("token");if(!a)throw new En("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,s){return this.uploadOrUpdate("PUT",t,e,s)}async move(t,e,s){var r=this;return r.handleOperation(async()=>await Ze(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:r.headers}))}async copy(t,e,s){var r=this;return r.handleOperation(async()=>({path:(await Ze(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(t,e,s){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const i=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let o=await Ze(r.fetch,`${r.url}/object/sign/${n}`,F({expiresIn:e},i?{transform:s.transform}:{}),{headers:r.headers});const a=new URLSearchParams;s!=null&&s.download&&a.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&a.set("cacheNonce",String(s.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,s){var r=this;return r.handleOperation(async()=>{const n=await Ze(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),i=new URLSearchParams;s!=null&&s.download&&i.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&i.set("cacheNonce",String(s.cacheNonce));const o=i.toString();return n.map(a=>F(F({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,s){const r=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",n=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const i=n.toString(),o=this._getFinalPath(t),a=()=>pr(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new yp(a,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);return e.handleOperation(async()=>gi(await pr(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})))}async exists(t){var e=this;const s=e._getFinalPath(t);try{return await gp(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(kn(n)){var r;const i=n instanceof pi?n.status:n instanceof oc?(r=n.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){const s=this._getFinalPath(t),r=new URLSearchParams;e!=null&&e.download&&r.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(r,e.transform),(e==null?void 0:e.cacheNonce)!=null&&r.set("cacheNonce",String(e.cacheNonce));const n=r.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}`)+(n?`?${n}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Vi(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,s){var r=this;return r.handleOperation(async()=>{const n=F(F(F({},vp),e),{},{prefix:t||""});return await Ze(r.fetch,`${r.url}/object/list/${r.bucketId}`,n,{headers:r.headers},s)})}async listV2(t,e){var s=this;return s.handleOperation(async()=>{const r=F({},t);return await Ze(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,r,{headers:s.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const bp="2.105.4",Er={"X-Client-Info":`storage-js/${bp}`};var wp=class extends $s{constructor(t,e={},s,r){const n=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase."));const i=n.href.replace(/\/$/,""),o=F(F({},Er),e);super(i,o,s,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const s=e.listBucketOptionsToQueryString(t);return await pr(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await pr(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var s=this;return s.handleOperation(async()=>await Ze(s.fetch,`${s.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}))}async updateBucket(t,e){var s=this;return s.handleOperation(async()=>await mi(s.fetch,`${s.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await Ze(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Vi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Sp=class extends $s{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},Er),e);super(r,n,s,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ze(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const s=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&s.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&s.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&s.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&s.set("sortOrder",t.sortOrder),t!=null&&t.search&&s.set("search",t.search);const r=s.toString(),n=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await pr(e.fetch,n,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Vi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!hp(t))throw new En("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const s=new np({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(s,{get(n,i){const o=n[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(n,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},Ep=class extends $s{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},Er),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var s=this;return s.handleOperation(async()=>await Ve.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var s=this;return s.handleOperation(async()=>await Ve.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers})||{})}},kp=class extends $s{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},Er),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},Tp=class extends $s{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},Er),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Ve.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Ap=class extends Tp{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Rp(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,s=this;return e().call(s,t)}async getBucket(t){var e=()=>super.getBucket,s=this;return e().call(s,t)}async listBuckets(t={}){var e=()=>super.listBuckets,s=this;return e().call(s,t)}async deleteBucket(t){var e=()=>super.deleteBucket,s=this;return e().call(s,t)}},Rp=class extends Ep{constructor(t,e,s,r){super(t,e,r),this.vectorBucketName=s}async createIndex(t){var e=()=>super.createIndex,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,s=this;return e().call(s,s.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,s=this;return e().call(s,s.vectorBucketName,t)}index(t){return new Op(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Op=class extends kp{constructor(t,e,s,r,n){super(t,e,n),this.vectorBucketName=s,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(t){var e=()=>super.getVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},xp=class extends wp{constructor(t,e={},s,r){super(t,e,s,r)}from(t){return new _p(this.url,this.headers,t,this.fetch)}get vectors(){return new Ap(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Sp(this.url+"/iceberg",this.headers,this.fetch)}};const cc="2.105.4",bs=30*1e3,yi=3,Fn=yi*bs,Cp="http://localhost:9999",Pp="supabase.auth.token",Ip={"X-Client-Info":`gotrue-js/${cc}`},vi="X-Supabase-Api-Version",uc={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},jp=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Np=10*60*1e3;class gr extends Error{constructor(e,s,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function P(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class $p extends gr{constructor(e,s,r){super(e,s,r),this.name="AuthApiError",this.status=s,this.code=r}}function Lp(t){return P(t)&&t.name==="AuthApiError"}class et extends gr{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class Ut extends gr{constructor(e,s,r,n){super(e,r,n),this.name=s,this.status=r}}class Te extends Ut{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ir(t){return P(t)&&t.name==="AuthSessionMissingError"}class ds extends Ut{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class jr extends Ut{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Nr extends Ut{constructor(e,s=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Up(t){return P(t)&&t.name==="AuthImplicitGrantRedirectError"}class oa extends Ut{constructor(e,s=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Dp extends Ut{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class _i extends Ut{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function qn(t){return P(t)&&t.name==="AuthRetryableFetchError"}class aa extends Ut{constructor(e,s,r){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class bi extends Ut{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Zr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),la=`
56
- \r=`.split(""),Bp=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<la.length;e+=1)t[la[e].charCodeAt(0)]=-2;for(let e=0;e<Zr.length;e+=1)t[Zr[e].charCodeAt(0)]=e;return t})();function ca(t,e,s){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;s(Zr[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;s(Zr[r]),e.queuedBits-=6}}function hc(t,e,s){const r=Bp[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)s(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ua(t){const e=[],s=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Fp(o,r,s)};for(let o=0;o<t.length;o+=1)hc(t.charCodeAt(o),n,i);return e.join("")}function Mp(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Hp(t,e){for(let s=0;s<t.length;s+=1){let r=t.charCodeAt(s);if(r>55295&&r<=56319){const n=(r-55296)*1024&65535;r=(t.charCodeAt(s+1)-56320&65535|n)+65536,s+=1}Mp(r,e)}}function Fp(t,e,s){if(e.utf8seq===0){if(t<=127){s(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&s(e.codepoint)}}function Cs(t){const e=[],s={queue:0,queuedBits:0},r=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)hc(t.charCodeAt(n),s,r);return new Uint8Array(e)}function qp(t){const e=[];return Hp(t,s=>e.push(s)),new Uint8Array(e)}function ss(t){const e=[],s={queue:0,queuedBits:0},r=n=>{e.push(n)};return t.forEach(n=>ca(n,s,r)),ca(null,s,r),e.join("")}function Vp(t){return Math.round(Date.now()/1e3)+t}function Kp(){return Symbol("auth-callback")}const Oe=()=>typeof window<"u"&&typeof document<"u",Xt={tested:!1,writable:!1},dc=()=>{if(!Oe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Xt.tested)return Xt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Xt.tested=!0,Xt.writable=!0}catch{Xt.tested=!0,Xt.writable=!1}return Xt.writable};function Wp(t){const e={},s=new URL(t);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return s.searchParams.forEach((r,n)=>{e[n]=r}),e}const fc=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Gp=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",ws=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},Qt=async(t,e)=>{const s=await t.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return null}},Re=async(t,e)=>{await t.removeItem(e)};class Tn{constructor(){this.promise=new Tn.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}Tn.promiseConstructor=Promise;function $r(t){const e=t.split(".");if(e.length!==3)throw new bi("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!jp.test(e[r]))throw new bi("JWT not in base64url format");return{header:JSON.parse(ua(e[0])),payload:JSON.parse(ua(e[1])),signature:Cs(e[2]),raw:{header:e[0],payload:e[1]}}}async function Jp(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function zp(t,e){return new Promise((r,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){n(o);return}}})()})}function Yp(t){return("0"+t.toString(16)).substr(-2)}function Xp(){const e=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=s.length;let n="";for(let i=0;i<56;i++)n+=s.charAt(Math.floor(Math.random()*r));return n}return crypto.getRandomValues(e),Array.from(e,Yp).join("")}async function Qp(t){const s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s),n=new Uint8Array(r);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}async function Zp(t){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."),t;const s=await Qp(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fs(t,e,s=!1){const r=Xp();let n=r;s&&(n+="/recovery"),await ws(t,`${e}-code-verifier`,n);const i=await Zp(r);return[i,r===i?"plain":"s256"]}const eg=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function tg(t){const e=t.headers.get(vi);if(!e||!e.match(eg))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function sg(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function rg(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const ng=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function kt(t){if(!ng.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Qe(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Vn(){const t={};return new Proxy(t,{get:(e,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const r=s.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ig(t,e){return new Proxy(t,{get:(s,r,n)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,r,n)}return!e.value&&typeof r=="string"&&(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."),e.value=!0),Reflect.get(s,r,n)}})}function ha(t){return JSON.parse(JSON.stringify(t))}const es=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},og=[502,503,504,520,521,522,523,524,530];async function da(t){var e;if(!Gp(t))throw new _i(es(t),0);if(og.includes(t.status))throw new _i(es(t),t.status);let s;try{s=await t.json()}catch(i){throw new et(es(i),i)}let r;const n=tg(t);if(n&&n.getTime()>=uc["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?r=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(r=s.error_code),r){if(r==="weak_password")throw new aa(es(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Te}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new aa(es(s),t.status,s.weak_password.reasons);throw new $p(es(s),t.status||500,r)}const ag=(t,e,s,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(r),Object.assign(Object.assign({},n),s))};async function U(t,e,s,r){var n;const i=Object.assign({},r==null?void 0:r.headers);i[vi]||(i[vi]=uc["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(n=r==null?void 0:r.query)!==null&&n!==void 0?n:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await lg(t,e,s+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function lg(t,e,s,r,n,i){const o=ag(e,r,n,i);let a;try{a=await t(s,Object.assign({},o))}catch(l){throw console.error(l),new _i(es(l),0)}if(a.ok||await da(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await da(l)}}function Je(t){var e;let s=null;hg(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=Vp(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:r},error:null}}function fa(t){const e=Je(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((s,r)=>s&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Kt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function cg(t){return{data:t,error:null}}function ug(t){const{action_link:e,email_otp:s,hashed_token:r,redirect_to:n,verification_type:i}=t,o=Sn(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:s,hashed_token:r,redirect_to:n,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function pa(t){return t}function hg(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Kn=["global","local","others"];class dg{constructor({url:e="",headers:s={},fetch:r,experimental:n}){this.url=e,this.headers=s,this.fetch=fc(r),this.experimental=n??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,s=Kn[0]){if(Kn.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Kn.join(", ")}`);try{return await U(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(P(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,s={}){try{return await U(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:Kt})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:s}=e,r=Sn(e,["options"]),n=Object.assign(Object.assign({},r),s);return"newEmail"in r&&(n.new_email=r==null?void 0:r.newEmail,delete n.newEmail),await U(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:ug,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(P(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await U(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Kt})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}}async listUsers(e){var s,r,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await U(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(m.split(";")[1].split("=")[1]);c[`${A}Page`]=v}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(P(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){kt(e);try{return await U(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Kt})}catch(s){if(P(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){kt(e);try{return await U(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:Kt})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,s=!1){kt(e);try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:Kt})}catch(r){if(P(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){kt(e.userId);try{const{data:s,error:r}=await U(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:s,error:r}}catch(s){if(P(s))return{data:null,error:s};throw s}}async _deleteFactor(e){kt(e.userId),kt(e.id);try{return{data:await U(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(P(s))return{data:null,error:s};throw s}}async _listOAuthClients(e){var s,r,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await U(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const v=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(m.split(";")[1].split("=")[1]);c[`${A}Page`]=v}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(P(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await U(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await U(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await U(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await U(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(P(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await U(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}}async _listCustomProviders(e){try{const s={};return e!=null&&e.type&&(s.type=e.type),await U(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:r=>{var n;return{data:{providers:(n=r==null?void 0:r.providers)!==null&&n!==void 0?n:[]},error:null}}})}catch(s){if(P(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(e){try{return await U(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}}async _getCustomProvider(e){try{return await U(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}}async _updateCustomProvider(e,s){try{return await U(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(P(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(e){try{return await U(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(P(s))return{data:null,error:s};throw s}}async _adminListPasskeys(e){Qe(this.experimental),kt(e.userId);try{return await U(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(P(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(e){Qe(this.experimental),kt(e.userId),kt(e.passkeyId);try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(P(s))return{data:null,error:s};throw s}}}function ga(t={}){return{getItem:e=>t[e]||null,setItem:(e,s)=>{t[e]=s},removeItem:e=>{delete t[e]}}}const dt={debug:!!(globalThis&&dc()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class pc extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class ma extends pc{}async function fg(t,e,s){dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;let n;e>0&&(n=setTimeout(()=>{r.abort(),dt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(n),dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await s()}finally{dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new ma(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(dt.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}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"),clearTimeout(n),await s()}})}catch(i){if(e>0&&clearTimeout(n),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(r.signal.aborted)return dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await s()}finally{dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await s()}));throw dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new ma(`Lock "${t}" was released because another request stole it`)}throw i}}function pg(){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)}}function gc(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function gg(t){return parseInt(t,16)}function mg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function yg(t){var e;const{chainId:s,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
57
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=gc(t.address),m=u?`${u}://${r}`:r,v=t.statement?`${t.statement}
58
- `:"",A=`${m} wants you to sign in with your Ethereum account:
55
+ })`):new Error(`WebSocket not available: ${s}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,s)}getChannels(){return this.channels}async removeChannel(e){const s=await e.unsubscribe();return s==="ok"&&e.teardown(),s}async removeAllChannels(){const e=this.channels.map(async r=>{const n=await r.unsubscribe();return r.teardown(),n}),s=await Promise.all(e);return await this.disconnect(),s}log(e,s,r){this.socketAdapter.log(e,s,r)}connectionState(){return this.socketAdapter.connectionState()||ui.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,s={config:{}}){const r=`realtime:${e}`,n=this.getChannels().find(i=>i.topic===r);if(n)return n;{const i=new ir(`realtime:${e}`,s,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(s=>s.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let s,r=!1;if(e)s=e,r=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(n){this.log("error","Error fetching access token from callback",n),s=this.accessTokenValue}else s=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(n=>{const i={access_token:s,version:_f};s&&n.updateJoinPayload(i),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(sc.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${e}`,s)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(s=>{this.log("error","error waiting for auth on connect",s)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(s,r)=>{s=="sent"&&this._setAuthSafely(),e&&e(s,r)}}_startWorkerHeartbeat(){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=s=>{this.log("worker","worker error",s.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=s=>{s.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let s;if(e)s=e;else{const r=new Blob([Xf],{type:"application/javascript"});s=URL.createObjectURL(r)}return s}_initializeOptions(e){var s,r,n,i,o,a,l,c,u,h,d,f;this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(r=e==null?void 0:e.accessToken)!==null&&r!==void 0?r:null;const m={};m.timeout=(n=e==null?void 0:e.timeout)!==null&&n!==void 0?n:Sf,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:sa.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:sa.HEARTBEAT_INTERVAL),m.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:yf.getWebSocketConstructor(),m.params=e==null?void 0:e.params,m.logger=e==null?void 0:e.logger,m.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),m.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:Yf(),m.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:w=>Gf[w-1]||Jf;let y,_;const S=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:wf;switch(S){case bf:y=(w,b)=>b(JSON.stringify(w)),_=(w,b)=>b(JSON.parse(w));break;case tc:y=this.serializer.encode.bind(this.serializer),_=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=S,m.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:y,m.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:_,m.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,m.params=Object.assign(Object.assign({},m.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,m.autoSendHeartbeat=!this.worker}return m}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var pr=class extends Error{constructor(t,e){var s;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((s=e.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Zf(t,e,s){const r=new URL(e,t);if(s)for(const[n,i]of Object.entries(s))i!==void 0&&r.searchParams.set(n,i);return r.toString()}async function ep(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function tp(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:r,query:n,body:i,headers:o}){const a=Zf(t.baseUrl,r,n),l=await ep(t.auth),c=await e(a,{method:s,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,m=f==null?void 0:f.error;throw new pr((m==null?void 0:m.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:m==null?void 0:m.type,icebergCode:m==null?void 0:m.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function Ir(t){return t.join("")}var sp=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:Ir(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const s={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ir(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ir(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ir(t.namespace)}`}),!0}catch(e){if(e instanceof pr&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof pr&&s.status===409)return;throw s}}};function hs(t){return t.join("")}var rp=class{constructor(t,e="",s){this.client=t,this.prefix=e,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables`,body:e,headers:s})).data.metadata}async updateTable(t,e){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${hs(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof pr&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof pr&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},np=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=tp({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new sp(this.client,e),this.tableOps=new rp(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function gr(t){"@babel/helpers - typeof";return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gr(t)}function ip(t,e){if(gr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(gr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function op(t){var e=ip(t,"string");return gr(e)=="symbol"?e:e+""}function ap(t,e,s){return(e=op(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ra(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function F(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?ra(Object(s),!0).forEach(function(r){ap(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):ra(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}var En=class extends Error{constructor(t,e="storage",s,r){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function kn(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var pi=class extends En{constructor(t,e,s,r="storage"){super(t,r,e,s),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=s}toJSON(){return F({},super.toJSON())}},oc=class extends En{constructor(t,e,s="storage"){super(t,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Zr(t,e,s){const r=F({},t),n=e.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===n&&delete r[i];return r[n]=s,r}function lp(t){const e={};for(const[s,r]of Object.entries(t))e[s.toLowerCase()]=r;return e}const cp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),up=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},gi=t=>{if(Array.isArray(t))return t.map(s=>gi(s));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([s,r])=>{const n=s.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[n]=gi(r)}),e},hp=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),na=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const s=e.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(t)},dp=async(t,e,s,r)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const n=t;let i=parseInt(String(n.status),10);Number.isFinite(i)||(i=500),n.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new pi(na(o),i,a,r))}).catch(()=>{const o=i+"";e(new pi(n.statusText||`HTTP ${i} error`,i,o,r))})}else e(new oc(na(t),t,r))},fp=(t,e,s,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!r)return F(F({},n),s);if(up(r)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);n.headers=Zr(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),n.body=JSON.stringify(r)}else n.body=r;return e!=null&&e.duplex&&(n.duplex=e.duplex),F(F({},n),s)};async function Hs(t,e,s,r,n,i,o){return new Promise((a,l)=>{t(s,fp(e,r,n,i)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>dp(c,l,r,o))})}function ac(t="storage"){return{get:async(e,s,r,n)=>Hs(e,"GET",s,r,n,void 0,t),post:async(e,s,r,n,i)=>Hs(e,"POST",s,n,i,r,t),put:async(e,s,r,n,i)=>Hs(e,"PUT",s,n,i,r,t),head:async(e,s,r,n)=>Hs(e,"HEAD",s,F(F({},r),{},{noResolveJson:!0}),n,void 0,t),remove:async(e,s,r,n,i)=>Hs(e,"DELETE",s,n,i,r,t)}}const pp=ac("storage"),{get:mr,post:tt,put:mi,head:gp,remove:Vi}=pp,Ke=ac("vectors");var Ls=class{constructor(t,e={},s,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=lp(e),this.fetch=cp(s),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Zr(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(kn(s))return{data:null,error:s};throw s}}},mp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(kn(e))return{data:null,error:e};throw e}}};let lc;lc=Symbol.toStringTag;var yp=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[lc]="BlobDownloadBuilder",this.promise=null}asStream(){return new mp(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(kn(e))return{data:null,error:e};throw e}}};const vp={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ia={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var _p=class extends Ls{constructor(t,e={},s,r){super(t,e,r,"storage"),this.bucketId=s}async uploadOrUpdate(t,e,s,r){var n=this;return n.handleOperation(async()=>{let i;const o=F(F({},ia),r);let a=F(F({},n.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",n.encodeMetadata(l)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",n.encodeMetadata(l))):(i=s,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=n.toBase64(n.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))a=Zr(a,d,f);const c=n._removeEmptyFolders(e),u=n._getFinalPath(c),h=await(t=="PUT"?mi:tt)(n.fetch,`${n.url}/object/${u}`,i,F({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,s){return this.uploadOrUpdate("POST",t,e,s)}async uploadToSignedUrl(t,e,s,r){var n=this;const i=n._removeEmptyFolders(t),o=n._getFinalPath(i),a=new URL(n.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),n.handleOperation(async()=>{let l;const c=F(F({},ia),r);let u=F(F({},n.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&s instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",n.encodeMetadata(h)),l.append("",s)):typeof FormData<"u"&&s instanceof FormData?(l=s,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",n.encodeMetadata(h))):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=n.toBase64(n.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))u=Zr(u,d,f);return{path:i,fullPath:(await mi(n.fetch,a.toString(),l,F({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var s=this;return s.handleOperation(async()=>{let r=s._getFinalPath(t);const n=F({},s.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const i=await tt(s.fetch,`${s.url}/object/upload/sign/${r}`,{},{headers:n}),o=new URL(s.url+i.url),a=o.searchParams.get("token");if(!a)throw new En("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,s){return this.uploadOrUpdate("PUT",t,e,s)}async move(t,e,s){var r=this;return r.handleOperation(async()=>await tt(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:r.headers}))}async copy(t,e,s){var r=this;return r.handleOperation(async()=>({path:(await tt(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:s==null?void 0:s.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(t,e,s){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const i=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let o=await tt(r.fetch,`${r.url}/object/sign/${n}`,F({expiresIn:e},i?{transform:s.transform}:{}),{headers:r.headers});const a=new URLSearchParams;s!=null&&s.download&&a.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&a.set("cacheNonce",String(s.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,s){var r=this;return r.handleOperation(async()=>{const n=await tt(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),i=new URLSearchParams;s!=null&&s.download&&i.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&i.set("cacheNonce",String(s.cacheNonce));const o=i.toString();return n.map(a=>F(F({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,s){const r=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",n=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const i=n.toString(),o=this._getFinalPath(t),a=()=>mr(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new yp(a,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);return e.handleOperation(async()=>gi(await mr(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})))}async exists(t){var e=this;const s=e._getFinalPath(t);try{return await gp(e.fetch,`${e.url}/object/${s}`,{headers:e.headers}),{data:!0,error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(kn(n)){var r;const i=n instanceof pi?n.status:n instanceof oc?(r=n.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:n}}throw n}}getPublicUrl(t,e){const s=this._getFinalPath(t),r=new URLSearchParams;e!=null&&e.download&&r.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(r,e.transform),(e==null?void 0:e.cacheNonce)!=null&&r.set("cacheNonce",String(e.cacheNonce));const n=r.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}`)+(n?`?${n}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Vi(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,s){var r=this;return r.handleOperation(async()=>{const n=F(F(F({},vp),e),{},{prefix:t||""});return await tt(r.fetch,`${r.url}/object/list/${r.bucketId}`,n,{headers:r.headers},s)})}async listV2(t,e){var s=this;return s.handleOperation(async()=>{const r=F({},t);return await tt(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,r,{headers:s.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const bp="2.105.4",kr={"X-Client-Info":`storage-js/${bp}`};var wp=class extends Ls{constructor(t,e={},s,r){const n=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase."));const i=n.href.replace(/\/$/,""),o=F(F({},kr),e);super(i,o,s,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const s=e.listBucketOptionsToQueryString(t);return await mr(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await mr(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var s=this;return s.handleOperation(async()=>await tt(s.fetch,`${s.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}))}async updateBucket(t,e){var s=this;return s.handleOperation(async()=>await mi(s.fetch,`${s.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await tt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Vi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},Sp=class extends Ls{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},kr),e);super(r,n,s,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await tt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const s=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&s.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&s.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&s.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&s.set("sortOrder",t.sortOrder),t!=null&&t.search&&s.set("search",t.search);const r=s.toString(),n=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return await mr(e.fetch,n,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Vi(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!hp(t))throw new En("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const s=new np({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(s,{get(n,i){const o=n[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(n,a),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}},Ep=class extends Ls{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},kr),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var s=this;return s.handleOperation(async()=>await Ke.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var s=this;return s.handleOperation(async()=>await Ke.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers})||{})}},kp=class extends Ls{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},kr),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},Tp=class extends Ls{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=F(F({},kr),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Ke.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Ap=class extends Tp{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Rp(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,s=this;return e().call(s,t)}async getBucket(t){var e=()=>super.getBucket,s=this;return e().call(s,t)}async listBuckets(t={}){var e=()=>super.listBuckets,s=this;return e().call(s,t)}async deleteBucket(t){var e=()=>super.deleteBucket,s=this;return e().call(s,t)}},Rp=class extends Ep{constructor(t,e,s,r){super(t,e,r),this.vectorBucketName=s}async createIndex(t){var e=()=>super.createIndex,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,s=this;return e().call(s,s.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,s=this;return e().call(s,s.vectorBucketName,t)}index(t){return new xp(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},xp=class extends kp{constructor(t,e,s,r,n){super(t,e,n),this.vectorBucketName=s,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(t){var e=()=>super.getVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,s=this;return e().call(s,F(F({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},Op=class extends wp{constructor(t,e={},s,r){super(t,e,s,r)}from(t){return new _p(this.url,this.headers,t,this.fetch)}get vectors(){return new Ap(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Sp(this.url+"/iceberg",this.headers,this.fetch)}};const cc="2.105.4",bs=30*1e3,yi=3,Fn=yi*bs,Cp="http://localhost:9999",Pp="supabase.auth.token",Ip={"X-Client-Info":`gotrue-js/${cc}`},vi="X-Supabase-Api-Version",uc={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},jp=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Np=10*60*1e3;class yr extends Error{constructor(e,s,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function I(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class $p extends yr{constructor(e,s,r){super(e,s,r),this.name="AuthApiError",this.status=s,this.code=r}}function Lp(t){return I(t)&&t.name==="AuthApiError"}class st extends yr{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class Ut extends yr{constructor(e,s,r,n){super(e,r,n),this.name=s,this.status=r}}class Te extends Ut{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function jr(t){return I(t)&&t.name==="AuthSessionMissingError"}class ds extends Ut{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Nr extends Ut{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class $r extends Ut{constructor(e,s=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function Up(t){return I(t)&&t.name==="AuthImplicitGrantRedirectError"}class oa extends Ut{constructor(e,s=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Dp extends Ut{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class _i extends Ut{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function qn(t){return I(t)&&t.name==="AuthRetryableFetchError"}class aa extends Ut{constructor(e,s,r){super(e,"AuthWeakPasswordError",s,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class bi extends Ut{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const en="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),la=`
56
+ \r=`.split(""),Bp=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<la.length;e+=1)t[la[e].charCodeAt(0)]=-2;for(let e=0;e<en.length;e+=1)t[en[e].charCodeAt(0)]=e;return t})();function ca(t,e,s){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;s(en[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;s(en[r]),e.queuedBits-=6}}function hc(t,e,s){const r=Bp[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)s(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function ua(t){const e=[],s=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Fp(o,r,s)};for(let o=0;o<t.length;o+=1)hc(t.charCodeAt(o),n,i);return e.join("")}function Mp(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Hp(t,e){for(let s=0;s<t.length;s+=1){let r=t.charCodeAt(s);if(r>55295&&r<=56319){const n=(r-55296)*1024&65535;r=(t.charCodeAt(s+1)-56320&65535|n)+65536,s+=1}Mp(r,e)}}function Fp(t,e,s){if(e.utf8seq===0){if(t<=127){s(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&s(e.codepoint)}}function Cs(t){const e=[],s={queue:0,queuedBits:0},r=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)hc(t.charCodeAt(n),s,r);return new Uint8Array(e)}function qp(t){const e=[];return Hp(t,s=>e.push(s)),new Uint8Array(e)}function ss(t){const e=[],s={queue:0,queuedBits:0},r=n=>{e.push(n)};return t.forEach(n=>ca(n,s,r)),ca(null,s,r),e.join("")}function Vp(t){return Math.round(Date.now()/1e3)+t}function Kp(){return Symbol("auth-callback")}const xe=()=>typeof window<"u"&&typeof document<"u",Xt={tested:!1,writable:!1},dc=()=>{if(!xe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Xt.tested)return Xt.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Xt.tested=!0,Xt.writable=!0}catch{Xt.tested=!0,Xt.writable=!1}return Xt.writable};function Wp(t){const e={},s=new URL(t);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((n,i)=>{e[i]=n})}catch{}return s.searchParams.forEach((r,n)=>{e[n]=r}),e}const fc=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Gp=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",ws=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},Qt=async(t,e)=>{const s=await t.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return null}},Re=async(t,e)=>{await t.removeItem(e)};class Tn{constructor(){this.promise=new Tn.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}Tn.promiseConstructor=Promise;function Lr(t){const e=t.split(".");if(e.length!==3)throw new bi("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!jp.test(e[r]))throw new bi("JWT not in base64url format");return{header:JSON.parse(ua(e[0])),payload:JSON.parse(ua(e[1])),signature:Cs(e[2]),raw:{header:e[0],payload:e[1]}}}async function Jp(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function zp(t,e){return new Promise((r,n)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){r(o);return}}catch(o){if(!e(i,o)){n(o);return}}})()})}function Yp(t){return("0"+t.toString(16)).substr(-2)}function Xp(){const e=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=s.length;let n="";for(let i=0;i<56;i++)n+=s.charAt(Math.floor(Math.random()*r));return n}return crypto.getRandomValues(e),Array.from(e,Yp).join("")}async function Qp(t){const s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s),n=new Uint8Array(r);return Array.from(n).map(i=>String.fromCharCode(i)).join("")}async function Zp(t){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."),t;const s=await Qp(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fs(t,e,s=!1){const r=Xp();let n=r;s&&(n+="/recovery"),await ws(t,`${e}-code-verifier`,n);const i=await Zp(r);return[i,r===i?"plain":"s256"]}const eg=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function tg(t){const e=t.headers.get(vi);if(!e||!e.match(eg))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function sg(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function rg(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const ng=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function kt(t){if(!ng.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function et(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Vn(){const t={};return new Proxy(t,{get:(e,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const r=s.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${s}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,s)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${s}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function ig(t,e){return new Proxy(t,{get:(s,r,n)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(s,r,n)}return!e.value&&typeof r=="string"&&(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."),e.value=!0),Reflect.get(s,r,n)}})}function ha(t){return JSON.parse(JSON.stringify(t))}const es=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},og=[502,503,504,520,521,522,523,524,530];async function da(t){var e;if(!Gp(t))throw new _i(es(t),0);if(og.includes(t.status))throw new _i(es(t),t.status);let s;try{s=await t.json()}catch(i){throw new st(es(i),i)}let r;const n=tg(t);if(n&&n.getTime()>=uc["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?r=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(r=s.error_code),r){if(r==="weak_password")throw new aa(es(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Te}else if(typeof s=="object"&&s&&typeof s.weak_password=="object"&&s.weak_password&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new aa(es(s),t.status,s.weak_password.reasons);throw new $p(es(s),t.status||500,r)}const ag=(t,e,s,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),n.body=JSON.stringify(r),Object.assign(Object.assign({},n),s))};async function U(t,e,s,r){var n;const i=Object.assign({},r==null?void 0:r.headers);i[vi]||(i[vi]=uc["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(n=r==null?void 0:r.query)!==null&&n!==void 0?n:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await lg(t,e,s+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function lg(t,e,s,r,n,i){const o=ag(e,r,n,i);let a;try{a=await t(s,Object.assign({},o))}catch(l){throw console.error(l),new _i(es(l),0)}if(a.ok||await da(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await da(l)}}function Ye(t){var e;let s=null;hg(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=Vp(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:r},error:null}}function fa(t){const e=Ye(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((s,r)=>s&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function Kt(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function cg(t){return{data:t,error:null}}function ug(t){const{action_link:e,email_otp:s,hashed_token:r,redirect_to:n,verification_type:i}=t,o=Sn(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:s,hashed_token:r,redirect_to:n,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function pa(t){return t}function hg(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Kn=["global","local","others"];class dg{constructor({url:e="",headers:s={},fetch:r,experimental:n}){this.url=e,this.headers=s,this.fetch=fc(r),this.experimental=n??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,s=Kn[0]){if(Kn.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Kn.join(", ")}`);try{return await U(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,s={}){try{return await U(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:Kt})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:s}=e,r=Sn(e,["options"]),n=Object.assign(Object.assign({},r),s);return"newEmail"in r&&(n.new_email=r==null?void 0:r.newEmail,delete n.newEmail),await U(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:ug,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(I(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await U(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:Kt})}catch(s){if(I(s))return{data:{user:null},error:s};throw s}}async listUsers(e){var s,r,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await U(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),_=JSON.parse(m.split(";")[1].split("=")[1]);c[`${_}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){kt(e);try{return await U(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:Kt})}catch(s){if(I(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){kt(e);try{return await U(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:Kt})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,s=!1){kt(e);try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:Kt})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){kt(e.userId);try{const{data:s,error:r}=await U(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:s,error:r}}catch(s){if(I(s))return{data:null,error:s};throw s}}async _deleteFactor(e){kt(e.userId),kt(e.id);try{return{data:await U(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(I(s))return{data:null,error:s};throw s}}async _listOAuthClients(e){var s,r,n,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await U(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(s=e==null?void 0:e.page)===null||s===void 0?void 0:s.toString())!==null&&r!==void 0?r:"",per_page:(i=(n=e==null?void 0:e.perPage)===null||n===void 0?void 0:n.toString())!==null&&i!==void 0?i:""},xform:pa});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(m=>{const y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),_=JSON.parse(m.split(";")[1].split("=")[1]);c[`${_}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await U(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(I(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await U(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(I(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await U(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await U(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(I(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await U(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(I(s))return{data:null,error:s};throw s}}async _listCustomProviders(e){try{const s={};return e!=null&&e.type&&(s.type=e.type),await U(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:r=>{var n;return{data:{providers:(n=r==null?void 0:r.providers)!==null&&n!==void 0?n:[]},error:null}}})}catch(s){if(I(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(e){try{return await U(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(I(s))return{data:null,error:s};throw s}}async _getCustomProvider(e){try{return await U(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(I(s))return{data:null,error:s};throw s}}async _updateCustomProvider(e,s){try{return await U(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(e){try{return await U(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(I(s))return{data:null,error:s};throw s}}async _adminListPasskeys(e){et(this.experimental),kt(e.userId);try{return await U(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(I(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(e){et(this.experimental),kt(e.userId),kt(e.passkeyId);try{return await U(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(I(s))return{data:null,error:s};throw s}}}function ga(t={}){return{getItem:e=>t[e]||null,setItem:(e,s)=>{t[e]=s},removeItem:e=>{delete t[e]}}}const dt={debug:!!(globalThis&&dc()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class pc extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class ma extends pc{}async function fg(t,e,s){dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;let n;e>0&&(n=setTimeout(()=>{r.abort(),dt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(n),dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await s()}finally{dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new ma(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(dt.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}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"),clearTimeout(n),await s()}})}catch(i){if(e>0&&clearTimeout(n),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(r.signal.aborted)return dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await s()}finally{dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await s()}));throw dt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new ma(`Lock "${t}" was released because another request stole it`)}throw i}}function pg(){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)}}function gc(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function gg(t){return parseInt(t,16)}function mg(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function yg(t){var e;const{chainId:s,domain:r,expirationTime:n,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(s))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${s}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
57
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=gc(t.address),m=u?`${u}://${r}`:r,y=t.statement?`${t.statement}
58
+ `:"",_=`${m} wants you to sign in with your Ethereum account:
59
59
  ${f}
60
60
 
61
- ${v}`;let T=`URI: ${h}
61
+ ${y}`;let S=`URI: ${h}
62
62
  Version: ${d}
63
63
  Chain ID: ${s}${o?`
64
64
  Nonce: ${o}`:""}
65
- Issued At: ${i.toISOString()}`;if(n&&(T+=`
66
- Expiration Time: ${n.toISOString()}`),a&&(T+=`
67
- Not Before: ${a.toISOString()}`),l&&(T+=`
68
- Request ID: ${l}`),c){let b=`
69
- Resources:`;for(const _ of c){if(!_||typeof _!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${_}`);b+=`
70
- - ${_}`}T+=b}return`${A}
71
- ${T}`}class we extends Error{constructor({message:e,code:s,cause:r,name:n}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=n??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=s}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class en extends we{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function vg({error:t,options:e}){var s,r,n;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new we({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new we({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new we({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new we({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new we({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new we({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new we({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new we({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(mc(o)){if(i.rp.id!==o)return new we({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new we({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new we({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new we({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new we({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function _g({error:t,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new we({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new we({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(mc(r)){if(s.rpId!==r)return new we({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new we({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new we({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new we({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class bg{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const wi=new bg;function ya(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:s,excludeCredentials:r}=t,n=Sn(t,["challenge","user","excludeCredentials"]),i=Cs(e).buffer,o=Object.assign(Object.assign({},s),{id:Cs(s.id).buffer}),a=Object.assign(Object.assign({},n),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Cs(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function va(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:s}=t,r=Sn(t,["challenge","allowCredentials"]),n=Cs(e).buffer,i=Object.assign(Object.assign({},r),{challenge:n});if(s&&s.length>0){i.allowCredentials=new Array(s.length);for(let o=0;o<s.length;o++){const a=s[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Cs(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function _a(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t;return{id:t.id,rawId:t.id,response:{attestationObject:ss(new Uint8Array(t.response.attestationObject)),clientDataJSON:ss(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function ba(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t,r=t.getClientExtensionResults(),n=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ss(new Uint8Array(n.authenticatorData)),clientDataJSON:ss(new Uint8Array(n.clientDataJSON)),signature:ss(new Uint8Array(n.signature)),userHandle:n.userHandle?ss(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function mc(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function tn(){var t,e;return!!(Oe()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function yc(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new en("Browser returned unexpected credential type",e)}:{data:null,error:new en("Empty credential response",e)}}catch(e){return{data:null,error:vg({error:e,options:t})}}}async function vc(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new en("Browser returned unexpected credential type",e)}:{data:null,error:new en("Empty credential response",e)}}catch(e){return{data:null,error:_g({error:e,options:t})}}}const wg={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Sg={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function sn(...t){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),s=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),r={};for(const n of t)if(n)for(const i in n){const o=n[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(s(o))r[i]=o;else if(e(o)){const a=r[i];e(a)?r[i]=sn(a,o):r[i]=sn(o)}else r[i]=o}return r}function Eg(t,e){return sn(wg,t,e||{})}function kg(t,e){return sn(Sg,t,e||{})}class Tg{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:s,friendlyName:r,signal:n},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!a)return{data:null,error:l};const c=n??wi.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,m=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${m}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Eg(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await yc({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=kg(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await vc(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return P(a)?{data:null,error:a}:{data:null,error:new et("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:s,webauthn:r}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!s)return{data:null,error:new gr("rpId is required for WebAuthn authentication")};try{if(!tn())return{data:null,error:new et("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:r},signal:n},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:s,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return P(o)?{data:null,error:o}:{data:null,error:new et("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!s)return{data:null,error:new gr("rpId is required for WebAuthn registration")};try{if(!tn())return{data:null,error:new et("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:s,rpOrigins:r},signal:n},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:s,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return P(o)?{data:null,error:o}:{data:null,error:new et("Unexpected error in register",o)}}}}pg();const Ag={url:Cp,storageKey:Pp,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Ip,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function wa(t,e,s){return await s()}const ps={};class mr{get jwks(){var e,s;return(s=(e=ps[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){ps[this.storageKey]=Object.assign(Object.assign({},ps[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=ps[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ps[this.storageKey]=Object.assign(Object.assign({},ps[this.storageKey]),{cachedAt:e})}constructor(e){var s,r,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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;const o=Object.assign(Object.assign({},Ag),e);if(this.storageKey=o.storageKey,this.instanceID=(s=mr.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,mr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Oe()){const a=`${this._logPrefix()} 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.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new dg({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=fc(o.fetch),this.lock=o.lock||wa,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Oe()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=fg:this.lock=wa,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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),webauthn:new Tg(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:dc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ga(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=ga(this.memoryStorage)),Oe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${cc}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let s={},r="none";if(Oe()&&(s=Wp(window.location.href),this._isImplicitGrantCallback(s)?r="implicit":await this._isPKCECallback(s)&&(r="pkce")),Oe()&&this.detectSessionInUrl&&r!=="none"){const{data:n,error:i}=await this._getSessionFromURL(s,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Up(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=n;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return P(s)?this._returnResult({error:s}):this._returnResult({error:new et("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,r,n;try{const i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:Je}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(P(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var s,r,n;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await fs(this.storage,this.storageKey)),i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(s=d==null?void 0:d.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:m},xform:Je})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},channel:(n=d==null?void 0:d.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Je})}else throw new jr("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Re(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let s;if("email"in e){const{email:i,password:o,options:a}=e;s=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:fa})}else if("phone"in e){const{phone:i,password:o,options:a}=e;s=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:fa})}else throw new jr("You must provide either an email or phone number and a password");const{data:r,error:n}=s;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!r||!r.session||!r.user){const i=new ds;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(s){if(P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,r,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.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(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,r,n,i,o,a,l,c,u,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{const{chain:v,wallet:A,statement:T,options:b}=e;let _;if(Oe())if(typeof A=="object")_=A;else{const K=window;if("ethereum"in K&&typeof K.ethereum=="object"&&"request"in K.ethereum&&typeof K.ethereum.request=="function")_=K.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof A!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=A}const O=new URL((s=b==null?void 0:b.url)!==null&&s!==void 0?s:window.location.href),M=await _.request({method:"eth_requestAccounts"}).then(K=>K).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!M||M.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const G=gc(M[0]);let V=(r=b==null?void 0:b.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!V){const K=await _.request({method:"eth_chainId"});V=gg(K)}const Y={domain:O.host,address:G,statement:T,uri:O.href,version:"1",chainId:V,nonce:(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=b==null?void 0:b.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=yg(Y),m=await _.request({method:"personal_sign",params:[mg(f),G]})}try{const{data:v,error:A}=await U(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:Je});if(A)throw A;if(!v||!v.session||!v.user){const T=new ds;return this._returnResult({data:{user:null,session:null},error:T})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:A})}catch(v){if(P(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async signInWithSolana(e){var s,r,n,i,o,a,l,c,u,h,d,f;let m,v;if("message"in e)m=e.message,v=e.signature;else{const{chain:A,wallet:T,statement:b,options:_}=e;let O;if(Oe())if(typeof T=="object")O=T;else{const G=window;if("solana"in G&&typeof G.solana=="object"&&("signIn"in G.solana&&typeof G.solana.signIn=="function"||"signMessage"in G.solana&&typeof G.solana.signMessage=="function"))O=G.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof T!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=T}const M=new URL((s=_==null?void 0:_.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in O&&O.signIn){const G=await O.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:M.host,uri:M.href}),b?{statement:b}:null));let V;if(Array.isArray(G)&&G[0]&&typeof G[0]=="object")V=G[0];else if(G&&typeof G=="object"&&"signedMessage"in G&&"signature"in G)V=G;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in V&&"signature"in V&&(typeof V.signedMessage=="string"||V.signedMessage instanceof Uint8Array)&&V.signature instanceof Uint8Array)m=typeof V.signedMessage=="string"?V.signedMessage:new TextDecoder().decode(V.signedMessage),v=V.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in O)||typeof O.signMessage!="function"||!("publicKey"in O)||typeof O!="object"||!O.publicKey||!("toBase58"in O.publicKey)||typeof O.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${M.host} wants you to sign in with your Solana account:`,O.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${M.href}`,`Issued At: ${(n=(r=_==null?void 0:_.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((a=_==null?void 0:_.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(u=_==null?void 0:_.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(V=>`- ${V}`)]:[]].join(`
72
- `);const G=await O.signMessage(new TextEncoder().encode(m),"utf8");if(!G||!(G instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=G}}try{const{data:A,error:T}=await U(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:ss(v)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Je});if(T)throw T;if(!A||!A.session||!A.user){const b=new ds;return this._returnResult({data:{user:null,session:null},error:b})}return A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),this._returnResult({data:Object.assign({},A),error:T})}catch(A){if(P(A))return this._returnResult({data:{user:null,session:null},error:A});throw A}}async _exchangeCodeForSession(e){const s=await Qt(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Dp;const{data:i,error:o}=await U(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Je});if(await Re(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new ds;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(n==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:o})}catch(i){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:s,provider:r,token:n,access_token:i,nonce:o}=e,a=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:Je}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new ds;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(s){if(P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,r,n,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await fs(this.storage,this.storageKey));const{error:h}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new jr("You must provide either an email or phone number.")}catch(a){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var s,r;try{let n,i;"options"in e&&(n=(s=e.options)===null||s===void 0?void 0:s.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await U(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:Je});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(n){if(P(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithSSO(e){var s,r,n,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await fs(this.storage,this.storageKey));const c=await U(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:(r=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&r!==void 0?r:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:cg});return!((i=c.data)===null||i===void 0)&&i.url&&Oe()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)throw r;if(!s)throw new Te;const{error:n}=await U(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(P(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:r,type:n,options:i}=e,{error:o}=await U(this.fetch,"POST",s,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:r,type:n,options:i}=e,{data:o,error:a}=await U(this.fetch,"POST",s,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new jr("You must provide either an email or phone number and a type")}catch(s){if(P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await r,await s()))();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 r=s();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await r}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 s=await this.__loadSession();return await e(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const s=await Qt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<Fn:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Qt(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Vn()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=ig(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Kt}):await this._useSession(async s=>{var r,n,i;const{data:o,error:a}=s;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Te}:await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:Kt})})}catch(s){if(P(s))return Ir(s)&&(await this._removeSession(),await Re(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async r=>{const{data:n,error:i}=r;if(i)throw i;if(!n.session)throw new Te;const o=n.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await fs(this.storage,this.storageKey));const{data:c,error:u}=await U(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:Kt});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Te;const s=Date.now()/1e3;let r=s,n=!0,i=null;const{payload:o}=$r(e.access_token);if(o.exp&&(r=o.exp,n=r<=s),n){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-s,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(s){if(P(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async s=>{var r;if(!e){const{data:o,error:a}=s;if(a)throw a;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Te;const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(P(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){var r;try{if(!Oe())throw new Nr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Nr(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new oa("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Nr("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new oa("No code detected.");const{data:_,error:O}=await this._exchangeCodeForSession(e.code);if(O)throw O;const M=new URL(window.location.href);return M.searchParams.delete("code"),window.history.replaceState(window.history.state,"",M.toString()),{data:{session:_.session,redirectType:(r=_.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new Nr("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const m=f-h;m*1e3<=bs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const v=f-d;h-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,f,h):h-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,f,h);const{data:A,error:T}=await this._getUser(o);if(T)throw T;const b={provider_token:n,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:A.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(n){if(P(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const s=await Qt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var r;const{data:n,error:i}=s;if(i&&!Ir(i))return this._returnResult({error:i});const o=(r=n.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(Lp(a)&&(a.status===404||a.status===401||a.status===403)||Ir(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await Re(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=Kp(),r={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async s=>{var r,n;try{const{data:{session:i},error:o}=s;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.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),Ir(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,s={}){let r=null,n=null;this.flowType==="pkce"&&([r,n]=await fs(this.storage,this.storageKey,!0));try{return await U(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(i){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:s,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:r,error:n}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await U(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return Oe()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(P(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var r;try{const{error:n,data:{session:i}}=s;if(n)throw n;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Je}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new ds}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(n){if(await Re(this.storage,`${this.storageKey}-code-verifier`),P(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var r,n;const{data:i,error:o}=s;if(o)throw o;return await U(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:void 0})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const r=Date.now();return await zp(async n=>(n>0&&await Jp(200*Math.pow(2,n-1)),this._debug(s,"refreshing attempt",n),await U(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Je})),(n,i)=>{const o=200*Math.pow(2,n);return i&&qn(i)&&Date.now()+o-r<bs})}catch(r){if(this._debug(s,"error",r),P(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",r),Oe()&&!s.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,s;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const n=await Qt(this.storage,this.storageKey);if(n&&this.userStorage){let o=await Qt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await ws(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Vn()}else if(n&&!n.user&&!n.user){const o=await Qt(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await Re(this.storage,this.storageKey+"-user"),await ws(this.storage,this.storageKey,n)):n.user=Vn()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),n!==null&&await this._removeSession();return}const i=((s=n.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<Fn;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${Fn}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),qn(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(n.access_token);!a&&(o!=null&&o.user)?(n.user=o.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(r,"error",n),console.error(n);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var s,r;if(!e)throw new Te;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Tn;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Te;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(n,"error",i),P(i)){const o={data:null,error:i};return qn(i)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,s,r=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",s,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:s});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,s)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Re(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),r=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&s.user&&await ws(this.userStorage,this.storageKey+"-user",{user:s.user});const n=Object.assign({},s);delete n.user;const i=ha(n);await ws(this.storage,this.storageKey,i)}else{const n=ha(s);await ws(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Re(this.storage,this.storageKey),await Re(this.storage,this.storageKey+"-code-verifier"),await Re(this.storage,this.storageKey+"-user"),this.userStorage&&await Re(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Oe()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),bs);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}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 s=>{const{data:{session:r}}=s;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((r.expires_at*1e3-e)/bs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${bs}ms, refresh threshold is ${yi} ticks`),n<=yi&&await this._callRefreshToken(r.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof pc)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Oe()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"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,s,r){const n=[`provider=${encodeURIComponent(s)}`];if(r!=null&&r.redirectTo&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await fs(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});n.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);n.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var r;const{data:n,error:i}=s;return i?this._returnResult({data:null,error:i}):await U(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var r,n;const{data:i,error:o}=s;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await U(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((n=l==null?void 0:l.totp)===null||n===void 0)&&n.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:n,error:i}=s;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?_a(e.webauthn.credential_response):ba(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await U(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:n,error:i}=s;if(i)return this._returnResult({data:null,error:i});const o=await U(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ya(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:va(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:r}=await this.getUser();if(r)return{data:null,error:r};const n={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=s==null?void 0:s.factors)!==null&&e!==void 0?e:[])n.all.push(i),i.status==="verified"&&n[i.factor_type].push(i);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var s,r,n,i;if(e)try{const{payload:f}=$r(e);let m=null;f.aal&&(m=f.aal);let v=m;const{data:{user:A},error:T}=await this.getUser(e);if(T)return this._returnResult({data:null,error:T});((r=(s=A==null?void 0:A.factors)===null||s===void 0?void 0:s.filter(O=>O.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(v="aal2");const _=f.amr||[];return{data:{currentLevel:m,nextLevel:v,currentAuthenticationMethods:_},error:null}}catch(f){if(P(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=$r(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(n=o.user.factors)===null||n===void 0?void 0:n.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;return n?this._returnResult({data:null,error:n}):r?await U(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Te})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new Te});const o=await U(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Oe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new Te});const o=await U(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Oe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;return r?this._returnResult({data:null,error:r}):s?await U(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:n=>({data:n,error:null})}):this._returnResult({data:null,error:new Te})})}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;return n?this._returnResult({data:null,error:n}):r?(await U(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Te})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let r=s.keys.find(a=>a.kid===e);if(r)return r;const n=Date.now();if(r=this.jwks.keys.find(a=>a.kid===e),r&&this.jwks_cached_at+Np>n)return r;const{data:i,error:o}=await U(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=n,r=i.keys.find(a=>a.kid===e),!r)?null:r}async getClaims(e,s={}){try{let r=e;if(!r){const{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});r=f.session.access_token}const{header:n,payload:i,signature:o,raw:{header:a,payload:l}}=$r(r);s!=null&&s.allowExpired||sg(i.exp);const c=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:n,signature:o},error:null}}const u=rg(n.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,qp(`${a}.${l}`)))throw new bi("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(e){var s,r,n;Qe(this.experimental);try{if(!tn())return this._returnResult({data:null,error:new et("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=va(i.options),l=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:wi.createNewAbortSignal(),{data:c,error:u}=await vc({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new et("WebAuthn ceremony failed",null)});const h=ba(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(P(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var s,r;Qe(this.experimental);try{if(!tn())return this._returnResult({data:null,error:new et("Browser does not support WebAuthn",null)});const{data:n,error:i}=await this._startPasskeyRegistration();if(i||!n)return this._returnResult({data:null,error:i});const o=ya(n.options),a=(r=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&r!==void 0?r:wi.createNewAbortSignal(),{data:l,error:c}=await yc({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new et("WebAuthn ceremony failed",null)});const u=_a(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(n){if(P(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyRegistration(){Qe(this.experimental);try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Te});const{data:n,error:i}=await U(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:s.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})})}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){Qe(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{data:i,error:o}=await U(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(e){var s;Qe(this.experimental);try{const{data:r,error:n}=await U(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:r,error:null})}catch(r){if(P(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(e){Qe(this.experimental);try{const{data:s,error:r}=await U(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Je});return r?this._returnResult({data:null,error:r}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){Qe(this.experimental);try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Te});const{data:n,error:i}=await U(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})})}catch(e){if(P(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){Qe(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{data:i,error:o}=await U(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(e){Qe(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{error:i}=await U(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(s){if(P(s))return this._returnResult({data:null,error:s});throw s}}}mr.nextInstanceID={};const Rg=mr,Og="2.105.4";let Ws="";typeof Deno<"u"?Ws="deno":typeof document<"u"?Ws="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ws="react-native":Ws="node";const xg={"X-Client-Info":`supabase-js-${Ws}/${Og}`},Cg={headers:xg},Pg={schema:"public"},Ig={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},jg={};function yr(t){"@babel/helpers - typeof";return yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yr(t)}function Ng(t,e){if(yr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(yr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $g(t){var e=Ng(t,"string");return yr(e)=="symbol"?e:e+""}function Lg(t,e,s){return(e=$g(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Sa(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function ye(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(s),!0).forEach(function(r){Lg(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Sa(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const Ug=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Dg=()=>Headers,Bg=(t,e,s)=>{const r=Ug(s),n=Dg();return async(i,o)=>{var a;const l=(a=await e())!==null&&a!==void 0?a:t;let c=new n(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,ye(ye({},o),{},{headers:c}))}};function Mg(t){return t.endsWith("/")?t:t+"/"}function Hg(t,e){var s,r;const{db:n,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:u,global:h}=e,d={db:ye(ye({},l),n),auth:ye(ye({},c),i),realtime:ye(ye({},u),o),storage:{},global:ye(ye(ye({},h),a),{},{headers:ye(ye({},(s=h==null?void 0:h.headers)!==null&&s!==void 0?s:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function Fg(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Mg(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var qg=class extends Rg{constructor(t){super(t)}},Vg=class{constructor(t,e,s){var r,n;this.supabaseUrl=t,this.supabaseKey=e;const i=Fg(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Pg,realtime:jg,auth:ye(ye({},Ig),{},{storageKey:o}),global:Cg},l=Hg(s??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(n=l.global.headers)!==null&&n!==void 0?n:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=Bg(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(ye({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new mf(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new xp(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new of(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(s=r.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:n,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,m){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new qg({url:this.authUrl.href,headers:ye(ye({},v),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:n,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:m,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(A=>A.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Qf(this.realtimeUrl.href,ye(ye({},t),{},{params:ye(ye({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Kg=(t,e,s)=>new Vg(t,e,s);function Wg(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const s=e.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}Wg()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");let Lr=null,Ur=null;async function _c(){return Ur||(Ur=await(await fetch("/api/auth/config")).json(),Ur)}async function Wn(){if(Lr)return Lr;const t=await _c();return!t.authEnabled||!t.supabaseUrl||!t.supabaseAnonKey?null:(Lr=Kg(t.supabaseUrl,t.supabaseAnonKey),Lr)}const kr=Ul("auth",()=>{const t=ue(null),e=ue(null),s=ue(!1),r=ue(!1),n=ue(!1);async function i(){var d;const c=await _c();if(n.value=c.authEnabled,!c.authEnabled){r.value=!0;return}const u=await Wn();if(!u){r.value=!0;return}const{data:h}=await u.auth.getSession();e.value=h.session,t.value=((d=h.session)==null?void 0:d.user)??null,u.auth.onAuthStateChange((f,m)=>{e.value=m,t.value=(m==null?void 0:m.user)??null}),r.value=!0}async function o(c,u){const h=await Wn();if(!h)return"Auth not configured";s.value=!0;try{const{error:d}=await h.auth.signInWithPassword({email:c,password:u});return d?d.message:null}finally{s.value=!1}}async function a(){const c=await Wn();c&&await c.auth.signOut(),t.value=null,e.value=null}function l(){var c;return((c=e.value)==null?void 0:c.access_token)??null}return{user:t,session:e,loading:s,initialized:r,authEnabled:n,init:i,signIn:o,signOut:a,getAccessToken:l}}),Gg={key:0,class:"w-64 bg-gray-900 border-r border-gray-800 flex flex-col"},Jg={class:"flex-1 py-6"},zg={class:"space-y-2 px-3"},Yg={key:0,class:"p-4 border-t border-gray-800"},Xg={class:"text-xs text-gray-500 truncate mb-2"},Qg=$t({__name:"AppNav",setup(t){const e=tf(),s=Xl(),r=kr();async function n(){await r.signOut(),s.push("/login")}return(i,o)=>ae(e).name!=="login"?(X(),Q("nav",Gg,[o[4]||(o[4]=I("div",{class:"p-6 border-b border-gray-800"},[I("h1",{class:"text-xl font-bold text-blue-400"},"IO"),I("p",{class:"text-xs text-gray-500"},"Terminal Assistant")],-1)),I("div",Jg,[I("ul",zg,[I("li",null,[ke(ae(Vs),{to:"/chat",class:tt(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ae(e).name==="chat"}])},{default:Hs(()=>[...o[0]||(o[0]=[Ss(" 💬 Chat ",-1)])]),_:1},8,["class"])]),I("li",null,[ke(ae(Vs),{to:"/skills",class:tt(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ae(e).name==="skills"}])},{default:Hs(()=>[...o[1]||(o[1]=[Ss(" ⚙️ Skills ",-1)])]),_:1},8,["class"])]),I("li",null,[ke(ae(Vs),{to:"/squads",class:tt(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ae(e).name==="squads"}])},{default:Hs(()=>[...o[2]||(o[2]=[Ss(" 👥 Squads ",-1)])]),_:1},8,["class"])]),I("li",null,[ke(ae(Vs),{to:"/activity",class:tt(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ae(e).name==="activity"}])},{default:Hs(()=>[...o[3]||(o[3]=[Ss(" 📊 Activity ",-1)])]),_:1},8,["class"])])])]),ae(r).authEnabled&&ae(r).user?(X(),Q("div",Yg,[I("p",Xg,le(ae(r).user.email),1),I("button",{onClick:n,class:"w-full px-3 py-1.5 text-sm text-gray-400 hover:text-white hover:bg-gray-800 rounded transition-colors"}," Sign out ")])):nt("",!0)])):nt("",!0)}}),Zg={class:"flex h-screen bg-gray-950"},em={class:"flex-1 overflow-auto"},tm=$t({__name:"App",setup(t){return(e,s)=>(X(),Q("div",Zg,[ke(Qg),I("main",em,[ke(ae(Yl))])]))}}),sm=Ul("chat",()=>{const t=ue([]),e=ue(!1);function s(i){t.value.push(i)}function r(i){const o=t.value[t.value.length-1];o&&o.role==="assistant"&&(o.content+=i)}function n(i){const o=t.value[t.value.length-1];o&&o.role==="assistant"&&(o.streaming=i)}return{messages:t,isLoading:e,addMessage:s,appendToLast:r,setLastStreaming:n}});async function vr(t,e){const s=kr(),r=s.getAccessToken(),n=new Headers(e==null?void 0:e.headers);r&&n.set("Authorization",`Bearer ${r}`);const i=await fetch(t,{...e,headers:n});return i.status===401&&s.authEnabled&&await s.signOut(),i}function rm(t){const s=kr().getAccessToken();if(!s)return t;const r=t.includes("?")?"&":"?";return`${t}${r}token=${encodeURIComponent(s)}`}const nm={class:"flex flex-col h-full"},im={key:0,class:"text-gray-600 text-sm text-center mt-12"},om={key:0,class:"inline-block w-2 h-4 bg-blue-400 ml-1 animate-pulse"},am={key:1,class:"flex justify-start"},lm={class:"border-t border-gray-800 p-4"},cm=["disabled"],um=["disabled"],hm=$t({__name:"ChatView",setup(t){const e=sm(),s=ue(""),r=ue(null),n=qe(()=>e.messages.some(a=>a.streaming));function i(){dn(()=>{r.value&&(r.value.scrollTop=r.value.scrollHeight)})}Os(()=>e.messages.length,i);async function o(){const a=s.value.trim();if(!a||e.isLoading)return;s.value="",e.isLoading=!0,e.addMessage({id:crypto.randomUUID(),role:"user",content:a}),e.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),i();const l=new EventSource(rm("/api/events"));l.onmessage=c=>{try{const u=JSON.parse(c.data);u.type==="delta"?(e.appendToLast(u.text),i()):u.type==="done"&&(e.setLastStreaming(!1),e.isLoading=!1,l.close(),i())}catch{}},l.onerror=()=>{e.setLastStreaming(!1),e.isLoading=!1,l.close()};try{await vr("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a})})}catch{e.appendToLast(`
65
+ Issued At: ${i.toISOString()}`;if(n&&(S+=`
66
+ Expiration Time: ${n.toISOString()}`),a&&(S+=`
67
+ Not Before: ${a.toISOString()}`),l&&(S+=`
68
+ Request ID: ${l}`),c){let w=`
69
+ Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);w+=`
70
+ - ${b}`}S+=w}return`${_}
71
+ ${S}`}class we extends Error{constructor({message:e,code:s,cause:r,name:n}){var i;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=n??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=s}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class tn extends we{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function vg({error:t,options:e}){var s,r,n;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new we({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new we({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new we({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new we({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new we({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new we({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new we({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new we({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(mc(o)){if(i.rp.id!==o)return new we({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new we({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new we({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new we({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new we({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function _g({error:t,options:e}){const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new we({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new we({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(mc(r)){if(s.rpId!==r)return new we({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new we({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new we({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new we({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class bg{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const wi=new bg;function ya(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:s,excludeCredentials:r}=t,n=Sn(t,["challenge","user","excludeCredentials"]),i=Cs(e).buffer,o=Object.assign(Object.assign({},s),{id:Cs(s.id).buffer}),a=Object.assign(Object.assign({},n),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Cs(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function va(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:s}=t,r=Sn(t,["challenge","allowCredentials"]),n=Cs(e).buffer,i=Object.assign(Object.assign({},r),{challenge:n});if(s&&s.length>0){i.allowCredentials=new Array(s.length);for(let o=0;o<s.length;o++){const a=s[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Cs(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function _a(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t;return{id:t.id,rawId:t.id,response:{attestationObject:ss(new Uint8Array(t.response.attestationObject)),clientDataJSON:ss(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function ba(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const s=t,r=t.getClientExtensionResults(),n=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:ss(new Uint8Array(n.authenticatorData)),clientDataJSON:ss(new Uint8Array(n.clientDataJSON)),signature:ss(new Uint8Array(n.signature)),userHandle:n.userHandle?ss(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function mc(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function sn(){var t,e;return!!(xe()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function yc(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new tn("Browser returned unexpected credential type",e)}:{data:null,error:new tn("Empty credential response",e)}}catch(e){return{data:null,error:vg({error:e,options:t})}}}async function vc(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new tn("Browser returned unexpected credential type",e)}:{data:null,error:new tn("Empty credential response",e)}}catch(e){return{data:null,error:_g({error:e,options:t})}}}const wg={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Sg={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function rn(...t){const e=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),s=n=>n instanceof ArrayBuffer||ArrayBuffer.isView(n),r={};for(const n of t)if(n)for(const i in n){const o=n[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(s(o))r[i]=o;else if(e(o)){const a=r[i];e(a)?r[i]=rn(a,o):r[i]=rn(o)}else r[i]=o}return r}function Eg(t,e){return rn(wg,t,e||{})}function kg(t,e){return rn(Sg,t,e||{})}class Tg{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:s,friendlyName:r,signal:n},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:s});if(!a)return{data:null,error:l};const c=n??wi.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,m=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${m}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Eg(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await yc({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=kg(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await vc(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new st("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:s,webauthn:r}){return this.client.mfa.verify({factorId:s,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!s)return{data:null,error:new yr("rpId is required for WebAuthn authentication")};try{if(!sn())return{data:null,error:new st("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:s,rpOrigins:r},signal:n},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:s,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new st("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:n}={}},i){if(!s)return{data:null,error:new yr("rpId is required for WebAuthn registration")};try{if(!sn())return{data:null,error:new st("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:s,rpOrigins:r},signal:n},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:s,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return I(o)?{data:null,error:o}:{data:null,error:new st("Unexpected error in register",o)}}}}pg();const Ag={url:Cp,storageKey:Pp,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Ip,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function wa(t,e,s){return await s()}const ps={};class vr{get jwks(){var e,s;return(s=(e=ps[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){ps[this.storageKey]=Object.assign(Object.assign({},ps[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=ps[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){ps[this.storageKey]=Object.assign(Object.assign({},ps[this.storageKey]),{cachedAt:e})}constructor(e){var s,r,n,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=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;const o=Object.assign(Object.assign({},Ag),e);if(this.storageKey=o.storageKey,this.instanceID=(s=vr.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,vr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&xe()){const a=`${this._logPrefix()} 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.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new dg({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=fc(o.fetch),this.lock=o.lock||wa,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&xe()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=fg:this.lock=wa,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),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),webauthn:new Tg(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:dc()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ga(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=ga(this.memoryStorage)),xe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${cc}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let s={},r="none";if(xe()&&(s=Wp(window.location.href),this._isImplicitGrantCallback(s)?r="implicit":await this._isPKCECallback(s)&&(r="pkce")),xe()&&this.detectSessionInUrl&&r!=="none"){const{data:n,error:i}=await this._getSessionFromURL(s,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),Up(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=n;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return I(s)?this._returnResult({error:s}):this._returnResult({error:new st("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,r,n;try{const i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.captchaToken}},xform:Ye}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var s,r,n;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,m=null;this.flowType==="pkce"&&([f,m]=await fs(this.storage,this.storageKey)),i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(s=d==null?void 0:d.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:m},xform:Ye})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await U(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},channel:(n=d==null?void 0:d.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:Ye})}else throw new Nr("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Re(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let s;if("email"in e){const{email:i,password:o,options:a}=e;s=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:fa})}else if("phone"in e){const{phone:i,password:o,options:a}=e;s=await U(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:fa})}else throw new Nr("You must provide either an email or phone number and a password");const{data:r,error:n}=s;if(n)return this._returnResult({data:{user:null,session:null},error:n});if(!r||!r.session||!r.user){const i=new ds;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:n})}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(e){var s,r,n,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(s=e.options)===null||s===void 0?void 0:s.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.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(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:s}=e;switch(s){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(e){var s,r,n,i,o,a,l,c,u,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{const{chain:y,wallet:_,statement:S,options:w}=e;let b;if(xe())if(typeof _=="object")b=_;else{const K=window;if("ethereum"in K&&typeof K.ethereum=="object"&&"request"in K.ethereum&&typeof K.ethereum.request=="function")b=K.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof _!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=_}const x=new URL((s=w==null?void 0:w.url)!==null&&s!==void 0?s:window.location.href),M=await b.request({method:"eth_requestAccounts"}).then(K=>K).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!M||M.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const z=gc(M[0]);let V=(r=w==null?void 0:w.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!V){const K=await b.request({method:"eth_chainId"});V=gg(K)}const Q={domain:x.host,address:z,statement:S,uri:x.href,version:"1",chainId:V,nonce:(n=w==null?void 0:w.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(o=(i=w==null?void 0:w.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=w==null?void 0:w.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=w==null?void 0:w.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=w==null?void 0:w.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=w==null?void 0:w.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=yg(Q),m=await b.request({method:"personal_sign",params:[mg(f),z]})}try{const{data:y,error:_}=await U(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:Ye});if(_)throw _;if(!y||!y.session||!y.user){const S=new ds;return this._returnResult({data:{user:null,session:null},error:S})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:_})}catch(y){if(I(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var s,r,n,i,o,a,l,c,u,h,d,f;let m,y;if("message"in e)m=e.message,y=e.signature;else{const{chain:_,wallet:S,statement:w,options:b}=e;let x;if(xe())if(typeof S=="object")x=S;else{const z=window;if("solana"in z&&typeof z.solana=="object"&&("signIn"in z.solana&&typeof z.solana.signIn=="function"||"signMessage"in z.solana&&typeof z.solana.signMessage=="function"))x=z.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=S}const M=new URL((s=b==null?void 0:b.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in x&&x.signIn){const z=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:M.host,uri:M.href}),w?{statement:w}:null));let V;if(Array.isArray(z)&&z[0]&&typeof z[0]=="object")V=z[0];else if(z&&typeof z=="object"&&"signedMessage"in z&&"signature"in z)V=z;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in V&&"signature"in V&&(typeof V.signedMessage=="string"||V.signedMessage instanceof Uint8Array)&&V.signature instanceof Uint8Array)m=typeof V.signedMessage=="string"?V.signedMessage:new TextDecoder().decode(V.signedMessage),y=V.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${M.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),...w?["",w,""]:[""],"Version: 1",`URI: ${M.href}`,`Issued At: ${(n=(r=b==null?void 0:b.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(V=>`- ${V}`)]:[]].join(`
72
+ `);const z=await x.signMessage(new TextEncoder().encode(m),"utf8");if(!z||!(z instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=z}}try{const{data:_,error:S}=await U(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:ss(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Ye});if(S)throw S;if(!_||!_.session||!_.user){const w=new ds;return this._returnResult({data:{user:null,session:null},error:w})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign({},_),error:S})}catch(_){if(I(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async _exchangeCodeForSession(e){const s=await Qt(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Dp;const{data:i,error:o}=await U(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:Ye});if(await Re(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new ds;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(n==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:n??null}),error:o})}catch(i){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:s,provider:r,token:n,access_token:i,nonce:o}=e,a=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:n,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:Ye}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new ds;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(e){var s,r,n,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await fs(this.storage,this.storageKey));const{error:h}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await U(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new Nr("You must provide either an email or phone number.")}catch(a){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var s,r;try{let n,i;"options"in e&&(n=(s=e.options)===null||s===void 0?void 0:s.redirectTo,i=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await U(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:Ye});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(n){if(I(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithSSO(e){var s,r,n,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await fs(this.storage,this.storageKey));const c=await U(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:(r=(s=e.options)===null||s===void 0?void 0:s.redirectTo)!==null&&r!==void 0?r:void 0}),!((n=e==null?void 0:e.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:cg});return!((i=c.data)===null||i===void 0)&&i.url&&xe()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)throw r;if(!s)throw new Te;const{error:n}=await U(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:n})})}catch(e){if(I(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const s=`${this.url}/resend`;if("email"in e){const{email:r,type:n,options:i}=e,{error:o}=await U(this.fetch,"POST",s,{headers:this.headers,body:{email:r,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:r,type:n,options:i}=e,{data:o,error:a}=await U(this.fetch,"POST",s,{headers:this.headers,body:{phone:r,type:n,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new Nr("You must provide either an email or phone number and a type")}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async s=>s))}async _acquireLock(e,s){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await r,await s()))();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 r=s();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await r}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 s=await this.__loadSession();return await e(s)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const s=await Qt(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?e=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<Fn:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await Qt(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Vn()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=ig(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:n},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(e){try{return e?await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:Kt}):await this._useSession(async s=>{var r,n,i;const{data:o,error:a}=s;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Te}:await U(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(n=o.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0,xform:Kt})})}catch(s){if(I(s))return jr(s)&&(await this._removeSession(),await Re(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(e,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,s))}async _updateUser(e,s={}){try{return await this._useSession(async r=>{const{data:n,error:i}=r;if(i)throw i;if(!n.session)throw new Te;const o=n.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await fs(this.storage,this.storageKey));const{data:c,error:u}=await U(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:Kt});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Te;const s=Date.now()/1e3;let r=s,n=!0,i=null;const{payload:o}=Lr(e.access_token);if(o.exp&&(r=o.exp,n=r<=s),n){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-s,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(s){if(I(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async s=>{var r;if(!e){const{data:o,error:a}=s;if(a)throw a;e=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Te;const{data:n,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):n?this._returnResult({data:{user:n.user,session:n},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(I(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){var r;try{if(!xe())throw new $r("No browser detected.");if(e.error||e.error_description||e.error_code)throw new $r(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new oa("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new $r("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new oa("No code detected.");const{data:b,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const M=new URL(window.location.href);return M.searchParams.delete("code"),window.history.replaceState(window.history.state,"",M.toString()),{data:{session:b.session,redirectType:(r=b.redirectType)!==null&&r!==void 0?r:null},error:null}}const{provider_token:n,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new $r("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const m=f-h;m*1e3<=bs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${d}s`);const y=f-d;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,f,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,f,h);const{data:_,error:S}=await this._getUser(o);if(S)throw S;const w={provider_token:n,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:_.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:w,redirectType:e.type},error:null})}catch(n){if(I(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const s=await Qt(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&s)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async s=>{var r;const{data:n,error:i}=s;if(i&&!jr(i))return this._returnResult({error:i});const o=(r=n.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(Lp(a)&&(a.status===404||a.status===401||a.status===403)||jr(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await Re(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=Kp(),r={id:s,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",s),this.stateChangeEmitters.delete(s)}};return this._debug("#onAuthStateChange()","registered callback with id",s),this.stateChangeEmitters.set(s,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async s=>{var r,n;try{const{data:{session:i},error:o}=s;if(o)throw o;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.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),jr(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,s={}){let r=null,n=null;this.flowType==="pkce"&&([r,n]=await fs(this.storage,this.storageKey,!0));try{return await U(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:n,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(i){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:s,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=s.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var s;try{const{data:r,error:n}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await U(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return xe()&&!(!((s=e.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(I(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async s=>{var r;try{const{error:n,data:{session:i}}=s;if(n)throw n;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await U(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Ye}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new ds}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(n){if(await Re(this.storage,`${this.storageKey}-code-verifier`),I(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}})}async unlinkIdentity(e){try{return await this._useSession(async s=>{var r,n;const{data:i,error:o}=s;if(o)throw o;return await U(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(n=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:void 0})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(e){const s=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{const r=Date.now();return await zp(async n=>(n>0&&await Jp(200*Math.pow(2,n-1)),this._debug(s,"refreshing attempt",n),await U(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Ye})),(n,i)=>{const o=200*Math.pow(2,n);return i&&qn(i)&&Date.now()+o-r<bs})}catch(r){if(this._debug(s,"error",r),I(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(s,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,s){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",s,"url",r),xe()&&!s.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,s;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const n=await Qt(this.storage,this.storageKey);if(n&&this.userStorage){let o=await Qt(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await ws(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Vn()}else if(n&&!n.user&&!n.user){const o=await Qt(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await Re(this.storage,this.storageKey+"-user"),await ws(this.storage,this.storageKey,n)):n.user=Vn()}if(this._debug(r,"session from storage",n),!this._isValidSession(n)){this._debug(r,"session is not valid"),n!==null&&await this._removeSession();return}const i=((s=n.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<Fn;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${Fn}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),qn(o)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(n.user&&n.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(n.access_token);!a&&(o!=null&&o.user)?(n.user=o.user,await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",n)}catch(n){this._debug(r,"error",n),console.error(n);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var s,r;if(!e)throw new Te;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Tn;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Te;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(n,"error",i),I(i)){const o={data:null,error:i};return qn(i)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(e,s,r=!0){const n=`#_notifyAllSubscribers(${e})`;this._debug(n,"begin",s,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:s});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,s)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(n,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Re(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},e),r=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&s.user&&await ws(this.userStorage,this.storageKey+"-user",{user:s.user});const n=Object.assign({},s);delete n.user;const i=ha(n);await ws(this.storage,this.storageKey,i)}else{const n=ha(s);await ws(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Re(this.storage,this.storageKey),await Re(this.storage,this.storageKey+"-code-verifier"),await Re(this.storage,this.storageKey+"-user"),this.userStorage&&await Re(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&xe()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),bs);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const s=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=s,s&&typeof s=="object"&&typeof s.unref=="function"?s.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(s)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const s=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,s&&clearTimeout(s)}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 s=>{const{data:{session:r}}=s;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const n=Math.floor((r.expires_at*1e3-e)/bs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${bs}ms, refresh threshold is ${yi} ticks`),n<=yi&&await this._callRefreshToken(r.refresh_token)})}catch(s){console.error("Auto refresh tick failed with error. This is likely a transient error.",s)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof pc)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!xe()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const s=`#_onVisibilityChanged(${e})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(s,"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,s,r){const n=[`provider=${encodeURIComponent(s)}`];if(r!=null&&r.redirectTo&&n.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&n.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await fs(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});n.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);n.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&n.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${n.join("&")}`}async _unenroll(e){try{return await this._useSession(async s=>{var r;const{data:n,error:i}=s;return i?this._returnResult({data:null,error:i}):await U(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(e){try{return await this._useSession(async s=>{var r,n;const{data:i,error:o}=s;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await U(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((n=l==null?void 0:l.totp)===null||n===void 0)&&n.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:n,error:i}=s;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?_a(e.webauthn.credential_response):ba(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await U(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var r;const{data:n,error:i}=s;if(i)return this._returnResult({data:null,error:i});const o=await U(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=n==null?void 0:n.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:ya(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:va(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(e){const{data:s,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:s.id,code:e.code})}async _listFactors(){var e;const{data:{user:s},error:r}=await this.getUser();if(r)return{data:null,error:r};const n={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=s==null?void 0:s.factors)!==null&&e!==void 0?e:[])n.all.push(i),i.status==="verified"&&n[i.factor_type].push(i);return{data:n,error:null}}async _getAuthenticatorAssuranceLevel(e){var s,r,n,i;if(e)try{const{payload:f}=Lr(e);let m=null;f.aal&&(m=f.aal);let y=m;const{data:{user:_},error:S}=await this.getUser(e);if(S)return this._returnResult({data:null,error:S});((r=(s=_==null?void 0:_.factors)===null||s===void 0?void 0:s.filter(x=>x.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(y="aal2");const b=f.amr||[];return{data:{currentLevel:m,nextLevel:y,currentAuthenticationMethods:b},error:null}}catch(f){if(I(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=Lr(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(n=o.user.factors)===null||n===void 0?void 0:n.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;return n?this._returnResult({data:null,error:n}):r?await U(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Te})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new Te});const o=await U(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&xe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,s){try{return await this._useSession(async r=>{const{data:{session:n},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!n)return this._returnResult({data:null,error:new Te});const o=await U(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:n.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&xe()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;return r?this._returnResult({data:null,error:r}):s?await U(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:n=>({data:n,error:null})}):this._returnResult({data:null,error:new Te})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;return n?this._returnResult({data:null,error:n}):r?(await U(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Te})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(e,s={keys:[]}){let r=s.keys.find(a=>a.kid===e);if(r)return r;const n=Date.now();if(r=this.jwks.keys.find(a=>a.kid===e),r&&this.jwks_cached_at+Np>n)return r;const{data:i,error:o}=await U(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=n,r=i.keys.find(a=>a.kid===e),!r)?null:r}async getClaims(e,s={}){try{let r=e;if(!r){const{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});r=f.session.access_token}const{header:n,payload:i,signature:o,raw:{header:a,payload:l}}=Lr(r);s!=null&&s.allowExpired||sg(i.exp);const c=!n.alg||n.alg.startsWith("HS")||!n.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(n.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:n,signature:o},error:null}}const u=rg(n.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,qp(`${a}.${l}`)))throw new bi("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(e){var s,r,n;et(this.experimental);try{if(!sn())return this._returnResult({data:null,error:new st("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=va(i.options),l=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:wi.createNewAbortSignal(),{data:c,error:u}=await vc({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new st("WebAuthn ceremony failed",null)});const h=ba(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(I(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var s,r;et(this.experimental);try{if(!sn())return this._returnResult({data:null,error:new st("Browser does not support WebAuthn",null)});const{data:n,error:i}=await this._startPasskeyRegistration();if(i||!n)return this._returnResult({data:null,error:i});const o=ya(n.options),a=(r=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&r!==void 0?r:wi.createNewAbortSignal(),{data:l,error:c}=await yc({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new st("WebAuthn ceremony failed",null)});const u=_a(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyRegistration(){et(this.experimental);try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Te});const{data:n,error:i}=await U(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:s.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){et(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{data:i,error:o}=await U(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(e){var s;et(this.experimental);try{const{data:r,error:n}=await U(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:r,error:null})}catch(r){if(I(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(e){et(this.experimental);try{const{data:s,error:r}=await U(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:Ye});return r?this._returnResult({data:null,error:r}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){et(this.experimental);try{return await this._useSession(async e=>{const{data:{session:s},error:r}=e;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Te});const{data:n,error:i}=await U(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:n,error:null})})}catch(e){if(I(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){et(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{data:i,error:o}=await U(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(e){et(this.experimental);try{return await this._useSession(async s=>{const{data:{session:r},error:n}=s;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Te});const{error:i}=await U(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}}vr.nextInstanceID={};const Rg=vr,xg="2.105.4";let Gs="";typeof Deno<"u"?Gs="deno":typeof document<"u"?Gs="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Gs="react-native":Gs="node";const Og={"X-Client-Info":`supabase-js-${Gs}/${xg}`},Cg={headers:Og},Pg={schema:"public"},Ig={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},jg={};function _r(t){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_r(t)}function Ng(t,e){if(_r(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(_r(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $g(t){var e=Ng(t,"string");return _r(e)=="symbol"?e:e+""}function Lg(t,e,s){return(e=$g(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Sa(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,r)}return s}function ye(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(s),!0).forEach(function(r){Lg(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Sa(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const Ug=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Dg=()=>Headers,Bg=(t,e,s)=>{const r=Ug(s),n=Dg();return async(i,o)=>{var a;const l=(a=await e())!==null&&a!==void 0?a:t;let c=new n(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,ye(ye({},o),{},{headers:c}))}};function Mg(t){return t.endsWith("/")?t:t+"/"}function Hg(t,e){var s,r;const{db:n,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:u,global:h}=e,d={db:ye(ye({},l),n),auth:ye(ye({},c),i),realtime:ye(ye({},u),o),storage:{},global:ye(ye(ye({},h),a),{},{headers:ye(ye({},(s=h==null?void 0:h.headers)!==null&&s!==void 0?s:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function Fg(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Mg(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var qg=class extends Rg{constructor(t){super(t)}},Vg=class{constructor(t,e,s){var r,n;this.supabaseUrl=t,this.supabaseKey=e;const i=Fg(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Pg,realtime:jg,auth:ye(ye({},Ig),{},{storageKey:o}),global:Cg},l=Hg(s??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(n=l.global.headers)!==null&&n!==void 0?n:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=Bg(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(ye({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new mf(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new Op(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new of(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,s)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,s;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(s=r.session)===null||s===void 0?void 0:s.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:n,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,m){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new qg({url:this.authUrl.href,headers:ye(ye({},y),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:s,storage:r,userStorage:n,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:m,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(_=>_.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Qf(this.realtimeUrl.href,ye(ye({},t),{},{params:ye(ye({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Kg=(t,e,s)=>new Vg(t,e,s);function Wg(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const s=e.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}Wg()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");let Ur=null,Dr=null;async function _c(){return Dr||(Dr=await(await fetch("/api/auth/config")).json(),Dr)}async function Wn(){if(Ur)return Ur;const t=await _c();return!t.authEnabled||!t.supabaseUrl||!t.supabaseAnonKey?null:(Ur=Kg(t.supabaseUrl,t.supabaseAnonKey),Ur)}const Tr=Ul("auth",()=>{const t=ae(null),e=ae(null),s=ae(!1),r=ae(!1),n=ae(!1);async function i(){var d;const c=await _c();if(n.value=c.authEnabled,!c.authEnabled){r.value=!0;return}const u=await Wn();if(!u){r.value=!0;return}const{data:h}=await u.auth.getSession();e.value=h.session,t.value=((d=h.session)==null?void 0:d.user)??null,u.auth.onAuthStateChange((f,m)=>{e.value=m,t.value=(m==null?void 0:m.user)??null}),r.value=!0}async function o(c,u){const h=await Wn();if(!h)return"Auth not configured";s.value=!0;try{const{error:d}=await h.auth.signInWithPassword({email:c,password:u});return d?d.message:null}finally{s.value=!1}}async function a(){const c=await Wn();c&&await c.auth.signOut(),t.value=null,e.value=null}function l(){var c;return((c=e.value)==null?void 0:c.access_token)??null}return{user:t,session:e,loading:s,initialized:r,authEnabled:n,init:i,signIn:o,signOut:a,getAccessToken:l}}),Gg={key:0,class:"w-64 bg-gray-900 border-r border-gray-800 flex flex-col"},Jg={class:"flex-1 py-6"},zg={class:"space-y-2 px-3"},Yg={key:0,class:"p-4 border-t border-gray-800"},Xg={class:"text-xs text-gray-500 truncate mb-2"},Qg=$t({__name:"AppNav",setup(t){const e=tf(),s=Xl(),r=Tr();async function n(){await r.signOut(),s.push("/login")}return(i,o)=>ce(e).name!=="login"?(G(),J("nav",Gg,[o[4]||(o[4]=O("div",{class:"p-6 border-b border-gray-800"},[O("h1",{class:"text-xl font-bold text-blue-400"},"IO"),O("p",{class:"text-xs text-gray-500"},"Terminal Assistant")],-1)),O("div",Jg,[O("ul",zg,[O("li",null,[ke(ce(Ks),{to:"/chat",class:We(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ce(e).name==="chat"}])},{default:Fs(()=>[...o[0]||(o[0]=[Ss(" 💬 Chat ",-1)])]),_:1},8,["class"])]),O("li",null,[ke(ce(Ks),{to:"/skills",class:We(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ce(e).name==="skills"}])},{default:Fs(()=>[...o[1]||(o[1]=[Ss(" ⚙️ Skills ",-1)])]),_:1},8,["class"])]),O("li",null,[ke(ce(Ks),{to:"/squads",class:We(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ce(e).name==="squads"}])},{default:Fs(()=>[...o[2]||(o[2]=[Ss(" 👥 Squads ",-1)])]),_:1},8,["class"])]),O("li",null,[ke(ce(Ks),{to:"/activity",class:We(["block px-4 py-2 rounded hover:bg-gray-800 transition-colors",{"bg-blue-900 text-blue-300":ce(e).name==="activity"}])},{default:Fs(()=>[...o[3]||(o[3]=[Ss(" 📊 Activity ",-1)])]),_:1},8,["class"])])])]),ce(r).authEnabled&&ce(r).user?(G(),J("div",Yg,[O("p",Xg,ee(ce(r).user.email),1),O("button",{onClick:n,class:"w-full px-3 py-1.5 text-sm text-gray-400 hover:text-white hover:bg-gray-800 rounded transition-colors"}," Sign out ")])):He("",!0)])):He("",!0)}}),Zg={class:"flex h-screen bg-gray-950"},em={class:"flex-1 overflow-auto"},tm=$t({__name:"App",setup(t){return(e,s)=>(G(),J("div",Zg,[ke(Qg),O("main",em,[ke(ce(Yl))])]))}}),sm=Ul("chat",()=>{const t=ae([]),e=ae(!1);function s(i){t.value.push(i)}function r(i){const o=t.value[t.value.length-1];o&&o.role==="assistant"&&(o.content+=i)}function n(i){const o=t.value[t.value.length-1];o&&o.role==="assistant"&&(o.streaming=i)}return{messages:t,isLoading:e,addMessage:s,appendToLast:r,setLastStreaming:n}});async function Ps(t,e){const s=Tr(),r=s.getAccessToken(),n=new Headers(e==null?void 0:e.headers);r&&n.set("Authorization",`Bearer ${r}`);const i=await fetch(t,{...e,headers:n});return i.status===401&&s.authEnabled&&await s.signOut(),i}function rm(t){const s=Tr().getAccessToken();if(!s)return t;const r=t.includes("?")?"&":"?";return`${t}${r}token=${encodeURIComponent(s)}`}const nm={class:"flex flex-col h-full"},im={key:0,class:"text-gray-600 text-sm text-center mt-12"},om={key:0,class:"inline-block w-2 h-4 bg-blue-400 ml-1 animate-pulse"},am={key:1,class:"flex justify-start"},lm={class:"border-t border-gray-800 p-4"},cm=["disabled"],um=["disabled"],hm=$t({__name:"ChatView",setup(t){const e=sm(),s=ae(""),r=ae(null),n=Ve(()=>e.messages.some(a=>a.streaming));function i(){fn(()=>{r.value&&(r.value.scrollTop=r.value.scrollHeight)})}xs(()=>e.messages.length,i);async function o(){const a=s.value.trim();if(!a||e.isLoading)return;s.value="",e.isLoading=!0,e.addMessage({id:crypto.randomUUID(),role:"user",content:a}),e.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),i();const l=new EventSource(rm("/api/events"));l.onmessage=c=>{try{const u=JSON.parse(c.data);u.type==="delta"?(e.appendToLast(u.text),i()):u.type==="done"&&(e.setLastStreaming(!1),e.isLoading=!1,l.close(),i())}catch{}},l.onerror=()=>{e.setLastStreaming(!1),e.isLoading=!1,l.close()};try{await Ps("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a})})}catch{e.appendToLast(`
73
73
 
74
- [Error: failed to reach IO]`),e.setLastStreaming(!1),e.isLoading=!1,l.close()}}return(a,l)=>(X(),Q("div",nm,[I("div",{ref_key:"messagesEl",ref:r,class:"flex-1 overflow-y-auto p-6 space-y-4"},[ae(e).messages.length===0?(X(),Q("div",im," Send a message to start chatting with IO ")):nt("",!0),(X(!0),Q(Fe,null,gn(ae(e).messages,c=>(X(),Q("div",{key:c.id,class:tt(["flex",c.role==="user"?"justify-end":"justify-start"])},[I("div",{class:tt(["max-w-[75%] px-4 py-3 rounded-lg text-sm whitespace-pre-wrap",c.role==="user"?"bg-blue-700 text-white":"bg-gray-800 text-gray-100 border border-gray-700"])},[I("span",null,le(c.content),1),c.streaming?(X(),Q("span",om)):nt("",!0)],2)],2))),128)),ae(e).isLoading&&!n.value?(X(),Q("div",am,[...l[1]||(l[1]=[I("div",{class:"bg-gray-800 border border-gray-700 px-4 py-3 rounded-lg text-sm text-gray-400 flex gap-1"},[I("span",{class:"animate-bounce",style:{"animation-delay":"0ms"}},"·"),I("span",{class:"animate-bounce",style:{"animation-delay":"150ms"}},"·"),I("span",{class:"animate-bounce",style:{"animation-delay":"300ms"}},"·")],-1)])])):nt("",!0)],512),I("div",lm,[I("form",{onSubmit:Mi(o,["prevent"]),class:"flex gap-3"},[Rs(I("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>s.value=c),type:"text",placeholder:"Message IO...",disabled:ae(e).isLoading,class:"flex-1 bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500 disabled:opacity-50"},null,8,cm),[[xs,s.value]]),I("button",{type:"submit",disabled:ae(e).isLoading||!s.value.trim(),class:"bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg text-sm transition-colors"}," Send ",8,um)],32)])]))}}),dm={class:"flex flex-col h-full bg-gray-950"},fm={class:"flex-1 overflow-y-auto p-6"},pm={key:0,class:"text-gray-400 text-center py-12"},gm={key:1,class:"bg-red-900 text-red-100 p-4 rounded-lg mb-4"},mm={key:2,class:"text-gray-400 text-center py-12"},ym={key:3,class:"grid gap-4"},vm={class:"flex justify-between items-start mb-2"},_m={class:"font-bold text-gray-100"},bm={class:"text-sm text-gray-500"},wm={class:"text-sm text-gray-400 mb-3"},Sm={class:"text-xs text-gray-500"},Em=$t({__name:"SkillsView",setup(t){const e=ue([]),s=ue(!0),r=ue(null);return pn(async()=>{try{const n=await vr("/api/skills");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=await n.json();e.value=i.skills}catch(n){r.value=n instanceof Error?n.message:"Failed to load skills"}finally{s.value=!1}}),(n,i)=>(X(),Q("div",dm,[I("div",fm,[i[0]||(i[0]=I("h2",{class:"text-2xl font-bold mb-6"},"Skills",-1)),s.value?(X(),Q("div",pm," Loading skills... ")):r.value?(X(),Q("div",gm,le(r.value),1)):e.value.length===0?(X(),Q("div",mm," No skills available ")):(X(),Q("div",ym,[(X(!0),Q(Fe,null,gn(e.value,o=>(X(),Q("div",{key:o.slug,class:"bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-blue-500 transition-colors"},[I("div",vm,[I("div",null,[I("h3",_m,le(o.name),1),I("p",bm,le(o.slug),1)])]),I("p",wm,le(o.description),1),I("p",Sm,le(o.path),1)]))),128))]))])]))}}),km={class:"flex flex-col h-full bg-gray-950"},Tm={class:"flex-1 overflow-y-auto p-6"},Am={class:"flex justify-between items-center mb-6"},Rm={class:"space-y-3"},Om=["disabled"],xm={key:0,class:"mt-2 text-red-400 text-sm"},Cm={key:1,class:"text-gray-400 text-center py-12"},Pm={key:2,class:"bg-red-900 text-red-100 p-4 rounded-lg mb-4"},Im={key:3,class:"text-gray-400 text-center py-12"},jm={key:4,class:"grid gap-4"},Nm={class:"flex justify-between items-start mb-3"},$m={class:"flex-1"},Lm={class:"font-bold text-gray-100"},Um={class:"text-sm text-gray-500"},Dm={class:"text-sm text-gray-400 mb-2"},Bm={class:"flex justify-between items-center text-xs text-gray-500"},Mm={key:0},Hm=$t({__name:"SquadsView",setup(t){const e=ue([]),s=ue(!0),r=ue(null),n=ue(!1),i=ue(!1),o=ue(null),a=ue({slug:"",name:"",projectPath:""}),l=h=>new Date(h).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),c=async()=>{try{const h=await vr("/api/squads");if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const d=await h.json();e.value=d.squads}catch(h){r.value=h instanceof Error?h.message:"Failed to load squads"}finally{s.value=!1}},u=async()=>{if(!a.value.slug||!a.value.name||!a.value.projectPath){o.value="All fields are required";return}i.value=!0,o.value=null;try{const h=await vr("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:a.value.slug,name:a.value.name,projectPath:a.value.projectPath})});if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);a.value={slug:"",name:"",projectPath:""},n.value=!1,await c()}catch(h){o.value=h instanceof Error?h.message:"Failed to create squad"}finally{i.value=!1}};return pn(()=>{c()}),(h,d)=>(X(),Q("div",km,[I("div",Tm,[I("div",Am,[d[4]||(d[4]=I("h2",{class:"text-2xl font-bold"},"Squads & Dashboard",-1)),I("button",{onClick:d[0]||(d[0]=f=>n.value=!n.value),class:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm transition-colors"},le(n.value?"Cancel":"New Squad"),1)]),n.value?(X(),Q("form",{key:0,onSubmit:Mi(u,["prevent"]),class:"bg-gray-800 border border-gray-700 rounded-lg p-4 mb-6"},[d[5]||(d[5]=I("h3",{class:"font-bold text-gray-100 mb-4"},"Create New Squad",-1)),I("div",Rm,[Rs(I("input",{"onUpdate:modelValue":d[1]||(d[1]=f=>a.value.slug=f),type:"text",placeholder:"Squad slug (e.g., frontend-team)",class:"w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"},null,512),[[xs,a.value.slug]]),Rs(I("input",{"onUpdate:modelValue":d[2]||(d[2]=f=>a.value.name=f),type:"text",placeholder:"Squad name (e.g., Frontend Team)",class:"w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"},null,512),[[xs,a.value.name]]),Rs(I("input",{"onUpdate:modelValue":d[3]||(d[3]=f=>a.value.projectPath=f),type:"text",placeholder:"Project path (e.g., /path/to/project)",class:"w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"},null,512),[[xs,a.value.projectPath]]),I("button",{type:"submit",disabled:i.value||!a.value.slug||!a.value.name||!a.value.projectPath,class:"w-full bg-green-600 hover:bg-green-700 disabled:bg-gray-700 text-white px-4 py-2 rounded text-sm transition-colors"},le(i.value?"Creating...":"Create Squad"),9,Om)]),o.value?(X(),Q("div",xm,le(o.value),1)):nt("",!0)],32)):nt("",!0),s.value?(X(),Q("div",Cm," Loading squads... ")):r.value?(X(),Q("div",Pm,le(r.value),1)):e.value.length===0?(X(),Q("div",Im," No squads created yet ")):(X(),Q("div",jm,[(X(!0),Q(Fe,null,gn(e.value,f=>(X(),Q("div",{key:f.id,class:"bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-blue-500 transition-colors"},[I("div",Nm,[I("div",$m,[I("h3",Lm,le(f.name),1),I("p",Um,le(f.slug),1)]),I("span",{class:tt(["px-2 py-1 rounded text-xs font-medium",f.status==="active"?"bg-green-900 text-green-100":f.status==="error"?"bg-red-900 text-red-100":"bg-gray-700 text-gray-200"])},le(f.status),3)]),I("p",Dm,"📁 "+le(f.project_path),1),I("div",Bm,[f.model?(X(),Q("span",Mm,"Model: "+le(f.model),1)):nt("",!0),I("span",null,le(l(f.created_at)),1)])]))),128))]))])]))}}),Fm={class:"flex flex-col h-full bg-gray-950"},qm={class:"flex-1 overflow-y-auto p-6"},Vm={class:"flex justify-between items-center mb-6"},Km=["disabled"],Wm={key:0,class:"text-gray-400 text-center py-12"},Gm={key:1,class:"bg-red-900 text-red-100 p-4 rounded-lg mb-4"},Jm={key:2,class:"text-gray-400 text-center py-12"},zm={key:3,class:"grid gap-4"},Ym={class:"flex justify-between items-start mb-3"},Xm={class:"flex-1"},Qm={class:"font-bold text-gray-100"},Zm={class:"text-sm text-gray-500"},ey={key:0,class:"inline-block w-2 h-2 bg-blue-400 rounded-full mr-1 animate-pulse"},ty={key:0,class:"bg-gray-700 rounded p-3 mb-2"},sy={class:"text-sm text-gray-100 break-words"},ry={class:"text-xs text-gray-500"},ny=$t({__name:"AgentActivityView",setup(t){const e=ue([]),s=ue(!0),r=ue(null);let n=null;const i=a=>a.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),o=async()=>{s.value=!0,r.value=null;try{const a=await vr("/api/agents");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();e.value=l.agents}catch(a){r.value=a instanceof Error?a.message:"Failed to load agents"}finally{s.value=!1}};return pn(()=>{o(),n=setInterval(o,5e3)}),Li(()=>{n&&clearInterval(n)}),(a,l)=>(X(),Q("div",Fm,[I("div",qm,[I("div",Vm,[l[0]||(l[0]=I("h2",{class:"text-2xl font-bold"},"Agent Activity",-1)),I("button",{onClick:o,disabled:s.value,class:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white px-4 py-2 rounded-lg text-sm transition-colors"},le(s.value?"Refreshing...":"Refresh"),9,Km)]),s.value&&e.value.length===0?(X(),Q("div",Wm," Loading agents... ")):r.value?(X(),Q("div",Gm,le(r.value),1)):e.value.length===0?(X(),Q("div",Jm," No active agents ")):(X(),Q("div",zm,[(X(!0),Q(Fe,null,gn(e.value,c=>(X(),Q("div",{key:c.slug,class:"bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-blue-500 transition-colors"},[I("div",Ym,[I("div",Xm,[I("h3",Qm,le(c.name),1),I("p",Zm,le(c.slug),1)]),I("span",{class:tt(["px-3 py-1 rounded text-xs font-medium",c.status==="working"?"bg-blue-900 text-blue-100":c.status==="error"?"bg-red-900 text-red-100":"bg-green-900 text-green-100"])},[c.status==="working"?(X(),Q("span",ey)):nt("",!0),Ss(" "+le(c.status==="working"?"Working":c.status==="error"?"Error":"Idle"),1)],2)]),c.currentTask?(X(),Q("div",ty,[l[1]||(l[1]=I("p",{class:"text-xs text-gray-400 mb-1"},"Current Task:",-1)),I("p",sy,le(c.currentTask),1)])):nt("",!0),I("div",ry," Last updated: "+le(i(new Date)),1)]))),128))]))])]))}}),iy={class:"flex items-center justify-center h-screen bg-gray-950"},oy={class:"w-full max-w-sm p-8 bg-gray-900 rounded-xl border border-gray-800"},ay={key:0,class:"text-red-400 text-sm"},ly=["disabled"],cy=$t({__name:"LoginView",setup(t){const e=kr(),s=Xl(),r=ue(""),n=ue(""),i=ue(null);async function o(){i.value=null;const a=await e.signIn(r.value,n.value);a?i.value=a:s.push("/chat")}return(a,l)=>(X(),Q("div",iy,[I("div",oy,[l[4]||(l[4]=I("h1",{class:"text-2xl font-bold text-white text-center mb-2"},"IO",-1)),l[5]||(l[5]=I("p",{class:"text-gray-400 text-sm text-center mb-8"},"Sign in to continue",-1)),I("form",{onSubmit:Mi(o,["prevent"]),class:"space-y-4"},[I("div",null,[l[2]||(l[2]=I("label",{for:"email",class:"block text-sm font-medium text-gray-300 mb-1"},"Email",-1)),Rs(I("input",{id:"email","onUpdate:modelValue":l[0]||(l[0]=c=>r.value=c),type:"email",required:"",autocomplete:"email",class:"w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent",placeholder:"you@example.com"},null,512),[[xs,r.value]])]),I("div",null,[l[3]||(l[3]=I("label",{for:"password",class:"block text-sm font-medium text-gray-300 mb-1"},"Password",-1)),Rs(I("input",{id:"password","onUpdate:modelValue":l[1]||(l[1]=c=>n.value=c),type:"password",required:"",autocomplete:"current-password",class:"w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent",placeholder:"••••••••"},null,512),[[xs,n.value]])]),i.value?(X(),Q("div",ay,le(i.value),1)):nt("",!0),I("button",{type:"submit",disabled:ae(e).loading,class:"w-full py-2 px-4 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors"},le(ae(e).loading?"Signing in...":"Sign in"),9,ly)],32)])]))}}),bc=ef({history:Nd("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:cy,meta:{public:!0}},{path:"/chat",name:"chat",component:hm},{path:"/skills",name:"skills",component:Em},{path:"/squads",name:"squads",component:Hm},{path:"/activity",name:"activity",component:ny}]});bc.beforeEach(async t=>{const e=kr();return e.initialized||await e.init(),!e.authEnabled||t.meta.public||e.user?!0:{name:"login"}});const Ki=Fh(tm);Ki.use(Kh());Ki.use(bc);Ki.mount("#app");
74
+ [Error: failed to reach IO]`),e.setLastStreaming(!1),e.isLoading=!1,l.close()}}return(a,l)=>(G(),J("div",nm,[O("div",{ref_key:"messagesEl",ref:r,class:"flex-1 overflow-y-auto p-6 space-y-4"},[ce(e).messages.length===0?(G(),J("div",im," Send a message to start chatting with IO ")):He("",!0),(G(!0),J(Me,null,cr(ce(e).messages,c=>(G(),J("div",{key:c.id,class:We(["flex",c.role==="user"?"justify-end":"justify-start"])},[O("div",{class:We(["max-w-[75%] px-4 py-3 rounded-lg text-sm whitespace-pre-wrap",c.role==="user"?"bg-blue-700 text-white":"bg-gray-800 text-gray-100 border border-gray-700"])},[O("span",null,ee(c.content),1),c.streaming?(G(),J("span",om)):He("",!0)],2)],2))),128)),ce(e).isLoading&&!n.value?(G(),J("div",am,[...l[1]||(l[1]=[O("div",{class:"bg-gray-800 border border-gray-700 px-4 py-3 rounded-lg text-sm text-gray-400 flex gap-1"},[O("span",{class:"animate-bounce",style:{"animation-delay":"0ms"}},"·"),O("span",{class:"animate-bounce",style:{"animation-delay":"150ms"}},"·"),O("span",{class:"animate-bounce",style:{"animation-delay":"300ms"}},"·")],-1)])])):He("",!0)],512),O("div",lm,[O("form",{onSubmit:Mi(o,["prevent"]),class:"flex gap-3"},[Rs(O("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>s.value=c),type:"text",placeholder:"Message IO...",disabled:ce(e).isLoading,class:"flex-1 bg-gray-800 border border-gray-700 rounded-lg px-4 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500 disabled:opacity-50"},null,8,cm),[[Os,s.value]]),O("button",{type:"submit",disabled:ce(e).isLoading||!s.value.trim(),class:"bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg text-sm transition-colors"}," Send ",8,um)],32)])]))}}),dm={class:"flex flex-col h-full bg-gray-950"},fm={class:"flex-1 overflow-y-auto p-6"},pm={key:0,class:"text-gray-400 text-center py-12"},gm={key:1,class:"bg-red-900 text-red-100 p-4 rounded-lg mb-4"},mm={key:2,class:"text-gray-400 text-center py-12"},ym={key:3,class:"grid gap-4"},vm={class:"flex justify-between items-start mb-2"},_m={class:"font-bold text-gray-100"},bm={class:"text-sm text-gray-500"},wm={class:"text-sm text-gray-400 mb-3"},Sm={class:"text-xs text-gray-500"},Em=$t({__name:"SkillsView",setup(t){const e=ae([]),s=ae(!0),r=ae(null);return gn(async()=>{try{const n=await Ps("/api/skills");if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const i=await n.json();e.value=i.skills}catch(n){r.value=n instanceof Error?n.message:"Failed to load skills"}finally{s.value=!1}}),(n,i)=>(G(),J("div",dm,[O("div",fm,[i[0]||(i[0]=O("h2",{class:"text-2xl font-bold mb-6"},"Skills",-1)),s.value?(G(),J("div",pm," Loading skills... ")):r.value?(G(),J("div",gm,ee(r.value),1)):e.value.length===0?(G(),J("div",mm," No skills available ")):(G(),J("div",ym,[(G(!0),J(Me,null,cr(e.value,o=>(G(),J("div",{key:o.slug,class:"bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-blue-500 transition-colors"},[O("div",vm,[O("div",null,[O("h3",_m,ee(o.name),1),O("p",bm,ee(o.slug),1)])]),O("p",wm,ee(o.description),1),O("p",Sm,ee(o.path),1)]))),128))]))])]))}}),km={class:"flex flex-col h-full bg-gray-950"},Tm={class:"flex-1 overflow-y-auto p-6"},Am={class:"flex justify-between items-center mb-6"},Rm={class:"space-y-3"},xm=["disabled"],Om={key:0,class:"mt-2 text-red-400 text-sm"},Cm={key:1,class:"text-gray-400 text-center py-12"},Pm={key:2,class:"bg-red-900 text-red-100 p-4 rounded-lg mb-4"},Im={key:3,class:"text-gray-400 text-center py-12"},jm={key:4,class:"grid gap-4"},Nm={class:"flex justify-between items-start mb-3"},$m={class:"flex-1"},Lm={class:"font-bold text-gray-100"},Um={class:"text-sm text-gray-500"},Dm={class:"flex items-center gap-2"},Bm={key:0,class:"px-2 py-1 rounded text-xs font-medium bg-purple-900 text-purple-100"},Mm={class:"text-sm text-gray-400 mb-2"},Hm={key:0,class:"mt-3 border-t border-gray-700 pt-3"},Fm={class:"grid gap-2"},qm={class:"flex-1 min-w-0"},Vm={class:"text-sm font-medium text-gray-100"},Km={class:"text-xs text-gray-500 ml-2"},Wm={key:1,class:"mt-3 border-t border-gray-700 pt-3"},Gm={class:"flex justify-between items-center text-xs text-gray-500 mt-3"},Jm={key:0},zm=$t({__name:"SquadsView",setup(t){const e={"a-team":"The A-Team",transformers:"Transformers",thundercats:"ThunderCats","gi-joe":"G.I. Joe",aliens:"Aliens",ghostbusters:"Ghostbusters"},s=ae([]),r=ae({}),n=ae(!0),i=ae(null),o=ae(!1),a=ae(!1),l=ae(null),c=ae({slug:"",name:"",projectPath:""}),u=m=>m?e[m]??m:"",h=m=>new Date(m).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),d=async()=>{try{const m=await Ps("/api/squads");if(!m.ok)throw new Error(`HTTP error! status: ${m.status}`);const y=await m.json();s.value=y.squads;for(const _ of y.squads)try{const S=await Ps(`/api/squads/${_.slug}/agents`);if(S.ok){const w=await S.json();r.value[_.slug]=w.agents}}catch{}}catch(m){i.value=m instanceof Error?m.message:"Failed to load squads"}finally{n.value=!1}},f=async()=>{if(!c.value.slug||!c.value.name||!c.value.projectPath){l.value="All fields are required";return}a.value=!0,l.value=null;try{const m=await Ps("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:c.value.slug,name:c.value.name,projectPath:c.value.projectPath})});if(!m.ok)throw new Error(`HTTP error! status: ${m.status}`);c.value={slug:"",name:"",projectPath:""},o.value=!1,await d()}catch(m){l.value=m instanceof Error?m.message:"Failed to create squad"}finally{a.value=!1}};return gn(()=>{d()}),(m,y)=>(G(),J("div",km,[O("div",Tm,[O("div",Am,[y[4]||(y[4]=O("h2",{class:"text-2xl font-bold"},"Squads & Dashboard",-1)),O("button",{onClick:y[0]||(y[0]=_=>o.value=!o.value),class:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm transition-colors"},ee(o.value?"Cancel":"New Squad"),1)]),o.value?(G(),J("form",{key:0,onSubmit:Mi(f,["prevent"]),class:"bg-gray-800 border border-gray-700 rounded-lg p-4 mb-6"},[y[5]||(y[5]=O("h3",{class:"font-bold text-gray-100 mb-4"},"Create New Squad",-1)),O("div",Rm,[Rs(O("input",{"onUpdate:modelValue":y[1]||(y[1]=_=>c.value.slug=_),type:"text",placeholder:"Squad slug (e.g., frontend-team)",class:"w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"},null,512),[[Os,c.value.slug]]),Rs(O("input",{"onUpdate:modelValue":y[2]||(y[2]=_=>c.value.name=_),type:"text",placeholder:"Squad name (e.g., Frontend Team)",class:"w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"},null,512),[[Os,c.value.name]]),Rs(O("input",{"onUpdate:modelValue":y[3]||(y[3]=_=>c.value.projectPath=_),type:"text",placeholder:"Project path (e.g., /path/to/project)",class:"w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500"},null,512),[[Os,c.value.projectPath]]),O("button",{type:"submit",disabled:a.value||!c.value.slug||!c.value.name||!c.value.projectPath,class:"w-full bg-green-600 hover:bg-green-700 disabled:bg-gray-700 text-white px-4 py-2 rounded text-sm transition-colors"},ee(a.value?"Creating...":"Create Squad"),9,xm)]),l.value?(G(),J("div",Om,ee(l.value),1)):He("",!0)],32)):He("",!0),n.value?(G(),J("div",Cm," Loading squads... ")):i.value?(G(),J("div",Pm,ee(i.value),1)):s.value.length===0?(G(),J("div",Im," No squads created yet ")):(G(),J("div",jm,[(G(!0),J(Me,null,cr(s.value,_=>(G(),J("div",{key:_.id,class:"bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-blue-500 transition-colors"},[O("div",Nm,[O("div",$m,[O("h3",Lm,ee(_.name),1),O("p",Um,ee(_.slug),1)]),O("div",Dm,[_.universe?(G(),J("span",Bm," 🎬 "+ee(u(_.universe)),1)):He("",!0),O("span",{class:We(["px-2 py-1 rounded text-xs font-medium",_.status==="working"?"bg-blue-900 text-blue-100":_.status==="error"?"bg-red-900 text-red-100":"bg-gray-700 text-gray-200"])},ee(_.status),3)])]),O("p",Mm,"📁 "+ee(_.project_path),1),r.value[_.slug]&&r.value[_.slug].length>0?(G(),J("div",Hm,[y[6]||(y[6]=O("p",{class:"text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2"},"Team Roster",-1)),O("div",Fm,[(G(!0),J(Me,null,cr(r.value[_.slug],S=>(G(),J("div",{key:S.character_name,class:We(["flex items-center gap-3 bg-gray-750 rounded px-3 py-2",S.status==="working"?"bg-blue-950 border border-blue-800":"bg-gray-900"])},[O("div",qm,[O("span",Vm,ee(S.character_name),1),O("span",Km,ee(S.role_title),1)]),O("span",{class:We(["px-2 py-0.5 rounded text-xs",S.status==="working"?"bg-blue-800 text-blue-200":S.status==="error"?"bg-red-800 text-red-200":"bg-gray-700 text-gray-400"])},ee(S.status),3)],2))),128))])])):(G(),J("div",Wm,[...y[7]||(y[7]=[O("p",{class:"text-xs text-gray-500 italic"},"No agents assigned yet",-1)])])),O("div",Gm,[_.model?(G(),J("span",Jm,"Model: "+ee(_.model),1)):He("",!0),O("span",null,ee(h(_.created_at)),1)])]))),128))]))])]))}}),Ym={class:"flex flex-col h-full bg-gray-950"},Xm={class:"flex-1 overflow-y-auto p-6"},Qm={class:"flex justify-between items-center mb-6"},Zm=["disabled"],ey={key:0,class:"text-gray-400 text-center py-12"},ty={key:1,class:"bg-red-900 text-red-100 p-4 rounded-lg mb-4"},sy={key:2,class:"text-gray-400 text-center py-12"},ry={key:3,class:"grid gap-4"},ny={class:"flex justify-between items-start mb-3"},iy={class:"flex-1"},oy={class:"font-bold text-gray-100"},ay={class:"flex items-center gap-2 mt-1"},ly={class:"text-sm text-gray-500"},cy={key:0,class:"text-xs bg-gray-700 text-gray-300 px-2 py-0.5 rounded"},uy={key:1,class:"text-xs bg-purple-900 text-purple-200 px-2 py-0.5 rounded"},hy={key:0,class:"inline-block w-2 h-2 bg-blue-400 rounded-full mr-1 animate-pulse"},dy={key:0,class:"bg-gray-700 rounded p-3 mb-2"},fy={class:"text-sm text-gray-100 break-words"},py={class:"text-xs text-gray-500"},gy=$t({__name:"AgentActivityView",setup(t){const e=ae([]),s=ae(!0),r=ae(null);let n=null;const i=a=>a.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),o=async()=>{s.value=!0,r.value=null;try{const a=await Ps("/api/agents");if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);const l=await a.json();e.value=l.agents}catch(a){r.value=a instanceof Error?a.message:"Failed to load agents"}finally{s.value=!1}};return gn(()=>{o(),n=setInterval(o,5e3)}),Li(()=>{n&&clearInterval(n)}),(a,l)=>(G(),J("div",Ym,[O("div",Xm,[O("div",Qm,[l[0]||(l[0]=O("h2",{class:"text-2xl font-bold"},"Agent Activity",-1)),O("button",{onClick:o,disabled:s.value,class:"bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white px-4 py-2 rounded-lg text-sm transition-colors"},ee(s.value?"Refreshing...":"Refresh"),9,Zm)]),s.value&&e.value.length===0?(G(),J("div",ey," Loading agents... ")):r.value?(G(),J("div",ty,ee(r.value),1)):e.value.length===0?(G(),J("div",sy," No active agents ")):(G(),J("div",ry,[(G(!0),J(Me,null,cr(e.value,c=>(G(),J("div",{key:c.slug+(c.characterName||""),class:"bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-blue-500 transition-colors"},[O("div",ny,[O("div",iy,[O("h3",oy,ee(c.name),1),O("div",ay,[O("p",ly,ee(c.slug),1),c.roleTitle?(G(),J("span",cy,ee(c.roleTitle),1)):He("",!0),c.universe?(G(),J("span",uy," 🎬 "+ee(c.universe),1)):He("",!0)])]),O("span",{class:We(["px-3 py-1 rounded text-xs font-medium",c.status==="working"?"bg-blue-900 text-blue-100":c.status==="error"?"bg-red-900 text-red-100":"bg-green-900 text-green-100"])},[c.status==="working"?(G(),J("span",hy)):He("",!0),Ss(" "+ee(c.status==="working"?"Working":c.status==="error"?"Error":"Idle"),1)],2)]),c.currentTask?(G(),J("div",dy,[l[1]||(l[1]=O("p",{class:"text-xs text-gray-400 mb-1"},"Current Task:",-1)),O("p",fy,ee(c.currentTask),1)])):He("",!0),O("div",py," Last updated: "+ee(i(new Date)),1)]))),128))]))])]))}}),my={class:"flex items-center justify-center h-screen bg-gray-950"},yy={class:"w-full max-w-sm p-8 bg-gray-900 rounded-xl border border-gray-800"},vy={key:0,class:"text-red-400 text-sm"},_y=["disabled"],by=$t({__name:"LoginView",setup(t){const e=Tr(),s=Xl(),r=ae(""),n=ae(""),i=ae(null);async function o(){i.value=null;const a=await e.signIn(r.value,n.value);a?i.value=a:s.push("/chat")}return(a,l)=>(G(),J("div",my,[O("div",yy,[l[4]||(l[4]=O("h1",{class:"text-2xl font-bold text-white text-center mb-2"},"IO",-1)),l[5]||(l[5]=O("p",{class:"text-gray-400 text-sm text-center mb-8"},"Sign in to continue",-1)),O("form",{onSubmit:Mi(o,["prevent"]),class:"space-y-4"},[O("div",null,[l[2]||(l[2]=O("label",{for:"email",class:"block text-sm font-medium text-gray-300 mb-1"},"Email",-1)),Rs(O("input",{id:"email","onUpdate:modelValue":l[0]||(l[0]=c=>r.value=c),type:"email",required:"",autocomplete:"email",class:"w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent",placeholder:"you@example.com"},null,512),[[Os,r.value]])]),O("div",null,[l[3]||(l[3]=O("label",{for:"password",class:"block text-sm font-medium text-gray-300 mb-1"},"Password",-1)),Rs(O("input",{id:"password","onUpdate:modelValue":l[1]||(l[1]=c=>n.value=c),type:"password",required:"",autocomplete:"current-password",class:"w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent",placeholder:"••••••••"},null,512),[[Os,n.value]])]),i.value?(G(),J("div",vy,ee(i.value),1)):He("",!0),O("button",{type:"submit",disabled:ce(e).loading,class:"w-full py-2 px-4 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white font-medium rounded-lg transition-colors"},ee(ce(e).loading?"Signing in...":"Sign in"),9,_y)],32)])]))}}),bc=ef({history:Nd("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:by,meta:{public:!0}},{path:"/chat",name:"chat",component:hm},{path:"/skills",name:"skills",component:Em},{path:"/squads",name:"squads",component:zm},{path:"/activity",name:"activity",component:gy}]});bc.beforeEach(async t=>{const e=Tr();return e.initialized||await e.init(),!e.authEnabled||t.meta.public||e.user?!0:{name:"login"}});const Ki=Fh(tm);Ki.use(Kh());Ki.use(bc);Ki.mount("#app");