heyio 0.17.2 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,84 +0,0 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function s(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(n){if(n.ep)return;n.ep=!0;const i=s(n);fetch(n.href,i)}})();/**
2
- * @vue/shared v3.5.34
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/function Gi(t){const e=Object.create(null);for(const s of t.split(","))e[s]=1;return s=>s in e}const Te={},Fs=[],Ut=()=>{},nl=()=>!1,Sn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),En=t=>t.startsWith("onUpdate:"),Fe=Object.assign,zi=(t,e)=>{const s=t.indexOf(e);s>-1&&t.splice(s,1)},hu=Object.prototype.hasOwnProperty,xe=(t,e)=>hu.call(t,e),ne=Array.isArray,Vs=t=>Nr(t)==="[object Map]",Tn=t=>Nr(t)==="[object Set]",_o=t=>Nr(t)==="[object Date]",pe=t=>typeof t=="function",Pe=t=>typeof t=="string",pt=t=>typeof t=="symbol",Se=t=>t!==null&&typeof t=="object",il=t=>(Se(t)||pe(t))&&pe(t.then)&&pe(t.catch),ol=Object.prototype.toString,Nr=t=>ol.call(t),fu=t=>Nr(t).slice(8,-1),al=t=>Nr(t)==="[object Object]",An=t=>Pe(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ar=Gi(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Cn=t=>{const e=Object.create(null);return s=>e[s]||(e[s]=t(s))},pu=/-\w/g,st=Cn(t=>t.replace(pu,e=>e.slice(1).toUpperCase())),gu=/\B([A-Z])/g,As=Cn(t=>t.replace(gu,"-$1").toLowerCase()),Rn=Cn(t=>t.charAt(0).toUpperCase()+t.slice(1)),Yn=Cn(t=>t?`on${Rn(t)}`:""),Lt=(t,e)=>!Object.is(t,e),tn=(t,...e)=>{for(let s=0;s<t.length;s++)t[s](...e)},ll=(t,e,s,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:s})},Ji=t=>{const e=parseFloat(t);return isNaN(e)?t:e},mu=t=>{const e=Pe(t)?Number(t):NaN;return isNaN(e)?t:e};let wo;const On=()=>wo||(wo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Yi(t){if(ne(t)){const e={};for(let s=0;s<t.length;s++){const r=t[s],n=Pe(r)?_u(r):Yi(r);if(n)for(const i in n)e[i]=n[i]}return e}else if(Pe(t)||Se(t))return t}const vu=/;(?![^(]*\))/g,bu=/:([^]+)/,yu=/\/\*[^]*?\*\//g;function _u(t){const e={};return t.replace(yu,"").split(vu).forEach(s=>{if(s){const r=s.split(bu);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function fe(t){let e="";if(Pe(t))e=t;else if(ne(t))for(let s=0;s<t.length;s++){const r=fe(t[s]);r&&(e+=r+" ")}else if(Se(t))for(const s in t)t[s]&&(e+=s+" ");return e.trim()}const wu="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",xu=Gi(wu);function cl(t){return!!t||t===""}function ku(t,e){if(t.length!==e.length)return!1;let s=!0;for(let r=0;s&&r<t.length;r++)s=Lr(t[r],e[r]);return s}function Lr(t,e){if(t===e)return!0;let s=_o(t),r=_o(e);if(s||r)return s&&r?t.getTime()===e.getTime():!1;if(s=pt(t),r=pt(e),s||r)return t===e;if(s=ne(t),r=ne(e),s||r)return s&&r?ku(t,e):!1;if(s=Se(t),r=Se(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||!Lr(t[o],e[o]))return!1}}return String(t)===String(e)}function ul(t,e){return t.findIndex(s=>Lr(s,e))}const dl=t=>!!(t&&t.__v_isRef===!0),R=t=>Pe(t)?t:t==null?"":ne(t)||Se(t)&&(t.toString===ol||!pe(t.toString))?dl(t)?R(t.value):JSON.stringify(t,hl,2):String(t),hl=(t,e)=>dl(e)?hl(t,e.value):Vs(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((s,[r,n],i)=>(s[Xn(r,i)+" =>"]=n,s),{})}:Tn(e)?{[`Set(${e.size})`]:[...e.values()].map(s=>Xn(s))}:pt(e)?Xn(e):Se(e)&&!ne(e)&&!al(e)?String(e):e,Xn=(t,e="")=>{var s;return pt(t)?`Symbol(${(s=t.description)!=null?s:e})`:t};/**
6
- * @vue/reactivity v3.5.34
7
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
- * @license MIT
9
- **/let Be;class fl{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&&Be&&(Be.active?(this.parent=Be,this.index=(Be.scopes||(Be.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=Be;try{return Be=this,e()}finally{Be=s}}}on(){++this._on===1&&(this.prevScope=Be,Be=this)}off(){if(this._on>0&&--this._on===0){if(Be===this)Be=this.prevScope;else{let e=Be;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 pl(t){return new fl(t)}function gl(){return Be}function Su(t,e=!1){Be&&Be.cleanups.push(t)}let Re;const Zn=new WeakSet;class ml{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,Be&&(Be.active?Be.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Zn.has(this)&&(Zn.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||bl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,xo(this),yl(this);const e=Re,s=_t;Re=this,_t=!0;try{return this.fn()}finally{_l(this),Re=e,_t=s,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Qi(e);this.deps=this.depsTail=void 0,xo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Zn.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){vi(this)&&this.run()}get dirty(){return vi(this)}}let vl=0,lr,cr;function bl(t,e=!1){if(t.flags|=8,e){t.next=cr,cr=t;return}t.next=lr,lr=t}function Xi(){vl++}function Zi(){if(--vl>0)return;if(cr){let e=cr;for(cr=void 0;e;){const s=e.next;e.next=void 0,e.flags&=-9,e=s}}let t;for(;lr;){let e=lr;for(lr=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 yl(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function _l(t){let e,s=t.depsTail,r=s;for(;r;){const n=r.prevDep;r.version===-1?(r===s&&(s=n),Qi(r),Eu(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=s}function vi(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(wl(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function wl(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===yr)||(t.globalVersion=yr,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!vi(t))))return;t.flags|=2;const e=t.dep,s=Re,r=_t;Re=t,_t=!0;try{yl(t);const n=t.fn(t._value);(e.version===0||Lt(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{Re=s,_t=r,_l(t),t.flags&=-3}}function Qi(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)Qi(i,!0)}!e&&!--s.sc&&s.map&&s.map.delete(s.key)}function Eu(t){const{prevDep:e,nextDep:s}=t;e&&(e.nextDep=s,t.prevDep=void 0),s&&(s.prevDep=e,t.nextDep=void 0)}let _t=!0;const xl=[];function Xt(){xl.push(_t),_t=!1}function Zt(){const t=xl.pop();_t=t===void 0?!0:t}function xo(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const s=Re;Re=void 0;try{e()}finally{Re=s}}}let yr=0;class Tu{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 eo{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(!Re||!_t||Re===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Re)s=this.activeLink=new Tu(Re,this),Re.deps?(s.prevDep=Re.depsTail,Re.depsTail.nextDep=s,Re.depsTail=s):Re.deps=Re.depsTail=s,kl(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=Re.depsTail,s.nextDep=void 0,Re.depsTail.nextDep=s,Re.depsTail=s,Re.deps===s&&(Re.deps=r)}return s}trigger(e){this.version++,yr++,this.notify(e)}notify(e){Xi();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{Zi()}}}function kl(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)kl(r)}const s=t.dep.subs;s!==t&&(t.prevSub=s,s&&(s.nextSub=t)),t.dep.subs=t}}const ln=new WeakMap,Ss=Symbol(""),bi=Symbol(""),_r=Symbol("");function Je(t,e,s){if(_t&&Re){let r=ln.get(t);r||ln.set(t,r=new Map);let n=r.get(s);n||(r.set(s,n=new eo),n.map=r,n.key=s),n.track()}}function Kt(t,e,s,r,n,i){const o=ln.get(t);if(!o){yr++;return}const a=l=>{l&&l.trigger()};if(Xi(),e==="clear")o.forEach(a);else{const l=ne(t),c=l&&An(s);if(l&&s==="length"){const u=Number(r);o.forEach((d,f)=>{(f==="length"||f===_r||!pt(f)&&f>=u)&&a(d)})}else switch((s!==void 0||o.has(void 0))&&a(o.get(s)),c&&a(o.get(_r)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Ss)),Vs(t)&&a(o.get(bi)));break;case"delete":l||(a(o.get(Ss)),Vs(t)&&a(o.get(bi)));break;case"set":Vs(t)&&a(o.get(Ss));break}}Zi()}function Au(t,e){const s=ln.get(t);return s&&s.get(e)}function Cs(t){const e=ye(t);return e===t?e:(Je(e,"iterate",_r),ut(t)?e:e.map(wt))}function $n(t){return Je(t=ye(t),"iterate",_r),t}function It(t,e){return Qt(t)?Gs(Jt(t)?wt(e):e):wt(e)}const Cu={__proto__:null,[Symbol.iterator](){return Qn(this,Symbol.iterator,t=>It(this,t))},concat(...t){return Cs(this).concat(...t.map(e=>ne(e)?Cs(e):e))},entries(){return Qn(this,"entries",t=>(t[1]=It(this,t[1]),t))},every(t,e){return Dt(this,"every",t,e,void 0,arguments)},filter(t,e){return Dt(this,"filter",t,e,s=>s.map(r=>It(this,r)),arguments)},find(t,e){return Dt(this,"find",t,e,s=>It(this,s),arguments)},findIndex(t,e){return Dt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Dt(this,"findLast",t,e,s=>It(this,s),arguments)},findLastIndex(t,e){return Dt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Dt(this,"forEach",t,e,void 0,arguments)},includes(...t){return ei(this,"includes",t)},indexOf(...t){return ei(this,"indexOf",t)},join(t){return Cs(this).join(t)},lastIndexOf(...t){return ei(this,"lastIndexOf",t)},map(t,e){return Dt(this,"map",t,e,void 0,arguments)},pop(){return Zs(this,"pop")},push(...t){return Zs(this,"push",t)},reduce(t,...e){return ko(this,"reduce",t,e)},reduceRight(t,...e){return ko(this,"reduceRight",t,e)},shift(){return Zs(this,"shift")},some(t,e){return Dt(this,"some",t,e,void 0,arguments)},splice(...t){return Zs(this,"splice",t)},toReversed(){return Cs(this).toReversed()},toSorted(t){return Cs(this).toSorted(t)},toSpliced(...t){return Cs(this).toSpliced(...t)},unshift(...t){return Zs(this,"unshift",t)},values(){return Qn(this,"values",t=>It(this,t))}};function Qn(t,e,s){const r=$n(t),n=r[e]();return r!==t&&!ut(t)&&(n._next=n.next,n.next=()=>{const i=n._next();return i.done||(i.value=s(i.value)),i}),n}const Ru=Array.prototype;function Dt(t,e,s,r,n,i){const o=$n(t),a=o!==t&&!ut(t),l=o[e];if(l!==Ru[e]){const d=l.apply(t,i);return a?wt(d):d}let c=s;o!==t&&(a?c=function(d,f){return s.call(this,It(t,d),f,t)}:s.length>2&&(c=function(d,f){return s.call(this,d,f,t)}));const u=l.call(o,c,r);return a&&n?n(u):u}function ko(t,e,s,r){const n=$n(t),i=n!==t&&!ut(t);let o=s,a=!1;n!==t&&(i?(a=r.length===0,o=function(c,u,d){return a&&(a=!1,c=It(t,c)),s.call(this,c,It(t,u),d,t)}):s.length>3&&(o=function(c,u,d){return s.call(this,c,u,d,t)}));const l=n[e](o,...r);return a?It(t,l):l}function ei(t,e,s){const r=ye(t);Je(r,"iterate",_r);const n=r[e](...s);return(n===-1||n===!1)&&Pn(s[0])?(s[0]=ye(s[0]),r[e](...s)):n}function Zs(t,e,s=[]){Xt(),Xi();const r=ye(t)[e].apply(t,s);return Zi(),Zt(),r}const Ou=Gi("__proto__,__v_isRef,__isVue"),Sl=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(pt));function $u(t){pt(t)||(t=String(t));const e=ye(this);return Je(e,"has",t),e.hasOwnProperty(t)}class El{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?Hu:Rl:i?Cl:Al).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=ne(e);if(!n){let l;if(o&&(l=Cu[s]))return l;if(s==="hasOwnProperty")return $u}const a=Reflect.get(e,s,Ne(e)?e:r);if((pt(s)?Sl.has(s):Ou(s))||(n||Je(e,"get",s),i))return a;if(Ne(a)){const l=o&&An(s)?a:a.value;return n&&Se(l)?_i(l):l}return Se(a)?n?_i(a):zt(a):a}}class Tl extends El{constructor(e=!1){super(!1,e)}set(e,s,r,n){let i=e[s];const o=ne(e)&&An(s);if(!this._isShallow){const c=Qt(i);if(!ut(r)&&!Qt(r)&&(i=ye(i),r=ye(r)),!o&&Ne(i)&&!Ne(r))return c||(i.value=r),!0}const a=o?Number(s)<e.length:xe(e,s),l=Reflect.set(e,s,r,Ne(e)?e:n);return e===ye(n)&&(a?Lt(r,i)&&Kt(e,"set",s,r):Kt(e,"add",s,r)),l}deleteProperty(e,s){const r=xe(e,s);e[s];const n=Reflect.deleteProperty(e,s);return n&&r&&Kt(e,"delete",s,void 0),n}has(e,s){const r=Reflect.has(e,s);return(!pt(s)||!Sl.has(s))&&Je(e,"has",s),r}ownKeys(e){return Je(e,"iterate",ne(e)?"length":Ss),Reflect.ownKeys(e)}}class Pu extends El{constructor(e=!1){super(!0,e)}set(e,s){return!0}deleteProperty(e,s){return!0}}const Iu=new Tl,ju=new Pu,Nu=new Tl(!0);const yi=t=>t,Fr=t=>Reflect.getPrototypeOf(t);function Lu(t,e,s){return function(...r){const n=this.__v_raw,i=ye(n),o=Vs(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...r),u=s?yi:e?Gs:wt;return!e&&Je(i,"iterate",l?bi:Ss),Fe(Object.create(c),{next(){const{value:d,done:f}=c.next();return f?{value:d,done:f}:{value:a?[u(d[0]),u(d[1])]:u(d),done:f}}})}}function Vr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Uu(t,e){const s={get(n){const i=this.__v_raw,o=ye(i),a=ye(n);t||(Lt(n,a)&&Je(o,"get",n),Je(o,"get",a));const{has:l}=Fr(o),c=e?yi:t?Gs:wt;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&&Je(ye(n),"iterate",Ss),n.size},has(n){const i=this.__v_raw,o=ye(i),a=ye(n);return t||(Lt(n,a)&&Je(o,"has",n),Je(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=ye(a),c=e?yi:t?Gs:wt;return!t&&Je(l,"iterate",Ss),a.forEach((u,d)=>n.call(i,c(u),c(d),o))}};return Fe(s,t?{add:Vr("add"),set:Vr("set"),delete:Vr("delete"),clear:Vr("clear")}:{add(n){const i=ye(this),o=Fr(i),a=ye(n),l=!e&&!ut(n)&&!Qt(n)?a:n;return o.has.call(i,l)||Lt(n,l)&&o.has.call(i,n)||Lt(a,l)&&o.has.call(i,a)||(i.add(l),Kt(i,"add",l,l)),this},set(n,i){!e&&!ut(i)&&!Qt(i)&&(i=ye(i));const o=ye(this),{has:a,get:l}=Fr(o);let c=a.call(o,n);c||(n=ye(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,i),c?Lt(i,u)&&Kt(o,"set",n,i):Kt(o,"add",n,i),this},delete(n){const i=ye(this),{has:o,get:a}=Fr(i);let l=o.call(i,n);l||(n=ye(n),l=o.call(i,n)),a&&a.call(i,n);const c=i.delete(n);return l&&Kt(i,"delete",n,void 0),c},clear(){const n=ye(this),i=n.size!==0,o=n.clear();return i&&Kt(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{s[n]=Lu(n,t,e)}),s}function to(t,e){const s=Uu(t,e);return(r,n,i)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(xe(s,n)&&n in r?s:r,n,i)}const Du={get:to(!1,!1)},Mu={get:to(!1,!0)},Bu={get:to(!0,!1)};const Al=new WeakMap,Cl=new WeakMap,Rl=new WeakMap,Hu=new WeakMap;function Fu(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Vu(t){return t.__v_skip||!Object.isExtensible(t)?0:Fu(fu(t))}function zt(t){return Qt(t)?t:so(t,!1,Iu,Du,Al)}function Ol(t){return so(t,!1,Nu,Mu,Cl)}function _i(t){return so(t,!0,ju,Bu,Rl)}function so(t,e,s,r,n){if(!Se(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Vu(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 Jt(t){return Qt(t)?Jt(t.__v_raw):!!(t&&t.__v_isReactive)}function Qt(t){return!!(t&&t.__v_isReadonly)}function ut(t){return!!(t&&t.__v_isShallow)}function Pn(t){return t?!!t.__v_raw:!1}function ye(t){const e=t&&t.__v_raw;return e?ye(e):t}function ro(t){return!xe(t,"__v_skip")&&Object.isExtensible(t)&&ll(t,"__v_skip",!0),t}const wt=t=>Se(t)?zt(t):t,Gs=t=>Se(t)?_i(t):t;function Ne(t){return t?t.__v_isRef===!0:!1}function F(t){return $l(t,!1)}function qu(t){return $l(t,!0)}function $l(t,e){return Ne(t)?t:new Wu(t,e)}class Wu{constructor(e,s){this.dep=new eo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?e:ye(e),this._value=s?e:wt(e),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(e){const s=this._rawValue,r=this.__v_isShallow||ut(e)||Qt(e);e=r?e:ye(e),Lt(e,s)&&(this._rawValue=e,this._value=r?e:wt(e),this.dep.trigger())}}function Oe(t){return Ne(t)?t.value:t}const Ku={get:(t,e,s)=>e==="__v_raw"?t:Oe(Reflect.get(t,e,s)),set:(t,e,s,r)=>{const n=t[e];return Ne(n)&&!Ne(s)?(n.value=s,!0):Reflect.set(t,e,s,r)}};function Pl(t){return Jt(t)?t:new Proxy(t,Ku)}function Gu(t){const e=ne(t)?new Array(t.length):{};for(const s in t)e[s]=Ju(t,s);return e}class zu{constructor(e,s,r){this._object=e,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=pt(s)?s:String(s),this._raw=ye(e);let n=!0,i=e;if(!ne(e)||pt(this._key)||!An(this._key))do n=!Pn(i)||ut(i);while(n&&(i=i.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=Oe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Ne(this._raw[this._key])){const s=this._object[this._key];if(Ne(s)){s.value=e;return}}this._object[this._key]=e}get dep(){return Au(this._raw,this._key)}}function Ju(t,e,s){return new zu(t,e,s)}class Yu{constructor(e,s,r){this.fn=e,this.setter=s,this._value=void 0,this.dep=new eo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=yr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Re!==this)return bl(this,!0),!0}get value(){const e=this.dep.track();return wl(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Xu(t,e,s=!1){let r,n;return pe(t)?r=t:(r=t.get,n=t.set),new Yu(r,n,s)}const qr={},cn=new WeakMap;let bs;function Zu(t,e=!1,s=bs){if(s){let r=cn.get(s);r||cn.set(s,r=[]),r.push(t)}}function Qu(t,e,s=Te){const{immediate:r,deep:n,once:i,scheduler:o,augmentJob:a,call:l}=s,c=L=>n?L:ut(L)||n===!1||n===0?Gt(L,1):Gt(L);let u,d,f,p,m=!1,b=!1;if(Ne(t)?(d=()=>t.value,m=ut(t)):Jt(t)?(d=()=>c(t),m=!0):ne(t)?(b=!0,m=t.some(L=>Jt(L)||ut(L)),d=()=>t.map(L=>{if(Ne(L))return L.value;if(Jt(L))return c(L);if(pe(L))return l?l(L,2):L()})):pe(t)?e?d=l?()=>l(t,2):t:d=()=>{if(f){Xt();try{f()}finally{Zt()}}const L=bs;bs=u;try{return l?l(t,3,[p]):t(p)}finally{bs=L}}:d=Ut,e&&n){const L=d,N=n===!0?1/0:n;d=()=>Gt(L(),N)}const x=gl(),y=()=>{u.stop(),x&&x.active&&zi(x.effects,u)};if(i&&e){const L=e;e=(...N)=>{L(...N),y()}}let k=b?new Array(t.length).fill(qr):qr;const A=L=>{if(!(!(u.flags&1)||!u.dirty&&!L))if(e){const N=u.run();if(n||m||(b?N.some(($,E)=>Lt($,k[E])):Lt(N,k))){f&&f();const $=bs;bs=u;try{const E=[N,k===qr?void 0:b&&k[0]===qr?[]:k,p];k=N,l?l(e,3,E):e(...E)}finally{bs=$}}}else u.run()};return a&&a(A),u=new ml(d),u.scheduler=o?()=>o(A,!1):A,p=L=>Zu(L,!1,u),f=u.onStop=()=>{const L=cn.get(u);if(L){if(l)l(L,4);else for(const N of L)N();cn.delete(u)}},e?r?A(!0):k=u.run():o?o(A.bind(null,!0),!0):u.run(),y.pause=u.pause.bind(u),y.resume=u.resume.bind(u),y.stop=y,y}function Gt(t,e=1/0,s){if(e<=0||!Se(t)||t.__v_skip||(s=s||new Map,(s.get(t)||0)>=e))return t;if(s.set(t,e),e--,Ne(t))Gt(t.value,e,s);else if(ne(t))for(let r=0;r<t.length;r++)Gt(t[r],e,s);else if(Tn(t)||Vs(t))t.forEach(r=>{Gt(r,e,s)});else if(al(t)){for(const r in t)Gt(t[r],e,s);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Gt(t[r],e,s)}return t}/**
10
- * @vue/runtime-core v3.5.34
11
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
- * @license MIT
13
- **/function Ur(t,e,s,r){try{return r?t(...r):t()}catch(n){In(n,e,s)}}function xt(t,e,s,r){if(pe(t)){const n=Ur(t,e,s,r);return n&&il(n)&&n.catch(i=>{In(i,e,s)}),n}if(ne(t)){const n=[];for(let i=0;i<t.length;i++)n.push(xt(t[i],e,s,r));return n}}function In(t,e,s,r=!0){const n=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||Te;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 d=0;d<u.length;d++)if(u[d](t,l,c)===!1)return}a=a.parent}if(i){Xt(),Ur(i,null,10,[t,l,c]),Zt();return}}ed(t,s,n,r,o)}function ed(t,e,s,r=!0,n=!1){if(n)throw t;console.error(t)}const et=[];let Rt=-1;const qs=[];let os=null,Ns=0;const Il=Promise.resolve();let un=null;function Es(t){const e=un||Il;return t?e.then(this?t.bind(this):t):e}function td(t){let e=Rt+1,s=et.length;for(;e<s;){const r=e+s>>>1,n=et[r],i=wr(n);i<t||i===t&&n.flags&2?e=r+1:s=r}return e}function no(t){if(!(t.flags&1)){const e=wr(t),s=et[et.length-1];!s||!(t.flags&2)&&e>=wr(s)?et.push(t):et.splice(td(e),0,t),t.flags|=1,jl()}}function jl(){un||(un=Il.then(Ll))}function sd(t){ne(t)?qs.push(...t):os&&t.id===-1?os.splice(Ns+1,0,t):t.flags&1||(qs.push(t),t.flags|=1),jl()}function So(t,e,s=Rt+1){for(;s<et.length;s++){const r=et[s];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;et.splice(s,1),s--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Nl(t){if(qs.length){const e=[...new Set(qs)].sort((s,r)=>wr(s)-wr(r));if(qs.length=0,os){os.push(...e);return}for(os=e,Ns=0;Ns<os.length;Ns++){const s=os[Ns];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}os=null,Ns=0}}const wr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Ll(t){try{for(Rt=0;Rt<et.length;Rt++){const e=et[Rt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Ur(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Rt<et.length;Rt++){const e=et[Rt];e&&(e.flags&=-2)}Rt=-1,et.length=0,Nl(),un=null,(et.length||qs.length)&&Ll()}}let at=null,Ul=null;function dn(t){const e=at;return at=t,Ul=t&&t.type.__scopeId||null,e}function xr(t,e=at,s){if(!e||t._n)return t;const r=(...n)=>{r._d&&pn(-1);const i=dn(e);let o;try{o=t(...n)}finally{dn(i),r._d&&pn(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function lt(t,e){if(at===null)return t;const s=Bn(at),r=t.dirs||(t.dirs=[]);for(let n=0;n<e.length;n++){let[i,o,a,l=Te]=e[n];i&&(pe(i)&&(i={mounted:i,updated:i}),i.deep&&Gt(o),r.push({dir:i,instance:s,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function hs(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&&(Xt(),xt(l,s,8,[t.el,a,t,e]),Zt())}}function sn(t,e){if(Ye){let s=Ye.provides;const r=Ye.parent&&Ye.parent.provides;r===s&&(s=Ye.provides=Object.create(r)),s[t]=e}}function ft(t,e,s=!1){const r=co();if(r||Ts){let n=Ts?Ts._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&&pe(e)?e.call(r&&r.proxy):e}}function rd(){return!!(co()||Ts)}const nd=Symbol.for("v-scx"),id=()=>ft(nd);function us(t,e,s){return Dl(t,e,s)}function Dl(t,e,s=Te){const{immediate:r,deep:n,flush:i,once:o}=s,a=Fe({},s),l=e&&r||!e&&i!=="post";let c;if(Er){if(i==="sync"){const p=id();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=Ut,p.resume=Ut,p.pause=Ut,p}}const u=Ye;a.call=(p,m,b)=>xt(p,u,m,b);let d=!1;i==="post"?a.scheduler=p=>{nt(p,u&&u.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(p,m)=>{m?p():no(p)}),a.augmentJob=p=>{e&&(p.flags|=4),d&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const f=Qu(t,e,a);return Er&&(c?c.push(f):l&&f()),f}function od(t,e,s){const r=this.proxy,n=Pe(t)?t.includes(".")?Ml(r,t):()=>r[t]:t.bind(r,r);let i;pe(e)?i=e:(i=e.handler,s=e);const o=Dr(this),a=Dl(n,i.bind(r),s);return o(),a}function Ml(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 ad=Symbol("_vte"),Bl=t=>t.__isTeleport,Ot=Symbol("_leaveCb"),Qs=Symbol("_enterCb");function ld(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ts(()=>{t.isMounted=!0}),io(()=>{t.isUnmounting=!0}),t}const dt=[Function,Array],Hl={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:dt,onEnter:dt,onAfterEnter:dt,onEnterCancelled:dt,onBeforeLeave:dt,onLeave:dt,onAfterLeave:dt,onLeaveCancelled:dt,onBeforeAppear:dt,onAppear:dt,onAfterAppear:dt,onAppearCancelled:dt},Fl=t=>{const e=t.subTree;return e.component?Fl(e.component):e},cd={name:"BaseTransition",props:Hl,setup(t,{slots:e}){const s=co(),r=ld();return()=>{const n=e.default&&Wl(e.default(),!0),i=n&&n.length?Vl(n):s.subTree?Y():void 0;if(!i)return;const o=ye(t),{mode:a}=o;if(r.isLeaving)return ti(i);const l=Eo(i);if(!l)return ti(i);let c=wi(l,o,r,s,d=>c=d);l.type!==tt&&kr(l,c);let u=s.subTree&&Eo(s.subTree);if(u&&u.type!==tt&&!_s(u,l)&&Fl(s).type!==tt){let d=wi(u,o,r,s);if(kr(u,d),a==="out-in"&&l.type!==tt)return r.isLeaving=!0,d.afterLeave=()=>{r.isLeaving=!1,s.job.flags&8||s.update(),delete d.afterLeave,u=void 0},ti(i);a==="in-out"&&l.type!==tt?d.delayLeave=(f,p,m)=>{const b=ql(r,u);b[String(u.key)]=u,f[Ot]=()=>{p(),f[Ot]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{m(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function Vl(t){let e=t[0];if(t.length>1){for(const s of t)if(s.type!==tt){e=s;break}}return e}const ud=cd;function ql(t,e){const{leavingVNodes:s}=t;let r=s.get(e.type);return r||(r=Object.create(null),s.set(e.type,r)),r}function wi(t,e,s,r,n){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:p,onAfterLeave:m,onLeaveCancelled:b,onBeforeAppear:x,onAppear:y,onAfterAppear:k,onAppearCancelled:A}=e,L=String(t.key),N=ql(s,t),$=(B,te)=>{B&&xt(B,r,9,te)},E=(B,te)=>{const de=te[1];$(B,te),ne(B)?B.every(V=>V.length<=1)&&de():B.length<=1&&de()},M={mode:o,persisted:a,beforeEnter(B){let te=l;if(!s.isMounted)if(i)te=x||l;else return;B[Ot]&&B[Ot](!0);const de=N[L];de&&_s(t,de)&&de.el[Ot]&&de.el[Ot](),$(te,[B])},enter(B){if(N[L]===t)return;let te=c,de=u,V=d;if(!s.isMounted)if(i)te=y||c,de=k||u,V=A||d;else return;let q=!1;B[Qs]=ce=>{q||(q=!0,ce?$(V,[B]):$(de,[B]),M.delayedLeave&&M.delayedLeave(),B[Qs]=void 0)};const O=B[Qs].bind(null,!1);te?E(te,[B,O]):O()},leave(B,te){const de=String(t.key);if(B[Qs]&&B[Qs](!0),s.isUnmounting)return te();$(f,[B]);let V=!1;B[Ot]=O=>{V||(V=!0,te(),O?$(b,[B]):$(m,[B]),B[Ot]=void 0,N[de]===t&&delete N[de])};const q=B[Ot].bind(null,!1);N[de]=t,p?E(p,[B,q]):q()},clone(B){const te=wi(B,e,s,r,n);return n&&n(te),te}};return M}function ti(t){if(jn(t))return t=ds(t),t.children=null,t}function Eo(t){if(!jn(t))return Bl(t.type)&&t.children?Vl(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:s}=t;if(s){if(e&16)return s[0];if(e&32&&pe(s.default))return s.default()}}function kr(t,e){t.shapeFlag&6&&t.component?(t.transition=e,kr(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 Wl(t,e=!1,s){let r=[],n=0;for(let i=0;i<t.length;i++){let o=t[i];const a=s==null?o.key:String(s)+String(o.key!=null?o.key:i);o.type===be?(o.patchFlag&128&&n++,r=r.concat(Wl(o.children,e,a))):(e||o.type!==tt)&&r.push(a!=null?ds(o,{key:a}):o)}if(n>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function gt(t,e){return pe(t)?Fe({name:t.name},e,{setup:t}):t}function Kl(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function To(t,e){let s;return!!((s=Object.getOwnPropertyDescriptor(t,e))&&!s.configurable)}const hn=new WeakMap;function ur(t,e,s,r,n=!1){if(ne(t)){t.forEach((b,x)=>ur(b,e&&(ne(e)?e[x]:e),s,r,n));return}if(dr(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&ur(t,e,s,r.component.subTree);return}const i=r.shapeFlag&4?Bn(r.component):r.el,o=n?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===Te?a.refs={}:a.refs,d=a.setupState,f=ye(d),p=d===Te?nl:b=>To(u,b)?!1:xe(f,b),m=(b,x)=>!(x&&To(u,x));if(c!=null&&c!==l){if(Ao(e),Pe(c))u[c]=null,p(c)&&(d[c]=null);else if(Ne(c)){const b=e;m(c,b.k)&&(c.value=null),b.k&&(u[b.k]=null)}}if(pe(l))Ur(l,a,12,[o,u]);else{const b=Pe(l),x=Ne(l);if(b||x){const y=()=>{if(t.f){const k=b?p(l)?d[l]:u[l]:m()||!t.k?l.value:u[t.k];if(n)ne(k)&&zi(k,i);else if(ne(k))k.includes(i)||k.push(i);else if(b)u[l]=[i],p(l)&&(d[l]=u[l]);else{const A=[i];m(l,t.k)&&(l.value=A),t.k&&(u[t.k]=A)}}else b?(u[l]=o,p(l)&&(d[l]=o)):x&&(m(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const k=()=>{y(),hn.delete(t)};k.id=-1,hn.set(t,k),nt(k,s)}else Ao(t),y()}}}function Ao(t){const e=hn.get(t);e&&(e.flags|=8,hn.delete(t))}On().requestIdleCallback;On().cancelIdleCallback;const dr=t=>!!t.type.__asyncLoader,jn=t=>t.type.__isKeepAlive;function dd(t,e){Gl(t,"a",e)}function hd(t,e){Gl(t,"da",e)}function Gl(t,e,s=Ye){const r=t.__wdc||(t.__wdc=()=>{let n=s;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(Nn(e,r,s),s){let n=s.parent;for(;n&&n.parent;)jn(n.parent.vnode)&&fd(r,e,s,n),n=n.parent}}function fd(t,e,s,r){const n=Nn(e,t,r,!0);Ln(()=>{zi(r[e],n)},s)}function Nn(t,e,s=Ye,r=!1){if(s){const n=s[t]||(s[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Xt();const a=Dr(s),l=xt(e,s,t,o);return a(),Zt(),l});return r?n.unshift(i):n.push(i),i}}const es=t=>(e,s=Ye)=>{(!Er||t==="sp")&&Nn(t,(...r)=>e(...r),s)},pd=es("bm"),ts=es("m"),gd=es("bu"),md=es("u"),io=es("bum"),Ln=es("um"),vd=es("sp"),bd=es("rtg"),yd=es("rtc");function _d(t,e=Ye){Nn("ec",t,e)}const wd="components",zl=Symbol.for("v-ndc");function xd(t){return Pe(t)?kd(wd,t,!1)||t:t||zl}function kd(t,e,s=!0,r=!1){const n=at||Ye;if(n){const i=n.type;{const a=ah(i,!1);if(a&&(a===e||a===st(e)||a===Rn(st(e))))return i}const o=Co(n[t]||i[t],e)||Co(n.appContext[t],e);return!o&&r?i:o}}function Co(t,e){return t&&(t[e]||t[st(e)]||t[Rn(st(e))])}function qe(t,e,s,r){let n;const i=s,o=ne(t);if(o||Pe(t)){const a=o&&Jt(t);let l=!1,c=!1;a&&(l=!ut(t),c=Qt(t),t=$n(t)),n=new Array(t.length);for(let u=0,d=t.length;u<d;u++)n[u]=e(l?c?Gs(wt(t[u])):wt(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(Se(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 xi=t=>t?gc(t)?Bn(t):xi(t.parent):null,hr=Fe(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=>xi(t.parent),$root:t=>xi(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Yl(t),$forceUpdate:t=>t.f||(t.f=()=>{no(t.update)}),$nextTick:t=>t.n||(t.n=Es.bind(t.proxy)),$watch:t=>od.bind(t)}),si=(t,e)=>t!==Te&&!t.__isScriptSetup&&xe(t,e),Sd={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 f=o[e];if(f!==void 0)switch(f){case 1:return r[e];case 2:return n[e];case 4:return s[e];case 3:return i[e]}else{if(si(r,e))return o[e]=1,r[e];if(n!==Te&&xe(n,e))return o[e]=2,n[e];if(xe(i,e))return o[e]=3,i[e];if(s!==Te&&xe(s,e))return o[e]=4,s[e];ki&&(o[e]=0)}}const c=hr[e];let u,d;if(c)return e==="$attrs"&&Je(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(s!==Te&&xe(s,e))return o[e]=4,s[e];if(d=l.config.globalProperties,xe(d,e))return d[e]},set({_:t},e,s){const{data:r,setupState:n,ctx:i}=t;return si(n,e)?(n[e]=s,!0):r!==Te&&xe(r,e)?(r[e]=s,!0):xe(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!==Te&&a[0]!=="$"&&xe(t,a)||si(e,a)||xe(i,a)||xe(r,a)||xe(hr,a)||xe(n.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,s){return s.get!=null?t._.accessCache[e]=0:xe(s,"value")&&this.set(t,e,s.value,null),Reflect.defineProperty(t,e,s)}};function Ro(t){return ne(t)?t.reduce((e,s)=>(e[s]=null,e),{}):t}let ki=!0;function Ed(t){const e=Yl(t),s=t.proxy,r=t.ctx;ki=!1,e.beforeCreate&&Oo(e.beforeCreate,t,"bc");const{data:n,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:f,beforeUpdate:p,updated:m,activated:b,deactivated:x,beforeDestroy:y,beforeUnmount:k,destroyed:A,unmounted:L,render:N,renderTracked:$,renderTriggered:E,errorCaptured:M,serverPrefetch:B,expose:te,inheritAttrs:de,components:V,directives:q,filters:O}=e;if(c&&Td(c,r,null),o)for(const ie in o){const me=o[ie];pe(me)&&(r[ie]=me.bind(s))}if(n){const ie=n.call(s,s);Se(ie)&&(t.data=zt(ie))}if(ki=!0,i)for(const ie in i){const me=i[ie],We=pe(me)?me.bind(s,s):pe(me.get)?me.get.bind(s,s):Ut,Xe=!pe(me)&&pe(me.set)?me.set.bind(s):Ut,H=$e({get:We,set:Xe});Object.defineProperty(r,ie,{enumerable:!0,configurable:!0,get:()=>H.value,set:T=>H.value=T})}if(a)for(const ie in a)Jl(a[ie],r,s,ie);if(l){const ie=pe(l)?l.call(s):l;Reflect.ownKeys(ie).forEach(me=>{sn(me,ie[me])})}u&&Oo(u,t,"c");function ge(ie,me){ne(me)?me.forEach(We=>ie(We.bind(s))):me&&ie(me.bind(s))}if(ge(pd,d),ge(ts,f),ge(gd,p),ge(md,m),ge(dd,b),ge(hd,x),ge(_d,M),ge(yd,$),ge(bd,E),ge(io,k),ge(Ln,L),ge(vd,B),ne(te))if(te.length){const ie=t.exposed||(t.exposed={});te.forEach(me=>{Object.defineProperty(ie,me,{get:()=>s[me],set:We=>s[me]=We,enumerable:!0})})}else t.exposed||(t.exposed={});N&&t.render===Ut&&(t.render=N),de!=null&&(t.inheritAttrs=de),V&&(t.components=V),q&&(t.directives=q),B&&Kl(t)}function Td(t,e,s=Ut){ne(t)&&(t=Si(t));for(const r in t){const n=t[r];let i;Se(n)?"default"in n?i=ft(n.from||r,n.default,!0):i=ft(n.from||r):i=ft(n),Ne(i)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[r]=i}}function Oo(t,e,s){xt(ne(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,s)}function Jl(t,e,s,r){let n=r.includes(".")?Ml(s,r):()=>s[r];if(Pe(t)){const i=e[t];pe(i)&&us(n,i)}else if(pe(t))us(n,t.bind(s));else if(Se(t))if(ne(t))t.forEach(i=>Jl(i,e,s,r));else{const i=pe(t.handler)?t.handler.bind(s):e[t.handler];pe(i)&&us(n,i,t)}}function Yl(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=>fn(l,c,o,!0)),fn(l,e,o)),Se(e)&&i.set(e,l),l}function fn(t,e,s,r=!1){const{mixins:n,extends:i}=e;i&&fn(t,i,s,!0),n&&n.forEach(o=>fn(t,o,s,!0));for(const o in e)if(!(r&&o==="expose")){const a=Ad[o]||s&&s[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Ad={data:$o,props:Po,emits:Po,methods:rr,computed:rr,beforeCreate:Ze,created:Ze,beforeMount:Ze,mounted:Ze,beforeUpdate:Ze,updated:Ze,beforeDestroy:Ze,beforeUnmount:Ze,destroyed:Ze,unmounted:Ze,activated:Ze,deactivated:Ze,errorCaptured:Ze,serverPrefetch:Ze,components:rr,directives:rr,watch:Rd,provide:$o,inject:Cd};function $o(t,e){return e?t?function(){return Fe(pe(t)?t.call(this,this):t,pe(e)?e.call(this,this):e)}:e:t}function Cd(t,e){return rr(Si(t),Si(e))}function Si(t){if(ne(t)){const e={};for(let s=0;s<t.length;s++)e[t[s]]=t[s];return e}return t}function Ze(t,e){return t?[...new Set([].concat(t,e))]:e}function rr(t,e){return t?Fe(Object.create(null),t,e):e}function Po(t,e){return t?ne(t)&&ne(e)?[...new Set([...t,...e])]:Fe(Object.create(null),Ro(t),Ro(e??{})):e}function Rd(t,e){if(!t)return e;if(!e)return t;const s=Fe(Object.create(null),t);for(const r in e)s[r]=Ze(t[r],e[r]);return s}function Xl(){return{app:null,config:{isNativeTag:nl,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 Od=0;function $d(t,e){return function(r,n=null){pe(r)||(r=Fe({},r)),n!=null&&!Se(n)&&(n=null);const i=Xl(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Od++,_component:r,_props:n,_container:null,_context:i,_instance:null,version:ch,get config(){return i.config},set config(u){},use(u,...d){return o.has(u)||(u&&pe(u.install)?(o.add(u),u.install(c,...d)):pe(u)&&(o.add(u),u(c,...d))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,f){if(!l){const p=c._ceVNode||He(r,n);return p.appContext=i,f===!0?f="svg":f===!1&&(f=void 0),t(p,u,f),l=!0,c._container=u,u.__vue_app__=c,Bn(p.component)}},onUnmount(u){a.push(u)},unmount(){l&&(xt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=Ts;Ts=c;try{return u()}finally{Ts=d}}};return c}}let Ts=null;const Pd=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${st(e)}Modifiers`]||t[`${As(e)}Modifiers`];function Id(t,e,...s){if(t.isUnmounted)return;const r=t.vnode.props||Te;let n=s;const i=e.startsWith("update:"),o=i&&Pd(r,e.slice(7));o&&(o.trim&&(n=s.map(u=>Pe(u)?u.trim():u)),o.number&&(n=s.map(Ji)));let a,l=r[a=Yn(e)]||r[a=Yn(st(e))];!l&&i&&(l=r[a=Yn(As(e))]),l&&xt(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,xt(c,t,6,n)}}const jd=new WeakMap;function Zl(t,e,s=!1){const r=s?jd:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const i=t.emits;let o={},a=!1;if(!pe(t)){const l=c=>{const u=Zl(c,e,!0);u&&(a=!0,Fe(o,u))};!s&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(Se(t)&&r.set(t,null),null):(ne(i)?i.forEach(l=>o[l]=null):Fe(o,i),Se(t)&&r.set(t,o),o)}function Un(t,e){return!t||!Sn(e)?!1:(e=e.slice(2).replace(/Once$/,""),xe(t,e[0].toLowerCase()+e.slice(1))||xe(t,As(e))||xe(t,e))}function Io(t){const{type:e,vnode:s,proxy:r,withProxy:n,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:b}=t,x=dn(t);let y,k;try{if(s.shapeFlag&4){const L=n||r,N=L;y=jt(c.call(N,L,u,d,p,f,m)),k=a}else{const L=e;y=jt(L.length>1?L(d,{attrs:a,slots:o,emit:l}):L(d,null)),k=e.props?a:Nd(a)}}catch(L){fr.length=0,In(L,t,1),y=He(tt)}let A=y;if(k&&b!==!1){const L=Object.keys(k),{shapeFlag:N}=A;L.length&&N&7&&(i&&L.some(En)&&(k=Ld(k,i)),A=ds(A,k,!1,!0))}return s.dirs&&(A=ds(A,null,!1,!0),A.dirs=A.dirs?A.dirs.concat(s.dirs):s.dirs),s.transition&&kr(A,s.transition),y=A,dn(x),y}const Nd=t=>{let e;for(const s in t)(s==="class"||s==="style"||Sn(s))&&((e||(e={}))[s]=t[s]);return e},Ld=(t,e)=>{const s={};for(const r in t)(!En(r)||!(r.slice(9)in e))&&(s[r]=t[r]);return s};function Ud(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?jo(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let d=0;d<u.length;d++){const f=u[d];if(Ql(o,r,f)&&!Un(c,f))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?jo(r,o,c):!0:!!o;return!1}function jo(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(Ql(e,t,i)&&!Un(s,i))return!0}return!1}function Ql(t,e,s){const r=t[s],n=e[s];return s==="style"&&Se(r)&&Se(n)?!Lr(r,n):r!==n}function Dd({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 ec={},tc=()=>Object.create(ec),sc=t=>Object.getPrototypeOf(t)===ec;function Md(t,e,s,r=!1){const n={},i=tc();t.propsDefaults=Object.create(null),rc(t,e,n,i);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);s?t.props=r?n:Ol(n):t.type.props?t.props=n:t.props=i,t.attrs=i}function Bd(t,e,s,r){const{props:n,attrs:i,vnode:{patchFlag:o}}=t,a=ye(n),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let d=0;d<u.length;d++){let f=u[d];if(Un(t.emitsOptions,f))continue;const p=e[f];if(l)if(xe(i,f))p!==i[f]&&(i[f]=p,c=!0);else{const m=st(f);n[m]=Ei(l,a,m,p,t,!1)}else p!==i[f]&&(i[f]=p,c=!0)}}}else{rc(t,e,n,i)&&(c=!0);let u;for(const d in a)(!e||!xe(e,d)&&((u=As(d))===d||!xe(e,u)))&&(l?s&&(s[d]!==void 0||s[u]!==void 0)&&(n[d]=Ei(l,a,d,void 0,t,!0)):delete n[d]);if(i!==a)for(const d in i)(!e||!xe(e,d))&&(delete i[d],c=!0)}c&&Kt(t.attrs,"set","")}function rc(t,e,s,r){const[n,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(ar(l))continue;const c=e[l];let u;n&&xe(n,u=st(l))?!i||!i.includes(u)?s[u]=c:(a||(a={}))[u]=c:Un(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=ye(s),c=a||Te;for(let u=0;u<i.length;u++){const d=i[u];s[d]=Ei(n,l,d,c[d],t,!xe(c,d))}}return o}function Ei(t,e,s,r,n,i){const o=t[s];if(o!=null){const a=xe(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&pe(l)){const{propsDefaults:c}=n;if(s in c)r=c[s];else{const u=Dr(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===As(s))&&(r=!0))}return r}const Hd=new WeakMap;function nc(t,e,s=!1){const r=s?Hd:e.propsCache,n=r.get(t);if(n)return n;const i=t.props,o={},a=[];let l=!1;if(!pe(t)){const u=d=>{l=!0;const[f,p]=nc(d,e,!0);Fe(o,f),p&&a.push(...p)};!s&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return Se(t)&&r.set(t,Fs),Fs;if(ne(i))for(let u=0;u<i.length;u++){const d=st(i[u]);No(d)&&(o[d]=Te)}else if(i)for(const u in i){const d=st(u);if(No(d)){const f=i[u],p=o[d]=ne(f)||pe(f)?{type:f}:Fe({},f),m=p.type;let b=!1,x=!0;if(ne(m))for(let y=0;y<m.length;++y){const k=m[y],A=pe(k)&&k.name;if(A==="Boolean"){b=!0;break}else A==="String"&&(x=!1)}else b=pe(m)&&m.name==="Boolean";p[0]=b,p[1]=x,(b||xe(p,"default"))&&a.push(d)}}const c=[o,a];return Se(t)&&r.set(t,c),c}function No(t){return t[0]!=="$"&&!ar(t)}const oo=t=>t==="_"||t==="_ctx"||t==="$stable",ao=t=>ne(t)?t.map(jt):[jt(t)],Fd=(t,e,s)=>{if(e._n)return e;const r=xr((...n)=>ao(e(...n)),s);return r._c=!1,r},ic=(t,e,s)=>{const r=t._ctx;for(const n in t){if(oo(n))continue;const i=t[n];if(pe(i))e[n]=Fd(n,i,r);else if(i!=null){const o=ao(i);e[n]=()=>o}}},oc=(t,e)=>{const s=ao(e);t.slots.default=()=>s},ac=(t,e,s)=>{for(const r in e)(s||!oo(r))&&(t[r]=e[r])},Vd=(t,e,s)=>{const r=t.slots=tc();if(t.vnode.shapeFlag&32){const n=e._;n?(ac(r,e,s),s&&ll(r,"_",n,!0)):ic(e,r)}else e&&oc(t,e)},qd=(t,e,s)=>{const{vnode:r,slots:n}=t;let i=!0,o=Te;if(r.shapeFlag&32){const a=e._;a?s&&a===1?i=!1:ac(n,e,s):(i=!e.$stable,ic(e,n)),o=e}else e&&(oc(t,e),o={default:1});if(i)for(const a in n)!oo(a)&&o[a]==null&&delete n[a]},nt=Jd;function Wd(t){return Kd(t)}function Kd(t,e){const s=On();s.__VUE__=!0;const{insert:r,remove:n,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:f,setScopeId:p=Ut,insertStaticContent:m}=t,b=(g,v,S,P=null,U=null,j=null,J=void 0,G=null,W=!!v.dynamicChildren)=>{if(g===v)return;g&&!_s(g,v)&&(P=I(g),T(g,U,j,!0),g=null),v.patchFlag===-2&&(W=!1,v.dynamicChildren=null);const{type:D,ref:oe,shapeFlag:Z}=v;switch(D){case Dn:x(g,v,S,P);break;case tt:y(g,v,S,P);break;case rn:g==null&&k(v,S,P,J);break;case be:V(g,v,S,P,U,j,J,G,W);break;default:Z&1?N(g,v,S,P,U,j,J,G,W):Z&6?q(g,v,S,P,U,j,J,G,W):(Z&64||Z&128)&&D.process(g,v,S,P,U,j,J,G,W,se)}oe!=null&&U?ur(oe,g&&g.ref,j,v||g,!v):oe==null&&g&&g.ref!=null&&ur(g.ref,null,j,g,!0)},x=(g,v,S,P)=>{if(g==null)r(v.el=a(v.children),S,P);else{const U=v.el=g.el;v.children!==g.children&&c(U,v.children)}},y=(g,v,S,P)=>{g==null?r(v.el=l(v.children||""),S,P):v.el=g.el},k=(g,v,S,P)=>{[g.el,g.anchor]=m(g.children,v,S,P,g.el,g.anchor)},A=({el:g,anchor:v},S,P)=>{let U;for(;g&&g!==v;)U=f(g),r(g,S,P),g=U;r(v,S,P)},L=({el:g,anchor:v})=>{let S;for(;g&&g!==v;)S=f(g),n(g),g=S;n(v)},N=(g,v,S,P,U,j,J,G,W)=>{if(v.type==="svg"?J="svg":v.type==="math"&&(J="mathml"),g==null)$(v,S,P,U,j,J,G,W);else{const D=g.el&&g.el._isVueCE?g.el:null;try{D&&D._beginPatch(),B(g,v,U,j,J,G,W)}finally{D&&D._endPatch()}}},$=(g,v,S,P,U,j,J,G)=>{let W,D;const{props:oe,shapeFlag:Z,transition:re,dirs:ue}=g;if(W=g.el=o(g.type,j,oe&&oe.is,oe),Z&8?u(W,g.children):Z&16&&M(g.children,W,null,P,U,ri(g,j),J,G),ue&&hs(g,null,P,"created"),E(W,g,g.scopeId,J,P),oe){for(const Ee in oe)Ee!=="value"&&!ar(Ee)&&i(W,Ee,null,oe[Ee],j,P);"value"in oe&&i(W,"value",null,oe.value,j),(D=oe.onVnodeBeforeMount)&&At(D,P,g)}ue&&hs(g,null,P,"beforeMount");const _e=Gd(U,re);_e&&re.beforeEnter(W),r(W,v,S),((D=oe&&oe.onVnodeMounted)||_e||ue)&&nt(()=>{try{D&&At(D,P,g),_e&&re.enter(W),ue&&hs(g,null,P,"mounted")}finally{}},U)},E=(g,v,S,P,U)=>{if(S&&p(g,S),P)for(let j=0;j<P.length;j++)p(g,P[j]);if(U){let j=U.subTree;if(v===j||dc(j.type)&&(j.ssContent===v||j.ssFallback===v)){const J=U.vnode;E(g,J,J.scopeId,J.slotScopeIds,U.parent)}}},M=(g,v,S,P,U,j,J,G,W=0)=>{for(let D=W;D<g.length;D++){const oe=g[D]=G?Wt(g[D]):jt(g[D]);b(null,oe,v,S,P,U,j,J,G)}},B=(g,v,S,P,U,j,J)=>{const G=v.el=g.el;let{patchFlag:W,dynamicChildren:D,dirs:oe}=v;W|=g.patchFlag&16;const Z=g.props||Te,re=v.props||Te;let ue;if(S&&fs(S,!1),(ue=re.onVnodeBeforeUpdate)&&At(ue,S,v,g),oe&&hs(v,g,S,"beforeUpdate"),S&&fs(S,!0),(Z.innerHTML&&re.innerHTML==null||Z.textContent&&re.textContent==null)&&u(G,""),D?te(g.dynamicChildren,D,G,S,P,ri(v,U),j):J||me(g,v,G,null,S,P,ri(v,U),j,!1),W>0){if(W&16)de(G,Z,re,S,U);else if(W&2&&Z.class!==re.class&&i(G,"class",null,re.class,U),W&4&&i(G,"style",Z.style,re.style,U),W&8){const _e=v.dynamicProps;for(let Ee=0;Ee<_e.length;Ee++){const Ae=_e[Ee],Ue=Z[Ae],Ke=re[Ae];(Ke!==Ue||Ae==="value")&&i(G,Ae,Ue,Ke,U,S)}}W&1&&g.children!==v.children&&u(G,v.children)}else!J&&D==null&&de(G,Z,re,S,U);((ue=re.onVnodeUpdated)||oe)&&nt(()=>{ue&&At(ue,S,v,g),oe&&hs(v,g,S,"updated")},P)},te=(g,v,S,P,U,j,J)=>{for(let G=0;G<v.length;G++){const W=g[G],D=v[G],oe=W.el&&(W.type===be||!_s(W,D)||W.shapeFlag&198)?d(W.el):S;b(W,D,oe,null,P,U,j,J,!0)}},de=(g,v,S,P,U)=>{if(v!==S){if(v!==Te)for(const j in v)!ar(j)&&!(j in S)&&i(g,j,v[j],null,U,P);for(const j in S){if(ar(j))continue;const J=S[j],G=v[j];J!==G&&j!=="value"&&i(g,j,G,J,U,P)}"value"in S&&i(g,"value",v.value,S.value,U)}},V=(g,v,S,P,U,j,J,G,W)=>{const D=v.el=g?g.el:a(""),oe=v.anchor=g?g.anchor:a("");let{patchFlag:Z,dynamicChildren:re,slotScopeIds:ue}=v;ue&&(G=G?G.concat(ue):ue),g==null?(r(D,S,P),r(oe,S,P),M(v.children||[],S,oe,U,j,J,G,W)):Z>0&&Z&64&&re&&g.dynamicChildren&&g.dynamicChildren.length===re.length?(te(g.dynamicChildren,re,S,U,j,J,G),(v.key!=null||U&&v===U.subTree)&&lc(g,v,!0)):me(g,v,S,oe,U,j,J,G,W)},q=(g,v,S,P,U,j,J,G,W)=>{v.slotScopeIds=G,g==null?v.shapeFlag&512?U.ctx.activate(v,S,P,J,W):O(v,S,P,U,j,J,W):ce(g,v,W)},O=(g,v,S,P,U,j,J)=>{const G=g.component=sh(g,P,U);if(jn(g)&&(G.ctx.renderer=se),rh(G,!1,J),G.asyncDep){if(U&&U.registerDep(G,ge,J),!g.el){const W=G.subTree=He(tt);y(null,W,v,S),g.placeholder=W.el}}else ge(G,g,v,S,U,j,J)},ce=(g,v,S)=>{const P=v.component=g.component;if(Ud(g,v,S))if(P.asyncDep&&!P.asyncResolved){ie(P,v,S);return}else P.next=v,P.update();else v.el=g.el,P.vnode=v},ge=(g,v,S,P,U,j,J)=>{const G=()=>{if(g.isMounted){let{next:Z,bu:re,u:ue,parent:_e,vnode:Ee}=g;{const Et=cc(g);if(Et){Z&&(Z.el=Ee.el,ie(g,Z,J)),Et.asyncDep.then(()=>{nt(()=>{g.isUnmounted||D()},U)});return}}let Ae=Z,Ue;fs(g,!1),Z?(Z.el=Ee.el,ie(g,Z,J)):Z=Ee,re&&tn(re),(Ue=Z.props&&Z.props.onVnodeBeforeUpdate)&&At(Ue,_e,Z,Ee),fs(g,!0);const Ke=Io(g),St=g.subTree;g.subTree=Ke,b(St,Ke,d(St.el),I(St),g,U,j),Z.el=Ke.el,Ae===null&&Dd(g,Ke.el),ue&&nt(ue,U),(Ue=Z.props&&Z.props.onVnodeUpdated)&&nt(()=>At(Ue,_e,Z,Ee),U)}else{let Z;const{el:re,props:ue}=v,{bm:_e,m:Ee,parent:Ae,root:Ue,type:Ke}=g,St=dr(v);fs(g,!1),_e&&tn(_e),!St&&(Z=ue&&ue.onVnodeBeforeMount)&&At(Z,Ae,v),fs(g,!0);{Ue.ce&&Ue.ce._hasShadowRoot()&&Ue.ce._injectChildStyle(Ke,g.parent?g.parent.type:void 0);const Et=g.subTree=Io(g);b(null,Et,S,P,g,U,j),v.el=Et.el}if(Ee&&nt(Ee,U),!St&&(Z=ue&&ue.onVnodeMounted)){const Et=v;nt(()=>At(Z,Ae,Et),U)}(v.shapeFlag&256||Ae&&dr(Ae.vnode)&&Ae.vnode.shapeFlag&256)&&g.a&&nt(g.a,U),g.isMounted=!0,v=S=P=null}};g.scope.on();const W=g.effect=new ml(G);g.scope.off();const D=g.update=W.run.bind(W),oe=g.job=W.runIfDirty.bind(W);oe.i=g,oe.id=g.uid,W.scheduler=()=>no(oe),fs(g,!0),D()},ie=(g,v,S)=>{v.component=g;const P=g.vnode.props;g.vnode=v,g.next=null,Bd(g,v.props,P,S),qd(g,v.children,S),Xt(),So(g),Zt()},me=(g,v,S,P,U,j,J,G,W=!1)=>{const D=g&&g.children,oe=g?g.shapeFlag:0,Z=v.children,{patchFlag:re,shapeFlag:ue}=v;if(re>0){if(re&128){Xe(D,Z,S,P,U,j,J,G,W);return}else if(re&256){We(D,Z,S,P,U,j,J,G,W);return}}ue&8?(oe&16&&Le(D,U,j),Z!==D&&u(S,Z)):oe&16?ue&16?Xe(D,Z,S,P,U,j,J,G,W):Le(D,U,j,!0):(oe&8&&u(S,""),ue&16&&M(Z,S,P,U,j,J,G,W))},We=(g,v,S,P,U,j,J,G,W)=>{g=g||Fs,v=v||Fs;const D=g.length,oe=v.length,Z=Math.min(D,oe);let re;for(re=0;re<Z;re++){const ue=v[re]=W?Wt(v[re]):jt(v[re]);b(g[re],ue,S,null,U,j,J,G,W)}D>oe?Le(g,U,j,!0,!1,Z):M(v,S,P,U,j,J,G,W,Z)},Xe=(g,v,S,P,U,j,J,G,W)=>{let D=0;const oe=v.length;let Z=g.length-1,re=oe-1;for(;D<=Z&&D<=re;){const ue=g[D],_e=v[D]=W?Wt(v[D]):jt(v[D]);if(_s(ue,_e))b(ue,_e,S,null,U,j,J,G,W);else break;D++}for(;D<=Z&&D<=re;){const ue=g[Z],_e=v[re]=W?Wt(v[re]):jt(v[re]);if(_s(ue,_e))b(ue,_e,S,null,U,j,J,G,W);else break;Z--,re--}if(D>Z){if(D<=re){const ue=re+1,_e=ue<oe?v[ue].el:P;for(;D<=re;)b(null,v[D]=W?Wt(v[D]):jt(v[D]),S,_e,U,j,J,G,W),D++}}else if(D>re)for(;D<=Z;)T(g[D],U,j,!0),D++;else{const ue=D,_e=D,Ee=new Map;for(D=_e;D<=re;D++){const it=v[D]=W?Wt(v[D]):jt(v[D]);it.key!=null&&Ee.set(it.key,D)}let Ae,Ue=0;const Ke=re-_e+1;let St=!1,Et=0;const Xs=new Array(Ke);for(D=0;D<Ke;D++)Xs[D]=0;for(D=ue;D<=Z;D++){const it=g[D];if(Ue>=Ke){T(it,U,j,!0);continue}let Tt;if(it.key!=null)Tt=Ee.get(it.key);else for(Ae=_e;Ae<=re;Ae++)if(Xs[Ae-_e]===0&&_s(it,v[Ae])){Tt=Ae;break}Tt===void 0?T(it,U,j,!0):(Xs[Tt-_e]=D+1,Tt>=Et?Et=Tt:St=!0,b(it,v[Tt],S,null,U,j,J,G,W),Ue++)}const vo=St?zd(Xs):Fs;for(Ae=vo.length-1,D=Ke-1;D>=0;D--){const it=_e+D,Tt=v[it],bo=v[it+1],yo=it+1<oe?bo.el||uc(bo):P;Xs[D]===0?b(null,Tt,S,yo,U,j,J,G,W):St&&(Ae<0||D!==vo[Ae]?H(Tt,S,yo,2):Ae--)}}},H=(g,v,S,P,U=null)=>{const{el:j,type:J,transition:G,children:W,shapeFlag:D}=g;if(D&6){H(g.component.subTree,v,S,P);return}if(D&128){g.suspense.move(v,S,P);return}if(D&64){J.move(g,v,S,se);return}if(J===be){r(j,v,S);for(let Z=0;Z<W.length;Z++)H(W[Z],v,S,P);r(g.anchor,v,S);return}if(J===rn){A(g,v,S);return}if(P!==2&&D&1&&G)if(P===0)G.beforeEnter(j),r(j,v,S),nt(()=>G.enter(j),U);else{const{leave:Z,delayLeave:re,afterLeave:ue}=G,_e=()=>{g.ctx.isUnmounted?n(j):r(j,v,S)},Ee=()=>{j._isLeaving&&j[Ot](!0),Z(j,()=>{_e(),ue&&ue()})};re?re(j,_e,Ee):Ee()}else r(j,v,S)},T=(g,v,S,P=!1,U=!1)=>{const{type:j,props:J,ref:G,children:W,dynamicChildren:D,shapeFlag:oe,patchFlag:Z,dirs:re,cacheIndex:ue,memo:_e}=g;if(Z===-2&&(U=!1),G!=null&&(Xt(),ur(G,null,S,g,!0),Zt()),ue!=null&&(v.renderCache[ue]=void 0),oe&256){v.ctx.deactivate(g);return}const Ee=oe&1&&re,Ae=!dr(g);let Ue;if(Ae&&(Ue=J&&J.onVnodeBeforeUnmount)&&At(Ue,v,g),oe&6)le(g.component,S,P);else{if(oe&128){g.suspense.unmount(S,P);return}Ee&&hs(g,null,v,"beforeUnmount"),oe&64?g.type.remove(g,v,S,se,P):D&&!D.hasOnce&&(j!==be||Z>0&&Z&64)?Le(D,v,S,!1,!0):(j===be&&Z&384||!U&&oe&16)&&Le(W,v,S),P&&C(g)}const Ke=_e!=null&&ue==null;(Ae&&(Ue=J&&J.onVnodeUnmounted)||Ee||Ke)&&nt(()=>{Ue&&At(Ue,v,g),Ee&&hs(g,null,v,"unmounted"),Ke&&(g.el=null)},S)},C=g=>{const{type:v,el:S,anchor:P,transition:U}=g;if(v===be){K(S,P);return}if(v===rn){L(g);return}const j=()=>{n(S),U&&!U.persisted&&U.afterLeave&&U.afterLeave()};if(g.shapeFlag&1&&U&&!U.persisted){const{leave:J,delayLeave:G}=U,W=()=>J(S,j);G?G(g.el,j,W):W()}else j()},K=(g,v)=>{let S;for(;g!==v;)S=f(g),n(g),g=S;n(v)},le=(g,v,S)=>{const{bum:P,scope:U,job:j,subTree:J,um:G,m:W,a:D}=g;Lo(W),Lo(D),P&&tn(P),U.stop(),j&&(j.flags|=8,T(J,g,v,S)),G&&nt(G,v),nt(()=>{g.isUnmounted=!0},v)},Le=(g,v,S,P=!1,U=!1,j=0)=>{for(let J=j;J<g.length;J++)T(g[J],v,S,P,U)},I=g=>{if(g.shapeFlag&6)return I(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const v=f(g.anchor||g.el),S=v&&v[ad];return S?f(S):v};let Q=!1;const X=(g,v,S)=>{let P;g==null?v._vnode&&(T(v._vnode,null,null,!0),P=v._vnode.component):b(v._vnode||null,g,v,null,null,null,S),v._vnode=g,Q||(Q=!0,So(P),Nl(),Q=!1)},se={p:b,um:T,m:H,r:C,mt:O,mc:M,pc:me,pbc:te,n:I,o:t};return{render:X,hydrate:void 0,createApp:$d(X)}}function ri({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 fs({effect:t,job:e},s){s?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Gd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function lc(t,e,s=!1){const r=t.children,n=e.children;if(ne(r)&&ne(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]=Wt(n[i]),a.el=o.el),!s&&a.patchFlag!==-2&&lc(o,a)),a.type===Dn&&(a.patchFlag===-1&&(a=n[i]=Wt(a)),a.el=o.el),a.type===tt&&!a.el&&(a.el=o.el)}}function zd(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 cc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:cc(e)}function Lo(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function uc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?uc(e.subTree):null}const dc=t=>t.__isSuspense;function Jd(t,e){e&&e.pendingBranch?ne(t)?e.effects.push(...t):e.effects.push(t):sd(t)}const be=Symbol.for("v-fgt"),Dn=Symbol.for("v-txt"),tt=Symbol.for("v-cmt"),rn=Symbol.for("v-stc"),fr=[];let ct=null;function _(t=!1){fr.push(ct=t?null:[])}function Yd(){fr.pop(),ct=fr[fr.length-1]||null}let Sr=1;function pn(t,e=!1){Sr+=t,t<0&&ct&&e&&(ct.hasOnce=!0)}function hc(t){return t.dynamicChildren=Sr>0?ct||Fs:null,Yd(),Sr>0&&ct&&ct.push(t),t}function w(t,e,s,r,n,i){return hc(h(t,e,s,r,n,i,!0))}function fc(t,e,s,r,n){return hc(He(t,e,s,r,n,!0))}function gn(t){return t?t.__v_isVNode===!0:!1}function _s(t,e){return t.type===e.type&&t.key===e.key}const pc=({key:t})=>t??null,nn=({ref:t,ref_key:e,ref_for:s})=>(typeof t=="number"&&(t=""+t),t!=null?Pe(t)||Ne(t)||pe(t)?{i:at,r:t,k:e,f:!!s}:t:null);function h(t,e=null,s=null,r=0,n=null,i=t===be?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&pc(e),ref:e&&nn(e),scopeId:Ul,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:at};return a?(lo(l,s),i&128&&t.normalize(l)):s&&(l.shapeFlag|=Pe(s)?8:16),Sr>0&&!o&&ct&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ct.push(l),l}const He=Xd;function Xd(t,e=null,s=null,r=0,n=null,i=!1){if((!t||t===zl)&&(t=tt),gn(t)){const a=ds(t,e,!0);return s&&lo(a,s),Sr>0&&!i&&ct&&(a.shapeFlag&6?ct[ct.indexOf(t)]=a:ct.push(a)),a.patchFlag=-2,a}if(lh(t)&&(t=t.__vccOpts),e){e=Zd(e);let{class:a,style:l}=e;a&&!Pe(a)&&(e.class=fe(a)),Se(l)&&(Pn(l)&&!ne(l)&&(l=Fe({},l)),e.style=Yi(l))}const o=Pe(t)?1:dc(t)?128:Bl(t)?64:Se(t)?4:pe(t)?2:0;return h(t,e,s,r,n,o,i,!0)}function Zd(t){return t?Pn(t)||sc(t)?Fe({},t):t:null}function ds(t,e,s=!1,r=!1){const{props:n,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?Qd(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&pc(c),ref:e&&e.ref?s&&i?ne(i)?i.concat(nn(e)):[i,nn(e)]:nn(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!==be?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&&ds(t.ssContent),ssFallback:t.ssFallback&&ds(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&kr(u,l.clone(u)),u}function he(t=" ",e=0){return He(Dn,null,t,e)}function Mn(t,e){const s=He(rn,null,t);return s.staticCount=e,s}function Y(t="",e=!1){return e?(_(),fc(tt,null,t)):He(tt,null,t)}function jt(t){return t==null||typeof t=="boolean"?He(tt):ne(t)?He(be,null,t.slice()):gn(t)?Wt(t):He(Dn,null,String(t))}function Wt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:ds(t)}function lo(t,e){let s=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(ne(e))s=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),lo(t,n()),n._c&&(n._d=!0));return}else{s=32;const n=e._;!n&&!sc(e)?e._ctx=at:n===3&&at&&(at.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else pe(e)?(e={default:e,_ctx:at},s=32):(e=String(e),r&64?(s=16,e=[he(e)]):s=8);t.children=e,t.shapeFlag|=s}function Qd(...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=fe([e.class,r.class]));else if(n==="style")e.style=Yi([e.style,r.style]);else if(Sn(n)){const i=e[n],o=r[n];o&&i!==o&&!(ne(i)&&i.includes(o))?e[n]=i?[].concat(i,o):o:o==null&&i==null&&!En(n)&&(e[n]=o)}else n!==""&&(e[n]=r[n])}return e}function At(t,e,s,r=null){xt(t,e,7,[s,r])}const eh=Xl();let th=0;function sh(t,e,s){const r=t.type,n=(e?e.appContext:t.appContext)||eh,i={uid:th++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new fl(!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:nc(r,n),emitsOptions:Zl(r,n),emit:null,emitted:null,propsDefaults:Te,inheritAttrs:r.inheritAttrs,ctx:Te,data:Te,props:Te,attrs:Te,slots:Te,refs:Te,setupState:Te,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=Id.bind(null,i),t.ce&&t.ce(i),i}let Ye=null;const co=()=>Ye||at;let mn,Ti;{const t=On(),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)}};mn=e("__VUE_INSTANCE_SETTERS__",s=>Ye=s),Ti=e("__VUE_SSR_SETTERS__",s=>Er=s)}const Dr=t=>{const e=Ye;return mn(t),t.scope.on(),()=>{t.scope.off(),mn(e)}},Uo=()=>{Ye&&Ye.scope.off(),mn(null)};function gc(t){return t.vnode.shapeFlag&4}let Er=!1;function rh(t,e=!1,s=!1){e&&Ti(e);const{props:r,children:n}=t.vnode,i=gc(t);Md(t,r,i,e),Vd(t,n,s||e);const o=i?nh(t,e):void 0;return e&&Ti(!1),o}function nh(t,e){const s=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Sd);const{setup:r}=s;if(r){Xt();const n=t.setupContext=r.length>1?oh(t):null,i=Dr(t),o=Ur(r,t,0,[t.props,n]),a=il(o);if(Zt(),i(),(a||t.sp)&&!dr(t)&&Kl(t),a){if(o.then(Uo,Uo),e)return o.then(l=>{Do(t,l)}).catch(l=>{In(l,t,0)});t.asyncDep=o}else Do(t,o)}else mc(t)}function Do(t,e,s){pe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Se(e)&&(t.setupState=Pl(e)),mc(t)}function mc(t,e,s){const r=t.type;t.render||(t.render=r.render||Ut);{const n=Dr(t);Xt();try{Ed(t)}finally{Zt(),n()}}}const ih={get(t,e){return Je(t,"get",""),t[e]}};function oh(t){const e=s=>{t.exposed=s||{}};return{attrs:new Proxy(t.attrs,ih),slots:t.slots,emit:t.emit,expose:e}}function Bn(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Pl(ro(t.exposed)),{get(e,s){if(s in e)return e[s];if(s in hr)return hr[s](t)},has(e,s){return s in e||s in hr}})):t.proxy}function ah(t,e=!0){return pe(t)?t.displayName||t.name:t.name||e&&t.__name}function lh(t){return pe(t)&&"__vccOpts"in t}const $e=(t,e)=>Xu(t,e,Er);function uo(t,e,s){try{pn(-1);const r=arguments.length;return r===2?Se(e)&&!ne(e)?gn(e)?He(t,null,[e]):He(t,e):He(t,null,e):(r>3?s=Array.prototype.slice.call(arguments,2):r===3&&gn(s)&&(s=[s]),He(t,e,s))}finally{pn(1)}}const ch="3.5.34";/**
14
- * @vue/runtime-dom v3.5.34
15
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
- * @license MIT
17
- **/let Ai;const Mo=typeof window<"u"&&window.trustedTypes;if(Mo)try{Ai=Mo.createPolicy("vue",{createHTML:t=>t})}catch{}const vc=Ai?t=>Ai.createHTML(t):t=>t,uh="http://www.w3.org/2000/svg",dh="http://www.w3.org/1998/Math/MathML",Ft=typeof document<"u"?document:null,Bo=Ft&&Ft.createElement("template"),hh={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"?Ft.createElementNS(uh,t):e==="mathml"?Ft.createElementNS(dh,t):s?Ft.createElement(t,{is:s}):Ft.createElement(t);return t==="select"&&r&&r.multiple!=null&&n.setAttribute("multiple",r.multiple),n},createText:t=>Ft.createTextNode(t),createComment:t=>Ft.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Ft.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{Bo.innerHTML=vc(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=Bo.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]}},rs="transition",er="animation",Tr=Symbol("_vtc"),bc={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},fh=Fe({},Hl,bc),ph=t=>(t.displayName="Transition",t.props=fh,t),yc=ph((t,{slots:e})=>uo(ud,gh(t),e)),ps=(t,e=[])=>{ne(t)?t.forEach(s=>s(...e)):t&&t(...e)},Ho=t=>t?ne(t)?t.some(e=>e.length>1):t.length>1:!1;function gh(t){const e={};for(const V in t)V in bc||(e[V]=t[V]);if(t.css===!1)return e;const{name:s="v",type:r,duration:n,enterFromClass:i=`${s}-enter-from`,enterActiveClass:o=`${s}-enter-active`,enterToClass:a=`${s}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:d=`${s}-leave-from`,leaveActiveClass:f=`${s}-leave-active`,leaveToClass:p=`${s}-leave-to`}=t,m=mh(n),b=m&&m[0],x=m&&m[1],{onBeforeEnter:y,onEnter:k,onEnterCancelled:A,onLeave:L,onLeaveCancelled:N,onBeforeAppear:$=y,onAppear:E=k,onAppearCancelled:M=A}=e,B=(V,q,O,ce)=>{V._enterCancelled=ce,gs(V,q?u:a),gs(V,q?c:o),O&&O()},te=(V,q)=>{V._isLeaving=!1,gs(V,d),gs(V,p),gs(V,f),q&&q()},de=V=>(q,O)=>{const ce=V?E:k,ge=()=>B(q,V,O);ps(ce,[q,ge]),Fo(()=>{gs(q,V?l:i),Mt(q,V?u:a),Ho(ce)||Vo(q,r,b,ge)})};return Fe(e,{onBeforeEnter(V){ps(y,[V]),Mt(V,i),Mt(V,o)},onBeforeAppear(V){ps($,[V]),Mt(V,l),Mt(V,c)},onEnter:de(!1),onAppear:de(!0),onLeave(V,q){V._isLeaving=!0;const O=()=>te(V,q);Mt(V,d),V._enterCancelled?(Mt(V,f),Ko(V)):(Ko(V),Mt(V,f)),Fo(()=>{V._isLeaving&&(gs(V,d),Mt(V,p),Ho(L)||Vo(V,r,x,O))}),ps(L,[V,O])},onEnterCancelled(V){B(V,!1,void 0,!0),ps(A,[V])},onAppearCancelled(V){B(V,!0,void 0,!0),ps(M,[V])},onLeaveCancelled(V){te(V),ps(N,[V])}})}function mh(t){if(t==null)return null;if(Se(t))return[ni(t.enter),ni(t.leave)];{const e=ni(t);return[e,e]}}function ni(t){return mu(t)}function Mt(t,e){e.split(/\s+/).forEach(s=>s&&t.classList.add(s)),(t[Tr]||(t[Tr]=new Set)).add(e)}function gs(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.remove(r));const s=t[Tr];s&&(s.delete(e),s.size||(t[Tr]=void 0))}function Fo(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let vh=0;function Vo(t,e,s,r){const n=t._endId=++vh,i=()=>{n===t._endId&&r()};if(s!=null)return setTimeout(i,s);const{type:o,timeout:a,propCount:l}=bh(t,e);if(!o)return r();const c=o+"end";let u=0;const d=()=>{t.removeEventListener(c,f),i()},f=p=>{p.target===t&&++u>=l&&d()};setTimeout(()=>{u<l&&d()},a+1),t.addEventListener(c,f)}function bh(t,e){const s=window.getComputedStyle(t),r=m=>(s[m]||"").split(", "),n=r(`${rs}Delay`),i=r(`${rs}Duration`),o=qo(n,i),a=r(`${er}Delay`),l=r(`${er}Duration`),c=qo(a,l);let u=null,d=0,f=0;e===rs?o>0&&(u=rs,d=o,f=i.length):e===er?c>0&&(u=er,d=c,f=l.length):(d=Math.max(o,c),u=d>0?o>c?rs:er:null,f=u?u===rs?i.length:l.length:0);const p=u===rs&&/\b(?:transform|all)(?:,|$)/.test(r(`${rs}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function qo(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((s,r)=>Wo(s)+Wo(t[r])))}function Wo(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function Ko(t){return(t?t.ownerDocument:document).body.offsetHeight}function yh(t,e,s){const r=t[Tr];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):s?t.setAttribute("class",e):t.className=e}const Go=Symbol("_vod"),_h=Symbol("_vsh"),wh=Symbol(""),xh=/(?:^|;)\s*display\s*:/;function kh(t,e,s){const r=t.style,n=Pe(s);let i=!1;if(s&&!n){if(e)if(Pe(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();s[a]==null&&nr(r,a,"")}else for(const o in e)s[o]==null&&nr(r,o,"");for(const o in s){o==="display"&&(i=!0);const a=s[o];a!=null?Eh(t,o,!Pe(e)&&e?e[o]:void 0,a)||nr(r,o,a):nr(r,o,"")}}else if(n){if(e!==s){const o=r[wh];o&&(s+=";"+o),r.cssText=s,i=xh.test(s)}}else e&&t.removeAttribute("style");Go in t&&(t[Go]=i?r.display:"",t[_h]&&(r.display="none"))}const zo=/\s*!important$/;function nr(t,e,s){if(ne(s))s.forEach(r=>nr(t,e,r));else if(s==null&&(s=""),e.startsWith("--"))t.setProperty(e,s);else{const r=Sh(t,e);zo.test(s)?t.setProperty(As(r),s.replace(zo,""),"important"):t[r]=s}}const Jo=["Webkit","Moz","ms"],ii={};function Sh(t,e){const s=ii[e];if(s)return s;let r=st(e);if(r!=="filter"&&r in t)return ii[e]=r;r=Rn(r);for(let n=0;n<Jo.length;n++){const i=Jo[n]+r;if(i in t)return ii[e]=i}return e}function Eh(t,e,s,r){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&Pe(r)&&s===r}const Yo="http://www.w3.org/1999/xlink";function Xo(t,e,s,r,n,i=xu(e)){r&&e.startsWith("xlink:")?s==null?t.removeAttributeNS(Yo,e.slice(6,e.length)):t.setAttributeNS(Yo,e,s):s==null||i&&!cl(s)?t.removeAttribute(e):t.setAttribute(e,i?"":pt(s)?String(s):s)}function Zo(t,e,s,r,n){if(e==="innerHTML"||e==="textContent"){s!=null&&(t[e]=e==="innerHTML"?vc(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=cl(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 ws(t,e,s,r){t.addEventListener(e,s,r)}function Th(t,e,s,r){t.removeEventListener(e,s,r)}const Qo=Symbol("_vei");function Ah(t,e,s,r,n=null){const i=t[Qo]||(t[Qo]={}),o=i[e];if(r&&o)o.value=r;else{const[a,l]=Ch(e);if(r){const c=i[e]=$h(r,n);ws(t,a,c,l)}else o&&(Th(t,a,o,l),i[e]=void 0)}}const ea=/(?:Once|Passive|Capture)$/;function Ch(t){let e;if(ea.test(t)){e={};let r;for(;r=t.match(ea);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):As(t.slice(2)),e]}let oi=0;const Rh=Promise.resolve(),Oh=()=>oi||(Rh.then(()=>oi=0),oi=Date.now());function $h(t,e){const s=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=s.attached)return;xt(Ph(r,s.value),e,5,[r])};return s.value=t,s.attached=Oh(),s}function Ph(t,e){if(ne(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 ta=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Ih=(t,e,s,r,n,i)=>{const o=n==="svg";e==="class"?yh(t,r,o):e==="style"?kh(t,s,r):Sn(e)?En(e)||Ah(t,e,s,r,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):jh(t,e,r,o))?(Zo(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Xo(t,e,r,o,i,e!=="value")):t._isVueCE&&(Nh(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!Pe(r)))?Zo(t,st(e),r,i,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Xo(t,e,r,o))};function jh(t,e,s,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&ta(e)&&pe(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 ta(e)&&Pe(s)?!1:e in t}function Nh(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 vn=t=>{const e=t.props["onUpdate:modelValue"]||!1;return ne(e)?s=>tn(e,s):e};function Lh(t){t.target.composing=!0}function sa(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ws=Symbol("_assign");function ra(t,e,s){return e&&(t=t.trim()),s&&(t=Ji(t)),t}const yt={created(t,{modifiers:{lazy:e,trim:s,number:r}},n){t[Ws]=vn(n);const i=r||n.props&&n.props.type==="number";ws(t,e?"change":"input",o=>{o.target.composing||t[Ws](ra(t.value,s,i))}),(s||i)&&ws(t,"change",()=>{t.value=ra(t.value,s,i)}),e||(ws(t,"compositionstart",Lh),ws(t,"compositionend",sa),ws(t,"change",sa))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:s,modifiers:{lazy:r,trim:n,number:i}},o){if(t[Ws]=vn(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?Ji(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)}},_c={deep:!0,created(t,e,s){t[Ws]=vn(s),ws(t,"change",()=>{const r=t._modelValue,n=Uh(t),i=t.checked,o=t[Ws];if(ne(r)){const a=ul(r,n),l=a!==-1;if(i&&!l)o(r.concat(n));else if(!i&&l){const c=[...r];c.splice(a,1),o(c)}}else if(Tn(r)){const a=new Set(r);i?a.add(n):a.delete(n),o(a)}else o(wc(t,i))})},mounted:na,beforeUpdate(t,e,s){t[Ws]=vn(s),na(t,e,s)}};function na(t,{value:e,oldValue:s},r){t._modelValue=e;let n;if(ne(e))n=ul(e,r.props.value)>-1;else if(Tn(e))n=e.has(r.props.value);else{if(e===s)return;n=Lr(e,wc(t,!0))}t.checked!==n&&(t.checked=n)}function Uh(t){return"_value"in t?t._value:t.value}function wc(t,e){const s=e?"_trueValue":"_falseValue";return s in t?t[s]:e}const Dh=["ctrl","shift","alt","meta"],Mh={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))},Yt=(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=Mh[e[o]];if(a&&a(n,e))return}return t(n,...i)})},Bh=Fe({patchProp:Ih},hh);let ia;function Hh(){return ia||(ia=Wd(Bh))}const Fh=(...t)=>{const e=Hh().createApp(...t),{mount:s}=e;return e.mount=r=>{const n=qh(r);if(!n)return;const i=e._component;!pe(i)&&!i.render&&!i.template&&(i.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=s(n,!1,Vh(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e};function Vh(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function qh(t){return Pe(t)?document.querySelector(t):t}/*!
18
- * pinia v2.3.1
19
- * (c) 2025 Eduardo San Martin Morote
20
- * @license MIT
21
- */let xc;const Hn=t=>xc=t,kc=Symbol();function Ci(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var pr;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(pr||(pr={}));function Wh(){const t=pl(!0),e=t.run(()=>F({}));let s=[],r=[];const n=ro({install(i){Hn(n),n._a=i,i.provide(kc,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 Sc=()=>{};function oa(t,e,s,r=Sc){t.push(e);const n=()=>{const i=t.indexOf(e);i>-1&&(t.splice(i,1),r())};return!s&&gl()&&Su(n),n}function Rs(t,...e){t.slice().forEach(s=>{s(...e)})}const Kh=t=>t(),aa=Symbol(),ai=Symbol();function Ri(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];Ci(n)&&Ci(r)&&t.hasOwnProperty(s)&&!Ne(r)&&!Jt(r)?t[s]=Ri(n,r):t[s]=r}return t}const Gh=Symbol();function zh(t){return!Ci(t)||!t.hasOwnProperty(Gh)}const{assign:is}=Object;function Jh(t){return!!(Ne(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=Gu(s.state.value[t]);return is(u,i,Object.keys(o||{}).reduce((d,f)=>(d[f]=ro($e(()=>{Hn(s);const p=s._s.get(t);return o[f].call(p,p)})),d),{}))}return l=Ec(t,c,e,s,r,!0),l}function Ec(t,e,s={},r,n,i){let o;const a=is({actions:{}},s),l={deep:!0};let c,u,d=[],f=[],p;const m=r.state.value[t];!i&&!m&&(r.state.value[t]={});let b;function x(M){let B;c=u=!1,typeof M=="function"?(M(r.state.value[t]),B={type:pr.patchFunction,storeId:t,events:p}):(Ri(r.state.value[t],M),B={type:pr.patchObject,payload:M,storeId:t,events:p});const te=b=Symbol();Es().then(()=>{b===te&&(c=!0)}),u=!0,Rs(d,B,r.state.value[t])}const y=i?function(){const{state:B}=s,te=B?B():{};this.$patch(de=>{is(de,te)})}:Sc;function k(){o.stop(),d=[],f=[],r._s.delete(t)}const A=(M,B="")=>{if(aa in M)return M[ai]=B,M;const te=function(){Hn(r);const de=Array.from(arguments),V=[],q=[];function O(ie){V.push(ie)}function ce(ie){q.push(ie)}Rs(f,{args:de,name:te[ai],store:N,after:O,onError:ce});let ge;try{ge=M.apply(this&&this.$id===t?this:N,de)}catch(ie){throw Rs(q,ie),ie}return ge instanceof Promise?ge.then(ie=>(Rs(V,ie),ie)).catch(ie=>(Rs(q,ie),Promise.reject(ie))):(Rs(V,ge),ge)};return te[aa]=!0,te[ai]=B,te},L={_p:r,$id:t,$onAction:oa.bind(null,f),$patch:x,$reset:y,$subscribe(M,B={}){const te=oa(d,M,B.detached,()=>de()),de=o.run(()=>us(()=>r.state.value[t],V=>{(B.flush==="sync"?u:c)&&M({storeId:t,type:pr.direct,events:p},V)},is({},l,B)));return te},$dispose:k},N=zt(L);r._s.set(t,N);const E=(r._a&&r._a.runWithContext||Kh)(()=>r._e.run(()=>(o=pl()).run(()=>e({action:A}))));for(const M in E){const B=E[M];if(Ne(B)&&!Jh(B)||Jt(B))i||(m&&zh(B)&&(Ne(B)?B.value=m[M]:Ri(B,m[M])),r.state.value[t][M]=B);else if(typeof B=="function"){const te=A(B,M);E[M]=te,a.actions[M]=B}}return is(N,E),is(ye(N),E),Object.defineProperty(N,"$state",{get:()=>r.state.value[t],set:M=>{x(B=>{is(B,M)})}}),r._p.forEach(M=>{is(N,o.run(()=>M({store:N,app:r._a,pinia:r,options:a})))}),m&&i&&s.hydrate&&s.hydrate(N.$state,m),c=!0,u=!0,N}/*! #__NO_SIDE_EFFECTS__ */function Tc(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=rd();return a=a||(c?ft(kc,null):null),a&&Hn(a),a=xc,a._s.has(r)||(i?Ec(r,e,n,a):Yh(r,n,a)),a._s.get(r)}return o.$id=r,o}/*!
22
- * vue-router v4.6.4
23
- * (c) 2025 Eduardo San Martin Morote
24
- * @license MIT
25
- */const Ls=typeof document<"u";function Ac(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&&Ac(t.default)}const we=Object.assign;function li(t,e){const s={};for(const r in e){const n=e[r];s[r]=kt(n)?n.map(t):t(n)}return s}const gr=()=>{},kt=Array.isArray;function la(t,e){const s={};for(const r in t)s[r]=r in e?e[r]:t[r];return s}const Cc=/#/g,Zh=/&/g,Qh=/\//g,ef=/=/g,tf=/\?/g,Rc=/\+/g,sf=/%5B/g,rf=/%5D/g,Oc=/%5E/g,nf=/%60/g,$c=/%7B/g,of=/%7C/g,Pc=/%7D/g,af=/%20/g;function ho(t){return t==null?"":encodeURI(""+t).replace(of,"|").replace(sf,"[").replace(rf,"]")}function lf(t){return ho(t).replace($c,"{").replace(Pc,"}").replace(Oc,"^")}function Oi(t){return ho(t).replace(Rc,"%2B").replace(af,"+").replace(Cc,"%23").replace(Zh,"%26").replace(nf,"`").replace($c,"{").replace(Pc,"}").replace(Oc,"^")}function cf(t){return Oi(t).replace(ef,"%3D")}function uf(t){return ho(t).replace(Cc,"%23").replace(tf,"%3F")}function df(t){return uf(t).replace(Qh,"%2F")}function Ar(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const hf=/\/$/,ff=t=>t.replace(hf,"");function ci(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=vf(r??e,s),{fullPath:r+i+o,path:r,query:n,hash:Ar(o)}}function pf(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function ca(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function gf(t,e,s){const r=e.matched.length-1,n=s.matched.length-1;return r>-1&&r===n&&zs(e.matched[r],s.matched[n])&&Ic(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function zs(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function Ic(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var s in t)if(!mf(t[s],e[s]))return!1;return!0}function mf(t,e){return kt(t)?ua(t,e):kt(e)?ua(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function ua(t,e){return kt(e)?t.length===e.length&&t.every((s,r)=>s===e[r]):t.length===1&&t[0]===e}function vf(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 ns={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let $i=function(t){return t.pop="pop",t.push="push",t}({}),ui=function(t){return t.back="back",t.forward="forward",t.unknown="",t}({});function bf(t){if(!t)if(Ls){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),ff(t)}const yf=/^[^#]+#/;function _f(t,e){return t.replace(yf,"#")+e}function wf(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 Fn=()=>({left:window.scrollX,top:window.scrollY});function xf(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=wf(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 da(t,e){return(history.state?history.state.position-e:-1)+t}const Pi=new Map;function kf(t,e){Pi.set(t,e)}function Sf(t){const e=Pi.get(t);return Pi.delete(t),e}function Ef(t){return typeof t=="string"||t&&typeof t=="object"}function jc(t){return typeof t=="string"||typeof t=="symbol"}let Ie=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 Nc=Symbol("");Ie.MATCHER_NOT_FOUND+"",Ie.NAVIGATION_GUARD_REDIRECT+"",Ie.NAVIGATION_ABORTED+"",Ie.NAVIGATION_CANCELLED+"",Ie.NAVIGATION_DUPLICATED+"";function Js(t,e){return we(new Error,{type:t,[Nc]:!0},e)}function Bt(t,e){return t instanceof Error&&Nc in t&&(e==null||!!(t.type&e))}const Tf=["params","query","hash"];function Af(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const s of Tf)s in t&&(e[s]=t[s]);return JSON.stringify(e,null,2)}function Cf(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(Rc," "),i=n.indexOf("="),o=Ar(i<0?n:n.slice(0,i)),a=i<0?null:Ar(n.slice(i+1));if(o in e){let l=e[o];kt(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function ha(t){let e="";for(let s in t){const r=t[s];if(s=cf(s),r==null){r!==void 0&&(e+=(e.length?"&":"")+s);continue}(kt(r)?r.map(n=>n&&Oi(n)):[r&&Oi(r)]).forEach(n=>{n!==void 0&&(e+=(e.length?"&":"")+s,n!=null&&(e+="="+n))})}return e}function Rf(t){const e={};for(const s in t){const r=t[s];r!==void 0&&(e[s]=kt(r)?r.map(n=>n==null?null:""+n):r==null?r:""+r)}return e}const Of=Symbol(""),fa=Symbol(""),Vn=Symbol(""),fo=Symbol(""),Ii=Symbol("");function tr(){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 as(t,e,s,r,n,i=o=>o()){const o=r&&(r.enterCallbacks[n]=r.enterCallbacks[n]||[]);return()=>new Promise((a,l)=>{const c=f=>{f===!1?l(Js(Ie.NAVIGATION_ABORTED,{from:s,to:e})):f instanceof Error?l(f):Ef(f)?l(Js(Ie.NAVIGATION_GUARD_REDIRECT,{from:e,to:f})):(o&&r.enterCallbacks[n]===o&&typeof f=="function"&&o.push(f),a())},u=i(()=>t.call(r&&r.instances[n],e,s,c));let d=Promise.resolve(u);t.length<3&&(d=d.then(c)),d.catch(f=>l(f))})}function di(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(Ac(l)){const c=(l.__vccOpts||l)[e];c&&i.push(as(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 d=Xh(u)?u.default:u;o.mods[a]=u,o.components[a]=d;const f=(d.__vccOpts||d)[e];return f&&as(f,s,r,o,a,n)()}))}}return i}function $f(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=>zs(c,a))?r.push(a):s.push(a));const l=t.matched[o];l&&(e.matched.find(c=>zs(c,l))||n.push(l))}return[s,r,n]}/*!
26
- * vue-router v4.6.4
27
- * (c) 2025 Eduardo San Martin Morote
28
- * @license MIT
29
- */let Pf=()=>location.protocol+"//"+location.host;function Lc(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),ca(a,"")}return ca(s,t)+r+n}function If(t,e,s,r){let n=[],i=[],o=null;const a=({state:f})=>{const p=Lc(t,location),m=s.value,b=e.value;let x=0;if(f){if(s.value=p,e.value=f,o&&o===m){o=null;return}x=b?f.position-b.position:0}else r(p);n.forEach(y=>{y(s.value,m,{delta:x,type:$i.pop,direction:x?x>0?ui.forward:ui.back:ui.unknown})})};function l(){o=s.value}function c(f){n.push(f);const p=()=>{const m=n.indexOf(f);m>-1&&n.splice(m,1)};return i.push(p),p}function u(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(we({},f.state,{scroll:Fn()}),"")}}function d(){for(const f of i)f();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:d}}function pa(t,e,s,r=!1,n=!1){return{back:t,current:e,forward:s,replaced:r,position:window.history.length,scroll:n?Fn():null}}function jf(t){const{history:e,location:s}=window,r={value:Lc(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 d=t.indexOf("#"),f=d>-1?(s.host&&document.querySelector("base")?t:t.slice(d))+l:Pf()+t+l;try{e[u?"replaceState":"pushState"](c,"",f),n.value=c}catch(p){console.error(p),s[u?"replace":"assign"](f)}}function o(l,c){i(l,we({},e.state,pa(n.value.back,l,n.value.forward,!0),c,{position:n.value.position}),!0),r.value=l}function a(l,c){const u=we({},n.value,e.state,{forward:l,scroll:Fn()});i(u.current,u,!0),i(l,we({},pa(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:n,push:a,replace:o}}function Nf(t){t=bf(t);const e=jf(t),s=If(t,e.state,e.location,e.replace);function r(i,o=!0){o||s.pauseListeners(),history.go(i)}const n=we({location:"",base:t,go:r,createHref:_f.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 xs=function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t}({});var Me=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}(Me||{});const Lf={type:xs.Static,value:""},Uf=/[a-zA-Z0-9_]/;function Df(t){if(!t)return[[]];if(t==="/")return[[Lf]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(p){throw new Error(`ERR (${s})/"${c}": ${p}`)}let s=Me.Static,r=s;const n=[];let i;function o(){i&&n.push(i),i=[]}let a=0,l,c="",u="";function d(){c&&(s===Me.Static?i.push({type:xs.Static,value:c}):s===Me.Param||s===Me.ParamRegExp||s===Me.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:xs.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function f(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&s!==Me.ParamRegExp){r=s,s=Me.EscapeNext;continue}switch(s){case Me.Static:l==="/"?(c&&d(),o()):l===":"?(d(),s=Me.Param):f();break;case Me.EscapeNext:f(),s=r;break;case Me.Param:l==="("?s=Me.ParamRegExp:Uf.test(l)?f():(d(),s=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Me.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=Me.ParamRegExpEnd:u+=l;break;case Me.ParamRegExpEnd:d(),s=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return s===Me.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),d(),o(),n}const ga="[^/]+?",Mf={sensitive:!1,strict:!1,start:!0,end:!0};var Qe=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}(Qe||{});const Bf=/[.+*?^${}()[\]/\\]/g;function Hf(t,e){const s=we({},Mf,e),r=[];let n=s.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[Qe.Root];s.strict&&!c.length&&(n+="/");for(let d=0;d<c.length;d++){const f=c[d];let p=Qe.Segment+(s.sensitive?Qe.BonusCaseSensitive:0);if(f.type===xs.Static)d||(n+="/"),n+=f.value.replace(Bf,"\\$&"),p+=Qe.Static;else if(f.type===xs.Param){const{value:m,repeatable:b,optional:x,regexp:y}=f;i.push({name:m,repeatable:b,optional:x});const k=y||ga;if(k!==ga){p+=Qe.BonusCustomRegExp;try{`${k}`}catch(L){throw new Error(`Invalid custom RegExp for param "${m}" (${k}): `+L.message)}}let A=b?`((?:${k})(?:/(?:${k}))*)`:`(${k})`;d||(A=x&&c.length<2?`(?:/${A})`:"/"+A),x&&(A+="?"),n+=A,p+=Qe.Dynamic,x&&(p+=Qe.BonusOptional),b&&(p+=Qe.BonusRepeatable),k===".*"&&(p+=Qe.BonusWildcard)}u.push(p)}r.push(u)}if(s.strict&&s.end){const c=r.length-1;r[c][r[c].length-1]+=Qe.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),d={};if(!u)return null;for(let f=1;f<u.length;f++){const p=u[f]||"",m=i[f-1];d[m.name]=p&&m.repeatable?p.split("/"):p}return d}function l(c){let u="",d=!1;for(const f of t){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const p of f)if(p.type===xs.Static)u+=p.value;else if(p.type===xs.Param){const{value:m,repeatable:b,optional:x}=p,y=m in c?c[m]:"";if(kt(y)&&!b)throw new Error(`Provided param "${m}" is an array but it is not repeatable (* or + modifiers)`);const k=kt(y)?y.join("/"):y;if(!k)if(x)f.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${m}"`);u+=k}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function Ff(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]===Qe.Static+Qe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===Qe.Static+Qe.Segment?1:-1:0}function Uc(t,e){let s=0;const r=t.score,n=e.score;for(;s<r.length&&s<n.length;){const i=Ff(r[s],n[s]);if(i)return i;s++}if(Math.abs(n.length-r.length)===1){if(ma(r))return 1;if(ma(n))return-1}return n.length-r.length}function ma(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Vf={strict:!1,end:!0,sensitive:!1};function qf(t,e,s){const r=Hf(Df(t.path),s),n=we(r,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function Wf(t,e){const s=[],r=new Map;e=la(Vf,e);function n(d){return r.get(d)}function i(d,f,p){const m=!p,b=ba(d);b.aliasOf=p&&p.record;const x=la(e,d),y=[b];if("alias"in d){const L=typeof d.alias=="string"?[d.alias]:d.alias;for(const N of L)y.push(ba(we({},b,{components:p?p.record.components:b.components,path:N,aliasOf:p?p.record:b})))}let k,A;for(const L of y){const{path:N}=L;if(f&&N[0]!=="/"){const $=f.record.path,E=$[$.length-1]==="/"?"":"/";L.path=f.record.path+(N&&E+N)}if(k=qf(L,f,x),p?p.alias.push(k):(A=A||k,A!==k&&A.alias.push(k),m&&d.name&&!ya(k)&&o(d.name)),Dc(k)&&l(k),b.children){const $=b.children;for(let E=0;E<$.length;E++)i($[E],k,p&&p.children[E])}p=p||k}return A?()=>{o(A)}:gr}function o(d){if(jc(d)){const f=r.get(d);f&&(r.delete(d),s.splice(s.indexOf(f),1),f.children.forEach(o),f.alias.forEach(o))}else{const f=s.indexOf(d);f>-1&&(s.splice(f,1),d.record.name&&r.delete(d.record.name),d.children.forEach(o),d.alias.forEach(o))}}function a(){return s}function l(d){const f=zf(d,s);s.splice(f,0,d),d.record.name&&!ya(d)&&r.set(d.record.name,d)}function c(d,f){let p,m={},b,x;if("name"in d&&d.name){if(p=r.get(d.name),!p)throw Js(Ie.MATCHER_NOT_FOUND,{location:d});x=p.record.name,m=we(va(f.params,p.keys.filter(A=>!A.optional).concat(p.parent?p.parent.keys.filter(A=>A.optional):[]).map(A=>A.name)),d.params&&va(d.params,p.keys.map(A=>A.name))),b=p.stringify(m)}else if(d.path!=null)b=d.path,p=s.find(A=>A.re.test(b)),p&&(m=p.parse(b),x=p.record.name);else{if(p=f.name?r.get(f.name):s.find(A=>A.re.test(f.path)),!p)throw Js(Ie.MATCHER_NOT_FOUND,{location:d,currentLocation:f});x=p.record.name,m=we({},f.params,d.params),b=p.stringify(m)}const y=[];let k=p;for(;k;)y.unshift(k.record),k=k.parent;return{name:x,path:b,params:m,matched:y,meta:Gf(y)}}t.forEach(d=>i(d));function u(){s.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:n}}function va(t,e){const s={};for(const r of e)r in t&&(s[r]=t[r]);return s}function ba(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Kf(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 Kf(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 ya(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Gf(t){return t.reduce((e,s)=>we(e,s.meta),{})}function zf(t,e){let s=0,r=e.length;for(;s!==r;){const i=s+r>>1;Uc(t,e[i])<0?r=i:s=i+1}const n=Jf(t);return n&&(r=e.lastIndexOf(n,r-1)),r}function Jf(t){let e=t;for(;e=e.parent;)if(Dc(e)&&Uc(t,e)===0)return e}function Dc({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function _a(t){const e=ft(Vn),s=ft(fo),r=$e(()=>{const l=Oe(t.to);return e.resolve(l)}),n=$e(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],d=s.matched;if(!u||!d.length)return-1;const f=d.findIndex(zs.bind(null,u));if(f>-1)return f;const p=wa(l[c-2]);return c>1&&wa(u)===p&&d[d.length-1].path!==p?d.findIndex(zs.bind(null,l[c-2])):f}),i=$e(()=>n.value>-1&&Qf(s.params,r.value.params)),o=$e(()=>n.value>-1&&n.value===s.matched.length-1&&Ic(s.params,r.value.params));function a(l={}){if(Zf(l)){const c=e[Oe(t.replace)?"replace":"push"](Oe(t.to)).catch(gr);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:$e(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function Yf(t){return t.length===1?t[0]:t}const Xf=gt({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:_a,setup(t,{slots:e}){const s=zt(_a(t)),{options:r}=ft(Vn),n=$e(()=>({[xa(t.activeClass,r.linkActiveClass,"router-link-active")]:s.isActive,[xa(t.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const i=e.default&&Yf(e.default(s));return t.custom?i:uo("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:n.value},i)}}}),Mc=Xf;function Zf(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 Qf(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(!kt(n)||n.length!==r.length||r.some((i,o)=>i.valueOf()!==n[o].valueOf()))return!1}return!0}function wa(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const xa=(t,e,s)=>t??e??s,ep=gt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const r=ft(Ii),n=$e(()=>t.route||r.value),i=ft(fa,0),o=$e(()=>{let c=Oe(i);const{matched:u}=n.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),a=$e(()=>n.value.matched[o.value]);sn(fa,$e(()=>o.value+1)),sn(Of,a),sn(Ii,n);const l=F();return us(()=>[l.value,a.value,t.name],([c,u,d],[f,p,m])=>{u&&(u.instances[d]=c,p&&p!==u&&c&&c===f&&(u.leaveGuards.size||(u.leaveGuards=p.leaveGuards),u.updateGuards.size||(u.updateGuards=p.updateGuards))),c&&u&&(!p||!zs(u,p)||!f)&&(u.enterCallbacks[d]||[]).forEach(b=>b(c))},{flush:"post"}),()=>{const c=n.value,u=t.name,d=a.value,f=d&&d.components[u];if(!f)return ka(s.default,{Component:f,route:c});const p=d.props[u],m=p?p===!0?c.params:typeof p=="function"?p(c):p:null,x=uo(f,we({},m,e,{onVnodeUnmounted:y=>{y.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return ka(s.default,{Component:x,route:c})||x}}});function ka(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Bc=ep;function tp(t){const e=Wf(t.routes,t),s=t.parseQuery||Cf,r=t.stringifyQuery||ha,n=t.history,i=tr(),o=tr(),a=tr(),l=qu(ns);let c=ns;Ls&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=li.bind(null,I=>""+I),d=li.bind(null,df),f=li.bind(null,Ar);function p(I,Q){let X,se;return jc(I)?(X=e.getRecordMatcher(I),se=Q):se=I,e.addRoute(se,X)}function m(I){const Q=e.getRecordMatcher(I);Q&&e.removeRoute(Q)}function b(){return e.getRoutes().map(I=>I.record)}function x(I){return!!e.getRecordMatcher(I)}function y(I,Q){if(Q=we({},Q||l.value),typeof I=="string"){const S=ci(s,I,Q.path),P=e.resolve({path:S.path},Q),U=n.createHref(S.fullPath);return we(S,P,{params:f(P.params),hash:Ar(S.hash),redirectedFrom:void 0,href:U})}let X;if(I.path!=null)X=we({},I,{path:ci(s,I.path,Q.path).path});else{const S=we({},I.params);for(const P in S)S[P]==null&&delete S[P];X=we({},I,{params:d(S)}),Q.params=d(Q.params)}const se=e.resolve(X,Q),ve=I.hash||"";se.params=u(f(se.params));const g=pf(r,we({},I,{hash:lf(ve),path:se.path})),v=n.createHref(g);return we({fullPath:g,hash:ve,query:r===ha?Rf(I.query):I.query||{}},se,{redirectedFrom:void 0,href:v})}function k(I){return typeof I=="string"?ci(s,I,l.value.path):we({},I)}function A(I,Q){if(c!==I)return Js(Ie.NAVIGATION_CANCELLED,{from:Q,to:I})}function L(I){return E(I)}function N(I){return L(we(k(I),{replace:!0}))}function $(I,Q){const X=I.matched[I.matched.length-1];if(X&&X.redirect){const{redirect:se}=X;let ve=typeof se=="function"?se(I,Q):se;return typeof ve=="string"&&(ve=ve.includes("?")||ve.includes("#")?ve=k(ve):{path:ve},ve.params={}),we({query:I.query,hash:I.hash,params:ve.path!=null?{}:I.params},ve)}}function E(I,Q){const X=c=y(I),se=l.value,ve=I.state,g=I.force,v=I.replace===!0,S=$(X,se);if(S)return E(we(k(S),{state:typeof S=="object"?we({},ve,S.state):ve,force:g,replace:v}),Q||X);const P=X;P.redirectedFrom=Q;let U;return!g&&gf(r,se,X)&&(U=Js(Ie.NAVIGATION_DUPLICATED,{to:P,from:se}),H(se,se,!0,!1)),(U?Promise.resolve(U):te(P,se)).catch(j=>Bt(j)?Bt(j,Ie.NAVIGATION_GUARD_REDIRECT)?j:Xe(j):me(j,P,se)).then(j=>{if(j){if(Bt(j,Ie.NAVIGATION_GUARD_REDIRECT))return E(we({replace:v},k(j.to),{state:typeof j.to=="object"?we({},ve,j.to.state):ve,force:g}),Q||P)}else j=V(P,se,!0,v,ve);return de(P,se,j),j})}function M(I,Q){const X=A(I,Q);return X?Promise.reject(X):Promise.resolve()}function B(I){const Q=K.values().next().value;return Q&&typeof Q.runWithContext=="function"?Q.runWithContext(I):I()}function te(I,Q){let X;const[se,ve,g]=$f(I,Q);X=di(se.reverse(),"beforeRouteLeave",I,Q);for(const S of se)S.leaveGuards.forEach(P=>{X.push(as(P,I,Q))});const v=M.bind(null,I,Q);return X.push(v),Le(X).then(()=>{X=[];for(const S of i.list())X.push(as(S,I,Q));return X.push(v),Le(X)}).then(()=>{X=di(ve,"beforeRouteUpdate",I,Q);for(const S of ve)S.updateGuards.forEach(P=>{X.push(as(P,I,Q))});return X.push(v),Le(X)}).then(()=>{X=[];for(const S of g)if(S.beforeEnter)if(kt(S.beforeEnter))for(const P of S.beforeEnter)X.push(as(P,I,Q));else X.push(as(S.beforeEnter,I,Q));return X.push(v),Le(X)}).then(()=>(I.matched.forEach(S=>S.enterCallbacks={}),X=di(g,"beforeRouteEnter",I,Q,B),X.push(v),Le(X))).then(()=>{X=[];for(const S of o.list())X.push(as(S,I,Q));return X.push(v),Le(X)}).catch(S=>Bt(S,Ie.NAVIGATION_CANCELLED)?S:Promise.reject(S))}function de(I,Q,X){a.list().forEach(se=>B(()=>se(I,Q,X)))}function V(I,Q,X,se,ve){const g=A(I,Q);if(g)return g;const v=Q===ns,S=Ls?history.state:{};X&&(se||v?n.replace(I.fullPath,we({scroll:v&&S&&S.scroll},ve)):n.push(I.fullPath,ve)),l.value=I,H(I,Q,X,v),Xe()}let q;function O(){q||(q=n.listen((I,Q,X)=>{if(!le.listening)return;const se=y(I),ve=$(se,le.currentRoute.value);if(ve){E(we(ve,{replace:!0,force:!0}),se).catch(gr);return}c=se;const g=l.value;Ls&&kf(da(g.fullPath,X.delta),Fn()),te(se,g).catch(v=>Bt(v,Ie.NAVIGATION_ABORTED|Ie.NAVIGATION_CANCELLED)?v:Bt(v,Ie.NAVIGATION_GUARD_REDIRECT)?(E(we(k(v.to),{force:!0}),se).then(S=>{Bt(S,Ie.NAVIGATION_ABORTED|Ie.NAVIGATION_DUPLICATED)&&!X.delta&&X.type===$i.pop&&n.go(-1,!1)}).catch(gr),Promise.reject()):(X.delta&&n.go(-X.delta,!1),me(v,se,g))).then(v=>{v=v||V(se,g,!1),v&&(X.delta&&!Bt(v,Ie.NAVIGATION_CANCELLED)?n.go(-X.delta,!1):X.type===$i.pop&&Bt(v,Ie.NAVIGATION_ABORTED|Ie.NAVIGATION_DUPLICATED)&&n.go(-1,!1)),de(se,g,v)}).catch(gr)}))}let ce=tr(),ge=tr(),ie;function me(I,Q,X){Xe(I);const se=ge.list();return se.length?se.forEach(ve=>ve(I,Q,X)):console.error(I),Promise.reject(I)}function We(){return ie&&l.value!==ns?Promise.resolve():new Promise((I,Q)=>{ce.add([I,Q])})}function Xe(I){return ie||(ie=!I,O(),ce.list().forEach(([Q,X])=>I?X(I):Q()),ce.reset()),I}function H(I,Q,X,se){const{scrollBehavior:ve}=t;if(!Ls||!ve)return Promise.resolve();const g=!X&&Sf(da(I.fullPath,0))||(se||!X)&&history.state&&history.state.scroll||null;return Es().then(()=>ve(I,Q,g)).then(v=>v&&xf(v)).catch(v=>me(v,I,Q))}const T=I=>n.go(I);let C;const K=new Set,le={currentRoute:l,listening:!0,addRoute:p,removeRoute:m,clearRoutes:e.clearRoutes,hasRoute:x,getRoutes:b,resolve:y,options:t,push:L,replace:N,go:T,back:()=>T(-1),forward:()=>T(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:ge.add,isReady:We,install(I){I.component("RouterLink",Mc),I.component("RouterView",Bc),I.config.globalProperties.$router=le,Object.defineProperty(I.config.globalProperties,"$route",{enumerable:!0,get:()=>Oe(l)}),Ls&&!C&&l.value===ns&&(C=!0,L(n.location).catch(se=>{}));const Q={};for(const se in ns)Object.defineProperty(Q,se,{get:()=>l.value[se],enumerable:!0});I.provide(Vn,le),I.provide(fo,Ol(Q)),I.provide(Ii,l);const X=I.unmount;K.add(I),I.unmount=function(){K.delete(I),K.size<1&&(c=ns,q&&q(),q=null,l.value=ns,C=!1,ie=!1),X()}}};function Le(I){return I.reduce((Q,X)=>Q.then(()=>B(X)),Promise.resolve())}return le}function Hc(){return ft(Vn)}function sp(t){return ft(fo)}function qn(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 rp(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(d){o(d)}}function l(u){try{c(r.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):n(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}const np=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class po 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 ip extends po{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Sa extends po{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Ea extends po{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var ji;(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"})(ji||(ji={}));class op{constructor(e,{headers:s={},customFetch:r,region:n=ji.Any}={}){this.url=e,this.headers=s,this.region=n,this.fetch=np(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return rp(this,arguments,void 0,function*(s,r={}){var n;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:d}=r;let f={},{region:p}=r;p||(p=this.region);const m=new URL(`${this.url}/${s}`);p&&p!=="any"&&(f["x-region"]=p,m.searchParams.set("forceFunctionRegion",p));let b;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",b=c):typeof c=="string"?(f["Content-Type"]="text/plain",b=c):typeof FormData<"u"&&c instanceof FormData?b=c:(f["Content-Type"]="application/json",b=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?b=JSON.stringify(c):b=c;let x=u;d&&(o=new AbortController,i=setTimeout(()=>o.abort(),d),u?(x=o.signal,u.addEventListener("abort",()=>o.abort())):x=o.signal);const y=yield this.fetch(m.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),a),body:b,signal:x}).catch(N=>{throw new ip(N)}),k=y.headers.get("x-relay-error");if(k&&k==="true")throw new Sa(y);if(!y.ok)throw new Ea(y);let A=((n=y.headers.get("Content-Type"))!==null&&n!==void 0?n:"text/plain").split(";")[0].trim(),L;return A==="application/json"?L=yield y.json():A==="application/octet-stream"||A==="application/pdf"?L=yield y.blob():A==="text/event-stream"?L=y:A==="multipart/form-data"?L=yield y.formData():L=yield y.text(),{data:L,error:null,response:y}}catch(a){return{data:null,error:a,response:a instanceof Ea||a instanceof Sa?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Fc=3,Ta=t=>Math.min(1e3*2**t,3e4),ap=[520,503],Vc=["GET","HEAD","OPTIONS"];var lp=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 Aa(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 cp(t,e,s,r){return!(!r||s>=Fc||!Vc.includes(t)||!ap.includes(e))}var up=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,(d,f)=>typeof f=="bigint"?f.toString():f),signal:s.signal})}catch(d){if((d==null?void 0:d.name)==="AbortError"||(d==null?void 0:d.code)==="ABORT_ERR"||!Vc.includes(s.method))throw d;if(s.retryEnabled&&o<Fc){const f=Ta(o);o++,await Aa(f,s.signal);continue}throw d}if(cp(s.method,u.status,o,s.retryEnabled)){var a,l;const d=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,f=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:Ta(o);await u.text(),o++,await Aa(f,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const d=o==null?void 0:o.cause;if(d){var f,p,m,b;const k=(f=d==null?void 0:d.message)!==null&&f!==void 0?f:"",A=(p=d==null?void 0:d.code)!==null&&p!==void 0?p:"";l=`${(m=o==null?void 0:o.name)!==null&&m!==void 0?m:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
30
-
31
- Caused by: ${(b=d==null?void 0:d.name)!==null&&b!==void 0?b:"Error"}: ${k}`,A&&(l+=` (${A})`),d!=null&&d.stack&&(l+=`
32
- ${d.stack}`)}else{var x;l=(x=o==null?void 0:o.stack)!==null&&x!==void 0?x:""}const y=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)",y>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${y} 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.`)):((d==null?void 0:d.name)==="HeadersOverflowError"||(d==null?void 0:d.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(c+=`. Your request URL is ${y} 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 f=await t.text();f===""||(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=f:r=JSON.parse(f))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),d=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&d&&d.length>1&&(n=parseInt(d[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 lp(s)}return{success:s===null,error:s,data:r,count:n,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},dp=class extends up{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 Ca=new RegExp("[,()]");var Us=class extends dp{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"&&Ca.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"&&Ca.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}},hp=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 Us({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 Us({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,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);a.searchParams.set("columns",u.join(","))}}return new Us({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 Us({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 Us({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 Cr(t){"@babel/helpers - typeof";return Cr=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},Cr(t)}function fp(t,e){if(Cr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(Cr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function pp(t){var e=fp(t,"string");return Cr(e)=="symbol"?e:e+""}function gp(t,e,s){return(e=pp(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 Wr(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){gp(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 mp=class qc{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 d=new AbortController,f=setTimeout(()=>d.abort(),i),p=u==null?void 0:u.signal;if(p){if(p.aborted)return clearTimeout(f),l(c,u);const m=()=>{clearTimeout(f),d.abort()};return p.addEventListener("abort",m,{once:!0}),l(c,Wr(Wr({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",m)})}return l(c,Wr(Wr({},u),{},{signal:d.signal})).finally(()=>clearTimeout(f))}: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 hp(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 qc(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=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(u)),d=r&&Object.values(s).some(u);d?(a="POST",c=s):r||n?(a=r?"HEAD":"GET",Object.entries(s).filter(([p,m])=>m!==void 0).map(([p,m])=>[p,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([p,m])=>{l.searchParams.append(p,m)})):(a="POST",c=s);const f=new Headers(this.headers);return d?f.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&f.set("Prefer",`count=${i}`),new Us({method:a,url:l,headers:f,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class vp{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
- import ws from "ws"
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
-
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 bp="2.105.4",yp=`realtime-js/${bp}`,_p="1.0.0",Wc="2.0.0",wp=Wc,xp=1e4,kp=100,ls={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Kc={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Ni={connecting:"connecting",closing:"closing",closed:"closed"};class Sp{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):{},d=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(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+d.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let m=new DataView(p),b=0;m.setUint8(b++,this.KINDS.userBroadcastPush),m.setUint8(b++,l.length),m.setUint8(b++,a.length),m.setUint8(b++,o.length),m.setUint8(b++,c.length),m.setUint8(b++,d.length),m.setUint8(b++,s),Array.from(l,y=>m.setUint8(b++,y.charCodeAt(0))),Array.from(a,y=>m.setUint8(b++,y.charCodeAt(0))),Array.from(o,y=>m.setUint8(b++,y.charCodeAt(0))),Array.from(c,y=>m.setUint8(b++,y.charCodeAt(0))),Array.from(d,y=>m.setUint8(b++,y.charCodeAt(0)));var x=new Uint8Array(p.byteLength+r.byteLength);return x.set(new Uint8Array(p),0),x.set(new Uint8Array(r),p.byteLength),x.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 d=r.decode(e.slice(l,l+o));l=l+o;const f=e.slice(l,e.byteLength),p=a===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,m={type:this.BROADCAST_EVENT,event:u,payload:p};return o>0&&(m.meta=JSON.parse(d)),{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 Ce;(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"})(Ce||(Ce={}));const Oa=(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]=Ep(o,t,e,n),i),{}):{}},Ep=(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)?Gc(i,o):Li(o)},Gc=(t,e)=>{if(t.charAt(0)==="_"){const s=t.slice(1,t.length);return Rp(e,s)}switch(t){case Ce.bool:return Tp(e);case Ce.float4:case Ce.float8:case Ce.int2:case Ce.int4:case Ce.int8:case Ce.numeric:case Ce.oid:return Ap(e);case Ce.json:case Ce.jsonb:return Cp(e);case Ce.timestamp:return Op(e);case Ce.abstime:case Ce.date:case Ce.daterange:case Ce.int4range:case Ce.int8range:case Ce.money:case Ce.reltime:case Ce.text:case Ce.time:case Ce.timestamptz:case Ce.timetz:case Ce.tsrange:case Ce.tstzrange:return Li(e);default:return Li(e)}},Li=t=>t,Tp=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Ap=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Cp=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Rp=(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=>Gc(e,a))}return t},Op=t=>typeof t=="string"?t.replace(" ","T"):t,zc=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 mr=t=>typeof t=="function"?t:function(){return t},$p=typeof self<"u"?self:null,Ds=typeof window<"u"?window:null,$t=$p||Ds||globalThis,Pp="2.0.0",Ip=1e4,jp=1e3,Nt={connecting:0,open:1,closing:2,closed:3},rt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Vt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ui={longpoll:"longpoll",websocket:"websocket"},Np={complete:4},Di="base64url.bearer.phx.",Kr=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})}},Jc=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))}},Lp=class{constructor(t,e,s){this.state=rt.closed,this.topic=t,this.params=mr(e||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Kr(this,Vt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Jc(()=>{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=rt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=rt.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=rt.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=rt.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 Kr(this,Vt.leave,mr({}),this.timeout).send(),this.state=rt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Vt.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=rt.closed,this.bindings=[]}onClose(t){this.on(Vt.close,t)}onError(t){return this.on(Vt.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 Kr(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=rt.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Vt.close,"leave")},s=new Kr(this,Vt.leave,mr({}),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=rt.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===rt.closed}isErrored(){return this.state===rt.errored}isJoined(){return this.state===rt.joined}isJoining(){return this.state===rt.joining}isLeaving(){return this.state===rt.leaving}},bn=class{static request(t,e,s,r,n,i,o){if($t.XDomainRequest){let a=new $t.XDomainRequest;return this.xdomainRequest(a,t,e,r,n,i,o)}else if($t.XMLHttpRequest){let a=new $t.XMLHttpRequest;return this.xhrRequest(a,t,e,s,r,n,i,o)}else{if($t.fetch&&$t.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),$t.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===Np.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)}`}},Up=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)},Os=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Di)&&(this.authToken=atob(e[1].slice(Di.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=Nt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ui.websocket),"$1/"+Ui.longpoll)}endpointURL(){return bn.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,s){this.close(t,e,s),this.readyState=Nt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Nt.open||this.readyState===Nt.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=Nt.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=Up(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=Nt.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=bn.request(t,this.endpointURL(),e,s,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&n(a)}),this.reqs.add(i)}},Dp=class ir{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=ir.syncState(this.state,n,i,o),this.pendingDiffs.forEach(l=>{this.state=ir.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=ir.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 ir.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 d=c.metas.map(b=>b.phx_ref),f=u.metas.map(b=>b.phx_ref),p=c.metas.filter(b=>f.indexOf(b.phx_ref)<0),m=u.metas.filter(b=>d.indexOf(b.phx_ref)<0);p.length>0&&(o[l]=c,o[l].metas=p),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(f=>f.phx_ref),d=c.metas.filter(f=>u.indexOf(f.phx_ref)<0);e[a].metas.unshift(...d)}r(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.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))}},Gr={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,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(s,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.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 d=s.decode(t.slice(a,a+o));a=a+o;let f=t.slice(a,t.byteLength),p={status:d,response:f};return{join_ref:l,ref:c,topic:u,event:Vt.reply,payload:p}},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}}},Mp=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||Ip,this.transport=e.transport||$t.WebSocket||Os,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=$t&&$t.sessionStorage}catch{}this.sessionStore=e.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=Gr.encode.bind(Gr),this.defaultDecoder=Gr.decode.bind(Gr),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!==Os?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;Ds&&Ds.addEventListener&&(Ds.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),Ds.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),Ds.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=mr(e.params||{}),this.endPoint=`${t}/${Ui.websocket}`,this.vsn=e.vsn||Pp,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Jc(()=>{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 Os}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=bn.appendParams(bn.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=mr(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Os?this.connectWithFallback(Os,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 Os:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Di}${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(),jp,"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===Nt.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(Vt.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case Nt.connecting:return"connecting";case Nt.open:return"open";case Nt.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 Lp(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 vr{constructor(e,s){const r=Hp(s);this.presence=new Dp(e.getChannel(),r),this.presence.onJoin((n,i,o)=>{const a=vr.onJoinPayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((n,i,o)=>{const a=vr.onLeavePayload(n,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return vr.transformState(this.presence.state)}static transformState(e){return e=Bp(e),Object.getOwnPropertyNames(e).reduce((s,r)=>{const n=e[r];return s[r]=on(n),s},{})}static onJoinPayload(e,s,r){const n=$a(s),i=on(r);return{event:"join",key:e,currentPresences:n,newPresences:i}}static onLeavePayload(e,s,r){const n=$a(s),i=on(r);return{event:"leave",key:e,currentPresences:n,leftPresences:i}}}function on(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Bp(t){return JSON.parse(JSON.stringify(t))}function Hp(t){return(t==null?void 0:t.events)&&{events:t.events}}function $a(t){return t!=null&&t.metas?on(t):[]}var Pa;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Pa||(Pa={}));class Fp{get state(){return this.presenceAdapter.state}constructor(e,s){this.channel=e,this.presenceAdapter=new vr(this.channel.channelAdapter,s)}}function Vp(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 qp{constructor(e,s,r){const n=Wp(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>kp){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===ls.joined}isJoined(){return this.state===ls.joined}isJoining(){return this.state===ls.joining}isClosed(){return this.state===ls.closed}isLeaving(){return this.state===ls.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Wp(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var Ia;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(Ia||(Ia={}));var Hs;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Hs||(Hs={}));var qt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(qt||(qt={}));class br{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 qp(this.socket.socketAdapter,e,this.params),this.presence=new Fp(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=zc(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(p=>p.filter))!==null&&n!==void 0?n:[],u=!!this.bindings[Hs.PRESENCE]&&this.bindings[Hs.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},f={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(p=>{e==null||e(qt.CHANNEL_ERROR,Vp(p))}),this._onClose(()=>e==null?void 0:e(qt.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(s).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){e==null||e(qt.SUBSCRIBED);return}this._updatePostgresBindings(p,e)}).receive("error",p=>{this.state=ls.errored;const m=Object.values(p).join(", ")||"error";e==null||e(qt.CHANNEL_ERROR,new Error(m,{cause:p}))}).receive("timeout",()=>{e==null||e(qt.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:d,filter:f}}=l,p=e&&e[a];if(p&&p.event===c&&br.isFilterValueEqual(p.schema,u)&&br.isFilterValueEqual(p.table,d)&&br.isFilterValueEqual(p.filter,f))o.push(Object.assign(Object.assign({},l),{id:p.id}));else{this.unsubscribe(),this.state=ls.errored,s==null||s(qt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=ls.errored&&s&&s(qt.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===Hs.PRESENCE||e===Hs.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 d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,r))return!1;const f=(n=this.bindings[d])===null||n===void 0?void 0:n.find(p=>p.ref===e.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in f){const p=f.id,m=(i=f.filter)===null||i===void 0?void 0:i.event;return p&&((o=s.ids)===null||o===void 0?void 0:o.includes(p))&&(m==="*"||(m==null?void 0:m.toLocaleLowerCase())===((a=s.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const p=(c=(l=f==null?void 0:f.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return p==="*"||p===((u=s==null?void 0:s.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,s){const{close:r,error:n,leave:i,join:o}=Kc;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=Oa(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(s.old=Oa(e.columns,e.old_record)),s}}class Kp{constructor(e,s){this.socket=new Mp(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()==Ni.connecting}isDisconnecting(){return this.socket.connectionState()==Ni.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ja={HEARTBEAT_INTERVAL:25e3},Gp=[1e3,2e3,5e3,1e4],zp=1e4;function Jp(){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 Yp(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Jp()}const Xp=`
38
- addEventListener("message", (e) => {
39
- if (e.data.event === "start") {
40
- setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
41
- }
42
- });`;class Zp{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,s){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new Sp,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=s==null?void 0:s.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey;const n=this._initializeOptions(s);this.socketAdapter=new Kp(e,n),this.httpEndpoint=zc(e),this.fetch=this._resolveFetch(s==null?void 0:s.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const s=e.message;throw s.includes("Node.js")?new Error(`${s}
43
-
44
- To use Realtime in Node.js, you need to provide a WebSocket implementation:
45
-
46
- Option 1: Use Node.js 22+ which has native WebSocket support
47
- Option 2: Install and provide the "ws" package:
48
-
49
- npm install ws
50
-
51
- import ws from "ws"
52
- const client = new RealtimeClient(url, {
53
- ...options,
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()||Ni.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 br(`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:yp};s&&n.updateJoinPayload(i),n.joinedOnce&&n.channelAdapter.isJoined()&&n.channelAdapter.push(Kc.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([Xp],{type:"application/javascript"});s=URL.createObjectURL(r)}return s}_initializeOptions(e){var s,r,n,i,o,a,l,c,u,d,f,p;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:xp,m.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:ja.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:ja.HEARTBEAT_INTERVAL),m.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:vp.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:Yp(),m.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:k=>Gp[k-1]||zp;let b,x;const y=(d=e==null?void 0:e.vsn)!==null&&d!==void 0?d:wp;switch(y){case _p:b=(k,A)=>A(JSON.stringify(k)),x=(k,A)=>A(JSON.parse(k));break;case Wc:b=this.serializer.encode.bind(this.serializer),x=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${m.vsn}`)}if(m.vsn=y,m.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:b,m.decode=(p=e==null?void 0:e.decode)!==null&&p!==void 0?p:x,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 Rr=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 Qp(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 eg(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 tg(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:s,path:r,query:n,body:i,headers:o}){const a=Qp(t.baseUrl,r,n),l=await eg(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(),d=(c.headers.get("content-type")||"").includes("application/json"),f=d&&u?JSON.parse(u):u;if(!c.ok){const p=d?f:void 0,m=p==null?void 0:p.error;throw new Rr((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:p})}return{status:c.status,headers:c.headers,data:f}}}}function zr(t){return t.join("")}var sg=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:zr(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/${zr(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${zr(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${zr(t.namespace)}`}),!0}catch(e){if(e instanceof Rr&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(s){if(s instanceof Rr&&s.status===409)return;throw s}}};function $s(t){return t.join("")}var rg=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/${$s(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/${$s(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/${$s(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/${$s(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/${$s(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/${$s(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(s){if(s instanceof Rr&&s.status===404)return!1;throw s}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(s){if(s instanceof Rr&&s.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw s}}},ng=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=tg({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new sg(this.client,e),this.tableOps=new rg(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 Or(t){"@babel/helpers - typeof";return Or=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},Or(t)}function ig(t,e){if(Or(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(Or(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function og(t){var e=ig(t,"string");return Or(e)=="symbol"?e:e+""}function ag(t,e,s){return(e=og(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function Na(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 ae(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(s),!0).forEach(function(r){ag(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Na(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}var Wn=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 Mi=class extends Wn{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 ae({},super.toJSON())}},Yc=class extends Wn{constructor(t,e,s="storage"){super(t,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function yn(t,e,s){const r=ae({},t),n=e.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===n&&delete r[i];return r[n]=s,r}function lg(t){const e={};for(const[s,r]of Object.entries(t))e[s.toLowerCase()]=r;return e}const cg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ug=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)},Bi=t=>{if(Array.isArray(t))return t.map(s=>Bi(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]=Bi(r)}),e},dg=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),La=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)},hg=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 Mi(La(o),i,a,r))}).catch(()=>{const o=i+"";e(new Mi(n.statusText||`HTTP ${i} error`,i,o,r))})}else e(new Yc(La(t),t,r))},fg=(t,e,s,r)=>{const n={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!r)return ae(ae({},n),s);if(ug(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=yn(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),ae(ae({},n),s)};async function sr(t,e,s,r,n,i,o){return new Promise((a,l)=>{t(s,fg(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=>hg(c,l,r,o))})}function Xc(t="storage"){return{get:async(e,s,r,n)=>sr(e,"GET",s,r,n,void 0,t),post:async(e,s,r,n,i)=>sr(e,"POST",s,n,i,r,t),put:async(e,s,r,n,i)=>sr(e,"PUT",s,n,i,r,t),head:async(e,s,r,n)=>sr(e,"HEAD",s,ae(ae({},r),{},{noResolveJson:!0}),n,void 0,t),remove:async(e,s,r,n,i)=>sr(e,"DELETE",s,n,i,r,t)}}const pg=Xc("storage"),{get:$r,post:vt,put:Hi,head:gg,remove:go}=pg,ot=Xc("vectors");var Ys=class{constructor(t,e={},s,r="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=lg(e),this.fetch=cg(s),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=yn(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}}},mg=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 Zc;Zc=Symbol.toStringTag;var vg=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Zc]="BlobDownloadBuilder",this.promise=null}asStream(){return new mg(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 bg={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Ua={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var yg=class extends Ys{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=ae(ae({},Ua),r);let a=ae(ae({},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[f,p]of Object.entries(r.headers))a=yn(a,f,p);const c=n._removeEmptyFolders(e),u=n._getFinalPath(c),d=await(t=="PUT"?Hi:vt)(n.fetch,`${n.url}/object/${u}`,i,ae({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:d.Id,fullPath:d.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=ae(ae({},Ua),r);let u=ae(ae({},n.headers),{"x-upsert":String(c.upsert)});const d=c.metadata;if(typeof Blob<"u"&&s instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),d&&l.append("metadata",n.encodeMetadata(d)),l.append("",s)):typeof FormData<"u"&&s instanceof FormData?(l=s,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),d&&!l.has("metadata")&&l.append("metadata",n.encodeMetadata(d))):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,d&&(u["x-metadata"]=n.toBase64(n.encodeMetadata(d))),(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[f,p]of Object.entries(r.headers))u=yn(u,f,p);return{path:i,fullPath:(await Hi(n.fetch,a.toString(),l,ae({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=ae({},s.headers);e!=null&&e.upsert&&(n["x-upsert"]="true");const i=await vt(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 Wn("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 vt(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 vt(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 vt(r.fetch,`${r.url}/object/sign/${n}`,ae({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 vt(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=>ae(ae({},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=()=>$r(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new vg(a,this.shouldThrowOnError)}async info(t){var e=this;const s=e._getFinalPath(t);return e.handleOperation(async()=>Bi(await $r(e.fetch,`${e.url}/object/info/${s}`,{headers:e.headers})))}async exists(t){var e=this;const s=e._getFinalPath(t);try{return await gg(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 Mi?n.status:n instanceof Yc?(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 go(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=ae(ae(ae({},bg),e),{},{prefix:t||""});return await vt(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=ae({},t);return await vt(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 _g="2.105.4",Mr={"X-Client-Info":`storage-js/${_g}`};var wg=class extends Ys{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=ae(ae({},Mr),e);super(i,o,s,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const s=e.listBucketOptionsToQueryString(t);return await $r(e.fetch,`${e.url}/bucket${s}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await $r(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var s=this;return s.handleOperation(async()=>await vt(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 Hi(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 vt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await go(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():""}},xg=class extends Ys{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=ae(ae({},Mr),e);super(r,n,s,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await vt(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 $r(e.fetch,n,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await go(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!dg(t))throw new Wn("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 ng({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}}}}})}},kg=class extends Ys{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=ae(ae({},Mr),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var s=this;return s.handleOperation(async()=>await ot.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var s=this;return s.handleOperation(async()=>await ot.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:s.headers})||{})}},Sg=class extends Ys{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=ae(ae({},Mr),{},{"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 ot.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await ot.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 ot.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await ot.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 ot.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},Eg=class extends Ys{constructor(t,e={},s){const r=t.replace(/\/$/,""),n=ae(ae({},Mr),{},{"Content-Type":"application/json"},e);super(r,n,s,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},Tg=class extends Eg{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new Ag(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)}},Ag=class extends kg{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,ae(ae({},t),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,s=this;return e().call(s,ae(ae({},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 Cg(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},Cg=class extends Sg{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,ae(ae({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(t){var e=()=>super.getVectors,s=this;return e().call(s,ae(ae({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,s=this;return e().call(s,ae(ae({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,s=this;return e().call(s,ae(ae({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,s=this;return e().call(s,ae(ae({},t),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},Rg=class extends wg{constructor(t,e={},s,r){super(t,e,s,r)}from(t){return new yg(this.url,this.headers,t,this.fetch)}get vectors(){return new Tg(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new xg(this.url+"/iceberg",this.headers,this.fetch)}};const Qc="2.105.4",Ms=30*1e3,Fi=3,hi=Fi*Ms,Og="http://localhost:9999",$g="supabase.auth.token",Pg={"X-Client-Info":`gotrue-js/${Qc}`},Vi="X-Supabase-Api-Version",eu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Ig=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,jg=10*60*1e3;class Pr 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 z(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Ng extends Pr{constructor(e,s,r){super(e,s,r),this.name="AuthApiError",this.status=s,this.code=r}}function Lg(t){return z(t)&&t.name==="AuthApiError"}class bt extends Pr{constructor(e,s){super(e),this.name="AuthUnknownError",this.originalError=s}}class ss extends Pr{constructor(e,s,r,n){super(e,r,n),this.name=s,this.status=r}}class Ve extends ss{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Jr(t){return z(t)&&t.name==="AuthSessionMissingError"}class Ps extends ss{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Yr extends ss{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Xr extends ss{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 Ug(t){return z(t)&&t.name==="AuthImplicitGrantRedirectError"}class Da extends ss{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 Dg extends ss{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 qi extends ss{constructor(e,s){super(e,"AuthRetryableFetchError",s,void 0)}}function fi(t){return z(t)&&t.name==="AuthRetryableFetchError"}class Ma extends ss{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 Wi extends ss{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const _n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Ba=`
56
- \r=`.split(""),Mg=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<Ba.length;e+=1)t[Ba[e].charCodeAt(0)]=-2;for(let e=0;e<_n.length;e+=1)t[_n[e].charCodeAt(0)]=e;return t})();function Ha(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(_n[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(_n[r]),e.queuedBits-=6}}function tu(t,e,s){const r=Mg[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 Fa(t){const e=[],s=o=>{e.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},i=o=>{Fg(o,r,s)};for(let o=0;o<t.length;o+=1)tu(t.charCodeAt(o),n,i);return e.join("")}function Bg(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 Hg(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}Bg(r,e)}}function Fg(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 Ks(t){const e=[],s={queue:0,queuedBits:0},r=n=>{e.push(n)};for(let n=0;n<t.length;n+=1)tu(t.charCodeAt(n),s,r);return new Uint8Array(e)}function Vg(t){const e=[];return Hg(t,s=>e.push(s)),new Uint8Array(e)}function ks(t){const e=[],s={queue:0,queuedBits:0},r=n=>{e.push(n)};return t.forEach(n=>Ha(n,s,r)),Ha(null,s,r),e.join("")}function qg(t){return Math.round(Date.now()/1e3)+t}function Wg(){return Symbol("auth-callback")}const ze=()=>typeof window<"u"&&typeof document<"u",ms={tested:!1,writable:!1},su=()=>{if(!ze())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ms.tested)return ms.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ms.tested=!0,ms.writable=!0}catch{ms.tested=!0,ms.writable=!1}return ms.writable};function Kg(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 ru=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Gg=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Bs=async(t,e,s)=>{await t.setItem(e,JSON.stringify(s))},vs=async(t,e)=>{const s=await t.getItem(e);if(!s)return null;try{return JSON.parse(s)}catch{return null}},Ge=async(t,e)=>{await t.removeItem(e)};class Gn{constructor(){this.promise=new Gn.promiseConstructor((e,s)=>{this.resolve=e,this.reject=s})}}Gn.promiseConstructor=Promise;function Zr(t){const e=t.split(".");if(e.length!==3)throw new Wi("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!Ig.test(e[r]))throw new Wi("JWT not in base64url format");return{header:JSON.parse(Fa(e[0])),payload:JSON.parse(Fa(e[1])),signature:Ks(e[2]),raw:{header:e[0],payload:e[1]}}}async function zg(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Jg(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 Yg(t){return("0"+t.toString(16)).substr(-2)}function Xg(){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,Yg).join("")}async function Zg(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 Qg(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 Zg(t);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Is(t,e,s=!1){const r=Xg();let n=r;s&&(n+="/recovery"),await Bs(t,`${e}-code-verifier`,n);const i=await Qg(r);return[i,r===i?"plain":"s256"]}const em=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function tm(t){const e=t.headers.get(Vi);if(!e||!e.match(em))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function sm(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 rm(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 nm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ht(t){if(!nm.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function mt(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 pi(){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 im(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 Va(t){return JSON.parse(JSON.stringify(t))}const ys=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)},om=[502,503,504,520,521,522,523,524,530];async function qa(t){var e;if(!Gg(t))throw new qi(ys(t),0);if(om.includes(t.status))throw new qi(ys(t),t.status);let s;try{s=await t.json()}catch(i){throw new bt(ys(i),i)}let r;const n=tm(t);if(n&&n.getTime()>=eu["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 Ma(ys(s),t.status,((e=s.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Ve}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 Ma(ys(s),t.status,s.weak_password.reasons);throw new Ng(ys(s),t.status||500,r)}const am=(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 ee(t,e,s,r){var n;const i=Object.assign({},r==null?void 0:r.headers);i[Vi]||(i[Vi]=eu["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 lm(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 lm(t,e,s,r,n,i){const o=am(e,r,n,i);let a;try{a=await t(s,Object.assign({},o))}catch(l){throw console.error(l),new qi(ys(l),0)}if(a.ok||await qa(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await qa(l)}}function ht(t){var e;let s=null;dm(t)&&(s=Object.assign({},t),t.expires_at||(s.expires_at=qg(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:s,user:r},error:null}}function Wa(t){const e=ht(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 cs(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function cm(t){return{data:t,error:null}}function um(t){const{action_link:e,email_otp:s,hashed_token:r,redirect_to:n,verification_type:i}=t,o=qn(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 Ka(t){return t}function dm(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const gi=["global","local","others"];class hm{constructor({url:e="",headers:s={},fetch:r,experimental:n}){this.url=e,this.headers=s,this.fetch=ru(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=gi[0]){if(gi.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${gi.join(", ")}`);try{return await ee(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(z(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,s={}){try{return await ee(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:cs})}catch(r){if(z(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:s}=e,r=qn(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 ee(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:um,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(z(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(e){try{return await ee(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:cs})}catch(s){if(z(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 ee(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:Ka});if(u.error)throw u.error;const d=await u.json(),f=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(m=>{const b=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(m.split(";")[1].split("=")[1]);c[`${x}Page`]=b}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(z(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Ht(e);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:cs})}catch(s){if(z(s))return{data:{user:null},error:s};throw s}}async updateUserById(e,s){Ht(e);try{return await ee(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:s,headers:this.headers,xform:cs})}catch(r){if(z(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,s=!1){Ht(e);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:s},xform:cs})}catch(r){if(z(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Ht(e.userId);try{const{data:s,error:r}=await ee(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(z(s))return{data:null,error:s};throw s}}async _deleteFactor(e){Ht(e.userId),Ht(e.id);try{return{data:await ee(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(s){if(z(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 ee(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:Ka});if(u.error)throw u.error;const d=await u.json(),f=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(m=>{const b=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),x=JSON.parse(m.split(";")[1].split("=")[1]);c[`${x}Page`]=b}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(z(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(z(s))return{data:null,error:s};throw s}}async _getOAuthClient(e){try{return await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(z(s))return{data:null,error:s};throw s}}async _updateOAuthClient(e,s){try{return await ee(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(z(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(z(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(e){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(z(s))return{data:null,error:s};throw s}}async _listCustomProviders(e){try{const s={};return e!=null&&e.type&&(s.type=e.type),await ee(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(z(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(e){try{return await ee(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(z(s))return{data:null,error:s};throw s}}async _getCustomProvider(e){try{return await ee(this.fetch,"GET",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(z(s))return{data:null,error:s};throw s}}async _updateCustomProvider(e,s){try{return await ee(this.fetch,"PUT",`${this.url}/admin/custom-providers/${e}`,{body:s,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(z(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(e){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(z(s))return{data:null,error:s};throw s}}async _adminListPasskeys(e){mt(this.experimental),Ht(e.userId);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(z(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(e){mt(this.experimental),Ht(e.userId),Ht(e.passkeyId);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(z(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 Ct={debug:!!(globalThis&&su()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class nu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class za extends nu{}async function fm(t,e,s){Ct.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;let n;e>0&&(n=setTimeout(()=>{r.abort(),Ct.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),Ct.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await s()}finally{Ct.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Ct.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new za(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Ct.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 Ct.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){Ct.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await s()}finally{Ct.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 Ct.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new za(`Lock "${t}" was released because another request stole it`)}throw i}}function pm(){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 iu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function gm(t){return parseInt(t,16)}function mm(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function vm(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:d,version:f}=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(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);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 p=iu(t.address),m=u?`${u}://${r}`:r,b=t.statement?`${t.statement}
58
- `:"",x=`${m} wants you to sign in with your Ethereum account:
59
- ${p}
60
-
61
- ${b}`;let y=`URI: ${d}
62
- Version: ${f}
63
- Chain ID: ${s}${o?`
64
- Nonce: ${o}`:""}
65
- Issued At: ${i.toISOString()}`;if(n&&(y+=`
66
- Expiration Time: ${n.toISOString()}`),a&&(y+=`
67
- Not Before: ${a.toISOString()}`),l&&(y+=`
68
- Request ID: ${l}`),c){let k=`
69
- Resources:`;for(const A of c){if(!A||typeof A!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${A}`);k+=`
70
- - ${A}`}y+=k}return`${x}
71
- ${y}`}class De 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 wn extends De{constructor(e,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:e}),this.name="WebAuthnUnknownError",this.originalError=s}}function bm({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 De({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 De({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 De({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 De({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 De({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new De({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 De({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new De({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(ou(o)){if(i.rp.id!==o)return new De({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new De({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 De({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 De({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 De({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function ym({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 De({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new De({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(ou(r)){if(s.rpId!==r)return new De({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new De({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new De({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 De({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class _m{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 Ki=new _m;function Ja(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=qn(t,["challenge","user","excludeCredentials"]),i=Ks(e).buffer,o=Object.assign(Object.assign({},s),{id:Ks(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:Ks(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Ya(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=qn(t,["challenge","allowCredentials"]),n=Ks(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:Ks(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function Xa(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:ks(new Uint8Array(t.response.attestationObject)),clientDataJSON:ks(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Za(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:ks(new Uint8Array(n.authenticatorData)),clientDataJSON:ks(new Uint8Array(n.clientDataJSON)),signature:ks(new Uint8Array(n.signature)),userHandle:n.userHandle?ks(new Uint8Array(n.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=s.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function ou(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function xn(){var t,e;return!!(ze()&&"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 au(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new wn("Browser returned unexpected credential type",e)}:{data:null,error:new wn("Empty credential response",e)}}catch(e){return{data:null,error:bm({error:e,options:t})}}}async function lu(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new wn("Browser returned unexpected credential type",e)}:{data:null,error:new wn("Empty credential response",e)}}catch(e){return{data:null,error:ym({error:e,options:t})}}}const wm={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},xm={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function kn(...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]=kn(a,o):r[i]=kn(o)}else r[i]=o}return r}function km(t,e){return kn(wm,t,e||{})}function Sm(t,e){return kn(xm,t,e||{})}class Em{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??Ki.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const d=r;if(d)u.name=`${u.id}:${d}`;else{const p=(await this.client.getUser()).data.user,m=((o=p==null?void 0:p.user_metadata)===null||o===void 0?void 0:o.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";u.name=`${u.id}:${m}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=km(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:f}=await au({publicKey:u,signal:c});return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=Sm(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:f}=await lu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(a){return z(a)?{data:null,error:a}:{data:null,error:new bt("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 Pr("rpId is required for WebAuthn authentication")};try{if(!xn())return{data:null,error:new bt("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 z(o)?{data:null,error:o}:{data:null,error:new bt("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 Pr("rpId is required for WebAuthn registration")};try{if(!xn())return{data:null,error:new bt("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 d;return(d=u.data)===null||d===void 0?void 0:d.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.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 z(o)?{data:null,error:o}:{data:null,error:new bt("Unexpected error in register",o)}}}}pm();const Tm={url:Og,storageKey:$g,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Pg,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Qa(t,e,s){return await s()}const js={};class Ir{get jwks(){var e,s;return(s=(e=js[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(e){js[this.storageKey]=Object.assign(Object.assign({},js[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,s;return(s=(e=js[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){js[this.storageKey]=Object.assign(Object.assign({},js[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({},Tm),e);if(this.storageKey=o.storageKey,this.instanceID=(s=Ir.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Ir.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&ze()){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 hm({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=ru(o.fetch),this.lock=o.lock||Qa,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&&ze()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=fm:this.lock=Qa,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 Em(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:su()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Ga(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=Ga(this.memoryStorage)),ze()&&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} (${Qc}) ${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(ze()&&(s=Kg(window.location.href),this._isImplicitGrantCallback(s)?r="implicit":await this._isPKCECallback(s)&&(r="pkce")),ze()&&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),Ug(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 z(s)?this._returnResult({error:s}):this._returnResult({error:new bt("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var s,r,n;try{const i=await ee(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:ht}),{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(z(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:d,options:f}=e;let p=null,m=null;this.flowType==="pkce"&&([p,m]=await Is(this.storage,this.storageKey)),i=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:d,data:(s=f==null?void 0:f.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:m},xform:ht})}else if("phone"in e){const{phone:u,password:d,options:f}=e;i=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(n=f==null?void 0:f.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:ht})}else throw new Yr("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Ge(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 Ge(this.storage,`${this.storageKey}-code-verifier`),z(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 ee(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:Wa})}else if("phone"in e){const{phone:i,password:o,options:a}=e;s=await ee(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:Wa})}else throw new Yr("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 Ps;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(z(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,d,f;let p,m;if("message"in e)p=e.message,m=e.signature;else{const{chain:b,wallet:x,statement:y,options:k}=e;let A;if(ze())if(typeof x=="object")A=x;else{const B=window;if("ethereum"in B&&typeof B.ethereum=="object"&&"request"in B.ethereum&&typeof B.ethereum.request=="function")A=B.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 x!="object"||!(k!=null&&k.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");A=x}const L=new URL((s=k==null?void 0:k.url)!==null&&s!==void 0?s:window.location.href),N=await A.request({method:"eth_requestAccounts"}).then(B=>B).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!N||N.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const $=iu(N[0]);let E=(r=k==null?void 0:k.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!E){const B=await A.request({method:"eth_chainId"});E=gm(B)}const M={domain:L.host,address:$,statement:y,uri:L.href,version:"1",chainId:E,nonce:(n=k==null?void 0:k.signInWithEthereum)===null||n===void 0?void 0:n.nonce,issuedAt:(o=(i=k==null?void 0:k.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=k==null?void 0:k.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=k==null?void 0:k.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=k==null?void 0:k.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=k==null?void 0:k.signInWithEthereum)===null||u===void 0?void 0:u.resources};p=vm(M),m=await A.request({method:"personal_sign",params:[mm(p),$]})}try{const{data:b,error:x}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:m},!((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:ht});if(x)throw x;if(!b||!b.session||!b.user){const y=new Ps;return this._returnResult({data:{user:null,session:null},error:y})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:x})}catch(b){if(z(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async signInWithSolana(e){var s,r,n,i,o,a,l,c,u,d,f,p;let m,b;if("message"in e)m=e.message,b=e.signature;else{const{chain:x,wallet:y,statement:k,options:A}=e;let L;if(ze())if(typeof y=="object")L=y;else{const $=window;if("solana"in $&&typeof $.solana=="object"&&("signIn"in $.solana&&typeof $.solana.signIn=="function"||"signMessage"in $.solana&&typeof $.solana.signMessage=="function"))L=$.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 y!="object"||!(A!=null&&A.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");L=y}const N=new URL((s=A==null?void 0:A.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in L&&L.signIn){const $=await L.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},A==null?void 0:A.signInWithSolana),{version:"1",domain:N.host,uri:N.href}),k?{statement:k}:null));let E;if(Array.isArray($)&&$[0]&&typeof $[0]=="object")E=$[0];else if($&&typeof $=="object"&&"signedMessage"in $&&"signature"in $)E=$;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in E&&"signature"in E&&(typeof E.signedMessage=="string"||E.signedMessage instanceof Uint8Array)&&E.signature instanceof Uint8Array)m=typeof E.signedMessage=="string"?E.signedMessage:new TextDecoder().decode(E.signedMessage),b=E.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in L)||typeof L.signMessage!="function"||!("publicKey"in L)||typeof L!="object"||!L.publicKey||!("toBase58"in L.publicKey)||typeof L.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${N.host} wants you to sign in with your Solana account:`,L.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${N.href}`,`Issued At: ${(n=(r=A==null?void 0:A.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&n!==void 0?n:new Date().toISOString()}`,...!((i=A==null?void 0:A.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${A.signInWithSolana.notBefore}`]:[],...!((o=A==null?void 0:A.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${A.signInWithSolana.expirationTime}`]:[],...!((a=A==null?void 0:A.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${A.signInWithSolana.chainId}`]:[],...!((l=A==null?void 0:A.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${A.signInWithSolana.nonce}`]:[],...!((c=A==null?void 0:A.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${A.signInWithSolana.requestId}`]:[],...!((d=(u=A==null?void 0:A.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...A.signInWithSolana.resources.map(E=>`- ${E}`)]:[]].join(`
72
- `);const $=await L.signMessage(new TextEncoder().encode(m),"utf8");if(!$||!($ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");b=$}}try{const{data:x,error:y}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:ks(b)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:ht});if(y)throw y;if(!x||!x.session||!x.user){const k=new Ps;return this._returnResult({data:{user:null,session:null},error:k})}return x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("SIGNED_IN",x.session)),this._returnResult({data:Object.assign({},x),error:y})}catch(x){if(z(x))return this._returnResult({data:{user:null,session:null},error:x});throw x}}async _exchangeCodeForSession(e){const s=await vs(this.storage,`${this.storageKey}-code-verifier`),[r,n]=(s??"").split("/");try{if(!r&&this.flowType==="pkce")throw new Dg;const{data:i,error:o}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:ht});if(await Ge(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Ps;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 Ge(this.storage,`${this.storageKey}-code-verifier`),z(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 ee(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:ht}),{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 Ps;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(z(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 Is(this.storage,this.storageKey));const{error:d}=await ee(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:d})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await ee(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 Yr("You must provide either an email or phone number.")}catch(a){if(await Ge(this.storage,`${this.storageKey}-code-verifier`),z(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 ee(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:n,xform:ht});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(z(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 Is(this.storage,this.storageKey));const c=await ee(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:cm});return!((i=c.data)===null||i===void 0)&&i.url&&ze()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Ge(this.storage,`${this.storageKey}-code-verifier`),z(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 Ve;const{error:n}=await ee(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(z(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 ee(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 ee(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 Yr("You must provide either an email or phone number and a type")}catch(s){if(z(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 vs(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()<hi:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const o=await vs(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=pi()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=im(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 ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:cs}):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 Ve}:await ee(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:cs})})}catch(s){if(z(s))return Jr(s)&&(await this._removeSession(),await Ge(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 Ve;const o=n.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Is(this.storage,this.storageKey));const{data:c,error:u}=await ee(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:cs});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 Ge(this.storage,`${this.storageKey}-code-verifier`),z(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 Ve;const s=Date.now()/1e3;let r=s,n=!0,i=null;const{payload:o}=Zr(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(z(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 Ve;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(z(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(e,s){var r;try{if(!ze())throw new Xr("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Xr(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 Da("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Xr("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 Da("No code detected.");const{data:A,error:L}=await this._exchangeCodeForSession(e.code);if(L)throw L;const N=new URL(window.location.href);return N.searchParams.delete("code"),window.history.replaceState(window.history.state,"",N.toString()),{data:{session:A.session,redirectType:(r=A.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 Xr("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(l);let p=d+f;c&&(p=parseInt(c));const m=p-d;m*1e3<=Ms&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${m}s, should have been closer to ${f}s`);const b=p-f;d-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,p,d):d-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,p,d);const{data:x,error:y}=await this._getUser(o);if(y)throw y;const k={provider_token:n,provider_refresh_token:i,access_token:o,expires_in:f,expires_at:p,refresh_token:a,token_type:u,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:k,redirectType:e.type},error:null})}catch(n){if(z(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 vs(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&&!(Lg(a)&&(a.status===404||a.status===401||a.status===403)||Jr(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await Ge(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const s=Wg(),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 Is(this.storage,this.storageKey,!0));try{return await ee(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 Ge(this.storage,`${this.storageKey}-code-verifier`),z(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(z(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:d,error:f}=i;if(f)throw f;const p=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 ee(this.fetch,"GET",p,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(n)throw n;return ze()&&!(!((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(z(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,d=await ee(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:ht}),{data:f,error:p}=d;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new Ps}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(n){if(await Ge(this.storage,`${this.storageKey}-code-verifier`),z(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 ee(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(z(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 Jg(async n=>(n>0&&await zg(200*Math.pow(2,n-1)),this._debug(s,"refreshing attempt",n),await ee(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ht})),(n,i)=>{const o=200*Math.pow(2,n);return i&&fi(i)&&Date.now()+o-r<Ms})}catch(r){if(this._debug(s,"error",r),z(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),ze()&&!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 vs(this.storage,this.storageKey);if(n&&this.userStorage){let o=await vs(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:n.user},await Bs(this.userStorage,this.storageKey+"-user",o)),n.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:pi()}else if(n&&!n.user&&!n.user){const o=await vs(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(n.user=o.user,await Ge(this.storage,this.storageKey+"-user"),await Bs(this.storage,this.storageKey,n)):n.user=pi()}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()<hi;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${hi}s`),i){if(this.autoRefreshToken&&n.refresh_token){const{error:o}=await this._callRefreshToken(n.refresh_token);o&&(console.error(o),fi(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 Ve;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const n=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Gn;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Ve;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),z(i)){const o={data:null,error:i};return fi(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 Ge(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 Bs(this.userStorage,this.storageKey+"-user",{user:s.user});const n=Object.assign({},s);delete n.user;const i=Va(n);await Bs(this.storage,this.storageKey,i)}else{const n=Va(s);await Bs(this.storage,this.storageKey,n)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Ge(this.storage,this.storageKey),await Ge(this.storage,this.storageKey+"-code-verifier"),await Ge(this.storage,this.storageKey+"-user"),this.userStorage&&await Ge(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&ze()&&(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(),Ms);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)/Ms);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${Ms}ms, refresh threshold is ${Fi} ticks`),n<=Fi&&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 nu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!ze()||!(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 Is(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 ee(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(z(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 ee(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(z(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"?Xa(e.webauthn.credential_response):Za(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await ee(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(z(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 ee(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:Ja(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:Ya(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(z(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:p}=Zr(e);let m=null;p.aal&&(m=p.aal);let b=m;const{data:{user:x},error:y}=await this.getUser(e);if(y)return this._returnResult({data:null,error:y});((r=(s=x==null?void 0:x.factors)===null||s===void 0?void 0:s.filter(L=>L.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(b="aal2");const A=p.amr||[];return{data:{currentLevel:m,nextLevel:b,currentAuthenticationMethods:A},error:null}}catch(p){if(z(p))return this._returnResult({data:null,error:p});throw p}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}=Zr(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(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const f=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:f},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 ee(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 Ve})})}catch(s){if(z(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 Ve});const o=await ee(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&&ze()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(z(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 Ve});const o=await ee(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&&ze()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(z(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 ee(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 Ve})})}catch(e){if(z(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 ee(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 Ve})})}catch(s){if(z(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+jg>n)return r;const{data:i,error:o}=await ee(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:p,error:m}=await this.getSession();if(m||!p.session)return this._returnResult({data:null,error:m});r=p.session.access_token}const{header:n,payload:i,signature:o,raw:{header:a,payload:l}}=Zr(r);s!=null&&s.allowExpired||sm(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:p}=await this.getUser(r);if(p)throw p;return{data:{claims:i,header:n,signature:o},error:null}}const u=rm(n.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,o,Vg(`${a}.${l}`)))throw new Wi("Invalid JWT signature");return{data:{claims:i,header:n,signature:o},error:null}}catch(r){if(z(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(e){var s,r,n;mt(this.experimental);try{if(!xn())return this._returnResult({data:null,error:new bt("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=Ya(i.options),l=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Ki.createNewAbortSignal(),{data:c,error:u}=await lu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new bt("WebAuthn ceremony failed",null)});const d=Za(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:d})}catch(i){if(z(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var s,r;mt(this.experimental);try{if(!xn())return this._returnResult({data:null,error:new bt("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=Ja(n.options),a=(r=(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.signal)!==null&&r!==void 0?r:Ki.createNewAbortSignal(),{data:l,error:c}=await au({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new bt("WebAuthn ceremony failed",null)});const u=Xa(l);return this._verifyPasskeyRegistration({challengeId:n.challenge_id,credential:u})}catch(n){if(z(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyRegistration(){mt(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 Ve});const{data:n,error:i}=await ee(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(z(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){mt(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 Ve});const{data:i,error:o}=await ee(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(z(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(e){var s;mt(this.experimental);try{const{data:r,error:n}=await ee(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(z(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(e){mt(this.experimental);try{const{data:s,error:r}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:ht});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(z(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){mt(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 Ve});const{data:n,error:i}=await ee(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(z(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){mt(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 Ve});const{data:i,error:o}=await ee(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(z(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(e){mt(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 Ve});const{error:i}=await ee(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(z(s))return this._returnResult({data:null,error:s});throw s}}}Ir.nextInstanceID={};const Am=Ir,Cm="2.105.4";let or="";typeof Deno<"u"?or="deno":typeof document<"u"?or="web":typeof navigator<"u"&&navigator.product==="ReactNative"?or="react-native":or="node";const Rm={"X-Client-Info":`supabase-js-${or}/${Cm}`},Om={headers:Rm},$m={schema:"public"},Pm={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Im={};function jr(t){"@babel/helpers - typeof";return jr=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},jr(t)}function jm(t,e){if(jr(t)!="object"||!t)return t;var s=t[Symbol.toPrimitive];if(s!==void 0){var r=s.call(t,e);if(jr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nm(t){var e=jm(t,"string");return jr(e)=="symbol"?e:e+""}function Lm(t,e,s){return(e=Nm(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function el(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 je(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?el(Object(s),!0).forEach(function(r){Lm(t,r,s[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):el(Object(s)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(s,r))})}return t}const Um=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Dm=()=>Headers,Mm=(t,e,s)=>{const r=Um(s),n=Dm();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,je(je({},o),{},{headers:c}))}};function Bm(t){return t.endsWith("/")?t:t+"/"}function Hm(t,e){var s,r;const{db:n,auth:i,realtime:o,global:a}=t,{db:l,auth:c,realtime:u,global:d}=e,f={db:je(je({},l),n),auth:je(je({},c),i),realtime:je(je({},u),o),storage:{},global:je(je(je({},d),a),{},{headers:je(je({},(s=d==null?void 0:d.headers)!==null&&s!==void 0?s:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function Fm(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(Bm(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Vm=class extends Am{constructor(t){super(t)}},qm=class{constructor(t,e,s){var r,n;this.supabaseUrl=t,this.supabaseKey=e;const i=Fm(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:$m,realtime:Im,auth:je(je({},Pm),{},{storageKey:o}),global:Om},l=Hm(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,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} 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=Mm(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(je({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 mp(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 Rg(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new op(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:d,skipAutoInitialize:f},p,m){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Vm({url:this.authUrl.href,headers:je(je({},b),p),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:d,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(x=>x.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Zp(this.realtimeUrl.href,je(je({},t),{},{params:je(je({},{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 Wm=(t,e,s)=>new qm(t,e,s);function Km(){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}Km()&&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 Qr=null,en=null;async function cu(){if(en)return en;try{const t=await fetch("/api/auth/config");if(!t.ok)throw new Error(`HTTP ${t.status}`);return en=await t.json(),en}catch{return{authEnabled:!1,supabaseUrl:null,supabaseAnonKey:null}}}async function an(){if(Qr)return Qr;const t=await cu();return!t.authEnabled||!t.supabaseUrl||!t.supabaseAnonKey?null:(Qr=Wm(t.supabaseUrl,t.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),Qr)}const Br=Tc("auth",()=>{const t=F(null),e=F(null),s=F(!1),r=F(!1),n=F(!1);let i=null;async function o(){const d=await cu();if(n.value=d.authEnabled,!d.authEnabled){r.value=!0;return}const f=await an();if(!f){r.value=!0;return}await new Promise(p=>{f.auth.onAuthStateChange((m,b)=>{e.value=b,t.value=(b==null?void 0:b.user)??null,m==="INITIAL_SESSION"&&p()})}),r.value=!0}async function a(){if(!r.value)return i||(i=o().catch(()=>{i=null})),i}async function l(d,f){const p=await an();if(!p)return"Auth not configured";s.value=!0;try{const{error:m}=await p.auth.signInWithPassword({email:d,password:f});return m?m.message:null}finally{s.value=!1}}async function c(){const d=await an();d&&await d.auth.signOut(),t.value=null,e.value=null}function u(){var d;return((d=e.value)==null?void 0:d.access_token)??null}return{user:t,session:e,loading:s,initialized:r,authEnabled:n,init:a,signIn:l,signOut:c,getAccessToken:u}});async function ke(t,e){const s=Br(),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});if(i.status===401&&s.authEnabled){const o=await an();if(o){const{data:a}=await o.auth.refreshSession();if(a.session){const l=new Headers(e==null?void 0:e.headers);return l.set("Authorization",`Bearer ${a.session.access_token}`),fetch(t,{...e,headers:l})}}await s.signOut()}return i}function zn(t){const s=Br().getAccessToken();if(!s)return t;const r=t.includes("?")?"&":"?";return`${t}${r}token=${encodeURIComponent(s)}`}const Gm={key:0,class:"flex items-center gap-2.5 min-w-0"},zm={key:1,class:"w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center"},Jm={class:"flex-1 py-3 overflow-y-auto overflow-x-hidden"},Ym={key:1,class:"text-[13px] font-medium truncate"},Xm={class:"shrink-0"},Zm={class:"p-2.5"},Qm={class:"flex items-center gap-2 px-2 py-1.5 rounded-lg bg-surface-2/50 mb-1.5"},e0={class:"w-6 h-6 rounded-full bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0"},t0={class:"text-[10px] text-accent font-semibold"},s0={class:"min-w-0 flex-1"},r0={class:"text-xs text-txt-primary truncate leading-tight"},n0={class:"flex items-center justify-between px-2"},i0={class:"flex items-center gap-1.5"},o0={key:0,class:"text-[10px] text-txt-muted font-mono"},a0={key:1,class:"flex items-center gap-1.5 px-2"},l0={key:0,class:"text-[10px] text-txt-muted font-mono"},c0={key:1,class:"flex flex-col items-center gap-1.5"},tl="io-nav-collapsed",u0=gt({__name:"AppNav",setup(t){const e=sp(),s=Hc(),r=Br(),n=F(""),i=F(0),o=F(0),a=F(!1);let l=null;const c=[{to:"/chat",name:"chat",icon:"💬",label:"Chat"},{to:"/inbox",name:"inbox",icon:"📥",label:"Inbox"},{to:"/skills",name:"skills",icon:"⚙️",label:"Skills"},{to:"/squads",name:"squads",icon:"👥",label:"Squads"},{to:"/wiki",name:"wiki",icon:"📚",label:"Wiki"},{to:"/schedules",name:"schedules",icon:"📅",label:"Schedules"},{to:"/notifications",name:"notifications",icon:"🔔",label:"Notifications"},{to:"/activity",name:"activity",icon:"📊",label:"Activity"}],u=$e(()=>{var y;return(((y=r.user)==null?void 0:y.email)??"").charAt(0).toUpperCase()});function d(x){return e.name===x}function f(){a.value=!a.value;try{localStorage.setItem(tl,String(a.value))}catch{}}async function p(){await r.signOut(),s.push("/login")}function m(){i.value=0}function b(){o.value=0}return ts(async()=>{try{const x=localStorage.getItem(tl);x!==null&&(a.value=x==="true")}catch{}try{const x=await ke("/api/status");if(x.ok){const y=await x.json();n.value=y.version??""}}catch{}try{const x=await ke("/api/notifications?unread=true&limit=1");if(x.ok){const y=await x.json();i.value=y.unreadCount??0}}catch{}try{const x=await ke("/api/inbox/count");if(x.ok){const y=await x.json();o.value=y.count??0}}catch{}l=new EventSource(zn("/api/events")),l.onmessage=x=>{try{JSON.parse(x.data).type==="notification"&&e.name!=="notifications"&&i.value++}catch{}}}),Ln(()=>{l==null||l.close(),l=null}),(x,y)=>Oe(e).name!=="login"?(_(),w("nav",{key:0,class:fe(["relative z-10 flex flex-col shrink-0 nav-sidebar border-r border-edge bg-surface-1/70 backdrop-blur-md",a.value?"nav-collapsed":"nav-expanded"])},[h("div",{class:fe(["flex items-center h-14 px-3 shrink-0",a.value?"justify-center":"justify-between"])},[a.value?(_(),w("div",zm,[...y[1]||(y[1]=[h("span",{class:"text-accent font-bold text-xs font-mono tracking-tight"},"IO",-1)])])):(_(),w("div",Gm,[...y[0]||(y[0]=[Mn('<div class="w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0" data-v-c37feebe><span class="text-accent font-bold text-sm font-mono tracking-tight" data-v-c37feebe>IO</span></div><div class="min-w-0" data-v-c37feebe><p class="text-sm font-semibold text-txt-primary leading-tight tracking-tight" data-v-c37feebe>IO Assistant</p><p class="text-[10px] text-txt-muted leading-tight" data-v-c37feebe>Terminal · Dashboard</p></div>',2)])])),a.value?(_(),w("button",{key:3,onClick:f,class:"absolute -right-3 top-4 w-6 h-6 rounded-full bg-surface-2 border border-edge-bright shadow-card flex items-center justify-center text-txt-muted hover:text-accent hover:border-accent/30 transition-all duration-150 z-20",title:"Expand sidebar"},[...y[3]||(y[3]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[h("path",{d:"M6 3l5 5-5 5"})],-1)])])):(_(),w("button",{key:2,onClick:f,class:"p-1.5 rounded-md text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 transition-all duration-150 shrink-0 ml-1",title:"Collapse sidebar"},[...y[2]||(y[2]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},[h("path",{d:"M10 3L5 8l5 5"})],-1)])]))],2),y[11]||(y[11]=h("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-edge to-transparent"},null,-1)),h("div",Jm,[h("ul",{class:fe(["space-y-0.5",a.value?"px-1.5":"px-2"])},[(_(),w(be,null,qe(c,k=>h("li",{key:k.to},[He(Oe(Mc),{to:k.to,class:fe(["group flex items-center rounded-lg transition-all duration-150 relative",[a.value?"justify-center p-2":"px-2.5 py-2 gap-2.5",d(k.name)?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"]]),title:a.value?k.label:void 0,onClick:A=>k.name==="notifications"?m():k.name==="inbox"?b():void 0},{default:xr(()=>[d(k.name)?(_(),w("span",{key:0,class:fe(["absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-r-full bg-accent shadow-glow-sm",a.value?"h-4":"h-5"])},null,2)):Y("",!0),h("span",{class:fe(["text-base leading-none shrink-0 transition-transform duration-150 group-hover:scale-105",a.value?"":"ml-0.5"])},R(k.icon),3),a.value?Y("",!0):(_(),w("span",Ym,R(k.label),1)),k.name==="notifications"&&i.value>0?(_(),w("span",{key:2,class:fe(["absolute flex items-center justify-center bg-red-500 text-white text-[9px] font-bold rounded-full min-w-[16px] h-[16px] px-0.5 ring-2 ring-surface-1",a.value?"top-0 right-0":"top-0.5 right-1"])},R(i.value>99?"99+":i.value),3)):Y("",!0),k.name==="inbox"&&o.value>0?(_(),w("span",{key:3,class:fe(["absolute flex items-center justify-center bg-accent text-surface-0 text-[9px] font-bold rounded-full min-w-[16px] h-[16px] px-0.5 ring-2 ring-surface-1",a.value?"top-0 right-0":"top-0.5 right-1"])},R(o.value>99?"99+":o.value),3)):Y("",!0)]),_:2},1032,["to","class","title","onClick"])])),64))],2)]),h("div",Xm,[y[10]||(y[10]=h("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-edge to-transparent"},null,-1)),h("div",Zm,[a.value?(_(),w("div",c0,[y[9]||(y[9]=h("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"p-1.5 rounded-md text-txt-muted hover:text-accent hover:bg-surface-3/50 transition-all duration-150",title:"GitHub"},[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"currentColor"},[h("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1)),Oe(r).authEnabled&&Oe(r).user?(_(),w("button",{key:0,onClick:p,class:"p-1.5 rounded-md text-txt-muted hover:text-red-400 hover:bg-surface-3/50 transition-all duration-150",title:"Sign out"},[...y[8]||(y[8]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3.5 w-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},[h("path",{d:"M6 2H3a1 1 0 00-1 1v10a1 1 0 001 1h3M11 11l3-3-3-3M14 8H6"})],-1)])])):Y("",!0)])):(_(),w(be,{key:0},[Oe(r).authEnabled&&Oe(r).user?(_(),w(be,{key:0},[h("div",Qm,[h("div",e0,[h("span",t0,R(u.value),1)]),h("div",s0,[h("p",r0,R(Oe(r).user.email),1)])]),h("div",n0,[h("span",i0,[n.value?(_(),w("span",o0,"v"+R(n.value),1)):Y("",!0),y[4]||(y[4]=h("span",{class:"text-[10px] text-txt-muted"},"·",-1)),y[5]||(y[5]=h("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"text-[10px] text-txt-muted hover:text-accent transition-colors"},[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 24 24",fill:"currentColor"},[h("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1))]),h("button",{onClick:p,class:"text-[11px] text-txt-muted hover:text-red-400 transition-colors px-1.5 py-0.5 rounded hover:bg-surface-3/50"}," Sign out ")])],64)):(_(),w("div",a0,[n.value?(_(),w("span",l0,"v"+R(n.value),1)):Y("",!0),y[6]||(y[6]=h("span",{class:"text-[10px] text-txt-muted"},"·",-1)),y[7]||(y[7]=h("a",{href:"https://github.com/michaeljolley/io",target:"_blank",rel:"noopener",class:"text-[10px] text-txt-muted hover:text-accent transition-colors"},[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-3 w-3",viewBox:"0 0 24 24",fill:"currentColor"},[h("path",{d:"M12 2C6.477 2 2 6.477 2 12c0 4.418 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.009-.868-.013-1.703-2.782.604-3.369-1.342-3.369-1.342-.454-1.154-1.11-1.462-1.11-1.462-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0112 6.836a9.59 9.59 0 012.504.337c1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z"})])],-1))]))],64))])])],2)):Y("",!0)}}),Hr=(t,e)=>{const s=t.__vccOpts||t;for(const[r,n]of e)s[r]=n;return s},d0=Hr(u0,[["__scopeId","data-v-c37feebe"]]),h0={class:"flex h-screen bg-surface-0 relative overflow-hidden"},f0={class:"flex-1 overflow-auto relative z-0"},p0=gt({__name:"App",setup(t){return(e,s)=>(_(),w("div",h0,[s[0]||(s[0]=h("div",{class:"pointer-events-none absolute inset-0 overflow-hidden","aria-hidden":"true"},[h("div",{class:"absolute -top-[40%] -left-[20%] w-[60%] h-[80%] rounded-full bg-accent/[0.02] blur-[120px]"}),h("div",{class:"absolute -bottom-[30%] -right-[10%] w-[50%] h-[60%] rounded-full bg-accent/[0.015] blur-[100px]"})],-1)),He(d0),h("main",f0,[He(Oe(Bc),null,{default:xr(({Component:r})=>[He(yc,{name:"view",mode:"out-in"},{default:xr(()=>[(_(),fc(xd(r)))]),_:2},1024)]),_:1})])]))}}),g0=Hr(p0,[["__scopeId","data-v-715b28be"]]),m0="modulepreload",v0=function(t){return"/"+t},sl={},b0=function(e,s,r){let n=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));n=Promise.allSettled(s.map(l=>{if(l=v0(l),l in sl)return;sl[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":m0,c||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),c)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return n.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})},y0=Tc("chat",()=>{const t=F([]),e=F(!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}});function Pt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*\*(.*?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-gray-800 px-1 rounded text-blue-300 font-mono text-xs">$1</code>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,(e,s,r)=>`<a href="${/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("#")?r:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${s}</a>`)}function uu(t){const e=t.trim();return e.startsWith("|")&&e.endsWith("|")&&e.length>2}function rl(t){return uu(t)&&/^\|[\s|:\-]+\|$/.test(t.trim())}function mi(t){return t.trim().slice(1,-1).split("|").map(e=>e.trim())}function _0(t){const e=t.trim();return e.startsWith(":")&&e.endsWith(":")?"text-center":e.endsWith(":")?"text-right":"text-left"}function w0(t){if(t.length<2)return t.map(a=>`<p class="my-1">${Pt(a)}</p>`).join(`
73
- `);const e=mi(t[0]),s=t[1],r=rl(s)?mi(s).map(_0):e.map(()=>"text-left"),n=rl(s)?t.slice(2):t.slice(1),i=e.map((a,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${r[l]??"text-left"}">${Pt(a)}</th>`).join(""),o=n.map(a=>{const l=mi(a);return`<tr class="border-b border-gray-800">${e.map((u,d)=>`<td class="px-3 py-1.5 text-gray-400 ${r[d]??"text-left"}">${Pt(l[d]??"")}</td>`).join("")}</tr>`}).join("");return`<div class="overflow-x-auto my-2"><table class="border-collapse w-full text-sm"><thead><tr class="border-b border-gray-700">${i}</tr></thead><tbody>${o}</tbody></table></div>`}function x0(t){if(!t.startsWith(`---
74
- `)&&t!=="---")return{frontmatter:null,body:t};const e=t.indexOf(`
75
- ---
76
- `,3),s=t.indexOf(`
77
- ---`,3),r=e!==-1?e:s!==-1&&t.slice(s).trimEnd()==="---"?s:-1;if(r===-1)return{frontmatter:null,body:t};const n=t.slice(4,r),i=e!==-1?t.slice(e+5):"",o={};for(const a of n.split(`
78
- `)){const l=a.match(/^([^:]+):\s*(.*)$/);if(!l)continue;const c=l[1].trim();let u=l[2].trim();(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),o[c]=u}return{frontmatter:Object.keys(o).length>0?o:null,body:i}}function Jn(t){if(!t)return"";const e=t.split(`
79
- `),s=[];let r=!1,n=!1,i=!1,o=[],a=[];function l(){n&&(s.push("</ul>"),n=!1)}function c(){i&&(s.push(w0(a)),a=[],i=!1)}for(const u of e){if(u.startsWith("```")){if(l(),c(),!r)r=!0,o=[];else{const y=o.join(`
80
- `).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");s.push(`<pre class="bg-gray-900 border border-gray-800 rounded p-3 my-2 overflow-x-auto"><code class="font-mono text-xs text-green-300">${y}</code></pre>`),r=!1,o=[]}continue}if(r){o.push(u);continue}if(uu(u)){l(),i=!0,a.push(u);continue}i&&c();const d=u.match(/^####\s+(.+)/),f=u.match(/^###\s+(.+)/),p=u.match(/^##\s+(.+)/),m=u.match(/^#\s+(.+)/);if(d){l(),s.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${Pt(d[1])}</h4>`);continue}if(f){l(),s.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${Pt(f[1])}</h3>`);continue}if(p){l(),s.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${Pt(p[1])}</h2>`);continue}if(m){l(),s.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${Pt(m[1])}</h1>`);continue}if(/^---+$/.test(u.trim())){l(),s.push('<hr class="border-gray-800 my-4" />');continue}const b=u.match(/^[-*+]\s+(.+)/);if(b){n||(s.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),n=!0),s.push(`<li>${Pt(b[1])}</li>`);continue}const x=u.match(/^\d+\.\s+(.+)/);if(x){n||(s.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),n=!0),s.push(`<li>${Pt(x[1])}</li>`);continue}if(u.trim()===""){l(),s.push('<div class="my-2"></div>');continue}l(),s.push(`<p class="my-1">${Pt(u)}</p>`)}if(r&&o.length){const u=o.join(`
81
- `).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");s.push(`<pre class="bg-gray-900 border border-gray-800 rounded p-3 my-2 overflow-x-auto"><code class="font-mono text-xs text-green-300">${u}</code></pre>`)}return c(),l(),s.join(`
82
- `)}const k0={class:"flex flex-col h-full relative bg-surface-0"},S0={key:0,class:"flex flex-col items-center justify-center h-full select-none animate-fade-in"},E0={class:"flex flex-wrap justify-center gap-2 mt-8 max-w-md"},T0=["onClick"],A0={key:1,class:"max-w-3xl mx-auto space-y-5"},C0={key:0,class:"max-w-[80%] px-4 py-2.5 rounded-2xl rounded-br-md text-sm whitespace-pre-wrap bg-accent/[0.12] text-txt-primary border border-accent/20"},R0={key:1,class:"max-w-[85%] flex gap-2.5 items-start"},O0=["innerHTML"],$0={key:0,class:"flex justify-start animate-fade-in"},P0={class:"shrink-0 border-t border-edge/50 bg-surface-1/60 backdrop-blur-md p-3 sm:p-4"},I0={class:"flex-1 relative group"},j0=["disabled"],N0=["disabled"],L0={class:"hidden sm:inline"},U0=["disabled"],D0='<span class="stream-cursor"></span>',M0=gt({__name:"ChatView",setup(t){const e=y0(),s=F(""),r=F(!1),n=F(null),i=F(!1),o=F(null),a=["Check squad status","Run my schedules","Summarize recent activity","What skills are installed?"];function l(x){s.value=x,Es(()=>b())}async function c(){if(!r.value){r.value=!0;try{await ke("/api/orchestrator/abort",{method:"POST"})}catch{}finally{r.value=!1}}}const u=$e(()=>e.messages.some(x=>x.streaming));function d(){const x=n.value;x&&(i.value=x.scrollTop+x.clientHeight<x.scrollHeight-100)}function f(){Es(()=>{n.value&&(n.value.scrollTop=n.value.scrollHeight)})}us(()=>e.messages.length,()=>{i.value||f()});function p(x){x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),b())}function m(){const x=o.value;x&&(x.style.height="auto",x.style.height=Math.min(x.scrollHeight,200)+"px")}async function b(){const x=s.value.trim();if(!x||e.isLoading)return;s.value="",Es(()=>{o.value&&(o.value.style.height="auto")}),e.isLoading=!0,e.addMessage({id:crypto.randomUUID(),role:"user",content:x}),e.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),f();const y=new EventSource(zn("/api/events"));y.onmessage=k=>{try{const A=JSON.parse(k.data);A.type==="delta"?(e.appendToLast(A.text),f()):A.type==="done"&&(e.setLastStreaming(!1),e.isLoading=!1,y.close(),f())}catch{}},y.onerror=()=>{e.setLastStreaming(!1),e.isLoading=!1,y.close()};try{await ke("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:x})})}catch{e.appendToLast(`
83
-
84
- [Error: failed to reach IO]`),e.setLastStreaming(!1),e.isLoading=!1,y.close()}}return(x,y)=>(_(),w("div",k0,[h("div",{ref_key:"messagesEl",ref:n,class:"flex-1 overflow-y-auto px-4 py-6 sm:px-6",onScroll:d},[Oe(e).messages.length===0?(_(),w("div",S0,[y[1]||(y[1]=h("div",{class:"w-16 h-16 rounded-2xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-5 shadow-glow"},[h("span",{class:"text-accent font-bold text-2xl font-mono tracking-tighter"},"IO")],-1)),y[2]||(y[2]=h("p",{class:"text-txt-secondary text-sm font-medium mb-1"},"What can I help you build?",-1)),y[3]||(y[3]=h("p",{class:"text-txt-muted text-xs"},"Send a message to start a conversation",-1)),h("div",E0,[(_(),w(be,null,qe(a,k=>h("button",{key:k,onClick:A=>l(k),class:"px-3 py-1.5 text-xs text-txt-secondary bg-surface-2/60 border border-edge rounded-full hover:border-accent/30 hover:text-accent hover:bg-accent/5 transition-all duration-200"},R(k),9,T0)),64))])])):(_(),w("div",A0,[(_(!0),w(be,null,qe(Oe(e).messages,k=>(_(),w("div",{key:k.id,class:fe(["flex animate-fade-in",k.role==="user"?"justify-end":"justify-start"])},[k.role==="user"?(_(),w("div",C0,R(k.content),1)):(_(),w("div",R0,[y[4]||(y[4]=h("div",{class:"shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center mt-0.5"},[h("span",{class:"text-accent text-[10px] font-bold font-mono"},"IO")],-1)),h("div",{class:"chat-md min-w-0 px-4 py-2.5 rounded-2xl rounded-tl-md text-sm bg-surface-2/70 text-txt-primary border border-edge",innerHTML:Oe(Jn)(k.content)+(k.streaming?D0:"")},null,8,O0)]))],2))),128)),Oe(e).isLoading&&!u.value?(_(),w("div",$0,[...y[5]||(y[5]=[Mn('<div class="flex gap-2.5 items-start" data-v-f2ce91f6><div class="shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center" data-v-f2ce91f6><span class="text-accent text-[10px] font-bold font-mono" data-v-f2ce91f6>IO</span></div><div class="px-4 py-3 rounded-2xl rounded-tl-md bg-surface-2/70 border border-edge flex items-center gap-1" data-v-f2ce91f6><span class="thinking-dot" style="animation-delay:0s;" data-v-f2ce91f6></span><span class="thinking-dot" style="animation-delay:0.15s;" data-v-f2ce91f6></span><span class="thinking-dot" style="animation-delay:0.3s;" data-v-f2ce91f6></span></div></div>',1)])])):Y("",!0)]))],544),He(yc,{name:"scroll-btn"},{default:xr(()=>[i.value?(_(),w("button",{key:0,onClick:f,class:"absolute bottom-24 left-1/2 -translate-x-1/2 z-10 w-8 h-8 rounded-full bg-surface-2/90 backdrop-blur-sm border border-edge-bright text-txt-secondary hover:text-accent hover:border-accent/40 hover:shadow-glow-sm flex items-center justify-center transition-all duration-200",title:"Scroll to bottom"},[...y[6]||(y[6]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[h("path",{d:"M4 6l4 4 4-4"})],-1)])])):Y("",!0)]),_:1}),h("div",P0,[h("form",{onSubmit:Yt(b,["prevent"]),class:"max-w-3xl mx-auto flex gap-2 items-end"},[h("div",I0,[lt(h("textarea",{ref_key:"inputEl",ref:o,"onUpdate:modelValue":y[0]||(y[0]=k=>s.value=k),placeholder:"Message IO…",disabled:Oe(e).isLoading,rows:"1",class:"w-full bg-surface-2/60 border border-edge rounded-xl px-4 py-2.5 pr-3 text-sm text-txt-primary placeholder-txt-muted/60 resize-none overflow-hidden focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200",onKeydown:p,onInput:m},null,40,j0),[[yt,s.value]])]),Oe(e).isLoading?(_(),w("button",{key:0,type:"button",onClick:c,disabled:r.value,class:"shrink-0 h-10 px-3.5 rounded-xl text-sm font-medium bg-red-500/15 text-red-400 border border-red-500/25 hover:bg-red-500/25 hover:border-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed transition-all duration-150 flex items-center gap-1.5",title:"Stop"},[y[7]||(y[7]=h("span",{class:"w-2.5 h-2.5 rounded-[3px] bg-red-400"},null,-1)),h("span",L0,R(r.value?"Stopping…":"Stop"),1)],8,N0)):(_(),w("button",{key:1,type:"submit",disabled:!s.value.trim(),class:"shrink-0 w-10 h-10 rounded-xl flex items-center justify-center bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40 hover:shadow-glow-sm disabled:opacity-25 disabled:cursor-not-allowed disabled:hover:shadow-none transition-all duration-150",title:"Send"},[...y[8]||(y[8]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-4 h-4",viewBox:"0 0 16 16",fill:"currentColor"},[h("path",{d:"M1.724 1.053a.5.5 0 0 1 .54-.068l12 6a.5.5 0 0 1 0 .894l-12 6A.5.5 0 0 1 1.5 13.5v-4.379l6.5-1.121-6.5-1.121V2.5a.5.5 0 0 1 .224-.447Z"})],-1)])],8,U0))],32)])]))}}),B0=Hr(M0,[["__scopeId","data-v-f2ce91f6"]]),H0={class:"flex flex-col h-full bg-surface-0"},F0={key:0,class:"flex flex-col h-full overflow-hidden animate-fade-in"},V0={class:"flex items-center gap-3 px-6 py-3.5 border-b border-edge shrink-0 bg-surface-1/60 backdrop-blur-sm"},q0={class:"text-base font-semibold text-txt-primary truncate"},W0={class:"text-[11px] text-txt-muted font-mono shrink-0 bg-surface-2/60 px-1.5 py-0.5 rounded"},K0={key:0,class:"flex-1 flex items-center justify-center"},G0={key:1,class:"flex-1 p-6"},z0={class:"inline-flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},J0={key:2,class:"flex-1 overflow-y-auto p-6 skill-content text-sm text-txt-secondary leading-relaxed"},Y0={key:0,class:"mb-6 bg-surface-2/60 border border-edge rounded-xl p-5"},X0={key:0,class:"mb-3"},Z0={class:"text-base font-semibold text-txt-primary"},Q0={key:1,class:"mb-3"},ev={class:"text-sm text-txt-secondary"},tv={class:"flex flex-wrap gap-6 mt-1"},sv={key:0},rv={class:"text-sm text-accent font-mono"},nv={key:1},iv={class:"text-sm text-txt-secondary"},ov={key:2,class:"mt-3 pt-3 border-t border-edge grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 items-baseline"},av={class:"text-[10px] text-txt-muted uppercase tracking-wider whitespace-nowrap"},lv={class:"text-xs text-txt-secondary font-mono"},cv=["innerHTML"],uv={key:1,class:"flex-1 overflow-y-auto p-6"},dv={class:"max-w-3xl"},hv={class:"mb-6 bg-surface-2/40 border border-edge rounded-xl p-4"},fv={class:"flex gap-1 mb-3"},pv={class:"flex gap-2"},gv=["disabled"],mv=["disabled"],vv={class:"flex flex-col gap-2"},bv=["disabled"],yv=["disabled"],_v=["disabled"],wv={key:0,class:"flex items-center gap-2 bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 p-3 rounded-lg mb-4 text-sm animate-fade-in"},xv={key:1,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm animate-fade-in"},kv={key:2,class:"mb-4"},Sv={key:3,class:"flex items-center justify-center py-16"},Ev={key:4,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm"},Tv={key:5,class:"text-txt-muted text-sm text-center py-16"},Av={key:6,class:"text-txt-muted text-sm text-center py-12"},Cv={key:7,class:"grid gap-3"},Rv=["onClick"],Ov={class:"flex justify-between items-start mb-1.5"},$v={class:"min-w-0"},Pv={class:"font-semibold text-txt-primary text-sm group-hover:text-accent transition-colors duration-150"},Iv={class:"text-[11px] text-txt-muted font-mono mt-0.5"},jv=["onClick"],Nv={class:"text-xs text-txt-secondary mb-2 line-clamp-2"},Lv={class:"text-[10px] text-txt-muted font-mono truncate"},Uv=gt({__name:"SkillsView",setup(t){const e=F([]),s=F(!0),r=F(null),n=F(""),i=F(!1),o=F(null),a=F(null),l=F("url"),c=F(""),u=F(""),d=F(!1),f=F(null),p=F(""),m=F(!1),b=F(null),x=$e(()=>x0(p.value)),y=$e(()=>x.value.frontmatter),k=$e(()=>Jn(x.value.body)),A=["name","description","version","author"],L=$e(()=>y.value?Object.entries(y.value).filter(([q])=>!A.includes(q)):[]),N=F(""),$=$e(()=>{const q=N.value.toLowerCase().trim();return q?e.value.filter(O=>O.name.toLowerCase().includes(q)||O.slug.toLowerCase().includes(q)||(O.description??"").toLowerCase().includes(q)):e.value});async function E(q){f.value=q,p.value="",b.value=null,m.value=!0;try{const O=await ke(`/api/skills/${encodeURIComponent(q.slug)}`);if(O.status===404)b.value="Skill not found";else if(!O.ok)b.value=`Failed to load skill (HTTP ${O.status})`;else{const ce=await O.json();p.value=ce.content??""}}catch(O){b.value=O instanceof Error?O.message:"Failed to load skill"}finally{m.value=!1}}function M(){f.value=null,p.value="",b.value=null}async function B(){try{const q=await ke("/api/skills");if(!q.ok)throw new Error(`HTTP error! status: ${q.status}`);const O=await q.json();e.value=O.skills}catch(q){r.value=q instanceof Error?q.message:"Failed to load skills"}finally{s.value=!1}}async function te(){if(!(i.value||n.value.trim()==="")){i.value=!0,o.value=null,a.value=null;try{const q=await ke("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoUrl:n.value.trim()})});if(q.ok){const O=await q.json();e.value=[O.skill,...e.value],n.value="",a.value=`✓ Installed: ${O.skill.name}`,setTimeout(()=>{a.value=null},4e3),B()}else{let O="Install failed";try{O=(await q.json()).error??q.statusText??O}catch{O=q.statusText||O}o.value=O}}catch(q){o.value=q instanceof Error?q.message:"Install failed"}finally{i.value=!1}}}async function de(){if(!(d.value||c.value.trim()===""||u.value.trim()==="")){d.value=!0,o.value=null,a.value=null;try{const q=await ke("/api/skills/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u.value.trim(),slug:c.value.trim()})});if(q.ok){const O=await q.json();e.value=[O.skill,...e.value],c.value="",u.value="",a.value=`✓ Installed: ${O.skill.name}`,setTimeout(()=>{a.value=null},4e3),B()}else{let O="Install failed";try{O=(await q.json()).error??q.statusText??O}catch{O=q.statusText||O}o.value=O}}catch(q){o.value=q instanceof Error?q.message:"Install failed"}finally{d.value=!1}}}async function V(q){if(confirm(`Delete skill "${q.name}"? This cannot be undone.`))try{const O=await ke(`/api/skills/${encodeURIComponent(q.slug)}`,{method:"DELETE"});if(O.ok)e.value=e.value.filter(ce=>ce.slug!==q.slug),a.value=`✓ Deleted: ${q.name}`,setTimeout(()=>{a.value=null},3e3);else{const ce=await O.json().catch(()=>({}));o.value=ce.error??(O.status===404?"Skill not found":`Delete failed (HTTP ${O.status})`)}}catch(O){o.value=O instanceof Error?O.message:"Delete failed"}}return ts(B),(q,O)=>(_(),w("div",H0,[f.value?(_(),w("div",F0,[h("div",V0,[h("button",{onClick:M,class:"text-txt-muted hover:text-accent transition-colors flex items-center gap-1.5 text-sm group"},[...O[6]||(O[6]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5 transition-transform group-hover:-translate-x-0.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[h("path",{d:"M10 3L5 8l5 5"})],-1),he(" Back ",-1)])]),O[7]||(O[7]=h("div",{class:"w-px h-5 bg-edge"},null,-1)),h("h2",q0,R(f.value.name),1),h("span",W0,R(f.value.slug),1)]),m.value?(_(),w("div",K0,[...O[8]||(O[8]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading… ")],-1)])])):b.value?(_(),w("div",G0,[h("div",z0,[O[9]||(O[9]=h("span",null,"⚠",-1)),he(" "+R(b.value),1)])])):(_(),w("div",J0,[y.value?(_(),w("div",Y0,[y.value.name?(_(),w("div",X0,[O[10]||(O[10]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Name",-1)),h("p",Z0,R(y.value.name),1)])):Y("",!0),y.value.description?(_(),w("div",Q0,[O[11]||(O[11]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Description",-1)),h("p",ev,R(y.value.description),1)])):Y("",!0),h("div",tv,[y.value.version?(_(),w("div",sv,[O[12]||(O[12]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Version",-1)),h("p",rv,R(y.value.version),1)])):Y("",!0),y.value.author?(_(),w("div",nv,[O[13]||(O[13]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Author",-1)),h("p",iv,R(y.value.author),1)])):Y("",!0)]),L.value.length>0?(_(),w("dl",ov,[(_(!0),w(be,null,qe(L.value,([ce,ge])=>(_(),w(be,{key:ce},[h("dt",av,R(ce),1),h("dd",lv,R(ge),1)],64))),128))])):Y("",!0)])):Y("",!0),h("div",{innerHTML:k.value},null,8,cv)]))])):(_(),w("div",uv,[h("div",dv,[O[20]||(O[20]=Mn('<div class="flex items-end justify-between mb-6" data-v-a63e75bb><div data-v-a63e75bb><h2 class="text-xl font-bold text-txt-primary tracking-tight" data-v-a63e75bb>Skills</h2><p class="text-xs text-txt-muted mt-0.5" data-v-a63e75bb>Manage installed Copilot skills</p></div><div class="flex items-center gap-2" data-v-a63e75bb><a href="https://github.com/github/awesome-copilot" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs text-txt-muted bg-surface-2/50 border border-edge px-2.5 py-1 rounded-full hover:border-accent/30 hover:text-accent transition-all duration-200" data-v-a63e75bb><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="w-3 h-3 fill-current" aria-hidden="true" data-v-a63e75bb><path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z" data-v-a63e75bb></path></svg> awesome-copilot </a><a href="https://skills.sh" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs text-txt-muted bg-surface-2/50 border border-edge px-2.5 py-1 rounded-full hover:border-accent/30 hover:text-accent transition-all duration-200" data-v-a63e75bb><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" class="w-3 h-3 fill-current" aria-hidden="true" data-v-a63e75bb><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8c0 .93.16 1.82.46 2.65L5 8.5V7H3.5l-.07.01A6.492 6.492 0 0 0 1.5 8Zm6.5 6.5c.93 0 1.82-.17 2.65-.47L8.5 11H7v2.5c.17.01.33.01.5.01Zm-5.3-1.7c.56.4 1.19.7 1.87.88L5 11H3.5c.34.66.79 1.25 1.2 1.8ZM8.5 1.5V4H10l2.5 2.5c.02-.16.03-.33.03-.5A6.5 6.5 0 0 0 8.5 1.5Zm-1 0A6.5 6.5 0 0 0 1.97 6H3.5L6 3.5V1.53c-.51.1-1 .26-1.5.46V1.5ZM11 8.5l-2.5 2.5H10l1.88-1.88A6.47 6.47 0 0 0 11 8.5ZM6 6v4h4V6H6Z" data-v-a63e75bb></path></svg> skills.sh </a></div></div>',1)),h("div",hv,[h("div",fv,[h("button",{type:"button",onClick:O[0]||(O[0]=ce=>l.value="url"),class:fe(["px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150",l.value==="url"?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/40 border border-transparent"])}," From URL ",2),h("button",{type:"button",onClick:O[1]||(O[1]=ce=>l.value="paste"),class:fe(["px-3 py-1.5 text-xs font-medium rounded-lg transition-all duration-150",l.value==="paste"?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/40 border border-transparent"])}," Paste SKILL.md ",2)]),l.value==="url"?(_(),w("form",{key:0,onSubmit:Yt(te,["prevent"])},[h("div",pv,[lt(h("input",{"onUpdate:modelValue":O[2]||(O[2]=ce=>n.value=ce),type:"url",placeholder:"https://github.com/owner/repo.git","aria-label":"Git repository URL",disabled:i.value,class:"flex-1 bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200"},null,8,gv),[[yt,n.value]]),h("button",{type:"submit",disabled:i.value||n.value.trim()==="",class:"bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150 whitespace-nowrap"},R(i.value?"Installing…":"Install"),9,mv)])],32)):(_(),w("form",{key:1,onSubmit:Yt(de,["prevent"])},[h("div",vv,[h("div",null,[lt(h("input",{"onUpdate:modelValue":O[3]||(O[3]=ce=>c.value=ce),type:"text",placeholder:"my-skill","aria-label":"Skill slug",disabled:d.value,class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 transition-all duration-200"},null,8,bv),[[yt,c.value]]),O[14]||(O[14]=h("p",{class:"text-[10px] text-txt-muted mt-1 ml-1"},"Unique identifier (lowercase, hyphens ok)",-1))]),lt(h("textarea",{"onUpdate:modelValue":O[4]||(O[4]=ce=>u.value=ce),placeholder:"Paste SKILL.md content here…","aria-label":"SKILL.md content",disabled:d.value,rows:"6",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary font-mono placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm disabled:opacity-40 resize-y transition-all duration-200"},null,8,yv),[[yt,u.value]]),h("button",{type:"submit",disabled:d.value||c.value.trim()===""||u.value.trim()==="",class:"self-end bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},R(d.value?"Installing…":"Install"),9,_v)])],32))]),a.value?(_(),w("div",wv,[O[15]||(O[15]=h("span",null,"✓",-1)),he(" "+R(a.value),1)])):Y("",!0),o.value?(_(),w("div",xv,[O[16]||(O[16]=h("span",null,"⚠",-1)),he(" "+R(o.value),1)])):Y("",!0),!s.value&&!r.value&&e.value.length>0?(_(),w("div",kv,[lt(h("input",{"onUpdate:modelValue":O[5]||(O[5]=ce=>N.value=ce),type:"search",placeholder:"Search skills…","aria-label":"Search skills",class:"w-full bg-surface-2/50 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[yt,N.value]])])):Y("",!0),s.value?(_(),w("div",Sv,[...O[17]||(O[17]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading skills… ")],-1)])])):r.value?(_(),w("div",Ev,[O[18]||(O[18]=h("span",null,"⚠",-1)),he(" "+R(r.value),1)])):e.value.length===0?(_(),w("div",Tv," No skills installed yet ")):$.value.length===0?(_(),w("div",Av," No matching skills ")):(_(),w("div",Cv,[(_(!0),w(be,null,qe($.value,ce=>(_(),w("div",{key:ce.slug,onClick:ge=>E(ce),class:"group bg-surface-2/40 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card-hover hover:bg-surface-2/70 transition-all duration-200 cursor-pointer"},[h("div",Ov,[h("div",$v,[h("h3",Pv,R(ce.name),1),h("p",Iv,R(ce.slug),1)]),h("button",{onClick:Yt(ge=>V(ce),["stop"]),class:"shrink-0 ml-2 p-1.5 rounded-lg text-txt-muted/0 group-hover:text-txt-muted hover:!text-red-400 hover:bg-red-500/10 transition-all duration-150",title:"Delete skill"},[...O[19]||(O[19]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},[h("path",{d:"M2 4h12M5.333 4V2.667a1.333 1.333 0 011.334-1.334h2.666a1.333 1.333 0 011.334 1.334V4m2 0v9.333a1.333 1.333 0 01-1.334 1.334H4.667a1.333 1.333 0 01-1.334-1.334V4h9.334z"})],-1)])],8,jv)]),h("p",Nv,R(ce.description),1),h("p",Lv,R(ce.path),1)],8,Rv))),128))]))])]))]))}}),Dv=Hr(Uv,[["__scopeId","data-v-a63e75bb"]]),Mv={class:"flex flex-col h-full bg-surface-0"},Bv={class:"flex-1 overflow-y-auto p-6"},Hv={class:"max-w-4xl"},Fv={class:"flex justify-between items-end mb-6"},Vv={class:"space-y-3"},qv=["disabled"],Wv={key:0,class:"mt-3 flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},Kv={key:1,class:"flex items-center justify-center py-16"},Gv={key:2,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-4 text-sm"},zv={key:3,class:"text-txt-muted text-sm text-center py-16"},Jv={key:4,class:"grid gap-3"},Yv=["onClick","aria-expanded"],Xv={class:"flex justify-between items-start mb-2"},Zv={class:"flex-1 flex items-center gap-2.5"},Qv={class:"min-w-0"},eb={class:"font-semibold text-txt-primary text-sm"},tb={class:"text-[11px] text-txt-muted font-mono"},sb={class:"flex items-center gap-2 shrink-0"},rb={key:0,class:"px-2 py-0.5 rounded-md text-[10px] font-medium bg-purple-500/10 text-purple-300 border border-purple-500/20"},nb={class:"text-xs text-txt-muted font-mono ml-6"},ib={key:0,class:"border-t border-edge px-4 pb-4 pt-3 animate-fade-in"},ob={class:"flex justify-between items-center text-[10px] text-txt-muted mb-3"},ab={key:0,class:"font-mono"},lb={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-3"},cb={key:1,class:"text-red-400 text-xs py-2"},ub={key:2,class:"text-txt-muted text-xs italic py-2"},db={key:3,class:"space-y-1.5"},hb={class:"flex-1 min-w-0"},fb={class:"flex items-center gap-1.5"},pb={class:"text-sm font-medium text-txt-primary truncate"},gb={key:0,title:"Team Lead",class:"text-xs"},mb={key:1,title:"QA / Veto Power",class:"text-xs"},vb={class:"text-[10px] text-txt-muted"},bb={class:"flex items-center gap-1 shrink-0"},yb=["onClick"],_b=["onClick","disabled"],wb={class:"bg-surface-1 border border-edge rounded-xl w-full max-w-2xl max-h-[85vh] flex flex-col shadow-2xl animate-fade-in"},xb={class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},kb={class:"text-sm font-semibold text-txt-primary flex items-center gap-2"},Sb={class:"text-xs font-normal text-txt-muted"},Eb={class:"text-[10px] text-txt-muted mt-0.5 flex items-center gap-1.5"},Tb={class:"flex items-center gap-3"},Ab={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},Cb={key:0,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},Rb={key:1,class:"text-txt-muted italic text-center py-8"},Ob={class:"shrink-0"},$b={class:"flex-1 min-w-0"},Pb={class:"text-txt-secondary break-words"},Ib={class:"text-txt-muted text-[10px] ml-2"},jb={key:0,class:"text-txt-muted italic text-center py-4"},Nb={class:"flex justify-between items-center mb-1"},Lb={class:"text-accent"},Ub={class:"text-txt-muted text-[10px]"},Db={class:"text-txt-secondary whitespace-pre-wrap break-words"},Mb=gt({__name:"SquadsView",setup(t){const e=new Set(["system"]),s={"a-team":"The A-Team",transformers:"Transformers",thundercats:"ThunderCats","gi-joe":"G.I. Joe",aliens:"Aliens",ghostbusters:"Ghostbusters"},r=F([]),n=F(!0),i=F(null),o=F(!1),a=F(!1),l=F(null),c=zt({}),u=zt({});function d(T){return[...T].sort((C,K)=>{const le=Le=>Le.is_lead?0:Le.is_qa?1:2;return le(C)-le(K)})}const f=zt({}),p=zt({}),m=F(new Set),b=F(null),x=F([]),y=F(null),k=F(!1),A=F(!0),L=F(null);let N=null;const $=$e(()=>y.value?"Disconnected":k.value?"Live":"Connecting…"),E=$e(()=>x.value.filter(T=>!(!T.summary||e.has(T.summary.kind)||T.type==="assistant.message_delta"))),M=T=>{try{return new Date(T).toLocaleTimeString()}catch{return""}},B=T=>{const C=T.data;if(!C||typeof C!="object")return"";if(typeof C.deltaContent=="string")return C.deltaContent;if(typeof C.content=="string")return C.content;if(typeof C.text=="string")return C.text;try{return JSON.stringify(C,null,2)}catch{return String(C)}},te=()=>{Es(()=>{const T=L.value;T&&(T.scrollTop=T.scrollHeight)})},de=T=>{if(!T.currentTaskId)return;V(),b.value=T,x.value=[],y.value=null,k.value=!1,A.value=!0;const C=zn(`/api/tasks/${encodeURIComponent(T.currentTaskId)}/events`),K=new EventSource(C);N=K,K.onopen=()=>{k.value=!0},K.onmessage=le=>{try{const Le=JSON.parse(le.data);x.value.push(Le),te()}catch{}},K.onerror=()=>{k.value=!1,x.value.length===0&&(y.value="Connection error. Retrying…")}},V=()=>{if(N){try{N.close()}catch{}N=null}b.value=null,x.value=[],y.value=null,k.value=!1};io(()=>{V()});const q=async(T,C)=>{if(!m.value.has(C)){m.value=new Set(m.value).add(C);try{await ke(`/api/tasks/${encodeURIComponent(C)}/cancel`,{method:"POST"}),await We(T,!0)}catch(K){p[T]=K instanceof Error?K.message:"Failed to stop task"}finally{const K=new Set(m.value);K.delete(C),m.value=K}}},O=F({slug:"",name:"",projectPath:""}),ce=T=>T?s[T]??T:"",ge=T=>new Date(T).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),ie=T=>!!c[T],me=async T=>{c[T]=!c[T],c[T]&&!u[T]&&!f[T]&&await We(T)},We=async(T,C=!1)=>{if(!(!C&&f[T])){f[T]=!0,p[T]=null;try{const K=await ke(`/api/squads/${encodeURIComponent(T)}/agents`);if(!K.ok)throw new Error(`HTTP error! status: ${K.status}`);const le=await K.json();u[T]=le.agents}catch(K){p[T]=K instanceof Error?K.message:"Failed to load agents"}finally{f[T]=!1}}},Xe=async()=>{try{const T=await ke("/api/squads");if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const C=await T.json();r.value=C.squads}catch(T){i.value=T instanceof Error?T.message:"Failed to load squads"}finally{n.value=!1}},H=async()=>{if(!O.value.slug||!O.value.name||!O.value.projectPath){l.value="All fields are required";return}a.value=!0,l.value=null;try{const T=await ke("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:O.value.slug,name:O.value.name,projectPath:O.value.projectPath})});if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);O.value={slug:"",name:"",projectPath:""},o.value=!1,await Xe()}catch(T){l.value=T instanceof Error?T.message:"Failed to create squad"}finally{a.value=!1}};return ts(()=>{Xe()}),(T,C)=>(_(),w("div",Mv,[h("div",Bv,[h("div",Hv,[h("div",Fv,[C[5]||(C[5]=h("div",null,[h("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Squads"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Manage teams and monitor agents")],-1)),h("button",{onClick:C[0]||(C[0]=K=>o.value=!o.value),class:fe(["px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150",o.value?"bg-surface-3/50 text-txt-secondary border border-edge hover:bg-surface-3/70":"bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40"])},R(o.value?"Cancel":"New Squad"),3)]),o.value?(_(),w("form",{key:0,onSubmit:Yt(H,["prevent"]),class:"bg-surface-2/40 border border-edge rounded-xl p-5 mb-6 animate-fade-in"},[C[7]||(C[7]=h("h3",{class:"font-semibold text-txt-primary text-sm mb-4"},"Create New Squad",-1)),h("div",Vv,[lt(h("input",{"onUpdate:modelValue":C[1]||(C[1]=K=>O.value.slug=K),type:"text",placeholder:"Squad slug (e.g., frontend-team)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[yt,O.value.slug]]),lt(h("input",{"onUpdate:modelValue":C[2]||(C[2]=K=>O.value.name=K),type:"text",placeholder:"Squad name (e.g., Frontend Team)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[yt,O.value.name]]),lt(h("input",{"onUpdate:modelValue":C[3]||(C[3]=K=>O.value.projectPath=K),type:"text",placeholder:"Project path (e.g., /path/to/project)",class:"w-full bg-surface-1/80 border border-edge rounded-lg px-3 py-2 text-sm text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[yt,O.value.projectPath]]),h("button",{type:"submit",disabled:a.value||!O.value.slug||!O.value.name||!O.value.projectPath,class:"w-full bg-accent/15 text-accent border border-accent/25 px-4 py-2 rounded-lg text-sm font-medium hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},R(a.value?"Creating…":"Create Squad"),9,qv)]),l.value?(_(),w("div",Wv,[C[6]||(C[6]=h("span",null,"⚠",-1)),he(" "+R(l.value),1)])):Y("",!0)],32)):Y("",!0),n.value?(_(),w("div",Kv,[...C[8]||(C[8]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading squads… ")],-1)])])):i.value?(_(),w("div",Gv,[C[9]||(C[9]=h("span",null,"⚠",-1)),he(" "+R(i.value),1)])):r.value.length===0?(_(),w("div",zv," No squads created yet ")):(_(),w("div",Jv,[(_(!0),w(be,null,qe(r.value,K=>(_(),w("div",{key:K.id,class:"bg-surface-2/40 border border-edge rounded-xl overflow-hidden hover:border-edge-bright transition-all duration-200"},[h("button",{type:"button",onClick:le=>me(K.slug),class:"w-full text-left p-4 focus:outline-none","aria-expanded":ie(K.slug)},[h("div",Xv,[h("div",Zv,[(_(),w("svg",{xmlns:"http://www.w3.org/2000/svg",class:fe(["w-3.5 h-3.5 text-txt-muted transition-transform duration-200 shrink-0",ie(K.slug)?"rotate-90":""]),viewBox:"0 0 16 16",fill:"currentColor"},[...C[10]||(C[10]=[h("path",{d:"M6 3l5 5-5 5z"},null,-1)])],2)),h("div",Qv,[h("h3",eb,R(K.name),1),h("p",tb,R(K.slug),1)])]),h("div",sb,[K.universe?(_(),w("span",rb," 🎬 "+R(ce(K.universe)),1)):Y("",!0),h("span",{class:fe(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",K.status==="working"?"bg-accent/10 text-accent border border-accent/20":K.status==="error"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-surface-3/60 text-txt-muted border border-edge"])},[h("span",{class:fe(["w-1.5 h-1.5 rounded-full",K.status==="working"?"bg-accent animate-pulse":K.status==="error"?"bg-red-400":"bg-txt-muted/50"])},null,2),he(" "+R(K.status),1)],2)])]),h("p",nb,"📁 "+R(K.project_path),1)],8,Yv),ie(K.slug)?(_(),w("div",ib,[h("div",ob,[K.model?(_(),w("span",ab,"Model: "+R(K.model),1)):Y("",!0),h("span",null,R(ge(K.created_at)),1)]),C[14]||(C[14]=h("h4",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-2"},"Team Roster",-1)),f[K.slug]?(_(),w("div",lb,[...C[11]||(C[11]=[h("span",{class:"w-3 h-3 border-2 border-edge border-t-accent rounded-full animate-spin"},null,-1),he(" Loading agents… ",-1)])])):p[K.slug]?(_(),w("div",cb,R(p[K.slug]),1)):!u[K.slug]||u[K.slug].length===0?(_(),w("div",ub," No agents assigned yet ")):(_(),w("ul",db,[(_(!0),w(be,null,qe(d(u[K.slug]??[]),le=>(_(),w("li",{key:le.id??le.character_name,class:fe(["flex items-center gap-3 rounded-lg px-3 py-2 transition-all duration-150",le.status==="working"?"bg-accent/[0.06] border border-accent/15":"bg-surface-1/50 border border-edge"])},[h("div",{class:fe(["w-7 h-7 rounded-full flex items-center justify-center shrink-0 text-[10px] font-bold",le.status==="working"?"bg-accent/15 text-accent border border-accent/25":le.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-surface-3/60 text-txt-muted border border-edge"])},R((le.character_name??"?").charAt(0).toUpperCase()),3),h("div",hb,[h("div",fb,[h("span",pb,R(le.character_name),1),le.is_lead?(_(),w("span",gb,"👑")):Y("",!0),le.is_qa?(_(),w("span",mb,"🛡️")):Y("",!0)]),h("span",vb,R(le.role_title),1)]),h("span",{class:fe(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",le.status==="working"?"bg-accent/10 text-accent":le.status==="error"?"bg-red-500/10 text-red-400":"bg-surface-3/40 text-txt-muted"])},[h("span",{class:fe(["w-1.5 h-1.5 rounded-full",le.status==="working"?"bg-accent animate-pulse":le.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),he(" "+R(le.status),1)],2),h("div",bb,[le.status==="working"&&le.currentTaskId?(_(),w("button",{key:0,type:"button",onClick:Le=>de(le),class:"text-[10px] font-medium px-2 py-1 rounded-md bg-accent/10 text-accent border border-accent/20 hover:bg-accent/20 transition-all duration-150 flex items-center gap-1",title:"Preview live work"},[...C[12]||(C[12]=[h("span",{"aria-hidden":"true"},"👁",-1),he(" Preview ",-1)])],8,yb)):Y("",!0),le.status==="working"&&le.currentTaskId?(_(),w("button",{key:1,type:"button",onClick:Le=>q(K.slug,le.currentTaskId),disabled:m.value.has(le.currentTaskId),class:"text-[10px] font-medium px-2 py-1 rounded-md bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150 flex items-center gap-1",title:"Stop task"},[C[13]||(C[13]=h("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),he(" "+R(m.value.has(le.currentTaskId)?"Stopping…":"Stop"),1)],8,_b)):Y("",!0)])],2))),128))]))])):Y("",!0)]))),128))]))])]),b.value?(_(),w("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:Yt(V,["self"])},[h("div",wb,[h("div",xb,[h("div",null,[h("h3",kb,[he(R(b.value.character_name)+" ",1),h("span",Sb,"— "+R(b.value.role_title),1)]),h("p",Eb,[h("span",{class:fe(["inline-block w-1.5 h-1.5 rounded-full",k.value?"bg-emerald-400 animate-pulse":"bg-txt-muted/50"])},null,2),he(" "+R($.value),1)])]),h("div",Tb,[h("label",Ab,[lt(h("input",{type:"checkbox","onUpdate:modelValue":C[4]||(C[4]=K=>A.value=K),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[_c,A.value]]),C[15]||(C[15]=he(" Summary ",-1))]),h("button",{type:"button",onClick:V,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")])]),h("div",{ref_key:"previewScrollEl",ref:L,class:"overflow-y-auto p-4 space-y-2 flex-1 font-mono text-xs"},[y.value?(_(),w("div",Cb,R(y.value),1)):x.value.length===0?(_(),w("div",Rb," Waiting for activity… ")):A.value?(_(),w(be,{key:2},[(_(!0),w(be,null,qe(E.value,(K,le)=>(_(),w("div",{key:le,class:"flex items-start gap-2 py-1.5 px-1"},[h("span",Ob,R(K.summary.icon),1),h("div",$b,[h("span",Pb,R(K.summary.summary),1),h("span",Ib,R(M(K.ts)),1)])]))),128)),E.value.length===0?(_(),w("div",jb," Processing… ")):Y("",!0)],64)):(_(!0),w(be,{key:3},qe(x.value,(K,le)=>(_(),w("div",{key:le,class:"border border-edge rounded-lg p-2.5 bg-surface-0"},[h("div",Nb,[h("span",Lb,R(K.type),1),h("span",Ub,R(M(K.ts)),1)]),h("pre",Db,R(B(K)),1)]))),128))],512),h("div",{class:"px-4 py-3 border-t border-edge flex justify-end"},[h("button",{type:"button",onClick:V,class:"bg-surface-3/50 hover:bg-surface-3/70 text-txt-secondary text-sm px-4 py-1.5 rounded-lg border border-edge transition-all duration-150"}," Close ")])])])):Y("",!0)]))}}),Bb={class:"flex flex-col h-full bg-surface-0"},Hb={class:"flex-1 overflow-y-auto p-6"},Fb={class:"max-w-4xl"},Vb={class:"flex justify-between items-end mb-6"},qb=["disabled"],Wb={key:0,class:"flex items-center gap-2 bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg mb-6 text-sm"},Kb={class:"mb-8"},Gb={key:0,class:"flex items-center justify-center py-10"},zb={key:1,class:"text-txt-muted text-sm text-center py-10"},Jb={key:2,class:"grid gap-3"},Yb={class:"flex justify-between items-start mb-2.5"},Xb={class:"flex items-center gap-3 min-w-0"},Zb={class:"min-w-0"},Qb={class:"font-semibold text-txt-primary text-sm"},ey={class:"flex items-center gap-1.5 mt-0.5 flex-wrap"},ty={class:"text-[10px] text-txt-muted font-mono"},sy={key:0,class:"text-[10px] text-txt-secondary bg-surface-3/50 px-1.5 py-0.5 rounded border border-edge"},ry={key:1,class:"text-[10px] text-purple-300 bg-purple-500/10 px-1.5 py-0.5 rounded border border-purple-500/20"},ny=["title"],iy={key:0,class:"bg-surface-0/60 border border-edge rounded-lg p-3 mb-2.5 ml-12"},oy={class:"text-sm text-txt-primary break-words"},ay={class:"flex justify-between items-center ml-12"},ly={class:"text-[10px] text-txt-muted"},cy=["onClick","disabled"],uy={key:0,class:"flex items-center justify-center py-10"},dy={key:1,class:"text-txt-muted text-sm text-center py-10"},hy={key:2,class:"relative"},fy={class:"space-y-1"},py=["onClick"],gy={class:"flex justify-between items-start gap-3"},my={class:"min-w-0 flex-1"},vy={class:"flex items-center gap-2 mb-0.5"},by={class:"text-sm font-medium text-txt-primary truncate group-hover:text-accent transition-colors"},yy={key:0,class:"text-[10px] text-txt-muted bg-surface-3/40 px-1.5 py-0.5 rounded border border-edge"},_y={class:"text-xs text-txt-secondary truncate"},wy={class:"text-[10px] text-txt-muted mt-1"},xy={key:0},ky={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},Sy={class:"bg-surface-1 border border-edge rounded-xl w-full max-w-2xl max-h-[85vh] flex flex-col shadow-2xl animate-fade-in"},Ey={class:"overflow-y-auto p-5 space-y-4"},Ty={key:0,class:"flex items-center justify-center py-10"},Ay={key:1,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},Cy={class:"flex justify-between items-start gap-3"},Ry={class:"text-sm text-txt-primary font-medium"},Oy={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},$y={class:"text-[11px] text-txt-muted font-mono break-all bg-surface-0/60 px-2 py-1 rounded border border-edge"},Py={key:0},Iy={class:"text-sm text-txt-secondary"},jy={class:"grid grid-cols-2 gap-4"},Ny={class:"text-sm text-txt-secondary"},Ly={class:"text-sm text-txt-secondary"},Uy={key:1},Dy={class:"text-sm text-accent font-mono"},My={class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 whitespace-pre-wrap break-words font-sans"},By={class:"flex justify-between items-center mb-2"},Hy={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},Fy={key:0,class:"text-sm text-txt-muted italic"},Vy={key:1,class:"text-sm text-txt-muted italic"},qy={key:2,class:"bg-surface-0/60 border border-edge rounded-lg divide-y divide-edge max-h-96 overflow-y-auto"},Wy=["onClick"],Ky={class:"shrink-0"},Gy={class:"flex-1 break-words"},zy={class:"text-[10px] text-txt-muted shrink-0"},Jy={key:0,class:"mt-2 pl-6 space-y-1"},Yy={key:0,class:"text-xs text-txt-secondary bg-surface-1 border border-edge rounded-lg p-2 whitespace-pre-wrap break-words font-mono"},Xy={class:"text-[11px] text-txt-muted bg-surface-1 border border-edge rounded-lg p-2 whitespace-pre-wrap break-words font-mono max-h-48 overflow-y-auto"},Zy={class:"text-[10px] text-txt-muted font-mono"},Qy={key:0,class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 whitespace-pre-wrap break-words font-mono max-h-96 overflow-y-auto"},e_={key:1,class:"text-sm text-txt-muted italic"},t_={class:"px-5 py-3 border-t border-edge flex justify-between items-center"},s_=["disabled"],r_={key:1},n_=gt({__name:"AgentActivityView",setup(t){const e=F([]),s=F([]),r=F(!0),n=F(null),i=F(new Set),o=F(null),a=F(null),l=F(!1),c=F(null),u=F([]),d=F(!1),f=F(!1),p=F(new Set);let m=null,b=null,x=null;const y=H=>H.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),k=H=>{if(!H)return"";const T=H.includes("T")?H:H.replace(" ","T")+"Z",C=new Date(T);return Number.isNaN(C.getTime())?H:C.toLocaleString()},A=H=>{switch(H){case"running":return"bg-accent/10 text-accent border border-accent/20";case"done":return"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20";case"failed":return"bg-red-500/10 text-red-400 border border-red-500/20";case"cancelled":return"bg-amber-500/10 text-amber-400 border border-amber-500/20";default:return"bg-surface-3/50 text-txt-muted border border-edge"}},L=$e(()=>{if(!a.value)return null;const H=a.value.started_at,T=a.value.completed_at;if(!H||!T)return null;const C=new Date(H.includes("T")?H:H.replace(" ","T")+"Z").getTime(),K=new Date(T.includes("T")?T:T.replace(" ","T")+"Z").getTime();if(Number.isNaN(C)||Number.isNaN(K))return null;const le=Math.max(0,Math.round((K-C)/1e3));if(le<60)return`${le}s`;const Le=Math.floor(le/60),I=le%60;return`${Le}m ${I}s`}),N=async H=>{if(!i.value.has(H)){i.value=new Set(i.value).add(H);try{await ke(`/api/tasks/${encodeURIComponent(H)}/cancel`,{method:"POST"}),await M(),o.value===H&&await B(H)}catch(T){n.value=T instanceof Error?T.message:"Failed to stop task"}finally{const T=new Set(i.value);T.delete(H),i.value=T}}},$=async()=>{try{const H=await ke("/api/agents");if(!H.ok)throw new Error(`HTTP error! status: ${H.status}`);const T=await H.json();e.value=T.agents}catch(H){n.value=H instanceof Error?H.message:"Failed to load agents"}},E=async()=>{try{const H=await ke("/api/tasks?limit=50");if(!H.ok)throw new Error(`HTTP error! status: ${H.status}`);const T=await H.json();s.value=T.tasks}catch(H){n.value=H instanceof Error?H.message:"Failed to load tasks"}},M=async()=>{r.value=!0,n.value=null;try{await Promise.all([$(),E()])}finally{r.value=!1}},B=async H=>{l.value=!0,c.value=null;try{const T=await ke(`/api/tasks/${encodeURIComponent(H)}`);if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);const C=await T.json();a.value=C.task}catch(T){c.value=T instanceof Error?T.message:"Failed to load task",a.value=null}finally{l.value=!1}},te=H=>{if(!H)return"";const T=new Date(H);return Number.isNaN(T.getTime())?"":T.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},de=H=>{try{return JSON.stringify(H,null,2)}catch{return String(H)}},V=H=>{if(H.status==="success")return"text-emerald-300";if(H.status==="error")return"text-red-300";if(H.status==="pending")return"text-accent";switch(H.kind){case"message":return"text-txt-primary";case"reasoning":return"text-purple-300";case"tool":return"text-blue-300";case"outcome":return"text-amber-300";default:return"text-txt-secondary"}},q=H=>{if(f.value)return;const T=new Set(p.value);T.has(H)?T.delete(H):T.add(H),p.value=T},O=async(H,T={})=>{T.initial&&(d.value=!0);try{const C=await ke(`/api/tasks/${encodeURIComponent(H)}/activity`);if(!C.ok)return;const K=await C.json();u.value=K.activity??[]}catch{}finally{T.initial&&(d.value=!1)}},ce=H=>{b||(b=setTimeout(()=>{b=null,o.value===H&&O(H)},250))},ge=H=>{ie(),O(H,{initial:!0});try{m=new EventSource(zn(`/api/tasks/${encodeURIComponent(H)}/events`)),m.onmessage=()=>{ce(H)},m.onerror=()=>{}}catch{m=null}},ie=()=>{m&&(m.close(),m=null),b&&(clearTimeout(b),b=null)},me=H=>{o.value=H,a.value=null,u.value=[],p.value=new Set,B(H),ge(H)},We=()=>{o.value=null,a.value=null,c.value=null,u.value=[],p.value=new Set,ie()},Xe=H=>{H.key==="Escape"&&o.value&&We()};return us(o,H=>{H?document.addEventListener("keydown",Xe):document.removeEventListener("keydown",Xe)}),ts(()=>{M(),x=setInterval(M,5e3)}),us(()=>{var H;return(H=a.value)==null?void 0:H.status},H=>{H&&H!=="running"&&(o.value&&O(o.value),ie())}),Ln(()=>{x&&clearInterval(x),document.removeEventListener("keydown",Xe),ie()}),(H,T)=>(_(),w("div",Bb,[h("div",Hb,[h("div",Fb,[h("div",Vb,[T[2]||(T[2]=h("div",null,[h("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Activity"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Monitor agents and recent tasks")],-1)),h("button",{onClick:M,disabled:r.value,class:"px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150 bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 hover:border-accent/40 disabled:opacity-30 disabled:cursor-not-allowed"},R(r.value?"Refreshing…":"Refresh"),9,qb)]),n.value?(_(),w("div",Wb,[T[3]||(T[3]=h("span",null,"⚠",-1)),he(" "+R(n.value),1)])):Y("",!0),h("section",Kb,[T[7]||(T[7]=h("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Active Agents",-1)),r.value&&e.value.length===0?(_(),w("div",Gb,[...T[4]||(T[4]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading agents… ")],-1)])])):e.value.length===0?(_(),w("div",zb," No active agents ")):(_(),w("div",Jb,[(_(!0),w(be,null,qe(e.value,C=>(_(),w("div",{key:C.slug+(C.characterName||""),class:fe(["group bg-surface-2/40 border rounded-xl p-4 transition-all duration-200",C.status==="working"?"border-accent/20 hover:border-accent/35":"border-edge hover:border-edge-bright"])},[h("div",Yb,[h("div",Xb,[h("div",{class:fe(["w-9 h-9 rounded-xl flex items-center justify-center shrink-0 text-xs font-bold",C.status==="working"?"bg-accent/15 text-accent border border-accent/25":C.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"])},R((C.name??"?").charAt(0).toUpperCase()),3),h("div",Zb,[h("h3",Qb,R(C.name),1),h("div",ey,[h("span",ty,R(C.slug),1),C.roleTitle?(_(),w("span",sy,R(C.roleTitle),1)):Y("",!0),C.universe?(_(),w("span",ry," 🎬 "+R(C.universe),1)):Y("",!0),C.model&&C.status==="working"?(_(),w("span",{key:2,class:"text-[10px] text-emerald-300 bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20",title:`Model: ${C.model}`}," 🧠 "+R(C.model),9,ny)):Y("",!0)])])]),h("span",{class:fe(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",C.status==="working"?"bg-accent/10 text-accent border border-accent/20":C.status==="error"?"bg-red-500/10 text-red-400 border border-red-500/20":"bg-emerald-500/10 text-emerald-400 border border-emerald-500/20"])},[h("span",{class:fe(["w-1.5 h-1.5 rounded-full",C.status==="working"?"bg-accent animate-pulse":C.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),he(" "+R(C.status==="working"?"Working":C.status==="error"?"Error":"Idle"),1)],2)]),C.currentTask?(_(),w("div",iy,[T[5]||(T[5]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-wider mb-1"},"Current Task",-1)),h("p",oy,R(C.currentTask),1)])):Y("",!0),h("div",ay,[h("div",ly," Last updated: "+R(y(new Date)),1),C.status==="working"&&C.currentTaskId?(_(),w("button",{key:0,type:"button",onClick:K=>N(C.currentTaskId),disabled:i.value.has(C.currentTaskId),class:"text-[10px] font-medium px-2.5 py-1 rounded-md bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150 flex items-center gap-1",title:"Stop task"},[T[6]||(T[6]=h("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),he(" "+R(i.value.has(C.currentTaskId)?"Stopping…":"Stop"),1)],8,cy)):Y("",!0)])],2))),128))]))]),h("section",null,[T[10]||(T[10]=h("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Recent Activity",-1)),r.value&&s.value.length===0?(_(),w("div",uy,[...T[8]||(T[8]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading activity… ")],-1)])])):s.value.length===0?(_(),w("div",dy," No recent activity yet ")):(_(),w("div",hy,[T[9]||(T[9]=h("div",{class:"absolute left-[15px] top-0 bottom-0 w-px bg-gradient-to-b from-accent/30 via-edge to-transparent"},null,-1)),h("div",fy,[(_(!0),w(be,null,qe(s.value,C=>(_(),w("button",{key:C.task_id,type:"button",onClick:K=>me(C.task_id),class:"w-full text-left relative pl-10 pr-4 py-3 rounded-lg hover:bg-surface-2/40 transition-all duration-150 group"},[h("div",{class:fe(["absolute left-[11px] top-4 w-[9px] h-[9px] rounded-full border-2 z-10",C.status==="running"?"bg-accent border-accent shadow-glow-sm":C.status==="done"?"bg-emerald-400 border-emerald-400":C.status==="failed"?"bg-red-400 border-red-400":C.status==="cancelled"?"bg-amber-400 border-amber-400":"bg-surface-3 border-edge"])},null,2),h("div",gy,[h("div",my,[h("div",vy,[h("span",by,R(C.agent_slug),1),C.origin_channel?(_(),w("span",yy,"via "+R(C.origin_channel),1)):Y("",!0)]),h("p",_y,R(C.description),1),h("p",wy,[he(R(k(C.started_at))+" ",1),C.completed_at?(_(),w("span",xy," · "+R(k(C.completed_at)),1)):Y("",!0)])]),h("span",{class:fe(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",A(C.status)])},[C.status==="running"?(_(),w("span",ky)):Y("",!0),he(" "+R(C.status),1)],2)])],8,py))),128))])]))])])]),o.value?(_(),w("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:Yt(We,["self"])},[h("div",Sy,[h("div",{class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},[T[11]||(T[11]=h("h3",{class:"text-sm font-semibold text-txt-primary"},"Task Details",-1)),h("button",{type:"button",onClick:We,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")]),h("div",Ey,[l.value?(_(),w("div",Ty,[...T[12]||(T[12]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading task… ")],-1)])])):c.value?(_(),w("div",Ay,R(c.value),1)):a.value?(_(),w(be,{key:2},[h("div",Cy,[h("div",null,[T[13]||(T[13]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Agent",-1)),h("p",Ry,R(a.value.agent_slug),1)]),h("span",{class:fe(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",A(a.value.status)])},[a.value.status==="running"?(_(),w("span",Oy)):Y("",!0),he(" "+R(a.value.status),1)],2)]),h("div",null,[T[14]||(T[14]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Task ID",-1)),h("p",$y,R(a.value.task_id),1)]),a.value.origin_channel?(_(),w("div",Py,[T[15]||(T[15]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Origin",-1)),h("p",Iy,R(a.value.origin_channel),1)])):Y("",!0),h("div",jy,[h("div",null,[T[16]||(T[16]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Started",-1)),h("p",Ny,R(k(a.value.started_at)),1)]),h("div",null,[T[17]||(T[17]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Completed",-1)),h("p",Ly,R(a.value.completed_at?k(a.value.completed_at):"—"),1)])]),L.value?(_(),w("div",Uy,[T[18]||(T[18]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Duration",-1)),h("p",Dy,R(L.value),1)])):Y("",!0),h("div",null,[T[19]||(T[19]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Description",-1)),h("pre",My,R(a.value.description),1)]),h("div",null,[h("div",By,[T[21]||(T[21]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted"},"Activity",-1)),h("label",Hy,[lt(h("input",{type:"checkbox","onUpdate:modelValue":T[0]||(T[0]=C=>f.value=C),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[_c,f.value]]),T[20]||(T[20]=he(" Show details ",-1))])]),d.value&&u.value.length===0?(_(),w("div",Fy,"Loading activity…")):u.value.length===0?(_(),w("div",Vy,"No activity yet")):(_(),w("ul",qy,[(_(!0),w(be,null,qe(u.value,(C,K)=>(_(),w("li",{key:`${C.ts}-${K}-${C.rawType}`,class:"px-3 py-2 text-sm hover:bg-surface-2/40 cursor-pointer transition-colors",onClick:le=>q(K)},[h("div",{class:fe(["flex items-start gap-2",V(C)])},[h("span",Ky,R(C.icon),1),h("span",Gy,R(C.summary),1),h("span",zy,R(te(C.ts)),1)],2),f.value||p.value.has(K)?(_(),w("div",Jy,[C.detail?(_(),w("pre",Yy,R(C.detail),1)):Y("",!0),h("pre",Xy,R(de(C.raw)),1),h("p",Zy,R(C.rawType),1)])):Y("",!0)],8,Wy))),128))]))]),h("div",null,[T[22]||(T[22]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Result",-1)),a.value.result?(_(),w("pre",Qy,R(a.value.result),1)):(_(),w("p",e_,"No result yet"))])],64)):Y("",!0)]),h("div",t_,[a.value&&a.value.status==="running"?(_(),w("button",{key:0,type:"button",onClick:T[1]||(T[1]=C=>N(a.value.task_id)),disabled:i.value.has(a.value.task_id),class:"text-xs font-medium px-3 py-1.5 rounded-lg bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150"},R(i.value.has(a.value.task_id)?"Stopping…":"Stop Task"),9,s_)):(_(),w("span",r_)),h("button",{type:"button",onClick:We,class:"bg-surface-3/50 hover:bg-surface-3/70 text-txt-secondary text-sm px-4 py-1.5 rounded-lg border border-edge transition-all duration-150"}," Close ")])])])):Y("",!0)]))}}),i_={class:"flex flex-col h-full"},o_={class:"flex-1 overflow-y-auto p-6"},a_={class:"flex justify-between items-center mb-6"},l_=["disabled"],c_={key:0,class:"flex items-center justify-center py-16"},u_={key:1,class:"bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl mb-4 text-sm"},d_={open:"",class:"mb-8 group/section"},h_={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},f_={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},p_={key:0,class:"flex flex-col items-center py-8"},g_={key:1,class:"grid gap-3"},m_={class:"flex flex-wrap items-start gap-3"},v_={class:"flex-1 min-w-0"},b_={class:"flex flex-wrap items-center gap-2 mb-1.5"},y_={class:"font-semibold text-txt-primary break-words min-w-0"},__={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},w_={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},x_={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},k_={key:0,class:"flex items-center gap-1 shrink-0"},S_={key:1,class:"flex items-center gap-1 shrink-0"},E_={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},T_={class:"flex flex-wrap items-center gap-1.5"},A_=["onClick","disabled"],C_=["onClick","disabled"],R_=["onClick","disabled"],O_=["onClick"],$_=["onClick","disabled"],P_={key:0,class:"mt-3"},I_=["onClick"],j_={key:1,class:"mt-4 pt-4 border-t border-edge/50"},N_={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},L_={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},U_={key:1,class:"text-txt-muted text-xs py-2 text-center"},D_={key:2,class:"space-y-1.5"},M_={class:"flex-1 min-w-0"},B_={class:"flex flex-wrap items-center gap-2"},H_={class:"text-txt-secondary"},F_={key:0,class:"text-txt-muted mt-0.5"},V_={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},q_={open:"",class:"group/section"},W_={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},K_={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},G_={key:0,class:"flex flex-col items-center py-8"},z_={key:1,class:"grid gap-3"},J_={class:"flex flex-wrap items-start gap-3"},Y_={class:"flex-1 min-w-0"},X_={class:"flex flex-wrap items-center gap-2 mb-1.5"},Z_={class:"font-semibold text-txt-primary break-words min-w-0"},Q_={class:"text-[10px] font-mono text-accent/60 bg-accent/5 px-2 py-0.5 rounded-full border border-accent/10 shrink-0"},ew={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},tw={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},sw={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},rw={key:0,class:"flex items-center gap-1 shrink-0"},nw={key:1,class:"flex items-center gap-1 shrink-0"},iw={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},ow={class:"flex flex-wrap items-center gap-1.5"},aw=["onClick","disabled"],lw=["onClick","disabled"],cw=["onClick","disabled"],uw=["onClick"],dw=["onClick","disabled"],hw={key:0,class:"mt-3"},fw=["onClick"],pw={key:1,class:"mt-4 pt-4 border-t border-edge/50"},gw={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},mw={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},vw={key:1,class:"text-txt-muted text-xs py-2 text-center"},bw={key:2,class:"space-y-1.5"},yw={class:"flex-1 min-w-0"},_w={class:"flex flex-wrap items-center gap-2"},ww={class:"text-txt-secondary"},xw={key:0,class:"text-txt-muted mt-0.5"},kw={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},Sw=gt({__name:"SchedulesView",setup(t){const e=F([]),s=F([]),r=F(!0),n=F(null),i=F(new Set),o=F(new Map),a=F(new Map),l=F(new Set),c=F(new Set);function u(N){const $=N.includes("T")||N.endsWith("Z")?N:N.replace(" ","T")+"Z";return new Date($).toLocaleString()}function d(N){return N==="done"?"bg-emerald-400":N==="failed"?"bg-red-400":"bg-accent animate-pulse"}function f(N){return N==="done"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":N==="failed"?"bg-red-500/10 text-red-400 border-red-500/20":"bg-accent/10 text-accent border-accent/20"}function p(N,$){const E=`${N}-${$}`,M=new Set(c.value);M.has(E)?M.delete(E):M.add(E),c.value=M}async function m(N,$){const E=`${N}-${$}`,M=o.value.get(E)??!1,B=new Map(o.value);if(B.set(E,!M),o.value=B,!M&&!a.value.has(E)){const te=new Set(l.value);te.add(E),l.value=te;try{const de=await ke(`/api/schedules/${N}/${$}/runs?limit=25`);if(de.ok){const V=await de.json(),q=new Map(a.value);q.set(E,V.runs??[]),a.value=q}}catch{}finally{const de=new Set(l.value);de.delete(E),l.value=de}}}async function b(){r.value=!0,n.value=null,a.value=new Map;try{const N=await ke("/api/schedules");if(!N.ok)throw new Error(`HTTP ${N.status}`);const $=await N.json();e.value=$.io,s.value=$.squads}catch(N){n.value=N instanceof Error?N.message:"Failed to load schedules"}finally{r.value=!1}}async function x(N,$){if(!i.value.has(N)){i.value=new Set(i.value).add(N);try{await $(),await b()}catch(E){n.value=E instanceof Error?E.message:"Action failed"}finally{const E=new Set(i.value);E.delete(N),i.value=E}}}async function y(N,$){await x(`${N}-${$}`,async()=>{const E=await ke(`/api/schedules/${N}/${$}/pause`,{method:"POST"});if(!E.ok)throw new Error(`HTTP ${E.status}`)})}async function k(N,$){await x(`${N}-${$}`,async()=>{const E=await ke(`/api/schedules/${N}/${$}/resume`,{method:"POST"});if(!E.ok)throw new Error(`HTTP ${E.status}`)})}async function A(N,$){await x(`${N}-${$}`,async()=>{const E=await ke(`/api/schedules/${N}/${$}/run-now`,{method:"POST"});if(!E.ok)throw new Error(`HTTP ${E.status}`)})}async function L(N,$,E){window.confirm(`Delete schedule '${E}'?`)&&await x(`${N}-${$}`,async()=>{const M=await ke(`/api/schedules/${N}/${$}`,{method:"DELETE"});if(!M.ok)throw new Error(`HTTP ${M.status}`)})}return ts(b),(N,$)=>(_(),w("div",i_,[h("div",o_,[h("div",a_,[$[1]||($[1]=h("div",null,[h("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Schedules"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Automated tasks & cron jobs")],-1)),h("button",{onClick:b,disabled:r.value,class:"flex items-center gap-1.5 bg-surface-2/60 hover:bg-surface-3/60 disabled:opacity-50 text-txt-secondary hover:text-txt-primary border border-edge hover:border-edge-bright px-3.5 py-2 rounded-xl text-sm transition-all duration-200"},[...$[0]||($[0]=[h("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.992 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182"})],-1),he(" Refresh ",-1)])],8,l_)]),r.value?(_(),w("div",c_,[...$[2]||($[2]=[h("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[h("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),he(" Loading schedules… ")],-1)])])):n.value?(_(),w("div",u_,R(n.value),1)):(_(),w(be,{key:2},[h("details",d_,[h("summary",h_,[$[3]||($[3]=h("svg",{class:"w-4 h-4 text-accent transition-transform group-open/section:rotate-90",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})],-1)),$[4]||($[4]=h("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"IO Schedules",-1)),h("span",f_,R(e.value.length),1),$[5]||($[5]=h("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),e.value.length===0?(_(),w("div",p_,[...$[6]||($[6]=[h("div",{class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},[h("svg",{class:"w-5 h-5 text-txt-muted",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1),h("p",{class:"text-txt-muted text-sm"},"No IO schedules configured",-1)])])):(_(),w("div",g_,[(_(!0),w(be,null,qe(e.value,E=>(_(),w("div",{key:E.id,class:"bg-surface-2/50 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden"},[h("div",m_,[h("div",v_,[h("div",b_,[h("span",y_,R(E.name),1),h("span",{class:fe(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",E.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[E.enabled?(_(),w("span",__)):Y("",!0),he(" "+R(E.enabled?"Active":"Paused"),1)],2)]),h("div",w_,[h("code",x_,R(E.cron_expr),1),E.next_run_at?(_(),w("span",k_,[$[7]||($[7]=h("svg",{class:"w-3 h-3",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 8.689c0-.864.933-1.405 1.683-.977l7.108 4.062a1.125 1.125 0 010 1.953l-7.108 4.062A1.125 1.125 0 013 16.811V8.69zM12.75 8.689c0-.864.933-1.405 1.683-.977l7.108 4.062a1.125 1.125 0 010 1.953l-7.108 4.062a1.125 1.125 0 01-1.683-.977V8.69z"})],-1)),he(" "+R(u(E.next_run_at)),1)])):Y("",!0),E.last_run_at?(_(),w("span",S_,[$[8]||($[8]=h("svg",{class:"w-3 h-3",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),he(" "+R(u(E.last_run_at)),1)])):Y("",!0)]),E.notes?(_(),w("p",E_,R(E.notes),1)):Y("",!0)]),h("div",T_,[E.enabled?(_(),w("button",{key:0,onClick:M=>y("io",E.id),disabled:i.value.has(`io-${E.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Pause"},"⏸ Pause",8,A_)):(_(),w("button",{key:1,onClick:M=>k("io",E.id),disabled:i.value.has(`io-${E.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Resume"},"▶ Resume",8,C_)),h("button",{onClick:M=>A("io",E.id),disabled:i.value.has(`io-${E.id}`),class:"text-accent hover:text-white disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-accent/10 hover:bg-accent/20 border border-accent/20 hover:border-accent/40 transition-all duration-200",title:"Run now"},"▶ Run now",8,R_),h("button",{onClick:M=>m("io",E.id),class:fe(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",o.value.get(`io-${E.id}`)?"bg-accent/10 text-accent border-accent/20":"bg-surface-3/40 hover:bg-surface-3 text-txt-secondary hover:text-txt-primary border-edge/50 hover:border-edge"]),title:"Toggle run history"},"📋 History",10,O_),h("button",{onClick:M=>L("io",E.id,E.name),disabled:i.value.has(`io-${E.id}`),class:"text-red-400/70 hover:text-red-400 disabled:opacity-50 text-xs px-2 py-1.5 rounded-lg hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition-all duration-200",title:"Delete"},[...$[9]||($[9]=[h("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})],-1)])],8,$_)])]),E.prompt?(_(),w("div",P_,[h("p",{class:fe(["text-xs text-txt-muted break-words",c.value.has(`io-${E.id}`)?"":"line-clamp-2"])},R(E.prompt),3),E.prompt.length>120?(_(),w("button",{key:0,onClick:M=>p("io",E.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},R(c.value.has(`io-${E.id}`)?"Show less ▲":"Show more ▼"),9,I_)):Y("",!0)])):Y("",!0),o.value.get(`io-${E.id}`)?(_(),w("div",j_,[h("h4",N_," Run history — "+R(E.name),1),l.value.has(`io-${E.id}`)?(_(),w("div",L_,[...$[10]||($[10]=[h("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),he(" Loading… ",-1)])])):!a.value.get(`io-${E.id}`)||a.value.get(`io-${E.id}`).length===0?(_(),w("div",U_," No history yet ")):(_(),w("ul",D_,[(_(!0),w(be,null,qe(a.value.get(`io-${E.id}`),M=>(_(),w("li",{key:M.id,class:"flex items-start gap-2.5 text-xs bg-surface-0/50 rounded-lg p-2.5 border border-edge/30"},[h("span",{class:fe(["w-2 h-2 rounded-full mt-1 shrink-0",d(M.status)])},null,2),h("div",M_,[h("div",B_,[h("span",H_,R(u(M.started_at)),1),h("span",{class:fe(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",f(M.status)])},R(M.status),3)]),M.completed_at?(_(),w("div",F_," Completed: "+R(u(M.completed_at)),1)):Y("",!0),M.error_text?(_(),w("div",V_,R(M.error_text),1)):Y("",!0)])]))),128))]))])):Y("",!0)]))),128))]))]),h("details",q_,[h("summary",W_,[$[11]||($[11]=h("svg",{class:"w-4 h-4 text-accent transition-transform group-open/section:rotate-90",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})],-1)),$[12]||($[12]=h("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"Squad Schedules",-1)),h("span",K_,R(s.value.length),1),$[13]||($[13]=h("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),s.value.length===0?(_(),w("div",G_,[...$[14]||($[14]=[h("div",{class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},[h("svg",{class:"w-5 h-5 text-txt-muted",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z"})])],-1),h("p",{class:"text-txt-muted text-sm"},"No squad schedules configured",-1)])])):(_(),w("div",z_,[(_(!0),w(be,null,qe(s.value,E=>(_(),w("div",{key:E.id,class:"bg-surface-2/50 border border-edge rounded-xl p-4 hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden"},[h("div",J_,[h("div",Y_,[h("div",X_,[h("span",Z_,R(E.name),1),h("span",Q_,R(E.squad_slug),1),h("span",{class:fe(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",E.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[E.enabled?(_(),w("span",ew)):Y("",!0),he(" "+R(E.enabled?"Active":"Paused"),1)],2)]),h("div",tw,[h("code",sw,R(E.cron_expr),1),E.next_run_at?(_(),w("span",rw,[$[15]||($[15]=h("svg",{class:"w-3 h-3",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 8.689c0-.864.933-1.405 1.683-.977l7.108 4.062a1.125 1.125 0 010 1.953l-7.108 4.062A1.125 1.125 0 013 16.811V8.69zM12.75 8.689c0-.864.933-1.405 1.683-.977l7.108 4.062a1.125 1.125 0 010 1.953l-7.108 4.062a1.125 1.125 0 01-1.683-.977V8.69z"})],-1)),he(" "+R(u(E.next_run_at)),1)])):Y("",!0),E.last_run_at?(_(),w("span",nw,[$[16]||($[16]=h("svg",{class:"w-3 h-3",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),he(" "+R(u(E.last_run_at)),1)])):Y("",!0)]),E.notes?(_(),w("p",iw,R(E.notes),1)):Y("",!0)]),h("div",ow,[E.enabled?(_(),w("button",{key:0,onClick:M=>y("squads",E.id),disabled:i.value.has(`squads-${E.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Pause"},"⏸ Pause",8,aw)):(_(),w("button",{key:1,onClick:M=>k("squads",E.id),disabled:i.value.has(`squads-${E.id}`),class:"text-txt-secondary hover:text-txt-primary disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-surface-3/40 hover:bg-surface-3 border border-edge/50 hover:border-edge transition-all duration-200",title:"Resume"},"▶ Resume",8,lw)),h("button",{onClick:M=>A("squads",E.id),disabled:i.value.has(`squads-${E.id}`),class:"text-accent hover:text-white disabled:opacity-50 text-xs px-2.5 py-1.5 rounded-lg bg-accent/10 hover:bg-accent/20 border border-accent/20 hover:border-accent/40 transition-all duration-200",title:"Run now"},"▶ Run now",8,cw),h("button",{onClick:M=>m("squads",E.id),class:fe(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",o.value.get(`squads-${E.id}`)?"bg-accent/10 text-accent border-accent/20":"bg-surface-3/40 hover:bg-surface-3 text-txt-secondary hover:text-txt-primary border-edge/50 hover:border-edge"]),title:"Toggle run history"},"📋 History",10,uw),h("button",{onClick:M=>L("squads",E.id,E.name),disabled:i.value.has(`squads-${E.id}`),class:"text-red-400/70 hover:text-red-400 disabled:opacity-50 text-xs px-2 py-1.5 rounded-lg hover:bg-red-500/10 border border-transparent hover:border-red-500/20 transition-all duration-200",title:"Delete"},[...$[17]||($[17]=[h("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})],-1)])],8,dw)])]),E.prompt?(_(),w("div",hw,[h("p",{class:fe(["text-xs text-txt-muted break-words",c.value.has(`squads-${E.id}`)?"":"line-clamp-2"])},R(E.prompt),3),E.prompt.length>120?(_(),w("button",{key:0,onClick:M=>p("squads",E.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},R(c.value.has(`squads-${E.id}`)?"Show less ▲":"Show more ▼"),9,fw)):Y("",!0)])):Y("",!0),o.value.get(`squads-${E.id}`)?(_(),w("div",pw,[h("h4",gw," Run history — "+R(E.name),1),l.value.has(`squads-${E.id}`)?(_(),w("div",mw,[...$[18]||($[18]=[h("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),he(" Loading… ",-1)])])):!a.value.get(`squads-${E.id}`)||a.value.get(`squads-${E.id}`).length===0?(_(),w("div",vw," No history yet ")):(_(),w("ul",bw,[(_(!0),w(be,null,qe(a.value.get(`squads-${E.id}`),M=>(_(),w("li",{key:M.id,class:"flex items-start gap-2.5 text-xs bg-surface-0/50 rounded-lg p-2.5 border border-edge/30"},[h("span",{class:fe(["w-2 h-2 rounded-full mt-1 shrink-0",d(M.status)])},null,2),h("div",yw,[h("div",_w,[h("span",ww,R(u(M.started_at)),1),h("span",{class:fe(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",f(M.status)])},R(M.status),3)]),M.completed_at?(_(),w("div",xw," Completed: "+R(u(M.completed_at)),1)):Y("",!0),M.error_text?(_(),w("div",kw,R(M.error_text),1)):Y("",!0)])]))),128))]))])):Y("",!0)]))),128))]))])],64))])]))}}),Ew={class:"flex flex-col h-full p-6"},Tw={class:"flex justify-between items-center mb-6"},Aw={key:0,class:"flex-1 flex items-center justify-center"},Cw={key:1,class:"flex-1 flex flex-col items-center justify-center"},Rw={key:2,class:"space-y-2 overflow-y-auto flex-1 pr-1"},Ow=["onClick"],$w={class:"p-4"},Pw={class:"flex items-start gap-3"},Iw={class:"flex flex-col items-center pt-1"},jw={key:0,class:"w-2 h-2 rounded-full bg-accent shadow-glow-sm shrink-0"},Nw={key:1,class:"w-2 h-2 rounded-full bg-edge shrink-0"},Lw={class:"flex-1 min-w-0"},Uw={class:"flex items-center gap-2 mb-1"},Dw={class:"text-sm font-medium text-txt-primary truncate"},Mw={key:0,class:"text-[10px] font-mono tracking-wider uppercase text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},Bw={class:"text-xs text-txt-muted"},Hw=["onClick"],Fw={key:0,class:"px-4 pb-4 pt-0"},Vw=["innerHTML"],qw=gt({__name:"NotificationsView",setup(t){const e=F([]),s=F(!0),r=F(new Set);function n(c){try{const u=c.includes("T")||c.endsWith("Z")?c:c.replace(" ","T")+"Z";return new Date(u).toLocaleString()}catch{return c}}function i(c){const u=new Set(r.value);u.has(c)?u.delete(c):u.add(c),r.value=u}async function o(){try{const c=await ke("/api/notifications?limit=100");if(c.ok){const u=await c.json();e.value=u.notifications??[]}}catch{}s.value=!1}async function a(c){try{await ke(`/api/notifications/${c}/read`,{method:"POST"});const u=e.value.find(d=>d.id===c);u&&(u.read_at=new Date().toISOString())}catch{}}async function l(){try{await ke("/api/notifications/read-all",{method:"POST"});for(const c of e.value)c.read_at||(c.read_at=new Date().toISOString())}catch{}}return ts(o),(c,u)=>(_(),w("div",Ew,[h("div",Tw,[u[0]||(u[0]=h("div",null,[h("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Notifications"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Background activity & alerts")],-1)),e.value.length>0?(_(),w("button",{key:0,onClick:l,class:"text-xs text-accent hover:text-accent-glow transition-colors font-medium"}," Mark all read ")):Y("",!0)]),s.value?(_(),w("div",Aw,[...u[1]||(u[1]=[h("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[h("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),he(" Loading… ")],-1)])])):e.value.length===0?(_(),w("div",Cw,[...u[2]||(u[2]=[h("div",{class:"w-12 h-12 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-4"},[h("svg",{class:"w-6 h-6 text-txt-muted",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"})])],-1),h("p",{class:"text-txt-muted text-sm"},"No notifications yet",-1)])])):(_(),w("ul",Rw,[(_(!0),w(be,null,qe(e.value,d=>{var f;return _(),w("li",{key:d.id,class:fe(["group rounded-xl border transition-all duration-200 cursor-pointer overflow-hidden",d.read_at?"bg-surface-1/40 border-edge/50 opacity-60 hover:opacity-80":"bg-surface-2/60 border-edge hover:border-edge-bright hover:shadow-card"]),onClick:p=>i(d.id)},[h("div",$w,[h("div",Pw,[h("div",Iw,[d.read_at?(_(),w("span",Nw)):(_(),w("span",jw))]),h("div",Lw,[h("div",Uw,[h("span",Dw,R(d.title),1),(f=d.source)!=null&&f.type?(_(),w("span",Mw,R(d.source.type),1)):Y("",!0)]),h("p",Bw,R(n(d.created_at)),1)]),d.read_at?Y("",!0):(_(),w("button",{key:0,onClick:Yt(p=>a(d.id),["stop"]),class:"text-txt-muted hover:text-accent shrink-0 opacity-0 group-hover:opacity-100 transition-all duration-200 p-1 rounded-lg hover:bg-accent/10",title:"Mark as read"},[...u[3]||(u[3]=[h("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[h("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"})],-1)])],8,Hw))])]),r.value.has(d.id)?(_(),w("div",Fw,[h("div",{class:"ml-5 mt-2 text-sm text-txt-secondary bg-surface-0/60 rounded-xl p-4 border border-edge/50 wiki-content",innerHTML:Oe(Jn)(d.text)},null,8,Vw)])):Y("",!0)],10,Ow)}),128))]))]))}}),Ww={class:"flex h-full overflow-hidden bg-surface-0"},Kw={class:"w-72 shrink-0 bg-surface-1/70 backdrop-blur-sm border-r border-edge flex flex-col"},Gw={class:"p-3.5 shrink-0"},zw={class:"flex items-center justify-between mb-3"},Jw={class:"text-[10px] text-txt-muted font-mono bg-surface-2/60 px-1.5 py-0.5 rounded"},Yw={key:0,class:"flex-1 flex items-center justify-center"},Xw={key:1,class:"flex-1 p-4"},Zw={class:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},Qw={key:2,class:"flex-1 overflow-y-auto py-2 px-2"},ex={key:0,class:"px-2 py-3 text-sm text-txt-muted text-center"},tx=["onClick"],sx={key:0,class:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-5 rounded-r-full bg-accent shadow-glow-sm"},rx={class:"flex-1 min-w-0 flex flex-col overflow-hidden"},nx={key:0,class:"flex-1 flex flex-col items-center justify-center select-none"},ix={key:1,class:"flex-1 flex items-center justify-center"},ox={key:2,class:"flex-1 p-6"},ax={class:"inline-flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},lx={key:3,class:"flex-1 overflow-y-auto"},cx={class:"max-w-3xl mx-auto px-6 py-6"},ux={class:"text-xl font-bold text-txt-primary mb-4 pb-3 border-b border-edge"},dx=["innerHTML"],hx=gt({__name:"WikiView",setup(t){const e=F([]),s=F(null),r=F(""),n=F(""),i=F(!1),o=F(!1),a=F(""),l=F(""),c=$e(()=>{const p=n.value.trim().toLowerCase();return p?e.value.filter(m=>m.title.toLowerCase().includes(p)):e.value}),u=$e(()=>Jn(r.value));async function d(){i.value=!0,a.value="";try{const p=await ke("/api/wiki");if(!p.ok)throw new Error(`HTTP ${p.status}`);const m=await p.json();e.value=m.pages??[]}catch(p){a.value=p instanceof Error?p.message:"Failed to load pages"}finally{i.value=!1}}async function f(p){var m;if(((m=s.value)==null?void 0:m.path)!==p.path){s.value=p,r.value="",o.value=!0,l.value="";try{const b=await ke(`/api/wiki/${encodeURIComponent(p.path)}`);if(!b.ok)throw new Error(`HTTP ${b.status}`);const x=await b.json();r.value=x.content??""}catch(b){l.value=b instanceof Error?b.message:"Failed to load page"}finally{o.value=!1}}}return ts(d),(p,m)=>(_(),w("div",Ww,[h("div",Kw,[h("div",Gw,[h("div",zw,[m[1]||(m[1]=h("h2",{class:"text-sm font-semibold text-txt-primary tracking-tight flex items-center gap-1.5"},[h("span",{class:"text-base"},"📚"),he(" Wiki ")],-1)),h("span",Jw,R(c.value.length),1)]),lt(h("input",{"onUpdate:modelValue":m[0]||(m[0]=b=>n.value=b),type:"text",placeholder:"Filter pages…",class:"w-full px-3 py-1.5 text-sm bg-surface-2/50 border border-edge rounded-lg text-txt-primary placeholder-txt-muted/50 focus:outline-none focus:border-accent/40 focus:shadow-glow-sm transition-all duration-200"},null,512),[[yt,n.value]])]),m[3]||(m[3]=h("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-edge to-transparent"},null,-1)),i.value?(_(),w("div",Yw,[...m[2]||(m[2]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading… ")],-1)])])):a.value?(_(),w("div",Xw,[h("div",Zw,R(a.value),1)])):(_(),w("ul",Qw,[c.value.length===0?(_(),w("li",ex," No pages found ")):Y("",!0),(_(!0),w(be,null,qe(c.value,b=>{var x,y,k;return _(),w("li",{key:b.path,onClick:A=>f(b),class:fe(["relative px-2.5 py-2 rounded-lg cursor-pointer text-sm transition-all duration-150 mb-0.5",((x=s.value)==null?void 0:x.path)===b.path?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"])},[((y=s.value)==null?void 0:y.path)===b.path?(_(),w("span",sx)):Y("",!0),h("span",{class:fe(((k=s.value)==null?void 0:k.path)===b.path?"ml-1":"")},R(b.title),3)],10,tx)}),128))]))]),h("div",rx,[s.value?o.value?(_(),w("div",ix,[...m[5]||(m[5]=[h("div",{class:"flex items-center gap-2 text-txt-muted text-sm"},[h("span",{class:"w-4 h-4 border-2 border-edge border-t-accent rounded-full animate-spin"}),he(" Loading… ")],-1)])])):l.value?(_(),w("div",ox,[h("div",ax,[m[6]||(m[6]=h("span",null,"⚠",-1)),he(" "+R(l.value),1)])])):(_(),w("div",lx,[h("div",cx,[h("h1",ux,R(s.value.title),1),h("div",{class:"wiki-content text-txt-secondary text-sm leading-relaxed",innerHTML:u.value},null,8,dx)])])):(_(),w("div",nx,[...m[4]||(m[4]=[h("div",{class:"w-12 h-12 rounded-xl bg-surface-2/60 border border-edge flex items-center justify-center mb-4"},[h("span",{class:"text-2xl"},"📖")],-1),h("p",{class:"text-txt-muted text-sm"},"Select a page to start reading",-1)])]))])]))}}),fx=Hr(hx,[["__scopeId","data-v-a74f92fe"]]),px={class:"relative flex items-center justify-center h-screen bg-surface-0 overflow-hidden"},gx={class:"relative w-full max-w-sm mx-4 animate-fade-in"},mx={class:"glass rounded-2xl border border-edge p-8 shadow-glow"},vx={key:0,class:"flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3.5 py-2.5"},bx=["disabled"],yx=gt({__name:"LoginView",setup(t){const e=Br(),s=Hc(),r=F(""),n=F(""),i=F(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)=>(_(),w("div",px,[l[6]||(l[6]=h("div",{class:"pointer-events-none absolute inset-0"},[h("div",{class:"absolute top-1/4 left-1/3 w-[500px] h-[500px] bg-accent/[0.04] rounded-full blur-[120px]"}),h("div",{class:"absolute bottom-1/4 right-1/4 w-[400px] h-[400px] bg-accent-dim/[0.06] rounded-full blur-[100px]"})],-1)),h("div",gx,[h("div",mx,[l[5]||(l[5]=Mn('<div class="flex flex-col items-center mb-8"><div class="w-14 h-14 rounded-xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-4 shadow-glow-sm"><span class="text-accent font-mono font-bold text-2xl tracking-tighter">IO</span></div><h1 class="text-xl font-semibold text-txt-primary tracking-tight">Welcome back</h1><p class="text-sm text-txt-muted mt-1">Sign in to continue</p></div>',1)),h("form",{onSubmit:Yt(o,["prevent"]),class:"space-y-5"},[h("div",null,[l[2]||(l[2]=h("label",{for:"email",class:"block text-xs font-medium text-txt-secondary mb-1.5 tracking-wide uppercase"},"Email",-1)),lt(h("input",{id:"email","onUpdate:modelValue":l[0]||(l[0]=c=>r.value=c),type:"email",required:"",autocomplete:"email",class:"w-full px-3.5 py-2.5 bg-surface-0/60 border border-edge rounded-xl text-txt-primary placeholder-txt-muted text-sm focus:outline-none focus:border-accent/50 focus:ring-1 focus:ring-accent/20 focus:shadow-glow-sm transition-all duration-200",placeholder:"you@example.com"},null,512),[[yt,r.value]])]),h("div",null,[l[3]||(l[3]=h("label",{for:"password",class:"block text-xs font-medium text-txt-secondary mb-1.5 tracking-wide uppercase"},"Password",-1)),lt(h("input",{id:"password","onUpdate:modelValue":l[1]||(l[1]=c=>n.value=c),type:"password",required:"",autocomplete:"current-password",class:"w-full px-3.5 py-2.5 bg-surface-0/60 border border-edge rounded-xl text-txt-primary placeholder-txt-muted text-sm focus:outline-none focus:border-accent/50 focus:ring-1 focus:ring-accent/20 focus:shadow-glow-sm transition-all duration-200",placeholder:"••••••••"},null,512),[[yt,n.value]])]),i.value?(_(),w("div",vx,[l[4]||(l[4]=h("svg",{class:"w-4 h-4 shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[h("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z","clip-rule":"evenodd"})],-1)),he(" "+R(i.value),1)])):Y("",!0),h("button",{type:"submit",disabled:Oe(e).loading,class:"w-full py-2.5 px-4 bg-accent hover:bg-accent-glow disabled:opacity-50 disabled:cursor-not-allowed text-surface-0 font-semibold text-sm rounded-xl transition-all duration-200 shadow-glow-sm hover:shadow-glow"},R(Oe(e).loading?"Signing in…":"Sign in"),9,bx)],32)])])]))}}),du=tp({history:Nf("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:yx,meta:{public:!0}},{path:"/chat",name:"chat",component:B0},{path:"/skills",name:"skills",component:Dv},{path:"/squads",name:"squads",component:Mb},{path:"/activity",name:"activity",component:n_},{path:"/wiki",name:"wiki",component:fx},{path:"/schedules",name:"schedules",component:Sw},{path:"/notifications",name:"notifications",component:qw},{path:"/inbox",name:"inbox",component:()=>b0(()=>import("./InboxView-BKYyyBKx.js"),[])}]});du.beforeEach(async t=>{const e=Br();return e.initialized||await e.init(),!e.authEnabled||t.meta.public||e.user?!0:{name:"login"}});const mo=Fh(g0);mo.use(Wh());mo.use(du);mo.mount("#app");export{be as F,h as a,Y as b,w as c,gt as d,he as e,Mn as f,F as g,ke as h,_ as i,Jn as j,ts as o,qe as r,R as t,Oe as u,Yt as w};