heyio 0.33.0 → 0.34.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.
- package/README.md +15 -2
- package/dist/api/server.js +20 -3
- package/dist/copilot/agents.js +42 -19
- package/dist/daemon.js +2 -2
- package/package.json +1 -1
- package/web-dist/assets/index-BHAZwBJG.css +10 -0
- package/web-dist/assets/index-D29OIK3_.js +88 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-Ddn6rUkk.js +0 -88
- package/web-dist/assets/index-KNbOV6QX.css +0 -10
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();/**
|
|
2
|
+
* @vue/shared v3.5.34
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/function da(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const je={},tn=[],qt=()=>{},Ll=()=>!1,Fr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Vr=e=>e.startsWith("onUpdate:"),Xe=Object.assign,ha=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},vd=Object.prototype.hasOwnProperty,Pe=(e,t)=>vd.call(e,t),ve=Array.isArray,sn=e=>Qn(e)==="[object Map]",qr=e=>Qn(e)==="[object Set]",Ha=e=>Qn(e)==="[object Date]",Te=e=>typeof e=="function",He=e=>typeof e=="string",Et=e=>typeof e=="symbol",Le=e=>e!==null&&typeof e=="object",Ml=e=>(Le(e)||Te(e))&&Te(e.then)&&Te(e.catch),jl=Object.prototype.toString,Qn=e=>jl.call(e),yd=e=>Qn(e).slice(8,-1),Dl=e=>Qn(e)==="[object Object]",zr=e=>He(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,En=da(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Kr=e=>{const t=Object.create(null);return s=>t[s]||(t[s]=e(s))},_d=/-\w/g,ut=Kr(e=>e.replace(_d,t=>t.slice(1).toUpperCase())),xd=/\B([A-Z])/g,Ds=Kr(e=>e.replace(xd,"-$1").toLowerCase()),Wr=Kr(e=>e.charAt(0).toUpperCase()+e.slice(1)),di=Kr(e=>e?`on${Wr(e)}`:""),Vt=(e,t)=>!Object.is(e,t),_r=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},Ul=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},fa=e=>{const t=parseFloat(e);return isNaN(t)?e:t},wd=e=>{const t=He(e)?Number(e):NaN;return isNaN(t)?e:t};let Fa;const Gr=()=>Fa||(Fa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function pa(e){if(ve(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],r=He(n)?Td(n):pa(n);if(r)for(const i in r)t[i]=r[i]}return t}else if(He(e)||Le(e))return e}const kd=/;(?![^(]*\))/g,Ed=/:([^]+)/,Sd=/\/\*[^]*?\*\//g;function Td(e){const t={};return e.replace(Sd,"").split(kd).forEach(s=>{if(s){const n=s.split(Ed);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ce(e){let t="";if(He(e))t=e;else if(ve(e))for(let s=0;s<e.length;s++){const n=ce(e[s]);n&&(t+=n+" ")}else if(Le(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const Ad="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Rd=da(Ad);function Bl(e){return!!e||e===""}function Cd(e,t){if(e.length!==t.length)return!1;let s=!0;for(let n=0;s&&n<e.length;n++)s=js(e[n],t[n]);return s}function js(e,t){if(e===t)return!0;let s=Ha(e),n=Ha(t);if(s||n)return s&&n?e.getTime()===t.getTime():!1;if(s=Et(e),n=Et(t),s||n)return e===t;if(s=ve(e),n=ve(t),s||n)return s&&n?Cd(e,t):!1;if(s=Le(e),n=Le(t),s||n){if(!s||!n)return!1;const r=Object.keys(e).length,i=Object.keys(t).length;if(r!==i)return!1;for(const a in e){const o=e.hasOwnProperty(a),l=t.hasOwnProperty(a);if(o&&!l||!o&&l||!js(e[a],t[a]))return!1}}return String(e)===String(t)}function Hl(e,t){return e.findIndex(s=>js(s,t))}const Fl=e=>!!(e&&e.__v_isRef===!0),C=e=>He(e)?e:e==null?"":ve(e)||Le(e)&&(e.toString===jl||!Te(e.toString))?Fl(e)?C(e.value):JSON.stringify(e,Vl,2):String(e),Vl=(e,t)=>Fl(t)?Vl(e,t.value):sn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,r],i)=>(s[hi(n,i)+" =>"]=r,s),{})}:qr(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>hi(s))}:Et(t)?hi(t):Le(t)&&!ve(t)&&!Dl(t)?String(t):t,hi=(e,t="")=>{var s;return Et(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};/**
|
|
6
|
+
* @vue/reactivity v3.5.34
|
|
7
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
|
+
* @license MIT
|
|
9
|
+
**/let Je;class ql{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Je&&(Je.active?(this.parent=Je,this.index=(Je.scopes||(Je.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].pause();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].resume();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].resume()}}run(t){if(this._active){const s=Je;try{return Je=this,t()}finally{Je=s}}}on(){++this._on===1&&(this.prevScope=Je,Je=this)}off(){if(this._on>0&&--this._on===0){if(Je===this)Je=this.prevScope;else{let t=Je;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s<n;s++)this.effects[s].stop();for(this.effects.length=0,s=0,n=this.cleanups.length;s<n;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,n=this.scopes.length;s<n;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function zl(e){return new ql(e)}function Kl(){return Je}function Od(e,t=!1){Je&&Je.cleanups.push(e)}let Ue;const fi=new WeakSet;class Wl{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Je&&(Je.active?Je.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,fi.has(this)&&(fi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Zl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Va(this),Jl(this);const t=Ue,s=Ct;Ue=this,Ct=!0;try{return this.fn()}finally{Yl(this),Ue=t,Ct=s,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)ba(t);this.deps=this.depsTail=void 0,Va(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?fi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Pi(this)&&this.run()}get dirty(){return Pi(this)}}let Gl=0,Sn,Tn;function Zl(e,t=!1){if(e.flags|=8,t){e.next=Tn,Tn=e;return}e.next=Sn,Sn=e}function ga(){Gl++}function ma(){if(--Gl>0)return;if(Tn){let t=Tn;for(Tn=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Sn;){let t=Sn;for(Sn=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function Jl(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Yl(e){let t,s=e.depsTail,n=s;for(;n;){const r=n.prevDep;n.version===-1?(n===s&&(s=r),ba(n),$d(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}e.deps=t,e.depsTail=s}function Pi(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xl(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xl(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Mn)||(e.globalVersion=Mn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Pi(e))))return;e.flags|=2;const t=e.dep,s=Ue,n=Ct;Ue=e,Ct=!0;try{Jl(e);const r=e.fn(e._value);(t.version===0||Vt(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Ue=s,Ct=n,Yl(e),e.flags&=-3}}function ba(e,t=!1){const{dep:s,prevSub:n,nextSub:r}=e;if(n&&(n.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)ba(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function $d(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let Ct=!0;const Ql=[];function is(){Ql.push(Ct),Ct=!1}function as(){const e=Ql.pop();Ct=e===void 0?!0:e}function Va(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Ue;Ue=void 0;try{t()}finally{Ue=s}}}let Mn=0;class Nd{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class va{constructor(t){this.computed=t,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(t){if(!Ue||!Ct||Ue===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Ue)s=this.activeLink=new Nd(Ue,this),Ue.deps?(s.prevDep=Ue.depsTail,Ue.depsTail.nextDep=s,Ue.depsTail=s):Ue.deps=Ue.depsTail=s,ec(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Ue.depsTail,s.nextDep=void 0,Ue.depsTail.nextDep=s,Ue.depsTail=s,Ue.deps===s&&(Ue.deps=n)}return s}trigger(t){this.version++,Mn++,this.notify(t)}notify(t){ga();try{for(let s=this.subs;s;s=s.prevSub)s.sub.notify()&&s.sub.dep.notify()}finally{ma()}}}function ec(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let n=t.deps;n;n=n.nextDep)ec(n)}const s=e.dep.subs;s!==e&&(e.prevSub=s,s&&(s.nextSub=e)),e.dep.subs=e}}const Sr=new WeakMap,Ps=Symbol(""),Li=Symbol(""),jn=Symbol("");function nt(e,t,s){if(Ct&&Ue){let n=Sr.get(e);n||Sr.set(e,n=new Map);let r=n.get(s);r||(n.set(s,r=new va),r.map=n,r.key=s),r.track()}}function ts(e,t,s,n,r,i){const a=Sr.get(e);if(!a){Mn++;return}const o=l=>{l&&l.trigger()};if(ga(),t==="clear")a.forEach(o);else{const l=ve(e),c=l&&zr(s);if(l&&s==="length"){const u=Number(n);a.forEach((d,f)=>{(f==="length"||f===jn||!Et(f)&&f>=u)&&o(d)})}else switch((s!==void 0||a.has(void 0))&&o(a.get(s)),c&&o(a.get(jn)),t){case"add":l?c&&o(a.get("length")):(o(a.get(Ps)),sn(e)&&o(a.get(Li)));break;case"delete":l||(o(a.get(Ps)),sn(e)&&o(a.get(Li)));break;case"set":sn(e)&&o(a.get(Ps));break}}ma()}function Id(e,t){const s=Sr.get(e);return s&&s.get(t)}function Bs(e){const t=$e(e);return t===e?t:(nt(t,"iterate",jn),bt(e)?t:t.map(Ot))}function Zr(e){return nt(e=$e(e),"iterate",jn),e}function Ut(e,t){return os(e)?on(ns(e)?Ot(t):t):Ot(t)}const Pd={__proto__:null,[Symbol.iterator](){return pi(this,Symbol.iterator,e=>Ut(this,e))},concat(...e){return Bs(this).concat(...e.map(t=>ve(t)?Bs(t):t))},entries(){return pi(this,"entries",e=>(e[1]=Ut(this,e[1]),e))},every(e,t){return Wt(this,"every",e,t,void 0,arguments)},filter(e,t){return Wt(this,"filter",e,t,s=>s.map(n=>Ut(this,n)),arguments)},find(e,t){return Wt(this,"find",e,t,s=>Ut(this,s),arguments)},findIndex(e,t){return Wt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Wt(this,"findLast",e,t,s=>Ut(this,s),arguments)},findLastIndex(e,t){return Wt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Wt(this,"forEach",e,t,void 0,arguments)},includes(...e){return gi(this,"includes",e)},indexOf(...e){return gi(this,"indexOf",e)},join(e){return Bs(this).join(e)},lastIndexOf(...e){return gi(this,"lastIndexOf",e)},map(e,t){return Wt(this,"map",e,t,void 0,arguments)},pop(){return gn(this,"pop")},push(...e){return gn(this,"push",e)},reduce(e,...t){return qa(this,"reduce",e,t)},reduceRight(e,...t){return qa(this,"reduceRight",e,t)},shift(){return gn(this,"shift")},some(e,t){return Wt(this,"some",e,t,void 0,arguments)},splice(...e){return gn(this,"splice",e)},toReversed(){return Bs(this).toReversed()},toSorted(e){return Bs(this).toSorted(e)},toSpliced(...e){return Bs(this).toSpliced(...e)},unshift(...e){return gn(this,"unshift",e)},values(){return pi(this,"values",e=>Ut(this,e))}};function pi(e,t,s){const n=Zr(e),r=n[t]();return n!==e&&!bt(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=s(i.value)),i}),r}const Ld=Array.prototype;function Wt(e,t,s,n,r,i){const a=Zr(e),o=a!==e&&!bt(e),l=a[t];if(l!==Ld[t]){const d=l.apply(e,i);return o?Ot(d):d}let c=s;a!==e&&(o?c=function(d,f){return s.call(this,Ut(e,d),f,e)}:s.length>2&&(c=function(d,f){return s.call(this,d,f,e)}));const u=l.call(a,c,n);return o&&r?r(u):u}function qa(e,t,s,n){const r=Zr(e),i=r!==e&&!bt(e);let a=s,o=!1;r!==e&&(i?(o=n.length===0,a=function(c,u,d){return o&&(o=!1,c=Ut(e,c)),s.call(this,c,Ut(e,u),d,e)}):s.length>3&&(a=function(c,u,d){return s.call(this,c,u,d,e)}));const l=r[t](a,...n);return o?Ut(e,l):l}function gi(e,t,s){const n=$e(e);nt(n,"iterate",jn);const r=n[t](...s);return(r===-1||r===!1)&&Jr(s[0])?(s[0]=$e(s[0]),n[t](...s)):r}function gn(e,t,s=[]){is(),ga();const n=$e(e)[t].apply(e,s);return ma(),as(),n}const Md=da("__proto__,__v_isRef,__isVue"),tc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Et));function jd(e){Et(e)||(e=String(e));const t=$e(this);return nt(t,"has",e),t.hasOwnProperty(e)}class sc{constructor(t=!1,s=!1){this._isReadonly=t,this._isShallow=s}get(t,s,n){if(s==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(s==="__v_isReactive")return!r;if(s==="__v_isReadonly")return r;if(s==="__v_isShallow")return i;if(s==="__v_raw")return n===(r?i?Wd:ac:i?ic:rc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(n)?t:void 0;const a=ve(t);if(!r){let l;if(a&&(l=Pd[s]))return l;if(s==="hasOwnProperty")return jd}const o=Reflect.get(t,s,qe(t)?t:n);if((Et(s)?tc.has(s):Md(s))||(r||nt(t,"get",s),i))return o;if(qe(o)){const l=a&&zr(s)?o:o.value;return r&&Le(l)?ji(l):l}return Le(o)?r?ji(o):lt(o):o}}class nc extends sc{constructor(t=!1){super(!1,t)}set(t,s,n,r){let i=t[s];const a=ve(t)&&zr(s);if(!this._isShallow){const c=os(i);if(!bt(n)&&!os(n)&&(i=$e(i),n=$e(n)),!a&&qe(i)&&!qe(n))return c||(i.value=n),!0}const o=a?Number(s)<t.length:Pe(t,s),l=Reflect.set(t,s,n,qe(t)?t:r);return t===$e(r)&&(o?Vt(n,i)&&ts(t,"set",s,n):ts(t,"add",s,n)),l}deleteProperty(t,s){const n=Pe(t,s);t[s];const r=Reflect.deleteProperty(t,s);return r&&n&&ts(t,"delete",s,void 0),r}has(t,s){const n=Reflect.has(t,s);return(!Et(s)||!tc.has(s))&&nt(t,"has",s),n}ownKeys(t){return nt(t,"iterate",ve(t)?"length":Ps),Reflect.ownKeys(t)}}class Dd extends sc{constructor(t=!1){super(!0,t)}set(t,s){return!0}deleteProperty(t,s){return!0}}const Ud=new nc,Bd=new Dd,Hd=new nc(!0);const Mi=e=>e,ar=e=>Reflect.getPrototypeOf(e);function Fd(e,t,s){return function(...n){const r=this.__v_raw,i=$e(r),a=sn(i),o=e==="entries"||e===Symbol.iterator&&a,l=e==="keys"&&a,c=r[e](...n),u=s?Mi:t?on:Ot;return!t&&nt(i,"iterate",l?Li:Ps),Xe(Object.create(c),{next(){const{value:d,done:f}=c.next();return f?{value:d,done:f}:{value:o?[u(d[0]),u(d[1])]:u(d),done:f}}})}}function or(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Vd(e,t){const s={get(r){const i=this.__v_raw,a=$e(i),o=$e(r);e||(Vt(r,o)&&nt(a,"get",r),nt(a,"get",o));const{has:l}=ar(a),c=t?Mi:e?on:Ot;if(l.call(a,r))return c(i.get(r));if(l.call(a,o))return c(i.get(o));i!==a&&i.get(r)},get size(){const r=this.__v_raw;return!e&&nt($e(r),"iterate",Ps),r.size},has(r){const i=this.__v_raw,a=$e(i),o=$e(r);return e||(Vt(r,o)&&nt(a,"has",r),nt(a,"has",o)),r===o?i.has(r):i.has(r)||i.has(o)},forEach(r,i){const a=this,o=a.__v_raw,l=$e(o),c=t?Mi:e?on:Ot;return!e&&nt(l,"iterate",Ps),o.forEach((u,d)=>r.call(i,c(u),c(d),a))}};return Xe(s,e?{add:or("add"),set:or("set"),delete:or("delete"),clear:or("clear")}:{add(r){const i=$e(this),a=ar(i),o=$e(r),l=!t&&!bt(r)&&!os(r)?o:r;return a.has.call(i,l)||Vt(r,l)&&a.has.call(i,r)||Vt(o,l)&&a.has.call(i,o)||(i.add(l),ts(i,"add",l,l)),this},set(r,i){!t&&!bt(i)&&!os(i)&&(i=$e(i));const a=$e(this),{has:o,get:l}=ar(a);let c=o.call(a,r);c||(r=$e(r),c=o.call(a,r));const u=l.call(a,r);return a.set(r,i),c?Vt(i,u)&&ts(a,"set",r,i):ts(a,"add",r,i),this},delete(r){const i=$e(this),{has:a,get:o}=ar(i);let l=a.call(i,r);l||(r=$e(r),l=a.call(i,r)),o&&o.call(i,r);const c=i.delete(r);return l&&ts(i,"delete",r,void 0),c},clear(){const r=$e(this),i=r.size!==0,a=r.clear();return i&&ts(r,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(r=>{s[r]=Fd(r,e,t)}),s}function ya(e,t){const s=Vd(e,t);return(n,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?n:Reflect.get(Pe(s,r)&&r in n?s:n,r,i)}const qd={get:ya(!1,!1)},zd={get:ya(!1,!0)},Kd={get:ya(!0,!1)};const rc=new WeakMap,ic=new WeakMap,ac=new WeakMap,Wd=new WeakMap;function Gd(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Zd(e){return e.__v_skip||!Object.isExtensible(e)?0:Gd(yd(e))}function lt(e){return os(e)?e:_a(e,!1,Ud,qd,rc)}function oc(e){return _a(e,!1,Hd,zd,ic)}function ji(e){return _a(e,!0,Bd,Kd,ac)}function _a(e,t,s,n,r){if(!Le(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=Zd(e);if(i===0)return e;const a=r.get(e);if(a)return a;const o=new Proxy(e,i===2?n:s);return r.set(e,o),o}function ns(e){return os(e)?ns(e.__v_raw):!!(e&&e.__v_isReactive)}function os(e){return!!(e&&e.__v_isReadonly)}function bt(e){return!!(e&&e.__v_isShallow)}function Jr(e){return e?!!e.__v_raw:!1}function $e(e){const t=e&&e.__v_raw;return t?$e(t):e}function xa(e){return!Pe(e,"__v_skip")&&Object.isExtensible(e)&&Ul(e,"__v_skip",!0),e}const Ot=e=>Le(e)?lt(e):e,on=e=>Le(e)?ji(e):e;function qe(e){return e?e.__v_isRef===!0:!1}function q(e){return lc(e,!1)}function Jd(e){return lc(e,!0)}function lc(e,t){return qe(e)?e:new Yd(e,t)}class Yd{constructor(t,s){this.dep=new va,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=s?t:$e(t),this._value=s?t:Ot(t),this.__v_isShallow=s}get value(){return this.dep.track(),this._value}set value(t){const s=this._rawValue,n=this.__v_isShallow||bt(t)||os(t);t=n?t:$e(t),Vt(t,s)&&(this._rawValue=t,this._value=n?t:Ot(t),this.dep.trigger())}}function Re(e){return qe(e)?e.value:e}const Xd={get:(e,t,s)=>t==="__v_raw"?e:Re(Reflect.get(e,t,s)),set:(e,t,s,n)=>{const r=e[t];return qe(r)&&!qe(s)?(r.value=s,!0):Reflect.set(e,t,s,n)}};function cc(e){return ns(e)?e:new Proxy(e,Xd)}function Qd(e){const t=ve(e)?new Array(e.length):{};for(const s in e)t[s]=th(e,s);return t}class eh{constructor(t,s,n){this._object=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Et(s)?s:String(s),this._raw=$e(t);let r=!0,i=t;if(!ve(t)||Et(this._key)||!zr(this._key))do r=!Jr(i)||bt(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let t=this._object[this._key];return this._shallow&&(t=Re(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&qe(this._raw[this._key])){const s=this._object[this._key];if(qe(s)){s.value=t;return}}this._object[this._key]=t}get dep(){return Id(this._raw,this._key)}}function th(e,t,s){return new eh(e,t,s)}class sh{constructor(t,s,n){this.fn=t,this.setter=s,this._value=void 0,this.dep=new va(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Mn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!s,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ue!==this)return Zl(this,!0),!0}get value(){const t=this.dep.track();return Xl(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function nh(e,t,s=!1){let n,r;return Te(e)?n=e:(n=e.get,r=e.set),new sh(n,r,s)}const lr={},Tr=new WeakMap;let Rs;function rh(e,t=!1,s=Rs){if(s){let n=Tr.get(s);n||Tr.set(s,n=[]),n.push(e)}}function ih(e,t,s=je){const{immediate:n,deep:r,once:i,scheduler:a,augmentJob:o,call:l}=s,c=E=>r?E:bt(E)||r===!1||r===0?ss(E,1):ss(E);let u,d,f,p,b=!1,v=!1;if(qe(e)?(d=()=>e.value,b=bt(e)):ns(e)?(d=()=>c(e),b=!0):ve(e)?(v=!0,b=e.some(E=>ns(E)||bt(E)),d=()=>e.map(E=>{if(qe(E))return E.value;if(ns(E))return c(E);if(Te(E))return l?l(E,2):E()})):Te(e)?t?d=l?()=>l(e,2):e:d=()=>{if(f){is();try{f()}finally{as()}}const E=Rs;Rs=u;try{return l?l(e,3,[p]):e(p)}finally{Rs=E}}:d=qt,t&&r){const E=d,A=r===!0?1/0:r;d=()=>ss(E(),A)}const T=Kl(),R=()=>{u.stop(),T&&T.active&&ha(T.effects,u)};if(i&&t){const E=t;t=(...A)=>{E(...A),R()}}let k=v?new Array(e.length).fill(lr):lr;const x=E=>{if(!(!(u.flags&1)||!u.dirty&&!E))if(t){const A=u.run();if(r||b||(v?A.some((N,O)=>Vt(N,k[O])):Vt(A,k))){f&&f();const N=Rs;Rs=u;try{const O=[A,k===lr?void 0:v&&k[0]===lr?[]:k,p];k=A,l?l(t,3,O):t(...O)}finally{Rs=N}}}else u.run()};return o&&o(x),u=new Wl(d),u.scheduler=a?()=>a(x,!1):x,p=E=>rh(E,!1,u),f=u.onStop=()=>{const E=Tr.get(u);if(E){if(l)l(E,4);else for(const A of E)A();Tr.delete(u)}},t?n?x(!0):k=u.run():a?a(x.bind(null,!0),!0):u.run(),R.pause=u.pause.bind(u),R.resume=u.resume.bind(u),R.stop=R,R}function ss(e,t=1/0,s){if(t<=0||!Le(e)||e.__v_skip||(s=s||new Map,(s.get(e)||0)>=t))return e;if(s.set(e,t),t--,qe(e))ss(e.value,t,s);else if(ve(e))for(let n=0;n<e.length;n++)ss(e[n],t,s);else if(qr(e)||sn(e))e.forEach(n=>{ss(n,t,s)});else if(Dl(e)){for(const n in e)ss(e[n],t,s);for(const n of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,n)&&ss(e[n],t,s)}return e}/**
|
|
10
|
+
* @vue/runtime-core v3.5.34
|
|
11
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
+
* @license MIT
|
|
13
|
+
**/function er(e,t,s,n){try{return n?e(...n):e()}catch(r){Yr(r,t,s)}}function $t(e,t,s,n){if(Te(e)){const r=er(e,t,s,n);return r&&Ml(r)&&r.catch(i=>{Yr(i,t,s)}),r}if(ve(e)){const r=[];for(let i=0;i<e.length;i++)r.push($t(e[i],t,s,n));return r}}function Yr(e,t,s,n=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||je;if(t){let o=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${s}`;for(;o;){const u=o.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,l,c)===!1)return}o=o.parent}if(i){is(),er(i,null,10,[e,l,c]),as();return}}ah(e,s,r,n,a)}function ah(e,t,s,n=!0,r=!1){if(r)throw e;console.error(e)}const ot=[];let Mt=-1;const nn=[];let ps=null,Gs=0;const uc=Promise.resolve();let Ar=null;function zt(e){const t=Ar||uc;return e?t.then(this?e.bind(this):e):t}function oh(e){let t=Mt+1,s=ot.length;for(;t<s;){const n=t+s>>>1,r=ot[n],i=Dn(r);i<e||i===e&&r.flags&2?t=n+1:s=n}return t}function wa(e){if(!(e.flags&1)){const t=Dn(e),s=ot[ot.length-1];!s||!(e.flags&2)&&t>=Dn(s)?ot.push(e):ot.splice(oh(t),0,e),e.flags|=1,dc()}}function dc(){Ar||(Ar=uc.then(fc))}function lh(e){ve(e)?nn.push(...e):ps&&e.id===-1?ps.splice(Gs+1,0,e):e.flags&1||(nn.push(e),e.flags|=1),dc()}function za(e,t,s=Mt+1){for(;s<ot.length;s++){const n=ot[s];if(n&&n.flags&2){if(e&&n.id!==e.uid)continue;ot.splice(s,1),s--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function hc(e){if(nn.length){const t=[...new Set(nn)].sort((s,n)=>Dn(s)-Dn(n));if(nn.length=0,ps){ps.push(...t);return}for(ps=t,Gs=0;Gs<ps.length;Gs++){const s=ps[Gs];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}ps=null,Gs=0}}const Dn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function fc(e){try{for(Mt=0;Mt<ot.length;Mt++){const t=ot[Mt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),er(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Mt<ot.length;Mt++){const t=ot[Mt];t&&(t.flags&=-2)}Mt=-1,ot.length=0,hc(),Ar=null,(ot.length||nn.length)&&fc()}}let gt=null,pc=null;function Rr(e){const t=gt;return gt=e,pc=e&&e.type.__scopeId||null,t}function Kt(e,t=gt,s){if(!t||e._n)return e;const n=(...r)=>{n._d&&$r(-1);const i=Rr(t);let a;try{a=e(...r)}finally{Rr(i),n._d&&$r(1)}return a};return n._n=!0,n._c=!0,n._d=!0,n}function Be(e,t){if(gt===null)return e;const s=si(gt),n=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[i,a,o,l=je]=t[r];i&&(Te(i)&&(i={mounted:i,updated:i}),i.deep&&ss(a),n.push({dir:i,instance:s,value:a,oldValue:void 0,arg:o,modifiers:l}))}return e}function ws(e,t,s,n){const r=e.dirs,i=t&&t.dirs;for(let a=0;a<r.length;a++){const o=r[a];i&&(o.oldValue=i[a].value);let l=o.dir[n];l&&(is(),$t(l,s,8,[e.el,o,e,t]),as())}}function xr(e,t){if(rt){let s=rt.provides;const n=rt.parent&&rt.parent.provides;n===s&&(s=rt.provides=Object.create(n)),s[e]=t}}function kt(e,t,s=!1){const n=Aa();if(n||Ls){let r=Ls?Ls._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return s&&Te(t)?t.call(n&&n.proxy):t}}function ch(){return!!(Aa()||Ls)}const uh=Symbol.for("v-scx"),dh=()=>kt(uh);function vt(e,t,s){return gc(e,t,s)}function gc(e,t,s=je){const{immediate:n,deep:r,flush:i,once:a}=s,o=Xe({},s),l=t&&n||!t&&i!=="post";let c;if(Hn){if(i==="sync"){const p=dh();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!l){const p=()=>{};return p.stop=qt,p.resume=qt,p.pause=qt,p}}const u=rt;o.call=(p,b,v)=>$t(p,u,b,v);let d=!1;i==="post"?o.scheduler=p=>{ht(p,u&&u.suspense)}:i!=="sync"&&(d=!0,o.scheduler=(p,b)=>{b?p():wa(p)}),o.augmentJob=p=>{t&&(p.flags|=4),d&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const f=ih(e,t,o);return Hn&&(c?c.push(f):l&&f()),f}function hh(e,t,s){const n=this.proxy,r=He(e)?e.includes(".")?mc(n,e):()=>n[e]:e.bind(n,n);let i;Te(t)?i=t:(i=t.handler,s=t);const a=sr(this),o=gc(r,i.bind(n),s);return a(),o}function mc(e,t){const s=t.split(".");return()=>{let n=e;for(let r=0;r<s.length&&n;r++)n=n[s[r]];return n}}const fh=Symbol("_vte"),bc=e=>e.__isTeleport,jt=Symbol("_leaveCb"),mn=Symbol("_enterCb");function ph(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return yt(()=>{e.isMounted=!0}),ka(()=>{e.isUnmounting=!0}),e}const xt=[Function,Array],vc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:xt,onEnter:xt,onAfterEnter:xt,onEnterCancelled:xt,onBeforeLeave:xt,onLeave:xt,onAfterLeave:xt,onLeaveCancelled:xt,onBeforeAppear:xt,onAppear:xt,onAfterAppear:xt,onAppearCancelled:xt},yc=e=>{const t=e.subTree;return t.component?yc(t.component):t},gh={name:"BaseTransition",props:vc,setup(e,{slots:t}){const s=Aa(),n=ph();return()=>{const r=t.default&&wc(t.default(),!0),i=r&&r.length?_c(r):s.subTree?B():void 0;if(!i)return;const a=$e(e),{mode:o}=a;if(n.isLeaving)return mi(i);const l=Ka(i);if(!l)return mi(i);let c=Di(l,a,n,s,d=>c=d);l.type!==ct&&Un(l,c);let u=s.subTree&&Ka(s.subTree);if(u&&u.type!==ct&&!Os(u,l)&&yc(s).type!==ct){let d=Di(u,a,n,s);if(Un(u,d),o==="out-in"&&l.type!==ct)return n.isLeaving=!0,d.afterLeave=()=>{n.isLeaving=!1,s.job.flags&8||s.update(),delete d.afterLeave,u=void 0},mi(i);o==="in-out"&&l.type!==ct?d.delayLeave=(f,p,b)=>{const v=xc(n,u);v[String(u.key)]=u,f[jt]=()=>{p(),f[jt]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{b(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function _c(e){let t=e[0];if(e.length>1){for(const s of e)if(s.type!==ct){t=s;break}}return t}const mh=gh;function xc(e,t){const{leavingVNodes:s}=e;let n=s.get(t.type);return n||(n=Object.create(null),s.set(t.type,n)),n}function Di(e,t,s,n,r){const{appear:i,mode:a,persisted:o=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:p,onAfterLeave:b,onLeaveCancelled:v,onBeforeAppear:T,onAppear:R,onAfterAppear:k,onAppearCancelled:x}=t,E=String(e.key),A=xc(s,e),N=(D,W)=>{D&&$t(D,n,9,W)},O=(D,W)=>{const ne=W[1];N(D,W),ve(D)?D.every(ee=>ee.length<=1)&&ne():D.length<=1&&ne()},L={mode:a,persisted:o,beforeEnter(D){let W=l;if(!s.isMounted)if(i)W=T||l;else return;D[jt]&&D[jt](!0);const ne=A[E];ne&&Os(e,ne)&&ne.el[jt]&&ne.el[jt](),N(W,[D])},enter(D){if(A[E]===e)return;let W=c,ne=u,ee=d;if(!s.isMounted)if(i)W=R||c,ne=k||u,ee=x||d;else return;let X=!1;D[mn]=$=>{X||(X=!0,$?N(ee,[D]):N(ne,[D]),L.delayedLeave&&L.delayedLeave(),D[mn]=void 0)};const I=D[mn].bind(null,!1);W?O(W,[D,I]):I()},leave(D,W){const ne=String(e.key);if(D[mn]&&D[mn](!0),s.isUnmounting)return W();N(f,[D]);let ee=!1;D[jt]=I=>{ee||(ee=!0,W(),I?N(v,[D]):N(b,[D]),D[jt]=void 0,A[ne]===e&&delete A[ne])};const X=D[jt].bind(null,!1);A[ne]=e,p?O(p,[D,X]):X()},clone(D){const W=Di(D,t,s,n,r);return r&&r(W),W}};return L}function mi(e){if(Xr(e))return e=_s(e),e.children=null,e}function Ka(e){if(!Xr(e))return bc(e.type)&&e.children?_c(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:s}=e;if(s){if(t&16)return s[0];if(t&32&&Te(s.default))return s.default()}}function Un(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Un(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function wc(e,t=!1,s){let n=[],r=0;for(let i=0;i<e.length;i++){let a=e[i];const o=s==null?a.key:String(s)+String(a.key!=null?a.key:i);a.type===we?(a.patchFlag&128&&r++,n=n.concat(wc(a.children,t,o))):(t||a.type!==ct)&&n.push(o!=null?_s(a,{key:o}):a)}if(r>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function st(e,t){return Te(e)?Xe({name:e.name},t,{setup:e}):e}function kc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Wa(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const Cr=new WeakMap;function An(e,t,s,n,r=!1){if(ve(e)){e.forEach((v,T)=>An(v,t&&(ve(t)?t[T]:t),s,n,r));return}if(Rn(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&An(e,t,s,n.component.subTree);return}const i=n.shapeFlag&4?si(n.component):n.el,a=r?null:i,{i:o,r:l}=e,c=t&&t.r,u=o.refs===je?o.refs={}:o.refs,d=o.setupState,f=$e(d),p=d===je?Ll:v=>Wa(u,v)?!1:Pe(f,v),b=(v,T)=>!(T&&Wa(u,T));if(c!=null&&c!==l){if(Ga(t),He(c))u[c]=null,p(c)&&(d[c]=null);else if(qe(c)){const v=t;b(c,v.k)&&(c.value=null),v.k&&(u[v.k]=null)}}if(Te(l))er(l,o,12,[a,u]);else{const v=He(l),T=qe(l);if(v||T){const R=()=>{if(e.f){const k=v?p(l)?d[l]:u[l]:b()||!e.k?l.value:u[e.k];if(r)ve(k)&&ha(k,i);else if(ve(k))k.includes(i)||k.push(i);else if(v)u[l]=[i],p(l)&&(d[l]=u[l]);else{const x=[i];b(l,e.k)&&(l.value=x),e.k&&(u[e.k]=x)}}else v?(u[l]=a,p(l)&&(d[l]=a)):T&&(b(l,e.k)&&(l.value=a),e.k&&(u[e.k]=a))};if(a){const k=()=>{R(),Cr.delete(e)};k.id=-1,Cr.set(e,k),ht(k,s)}else Ga(e),R()}}}function Ga(e){const t=Cr.get(e);t&&(t.flags|=8,Cr.delete(e))}Gr().requestIdleCallback;Gr().cancelIdleCallback;const Rn=e=>!!e.type.__asyncLoader,Xr=e=>e.type.__isKeepAlive;function bh(e,t){Ec(e,"a",t)}function vh(e,t){Ec(e,"da",t)}function Ec(e,t,s=rt){const n=e.__wdc||(e.__wdc=()=>{let r=s;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(Qr(t,n,s),s){let r=s.parent;for(;r&&r.parent;)Xr(r.parent.vnode)&&yh(n,t,s,r),r=r.parent}}function yh(e,t,s,n){const r=Qr(t,e,n,!0);tr(()=>{ha(n[t],r)},s)}function Qr(e,t,s=rt,n=!1){if(s){const r=s[e]||(s[e]=[]),i=t.__weh||(t.__weh=(...a)=>{is();const o=sr(s),l=$t(t,s,e,a);return o(),as(),l});return n?r.unshift(i):r.push(i),i}}const cs=e=>(t,s=rt)=>{(!Hn||e==="sp")&&Qr(e,(...n)=>t(...n),s)},_h=cs("bm"),yt=cs("m"),xh=cs("bu"),wh=cs("u"),ka=cs("bum"),tr=cs("um"),kh=cs("sp"),Eh=cs("rtg"),Sh=cs("rtc");function Th(e,t=rt){Qr("ec",e,t)}const Ah="components",Sc=Symbol.for("v-ndc");function Rh(e){return He(e)?Ch(Ah,e,!1)||e:e||Sc}function Ch(e,t,s=!0,n=!1){const r=gt||rt;if(r){const i=r.type;{const o=pf(i,!1);if(o&&(o===t||o===ut(t)||o===Wr(ut(t))))return i}const a=Za(r[e]||i[e],t)||Za(r.appContext[e],t);return!a&&n?i:a}}function Za(e,t){return e&&(e[t]||e[ut(t)]||e[Wr(ut(t))])}function Me(e,t,s,n){let r;const i=s,a=ve(e);if(a||He(e)){const o=a&&ns(e);let l=!1,c=!1;o&&(l=!bt(e),c=os(e),e=Zr(e)),r=new Array(e.length);for(let u=0,d=e.length;u<d;u++)r[u]=t(l?c?on(Ot(e[u])):Ot(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){r=new Array(e);for(let o=0;o<e;o++)r[o]=t(o+1,o,void 0,i)}else if(Le(e))if(e[Symbol.iterator])r=Array.from(e,(o,l)=>t(o,l,void 0,i));else{const o=Object.keys(e);r=new Array(o.length);for(let l=0,c=o.length;l<c;l++){const u=o[l];r[l]=t(e[u],u,l,i)}}else r=[];return r}const Ui=e=>e?zc(e)?si(e):Ui(e.parent):null,Cn=Xe(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ui(e.parent),$root:e=>Ui(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Ac(e),$forceUpdate:e=>e.f||(e.f=()=>{wa(e.update)}),$nextTick:e=>e.n||(e.n=zt.bind(e.proxy)),$watch:e=>hh.bind(e)}),bi=(e,t)=>e!==je&&!e.__isScriptSetup&&Pe(e,t),Oh={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:s,setupState:n,data:r,props:i,accessCache:a,type:o,appContext:l}=e;if(t[0]!=="$"){const f=a[t];if(f!==void 0)switch(f){case 1:return n[t];case 2:return r[t];case 4:return s[t];case 3:return i[t]}else{if(bi(n,t))return a[t]=1,n[t];if(r!==je&&Pe(r,t))return a[t]=2,r[t];if(Pe(i,t))return a[t]=3,i[t];if(s!==je&&Pe(s,t))return a[t]=4,s[t];Bi&&(a[t]=0)}}const c=Cn[t];let u,d;if(c)return t==="$attrs"&&nt(e.attrs,"get",""),c(e);if((u=o.__cssModules)&&(u=u[t]))return u;if(s!==je&&Pe(s,t))return a[t]=4,s[t];if(d=l.config.globalProperties,Pe(d,t))return d[t]},set({_:e},t,s){const{data:n,setupState:r,ctx:i}=e;return bi(r,t)?(r[t]=s,!0):n!==je&&Pe(n,t)?(n[t]=s,!0):Pe(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=s,!0)},has({_:{data:e,setupState:t,accessCache:s,ctx:n,appContext:r,props:i,type:a}},o){let l;return!!(s[o]||e!==je&&o[0]!=="$"&&Pe(e,o)||bi(t,o)||Pe(i,o)||Pe(n,o)||Pe(Cn,o)||Pe(r.config.globalProperties,o)||(l=a.__cssModules)&&l[o])},defineProperty(e,t,s){return s.get!=null?e._.accessCache[t]=0:Pe(s,"value")&&this.set(e,t,s.value,null),Reflect.defineProperty(e,t,s)}};function Ja(e){return ve(e)?e.reduce((t,s)=>(t[s]=null,t),{}):e}let Bi=!0;function $h(e){const t=Ac(e),s=e.proxy,n=e.ctx;Bi=!1,t.beforeCreate&&Ya(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:a,watch:o,provide:l,inject:c,created:u,beforeMount:d,mounted:f,beforeUpdate:p,updated:b,activated:v,deactivated:T,beforeDestroy:R,beforeUnmount:k,destroyed:x,unmounted:E,render:A,renderTracked:N,renderTriggered:O,errorCaptured:L,serverPrefetch:D,expose:W,inheritAttrs:ne,components:ee,directives:X,filters:I}=t;if(c&&Nh(c,n,null),a)for(const S in a){const H=a[S];Te(H)&&(n[S]=H.bind(s))}if(r){const S=r.call(s,s);Le(S)&&(e.data=lt(S))}if(Bi=!0,i)for(const S in i){const H=i[S],ie=Te(H)?H.bind(s,s):Te(H.get)?H.get.bind(s,s):qt,ge=!Te(H)&&Te(H.set)?H.set.bind(s):qt,ke=Ne({get:ie,set:ge});Object.defineProperty(n,S,{enumerable:!0,configurable:!0,get:()=>ke.value,set:Ae=>ke.value=Ae})}if(o)for(const S in o)Tc(o[S],n,s,S);if(l){const S=Te(l)?l.call(s):l;Reflect.ownKeys(S).forEach(H=>{xr(H,S[H])})}u&&Ya(u,e,"c");function y(S,H){ve(H)?H.forEach(ie=>S(ie.bind(s))):H&&S(H.bind(s))}if(y(_h,d),y(yt,f),y(xh,p),y(wh,b),y(bh,v),y(vh,T),y(Th,L),y(Sh,N),y(Eh,O),y(ka,k),y(tr,E),y(kh,D),ve(W))if(W.length){const S=e.exposed||(e.exposed={});W.forEach(H=>{Object.defineProperty(S,H,{get:()=>s[H],set:ie=>s[H]=ie,enumerable:!0})})}else e.exposed||(e.exposed={});A&&e.render===qt&&(e.render=A),ne!=null&&(e.inheritAttrs=ne),ee&&(e.components=ee),X&&(e.directives=X),D&&kc(e)}function Nh(e,t,s=qt){ve(e)&&(e=Hi(e));for(const n in e){const r=e[n];let i;Le(r)?"default"in r?i=kt(r.from||n,r.default,!0):i=kt(r.from||n):i=kt(r),qe(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:a=>i.value=a}):t[n]=i}}function Ya(e,t,s){$t(ve(e)?e.map(n=>n.bind(t.proxy)):e.bind(t.proxy),t,s)}function Tc(e,t,s,n){let r=n.includes(".")?mc(s,n):()=>s[n];if(He(e)){const i=t[e];Te(i)&&vt(r,i)}else if(Te(e))vt(r,e.bind(s));else if(Le(e))if(ve(e))e.forEach(i=>Tc(i,t,s,n));else{const i=Te(e.handler)?e.handler.bind(s):t[e.handler];Te(i)&&vt(r,i,e)}}function Ac(e){const t=e.type,{mixins:s,extends:n}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:a}}=e.appContext,o=i.get(t);let l;return o?l=o:!r.length&&!s&&!n?l=t:(l={},r.length&&r.forEach(c=>Or(l,c,a,!0)),Or(l,t,a)),Le(t)&&i.set(t,l),l}function Or(e,t,s,n=!1){const{mixins:r,extends:i}=t;i&&Or(e,i,s,!0),r&&r.forEach(a=>Or(e,a,s,!0));for(const a in t)if(!(n&&a==="expose")){const o=Ih[a]||s&&s[a];e[a]=o?o(e[a],t[a]):t[a]}return e}const Ih={data:Xa,props:Qa,emits:Qa,methods:_n,computed:_n,beforeCreate:it,created:it,beforeMount:it,mounted:it,beforeUpdate:it,updated:it,beforeDestroy:it,beforeUnmount:it,destroyed:it,unmounted:it,activated:it,deactivated:it,errorCaptured:it,serverPrefetch:it,components:_n,directives:_n,watch:Lh,provide:Xa,inject:Ph};function Xa(e,t){return t?e?function(){return Xe(Te(e)?e.call(this,this):e,Te(t)?t.call(this,this):t)}:t:e}function Ph(e,t){return _n(Hi(e),Hi(t))}function Hi(e){if(ve(e)){const t={};for(let s=0;s<e.length;s++)t[e[s]]=e[s];return t}return e}function it(e,t){return e?[...new Set([].concat(e,t))]:t}function _n(e,t){return e?Xe(Object.create(null),e,t):t}function Qa(e,t){return e?ve(e)&&ve(t)?[...new Set([...e,...t])]:Xe(Object.create(null),Ja(e),Ja(t??{})):t}function Lh(e,t){if(!e)return t;if(!t)return e;const s=Xe(Object.create(null),e);for(const n in t)s[n]=it(e[n],t[n]);return s}function Rc(){return{app:null,config:{isNativeTag:Ll,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 Mh=0;function jh(e,t){return function(n,r=null){Te(n)||(n=Xe({},n)),r!=null&&!Le(r)&&(r=null);const i=Rc(),a=new WeakSet,o=[];let l=!1;const c=i.app={_uid:Mh++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:mf,get config(){return i.config},set config(u){},use(u,...d){return a.has(u)||(u&&Te(u.install)?(a.add(u),u.install(c,...d)):Te(u)&&(a.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||de(n,r);return p.appContext=i,f===!0?f="svg":f===!1&&(f=void 0),e(p,u,f),l=!0,c._container=u,u.__vue_app__=c,si(p.component)}},onUnmount(u){o.push(u)},unmount(){l&&($t(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,d){return i.provides[u]=d,c},runWithContext(u){const d=Ls;Ls=c;try{return u()}finally{Ls=d}}};return c}}let Ls=null;const Dh=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${ut(t)}Modifiers`]||e[`${Ds(t)}Modifiers`];function Uh(e,t,...s){if(e.isUnmounted)return;const n=e.vnode.props||je;let r=s;const i=t.startsWith("update:"),a=i&&Dh(n,t.slice(7));a&&(a.trim&&(r=s.map(u=>He(u)?u.trim():u)),a.number&&(r=s.map(fa)));let o,l=n[o=di(t)]||n[o=di(ut(t))];!l&&i&&(l=n[o=di(Ds(t))]),l&&$t(l,e,6,r);const c=n[o+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[o])return;e.emitted[o]=!0,$t(c,e,6,r)}}const Bh=new WeakMap;function Cc(e,t,s=!1){const n=s?Bh:t.emitsCache,r=n.get(e);if(r!==void 0)return r;const i=e.emits;let a={},o=!1;if(!Te(e)){const l=c=>{const u=Cc(c,t,!0);u&&(o=!0,Xe(a,u))};!s&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!o?(Le(e)&&n.set(e,null),null):(ve(i)?i.forEach(l=>a[l]=null):Xe(a,i),Le(e)&&n.set(e,a),a)}function ei(e,t){return!e||!Fr(t)?!1:(t=t.slice(2).replace(/Once$/,""),Pe(e,t[0].toLowerCase()+t.slice(1))||Pe(e,Ds(t))||Pe(e,t))}function eo(e){const{type:t,vnode:s,proxy:n,withProxy:r,propsOptions:[i],slots:a,attrs:o,emit:l,render:c,renderCache:u,props:d,data:f,setupState:p,ctx:b,inheritAttrs:v}=e,T=Rr(e);let R,k;try{if(s.shapeFlag&4){const E=r||n,A=E;R=Ht(c.call(A,E,u,d,p,f,b)),k=o}else{const E=t;R=Ht(E.length>1?E(d,{attrs:o,slots:a,emit:l}):E(d,null)),k=t.props?o:Hh(o)}}catch(E){On.length=0,Yr(E,e,1),R=de(ct)}let x=R;if(k&&v!==!1){const E=Object.keys(k),{shapeFlag:A}=x;E.length&&A&7&&(i&&E.some(Vr)&&(k=Fh(k,i)),x=_s(x,k,!1,!0))}return s.dirs&&(x=_s(x,null,!1,!0),x.dirs=x.dirs?x.dirs.concat(s.dirs):s.dirs),s.transition&&Un(x,s.transition),R=x,Rr(T),R}const Hh=e=>{let t;for(const s in e)(s==="class"||s==="style"||Fr(s))&&((t||(t={}))[s]=e[s]);return t},Fh=(e,t)=>{const s={};for(const n in e)(!Vr(n)||!(n.slice(9)in t))&&(s[n]=e[n]);return s};function Vh(e,t,s){const{props:n,children:r,component:i}=e,{props:a,children:o,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(s&&l>=0){if(l&1024)return!0;if(l&16)return n?to(n,a,c):!!a;if(l&8){const u=t.dynamicProps;for(let d=0;d<u.length;d++){const f=u[d];if(Oc(a,n,f)&&!ei(c,f))return!0}}}else return(r||o)&&(!o||!o.$stable)?!0:n===a?!1:n?a?to(n,a,c):!0:!!a;return!1}function to(e,t,s){const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!0;for(let r=0;r<n.length;r++){const i=n[r];if(Oc(t,e,i)&&!ei(s,i))return!0}return!1}function Oc(e,t,s){const n=e[s],r=t[s];return s==="style"&&Le(n)&&Le(r)?!js(n,r):n!==r}function qh({vnode:e,parent:t,suspense:s},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=n,e=r),r===e)(e=t.vnode).el=n,t=t.parent;else break}s&&s.activeBranch===e&&(s.vnode.el=n)}const $c={},Nc=()=>Object.create($c),Ic=e=>Object.getPrototypeOf(e)===$c;function zh(e,t,s,n=!1){const r={},i=Nc();e.propsDefaults=Object.create(null),Pc(e,t,r,i);for(const a in e.propsOptions[0])a in r||(r[a]=void 0);s?e.props=n?r:oc(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function Kh(e,t,s,n){const{props:r,attrs:i,vnode:{patchFlag:a}}=e,o=$e(r),[l]=e.propsOptions;let c=!1;if((n||a>0)&&!(a&16)){if(a&8){const u=e.vnode.dynamicProps;for(let d=0;d<u.length;d++){let f=u[d];if(ei(e.emitsOptions,f))continue;const p=t[f];if(l)if(Pe(i,f))p!==i[f]&&(i[f]=p,c=!0);else{const b=ut(f);r[b]=Fi(l,o,b,p,e,!1)}else p!==i[f]&&(i[f]=p,c=!0)}}}else{Pc(e,t,r,i)&&(c=!0);let u;for(const d in o)(!t||!Pe(t,d)&&((u=Ds(d))===d||!Pe(t,u)))&&(l?s&&(s[d]!==void 0||s[u]!==void 0)&&(r[d]=Fi(l,o,d,void 0,e,!0)):delete r[d]);if(i!==o)for(const d in i)(!t||!Pe(t,d))&&(delete i[d],c=!0)}c&&ts(e.attrs,"set","")}function Pc(e,t,s,n){const[r,i]=e.propsOptions;let a=!1,o;if(t)for(let l in t){if(En(l))continue;const c=t[l];let u;r&&Pe(r,u=ut(l))?!i||!i.includes(u)?s[u]=c:(o||(o={}))[u]=c:ei(e.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,a=!0)}if(i){const l=$e(s),c=o||je;for(let u=0;u<i.length;u++){const d=i[u];s[d]=Fi(r,l,d,c[d],e,!Pe(c,d))}}return a}function Fi(e,t,s,n,r,i){const a=e[s];if(a!=null){const o=Pe(a,"default");if(o&&n===void 0){const l=a.default;if(a.type!==Function&&!a.skipFactory&&Te(l)){const{propsDefaults:c}=r;if(s in c)n=c[s];else{const u=sr(r);n=c[s]=l.call(null,t),u()}}else n=l;r.ce&&r.ce._setProp(s,n)}a[0]&&(i&&!o?n=!1:a[1]&&(n===""||n===Ds(s))&&(n=!0))}return n}const Wh=new WeakMap;function Lc(e,t,s=!1){const n=s?Wh:t.propsCache,r=n.get(e);if(r)return r;const i=e.props,a={},o=[];let l=!1;if(!Te(e)){const u=d=>{l=!0;const[f,p]=Lc(d,t,!0);Xe(a,f),p&&o.push(...p)};!s&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return Le(e)&&n.set(e,tn),tn;if(ve(i))for(let u=0;u<i.length;u++){const d=ut(i[u]);so(d)&&(a[d]=je)}else if(i)for(const u in i){const d=ut(u);if(so(d)){const f=i[u],p=a[d]=ve(f)||Te(f)?{type:f}:Xe({},f),b=p.type;let v=!1,T=!0;if(ve(b))for(let R=0;R<b.length;++R){const k=b[R],x=Te(k)&&k.name;if(x==="Boolean"){v=!0;break}else x==="String"&&(T=!1)}else v=Te(b)&&b.name==="Boolean";p[0]=v,p[1]=T,(v||Pe(p,"default"))&&o.push(d)}}const c=[a,o];return Le(e)&&n.set(e,c),c}function so(e){return e[0]!=="$"&&!En(e)}const Ea=e=>e==="_"||e==="_ctx"||e==="$stable",Sa=e=>ve(e)?e.map(Ht):[Ht(e)],Gh=(e,t,s)=>{if(t._n)return t;const n=Kt((...r)=>Sa(t(...r)),s);return n._c=!1,n},Mc=(e,t,s)=>{const n=e._ctx;for(const r in e){if(Ea(r))continue;const i=e[r];if(Te(i))t[r]=Gh(r,i,n);else if(i!=null){const a=Sa(i);t[r]=()=>a}}},jc=(e,t)=>{const s=Sa(t);e.slots.default=()=>s},Dc=(e,t,s)=>{for(const n in t)(s||!Ea(n))&&(e[n]=t[n])},Zh=(e,t,s)=>{const n=e.slots=Nc();if(e.vnode.shapeFlag&32){const r=t._;r?(Dc(n,t,s),s&&Ul(n,"_",r,!0)):Mc(t,n)}else t&&jc(e,t)},Jh=(e,t,s)=>{const{vnode:n,slots:r}=e;let i=!0,a=je;if(n.shapeFlag&32){const o=t._;o?s&&o===1?i=!1:Dc(r,t,s):(i=!t.$stable,Mc(t,r)),a=t}else t&&(jc(e,t),a={default:1});if(i)for(const o in r)!Ea(o)&&a[o]==null&&delete r[o]},ht=tf;function Yh(e){return Xh(e)}function Xh(e,t){const s=Gr();s.__VUE__=!0;const{insert:n,remove:r,patchProp:i,createElement:a,createText:o,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:f,setScopeId:p=qt,insertStaticContent:b}=e,v=(_,w,P,F=null,G=null,z=null,K=void 0,se=null,Y=!!w.dynamicChildren)=>{if(_===w)return;_&&!Os(_,w)&&(F=j(_),Ae(_,G,z,!0),_=null),w.patchFlag===-2&&(Y=!1,w.dynamicChildren=null);const{type:V,ref:be,shapeFlag:re}=w;switch(V){case ti:T(_,w,P,F);break;case ct:R(_,w,P,F);break;case wr:_==null&&k(w,P,F,K);break;case we:ee(_,w,P,F,G,z,K,se,Y);break;default:re&1?A(_,w,P,F,G,z,K,se,Y):re&6?X(_,w,P,F,G,z,K,se,Y):(re&64||re&128)&&V.process(_,w,P,F,G,z,K,se,Y,me)}be!=null&&G?An(be,_&&_.ref,z,w||_,!w):be==null&&_&&_.ref!=null&&An(_.ref,null,z,_,!0)},T=(_,w,P,F)=>{if(_==null)n(w.el=o(w.children),P,F);else{const G=w.el=_.el;w.children!==_.children&&c(G,w.children)}},R=(_,w,P,F)=>{_==null?n(w.el=l(w.children||""),P,F):w.el=_.el},k=(_,w,P,F)=>{[_.el,_.anchor]=b(_.children,w,P,F,_.el,_.anchor)},x=({el:_,anchor:w},P,F)=>{let G;for(;_&&_!==w;)G=f(_),n(_,P,F),_=G;n(w,P,F)},E=({el:_,anchor:w})=>{let P;for(;_&&_!==w;)P=f(_),r(_),_=P;r(w)},A=(_,w,P,F,G,z,K,se,Y)=>{if(w.type==="svg"?K="svg":w.type==="math"&&(K="mathml"),_==null)N(w,P,F,G,z,K,se,Y);else{const V=_.el&&_.el._isVueCE?_.el:null;try{V&&V._beginPatch(),D(_,w,G,z,K,se,Y)}finally{V&&V._endPatch()}}},N=(_,w,P,F,G,z,K,se)=>{let Y,V;const{props:be,shapeFlag:re,transition:pe,dirs:ye}=_;if(Y=_.el=a(_.type,z,be&&be.is,be),re&8?u(Y,_.children):re&16&&L(_.children,Y,null,F,G,vi(_,z),K,se),ye&&ws(_,null,F,"created"),O(Y,_,_.scopeId,K,F),be){for(const te in be)te!=="value"&&!En(te)&&i(Y,te,null,be[te],z,F);"value"in be&&i(Y,"value",null,be.value,z),(V=be.onVnodeBeforeMount)&&Pt(V,F,_)}ye&&ws(_,null,F,"beforeMount");const Z=Qh(G,pe);Z&&pe.beforeEnter(Y),n(Y,w,P),((V=be&&be.onVnodeMounted)||Z||ye)&&ht(()=>{try{V&&Pt(V,F,_),Z&&pe.enter(Y),ye&&ws(_,null,F,"mounted")}finally{}},G)},O=(_,w,P,F,G)=>{if(P&&p(_,P),F)for(let z=0;z<F.length;z++)p(_,F[z]);if(G){let z=G.subTree;if(w===z||Fc(z.type)&&(z.ssContent===w||z.ssFallback===w)){const K=G.vnode;O(_,K,K.scopeId,K.slotScopeIds,G.parent)}}},L=(_,w,P,F,G,z,K,se,Y=0)=>{for(let V=Y;V<_.length;V++){const be=_[V]=se?es(_[V]):Ht(_[V]);v(null,be,w,P,F,G,z,K,se)}},D=(_,w,P,F,G,z,K)=>{const se=w.el=_.el;let{patchFlag:Y,dynamicChildren:V,dirs:be}=w;Y|=_.patchFlag&16;const re=_.props||je,pe=w.props||je;let ye;if(P&&ks(P,!1),(ye=pe.onVnodeBeforeUpdate)&&Pt(ye,P,w,_),be&&ws(w,_,P,"beforeUpdate"),P&&ks(P,!0),(re.innerHTML&&pe.innerHTML==null||re.textContent&&pe.textContent==null)&&u(se,""),V?W(_.dynamicChildren,V,se,P,F,vi(w,G),z):K||H(_,w,se,null,P,F,vi(w,G),z,!1),Y>0){if(Y&16)ne(se,re,pe,P,G);else if(Y&2&&re.class!==pe.class&&i(se,"class",null,pe.class,G),Y&4&&i(se,"style",re.style,pe.style,G),Y&8){const Z=w.dynamicProps;for(let te=0;te<Z.length;te++){const ue=Z[te],_e=re[ue],Oe=pe[ue];(Oe!==_e||ue==="value")&&i(se,ue,_e,Oe,G,P)}}Y&1&&_.children!==w.children&&u(se,w.children)}else!K&&V==null&&ne(se,re,pe,P,G);((ye=pe.onVnodeUpdated)||be)&&ht(()=>{ye&&Pt(ye,P,w,_),be&&ws(w,_,P,"updated")},F)},W=(_,w,P,F,G,z,K)=>{for(let se=0;se<w.length;se++){const Y=_[se],V=w[se],be=Y.el&&(Y.type===we||!Os(Y,V)||Y.shapeFlag&198)?d(Y.el):P;v(Y,V,be,null,F,G,z,K,!0)}},ne=(_,w,P,F,G)=>{if(w!==P){if(w!==je)for(const z in w)!En(z)&&!(z in P)&&i(_,z,w[z],null,G,F);for(const z in P){if(En(z))continue;const K=P[z],se=w[z];K!==se&&z!=="value"&&i(_,z,se,K,G,F)}"value"in P&&i(_,"value",w.value,P.value,G)}},ee=(_,w,P,F,G,z,K,se,Y)=>{const V=w.el=_?_.el:o(""),be=w.anchor=_?_.anchor:o("");let{patchFlag:re,dynamicChildren:pe,slotScopeIds:ye}=w;ye&&(se=se?se.concat(ye):ye),_==null?(n(V,P,F),n(be,P,F),L(w.children||[],P,be,G,z,K,se,Y)):re>0&&re&64&&pe&&_.dynamicChildren&&_.dynamicChildren.length===pe.length?(W(_.dynamicChildren,pe,P,G,z,K,se),(w.key!=null||G&&w===G.subTree)&&Uc(_,w,!0)):H(_,w,P,be,G,z,K,se,Y)},X=(_,w,P,F,G,z,K,se,Y)=>{w.slotScopeIds=se,_==null?w.shapeFlag&512?G.ctx.activate(w,P,F,K,Y):I(w,P,F,G,z,K,Y):$(_,w,Y)},I=(_,w,P,F,G,z,K)=>{const se=_.component=cf(_,F,G);if(Xr(_)&&(se.ctx.renderer=me),uf(se,!1,K),se.asyncDep){if(G&&G.registerDep(se,y,K),!_.el){const Y=se.subTree=de(ct);R(null,Y,w,P),_.placeholder=Y.el}}else y(se,_,w,P,G,z,K)},$=(_,w,P)=>{const F=w.component=_.component;if(Vh(_,w,P))if(F.asyncDep&&!F.asyncResolved){S(F,w,P);return}else F.next=w,F.update();else w.el=_.el,F.vnode=w},y=(_,w,P,F,G,z,K)=>{const se=()=>{if(_.isMounted){let{next:re,bu:pe,u:ye,parent:Z,vnode:te}=_;{const _t=Bc(_);if(_t){re&&(re.el=te.el,S(_,re,K)),_t.asyncDep.then(()=>{ht(()=>{_.isUnmounted||V()},G)});return}}let ue=re,_e;ks(_,!1),re?(re.el=te.el,S(_,re,K)):re=te,pe&&_r(pe),(_e=re.props&&re.props.onVnodeBeforeUpdate)&&Pt(_e,Z,re,te),ks(_,!0);const Oe=eo(_),Ke=_.subTree;_.subTree=Oe,v(Ke,Oe,d(Ke.el),j(Ke),_,G,z),re.el=Oe.el,ue===null&&qh(_,Oe.el),ye&&ht(ye,G),(_e=re.props&&re.props.onVnodeUpdated)&&ht(()=>Pt(_e,Z,re,te),G)}else{let re;const{el:pe,props:ye}=w,{bm:Z,m:te,parent:ue,root:_e,type:Oe}=_,Ke=Rn(w);ks(_,!1),Z&&_r(Z),!Ke&&(re=ye&&ye.onVnodeBeforeMount)&&Pt(re,ue,w),ks(_,!0);{_e.ce&&_e.ce._hasShadowRoot()&&_e.ce._injectChildStyle(Oe,_.parent?_.parent.type:void 0);const _t=_.subTree=eo(_);v(null,_t,P,F,_,G,z),w.el=_t.el}if(te&&ht(te,G),!Ke&&(re=ye&&ye.onVnodeMounted)){const _t=w;ht(()=>Pt(re,ue,_t),G)}(w.shapeFlag&256||ue&&Rn(ue.vnode)&&ue.vnode.shapeFlag&256)&&_.a&&ht(_.a,G),_.isMounted=!0,w=P=F=null}};_.scope.on();const Y=_.effect=new Wl(se);_.scope.off();const V=_.update=Y.run.bind(Y),be=_.job=Y.runIfDirty.bind(Y);be.i=_,be.id=_.uid,Y.scheduler=()=>wa(be),ks(_,!0),V()},S=(_,w,P)=>{w.component=_;const F=_.vnode.props;_.vnode=w,_.next=null,Kh(_,w.props,F,P),Jh(_,w.children,P),is(),za(_),as()},H=(_,w,P,F,G,z,K,se,Y=!1)=>{const V=_&&_.children,be=_?_.shapeFlag:0,re=w.children,{patchFlag:pe,shapeFlag:ye}=w;if(pe>0){if(pe&128){ge(V,re,P,F,G,z,K,se,Y);return}else if(pe&256){ie(V,re,P,F,G,z,K,se,Y);return}}ye&8?(be&16&&Q(V,G,z),re!==V&&u(P,re)):be&16?ye&16?ge(V,re,P,F,G,z,K,se,Y):Q(V,G,z,!0):(be&8&&u(P,""),ye&16&&L(re,P,F,G,z,K,se,Y))},ie=(_,w,P,F,G,z,K,se,Y)=>{_=_||tn,w=w||tn;const V=_.length,be=w.length,re=Math.min(V,be);let pe;for(pe=0;pe<re;pe++){const ye=w[pe]=Y?es(w[pe]):Ht(w[pe]);v(_[pe],ye,P,null,G,z,K,se,Y)}V>be?Q(_,G,z,!0,!1,re):L(w,P,F,G,z,K,se,Y,re)},ge=(_,w,P,F,G,z,K,se,Y)=>{let V=0;const be=w.length;let re=_.length-1,pe=be-1;for(;V<=re&&V<=pe;){const ye=_[V],Z=w[V]=Y?es(w[V]):Ht(w[V]);if(Os(ye,Z))v(ye,Z,P,null,G,z,K,se,Y);else break;V++}for(;V<=re&&V<=pe;){const ye=_[re],Z=w[pe]=Y?es(w[pe]):Ht(w[pe]);if(Os(ye,Z))v(ye,Z,P,null,G,z,K,se,Y);else break;re--,pe--}if(V>re){if(V<=pe){const ye=pe+1,Z=ye<be?w[ye].el:F;for(;V<=pe;)v(null,w[V]=Y?es(w[V]):Ht(w[V]),P,Z,G,z,K,se,Y),V++}}else if(V>pe)for(;V<=re;)Ae(_[V],G,z,!0),V++;else{const ye=V,Z=V,te=new Map;for(V=Z;V<=pe;V++){const ft=w[V]=Y?es(w[V]):Ht(w[V]);ft.key!=null&&te.set(ft.key,V)}let ue,_e=0;const Oe=pe-Z+1;let Ke=!1,_t=0;const xs=new Array(Oe);for(V=0;V<Oe;V++)xs[V]=0;for(V=ye;V<=re;V++){const ft=_[V];if(_e>=Oe){Ae(ft,G,z,!0);continue}let It;if(ft.key!=null)It=te.get(ft.key);else for(ue=Z;ue<=pe;ue++)if(xs[ue-Z]===0&&Os(ft,w[ue])){It=ue;break}It===void 0?Ae(ft,G,z,!0):(xs[It-Z]=V+1,It>=_t?_t=It:Ke=!0,v(ft,w[It],P,null,G,z,K,se,Y),_e++)}const Da=Ke?ef(xs):tn;for(ue=Da.length-1,V=Oe-1;V>=0;V--){const ft=Z+V,It=w[ft],Ua=w[ft+1],Ba=ft+1<be?Ua.el||Hc(Ua):F;xs[V]===0?v(null,It,P,Ba,G,z,K,se,Y):Ke&&(ue<0||V!==Da[ue]?ke(It,P,Ba,2):ue--)}}},ke=(_,w,P,F,G=null)=>{const{el:z,type:K,transition:se,children:Y,shapeFlag:V}=_;if(V&6){ke(_.component.subTree,w,P,F);return}if(V&128){_.suspense.move(w,P,F);return}if(V&64){K.move(_,w,P,me);return}if(K===we){n(z,w,P);for(let re=0;re<Y.length;re++)ke(Y[re],w,P,F);n(_.anchor,w,P);return}if(K===wr){x(_,w,P);return}if(F!==2&&V&1&&se)if(F===0)se.beforeEnter(z),n(z,w,P),ht(()=>se.enter(z),G);else{const{leave:re,delayLeave:pe,afterLeave:ye}=se,Z=()=>{_.ctx.isUnmounted?r(z):n(z,w,P)},te=()=>{z._isLeaving&&z[jt](!0),re(z,()=>{Z(),ye&&ye()})};pe?pe(z,Z,te):te()}else n(z,w,P)},Ae=(_,w,P,F=!1,G=!1)=>{const{type:z,props:K,ref:se,children:Y,dynamicChildren:V,shapeFlag:be,patchFlag:re,dirs:pe,cacheIndex:ye,memo:Z}=_;if(re===-2&&(G=!1),se!=null&&(is(),An(se,null,P,_,!0),as()),ye!=null&&(w.renderCache[ye]=void 0),be&256){w.ctx.deactivate(_);return}const te=be&1&&pe,ue=!Rn(_);let _e;if(ue&&(_e=K&&K.onVnodeBeforeUnmount)&&Pt(_e,w,_),be&6)U(_.component,P,F);else{if(be&128){_.suspense.unmount(P,F);return}te&&ws(_,null,w,"beforeUnmount"),be&64?_.type.remove(_,w,P,me,F):V&&!V.hasOnce&&(z!==we||re>0&&re&64)?Q(V,w,P,!1,!0):(z===we&&re&384||!G&&be&16)&&Q(Y,w,P),F&&J(_)}const Oe=Z!=null&&ye==null;(ue&&(_e=K&&K.onVnodeUnmounted)||te||Oe)&&ht(()=>{_e&&Pt(_e,w,_),te&&ws(_,null,w,"unmounted"),Oe&&(_.el=null)},P)},J=_=>{const{type:w,el:P,anchor:F,transition:G}=_;if(w===we){M(P,F);return}if(w===wr){E(_);return}const z=()=>{r(P),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(_.shapeFlag&1&&G&&!G.persisted){const{leave:K,delayLeave:se}=G,Y=()=>K(P,z);se?se(_.el,z,Y):Y()}else z()},M=(_,w)=>{let P;for(;_!==w;)P=f(_),r(_),_=P;r(w)},U=(_,w,P)=>{const{bum:F,scope:G,job:z,subTree:K,um:se,m:Y,a:V}=_;no(Y),no(V),F&&_r(F),G.stop(),z&&(z.flags|=8,Ae(K,_,w,P)),se&&ht(se,w),ht(()=>{_.isUnmounted=!0},w)},Q=(_,w,P,F=!1,G=!1,z=0)=>{for(let K=z;K<_.length;K++)Ae(_[K],w,P,F,G)},j=_=>{if(_.shapeFlag&6)return j(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const w=f(_.anchor||_.el),P=w&&w[fh];return P?f(P):w};let ae=!1;const oe=(_,w,P)=>{let F;_==null?w._vnode&&(Ae(w._vnode,null,null,!0),F=w._vnode.component):v(w._vnode||null,_,w,null,null,null,P),w._vnode=_,ae||(ae=!0,za(F),hc(),ae=!1)},me={p:v,um:Ae,m:ke,r:J,mt:I,mc:L,pc:H,pbc:W,n:j,o:e};return{render:oe,hydrate:void 0,createApp:jh(oe)}}function vi({type:e,props:t},s){return s==="svg"&&e==="foreignObject"||s==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:s}function ks({effect:e,job:t},s){s?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Qh(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Uc(e,t,s=!1){const n=e.children,r=t.children;if(ve(n)&&ve(r))for(let i=0;i<n.length;i++){const a=n[i];let o=r[i];o.shapeFlag&1&&!o.dynamicChildren&&((o.patchFlag<=0||o.patchFlag===32)&&(o=r[i]=es(r[i]),o.el=a.el),!s&&o.patchFlag!==-2&&Uc(a,o)),o.type===ti&&(o.patchFlag===-1&&(o=r[i]=es(o)),o.el=a.el),o.type===ct&&!o.el&&(o.el=a.el)}}function ef(e){const t=e.slice(),s=[0];let n,r,i,a,o;const l=e.length;for(n=0;n<l;n++){const c=e[n];if(c!==0){if(r=s[s.length-1],e[r]<c){t[n]=r,s.push(n);continue}for(i=0,a=s.length-1;i<a;)o=i+a>>1,e[s[o]]<c?i=o+1:a=o;c<e[s[i]]&&(i>0&&(t[n]=s[i-1]),s[i]=n)}}for(i=s.length,a=s[i-1];i-- >0;)s[i]=a,a=t[a];return s}function Bc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Bc(t)}function no(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Hc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Hc(t.subTree):null}const Fc=e=>e.__isSuspense;function tf(e,t){t&&t.pendingBranch?ve(e)?t.effects.push(...e):t.effects.push(e):lh(e)}const we=Symbol.for("v-fgt"),ti=Symbol.for("v-txt"),ct=Symbol.for("v-cmt"),wr=Symbol.for("v-stc"),On=[];let mt=null;function g(e=!1){On.push(mt=e?null:[])}function sf(){On.pop(),mt=On[On.length-1]||null}let Bn=1;function $r(e,t=!1){Bn+=e,e<0&&mt&&t&&(mt.hasOnce=!0)}function Vc(e){return e.dynamicChildren=Bn>0?mt||tn:null,sf(),Bn>0&&mt&&mt.push(e),e}function m(e,t,s,n,r,i){return Vc(h(e,t,s,n,r,i,!0))}function Bt(e,t,s,n,r){return Vc(de(e,t,s,n,r,!0))}function Nr(e){return e?e.__v_isVNode===!0:!1}function Os(e,t){return e.type===t.type&&e.key===t.key}const qc=({key:e})=>e??null,kr=({ref:e,ref_key:t,ref_for:s})=>(typeof e=="number"&&(e=""+e),e!=null?He(e)||qe(e)||Te(e)?{i:gt,r:e,k:t,f:!!s}:e:null);function h(e,t=null,s=null,n=0,r=null,i=e===we?0:1,a=!1,o=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&qc(t),ref:t&&kr(t),scopeId:pc,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:n,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:gt};return o?(Ta(l,s),i&128&&e.normalize(l)):s&&(l.shapeFlag|=He(s)?8:16),Bn>0&&!a&&mt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&mt.push(l),l}const de=nf;function nf(e,t=null,s=null,n=0,r=null,i=!1){if((!e||e===Sc)&&(e=ct),Nr(e)){const o=_s(e,t,!0);return s&&Ta(o,s),Bn>0&&!i&&mt&&(o.shapeFlag&6?mt[mt.indexOf(e)]=o:mt.push(o)),o.patchFlag=-2,o}if(gf(e)&&(e=e.__vccOpts),t){t=rf(t);let{class:o,style:l}=t;o&&!He(o)&&(t.class=ce(o)),Le(l)&&(Jr(l)&&!ve(l)&&(l=Xe({},l)),t.style=pa(l))}const a=He(e)?1:Fc(e)?128:bc(e)?64:Le(e)?4:Te(e)?2:0;return h(e,t,s,n,r,a,i,!0)}function rf(e){return e?Jr(e)||Ic(e)?Xe({},e):e:null}function _s(e,t,s=!1,n=!1){const{props:r,ref:i,patchFlag:a,children:o,transition:l}=e,c=t?af(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&qc(c),ref:t&&t.ref?s&&i?ve(i)?i.concat(kr(t)):[i,kr(t)]:kr(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:o,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==we?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&_s(e.ssContent),ssFallback:e.ssFallback&&_s(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&n&&Un(u,l.clone(u)),u}function fe(e=" ",t=0){return de(ti,null,e,t)}function hn(e,t){const s=de(wr,null,e);return s.staticCount=t,s}function B(e="",t=!1){return t?(g(),Bt(ct,null,e)):de(ct,null,e)}function Ht(e){return e==null||typeof e=="boolean"?de(ct):ve(e)?de(we,null,e.slice()):Nr(e)?es(e):de(ti,null,String(e))}function es(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:_s(e)}function Ta(e,t){let s=0;const{shapeFlag:n}=e;if(t==null)t=null;else if(ve(t))s=16;else if(typeof t=="object")if(n&65){const r=t.default;r&&(r._c&&(r._d=!1),Ta(e,r()),r._c&&(r._d=!0));return}else{s=32;const r=t._;!r&&!Ic(t)?t._ctx=gt:r===3&>&&(gt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Te(t)?(t={default:t,_ctx:gt},s=32):(t=String(t),n&64?(s=16,t=[fe(t)]):s=8);e.children=t,e.shapeFlag|=s}function af(...e){const t={};for(let s=0;s<e.length;s++){const n=e[s];for(const r in n)if(r==="class")t.class!==n.class&&(t.class=ce([t.class,n.class]));else if(r==="style")t.style=pa([t.style,n.style]);else if(Fr(r)){const i=t[r],a=n[r];a&&i!==a&&!(ve(i)&&i.includes(a))?t[r]=i?[].concat(i,a):a:a==null&&i==null&&!Vr(r)&&(t[r]=a)}else r!==""&&(t[r]=n[r])}return t}function Pt(e,t,s,n=null){$t(e,t,7,[s,n])}const of=Rc();let lf=0;function cf(e,t,s){const n=e.type,r=(t?t.appContext:e.appContext)||of,i={uid:lf++,vnode:e,type:n,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ql(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Lc(n,r),emitsOptions:Cc(n,r),emit:null,emitted:null,propsDefaults:je,inheritAttrs:n.inheritAttrs,ctx:je,data:je,props:je,attrs:je,slots:je,refs:je,setupState:je,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=t?t.root:i,i.emit=Uh.bind(null,i),e.ce&&e.ce(i),i}let rt=null;const Aa=()=>rt||gt;let Ir,Vi;{const e=Gr(),t=(s,n)=>{let r;return(r=e[s])||(r=e[s]=[]),r.push(n),i=>{r.length>1?r.forEach(a=>a(i)):r[0](i)}};Ir=t("__VUE_INSTANCE_SETTERS__",s=>rt=s),Vi=t("__VUE_SSR_SETTERS__",s=>Hn=s)}const sr=e=>{const t=rt;return Ir(e),e.scope.on(),()=>{e.scope.off(),Ir(t)}},ro=()=>{rt&&rt.scope.off(),Ir(null)};function zc(e){return e.vnode.shapeFlag&4}let Hn=!1;function uf(e,t=!1,s=!1){t&&Vi(t);const{props:n,children:r}=e.vnode,i=zc(e);zh(e,n,i,t),Zh(e,r,s||t);const a=i?df(e,t):void 0;return t&&Vi(!1),a}function df(e,t){const s=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Oh);const{setup:n}=s;if(n){is();const r=e.setupContext=n.length>1?ff(e):null,i=sr(e),a=er(n,e,0,[e.props,r]),o=Ml(a);if(as(),i(),(o||e.sp)&&!Rn(e)&&kc(e),o){if(a.then(ro,ro),t)return a.then(l=>{io(e,l)}).catch(l=>{Yr(l,e,0)});e.asyncDep=a}else io(e,a)}else Kc(e)}function io(e,t,s){Te(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Le(t)&&(e.setupState=cc(t)),Kc(e)}function Kc(e,t,s){const n=e.type;e.render||(e.render=n.render||qt);{const r=sr(e);is();try{$h(e)}finally{as(),r()}}}const hf={get(e,t){return nt(e,"get",""),e[t]}};function ff(e){const t=s=>{e.exposed=s||{}};return{attrs:new Proxy(e.attrs,hf),slots:e.slots,emit:e.emit,expose:t}}function si(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(cc(xa(e.exposed)),{get(t,s){if(s in t)return t[s];if(s in Cn)return Cn[s](e)},has(t,s){return s in t||s in Cn}})):e.proxy}function pf(e,t=!0){return Te(e)?e.displayName||e.name:e.name||t&&e.__name}function gf(e){return Te(e)&&"__vccOpts"in e}const Ne=(e,t)=>nh(e,t,Hn);function Ra(e,t,s){try{$r(-1);const n=arguments.length;return n===2?Le(t)&&!ve(t)?Nr(t)?de(e,null,[t]):de(e,t):de(e,null,t):(n>3?s=Array.prototype.slice.call(arguments,2):n===3&&Nr(s)&&(s=[s]),de(e,t,s))}finally{$r(1)}}const mf="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 qi;const ao=typeof window<"u"&&window.trustedTypes;if(ao)try{qi=ao.createPolicy("vue",{createHTML:e=>e})}catch{}const Wc=qi?e=>qi.createHTML(e):e=>e,bf="http://www.w3.org/2000/svg",vf="http://www.w3.org/1998/Math/MathML",Yt=typeof document<"u"?document:null,oo=Yt&&Yt.createElement("template"),yf={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const r=t==="svg"?Yt.createElementNS(bf,e):t==="mathml"?Yt.createElementNS(vf,e):s?Yt.createElement(e,{is:s}):Yt.createElement(e);return e==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:e=>Yt.createTextNode(e),createComment:e=>Yt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Yt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,r,i){const a=s?s.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),s),!(r===i||!(r=r.nextSibling)););else{oo.innerHTML=Wc(n==="svg"?`<svg>${e}</svg>`:n==="mathml"?`<math>${e}</math>`:e);const o=oo.content;if(n==="svg"||n==="mathml"){const l=o.firstChild;for(;l.firstChild;)o.appendChild(l.firstChild);o.removeChild(l)}t.insertBefore(o,s)}return[a?a.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},ds="transition",bn="animation",Fn=Symbol("_vtc"),Gc={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},_f=Xe({},vc,Gc),xf=e=>(e.displayName="Transition",e.props=_f,e),rn=xf((e,{slots:t})=>Ra(mh,wf(e),t)),Es=(e,t=[])=>{ve(e)?e.forEach(s=>s(...t)):e&&e(...t)},lo=e=>e?ve(e)?e.some(t=>t.length>1):e.length>1:!1;function wf(e){const t={};for(const ee in e)ee in Gc||(t[ee]=e[ee]);if(e.css===!1)return t;const{name:s="v",type:n,duration:r,enterFromClass:i=`${s}-enter-from`,enterActiveClass:a=`${s}-enter-active`,enterToClass:o=`${s}-enter-to`,appearFromClass:l=i,appearActiveClass:c=a,appearToClass:u=o,leaveFromClass:d=`${s}-leave-from`,leaveActiveClass:f=`${s}-leave-active`,leaveToClass:p=`${s}-leave-to`}=e,b=kf(r),v=b&&b[0],T=b&&b[1],{onBeforeEnter:R,onEnter:k,onEnterCancelled:x,onLeave:E,onLeaveCancelled:A,onBeforeAppear:N=R,onAppear:O=k,onAppearCancelled:L=x}=t,D=(ee,X,I,$)=>{ee._enterCancelled=$,Ss(ee,X?u:o),Ss(ee,X?c:a),I&&I()},W=(ee,X)=>{ee._isLeaving=!1,Ss(ee,d),Ss(ee,p),Ss(ee,f),X&&X()},ne=ee=>(X,I)=>{const $=ee?O:k,y=()=>D(X,ee,I);Es($,[X,y]),co(()=>{Ss(X,ee?l:i),Gt(X,ee?u:o),lo($)||uo(X,n,v,y)})};return Xe(t,{onBeforeEnter(ee){Es(R,[ee]),Gt(ee,i),Gt(ee,a)},onBeforeAppear(ee){Es(N,[ee]),Gt(ee,l),Gt(ee,c)},onEnter:ne(!1),onAppear:ne(!0),onLeave(ee,X){ee._isLeaving=!0;const I=()=>W(ee,X);Gt(ee,d),ee._enterCancelled?(Gt(ee,f),po(ee)):(po(ee),Gt(ee,f)),co(()=>{ee._isLeaving&&(Ss(ee,d),Gt(ee,p),lo(E)||uo(ee,n,T,I))}),Es(E,[ee,I])},onEnterCancelled(ee){D(ee,!1,void 0,!0),Es(x,[ee])},onAppearCancelled(ee){D(ee,!0,void 0,!0),Es(L,[ee])},onLeaveCancelled(ee){W(ee),Es(A,[ee])}})}function kf(e){if(e==null)return null;if(Le(e))return[yi(e.enter),yi(e.leave)];{const t=yi(e);return[t,t]}}function yi(e){return wd(e)}function Gt(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.add(s)),(e[Fn]||(e[Fn]=new Set)).add(t)}function Ss(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.remove(n));const s=e[Fn];s&&(s.delete(t),s.size||(e[Fn]=void 0))}function co(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Ef=0;function uo(e,t,s,n){const r=e._endId=++Ef,i=()=>{r===e._endId&&n()};if(s!=null)return setTimeout(i,s);const{type:a,timeout:o,propCount:l}=Sf(e,t);if(!a)return n();const c=a+"end";let u=0;const d=()=>{e.removeEventListener(c,f),i()},f=p=>{p.target===e&&++u>=l&&d()};setTimeout(()=>{u<l&&d()},o+1),e.addEventListener(c,f)}function Sf(e,t){const s=window.getComputedStyle(e),n=b=>(s[b]||"").split(", "),r=n(`${ds}Delay`),i=n(`${ds}Duration`),a=ho(r,i),o=n(`${bn}Delay`),l=n(`${bn}Duration`),c=ho(o,l);let u=null,d=0,f=0;t===ds?a>0&&(u=ds,d=a,f=i.length):t===bn?c>0&&(u=bn,d=c,f=l.length):(d=Math.max(a,c),u=d>0?a>c?ds:bn:null,f=u?u===ds?i.length:l.length:0);const p=u===ds&&/\b(?:transform|all)(?:,|$)/.test(n(`${ds}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function ho(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((s,n)=>fo(s)+fo(e[n])))}function fo(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function po(e){return(e?e.ownerDocument:document).body.offsetHeight}function Tf(e,t,s){const n=e[Fn];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const go=Symbol("_vod"),Af=Symbol("_vsh"),Rf=Symbol(""),Cf=/(?:^|;)\s*display\s*:/;function Of(e,t,s){const n=e.style,r=He(s);let i=!1;if(s&&!r){if(t)if(He(t))for(const a of t.split(";")){const o=a.slice(0,a.indexOf(":")).trim();s[o]==null&&xn(n,o,"")}else for(const a in t)s[a]==null&&xn(n,a,"");for(const a in s){a==="display"&&(i=!0);const o=s[a];o!=null?Nf(e,a,!He(t)&&t?t[a]:void 0,o)||xn(n,a,o):xn(n,a,"")}}else if(r){if(t!==s){const a=n[Rf];a&&(s+=";"+a),n.cssText=s,i=Cf.test(s)}}else t&&e.removeAttribute("style");go in e&&(e[go]=i?n.display:"",e[Af]&&(n.display="none"))}const mo=/\s*!important$/;function xn(e,t,s){if(ve(s))s.forEach(n=>xn(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))e.setProperty(t,s);else{const n=$f(e,t);mo.test(s)?e.setProperty(Ds(n),s.replace(mo,""),"important"):e[n]=s}}const bo=["Webkit","Moz","ms"],_i={};function $f(e,t){const s=_i[t];if(s)return s;let n=ut(t);if(n!=="filter"&&n in e)return _i[t]=n;n=Wr(n);for(let r=0;r<bo.length;r++){const i=bo[r]+n;if(i in e)return _i[t]=i}return t}function Nf(e,t,s,n){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&He(n)&&s===n}const vo="http://www.w3.org/1999/xlink";function yo(e,t,s,n,r,i=Rd(t)){n&&t.startsWith("xlink:")?s==null?e.removeAttributeNS(vo,t.slice(6,t.length)):e.setAttributeNS(vo,t,s):s==null||i&&!Bl(s)?e.removeAttribute(t):e.setAttribute(t,i?"":Et(s)?String(s):s)}function _o(e,t,s,n,r){if(t==="innerHTML"||t==="textContent"){s!=null&&(e[t]=t==="innerHTML"?Wc(s):s);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const o=i==="OPTION"?e.getAttribute("value")||"":e.value,l=s==null?e.type==="checkbox"?"on":"":String(s);(o!==l||!("_value"in e))&&(e.value=l),s==null&&e.removeAttribute(t),e._value=s;return}let a=!1;if(s===""||s==null){const o=typeof e[t];o==="boolean"?s=Bl(s):s==null&&o==="string"?(s="",a=!0):o==="number"&&(s=0,a=!0)}try{e[t]=s}catch{}a&&e.removeAttribute(r||t)}function ms(e,t,s,n){e.addEventListener(t,s,n)}function If(e,t,s,n){e.removeEventListener(t,s,n)}const xo=Symbol("_vei");function Pf(e,t,s,n,r=null){const i=e[xo]||(e[xo]={}),a=i[t];if(n&&a)a.value=n;else{const[o,l]=Lf(t);if(n){const c=i[t]=Df(n,r);ms(e,o,c,l)}else a&&(If(e,o,a,l),i[t]=void 0)}}const wo=/(?:Once|Passive|Capture)$/;function Lf(e){let t;if(wo.test(e)){t={};let n;for(;n=e.match(wo);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Ds(e.slice(2)),t]}let xi=0;const Mf=Promise.resolve(),jf=()=>xi||(Mf.then(()=>xi=0),xi=Date.now());function Df(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;$t(Uf(n,s.value),t,5,[n])};return s.value=e,s.attached=jf(),s}function Uf(e,t){if(ve(t)){const s=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{s.call(e),e._stopped=!0},t.map(n=>r=>!r._stopped&&n&&n(r))}else return t}const ko=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Bf=(e,t,s,n,r,i)=>{const a=r==="svg";t==="class"?Tf(e,n,a):t==="style"?Of(e,s,n):Fr(t)?Vr(t)||Pf(e,t,s,n,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Hf(e,t,n,a))?(_o(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&yo(e,t,n,a,i,t!=="value")):e._isVueCE&&(Ff(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!He(n)))?_o(e,ut(t),n,i,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),yo(e,t,n,a))};function Hf(e,t,s,n){if(n)return!!(t==="innerHTML"||t==="textContent"||t in e&&ko(t)&&Te(s));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return ko(t)&&He(s)?!1:t in e}function Ff(e,t){const s=e._def.props;if(!s)return!1;const n=ut(t);return Array.isArray(s)?s.some(r=>ut(r)===n):Object.keys(s).some(r=>ut(r)===n)}const ln=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ve(t)?s=>_r(t,s):t};function Vf(e){e.target.composing=!0}function Eo(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const rs=Symbol("_assign");function So(e,t,s){return t&&(e=e.trim()),s&&(e=fa(e)),e}const ze={created(e,{modifiers:{lazy:t,trim:s,number:n}},r){e[rs]=ln(r);const i=n||r.props&&r.props.type==="number";ms(e,t?"change":"input",a=>{a.target.composing||e[rs](So(e.value,s,i))}),(s||i)&&ms(e,"change",()=>{e.value=So(e.value,s,i)}),t||(ms(e,"compositionstart",Vf),ms(e,"compositionend",Eo),ms(e,"change",Eo))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:s,modifiers:{lazy:n,trim:r,number:i}},a){if(e[rs]=ln(a),e.composing)return;const o=(i||e.type==="number")&&!/^0\d/.test(e.value)?fa(e.value):e.value,l=t??"";if(o===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(n&&t===s||r&&e.value.trim()===l)||(e.value=l)}},Zc={deep:!0,created(e,t,s){e[rs]=ln(s),ms(e,"change",()=>{const n=e._modelValue,r=Jc(e),i=e.checked,a=e[rs];if(ve(n)){const o=Hl(n,r),l=o!==-1;if(i&&!l)a(n.concat(r));else if(!i&&l){const c=[...n];c.splice(o,1),a(c)}}else if(qr(n)){const o=new Set(n);i?o.add(r):o.delete(r),a(o)}else a(Yc(e,i))})},mounted:To,beforeUpdate(e,t,s){e[rs]=ln(s),To(e,t,s)}};function To(e,{value:t,oldValue:s},n){e._modelValue=t;let r;if(ve(t))r=Hl(t,n.props.value)>-1;else if(qr(t))r=t.has(n.props.value);else{if(t===s)return;r=js(t,Yc(e,!0))}e.checked!==r&&(e.checked=r)}const Ao={created(e,{value:t},s){e.checked=js(t,s.props.value),e[rs]=ln(s),ms(e,"change",()=>{e[rs](Jc(e))})},beforeUpdate(e,{value:t,oldValue:s},n){e[rs]=ln(n),t!==s&&(e.checked=js(t,n.props.value))}};function Jc(e){return"_value"in e?e._value:e.value}function Yc(e,t){const s=t?"_trueValue":"_falseValue";return s in e?e[s]:t}const qf=["ctrl","shift","alt","meta"],zf={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>qf.some(s=>e[`${s}Key`]&&!t.includes(s))},Ye=(e,t)=>{if(!e)return e;const s=e._withMods||(e._withMods={}),n=t.join(".");return s[n]||(s[n]=(r,...i)=>{for(let a=0;a<t.length;a++){const o=zf[t[a]];if(o&&o(r,t))return}return e(r,...i)})},Kf=Xe({patchProp:Bf},yf);let Ro;function Wf(){return Ro||(Ro=Yh(Kf))}const Gf=(...e)=>{const t=Wf().createApp(...e),{mount:s}=t;return t.mount=n=>{const r=Jf(n);if(!r)return;const i=t._component;!Te(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const a=s(r,!1,Zf(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},t};function Zf(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Jf(e){return He(e)?document.querySelector(e):e}/*!
|
|
18
|
+
* pinia v2.3.1
|
|
19
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/let Xc;const ni=e=>Xc=e,Qc=Symbol();function zi(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var $n;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})($n||($n={}));function Yf(){const e=zl(!0),t=e.run(()=>q({}));let s=[],n=[];const r=xa({install(i){ni(r),r._a=i,i.provide(Qc,r),i.config.globalProperties.$pinia=r,n.forEach(a=>s.push(a)),n=[]},use(i){return this._a?s.push(i):n.push(i),this},_p:s,_a:null,_e:e,_s:new Map,state:t});return r}const eu=()=>{};function Co(e,t,s,n=eu){e.push(t);const r=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),n())};return!s&&Kl()&&Od(r),r}function Hs(e,...t){e.slice().forEach(s=>{s(...t)})}const Xf=e=>e(),Oo=Symbol(),wi=Symbol();function Ki(e,t){e instanceof Map&&t instanceof Map?t.forEach((s,n)=>e.set(n,s)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const s in t){if(!t.hasOwnProperty(s))continue;const n=t[s],r=e[s];zi(r)&&zi(n)&&e.hasOwnProperty(s)&&!qe(n)&&!ns(n)?e[s]=Ki(r,n):e[s]=n}return e}const Qf=Symbol();function ep(e){return!zi(e)||!e.hasOwnProperty(Qf)}const{assign:fs}=Object;function tp(e){return!!(qe(e)&&e.effect)}function sp(e,t,s,n){const{state:r,actions:i,getters:a}=t,o=s.state.value[e];let l;function c(){o||(s.state.value[e]=r?r():{});const u=Qd(s.state.value[e]);return fs(u,i,Object.keys(a||{}).reduce((d,f)=>(d[f]=xa(Ne(()=>{ni(s);const p=s._s.get(e);return a[f].call(p,p)})),d),{}))}return l=tu(e,c,t,s,n,!0),l}function tu(e,t,s={},n,r,i){let a;const o=fs({actions:{}},s),l={deep:!0};let c,u,d=[],f=[],p;const b=n.state.value[e];!i&&!b&&(n.state.value[e]={});let v;function T(L){let D;c=u=!1,typeof L=="function"?(L(n.state.value[e]),D={type:$n.patchFunction,storeId:e,events:p}):(Ki(n.state.value[e],L),D={type:$n.patchObject,payload:L,storeId:e,events:p});const W=v=Symbol();zt().then(()=>{v===W&&(c=!0)}),u=!0,Hs(d,D,n.state.value[e])}const R=i?function(){const{state:D}=s,W=D?D():{};this.$patch(ne=>{fs(ne,W)})}:eu;function k(){a.stop(),d=[],f=[],n._s.delete(e)}const x=(L,D="")=>{if(Oo in L)return L[wi]=D,L;const W=function(){ni(n);const ne=Array.from(arguments),ee=[],X=[];function I(S){ee.push(S)}function $(S){X.push(S)}Hs(f,{args:ne,name:W[wi],store:A,after:I,onError:$});let y;try{y=L.apply(this&&this.$id===e?this:A,ne)}catch(S){throw Hs(X,S),S}return y instanceof Promise?y.then(S=>(Hs(ee,S),S)).catch(S=>(Hs(X,S),Promise.reject(S))):(Hs(ee,y),y)};return W[Oo]=!0,W[wi]=D,W},E={_p:n,$id:e,$onAction:Co.bind(null,f),$patch:T,$reset:R,$subscribe(L,D={}){const W=Co(d,L,D.detached,()=>ne()),ne=a.run(()=>vt(()=>n.state.value[e],ee=>{(D.flush==="sync"?u:c)&&L({storeId:e,type:$n.direct,events:p},ee)},fs({},l,D)));return W},$dispose:k},A=lt(E);n._s.set(e,A);const O=(n._a&&n._a.runWithContext||Xf)(()=>n._e.run(()=>(a=zl()).run(()=>t({action:x}))));for(const L in O){const D=O[L];if(qe(D)&&!tp(D)||ns(D))i||(b&&ep(D)&&(qe(D)?D.value=b[L]:Ki(D,b[L])),n.state.value[e][L]=D);else if(typeof D=="function"){const W=x(D,L);O[L]=W,o.actions[L]=D}}return fs(A,O),fs($e(A),O),Object.defineProperty(A,"$state",{get:()=>n.state.value[e],set:L=>{T(D=>{fs(D,L)})}}),n._p.forEach(L=>{fs(A,a.run(()=>L({store:A,app:n._a,pinia:n,options:o})))}),b&&i&&s.hydrate&&s.hydrate(A.$state,b),c=!0,u=!0,A}/*! #__NO_SIDE_EFFECTS__ */function su(e,t,s){let n,r;const i=typeof t=="function";typeof e=="string"?(n=e,r=i?s:t):(r=e,n=e.id);function a(o,l){const c=ch();return o=o||(c?kt(Qc,null):null),o&&ni(o),o=Xc,o._s.has(n)||(i?tu(n,t,r,o):sp(n,r,o)),o._s.get(n)}return a.$id=n,a}/*!
|
|
22
|
+
* vue-router v4.6.4
|
|
23
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/const Zs=typeof document<"u";function nu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function np(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&nu(e.default)}const Ie=Object.assign;function ki(e,t){const s={};for(const n in t){const r=t[n];s[n]=Nt(r)?r.map(e):e(r)}return s}const Nn=()=>{},Nt=Array.isArray;function $o(e,t){const s={};for(const n in e)s[n]=n in t?t[n]:e[n];return s}const ru=/#/g,rp=/&/g,ip=/\//g,ap=/=/g,op=/\?/g,iu=/\+/g,lp=/%5B/g,cp=/%5D/g,au=/%5E/g,up=/%60/g,ou=/%7B/g,dp=/%7C/g,lu=/%7D/g,hp=/%20/g;function Ca(e){return e==null?"":encodeURI(""+e).replace(dp,"|").replace(lp,"[").replace(cp,"]")}function fp(e){return Ca(e).replace(ou,"{").replace(lu,"}").replace(au,"^")}function Wi(e){return Ca(e).replace(iu,"%2B").replace(hp,"+").replace(ru,"%23").replace(rp,"%26").replace(up,"`").replace(ou,"{").replace(lu,"}").replace(au,"^")}function pp(e){return Wi(e).replace(ap,"%3D")}function gp(e){return Ca(e).replace(ru,"%23").replace(op,"%3F")}function mp(e){return gp(e).replace(ip,"%2F")}function Vn(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const bp=/\/$/,vp=e=>e.replace(bp,"");function Ei(e,t,s="/"){let n,r={},i="",a="";const o=t.indexOf("#");let l=t.indexOf("?");return l=o>=0&&l>o?-1:l,l>=0&&(n=t.slice(0,l),i=t.slice(l,o>0?o:t.length),r=e(i.slice(1))),o>=0&&(n=n||t.slice(0,o),a=t.slice(o,t.length)),n=wp(n??t,s),{fullPath:n+i+a,path:n,query:r,hash:Vn(a)}}function yp(e,t){const s=t.query?e(t.query):"";return t.path+(s&&"?")+s+(t.hash||"")}function No(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function _p(e,t,s){const n=t.matched.length-1,r=s.matched.length-1;return n>-1&&n===r&&cn(t.matched[n],s.matched[r])&&cu(t.params,s.params)&&e(t.query)===e(s.query)&&t.hash===s.hash}function cn(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function cu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var s in e)if(!xp(e[s],t[s]))return!1;return!0}function xp(e,t){return Nt(e)?Io(e,t):Nt(t)?Io(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Io(e,t){return Nt(t)?e.length===t.length&&e.every((s,n)=>s===t[n]):e.length===1&&e[0]===t}function wp(e,t){if(e.startsWith("/"))return e;if(!e)return t;const s=t.split("/"),n=e.split("/"),r=n[n.length-1];(r===".."||r===".")&&n.push("");let i=s.length-1,a,o;for(a=0;a<n.length;a++)if(o=n[a],o!==".")if(o==="..")i>1&&i--;else break;return s.slice(0,i).join("/")+"/"+n.slice(a).join("/")}const hs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Gi=function(e){return e.pop="pop",e.push="push",e}({}),Si=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function kp(e){if(!e)if(Zs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),vp(e)}const Ep=/^[^#]+#/;function Sp(e,t){return e.replace(Ep,"#")+t}function Tp(e,t){const s=document.documentElement.getBoundingClientRect(),n=e.getBoundingClientRect();return{behavior:t.behavior,left:n.left-s.left-(t.left||0),top:n.top-s.top-(t.top||0)}}const ri=()=>({left:window.scrollX,top:window.scrollY});function Ap(e){let t;if("el"in e){const s=e.el,n=typeof s=="string"&&s.startsWith("#"),r=typeof s=="string"?n?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!r)return;t=Tp(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Po(e,t){return(history.state?history.state.position-t:-1)+e}const Zi=new Map;function Rp(e,t){Zi.set(e,t)}function Cp(e){const t=Zi.get(e);return Zi.delete(e),t}function Op(e){return typeof e=="string"||e&&typeof e=="object"}function uu(e){return typeof e=="string"||typeof e=="symbol"}let Fe=function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e}({});const du=Symbol("");Fe.MATCHER_NOT_FOUND+"",Fe.NAVIGATION_GUARD_REDIRECT+"",Fe.NAVIGATION_ABORTED+"",Fe.NAVIGATION_CANCELLED+"",Fe.NAVIGATION_DUPLICATED+"";function un(e,t){return Ie(new Error,{type:e,[du]:!0},t)}function Zt(e,t){return e instanceof Error&&du in e&&(t==null||!!(e.type&t))}const $p=["params","query","hash"];function Np(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const s of $p)s in e&&(t[s]=e[s]);return JSON.stringify(t,null,2)}function Ip(e){const t={};if(e===""||e==="?")return t;const s=(e[0]==="?"?e.slice(1):e).split("&");for(let n=0;n<s.length;++n){const r=s[n].replace(iu," "),i=r.indexOf("="),a=Vn(i<0?r:r.slice(0,i)),o=i<0?null:Vn(r.slice(i+1));if(a in t){let l=t[a];Nt(l)||(l=t[a]=[l]),l.push(o)}else t[a]=o}return t}function Lo(e){let t="";for(let s in e){const n=e[s];if(s=pp(s),n==null){n!==void 0&&(t+=(t.length?"&":"")+s);continue}(Nt(n)?n.map(r=>r&&Wi(r)):[n&&Wi(n)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+s,r!=null&&(t+="="+r))})}return t}function Pp(e){const t={};for(const s in e){const n=e[s];n!==void 0&&(t[s]=Nt(n)?n.map(r=>r==null?null:""+r):n==null?n:""+n)}return t}const Lp=Symbol(""),Mo=Symbol(""),ii=Symbol(""),Oa=Symbol(""),Ji=Symbol("");function vn(){let e=[];function t(n){return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}function s(){e=[]}return{add:t,list:()=>e.slice(),reset:s}}function gs(e,t,s,n,r,i=a=>a()){const a=n&&(n.enterCallbacks[r]=n.enterCallbacks[r]||[]);return()=>new Promise((o,l)=>{const c=f=>{f===!1?l(un(Fe.NAVIGATION_ABORTED,{from:s,to:t})):f instanceof Error?l(f):Op(f)?l(un(Fe.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(a&&n.enterCallbacks[r]===a&&typeof f=="function"&&a.push(f),o())},u=i(()=>e.call(n&&n.instances[r],t,s,c));let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(f=>l(f))})}function Ti(e,t,s,n,r=i=>i()){const i=[];for(const a of e)for(const o in a.components){let l=a.components[o];if(!(t!=="beforeRouteEnter"&&!a.instances[o]))if(nu(l)){const c=(l.__vccOpts||l)[t];c&&i.push(gs(c,s,n,a,o,r))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${o}" at "${a.path}"`);const d=np(u)?u.default:u;a.mods[o]=u,a.components[o]=d;const f=(d.__vccOpts||d)[t];return f&&gs(f,s,n,a,o,r)()}))}}return i}function Mp(e,t){const s=[],n=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let a=0;a<i;a++){const o=t.matched[a];o&&(e.matched.find(c=>cn(c,o))?n.push(o):s.push(o));const l=e.matched[a];l&&(t.matched.find(c=>cn(c,l))||r.push(l))}return[s,n,r]}/*!
|
|
26
|
+
* vue-router v4.6.4
|
|
27
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
28
|
+
* @license MIT
|
|
29
|
+
*/let jp=()=>location.protocol+"//"+location.host;function hu(e,t){const{pathname:s,search:n,hash:r}=t,i=e.indexOf("#");if(i>-1){let a=r.includes(e.slice(i))?e.slice(i).length:1,o=r.slice(a);return o[0]!=="/"&&(o="/"+o),No(o,"")}return No(s,e)+n+r}function Dp(e,t,s,n){let r=[],i=[],a=null;const o=({state:f})=>{const p=hu(e,location),b=s.value,v=t.value;let T=0;if(f){if(s.value=p,t.value=f,a&&a===b){a=null;return}T=v?f.position-v.position:0}else n(p);r.forEach(R=>{R(s.value,b,{delta:T,type:Gi.pop,direction:T?T>0?Si.forward:Si.back:Si.unknown})})};function l(){a=s.value}function c(f){r.push(f);const p=()=>{const b=r.indexOf(f);b>-1&&r.splice(b,1)};return i.push(p),p}function u(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Ie({},f.state,{scroll:ri()}),"")}}function d(){for(const f of i)f();i=[],window.removeEventListener("popstate",o),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",o),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:d}}function jo(e,t,s,n=!1,r=!1){return{back:e,current:t,forward:s,replaced:n,position:window.history.length,scroll:r?ri():null}}function Up(e){const{history:t,location:s}=window,n={value:hu(e,s)},r={value:t.state};r.value||i(n.value,{back:null,current:n.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const d=e.indexOf("#"),f=d>-1?(s.host&&document.querySelector("base")?e:e.slice(d))+l:jp()+e+l;try{t[u?"replaceState":"pushState"](c,"",f),r.value=c}catch(p){console.error(p),s[u?"replace":"assign"](f)}}function a(l,c){i(l,Ie({},t.state,jo(r.value.back,l,r.value.forward,!0),c,{position:r.value.position}),!0),n.value=l}function o(l,c){const u=Ie({},r.value,t.state,{forward:l,scroll:ri()});i(u.current,u,!0),i(l,Ie({},jo(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:r,push:o,replace:a}}function Bp(e){e=kp(e);const t=Up(e),s=Dp(e,t.state,t.location,t.replace);function n(i,a=!0){a||s.pauseListeners(),history.go(i)}const r=Ie({location:"",base:e,go:n,createHref:Sp.bind(null,e)},t,s);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}let Ns=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Ze=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e}(Ze||{});const Hp={type:Ns.Static,value:""},Fp=/[a-zA-Z0-9_]/;function Vp(e){if(!e)return[[]];if(e==="/")return[[Hp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(p){throw new Error(`ERR (${s})/"${c}": ${p}`)}let s=Ze.Static,n=s;const r=[];let i;function a(){i&&r.push(i),i=[]}let o=0,l,c="",u="";function d(){c&&(s===Ze.Static?i.push({type:Ns.Static,value:c}):s===Ze.Param||s===Ze.ParamRegExp||s===Ze.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Ns.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function f(){c+=l}for(;o<e.length;){if(l=e[o++],l==="\\"&&s!==Ze.ParamRegExp){n=s,s=Ze.EscapeNext;continue}switch(s){case Ze.Static:l==="/"?(c&&d(),a()):l===":"?(d(),s=Ze.Param):f();break;case Ze.EscapeNext:f(),s=n;break;case Ze.Param:l==="("?s=Ze.ParamRegExp:Fp.test(l)?f():(d(),s=Ze.Static,l!=="*"&&l!=="?"&&l!=="+"&&o--);break;case Ze.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:s=Ze.ParamRegExpEnd:u+=l;break;case Ze.ParamRegExpEnd:d(),s=Ze.Static,l!=="*"&&l!=="?"&&l!=="+"&&o--,u="";break;default:t("Unknown state");break}}return s===Ze.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),d(),a(),r}const Do="[^/]+?",qp={sensitive:!1,strict:!1,start:!0,end:!0};var at=function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e}(at||{});const zp=/[.+*?^${}()[\]/\\]/g;function Kp(e,t){const s=Ie({},qp,t),n=[];let r=s.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[at.Root];s.strict&&!c.length&&(r+="/");for(let d=0;d<c.length;d++){const f=c[d];let p=at.Segment+(s.sensitive?at.BonusCaseSensitive:0);if(f.type===Ns.Static)d||(r+="/"),r+=f.value.replace(zp,"\\$&"),p+=at.Static;else if(f.type===Ns.Param){const{value:b,repeatable:v,optional:T,regexp:R}=f;i.push({name:b,repeatable:v,optional:T});const k=R||Do;if(k!==Do){p+=at.BonusCustomRegExp;try{`${k}`}catch(E){throw new Error(`Invalid custom RegExp for param "${b}" (${k}): `+E.message)}}let x=v?`((?:${k})(?:/(?:${k}))*)`:`(${k})`;d||(x=T&&c.length<2?`(?:/${x})`:"/"+x),T&&(x+="?"),r+=x,p+=at.Dynamic,T&&(p+=at.BonusOptional),v&&(p+=at.BonusRepeatable),k===".*"&&(p+=at.BonusWildcard)}u.push(p)}n.push(u)}if(s.strict&&s.end){const c=n.length-1;n[c][n[c].length-1]+=at.BonusStrict}s.strict||(r+="/?"),s.end?r+="$":s.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const a=new RegExp(r,s.sensitive?"":"i");function o(c){const u=c.match(a),d={};if(!u)return null;for(let f=1;f<u.length;f++){const p=u[f]||"",b=i[f-1];d[b.name]=p&&b.repeatable?p.split("/"):p}return d}function l(c){let u="",d=!1;for(const f of e){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const p of f)if(p.type===Ns.Static)u+=p.value;else if(p.type===Ns.Param){const{value:b,repeatable:v,optional:T}=p,R=b in c?c[b]:"";if(Nt(R)&&!v)throw new Error(`Provided param "${b}" is an array but it is not repeatable (* or + modifiers)`);const k=Nt(R)?R.join("/"):R;if(!k)if(T)f.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${b}"`);u+=k}}return u||"/"}return{re:a,score:n,keys:i,parse:o,stringify:l}}function Wp(e,t){let s=0;for(;s<e.length&&s<t.length;){const n=t[s]-e[s];if(n)return n;s++}return e.length<t.length?e.length===1&&e[0]===at.Static+at.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===at.Static+at.Segment?1:-1:0}function fu(e,t){let s=0;const n=e.score,r=t.score;for(;s<n.length&&s<r.length;){const i=Wp(n[s],r[s]);if(i)return i;s++}if(Math.abs(r.length-n.length)===1){if(Uo(n))return 1;if(Uo(r))return-1}return r.length-n.length}function Uo(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Gp={strict:!1,end:!0,sensitive:!1};function Zp(e,t,s){const n=Kp(Vp(e.path),s),r=Ie(n,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function Jp(e,t){const s=[],n=new Map;t=$o(Gp,t);function r(d){return n.get(d)}function i(d,f,p){const b=!p,v=Ho(d);v.aliasOf=p&&p.record;const T=$o(t,d),R=[v];if("alias"in d){const E=typeof d.alias=="string"?[d.alias]:d.alias;for(const A of E)R.push(Ho(Ie({},v,{components:p?p.record.components:v.components,path:A,aliasOf:p?p.record:v})))}let k,x;for(const E of R){const{path:A}=E;if(f&&A[0]!=="/"){const N=f.record.path,O=N[N.length-1]==="/"?"":"/";E.path=f.record.path+(A&&O+A)}if(k=Zp(E,f,T),p?p.alias.push(k):(x=x||k,x!==k&&x.alias.push(k),b&&d.name&&!Fo(k)&&a(d.name)),pu(k)&&l(k),v.children){const N=v.children;for(let O=0;O<N.length;O++)i(N[O],k,p&&p.children[O])}p=p||k}return x?()=>{a(x)}:Nn}function a(d){if(uu(d)){const f=n.get(d);f&&(n.delete(d),s.splice(s.indexOf(f),1),f.children.forEach(a),f.alias.forEach(a))}else{const f=s.indexOf(d);f>-1&&(s.splice(f,1),d.record.name&&n.delete(d.record.name),d.children.forEach(a),d.alias.forEach(a))}}function o(){return s}function l(d){const f=Qp(d,s);s.splice(f,0,d),d.record.name&&!Fo(d)&&n.set(d.record.name,d)}function c(d,f){let p,b={},v,T;if("name"in d&&d.name){if(p=n.get(d.name),!p)throw un(Fe.MATCHER_NOT_FOUND,{location:d});T=p.record.name,b=Ie(Bo(f.params,p.keys.filter(x=>!x.optional).concat(p.parent?p.parent.keys.filter(x=>x.optional):[]).map(x=>x.name)),d.params&&Bo(d.params,p.keys.map(x=>x.name))),v=p.stringify(b)}else if(d.path!=null)v=d.path,p=s.find(x=>x.re.test(v)),p&&(b=p.parse(v),T=p.record.name);else{if(p=f.name?n.get(f.name):s.find(x=>x.re.test(f.path)),!p)throw un(Fe.MATCHER_NOT_FOUND,{location:d,currentLocation:f});T=p.record.name,b=Ie({},f.params,d.params),v=p.stringify(b)}const R=[];let k=p;for(;k;)R.unshift(k.record),k=k.parent;return{name:T,path:v,params:b,matched:R,meta:Xp(R)}}e.forEach(d=>i(d));function u(){s.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:a,clearRoutes:u,getRoutes:o,getRecordMatcher:r}}function Bo(e,t){const s={};for(const n of t)n in e&&(s[n]=e[n]);return s}function Ho(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Yp(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function Yp(e){const t={},s=e.props||!1;if("component"in e)t.default=s;else for(const n in e.components)t[n]=typeof s=="object"?s[n]:s;return t}function Fo(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Xp(e){return e.reduce((t,s)=>Ie(t,s.meta),{})}function Qp(e,t){let s=0,n=t.length;for(;s!==n;){const i=s+n>>1;fu(e,t[i])<0?n=i:s=i+1}const r=eg(e);return r&&(n=t.lastIndexOf(r,n-1)),n}function eg(e){let t=e;for(;t=t.parent;)if(pu(t)&&fu(e,t)===0)return t}function pu({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Vo(e){const t=kt(ii),s=kt(Oa),n=Ne(()=>{const l=Re(e.to);return t.resolve(l)}),r=Ne(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],d=s.matched;if(!u||!d.length)return-1;const f=d.findIndex(cn.bind(null,u));if(f>-1)return f;const p=qo(l[c-2]);return c>1&&qo(u)===p&&d[d.length-1].path!==p?d.findIndex(cn.bind(null,l[c-2])):f}),i=Ne(()=>r.value>-1&&rg(s.params,n.value.params)),a=Ne(()=>r.value>-1&&r.value===s.matched.length-1&&cu(s.params,n.value.params));function o(l={}){if(ng(l)){const c=t[Re(e.replace)?"replace":"push"](Re(e.to)).catch(Nn);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:i,isExactActive:a,navigate:o}}function tg(e){return e.length===1?e[0]:e}const sg=st({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:Vo,setup(e,{slots:t}){const s=lt(Vo(e)),{options:n}=kt(ii),r=Ne(()=>({[zo(e.activeClass,n.linkActiveClass,"router-link-active")]:s.isActive,[zo(e.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const i=t.default&&tg(t.default(s));return e.custom?i:Ra("a",{"aria-current":s.isExactActive?e.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:r.value},i)}}}),Yi=sg;function ng(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function rg(e,t){for(const s in t){const n=t[s],r=e[s];if(typeof n=="string"){if(n!==r)return!1}else if(!Nt(r)||r.length!==n.length||n.some((i,a)=>i.valueOf()!==r[a].valueOf()))return!1}return!0}function qo(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const zo=(e,t,s)=>e??t??s,ig=st({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:s}){const n=kt(Ji),r=Ne(()=>e.route||n.value),i=kt(Mo,0),a=Ne(()=>{let c=Re(i);const{matched:u}=r.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),o=Ne(()=>r.value.matched[a.value]);xr(Mo,Ne(()=>a.value+1)),xr(Lp,o),xr(Ji,r);const l=q();return vt(()=>[l.value,o.value,e.name],([c,u,d],[f,p,b])=>{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||!cn(u,p)||!f)&&(u.enterCallbacks[d]||[]).forEach(v=>v(c))},{flush:"post"}),()=>{const c=r.value,u=e.name,d=o.value,f=d&&d.components[u];if(!f)return Ko(s.default,{Component:f,route:c});const p=d.props[u],b=p?p===!0?c.params:typeof p=="function"?p(c):p:null,T=Ra(f,Ie({},b,t,{onVnodeUnmounted:R=>{R.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return Ko(s.default,{Component:T,route:c})||T}}});function Ko(e,t){if(!e)return null;const s=e(t);return s.length===1?s[0]:s}const gu=ig;function ag(e){const t=Jp(e.routes,e),s=e.parseQuery||Ip,n=e.stringifyQuery||Lo,r=e.history,i=vn(),a=vn(),o=vn(),l=Jd(hs);let c=hs;Zs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ki.bind(null,j=>""+j),d=ki.bind(null,mp),f=ki.bind(null,Vn);function p(j,ae){let oe,me;return uu(j)?(oe=t.getRecordMatcher(j),me=ae):me=j,t.addRoute(me,oe)}function b(j){const ae=t.getRecordMatcher(j);ae&&t.removeRoute(ae)}function v(){return t.getRoutes().map(j=>j.record)}function T(j){return!!t.getRecordMatcher(j)}function R(j,ae){if(ae=Ie({},ae||l.value),typeof j=="string"){const P=Ei(s,j,ae.path),F=t.resolve({path:P.path},ae),G=r.createHref(P.fullPath);return Ie(P,F,{params:f(F.params),hash:Vn(P.hash),redirectedFrom:void 0,href:G})}let oe;if(j.path!=null)oe=Ie({},j,{path:Ei(s,j.path,ae.path).path});else{const P=Ie({},j.params);for(const F in P)P[F]==null&&delete P[F];oe=Ie({},j,{params:d(P)}),ae.params=d(ae.params)}const me=t.resolve(oe,ae),Ce=j.hash||"";me.params=u(f(me.params));const _=yp(n,Ie({},j,{hash:fp(Ce),path:me.path})),w=r.createHref(_);return Ie({fullPath:_,hash:Ce,query:n===Lo?Pp(j.query):j.query||{}},me,{redirectedFrom:void 0,href:w})}function k(j){return typeof j=="string"?Ei(s,j,l.value.path):Ie({},j)}function x(j,ae){if(c!==j)return un(Fe.NAVIGATION_CANCELLED,{from:ae,to:j})}function E(j){return O(j)}function A(j){return E(Ie(k(j),{replace:!0}))}function N(j,ae){const oe=j.matched[j.matched.length-1];if(oe&&oe.redirect){const{redirect:me}=oe;let Ce=typeof me=="function"?me(j,ae):me;return typeof Ce=="string"&&(Ce=Ce.includes("?")||Ce.includes("#")?Ce=k(Ce):{path:Ce},Ce.params={}),Ie({query:j.query,hash:j.hash,params:Ce.path!=null?{}:j.params},Ce)}}function O(j,ae){const oe=c=R(j),me=l.value,Ce=j.state,_=j.force,w=j.replace===!0,P=N(oe,me);if(P)return O(Ie(k(P),{state:typeof P=="object"?Ie({},Ce,P.state):Ce,force:_,replace:w}),ae||oe);const F=oe;F.redirectedFrom=ae;let G;return!_&&_p(n,me,oe)&&(G=un(Fe.NAVIGATION_DUPLICATED,{to:F,from:me}),ke(me,me,!0,!1)),(G?Promise.resolve(G):W(F,me)).catch(z=>Zt(z)?Zt(z,Fe.NAVIGATION_GUARD_REDIRECT)?z:ge(z):H(z,F,me)).then(z=>{if(z){if(Zt(z,Fe.NAVIGATION_GUARD_REDIRECT))return O(Ie({replace:w},k(z.to),{state:typeof z.to=="object"?Ie({},Ce,z.to.state):Ce,force:_}),ae||F)}else z=ee(F,me,!0,w,Ce);return ne(F,me,z),z})}function L(j,ae){const oe=x(j,ae);return oe?Promise.reject(oe):Promise.resolve()}function D(j){const ae=M.values().next().value;return ae&&typeof ae.runWithContext=="function"?ae.runWithContext(j):j()}function W(j,ae){let oe;const[me,Ce,_]=Mp(j,ae);oe=Ti(me.reverse(),"beforeRouteLeave",j,ae);for(const P of me)P.leaveGuards.forEach(F=>{oe.push(gs(F,j,ae))});const w=L.bind(null,j,ae);return oe.push(w),Q(oe).then(()=>{oe=[];for(const P of i.list())oe.push(gs(P,j,ae));return oe.push(w),Q(oe)}).then(()=>{oe=Ti(Ce,"beforeRouteUpdate",j,ae);for(const P of Ce)P.updateGuards.forEach(F=>{oe.push(gs(F,j,ae))});return oe.push(w),Q(oe)}).then(()=>{oe=[];for(const P of _)if(P.beforeEnter)if(Nt(P.beforeEnter))for(const F of P.beforeEnter)oe.push(gs(F,j,ae));else oe.push(gs(P.beforeEnter,j,ae));return oe.push(w),Q(oe)}).then(()=>(j.matched.forEach(P=>P.enterCallbacks={}),oe=Ti(_,"beforeRouteEnter",j,ae,D),oe.push(w),Q(oe))).then(()=>{oe=[];for(const P of a.list())oe.push(gs(P,j,ae));return oe.push(w),Q(oe)}).catch(P=>Zt(P,Fe.NAVIGATION_CANCELLED)?P:Promise.reject(P))}function ne(j,ae,oe){o.list().forEach(me=>D(()=>me(j,ae,oe)))}function ee(j,ae,oe,me,Ce){const _=x(j,ae);if(_)return _;const w=ae===hs,P=Zs?history.state:{};oe&&(me||w?r.replace(j.fullPath,Ie({scroll:w&&P&&P.scroll},Ce)):r.push(j.fullPath,Ce)),l.value=j,ke(j,ae,oe,w),ge()}let X;function I(){X||(X=r.listen((j,ae,oe)=>{if(!U.listening)return;const me=R(j),Ce=N(me,U.currentRoute.value);if(Ce){O(Ie(Ce,{replace:!0,force:!0}),me).catch(Nn);return}c=me;const _=l.value;Zs&&Rp(Po(_.fullPath,oe.delta),ri()),W(me,_).catch(w=>Zt(w,Fe.NAVIGATION_ABORTED|Fe.NAVIGATION_CANCELLED)?w:Zt(w,Fe.NAVIGATION_GUARD_REDIRECT)?(O(Ie(k(w.to),{force:!0}),me).then(P=>{Zt(P,Fe.NAVIGATION_ABORTED|Fe.NAVIGATION_DUPLICATED)&&!oe.delta&&oe.type===Gi.pop&&r.go(-1,!1)}).catch(Nn),Promise.reject()):(oe.delta&&r.go(-oe.delta,!1),H(w,me,_))).then(w=>{w=w||ee(me,_,!1),w&&(oe.delta&&!Zt(w,Fe.NAVIGATION_CANCELLED)?r.go(-oe.delta,!1):oe.type===Gi.pop&&Zt(w,Fe.NAVIGATION_ABORTED|Fe.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),ne(me,_,w)}).catch(Nn)}))}let $=vn(),y=vn(),S;function H(j,ae,oe){ge(j);const me=y.list();return me.length?me.forEach(Ce=>Ce(j,ae,oe)):console.error(j),Promise.reject(j)}function ie(){return S&&l.value!==hs?Promise.resolve():new Promise((j,ae)=>{$.add([j,ae])})}function ge(j){return S||(S=!j,I(),$.list().forEach(([ae,oe])=>j?oe(j):ae()),$.reset()),j}function ke(j,ae,oe,me){const{scrollBehavior:Ce}=e;if(!Zs||!Ce)return Promise.resolve();const _=!oe&&Cp(Po(j.fullPath,0))||(me||!oe)&&history.state&&history.state.scroll||null;return zt().then(()=>Ce(j,ae,_)).then(w=>w&&Ap(w)).catch(w=>H(w,j,ae))}const Ae=j=>r.go(j);let J;const M=new Set,U={currentRoute:l,listening:!0,addRoute:p,removeRoute:b,clearRoutes:t.clearRoutes,hasRoute:T,getRoutes:v,resolve:R,options:e,push:E,replace:A,go:Ae,back:()=>Ae(-1),forward:()=>Ae(1),beforeEach:i.add,beforeResolve:a.add,afterEach:o.add,onError:y.add,isReady:ie,install(j){j.component("RouterLink",Yi),j.component("RouterView",gu),j.config.globalProperties.$router=U,Object.defineProperty(j.config.globalProperties,"$route",{enumerable:!0,get:()=>Re(l)}),Zs&&!J&&l.value===hs&&(J=!0,E(r.location).catch(me=>{}));const ae={};for(const me in hs)Object.defineProperty(ae,me,{get:()=>l.value[me],enumerable:!0});j.provide(ii,U),j.provide(Oa,oc(ae)),j.provide(Ji,l);const oe=j.unmount;M.add(j),j.unmount=function(){M.delete(j),M.size<1&&(c=hs,X&&X(),X=null,l.value=hs,J=!1,S=!1),oe()}}};function Q(j){return j.reduce((ae,oe)=>ae.then(()=>D(oe)),Promise.resolve())}return U}function mu(){return kt(ii)}function bu(e){return kt(Oa)}const og=["width","height","viewBox","innerHTML"],Ee=st({__name:"FluentIcon",props:{paths:{},size:{default:20},viewBox:{default:20}},setup(e){return(t,s)=>(g(),m("svg",{xmlns:"http://www.w3.org/2000/svg",width:e.size,height:e.size,viewBox:`0 0 ${e.viewBox} ${e.viewBox}`,fill:"currentColor","aria-hidden":"true",innerHTML:e.paths},null,8,og))}});function ai(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(s[n[r]]=e[n[r]]);return s}function lg(e,t,s,n){function r(i){return i instanceof s?i:new s(function(a){a(i)})}return new(s||(s=Promise))(function(i,a){function o(u){try{c(n.next(u))}catch(d){a(d)}}function l(u){try{c(n.throw(u))}catch(d){a(d)}}function c(u){u.done?i(u.value):r(u.value).then(o,l)}c((n=n.apply(e,t||[])).next())})}const cg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class $a extends Error{constructor(t,s="FunctionsError",n){super(t),this.name=s,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class ug extends $a{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Wo extends $a{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Go extends $a{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Xi;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Xi||(Xi={}));class dg{constructor(t,{headers:s={},customFetch:n,region:r=Xi.Any}={}){this.url=t,this.headers=s,this.region=r,this.fetch=cg(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return lg(this,arguments,void 0,function*(s,n={}){var r;let i,a;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=n;let f={},{region:p}=n;p||(p=this.region);const b=new URL(`${this.url}/${s}`);p&&p!=="any"&&(f["x-region"]=p,b.searchParams.set("forceFunctionRegion",p));let v;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",v=c):typeof c=="string"?(f["Content-Type"]="text/plain",v=c):typeof FormData<"u"&&c instanceof FormData?v=c:(f["Content-Type"]="application/json",v=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?v=JSON.stringify(c):v=c;let T=u;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),u?(T=a.signal,u.addEventListener("abort",()=>a.abort())):T=a.signal);const R=yield this.fetch(b.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:v,signal:T}).catch(A=>{throw new ug(A)}),k=R.headers.get("x-relay-error");if(k&&k==="true")throw new Wo(R);if(!R.ok)throw new Go(R);let x=((r=R.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),E;return x==="application/json"?E=yield R.json():x==="application/octet-stream"||x==="application/pdf"?E=yield R.blob():x==="text/event-stream"?E=R:x==="multipart/form-data"?E=yield R.formData():E=yield R.text(),{data:E,error:null,response:R}}catch(o){return{data:null,error:o,response:o instanceof Go||o instanceof Wo?o.context:void 0}}finally{i&&clearTimeout(i)}})}}const vu=3,Zo=e=>Math.min(1e3*2**e,3e4),hg=[520,503],yu=["GET","HEAD","OPTIONS"];var fg=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Jo(e,t){return new Promise(s=>{if(t!=null&&t.aborted){s();return}const n=setTimeout(()=>{t==null||t.removeEventListener("abort",r),s()},e);function r(){clearTimeout(n),s()}t==null||t.addEventListener("abort",r)})}function pg(e,t,s,n){return!(!n||s>=vu||!yu.includes(e)||!hg.includes(t))}var gg=class{constructor(e){var t,s,n,r,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(s=e.isMaybeSingle)!==null&&s!==void 0?s:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(r=e.urlLengthLimit)!==null&&r!==void 0?r:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.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(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){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 a=this.headers.get("Accept");a==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!a||a==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let a=0;for(;;){const c=new Headers(s.headers);a>0&&c.set("X-Retry-Count",String(a));let u;try{u=await n(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"||!yu.includes(s.method))throw d;if(s.retryEnabled&&a<vu){const f=Zo(a);a++,await Jo(f,s.signal);continue}throw d}if(pg(s.method,u.status,a,s.retryEnabled)){var o,l;const d=(o=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&o!==void 0?o:null,f=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:Zo(a);await u.text(),a++,await Jo(f,s.signal);continue}return await s.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(a=>{var o;let l="",c="",u="";const d=a==null?void 0:a.cause;if(d){var f,p,b,v;const k=(f=d==null?void 0:d.message)!==null&&f!==void 0?f:"",x=(p=d==null?void 0:d.code)!==null&&p!==void 0?p:"";l=`${(b=a==null?void 0:a.name)!==null&&b!==void 0?b:"FetchError"}: ${a==null?void 0:a.message}`,l+=`
|
|
30
|
+
|
|
31
|
+
Caused by: ${(v=d==null?void 0:d.name)!==null&&v!==void 0?v:"Error"}: ${k}`,x&&(l+=` (${x})`),d!=null&&d.stack&&(l+=`
|
|
32
|
+
${d.stack}`)}else{var T;l=(T=a==null?void 0:a.stack)!==null&&T!==void 0?T:""}const R=this.url.toString().length;return(a==null?void 0:a.name)==="AbortError"||(a==null?void 0:a.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",R>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${R} 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)",R>this.urlLengthLimit&&(c+=`. Your request URL is ${R} 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:`${(o=a==null?void 0:a.name)!==null&&o!==void 0?o:"FetchError"}: ${a==null?void 0:a.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let s=null,n=null,r=null,i=e.status,a=e.statusText;if(e.ok){var o,l;if(t.method!=="HEAD"){var c;const f=await e.text();f===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?n=f:n=JSON.parse(f))}const u=(o=t.headers.get("Prefer"))===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),d=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&d&&d.length>1&&(r=parseInt(d[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(s={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,r=null,i=406,a="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await e.text();try{s=JSON.parse(u),Array.isArray(s)&&e.status===404&&(n=[],s=null,i=200,a="OK")}catch{e.status===404&&u===""?(i=204,a="No Content"):s={message:u}}if(s&&t.shouldThrowOnError)throw new fg(s)}return{success:s===null,error:s,data:n,count:r,status:i,statusText:a}}returns(){return this}overrideTypes(){return this}},mg=class extends gg{select(e){let t=!1;const s=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",s),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:n,referencedTable:r=n}={}){const i=r?`${r}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const n=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:n=s}={}){const r=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,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:e=!1,verbose:t=!1,settings:s=!1,buffers:n=!1,wal:r=!1,format:i="text"}={}){var a;const o=[e?"analyze":null,t?"verbose":null,s?"settings":null,n?"buffers":null,r?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${o};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const Yo=new RegExp("[,()]");var Js=class extends mg{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const s=Array.from(new Set(t)).map(n=>typeof n=="string"&&Yo.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}notIn(e,t){const s=Array.from(new Set(t)).map(n=>typeof n=="string"&&Yo.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${s})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:n}={}){let r="";n==="plain"?r="pl":n==="phrase"?r="ph":n==="websearch"&&(r="w");const i=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${r}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,s])=>s!==void 0).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const n=s?`${s}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}},bg=class{constructor(e,{headers:t={},schema:s,fetch:n,urlLengthLimit:r=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=s,this.fetch=n,this.urlLengthLimit=r,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:s=!1,count:n}=t??{},r=s?"HEAD":"GET";let i=!1;const a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:o,headers:l}=this.cloneRequestState();return o.searchParams.set("select",a),n&&l.append("Prefer",`count=${n}`),new Js({method:r,url:o,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:s=!0}={}){var n;const r="POST",{url:i,headers:a}=this.cloneRequestState();if(t&&a.append("Prefer",`count=${t}`),s||a.append("Prefer","missing=default"),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Js({method:r,url:i,headers:a,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:n,defaultToNull:r=!0}={}){var i;const a="POST",{url:o,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${s?"ignore":"merge"}-duplicates`),t!==void 0&&o.searchParams.set("on_conflict",t),n&&l.append("Prefer",`count=${n}`),r||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.reduce((u,d)=>u.concat(Object.keys(d)),[]);if(c.length>0){const u=[...new Set(c)].map(d=>`"${d}"`);o.searchParams.set("columns",u.join(","))}}return new Js({method:a,url:o,headers:l,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var s;const n="PATCH",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Js({method:n,url:r,headers:i,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const s="DELETE",{url:n,headers:r}=this.cloneRequestState();return e&&r.append("Prefer",`count=${e}`),new Js({method:s,url:n,headers:r,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function qn(e){"@babel/helpers - typeof";return qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(e)}function vg(e,t){if(qn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yg(e){var t=vg(e,"string");return qn(t)=="symbol"?t:t+""}function _g(e,t,s){return(t=yg(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Xo(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function cr(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?Xo(Object(s),!0).forEach(function(n){_g(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Xo(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}var xg=class _u{constructor(t,{headers:s={},schema:n,fetch:r,timeout:i,urlLengthLimit:a=8e3,retry:o}={}){this.url=t,this.headers=new Headers(s),this.schemaName=n,this.urlLengthLimit=a;const l=r??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 b=()=>{clearTimeout(f),d.abort()};return p.addEventListener("abort",b,{once:!0}),l(c,cr(cr({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",b)})}return l(c,cr(cr({},u),{},{signal:d.signal})).finally(()=>clearTimeout(f))}:this.fetch=l,this.retry=o}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new bg(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new _u(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,s={},{head:n=!1,get:r=!1,count:i}={}){var a;let o;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(u)),d=n&&Object.values(s).some(u);d?(o="POST",c=s):n||r?(o=n?"HEAD":"GET",Object.entries(s).filter(([p,b])=>b!==void 0).map(([p,b])=>[p,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([p,b])=>{l.searchParams.append(p,b)})):(o="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 Js({method:o,url:l,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class wg{constructor(){}static detectEnvironment(){var t;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 n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.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"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 r=globalThis.process;if(r){const i=r.versions;if(i&&i.node){const a=i.node,o=parseInt(a.replace(/^v/,"").split(".")[0]);return o>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${o} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${o} 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 t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let s=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(s+=`
|
|
35
|
+
|
|
36
|
+
Suggested solution: ${t.workaround}`),new Error(s)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const kg="2.105.4",Eg=`realtime-js/${kg}`,Sg="1.0.0",xu="2.0.0",Tg=xu,Ag=1e4,Rg=100,bs={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},wu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Qi={connecting:"connecting",closing:"closing",closed:"closed"};class Cg{constructor(t){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=t??[]}encode(t,s){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return s(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return s(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var s;return this._isArrayBuffer((s=t.payload)===null||s===void 0?void 0:s.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var s,n;const r=(n=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(t){var s,n;const r=(n=(s=t.payload)===null||s===void 0?void 0:s.payload)!==null&&n!==void 0?n:{},a=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(t,s,n){var r,i;const a=t.topic,o=(r=t.ref)!==null&&r!==void 0?r:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.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(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.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+o.length+a.length+c.length+d.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let b=new DataView(p),v=0;b.setUint8(v++,this.KINDS.userBroadcastPush),b.setUint8(v++,l.length),b.setUint8(v++,o.length),b.setUint8(v++,a.length),b.setUint8(v++,c.length),b.setUint8(v++,d.length),b.setUint8(v++,s),Array.from(l,R=>b.setUint8(v++,R.charCodeAt(0))),Array.from(o,R=>b.setUint8(v++,R.charCodeAt(0))),Array.from(a,R=>b.setUint8(v++,R.charCodeAt(0))),Array.from(c,R=>b.setUint8(v++,R.charCodeAt(0))),Array.from(d,R=>b.setUint8(v++,R.charCodeAt(0)));var T=new Uint8Array(p.byteLength+n.byteLength);return T.set(new Uint8Array(p),0),T.set(new Uint8Array(n),p.byteLength),T.buffer}decode(t,s){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return s(n)}if(typeof t=="string"){const n=JSON.parse(t),[r,i,a,o,l]=n;return s({join_ref:r,ref:i,topic:a,event:o,payload:l})}return s({})}_binaryDecode(t){const s=new DataView(t),n=s.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,s,r)}}_decodeUserBroadcast(t,s,n){const r=s.getUint8(1),i=s.getUint8(2),a=s.getUint8(3),o=s.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(t.slice(l,l+r));l=l+r;const u=n.decode(t.slice(l,l+i));l=l+i;const d=n.decode(t.slice(l,l+a));l=l+a;const f=t.slice(l,t.byteLength),p=o===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,b={type:this.BROADCAST_EVENT,event:u,payload:p};return a>0&&(b.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(t){var s;return t instanceof ArrayBuffer||((s=t==null?void 0:t.constructor)===null||s===void 0?void 0:s.name)==="ArrayBuffer"}_pick(t,s){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>s.includes(n)))}}var De;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(De||(De={}));const Qo=(e,t,s={})=>{var n;const r=(n=s.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((i,a)=>(i[a]=Og(a,e,t,r),i),{}):{}},Og=(e,t,s,n)=>{const r=t.find(o=>o.name===e),i=r==null?void 0:r.type,a=s[e];return i&&!n.includes(i)?ku(i,a):ea(a)},ku=(e,t)=>{if(e.charAt(0)==="_"){const s=e.slice(1,e.length);return Pg(t,s)}switch(e){case De.bool:return $g(t);case De.float4:case De.float8:case De.int2:case De.int4:case De.int8:case De.numeric:case De.oid:return Ng(t);case De.json:case De.jsonb:return Ig(t);case De.timestamp:return Lg(t);case De.abstime:case De.date:case De.daterange:case De.int4range:case De.int8range:case De.money:case De.reltime:case De.text:case De.time:case De.timestamptz:case De.timetz:case De.tsrange:case De.tstzrange:return ea(t);default:return ea(t)}},ea=e=>e,$g=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Ng=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Ig=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Pg=(e,t)=>{if(typeof e!="string")return e;const s=e.length-1,n=e[s];if(e[0]==="{"&&n==="}"){let i;const a=e.slice(1,s);try{i=JSON.parse("["+a+"]")}catch{i=a?a.split(","):[]}return i.map(o=>ku(t,o))}return e},Lg=e=>typeof e=="string"?e.replace(" ","T"):e,Eu=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var In=e=>typeof e=="function"?e:function(){return e},Mg=typeof self<"u"?self:null,Ys=typeof window<"u"?window:null,Dt=Mg||Ys||globalThis,jg="2.0.0",Dg=1e4,Ug=1e3,Ft={connecting:0,open:1,closing:2,closed:3},dt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Xt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ta={longpoll:"longpoll",websocket:"websocket"},Bg={complete:4},sa="base64url.bearer.phx.",ur=class{constructor(e,t,s,n){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,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(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}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,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Su=class{constructor(e,t){this.callback=e,this.timerCalc=t,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))}},Hg=class{constructor(e,t,s){this.state=dt.closed,this.topic=e,this.params=In(t||{}),this.socket=s,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ur(this,Xt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Su(()=>{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=dt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=dt.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=dt.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=dt.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 ur(this,Xt.leave,In({}),this.timeout).send(),this.state=dt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Xt.reply,(n,r)=>{this.trigger(this.replyEventName(r),n)})}join(e=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=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=dt.closed,this.bindings=[]}onClose(e){this.on(Xt.close,e)}onError(e){return this.on(Xt.error,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(typeof t>"u"||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new ur(this,e,function(){return t},s);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=dt.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Xt.close,"leave")},s=new ur(this,Xt.leave,In({}),e);return s.receive("ok",()=>t()).receive("timeout",()=>t()),s.send(),this.canPush()||s.trigger("ok",{}),s}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=dt.joining,this.joinPush.resend(e))}trigger(e,t,s,n){let r=this.onMessage(e,t,s,n);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(a=>a.event===e&&this.filterBindings(a,t,s));for(let a=0;a<i.length;a++)i[a].callback(r,s,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===dt.closed}isErrored(){return this.state===dt.errored}isJoined(){return this.state===dt.joined}isJoining(){return this.state===dt.joining}isLeaving(){return this.state===dt.leaving}},Pr=class{static request(e,t,s,n,r,i,a){if(Dt.XDomainRequest){let o=new Dt.XDomainRequest;return this.xdomainRequest(o,e,t,n,r,i,a)}else if(Dt.XMLHttpRequest){let o=new Dt.XMLHttpRequest;return this.xhrRequest(o,e,t,s,n,r,i,a)}else{if(Dt.fetch&&Dt.AbortController)return this.fetchRequest(e,t,s,n,r,i,a);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,s,n,r,i,a){let o={method:e,headers:s,body:n},l=null;return r&&(l=new AbortController,setTimeout(()=>l.abort(),r),o.signal=l.signal),Dt.fetch(t,o).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>a&&a(c)).catch(c=>{c.name==="AbortError"&&i?i():a&&a(null)}),l}static xdomainRequest(e,t,s,n,r,i,a){return e.timeout=r,e.open(t,s),e.onload=()=>{let o=this.parseJSON(e.responseText);a&&a(o)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,s,n,r,i,a,o){e.open(t,s,!0),e.timeout=i;for(let[l,c]of Object.entries(n))e.setRequestHeader(l,c);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===Bg.complete&&o){let l=this.parseJSON(e.responseText);o(l)}},a&&(e.ontimeout=a),e.send(r),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=t?`${t}[${n}]`:n,i=e[n];typeof i=="object"?s.push(this.serialize(i,r)):s.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}return s.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},Fg=e=>{let t="",s=new Uint8Array(e),n=s.byteLength;for(let r=0;r<n;r++)t+=String.fromCharCode(s[r]);return btoa(t)},Fs=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(sa)&&(this.authToken=atob(t[1].slice(sa.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(e),this.readyState=Ft.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ta.websocket),"$1/"+ta.longpoll)}endpointURL(){return Pr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=Ft.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ft.open||this.readyState===Ft.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:s,token:n,messages:r}=t;if(s===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else s=0;switch(s){case 200:r.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Ft.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(e){typeof e!="string"&&(e=Fg(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
|
|
37
|
+
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,s){for(let r of this.reqs)r.abort();this.readyState=Ft.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,s,n,r){let i,a=()=>{this.reqs.delete(i),n()};i=Pr.request(e,this.endpointURL(),t,s,this.timeout,a,o=>{this.reqs.delete(i),this.isActive()&&r(o)}),this.reqs.add(i)}},Vg=class wn{constructor(t,s={}){let n=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,r=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel.joinRef(),this.state=wn.syncState(this.state,r,i,a),this.pendingDiffs.forEach(l=>{this.state=wn.syncDiff(this.state,l,i,a)}),this.pendingDiffs=[],o()}),this.channel.on(n.diff,r=>{let{onJoin:i,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=wn.syncDiff(this.state,r,i,a),o())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return wn.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,s,n,r){let i=this.clone(t),a={},o={};return this.map(i,(l,c)=>{s[l]||(o[l]=c)}),this.map(s,(l,c)=>{let u=i[l];if(u){let d=c.metas.map(v=>v.phx_ref),f=u.metas.map(v=>v.phx_ref),p=c.metas.filter(v=>f.indexOf(v.phx_ref)<0),b=u.metas.filter(v=>d.indexOf(v.phx_ref)<0);p.length>0&&(a[l]=c,a[l].metas=p),b.length>0&&(o[l]=this.clone(u),o[l].metas=b)}else a[l]=c}),this.syncDiff(i,{joins:a,leaves:o},n,r)}static syncDiff(t,s,n,r){let{joins:i,leaves:a}=this.clone(s);return n||(n=function(){}),r||(r=function(){}),this.map(i,(o,l)=>{let c=t[o];if(t[o]=this.clone(l),c){let u=t[o].metas.map(f=>f.phx_ref),d=c.metas.filter(f=>u.indexOf(f.phx_ref)<0);t[o].metas.unshift(...d)}n(o,c,l)}),this.map(a,(o,l)=>{let c=t[o];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.phx_ref)<0),r(o,c,l),c.metas.length===0&&delete t[o]}),t}static list(t,s){return s||(s=function(n,r){return r}),this.map(t,(n,r)=>s(n,r))}static map(t,s){return Object.getOwnPropertyNames(t).map(n=>s(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},dr={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,n,r,i,a]=JSON.parse(e);return t({join_ref:s,ref:n,topic:r,event:i,payload:a})}},binaryEncode(e){let{join_ref:t,ref:s,event:n,topic:r,payload:i}=e,a=this.META_LENGTH+t.length+s.length+r.length+n.length,o=new ArrayBuffer(this.HEADER_LENGTH+a),l=new DataView(o),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),l.setUint8(c++,n.length),Array.from(t,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(s,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0)));var u=new Uint8Array(o.byteLength+i.byteLength);return u.set(new Uint8Array(o),0),u.set(new Uint8Array(i),o.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),n=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),a=this.HEADER_LENGTH+this.META_LENGTH-1,o=s.decode(e.slice(a,a+n));a=a+n;let l=s.decode(e.slice(a,a+r));a=a+r;let c=s.decode(e.slice(a,a+i));a=a+i;let u=e.slice(a,e.byteLength);return{join_ref:o,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),a=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(o,o+n));o=o+n;let c=s.decode(e.slice(o,o+r));o=o+r;let u=s.decode(e.slice(o,o+i));o=o+i;let d=s.decode(e.slice(o,o+a));o=o+a;let f=e.slice(o,e.byteLength),p={status:d,response:f};return{join_ref:l,ref:c,topic:u,event:Xt.reply,payload:p}},decodeBroadcast(e,t,s){let n=t.getUint8(1),r=t.getUint8(2),i=this.HEADER_LENGTH+2,a=s.decode(e.slice(i,i+n));i=i+n;let o=s.decode(e.slice(i,i+r));i=i+r;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:a,event:o,payload:l}}},qg=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Dg,this.transport=t.transport||Dt.WebSocket||Fs,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let s=null;try{s=Dt&&Dt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||s,this.establishedConnections=0,this.defaultEncoder=dr.encode.bind(dr),this.defaultDecoder=dr.decode.bind(dr),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Fs?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Ys&&Ys.addEventListener&&(Ys.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Ys.addEventListener("pageshow",r=>{n===this.connectClock&&(n=null,this.connect())}),Ys.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=r=>t.rejoinAfterMs?t.rejoinAfterMs(r):[1e3,2e3,5e3][r-1]||1e4,this.reconnectAfterMs=r=>t.reconnectAfterMs?t.reconnectAfterMs(r):[10,50,100,150,200,250,500,1e3,2e3][r-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(r,i,a)=>{console.log(`${r}: ${i}`,a)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=In(t.params||{}),this.endPoint=`${e}/${ta.websocket}`,this.vsn=t.vsn||jg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Su(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return Fs}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Pr.appendParams(Pr.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=In(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Fs?this.connectWithFallback(Fs,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(r=>{r.ref===t&&(this.off([n]),e(Date.now()-s))});return!0}transportName(e){switch(e){case Fs:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${sa}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s=!1,n=!0,r,i,a=this.transportName(e),o=l=>{this.log("transport",`falling back to ${a}...`,l),this.off([r,i]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${a}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),i=this.onError(l=>{this.log("transport","error",l),n&&!s&&(clearTimeout(this.fallbackTimer),o(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(s=!0,!n){let l=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),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(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Ug,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,s||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){if(s===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s)}waitForSocketClosed(e,t,s=1){if(s===5||e.readyState===Ft.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Xt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ft.connecting:return"connecting";case Ft.open:return"open";case Ft.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([s])=>e.indexOf(s)===-1)}channel(e,t={}){let s=new Hg(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:n,ref:r,join_ref:i}=e;this.log("push",`${t} ${s} (${i}, ${r})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}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(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:s,event:n,payload:r,ref:i,join_ref:a}=t;if(i&&i===this.pendingHeartbeatRef){const o=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status==="ok"?"ok":"error",o)}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",`${r.status||""} ${s} ${n} ${i&&"("+i+")"||""}`.trim(),r);for(let o=0;o<this.channels.length;o++){const l=this.channels[o];l.isMember(s,n,r,a)&&l.trigger(n,r,i,a)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([s,n])=>{try{n(...t)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(s){this.log("error",`error triggering ${e} callbacks`,s)}}leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s.isJoined()||s.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Pn{constructor(t,s){const n=Kg(s);this.presence=new Vg(t.getChannel(),n),this.presence.onJoin((r,i,a)=>{const o=Pn.onJoinPayload(r,i,a);t.getChannel().trigger("presence",o)}),this.presence.onLeave((r,i,a)=>{const o=Pn.onLeavePayload(r,i,a);t.getChannel().trigger("presence",o)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Pn.transformState(this.presence.state)}static transformState(t){return t=zg(t),Object.getOwnPropertyNames(t).reduce((s,n)=>{const r=t[n];return s[n]=Er(r),s},{})}static onJoinPayload(t,s,n){const r=el(s),i=Er(n);return{event:"join",key:t,currentPresences:r,newPresences:i}}static onLeavePayload(t,s,n){const r=el(s),i=Er(n);return{event:"leave",key:t,currentPresences:r,leftPresences:i}}}function Er(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function zg(e){return JSON.parse(JSON.stringify(e))}function Kg(e){return(e==null?void 0:e.events)&&{events:e.events}}function el(e){return e!=null&&e.metas?Er(e):[]}var tl;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(tl||(tl={}));class Wg{get state(){return this.presenceAdapter.state}constructor(t,s){this.channel=t,this.presenceAdapter=new Pn(this.channel.channelAdapter,s)}}function Gg(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const s=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${s}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class Zg{constructor(t,s,n){const r=Jg(n);this.channel=t.getSocket().channel(s,r),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,s){return this.channel.on(t,s)}off(t,s){this.channel.off(t,s)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,s,n){let r;try{r=this.channel.push(t,s,n)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Rg){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return r}updateJoinPayload(t){const s=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},s),t)}canPush(){return this.socket.isConnected()&&this.state===bs.joined}isJoined(){return this.state===bs.joined}isJoining(){return this.state===bs.joining}isClosed(){return this.state===bs.closed}isLeaving(){return this.state===bs.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function Jg(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var sl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(sl||(sl={}));var en;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(en||(en={}));var Qt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Qt||(Qt={}));class Ln{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}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(t,s={config:{}},n){var r,i;if(this.topic=t,this.params=s,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},s.config),this.channelAdapter=new Zg(this.socket.socketAdapter,t,this.params),this.presence=new Wg(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Eu(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(r=this.params.config)===null||r===void 0?void 0:r.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(t,s=this.timeout){var n,r,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(r=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&r!==void 0?r:[],u=!!this.bindings[en.PRESENCE]&&this.bindings[en.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},f={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(p=>{t==null||t(Qt.CHANNEL_ERROR,Gg(p))}),this._onClose(()=>t==null?void 0:t(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){t==null||t(Qt.SUBSCRIBED);return}this._updatePostgresBindings(p,t)}).receive("error",p=>{this.state=bs.errored;const b=Object.values(p).join(", ")||"error";t==null||t(Qt.CHANNEL_ERROR,new Error(b,{cause:p}))}).receive("timeout",()=>{t==null||t(Qt.TIMED_OUT)})}return this}_updatePostgresBindings(t,s){var n;const r=this.bindings.postgres_changes,i=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0,a=[];for(let o=0;o<i;o++){const l=r[o],{filter:{event:c,schema:u,table:d,filter:f}}=l,p=t&&t[o];if(p&&p.event===c&&Ln.isFilterValueEqual(p.schema,u)&&Ln.isFilterValueEqual(p.table,d)&&Ln.isFilterValueEqual(p.filter,f))a.push(Object.assign(Object.assign({},l),{id:p.id}));else{this.unsubscribe(),this.state=bs.errored,s==null||s(Qt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=a,this.state!=bs.errored&&s&&s(Qt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,s={}){return await this.send({type:"presence",event:"track",payload:t},s.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,s,n){const r=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===en.PRESENCE||t===en.POSTGRES_CHANGES;if(r&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,s,n)}async httpSend(t,s,n={}){var r;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 a={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:s,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(t,s={}){var n,r;if(!this.channelAdapter.canPush()&&t.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:a}=t,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=s.timeout)!==null&&n!==void 0?n:this.timeout);return await((r=c.body)===null||r===void 0?void 0:r.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var a,o,l;const c=this.channelAdapter.push(t.type,t,s.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.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(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(s=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>s("ok")).receive("timeout",()=>s("timed out")).receive("error",()=>s("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,s,n){const r=new AbortController,i=setTimeout(()=>r.abort(),n),a=await this.socket.fetch(t,Object.assign(Object.assign({},s),{signal:r.signal}));return clearTimeout(i),a}_on(t,s,n){const r=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,n),a={type:r,filter:s,callback:n,ref:i};return this.bindings[r]?this.bindings[r].push(a):this.bindings[r]=[a],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,s,n)=>{var r,i,a,o,l,c,u;const d=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const f=(r=this.bindings[d])===null||r===void 0?void 0:r.find(p=>p.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in f){const p=f.id,b=(i=f.filter)===null||i===void 0?void 0:i.event;return p&&((a=s.ids)===null||a===void 0?void 0:a.includes(p))&&(b==="*"||(b==null?void 0:b.toLocaleLowerCase())===((o=s.data)===null||o===void 0?void 0:o.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(t,s){const{close:n,error:r,leave:i,join:a}=wu;return s&&[n,r,i,a].includes(t)&&s!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,s,n)=>{if(typeof s=="object"&&"ids"in s){const r=s.data,{schema:i,table:a,commit_timestamp:o,type:l,errors:c}=r;return Object.assign(Object.assign({},{schema:i,table:a,commit_timestamp:o,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(r))}return s})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const s in t.bindings)for(const n of t.bindings[s])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,s){return(t??void 0)===(s??void 0)}_getPayloadRecords(t){const s={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(s.new=Qo(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(s.old=Qo(t.columns,t.old_record)),s}}class Yg{constructor(t,s){this.socket=new qg(t,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(t){this.socket.heartbeatCallback=t}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(t,s,n,r=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),r),this.socket.disconnect(()=>{t(),i("ok")},s,n)})}push(t){this.socket.push(t)}log(t,s,n){this.socket.log(t,s,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Qi.connecting}isDisconnecting(){return this.socket.connectionState()==Qi.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const nl={HEARTBEAT_INTERVAL:25e3},Xg=[1e3,2e3,5e3,1e4],Qg=1e4;function e0(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var s;return(s=Array.from(e.keys())[t])!==null&&s!==void 0?s:null},removeItem(t){e.delete(t)},setItem(t,s){e.set(t,String(s))}}}function t0(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return e0()}const s0=`
|
|
38
|
+
addEventListener("message", (e) => {
|
|
39
|
+
if (e.data.event === "start") {
|
|
40
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
41
|
+
}
|
|
42
|
+
});`;class n0{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(t,s){var n;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 Cg,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...a)=>i(...a):(...a)=>fetch(...a),!(!((n=s==null?void 0:s.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=s.params.apikey;const r=this._initializeOptions(s);this.socketAdapter=new Yg(t,r),this.httpEndpoint=Eu(t),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(t){const s=t.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(t,s){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,s)}getChannels(){return this.channels}async removeChannel(t){const s=await t.unsubscribe();return s==="ok"&&t.teardown(),s}async removeAllChannels(){const t=this.channels.map(async n=>{const r=await n.unsubscribe();return n.teardown(),r}),s=await Promise.all(t);return await this.disconnect(),s}log(t,s,n){this.socketAdapter.log(t,s,n)}connectionState(){return this.socketAdapter.connectionState()||Qi.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,s={config:{}}){const n=`realtime:${t}`,r=this.getChannels().find(i=>i.topic===n);if(r)return r;{const i=new Ln(`realtime:${t}`,s,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(s=>s.topic!==t.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(t=null){let s,n=!1;if(t)s=t,n=!0;else if(this.accessToken)try{s=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),s=this.accessTokenValue}else s=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=s&&(this.accessTokenValue=s,this.channels.forEach(r=>{const i={access_token:s,version:Eg};s&&r.updateJoinPayload(i),r.joinedOnce&&r.channelAdapter.isJoined()&&r.channelAdapter.push(wu.access_token,{access_token:s})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(s=>{this.log("error",`Error setting auth in ${t}`,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(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(s,n)=>{s=="sent"&&this._setAuthSafely(),t&&t(s,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),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(t){let s;if(t)s=t;else{const n=new Blob([s0],{type:"application/javascript"});s=URL.createObjectURL(n)}return s}_initializeOptions(t){var s,n,r,i,a,o,l,c,u,d,f,p;this.worker=(s=t==null?void 0:t.worker)!==null&&s!==void 0?s:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const b={};b.timeout=(r=t==null?void 0:t.timeout)!==null&&r!==void 0?r:Ag,b.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:nl.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(a=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&a!==void 0?a:2*((o=t==null?void 0:t.heartbeatIntervalMs)!==null&&o!==void 0?o:nl.HEARTBEAT_INTERVAL),b.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:wg.getWebSocketConstructor(),b.params=t==null?void 0:t.params,b.logger=t==null?void 0:t.logger,b.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),b.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:t0(),b.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:k=>Xg[k-1]||Qg;let v,T;const R=(d=t==null?void 0:t.vsn)!==null&&d!==void 0?d:Tg;switch(R){case Sg:v=(k,x)=>x(JSON.stringify(k)),T=(k,x)=>x(JSON.parse(k));break;case xu:v=this.serializer.encode.bind(this.serializer),T=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${b.vsn}`)}if(b.vsn=R,b.encode=(f=t==null?void 0:t.encode)!==null&&f!==void 0?f:v,b.decode=(p=t==null?void 0:t.decode)!==null&&p!==void 0?p:T,b.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,b.params=Object.assign(Object.assign({},b.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,b.autoSendHeartbeat=!this.worker}return b}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var zn=class extends Error{constructor(e,t){var s;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((s=t.icebergType)==null?void 0:s.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function r0(e,t,s){const n=new URL(t,e);if(s)for(const[r,i]of Object.entries(s))i!==void 0&&n.searchParams.set(r,i);return n.toString()}async function i0(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function a0(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:s,path:n,query:r,body:i,headers:a}){const o=r0(e.baseUrl,n,r),l=await i0(e.auth),c=await t(o,{method:s,headers:{...i?{"Content-Type":"application/json"}:{},...l,...a},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,b=p==null?void 0:p.error;throw new zn((b==null?void 0:b.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:b==null?void 0:b.type,icebergCode:b==null?void 0:b.code,details:p})}return{status:c.status,headers:c.headers,data:f}}}}function hr(e){return e.join("")}var o0=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:hr(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const s={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${hr(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${hr(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${hr(e.namespace)}`}),!0}catch(t){if(t instanceof zn&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(s){if(s instanceof zn&&s.status===409)return;throw s}}};function Vs(e){return e.join("")}var l0=class{constructor(e,t="",s){this.client=e,this.prefix=t,this.accessDelegation=s}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vs(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const s={};return this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Vs(e.namespace)}/tables`,body:t,headers:s})).data.metadata}async updateTable(e,t){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Vs(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Vs(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vs(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Vs(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(s){if(s instanceof zn&&s.status===404)return!1;throw s}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(s){if(s instanceof zn&&s.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw s}}},c0=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const s=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=a0({baseUrl:s,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new o0(this.client,t),this.tableOps=new l0(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function Kn(e){"@babel/helpers - typeof";return Kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kn(e)}function u0(e,t){if(Kn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(Kn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d0(e){var t=u0(e,"string");return Kn(t)=="symbol"?t:t+""}function h0(e,t,s){return(t=d0(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function rl(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function xe(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?rl(Object(s),!0).forEach(function(n){h0(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):rl(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}var oi=class extends Error{constructor(e,t="storage",s,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=s,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function li(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var na=class extends oi{constructor(e,t,s,n="storage"){super(e,n,t,s),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=s}toJSON(){return xe({},super.toJSON())}},Tu=class extends oi{constructor(e,t,s="storage"){super(e,s),this.name=s==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Lr(e,t,s){const n=xe({},e),r=t.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===r&&delete n[i];return n[r]=s,n}function f0(e){const t={};for(const[s,n]of Object.entries(e))t[s.toLowerCase()]=n;return t}const p0=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),g0=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},ra=e=>{if(Array.isArray(e))return e.map(s=>ra(s));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([s,n])=>{const r=s.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[r]=ra(n)}),t},m0=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),il=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const s=t.error;if(typeof s.message=="string")return s.message}}return JSON.stringify(e)},b0=async(e,t,s,n)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const r=e;let i=parseInt(String(r.status),10);Number.isFinite(i)||(i=500),r.json().then(a=>{const o=(a==null?void 0:a.statusCode)||(a==null?void 0:a.code)||i+"";t(new na(il(a),i,o,n))}).catch(()=>{const a=i+"";t(new na(r.statusText||`HTTP ${i} error`,i,a,n))})}else t(new Tu(il(e),e,n))},v0=(e,t,s,n)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return xe(xe({},r),s);if(g0(n)){var i;const a=(t==null?void 0:t.headers)||{};let o;for(const[l,c]of Object.entries(a))l.toLowerCase()==="content-type"&&(o=c);r.headers=Lr(a,"Content-Type",(i=o)!==null&&i!==void 0?i:"application/json"),r.body=JSON.stringify(n)}else r.body=n;return t!=null&&t.duplex&&(r.duplex=t.duplex),xe(xe({},r),s)};async function yn(e,t,s,n,r,i,a){return new Promise((o,l)=>{e(s,v0(t,n,r,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(a==="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=>o(c)).catch(c=>b0(c,l,n,a))})}function Au(e="storage"){return{get:async(t,s,n,r)=>yn(t,"GET",s,n,r,void 0,e),post:async(t,s,n,r,i)=>yn(t,"POST",s,r,i,n,e),put:async(t,s,n,r,i)=>yn(t,"PUT",s,r,i,n,e),head:async(t,s,n,r)=>yn(t,"HEAD",s,xe(xe({},n),{},{noResolveJson:!0}),r,void 0,e),remove:async(t,s,n,r,i)=>yn(t,"DELETE",s,r,i,n,e)}}const y0=Au("storage"),{get:Wn,post:Tt,put:ia,head:_0,remove:Na}=y0,pt=Au("vectors");var fn=class{constructor(e,t={},s,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=f0(t),this.fetch=p0(s),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Lr(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(li(s))return{data:null,error:s};throw s}}},x0=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(li(t))return{data:null,error:t};throw t}}};let Ru;Ru=Symbol.toStringTag;var w0=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Ru]="BlobDownloadBuilder",this.promise=null}asStream(){return new x0(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(li(t))return{data:null,error:t};throw t}}};const k0={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},al={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var E0=class extends fn{constructor(e,t={},s,n){super(e,t,n,"storage"),this.bucketId=s}async uploadOrUpdate(e,t,s,n){var r=this;return r.handleOperation(async()=>{let i;const a=xe(xe({},al),n);let o=xe(xe({},r.headers),e==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;if(typeof Blob<"u"&&s instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),l&&i.append("metadata",r.encodeMetadata(l)),i.append("",s)):typeof FormData<"u"&&s instanceof FormData?(i=s,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),l&&!i.has("metadata")&&i.append("metadata",r.encodeMetadata(l))):(i=s,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=r.toBase64(r.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))o=Lr(o,f,p);const c=r._removeEmptyFolders(t),u=r._getFinalPath(c),d=await(e=="PUT"?ia:Tt)(r.fetch,`${r.url}/object/${u}`,i,xe({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,s){return this.uploadOrUpdate("POST",e,t,s)}async uploadToSignedUrl(e,t,s,n){var r=this;const i=r._removeEmptyFolders(e),a=r._getFinalPath(i),o=new URL(r.url+`/object/upload/sign/${a}`);return o.searchParams.set("token",t),r.handleOperation(async()=>{let l;const c=xe(xe({},al),n);let u=xe(xe({},r.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",r.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",r.encodeMetadata(d))):(l=s,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,d&&(u["x-metadata"]=r.toBase64(r.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))u=Lr(u,f,p);return{path:i,fullPath:(await ia(r.fetch,o.toString(),l,xe({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var s=this;return s.handleOperation(async()=>{let n=s._getFinalPath(e);const r=xe({},s.headers);t!=null&&t.upsert&&(r["x-upsert"]="true");const i=await Tt(s.fetch,`${s.url}/object/upload/sign/${n}`,{},{headers:r}),a=new URL(s.url+i.url),o=a.searchParams.get("token");if(!o)throw new oi("No token returned by API");return{signedUrl:a.toString(),path:e,token:o}})}async update(e,t,s){return this.uploadOrUpdate("PUT",e,t,s)}async move(e,t,s){var n=this;return n.handleOperation(async()=>await Tt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers}))}async copy(e,t,s){var n=this;return n.handleOperation(async()=>({path:(await Tt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:s==null?void 0:s.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,s){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const i=typeof(s==null?void 0:s.transform)=="object"&&s.transform!==null&&Object.keys(s.transform).length>0;let a=await Tt(n.fetch,`${n.url}/object/sign/${r}`,xe({expiresIn:t},i?{transform:s.transform}:{}),{headers:n.headers});const o=new URLSearchParams;s!=null&&s.download&&o.set("download",s.download===!0?"":s.download),(s==null?void 0:s.cacheNonce)!=null&&o.set("cacheNonce",String(s.cacheNonce));const l=o.toString();return{signedUrl:encodeURI(`${n.url}${a.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,s){var n=this;return n.handleOperation(async()=>{const r=await Tt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.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 a=i.toString();return r.map(o=>xe(xe({},o),{},{signedUrl:o.signedURL?encodeURI(`${n.url}${o.signedURL}${a?`&${a}`:""}`):null}))})}download(e,t,s){const n=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",r=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const i=r.toString(),a=this._getFinalPath(e),o=()=>Wn(this.fetch,`${this.url}/${n}/${a}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},s);return new w0(o,this.shouldThrowOnError)}async info(e){var t=this;const s=t._getFinalPath(e);return t.handleOperation(async()=>ra(await Wn(t.fetch,`${t.url}/object/info/${s}`,{headers:t.headers})))}async exists(e){var t=this;const s=t._getFinalPath(e);try{return await _0(t.fetch,`${t.url}/object/${s}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(li(r)){var n;const i=r instanceof na?r.status:r instanceof Tu?(n=r.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const s=this._getFinalPath(e),n=new URLSearchParams;t!=null&&t.download&&n.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(n,t.transform),(t==null?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));const r=n.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}`)+(r?`?${r}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Na(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,s){var n=this;return n.handleOperation(async()=>{const r=xe(xe(xe({},k0),t),{},{prefix:e||""});return await Tt(n.fetch,`${n.url}/object/list/${n.bucketId}`,r,{headers:n.headers},s)})}async listV2(e,t){var s=this;return s.handleOperation(async()=>{const n=xe({},e);return await Tt(s.fetch,`${s.url}/object/list-v2/${s.bucketId}`,n,{headers:s.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const S0="2.105.4",nr={"X-Client-Info":`storage-js/${S0}`};var T0=class extends fn{constructor(e,t={},s,n){const r=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(r.hostname)&&!r.hostname.includes("storage.supabase.")&&(r.hostname=r.hostname.replace("supabase.","storage.supabase."));const i=r.href.replace(/\/$/,""),a=xe(xe({},nr),t);super(i,a,s,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=t.listBucketOptionsToQueryString(e);return await Wn(t.fetch,`${t.url}/bucket${s}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Wn(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var s=this;return s.handleOperation(async()=>await Tt(s.fetch,`${s.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async updateBucket(e,t){var s=this;return s.handleOperation(async()=>await ia(s.fetch,`${s.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:s.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Tt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Na(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},A0=class extends fn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=xe(xe({},nr),t);super(n,r,s,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Tt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const s=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&s.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&s.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&s.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&s.set("sortOrder",e.sortOrder),e!=null&&e.search&&s.set("search",e.search);const n=s.toString(),r=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await Wn(t.fetch,r,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Na(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!m0(e))throw new oi("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 c0({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(s,{get(r,i){const a=r[i];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(r,o),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},R0=class extends fn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=xe(xe({},nr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var s=this;return s.handleOperation(async()=>await pt.post(s.fetch,`${s.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var s=this;return s.handleOperation(async()=>await pt.post(s.fetch,`${s.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:s.headers})||{})}},C0=class extends fn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=xe(xe({},nr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},O0=class extends fn{constructor(e,t={},s){const n=e.replace(/\/$/,""),r=xe(xe({},nr),{},{"Content-Type":"application/json"},t);super(n,r,s,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await pt.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},$0=class extends O0{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new N0(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,s=this;return t().call(s,e)}async getBucket(e){var t=()=>super.getBucket,s=this;return t().call(s,e)}async listBuckets(e={}){var t=()=>super.listBuckets,s=this;return t().call(s,e)}async deleteBucket(e){var t=()=>super.deleteBucket,s=this;return t().call(s,e)}},N0=class extends R0{constructor(e,t,s,n){super(e,t,n),this.vectorBucketName=s}async createIndex(e){var t=()=>super.createIndex,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,s=this;return t().call(s,s.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,s=this;return t().call(s,s.vectorBucketName,e)}index(e){return new I0(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},I0=class extends C0{constructor(e,t,s,n,r){super(e,t,r),this.vectorBucketName=s,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async getVectors(e){var t=()=>super.getVectors,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,s=this;return t().call(s,xe(xe({},e),{},{vectorBucketName:s.vectorBucketName,indexName:s.indexName}))}},P0=class extends T0{constructor(e,t={},s,n){super(e,t,s,n)}from(e){return new E0(this.url,this.headers,e,this.fetch)}get vectors(){return new $0(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new A0(this.url+"/iceberg",this.headers,this.fetch)}};const Cu="2.105.4",Xs=30*1e3,aa=3,Ai=aa*Xs,L0="http://localhost:9999",M0="supabase.auth.token",j0={"X-Client-Info":`gotrue-js/${Cu}`},oa="X-Supabase-Api-Version",Ou={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},D0=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,U0=10*60*1e3;class Gn extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function le(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class B0 extends Gn{constructor(t,s,n){super(t,s,n),this.name="AuthApiError",this.status=s,this.code=n}}function H0(e){return le(e)&&e.name==="AuthApiError"}class Rt extends Gn{constructor(t,s){super(t),this.name="AuthUnknownError",this.originalError=s}}class us extends Gn{constructor(t,s,n,r){super(t,n,r),this.name=s,this.status=n}}class Qe extends us{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function fr(e){return le(e)&&e.name==="AuthSessionMissingError"}class qs extends us{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class pr extends us{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class gr extends us{constructor(t,s=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function F0(e){return le(e)&&e.name==="AuthImplicitGrantRedirectError"}class ol extends us{constructor(t,s=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class V0 extends us{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 la extends us{constructor(t,s){super(t,"AuthRetryableFetchError",s,void 0)}}function Ri(e){return le(e)&&e.name==="AuthRetryableFetchError"}class ll extends us{constructor(t,s,n){super(t,"AuthWeakPasswordError",s,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class ca extends us{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),cl=`
|
|
56
|
+
\r=`.split(""),q0=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<cl.length;t+=1)e[cl[t].charCodeAt(0)]=-2;for(let t=0;t<Mr.length;t+=1)e[Mr[t].charCodeAt(0)]=t;return e})();function ul(e,t,s){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(Mr[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;s(Mr[n]),t.queuedBits-=6}}function $u(e,t,s){const n=q0[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)s(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function dl(e){const t=[],s=a=>{t.push(String.fromCodePoint(a))},n={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},i=a=>{W0(a,n,s)};for(let a=0;a<e.length;a+=1)$u(e.charCodeAt(a),r,i);return t.join("")}function z0(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function K0(e,t){for(let s=0;s<e.length;s+=1){let n=e.charCodeAt(s);if(n>55295&&n<=56319){const r=(n-55296)*1024&65535;n=(e.charCodeAt(s+1)-56320&65535|r)+65536,s+=1}z0(n,t)}}function W0(e,t,s){if(t.utf8seq===0){if(e<=127){s(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&s(t.codepoint)}}function an(e){const t=[],s={queue:0,queuedBits:0},n=r=>{t.push(r)};for(let r=0;r<e.length;r+=1)$u(e.charCodeAt(r),s,n);return new Uint8Array(t)}function G0(e){const t=[];return K0(e,s=>t.push(s)),new Uint8Array(t)}function Is(e){const t=[],s={queue:0,queuedBits:0},n=r=>{t.push(r)};return e.forEach(r=>ul(r,s,n)),ul(null,s,n),t.join("")}function Z0(e){return Math.round(Date.now()/1e3)+e}function J0(){return Symbol("auth-callback")}const tt=()=>typeof window<"u"&&typeof document<"u",Ts={tested:!1,writable:!1},Nu=()=>{if(!tt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ts.tested)return Ts.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),Ts.tested=!0,Ts.writable=!0}catch{Ts.tested=!0,Ts.writable=!1}return Ts.writable};function Y0(e){const t={},s=new URL(e);if(s.hash&&s.hash[0]==="#")try{new URLSearchParams(s.hash.substring(1)).forEach((r,i)=>{t[i]=r})}catch{}return s.searchParams.forEach((n,r)=>{t[r]=n}),t}const Iu=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),X0=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Qs=async(e,t,s)=>{await e.setItem(t,JSON.stringify(s))},As=async(e,t)=>{const s=await e.getItem(t);if(!s)return null;try{return JSON.parse(s)}catch{return null}},et=async(e,t)=>{await e.removeItem(t)};class ci{constructor(){this.promise=new ci.promiseConstructor((t,s)=>{this.resolve=t,this.reject=s})}}ci.promiseConstructor=Promise;function mr(e){const t=e.split(".");if(t.length!==3)throw new ca("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!D0.test(t[n]))throw new ca("JWT not in base64url format");return{header:JSON.parse(dl(t[0])),payload:JSON.parse(dl(t[1])),signature:an(t[2]),raw:{header:t[0],payload:t[1]}}}async function Q0(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function em(e,t){return new Promise((n,r)=>{(async()=>{for(let i=0;i<1/0;i++)try{const a=await e(i);if(!t(i,null,a)){n(a);return}}catch(a){if(!t(i,a)){r(a);return}}})()})}function tm(e){return("0"+e.toString(16)).substr(-2)}function sm(){const t=new Uint32Array(56);if(typeof crypto>"u"){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=s.length;let r="";for(let i=0;i<56;i++)r+=s.charAt(Math.floor(Math.random()*n));return r}return crypto.getRandomValues(t),Array.from(t,tm).join("")}async function nm(e){const s=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",s),r=new Uint8Array(n);return Array.from(r).map(i=>String.fromCharCode(i)).join("")}async function rm(e){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."),e;const s=await nm(e);return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function zs(e,t,s=!1){const n=sm();let r=n;s&&(r+="/recovery"),await Qs(e,`${t}-code-verifier`,r);const i=await rm(n);return[i,n===i?"plain":"s256"]}const im=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function am(e){const t=e.headers.get(oa);if(!t||!t.match(im))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function om(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function lm(e){switch(e){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 cm=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Jt(e){if(!cm.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function St(e){if(!e.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 Ci(){const e={};return new Proxy(e,{get:(t,s)=>{if(s==="__isUserNotAvailableProxy")return!0;if(typeof s=="symbol"){const n=s.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="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:(t,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:(t,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 um(e,t){return new Proxy(e,{get:(s,n,r)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.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,n,r)}return!t.value&&typeof n=="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."),t.value=!0),Reflect.get(s,n,r)}})}function hl(e){return JSON.parse(JSON.stringify(e))}const Cs=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},dm=[502,503,504,520,521,522,523,524,530];async function fl(e){var t;if(!X0(e))throw new la(Cs(e),0);if(dm.includes(e.status))throw new la(Cs(e),e.status);let s;try{s=await e.json()}catch(i){throw new Rt(Cs(i),i)}let n;const r=am(e);if(r&&r.getTime()>=Ou["2024-01-01"].timestamp&&typeof s=="object"&&s&&typeof s.code=="string"?n=s.code:typeof s=="object"&&s&&typeof s.error_code=="string"&&(n=s.error_code),n){if(n==="weak_password")throw new ll(Cs(s),e.status,((t=s.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Qe}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,a)=>i&&typeof a=="string",!0))throw new ll(Cs(s),e.status,s.weak_password.reasons);throw new B0(Cs(s),e.status||500,n)}const hm=(e,t,s,n)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),r.body=JSON.stringify(n),Object.assign(Object.assign({},r),s))};async function he(e,t,s,n){var r;const i=Object.assign({},n==null?void 0:n.headers);i[oa]||(i[oa]=Ou["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const a=(r=n==null?void 0:n.query)!==null&&r!==void 0?r:{};n!=null&&n.redirectTo&&(a.redirect_to=n.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await fm(e,t,s+o,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function fm(e,t,s,n,r,i){const a=hm(t,n,r,i);let o;try{o=await e(s,Object.assign({},a))}catch(l){throw console.error(l),new la(Cs(l),0)}if(o.ok||await fl(o),n!=null&&n.noResolveJson)return o;try{return await o.json()}catch(l){await fl(l)}}function wt(e){var t;let s=null;mm(e)&&(s=Object.assign({},e),e.expires_at||(s.expires_at=Z0(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:s,user:n},error:null}}function pl(e){const t=wt(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((s,n)=>s&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function vs(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function pm(e){return{data:e,error:null}}function gm(e){const{action_link:t,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i}=e,a=ai(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:s,hashed_token:n,redirect_to:r,verification_type:i},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function gl(e){return e}function mm(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Oi=["global","local","others"];class bm{constructor({url:t="",headers:s={},fetch:n,experimental:r}){this.url=t,this.headers=s,this.fetch=Iu(n),this.experimental=r??{},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(t,s=Oi[0]){if(Oi.indexOf(s)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Oi.join(", ")}`);try{return await he(this.fetch,"POST",`${this.url}/logout?scope=${s}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(le(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,s={}){try{return await he(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:s.data},headers:this.headers,redirectTo:s.redirectTo,xform:vs})}catch(n){if(le(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:s}=t,n=ai(t,["options"]),r=Object.assign(Object.assign({},n),s);return"newEmail"in n&&(r.new_email=n==null?void 0:n.newEmail,delete r.newEmail),await he(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:gm,redirectTo:s==null?void 0:s.redirectTo})}catch(s){if(le(s))return{data:{properties:null,user:null},error:s};throw s}}async createUser(t){try{return await he(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:vs})}catch(s){if(le(s))return{data:{user:null},error:s};throw s}}async listUsers(t){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await he(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:gl});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(b=>{const v=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(b.split(";")[1].split("=")[1]);c[`${T}Page`]=v}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(le(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){Jt(t);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:vs})}catch(s){if(le(s))return{data:{user:null},error:s};throw s}}async updateUserById(t,s){Jt(t);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:s,headers:this.headers,xform:vs})}catch(n){if(le(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,s=!1){Jt(t);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:s},xform:vs})}catch(n){if(le(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){Jt(t.userId);try{const{data:s,error:n}=await he(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:s,error:n}}catch(s){if(le(s))return{data:null,error:s};throw s}}async _deleteFactor(t){Jt(t.userId),Jt(t.id);try{return{data:await he(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(s){if(le(s))return{data:null,error:s};throw s}}async _listOAuthClients(t){var s,n,r,i,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await he(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(s=t==null?void 0:t.page)===null||s===void 0?void 0:s.toString())!==null&&n!==void 0?n:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:gl});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(b=>{const v=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(b.split(";")[1].split("=")[1]);c[`${T}Page`]=v}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(le(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(le(s))return{data:null,error:s};throw s}}async _getOAuthClient(t){try{return await he(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(le(s))return{data:null,error:s};throw s}}async _updateOAuthClient(t,s){try{return await he(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(le(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await he(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(le(s))return{data:null,error:s};throw s}}async _regenerateOAuthClientSecret(t){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(le(s))return{data:null,error:s};throw s}}async _listCustomProviders(t){try{const s={};return t!=null&&t.type&&(s.type=t.type),await he(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:s,xform:n=>{var r;return{data:{providers:(r=n==null?void 0:n.providers)!==null&&r!==void 0?r:[]},error:null}}})}catch(s){if(le(s))return{data:{providers:[]},error:s};throw s}}async _createCustomProvider(t){try{return await he(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(le(s))return{data:null,error:s};throw s}}async _getCustomProvider(t){try{return await he(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(le(s))return{data:null,error:s};throw s}}async _updateCustomProvider(t,s){try{return await he(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:s,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(le(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await he(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(le(s))return{data:null,error:s};throw s}}async _adminListPasskeys(t){St(this.experimental),Jt(t.userId);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(le(s))return{data:null,error:s};throw s}}async _adminDeletePasskey(t){St(this.experimental),Jt(t.userId),Jt(t.passkeyId);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(s){if(le(s))return{data:null,error:s};throw s}}}function ml(e={}){return{getItem:t=>e[t]||null,setItem:(t,s)=>{e[t]=s},removeItem:t=>{delete e[t]}}}const Lt={debug:!!(globalThis&&Nu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Pu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class bl extends Pu{}async function vm(e,t,s){Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;let r;t>0&&(r=setTimeout(()=>{n.abort(),Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(r),Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await s()}finally{Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new bl(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Lt.debug)try{const a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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(r),await s()}})}catch(i){if(t>0&&clearTimeout(r),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(n.signal.aborted)return Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}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(e,{mode:"exclusive",steal:!0},async a=>{if(a){Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,a.name);try{return await s()}finally{Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,a.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await s()}));throw Lt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new bl(`Lock "${e}" was released because another request stole it`)}throw i}}function ym(){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 Lu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function _m(e){return parseInt(e,16)}function xm(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function wm(e){var t;const{chainId:s,domain:n,expirationTime:r,issuedAt:i=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:f}=e;{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(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);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(!((t=e.statement)===null||t===void 0)&&t.includes(`
|
|
57
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=Lu(e.address),b=u?`${u}://${n}`:n,v=e.statement?`${e.statement}
|
|
58
|
+
`:"",T=`${b} wants you to sign in with your Ethereum account:
|
|
59
|
+
${p}
|
|
60
|
+
|
|
61
|
+
${v}`;let R=`URI: ${d}
|
|
62
|
+
Version: ${f}
|
|
63
|
+
Chain ID: ${s}${a?`
|
|
64
|
+
Nonce: ${a}`:""}
|
|
65
|
+
Issued At: ${i.toISOString()}`;if(r&&(R+=`
|
|
66
|
+
Expiration Time: ${r.toISOString()}`),o&&(R+=`
|
|
67
|
+
Not Before: ${o.toISOString()}`),l&&(R+=`
|
|
68
|
+
Request ID: ${l}`),c){let k=`
|
|
69
|
+
Resources:`;for(const x of c){if(!x||typeof x!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${x}`);k+=`
|
|
70
|
+
- ${x}`}R+=k}return`${T}
|
|
71
|
+
${R}`}class We extends Error{constructor({message:t,code:s,cause:n,name:r}){var i;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=r??(n instanceof Error?n.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 jr extends We{constructor(t,s){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s,message:t}),this.name="WebAuthnUnknownError",this.originalError=s}}function km({error:e,options:t}){var s,n,r;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new We({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.requireResidentKey)===!0)return new We({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new We({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new We({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new We({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new We({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new We({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new We({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(Mu(a)){if(i.rp.id!==a)return new We({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new We({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new We({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new We({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new We({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Em({error:e,options:t}){const{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new We({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new We({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(Mu(n)){if(s.rpId!==n)return new We({message:`The RP ID "${s.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new We({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new We({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new We({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Sm{createNewAbortSignal(){if(this.controller){const s=new Error("Cancelling existing WebAuthn API call for new one");s.name="AbortError",this.controller.abort(s)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const ua=new Sm;function vl(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:s,excludeCredentials:n}=e,r=ai(e,["challenge","user","excludeCredentials"]),i=an(t).buffer,a=Object.assign(Object.assign({},s),{id:an(s.id).buffer}),o=Object.assign(Object.assign({},r),{challenge:i,user:a});if(n&&n.length>0){o.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:an(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function yl(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:s}=e,n=ai(e,["challenge","allowCredentials"]),r=an(t).buffer,i=Object.assign(Object.assign({},n),{challenge:r});if(s&&s.length>0){i.allowCredentials=new Array(s.length);for(let a=0;a<s.length;a++){const o=s[a];i.allowCredentials[a]=Object.assign(Object.assign({},o),{id:an(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return i}function _l(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e;return{id:e.id,rawId:e.id,response:{attestationObject:Is(new Uint8Array(e.response.attestationObject)),clientDataJSON:Is(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function xl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const s=e,n=e.getClientExtensionResults(),r=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Is(new Uint8Array(r.authenticatorData)),clientDataJSON:Is(new Uint8Array(r.clientDataJSON)),signature:Is(new Uint8Array(r.signature)),userHandle:r.userHandle?Is(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=s.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Mu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Dr(){var e,t;return!!(tt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function ju(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new jr("Browser returned unexpected credential type",t)}:{data:null,error:new jr("Empty credential response",t)}}catch(t){return{data:null,error:km({error:t,options:e})}}}async function Du(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new jr("Browser returned unexpected credential type",t)}:{data:null,error:new jr("Empty credential response",t)}}catch(t){return{data:null,error:Em({error:t,options:e})}}}const Tm={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Am={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ur(...e){const t=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),s=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),n={};for(const r of e)if(r)for(const i in r){const a=r[i];if(a!==void 0)if(Array.isArray(a))n[i]=a;else if(s(a))n[i]=a;else if(t(a)){const o=n[i];t(o)?n[i]=Ur(o,a):n[i]=Ur(a)}else n[i]=a}return n}function Rm(e,t){return Ur(Tm,e,t||{})}function Cm(e,t){return Ur(Am,e,t||{})}class Om{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:s,friendlyName:n,signal:r},i){var a;try{const{data:o,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:s});if(!o)return{data:null,error:l};const c=r??ua.createNewAbortSignal();if(o.webauthn.type==="create"){const{user:u}=o.webauthn.credential_options.publicKey;if(!u.name){const d=n;if(d)u.name=`${u.id}:${d}`;else{const p=(await this.client.getUser()).data.user,b=((a=p==null?void 0:p.user_metadata)===null||a===void 0?void 0:a.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";u.name=`${u.id}:${b}`}}u.displayName||(u.displayName=u.name)}switch(o.webauthn.type){case"create":{const u=Rm(o.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:f}=await ju({publicKey:u,signal:c});return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}case"request":{const u=Cm(o.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:f}=await Du(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:t,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:d}},error:null}:{data:null,error:f}}}}catch(o){return le(o)?{data:null,error:o}:{data:null,error:new Rt("Unexpected error in challenge",o)}}}async _verify({challengeId:t,factorId:s,webauthn:n}){return this.client.mfa.verify({factorId:s,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Gn("rpId is required for WebAuthn authentication")};try{if(!Dr())return{data:null,error:new Rt("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:t,webauthn:{rpId:s,rpOrigins:n},signal:r},{request:i});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:t,challengeId:a.challengeId,webauthn:{type:l.type,rpId:s,rpOrigins:n,credential_response:l.credential_response}})}catch(a){return le(a)?{data:null,error:a}:{data:null,error:new Rt("Unexpected error in authenticate",a)}}}async _register({friendlyName:t,webauthn:{rpId:s=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!s)return{data:null,error:new Gn("rpId is required for WebAuthn registration")};try{if(!Dr())return{data:null,error:new Rt("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:t});if(!a)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===t&&f.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:s,rpOrigins:n},signal:r},{create:i});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:s,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return le(a)?{data:null,error:a}:{data:null,error:new Rt("Unexpected error in register",a)}}}}ym();const $m={url:L0,storageKey:M0,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:j0,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function wl(e,t,s){return await s()}const Ks={};class Zn{get jwks(){var t,s;return(s=(t=Ks[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&s!==void 0?s:{keys:[]}}set jwks(t){Ks[this.storageKey]=Object.assign(Object.assign({},Ks[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,s;return(s=(t=Ks[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&s!==void 0?s:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Ks[this.storageKey]=Object.assign(Object.assign({},Ks[this.storageKey]),{cachedAt:t})}constructor(t){var s,n,r,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 a=Object.assign(Object.assign({},$m),t);if(this.storageKey=a.storageKey,this.instanceID=(s=Zn.nextInstanceID[this.storageKey])!==null&&s!==void 0?s:0,Zn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.instanceID>0&&tt()){const o=`${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(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=a.persistSession,this.autoRefreshToken=a.autoRefreshToken,this.experimental=(n=a.experimental)!==null&&n!==void 0?n:{},this.admin=new bm({url:a.url,headers:a.headers,fetch:a.fetch,experimental:this.experimental}),this.url=a.url,this.headers=a.headers,this.fetch=Iu(a.fetch),this.lock=a.lock||wl,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,this.throwOnError=a.throwOnError,this.lockAcquireTimeout=a.lockAcquireTimeout,a.lock?this.lock=a.lock:this.persistSession&&tt()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=vm:this.lock=wl,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 Om(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?(a.storage?this.storage=a.storage:Nu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=ml(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=ml(this.memoryStorage)),tt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o);try{await this._notifyAllSubscribers(o.data.event,o.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}a.skipAutoInitialize||this.initialize().catch(o=>{this._debug("#initialize()","error",o)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Cu}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),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 t;try{let s={},n="none";if(tt()&&(s=Y0(window.location.href),this._isImplicitGrantCallback(s)?n="implicit":await this._isPKCECallback(s)&&(n="pkce")),tt()&&this.detectSessionInUrl&&n!=="none"){const{data:r,error:i}=await this._getSessionFromURL(s,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),F0(i)){const l=(t=i.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:a,redirectType:o}=r;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(s){return le(s)?this._returnResult({error:s}):this._returnResult({error:new Rt("Unexpected error during initialization",s)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var s,n,r;try{const i=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}},xform:wt}),{data:a,error:o}=i;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(le(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var s,n,r;try{let i;if("email"in t){const{email:u,password:d,options:f}=t;let p=null,b=null;this.flowType==="pkce"&&([p,b]=await zs(this.storage,this.storageKey)),i=await he(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:b},xform:wt})}else if("phone"in t){const{phone:u,password:d,options:f}=t;i=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(r=f==null?void 0:f.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:wt})}else throw new pr("You must provide either an email or phone number and a password");const{data:a,error:o}=i;if(o||!a)return await et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let s;if("email"in t){const{email:i,password:a,options:o}=t;s=await he(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:pl})}else if("phone"in t){const{phone:i,password:a,options:o}=t;s=await he(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:pl})}else throw new pr("You must provide either an email or phone number and a password");const{data:n,error:r}=s;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!n||!n.session||!n.user){const i=new qs;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:r})}catch(s){if(le(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOAuth(t){var s,n,r,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(r=t.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:s}=t;switch(s){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${s}"`)}}async signInWithEthereum(t){var s,n,r,i,a,o,l,c,u,d,f;let p,b;if("message"in t)p=t.message,b=t.signature;else{const{chain:v,wallet:T,statement:R,options:k}=t;let x;if(tt())if(typeof T=="object")x=T;else{const D=window;if("ethereum"in D&&typeof D.ethereum=="object"&&"request"in D.ethereum&&typeof D.ethereum.request=="function")x=D.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 T!="object"||!(k!=null&&k.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=T}const E=new URL((s=k==null?void 0:k.url)!==null&&s!==void 0?s:window.location.href),A=await x.request({method:"eth_requestAccounts"}).then(D=>D).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!A||A.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const N=Lu(A[0]);let O=(n=k==null?void 0:k.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!O){const D=await x.request({method:"eth_chainId"});O=_m(D)}const L={domain:E.host,address:N,statement:R,uri:E.href,version:"1",chainId:O,nonce:(r=k==null?void 0:k.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(a=(i=k==null?void 0:k.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=k==null?void 0:k.signInWithEthereum)===null||o===void 0?void 0:o.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=wm(L),b=await x.request({method:"personal_sign",params:[xm(p),N]})}try{const{data:v,error:T}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:b},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:wt});if(T)throw T;if(!v||!v.session||!v.user){const R=new qs;return this._returnResult({data:{user:null,session:null},error:R})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:T})}catch(v){if(le(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}async signInWithSolana(t){var s,n,r,i,a,o,l,c,u,d,f,p;let b,v;if("message"in t)b=t.message,v=t.signature;else{const{chain:T,wallet:R,statement:k,options:x}=t;let E;if(tt())if(typeof R=="object")E=R;else{const N=window;if("solana"in N&&typeof N.solana=="object"&&("signIn"in N.solana&&typeof N.solana.signIn=="function"||"signMessage"in N.solana&&typeof N.solana.signMessage=="function"))E=N.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 R!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");E=R}const A=new URL((s=x==null?void 0:x.url)!==null&&s!==void 0?s:window.location.href);if("signIn"in E&&E.signIn){const N=await E.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},x==null?void 0:x.signInWithSolana),{version:"1",domain:A.host,uri:A.href}),k?{statement:k}:null));let O;if(Array.isArray(N)&&N[0]&&typeof N[0]=="object")O=N[0];else if(N&&typeof N=="object"&&"signedMessage"in N&&"signature"in N)O=N;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in O&&"signature"in O&&(typeof O.signedMessage=="string"||O.signedMessage instanceof Uint8Array)&&O.signature instanceof Uint8Array)b=typeof O.signedMessage=="string"?O.signedMessage:new TextDecoder().decode(O.signedMessage),v=O.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in E)||typeof E.signMessage!="function"||!("publicKey"in E)||typeof E!="object"||!E.publicKey||!("toBase58"in E.publicKey)||typeof E.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${A.host} wants you to sign in with your Solana account:`,E.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${A.href}`,`Issued At: ${(r=(n=x==null?void 0:x.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&r!==void 0?r:new Date().toISOString()}`,...!((i=x==null?void 0:x.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${x.signInWithSolana.notBefore}`]:[],...!((a=x==null?void 0:x.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${x.signInWithSolana.expirationTime}`]:[],...!((o=x==null?void 0:x.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${x.signInWithSolana.chainId}`]:[],...!((l=x==null?void 0:x.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${x.signInWithSolana.nonce}`]:[],...!((c=x==null?void 0:x.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${x.signInWithSolana.requestId}`]:[],...!((d=(u=x==null?void 0:x.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...x.signInWithSolana.resources.map(O=>`- ${O}`)]:[]].join(`
|
|
72
|
+
`);const N=await E.signMessage(new TextEncoder().encode(b),"utf8");if(!N||!(N instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");v=N}}try{const{data:T,error:R}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:Is(v)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:wt});if(R)throw R;if(!T||!T.session||!T.user){const k=new qs;return this._returnResult({data:{user:null,session:null},error:k})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:R})}catch(T){if(le(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async _exchangeCodeForSession(t){const s=await As(this.storage,`${this.storageKey}-code-verifier`),[n,r]=(s??"").split("/");try{if(!n&&this.flowType==="pkce")throw new V0;const{data:i,error:a}=await he(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:wt});if(await et(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!i||!i.session||!i.user){const o=new qs;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(r==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:r??null}),error:a})}catch(i){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:s,provider:n,token:r,access_token:i,nonce:a}=t,o=await he(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:r,access_token:i,nonce:a,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},xform:wt}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new qs;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(le(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithOtp(t){var s,n,r,i,a;try{if("email"in t){const{email:o,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await zs(this.storage,this.storageKey));const{error:d}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!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 t){const{phone:o,options:l}=t,{data:c,error:u}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},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:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new pr("You must provide either an email or phone number.")}catch(o){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(t){var s,n;try{let r,i;"options"in t&&(r=(s=t.options)===null||s===void 0?void 0:s.redirectTo,i=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:a,error:o}=await he(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:wt});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(r){if(le(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(t){var s,n,r,i,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await zs(this.storage,this.storageKey));const c=await he(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(s=t.options)===null||s===void 0?void 0:s.redirectTo)!==null&&n!==void 0?n:void 0}),!((r=t==null?void 0:t.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:pm});return!((i=c.data)===null||i===void 0)&&i.url&&tt()&&!(!((a=t.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)throw n;if(!s)throw new Qe;const{error:r}=await he(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:s.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(t){if(le(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const s=`${this.url}/resend`;if("email"in t){const{email:n,type:r,options:i}=t,{error:a}=await he(this.fetch,"POST",s,{headers:this.headers,body:{email:n,type:r,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:a})}else if("phone"in t){const{phone:n,type:r,options:i}=t,{data:a,error:o}=await he(this.fetch,"POST",s,{headers:this.headers,body:{phone:n,type:r,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new pr("You must provide either an email or phone number and a type")}catch(s){if(le(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(t,s){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await n,await s()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=s();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const s=await this.__loadSession();return await t(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 t=null;const s=await As(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",s),s!==null&&(this._isValidSession(s)?t=s:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<Ai:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const a=await As(this.userStorage,this.storageKey+"-user");a!=null&&a.user?t.user=a.user:t.user=Ci()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};t.user=um(t.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:r,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:r},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const s=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return s.data.user&&(this.suppressGetSessionWarning=!0),s}async _getUser(t){try{return t?await he(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:vs}):await this._useSession(async s=>{var n,r,i;const{data:a,error:o}=s;if(o)throw o;return!(!((n=a.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Qe}:await he(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=a.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:vs})})}catch(s){if(le(s))return fr(s)&&(await this._removeSession(),await et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:s});throw s}}async updateUser(t,s={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,s))}async _updateUser(t,s={}){try{return await this._useSession(async n=>{const{data:r,error:i}=n;if(i)throw i;if(!r.session)throw new Qe;const a=r.session;let o=null,l=null;this.flowType==="pkce"&&t.email!=null&&([o,l]=await zs(this.storage,this.storageKey));const{data:c,error:u}=await he(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:s==null?void 0:s.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:vs});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(n){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Qe;const s=Date.now()/1e3;let n=s,r=!0,i=null;const{payload:a}=mr(t.access_token);if(a.exp&&(n=a.exp,r=n<=s),r){const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};i=o}else{const{data:o,error:l}=await this._getUser(t.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:n-s,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(s){if(le(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async s=>{var n;if(!t){const{data:a,error:o}=s;if(o)throw o;t=(n=a.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new Qe;const{data:r,error:i}=await this._callRefreshToken(t.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(s){if(le(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async _getSessionFromURL(t,s){var n;try{if(!tt())throw new gr("No browser detected.");if(t.error||t.error_description||t.error_code)throw new gr(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(s){case"implicit":if(this.flowType==="pkce")throw new ol("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new gr("Not a valid implicit grant flow url.");break;default:}if(s==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new ol("No code detected.");const{data:x,error:E}=await this._exchangeCodeForSession(t.code);if(E)throw E;const A=new URL(window.location.href);return A.searchParams.delete("code"),window.history.replaceState(window.history.state,"",A.toString()),{data:{session:x.session,redirectType:(n=x.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:a,refresh_token:o,expires_in:l,expires_at:c,token_type:u}=t;if(!a||!l||!o||!u)throw new gr("No session defined in URL");const d=Math.round(Date.now()/1e3),f=parseInt(l);let p=d+f;c&&(p=parseInt(c));const b=p-d;b*1e3<=Xs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${f}s`);const v=p-f;d-v>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",v,p,d):d-v<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",v,p,d);const{data:T,error:R}=await this._getUser(a);if(R)throw R;const k={provider_token:r,provider_refresh_token:i,access_token:a,expires_in:f,expires_at:p,refresh_token:o,token_type:u,user:T.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:k,redirectType:t.type},error:null})}catch(r){if(le(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const s=await As(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&s)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i&&!fr(i))return this._returnResult({error:i});const a=(n=r.session)===null||n===void 0?void 0:n.access_token;if(a){const{error:o}=await this.admin.signOut(a,t);if(o&&!(H0(o)&&(o.status===404||o.status===401||o.status===403)||fr(o)))return this._returnResult({error:o})}return t!=="others"&&(await this._removeSession(),await et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const s=J0(),n={id:s,callback:t,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,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(s)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async s=>{var n,r;try{const{data:{session:i},error:a}=s;if(a)throw a;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),fr(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,s={}){let n=null,r=null;this.flowType==="pkce"&&([n,r]=await zs(this.storage,this.storageKey,!0));try{return await he(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:r,gotrue_meta_security:{captcha_token:s.captchaToken}},headers:this.headers,redirectTo:s.redirectTo})}catch(i){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:s,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=s.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var s;try{const{data:n,error:r}=await this._useSession(async i=>{var a,o,l,c,u;const{data:d,error:f}=i;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(a=t.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await he(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(r)throw r;return tt()&&!(!((s=t.options)===null||s===void 0)&&s.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(le(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async s=>{var n;try{const{error:r,data:{session:i}}=s;if(r)throw r;const{options:a,provider:o,token:l,access_token:c,nonce:u}=t,d=await he(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:wt}),{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 qs}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(r){if(await et(this.storage,`${this.storageKey}-code-verifier`),le(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(t){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)throw a;return await he(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(r=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&r!==void 0?r:void 0})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async _refreshAccessToken(t){const s=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{const n=Date.now();return await em(async r=>(r>0&&await Q0(200*Math.pow(2,r-1)),this._debug(s,"refreshing attempt",r),await he(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:wt})),(r,i)=>{const a=200*Math.pow(2,r);return i&&Ri(i)&&Date.now()+a-n<Xs})}catch(n){if(this._debug(s,"error",n),le(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(s,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,s){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:s.redirectTo,scopes:s.scopes,queryParams:s.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",s,"url",n),tt()&&!s.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,s;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const r=await As(this.storage,this.storageKey);if(r&&this.userStorage){let a=await As(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:r.user},await Qs(this.userStorage,this.storageKey+"-user",a)),r.user=(t=a==null?void 0:a.user)!==null&&t!==void 0?t:Ci()}else if(r&&!r.user&&!r.user){const a=await As(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(r.user=a.user,await et(this.storage,this.storageKey+"-user"),await Qs(this.storage,this.storageKey,r)):r.user=Ci()}if(this._debug(n,"session from storage",r),!this._isValidSession(r)){this._debug(n,"session is not valid"),r!==null&&await this._removeSession();return}const i=((s=r.expires_at)!==null&&s!==void 0?s:1/0)*1e3-Date.now()<Ai;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ai}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:a}=await this._callRefreshToken(r.refresh_token);a&&(console.error(a),Ri(a)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(r.access_token);!o&&(a!=null&&a.user)?(r.user=a.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(n,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(n,"error",r),console.error(r);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var s,n;if(!t)throw new Qe;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new ci;const{data:i,error:a}=await this._refreshAccessToken(t);if(a)throw a;if(!i.session)throw new Qe;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const o={data:i.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(i){if(this._debug(r,"error",i),le(i)){const a={data:null,error:i};return Ri(i)||await this._removeSession(),(s=this.refreshingDeferred)===null||s===void 0||s.resolve(a),a}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(t,s,n=!0){const r=`#_notifyAllSubscribers(${t})`;this._debug(r,"begin",s,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:s});const i=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,s)}catch(l){i.push(l)}});if(await Promise.all(a),i.length>0){for(let o=0;o<i.length;o+=1)console.error(i[o]);throw i[0]}}finally{this._debug(r,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await et(this.storage,`${this.storageKey}-code-verifier`);const s=Object.assign({},t),n=s.user&&s.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&s.user&&await Qs(this.userStorage,this.storageKey+"-user",{user:s.user});const r=Object.assign({},s);delete r.user;const i=hl(r);await Qs(this.storage,this.storageKey,i)}else{const r=hl(s);await Qs(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await et(this.storage,this.storageKey),await et(this.storage,this.storageKey+"-code-verifier"),await et(this.storage,this.storageKey+"-user"),this.userStorage&&await et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&tt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(s){console.error("removing visibilitychange callback failed",s)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Xs);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);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 t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);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 t=Date.now();try{return await this._useSession(async s=>{const{data:{session:n}}=s;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((n.expires_at*1e3-t)/Xs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${Xs}ms, refresh threshold is ${aa} ticks`),r<=aa&&await this._callRefreshToken(n.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(t){if(t instanceof Pu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!tt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const s=`#_onVisibilityChanged(${t})`;this._debug(s,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(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(t,s,n){const r=[`provider=${encodeURIComponent(s)}`];if(n!=null&&n.redirectTo&&r.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&r.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,a]=await zs(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(a)}`});r.push(o.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);r.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&r.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;return i?this._returnResult({data:null,error:i}):await he(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async _enroll(t){try{return await this._useSession(async s=>{var n,r;const{data:i,error:a}=s;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await he(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(t.factorType==="totp"&&l.type==="totp"&&(!((r=l==null?void 0:l.totp)===null||r===void 0)&&r.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(le(s))return this._returnResult({data:null,error:s});throw s}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?_l(t.webauthn.credential_response):xl(t.webauthn.credential_response)})}:{code:t.code}),{data:o,error:l}=await he(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:a,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async s=>{var n;const{data:r,error:i}=s;if(i)return this._returnResult({data:null,error:i});const a=await he(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=r==null?void 0:r.session)===null||n===void 0?void 0:n.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:vl(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:yl(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}})}async _challengeAndVerify(t){const{data:s,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:s.id,code:t.code})}async _listFactors(){var t;const{data:{user:s},error:n}=await this.getUser();if(n)return{data:null,error:n};const r={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=s==null?void 0:s.factors)!==null&&t!==void 0?t:[])r.all.push(i),i.status==="verified"&&r[i.factor_type].push(i);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(t){var s,n,r,i;if(t)try{const{payload:p}=mr(t);let b=null;p.aal&&(b=p.aal);let v=b;const{data:{user:T},error:R}=await this.getUser(t);if(R)return this._returnResult({data:null,error:R});((n=(s=T==null?void 0:T.factors)===null||s===void 0?void 0:s.filter(E=>E.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(v="aal2");const x=p.amr||[];return{data:{currentLevel:b,nextLevel:v,currentAuthenticationMethods:x},error:null}}catch(p){if(le(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:a},error:o}=await this.getSession();if(o)return this._returnResult({data:null,error:o});if(!a)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=mr(a.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(r=a.user.factors)===null||r===void 0?void 0:r.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(t){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?await he(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Qe})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async _approveAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Qe});const a=await he(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&tt()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(le(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,s){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Qe});const a=await he(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&tt()&&!(s!=null&&s.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(n){if(le(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;return n?this._returnResult({data:null,error:n}):s?await he(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new Qe})})}catch(t){if(le(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;return r?this._returnResult({data:null,error:r}):n?(await he(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Qe})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async fetchJwk(t,s={keys:[]}){let n=s.keys.find(o=>o.kid===t);if(n)return n;const r=Date.now();if(n=this.jwks.keys.find(o=>o.kid===t),n&&this.jwks_cached_at+U0>r)return n;const{data:i,error:a}=await he(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=r,n=i.keys.find(o=>o.kid===t),!n)?null:n}async getClaims(t,s={}){try{let n=t;if(!n){const{data:p,error:b}=await this.getSession();if(b||!p.session)return this._returnResult({data:null,error:b});n=p.session.access_token}const{header:r,payload:i,signature:a,raw:{header:o,payload:l}}=mr(n);s!=null&&s.allowExpired||om(i.exp);const c=!r.alg||r.alg.startsWith("HS")||!r.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(r.kid,s!=null&&s.keys?{keys:s.keys}:s==null?void 0:s.jwks);if(!c){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:i,header:r,signature:a},error:null}}const u=lm(r.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,a,G0(`${o}.${l}`)))throw new ca("Invalid JWT signature");return{data:{claims:i,header:r,signature:a},error:null}}catch(n){if(le(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var s,n,r;St(this.experimental);try{if(!Dr())return this._returnResult({data:null,error:new Rt("Browser does not support WebAuthn",null)});const{data:i,error:a}=await this._startPasskeyAuthentication({options:{captchaToken:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}});if(a||!i)return this._returnResult({data:null,error:a});const o=yl(i.options),l=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:ua.createNewAbortSignal(),{data:c,error:u}=await Du({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new Rt("WebAuthn ceremony failed",null)});const d=xl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:d})}catch(i){if(le(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var s,n;St(this.experimental);try{if(!Dr())return this._returnResult({data:null,error:new Rt("Browser does not support WebAuthn",null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const a=vl(r.options),o=(n=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&n!==void 0?n:ua.createNewAbortSignal(),{data:l,error:c}=await ju({publicKey:a,signal:o});if(c||!l)return this._returnResult({data:null,error:c??new Rt("WebAuthn ceremony failed",null)});const u=_l(l);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(r){if(le(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyRegistration(){St(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new Qe});const{data:r,error:i}=await he(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:r,error:null})})}catch(t){if(le(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){St(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Qe});const{data:i,error:a}=await he(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyAuthentication(t){var s;St(this.experimental);try{const{data:n,error:r}=await he(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:n,error:null})}catch(n){if(le(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){St(this.experimental);try{const{data:s,error:n}=await he(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:wt});return n?this._returnResult({data:null,error:n}):(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:s,error:null}))}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async _listPasskeys(){St(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!s)return this._returnResult({data:null,error:new Qe});const{data:r,error:i}=await he(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:s.access_token,xform:a=>({data:a,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(le(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){St(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Qe});const{data:i,error:a}=await he(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:t.friendlyName}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:i,error:null})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}async _deletePasskey(t){St(this.experimental);try{return await this._useSession(async s=>{const{data:{session:n},error:r}=s;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new Qe});const{error:i}=await he(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(s){if(le(s))return this._returnResult({data:null,error:s});throw s}}}Zn.nextInstanceID={};const Nm=Zn,Im="2.105.4";let kn="";typeof Deno<"u"?kn="deno":typeof document<"u"?kn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?kn="react-native":kn="node";const Pm={"X-Client-Info":`supabase-js-${kn}/${Im}`},Lm={headers:Pm},Mm={schema:"public"},jm={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Dm={};function Jn(e){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jn(e)}function Um(e,t){if(Jn(e)!="object"||!e)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var n=s.call(e,t);if(Jn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bm(e){var t=Um(e,"string");return Jn(t)=="symbol"?t:t+""}function Hm(e,t,s){return(t=Bm(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function kl(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,n)}return s}function Ve(e){for(var t=1;t<arguments.length;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?kl(Object(s),!0).forEach(function(n){Hm(e,n,s[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):kl(Object(s)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(s,n))})}return e}const Fm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Vm=()=>Headers,qm=(e,t,s)=>{const n=Fm(s),r=Vm();return async(i,a)=>{var o;const l=(o=await t())!==null&&o!==void 0?o:e;let c=new r(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),n(i,Ve(Ve({},a),{},{headers:c}))}};function zm(e){return e.endsWith("/")?e:e+"/"}function Km(e,t){var s,n;const{db:r,auth:i,realtime:a,global:o}=e,{db:l,auth:c,realtime:u,global:d}=t,f={db:Ve(Ve({},l),r),auth:Ve(Ve({},c),i),realtime:Ve(Ve({},u),a),storage:{},global:Ve(Ve(Ve({},d),o),{},{headers:Ve(Ve({},(s=d==null?void 0:d.headers)!==null&&s!==void 0?s:{}),(n=o==null?void 0:o.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?f.accessToken=e.accessToken:delete f.accessToken,f}function Wm(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(zm(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Gm=class extends Nm{constructor(e){super(e)}},Zm=class{constructor(e,t,s){var n,r;this.supabaseUrl=e,this.supabaseKey=t;const i=Wm(e);if(!t)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 a=`sb-${i.hostname.split(".")[0]}-auth-token`,o={db:Mm,realtime:Dm,auth:Ve(Ve({},jm),{},{storageKey:a}),global:Lm},l=Km(s??{},o);if(this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(r=l.global.headers)!==null&&r!==void 0?r:{},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=qm(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Ve({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 xg(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 P0(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new dg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,s)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,s;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(s=n.session)===null||s===void 0?void 0:s.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:r,storageKey:i,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:d,skipAutoInitialize:f},p,b){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Gm({url:this.authUrl.href,headers:Ve(Ve({},v),p),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:n,userStorage:r,flowType:a,lock:o,debug:l,throwOnError:c,experimental:u,fetch:b,lockAcquireTimeout:d,skipAutoInitialize:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(T=>T.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new n0(this.realtimeUrl.href,Ve(Ve({},e),{},{params:Ve(Ve({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Jm=(e,t,s)=>new Zm(e,t,s);function Ym(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const s=t.match(/^v(\d+)\./);return s?parseInt(s[1],10)<=18:!1}Ym()&&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 br=null,vr=null;async function Uu(){if(vr)return vr;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return vr=await e.json(),vr}catch{return{authEnabled:!1,supabaseUrl:null,supabaseAnonKey:null}}}async function $s(){if(br)return br;const e=await Uu();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(br=Jm(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),br)}const rr=su("auth",()=>{const e=q(null),t=q(null),s=q(!1),n=q(!1),r=q(!1);let i=null;async function a(){const d=await Uu();if(r.value=d.authEnabled,!d.authEnabled){n.value=!0;return}const f=await $s();if(!f){n.value=!0;return}await new Promise(p=>{f.auth.onAuthStateChange((b,v)=>{v?(t.value=v,e.value=v.user??null):b==="SIGNED_OUT"&&(t.value=null,e.value=null),b==="INITIAL_SESSION"&&p()})}),n.value=!0}async function o(){if(!n.value)return i||(i=a().catch(()=>{i=null})),i}async function l(d,f){const p=await $s();if(!p)return"Auth not configured";s.value=!0;try{const{error:b}=await p.auth.signInWithPassword({email:d,password:f});return b?b.message:null}finally{s.value=!1}}async function c(){const d=await $s();d&&await d.auth.signOut(),e.value=null,t.value=null}async function u(){const d=t.value;if(d!=null&&d.access_token){if(d.expires_at&&d.expires_at*1e3-Date.now()<3e4)try{const f=await $s();if(f){const{data:p}=await f.auth.refreshSession();if(p.session)return p.session.access_token}}catch{}return d.access_token}if(r.value)try{const f=await $s();if(f){const{data:p}=await f.auth.refreshSession();if(p.session)return p.session.access_token}}catch{}return null}return{user:e,session:t,loading:s,initialized:n,authEnabled:r,init:o,signIn:l,signOut:c,getAccessToken:u}});async function Se(e,t){const s=rr(),n=await s.getAccessToken(),r=new Headers(t==null?void 0:t.headers);n&&r.set("Authorization",`Bearer ${n}`);const i=await fetch(e,{...t,headers:r});if(i.status===401&&s.authEnabled){const a=await $s();if(a){const{data:o,error:l}=await a.auth.refreshSession();if(o.session){const c=new Headers(t==null?void 0:t.headers);return c.set("Authorization",`Bearer ${o.session.access_token}`),fetch(e,{...t,headers:c})}l||await s.signOut()}}return i}async function ir(e){const s=await rr().getAccessToken();if(!s)return e;const n=e.includes("?")?"&":"?";return`${e}${n}token=${encodeURIComponent(s)}`}const Xm={key:0,class:"flex items-center gap-2.5 min-w-0"},Qm={key:1,class:"w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center"},eb={class:"flex-1 py-3 overflow-y-auto overflow-x-hidden"},tb={key:1,class:"text-[13px] font-medium truncate"},sb={class:"shrink-0"},nb={class:"p-2.5"},rb={class:"flex items-center gap-2 px-2 py-1.5 rounded-lg bg-surface-2/50 mb-1.5"},ib={class:"w-6 h-6 rounded-full bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0"},ab={class:"text-[10px] text-accent font-semibold"},ob={class:"min-w-0 flex-1"},lb={class:"text-xs text-txt-primary truncate leading-tight"},cb={class:"flex items-center justify-between px-2"},ub={class:"flex items-center gap-1.5"},db=["href"],hb={class:"text-[10px] text-txt-muted font-mono group-hover/ver:text-accent transition-colors"},fb={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm animate-pulse"},pb={key:1,class:"flex items-center gap-1.5 px-2"},gb=["href"],mb={class:"text-[10px] text-txt-muted font-mono group-hover/ver:text-accent transition-colors"},bb={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm animate-pulse"},vb={key:1,class:"flex flex-col items-center gap-1.5"},yb={key:1,class:"md:hidden fixed bottom-0 inset-x-0 z-50 flex items-stretch border-t border-edge",style:{background:"linear-gradient(180deg, rgba(8,13,22,0.93) 0%, rgba(5,8,15,0.98) 100%)","backdrop-filter":"blur(12px)","padding-bottom":"env(safe-area-inset-bottom)"},"aria-label":"Mobile navigation"},_b={key:0,class:"absolute top-0 left-1/2 -translate-x-1/2 w-6 h-[2px] bg-accent rounded-b-full"},xb={class:"relative"},wb={key:0,class:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] flex items-center justify-center bg-red-500 text-white text-[7px] font-bold rounded-full px-0.5 ring-1 ring-surface-0"},kb={key:1,class:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] flex items-center justify-center bg-accent text-surface-1 text-[7px] font-bold rounded-full px-0.5 ring-1 ring-surface-0"},Eb={class:"text-[9px] leading-tight font-medium truncate max-w-full px-0.5"},El="io-last-seen-version",Sl="io-nav-collapsed",Sb=st({__name:"AppNav",setup(e){const t=bu(),s=mu(),n=rr(),r=q(""),i=q(0),a=q(0),o=q(!1);let l=null;const c=q(!1),u=Ne(()=>r.value?`https://github.com/michaeljolley/io/releases/tag/v${r.value}`:"https://github.com/michaeljolley/io/releases"),d=[{to:"/chat",name:"chat",icon:'<path d="M10 2a8 8 0 1 1-3.61 15.14l-.12-.07-3.65.92a.5.5 0 0 1-.62-.45v-.08l.01-.08.92-3.64-.07-.12a7.95 7.95 0 0 1-.83-2.9l-.02-.37L2 10a8 8 0 0 1 8-8Zm0 1a7 7 0 0 0-6.1 10.42.5.5 0 0 1 .06.28l-.02.1-.75 3.01 3.02-.75a.5.5 0 0 1 .19-.01l.09.02.09.04A7 7 0 1 0 10 3Zm.5 8a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h3.09Zm2-3a.5.5 0 0 1 .09 1H7.5a.5.5 0 0 1-.09-1h5.09Z"/>',label:"Chat"},{to:"/feed",name:"feed",icon:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',label:"Feed"},{to:"/skills",name:"skills",icon:'<path d="M9 6.5a4.5 4.5 0 0 1 6.35-4.1.5.5 0 0 1 .15.8l-2.3 2.3 1.3 1.3 2.3-2.3a.5.5 0 0 1 .8.15A4.49 4.49 0 0 1 13.5 11a4.5 4.5 0 0 1-1.1-.14l-6.37 6.45a2.36 2.36 0 0 1-3.37-3.3l6.42-6.65A4.52 4.52 0 0 1 9 6.5ZM13.5 3a3.5 3.5 0 0 0-3.39 4.39.5.5 0 0 1-.12.47L3.38 14.7a1.36 1.36 0 0 0 1.94 1.9l6.57-6.66a.5.5 0 0 1 .51-.12 3.5 3.5 0 0 0 4.53-4.05l-2.08 2.07a.5.5 0 0 1-.7 0l-2-2a.5.5 0 0 1 0-.7l2.07-2.08A3.52 3.52 0 0 0 13.5 3Z"/>',label:"Skills"},{to:"/squads",name:"squads",icon:'<path d="M10 3a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM7.5 4.5a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Zm8-.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-10 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm.6 12H5a2 2 0 0 1-2-2V9.25c0-.14.11-.25.25-.25h1.76c.04-.37.17-.7.37-1H3.25C2.56 8 2 8.56 2 9.25V13a3 3 0 0 0 3.4 2.97 4.96 4.96 0 0 1-.3-.97Zm9.5.97A3 3 0 0 0 18 13V9.25C18 8.56 17.44 8 16.75 8h-2.13c.2.3.33.63.37 1h1.76c.14 0 .25.11.25.25V13a2 2 0 0 1-2.1 2c-.07.34-.17.66-.3.97ZM7.25 8C6.56 8 6 8.56 6 9.25V14a4 4 0 0 0 8 0V9.25C14 8.56 13.44 8 12.75 8h-5.5ZM7 9.25c0-.14.11-.25.25-.25h5.5c.14 0 .25.11.25.25V14a3 3 0 1 1-6 0V9.25Z"/>',label:"Squads"},{to:"/wiki",name:"wiki",icon:'<path d="M10 16c-.46.6-1.18 1-2 1H3.5A1.5 1.5 0 0 1 2 15.5v-11C2 3.67 2.67 3 3.5 3H8c.82 0 1.54.4 2 1 .46-.6 1.18-1 2-1h4.5c.83 0 1.5.67 1.5 1.5v11c0 .83-.67 1.5-1.5 1.5H12a2.5 2.5 0 0 1-2-1ZM3 4.5v11c0 .28.22.5.5.5H8c.83 0 1.5-.67 1.5-1.5v-9C9.5 4.67 8.83 4 8 4H3.5a.5.5 0 0 0-.5.5Zm7.5 10c0 .83.67 1.5 1.5 1.5h4.5a.5.5 0 0 0 .5-.5v-11a.5.5 0 0 0-.5-.5H12c-.83 0-1.5.67-1.5 1.5v9Z"/>',label:"Wiki"},{to:"/schedules",name:"schedules",icon:'<path d="M7 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm1 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4-5.5A2.5 2.5 0 0 0 14.5 3h-9A2.5 2.5 0 0 0 3 5.5v9A2.5 2.5 0 0 0 5.5 17h9a2.5 2.5 0 0 0 2.5-2.5v-9ZM4 7h12v7.5c0 .83-.67 1.5-1.5 1.5h-9A1.5 1.5 0 0 1 4 14.5V7Zm1.5-3h9c.83 0 1.5.67 1.5 1.5V6H4v-.5C4 4.67 4.67 4 5.5 4Z"/>',label:"Schedules"},{to:"/activity",name:"activity",icon:'<path d="M16.52 9c.26 0 .48-.2.48-.46V8.5A6.5 6.5 0 0 0 10.5 2h-.04a.47.47 0 0 0-.46.48V8.5c0 .28.22.5.5.5h6.02ZM11 3.02A5.5 5.5 0 0 1 15.98 8H11V3.02ZM8 9V5.1A5 5 0 0 0 9 15v1a6 6 0 0 1-.5-11.98c.28-.02.5.2.5.48V9a1 1 0 0 0 1 1h4.5c.28 0 .5.22.48.5a6 6 0 0 1-.06.5H10a2 2 0 0 1-2-2Zm9 1a1 1 0 0 0-1 1v7a1 1 0 1 0 2 0v-7a1 1 0 0 0-1-1Zm-3 2a1 1 0 0 0-1 1v5a1 1 0 1 0 2 0v-5a1 1 0 0 0-1-1Zm-4 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0v-3Z"/>',label:"Activity"},{to:"/inbox",name:"inbox",icon:'<path d="M2 6.25A2.25 2.25 0 0 1 4.25 4h11.5A2.25 2.25 0 0 1 18 6.25v7.5A2.25 2.25 0 0 1 15.75 16H4.25A2.25 2.25 0 0 1 2 13.75v-7.5Zm2.25-1a1 1 0 0 0-1 1v.388l6.75 4.5 6.75-4.5V6.25a1 1 0 0 0-1-1H4.25Zm12.5 2.834-6.294 4.196a.75.75 0 0 1-.812 0L3.25 8.084v5.666a1 1 0 0 0 1 1h11.5a1 1 0 0 0 1-1V8.084Z"/>',label:"Inbox"},{to:"/mcp",name:"mcp",icon:'<path d="M10 2a8 8 0 1 0 0 16A8 8 0 0 0 10 2ZM3 10a7 7 0 0 1 11.95-4.95l-9.9 9.9A6.97 6.97 0 0 1 3 10Zm2.05 4.95 9.9-9.9A7 7 0 0 1 5.05 14.95Z"/>',label:"MCP"}],f=Ne(()=>{var A;return(((A=n.user)==null?void 0:A.email)??"").charAt(0).toUpperCase()});function p(E){return t.name===E}function b(){try{localStorage.setItem(El,r.value)}catch{}c.value=!1}function v(){o.value=!o.value;try{localStorage.setItem(Sl,String(o.value))}catch{}}async function T(){await n.signOut(),s.push("/login")}function R(){i.value=0}function k(){a.value=0}yt(async()=>{try{const E=localStorage.getItem(Sl);E!==null&&(o.value=E==="true")}catch{}if(await n.init(),!(n.authEnabled&&!n.user)){try{const E=await Se("/api/status");if(E.ok){const A=await E.json();r.value=A.version??"";try{const N=localStorage.getItem(El);r.value&&r.value!==N&&(c.value=!0)}catch{}}}catch{}try{const E=await Se("/api/feed/count");if(E.ok){const A=await E.json();i.value=A.count??0}}catch{}try{const E=await Se("/api/inbox/count");if(E.ok){const A=await E.json();a.value=A.count??0}}catch{}x()}});async function x(E=0){l==null||l.close(),l=null;const A=new EventSource(await ir("/api/events"));l=A,A.onmessage=N=>{try{JSON.parse(N.data).type==="feed"&&t.name!=="feed"&&i.value++}catch{}},A.onerror=async()=>{if(A.close(),l===A&&(l=null),!(E>=3)){try{const N=await $s();N&&await N.auth.refreshSession()}catch{}setTimeout(()=>x(E+1),2e3*(E+1))}}}return tr(()=>{l==null||l.close(),l=null}),(E,A)=>(g(),m(we,null,[Re(t).name!=="login"?(g(),m("nav",{key:0,class:ce(["relative z-10 hidden md:flex flex-col shrink-0 nav-sidebar border-r border-edge backdrop-blur-md",o.value?"nav-collapsed":"nav-expanded"]),style:{background:"linear-gradient(180deg, rgba(10,17,32,0.85) 0%, rgba(12,18,32,0.78) 50%, rgba(8,13,25,0.88) 100%)"}},[h("div",{class:ce(["flex items-center h-14 px-3 shrink-0",o.value?"justify-center":"justify-between"])},[o.value?(g(),m("div",Qm,[...A[1]||(A[1]=[h("span",{class:"text-accent font-bold text-xs font-mono tracking-tight"},"IO",-1)])])):(g(),m("div",Xm,[...A[0]||(A[0]=[hn('<div class="w-8 h-8 rounded-lg bg-accent/10 border border-accent/20 flex items-center justify-center shrink-0" data-v-25bb2173><span class="text-accent font-bold text-sm font-mono tracking-tight" data-v-25bb2173>IO</span></div><div class="min-w-0" data-v-25bb2173><p class="text-sm font-semibold text-txt-primary leading-tight tracking-tight" data-v-25bb2173>IO Assistant</p><p class="text-[10px] text-txt-muted leading-tight" data-v-25bb2173>Terminal · Dashboard</p></div>',2)])])),o.value?(g(),m("button",{key:3,onClick:v,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"},[de(Ee,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:12})])):(g(),m("button",{key:2,onClick:v,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"},[de(Ee,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14})]))],2),A[8]||(A[8]=h("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-accent/[0.12] to-transparent"},null,-1)),h("div",eb,[h("ul",{class:ce(["space-y-0.5",o.value?"px-1.5":"px-2"])},[(g(),m(we,null,Me(d,N=>h("li",{key:N.to},[de(Re(Yi),{to:N.to,class:ce(["group flex items-center rounded-lg transition-all duration-150 relative",[o.value?"justify-center p-2":"px-2.5 py-2 gap-2.5",p(N.name)?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"]]),title:o.value?N.label:void 0,onClick:O=>N.name==="feed"?R():N.name==="inbox"?k():void 0},{default:Kt(()=>[p(N.name)?(g(),m("span",{key:0,class:ce(["absolute left-0 top-1/2 -translate-y-1/2 w-[3px] rounded-r-full bg-accent shadow-glow-sm",o.value?"h-4":"h-5"])},null,2)):B("",!0),de(Ee,{paths:N.icon,size:18,class:ce(["shrink-0 transition-transform duration-150 group-hover:scale-105",o.value?"":"ml-0.5"])},null,8,["paths","class"]),o.value?B("",!0):(g(),m("span",tb,C(N.label),1)),N.name==="feed"&&i.value>0?(g(),m("span",{key:2,class:ce(["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",o.value?"top-0 right-0":"top-0.5 right-1"])},C(i.value>99?"99+":i.value),3)):B("",!0),N.name==="inbox"&&a.value>0?(g(),m("span",{key:3,class:ce(["absolute flex items-center justify-center bg-accent text-surface-1 text-[9px] font-bold rounded-full min-w-[16px] h-[16px] px-0.5 ring-2 ring-surface-1",o.value?"top-0 right-0":"top-0.5 right-1"])},C(a.value>99?"99+":a.value),3)):B("",!0)]),_:2},1032,["to","class","title","onClick"])])),64))],2)]),h("div",sb,[A[7]||(A[7]=h("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-accent/[0.08] to-transparent"},null,-1)),h("div",nb,[o.value?(g(),m("div",vb,[A[6]||(A[6]=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)),Re(n).authEnabled&&Re(n).user?(g(),m("button",{key:0,onClick:T,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"},[de(Ee,{paths:'<path d="M9.16 16.87a.5.5 0 1 0 .67-.74L3.67 10.5H17.5a.5.5 0 0 0 0-1H3.67l6.16-5.63a.5.5 0 0 0-.67-.74L2.24 9.44a.75.75 0 0 0 0 1.11l6.92 6.32Z"/>',size:14})])):B("",!0)])):(g(),m(we,{key:0},[Re(n).authEnabled&&Re(n).user?(g(),m(we,{key:0},[h("div",rb,[h("div",ib,[h("span",ab,C(f.value),1)]),h("div",ob,[h("p",lb,C(Re(n).user.email),1)])]),h("div",cb,[h("span",ub,[r.value?(g(),m("a",{key:0,href:u.value,target:"_blank",rel:"noopener noreferrer",onClick:b,class:"group/ver flex items-center gap-1 hover:opacity-80 transition-opacity",title:"View release on GitHub"},[h("span",hb,"v"+C(r.value),1),c.value?(g(),m("span",fb)):B("",!0)],8,db)):B("",!0),A[2]||(A[2]=h("span",{class:"text-[10px] text-txt-muted"},"·",-1)),A[3]||(A[3]=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:T,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)):(g(),m("div",pb,[r.value?(g(),m("a",{key:0,href:u.value,target:"_blank",rel:"noopener noreferrer",onClick:b,class:"group/ver flex items-center gap-1 hover:opacity-80 transition-opacity",title:"View release on GitHub"},[h("span",mb,"v"+C(r.value),1),c.value?(g(),m("span",bb)):B("",!0)],8,gb)):B("",!0),A[4]||(A[4]=h("span",{class:"text-[10px] text-txt-muted"},"·",-1)),A[5]||(A[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))]))],64))])])],2)):B("",!0),Re(t).name!=="login"?(g(),m("nav",yb,[(g(),m(we,null,Me(d,N=>de(Re(Yi),{key:N.to,to:N.to,class:ce(["relative flex-1 flex flex-col items-center justify-center gap-0.5 py-2 px-1 min-w-0 transition-colors duration-150 touch-manipulation select-none",p(N.name)?"text-accent":"text-txt-muted"]),onClick:O=>N.name==="feed"?R():N.name==="inbox"?k():void 0,"aria-label":N.label},{default:Kt(()=>[p(N.name)?(g(),m("span",_b)):B("",!0),h("span",xb,[de(Ee,{paths:N.icon,size:20},null,8,["paths"]),N.name==="feed"&&i.value>0?(g(),m("span",wb,C(i.value>9?"9+":i.value),1)):B("",!0),N.name==="inbox"&&a.value>0?(g(),m("span",kb,C(a.value>9?"9+":a.value),1)):B("",!0)]),h("span",Eb,C(N.label),1)]),_:2},1032,["to","class","onClick","aria-label"])),64))])):B("",!0)],64))}}),pn=(e,t)=>{const s=e.__vccOpts||e;for(const[n,r]of t)s[n]=r;return s},Tb=pn(Sb,[["__scopeId","data-v-25bb2173"]]),Bu=su("chat",()=>{const e=q([]),t=q(!1);function s(i){e.value.push(i)}function n(i){const a=e.value[e.value.length-1];a&&a.role==="assistant"&&(a.content+=i)}function r(i){const a=e.value[e.value.length-1];a&&a.role==="assistant"&&(a.streaming=i)}return{messages:e,isLoading:t,addMessage:s,appendToLast:n,setLastStreaming:r}});function Ab(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hu(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const s=e[t],n=typeof s;(n==="object"||n==="function")&&!Object.isFrozen(s)&&Hu(s)}),e}class Tl{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Fu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ys(e,...t){const s=Object.create(null);for(const n in e)s[n]=e[n];return t.forEach(function(n){for(const r in n)s[r]=n[r]}),s}const Rb="</span>",Al=e=>!!e.scope,Cb=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const s=e.split(".");return[`${t}${s.shift()}`,...s.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class Ob{constructor(t,s){this.buffer="",this.classPrefix=s.classPrefix,t.walk(this)}addText(t){this.buffer+=Fu(t)}openNode(t){if(!Al(t))return;const s=Cb(t.scope,{prefix:this.classPrefix});this.span(s)}closeNode(t){Al(t)&&(this.buffer+=Rb)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Rl=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Ia{constructor(){this.rootNode=Rl(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const s=Rl({scope:t});this.add(s),this.stack.push(s)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,s){return typeof s=="string"?t.addText(s):s.children&&(t.openNode(s),s.children.forEach(n=>this._walk(t,n)),t.closeNode(s)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(s=>typeof s=="string")?t.children=[t.children.join("")]:t.children.forEach(s=>{Ia._collapse(s)}))}}class $b extends Ia{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,s){const n=t.root;s&&(n.scope=`language:${s}`),this.add(n)}toHTML(){return new Ob(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Yn(e){return e?typeof e=="string"?e:e.source:null}function Vu(e){return Us("(?=",e,")")}function Nb(e){return Us("(?:",e,")*")}function Ib(e){return Us("(?:",e,")?")}function Us(...e){return e.map(s=>Yn(s)).join("")}function Pb(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Pa(...e){return"("+(Pb(e).capture?"":"?:")+e.map(n=>Yn(n)).join("|")+")"}function qu(e){return new RegExp(e.toString()+"|").exec("").length-1}function Lb(e,t){const s=e&&e.exec(t);return s&&s.index===0}const Mb=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function La(e,{joinWith:t}){let s=0;return e.map(n=>{s+=1;const r=s;let i=Yn(n),a="";for(;i.length>0;){const o=Mb.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+r):(a+=o[0],o[0]==="("&&s++)}return a}).map(n=>`(${n})`).join(t)}const jb=/\b\B/,zu="[a-zA-Z]\\w*",Ma="[a-zA-Z_]\\w*",Ku="\\b\\d+(\\.\\d+)?",Wu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Gu="\\b(0b[01]+)",Db="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Ub=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Us(t,/.*\b/,e.binary,/\b.*/)),ys({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(s,n)=>{s.index!==0&&n.ignoreMatch()}},e)},Xn={begin:"\\\\[\\s\\S]",relevance:0},Bb={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Xn]},Hb={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Xn]},Fb={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},ui=function(e,t,s={}){const n=ys({scope:"comment",begin:e,end:t,contains:[]},s);n.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const r=Pa("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return n.contains.push({begin:Us(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),n},Vb=ui("//","$"),qb=ui("/\\*","\\*/"),zb=ui("#","$"),Kb={scope:"number",begin:Ku,relevance:0},Wb={scope:"number",begin:Wu,relevance:0},Gb={scope:"number",begin:Gu,relevance:0},Zb={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Xn,{begin:/\[/,end:/\]/,relevance:0,contains:[Xn]}]},Jb={scope:"title",begin:zu,relevance:0},Yb={scope:"title",begin:Ma,relevance:0},Xb={begin:"\\.\\s*"+Ma,relevance:0},Qb=function(e){return Object.assign(e,{"on:begin":(t,s)=>{s.data._beginMatch=t[1]},"on:end":(t,s)=>{s.data._beginMatch!==t[1]&&s.ignoreMatch()}})};var yr=Object.freeze({__proto__:null,APOS_STRING_MODE:Bb,BACKSLASH_ESCAPE:Xn,BINARY_NUMBER_MODE:Gb,BINARY_NUMBER_RE:Gu,COMMENT:ui,C_BLOCK_COMMENT_MODE:qb,C_LINE_COMMENT_MODE:Vb,C_NUMBER_MODE:Wb,C_NUMBER_RE:Wu,END_SAME_AS_BEGIN:Qb,HASH_COMMENT_MODE:zb,IDENT_RE:zu,MATCH_NOTHING_RE:jb,METHOD_GUARD:Xb,NUMBER_MODE:Kb,NUMBER_RE:Ku,PHRASAL_WORDS_MODE:Fb,QUOTE_STRING_MODE:Hb,REGEXP_MODE:Zb,RE_STARTERS_RE:Db,SHEBANG:Ub,TITLE_MODE:Jb,UNDERSCORE_IDENT_RE:Ma,UNDERSCORE_TITLE_MODE:Yb});function ev(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function tv(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function sv(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=ev,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function nv(e,t){Array.isArray(e.illegal)&&(e.illegal=Pa(...e.illegal))}function rv(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function iv(e,t){e.relevance===void 0&&(e.relevance=1)}const av=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const s=Object.assign({},e);Object.keys(e).forEach(n=>{delete e[n]}),e.keywords=s.keywords,e.begin=Us(s.beforeMatch,Vu(s.begin)),e.starts={relevance:0,contains:[Object.assign(s,{endsParent:!0})]},e.relevance=0,delete s.beforeMatch},ov=["of","and","for","in","not","or","if","then","parent","list","value"],lv="keyword";function Zu(e,t,s=lv){const n=Object.create(null);return typeof e=="string"?r(s,e.split(" ")):Array.isArray(e)?r(s,e):Object.keys(e).forEach(function(i){Object.assign(n,Zu(e[i],t,i))}),n;function r(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const l=o.split("|");n[l[0]]=[i,cv(l[0],l[1])]})}}function cv(e,t){return t?Number(t):uv(e)?0:1}function uv(e){return ov.includes(e.toLowerCase())}const Cl={},Ms=e=>{console.error(e)},Ol=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ws=(e,t)=>{Cl[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Cl[`${e}/${t}`]=!0)},Br=new Error;function Ju(e,t,{key:s}){let n=0;const r=e[s],i={},a={};for(let o=1;o<=t.length;o++)a[o+n]=r[o],i[o+n]=!0,n+=qu(t[o-1]);e[s]=a,e[s]._emit=i,e[s]._multi=!0}function dv(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ms("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Br;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ms("beginScope must be object"),Br;Ju(e,e.begin,{key:"beginScope"}),e.begin=La(e.begin,{joinWith:""})}}function hv(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ms("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Br;if(typeof e.endScope!="object"||e.endScope===null)throw Ms("endScope must be object"),Br;Ju(e,e.end,{key:"endScope"}),e.end=La(e.end,{joinWith:""})}}function fv(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function pv(e){fv(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),dv(e),hv(e)}function gv(e){function t(a,o){return new RegExp(Yn(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class s{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,o]),this.matchAt+=qu(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(l=>l[1]);this.matcherRe=t(La(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(o);if(!l)return null;const c=l.findIndex((d,f)=>f>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class n{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const l=new s;return this.rules.slice(o).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[o]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,l){this.rules.push([o,l]),l.type==="begin"&&this.count++}exec(o){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(o);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(o)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function r(a){const o=new n;return a.contains.forEach(l=>o.addRule(l.begin,{rule:l,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const l=a;if(a.isCompiled)return l;[tv,rv,pv,av].forEach(u=>u(a,o)),e.compilerExtensions.forEach(u=>u(a,o)),a.__beforeBegin=null,[sv,nv,iv].forEach(u=>u(a,o)),a.isCompiled=!0;let c=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),c=a.keywords.$pattern,delete a.keywords.$pattern),c=c||/\w+/,a.keywords&&(a.keywords=Zu(a.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),o&&(a.begin||(a.begin=/\B|\b/),l.beginRe=t(l.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(l.endRe=t(l.end)),l.terminatorEnd=Yn(l.end)||"",a.endsWithParent&&o.terminatorEnd&&(l.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(l.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(u){return mv(u==="self"?a:u)})),a.contains.forEach(function(u){i(u,l)}),a.starts&&i(a.starts,o),l.matcher=r(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=ys(e.classNameAliases||{}),i(e)}function Yu(e){return e?e.endsWithParent||Yu(e.starts):!1}function mv(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return ys(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Yu(e)?ys(e,{starts:e.starts?ys(e.starts):null}):Object.isFrozen(e)?ys(e):e}var bv="11.11.1";class vv extends Error{constructor(t,s){super(t),this.name="HTMLInjectionError",this.html=s}}const $i=Fu,$l=ys,Nl=Symbol("nomatch"),yv=7,Xu=function(e){const t=Object.create(null),s=Object.create(null),n=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:$b};function l(y){return o.noHighlightRe.test(y)}function c(y){let S=y.className+" ";S+=y.parentNode?y.parentNode.className:"";const H=o.languageDetectRe.exec(S);if(H){const ie=L(H[1]);return ie||(Ol(i.replace("{}",H[1])),Ol("Falling back to no-highlight mode for this block.",y)),ie?H[1]:"no-highlight"}return S.split(/\s+/).find(ie=>l(ie)||L(ie))}function u(y,S,H){let ie="",ge="";typeof S=="object"?(ie=y,H=S.ignoreIllegals,ge=S.language):(Ws("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ws("10.7.0",`Please use highlight(code, options) instead.
|
|
73
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),ge=y,ie=S),H===void 0&&(H=!0);const ke={code:ie,language:ge};I("before:highlight",ke);const Ae=ke.result?ke.result:d(ke.language,ke.code,H);return Ae.code=ke.code,I("after:highlight",Ae),Ae}function d(y,S,H,ie){const ge=Object.create(null);function ke(Z,te){return Z.keywords[te]}function Ae(){if(!K.keywords){Y.addText(V);return}let Z=0;K.keywordPatternRe.lastIndex=0;let te=K.keywordPatternRe.exec(V),ue="";for(;te;){ue+=V.substring(Z,te.index);const _e=F.case_insensitive?te[0].toLowerCase():te[0],Oe=ke(K,_e);if(Oe){const[Ke,_t]=Oe;if(Y.addText(ue),ue="",ge[_e]=(ge[_e]||0)+1,ge[_e]<=yv&&(be+=_t),Ke.startsWith("_"))ue+=te[0];else{const xs=F.classNameAliases[Ke]||Ke;U(te[0],xs)}}else ue+=te[0];Z=K.keywordPatternRe.lastIndex,te=K.keywordPatternRe.exec(V)}ue+=V.substring(Z),Y.addText(ue)}function J(){if(V==="")return;let Z=null;if(typeof K.subLanguage=="string"){if(!t[K.subLanguage]){Y.addText(V);return}Z=d(K.subLanguage,V,!0,se[K.subLanguage]),se[K.subLanguage]=Z._top}else Z=p(V,K.subLanguage.length?K.subLanguage:null);K.relevance>0&&(be+=Z.relevance),Y.__addSublanguage(Z._emitter,Z.language)}function M(){K.subLanguage!=null?J():Ae(),V=""}function U(Z,te){Z!==""&&(Y.startScope(te),Y.addText(Z),Y.endScope())}function Q(Z,te){let ue=1;const _e=te.length-1;for(;ue<=_e;){if(!Z._emit[ue]){ue++;continue}const Oe=F.classNameAliases[Z[ue]]||Z[ue],Ke=te[ue];Oe?U(Ke,Oe):(V=Ke,Ae(),V=""),ue++}}function j(Z,te){return Z.scope&&typeof Z.scope=="string"&&Y.openNode(F.classNameAliases[Z.scope]||Z.scope),Z.beginScope&&(Z.beginScope._wrap?(U(V,F.classNameAliases[Z.beginScope._wrap]||Z.beginScope._wrap),V=""):Z.beginScope._multi&&(Q(Z.beginScope,te),V="")),K=Object.create(Z,{parent:{value:K}}),K}function ae(Z,te,ue){let _e=Lb(Z.endRe,ue);if(_e){if(Z["on:end"]){const Oe=new Tl(Z);Z["on:end"](te,Oe),Oe.isMatchIgnored&&(_e=!1)}if(_e){for(;Z.endsParent&&Z.parent;)Z=Z.parent;return Z}}if(Z.endsWithParent)return ae(Z.parent,te,ue)}function oe(Z){return K.matcher.regexIndex===0?(V+=Z[0],1):(ye=!0,0)}function me(Z){const te=Z[0],ue=Z.rule,_e=new Tl(ue),Oe=[ue.__beforeBegin,ue["on:begin"]];for(const Ke of Oe)if(Ke&&(Ke(Z,_e),_e.isMatchIgnored))return oe(te);return ue.skip?V+=te:(ue.excludeBegin&&(V+=te),M(),!ue.returnBegin&&!ue.excludeBegin&&(V=te)),j(ue,Z),ue.returnBegin?0:te.length}function Ce(Z){const te=Z[0],ue=S.substring(Z.index),_e=ae(K,Z,ue);if(!_e)return Nl;const Oe=K;K.endScope&&K.endScope._wrap?(M(),U(te,K.endScope._wrap)):K.endScope&&K.endScope._multi?(M(),Q(K.endScope,Z)):Oe.skip?V+=te:(Oe.returnEnd||Oe.excludeEnd||(V+=te),M(),Oe.excludeEnd&&(V=te));do K.scope&&Y.closeNode(),!K.skip&&!K.subLanguage&&(be+=K.relevance),K=K.parent;while(K!==_e.parent);return _e.starts&&j(_e.starts,Z),Oe.returnEnd?0:te.length}function _(){const Z=[];for(let te=K;te!==F;te=te.parent)te.scope&&Z.unshift(te.scope);Z.forEach(te=>Y.openNode(te))}let w={};function P(Z,te){const ue=te&&te[0];if(V+=Z,ue==null)return M(),0;if(w.type==="begin"&&te.type==="end"&&w.index===te.index&&ue===""){if(V+=S.slice(te.index,te.index+1),!r){const _e=new Error(`0 width match regex (${y})`);throw _e.languageName=y,_e.badRule=w.rule,_e}return 1}if(w=te,te.type==="begin")return me(te);if(te.type==="illegal"&&!H){const _e=new Error('Illegal lexeme "'+ue+'" for mode "'+(K.scope||"<unnamed>")+'"');throw _e.mode=K,_e}else if(te.type==="end"){const _e=Ce(te);if(_e!==Nl)return _e}if(te.type==="illegal"&&ue==="")return V+=`
|
|
74
|
+
`,1;if(pe>1e5&&pe>te.index*3)throw new Error("potential infinite loop, way more iterations than matches");return V+=ue,ue.length}const F=L(y);if(!F)throw Ms(i.replace("{}",y)),new Error('Unknown language: "'+y+'"');const G=gv(F);let z="",K=ie||G;const se={},Y=new o.__emitter(o);_();let V="",be=0,re=0,pe=0,ye=!1;try{if(F.__emitTokens)F.__emitTokens(S,Y);else{for(K.matcher.considerAll();;){pe++,ye?ye=!1:K.matcher.considerAll(),K.matcher.lastIndex=re;const Z=K.matcher.exec(S);if(!Z)break;const te=S.substring(re,Z.index),ue=P(te,Z);re=Z.index+ue}P(S.substring(re))}return Y.finalize(),z=Y.toHTML(),{language:y,value:z,relevance:be,illegal:!1,_emitter:Y,_top:K}}catch(Z){if(Z.message&&Z.message.includes("Illegal"))return{language:y,value:$i(S),illegal:!0,relevance:0,_illegalBy:{message:Z.message,index:re,context:S.slice(re-100,re+100),mode:Z.mode,resultSoFar:z},_emitter:Y};if(r)return{language:y,value:$i(S),illegal:!1,relevance:0,errorRaised:Z,_emitter:Y,_top:K};throw Z}}function f(y){const S={value:$i(y),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return S._emitter.addText(y),S}function p(y,S){S=S||o.languages||Object.keys(t);const H=f(y),ie=S.filter(L).filter(W).map(M=>d(M,y,!1));ie.unshift(H);const ge=ie.sort((M,U)=>{if(M.relevance!==U.relevance)return U.relevance-M.relevance;if(M.language&&U.language){if(L(M.language).supersetOf===U.language)return 1;if(L(U.language).supersetOf===M.language)return-1}return 0}),[ke,Ae]=ge,J=ke;return J.secondBest=Ae,J}function b(y,S,H){const ie=S&&s[S]||H;y.classList.add("hljs"),y.classList.add(`language-${ie}`)}function v(y){let S=null;const H=c(y);if(l(H))return;if(I("before:highlightElement",{el:y,language:H}),y.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",y);return}if(y.children.length>0&&(o.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(y)),o.throwUnescapedHTML))throw new vv("One of your code blocks includes unescaped HTML.",y.innerHTML);S=y;const ie=S.textContent,ge=H?u(ie,{language:H,ignoreIllegals:!0}):p(ie);y.innerHTML=ge.value,y.dataset.highlighted="yes",b(y,H,ge.language),y.result={language:ge.language,re:ge.relevance,relevance:ge.relevance},ge.secondBest&&(y.secondBest={language:ge.secondBest.language,relevance:ge.secondBest.relevance}),I("after:highlightElement",{el:y,result:ge,text:ie})}function T(y){o=$l(o,y)}const R=()=>{E(),Ws("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){E(),Ws("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function E(){function y(){E()}if(document.readyState==="loading"){x||window.addEventListener("DOMContentLoaded",y,!1),x=!0;return}document.querySelectorAll(o.cssSelector).forEach(v)}function A(y,S){let H=null;try{H=S(e)}catch(ie){if(Ms("Language definition for '{}' could not be registered.".replace("{}",y)),r)Ms(ie);else throw ie;H=a}H.name||(H.name=y),t[y]=H,H.rawDefinition=S.bind(null,e),H.aliases&&D(H.aliases,{languageName:y})}function N(y){delete t[y];for(const S of Object.keys(s))s[S]===y&&delete s[S]}function O(){return Object.keys(t)}function L(y){return y=(y||"").toLowerCase(),t[y]||t[s[y]]}function D(y,{languageName:S}){typeof y=="string"&&(y=[y]),y.forEach(H=>{s[H.toLowerCase()]=S})}function W(y){const S=L(y);return S&&!S.disableAutodetect}function ne(y){y["before:highlightBlock"]&&!y["before:highlightElement"]&&(y["before:highlightElement"]=S=>{y["before:highlightBlock"](Object.assign({block:S.el},S))}),y["after:highlightBlock"]&&!y["after:highlightElement"]&&(y["after:highlightElement"]=S=>{y["after:highlightBlock"](Object.assign({block:S.el},S))})}function ee(y){ne(y),n.push(y)}function X(y){const S=n.indexOf(y);S!==-1&&n.splice(S,1)}function I(y,S){const H=y;n.forEach(function(ie){ie[H]&&ie[H](S)})}function $(y){return Ws("10.7.0","highlightBlock will be removed entirely in v12.0"),Ws("10.7.0","Please use highlightElement now."),v(y)}Object.assign(e,{highlight:u,highlightAuto:p,highlightAll:E,highlightElement:v,highlightBlock:$,configure:T,initHighlighting:R,initHighlightingOnLoad:k,registerLanguage:A,unregisterLanguage:N,listLanguages:O,getLanguage:L,registerAliases:D,autoDetection:W,inherit:$l,addPlugin:ee,removePlugin:X}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=bv,e.regex={concat:Us,lookahead:Vu,either:Pa,optional:Ib,anyNumberOfTimes:Nb};for(const y in yr)typeof yr[y]=="object"&&Hu(yr[y]);return Object.assign(e,yr),e},dn=Xu({});dn.newInstance=()=>Xu({});var _v=dn;dn.HighlightJS=dn;dn.default=dn;const Ge=Ab(_v),Hr="[A-Za-z$_][0-9A-Za-z$_]*",Qu=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],ed=["true","false","null","undefined","NaN","Infinity"],td=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],sd=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],nd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rd=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],id=[].concat(nd,td,sd);function xv(e){const t=e.regex,s=(H,{after:ie})=>{const ge="</"+H[0].slice(1);return H.input.indexOf(ge,ie)!==-1},n=Hr,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,ie)=>{const ge=H[0].length+H.index,ke=H.input[ge];if(ke==="<"||ke===","){ie.ignoreMatch();return}ke===">"&&(s(H,{after:ge})||ie.ignoreMatch());let Ae;const J=H.input.substring(ge);if(Ae=J.match(/^\s*=/)){ie.ignoreMatch();return}if((Ae=J.match(/^\s+extends\s+/))&&Ae.index===0){ie.ignoreMatch();return}}},o={$pattern:Hr,keyword:Qu,literal:ed,built_in:id,"variable.language":rd},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"css"}},v={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},k={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,v,T,{match:/\$\d+/},d];f.contains=x.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(x)});const E=[].concat(k,f.contains),A=E.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(E)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:A},O={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...td,...sd]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},W={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ee(H){return t.concat("(?!",H.join("|"),")")}const X={match:t.concat(/\b/,ee([...nd,"super","import"].map(H=>`${H}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",S={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,v,T,k,{match:/\$\d+/},d,L,{scope:"attr",match:n+t.lookahead(":"),relevance:0},S,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,e.REGEXP_MODE,{className:"function",begin:y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:A}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},W,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},X,ne,O,$,{match:/\$[(.]/}]}}function ad(e){const t=e.regex,s=xv(e),n=Hr,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[s.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Hr,keyword:Qu.concat(l),literal:ed,built_in:id.concat(r),"variable.language":rd},u={className:"meta",begin:"@"+n},d=(v,T,R)=>{const k=v.contains.findIndex(x=>x.label===T);if(k===-1)throw new Error("can not find mode to replace");v.contains.splice(k,1,R)};Object.assign(s.keywords,c),s.exports.PARAMS_CONTAINS.push(u);const f=s.contains.find(v=>v.scope==="attr"),p=Object.assign({},f,{match:t.concat(n,t.lookahead(/\s*\?:/))});s.exports.PARAMS_CONTAINS.push([s.exports.CLASS_REFERENCE,f,p]),s.contains=s.contains.concat([u,i,a,p]),d(s,"shebang",e.SHEBANG()),d(s,"use_strict",o);const b=s.contains.find(v=>v.label==="func.def");return b.relevance=0,Object.assign(s,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),s}const Il="[A-Za-z$_][0-9A-Za-z$_]*",wv=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],kv=["true","false","null","undefined","NaN","Infinity"],od=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ld=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],cd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ev=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Sv=[].concat(cd,od,ld);function ud(e){const t=e.regex,s=(H,{after:ie})=>{const ge="</"+H[0].slice(1);return H.input.indexOf(ge,ie)!==-1},n=Il,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(H,ie)=>{const ge=H[0].length+H.index,ke=H.input[ge];if(ke==="<"||ke===","){ie.ignoreMatch();return}ke===">"&&(s(H,{after:ge})||ie.ignoreMatch());let Ae;const J=H.input.substring(ge);if(Ae=J.match(/^\s*=/)){ie.ignoreMatch();return}if((Ae=J.match(/^\s+extends\s+/))&&Ae.index===0){ie.ignoreMatch();return}}},o={$pattern:Il,keyword:wv,literal:kv,built_in:Sv,"variable.language":Ev},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"css"}},v={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},k={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:n+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,v,T,{match:/\$\d+/},d];f.contains=x.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(x)});const E=[].concat(k,f.contains),A=E.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(E)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:A},O={variants:[{match:[/class/,/\s+/,n,/\s+/,/extends/,/\s+/,t.concat(n,"(",t.concat(/\./,n),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,n],scope:{1:"keyword",3:"title.class"}}]},L={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...od,...ld]}},D={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},W={variants:[{match:[/function/,/\s+/,n,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},ne={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function ee(H){return t.concat("(?!",H.join("|"),")")}const X={match:t.concat(/\b/,ee([...cd,"super","import"].map(H=>`${H}\\s*\\(`)),n,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(n,/(?![0-9A-Za-z$_(])/))),end:n,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,n,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},y="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",S={match:[/const|var|let/,/\s+/,n,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(y)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:A,CLASS_REFERENCE:L},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),D,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,v,T,k,{match:/\$\d+/},d,L,{scope:"attr",match:n+t.lookahead(":"),relevance:0},S,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,e.REGEXP_MODE,{className:"function",begin:y,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:A}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},W,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:n,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+n,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},X,ne,O,$,{match:/\$[(.]/}]}}function dd(e){const t=e.regex,s=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),n=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],o={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:n,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,b=`\\b|${n.join("|")}`,v={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${b})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${b})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${b})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${b})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${b})`},{begin:`\\b(${f})[jJ](?=${b})`}]},T={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},R={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",l,v,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,v,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[l,v,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,T,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,s],scope:{1:"keyword",3:"title.function"},contains:[R]},{variants:[{match:[/\bclass/,/\s+/,s,/\s*/,/\(\s*/,s,/\s*\)/]},{match:[/\bclass/,/\s+/,s]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[v,R,d]}]}}function hd(e){const t=e.regex,s={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[s]}]};Object.assign(s,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,r]};r.contains.push(o);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,s]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),b={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},v=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],T=["true","false"],R={match:/(\/[a-z._-]+)+/},k=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],x=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],E=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],A=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:v,literal:T,built_in:[...k,...x,"set","shopt",...E,...A]},contains:[p,e.SHEBANG(),b,d,i,a,R,o,l,c,u,s]}}function Tv(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},s={match:/[{}[\],:]/,className:"punctuation",relevance:0},n=["true","false","null"],r={scope:"literal",beginKeywords:n.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:n},contains:[t,s,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const Av=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Rv=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Cv=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Ov=[...Rv,...Cv],$v=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Nv=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Iv=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Pv=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Lv(e){const t=e.regex,s=Av(e),n={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[s.BLOCK_COMMENT,n,s.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+a,relevance:0},s.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Nv.join("|")+")"},{begin:":(:)?("+Iv.join("|")+")"}]},s.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Pv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[s.BLOCK_COMMENT,s.HEXCOLOR,s.IMPORTANT,s.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},s.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:r,attribute:$v.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,s.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Ov.join("|")+")\\b"}]}}function fd(e){const t=e.regex,s=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),n=/[\p{L}0-9._:-]+/u,r={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:n,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[r]},{begin:/'/,end:/'/,contains:[r]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,a,l,o]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},r,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(s,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:s,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(s,/>/))),contains:[{className:"name",begin:s,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Mv(e){const t=e.regex,s=e.COMMENT("--","$"),n={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],d=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=u,b=[...c,...l].filter(A=>!u.includes(A)),v={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},T={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},R={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function k(A){return t.concat(/\b/,t.either(...A.map(N=>N.replace(/\s+/,"\\s+"))),/\b/)}const x={scope:"keyword",match:k(f),relevance:0};function E(A,{exceptions:N,when:O}={}){const L=O;return N=N||[],A.map(D=>D.match(/\|\d+$/)||N.includes(D)?D:L(D)?`${D}|0`:D)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:E(b,{when:A=>A.length<3}),literal:i,type:o,built_in:d},contains:[{scope:"type",match:k(a)},x,R,v,n,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,s,T]}}function pd(e){const t="true false yes no null",s="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},b={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},v={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},T=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+s},{className:"type",begin:"!<"+s+">"},{className:"type",begin:"!"+s},{className:"type",begin:"!!"+s},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},f,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},b,v,i,a],R=[...T];return R.pop(),R.push(o),p.contains=R,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:T}}function gd(e){const t=e.regex,s={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},n={begin:"^[-\\*]{3,}",end:"$"},r={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=e.inherit(c,{contains:[]}),f=e.inherit(u,{contains:[]});c.contains.push(f),u.contains.push(d);let p=[s,l];return[c,u,d,f].forEach(R=>{R.contains=R.contains.concat(p)}),p=p.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},s,i,c,u,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},r,n,l,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}Ge.registerLanguage("typescript",ad);Ge.registerLanguage("ts",ad);Ge.registerLanguage("javascript",ud);Ge.registerLanguage("js",ud);Ge.registerLanguage("python",dd);Ge.registerLanguage("py",dd);Ge.registerLanguage("bash",hd);Ge.registerLanguage("sh",hd);Ge.registerLanguage("json",Tv);Ge.registerLanguage("css",Lv);Ge.registerLanguage("html",fd);Ge.registerLanguage("xml",fd);Ge.registerLanguage("sql",Mv);Ge.registerLanguage("yaml",pd);Ge.registerLanguage("yml",pd);Ge.registerLanguage("markdown",gd);Ge.registerLanguage("md",gd);function At(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").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,(t,s,n)=>`<a href="${/^https?:\/\//i.test(n)||n.startsWith("/")||n.startsWith("#")?n:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${s}</a>`)}function md(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Pl(e){return md(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Ni(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function jv(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function Dv(e){if(e.length<2)return e.map(o=>`<p class="my-1">${At(o)}</p>`).join(`
|
|
75
|
+
`);const t=Ni(e[0]),s=e[1],n=Pl(s)?Ni(s).map(jv):t.map(()=>"text-left"),r=Pl(s)?e.slice(2):e.slice(1),i=t.map((o,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${n[l]??"text-left"}">${At(o)}</th>`).join(""),a=r.map(o=>{const l=Ni(o);return`<tr class="border-b border-gray-800">${t.map((u,d)=>`<td class="px-3 py-1.5 text-gray-400 ${n[d]??"text-left"}">${At(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>${a}</tbody></table></div>`}function Uv(e){if(!e.startsWith(`---
|
|
76
|
+
`)&&e!=="---")return{frontmatter:null,body:e};const t=e.indexOf(`
|
|
77
|
+
---
|
|
78
|
+
`,3),s=e.indexOf(`
|
|
79
|
+
---`,3),n=t!==-1?t:s!==-1&&e.slice(s).trimEnd()==="---"?s:-1;if(n===-1)return{frontmatter:null,body:e};const r=e.slice(4,n),i=t!==-1?e.slice(t+5):"",a={};for(const o of r.split(`
|
|
80
|
+
`)){const l=o.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)),a[c]=u}return{frontmatter:Object.keys(a).length>0?a:null,body:i}}function ls(e){if(!e)return"";const t=e.split(`
|
|
81
|
+
`),s=[];let n=!1,r=null,i=!1,a=!1,o=[],l="",c=[];function u(){r&&(s.push(`</${r}>`),r=null)}function d(){a&&(s.push(Dv(c)),c=[],a=!1)}function f(){i&&(s.push("</blockquote>"),i=!1)}for(const p of t){if(p.startsWith("```")){if(u(),d(),!n)n=!0,l=p.slice(3).trim().split(/\s+/)[0].toLowerCase(),o=[];else{const A=o.join(`
|
|
82
|
+
`);let N;try{N=l&&Ge.getLanguage(l)?Ge.highlight(A,{language:l,ignoreIllegals:!0}).value:Ge.highlightAuto(A).value}catch{N=A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const O=l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),L=O?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${O}</span>`:"";s.push(`<div class="relative my-2"><pre class="bg-surface-1 border border-edge rounded-xl p-3 overflow-x-auto"><code class="hljs font-mono text-xs">${N}</code></pre>${L}</div>`),n=!1,l="",o=[]}continue}if(n){o.push(p);continue}if(md(p)){u(),a=!0,c.push(p);continue}a&&d();const b=p.match(/^####\s+(.+)/),v=p.match(/^###\s+(.+)/),T=p.match(/^##\s+(.+)/),R=p.match(/^#\s+(.+)/);if(b){u(),f(),s.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${At(b[1])}</h4>`);continue}if(v){u(),f(),s.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${At(v[1])}</h3>`);continue}if(T){u(),f(),s.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${At(T[1])}</h2>`);continue}if(R){u(),f(),s.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${At(R[1])}</h1>`);continue}if(/^---+$/.test(p.trim())){u(),f(),s.push('<hr class="border-gray-800 my-4" />');continue}const k=p.match(/^[-*+]\s+(.+)/);if(k){r==="ol"&&u(),f(),r||(s.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),r="ul"),s.push(`<li>${At(k[1])}</li>`);continue}const x=p.match(/^\d+\.\s+(.+)/);if(x){r==="ul"&&u(),f(),r||(s.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),r="ol"),s.push(`<li>${At(x[1])}</li>`);continue}const E=p.match(/^>\s?(.*)/);if(E){u(),i||(s.push('<blockquote class="border-l-2 border-txt-muted pl-3 my-2 text-txt-muted italic">'),i=!0),s.push(`<p class="my-0">${At(E[1])}</p>`);continue}if(p.trim()===""){u(),f(),s.push('<div class="my-2"></div>');continue}u(),f(),s.push(`<p class="my-1">${At(p)}</p>`)}if(n&&o.length){const p=o.join(`
|
|
83
|
+
`).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");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">${p}</code></pre>`)}return d(),u(),f(),s.join(`
|
|
84
|
+
`)}const Bv={class:"fixed bottom-4 right-4 z-50 flex flex-col items-end"},Hv={key:0,class:"mb-3 w-[400px] h-[500px] max-w-[calc(100vw-2rem)] max-h-[calc(100vh-6rem)] flex flex-col rounded-2xl bg-surface-2 border border-edge shadow-card overflow-hidden"},Fv={class:"flex items-center justify-between px-4 py-2.5 border-b border-edge/50 bg-surface-3/50"},Vv={key:0,class:"flex flex-col items-center justify-center h-full select-none"},qv={key:0,class:"max-w-[80%] px-3 py-2 rounded-xl rounded-br-sm text-xs whitespace-pre-wrap bg-accent/[0.12] text-txt-primary border border-accent/20"},zv={key:1,class:"max-w-[85%] flex gap-2 items-start"},Kv=["innerHTML"],Wv={key:0,class:"flex justify-start"},Gv={class:"shrink-0 border-t border-edge/50 p-2.5 bg-surface-3/30"},Zv=["disabled"],Jv=["disabled"],Yv={key:0,class:"absolute top-0 right-0 w-3 h-3 rounded-full bg-accent border-2 border-surface-2 shadow-glow-sm"},Xv={key:1,class:"absolute inset-0 rounded-full border-2 border-accent/60 animate-ping pointer-events-none"},Qv={key:2,class:"absolute inset-0 rounded-full border border-accent/30 animate-pulse pointer-events-none"},e1='<span class="stream-cursor"></span>',t1=st({__name:"FloatingChat",setup(e){const t=Bu(),s=q(!1),n=q(""),r=q(null),i=q(null),a=q(!1),o=q(t.messages.length),l=Ne(()=>t.messages.some(v=>v.streaming));function c(){s.value=!0,a.value=!1,o.value=t.messages.length,zt(()=>u())}function u(){zt(()=>{r.value&&r.value.scrollTo({top:r.value.scrollHeight,behavior:"instant"})})}vt(()=>t.messages.length,v=>{if(s.value)u(),o.value=v;else{const T=t.messages[v-1];v>o.value&&(T==null?void 0:T.role)==="assistant"&&(a.value=!0)}}),vt(()=>{var v;return(v=t.messages[t.messages.length-1])==null?void 0:v.content},()=>{s.value&&u()});function d(v){v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),b())}function f(){const v=i.value;v&&(v.style.height="auto",v.style.height=Math.min(v.scrollHeight,100)+"px")}async function p(){try{await Se("/api/orchestrator/abort",{method:"POST"})}catch{}}async function b(){const v=n.value.trim();if(!v||t.isLoading)return;n.value="",zt(()=>{i.value&&(i.value.style.height="auto")}),t.isLoading=!0,t.addMessage({id:crypto.randomUUID(),role:"user",content:v}),t.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),u();const T=new EventSource(await ir("/api/events"));T.onmessage=R=>{try{const k=JSON.parse(R.data);k.type==="delta"?t.appendToLast(k.text):k.type==="done"&&(t.setLastStreaming(!1),t.isLoading=!1,T.close())}catch{}},T.onerror=()=>{t.setLastStreaming(!1),t.isLoading=!1,T.close()};try{await Se("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:v})})}catch{t.appendToLast(`
|
|
85
|
+
|
|
86
|
+
[Error: failed to reach IO]`),t.setLastStreaming(!1),t.isLoading=!1,T.close()}}return(v,T)=>(g(),m("div",Bv,[de(rn,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 scale-90 translate-y-4","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-90 translate-y-4"},{default:Kt(()=>[s.value?(g(),m("div",Hv,[h("div",Fv,[T[2]||(T[2]=h("div",{class:"flex items-center gap-2"},[h("div",{class:"w-5 h-5 rounded-md bg-accent/10 border border-accent/20 flex items-center justify-center"},[h("span",{class:"text-accent text-[9px] font-bold font-mono"},"IO")]),h("span",{class:"text-xs font-semibold text-txt-primary"},"Chat")],-1)),h("button",{onClick:T[0]||(T[0]=R=>s.value=!1),class:"p-1 rounded-lg text-txt-muted hover:text-txt-primary hover:bg-surface-2 transition-all duration-150",title:"Minimize"},[de(Ee,{paths:'<path d="M3.5 10a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1h-13Z"/>',size:14})])]),h("div",{ref_key:"messagesEl",ref:r,class:"flex-1 overflow-y-auto px-3 py-3 space-y-3"},[Re(t).messages.length===0?(g(),m("div",Vv,[...T[3]||(T[3]=[h("div",{class:"w-10 h-10 rounded-xl bg-accent/10 border border-accent/20 flex items-center justify-center mb-3"},[h("span",{class:"text-accent font-bold text-sm font-mono"},"IO")],-1),h("p",{class:"text-txt-muted text-xs"},"Send a message to start",-1)])])):(g(),m(we,{key:1},[(g(!0),m(we,null,Me(Re(t).messages,R=>(g(),m("div",{key:R.id,class:ce(["flex",R.role==="user"?"justify-end":"justify-start"])},[R.role==="user"?(g(),m("div",qv,C(R.content),1)):(g(),m("div",zv,[T[4]||(T[4]=h("div",{class:"shrink-0 w-5 h-5 rounded-md bg-surface-3/60 border border-edge flex items-center justify-center mt-0.5"},[h("span",{class:"text-accent text-[8px] font-bold font-mono"},"IO")],-1)),h("div",{class:"floating-chat-md min-w-0 px-3 py-2 rounded-xl rounded-tl-sm text-xs bg-surface-0/60 text-txt-primary border border-edge/50",innerHTML:Re(ls)(R.content)+(R.streaming?e1:"")},null,8,Kv)]))],2))),128)),Re(t).isLoading&&!l.value?(g(),m("div",Wv,[...T[5]||(T[5]=[h("div",{class:"flex gap-2 items-start"},[h("div",{class:"shrink-0 w-5 h-5 rounded-md bg-surface-3/60 border border-edge flex items-center justify-center"},[h("span",{class:"text-accent text-[8px] font-bold font-mono"},"IO")]),h("div",{class:"px-3 py-2 rounded-xl rounded-tl-sm bg-surface-0/60 border border-edge/50 flex items-center gap-1"},[h("span",{class:"thinking-dot",style:{"animation-delay":"0s"}}),h("span",{class:"thinking-dot",style:{"animation-delay":"0.15s"}}),h("span",{class:"thinking-dot",style:{"animation-delay":"0.3s"}})])],-1)])])):B("",!0)],64))],512),h("div",Gv,[h("form",{onSubmit:Ye(b,["prevent"]),class:"flex gap-2 items-end"},[Be(h("textarea",{ref_key:"inputEl",ref:i,"onUpdate:modelValue":T[1]||(T[1]=R=>n.value=R),placeholder:"Message IO…",disabled:Re(t).isLoading,rows:"1",class:"flex-1 bg-surface-0/50 border border-edge rounded-lg px-3 py-2 text-xs text-txt-primary placeholder:text-txt-muted/60 resize-none overflow-hidden focus:outline-none focus:border-accent/40 disabled:opacity-40 transition-all duration-150",onKeydown:d,onInput:f},null,40,Zv),[[ze,n.value]]),Re(t).isLoading?(g(),m("button",{key:0,type:"button",onClick:p,class:"shrink-0 w-8 h-8 rounded-lg flex items-center justify-center bg-red-500/15 text-red-400 border border-red-500/25 hover:bg-red-500/25 transition-all duration-150",title:"Stop"},[...T[6]||(T[6]=[h("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)])])):(g(),m("button",{key:1,type:"submit",disabled:!n.value.trim(),class:"shrink-0 w-8 h-8 rounded-lg flex items-center justify-center bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 disabled:opacity-25 disabled:cursor-not-allowed transition-all duration-150",title:"Send"},[de(Ee,{paths:'<path d="M2.18 2.11a.5.5 0 0 1 .54-.06l15 7.5a.5.5 0 0 1 0 .9l-15 7.5a.5.5 0 0 1-.7-.58L3.98 10 2.02 2.63a.5.5 0 0 1 .16-.52Zm2.7 8.39-1.61 6.06L16.38 10 3.27 3.44 4.88 9.5h6.62a.5.5 0 1 1 0 1H4.88Z"/>',size:14})],8,Jv))],32)])])):B("",!0)]),_:1}),s.value?B("",!0):(g(),m("button",{key:0,onClick:c,class:"w-12 h-12 rounded-full bg-accent/15 border border-accent/25 text-accent flex items-center justify-center shadow-glow-sm hover:bg-accent/25 hover:border-accent/40 hover:shadow-glow transition-all duration-200 relative",title:"Open chat"},[de(Ee,{paths:'<path d="M10 2a8 8 0 1 1-3.61 15.14l-3.05.92a.75.75 0 0 1-.92-.93l.94-3.05A8 8 0 0 1 10 2Zm0 1a7 7 0 0 0-5.87 10.77.75.75 0 0 1 .07.56l-.72 2.34 2.32-.7a.75.75 0 0 1 .57.07A7 7 0 1 0 10 3Z"/>',size:22}),a.value?(g(),m("span",Yv)):B("",!0),Re(t).isLoading?(g(),m("span",Xv)):B("",!0),Re(t).isLoading?(g(),m("span",Qv)):B("",!0)]))]))}}),s1=pn(t1,[["__scopeId","data-v-5b741a03"]]),n1={class:"flex h-screen bg-surface-0 relative overflow-hidden"},r1={class:"flex-1 overflow-auto relative z-0 pb-16 md:pb-0"},i1=st({__name:"App",setup(e){return(t,s)=>(g(),m("div",n1,[s[1]||(s[1]=hn('<div class="pointer-events-none absolute inset-0 overflow-hidden" aria-hidden="true" data-v-8f8c3140><div class="absolute -top-[30%] -right-[15%] w-[65%] h-[70%] rounded-full bg-accent/[0.03] blur-[160px]" data-v-8f8c3140></div><div class="absolute -bottom-[25%] -left-[15%] w-[55%] h-[55%] rounded-full bg-blue-900/[0.06] blur-[140px]" data-v-8f8c3140></div><div class="absolute top-[15%] left-[25%] w-[45%] h-[50%] rounded-full bg-indigo-950/[0.08] blur-[180px]" data-v-8f8c3140></div><div class="absolute top-0 inset-x-0 h-px bg-gradient-to-r from-transparent via-accent/[0.18] to-transparent" data-v-8f8c3140></div><div class="absolute inset-0" style="background:radial-gradient(ellipse 85% 75% at 50% 40%, transparent 45%, rgba(3, 5, 10, 0.35) 100%);" data-v-8f8c3140></div></div>',1)),de(Tb),h("main",r1,[s[0]||(s[0]=h("div",{class:"pointer-events-none absolute top-0 inset-x-0 h-[2px] bg-gradient-to-r from-transparent via-accent/[0.1] to-transparent z-10","aria-hidden":"true"},null,-1)),de(Re(gu),null,{default:Kt(({Component:n})=>[de(rn,{name:"view",mode:"out-in"},{default:Kt(()=>[(g(),Bt(Rh(n)))]),_:2},1024)]),_:1})]),de(s1)]))}}),a1=pn(i1,[["__scopeId","data-v-8f8c3140"]]),o1={key:0,class:"absolute inset-0 z-20 flex items-center justify-center bg-surface-0/80 backdrop-blur-sm border-2 border-dashed border-accent/50 rounded-none pointer-events-none"},l1={key:0,class:"flex flex-col items-center justify-center h-full select-none animate-fade-in"},c1={class:"flex flex-wrap justify-center gap-2 mt-8 max-w-md"},u1=["onClick"],d1={key:1,class:"max-w-3xl mx-auto space-y-5"},h1={key:0,class:"max-w-[80%] rounded-2xl rounded-br-md text-sm bg-gradient-to-br from-accent/[0.14] to-accent/[0.08] text-txt-primary border border-accent/20 shadow-glow-sm overflow-hidden"},f1={key:0,class:"flex flex-wrap gap-1.5 p-2 pb-0"},p1=["src","alt"],g1={key:1,class:"flex items-center gap-1.5 bg-surface-2/50 border border-edge rounded-lg px-2 py-1.5 text-xs text-txt-secondary"},m1={class:"truncate max-w-[120px]"},b1={key:1,class:"px-4 py-2.5 whitespace-pre-wrap"},v1={key:2,class:"px-4 py-2.5 whitespace-pre-wrap"},y1={key:1,class:"max-w-[85%] flex gap-2.5 items-start"},_1=["innerHTML"],x1={key:0,class:"flex justify-start animate-fade-in"},w1={class:"shrink-0 border-t border-edge/50 backdrop-blur-md p-3 sm:p-4",style:{background:"linear-gradient(180deg, rgba(12,18,32,0.75) 0%, rgba(8,13,22,0.88) 100%)"}},k1={class:"max-w-3xl mx-auto"},E1={key:0,class:"flex items-center gap-2 mb-2 px-3 py-2 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-xs"},S1={key:0,class:"flex flex-wrap gap-1.5 mb-2"},T1=["src","alt"],A1={key:1,class:"w-8 h-8 flex items-center justify-center shrink-0 bg-surface-0/40"},R1={class:"px-1 min-w-0"},C1={class:"text-[11px] text-txt-secondary truncate max-w-[100px]"},O1={class:"text-[10px] text-txt-muted"},$1=["onClick","title"],N1=["disabled"],I1={class:"flex-1 relative group"},P1=["disabled"],L1=["disabled"],M1={class:"hidden sm:inline"},j1=["disabled"],D1=5*1024*1024,Ii=5,U1='<span class="stream-cursor"></span>',B1=st({__name:"ChatView",setup(e){const t=Bu(),s=bu(),n=q(""),r=q(!1),i=q(!1),a=q(null),o=q([]),l=q(null),c=q(!1),u=q(null),d=q(null),f=["Check squad status","Run my schedules","Summarize recent activity","What skills are installed?"],p=Ne(()=>(n.value.trim().length>0||o.value.length>0)&&!t.isLoading);function b($){return $<1024?`${$} B`:$<1024*1024?`${($/1024).toFixed(1)} KB`:`${($/(1024*1024)).toFixed(1)} MB`}function v($){o.value.splice($,1)}function T($){a.value=$,setTimeout(()=>{a.value=null},4e3)}function R($){return new Promise((y,S)=>{const H=new FileReader;H.onload=()=>{const ie=H.result,ge=ie.split(",")[1]??"";y({dataUrl:ie,base64:ge})},H.onerror=S,H.readAsDataURL($)})}async function k($){const y=Array.from($),S=Ii-o.value.length;if(S<=0){T(`Maximum ${Ii} files per message.`);return}const H=y.slice(0,S);y.length>S&&T(`Only ${S} more file(s) can be added (max ${Ii}).`);for(const ie of H){if(ie.size>D1){T(`"${ie.name}" exceeds the 5 MB limit and was skipped.`);continue}try{const{dataUrl:ge,base64:ke}=await R(ie);o.value.push({file:ie,dataUrl:ge,base64:ke,mimeType:ie.type||"application/octet-stream"})}catch{T(`Failed to read "${ie.name}".`)}}}function x($){var S;const y=$.target;(S=y.files)!=null&&S.length&&k(y.files),y.value=""}function E(){i.value=!0}function A(){i.value=!1}function N($){var y;i.value=!1,(y=$.dataTransfer)!=null&&y.files.length&&k($.dataTransfer.files)}function O($){n.value=$,zt(()=>I())}async function L(){if(!r.value){r.value=!0;try{await Se("/api/orchestrator/abort",{method:"POST"})}catch{}finally{r.value=!1}}}const D=Ne(()=>t.messages.some($=>$.streaming));function W(){const $=l.value;$&&(c.value=$.scrollTop+$.clientHeight<$.scrollHeight-100)}function ne($=!0){zt(()=>{l.value&&l.value.scrollTo({top:l.value.scrollHeight,behavior:$?"smooth":"instant"})})}yt(()=>{ne(!1)}),vt(()=>s.name,$=>{$==="chat"&&ne(!1)}),vt(()=>t.messages.length,()=>{c.value||ne()});function ee($){$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),I())}function X(){const $=u.value;$&&($.style.height="auto",$.style.height=Math.min($.scrollHeight,200)+"px")}async function I(){const $=n.value.trim(),y=[...o.value];if(!$&&!y.length||t.isLoading)return;const S=$||"Please analyze these files.",H=y.map(ke=>({type:"blob",data:ke.base64,mimeType:ke.mimeType,displayName:ke.file.name}));n.value="",o.value=[],zt(()=>{u.value&&(u.value.style.height="auto")}),t.isLoading=!0;const ie={id:crypto.randomUUID(),role:"user",content:$,...H.length?{attachments:H}:{}};t.addMessage(ie),t.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),ne();const ge=new EventSource(await ir("/api/events"));ge.onmessage=ke=>{try{const Ae=JSON.parse(ke.data);Ae.type==="delta"?(t.appendToLast(Ae.text),ne()):Ae.type==="done"&&(t.setLastStreaming(!1),t.isLoading=!1,ge.close(),ne())}catch{}},ge.onerror=()=>{t.setLastStreaming(!1),t.isLoading=!1,ge.close()};try{await Se("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:S,...H.length?{attachments:H}:{}})})}catch{t.appendToLast(`
|
|
87
|
+
|
|
88
|
+
[Error: failed to reach IO]`),t.setLastStreaming(!1),t.isLoading=!1,ge.close()}}return($,y)=>(g(),m("div",{class:"flex flex-col h-full relative bg-surface-0",onDragover:Ye(E,["prevent"]),onDragleave:A,onDrop:Ye(N,["prevent"])},[de(rn,{name:"fade"},{default:Kt(()=>[i.value?(g(),m("div",o1,[...y[2]||(y[2]=[h("div",{class:"flex flex-col items-center gap-2 text-accent"},[h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-10 h-10 opacity-80","aria-hidden":"true"},[h("path",{d:"M9.25 13.25a.75.75 0 0 0 1.5 0V4.636l2.955 3.129a.75.75 0 0 0 1.09-1.03l-4.25-4.5a.75.75 0 0 0-1.09 0l-4.25 4.5a.75.75 0 1 0 1.09 1.03L9.25 4.636v8.614Z"}),h("path",{d:"M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"})]),h("span",{class:"text-sm font-medium"},"Drop files to attach")],-1)])])):B("",!0)]),_:1}),h("div",{ref_key:"messagesEl",ref:l,class:"flex-1 overflow-y-auto px-3 py-4 sm:px-4 sm:py-6",onScroll:W},[Re(t).messages.length===0?(g(),m("div",l1,[y[3]||(y[3]=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[4]||(y[4]=h("p",{class:"text-txt-secondary text-sm font-medium mb-1"},"What can I help you build?",-1)),y[5]||(y[5]=h("p",{class:"text-txt-muted text-xs"},"Send a message to start a conversation",-1)),h("div",c1,[(g(),m(we,null,Me(f,S=>h("button",{key:S,onClick:H=>O(S),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"},C(S),9,u1)),64))])])):(g(),m("div",d1,[(g(!0),m(we,null,Me(Re(t).messages,S=>{var H;return g(),m("div",{key:S.id,class:ce(["flex animate-fade-in",S.role==="user"?"justify-end":"justify-start"])},[S.role==="user"?(g(),m("div",h1,[S.attachments&&S.attachments.length?(g(),m("div",f1,[(g(!0),m(we,null,Me(S.attachments,(ie,ge)=>(g(),m(we,{key:ge},[ie.mimeType.startsWith("image/")?(g(),m("img",{key:0,src:`data:${ie.mimeType};base64,${ie.data}`,alt:ie.displayName??"attachment",class:"w-20 h-20 object-cover rounded-lg border border-accent/20"},null,8,p1)):(g(),m("div",g1,[y[6]||(y[6]=h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-3.5 h-3.5 shrink-0 text-txt-muted","aria-hidden":"true"},[h("path",{d:"M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"})],-1)),h("span",m1,C(ie.displayName??"file"),1)]))],64))),128))])):B("",!0),S.content?(g(),m("div",b1,C(S.content),1)):(H=S.attachments)!=null&&H.length?B("",!0):(g(),m("div",v1,C(S.content),1))])):(g(),m("div",y1,[y[7]||(y[7]=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:Re(ls)(S.content)+(S.streaming?U1:"")},null,8,_1)]))],2)}),128)),Re(t).isLoading&&!D.value?(g(),m("div",x1,[...y[8]||(y[8]=[hn('<div class="flex gap-2.5 items-start" data-v-d4e21ed9><div class="shrink-0 w-6 h-6 rounded-lg bg-surface-3/60 border border-edge flex items-center justify-center" data-v-d4e21ed9><span class="text-accent text-[10px] font-bold font-mono" data-v-d4e21ed9>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-d4e21ed9><span class="thinking-dot" style="animation-delay:0s;" data-v-d4e21ed9></span><span class="thinking-dot" style="animation-delay:0.15s;" data-v-d4e21ed9></span><span class="thinking-dot" style="animation-delay:0.3s;" data-v-d4e21ed9></span></div></div>',1)])])):B("",!0)]))],544),de(rn,{name:"scroll-btn"},{default:Kt(()=>[c.value?(g(),m("button",{key:0,onClick:ne,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"},[de(Ee,{paths:'<path d="M15.85 7.65c.2.2.2.5 0 .7l-5.46 5.49a.55.55 0 0 1-.78 0L4.15 8.35a.5.5 0 1 1 .7-.7L10 12.8l5.15-5.16c.2-.2.5-.2.7 0Z"/>',size:16})])):B("",!0)]),_:1}),h("div",w1,[h("div",k1,[de(rn,{name:"fade"},{default:Kt(()=>[a.value?(g(),m("div",E1,[y[9]||(y[9]=h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-3.5 h-3.5 shrink-0","aria-hidden":"true"},[h("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z","clip-rule":"evenodd"})],-1)),fe(" "+C(a.value),1)])):B("",!0)]),_:1}),o.value.length?(g(),m("div",S1,[(g(!0),m(we,null,Me(o.value,(S,H)=>(g(),m("div",{key:H,class:"flex items-center gap-1.5 bg-surface-2/60 border border-edge rounded-lg overflow-hidden hover:border-edge-bright transition-colors duration-150 group"},[S.mimeType.startsWith("image/")?(g(),m("img",{key:0,src:S.dataUrl,alt:S.file.name,class:"w-8 h-8 object-cover shrink-0"},null,8,T1)):(g(),m("div",A1,[...y[10]||(y[10]=[h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-4 h-4 text-txt-muted","aria-hidden":"true"},[h("path",{d:"M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"})],-1)])])),h("div",R1,[h("p",C1,C(S.file.name),1),h("p",O1,C(b(S.file.size)),1)]),h("button",{type:"button",onClick:ie=>v(H),class:"pr-1.5 text-txt-muted hover:text-red-400 transition-colors duration-150 opacity-0 group-hover:opacity-100",title:`Remove ${S.file.name}`,"aria-label":"Remove attachment"},[...y[11]||(y[11]=[h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-3.5 h-3.5","aria-hidden":"true"},[h("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})],-1)])],8,$1)]))),128))])):B("",!0),h("form",{onSubmit:Ye(I,["prevent"]),class:"flex gap-2 items-end"},[h("input",{ref_key:"fileInputEl",ref:d,type:"file",multiple:"",accept:"image/*,.pdf,.txt,.md,.json,.csv,.ts,.js,.py,.html,.css,.xml,.yaml,.yml,.toml",class:"hidden",onChange:x},null,544),h("button",{type:"button",onClick:y[0]||(y[0]=S=>{var H;return(H=d.value)==null?void 0:H.click()}),disabled:Re(t).isLoading,class:"shrink-0 w-10 h-10 rounded-xl flex items-center justify-center bg-surface-2/60 border border-edge text-txt-muted hover:text-accent hover:border-accent/30 hover:bg-accent/5 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150",title:"Attach files"},[...y[12]||(y[12]=[h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-4 h-4","aria-hidden":"true"},[h("path",{"fill-rule":"evenodd",d:"M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a1.5 1.5 0 0 0 2.122 2.121l7-6.999a.75.75 0 1 1 1.06 1.06l-7 7a3 3 0 0 1-4.242-4.242l7-7a4.5 4.5 0 0 1 6.364 6.364l-7 7a6 6 0 0 1-8.486-8.486l7-7a.75.75 0 0 1 1.06 1.06Z","clip-rule":"evenodd"})],-1)])],8,N1),h("div",I1,[Be(h("textarea",{ref_key:"inputEl",ref:u,"onUpdate:modelValue":y[1]||(y[1]=S=>n.value=S),placeholder:"Message IO…",disabled:Re(t).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:ee,onInput:X},null,40,P1),[[ze,n.value]])]),Re(t).isLoading?(g(),m("button",{key:0,type:"button",onClick:L,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[13]||(y[13]=h("span",{class:"w-2.5 h-2.5 rounded-[3px] bg-red-400"},null,-1)),h("span",M1,C(r.value?"Stopping…":"Stop"),1)],8,L1)):(g(),m("button",{key:1,type:"submit",disabled:!p.value,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"},[de(Ee,{paths:'<path d="M2.18 2.11a.5.5 0 0 1 .54-.06l15 7.5a.5.5 0 0 1 0 .9l-15 7.5a.5.5 0 0 1-.7-.58L3.98 10 2.02 2.63a.5.5 0 0 1 .16-.52Zm2.7 8.39-1.61 6.06L16.38 10 3.27 3.44 4.88 9.5h6.62a.5.5 0 1 1 0 1H4.88Z"/>',size:16})],8,j1))],32)])])],32))}}),H1=pn(B1,[["__scopeId","data-v-d4e21ed9"]]),F1={class:"flex flex-col h-full bg-surface-0"},V1={key:0,class:"flex flex-col h-full overflow-hidden animate-fade-in"},q1={class:"flex items-center gap-3 px-3 sm:px-6 py-3.5 border-b border-edge/70 shrink-0 backdrop-blur-sm",style:{background:"linear-gradient(180deg, rgba(19,27,46,0.9) 0%, rgba(12,18,32,0.85) 100%)"}},z1={class:"text-base font-semibold text-txt-primary truncate"},K1={class:"text-[11px] text-txt-muted font-mono shrink-0 bg-surface-2/60 px-1.5 py-0.5 rounded"},W1={key:0,class:"flex-1 flex items-center justify-center"},G1={key:1,class:"flex-1 p-6"},Z1={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"},J1={key:2,class:"flex-1 overflow-y-auto p-6 skill-content text-sm text-txt-secondary leading-relaxed"},Y1={key:0,class:"mb-6 bg-surface-2/60 border border-edge rounded-xl p-5"},X1={key:0,class:"mb-3"},Q1={class:"text-base font-semibold text-txt-primary"},ey={key:1,class:"mb-3"},ty={class:"text-sm text-txt-secondary"},sy={class:"flex flex-wrap gap-6 mt-1"},ny={key:0},ry={class:"text-sm text-accent font-mono"},iy={key:1},ay={class:"text-sm text-txt-secondary"},oy={key:2,class:"mt-3 pt-3 border-t border-edge grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 items-baseline"},ly={class:"text-[10px] text-txt-muted uppercase tracking-wider whitespace-nowrap"},cy={class:"text-xs text-txt-secondary font-mono"},uy=["innerHTML"],dy={key:1,class:"flex-1 overflow-y-auto p-3 sm:p-6"},hy={class:"max-w-3xl"},fy={class:"mb-6 bg-surface-2/40 border border-edge rounded-xl p-4"},py={class:"flex gap-1 mb-3"},gy={class:"flex gap-2"},my=["disabled"],by=["disabled"],vy={class:"flex flex-col gap-2"},yy=["disabled"],_y=["disabled"],xy=["disabled"],wy={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"},ky={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"},Ey={key:2,class:"mb-4"},Sy={key:3,class:"flex items-center justify-center py-16"},Ty={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"},Ay={key:5,class:"text-txt-muted text-sm text-center py-16"},Ry={key:6,class:"text-txt-muted text-sm text-center py-12"},Cy={key:7,class:"grid gap-3"},Oy=["onClick"],$y={class:"flex justify-between items-start mb-1.5"},Ny={class:"min-w-0"},Iy={class:"font-semibold text-txt-primary text-sm group-hover:text-accent transition-colors duration-150"},Py={class:"text-[11px] text-txt-muted font-mono mt-0.5"},Ly=["onClick"],My={class:"text-xs text-txt-secondary mb-2 line-clamp-2"},jy={class:"text-[10px] text-txt-muted font-mono truncate"},Dy=st({__name:"SkillsView",setup(e){const t=q([]),s=q(!0),n=q(null),r=q(""),i=q(!1),a=q(null),o=q(null),l=q("url"),c=q(""),u=q(""),d=q(!1),f=q(null),p=q(""),b=q(!1),v=q(null),T=Ne(()=>Uv(p.value)),R=Ne(()=>T.value.frontmatter),k=Ne(()=>ls(T.value.body)),x=["name","description","version","author"],E=Ne(()=>R.value?Object.entries(R.value).filter(([X])=>!x.includes(X)):[]),A=q(""),N=Ne(()=>{const X=A.value.toLowerCase().trim();return X?t.value.filter(I=>I.name.toLowerCase().includes(X)||I.slug.toLowerCase().includes(X)||(I.description??"").toLowerCase().includes(X)):t.value});async function O(X){f.value=X,p.value="",v.value=null,b.value=!0;try{const I=await Se(`/api/skills/${encodeURIComponent(X.slug)}`);if(I.status===404)v.value="Skill not found";else if(!I.ok)v.value=`Failed to load skill (HTTP ${I.status})`;else{const $=await I.json();p.value=$.content??""}}catch(I){v.value=I instanceof Error?I.message:"Failed to load skill"}finally{b.value=!1}}function L(){f.value=null,p.value="",v.value=null}async function D(){try{const X=await Se("/api/skills");if(!X.ok)throw new Error(`HTTP error! status: ${X.status}`);const I=await X.json();t.value=I.skills}catch(X){n.value=X instanceof Error?X.message:"Failed to load skills"}finally{s.value=!1}}async function W(){if(!(i.value||r.value.trim()==="")){i.value=!0,a.value=null,o.value=null;try{const X=await Se("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoUrl:r.value.trim()})});if(X.ok){const I=await X.json();t.value=[I.skill,...t.value],r.value="",o.value=`✓ Installed: ${I.skill.name}`,setTimeout(()=>{o.value=null},4e3),D()}else{let I="Install failed";try{I=(await X.json()).error??X.statusText??I}catch{I=X.statusText||I}a.value=I}}catch(X){a.value=X instanceof Error?X.message:"Install failed"}finally{i.value=!1}}}async function ne(){if(!(d.value||c.value.trim()===""||u.value.trim()==="")){d.value=!0,a.value=null,o.value=null;try{const X=await Se("/api/skills/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u.value.trim(),slug:c.value.trim()})});if(X.ok){const I=await X.json();t.value=[I.skill,...t.value],c.value="",u.value="",o.value=`✓ Installed: ${I.skill.name}`,setTimeout(()=>{o.value=null},4e3),D()}else{let I="Install failed";try{I=(await X.json()).error??X.statusText??I}catch{I=X.statusText||I}a.value=I}}catch(X){a.value=X instanceof Error?X.message:"Install failed"}finally{d.value=!1}}}async function ee(X){if(confirm(`Delete skill "${X.name}"? This cannot be undone.`))try{const I=await Se(`/api/skills/${encodeURIComponent(X.slug)}`,{method:"DELETE"});if(I.ok)t.value=t.value.filter($=>$.slug!==X.slug),o.value=`✓ Deleted: ${X.name}`,setTimeout(()=>{o.value=null},3e3);else{const $=await I.json().catch(()=>({}));a.value=$.error??(I.status===404?"Skill not found":`Delete failed (HTTP ${I.status})`)}}catch(I){a.value=I instanceof Error?I.message:"Delete failed"}}return yt(D),(X,I)=>(g(),m("div",F1,[f.value?(g(),m("div",V1,[h("div",q1,[h("button",{onClick:L,class:"text-txt-muted hover:text-accent transition-colors flex items-center gap-1.5 text-sm group"},[de(Ee,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14,class:"transition-transform group-hover:-translate-x-0.5"}),I[6]||(I[6]=fe(" Back ",-1))]),I[7]||(I[7]=h("div",{class:"w-px h-5 bg-edge"},null,-1)),h("h2",z1,C(f.value.name),1),h("span",K1,C(f.value.slug),1)]),b.value?(g(),m("div",W1,[...I[8]||(I[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"}),fe(" Loading… ")],-1)])])):v.value?(g(),m("div",G1,[h("div",Z1,[I[9]||(I[9]=h("span",null,"⚠",-1)),fe(" "+C(v.value),1)])])):(g(),m("div",J1,[R.value?(g(),m("div",Y1,[R.value.name?(g(),m("div",X1,[I[10]||(I[10]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Name",-1)),h("p",Q1,C(R.value.name),1)])):B("",!0),R.value.description?(g(),m("div",ey,[I[11]||(I[11]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Description",-1)),h("p",ty,C(R.value.description),1)])):B("",!0),h("div",sy,[R.value.version?(g(),m("div",ny,[I[12]||(I[12]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Version",-1)),h("p",ry,C(R.value.version),1)])):B("",!0),R.value.author?(g(),m("div",iy,[I[13]||(I[13]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-widest mb-0.5"},"Author",-1)),h("p",ay,C(R.value.author),1)])):B("",!0)]),E.value.length>0?(g(),m("dl",oy,[(g(!0),m(we,null,Me(E.value,([$,y])=>(g(),m(we,{key:$},[h("dt",ly,C($),1),h("dd",cy,C(y),1)],64))),128))])):B("",!0)])):B("",!0),h("div",{innerHTML:k.value},null,8,uy)]))])):(g(),m("div",dy,[h("div",hy,[I[19]||(I[19]=hn('<div class="flex items-end justify-between mb-6" data-v-20b3d95d><div data-v-20b3d95d><h2 class="text-xl font-bold text-txt-primary tracking-tight" data-v-20b3d95d>Skills</h2><p class="text-xs text-txt-muted mt-0.5" data-v-20b3d95d>Manage installed Copilot skills</p></div><div class="flex items-center gap-2" data-v-20b3d95d><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-20b3d95d><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-20b3d95d><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-20b3d95d></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-20b3d95d><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-20b3d95d><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-20b3d95d></path></svg> skills.sh </a></div></div>',1)),h("div",fy,[h("div",py,[h("button",{type:"button",onClick:I[0]||(I[0]=$=>l.value="url"),class:ce(["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:I[1]||(I[1]=$=>l.value="paste"),class:ce(["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"?(g(),m("form",{key:0,onSubmit:Ye(W,["prevent"])},[h("div",gy,[Be(h("input",{"onUpdate:modelValue":I[2]||(I[2]=$=>r.value=$),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,my),[[ze,r.value]]),h("button",{type:"submit",disabled:i.value||r.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"},C(i.value?"Installing…":"Install"),9,by)])],32)):(g(),m("form",{key:1,onSubmit:Ye(ne,["prevent"])},[h("div",vy,[h("div",null,[Be(h("input",{"onUpdate:modelValue":I[3]||(I[3]=$=>c.value=$),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,yy),[[ze,c.value]]),I[14]||(I[14]=h("p",{class:"text-[10px] text-txt-muted mt-1 ml-1"},"Unique identifier (lowercase, hyphens ok)",-1))]),Be(h("textarea",{"onUpdate:modelValue":I[4]||(I[4]=$=>u.value=$),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,_y),[[ze,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"},C(d.value?"Installing…":"Install"),9,xy)])],32))]),o.value?(g(),m("div",wy,[I[15]||(I[15]=h("span",null,"✓",-1)),fe(" "+C(o.value),1)])):B("",!0),a.value?(g(),m("div",ky,[I[16]||(I[16]=h("span",null,"⚠",-1)),fe(" "+C(a.value),1)])):B("",!0),!s.value&&!n.value&&t.value.length>0?(g(),m("div",Ey,[Be(h("input",{"onUpdate:modelValue":I[5]||(I[5]=$=>A.value=$),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),[[ze,A.value]])])):B("",!0),s.value?(g(),m("div",Sy,[...I[17]||(I[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"}),fe(" Loading skills… ")],-1)])])):n.value?(g(),m("div",Ty,[I[18]||(I[18]=h("span",null,"⚠",-1)),fe(" "+C(n.value),1)])):t.value.length===0?(g(),m("div",Ay," No skills installed yet ")):N.value.length===0?(g(),m("div",Ry," No matching skills ")):(g(),m("div",Cy,[(g(!0),m(we,null,Me(N.value,$=>(g(),m("div",{key:$.slug,onClick:y=>O($),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",$y,[h("div",Ny,[h("h3",Iy,C($.name),1),h("p",Py,C($.slug),1)]),h("button",{onClick:Ye(y=>ee($),["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"},[de(Ee,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,Ly)]),h("p",My,C($.description),1),h("p",jy,C($.path),1)],8,Oy))),128))]))])]))]))}}),Uy=pn(Dy,[["__scopeId","data-v-20b3d95d"]]),By={class:"space-y-3"},Hy={class:"flex items-center justify-between"},Fy={class:"flex items-center gap-2 pt-1"},Vy=["disabled"],qy={key:0,class:"text-[10px] text-red-400"},zy={key:1,class:"flex items-center gap-2 text-txt-muted text-xs py-2"},Ky={key:2,class:"text-red-400 text-xs py-1"},Wy={key:3,class:"text-txt-muted text-xs italic py-1"},Gy={key:4,class:"space-y-2"},Zy={class:"flex items-center gap-2 px-3 py-2"},Jy={class:"flex-1 min-w-0"},Yy={class:"flex items-center gap-1.5"},Xy={class:"text-xs font-medium text-txt-primary truncate"},Qy={class:"text-[10px] text-txt-muted font-mono truncate"},e_={class:"flex items-center gap-1 shrink-0"},t_=["onClick","title"],s_=["onClick","disabled"],n_=["onClick","disabled"],r_={class:"px-3 pb-2 flex items-center gap-3 text-[10px] text-txt-muted"},i_={key:0},a_={key:0,class:"border-t border-edge/50 px-3 py-2 bg-surface-0/40 animate-fade-in"},o_={key:0,class:"flex items-center gap-2 text-txt-muted text-[10px] py-1"},l_={key:1,class:"text-txt-muted text-[10px] italic py-1"},c_={key:2,class:"space-y-2"},u_={class:"flex items-start gap-1.5"},d_=["title"],h_={key:0,class:"w-1.5 h-1.5 rounded-full bg-green-400"},f_={class:"flex-1 min-w-0"},p_={class:"text-txt-secondary"},g_={key:0,class:"text-txt-muted mt-0.5 leading-relaxed"},m_={class:"text-txt-muted/60 mt-0.5"},b_={key:1,class:"px-3 pb-2 text-[10px] text-red-400"},v_=st({__name:"SquadInstances",props:{squadSlug:{}},setup(e){const t=e,s=q([]),n=q(!1),r=q(null),i=q(!1),a=q(new Set),o=lt({}),l=lt({}),c=lt({}),u=lt({}),d=q(!1),f=q(!1),p=q(null),b=lt({issueRef:"",baseBranch:""});function v(L){switch(L){case"active":return"bg-green-500/15 text-green-400 border-green-500/25";case"pending":return"bg-yellow-500/15 text-yellow-400 border-yellow-500/25";case"merging":return"bg-accent/15 text-accent border-accent/25";case"done":return"bg-surface-3/50 text-txt-muted border-edge";case"failed":return"bg-red-500/15 text-red-400 border-red-500/25";default:return"bg-surface-3/50 text-txt-muted border-edge"}}function T(L){return L==="active"||L==="pending"}function R(L){try{const D=L.includes("T")||L.endsWith("Z")?L:L.replace(" ","T")+"Z";return new Date(D).toLocaleString()}catch{return L}}async function k(){n.value=!0,r.value=null;try{const L=`/api/squads/${t.squadSlug}/instances${i.value?"?include_completed=true":""}`,D=await Se(L);if(!D.ok)throw new Error(`HTTP ${D.status}`);const W=await D.json();s.value=W.instances??[]}catch(L){r.value=L instanceof Error?L.message:"Failed to load instances"}finally{n.value=!1}}async function x(L){const D=new Set(a.value);if(D.has(L)){D.delete(L),a.value=D;return}if(D.add(L),a.value=D,!o[L]){l[L]=!0;try{const W=await Se(`/api/squads/${t.squadSlug}/instances/${L}`);if(!W.ok)throw new Error(`HTTP ${W.status}`);const ne=await W.json();o[L]=ne.decisions??[]}catch{o[L]=[]}finally{l[L]=!1}}}async function E(L){c[L]="completing",u[L]=null;try{const D=await Se(`/api/squads/${t.squadSlug}/instances/${L}/complete`,{method:"POST"});if(!D.ok)throw new Error(`HTTP ${D.status}`);await k(),a.value.has(L)&&(delete o[L],await x(L))}catch(D){u[L]=D instanceof Error?D.message:"Complete failed"}finally{c[L]=null}}async function A(L){c[L]="aborting",u[L]=null;try{const D=await Se(`/api/squads/${t.squadSlug}/instances/${L}/abort`,{method:"POST"});if(!D.ok)throw new Error(`HTTP ${D.status}`);await k()}catch(D){u[L]=D instanceof Error?D.message:"Abort failed"}finally{c[L]=null}}async function N(){const L=b.issueRef.trim();if(L){f.value=!0,p.value=null;try{const D={issue_ref:L};b.baseBranch.trim()&&(D.base_branch=b.baseBranch.trim());const W=await Se(`/api/squads/${t.squadSlug}/instances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)});if(!W.ok){const ne=await W.json().catch(()=>({error:`HTTP ${W.status}`}));throw new Error(ne.error??`HTTP ${W.status}`)}b.issueRef="",b.baseBranch="",d.value=!1,await k()}catch(D){p.value=D instanceof Error?D.message:"Failed to create instance"}finally{f.value=!1}}}async function O(){i.value=!i.value,await k()}return vt(()=>t.squadSlug,()=>k()),yt(()=>k()),(L,D)=>(g(),m("div",By,[h("div",Hy,[D[3]||(D[3]=h("h4",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider"},"Instances",-1)),h("button",{onClick:D[0]||(D[0]=W=>d.value=!d.value),class:ce(["flex items-center gap-1 text-[10px] font-medium px-2 py-1 rounded-md transition-all duration-150",d.value?"bg-surface-3/50 text-txt-secondary border border-edge hover:bg-surface-3/70":"bg-accent/10 text-accent border border-accent/20 hover:bg-accent/20"])},[d.value?B("",!0):(g(),Bt(Ee,{key:0,paths:'<path d="M10 3a.5.5 0 0 1 .5.5v6h6a.5.5 0 0 1 0 1h-6v6a.5.5 0 0 1-1 0v-6h-6a.5.5 0 0 1 0-1h6v-6A.5.5 0 0 1 10 3Z"/>',size:10})),fe(" "+C(d.value?"Cancel":"New Instance"),1)],2)]),d.value?(g(),m("form",{key:0,onSubmit:Ye(N,["prevent"]),class:"bg-surface-3/30 border border-edge rounded-lg p-3 space-y-2 animate-fade-in"},[Be(h("input",{"onUpdate:modelValue":D[1]||(D[1]=W=>b.issueRef=W),type:"text",placeholder:"Issue ref (e.g. #231 or feature-auth)",class:"w-full bg-surface-0/50 border border-edge rounded-md px-3 py-1.5 text-xs text-txt-primary placeholder:text-txt-muted/60 focus:outline-none focus:border-accent/40 transition-all duration-150"},null,512),[[ze,b.issueRef]]),Be(h("input",{"onUpdate:modelValue":D[2]||(D[2]=W=>b.baseBranch=W),type:"text",placeholder:"Base branch (default: main)",class:"w-full bg-surface-0/50 border border-edge rounded-md px-3 py-1.5 text-xs text-txt-primary placeholder:text-txt-muted/60 focus:outline-none focus:border-accent/40 transition-all duration-150"},null,512),[[ze,b.baseBranch]]),h("div",Fy,[h("button",{type:"submit",disabled:f.value||!b.issueRef.trim(),class:"flex-1 bg-accent/15 text-accent border border-accent/25 px-3 py-1.5 rounded-md text-xs font-medium hover:bg-accent/25 disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-150"},C(f.value?"Spawning…":"Spawn Instance"),9,Vy)]),p.value?(g(),m("p",qy,C(p.value),1)):B("",!0)],32)):B("",!0),n.value?(g(),m("div",zy,[...D[4]||(D[4]=[h("span",{class:"w-3 h-3 border-2 border-edge border-t-accent rounded-full animate-spin shrink-0"},null,-1),fe(" Loading instances… ",-1)])])):r.value?(g(),m("div",Ky,C(r.value),1)):s.value.length===0?(g(),m("div",Wy," No active instances ")):(g(),m("div",Gy,[(g(!0),m(we,null,Me(s.value,W=>(g(),m("div",{key:W.id,class:"bg-surface-2/50 border border-edge rounded-lg overflow-hidden animate-fade-in"},[h("div",Zy,[h("span",{class:ce(["shrink-0 text-[9px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded border",v(W.status)])},C(W.status),3),h("div",Jy,[h("div",Yy,[h("span",Xy,C(W.issue_ref??W.id),1)]),h("p",Qy,C(W.branch_name),1)]),h("div",e_,[h("button",{onClick:ne=>x(W.id),class:"p-1 rounded text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 transition-all duration-150",title:a.value.has(W.id)?"Hide decisions":"Show decisions"},[de(Ee,{paths:'<path d="M7.47 4.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1-1.06 1.06L8 5.81 3.28 10.53a.75.75 0 0 1-1.06-1.06l5.25-5.25Z"/>',size:12,class:ce(["transition-transform duration-150",a.value.has(W.id)?"rotate-180":""])},null,8,["class"])],8,t_),T(W.status)?(g(),m("button",{key:0,onClick:ne=>E(W.id),disabled:!!c[W.id],class:"text-[10px] font-medium px-2 py-1 rounded-md bg-green-500/10 text-green-400 border border-green-500/20 hover:bg-green-500/20 disabled:opacity-40 transition-all duration-150",title:"Merge decisions back and complete"},C(c[W.id]==="completing"?"Merging…":"Complete"),9,s_)):B("",!0),T(W.status)?(g(),m("button",{key:1,onClick:ne=>A(W.id),disabled:!!c[W.id],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",title:"Abort — worktree preserved for debugging"},C(c[W.id]==="aborting"?"Aborting…":"Abort"),9,n_)):B("",!0)])]),h("div",r_,[h("span",null,"Created "+C(R(W.created_at)),1),W.completed_at?(g(),m("span",i_,"· Completed "+C(R(W.completed_at)),1)):B("",!0)]),a.value.has(W.id)?(g(),m("div",a_,[l[W.id]?(g(),m("div",o_,[...D[5]||(D[5]=[h("span",{class:"w-2.5 h-2.5 border border-edge border-t-accent rounded-full animate-spin"},null,-1),fe(" Loading decisions… ",-1)])])):!o[W.id]||o[W.id].length===0?(g(),m("div",l_," No decisions logged yet ")):(g(),m("ul",c_,[(g(!0),m(we,null,Me(o[W.id],(ne,ee)=>(g(),m("li",{key:ee,class:"text-[10px] leading-snug"},[h("div",u_,[h("span",{class:ce(["shrink-0 mt-0.5 w-3 h-3 rounded-full border flex items-center justify-center",ne.merged_to_master?"border-green-500/40 bg-green-500/10":"border-edge bg-surface-3/40"]),title:ne.merged_to_master?"Merged to master":"Pending merge"},[ne.merged_to_master?(g(),m("span",h_)):B("",!0)],10,d_),h("div",f_,[h("p",p_,C(ne.decision),1),ne.context?(g(),m("p",g_,C(ne.context),1)):B("",!0),h("p",m_,C(R(ne.created_at)),1)])])]))),128))]))])):B("",!0),u[W.id]?(g(),m("div",b_,C(u[W.id]),1)):B("",!0)]))),128)),h("button",{onClick:O,class:"w-full text-center text-[10px] text-txt-muted hover:text-txt-secondary py-1 transition-colors duration-150"},C(i.value?"Hide completed":"Show completed instances"),1)]))]))}}),y_={class:"flex flex-col h-full bg-surface-0"},__={class:"flex-1 overflow-y-auto p-3 sm:p-6"},x_={class:"max-w-4xl"},w_={class:"flex justify-between items-end mb-6"},k_={class:"space-y-3"},E_=["disabled"],S_={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"},T_={key:1,class:"flex items-center justify-center py-16"},A_={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"},R_={key:3,class:"text-txt-muted text-sm text-center py-16"},C_={key:4,class:"grid gap-3"},O_=["onClick","aria-expanded"],$_={class:"flex justify-between items-start mb-2"},N_={class:"flex-1 flex items-center gap-2.5"},I_={class:"min-w-0"},P_={class:"font-semibold text-txt-primary text-sm"},L_={class:"text-[11px] text-txt-muted font-mono"},M_={class:"flex items-center gap-2 shrink-0"},j_={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"},D_={class:"text-xs text-txt-muted font-mono ml-6"},U_={key:0,class:"border-t border-edge px-4 pb-4 pt-3 animate-fade-in"},B_={class:"flex justify-between items-center text-[10px] text-txt-muted mb-3"},H_={key:0,class:"font-mono"},F_={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-3"},V_={key:1,class:"text-red-400 text-xs py-2"},q_={key:2,class:"text-txt-muted text-xs italic py-2"},z_={key:3,class:"space-y-1.5"},K_={class:"flex-1 min-w-0"},W_={class:"flex items-center gap-1.5"},G_={class:"text-sm font-medium text-txt-primary truncate"},Z_={key:0,title:"Team Lead",class:"text-xs"},J_={key:1,title:"QA / Veto Power",class:"text-xs"},Y_={class:"text-[10px] text-txt-muted"},X_={class:"flex items-center gap-1 shrink-0"},Q_=["onClick"],ex=["onClick","disabled"],tx={class:"mt-4 pt-4 border-t border-edge/40"},sx=["onClick"],nx={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"},rx={class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},ix={class:"text-sm font-semibold text-txt-primary flex items-center gap-2"},ax={class:"text-xs font-normal text-txt-muted"},ox={class:"text-[10px] text-txt-muted mt-0.5 flex items-center gap-1.5"},lx={class:"flex items-center gap-3"},cx={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},ux={key:0,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},dx={key:1,class:"text-txt-muted italic text-center py-8"},hx={class:"shrink-0"},fx={class:"flex-1 min-w-0"},px={class:"text-txt-secondary break-words"},gx={class:"text-txt-muted text-[10px] ml-2"},mx={key:0,class:"text-txt-muted italic text-center py-4"},bx={class:"flex justify-between items-center mb-1"},vx={class:"text-accent"},yx={class:"text-txt-muted text-[10px]"},_x={class:"text-txt-secondary whitespace-pre-wrap break-words"},xx=st({__name:"SquadsView",setup(e){const t=new Set(["system"]),s={"a-team":"The A-Team",transformers:"Transformers",thundercats:"ThunderCats","gi-joe":"G.I. Joe",aliens:"Aliens",ghostbusters:"Ghostbusters"},n=q([]),r=q(!0),i=q(null),a=q(!1),o=q(!1),l=q(null),c=lt({}),u=lt({}),d=lt({});function f(M){return[...M].sort((U,Q)=>{const j=ae=>ae.is_lead?0:ae.is_qa?1:2;return j(U)-j(Q)})}const p=lt({}),b=lt({}),v=q(new Set),T=q(null),R=q([]),k=q(null),x=q(!1),E=q(!0),A=q(null);let N=null;const O=Ne(()=>k.value?"Disconnected":x.value?"Live":"Connecting…"),L=Ne(()=>R.value.filter(M=>!(!M.summary||t.has(M.summary.kind)||M.type==="assistant.message_delta"))),D=M=>{try{return new Date(M).toLocaleTimeString()}catch{return""}},W=M=>{const U=M.data;if(!U||typeof U!="object")return"";if(typeof U.deltaContent=="string")return U.deltaContent;if(typeof U.content=="string")return U.content;if(typeof U.text=="string")return U.text;try{return JSON.stringify(U,null,2)}catch{return String(U)}},ne=()=>{zt(()=>{const M=A.value;M&&(M.scrollTop=M.scrollHeight)})},ee=async M=>{if(!M.currentTaskId)return;X(),T.value=M,R.value=[],k.value=null,x.value=!1,E.value=!0;const U=await ir(`/api/tasks/${encodeURIComponent(M.currentTaskId)}/events`),Q=new EventSource(U);N=Q,Q.onopen=()=>{x.value=!0},Q.onmessage=j=>{try{const ae=JSON.parse(j.data);R.value.push(ae),ne()}catch{}},Q.onerror=()=>{x.value=!1,R.value.length===0&&(k.value="Connection error. Retrying…")}},X=()=>{if(N){try{N.close()}catch{}N=null}T.value=null,R.value=[],k.value=null,x.value=!1};ka(()=>{X()});const I=async(M,U)=>{if(!v.value.has(U)){v.value=new Set(v.value).add(U);try{await Se(`/api/tasks/${encodeURIComponent(U)}/cancel`,{method:"POST"}),await ke(M,!0)}catch(Q){b[M]=Q instanceof Error?Q.message:"Failed to stop task"}finally{const Q=new Set(v.value);Q.delete(U),v.value=Q}}},$=q({slug:"",name:"",projectPath:""}),y=M=>M?s[M]??M:"",S=M=>new Date(M).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),H=M=>!!c[M],ie=async M=>{c[M]=!c[M],c[M]&&!d[M]&&!p[M]&&await ke(M)},ge=M=>{u[M]=!u[M]},ke=async(M,U=!1)=>{if(!(!U&&p[M])){p[M]=!0,b[M]=null;try{const Q=await Se(`/api/squads/${encodeURIComponent(M)}/agents`);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);const j=await Q.json();d[M]=j.agents}catch(Q){b[M]=Q instanceof Error?Q.message:"Failed to load agents"}finally{p[M]=!1}}},Ae=async()=>{try{const M=await Se("/api/squads");if(!M.ok)throw new Error(`HTTP error! status: ${M.status}`);const U=await M.json();n.value=U.squads}catch(M){i.value=M instanceof Error?M.message:"Failed to load squads"}finally{r.value=!1}},J=async()=>{if(!$.value.slug||!$.value.name||!$.value.projectPath){l.value="All fields are required";return}o.value=!0,l.value=null;try{const M=await Se("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:$.value.slug,name:$.value.name,projectPath:$.value.projectPath})});if(!M.ok)throw new Error(`HTTP error! status: ${M.status}`);$.value={slug:"",name:"",projectPath:""},a.value=!1,await Ae()}catch(M){l.value=M instanceof Error?M.message:"Failed to create squad"}finally{o.value=!1}};return yt(()=>{Ae()}),(M,U)=>(g(),m("div",y_,[h("div",__,[h("div",x_,[h("div",w_,[U[5]||(U[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:U[0]||(U[0]=Q=>a.value=!a.value),class:ce(["px-3.5 py-2 rounded-lg text-sm font-medium transition-all duration-150",a.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"])},C(a.value?"Cancel":"New Squad"),3)]),a.value?(g(),m("form",{key:0,onSubmit:Ye(J,["prevent"]),class:"bg-surface-2/40 border border-edge rounded-xl p-5 mb-6 animate-fade-in"},[U[7]||(U[7]=h("h3",{class:"font-semibold text-txt-primary text-sm mb-4"},"Create New Squad",-1)),h("div",k_,[Be(h("input",{"onUpdate:modelValue":U[1]||(U[1]=Q=>$.value.slug=Q),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),[[ze,$.value.slug]]),Be(h("input",{"onUpdate:modelValue":U[2]||(U[2]=Q=>$.value.name=Q),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),[[ze,$.value.name]]),Be(h("input",{"onUpdate:modelValue":U[3]||(U[3]=Q=>$.value.projectPath=Q),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),[[ze,$.value.projectPath]]),h("button",{type:"submit",disabled:o.value||!$.value.slug||!$.value.name||!$.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"},C(o.value?"Creating…":"Create Squad"),9,E_)]),l.value?(g(),m("div",S_,[U[6]||(U[6]=h("span",null,"⚠",-1)),fe(" "+C(l.value),1)])):B("",!0)],32)):B("",!0),r.value?(g(),m("div",T_,[...U[8]||(U[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"}),fe(" Loading squads… ")],-1)])])):i.value?(g(),m("div",A_,[U[9]||(U[9]=h("span",null,"⚠",-1)),fe(" "+C(i.value),1)])):n.value.length===0?(g(),m("div",R_," No squads created yet ")):(g(),m("div",C_,[(g(!0),m(we,null,Me(n.value,Q=>(g(),m("div",{key:Q.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:j=>ie(Q.slug),class:"w-full text-left p-4 focus:outline-none","aria-expanded":H(Q.slug)},[h("div",$_,[h("div",N_,[de(Ee,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:14,class:ce(["text-txt-muted transition-transform duration-200 shrink-0",H(Q.slug)?"rotate-90":""])},null,8,["class"]),h("div",I_,[h("h3",P_,C(Q.name),1),h("p",L_,C(Q.slug),1)])]),h("div",M_,[Q.universe?(g(),m("span",j_," 🎬 "+C(y(Q.universe)),1)):B("",!0),h("span",{class:ce(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",Q.status==="working"?"bg-accent/10 text-accent border border-accent/20":Q.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:ce(["w-1.5 h-1.5 rounded-full",Q.status==="working"?"bg-accent animate-pulse":Q.status==="error"?"bg-red-400":"bg-txt-muted/50"])},null,2),fe(" "+C(Q.status),1)],2)])]),h("p",D_,"📁 "+C(Q.project_path),1)],8,O_),H(Q.slug)?(g(),m("div",U_,[h("div",B_,[Q.model?(g(),m("span",H_,"Model: "+C(Q.model),1)):B("",!0),h("span",null,C(S(Q.created_at)),1)]),U[14]||(U[14]=h("h4",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-2"},"Team Roster",-1)),p[Q.slug]?(g(),m("div",F_,[...U[10]||(U[10]=[h("span",{class:"w-3 h-3 border-2 border-edge border-t-accent rounded-full animate-spin"},null,-1),fe(" Loading agents… ",-1)])])):b[Q.slug]?(g(),m("div",V_,C(b[Q.slug]),1)):!d[Q.slug]||d[Q.slug].length===0?(g(),m("div",q_," No agents assigned yet ")):(g(),m("ul",z_,[(g(!0),m(we,null,Me(f(d[Q.slug]??[]),j=>(g(),m("li",{key:j.id??j.character_name,class:ce(["flex items-center gap-3 rounded-lg px-3 py-2 transition-all duration-150",j.status==="working"?"bg-accent/[0.06] border border-accent/15":"bg-surface-1/50 border border-edge"])},[h("div",{class:ce(["w-7 h-7 rounded-full flex items-center justify-center shrink-0 text-[10px] font-bold",j.status==="working"?"bg-accent/15 text-accent border border-accent/25":j.status==="error"?"bg-red-500/15 text-red-400 border border-red-500/25":"bg-surface-3/60 text-txt-muted border border-edge"])},C((j.character_name??"?").charAt(0).toUpperCase()),3),h("div",K_,[h("div",W_,[h("span",G_,C(j.character_name),1),j.is_lead?(g(),m("span",Z_,"👑")):B("",!0),j.is_qa?(g(),m("span",J_,"🛡️")):B("",!0)]),h("span",Y_,C(j.role_title),1)]),h("span",{class:ce(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",j.status==="working"?"bg-accent/10 text-accent":j.status==="error"?"bg-red-500/10 text-red-400":"bg-surface-3/40 text-txt-muted"])},[h("span",{class:ce(["w-1.5 h-1.5 rounded-full",j.status==="working"?"bg-accent animate-pulse":j.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),fe(" "+C(j.status),1)],2),h("div",X_,[j.status==="working"&&j.currentTaskId?(g(),m("button",{key:0,type:"button",onClick:ae=>ee(j),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"},[...U[11]||(U[11]=[h("span",{"aria-hidden":"true"},"👁",-1),fe(" Preview ",-1)])],8,Q_)):B("",!0),j.status==="working"&&j.currentTaskId?(g(),m("button",{key:1,type:"button",onClick:ae=>I(Q.slug,j.currentTaskId),disabled:v.value.has(j.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"},[U[12]||(U[12]=h("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),fe(" "+C(v.value.has(j.currentTaskId)?"Stopping…":"Stop"),1)],8,ex)):B("",!0)])],2))),128))])),h("div",tx,[h("button",{type:"button",onClick:j=>ge(Q.slug),class:"flex items-center gap-1.5 mb-3 text-[10px] text-txt-muted hover:text-txt-secondary transition-colors duration-150"},[de(Ee,{paths:'<path d="M7.47 4.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1-1.06 1.06L8 5.81 3.28 10.53a.75.75 0 0 1-1.06-1.06l5.25-5.25Z"/>',size:11,class:ce(["transition-transform duration-150",u[Q.slug]?"rotate-180":""])},null,8,["class"]),U[13]||(U[13]=h("span",{class:"font-semibold uppercase tracking-wider"},"Instances",-1))],8,sx),u[Q.slug]?(g(),Bt(v_,{key:0,"squad-slug":Q.slug,class:"animate-fade-in"},null,8,["squad-slug"])):B("",!0)])])):B("",!0)]))),128))]))])]),T.value?(g(),m("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:Ye(X,["self"])},[h("div",nx,[h("div",rx,[h("div",null,[h("h3",ix,[fe(C(T.value.character_name)+" ",1),h("span",ax,"— "+C(T.value.role_title),1)]),h("p",ox,[h("span",{class:ce(["inline-block w-1.5 h-1.5 rounded-full",x.value?"bg-emerald-400 animate-pulse":"bg-txt-muted/50"])},null,2),fe(" "+C(O.value),1)])]),h("div",lx,[h("label",cx,[Be(h("input",{type:"checkbox","onUpdate:modelValue":U[4]||(U[4]=Q=>E.value=Q),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[Zc,E.value]]),U[15]||(U[15]=fe(" Summary ",-1))]),h("button",{type:"button",onClick:X,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:A,class:"overflow-y-auto p-4 space-y-2 flex-1 font-mono text-xs"},[k.value?(g(),m("div",ux,C(k.value),1)):R.value.length===0?(g(),m("div",dx," Waiting for activity… ")):E.value?(g(),m(we,{key:2},[(g(!0),m(we,null,Me(L.value,(Q,j)=>(g(),m("div",{key:j,class:"flex items-start gap-2 py-1.5 px-1"},[h("span",hx,C(Q.summary.icon),1),h("div",fx,[h("span",px,C(Q.summary.summary),1),h("span",gx,C(D(Q.ts)),1)])]))),128)),L.value.length===0?(g(),m("div",mx," Processing… ")):B("",!0)],64)):(g(!0),m(we,{key:3},Me(R.value,(Q,j)=>(g(),m("div",{key:j,class:"border border-edge rounded-lg p-2.5 bg-surface-0"},[h("div",bx,[h("span",vx,C(Q.type),1),h("span",yx,C(D(Q.ts)),1)]),h("pre",_x,C(W(Q)),1)]))),128))],512),h("div",{class:"px-4 py-3 border-t border-edge flex justify-end"},[h("button",{type:"button",onClick:X,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 ")])])])):B("",!0)]))}}),wx={class:"flex flex-col h-full bg-surface-0"},kx={class:"flex-1 overflow-y-auto p-3 sm:p-6"},Ex={class:"max-w-4xl"},Sx={class:"flex justify-between items-end mb-6"},Tx=["disabled"],Ax={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"},Rx={class:"mb-8"},Cx={key:0,class:"flex items-center justify-center py-10"},Ox={key:1,class:"text-txt-muted text-sm text-center py-10"},$x={key:2,class:"grid gap-3"},Nx={class:"flex justify-between items-start mb-2.5"},Ix={class:"flex items-center gap-3 min-w-0"},Px={class:"min-w-0"},Lx={class:"font-semibold text-txt-primary text-sm"},Mx={class:"flex items-center gap-1.5 mt-0.5 flex-wrap"},jx={class:"text-[10px] text-txt-muted font-mono"},Dx={key:0,class:"text-[10px] text-txt-secondary bg-surface-3/50 px-1.5 py-0.5 rounded border border-edge"},Ux={key:1,class:"text-[10px] text-purple-300 bg-purple-500/10 px-1.5 py-0.5 rounded border border-purple-500/20"},Bx=["title"],Hx={key:0,class:"bg-surface-0/60 border border-edge rounded-lg p-3 mb-2.5 ml-12"},Fx={class:"text-sm text-txt-primary break-words"},Vx={class:"flex justify-between items-center ml-12"},qx={class:"text-[10px] text-txt-muted"},zx=["onClick","disabled"],Kx={key:0,class:"flex items-center justify-center py-10"},Wx={key:1,class:"text-txt-muted text-sm text-center py-10"},Gx={key:2,class:"relative"},Zx={class:"space-y-1"},Jx=["onClick"],Yx={class:"flex justify-between items-start gap-3"},Xx={class:"min-w-0 flex-1"},Qx={class:"flex items-center gap-2 mb-0.5"},ew={class:"text-sm font-medium text-txt-primary truncate group-hover:text-accent transition-colors"},tw={key:0,class:"text-[10px] text-txt-muted bg-surface-3/40 px-1.5 py-0.5 rounded border border-edge"},sw={class:"text-xs text-txt-secondary truncate"},nw={class:"text-[10px] text-txt-muted mt-1"},rw={key:0},iw={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},aw={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"},ow={class:"overflow-y-auto p-5 space-y-4"},lw={key:0,class:"flex items-center justify-center py-10"},cw={key:1,class:"bg-red-500/10 text-red-400 border border-red-500/20 p-3 rounded-lg text-sm"},uw={class:"flex justify-between items-start gap-3"},dw={class:"text-sm text-txt-primary font-medium"},hw={key:0,class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},fw={class:"text-[11px] text-txt-muted font-mono break-all bg-surface-0/60 px-2 py-1 rounded border border-edge"},pw={key:0},gw={class:"text-sm text-txt-secondary"},mw={class:"grid grid-cols-2 gap-4"},bw={class:"text-sm text-txt-secondary"},vw={class:"text-sm text-txt-secondary"},yw={key:1},_w={class:"text-sm text-accent font-mono"},xw=["innerHTML"],ww={class:"flex justify-between items-center mb-2"},kw={class:"flex items-center gap-1.5 text-[10px] text-txt-muted cursor-pointer select-none"},Ew={key:0,class:"text-sm text-txt-muted italic"},Sw={key:1,class:"text-sm text-txt-muted italic"},Tw={key:2,class:"bg-surface-0/60 border border-edge rounded-lg divide-y divide-edge max-h-96 overflow-y-auto"},Aw=["onClick"],Rw={class:"shrink-0"},Cw={class:"flex-1 break-words"},Ow={class:"text-[10px] text-txt-muted shrink-0"},$w={key:0,class:"mt-2 pl-6 space-y-1"},Nw={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"},Iw={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"},Pw={class:"text-[10px] text-txt-muted font-mono"},Lw=["innerHTML"],Mw={key:1,class:"text-sm text-txt-muted italic"},jw={class:"px-5 py-3 border-t border-edge flex justify-between items-center"},Dw=["disabled"],Uw={key:1},Bw=st({__name:"AgentActivityView",setup(e){const t=q([]),s=Ne(()=>t.value.filter(J=>J.status!=="idle")),n=q([]),r=q(!0),i=q(null),a=q(new Set),o=q(null),l=q(null),c=q(!1),u=q(null),d=q([]),f=q(!1),p=q(!1),b=q(new Set),v=Ne(()=>p.value?d.value:d.value.filter(J=>!(J.rawType==="assistant.message"&&(!J.detail||!J.detail.trim())||J.rawType.includes("tool.execution_complete")&&J.status==="success")));let T=null,R=null,k=null;const x=J=>J.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}),E=J=>{if(!J)return"";const M=J.includes("T")?J:J.replace(" ","T")+"Z",U=new Date(M);return Number.isNaN(U.getTime())?J:U.toLocaleString()},A=J=>{switch(J){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"}},N=Ne(()=>{if(!l.value)return null;const J=l.value.started_at,M=l.value.completed_at;if(!J||!M)return null;const U=new Date(J.includes("T")?J:J.replace(" ","T")+"Z").getTime(),Q=new Date(M.includes("T")?M:M.replace(" ","T")+"Z").getTime();if(Number.isNaN(U)||Number.isNaN(Q))return null;const j=Math.max(0,Math.round((Q-U)/1e3));if(j<60)return`${j}s`;const ae=Math.floor(j/60),oe=j%60;return`${ae}m ${oe}s`}),O=async J=>{if(!a.value.has(J)){a.value=new Set(a.value).add(J);try{await Se(`/api/tasks/${encodeURIComponent(J)}/cancel`,{method:"POST"}),await W(),o.value===J&&await ne(J)}catch(M){i.value=M instanceof Error?M.message:"Failed to stop task"}finally{const M=new Set(a.value);M.delete(J),a.value=M}}},L=async()=>{try{const J=await Se("/api/agents");if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);const M=await J.json();t.value=M.agents}catch(J){i.value=J instanceof Error?J.message:"Failed to load agents"}},D=async()=>{try{const J=await Se("/api/tasks?limit=50");if(!J.ok)throw new Error(`HTTP error! status: ${J.status}`);const M=await J.json();n.value=M.tasks}catch(J){i.value=J instanceof Error?J.message:"Failed to load tasks"}},W=async()=>{r.value=!0,i.value=null;try{await Promise.all([L(),D()])}finally{r.value=!1}},ne=async J=>{c.value=!0,u.value=null;try{const M=await Se(`/api/tasks/${encodeURIComponent(J)}`);if(!M.ok)throw new Error(`HTTP error! status: ${M.status}`);const U=await M.json();l.value=U.task}catch(M){u.value=M instanceof Error?M.message:"Failed to load task",l.value=null}finally{c.value=!1}},ee=J=>{if(!J)return"";const M=new Date(J);return Number.isNaN(M.getTime())?"":M.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},X=J=>{try{return JSON.stringify(J,null,2)}catch{return String(J)}},I=J=>{if(J.status==="success")return"text-emerald-300";if(J.status==="error")return"text-red-300";if(J.status==="pending")return"text-accent";switch(J.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"}},$=J=>{if(p.value)return;const M=new Set(b.value);M.has(J)?M.delete(J):M.add(J),b.value=M},y=async(J,M={})=>{M.initial&&(f.value=!0);try{const U=await Se(`/api/tasks/${encodeURIComponent(J)}/activity`);if(!U.ok)return;const Q=await U.json();d.value=Q.activity??[]}catch{}finally{M.initial&&(f.value=!1)}},S=J=>{R||(R=setTimeout(()=>{R=null,o.value===J&&y(J)},250))},H=async J=>{ie(),y(J,{initial:!0});try{T=new EventSource(await ir(`/api/tasks/${encodeURIComponent(J)}/events`)),T.onmessage=()=>{S(J)},T.onerror=()=>{}}catch{T=null}},ie=()=>{T&&(T.close(),T=null),R&&(clearTimeout(R),R=null)},ge=J=>{o.value=J,l.value=null,d.value=[],b.value=new Set,ne(J),H(J)},ke=()=>{o.value=null,l.value=null,u.value=null,d.value=[],b.value=new Set,ie()},Ae=J=>{J.key==="Escape"&&o.value&&ke()};return vt(o,J=>{J?document.addEventListener("keydown",Ae):document.removeEventListener("keydown",Ae)}),yt(()=>{W(),k=setInterval(W,5e3)}),vt(()=>{var J;return(J=l.value)==null?void 0:J.status},J=>{J&&J!=="running"&&(o.value&&y(o.value),ie())}),tr(()=>{k&&clearInterval(k),document.removeEventListener("keydown",Ae),ie()}),(J,M)=>(g(),m("div",wx,[h("div",kx,[h("div",Ex,[h("div",Sx,[M[2]||(M[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:W,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"},C(r.value?"Refreshing…":"Refresh"),9,Tx)]),i.value?(g(),m("div",Ax,[M[3]||(M[3]=h("span",null,"⚠",-1)),fe(" "+C(i.value),1)])):B("",!0),h("section",Rx,[M[7]||(M[7]=h("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Active Agents",-1)),r.value&&s.value.length===0?(g(),m("div",Cx,[...M[4]||(M[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"}),fe(" Loading agents… ")],-1)])])):s.value.length===0?(g(),m("div",Ox," No active agents ")):(g(),m("div",$x,[(g(!0),m(we,null,Me(s.value,U=>(g(),m("div",{key:U.slug+(U.characterName||""),class:ce(["group bg-surface-2/40 border rounded-xl p-4 transition-all duration-200",U.status==="working"?"border-accent/20 hover:border-accent/35":"border-edge hover:border-edge-bright"])},[h("div",Nx,[h("div",Ix,[h("div",{class:ce(["w-9 h-9 rounded-xl flex items-center justify-center shrink-0 text-xs font-bold",U.status==="working"?"bg-accent/15 text-accent border border-accent/25":U.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"])},C((U.name??"?").charAt(0).toUpperCase()),3),h("div",Px,[h("h3",Lx,C(U.name),1),h("div",Mx,[h("span",jx,C(U.slug),1),U.roleTitle?(g(),m("span",Dx,C(U.roleTitle),1)):B("",!0),U.universe?(g(),m("span",Ux," 🎬 "+C(U.universe),1)):B("",!0),U.model&&U.status==="working"?(g(),m("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: ${U.model}`}," 🧠 "+C(U.model),9,Bx)):B("",!0)])])]),h("span",{class:ce(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",U.status==="working"?"bg-accent/10 text-accent border border-accent/20":U.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:ce(["w-1.5 h-1.5 rounded-full",U.status==="working"?"bg-accent animate-pulse":U.status==="error"?"bg-red-400":"bg-emerald-400"])},null,2),fe(" "+C(U.status==="working"?"Working":U.status==="error"?"Error":"Idle"),1)],2)]),U.currentTask?(g(),m("div",Hx,[M[5]||(M[5]=h("p",{class:"text-[10px] text-txt-muted uppercase tracking-wider mb-1"},"Current Task",-1)),h("p",Fx,C(U.currentTask),1)])):B("",!0),h("div",Vx,[h("div",qx," Last updated: "+C(x(new Date)),1),U.status==="working"&&U.currentTaskId?(g(),m("button",{key:0,type:"button",onClick:Q=>O(U.currentTaskId),disabled:a.value.has(U.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"},[M[6]||(M[6]=h("span",{class:"w-2 h-2 rounded-[2px] bg-red-400"},null,-1)),fe(" "+C(a.value.has(U.currentTaskId)?"Stopping…":"Stop"),1)],8,zx)):B("",!0)])],2))),128))]))]),h("section",null,[M[10]||(M[10]=h("h3",{class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider mb-3"},"Recent Activity",-1)),r.value&&n.value.length===0?(g(),m("div",Kx,[...M[8]||(M[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"}),fe(" Loading activity… ")],-1)])])):n.value.length===0?(g(),m("div",Wx," No recent activity yet ")):(g(),m("div",Gx,[M[9]||(M[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",Zx,[(g(!0),m(we,null,Me(n.value,U=>(g(),m("button",{key:U.task_id,type:"button",onClick:Q=>ge(U.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:ce(["absolute left-[11px] top-4 w-[9px] h-[9px] rounded-full border-2 z-10",U.status==="running"?"bg-accent border-accent shadow-glow-sm":U.status==="done"?"bg-emerald-400 border-emerald-400":U.status==="failed"?"bg-red-400 border-red-400":U.status==="cancelled"?"bg-amber-400 border-amber-400":"bg-surface-3 border-edge"])},null,2),h("div",Yx,[h("div",Xx,[h("div",Qx,[h("span",ew,C(U.agent_slug),1),U.origin_channel?(g(),m("span",tw,"via "+C(U.origin_channel),1)):B("",!0)]),h("p",sw,C(U.description),1),h("p",nw,[fe(C(E(U.started_at))+" ",1),U.completed_at?(g(),m("span",rw," · "+C(E(U.completed_at)),1)):B("",!0)])]),h("span",{class:ce(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium shrink-0",A(U.status)])},[U.status==="running"?(g(),m("span",iw)):B("",!0),fe(" "+C(U.status),1)],2)])],8,Jx))),128))])]))])])]),o.value?(g(),m("div",{key:0,class:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 z-50",onClick:Ye(ke,["self"])},[h("div",aw,[h("div",{class:"flex justify-between items-center px-5 py-3.5 border-b border-edge"},[M[11]||(M[11]=h("h3",{class:"text-sm font-semibold text-txt-primary"},"Task Details",-1)),h("button",{type:"button",onClick:ke,class:"text-txt-muted hover:text-txt-primary text-lg leading-none transition-colors p-1","aria-label":"Close"},"×")]),h("div",ow,[c.value?(g(),m("div",lw,[...M[12]||(M[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"}),fe(" Loading task… ")],-1)])])):u.value?(g(),m("div",cw,C(u.value),1)):l.value?(g(),m(we,{key:2},[h("div",uw,[h("div",null,[M[13]||(M[13]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Agent",-1)),h("p",dw,C(l.value.agent_slug),1)]),h("span",{class:ce(["flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium",A(l.value.status)])},[l.value.status==="running"?(g(),m("span",hw)):B("",!0),fe(" "+C(l.value.status),1)],2)]),h("div",null,[M[14]||(M[14]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Task ID",-1)),h("p",fw,C(l.value.task_id),1)]),l.value.origin_channel?(g(),m("div",pw,[M[15]||(M[15]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Origin",-1)),h("p",gw,C(l.value.origin_channel),1)])):B("",!0),h("div",mw,[h("div",null,[M[16]||(M[16]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Started",-1)),h("p",bw,C(E(l.value.started_at)),1)]),h("div",null,[M[17]||(M[17]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Completed",-1)),h("p",vw,C(l.value.completed_at?E(l.value.completed_at):"—"),1)])]),N.value?(g(),m("div",yw,[M[18]||(M[18]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Duration",-1)),h("p",_w,C(N.value),1)])):B("",!0),h("div",null,[M[19]||(M[19]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Description",-1)),h("div",{class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 wiki-content",innerHTML:Re(ls)(l.value.description)},null,8,xw)]),h("div",null,[h("div",ww,[M[21]||(M[21]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted"},"Activity",-1)),h("label",kw,[Be(h("input",{type:"checkbox","onUpdate:modelValue":M[0]||(M[0]=U=>p.value=U),class:"rounded bg-surface-3 border-edge accent-accent"},null,512),[[Zc,p.value]]),M[20]||(M[20]=fe(" Show details ",-1))])]),f.value&&d.value.length===0?(g(),m("div",Ew,"Loading activity…")):d.value.length===0?(g(),m("div",Sw,"No activity yet")):(g(),m("ul",Tw,[(g(!0),m(we,null,Me(v.value,(U,Q)=>(g(),m("li",{key:`${U.ts}-${Q}-${U.rawType}`,class:"px-3 py-2 text-sm hover:bg-surface-2/40 cursor-pointer transition-colors",onClick:j=>$(Q)},[h("div",{class:ce(["flex items-start gap-2",I(U)])},[h("span",Rw,C(U.icon),1),h("span",Cw,C(U.summary),1),h("span",Ow,C(ee(U.ts)),1)],2),p.value||b.value.has(Q)?(g(),m("div",$w,[U.detail?(g(),m("pre",Nw,C(U.detail),1)):B("",!0),h("pre",Iw,C(X(U.raw)),1),h("p",Pw,C(U.rawType),1)])):B("",!0)],8,Aw))),128))]))]),h("div",null,[M[22]||(M[22]=h("p",{class:"text-[10px] uppercase tracking-widest text-txt-muted mb-0.5"},"Result",-1)),l.value.result?(g(),m("div",{key:0,class:"text-sm text-txt-primary bg-surface-0/60 border border-edge rounded-lg p-3 wiki-content max-h-96 overflow-y-auto",innerHTML:Re(ls)(l.value.result)},null,8,Lw)):(g(),m("p",Mw,"No result yet"))])],64)):B("",!0)]),h("div",jw,[l.value&&l.value.status==="running"?(g(),m("button",{key:0,type:"button",onClick:M[1]||(M[1]=U=>O(l.value.task_id)),disabled:a.value.has(l.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"},C(a.value.has(l.value.task_id)?"Stopping…":"Stop Task"),9,Dw)):(g(),m("span",Uw)),h("button",{type:"button",onClick:ke,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 ")])])])):B("",!0)]))}}),Hw={class:"flex flex-col h-full"},Fw={class:"flex-1 overflow-y-auto p-3 sm:p-6"},Vw={class:"flex justify-between items-center mb-6"},qw=["disabled"],zw={key:0,class:"flex items-center justify-center py-16"},Kw={key:1,class:"bg-red-500/10 border border-red-500/20 text-red-400 p-4 rounded-xl mb-4 text-sm"},Ww={open:"",class:"mb-8 group/section"},Gw={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},Zw={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},Jw={key:0,class:"flex flex-col items-center py-8"},Yw={class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},Xw={key:1,class:"grid gap-3"},Qw={class:"flex flex-wrap items-start gap-3"},e5={class:"flex-1 min-w-0"},t5={class:"flex flex-wrap items-center gap-2 mb-1.5"},s5={class:"font-semibold text-txt-primary break-words min-w-0"},n5={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},r5={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},i5={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},a5={key:0,class:"flex items-center gap-1 shrink-0"},o5={key:1,class:"flex items-center gap-1 shrink-0"},l5={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},c5={class:"flex flex-wrap items-center gap-1.5"},u5=["onClick","disabled"],d5=["onClick","disabled"],h5=["onClick","disabled"],f5=["onClick"],p5=["onClick","disabled"],g5={key:0,class:"mt-3"},m5=["onClick"],b5={key:1,class:"mt-4 pt-4 border-t border-edge/50"},v5={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},y5={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},_5={key:1,class:"text-txt-muted text-xs py-2 text-center"},x5={key:2,class:"space-y-1.5"},w5={class:"flex-1 min-w-0"},k5={class:"flex flex-wrap items-center gap-2"},E5={class:"text-txt-secondary"},S5={key:0,class:"text-txt-muted mt-0.5"},T5={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},A5={open:"",class:"group/section"},R5={class:"cursor-pointer select-none flex items-center gap-3 text-sm font-semibold text-txt-primary mb-4 py-2"},C5={class:"text-[10px] font-mono text-txt-muted bg-surface-2 px-2 py-0.5 rounded-full border border-edge"},O5={key:0,class:"flex flex-col items-center py-8"},$5={class:"w-10 h-10 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-3"},N5={key:1,class:"grid gap-3"},I5={class:"flex flex-wrap items-start gap-3"},P5={class:"flex-1 min-w-0"},L5={class:"flex flex-wrap items-center gap-2 mb-1.5"},M5={class:"font-semibold text-txt-primary break-words min-w-0"},j5={class:"text-[10px] font-mono text-accent/60 bg-accent/5 px-2 py-0.5 rounded-full border border-accent/10 shrink-0"},D5={key:0,class:"w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"},U5={class:"flex flex-wrap items-center gap-3 text-xs text-txt-muted mt-1"},B5={class:"font-mono text-accent/80 bg-surface-0/60 px-2 py-0.5 rounded-lg border border-edge/50 break-all"},H5={key:0,class:"flex items-center gap-1 shrink-0"},F5={key:1,class:"flex items-center gap-1 shrink-0"},V5={key:0,class:"text-xs text-txt-muted mt-1.5 break-words"},q5={class:"flex flex-wrap items-center gap-1.5"},z5=["onClick","disabled"],K5=["onClick","disabled"],W5=["onClick","disabled"],G5=["onClick"],Z5=["onClick","disabled"],J5={key:0,class:"mt-3"},Y5=["onClick"],X5={key:1,class:"mt-4 pt-4 border-t border-edge/50"},Q5={class:"text-[10px] font-semibold text-txt-muted uppercase tracking-widest mb-3"},e2={key:0,class:"flex items-center gap-2 text-txt-muted text-xs py-2 justify-center"},t2={key:1,class:"text-txt-muted text-xs py-2 text-center"},s2={key:2,class:"space-y-1.5"},n2={class:"flex-1 min-w-0"},r2={class:"flex flex-wrap items-center gap-2"},i2={class:"text-txt-secondary"},a2={key:0,class:"text-txt-muted mt-0.5"},o2={key:1,class:"text-red-400 mt-1 break-words bg-red-500/5 rounded px-2 py-1 border border-red-500/10"},l2=st({__name:"SchedulesView",setup(e){const t=q([]),s=q([]),n=q(!0),r=q(null),i=q(new Set),a=q(new Map),o=q(new Map),l=q(new Set),c=q(new Set);function u(A){const N=A.includes("T")||A.endsWith("Z")?A:A.replace(" ","T")+"Z";return new Date(N).toLocaleString()}function d(A){return A==="done"?"bg-emerald-400":A==="failed"?"bg-red-400":"bg-accent animate-pulse"}function f(A){return A==="done"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":A==="failed"?"bg-red-500/10 text-red-400 border-red-500/20":"bg-accent/10 text-accent border-accent/20"}function p(A,N){const O=`${A}-${N}`,L=new Set(c.value);L.has(O)?L.delete(O):L.add(O),c.value=L}async function b(A,N){const O=`${A}-${N}`,L=a.value.get(O)??!1,D=new Map(a.value);if(D.set(O,!L),a.value=D,!L&&!o.value.has(O)){const W=new Set(l.value);W.add(O),l.value=W;try{const ne=await Se(`/api/schedules/${A}/${N}/runs?limit=25`);if(ne.ok){const ee=await ne.json(),X=new Map(o.value);X.set(O,ee.runs??[]),o.value=X}}catch{}finally{const ne=new Set(l.value);ne.delete(O),l.value=ne}}}async function v(){n.value=!0,r.value=null,o.value=new Map;try{const A=await Se("/api/schedules");if(!A.ok)throw new Error(`HTTP ${A.status}`);const N=await A.json();t.value=N.io,s.value=N.squads}catch(A){r.value=A instanceof Error?A.message:"Failed to load schedules"}finally{n.value=!1}}async function T(A,N){if(!i.value.has(A)){i.value=new Set(i.value).add(A);try{await N(),await v()}catch(O){r.value=O instanceof Error?O.message:"Action failed"}finally{const O=new Set(i.value);O.delete(A),i.value=O}}}async function R(A,N){await T(`${A}-${N}`,async()=>{const O=await Se(`/api/schedules/${A}/${N}/pause`,{method:"POST"});if(!O.ok)throw new Error(`HTTP ${O.status}`)})}async function k(A,N){await T(`${A}-${N}`,async()=>{const O=await Se(`/api/schedules/${A}/${N}/resume`,{method:"POST"});if(!O.ok)throw new Error(`HTTP ${O.status}`)})}async function x(A,N){await T(`${A}-${N}`,async()=>{const O=await Se(`/api/schedules/${A}/${N}/run-now`,{method:"POST"});if(!O.ok)throw new Error(`HTTP ${O.status}`)})}async function E(A,N,O){window.confirm(`Delete schedule '${O}'?`)&&await T(`${A}-${N}`,async()=>{const L=await Se(`/api/schedules/${A}/${N}`,{method:"DELETE"});if(!L.ok)throw new Error(`HTTP ${L.status}`)})}return yt(v),(A,N)=>(g(),m("div",Hw,[h("div",Fw,[h("div",Vw,[N[1]||(N[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:v,disabled:n.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"},[de(Ee,{paths:'<path d="M11.41 3.64a.5.5 0 0 0 0-.71L9.3.8a.5.5 0 0 0-.7.7l1 1a7.5 7.5 0 0 0-4.08 13.5.5.5 0 0 0 .6-.8A6.5 6.5 0 0 1 10.14 3.5L8.59 5.04a.5.5 0 0 0 .7.7l2.12-2.11ZM8.6 16.36a.5.5 0 0 0 0 .71l2.12 2.12a.5.5 0 0 0 .7-.7l-1-1a7.5 7.5 0 0 0 4.07-13.5.5.5 0 1 0-.59.8A6.5 6.5 0 0 1 9.86 16.5l1.55-1.55a.5.5 0 1 0-.7-.7l-2.12 2.11Z"/>',class:"w-3.5 h-3.5"}),N[0]||(N[0]=fe(" Refresh ",-1))],8,qw)]),n.value?(g(),m("div",zw,[...N[2]||(N[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"}),fe(" Loading schedules… ")],-1)])])):r.value?(g(),m("div",Kw,C(r.value),1)):(g(),m(we,{key:2},[h("details",Ww,[h("summary",Gw,[de(Ee,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:16,class:"text-accent transition-transform group-open/section:rotate-90"}),N[3]||(N[3]=h("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"IO Schedules",-1)),h("span",Zw,C(t.value.length),1),N[4]||(N[4]=h("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),t.value.length===0?(g(),m("div",Jw,[h("div",Yw,[de(Ee,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:20,class:"text-txt-muted"})]),N[5]||(N[5]=h("p",{class:"text-txt-muted text-sm"},"No IO schedules configured",-1))])):(g(),m("div",Xw,[(g(!0),m(we,null,Me(t.value,O=>(g(),m("div",{key:O.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",Qw,[h("div",e5,[h("div",t5,[h("span",s5,C(O.name),1),h("span",{class:ce(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",O.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[O.enabled?(g(),m("span",n5)):B("",!0),fe(" "+C(O.enabled?"Active":"Paused"),1)],2)]),h("div",r5,[h("code",i5,C(O.cron_expr),1),O.next_run_at?(g(),m("span",a5,[de(Ee,{paths:'<path d="M17.22 8.69a1.5 1.5 0 0 1 0 2.62l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Zm-.48 1.75a.5.5 0 0 0 0-.88l-10-5.5A.5.5 0 0 0 6 4.5v11c0 .38.4.62.74.44l10-5.5Z"/>',size:12}),fe(" "+C(u(O.next_run_at)),1)])):B("",!0),O.last_run_at?(g(),m("span",o5,[de(Ee,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:12}),fe(" "+C(u(O.last_run_at)),1)])):B("",!0)]),O.notes?(g(),m("p",l5,C(O.notes),1)):B("",!0)]),h("div",c5,[O.enabled?(g(),m("button",{key:0,onClick:L=>R("io",O.id),disabled:i.value.has(`io-${O.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,u5)):(g(),m("button",{key:1,onClick:L=>k("io",O.id),disabled:i.value.has(`io-${O.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,d5)),h("button",{onClick:L=>x("io",O.id),disabled:i.value.has(`io-${O.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,h5),h("button",{onClick:L=>b("io",O.id),class:ce(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",a.value.get(`io-${O.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,f5),h("button",{onClick:L=>E("io",O.id,O.name),disabled:i.value.has(`io-${O.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"},[de(Ee,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,p5)])]),O.prompt?(g(),m("div",g5,[h("p",{class:ce(["text-xs text-txt-muted break-words",c.value.has(`io-${O.id}`)?"":"line-clamp-2"])},C(O.prompt),3),O.prompt.length>120?(g(),m("button",{key:0,onClick:L=>p("io",O.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},C(c.value.has(`io-${O.id}`)?"Show less ▲":"Show more ▼"),9,m5)):B("",!0)])):B("",!0),a.value.get(`io-${O.id}`)?(g(),m("div",b5,[h("h4",v5," Run history — "+C(O.name),1),l.value.has(`io-${O.id}`)?(g(),m("div",y5,[...N[6]||(N[6]=[h("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),fe(" Loading… ",-1)])])):!o.value.get(`io-${O.id}`)||o.value.get(`io-${O.id}`).length===0?(g(),m("div",_5," No history yet ")):(g(),m("ul",x5,[(g(!0),m(we,null,Me(o.value.get(`io-${O.id}`),L=>(g(),m("li",{key:L.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:ce(["w-2 h-2 rounded-full mt-1 shrink-0",d(L.status)])},null,2),h("div",w5,[h("div",k5,[h("span",E5,C(u(L.started_at)),1),h("span",{class:ce(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",f(L.status)])},C(L.status),3)]),L.completed_at?(g(),m("div",S5," Completed: "+C(u(L.completed_at)),1)):B("",!0),L.error_text?(g(),m("div",T5,C(L.error_text),1)):B("",!0)])]))),128))]))])):B("",!0)]))),128))]))]),h("details",A5,[h("summary",R5,[de(Ee,{paths:'<path d="M7.65 4.15c.2-.2.5-.2.7 0l5.49 5.46c.21.22.21.57 0 .78l-5.49 5.46a.5.5 0 0 1-.7-.7L12.8 10 7.65 4.85a.5.5 0 0 1 0-.7Z"/>',size:16,class:"text-accent transition-transform group-open/section:rotate-90"}),N[7]||(N[7]=h("span",{class:"tracking-wide uppercase text-xs text-txt-secondary"},"Squad Schedules",-1)),h("span",C5,C(s.value.length),1),N[8]||(N[8]=h("div",{class:"flex-1 h-px bg-gradient-to-r from-edge to-transparent"},null,-1))]),s.value.length===0?(g(),m("div",O5,[h("div",$5,[de(Ee,{paths:'<path d="M10 3a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3ZM7.5 4.5a2.5 2.5 0 1 1 5 0 2.5 2.5 0 0 1-5 0Zm8-.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-2 1a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-10 0a1 1 0 1 1 2 0 1 1 0 0 1-2 0Zm1-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm.6 12H5a2 2 0 0 1-2-2V9.25c0-.14.11-.25.25-.25h1.76c.04-.37.17-.7.37-1H3.25C2.56 8 2 8.56 2 9.25V13a3 3 0 0 0 3.4 2.97 4.96 4.96 0 0 1-.3-.97Zm9.5.97A3 3 0 0 0 18 13V9.25C18 8.56 17.44 8 16.75 8h-2.13c.2.3.33.63.37 1h1.76c.14 0 .25.11.25.25V13a2 2 0 0 1-2.1 2c-.07.34-.17.66-.3.97ZM7.25 8C6.56 8 6 8.56 6 9.25V14a4 4 0 0 0 8 0V9.25C14 8.56 13.44 8 12.75 8h-5.5ZM7 9.25c0-.14.11-.25.25-.25h5.5c.14 0 .25.11.25.25V14a3 3 0 1 1-6 0V9.25Z"/>',size:20,class:"text-txt-muted"})]),N[9]||(N[9]=h("p",{class:"text-txt-muted text-sm"},"No squad schedules configured",-1))])):(g(),m("div",N5,[(g(!0),m(we,null,Me(s.value,O=>(g(),m("div",{key:O.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",I5,[h("div",P5,[h("div",L5,[h("span",M5,C(O.name),1),h("span",j5,C(O.squad_slug),1),h("span",{class:ce(["inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",O.enabled?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-surface-3/60 text-txt-muted border-edge"])},[O.enabled?(g(),m("span",D5)):B("",!0),fe(" "+C(O.enabled?"Active":"Paused"),1)],2)]),h("div",U5,[h("code",B5,C(O.cron_expr),1),O.next_run_at?(g(),m("span",H5,[de(Ee,{paths:'<path d="M17.22 8.69a1.5 1.5 0 0 1 0 2.62l-10 5.5A1.5 1.5 0 0 1 5 15.5v-11A1.5 1.5 0 0 1 7.22 3.2l10 5.5Zm-.48 1.75a.5.5 0 0 0 0-.88l-10-5.5A.5.5 0 0 0 6 4.5v11c0 .38.4.62.74.44l10-5.5Z"/>',size:12}),fe(" "+C(u(O.next_run_at)),1)])):B("",!0),O.last_run_at?(g(),m("span",F5,[de(Ee,{paths:'<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14Zm-.5 2a.5.5 0 0 1 .5.41V10h2.5a.5.5 0 0 1 .09 1H9.5a.5.5 0 0 1-.5-.41V5.5c0-.28.22-.5.5-.5Z"/>',size:12}),fe(" "+C(u(O.last_run_at)),1)])):B("",!0)]),O.notes?(g(),m("p",V5,C(O.notes),1)):B("",!0)]),h("div",q5,[O.enabled?(g(),m("button",{key:0,onClick:L=>R("squads",O.id),disabled:i.value.has(`squads-${O.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,z5)):(g(),m("button",{key:1,onClick:L=>k("squads",O.id),disabled:i.value.has(`squads-${O.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,K5)),h("button",{onClick:L=>x("squads",O.id),disabled:i.value.has(`squads-${O.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,W5),h("button",{onClick:L=>b("squads",O.id),class:ce(["text-xs px-2.5 py-1.5 rounded-lg border transition-all duration-200",a.value.get(`squads-${O.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,G5),h("button",{onClick:L=>E("squads",O.id,O.name),disabled:i.value.has(`squads-${O.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"},[de(Ee,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,Z5)])]),O.prompt?(g(),m("div",J5,[h("p",{class:ce(["text-xs text-txt-muted break-words",c.value.has(`squads-${O.id}`)?"":"line-clamp-2"])},C(O.prompt),3),O.prompt.length>120?(g(),m("button",{key:0,onClick:L=>p("squads",O.id),class:"text-[10px] text-accent/70 hover:text-accent mt-1 transition-colors"},C(c.value.has(`squads-${O.id}`)?"Show less ▲":"Show more ▼"),9,Y5)):B("",!0)])):B("",!0),a.value.get(`squads-${O.id}`)?(g(),m("div",X5,[h("h4",Q5," Run history — "+C(O.name),1),l.value.has(`squads-${O.id}`)?(g(),m("div",e2,[...N[10]||(N[10]=[h("div",{class:"w-1 h-1 rounded-full bg-accent animate-pulse"},null,-1),fe(" Loading… ",-1)])])):!o.value.get(`squads-${O.id}`)||o.value.get(`squads-${O.id}`).length===0?(g(),m("div",t2," No history yet ")):(g(),m("ul",s2,[(g(!0),m(we,null,Me(o.value.get(`squads-${O.id}`),L=>(g(),m("li",{key:L.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:ce(["w-2 h-2 rounded-full mt-1 shrink-0",d(L.status)])},null,2),h("div",n2,[h("div",r2,[h("span",i2,C(u(L.started_at)),1),h("span",{class:ce(["px-1.5 py-0.5 rounded-full text-[10px] font-medium tracking-wide uppercase border shrink-0",f(L.status)])},C(L.status),3)]),L.completed_at?(g(),m("div",a2," Completed: "+C(u(L.completed_at)),1)):B("",!0),L.error_text?(g(),m("div",o2,C(L.error_text),1)):B("",!0)])]))),128))]))])):B("",!0)]))),128))]))])],64))])]))}}),c2={class:"relative flex flex-col h-full p-3 sm:p-6"},u2={class:"flex justify-between items-start mb-4"},d2={class:"flex items-center gap-2 flex-wrap justify-end"},h2={class:"relative mb-3"},f2={class:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-txt-muted"},p2={class:"flex gap-1.5 mb-4"},g2={key:0,class:"flex-1 flex items-center justify-center"},m2={key:1,class:"flex-1 flex flex-col items-center justify-center"},b2={class:"w-14 h-14 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-4"},v2=["onClick"],y2=["onClick"],_2={class:"mt-0.5 shrink-0"},x2={key:1,class:"mt-2 w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm shrink-0"},w2={key:2,class:"mt-2 w-1.5 h-1.5 rounded-full bg-edge shrink-0"},k2={class:"flex-1 min-w-0"},E2={class:"flex items-center gap-2 mb-0.5"},S2={class:"text-sm font-semibold text-txt-primary truncate leading-snug"},T2={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"},A2={class:"text-[10px] text-txt-muted mb-1"},R2={key:0,class:"flex flex-wrap items-center gap-1 mb-1"},C2={key:0,class:"text-[10px] font-mono text-accent/80 bg-accent/10 px-1.5 py-0.5 rounded border border-accent/20 shrink-0"},O2={key:1,class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},$2={key:2,class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},N2={key:1,class:"text-xs text-txt-secondary line-clamp-2 leading-relaxed"},I2={key:3,class:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},P2=["onClick"],L2=["onClick","disabled"],M2={key:0,class:"px-4 pb-4"},j2=["innerHTML"],D2=["onClick"],U2={class:"text-xs font-semibold text-txt-secondary uppercase tracking-wider"},B2={class:"text-[10px] font-mono text-txt-muted"},H2={key:0,class:"space-y-2"},F2=["onClick"],V2=["onClick"],q2={class:"mt-0.5 shrink-0"},z2={key:1,class:"mt-2 w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm shrink-0"},K2={key:2,class:"mt-2 w-1.5 h-1.5 rounded-full bg-edge shrink-0"},W2={class:"flex-1 min-w-0"},G2={class:"flex items-center gap-2 mb-0.5"},Z2={class:"text-sm font-semibold text-txt-primary truncate leading-snug"},J2={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"},Y2={class:"text-[10px] text-txt-muted mb-1"},X2={key:0,class:"flex flex-wrap items-center gap-1 mb-1"},Q2={key:0,class:"text-[10px] font-mono text-accent/80 bg-accent/10 px-1.5 py-0.5 rounded border border-accent/20 shrink-0"},ek={key:1,class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},tk={key:2,class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},sk={key:1,class:"text-xs text-txt-secondary line-clamp-2 leading-relaxed"},nk={key:3,class:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity duration-200"},rk=["onClick"],ik=["onClick","disabled"],ak={key:0,class:"px-4 pb-4"},ok=["innerHTML"],lk={key:0,class:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-3 px-4 py-2.5 rounded-2xl bg-surface-3 border border-edge-bright shadow-card backdrop-blur-sm z-20"},ck={class:"text-xs font-semibold text-txt-secondary mr-1 whitespace-nowrap"},uk=["disabled"],dk=["disabled"],hk={key:4,class:"mt-3 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"},fk=st({__name:"FeedView",setup(e){const t=q([]),s=q(!0),n=q(new Set),r=q(new Set),i=q(null),a=q("");let o=null;const l=q(!1),c=q(new Set),u=q(!1),d=q(new Set),f=q(!1);function p(I){const $=I.match(/^\[([^\]]+)\]/);return $?$[1]:null}const b=Ne(()=>t.value),v=Ne(()=>{const I=new Map;for(const y of b.value){const S=p(y.title)??"__ungrouped__";I.has(S)||I.set(S,[]),I.get(S).push(y)}const $=[];for(const[y,S]of I)$.push({key:y,label:y==="__ungrouped__"?"Ungrouped":y,entries:S});return $.sort((y,S)=>y.key==="__ungrouped__"?1:S.key==="__ungrouped__"?-1:y.key.localeCompare(S.key)),$}),T=Ne(()=>b.value.length>0&&b.value.every(I=>d.value.has(I.id)));function R(I){try{const $=I.includes("T")||I.endsWith("Z")?I:I.replace(" ","T")+"Z";return new Date($).toLocaleString()}catch{return I}}function k(I){return I.replace(/[#*`_~[\]()]/g,"").slice(0,200)}function x(I){const $=new Set(n.value);$.has(I)?$.delete(I):$.add(I),n.value=$}function E(){u.value=!u.value,u.value||(d.value=new Set)}function A(I){const $=new Set(d.value);$.has(I)?$.delete(I):$.add(I),d.value=$}function N(){T.value?d.value=new Set:d.value=new Set(b.value.map(I=>I.id))}function O(I){const $=new Set(c.value);$.has(I)?$.delete(I):$.add(I),c.value=$}async function L(I){s.value=!0,i.value=null;try{const $=new URLSearchParams({limit:"100",type:"notification"});I&&$.set("search",I);const y=await Se(`/api/feed?${$}`);if(y.ok){const S=await y.json();t.value=S.entries??[]}}catch{}s.value=!1}async function D(I){try{await Se(`/api/feed/${I}/read`,{method:"POST"});const $=t.value.find(y=>y.id===I);$&&($.read_at=new Date().toISOString())}catch{}}async function W(){try{await Se("/api/feed/read-all?type=notification",{method:"POST"});const I=new Date().toISOString();for(const $ of t.value)$.read_at||($.read_at=I)}catch{}}async function ne(I){if(!window.confirm("Delete this entry?"))return;const $=new Set(r.value);$.add(I),r.value=$;try{const y=await Se(`/api/feed/${I}`,{method:"DELETE"});if(y.ok){t.value=t.value.filter(H=>H.id!==I);const S=new Set(n.value);S.delete(I),n.value=S}else i.value=`Failed to delete entry (HTTP ${y.status})`}catch(y){i.value=y instanceof Error?y.message:"Delete failed"}finally{const y=new Set(r.value);y.delete(I),r.value=y}}async function ee(){const I=Array.from(d.value);if(I.length!==0){f.value=!0;try{const $=await Se("/api/feed/batch-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:I})});if($.ok){const y=new Date().toISOString();for(const S of t.value)I.includes(S.id)&&(S.read_at=S.read_at??y);d.value=new Set}else i.value=`Bulk mark-read failed (HTTP ${$.status})`}catch($){i.value=$ instanceof Error?$.message:"Bulk mark-read failed"}finally{f.value=!1}}}async function X(){const I=Array.from(d.value);if(I.length!==0&&window.confirm(`Delete ${I.length} item${I.length===1?"":"s"}?`)){f.value=!0;try{const $=await Se("/api/feed/batch-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:I})});if($.ok){t.value=t.value.filter(S=>!I.includes(S.id));const y=new Set(n.value);I.forEach(S=>y.delete(S)),n.value=y,d.value=new Set}else i.value=`Bulk delete failed (HTTP ${$.status})`}catch($){i.value=$ instanceof Error?$.message:"Bulk delete failed"}finally{f.value=!1}}}return vt(a,I=>{o!==null&&clearTimeout(o),o=setTimeout(()=>{L(I.trim()||void 0)},300)}),yt(()=>L()),(I,$)=>(g(),m("div",c2,[h("div",u2,[$[3]||($[3]=h("div",null,[h("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Feed"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Messages, results & notifications")],-1)),h("div",d2,[u.value&&b.value.length>0?(g(),m("button",{key:0,onClick:N,class:"text-xs text-txt-secondary hover:text-txt-primary transition-colors font-medium"},C(T.value?"Deselect all":"Select all"),1)):B("",!0),!u.value&&t.value.length>0?(g(),m("button",{key:1,onClick:W,class:"text-xs text-accent hover:text-accent-glow transition-colors font-medium"}," Mark all read ")):B("",!0),t.value.length>0?(g(),m("button",{key:2,onClick:E,class:ce(["text-xs px-2.5 py-1 rounded-lg border transition-all duration-150 font-medium",u.value?"text-accent border-accent/30 bg-accent/10 hover:bg-accent/20":"text-txt-muted border-edge hover:text-txt-secondary hover:border-edge-bright hover:bg-surface-3/40"])},C(u.value?"Cancel":"Select"),3)):B("",!0)])]),h("div",h2,[h("div",f2,[de(Ee,{paths:'<path d="M13.74 13.03a7.5 7.5 0 1 0-.71.71l3.63 3.63c.2.2.51.2.71 0a.5.5 0 0 0 0-.71l-3.63-3.63Zm.26-5.53a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0Z"/>',size:14})]),Be(h("input",{"onUpdate:modelValue":$[0]||($[0]=y=>a.value=y),type:"text",placeholder:"Search feed…",class:"w-full pl-8 pr-8 py-2 text-xs bg-surface-2/50 border border-edge rounded-xl text-txt-primary placeholder:text-txt-muted focus:outline-none focus:border-accent/40 focus:bg-surface-2 transition-all duration-150"},null,512),[[ze,a.value]]),a.value?(g(),m("button",{key:0,onClick:$[1]||($[1]=y=>a.value=""),class:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded text-txt-muted hover:text-txt-primary transition-colors",title:"Clear search"},[de(Ee,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:12})])):B("",!0)]),h("div",p2,[h("button",{onClick:$[2]||($[2]=y=>l.value=!l.value),class:ce(["flex items-center gap-1.5 text-xs font-medium py-1.5 px-3 rounded-lg transition-all duration-150 shrink-0",l.value?"bg-accent/10 text-accent border border-accent/20":"text-txt-muted hover:text-txt-secondary hover:bg-surface-3/50 border border-transparent"]),title:"Group by team"},[de(Ee,{paths:'<path d="M8 2a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm0 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-5 4a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm0 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm10-1a2 2 0 1 1 0 4 2 2 0 0 1 0-4Zm0 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2ZM8 9.5a.5.5 0 0 1 .5.5v1h4a.5.5 0 0 1 .5.5v1h1.5a.5.5 0 0 1 0 1H14v1a.5.5 0 0 1-1 0v-3.5H7v3.5a.5.5 0 0 1-1 0v-1H4.5a.5.5 0 0 1 0-1H6v-1a.5.5 0 0 1 .5-.5h1V10a.5.5 0 0 1 .5-.5Z"/>',size:12}),$[4]||($[4]=fe(" Team ",-1))],2)]),s.value?(g(),m("div",g2,[...$[5]||($[5]=[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"}),fe(" Loading… ")],-1)])])):b.value.length===0?(g(),m("div",m2,[h("div",b2,[de(Ee,{paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:28,class:"text-txt-muted"})]),$[6]||($[6]=h("p",{class:"text-txt-muted text-sm font-medium"},"Nothing here yet",-1)),$[7]||($[7]=h("p",{class:"text-txt-muted/60 text-xs mt-1"}," No notifications ",-1))])):l.value?(g(),m("div",{key:3,class:ce(["space-y-3 overflow-y-auto flex-1 pr-1",u.value&&d.value.size>0?"pb-16":""])},[(g(!0),m(we,null,Me(v.value,y=>(g(),m("div",{key:y.key},[h("button",{onClick:S=>O(y.key),class:"w-full flex items-center gap-2 px-2 py-1.5 mb-1 text-left hover:bg-surface-3/30 rounded-lg transition-colors duration-150"},[de(Ee,{paths:'<path d="M7.47 4.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1-1.06 1.06L8 5.81 3.28 10.53a.75.75 0 0 1-1.06-1.06l5.25-5.25Z"/>',size:12,class:ce(["text-txt-muted transition-transform duration-150 shrink-0",c.value.has(y.key)?"-rotate-90":"rotate-180"])},null,8,["class"]),h("span",U2,C(y.label),1),h("span",B2,"("+C(y.entries.length)+")",1)],8,D2),c.value.has(y.key)?B("",!0):(g(),m("ul",H2,[(g(!0),m(we,null,Me(y.entries,S=>(g(),m("li",{key:S.id,class:ce(["group bg-surface-2/50 border border-edge rounded-xl hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden animate-fade-in",[S.read_at?"":"glow-inner",u.value&&d.value.has(S.id)?"ring-1 ring-accent/40 bg-accent/5 border-accent/30":""]])},[h("div",{class:"flex items-start gap-3 p-4 cursor-pointer",onClick:H=>u.value?A(S.id):x(S.id)},[u.value?(g(),m("div",{key:0,class:"mt-0.5 shrink-0",onClick:Ye(H=>A(S.id),["stop"])},[h("div",{class:ce(["w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all duration-150",d.value.has(S.id)?"border-accent bg-accent shadow-glow-sm":"border-edge hover:border-accent/60"])},[d.value.has(S.id)?(g(),Bt(Ee,{key:0,paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:11,class:"text-surface-0"})):B("",!0)],2)],8,V2)):B("",!0),h("div",q2,[S.type==="inbox"?(g(),Bt(Ee,{key:0,paths:'<path d="M6 3a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H6Zm10 7h-3.5a.5.5 0 0 0-.5.5v.01a1.75 1.75 0 0 1-.03.3c-.04.2-.1.46-.23.72-.13.25-.3.49-.57.66-.26.18-.63.31-1.17.31-.54 0-.9-.13-1.17-.3a1.7 1.7 0 0 1-.57-.67A2.57 2.57 0 0 1 8 10.5v-.01a.5.5 0 0 0-.5-.5H4V6c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2v4ZM4 11h3.05c.05.26.14.62.32.97.18.38.47.76.9 1.06.45.29 1.02.47 1.73.47s1.28-.18 1.72-.47c.44-.3.73-.68.91-1.06.18-.35.27-.7.32-.97H16v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3Z"/>',size:16,class:ce(S.read_at?"text-txt-muted":"text-accent")},null,8,["class"])):(g(),Bt(Ee,{key:1,paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:16,class:ce(S.read_at?"text-txt-muted":"text-accent")},null,8,["class"]))]),S.read_at?(g(),m("span",K2)):(g(),m("span",z2)),h("div",W2,[h("div",G2,[h("span",Z2,C(S.title),1),S.source_type?(g(),m("span",J2,C(S.source_type),1)):B("",!0)]),h("p",Y2,C(R(S.created_at)),1),S.type==="inbox"&&(S.squad_slug||S.instance_id||S.task_id)?(g(),m("div",X2,[S.squad_slug?(g(),m("span",Q2,C(S.squad_slug),1)):B("",!0),S.instance_id?(g(),m("span",ek,"inst:"+C(S.instance_id.slice(0,8)),1)):B("",!0),S.task_id?(g(),m("span",tk,"task:"+C(S.task_id.slice(0,8)),1)):B("",!0)])):B("",!0),n.value.has(S.id)?B("",!0):(g(),m("p",sk,C(k(S.body)),1))]),u.value?B("",!0):(g(),m("div",nk,[S.read_at?B("",!0):(g(),m("button",{key:0,onClick:Ye(H=>D(S.id),["stop"]),class:"p-1.5 rounded-lg text-txt-muted hover:text-accent hover:bg-accent/10 border border-transparent hover:border-accent/20 transition-all duration-150",title:"Mark as read"},[de(Ee,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14})],8,rk)),h("button",{onClick:Ye(H=>ne(S.id),["stop"]),disabled:r.value.has(S.id),class:"p-1.5 rounded-lg text-txt-muted hover:text-red-400 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 disabled:opacity-30 transition-all duration-150",title:"Delete"},[de(Ee,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,ik)]))],8,F2),!u.value&&n.value.has(S.id)?(g(),m("div",ak,[h("div",{class:"text-sm text-txt-secondary bg-surface-0/60 rounded-xl p-4 border border-edge/50 wiki-content leading-relaxed",innerHTML:Re(ls)(S.body)},null,8,ok)])):B("",!0)],2))),128))]))]))),128))],2)):(g(),m("ul",{key:2,class:ce(["space-y-2 overflow-y-auto flex-1 pr-1",u.value&&d.value.size>0?"pb-16":""])},[(g(!0),m(we,null,Me(b.value,y=>(g(),m("li",{key:y.id,class:ce(["group bg-surface-2/50 border border-edge rounded-xl hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden animate-fade-in",[y.read_at?"":"glow-inner",u.value&&d.value.has(y.id)?"ring-1 ring-accent/40 bg-accent/5 border-accent/30":""]])},[h("div",{class:"flex items-start gap-3 p-4 cursor-pointer",onClick:S=>u.value?A(y.id):x(y.id)},[u.value?(g(),m("div",{key:0,class:"mt-0.5 shrink-0",onClick:Ye(S=>A(y.id),["stop"])},[h("div",{class:ce(["w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all duration-150",d.value.has(y.id)?"border-accent bg-accent shadow-glow-sm":"border-edge hover:border-accent/60"])},[d.value.has(y.id)?(g(),Bt(Ee,{key:0,paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:11,class:"text-surface-0"})):B("",!0)],2)],8,y2)):B("",!0),h("div",_2,[y.type==="inbox"?(g(),Bt(Ee,{key:0,paths:'<path d="M6 3a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H6Zm10 7h-3.5a.5.5 0 0 0-.5.5v.01a1.75 1.75 0 0 1-.03.3c-.04.2-.1.46-.23.72-.13.25-.3.49-.57.66-.26.18-.63.31-1.17.31-.54 0-.9-.13-1.17-.3a1.7 1.7 0 0 1-.57-.67A2.57 2.57 0 0 1 8 10.5v-.01a.5.5 0 0 0-.5-.5H4V6c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2v4ZM4 11h3.05c.05.26.14.62.32.97.18.38.47.76.9 1.06.45.29 1.02.47 1.73.47s1.28-.18 1.72-.47c.44-.3.73-.68.91-1.06.18-.35.27-.7.32-.97H16v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3Z"/>',size:16,class:ce(y.read_at?"text-txt-muted":"text-accent")},null,8,["class"])):(g(),Bt(Ee,{key:1,paths:'<path d="M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1 .06.17l.01.08.01.13a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.26-.03l-.13-.04a1 1 0 0 1-.6-1.05l.02-.13.05-.13L4 11.4V7.57A5.9 5.9 0 0 1 10 2Zm1.5 13h-3v.15a1.5 1.5 0 0 0 1.36 1.34l.14.01c.78 0 1.42-.6 1.5-1.36V15ZM10 3a4.9 4.9 0 0 0-4.98 4.38L5 7.6V11.5l-.04.2L4 14h12l-.96-2.3-.04-.2V7.61A4.9 4.9 0 0 0 10 3Z"/>',size:16,class:ce(y.read_at?"text-txt-muted":"text-accent")},null,8,["class"]))]),y.read_at?(g(),m("span",w2)):(g(),m("span",x2)),h("div",k2,[h("div",E2,[h("span",S2,C(y.title),1),y.source_type?(g(),m("span",T2,C(y.source_type),1)):B("",!0)]),h("p",A2,C(R(y.created_at)),1),y.type==="inbox"&&(y.squad_slug||y.instance_id||y.task_id)?(g(),m("div",R2,[y.squad_slug?(g(),m("span",C2,C(y.squad_slug),1)):B("",!0),y.instance_id?(g(),m("span",O2,"inst:"+C(y.instance_id.slice(0,8)),1)):B("",!0),y.task_id?(g(),m("span",$2,"task:"+C(y.task_id.slice(0,8)),1)):B("",!0)])):B("",!0),n.value.has(y.id)?B("",!0):(g(),m("p",N2,C(k(y.body)),1))]),u.value?B("",!0):(g(),m("div",I2,[y.read_at?B("",!0):(g(),m("button",{key:0,onClick:Ye(S=>D(y.id),["stop"]),class:"p-1.5 rounded-lg text-txt-muted hover:text-accent hover:bg-accent/10 border border-transparent hover:border-accent/20 transition-all duration-150",title:"Mark as read"},[de(Ee,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14})],8,P2)),h("button",{onClick:Ye(S=>ne(y.id),["stop"]),disabled:r.value.has(y.id),class:"p-1.5 rounded-lg text-txt-muted hover:text-red-400 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 disabled:opacity-30 transition-all duration-150",title:"Delete"},[de(Ee,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14})],8,L2)]))],8,v2),!u.value&&n.value.has(y.id)?(g(),m("div",M2,[h("div",{class:"text-sm text-txt-secondary bg-surface-0/60 rounded-xl p-4 border border-edge/50 wiki-content leading-relaxed",innerHTML:Re(ls)(y.body)},null,8,j2)])):B("",!0)],2))),128))],2)),de(rn,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-4"},{default:Kt(()=>[u.value&&d.value.size>0?(g(),m("div",lk,[h("span",ck,C(d.value.size)+" selected ",1),h("button",{onClick:ee,disabled:f.value,class:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-xl bg-accent/15 text-accent border border-accent/25 hover:bg-accent/25 disabled:opacity-40 transition-all duration-150"},[de(Ee,{paths:'<path d="M3.37 10.17a.5.5 0 0 0-.74.66l4 4.5c.19.22.52.23.72.02l10.5-10.5a.5.5 0 0 0-.7-.7L7.02 14.27l-3.65-4.1Z"/>',size:14}),$[8]||($[8]=fe(" Mark read ",-1))],8,uk),h("button",{onClick:X,disabled:f.value,class:"flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-xl bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 disabled:opacity-40 transition-all duration-150"},[de(Ee,{paths:'<path d="M8.5 4h3a1.5 1.5 0 0 0-3 0Zm-1 0a2.5 2.5 0 0 1 5 0h5a.5.5 0 0 1 0 1h-1.05l-1.2 10.34A3 3 0 0 1 12.27 18H7.73a3 3 0 0 1-2.98-2.66L3.55 5H2.5a.5.5 0 0 1 0-1h5ZM5.74 15.23A2 2 0 0 0 7.73 17h4.54a2 2 0 0 0 1.99-1.77L15.44 5H4.56l1.18 10.23ZM8.5 7.5c.28 0 .5.22.5.5v6a.5.5 0 0 1-1 0V8c0-.28.22-.5.5-.5ZM12 8a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V8Z"/>',size:14}),$[9]||($[9]=fe(" Delete ",-1))],8,dk)])):B("",!0)]),_:1}),i.value?(g(),m("div",hk,[de(Ee,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16,class:"shrink-0"}),fe(" "+C(i.value),1)])):B("",!0)]))}}),pk={class:"flex flex-col h-full p-3 sm:p-6"},gk={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-4 text-sm"},mk={key:1,class:"flex-1 flex items-center justify-center"},bk={key:2,class:"flex-1 flex flex-col items-center justify-center"},vk={key:3,class:"space-y-3 overflow-y-auto flex-1"},yk={class:"flex justify-between items-start gap-3"},_k={class:"text-sm font-semibold text-txt-primary leading-snug"},xk={class:"flex items-center gap-2 shrink-0"},wk={class:"text-[10px] text-txt-muted font-mono"},kk=["onClick","disabled"],Ek={key:0,class:"flex flex-wrap items-center gap-1 mt-1.5 mb-1"},Sk={key:0,class:"text-[10px] font-mono text-accent/80 bg-accent/10 px-1.5 py-0.5 rounded border border-accent/20"},Tk={key:1,class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50"},Ak={key:2,class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50"},Rk=["innerHTML"],Ck="inbox-last-seen-id",Ok=st({__name:"InboxView",setup(e){const t=q([]),s=q(!1),n=q(null),r=q(new Set);let i=null;const a=u=>{if(!u)return"";const d=u.includes("T")?u:u.replace(" ","T")+"Z",f=new Date(d);return Number.isNaN(f.getTime())?u:f.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})},o=u=>{if(u.length===0)return;const d=Math.max(...u.map(f=>f.id));try{localStorage.setItem(Ck,String(d))}catch{}},l=async(u=!1)=>{u&&(s.value=!0),n.value=null;try{const d=await Se("/api/inbox");if(!d.ok)throw new Error(`HTTP ${d.status}`);const f=await d.json();t.value=f.entries??[],o(t.value)}catch(d){u&&(n.value=d instanceof Error?d.message:"Failed to load inbox")}finally{u&&(s.value=!1)}},c=async u=>{if(!r.value.has(u)){r.value=new Set(r.value).add(u);try{const d=await Se(`/api/inbox/${encodeURIComponent(u)}`,{method:"DELETE"});if(!d.ok&&d.status!==204)throw new Error(`HTTP ${d.status}`);t.value=t.value.filter(f=>f.id!==u)}catch(d){n.value=d instanceof Error?d.message:"Failed to delete entry"}finally{const d=new Set(r.value);d.delete(u),r.value=d}}};return yt(()=>{l(!0),i=setInterval(()=>l(),1e4)}),tr(()=>{i&&clearInterval(i)}),(u,d)=>(g(),m("div",pk,[d[4]||(d[4]=h("div",{class:"flex justify-between items-center mb-6"},[h("div",null,[h("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"Inbox"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Messages delivered to you")])],-1)),n.value?(g(),m("div",gk,[d[0]||(d[0]=h("span",null,"⚠",-1)),fe(" "+C(n.value),1)])):B("",!0),s.value&&t.value.length===0?(g(),m("div",mk,[...d[1]||(d[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"}),fe(" Loading… ")],-1)])])):!s.value&&t.value.length===0?(g(),m("div",bk,[...d[2]||(d[2]=[hn('<div class="w-14 h-14 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-4"><svg viewBox="0 0 20 20" fill="currentColor" class="w-7 h-7 text-txt-muted" aria-hidden="true"><path d="M2 6.25A2.25 2.25 0 0 1 4.25 4h11.5A2.25 2.25 0 0 1 18 6.25v7.5A2.25 2.25 0 0 1 15.75 16H4.25A2.25 2.25 0 0 1 2 13.75v-7.5Zm2.25-1a1 1 0 0 0-1 1v.388l6.75 4.5 6.75-4.5V6.25a1 1 0 0 0-1-1H4.25Zm12.5 2.834-6.294 4.196a.75.75 0 0 1-.812 0L3.25 8.084v5.666a1 1 0 0 0 1 1h11.5a1 1 0 0 0 1-1V8.084Z"></path></svg></div><p class="text-txt-muted text-sm font-medium">Inbox is empty</p><p class="text-txt-muted/60 text-xs mt-1">New messages will appear here</p>',3)])])):(g(),m("ul",vk,[(g(!0),m(we,null,Me(t.value,f=>(g(),m("li",{key:f.id,class:"bg-surface-2/40 border border-edge rounded-xl p-4 hover:border-edge-bright transition-all duration-150 group"},[h("div",yk,[h("h3",_k,C(f.title),1),h("div",xk,[h("span",wk,C(a(f.created_at)),1),h("button",{onClick:p=>c(f.id),disabled:r.value.has(f.id),class:"opacity-0 group-hover:opacity-100 transition-opacity text-txt-muted hover:text-red-400 disabled:opacity-30",title:"Delete","aria-label":"Delete entry"},[...d[3]||(d[3]=[h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-4 h-4","aria-hidden":"true"},[h("path",{"fill-rule":"evenodd",d:"M8.75 1A2.75 2.75 0 0 0 6 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 1 0 .23 1.482l.149-.022.841 10.518A2.75 2.75 0 0 0 7.596 19h4.807a2.75 2.75 0 0 0 2.742-2.53l.841-10.52.149.023a.75.75 0 0 0 .23-1.482A41.03 41.03 0 0 0 14 4.193V3.75A2.75 2.75 0 0 0 11.25 1h-2.5ZM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4ZM8.58 7.72a.75.75 0 0 0-1.5.06l.3 7.5a.75.75 0 1 0 1.5-.06l-.3-7.5Zm4.34.06a.75.75 0 1 0-1.5-.06l-.3 7.5a.75.75 0 1 0 1.5.06l.3-7.5Z","clip-rule":"evenodd"})],-1)])],8,kk)])]),f.squad_slug||f.instance_id||f.task_id?(g(),m("div",Ek,[f.squad_slug?(g(),m("span",Sk,C(f.squad_slug),1)):B("",!0),f.instance_id?(g(),m("span",Tk,"inst:"+C(f.instance_id),1)):B("",!0),f.task_id?(g(),m("span",Ak,"task:"+C(f.task_id),1)):B("",!0)])):B("",!0),h("div",{class:"mt-2 text-sm text-txt-secondary wiki-content prose-sm",innerHTML:Re(ls)(f.body)},null,8,Rk)]))),128))]))]))}}),$k={class:"flex flex-col md:flex-row h-full overflow-hidden bg-surface-0"},Nk={class:"p-3.5 shrink-0"},Ik={class:"flex items-center justify-between mb-3"},Pk={class:"text-[10px] text-txt-muted font-mono bg-surface-2/60 px-1.5 py-0.5 rounded"},Lk={key:0,class:"flex-1 flex items-center justify-center"},Mk={key:1,class:"flex-1 p-4"},jk={class:"text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2"},Dk={key:2,class:"flex-1 overflow-y-auto py-2 px-2"},Uk={key:0,class:"px-2 py-3 text-sm text-txt-muted text-center"},Bk=["onClick"],Hk={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"},Fk={key:0,class:"md:hidden flex items-center gap-2 px-3 py-2 border-b border-edge bg-surface-1/60 shrink-0"},Vk={class:"text-xs text-txt-primary font-medium truncate"},qk={key:1,class:"flex-1 flex flex-col items-center justify-center select-none"},zk={key:2,class:"flex-1 flex items-center justify-center"},Kk={key:3,class:"flex-1 p-6"},Wk={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"},Gk={key:4,class:"flex-1 overflow-y-auto"},Zk={class:"max-w-3xl mx-auto px-6 py-6"},Jk={class:"text-xl font-bold text-txt-primary mb-4 pb-3 border-b border-edge"},Yk=["innerHTML"],Xk=st({__name:"WikiView",setup(e){const t=q([]),s=q(null),n=q(""),r=q(""),i=q(!1),a=q(!1),o=q(""),l=q(""),c=Ne(()=>{const p=r.value.trim().toLowerCase();return p?t.value.filter(b=>b.title.toLowerCase().includes(p)):t.value}),u=Ne(()=>ls(n.value));async function d(){i.value=!0,o.value="";try{const p=await Se("/api/wiki");if(!p.ok)throw new Error(`HTTP ${p.status}`);const b=await p.json();t.value=b.pages??[]}catch(p){o.value=p instanceof Error?p.message:"Failed to load pages"}finally{i.value=!1}}async function f(p){var b;if(((b=s.value)==null?void 0:b.path)!==p.path){s.value=p,n.value="",a.value=!0,l.value="";try{const v=await Se(`/api/wiki/${encodeURIComponent(p.path)}`);if(!v.ok)throw new Error(`HTTP ${v.status}`);const T=await v.json();n.value=T.content??""}catch(v){l.value=v instanceof Error?v.message:"Failed to load page"}finally{a.value=!1}}}return yt(d),(p,b)=>(g(),m("div",$k,[h("div",{class:ce(["bg-surface-1/70 backdrop-blur-sm border-edge flex flex-col",s.value?"hidden md:flex md:w-72 md:shrink-0 md:border-r":"flex w-full md:w-72 md:shrink-0 border-b md:border-b-0 md:border-r md:h-full max-h-64 md:max-h-none"])},[h("div",Nk,[h("div",Ik,[b[2]||(b[2]=h("h2",{class:"text-sm font-semibold text-txt-primary tracking-tight flex items-center gap-1.5"},[h("span",{class:"text-base"},"📚"),fe(" Wiki ")],-1)),h("span",Pk,C(c.value.length),1)]),Be(h("input",{"onUpdate:modelValue":b[0]||(b[0]=v=>r.value=v),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),[[ze,r.value]])]),b[4]||(b[4]=h("div",{class:"mx-3 h-px bg-gradient-to-r from-transparent via-edge to-transparent"},null,-1)),i.value?(g(),m("div",Lk,[...b[3]||(b[3]=[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"}),fe(" Loading… ")],-1)])])):o.value?(g(),m("div",Mk,[h("div",jk,C(o.value),1)])):(g(),m("ul",Dk,[c.value.length===0?(g(),m("li",Uk," No pages found ")):B("",!0),(g(!0),m(we,null,Me(c.value,v=>{var T,R,k;return g(),m("li",{key:v.path,onClick:x=>f(v),class:ce(["relative px-2.5 py-2 rounded-lg cursor-pointer text-sm transition-all duration-150 mb-0.5",((T=s.value)==null?void 0:T.path)===v.path?"bg-accent/10 text-accent":"text-txt-secondary hover:text-txt-primary hover:bg-surface-3/40"])},[((R=s.value)==null?void 0:R.path)===v.path?(g(),m("span",Hk)):B("",!0),h("span",{class:ce(((k=s.value)==null?void 0:k.path)===v.path?"ml-1":"")},C(v.title),3)],10,Bk)}),128))]))],2),h("div",{class:ce(["flex-1 min-w-0 flex flex-col overflow-hidden",s.value?"flex":"hidden md:flex"])},[s.value?(g(),m("div",Fk,[h("button",{onClick:b[1]||(b[1]=v=>s.value=null),class:"flex items-center gap-1.5 text-xs text-txt-muted hover:text-accent transition-colors py-1"},[de(Ee,{paths:'<path d="M12.35 15.85a.5.5 0 0 1-.7 0L6.16 10.4a.55.55 0 0 1 0-.78l5.49-5.46a.5.5 0 1 1 .7.7L7.2 10l5.16 5.15c.2.2.2.5 0 .7Z"/>',size:14}),b[5]||(b[5]=fe(" All pages ",-1))]),b[6]||(b[6]=h("span",{class:"text-txt-muted/30"},"·",-1)),h("span",Vk,C(s.value.title),1)])):B("",!0),s.value?a.value?(g(),m("div",zk,[...b[8]||(b[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"}),fe(" Loading… ")],-1)])])):l.value?(g(),m("div",Kk,[h("div",Wk,[b[9]||(b[9]=h("span",null,"⚠",-1)),fe(" "+C(l.value),1)])])):(g(),m("div",Gk,[h("div",Zk,[h("h1",Jk,C(s.value.title),1),h("div",{class:"wiki-content text-txt-secondary text-sm leading-relaxed",innerHTML:u.value},null,8,Yk)])])):(g(),m("div",qk,[...b[7]||(b[7]=[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)])]))],2)]))}}),Qk=pn(Xk,[["__scopeId","data-v-5b6273c1"]]),eE={class:"relative flex items-center justify-center h-screen bg-surface-0 overflow-hidden"},tE={class:"relative w-full max-w-sm mx-4 animate-fade-in"},sE={class:"glass rounded-2xl border border-edge p-8 shadow-glow"},nE={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"},rE=["disabled"],iE=st({__name:"LoginView",setup(e){const t=rr(),s=mu(),n=q(""),r=q(""),i=q(null);async function a(){i.value=null;const o=await t.signIn(n.value,r.value);o?i.value=o:s.push("/chat")}return(o,l)=>(g(),m("div",eE,[l[5]||(l[5]=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",tE,[h("div",sE,[l[4]||(l[4]=hn('<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:Ye(a,["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)),Be(h("input",{id:"email","onUpdate:modelValue":l[0]||(l[0]=c=>n.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),[[ze,n.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)),Be(h("input",{id:"password","onUpdate:modelValue":l[1]||(l[1]=c=>r.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),[[ze,r.value]])]),i.value?(g(),m("div",nE,[de(Ee,{paths:'<path d="m4.09 4.22.06-.07a.5.5 0 0 1 .63-.06l.07.06L10 9.29l5.15-5.14a.5.5 0 0 1 .63-.06l.07.06c.18.17.2.44.06.63l-.06.07L10.71 10l5.14 5.15c.18.17.2.44.06.63l-.06.07a.5.5 0 0 1-.63.06l-.07-.06L10 10.71l-5.15 5.14a.5.5 0 0 1-.63.06l-.07-.06a.5.5 0 0 1-.06-.63l.06-.07L9.29 10 4.15 4.85a.5.5 0 0 1-.06-.63l.06-.07-.06.07Z"/>',size:16,class:"shrink-0"}),fe(" "+C(i.value),1)])):B("",!0),h("button",{type:"submit",disabled:Re(t).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"},C(Re(t).loading?"Signing in…":"Sign in"),9,rE)],32)])])]))}}),aE={class:"flex flex-col h-full p-3 sm:p-6 overflow-y-auto"},oE={class:"flex justify-between items-start mb-6"},lE=["disabled"],cE={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-4 text-sm"},uE={key:1,class:"flex items-center gap-2 bg-accent/10 text-accent border border-accent/20 p-3 rounded-lg mb-4 text-sm"},dE={class:"mb-6"},hE={key:0,class:"flex items-center gap-2 text-txt-muted text-sm py-4"},fE={key:1,class:"text-txt-muted text-sm py-4 text-center border border-dashed border-edge rounded-xl"},pE={key:2,class:"space-y-2"},gE={class:"flex-1 min-w-0"},mE={class:"flex items-center gap-2"},bE={class:"text-sm font-semibold text-txt-primary"},vE={class:"text-[10px] font-mono text-txt-muted bg-surface-0/60 px-1.5 py-0.5 rounded border border-edge/50 shrink-0"},yE={class:"text-[11px] text-txt-muted font-mono truncate mt-0.5"},_E={class:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity duration-150"},xE=["onClick","disabled"],wE=["onClick","disabled"],kE={class:"bg-surface-2/30 border border-edge rounded-xl p-4"},EE={class:"flex gap-4"},SE={class:"flex items-center gap-2 text-sm text-txt-secondary cursor-pointer"},TE={class:"flex items-center gap-2 text-sm text-txt-secondary cursor-pointer"},AE={key:1},RE=["onUpdate:modelValue"],CE=["onUpdate:modelValue"],OE=["onClick"],$E=["disabled"],NE=st({__name:"McpView",setup(e){const t=q([]),s=q(!1),n=q(!1),r=q(!1),i=q(new Set),a=q(new Set),o=q(null),l=q(null),c=q({name:"",transport:"stdio",command:"",args:"",url:"",envRows:[]});function u(k){l.value=k,setTimeout(()=>{l.value=null},3e3)}function d(){c.value.envRows.push({key:"",value:""})}function f(k){c.value.envRows.splice(k,1)}async function p(){s.value=!0,o.value=null;try{const k=await Se("/api/mcp/servers");if(!k.ok)throw new Error(`HTTP ${k.status}`);const x=await k.json();t.value=x.servers??[]}catch(k){o.value=k instanceof Error?k.message:"Failed to load servers"}finally{s.value=!1}}async function b(k){const x=new Set(i.value);x.add(k),i.value=x;try{const E=await Se(`/api/mcp/servers/${encodeURIComponent(k)}/toggle`,{method:"PATCH"});if(!E.ok)throw new Error(`HTTP ${E.status}`);const A=await E.json(),N=t.value.find(O=>O.name===k);N&&(N.enabled=A.enabled),u(`${k} ${A.enabled?"enabled":"disabled"} -- reload to apply`)}catch(E){o.value=E instanceof Error?E.message:"Toggle failed"}finally{const E=new Set(i.value);E.delete(k),i.value=E}}async function v(k){if(!window.confirm(`Remove MCP server "${k}"?`))return;const x=new Set(a.value);x.add(k),a.value=x;try{const E=await Se(`/api/mcp/servers/${encodeURIComponent(k)}`,{method:"DELETE"});if(!E.ok)throw new Error(`HTTP ${E.status}`);t.value=t.value.filter(A=>A.name!==k),u(`${k} removed -- reload to apply`)}catch(E){o.value=E instanceof Error?E.message:"Delete failed"}finally{const E=new Set(a.value);E.delete(k),a.value=E}}async function T(){o.value=null,r.value=!0;try{const k={};for(const A of c.value.envRows)A.key.trim()&&(k[A.key.trim()]=A.value);const x={name:c.value.name};c.value.transport==="stdio"?(x.command=c.value.command,c.value.args.trim()&&(x.args=c.value.args.trim().split(/\s+/))):x.url=c.value.url,Object.keys(k).length&&(x.env=k);const E=await Se("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!E.ok){const A=await E.json();throw new Error(A.error??`HTTP ${E.status}`)}c.value={name:"",transport:"stdio",command:"",args:"",url:"",envRows:[]},await p(),u("Server added -- reload to activate tools")}catch(k){o.value=k instanceof Error?k.message:"Failed to add server"}finally{r.value=!1}}async function R(){n.value=!0,o.value=null;try{const k=await Se("/api/mcp/reload",{method:"POST"});if(!k.ok)throw new Error(`HTTP ${k.status}`);await p(),u("MCP tools reloaded successfully")}catch(k){o.value=k instanceof Error?k.message:"Reload failed"}finally{n.value=!1}}return yt(p),(k,x)=>(g(),m("div",aE,[h("div",oE,[x[7]||(x[7]=h("div",null,[h("h2",{class:"text-xl font-bold text-txt-primary tracking-tight"},"MCP Servers"),h("p",{class:"text-xs text-txt-muted mt-0.5"},"Manage Model Context Protocol servers and their tools")],-1)),h("button",{onClick:R,disabled:n.value,class:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-accent/10 border border-accent/20 text-accent text-xs font-medium hover:bg-accent/20 disabled:opacity-50 disabled:cursor-wait transition-all duration-150",title:"Reload MCP tools (applies config changes)"},[(g(),m("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:ce(["w-3.5 h-3.5",n.value?"animate-spin":""]),"aria-hidden":"true"},[...x[6]||(x[6]=[h("path",{"fill-rule":"evenodd",d:"M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0v2.43l-.31-.31a7 7 0 0 0-11.712 3.138.75.75 0 0 0 1.449.39A5.5 5.5 0 0 1 13.89 5.05l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z","clip-rule":"evenodd"},null,-1)])],2)),fe(" "+C(n.value?"Reloading...":"Reload Tools"),1)],8,lE)]),o.value?(g(),m("div",cE,[x[8]||(x[8]=h("span",null,"!",-1)),fe(" "+C(o.value),1)])):B("",!0),l.value?(g(),m("div",uE,[x[9]||(x[9]=h("span",null,"OK",-1)),fe(" "+C(l.value),1)])):B("",!0),h("div",dE,[x[12]||(x[12]=h("h3",{class:"text-xs font-semibold text-txt-muted uppercase tracking-wider mb-3"},"Configured Servers",-1)),s.value?(g(),m("div",hE,[...x[10]||(x[10]=[h("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"},null,-1),fe(" Loading... ",-1)])])):t.value.length===0?(g(),m("div",fE," No MCP servers configured. Add one below. ")):(g(),m("ul",pE,[(g(!0),m(we,null,Me(t.value,E=>(g(),m("li",{key:E.name,class:ce(["flex items-center gap-3 p-3 bg-surface-2/50 border border-edge rounded-xl hover:border-edge-bright transition-all duration-150 group",E.enabled===!1?"opacity-60":""])},[h("span",{class:ce(["w-2 h-2 rounded-full shrink-0",E.enabled===!1?"bg-txt-muted":"bg-green-400"])},null,2),h("div",gE,[h("div",mE,[h("span",bE,C(E.name),1),h("span",vE,C(E.url?"SSE":"stdio"),1)]),h("p",yE,C(E.url??[E.command,...E.args??[]].join(" ")),1)]),h("div",_E,[h("button",{onClick:A=>b(E.name),disabled:i.value.has(E.name),class:ce(["px-2 py-1 rounded-lg text-xs font-medium border transition-all duration-150 disabled:opacity-40",E.enabled===!1?"text-txt-muted border-edge hover:text-txt-primary hover:border-edge-bright":"text-accent border-accent/30 hover:bg-accent/10"])},C(E.enabled===!1?"Enable":"Disable"),11,xE),h("button",{onClick:A=>v(E.name),disabled:a.value.has(E.name),class:"p-1.5 rounded-lg text-txt-muted hover:text-red-400 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 disabled:opacity-40 transition-all duration-150",title:"Remove server"},[...x[11]||(x[11]=[h("svg",{viewBox:"0 0 20 20",fill:"currentColor",class:"w-4 h-4","aria-hidden":"true"},[h("path",{"fill-rule":"evenodd",d:"M8.75 1A2.75 2.75 0 0 0 6 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 1 0 .23 1.482l.149-.022.841 10.518A2.75 2.75 0 0 0 7.596 19h4.807a2.75 2.75 0 0 0 2.742-2.53l.841-10.52.149.023a.75.75 0 0 0 .23-1.482A41.03 41.03 0 0 0 14 4.193V3.75A2.75 2.75 0 0 0 11.25 1h-2.5ZM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4ZM8.58 7.72a.75.75 0 0 0-1.5.06l.3 7.5a.75.75 0 1 0 1.5-.06l-.3-7.5Zm4.34.06a.75.75 0 1 0-1.5-.06l-.3 7.5a.75.75 0 1 0 1.5.06l.3-7.5Z","clip-rule":"evenodd"})],-1)])],8,wE)])],2))),128))]))]),h("div",kE,[x[20]||(x[20]=h("h3",{class:"text-xs font-semibold text-txt-muted uppercase tracking-wider mb-4"},"Add Server",-1)),h("form",{onSubmit:Ye(T,["prevent"]),class:"space-y-3"},[h("div",null,[x[13]||(x[13]=h("label",{class:"block text-xs font-medium text-txt-secondary mb-1"},"Name *",-1)),Be(h("input",{"onUpdate:modelValue":x[0]||(x[0]=E=>c.value.name=E),type:"text",placeholder:"e.g. github, postgres",class:"w-full bg-surface-2/50 border border-edge text-txt-primary text-sm rounded-lg px-3 py-2 placeholder:text-txt-muted focus:outline-none focus:border-accent/60 transition-colors",required:""},null,512),[[ze,c.value.name]])]),h("div",EE,[h("label",SE,[Be(h("input",{"onUpdate:modelValue":x[1]||(x[1]=E=>c.value.transport=E),type:"radio",value:"stdio",class:"accent-accent"},null,512),[[Ao,c.value.transport]]),x[14]||(x[14]=fe(" stdio (command) ",-1))]),h("label",TE,[Be(h("input",{"onUpdate:modelValue":x[2]||(x[2]=E=>c.value.transport=E),type:"radio",value:"sse",class:"accent-accent"},null,512),[[Ao,c.value.transport]]),x[15]||(x[15]=fe(" SSE (URL) ",-1))])]),c.value.transport==="stdio"?(g(),m(we,{key:0},[h("div",null,[x[16]||(x[16]=h("label",{class:"block text-xs font-medium text-txt-secondary mb-1"},"Command *",-1)),Be(h("input",{"onUpdate:modelValue":x[3]||(x[3]=E=>c.value.command=E),type:"text",placeholder:"e.g. npx",class:"w-full bg-surface-2/50 border border-edge text-txt-primary text-sm rounded-lg px-3 py-2 placeholder:text-txt-muted focus:outline-none focus:border-accent/60 transition-colors"},null,512),[[ze,c.value.command]])]),h("div",null,[x[17]||(x[17]=h("label",{class:"block text-xs font-medium text-txt-secondary mb-1"},[fe("Args "),h("span",{class:"text-txt-muted font-normal"},"(space-separated)")],-1)),Be(h("input",{"onUpdate:modelValue":x[4]||(x[4]=E=>c.value.args=E),type:"text",placeholder:"e.g. -y @modelcontextprotocol/server-github",class:"w-full bg-surface-2/50 border border-edge text-txt-primary text-sm rounded-lg px-3 py-2 placeholder:text-txt-muted focus:outline-none focus:border-accent/60 transition-colors"},null,512),[[ze,c.value.args]])])],64)):B("",!0),c.value.transport==="sse"?(g(),m("div",AE,[x[18]||(x[18]=h("label",{class:"block text-xs font-medium text-txt-secondary mb-1"},"URL *",-1)),Be(h("input",{"onUpdate:modelValue":x[5]||(x[5]=E=>c.value.url=E),type:"url",placeholder:"e.g. http://localhost:3001/sse",class:"w-full bg-surface-2/50 border border-edge text-txt-primary text-sm rounded-lg px-3 py-2 placeholder:text-txt-muted focus:outline-none focus:border-accent/60 transition-colors"},null,512),[[ze,c.value.url]])])):B("",!0),h("div",null,[h("div",{class:"flex items-center justify-between mb-1"},[x[19]||(x[19]=h("label",{class:"text-xs font-medium text-txt-secondary"},"Environment Variables",-1)),h("button",{type:"button",onClick:d,class:"text-[11px] text-accent hover:text-accent/80 transition-colors"},"+ Add")]),(g(!0),m(we,null,Me(c.value.envRows,(E,A)=>(g(),m("div",{key:A,class:"flex gap-2 mb-1.5"},[Be(h("input",{"onUpdate:modelValue":N=>E.key=N,type:"text",placeholder:"KEY",class:"flex-1 bg-surface-2/50 border border-edge text-txt-primary text-xs rounded-lg px-2 py-1.5 placeholder:text-txt-muted font-mono focus:outline-none focus:border-accent/60 transition-colors"},null,8,RE),[[ze,E.key]]),Be(h("input",{"onUpdate:modelValue":N=>E.value=N,type:"text",placeholder:"value",class:"flex-1 bg-surface-2/50 border border-edge text-txt-primary text-xs rounded-lg px-2 py-1.5 placeholder:text-txt-muted font-mono focus:outline-none focus:border-accent/60 transition-colors"},null,8,CE),[[ze,E.value]]),h("button",{type:"button",onClick:N=>f(A),class:"text-txt-muted hover:text-red-400 transition-colors px-1"},"x",8,OE)]))),128))]),h("button",{type:"submit",disabled:r.value,class:"px-4 py-2 bg-accent/10 border border-accent/30 text-accent text-sm font-medium rounded-lg hover:bg-accent/20 disabled:opacity-50 disabled:cursor-wait transition-all duration-150"},C(r.value?"Adding...":"Add Server"),9,$E)],32)])]))}}),bd=ag({history:Bp("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:iE,meta:{public:!0}},{path:"/chat",name:"chat",component:H1},{path:"/skills",name:"skills",component:Uy},{path:"/squads",name:"squads",component:xx},{path:"/activity",name:"activity",component:Bw},{path:"/wiki",name:"wiki",component:Qk},{path:"/schedules",name:"schedules",component:l2},{path:"/feed",name:"feed",component:fk},{path:"/inbox",name:"inbox",component:Ok},{path:"/notifications",redirect:"/feed"},{path:"/mcp",name:"mcp",component:NE}]});bd.beforeEach(async e=>{const t=rr();return t.initialized||await t.init(),!t.authEnabled||e.meta.public||t.user?!0:{name:"login"}});const ja=Gf(a1);ja.use(Yf());ja.use(bd);ja.mount("#app");
|