heyio 0.36.0 → 0.38.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/package.json +1 -1
- package/web-dist/assets/AgentActivityView-9D_RDmmt.js +1 -0
- package/web-dist/assets/ChatView-5ySvKPi9.js +4 -0
- package/web-dist/assets/FeedView-BDaNijfW.js +1 -0
- package/web-dist/assets/InboxView-DKP-ahnW.js +1 -0
- package/web-dist/assets/LoginView-BHp6tqp8.js +1 -0
- package/web-dist/assets/McpView-CWYN7lRW.js +1 -0
- package/web-dist/assets/SchedulesView-BpcU8RrX.js +1 -0
- package/web-dist/assets/SettingsTabs.vue_vue_type_script_setup_true_lang-CYIbgQ2F.js +1 -0
- package/web-dist/assets/SkillsView-BHoQKBHu.js +1 -0
- package/web-dist/assets/SquadsView-Bg--LUPA.js +1 -0
- package/web-dist/assets/StatusIndicator.vue_vue_type_script_setup_true_lang-BpggUfx8.js +1 -0
- package/web-dist/assets/WikiView-CqfWT-Hg.js +1 -0
- package/web-dist/assets/index-Cilo_iXJ.js +81 -0
- package/web-dist/assets/index-VErxBQJ_.css +10 -0
- package/web-dist/index.html +4 -4
- package/web-dist/assets/index-BF3SnkDw.css +0 -10
- package/web-dist/assets/index-DmOgGsHI.js +0 -88
|
@@ -1,88 +0,0 @@
|
|
|
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"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(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 s(r){if(r.ep)return;r.ep=!0;const i=n(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 bo(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Ie={},ns=[],Ht=()=>{},Kl=()=>!1,Vr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),qr=e=>e.startsWith("onUpdate:"),Ze=Object.assign,vo=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Td=Object.prototype.hasOwnProperty,Ce=(e,t)=>Td.call(e,t),me=Array.isArray,ss=e=>nr(e)==="[object Map]",ds=e=>nr(e)==="[object Set]",Yo=e=>nr(e)==="[object Date]",Ee=e=>typeof e=="function",je=e=>typeof e=="string",wt=e=>typeof e=="symbol",$e=e=>e!==null&&typeof e=="object",Wl=e=>($e(e)||Ee(e))&&Ee(e.then)&&Ee(e.catch),Gl=Object.prototype.toString,nr=e=>Gl.call(e),Ad=e=>nr(e).slice(8,-1),zl=e=>nr(e)==="[object Object]",Kr=e=>je(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ts=bo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Wr=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Rd=/-\w/g,ct=Wr(e=>e.replace(Rd,t=>t.slice(1).toUpperCase())),Cd=/\B([A-Z])/g,wn=Wr(e=>e.replace(Cd,"-$1").toLowerCase()),Gr=Wr(e=>e.charAt(0).toUpperCase()+e.slice(1)),pi=Wr(e=>e?`on${Gr(e)}`:""),Bt=(e,t)=>!Object.is(e,t),wr=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Jl=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},zr=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Od=e=>{const t=je(e)?Number(e):NaN;return isNaN(t)?e:t};let Xo;const Jr=()=>Xo||(Xo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function yo(e){if(me(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],r=je(s)?Pd(s):yo(s);if(r)for(const i in r)t[i]=r[i]}return t}else if(je(e)||$e(e))return e}const $d=/;(?![^(]*\))/g,Nd=/:([^]+)/,Id=/\/\*[^]*?\*\//g;function Pd(e){const t={};return e.replace(Id,"").split($d).forEach(n=>{if(n){const s=n.split(Nd);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function Te(e){let t="";if(je(e))t=e;else if(me(e))for(let n=0;n<e.length;n++){const s=Te(e[n]);s&&(t+=s+" ")}else if($e(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Ld="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Md=bo(Ld);function Zl(e){return!!e||e===""}function jd(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=hs(e[s],t[s]);return n}function hs(e,t){if(e===t)return!0;let n=Yo(e),s=Yo(t);if(n||s)return n&&s?e.getTime()===t.getTime():!1;if(n=wt(e),s=wt(t),n||s)return e===t;if(n=me(e),s=me(t),n||s)return n&&s?jd(e,t):!1;if(n=$e(e),s=$e(t),n||s){if(!n||!s)return!1;const r=Object.keys(e).length,i=Object.keys(t).length;if(r!==i)return!1;for(const o in e){const a=e.hasOwnProperty(o),l=t.hasOwnProperty(o);if(a&&!l||!a&&l||!hs(e[o],t[o]))return!1}}return String(e)===String(t)}function _o(e,t){return e.findIndex(n=>hs(n,t))}const Yl=e=>!!(e&&e.__v_isRef===!0),U=e=>je(e)?e:e==null?"":me(e)||$e(e)&&(e.toString===Gl||!Ee(e.toString))?Yl(e)?U(e.value):JSON.stringify(e,Xl,2):String(e),Xl=(e,t)=>Yl(t)?Xl(e,t.value):ss(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],i)=>(n[gi(s,i)+" =>"]=r,n),{})}:ds(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>gi(n))}:wt(t)?gi(t):$e(t)&&!me(t)&&!zl(t)?String(t):t,gi=(e,t="")=>{var n;return wt(e)?`Symbol(${(n=e.description)!=null?n: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,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=Je;try{return Je=this,t()}finally{Je=n}}}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 n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(this.effects.length=0,n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,s=this.scopes.length;n<s;n++)this.scopes[n].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 ec(e){return new Ql(e)}function tc(){return Je}function Dd(e,t=!1){Je&&Je.cleanups.push(e)}let Le;const mi=new WeakSet;class nc{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,mi.has(this)&&(mi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||rc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Qo(this),ic(this);const t=Le,n=Tt;Le=this,Tt=!0;try{return this.fn()}finally{oc(this),Le=t,Tt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Eo(t);this.deps=this.depsTail=void 0,Qo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?mi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ji(this)&&this.run()}get dirty(){return ji(this)}}let sc=0,As,Rs;function rc(e,t=!1){if(e.flags|=8,t){e.next=Rs,Rs=e;return}e.next=As,As=e}function wo(){sc++}function xo(){if(--sc>0)return;if(Rs){let t=Rs;for(Rs=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;As;){let t=As;for(As=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function ic(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function oc(e){let t,n=e.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),Eo(s),Ud(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}e.deps=t,e.depsTail=n}function ji(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ac(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ac(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ds)||(e.globalVersion=Ds,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ji(e))))return;e.flags|=2;const t=e.dep,n=Le,s=Tt;Le=e,Tt=!0;try{ic(e);const r=e.fn(e._value);(t.version===0||Bt(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Le=n,Tt=s,oc(e),e.flags&=-3}}function Eo(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)Eo(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ud(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Tt=!0;const lc=[];function tn(){lc.push(Tt),Tt=!1}function nn(){const e=lc.pop();Tt=e===void 0?!0:e}function Qo(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Le;Le=void 0;try{t()}finally{Le=n}}}let Ds=0;class Bd{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ko{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(!Le||!Tt||Le===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Le)n=this.activeLink=new Bd(Le,this),Le.deps?(n.prevDep=Le.depsTail,Le.depsTail.nextDep=n,Le.depsTail=n):Le.deps=Le.depsTail=n,cc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=Le.depsTail,n.nextDep=void 0,Le.depsTail.nextDep=n,Le.depsTail=n,Le.deps===n&&(Le.deps=s)}return n}trigger(t){this.version++,Ds++,this.notify(t)}notify(t){wo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{xo()}}}function cc(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)cc(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Tr=new WeakMap,Ln=Symbol(""),Di=Symbol(""),Us=Symbol("");function et(e,t,n){if(Tt&&Le){let s=Tr.get(e);s||Tr.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new ko),r.map=s,r.key=n),r.track()}}function Zt(e,t,n,s,r,i){const o=Tr.get(e);if(!o){Ds++;return}const a=l=>{l&&l.trigger()};if(wo(),t==="clear")o.forEach(a);else{const l=me(e),c=l&&Kr(n);if(l&&n==="length"){const u=Number(s);o.forEach((d,h)=>{(h==="length"||h===Us||!wt(h)&&h>=u)&&a(d)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(Us)),t){case"add":l?c&&a(o.get("length")):(a(o.get(Ln)),ss(e)&&a(o.get(Di)));break;case"delete":l||(a(o.get(Ln)),ss(e)&&a(o.get(Di)));break;case"set":ss(e)&&a(o.get(Ln));break}}xo()}function Hd(e,t){const n=Tr.get(e);return n&&n.get(t)}function Bn(e){const t=Ae(e);return t===e?t:(et(t,"iterate",Us),gt(e)?t:t.map(Rt))}function Zr(e){return et(e=Ae(e),"iterate",Us),e}function jt(e,t){return sn(e)?os(Xt(e)?Rt(t):t):Rt(t)}const Fd={__proto__:null,[Symbol.iterator](){return bi(this,Symbol.iterator,e=>jt(this,e))},concat(...e){return Bn(this).concat(...e.map(t=>me(t)?Bn(t):t))},entries(){return bi(this,"entries",e=>(e[1]=jt(this,e[1]),e))},every(e,t){return Ft(this,"every",e,t,void 0,arguments)},filter(e,t){return Ft(this,"filter",e,t,n=>n.map(s=>jt(this,s)),arguments)},find(e,t){return Ft(this,"find",e,t,n=>jt(this,n),arguments)},findIndex(e,t){return Ft(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ft(this,"findLast",e,t,n=>jt(this,n),arguments)},findLastIndex(e,t){return Ft(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ft(this,"forEach",e,t,void 0,arguments)},includes(...e){return vi(this,"includes",e)},indexOf(...e){return vi(this,"indexOf",e)},join(e){return Bn(this).join(e)},lastIndexOf(...e){return vi(this,"lastIndexOf",e)},map(e,t){return Ft(this,"map",e,t,void 0,arguments)},pop(){return ms(this,"pop")},push(...e){return ms(this,"push",e)},reduce(e,...t){return ea(this,"reduce",e,t)},reduceRight(e,...t){return ea(this,"reduceRight",e,t)},shift(){return ms(this,"shift")},some(e,t){return Ft(this,"some",e,t,void 0,arguments)},splice(...e){return ms(this,"splice",e)},toReversed(){return Bn(this).toReversed()},toSorted(e){return Bn(this).toSorted(e)},toSpliced(...e){return Bn(this).toSpliced(...e)},unshift(...e){return ms(this,"unshift",e)},values(){return bi(this,"values",e=>jt(this,e))}};function bi(e,t,n){const s=Zr(e),r=s[t]();return s!==e&&!gt(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const Vd=Array.prototype;function Ft(e,t,n,s,r,i){const o=Zr(e),a=o!==e&&!gt(e),l=o[t];if(l!==Vd[t]){const d=l.apply(e,i);return a?Rt(d):d}let c=n;o!==e&&(a?c=function(d,h){return n.call(this,jt(e,d),h,e)}:n.length>2&&(c=function(d,h){return n.call(this,d,h,e)}));const u=l.call(o,c,s);return a&&r?r(u):u}function ea(e,t,n,s){const r=Zr(e),i=r!==e&&!gt(e);let o=n,a=!1;r!==e&&(i?(a=s.length===0,o=function(c,u,d){return a&&(a=!1,c=jt(e,c)),n.call(this,c,jt(e,u),d,e)}):n.length>3&&(o=function(c,u,d){return n.call(this,c,u,d,e)}));const l=r[t](o,...s);return a?jt(e,l):l}function vi(e,t,n){const s=Ae(e);et(s,"iterate",Us);const r=s[t](...n);return(r===-1||r===!1)&&Yr(n[0])?(n[0]=Ae(n[0]),s[t](...n)):r}function ms(e,t,n=[]){tn(),wo();const s=Ae(e)[t].apply(e,n);return xo(),nn(),s}const qd=bo("__proto__,__v_isRef,__isVue"),uc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(wt));function Kd(e){wt(e)||(e=String(e));const t=Ae(this);return et(t,"has",e),t.hasOwnProperty(e)}class dc{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return i;if(n==="__v_raw")return s===(r?i?th:gc:i?pc:fc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=me(t);if(!r){let l;if(o&&(l=Fd[n]))return l;if(n==="hasOwnProperty")return Kd}const a=Reflect.get(t,n,Fe(t)?t:s);if((wt(n)?uc.has(n):qd(n))||(r||et(t,"get",n),i))return a;if(Fe(a)){const l=o&&Kr(n)?a:a.value;return r&&$e(l)?Bi(l):l}return $e(a)?r?Bi(a):at(a):a}}class hc extends dc{constructor(t=!1){super(!1,t)}set(t,n,s,r){let i=t[n];const o=me(t)&&Kr(n);if(!this._isShallow){const c=sn(i);if(!gt(s)&&!sn(s)&&(i=Ae(i),s=Ae(s)),!o&&Fe(i)&&!Fe(s))return c||(i.value=s),!0}const a=o?Number(n)<t.length:Ce(t,n),l=Reflect.set(t,n,s,Fe(t)?t:r);return t===Ae(r)&&(a?Bt(s,i)&&Zt(t,"set",n,s):Zt(t,"add",n,s)),l}deleteProperty(t,n){const s=Ce(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&s&&Zt(t,"delete",n,void 0),r}has(t,n){const s=Reflect.has(t,n);return(!wt(n)||!uc.has(n))&&et(t,"has",n),s}ownKeys(t){return et(t,"iterate",me(t)?"length":Ln),Reflect.ownKeys(t)}}class Wd extends dc{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Gd=new hc,zd=new Wd,Jd=new hc(!0);const Ui=e=>e,or=e=>Reflect.getPrototypeOf(e);function Zd(e,t,n){return function(...s){const r=this.__v_raw,i=Ae(r),o=ss(i),a=e==="entries"||e===Symbol.iterator&&o,l=e==="keys"&&o,c=r[e](...s),u=n?Ui:t?os:Rt;return!t&&et(i,"iterate",l?Di:Ln),Ze(Object.create(c),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:a?[u(d[0]),u(d[1])]:u(d),done:h}}})}}function ar(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Yd(e,t){const n={get(r){const i=this.__v_raw,o=Ae(i),a=Ae(r);e||(Bt(r,a)&&et(o,"get",r),et(o,"get",a));const{has:l}=or(o),c=t?Ui:e?os:Rt;if(l.call(o,r))return c(i.get(r));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!e&&et(Ae(r),"iterate",Ln),r.size},has(r){const i=this.__v_raw,o=Ae(i),a=Ae(r);return e||(Bt(r,a)&&et(o,"has",r),et(o,"has",a)),r===a?i.has(r):i.has(r)||i.has(a)},forEach(r,i){const o=this,a=o.__v_raw,l=Ae(a),c=t?Ui:e?os:Rt;return!e&&et(l,"iterate",Ln),a.forEach((u,d)=>r.call(i,c(u),c(d),o))}};return Ze(n,e?{add:ar("add"),set:ar("set"),delete:ar("delete"),clear:ar("clear")}:{add(r){const i=Ae(this),o=or(i),a=Ae(r),l=!t&&!gt(r)&&!sn(r)?a:r;return o.has.call(i,l)||Bt(r,l)&&o.has.call(i,r)||Bt(a,l)&&o.has.call(i,a)||(i.add(l),Zt(i,"add",l,l)),this},set(r,i){!t&&!gt(i)&&!sn(i)&&(i=Ae(i));const o=Ae(this),{has:a,get:l}=or(o);let c=a.call(o,r);c||(r=Ae(r),c=a.call(o,r));const u=l.call(o,r);return o.set(r,i),c?Bt(i,u)&&Zt(o,"set",r,i):Zt(o,"add",r,i),this},delete(r){const i=Ae(this),{has:o,get:a}=or(i);let l=o.call(i,r);l||(r=Ae(r),l=o.call(i,r)),a&&a.call(i,r);const c=i.delete(r);return l&&Zt(i,"delete",r,void 0),c},clear(){const r=Ae(this),i=r.size!==0,o=r.clear();return i&&Zt(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=Zd(r,e,t)}),n}function So(e,t){const n=Yd(e,t);return(s,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(Ce(n,r)&&r in s?n:s,r,i)}const Xd={get:So(!1,!1)},Qd={get:So(!1,!0)},eh={get:So(!0,!1)};const fc=new WeakMap,pc=new WeakMap,gc=new WeakMap,th=new WeakMap;function nh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function sh(e){return e.__v_skip||!Object.isExtensible(e)?0:nh(Ad(e))}function at(e){return sn(e)?e:To(e,!1,Gd,Xd,fc)}function mc(e){return To(e,!1,Jd,Qd,pc)}function Bi(e){return To(e,!0,zd,eh,gc)}function To(e,t,n,s,r){if(!$e(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=sh(e);if(i===0)return e;const o=r.get(e);if(o)return o;const a=new Proxy(e,i===2?s:n);return r.set(e,a),a}function Xt(e){return sn(e)?Xt(e.__v_raw):!!(e&&e.__v_isReactive)}function sn(e){return!!(e&&e.__v_isReadonly)}function gt(e){return!!(e&&e.__v_isShallow)}function Yr(e){return e?!!e.__v_raw:!1}function Ae(e){const t=e&&e.__v_raw;return t?Ae(t):e}function Ao(e){return!Ce(e,"__v_skip")&&Object.isExtensible(e)&&Jl(e,"__v_skip",!0),e}const Rt=e=>$e(e)?at(e):e,os=e=>$e(e)?Bi(e):e;function Fe(e){return e?e.__v_isRef===!0:!1}function B(e){return bc(e,!1)}function rh(e){return bc(e,!0)}function bc(e,t){return Fe(e)?e:new ih(e,t)}class ih{constructor(t,n){this.dep=new ko,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Ae(t),this._value=n?t:Rt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||gt(t)||sn(t);t=s?t:Ae(t),Bt(t,n)&&(this._rawValue=t,this._value=s?t:Rt(t),this.dep.trigger())}}function De(e){return Fe(e)?e.value:e}const oh={get:(e,t,n)=>t==="__v_raw"?e:De(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return Fe(r)&&!Fe(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function vc(e){return Xt(e)?e:new Proxy(e,oh)}function ah(e){const t=me(e)?new Array(e.length):{};for(const n in e)t[n]=ch(e,n);return t}class lh{constructor(t,n,s){this._object=t,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._key=wt(n)?n:String(n),this._raw=Ae(t);let r=!0,i=t;if(!me(t)||wt(this._key)||!Kr(this._key))do r=!Yr(i)||gt(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let t=this._object[this._key];return this._shallow&&(t=De(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Fe(this._raw[this._key])){const n=this._object[this._key];if(Fe(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return Hd(this._raw,this._key)}}function ch(e,t,n){return new lh(e,t,n)}class uh{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ko(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ds-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&Le!==this)return rc(this,!0),!0}get value(){const t=this.dep.track();return ac(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function dh(e,t,n=!1){let s,r;return Ee(e)?s=e:(s=e.get,r=e.set),new uh(s,r,n)}const lr={},Ar=new WeakMap;let Cn;function hh(e,t=!1,n=Cn){if(n){let s=Ar.get(n);s||Ar.set(n,s=[]),s.push(e)}}function fh(e,t,n=Ie){const{immediate:s,deep:r,once:i,scheduler:o,augmentJob:a,call:l}=n,c=k=>r?k:gt(k)||r===!1||r===0?Yt(k,1):Yt(k);let u,d,h,f,g=!1,b=!1;if(Fe(e)?(d=()=>e.value,g=gt(e)):Xt(e)?(d=()=>c(e),g=!0):me(e)?(b=!0,g=e.some(k=>Xt(k)||gt(k)),d=()=>e.map(k=>{if(Fe(k))return k.value;if(Xt(k))return c(k);if(Ee(k))return l?l(k,2):k()})):Ee(e)?t?d=l?()=>l(e,2):e:d=()=>{if(h){tn();try{h()}finally{nn()}}const k=Cn;Cn=u;try{return l?l(e,3,[f]):e(f)}finally{Cn=k}}:d=Ht,t&&r){const k=d,$=r===!0?1/0:r;d=()=>Yt(k(),$)}const T=tc(),E=()=>{u.stop(),T&&T.active&&vo(T.effects,u)};if(i&&t){const k=t;t=(...$)=>{k(...$),E()}}let m=b?new Array(e.length).fill(lr):lr;const x=k=>{if(!(!(u.flags&1)||!u.dirty&&!k))if(t){const $=u.run();if(r||g||(b?$.some((D,S)=>Bt(D,m[S])):Bt($,m))){h&&h();const D=Cn;Cn=u;try{const S=[$,m===lr?void 0:b&&m[0]===lr?[]:m,f];m=$,l?l(t,3,S):t(...S)}finally{Cn=D}}}else u.run()};return a&&a(x),u=new nc(d),u.scheduler=o?()=>o(x,!1):x,f=k=>hh(k,!1,u),h=u.onStop=()=>{const k=Ar.get(u);if(k){if(l)l(k,4);else for(const $ of k)$();Ar.delete(u)}},t?s?x(!0):m=u.run():o?o(x.bind(null,!0),!0):u.run(),E.pause=u.pause.bind(u),E.resume=u.resume.bind(u),E.stop=E,E}function Yt(e,t=1/0,n){if(t<=0||!$e(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Fe(e))Yt(e.value,t,n);else if(me(e))for(let s=0;s<e.length;s++)Yt(e[s],t,n);else if(ds(e)||ss(e))e.forEach(s=>{Yt(s,t,n)});else if(zl(e)){for(const s in e)Yt(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&Yt(e[s],t,n)}return e}/**
|
|
10
|
-
* @vue/runtime-core v3.5.34
|
|
11
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
-
* @license MIT
|
|
13
|
-
**/function sr(e,t,n,s){try{return s?e(...s):e()}catch(r){Xr(r,t,n)}}function Ct(e,t,n,s){if(Ee(e)){const r=sr(e,t,n,s);return r&&Wl(r)&&r.catch(i=>{Xr(i,t,n)}),r}if(me(e)){const r=[];for(let i=0;i<e.length;i++)r.push(Ct(e[i],t,n,s));return r}}function Xr(e,t,n,s=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||Ie;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,l,c)===!1)return}a=a.parent}if(i){tn(),sr(i,null,10,[e,l,c]),nn();return}}ph(e,n,r,s,o)}function ph(e,t,n,s=!0,r=!1){if(r)throw e;console.error(e)}const ot=[];let Pt=-1;const rs=[];let fn=null,zn=0;const yc=Promise.resolve();let Rr=null;function At(e){const t=Rr||yc;return e?t.then(this?e.bind(this):e):t}function gh(e){let t=Pt+1,n=ot.length;for(;t<n;){const s=t+n>>>1,r=ot[s],i=Bs(r);i<e||i===e&&r.flags&2?t=s+1:n=s}return t}function Ro(e){if(!(e.flags&1)){const t=Bs(e),n=ot[ot.length-1];!n||!(e.flags&2)&&t>=Bs(n)?ot.push(e):ot.splice(gh(t),0,e),e.flags|=1,_c()}}function _c(){Rr||(Rr=yc.then(xc))}function mh(e){me(e)?rs.push(...e):fn&&e.id===-1?fn.splice(zn+1,0,e):e.flags&1||(rs.push(e),e.flags|=1),_c()}function ta(e,t,n=Pt+1){for(;n<ot.length;n++){const s=ot[n];if(s&&s.flags&2){if(e&&s.id!==e.uid)continue;ot.splice(n,1),n--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function wc(e){if(rs.length){const t=[...new Set(rs)].sort((n,s)=>Bs(n)-Bs(s));if(rs.length=0,fn){fn.push(...t);return}for(fn=t,zn=0;zn<fn.length;zn++){const n=fn[zn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}fn=null,zn=0}}const Bs=e=>e.id==null?e.flags&2?-1:1/0:e.id;function xc(e){try{for(Pt=0;Pt<ot.length;Pt++){const t=ot[Pt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),sr(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Pt<ot.length;Pt++){const t=ot[Pt];t&&(t.flags&=-2)}Pt=-1,ot.length=0,wc(),Rr=null,(ot.length||rs.length)&&xc()}}let ft=null,Ec=null;function Cr(e){const t=ft;return ft=e,Ec=e&&e.type.__scopeId||null,t}function yn(e,t=ft,n){if(!t||e._n)return e;const s=(...r)=>{s._d&&Nr(-1);const i=Cr(t);let o;try{o=e(...r)}finally{Cr(i),s._d&&Nr(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function Ue(e,t){if(ft===null)return e;const n=si(ft),s=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[i,o,a,l=Ie]=t[r];i&&(Ee(i)&&(i={mounted:i,updated:i}),i.deep&&Yt(o),s.push({dir:i,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return e}function En(e,t,n,s){const r=e.dirs,i=t&&t.dirs;for(let o=0;o<r.length;o++){const a=r[o];i&&(a.oldValue=i[o].value);let l=a.dir[s];l&&(tn(),Ct(l,n,8,[e.el,a,e,t]),nn())}}function xr(e,t){if(tt){let n=tt.provides;const s=tt.parent&&tt.parent.provides;s===n&&(n=tt.provides=Object.create(s)),n[e]=t}}function _t(e,t,n=!1){const s=Lo();if(s||Mn){let r=Mn?Mn._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&Ee(t)?t.call(s&&s.proxy):t}}function bh(){return!!(Lo()||Mn)}const vh=Symbol.for("v-scx"),yh=()=>_t(vh);function mt(e,t,n){return kc(e,t,n)}function kc(e,t,n=Ie){const{immediate:s,deep:r,flush:i,once:o}=n,a=Ze({},n),l=t&&s||!t&&i!=="post";let c;if(Vs){if(i==="sync"){const f=yh();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Ht,f.resume=Ht,f.pause=Ht,f}}const u=tt;a.call=(f,g,b)=>Ct(f,u,g,b);let d=!1;i==="post"?a.scheduler=f=>{rt(f,u&&u.suspense)}:i!=="sync"&&(d=!0,a.scheduler=(f,g)=>{g?f():Ro(f)}),a.augmentJob=f=>{t&&(f.flags|=4),d&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const h=fh(e,t,a);return Vs&&(c?c.push(h):l&&h()),h}function _h(e,t,n){const s=this.proxy,r=je(e)?e.includes(".")?Sc(s,e):()=>s[e]:e.bind(s,s);let i;Ee(t)?i=t:(i=t.handler,n=t);const o=rr(this),a=kc(r,i.bind(s),n);return o(),a}function Sc(e,t){const n=t.split(".");return()=>{let s=e;for(let r=0;r<n.length&&s;r++)s=s[n[r]];return s}}const dn=new WeakMap,Tc=Symbol("_vte"),Ac=e=>e.__isTeleport,$n=e=>e&&(e.disabled||e.disabled===""),wh=e=>e&&(e.defer||e.defer===""),na=e=>typeof SVGElement<"u"&&e instanceof SVGElement,sa=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Hi=(e,t)=>{const n=e&&e.to;return je(n)?t?t(n):null:n},xh={name:"Teleport",__isTeleport:!0,process(e,t,n,s,r,i,o,a,l,c){const{mc:u,pc:d,pbc:h,o:{insert:f,querySelector:g,createText:b,createComment:T,parentNode:E}}=c,m=$n(t.props);let{dynamicChildren:x}=t;const k=(S,R,C)=>{S.shapeFlag&16&&u(S.children,R,C,r,i,o,a,l)},$=(S=t)=>{const R=$n(S.props),C=S.target=Hi(S.props,g),G=Fi(C,S,b,f);C&&(o!=="svg"&&na(C)?o="svg":o!=="mathml"&&sa(C)&&(o="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(C),R||(k(S,C,G),ws(S,!1)))},D=S=>{const R=()=>{if(dn.get(S)===R){if(dn.delete(S),$n(S.props)){const C=E(S.el)||n;k(S,C,S.anchor),ws(S,!0)}$(S)}};dn.set(S,R),rt(R,i)};if(e==null){const S=t.el=b(""),R=t.anchor=b("");if(f(S,n,s),f(R,n,s),wh(t.props)||i&&i.pendingBranch){D(t);return}m&&(k(t,n,R),ws(t,!0)),$()}else{t.el=e.el;const S=t.anchor=e.anchor,R=dn.get(e);if(R){R.flags|=8,dn.delete(e),D(t);return}t.targetStart=e.targetStart;const C=t.target=e.target,G=t.targetAnchor=e.targetAnchor,oe=$n(e.props),L=oe?n:C,N=oe?S:G;if(o==="svg"||na(C)?o="svg":(o==="mathml"||sa(C))&&(o="mathml"),x?(h(e.dynamicChildren,x,L,r,i,o,a),Io(e,t,!0)):l||d(e,t,L,N,r,i,o,a,!1),m)oe?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):cr(t,n,S,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const P=t.target=Hi(t.props,g);P&&cr(t,P,null,c,0)}else oe&&cr(t,C,G,c,1);ws(t,m)}},remove(e,t,n,{um:s,o:{remove:r}},i){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:d,props:h}=e;let f=i||!$n(h);const g=dn.get(e);if(g&&(g.flags|=8,dn.delete(e),f=!1),d&&(r(c),r(u)),i&&r(l),o&16)for(let b=0;b<a.length;b++){const T=a[b];s(T,t,n,f,!!T.dynamicChildren)}},move:cr,hydrate:Eh};function cr(e,t,n,{o:{insert:s},m:r},i=2){i===0&&s(e.targetAnchor,t,n);const{el:o,anchor:a,shapeFlag:l,children:c,props:u}=e,d=i===2;if(d&&s(o,t,n),!dn.has(e)&&(!d||$n(u))&&l&16)for(let h=0;h<c.length;h++)r(c[h],t,n,2);d&&s(a,t,n)}function Eh(e,t,n,s,r,i,{o:{nextSibling:o,parentNode:a,querySelector:l,insert:c,createText:u}},d){function h(T,E){let m=E;for(;m;){if(m&&m.nodeType===8){if(m.data==="teleport start anchor")t.targetStart=m;else if(m.data==="teleport anchor"){t.targetAnchor=m,T._lpa=t.targetAnchor&&o(t.targetAnchor);break}}m=o(m)}}function f(T,E){E.anchor=d(o(T),E,a(T),n,s,r,i)}const g=t.target=Hi(t.props,l),b=$n(t.props);if(g){const T=g._lpa||g.firstChild;t.shapeFlag&16&&(b?(f(e,t),h(g,T),t.targetAnchor||Fi(g,t,u,c,a(e)===g?e:null)):(t.anchor=o(e),h(g,T),t.targetAnchor||Fi(g,t,u,c),d(T&&o(T),t,g,n,s,r,i))),ws(t,b)}else b&&t.shapeFlag&16&&(f(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}const Co=xh;function ws(e,t){const n=e.ctx;if(n&&n.ut){let s,r;for(t?(s=e.el,r=e.anchor):(s=e.targetStart,r=e.targetAnchor);s&&s!==r;)s.nodeType===1&&s.setAttribute("data-v-owner",n.uid),s=s.nextSibling;n.ut()}}function Fi(e,t,n,s,r=null){const i=t.targetStart=n(""),o=t.targetAnchor=n("");return i[Tc]=o,e&&(s(i,e,r),s(o,e,r)),o}const Lt=Symbol("_leaveCb"),bs=Symbol("_enterCb");function kh(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return nt(()=>{e.isMounted=!0}),Oo(()=>{e.isUnmounting=!0}),e}const vt=[Function,Array],Rc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:vt,onEnter:vt,onAfterEnter:vt,onEnterCancelled:vt,onBeforeLeave:vt,onLeave:vt,onAfterLeave:vt,onLeaveCancelled:vt,onBeforeAppear:vt,onAppear:vt,onAfterAppear:vt,onAppearCancelled:vt},Cc=e=>{const t=e.subTree;return t.component?Cc(t.component):t},Sh={name:"BaseTransition",props:Rc,setup(e,{slots:t}){const n=Lo(),s=kh();return()=>{const r=t.default&&Nc(t.default(),!0),i=r&&r.length?Oc(r):n.subTree?Q():void 0;if(!i)return;const o=Ae(e),{mode:a}=o;if(s.isLeaving)return yi(i);const l=ra(i);if(!l)return yi(i);let c=Vi(l,o,s,n,d=>c=d);l.type!==lt&&Hs(l,c);let u=n.subTree&&ra(n.subTree);if(u&&u.type!==lt&&!Nn(u,l)&&Cc(n).type!==lt){let d=Vi(u,o,s,n);if(Hs(u,d),a==="out-in"&&l.type!==lt)return s.isLeaving=!0,d.afterLeave=()=>{s.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,u=void 0},yi(i);a==="in-out"&&l.type!==lt?d.delayLeave=(h,f,g)=>{const b=$c(s,u);b[String(u.key)]=u,h[Lt]=()=>{f(),h[Lt]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{g(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function Oc(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==lt){t=n;break}}return t}const Th=Sh;function $c(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function Vi(e,t,n,s,r){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:h,onLeave:f,onAfterLeave:g,onLeaveCancelled:b,onBeforeAppear:T,onAppear:E,onAfterAppear:m,onAppearCancelled:x}=t,k=String(e.key),$=$c(n,e),D=(C,G)=>{C&&Ct(C,s,9,G)},S=(C,G)=>{const oe=G[1];D(C,G),me(C)?C.every(L=>L.length<=1)&&oe():C.length<=1&&oe()},R={mode:o,persisted:a,beforeEnter(C){let G=l;if(!n.isMounted)if(i)G=T||l;else return;C[Lt]&&C[Lt](!0);const oe=$[k];oe&&Nn(e,oe)&&oe.el[Lt]&&oe.el[Lt](),D(G,[C])},enter(C){if($[k]===e)return;let G=c,oe=u,L=d;if(!n.isMounted)if(i)G=E||c,oe=m||u,L=x||d;else return;let N=!1;C[bs]=I=>{N||(N=!0,I?D(L,[C]):D(oe,[C]),R.delayedLeave&&R.delayedLeave(),C[bs]=void 0)};const P=C[bs].bind(null,!1);G?S(G,[C,P]):P()},leave(C,G){const oe=String(e.key);if(C[bs]&&C[bs](!0),n.isUnmounting)return G();D(h,[C]);let L=!1;C[Lt]=P=>{L||(L=!0,G(),P?D(b,[C]):D(g,[C]),C[Lt]=void 0,$[oe]===e&&delete $[oe])};const N=C[Lt].bind(null,!1);$[oe]=e,f?S(f,[C,N]):N()},clone(C){const G=Vi(C,t,n,s,r);return r&&r(G),G}};return R}function yi(e){if(Qr(e))return e=_n(e),e.children=null,e}function ra(e){if(!Qr(e))return Ac(e.type)&&e.children?Oc(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Ee(n.default))return n.default()}}function Hs(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Hs(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 Nc(e,t=!1,n){let s=[],r=0;for(let i=0;i<e.length;i++){let o=e[i];const a=n==null?o.key:String(n)+String(o.key!=null?o.key:i);o.type===be?(o.patchFlag&128&&r++,s=s.concat(Nc(o.children,t,a))):(t||o.type!==lt)&&s.push(a!=null?_n(o,{key:a}):o)}if(r>1)for(let i=0;i<s.length;i++)s[i].patchFlag=-2;return s}function Ge(e,t){return Ee(e)?Ze({name:e.name},t,{setup:e}):e}function Ic(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function ia(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Or=new WeakMap;function Cs(e,t,n,s,r=!1){if(me(e)){e.forEach((b,T)=>Cs(b,t&&(me(t)?t[T]:t),n,s,r));return}if(Os(s)&&!r){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Cs(e,t,n,s.component.subTree);return}const i=s.shapeFlag&4?si(s.component):s.el,o=r?null:i,{i:a,r:l}=e,c=t&&t.r,u=a.refs===Ie?a.refs={}:a.refs,d=a.setupState,h=Ae(d),f=d===Ie?Kl:b=>ia(u,b)?!1:Ce(h,b),g=(b,T)=>!(T&&ia(u,T));if(c!=null&&c!==l){if(oa(t),je(c))u[c]=null,f(c)&&(d[c]=null);else if(Fe(c)){const b=t;g(c,b.k)&&(c.value=null),b.k&&(u[b.k]=null)}}if(Ee(l))sr(l,a,12,[o,u]);else{const b=je(l),T=Fe(l);if(b||T){const E=()=>{if(e.f){const m=b?f(l)?d[l]:u[l]:g()||!e.k?l.value:u[e.k];if(r)me(m)&&vo(m,i);else if(me(m))m.includes(i)||m.push(i);else if(b)u[l]=[i],f(l)&&(d[l]=u[l]);else{const x=[i];g(l,e.k)&&(l.value=x),e.k&&(u[e.k]=x)}}else b?(u[l]=o,f(l)&&(d[l]=o)):T&&(g(l,e.k)&&(l.value=o),e.k&&(u[e.k]=o))};if(o){const m=()=>{E(),Or.delete(e)};m.id=-1,Or.set(e,m),rt(m,n)}else oa(e),E()}}}function oa(e){const t=Or.get(e);t&&(t.flags|=8,Or.delete(e))}Jr().requestIdleCallback;Jr().cancelIdleCallback;const Os=e=>!!e.type.__asyncLoader,Qr=e=>e.type.__isKeepAlive;function Ah(e,t){Pc(e,"a",t)}function Rh(e,t){Pc(e,"da",t)}function Pc(e,t,n=tt){const s=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(ei(t,s,n),n){let r=n.parent;for(;r&&r.parent;)Qr(r.parent.vnode)&&Ch(s,t,n,r),r=r.parent}}function Ch(e,t,n,s){const r=ei(t,e,s,!0);fs(()=>{vo(s[t],r)},n)}function ei(e,t,n=tt,s=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{tn();const a=rr(n),l=Ct(t,n,e,o);return a(),nn(),l});return s?r.unshift(i):r.push(i),i}}const an=e=>(t,n=tt)=>{(!Vs||e==="sp")&&ei(e,(...s)=>t(...s),n)},Oh=an("bm"),nt=an("m"),$h=an("bu"),Nh=an("u"),Oo=an("bum"),fs=an("um"),Ih=an("sp"),Ph=an("rtg"),Lh=an("rtc");function Mh(e,t=tt){ei("ec",e,t)}const Lc="components";function Mc(e,t){return Dc(Lc,e,!0,t)||e}const jc=Symbol.for("v-ndc");function jh(e){return je(e)?Dc(Lc,e,!1)||e:e||jc}function Dc(e,t,n=!0,s=!1){const r=ft||tt;if(r){const i=r.type;{const a=Ef(i,!1);if(a&&(a===t||a===ct(t)||a===Gr(ct(t))))return i}const o=aa(r[e]||i[e],t)||aa(r.appContext[e],t);return!o&&s?i:o}}function aa(e,t){return e&&(e[t]||e[ct(t)]||e[Gr(ct(t))])}function Ne(e,t,n,s){let r;const i=n,o=me(e);if(o||je(e)){const a=o&&Xt(e);let l=!1,c=!1;a&&(l=!gt(e),c=sn(e),e=Zr(e)),r=new Array(e.length);for(let u=0,d=e.length;u<d;u++)r[u]=t(l?c?os(Rt(e[u])):Rt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){r=new Array(e);for(let a=0;a<e;a++)r[a]=t(a+1,a,void 0,i)}else if($e(e))if(e[Symbol.iterator])r=Array.from(e,(a,l)=>t(a,l,void 0,i));else{const a=Object.keys(e);r=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];r[l]=t(e[u],u,l,i)}}else r=[];return r}const qi=e=>e?su(e)?si(e):qi(e.parent):null,$s=Ze(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=>qi(e.parent),$root:e=>qi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Bc(e),$forceUpdate:e=>e.f||(e.f=()=>{Ro(e.update)}),$nextTick:e=>e.n||(e.n=At.bind(e.proxy)),$watch:e=>_h.bind(e)}),_i=(e,t)=>e!==Ie&&!e.__isScriptSetup&&Ce(e,t),Dh={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:r,props:i,accessCache:o,type:a,appContext:l}=e;if(t[0]!=="$"){const h=o[t];if(h!==void 0)switch(h){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(_i(s,t))return o[t]=1,s[t];if(r!==Ie&&Ce(r,t))return o[t]=2,r[t];if(Ce(i,t))return o[t]=3,i[t];if(n!==Ie&&Ce(n,t))return o[t]=4,n[t];Ki&&(o[t]=0)}}const c=$s[t];let u,d;if(c)return t==="$attrs"&&et(e.attrs,"get",""),c(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Ie&&Ce(n,t))return o[t]=4,n[t];if(d=l.config.globalProperties,Ce(d,t))return d[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:i}=e;return _i(r,t)?(r[t]=n,!0):s!==Ie&&Ce(s,t)?(s[t]=n,!0):Ce(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,props:i,type:o}},a){let l;return!!(n[a]||e!==Ie&&a[0]!=="$"&&Ce(e,a)||_i(t,a)||Ce(i,a)||Ce(s,a)||Ce($s,a)||Ce(r.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ce(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function la(e){return me(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ki=!0;function Uh(e){const t=Bc(e),n=e.proxy,s=e.ctx;Ki=!1,t.beforeCreate&&ca(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:f,updated:g,activated:b,deactivated:T,beforeDestroy:E,beforeUnmount:m,destroyed:x,unmounted:k,render:$,renderTracked:D,renderTriggered:S,errorCaptured:R,serverPrefetch:C,expose:G,inheritAttrs:oe,components:L,directives:N,filters:P}=t;if(c&&Bh(c,s,null),o)for(const j in o){const q=o[j];Ee(q)&&(s[j]=q.bind(n))}if(r){const j=r.call(n,n);$e(j)&&(e.data=at(j))}if(Ki=!0,i)for(const j in i){const q=i[j],ae=Ee(q)?q.bind(n,n):Ee(q.get)?q.get.bind(n,n):Ht,pe=!Ee(q)&&Ee(q.set)?q.set.bind(n):Ht,we=Oe({get:ae,set:pe});Object.defineProperty(s,j,{enumerable:!0,configurable:!0,get:()=>we.value,set:V=>we.value=V})}if(a)for(const j in a)Uc(a[j],s,n,j);if(l){const j=Ee(l)?l.call(n):l;Reflect.ownKeys(j).forEach(q=>{xr(q,j[q])})}u&&ca(u,e,"c");function A(j,q){me(q)?q.forEach(ae=>j(ae.bind(n))):q&&j(q.bind(n))}if(A(Oh,d),A(nt,h),A($h,f),A(Nh,g),A(Ah,b),A(Rh,T),A(Mh,R),A(Lh,D),A(Ph,S),A(Oo,m),A(fs,k),A(Ih,C),me(G))if(G.length){const j=e.exposed||(e.exposed={});G.forEach(q=>{Object.defineProperty(j,q,{get:()=>n[q],set:ae=>n[q]=ae,enumerable:!0})})}else e.exposed||(e.exposed={});$&&e.render===Ht&&(e.render=$),oe!=null&&(e.inheritAttrs=oe),L&&(e.components=L),N&&(e.directives=N),C&&Ic(e)}function Bh(e,t,n=Ht){me(e)&&(e=Wi(e));for(const s in e){const r=e[s];let i;$e(r)?"default"in r?i=_t(r.from||s,r.default,!0):i=_t(r.from||s):i=_t(r),Fe(i)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[s]=i}}function ca(e,t,n){Ct(me(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function Uc(e,t,n,s){let r=s.includes(".")?Sc(n,s):()=>n[s];if(je(e)){const i=t[e];Ee(i)&&mt(r,i)}else if(Ee(e))mt(r,e.bind(n));else if($e(e))if(me(e))e.forEach(i=>Uc(i,t,n,s));else{const i=Ee(e.handler)?e.handler.bind(n):t[e.handler];Ee(i)&&mt(r,i,e)}}function Bc(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,a=i.get(t);let l;return a?l=a:!r.length&&!n&&!s?l=t:(l={},r.length&&r.forEach(c=>$r(l,c,o,!0)),$r(l,t,o)),$e(t)&&i.set(t,l),l}function $r(e,t,n,s=!1){const{mixins:r,extends:i}=t;i&&$r(e,i,n,!0),r&&r.forEach(o=>$r(e,o,n,!0));for(const o in t)if(!(s&&o==="expose")){const a=Hh[o]||n&&n[o];e[o]=a?a(e[o],t[o]):t[o]}return e}const Hh={data:ua,props:da,emits:da,methods:xs,computed:xs,beforeCreate:st,created:st,beforeMount:st,mounted:st,beforeUpdate:st,updated:st,beforeDestroy:st,beforeUnmount:st,destroyed:st,unmounted:st,activated:st,deactivated:st,errorCaptured:st,serverPrefetch:st,components:xs,directives:xs,watch:Vh,provide:ua,inject:Fh};function ua(e,t){return t?e?function(){return Ze(Ee(e)?e.call(this,this):e,Ee(t)?t.call(this,this):t)}:t:e}function Fh(e,t){return xs(Wi(e),Wi(t))}function Wi(e){if(me(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function st(e,t){return e?[...new Set([].concat(e,t))]:t}function xs(e,t){return e?Ze(Object.create(null),e,t):t}function da(e,t){return e?me(e)&&me(t)?[...new Set([...e,...t])]:Ze(Object.create(null),la(e),la(t??{})):t}function Vh(e,t){if(!e)return t;if(!t)return e;const n=Ze(Object.create(null),e);for(const s in t)n[s]=st(e[s],t[s]);return n}function Hc(){return{app:null,config:{isNativeTag:Kl,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 qh=0;function Kh(e,t){return function(s,r=null){Ee(s)||(s=Ze({},s)),r!=null&&!$e(r)&&(r=null);const i=Hc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:qh++,_component:s,_props:r,_container:null,_context:i,_instance:null,version:Sf,get config(){return i.config},set config(u){},use(u,...d){return o.has(u)||(u&&Ee(u.install)?(o.add(u),u.install(c,...d)):Ee(u)&&(o.add(u),u(c,...d))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,d){return d?(i.components[u]=d,c):i.components[u]},directive(u,d){return d?(i.directives[u]=d,c):i.directives[u]},mount(u,d,h){if(!l){const f=c._ceVNode||Me(s,r);return f.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),e(f,u,h),l=!0,c._container=u,u.__vue_app__=c,si(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Ct(a,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=Mn;Mn=c;try{return u()}finally{Mn=d}}};return c}}let Mn=null;const Wh=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${ct(t)}Modifiers`]||e[`${wn(t)}Modifiers`];function Gh(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||Ie;let r=n;const i=t.startsWith("update:"),o=i&&Wh(s,t.slice(7));o&&(o.trim&&(r=n.map(u=>je(u)?u.trim():u)),o.number&&(r=n.map(zr)));let a,l=s[a=pi(t)]||s[a=pi(ct(t))];!l&&i&&(l=s[a=pi(wn(t))]),l&&Ct(l,e,6,r);const c=s[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Ct(c,e,6,r)}}const zh=new WeakMap;function Fc(e,t,n=!1){const s=n?zh:t.emitsCache,r=s.get(e);if(r!==void 0)return r;const i=e.emits;let o={},a=!1;if(!Ee(e)){const l=c=>{const u=Fc(c,t,!0);u&&(a=!0,Ze(o,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?($e(e)&&s.set(e,null),null):(me(i)?i.forEach(l=>o[l]=null):Ze(o,i),$e(e)&&s.set(e,o),o)}function ti(e,t){return!e||!Vr(t)?!1:(t=t.slice(2).replace(/Once$/,""),Ce(e,t[0].toLowerCase()+t.slice(1))||Ce(e,wn(t))||Ce(e,t))}function ha(e){const{type:t,vnode:n,proxy:s,withProxy:r,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:d,data:h,setupState:f,ctx:g,inheritAttrs:b}=e,T=Cr(e);let E,m;try{if(n.shapeFlag&4){const k=r||s,$=k;E=Dt(c.call($,k,u,d,f,h,g)),m=a}else{const k=t;E=Dt(k.length>1?k(d,{attrs:a,slots:o,emit:l}):k(d,null)),m=t.props?a:Jh(a)}}catch(k){Ns.length=0,Xr(k,e,1),E=Me(lt)}let x=E;if(m&&b!==!1){const k=Object.keys(m),{shapeFlag:$}=x;k.length&&$&7&&(i&&k.some(qr)&&(m=Zh(m,i)),x=_n(x,m,!1,!0))}return n.dirs&&(x=_n(x,null,!1,!0),x.dirs=x.dirs?x.dirs.concat(n.dirs):n.dirs),n.transition&&Hs(x,n.transition),E=x,Cr(T),E}const Jh=e=>{let t;for(const n in e)(n==="class"||n==="style"||Vr(n))&&((t||(t={}))[n]=e[n]);return t},Zh=(e,t)=>{const n={};for(const s in e)(!qr(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function Yh(e,t,n){const{props:s,children:r,component:i}=e,{props:o,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return s?fa(s,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let d=0;d<u.length;d++){const h=u[d];if(Vc(o,s,h)&&!ti(c,h))return!0}}}else return(r||a)&&(!a||!a.$stable)?!0:s===o?!1:s?o?fa(s,o,c):!0:!!o;return!1}function fa(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let r=0;r<s.length;r++){const i=s[r];if(Vc(t,e,i)&&!ti(n,i))return!0}return!1}function Vc(e,t,n){const s=e[n],r=t[n];return n==="style"&&$e(s)&&$e(r)?!hs(s,r):s!==r}function Xh({vnode:e,parent:t,suspense:n},s){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=s,e=r),r===e)(e=t.vnode).el=s,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=s)}const qc={},Kc=()=>Object.create(qc),Wc=e=>Object.getPrototypeOf(e)===qc;function Qh(e,t,n,s=!1){const r={},i=Kc();e.propsDefaults=Object.create(null),Gc(e,t,r,i);for(const o in e.propsOptions[0])o in r||(r[o]=void 0);n?e.props=s?r:mc(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function ef(e,t,n,s){const{props:r,attrs:i,vnode:{patchFlag:o}}=e,a=Ae(r),[l]=e.propsOptions;let c=!1;if((s||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let d=0;d<u.length;d++){let h=u[d];if(ti(e.emitsOptions,h))continue;const f=t[h];if(l)if(Ce(i,h))f!==i[h]&&(i[h]=f,c=!0);else{const g=ct(h);r[g]=Gi(l,a,g,f,e,!1)}else f!==i[h]&&(i[h]=f,c=!0)}}}else{Gc(e,t,r,i)&&(c=!0);let u;for(const d in a)(!t||!Ce(t,d)&&((u=wn(d))===d||!Ce(t,u)))&&(l?n&&(n[d]!==void 0||n[u]!==void 0)&&(r[d]=Gi(l,a,d,void 0,e,!0)):delete r[d]);if(i!==a)for(const d in i)(!t||!Ce(t,d))&&(delete i[d],c=!0)}c&&Zt(e.attrs,"set","")}function Gc(e,t,n,s){const[r,i]=e.propsOptions;let o=!1,a;if(t)for(let l in t){if(Ts(l))continue;const c=t[l];let u;r&&Ce(r,u=ct(l))?!i||!i.includes(u)?n[u]=c:(a||(a={}))[u]=c:ti(e.emitsOptions,l)||(!(l in s)||c!==s[l])&&(s[l]=c,o=!0)}if(i){const l=Ae(n),c=a||Ie;for(let u=0;u<i.length;u++){const d=i[u];n[d]=Gi(r,l,d,c[d],e,!Ce(c,d))}}return o}function Gi(e,t,n,s,r,i){const o=e[n];if(o!=null){const a=Ce(o,"default");if(a&&s===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Ee(l)){const{propsDefaults:c}=r;if(n in c)s=c[n];else{const u=rr(r);s=c[n]=l.call(null,t),u()}}else s=l;r.ce&&r.ce._setProp(n,s)}o[0]&&(i&&!a?s=!1:o[1]&&(s===""||s===wn(n))&&(s=!0))}return s}const tf=new WeakMap;function zc(e,t,n=!1){const s=n?tf:t.propsCache,r=s.get(e);if(r)return r;const i=e.props,o={},a=[];let l=!1;if(!Ee(e)){const u=d=>{l=!0;const[h,f]=zc(d,t,!0);Ze(o,h),f&&a.push(...f)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return $e(e)&&s.set(e,ns),ns;if(me(i))for(let u=0;u<i.length;u++){const d=ct(i[u]);pa(d)&&(o[d]=Ie)}else if(i)for(const u in i){const d=ct(u);if(pa(d)){const h=i[u],f=o[d]=me(h)||Ee(h)?{type:h}:Ze({},h),g=f.type;let b=!1,T=!0;if(me(g))for(let E=0;E<g.length;++E){const m=g[E],x=Ee(m)&&m.name;if(x==="Boolean"){b=!0;break}else x==="String"&&(T=!1)}else b=Ee(g)&&g.name==="Boolean";f[0]=b,f[1]=T,(b||Ce(f,"default"))&&a.push(d)}}const c=[o,a];return $e(e)&&s.set(e,c),c}function pa(e){return e[0]!=="$"&&!Ts(e)}const $o=e=>e==="_"||e==="_ctx"||e==="$stable",No=e=>me(e)?e.map(Dt):[Dt(e)],nf=(e,t,n)=>{if(t._n)return t;const s=yn((...r)=>No(t(...r)),n);return s._c=!1,s},Jc=(e,t,n)=>{const s=e._ctx;for(const r in e){if($o(r))continue;const i=e[r];if(Ee(i))t[r]=nf(r,i,s);else if(i!=null){const o=No(i);t[r]=()=>o}}},Zc=(e,t)=>{const n=No(t);e.slots.default=()=>n},Yc=(e,t,n)=>{for(const s in t)(n||!$o(s))&&(e[s]=t[s])},sf=(e,t,n)=>{const s=e.slots=Kc();if(e.vnode.shapeFlag&32){const r=t._;r?(Yc(s,t,n),n&&Jl(s,"_",r,!0)):Jc(t,s)}else t&&Zc(e,t)},rf=(e,t,n)=>{const{vnode:s,slots:r}=e;let i=!0,o=Ie;if(s.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Yc(r,t,n):(i=!t.$stable,Jc(t,r)),o=t}else t&&(Zc(e,t),o={default:1});if(i)for(const a in r)!$o(a)&&o[a]==null&&delete r[a]},rt=uf;function of(e){return af(e)}function af(e,t){const n=Jr();n.__VUE__=!0;const{insert:s,remove:r,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:f=Ht,insertStaticContent:g}=e,b=(v,_,O,H=null,z=null,K=null,W=void 0,te=null,Z=!!_.dynamicChildren)=>{if(v===_)return;v&&!Nn(v,_)&&(H=M(v),V(v,z,K,!0),v=null),_.patchFlag===-2&&(Z=!1,_.dynamicChildren=null);const{type:F,ref:ge,shapeFlag:re}=_;switch(F){case ni:T(v,_,O,H);break;case lt:E(v,_,O,H);break;case Er:v==null&&m(_,O,H,W);break;case be:L(v,_,O,H,z,K,W,te,Z);break;default:re&1?$(v,_,O,H,z,K,W,te,Z):re&6?N(v,_,O,H,z,K,W,te,Z):(re&64||re&128)&&F.process(v,_,O,H,z,K,W,te,Z,fe)}ge!=null&&z?Cs(ge,v&&v.ref,K,_||v,!_):ge==null&&v&&v.ref!=null&&Cs(v.ref,null,K,v,!0)},T=(v,_,O,H)=>{if(v==null)s(_.el=a(_.children),O,H);else{const z=_.el=v.el;_.children!==v.children&&c(z,_.children)}},E=(v,_,O,H)=>{v==null?s(_.el=l(_.children||""),O,H):_.el=v.el},m=(v,_,O,H)=>{[v.el,v.anchor]=g(v.children,_,O,H,v.el,v.anchor)},x=({el:v,anchor:_},O,H)=>{let z;for(;v&&v!==_;)z=h(v),s(v,O,H),v=z;s(_,O,H)},k=({el:v,anchor:_})=>{let O;for(;v&&v!==_;)O=h(v),r(v),v=O;r(_)},$=(v,_,O,H,z,K,W,te,Z)=>{if(_.type==="svg"?W="svg":_.type==="math"&&(W="mathml"),v==null)D(_,O,H,z,K,W,te,Z);else{const F=v.el&&v.el._isVueCE?v.el:null;try{F&&F._beginPatch(),C(v,_,z,K,W,te,Z)}finally{F&&F._endPatch()}}},D=(v,_,O,H,z,K,W,te)=>{let Z,F;const{props:ge,shapeFlag:re,transition:he,dirs:ve}=v;if(Z=v.el=o(v.type,K,ge&&ge.is,ge),re&8?u(Z,v.children):re&16&&R(v.children,Z,null,H,z,wi(v,K),W,te),ve&&En(v,null,H,"created"),S(Z,v,v.scopeId,W,H),ge){for(const ee in ge)ee!=="value"&&!Ts(ee)&&i(Z,ee,null,ge[ee],K,H);"value"in ge&&i(Z,"value",null,ge.value,K),(F=ge.onVnodeBeforeMount)&&Nt(F,H,v)}ve&&En(v,null,H,"beforeMount");const J=lf(z,he);J&&he.beforeEnter(Z),s(Z,_,O),((F=ge&&ge.onVnodeMounted)||J||ve)&&rt(()=>{try{F&&Nt(F,H,v),J&&he.enter(Z),ve&&En(v,null,H,"mounted")}finally{}},z)},S=(v,_,O,H,z)=>{if(O&&f(v,O),H)for(let K=0;K<H.length;K++)f(v,H[K]);if(z){let K=z.subTree;if(_===K||eu(K.type)&&(K.ssContent===_||K.ssFallback===_)){const W=z.vnode;S(v,W,W.scopeId,W.slotScopeIds,z.parent)}}},R=(v,_,O,H,z,K,W,te,Z=0)=>{for(let F=Z;F<v.length;F++){const ge=v[F]=te?Jt(v[F]):Dt(v[F]);b(null,ge,_,O,H,z,K,W,te)}},C=(v,_,O,H,z,K,W)=>{const te=_.el=v.el;let{patchFlag:Z,dynamicChildren:F,dirs:ge}=_;Z|=v.patchFlag&16;const re=v.props||Ie,he=_.props||Ie;let ve;if(O&&kn(O,!1),(ve=he.onVnodeBeforeUpdate)&&Nt(ve,O,_,v),ge&&En(_,v,O,"beforeUpdate"),O&&kn(O,!0),(re.innerHTML&&he.innerHTML==null||re.textContent&&he.textContent==null)&&u(te,""),F?G(v.dynamicChildren,F,te,O,H,wi(_,z),K):W||q(v,_,te,null,O,H,wi(_,z),K,!1),Z>0){if(Z&16)oe(te,re,he,O,z);else if(Z&2&&re.class!==he.class&&i(te,"class",null,he.class,z),Z&4&&i(te,"style",re.style,he.style,z),Z&8){const J=_.dynamicProps;for(let ee=0;ee<J.length;ee++){const ue=J[ee],ye=re[ue],Se=he[ue];(Se!==ye||ue==="value")&&i(te,ue,ye,Se,z,O)}}Z&1&&v.children!==_.children&&u(te,_.children)}else!W&&F==null&&oe(te,re,he,O,z);((ve=he.onVnodeUpdated)||ge)&&rt(()=>{ve&&Nt(ve,O,_,v),ge&&En(_,v,O,"updated")},H)},G=(v,_,O,H,z,K,W)=>{for(let te=0;te<_.length;te++){const Z=v[te],F=_[te],ge=Z.el&&(Z.type===be||!Nn(Z,F)||Z.shapeFlag&198)?d(Z.el):O;b(Z,F,ge,null,H,z,K,W,!0)}},oe=(v,_,O,H,z)=>{if(_!==O){if(_!==Ie)for(const K in _)!Ts(K)&&!(K in O)&&i(v,K,_[K],null,z,H);for(const K in O){if(Ts(K))continue;const W=O[K],te=_[K];W!==te&&K!=="value"&&i(v,K,te,W,z,H)}"value"in O&&i(v,"value",_.value,O.value,z)}},L=(v,_,O,H,z,K,W,te,Z)=>{const F=_.el=v?v.el:a(""),ge=_.anchor=v?v.anchor:a("");let{patchFlag:re,dynamicChildren:he,slotScopeIds:ve}=_;ve&&(te=te?te.concat(ve):ve),v==null?(s(F,O,H),s(ge,O,H),R(_.children||[],O,ge,z,K,W,te,Z)):re>0&&re&64&&he&&v.dynamicChildren&&v.dynamicChildren.length===he.length?(G(v.dynamicChildren,he,O,z,K,W,te),(_.key!=null||z&&_===z.subTree)&&Io(v,_,!0)):q(v,_,O,ge,z,K,W,te,Z)},N=(v,_,O,H,z,K,W,te,Z)=>{_.slotScopeIds=te,v==null?_.shapeFlag&512?z.ctx.activate(_,O,H,W,Z):P(_,O,H,z,K,W,Z):I(v,_,Z)},P=(v,_,O,H,z,K,W)=>{const te=v.component=vf(v,H,z);if(Qr(v)&&(te.ctx.renderer=fe),yf(te,!1,W),te.asyncDep){if(z&&z.registerDep(te,A,W),!v.el){const Z=te.subTree=Me(lt);E(null,Z,_,O),v.placeholder=Z.el}}else A(te,v,_,O,z,K,W)},I=(v,_,O)=>{const H=_.component=v.component;if(Yh(v,_,O))if(H.asyncDep&&!H.asyncResolved){j(H,_,O);return}else H.next=_,H.update();else _.el=v.el,H.vnode=_},A=(v,_,O,H,z,K,W)=>{const te=()=>{if(v.isMounted){let{next:re,bu:he,u:ve,parent:J,vnode:ee}=v;{const bt=Xc(v);if(bt){re&&(re.el=ee.el,j(v,re,W)),bt.asyncDep.then(()=>{rt(()=>{v.isUnmounted||F()},z)});return}}let ue=re,ye;kn(v,!1),re?(re.el=ee.el,j(v,re,W)):re=ee,he&&wr(he),(ye=re.props&&re.props.onVnodeBeforeUpdate)&&Nt(ye,J,re,ee),kn(v,!0);const Se=ha(v),qe=v.subTree;v.subTree=Se,b(qe,Se,d(qe.el),M(qe),v,z,K),re.el=Se.el,ue===null&&Xh(v,Se.el),ve&&rt(ve,z),(ye=re.props&&re.props.onVnodeUpdated)&&rt(()=>Nt(ye,J,re,ee),z)}else{let re;const{el:he,props:ve}=_,{bm:J,m:ee,parent:ue,root:ye,type:Se}=v,qe=Os(_);kn(v,!1),J&&wr(J),!qe&&(re=ve&&ve.onVnodeBeforeMount)&&Nt(re,ue,_),kn(v,!0);{ye.ce&&ye.ce._hasShadowRoot()&&ye.ce._injectChildStyle(Se,v.parent?v.parent.type:void 0);const bt=v.subTree=ha(v);b(null,bt,O,H,v,z,K),_.el=bt.el}if(ee&&rt(ee,z),!qe&&(re=ve&&ve.onVnodeMounted)){const bt=_;rt(()=>Nt(re,ue,bt),z)}(_.shapeFlag&256||ue&&Os(ue.vnode)&&ue.vnode.shapeFlag&256)&&v.a&&rt(v.a,z),v.isMounted=!0,_=O=H=null}};v.scope.on();const Z=v.effect=new nc(te);v.scope.off();const F=v.update=Z.run.bind(Z),ge=v.job=Z.runIfDirty.bind(Z);ge.i=v,ge.id=v.uid,Z.scheduler=()=>Ro(ge),kn(v,!0),F()},j=(v,_,O)=>{_.component=v;const H=v.vnode.props;v.vnode=_,v.next=null,ef(v,_.props,H,O),rf(v,_.children,O),tn(),ta(v),nn()},q=(v,_,O,H,z,K,W,te,Z=!1)=>{const F=v&&v.children,ge=v?v.shapeFlag:0,re=_.children,{patchFlag:he,shapeFlag:ve}=_;if(he>0){if(he&128){pe(F,re,O,H,z,K,W,te,Z);return}else if(he&256){ae(F,re,O,H,z,K,W,te,Z);return}}ve&8?(ge&16&&ne(F,z,K),re!==F&&u(O,re)):ge&16?ve&16?pe(F,re,O,H,z,K,W,te,Z):ne(F,z,K,!0):(ge&8&&u(O,""),ve&16&&R(re,O,H,z,K,W,te,Z))},ae=(v,_,O,H,z,K,W,te,Z)=>{v=v||ns,_=_||ns;const F=v.length,ge=_.length,re=Math.min(F,ge);let he;for(he=0;he<re;he++){const ve=_[he]=Z?Jt(_[he]):Dt(_[he]);b(v[he],ve,O,null,z,K,W,te,Z)}F>ge?ne(v,z,K,!0,!1,re):R(_,O,H,z,K,W,te,Z,re)},pe=(v,_,O,H,z,K,W,te,Z)=>{let F=0;const ge=_.length;let re=v.length-1,he=ge-1;for(;F<=re&&F<=he;){const ve=v[F],J=_[F]=Z?Jt(_[F]):Dt(_[F]);if(Nn(ve,J))b(ve,J,O,null,z,K,W,te,Z);else break;F++}for(;F<=re&&F<=he;){const ve=v[re],J=_[he]=Z?Jt(_[he]):Dt(_[he]);if(Nn(ve,J))b(ve,J,O,null,z,K,W,te,Z);else break;re--,he--}if(F>re){if(F<=he){const ve=he+1,J=ve<ge?_[ve].el:H;for(;F<=he;)b(null,_[F]=Z?Jt(_[F]):Dt(_[F]),O,J,z,K,W,te,Z),F++}}else if(F>he)for(;F<=re;)V(v[F],z,K,!0),F++;else{const ve=F,J=F,ee=new Map;for(F=J;F<=he;F++){const dt=_[F]=Z?Jt(_[F]):Dt(_[F]);dt.key!=null&&ee.set(dt.key,F)}let ue,ye=0;const Se=he-J+1;let qe=!1,bt=0;const xn=new Array(Se);for(F=0;F<Se;F++)xn[F]=0;for(F=ve;F<=re;F++){const dt=v[F];if(ye>=Se){V(dt,z,K,!0);continue}let $t;if(dt.key!=null)$t=ee.get(dt.key);else for(ue=J;ue<=he;ue++)if(xn[ue-J]===0&&Nn(dt,_[ue])){$t=ue;break}$t===void 0?V(dt,z,K,!0):(xn[$t-J]=F+1,$t>=bt?bt=$t:qe=!0,b(dt,_[$t],O,null,z,K,W,te,Z),ye++)}const zo=qe?cf(xn):ns;for(ue=zo.length-1,F=Se-1;F>=0;F--){const dt=J+F,$t=_[dt],Jo=_[dt+1],Zo=dt+1<ge?Jo.el||Qc(Jo):H;xn[F]===0?b(null,$t,O,Zo,z,K,W,te,Z):qe&&(ue<0||F!==zo[ue]?we($t,O,Zo,2):ue--)}}},we=(v,_,O,H,z=null)=>{const{el:K,type:W,transition:te,children:Z,shapeFlag:F}=v;if(F&6){we(v.component.subTree,_,O,H);return}if(F&128){v.suspense.move(_,O,H);return}if(F&64){W.move(v,_,O,fe);return}if(W===be){s(K,_,O);for(let re=0;re<Z.length;re++)we(Z[re],_,O,H);s(v.anchor,_,O);return}if(W===Er){x(v,_,O);return}if(H!==2&&F&1&&te)if(H===0)te.beforeEnter(K),s(K,_,O),rt(()=>te.enter(K),z);else{const{leave:re,delayLeave:he,afterLeave:ve}=te,J=()=>{v.ctx.isUnmounted?r(K):s(K,_,O)},ee=()=>{K._isLeaving&&K[Lt](!0),re(K,()=>{J(),ve&&ve()})};he?he(K,J,ee):ee()}else s(K,_,O)},V=(v,_,O,H=!1,z=!1)=>{const{type:K,props:W,ref:te,children:Z,dynamicChildren:F,shapeFlag:ge,patchFlag:re,dirs:he,cacheIndex:ve,memo:J}=v;if(re===-2&&(z=!1),te!=null&&(tn(),Cs(te,null,O,v,!0),nn()),ve!=null&&(_.renderCache[ve]=void 0),ge&256){_.ctx.deactivate(v);return}const ee=ge&1&&he,ue=!Os(v);let ye;if(ue&&(ye=W&&W.onVnodeBeforeUnmount)&&Nt(ye,_,v),ge&6)ce(v.component,O,H);else{if(ge&128){v.suspense.unmount(O,H);return}ee&&En(v,null,_,"beforeUnmount"),ge&64?v.type.remove(v,_,O,fe,H):F&&!F.hasOnce&&(K!==be||re>0&&re&64)?ne(F,_,O,!1,!0):(K===be&&re&384||!z&&ge&16)&&ne(Z,_,O),H&&le(v)}const Se=J!=null&&ve==null;(ue&&(ye=W&&W.onVnodeUnmounted)||ee||Se)&&rt(()=>{ye&&Nt(ye,_,v),ee&&En(v,null,_,"unmounted"),Se&&(v.el=null)},O)},le=v=>{const{type:_,el:O,anchor:H,transition:z}=v;if(_===be){Y(O,H);return}if(_===Er){k(v);return}const K=()=>{r(O),z&&!z.persisted&&z.afterLeave&&z.afterLeave()};if(v.shapeFlag&1&&z&&!z.persisted){const{leave:W,delayLeave:te}=z,Z=()=>W(O,K);te?te(v.el,K,Z):Z()}else K()},Y=(v,_)=>{let O;for(;v!==_;)O=h(v),r(v),v=O;r(_)},ce=(v,_,O)=>{const{bum:H,scope:z,job:K,subTree:W,um:te,m:Z,a:F}=v;ga(Z),ga(F),H&&wr(H),z.stop(),K&&(K.flags|=8,V(W,v,_,O)),te&&rt(te,_),rt(()=>{v.isUnmounted=!0},_)},ne=(v,_,O,H=!1,z=!1,K=0)=>{for(let W=K;W<v.length;W++)V(v[W],_,O,H,z)},M=v=>{if(v.shapeFlag&6)return M(v.component.subTree);if(v.shapeFlag&128)return v.suspense.next();const _=h(v.anchor||v.el),O=_&&_[Tc];return O?h(O):_};let X=!1;const se=(v,_,O)=>{let H;v==null?_._vnode&&(V(_._vnode,null,null,!0),H=_._vnode.component):b(_._vnode||null,v,_,null,null,null,O),_._vnode=v,X||(X=!0,ta(H),wc(),X=!1)},fe={p:b,um:V,m:we,r:le,mt:P,mc:R,pc:q,pbc:G,n:M,o:e};return{render:se,hydrate:void 0,createApp:Kh(se)}}function wi({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function kn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function lf(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Io(e,t,n=!1){const s=e.children,r=t.children;if(me(s)&&me(r))for(let i=0;i<s.length;i++){const o=s[i];let a=r[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=r[i]=Jt(r[i]),a.el=o.el),!n&&a.patchFlag!==-2&&Io(o,a)),a.type===ni&&(a.patchFlag===-1&&(a=r[i]=Jt(a)),a.el=o.el),a.type===lt&&!a.el&&(a.el=o.el)}}function cf(e){const t=e.slice(),n=[0];let s,r,i,o,a;const l=e.length;for(s=0;s<l;s++){const c=e[s];if(c!==0){if(r=n[n.length-1],e[r]<c){t[s]=r,n.push(s);continue}for(i=0,o=n.length-1;i<o;)a=i+o>>1,e[n[a]]<c?i=a+1:o=a;c<e[n[i]]&&(i>0&&(t[s]=n[i-1]),n[i]=s)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function Xc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Xc(t)}function ga(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Qc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Qc(t.subTree):null}const eu=e=>e.__isSuspense;function uf(e,t){t&&t.pendingBranch?me(e)?t.effects.push(...e):t.effects.push(e):mh(e)}const be=Symbol.for("v-fgt"),ni=Symbol.for("v-txt"),lt=Symbol.for("v-cmt"),Er=Symbol.for("v-stc"),Ns=[];let pt=null;function y(e=!1){Ns.push(pt=e?null:[])}function df(){Ns.pop(),pt=Ns[Ns.length-1]||null}let Fs=1;function Nr(e,t=!1){Fs+=e,e<0&&pt&&t&&(pt.hasOnce=!0)}function tu(e){return e.dynamicChildren=Fs>0?pt||ns:null,df(),Fs>0&&pt&&pt.push(e),e}function w(e,t,n,s,r,i){return tu(p(e,t,n,s,r,i,!0))}function rn(e,t,n,s,r){return tu(Me(e,t,n,s,r,!0))}function Ir(e){return e?e.__v_isVNode===!0:!1}function Nn(e,t){return e.type===t.type&&e.key===t.key}const nu=({key:e})=>e??null,kr=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?je(e)||Fe(e)||Ee(e)?{i:ft,r:e,k:t,f:!!n}:e:null);function p(e,t=null,n=null,s=0,r=null,i=e===be?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&nu(t),ref:t&&kr(t),scopeId:Ec,slotScopeIds:null,children:n,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:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:ft};return a?(Po(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=je(n)?8:16),Fs>0&&!o&&pt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&pt.push(l),l}const Me=hf;function hf(e,t=null,n=null,s=0,r=null,i=!1){if((!e||e===jc)&&(e=lt),Ir(e)){const a=_n(e,t,!0);return n&&Po(a,n),Fs>0&&!i&&pt&&(a.shapeFlag&6?pt[pt.indexOf(e)]=a:pt.push(a)),a.patchFlag=-2,a}if(kf(e)&&(e=e.__vccOpts),t){t=ff(t);let{class:a,style:l}=t;a&&!je(a)&&(t.class=Te(a)),$e(l)&&(Yr(l)&&!me(l)&&(l=Ze({},l)),t.style=yo(l))}const o=je(e)?1:eu(e)?128:Ac(e)?64:$e(e)?4:Ee(e)?2:0;return p(e,t,n,s,r,o,i,!0)}function ff(e){return e?Yr(e)||Wc(e)?Ze({},e):e:null}function _n(e,t,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:a,transition:l}=e,c=t?gf(r||{},t):r,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&nu(c),ref:t&&t.ref?n&&i?me(i)?i.concat(kr(t)):[i,kr(t)]:kr(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==be?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&_n(e.ssContent),ssFallback:e.ssFallback&&_n(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&s&&Hs(u,l.clone(u)),u}function on(e=" ",t=0){return Me(ni,null,e,t)}function pf(e,t){const n=Me(Er,null,e);return n.staticCount=t,n}function Q(e="",t=!1){return t?(y(),rn(lt,null,e)):Me(lt,null,e)}function Dt(e){return e==null||typeof e=="boolean"?Me(lt):me(e)?Me(be,null,e.slice()):Ir(e)?Jt(e):Me(ni,null,String(e))}function Jt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:_n(e)}function Po(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(me(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),Po(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Wc(t)?t._ctx=ft:r===3&&ft&&(ft.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ee(t)?(t={default:t,_ctx:ft},n=32):(t=String(t),s&64?(n=16,t=[on(t)]):n=8);e.children=t,e.shapeFlag|=n}function gf(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const r in s)if(r==="class")t.class!==s.class&&(t.class=Te([t.class,s.class]));else if(r==="style")t.style=yo([t.style,s.style]);else if(Vr(r)){const i=t[r],o=s[r];o&&i!==o&&!(me(i)&&i.includes(o))?t[r]=i?[].concat(i,o):o:o==null&&i==null&&!qr(r)&&(t[r]=o)}else r!==""&&(t[r]=s[r])}return t}function Nt(e,t,n,s=null){Ct(e,t,7,[n,s])}const mf=Hc();let bf=0;function vf(e,t,n){const s=e.type,r=(t?t.appContext:e.appContext)||mf,i={uid:bf++,vnode:e,type:s,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:zc(s,r),emitsOptions:Fc(s,r),emit:null,emitted:null,propsDefaults:Ie,inheritAttrs:s.inheritAttrs,ctx:Ie,data:Ie,props:Ie,attrs:Ie,slots:Ie,refs:Ie,setupState:Ie,setupContext:null,suspense:n,suspenseId:n?n.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=Gh.bind(null,i),e.ce&&e.ce(i),i}let tt=null;const Lo=()=>tt||ft;let Pr,zi;{const e=Jr(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};Pr=t("__VUE_INSTANCE_SETTERS__",n=>tt=n),zi=t("__VUE_SSR_SETTERS__",n=>Vs=n)}const rr=e=>{const t=tt;return Pr(e),e.scope.on(),()=>{e.scope.off(),Pr(t)}},ma=()=>{tt&&tt.scope.off(),Pr(null)};function su(e){return e.vnode.shapeFlag&4}let Vs=!1;function yf(e,t=!1,n=!1){t&&zi(t);const{props:s,children:r}=e.vnode,i=su(e);Qh(e,s,i,t),sf(e,r,n||t);const o=i?_f(e,t):void 0;return t&&zi(!1),o}function _f(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Dh);const{setup:s}=n;if(s){tn();const r=e.setupContext=s.length>1?xf(e):null,i=rr(e),o=sr(s,e,0,[e.props,r]),a=Wl(o);if(nn(),i(),(a||e.sp)&&!Os(e)&&Ic(e),a){if(o.then(ma,ma),t)return o.then(l=>{ba(e,l)}).catch(l=>{Xr(l,e,0)});e.asyncDep=o}else ba(e,o)}else ru(e)}function ba(e,t,n){Ee(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:$e(t)&&(e.setupState=vc(t)),ru(e)}function ru(e,t,n){const s=e.type;e.render||(e.render=s.render||Ht);{const r=rr(e);tn();try{Uh(e)}finally{nn(),r()}}}const wf={get(e,t){return et(e,"get",""),e[t]}};function xf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,wf),slots:e.slots,emit:e.emit,expose:t}}function si(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(vc(Ao(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in $s)return $s[n](e)},has(t,n){return n in t||n in $s}})):e.proxy}function Ef(e,t=!0){return Ee(e)?e.displayName||e.name:e.name||t&&e.__name}function kf(e){return Ee(e)&&"__vccOpts"in e}const Oe=(e,t)=>dh(e,t,Vs);function Mo(e,t,n){try{Nr(-1);const s=arguments.length;return s===2?$e(t)&&!me(t)?Ir(t)?Me(e,null,[t]):Me(e,t):Me(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Ir(n)&&(n=[n]),Me(e,t,n))}finally{Nr(1)}}const Sf="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 Ji;const va=typeof window<"u"&&window.trustedTypes;if(va)try{Ji=va.createPolicy("vue",{createHTML:e=>e})}catch{}const iu=Ji?e=>Ji.createHTML(e):e=>e,Tf="http://www.w3.org/2000/svg",Af="http://www.w3.org/1998/Math/MathML",Wt=typeof document<"u"?document:null,ya=Wt&&Wt.createElement("template"),Rf={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?Wt.createElementNS(Tf,e):t==="mathml"?Wt.createElementNS(Af,e):n?Wt.createElement(e,{is:n}):Wt.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>Wt.createTextNode(e),createComment:e=>Wt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Wt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{ya.innerHTML=iu(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const a=ya.content;if(s==="svg"||s==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},cn="transition",vs="animation",qs=Symbol("_vtc"),ou={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},Cf=Ze({},Rc,ou),Of=e=>(e.displayName="Transition",e.props=Cf,e),jo=Of((e,{slots:t})=>Mo(Th,$f(e),t)),Sn=(e,t=[])=>{me(e)?e.forEach(n=>n(...t)):e&&e(...t)},_a=e=>e?me(e)?e.some(t=>t.length>1):e.length>1:!1;function $f(e){const t={};for(const L in e)L in ou||(t[L]=e[L]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:f=`${n}-leave-to`}=e,g=Nf(r),b=g&&g[0],T=g&&g[1],{onBeforeEnter:E,onEnter:m,onEnterCancelled:x,onLeave:k,onLeaveCancelled:$,onBeforeAppear:D=E,onAppear:S=m,onAppearCancelled:R=x}=t,C=(L,N,P,I)=>{L._enterCancelled=I,Tn(L,N?u:a),Tn(L,N?c:o),P&&P()},G=(L,N)=>{L._isLeaving=!1,Tn(L,d),Tn(L,f),Tn(L,h),N&&N()},oe=L=>(N,P)=>{const I=L?S:m,A=()=>C(N,L,P);Sn(I,[N,A]),wa(()=>{Tn(N,L?l:i),Vt(N,L?u:a),_a(I)||xa(N,s,b,A)})};return Ze(t,{onBeforeEnter(L){Sn(E,[L]),Vt(L,i),Vt(L,o)},onBeforeAppear(L){Sn(D,[L]),Vt(L,l),Vt(L,c)},onEnter:oe(!1),onAppear:oe(!0),onLeave(L,N){L._isLeaving=!0;const P=()=>G(L,N);Vt(L,d),L._enterCancelled?(Vt(L,h),Sa(L)):(Sa(L),Vt(L,h)),wa(()=>{L._isLeaving&&(Tn(L,d),Vt(L,f),_a(k)||xa(L,s,T,P))}),Sn(k,[L,P])},onEnterCancelled(L){C(L,!1,void 0,!0),Sn(x,[L])},onAppearCancelled(L){C(L,!0,void 0,!0),Sn(R,[L])},onLeaveCancelled(L){G(L),Sn($,[L])}})}function Nf(e){if(e==null)return null;if($e(e))return[xi(e.enter),xi(e.leave)];{const t=xi(e);return[t,t]}}function xi(e){return Od(e)}function Vt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[qs]||(e[qs]=new Set)).add(t)}function Tn(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[qs];n&&(n.delete(t),n.size||(e[qs]=void 0))}function wa(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let If=0;function xa(e,t,n,s){const r=e._endId=++If,i=()=>{r===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=Pf(e,t);if(!o)return s();const c=o+"end";let u=0;const d=()=>{e.removeEventListener(c,h),i()},h=f=>{f.target===e&&++u>=l&&d()};setTimeout(()=>{u<l&&d()},a+1),e.addEventListener(c,h)}function Pf(e,t){const n=window.getComputedStyle(e),s=g=>(n[g]||"").split(", "),r=s(`${cn}Delay`),i=s(`${cn}Duration`),o=Ea(r,i),a=s(`${vs}Delay`),l=s(`${vs}Duration`),c=Ea(a,l);let u=null,d=0,h=0;t===cn?o>0&&(u=cn,d=o,h=i.length):t===vs?c>0&&(u=vs,d=c,h=l.length):(d=Math.max(o,c),u=d>0?o>c?cn:vs:null,h=u?u===cn?i.length:l.length:0);const f=u===cn&&/\b(?:transform|all)(?:,|$)/.test(s(`${cn}Property`).toString());return{type:u,timeout:d,propCount:h,hasTransform:f}}function Ea(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>ka(n)+ka(e[s])))}function ka(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Sa(e){return(e?e.ownerDocument:document).body.offsetHeight}function Lf(e,t,n){const s=e[qs];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ta=Symbol("_vod"),Mf=Symbol("_vsh"),jf=Symbol(""),Df=/(?:^|;)\s*display\s*:/;function Uf(e,t,n){const s=e.style,r=je(n);let i=!1;if(n&&!r){if(t)if(je(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Es(s,a,"")}else for(const o in t)n[o]==null&&Es(s,o,"");for(const o in n){o==="display"&&(i=!0);const a=n[o];a!=null?Hf(e,o,!je(t)&&t?t[o]:void 0,a)||Es(s,o,a):Es(s,o,"")}}else if(r){if(t!==n){const o=s[jf];o&&(n+=";"+o),s.cssText=n,i=Df.test(n)}}else t&&e.removeAttribute("style");Ta in e&&(e[Ta]=i?s.display:"",e[Mf]&&(s.display="none"))}const Aa=/\s*!important$/;function Es(e,t,n){if(me(n))n.forEach(s=>Es(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Bf(e,t);Aa.test(n)?e.setProperty(wn(s),n.replace(Aa,""),"important"):e[s]=n}}const Ra=["Webkit","Moz","ms"],Ei={};function Bf(e,t){const n=Ei[t];if(n)return n;let s=ct(t);if(s!=="filter"&&s in e)return Ei[t]=s;s=Gr(s);for(let r=0;r<Ra.length;r++){const i=Ra[r]+s;if(i in e)return Ei[t]=i}return t}function Hf(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&je(s)&&n===s}const Ca="http://www.w3.org/1999/xlink";function Oa(e,t,n,s,r,i=Md(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Ca,t.slice(6,t.length)):e.setAttributeNS(Ca,t,n):n==null||i&&!Zl(n)?e.removeAttribute(t):e.setAttribute(t,i?"":wt(n)?String(n):n)}function $a(e,t,n,s,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?iu(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Zl(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(r||t)}function gn(e,t,n,s){e.addEventListener(t,n,s)}function Ff(e,t,n,s){e.removeEventListener(t,n,s)}const Na=Symbol("_vei");function Vf(e,t,n,s,r=null){const i=e[Na]||(e[Na]={}),o=i[t];if(s&&o)o.value=s;else{const[a,l]=qf(t);if(s){const c=i[t]=Gf(s,r);gn(e,a,c,l)}else o&&(Ff(e,a,o,l),i[t]=void 0)}}const Ia=/(?:Once|Passive|Capture)$/;function qf(e){let t;if(Ia.test(e)){t={};let s;for(;s=e.match(Ia);)e=e.slice(0,e.length-s[0].length),t[s[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):wn(e.slice(2)),t]}let ki=0;const Kf=Promise.resolve(),Wf=()=>ki||(Kf.then(()=>ki=0),ki=Date.now());function Gf(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;Ct(zf(s,n.value),t,5,[s])};return n.value=e,n.attached=Wf(),n}function zf(e,t){if(me(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Pa=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Jf=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?Lf(e,s,o):t==="style"?Uf(e,n,s):Vr(t)?qr(t)||Vf(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Zf(e,t,s,o))?($a(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Oa(e,t,s,o,i,t!=="value")):e._isVueCE&&(Yf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!je(s)))?$a(e,ct(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Oa(e,t,s,o))};function Zf(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Pa(t)&&Ee(n));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 Pa(t)&&je(n)?!1:t in e}function Yf(e,t){const n=e._def.props;if(!n)return!1;const s=ct(t);return Array.isArray(n)?n.some(r=>ct(r)===s):Object.keys(n).some(r=>ct(r)===s)}const as=e=>{const t=e.props["onUpdate:modelValue"]||!1;return me(t)?n=>wr(t,n):t};function Xf(e){e.target.composing=!0}function La(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Qt=Symbol("_assign");function Ma(e,t,n){return t&&(e=e.trim()),n&&(e=zr(e)),e}const Ve={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[Qt]=as(r);const i=s||r.props&&r.props.type==="number";gn(e,t?"change":"input",o=>{o.target.composing||e[Qt](Ma(e.value,n,i))}),(n||i)&&gn(e,"change",()=>{e.value=Ma(e.value,n,i)}),t||(gn(e,"compositionstart",Xf),gn(e,"compositionend",La),gn(e,"change",La))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[Qt]=as(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?zr(e.value):e.value,l=t??"";if(a===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===l)||(e.value=l)}},Qf={deep:!0,created(e,t,n){e[Qt]=as(n),gn(e,"change",()=>{const s=e._modelValue,r=Ks(e),i=e.checked,o=e[Qt];if(me(s)){const a=_o(s,r),l=a!==-1;if(i&&!l)o(s.concat(r));else if(!i&&l){const c=[...s];c.splice(a,1),o(c)}}else if(ds(s)){const a=new Set(s);i?a.add(r):a.delete(r),o(a)}else o(au(e,i))})},mounted:ja,beforeUpdate(e,t,n){e[Qt]=as(n),ja(e,t,n)}};function ja(e,{value:t,oldValue:n},s){e._modelValue=t;let r;if(me(t))r=_o(t,s.props.value)>-1;else if(ds(t))r=t.has(s.props.value);else{if(t===n)return;r=hs(t,au(e,!0))}e.checked!==r&&(e.checked=r)}const ep={deep:!0,created(e,{value:t,modifiers:{number:n}},s){const r=ds(t);gn(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?zr(Ks(o)):Ks(o));e[Qt](e.multiple?r?new Set(i):i:i[0]),e._assigning=!0,At(()=>{e._assigning=!1})}),e[Qt]=as(s)},mounted(e,{value:t}){Da(e,t)},beforeUpdate(e,t,n){e[Qt]=as(n)},updated(e,{value:t}){e._assigning||Da(e,t)}};function Da(e,t){const n=e.multiple,s=me(t);if(!(n&&!s&&!ds(t))){for(let r=0,i=e.options.length;r<i;r++){const o=e.options[r],a=Ks(o);if(n)if(s){const l=typeof a;l==="string"||l==="number"?o.selected=t.some(c=>String(c)===String(a)):o.selected=_o(t,a)>-1}else o.selected=t.has(a);else if(hs(Ks(o),t)){e.selectedIndex!==r&&(e.selectedIndex=r);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ks(e){return"_value"in e?e._value:e.value}function au(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const tp=["ctrl","shift","alt","meta"],np={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)=>tp.some(n=>e[`${n}Key`]&&!t.includes(n))},en=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...i)=>{for(let o=0;o<t.length;o++){const a=np[t[o]];if(a&&a(r,t))return}return e(r,...i)})},sp={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},lu=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=r=>{if(!("key"in r))return;const i=wn(r.key);if(t.some(o=>o===i||sp[o]===i))return e(r)})},rp=Ze({patchProp:Jf},Rf);let Ua;function ip(){return Ua||(Ua=of(rp))}const op=(...e)=>{const t=ip().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=lp(s);if(!r)return;const i=t._component;!Ee(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=n(r,!1,ap(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};function ap(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function lp(e){return je(e)?document.querySelector(e):e}/*!
|
|
18
|
-
* pinia v2.3.1
|
|
19
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
-
* @license MIT
|
|
21
|
-
*/let cu;const ri=e=>cu=e,uu=Symbol();function Zi(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Is;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Is||(Is={}));function cp(){const e=ec(!0),t=e.run(()=>B({}));let n=[],s=[];const r=Ao({install(i){ri(r),r._a=i,i.provide(uu,r),i.config.globalProperties.$pinia=r,s.forEach(o=>n.push(o)),s=[]},use(i){return this._a?n.push(i):s.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return r}const du=()=>{};function Ba(e,t,n,s=du){e.push(t);const r=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),s())};return!n&&tc()&&Dd(r),r}function Hn(e,...t){e.slice().forEach(n=>{n(...t)})}const up=e=>e(),Ha=Symbol(),Si=Symbol();function Yi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,s)=>e.set(s,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const s=t[n],r=e[n];Zi(r)&&Zi(s)&&e.hasOwnProperty(n)&&!Fe(s)&&!Xt(s)?e[n]=Yi(r,s):e[n]=s}return e}const dp=Symbol();function hp(e){return!Zi(e)||!e.hasOwnProperty(dp)}const{assign:hn}=Object;function fp(e){return!!(Fe(e)&&e.effect)}function pp(e,t,n,s){const{state:r,actions:i,getters:o}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=r?r():{});const u=ah(n.state.value[e]);return hn(u,i,Object.keys(o||{}).reduce((d,h)=>(d[h]=Ao(Oe(()=>{ri(n);const f=n._s.get(e);return o[h].call(f,f)})),d),{}))}return l=hu(e,c,t,n,s,!0),l}function hu(e,t,n={},s,r,i){let o;const a=hn({actions:{}},n),l={deep:!0};let c,u,d=[],h=[],f;const g=s.state.value[e];!i&&!g&&(s.state.value[e]={});let b;function T(R){let C;c=u=!1,typeof R=="function"?(R(s.state.value[e]),C={type:Is.patchFunction,storeId:e,events:f}):(Yi(s.state.value[e],R),C={type:Is.patchObject,payload:R,storeId:e,events:f});const G=b=Symbol();At().then(()=>{b===G&&(c=!0)}),u=!0,Hn(d,C,s.state.value[e])}const E=i?function(){const{state:C}=n,G=C?C():{};this.$patch(oe=>{hn(oe,G)})}:du;function m(){o.stop(),d=[],h=[],s._s.delete(e)}const x=(R,C="")=>{if(Ha in R)return R[Si]=C,R;const G=function(){ri(s);const oe=Array.from(arguments),L=[],N=[];function P(j){L.push(j)}function I(j){N.push(j)}Hn(h,{args:oe,name:G[Si],store:$,after:P,onError:I});let A;try{A=R.apply(this&&this.$id===e?this:$,oe)}catch(j){throw Hn(N,j),j}return A instanceof Promise?A.then(j=>(Hn(L,j),j)).catch(j=>(Hn(N,j),Promise.reject(j))):(Hn(L,A),A)};return G[Ha]=!0,G[Si]=C,G},k={_p:s,$id:e,$onAction:Ba.bind(null,h),$patch:T,$reset:E,$subscribe(R,C={}){const G=Ba(d,R,C.detached,()=>oe()),oe=o.run(()=>mt(()=>s.state.value[e],L=>{(C.flush==="sync"?u:c)&&R({storeId:e,type:Is.direct,events:f},L)},hn({},l,C)));return G},$dispose:m},$=at(k);s._s.set(e,$);const S=(s._a&&s._a.runWithContext||up)(()=>s._e.run(()=>(o=ec()).run(()=>t({action:x}))));for(const R in S){const C=S[R];if(Fe(C)&&!fp(C)||Xt(C))i||(g&&hp(C)&&(Fe(C)?C.value=g[R]:Yi(C,g[R])),s.state.value[e][R]=C);else if(typeof C=="function"){const G=x(C,R);S[R]=G,a.actions[R]=C}}return hn($,S),hn(Ae($),S),Object.defineProperty($,"$state",{get:()=>s.state.value[e],set:R=>{T(C=>{hn(C,R)})}}),s._p.forEach(R=>{hn($,o.run(()=>R({store:$,app:s._a,pinia:s,options:a})))}),g&&i&&n.hydrate&&n.hydrate($.$state,g),c=!0,u=!0,$}/*! #__NO_SIDE_EFFECTS__ */function fu(e,t,n){let s,r;const i=typeof t=="function";typeof e=="string"?(s=e,r=i?n:t):(r=e,s=e.id);function o(a,l){const c=bh();return a=a||(c?_t(uu,null):null),a&&ri(a),a=cu,a._s.has(s)||(i?hu(s,t,r,a):pp(s,r,a)),a._s.get(s)}return o.$id=s,o}/*!
|
|
22
|
-
* vue-router v4.6.4
|
|
23
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
24
|
-
* @license MIT
|
|
25
|
-
*/const Jn=typeof document<"u";function pu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function gp(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&pu(e.default)}const Re=Object.assign;function Ti(e,t){const n={};for(const s in t){const r=t[s];n[s]=Ot(r)?r.map(e):e(r)}return n}const Ps=()=>{},Ot=Array.isArray;function Fa(e,t){const n={};for(const s in e)n[s]=s in t?t[s]:e[s];return n}const gu=/#/g,mp=/&/g,bp=/\//g,vp=/=/g,yp=/\?/g,mu=/\+/g,_p=/%5B/g,wp=/%5D/g,bu=/%5E/g,xp=/%60/g,vu=/%7B/g,Ep=/%7C/g,yu=/%7D/g,kp=/%20/g;function Do(e){return e==null?"":encodeURI(""+e).replace(Ep,"|").replace(_p,"[").replace(wp,"]")}function Sp(e){return Do(e).replace(vu,"{").replace(yu,"}").replace(bu,"^")}function Xi(e){return Do(e).replace(mu,"%2B").replace(kp,"+").replace(gu,"%23").replace(mp,"%26").replace(xp,"`").replace(vu,"{").replace(yu,"}").replace(bu,"^")}function Tp(e){return Xi(e).replace(vp,"%3D")}function Ap(e){return Do(e).replace(gu,"%23").replace(yp,"%3F")}function Rp(e){return Ap(e).replace(bp,"%2F")}function Ws(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Cp=/\/$/,Op=e=>e.replace(Cp,"");function Ai(e,t,n="/"){let s,r={},i="",o="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(s=t.slice(0,l),i=t.slice(l,a>0?a:t.length),r=e(i.slice(1))),a>=0&&(s=s||t.slice(0,a),o=t.slice(a,t.length)),s=Pp(s??t,n),{fullPath:s+i+o,path:s,query:r,hash:Ws(o)}}function $p(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Va(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Np(e,t,n){const s=t.matched.length-1,r=n.matched.length-1;return s>-1&&s===r&&ls(t.matched[s],n.matched[r])&&_u(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ls(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function _u(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Ip(e[n],t[n]))return!1;return!0}function Ip(e,t){return Ot(e)?qa(e,t):Ot(t)?qa(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function qa(e,t){return Ot(t)?e.length===t.length&&e.every((n,s)=>n===t[s]):e.length===1&&e[0]===t}function Pp(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),s=e.split("/"),r=s[s.length-1];(r===".."||r===".")&&s.push("");let i=n.length-1,o,a;for(o=0;o<s.length;o++)if(a=s[o],a!==".")if(a==="..")i>1&&i--;else break;return n.slice(0,i).join("/")+"/"+s.slice(o).join("/")}const un={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Qi=function(e){return e.pop="pop",e.push="push",e}({}),Ri=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function Lp(e){if(!e)if(Jn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Op(e)}const Mp=/^[^#]+#/;function jp(e,t){return e.replace(Mp,"#")+t}function Dp(e,t){const n=document.documentElement.getBoundingClientRect(),s=e.getBoundingClientRect();return{behavior:t.behavior,left:s.left-n.left-(t.left||0),top:s.top-n.top-(t.top||0)}}const ii=()=>({left:window.scrollX,top:window.scrollY});function Up(e){let t;if("el"in e){const n=e.el,s=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?s?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=Dp(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 Ka(e,t){return(history.state?history.state.position-t:-1)+e}const eo=new Map;function Bp(e,t){eo.set(e,t)}function Hp(e){const t=eo.get(e);return eo.delete(e),t}function Fp(e){return typeof e=="string"||e&&typeof e=="object"}function wu(e){return typeof e=="string"||typeof e=="symbol"}let Be=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 xu=Symbol("");Be.MATCHER_NOT_FOUND+"",Be.NAVIGATION_GUARD_REDIRECT+"",Be.NAVIGATION_ABORTED+"",Be.NAVIGATION_CANCELLED+"",Be.NAVIGATION_DUPLICATED+"";function cs(e,t){return Re(new Error,{type:e,[xu]:!0},t)}function qt(e,t){return e instanceof Error&&xu in e&&(t==null||!!(e.type&t))}const Vp=["params","query","hash"];function qp(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Vp)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Kp(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;s<n.length;++s){const r=n[s].replace(mu," "),i=r.indexOf("="),o=Ws(i<0?r:r.slice(0,i)),a=i<0?null:Ws(r.slice(i+1));if(o in t){let l=t[o];Ot(l)||(l=t[o]=[l]),l.push(a)}else t[o]=a}return t}function Wa(e){let t="";for(let n in e){const s=e[n];if(n=Tp(n),s==null){s!==void 0&&(t+=(t.length?"&":"")+n);continue}(Ot(s)?s.map(r=>r&&Xi(r)):[s&&Xi(s)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function Wp(e){const t={};for(const n in e){const s=e[n];s!==void 0&&(t[n]=Ot(s)?s.map(r=>r==null?null:""+r):s==null?s:""+s)}return t}const Gp=Symbol(""),Ga=Symbol(""),oi=Symbol(""),Uo=Symbol(""),to=Symbol("");function ys(){let e=[];function t(s){return e.push(s),()=>{const r=e.indexOf(s);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function pn(e,t,n,s,r,i=o=>o()){const o=s&&(s.enterCallbacks[r]=s.enterCallbacks[r]||[]);return()=>new Promise((a,l)=>{const c=h=>{h===!1?l(cs(Be.NAVIGATION_ABORTED,{from:n,to:t})):h instanceof Error?l(h):Fp(h)?l(cs(Be.NAVIGATION_GUARD_REDIRECT,{from:t,to:h})):(o&&s.enterCallbacks[r]===o&&typeof h=="function"&&o.push(h),a())},u=i(()=>e.call(s&&s.instances[r],t,n,c));let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(h=>l(h))})}function Ci(e,t,n,s,r=i=>i()){const i=[];for(const o of e)for(const a in o.components){let l=o.components[a];if(!(t!=="beforeRouteEnter"&&!o.instances[a]))if(pu(l)){const c=(l.__vccOpts||l)[t];c&&i.push(pn(c,n,s,o,a,r))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const d=gp(u)?u.default:u;o.mods[a]=u,o.components[a]=d;const h=(d.__vccOpts||d)[t];return h&&pn(h,n,s,o,a,r)()}))}}return i}function zp(e,t){const n=[],s=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let o=0;o<i;o++){const a=t.matched[o];a&&(e.matched.find(c=>ls(c,a))?s.push(a):n.push(a));const l=e.matched[o];l&&(t.matched.find(c=>ls(c,l))||r.push(l))}return[n,s,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 Eu(e,t){const{pathname:n,search:s,hash:r}=t,i=e.indexOf("#");if(i>-1){let o=r.includes(e.slice(i))?e.slice(i).length:1,a=r.slice(o);return a[0]!=="/"&&(a="/"+a),Va(a,"")}return Va(n,e)+s+r}function Zp(e,t,n,s){let r=[],i=[],o=null;const a=({state:h})=>{const f=Eu(e,location),g=n.value,b=t.value;let T=0;if(h){if(n.value=f,t.value=h,o&&o===g){o=null;return}T=b?h.position-b.position:0}else s(f);r.forEach(E=>{E(n.value,g,{delta:T,type:Qi.pop,direction:T?T>0?Ri.forward:Ri.back:Ri.unknown})})};function l(){o=n.value}function c(h){r.push(h);const f=()=>{const g=r.indexOf(h);g>-1&&r.splice(g,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:h}=window;if(!h.state)return;h.replaceState(Re({},h.state,{scroll:ii()}),"")}}function d(){for(const h of i)h();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:d}}function za(e,t,n,s=!1,r=!1){return{back:e,current:t,forward:n,replaced:s,position:window.history.length,scroll:r?ii():null}}function Yp(e){const{history:t,location:n}=window,s={value:Eu(e,n)},r={value:t.state};r.value||i(s.value,{back:null,current:s.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const d=e.indexOf("#"),h=d>-1?(n.host&&document.querySelector("base")?e:e.slice(d))+l:Jp()+e+l;try{t[u?"replaceState":"pushState"](c,"",h),r.value=c}catch(f){console.error(f),n[u?"replace":"assign"](h)}}function o(l,c){i(l,Re({},t.state,za(r.value.back,l,r.value.forward,!0),c,{position:r.value.position}),!0),s.value=l}function a(l,c){const u=Re({},r.value,t.state,{forward:l,scroll:ii()});i(u.current,u,!0),i(l,Re({},za(s.value,l,null),{position:u.position+1},c),!1),s.value=l}return{location:s,state:r,push:a,replace:o}}function Xp(e){e=Lp(e);const t=Yp(e),n=Zp(e,t.state,t.location,t.replace);function s(i,o=!0){o||n.pauseListeners(),history.go(i)}const r=Re({location:"",base:e,go:s,createHref:jp.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}let In=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 Qp={type:In.Static,value:""},eg=/[a-zA-Z0-9_]/;function tg(e){if(!e)return[[]];if(e==="/")return[[Qp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${n})/"${c}": ${f}`)}let n=ze.Static,s=n;const r=[];let i;function o(){i&&r.push(i),i=[]}let a=0,l,c="",u="";function d(){c&&(n===ze.Static?i.push({type:In.Static,value:c}):n===ze.Param||n===ze.ParamRegExp||n===ze.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:In.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function h(){c+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==ze.ParamRegExp){s=n,n=ze.EscapeNext;continue}switch(n){case ze.Static:l==="/"?(c&&d(),o()):l===":"?(d(),n=ze.Param):h();break;case ze.EscapeNext:h(),n=s;break;case ze.Param:l==="("?n=ze.ParamRegExp:eg.test(l)?h():(d(),n=ze.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case ze.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=ze.ParamRegExpEnd:u+=l;break;case ze.ParamRegExpEnd:d(),n=ze.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===ze.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),d(),o(),r}const Ja="[^/]+?",ng={sensitive:!1,strict:!1,start:!0,end:!0};var it=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}(it||{});const sg=/[.+*?^${}()[\]/\\]/g;function rg(e,t){const n=Re({},ng,t),s=[];let r=n.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[it.Root];n.strict&&!c.length&&(r+="/");for(let d=0;d<c.length;d++){const h=c[d];let f=it.Segment+(n.sensitive?it.BonusCaseSensitive:0);if(h.type===In.Static)d||(r+="/"),r+=h.value.replace(sg,"\\$&"),f+=it.Static;else if(h.type===In.Param){const{value:g,repeatable:b,optional:T,regexp:E}=h;i.push({name:g,repeatable:b,optional:T});const m=E||Ja;if(m!==Ja){f+=it.BonusCustomRegExp;try{`${m}`}catch(k){throw new Error(`Invalid custom RegExp for param "${g}" (${m}): `+k.message)}}let x=b?`((?:${m})(?:/(?:${m}))*)`:`(${m})`;d||(x=T&&c.length<2?`(?:/${x})`:"/"+x),T&&(x+="?"),r+=x,f+=it.Dynamic,T&&(f+=it.BonusOptional),b&&(f+=it.BonusRepeatable),m===".*"&&(f+=it.BonusWildcard)}u.push(f)}s.push(u)}if(n.strict&&n.end){const c=s.length-1;s[c][s[c].length-1]+=it.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const o=new RegExp(r,n.sensitive?"":"i");function a(c){const u=c.match(o),d={};if(!u)return null;for(let h=1;h<u.length;h++){const f=u[h]||"",g=i[h-1];d[g.name]=f&&g.repeatable?f.split("/"):f}return d}function l(c){let u="",d=!1;for(const h of e){(!d||!u.endsWith("/"))&&(u+="/"),d=!1;for(const f of h)if(f.type===In.Static)u+=f.value;else if(f.type===In.Param){const{value:g,repeatable:b,optional:T}=f,E=g in c?c[g]:"";if(Ot(E)&&!b)throw new Error(`Provided param "${g}" is an array but it is not repeatable (* or + modifiers)`);const m=Ot(E)?E.join("/"):E;if(!m)if(T)h.length<2&&(u.endsWith("/")?u=u.slice(0,-1):d=!0);else throw new Error(`Missing required param "${g}"`);u+=m}}return u||"/"}return{re:o,score:s,keys:i,parse:a,stringify:l}}function ig(e,t){let n=0;for(;n<e.length&&n<t.length;){const s=t[n]-e[n];if(s)return s;n++}return e.length<t.length?e.length===1&&e[0]===it.Static+it.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===it.Static+it.Segment?1:-1:0}function ku(e,t){let n=0;const s=e.score,r=t.score;for(;n<s.length&&n<r.length;){const i=ig(s[n],r[n]);if(i)return i;n++}if(Math.abs(r.length-s.length)===1){if(Za(s))return 1;if(Za(r))return-1}return r.length-s.length}function Za(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const og={strict:!1,end:!0,sensitive:!1};function ag(e,t,n){const s=rg(tg(e.path),n),r=Re(s,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function lg(e,t){const n=[],s=new Map;t=Fa(og,t);function r(d){return s.get(d)}function i(d,h,f){const g=!f,b=Xa(d);b.aliasOf=f&&f.record;const T=Fa(t,d),E=[b];if("alias"in d){const k=typeof d.alias=="string"?[d.alias]:d.alias;for(const $ of k)E.push(Xa(Re({},b,{components:f?f.record.components:b.components,path:$,aliasOf:f?f.record:b})))}let m,x;for(const k of E){const{path:$}=k;if(h&&$[0]!=="/"){const D=h.record.path,S=D[D.length-1]==="/"?"":"/";k.path=h.record.path+($&&S+$)}if(m=ag(k,h,T),f?f.alias.push(m):(x=x||m,x!==m&&x.alias.push(m),g&&d.name&&!Qa(m)&&o(d.name)),Su(m)&&l(m),b.children){const D=b.children;for(let S=0;S<D.length;S++)i(D[S],m,f&&f.children[S])}f=f||m}return x?()=>{o(x)}:Ps}function o(d){if(wu(d)){const h=s.get(d);h&&(s.delete(d),n.splice(n.indexOf(h),1),h.children.forEach(o),h.alias.forEach(o))}else{const h=n.indexOf(d);h>-1&&(n.splice(h,1),d.record.name&&s.delete(d.record.name),d.children.forEach(o),d.alias.forEach(o))}}function a(){return n}function l(d){const h=dg(d,n);n.splice(h,0,d),d.record.name&&!Qa(d)&&s.set(d.record.name,d)}function c(d,h){let f,g={},b,T;if("name"in d&&d.name){if(f=s.get(d.name),!f)throw cs(Be.MATCHER_NOT_FOUND,{location:d});T=f.record.name,g=Re(Ya(h.params,f.keys.filter(x=>!x.optional).concat(f.parent?f.parent.keys.filter(x=>x.optional):[]).map(x=>x.name)),d.params&&Ya(d.params,f.keys.map(x=>x.name))),b=f.stringify(g)}else if(d.path!=null)b=d.path,f=n.find(x=>x.re.test(b)),f&&(g=f.parse(b),T=f.record.name);else{if(f=h.name?s.get(h.name):n.find(x=>x.re.test(h.path)),!f)throw cs(Be.MATCHER_NOT_FOUND,{location:d,currentLocation:h});T=f.record.name,g=Re({},h.params,d.params),b=f.stringify(g)}const E=[];let m=f;for(;m;)E.unshift(m.record),m=m.parent;return{name:T,path:b,params:g,matched:E,meta:ug(E)}}e.forEach(d=>i(d));function u(){n.length=0,s.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:r}}function Ya(e,t){const n={};for(const s of t)s in e&&(n[s]=e[s]);return n}function Xa(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:cg(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 cg(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const s in e.components)t[s]=typeof n=="object"?n[s]:n;return t}function Qa(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function ug(e){return e.reduce((t,n)=>Re(t,n.meta),{})}function dg(e,t){let n=0,s=t.length;for(;n!==s;){const i=n+s>>1;ku(e,t[i])<0?s=i:n=i+1}const r=hg(e);return r&&(s=t.lastIndexOf(r,s-1)),s}function hg(e){let t=e;for(;t=t.parent;)if(Su(t)&&ku(e,t)===0)return t}function Su({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function el(e){const t=_t(oi),n=_t(Uo),s=Oe(()=>{const l=De(e.to);return t.resolve(l)}),r=Oe(()=>{const{matched:l}=s.value,{length:c}=l,u=l[c-1],d=n.matched;if(!u||!d.length)return-1;const h=d.findIndex(ls.bind(null,u));if(h>-1)return h;const f=tl(l[c-2]);return c>1&&tl(u)===f&&d[d.length-1].path!==f?d.findIndex(ls.bind(null,l[c-2])):h}),i=Oe(()=>r.value>-1&&bg(n.params,s.value.params)),o=Oe(()=>r.value>-1&&r.value===n.matched.length-1&&_u(n.params,s.value.params));function a(l={}){if(mg(l)){const c=t[De(e.replace)?"replace":"push"](De(e.to)).catch(Ps);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:s,href:Oe(()=>s.value.href),isActive:i,isExactActive:o,navigate:a}}function fg(e){return e.length===1?e[0]:e}const pg=Ge({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:el,setup(e,{slots:t}){const n=at(el(e)),{options:s}=_t(oi),r=Oe(()=>({[nl(e.activeClass,s.linkActiveClass,"router-link-active")]:n.isActive,[nl(e.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&fg(t.default(n));return e.custom?i:Mo("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},i)}}}),gg=pg;function mg(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 bg(e,t){for(const n in t){const s=t[n],r=e[n];if(typeof s=="string"){if(s!==r)return!1}else if(!Ot(r)||r.length!==s.length||s.some((i,o)=>i.valueOf()!==r[o].valueOf()))return!1}return!0}function tl(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const nl=(e,t,n)=>e??t??n,vg=Ge({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const s=_t(to),r=Oe(()=>e.route||s.value),i=_t(Ga,0),o=Oe(()=>{let c=De(i);const{matched:u}=r.value;let d;for(;(d=u[c])&&!d.components;)c++;return c}),a=Oe(()=>r.value.matched[o.value]);xr(Ga,Oe(()=>o.value+1)),xr(Gp,a),xr(to,r);const l=B();return mt(()=>[l.value,a.value,e.name],([c,u,d],[h,f,g])=>{u&&(u.instances[d]=c,f&&f!==u&&c&&c===h&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!ls(u,f)||!h)&&(u.enterCallbacks[d]||[]).forEach(b=>b(c))},{flush:"post"}),()=>{const c=r.value,u=e.name,d=a.value,h=d&&d.components[u];if(!h)return sl(n.default,{Component:h,route:c});const f=d.props[u],g=f?f===!0?c.params:typeof f=="function"?f(c):f:null,T=Mo(h,Re({},g,t,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(d.instances[u]=null)},ref:l}));return sl(n.default,{Component:T,route:c})||T}}});function sl(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const no=vg;function yg(e){const t=lg(e.routes,e),n=e.parseQuery||Kp,s=e.stringifyQuery||Wa,r=e.history,i=ys(),o=ys(),a=ys(),l=rh(un);let c=un;Jn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ti.bind(null,M=>""+M),d=Ti.bind(null,Rp),h=Ti.bind(null,Ws);function f(M,X){let se,fe;return wu(M)?(se=t.getRecordMatcher(M),fe=X):fe=M,t.addRoute(fe,se)}function g(M){const X=t.getRecordMatcher(M);X&&t.removeRoute(X)}function b(){return t.getRoutes().map(M=>M.record)}function T(M){return!!t.getRecordMatcher(M)}function E(M,X){if(X=Re({},X||l.value),typeof M=="string"){const O=Ai(n,M,X.path),H=t.resolve({path:O.path},X),z=r.createHref(O.fullPath);return Re(O,H,{params:h(H.params),hash:Ws(O.hash),redirectedFrom:void 0,href:z})}let se;if(M.path!=null)se=Re({},M,{path:Ai(n,M.path,X.path).path});else{const O=Re({},M.params);for(const H in O)O[H]==null&&delete O[H];se=Re({},M,{params:d(O)}),X.params=d(X.params)}const fe=t.resolve(se,X),ke=M.hash||"";fe.params=u(h(fe.params));const v=$p(s,Re({},M,{hash:Sp(ke),path:fe.path})),_=r.createHref(v);return Re({fullPath:v,hash:ke,query:s===Wa?Wp(M.query):M.query||{}},fe,{redirectedFrom:void 0,href:_})}function m(M){return typeof M=="string"?Ai(n,M,l.value.path):Re({},M)}function x(M,X){if(c!==M)return cs(Be.NAVIGATION_CANCELLED,{from:X,to:M})}function k(M){return S(M)}function $(M){return k(Re(m(M),{replace:!0}))}function D(M,X){const se=M.matched[M.matched.length-1];if(se&&se.redirect){const{redirect:fe}=se;let ke=typeof fe=="function"?fe(M,X):fe;return typeof ke=="string"&&(ke=ke.includes("?")||ke.includes("#")?ke=m(ke):{path:ke},ke.params={}),Re({query:M.query,hash:M.hash,params:ke.path!=null?{}:M.params},ke)}}function S(M,X){const se=c=E(M),fe=l.value,ke=M.state,v=M.force,_=M.replace===!0,O=D(se,fe);if(O)return S(Re(m(O),{state:typeof O=="object"?Re({},ke,O.state):ke,force:v,replace:_}),X||se);const H=se;H.redirectedFrom=X;let z;return!v&&Np(s,fe,se)&&(z=cs(Be.NAVIGATION_DUPLICATED,{to:H,from:fe}),we(fe,fe,!0,!1)),(z?Promise.resolve(z):G(H,fe)).catch(K=>qt(K)?qt(K,Be.NAVIGATION_GUARD_REDIRECT)?K:pe(K):q(K,H,fe)).then(K=>{if(K){if(qt(K,Be.NAVIGATION_GUARD_REDIRECT))return S(Re({replace:_},m(K.to),{state:typeof K.to=="object"?Re({},ke,K.to.state):ke,force:v}),X||H)}else K=L(H,fe,!0,_,ke);return oe(H,fe,K),K})}function R(M,X){const se=x(M,X);return se?Promise.reject(se):Promise.resolve()}function C(M){const X=Y.values().next().value;return X&&typeof X.runWithContext=="function"?X.runWithContext(M):M()}function G(M,X){let se;const[fe,ke,v]=zp(M,X);se=Ci(fe.reverse(),"beforeRouteLeave",M,X);for(const O of fe)O.leaveGuards.forEach(H=>{se.push(pn(H,M,X))});const _=R.bind(null,M,X);return se.push(_),ne(se).then(()=>{se=[];for(const O of i.list())se.push(pn(O,M,X));return se.push(_),ne(se)}).then(()=>{se=Ci(ke,"beforeRouteUpdate",M,X);for(const O of ke)O.updateGuards.forEach(H=>{se.push(pn(H,M,X))});return se.push(_),ne(se)}).then(()=>{se=[];for(const O of v)if(O.beforeEnter)if(Ot(O.beforeEnter))for(const H of O.beforeEnter)se.push(pn(H,M,X));else se.push(pn(O.beforeEnter,M,X));return se.push(_),ne(se)}).then(()=>(M.matched.forEach(O=>O.enterCallbacks={}),se=Ci(v,"beforeRouteEnter",M,X,C),se.push(_),ne(se))).then(()=>{se=[];for(const O of o.list())se.push(pn(O,M,X));return se.push(_),ne(se)}).catch(O=>qt(O,Be.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function oe(M,X,se){a.list().forEach(fe=>C(()=>fe(M,X,se)))}function L(M,X,se,fe,ke){const v=x(M,X);if(v)return v;const _=X===un,O=Jn?history.state:{};se&&(fe||_?r.replace(M.fullPath,Re({scroll:_&&O&&O.scroll},ke)):r.push(M.fullPath,ke)),l.value=M,we(M,X,se,_),pe()}let N;function P(){N||(N=r.listen((M,X,se)=>{if(!ce.listening)return;const fe=E(M),ke=D(fe,ce.currentRoute.value);if(ke){S(Re(ke,{replace:!0,force:!0}),fe).catch(Ps);return}c=fe;const v=l.value;Jn&&Bp(Ka(v.fullPath,se.delta),ii()),G(fe,v).catch(_=>qt(_,Be.NAVIGATION_ABORTED|Be.NAVIGATION_CANCELLED)?_:qt(_,Be.NAVIGATION_GUARD_REDIRECT)?(S(Re(m(_.to),{force:!0}),fe).then(O=>{qt(O,Be.NAVIGATION_ABORTED|Be.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===Qi.pop&&r.go(-1,!1)}).catch(Ps),Promise.reject()):(se.delta&&r.go(-se.delta,!1),q(_,fe,v))).then(_=>{_=_||L(fe,v,!1),_&&(se.delta&&!qt(_,Be.NAVIGATION_CANCELLED)?r.go(-se.delta,!1):se.type===Qi.pop&&qt(_,Be.NAVIGATION_ABORTED|Be.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),oe(fe,v,_)}).catch(Ps)}))}let I=ys(),A=ys(),j;function q(M,X,se){pe(M);const fe=A.list();return fe.length?fe.forEach(ke=>ke(M,X,se)):console.error(M),Promise.reject(M)}function ae(){return j&&l.value!==un?Promise.resolve():new Promise((M,X)=>{I.add([M,X])})}function pe(M){return j||(j=!M,P(),I.list().forEach(([X,se])=>M?se(M):X()),I.reset()),M}function we(M,X,se,fe){const{scrollBehavior:ke}=e;if(!Jn||!ke)return Promise.resolve();const v=!se&&Hp(Ka(M.fullPath,0))||(fe||!se)&&history.state&&history.state.scroll||null;return At().then(()=>ke(M,X,v)).then(_=>_&&Up(_)).catch(_=>q(_,M,X))}const V=M=>r.go(M);let le;const Y=new Set,ce={currentRoute:l,listening:!0,addRoute:f,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:T,getRoutes:b,resolve:E,options:e,push:k,replace:$,go:V,back:()=>V(-1),forward:()=>V(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:A.add,isReady:ae,install(M){M.component("RouterLink",gg),M.component("RouterView",no),M.config.globalProperties.$router=ce,Object.defineProperty(M.config.globalProperties,"$route",{enumerable:!0,get:()=>De(l)}),Jn&&!le&&l.value===un&&(le=!0,k(r.location).catch(fe=>{}));const X={};for(const fe in un)Object.defineProperty(X,fe,{get:()=>l.value[fe],enumerable:!0});M.provide(oi,ce),M.provide(Uo,mc(X)),M.provide(to,l);const se=M.unmount;Y.add(M),M.unmount=function(){Y.delete(M),Y.size<1&&(c=un,N&&N(),N=null,l.value=un,le=!1,j=!1),se()}}};function ne(M){return M.reduce((X,se)=>X.then(()=>C(se)),Promise.resolve())}return ce}function _g(){return _t(oi)}function Bo(e){return _t(Uo)}function ai(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)t.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(n[s[r]]=e[s[r]]);return n}function wg(e,t,n,s){function r(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(s.next(u))}catch(d){o(d)}}function l(u){try{c(s.throw(u))}catch(d){o(d)}}function c(u){u.done?i(u.value):r(u.value).then(a,l)}c((s=s.apply(e,t||[])).next())})}const xg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Ho extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Eg extends Ho{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class rl extends Ho{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class il extends Ho{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var so;(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"})(so||(so={}));class kg{constructor(t,{headers:n={},customFetch:s,region:r=so.Any}={}){this.url=t,this.headers=n,this.region=r,this.fetch=xg(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return wg(this,arguments,void 0,function*(n,s={}){var r;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:d}=s;let h={},{region:f}=s;f||(f=this.region);const g=new URL(`${this.url}/${n}`);f&&f!=="any"&&(h["x-region"]=f,g.searchParams.set("forceFunctionRegion",f));let b;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",b=c):typeof c=="string"?(h["Content-Type"]="text/plain",b=c):typeof FormData<"u"&&c instanceof FormData?b=c:(h["Content-Type"]="application/json",b=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?b=JSON.stringify(c):b=c;let T=u;d&&(o=new AbortController,i=setTimeout(()=>o.abort(),d),u?(T=o.signal,u.addEventListener("abort",()=>o.abort())):T=o.signal);const E=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),a),body:b,signal:T}).catch($=>{throw new Eg($)}),m=E.headers.get("x-relay-error");if(m&&m==="true")throw new rl(E);if(!E.ok)throw new il(E);let x=((r=E.headers.get("Content-Type"))!==null&&r!==void 0?r:"text/plain").split(";")[0].trim(),k;return x==="application/json"?k=yield E.json():x==="application/octet-stream"||x==="application/pdf"?k=yield E.blob():x==="text/event-stream"?k=E:x==="multipart/form-data"?k=yield E.formData():k=yield E.text(),{data:k,error:null,response:E}}catch(a){return{data:null,error:a,response:a instanceof il||a instanceof rl?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Tu=3,ol=e=>Math.min(1e3*2**e,3e4),Sg=[520,503],Au=["GET","HEAD","OPTIONS"];var Tg=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 al(e,t){return new Promise(n=>{if(t!=null&&t.aborted){n();return}const s=setTimeout(()=>{t==null||t.removeEventListener("abort",r),n()},e);function r(){clearTimeout(s),n()}t==null||t.addEventListener("abort",r)})}function Ag(e,t,n,s){return!(!s||n>=Tu||!Au.includes(e)||!Sg.includes(t))}var Rg=class{constructor(e){var t,n,s,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=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(s=e.shouldStripNulls)!==null&&s!==void 0?s:!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 n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const s=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(n.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await s(n.url.toString(),{method:n.method,headers:c,body:JSON.stringify(n.body,(d,h)=>typeof h=="bigint"?h.toString():h),signal:n.signal})}catch(d){if((d==null?void 0:d.name)==="AbortError"||(d==null?void 0:d.code)==="ABORT_ERR"||!Au.includes(n.method))throw d;if(n.retryEnabled&&o<Tu){const h=ol(o);o++,await al(h,n.signal);continue}throw d}if(Ag(n.method,u.status,o,n.retryEnabled)){var a,l;const d=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,h=d!==null?Math.max(0,parseInt(d,10)||0)*1e3:ol(o);await u.text(),o++,await al(h,n.signal);continue}return await n.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const d=o==null?void 0:o.cause;if(d){var h,f,g,b;const m=(h=d==null?void 0:d.message)!==null&&h!==void 0?h:"",x=(f=d==null?void 0:d.code)!==null&&f!==void 0?f:"";l=`${(g=o==null?void 0:o.name)!==null&&g!==void 0?g:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
30
|
-
|
|
31
|
-
Caused by: ${(b=d==null?void 0:d.name)!==null&&b!==void 0?b:"Error"}: ${m}`,x&&(l+=` (${x})`),d!=null&&d.stack&&(l+=`
|
|
32
|
-
${d.stack}`)}else{var T;l=(T=o==null?void 0:o.stack)!==null&&T!==void 0?T:""}const E=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",E>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${E} 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)",E>this.urlLengthLimit&&(c+=`. Your request URL is ${E} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let n=null,s=null,r=null,i=e.status,o=e.statusText;if(e.ok){var a,l;if(t.method!=="HEAD"){var c;const h=await e.text();h===""||(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"))?s=h:s=JSON.parse(h))}const u=(a=t.headers.get("Prefer"))===null||a===void 0?void 0:a.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(s)&&(s.length>1?(n={code:"PGRST116",details:`Results contain ${s.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},s=null,r=null,i=406,o="Not Acceptable"):s.length===1?s=s[0]:s=null)}else{const u=await e.text();try{n=JSON.parse(u),Array.isArray(n)&&e.status===404&&(s=[],n=null,i=200,o="OK")}catch{e.status===404&&u===""?(i=204,o="No Content"):n={message:u}}if(n&&t.shouldThrowOnError)throw new Tg(n)}return{success:n===null,error:n,data:s,count:r,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Cg=class extends Rg{select(e){let t=!1;const n=(e??"*").split("").map(s=>/\s/.test(s)&&!t?"":(s==='"'&&(t=!t),s)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:s,referencedTable:r=s}={}){const i=r?`${r}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const s=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:s=n}={}){const r=typeof s>"u"?"offset":`${s}.offset`,i=typeof s>"u"?"limit":`${s}.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:n=!1,buffers:s=!1,wal:r=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,s?"buffers":null,r?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const ll=new RegExp("[,()]");var Zn=class extends Cg{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 n=Array.from(new Set(t)).map(s=>typeof s=="string"&&ll.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(s=>typeof s=="string"&&ll.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),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:n,type:s}={}){let r="";s==="plain"?r="pl":s==="phrase"?r="ph":s==="websearch"&&(r="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${r}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const s=n?`${n}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Og=class{constructor(e,{headers:t={},schema:n,fetch:s,urlLengthLimit:r=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=s,this.urlLengthLimit=r,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:s}=t??{},r=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),s&&l.append("Prefer",`count=${s}`),new Zn({method:r,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var s;const r="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const a=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Zn({method:r,url:i,headers:o,schema:this.schema,body:e,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:s,defaultToNull:r=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&a.searchParams.set("on_conflict",t),s&&l.append("Prefer",`count=${s}`),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}"`);a.searchParams.set("columns",u.join(","))}}return new Zn({method:o,url:a,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 n;const s="PATCH",{url:r,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Zn({method:s,url:r,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:s,headers:r}=this.cloneRequestState();return e&&r.append("Prefer",`count=${e}`),new Zn({method:n,url:s,headers:r,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Gs(e){"@babel/helpers - typeof";return Gs=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},Gs(e)}function $g(e,t){if(Gs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Gs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ng(e){var t=$g(e,"string");return Gs(t)=="symbol"?t:t+""}function Ig(e,t,n){return(t=Ng(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function ur(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(s){Ig(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}var Pg=class Ru{constructor(t,{headers:n={},schema:s,fetch:r,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=t,this.headers=new Headers(n),this.schemaName=s,this.urlLengthLimit=o;const l=r??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const d=new AbortController,h=setTimeout(()=>d.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(h),l(c,u);const g=()=>{clearTimeout(h),d.abort()};return f.addEventListener("abort",g,{once:!0}),l(c,ur(ur({},u),{},{signal:d.signal})).finally(()=>{clearTimeout(h),f.removeEventListener("abort",g)})}return l(c,ur(ur({},u),{},{signal:d.signal})).finally(()=>clearTimeout(h))}:this.fetch=l,this.retry=a}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Og(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 Ru(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:s=!1,get:r=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),d=s&&Object.values(n).some(u);d?(a="POST",c=n):s||r?(a=s?"HEAD":"GET",Object.entries(n).filter(([f,g])=>g!==void 0).map(([f,g])=>[f,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([f,g])=>{l.searchParams.append(f,g)})):(a="POST",c=n);const h=new Headers(this.headers);return d?h.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&h.set("Prefer",`count=${i}`),new Zn({method:a,url:l,headers:h,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Lg{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const s=typeof global<"u"?global:void 0;if(s&&typeof s.WebSocket<"u")return{type:"native",wsConstructor:s.WebSocket};if(typeof globalThis<"u"&&typeof n.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"&&n.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 o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
33
|
-
import ws from "ws"
|
|
34
|
-
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
|
|
35
|
-
|
|
36
|
-
Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Mg="2.105.4",jg=`realtime-js/${Mg}`,Dg="1.0.0",Cu="2.0.0",Ug=Cu,Bg=1e4,Hg=100,mn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ou={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},ro={connecting:"connecting",closing:"closing",closed:"closed"};class Fg{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,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const r=(s=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&s!==void 0?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,r)}_encodeJsonUserBroadcastPush(t){var n,s;const r=(s=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&s!==void 0?s:{},o=new TextEncoder().encode(JSON.stringify(r)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,s){var r,i;const o=t.topic,a=(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(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const h=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+d.length,f=new ArrayBuffer(this.HEADER_LENGTH+h);let g=new DataView(f),b=0;g.setUint8(b++,this.KINDS.userBroadcastPush),g.setUint8(b++,l.length),g.setUint8(b++,a.length),g.setUint8(b++,o.length),g.setUint8(b++,c.length),g.setUint8(b++,d.length),g.setUint8(b++,n),Array.from(l,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(a,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(o,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(c,E=>g.setUint8(b++,E.charCodeAt(0))),Array.from(d,E=>g.setUint8(b++,E.charCodeAt(0)));var T=new Uint8Array(f.byteLength+s.byteLength);return T.set(new Uint8Array(f),0),T.set(new Uint8Array(s),f.byteLength),T.buffer}decode(t,n){if(this._isArrayBuffer(t)){let s=this._binaryDecode(t);return n(s)}if(typeof t=="string"){const s=JSON.parse(t),[r,i,o,a,l]=s;return n({join_ref:r,ref:i,topic:o,event:a,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),r=new TextDecoder;switch(s){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,r)}}_decodeUserBroadcast(t,n,s){const r=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=s.decode(t.slice(l,l+r));l=l+r;const u=s.decode(t.slice(l,l+i));l=l+i;const d=s.decode(t.slice(l,l+o));l=l+o;const h=t.slice(l,t.byteLength),f=a===this.JSON_ENCODING?JSON.parse(s.decode(h)):h,g={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(g.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([s])=>n.includes(s)))}}var Pe;(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"})(Pe||(Pe={}));const ul=(e,t,n={})=>{var s;const r=(s=n.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=Vg(o,e,t,r),i),{}):{}},Vg=(e,t,n,s)=>{const r=t.find(a=>a.name===e),i=r==null?void 0:r.type,o=n[e];return i&&!s.includes(i)?$u(i,o):io(o)},$u=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Gg(t,n)}switch(e){case Pe.bool:return qg(t);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return Kg(t);case Pe.json:case Pe.jsonb:return Wg(t);case Pe.timestamp:return zg(t);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return io(t);default:return io(t)}},io=e=>e,qg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Kg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Wg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Gg=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,s=e[n];if(e[0]==="{"&&s==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>$u(t,a))}return e},zg=e=>typeof e=="string"?e.replace(" ","T"):e,Nu=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 Ls=e=>typeof e=="function"?e:function(){return e},Jg=typeof self<"u"?self:null,Yn=typeof window<"u"?window:null,Mt=Jg||Yn||globalThis,Zg="2.0.0",Yg=1e4,Xg=1e3,Ut={connecting:0,open:1,closing:2,closed:3},ut={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Gt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},oo={longpoll:"longpoll",websocket:"websocket"},Qg={complete:4},ao="base64url.bearer.phx.",dr=class{constructor(e,t,n,s){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=s,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:n}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.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})}},Iu=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))}},em=class{constructor(e,t,n){this.state=ut.closed,this.topic=e,this.params=Ls(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new dr(this,Gt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Iu(()=>{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=ut.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",s=>{this.state=ut.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=ut.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=ut.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 dr(this,Gt.leave,Ls({}),this.timeout).send(),this.state=ut.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Gt.reply,(s,r)=>{this.trigger(this.replyEventName(r),s)})}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=ut.closed,this.bindings=[]}onClose(e){this.on(Gt.close,e)}onError(e){return this.on(Gt.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=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 s=new dr(this,e,function(){return t},n);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=ut.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Gt.close,"leave")},n=new dr(this,Gt.leave,Ls({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,s){return this.topic!==e?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=ut.joining,this.joinPush.resend(e))}trigger(e,t,n,s){let r=this.onMessage(e,t,n,s);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,n));for(let o=0;o<i.length;o++)i[o].callback(r,n,s||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===ut.closed}isErrored(){return this.state===ut.errored}isJoined(){return this.state===ut.joined}isJoining(){return this.state===ut.joining}isLeaving(){return this.state===ut.leaving}},Lr=class{static request(e,t,n,s,r,i,o){if(Mt.XDomainRequest){let a=new Mt.XDomainRequest;return this.xdomainRequest(a,e,t,s,r,i,o)}else if(Mt.XMLHttpRequest){let a=new Mt.XMLHttpRequest;return this.xhrRequest(a,e,t,n,s,r,i,o)}else{if(Mt.fetch&&Mt.AbortController)return this.fetchRequest(e,t,n,s,r,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,s,r,i,o){let a={method:e,headers:n,body:s},l=null;return r&&(l=new AbortController,setTimeout(()=>l.abort(),r),a.signal=l.signal),Mt.fetch(t,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(e,t,n,s,r,i,o){return e.timeout=r,e.open(t,n),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,n,s,r,i,o,a){e.open(t,n,!0),e.timeout=i;for(let[l,c]of Object.entries(s))e.setRequestHeader(l,c);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===Qg.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),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 n=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let r=t?`${t}[${s}]`:s,i=e[s];typeof i=="object"?n.push(this.serialize(i,r)):n.push(encodeURIComponent(r)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},tm=e=>{let t="",n=new Uint8Array(e),s=n.byteLength;for(let r=0;r<s;r++)t+=String.fromCharCode(n[r]);return btoa(t)},Fn=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(ao)&&(this.authToken=atob(t[1].slice(ao.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=Ut.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+oo.websocket),"$1/"+oo.longpoll)}endpointURL(){return Lr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Ut.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ut.open||this.readyState===Ut.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:n,token:s,messages:r}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=s}else n=0;switch(n){case 200:r.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Ut.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 ${n}`)}})}send(e){typeof e!="string"&&(e=tm(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,n){for(let r of this.reqs)r.abort();this.readyState=Ut.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(e,t,n,s,r){let i,o=()=>{this.reqs.delete(i),s()};i=Lr.request(e,this.endpointURL(),t,n,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&r(a)}),this.reqs.add(i)}},nm=class ks{constructor(t,n={}){let s=n.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(s.state,r=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=ks.syncState(this.state,r,i,o),this.pendingDiffs.forEach(l=>{this.state=ks.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(s.diff,r=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=ks.syncDiff(this.state,r,i,o),a())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return ks.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,s,r){let i=this.clone(t),o={},a={};return this.map(i,(l,c)=>{n[l]||(a[l]=c)}),this.map(n,(l,c)=>{let u=i[l];if(u){let d=c.metas.map(b=>b.phx_ref),h=u.metas.map(b=>b.phx_ref),f=c.metas.filter(b=>h.indexOf(b.phx_ref)<0),g=u.metas.filter(b=>d.indexOf(b.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),g.length>0&&(a[l]=this.clone(u),a[l].metas=g)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},s,r)}static syncDiff(t,n,s,r){let{joins:i,leaves:o}=this.clone(n);return s||(s=function(){}),r||(r=function(){}),this.map(i,(a,l)=>{let c=t[a];if(t[a]=this.clone(l),c){let u=t[a].metas.map(h=>h.phx_ref),d=c.metas.filter(h=>u.indexOf(h.phx_ref)<0);t[a].metas.unshift(...d)}s(a,c,l)}),this.map(o,(a,l)=>{let c=t[a];if(!c)return;let u=l.metas.map(d=>d.phx_ref);c.metas=c.metas.filter(d=>u.indexOf(d.phx_ref)<0),r(a,c,l),c.metas.length===0&&delete t[a]}),t}static list(t,n){return n||(n=function(s,r){return r}),this.map(t,(s,r)=>n(s,r))}static map(t,n){return Object.getOwnPropertyNames(t).map(s=>n(s,t[s]))}static clone(t){return JSON.parse(JSON.stringify(t))}},hr={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 n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,s,r,i,o]=JSON.parse(e);return t({join_ref:n,ref:s,topic:r,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:s,topic:r,payload:i}=e,o=this.META_LENGTH+t.length+n.length+r.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,r.length),l.setUint8(c++,s.length),Array.from(t,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(n,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(r,d=>l.setUint8(c++,d.charCodeAt(0))),Array.from(s,d=>l.setUint8(c++,d.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,n){let s=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+s));o=o+s;let l=n.decode(e.slice(o,o+r));o=o+r;let c=n.decode(e.slice(o,o+i));o=o+i;let u=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,n){let s=t.getUint8(1),r=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(a,a+s));a=a+s;let c=n.decode(e.slice(a,a+r));a=a+r;let u=n.decode(e.slice(a,a+i));a=a+i;let d=n.decode(e.slice(a,a+o));a=a+o;let h=e.slice(a,e.byteLength),f={status:d,response:h};return{join_ref:l,ref:c,topic:u,event:Gt.reply,payload:f}},decodeBroadcast(e,t,n){let s=t.getUint8(1),r=t.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(e.slice(i,i+s));i=i+s;let a=n.decode(e.slice(i,i+r));i=i+r;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},sm=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||Yg,this.transport=t.transport||Mt.WebSocket||Fn,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=Mt&&Mt.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=hr.encode.bind(hr),this.defaultDecoder=hr.decode.bind(hr),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!==Fn?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let s=null;Yn&&Yn.addEventListener&&(Yn.addEventListener("pagehide",r=>{this.conn&&(this.disconnect(),s=this.connectClock)}),Yn.addEventListener("pageshow",r=>{s===this.connectClock&&(s=null,this.connect())}),Yn.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,o)=>{console.log(`${r}: ${i}`,o)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Ls(t.params||{}),this.endPoint=`${e}/${oo.websocket}`,this.vsn=t.vsn||Zg,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Iu(()=>{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 Fn}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=Lr.appendParams(Lr.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,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Ls(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Fn?this.connectWithFallback(Fn,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}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(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(r=>{r.ref===t&&(this.off([s]),e(Date.now()-n))});return!0}transportName(e){switch(e){case Fn:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${ao}${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 n=!1,s=!0,r,i,o=this.transportName(e),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([r,i]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),i=this.onError(l=>{this.log("transport","error",l),s&&!n&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!s){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(a,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(),Xg,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const s=this.conn;this.waitForBufferDone(s,()=>{t?s.close(t,n||""):s.close(),this.waitForSocketClosed(s,()=>{this.conn===s&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Ut.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}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,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Gt.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ut.connecting:return"connecting";case Ut.open:return"open";case Ut.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(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new em(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:s,ref:r,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${r})`,s)}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:n,event:s,payload:r,ref:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(r.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${r.status||""} ${n} ${s} ${i&&"("+i+")"||""}`.trim(),r);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(n,s,r,o)&&l.trigger(s,r,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,s])=>{try{s(...t)}catch(r){this.log("error",`error in ${e} callback`,r)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Ms{constructor(t,n){const s=im(n);this.presence=new nm(t.getChannel(),s),this.presence.onJoin((r,i,o)=>{const a=Ms.onJoinPayload(r,i,o);t.getChannel().trigger("presence",a)}),this.presence.onLeave((r,i,o)=>{const a=Ms.onLeavePayload(r,i,o);t.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Ms.transformState(this.presence.state)}static transformState(t){return t=rm(t),Object.getOwnPropertyNames(t).reduce((n,s)=>{const r=t[s];return n[s]=Sr(r),n},{})}static onJoinPayload(t,n,s){const r=dl(n),i=Sr(s);return{event:"join",key:t,currentPresences:r,newPresences:i}}static onLeavePayload(t,n,s){const r=dl(n),i=Sr(s);return{event:"leave",key:t,currentPresences:r,leftPresences:i}}}function Sr(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function rm(e){return JSON.parse(JSON.stringify(e))}function im(e){return(e==null?void 0:e.events)&&{events:e.events}}function dl(e){return e!=null&&e.metas?Sr(e):[]}var hl;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(hl||(hl={}));class om{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Ms(this.channel.channelAdapter,n)}}function am(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 n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class lm{constructor(t,n,s){const r=cm(s);this.channel=t.getSocket().channel(n,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,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}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,n,s){let r;try{r=this.channel.push(t,n,s)}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>Hg){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 n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===mn.joined}isJoined(){return this.state===mn.joined}isJoining(){return this.state===mn.joining}isClosed(){return this.state===mn.closed}isLeaving(){return this.state===mn.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function cm(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var fl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(fl||(fl={}));var ts;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(ts||(ts={}));var zt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(zt||(zt={}));class js{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,n={config:{}},s){var r,i;if(this.topic=t,this.params=n,this.socket=s,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new lm(this.socket.socketAdapter,t,this.params),this.presence=new om(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Nu(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,n=this.timeout){var s,r,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(r=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(f=>f.filter))!==null&&r!==void 0?r:[],u=!!this.bindings[ts.PRESENCE]&&this.bindings[ts.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,d={},h={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(f=>{t==null||t(zt.CHANNEL_ERROR,am(f))}),this._onClose(()=>t==null?void 0:t(zt.CLOSED)),this.updateJoinPayload(Object.assign({config:h},d)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(zt.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=mn.errored;const g=Object.values(f).join(", ")||"error";t==null||t(zt.CHANNEL_ERROR,new Error(g,{cause:f}))}).receive("timeout",()=>{t==null||t(zt.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var s;const r=this.bindings.postgres_changes,i=(s=r==null?void 0:r.length)!==null&&s!==void 0?s:0,o=[];for(let a=0;a<i;a++){const l=r[a],{filter:{event:c,schema:u,table:d,filter:h}}=l,f=t&&t[a];if(f&&f.event===c&&js.isFilterValueEqual(f.schema,u)&&js.isFilterValueEqual(f.table,d)&&js.isFilterValueEqual(f.filter,h))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=mn.errored,n==null||n(zt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=mn.errored&&n&&n(zt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,s){const r=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===ts.PRESENCE||t===ts.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,n,s)}async httpSend(t,n,s={}){var r;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(r=s.timeout)!==null&&r!==void 0?r:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(t,n={}){var s,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:o}=t,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(s=n.timeout)!==null&&s!==void 0?s: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 o,a,l;const c=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,s){const r=new AbortController,i=setTimeout(()=>r.abort(),s),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:r.signal}));return clearTimeout(i),o}_on(t,n,s){const r=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,s),o={type:r,filter:n,callback:s,ref:i};return this.bindings[r]?this.bindings[r].push(o):this.bindings[r]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,s)=>{var r,i,o,a,l,c,u;const d=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,s))return!1;const h=(r=this.bindings[d])===null||r===void 0?void 0:r.find(f=>f.ref===t.ref);if(!h)return!0;if(["broadcast","presence","postgres_changes"].includes(d))if("id"in h){const f=h.id,g=(i=h.filter)===null||i===void 0?void 0:i.event;return f&&((o=n.ids)===null||o===void 0?void 0:o.includes(f))&&(g==="*"||(g==null?void 0:g.toLocaleLowerCase())===((a=n.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=h==null?void 0:h.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(t,n){const{close:s,error:r,leave:i,join:o}=Ou;return n&&[s,r,i,o].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,s)=>{if(typeof n=="object"&&"ids"in n){const r=n.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=r;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(r))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const s of t.bindings[n])this._on(s.type,s.filter,s.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=ul(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=ul(t.columns,t.old_record)),n}}class um{constructor(t,n){this.socket=new sm(t,n)}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,n,s,r=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),r),this.socket.disconnect(()=>{t(),i("ok")},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}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()==ro.connecting}isDisconnecting(){return this.socket.connectionState()==ro.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const pl={HEARTBEAT_INTERVAL:25e3},dm=[1e3,2e3,5e3,1e4],hm=1e4;function fm(){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 n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function pm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return fm()}const gm=`
|
|
38
|
-
addEventListener("message", (e) => {
|
|
39
|
-
if (e.data.event === "start") {
|
|
40
|
-
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
41
|
-
}
|
|
42
|
-
});`;class mm{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,n){var s;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 Fg,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const r=this._initializeOptions(n);this.socketAdapter=new um(t,r),this.httpEndpoint=Nu(t),this.fetch=this._resolveFetch(n==null?void 0:n.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 n=t.message;throw n.includes("Node.js")?new Error(`${n}
|
|
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: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async s=>{const r=await s.unsubscribe();return s.teardown(),r}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,s){this.socketAdapter.log(t,n,s)}connectionState(){return this.socketAdapter.connectionState()||ro.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const s=`realtime:${t}`,r=this.getChannels().find(i=>i.topic===s);if(r)return r;{const i=new js(`realtime:${t}`,n,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(n=>n.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 n,s=!1;if(t)n=t,s=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(r){this.log("error","Error fetching access token from callback",r),n=this.accessTokenValue}else n=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(r=>{const i={access_token:n,version:jg};n&&r.updateJoinPayload(i),r.joinedOnce&&r.channelAdapter.isJoined()&&r.channelAdapter.push(Ou.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),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(n,s)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,s)}}_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=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.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 n;if(t)n=t;else{const s=new Blob([gm],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_initializeOptions(t){var n,s,r,i,o,a,l,c,u,d,h,f;this.worker=(n=t==null?void 0:t.worker)!==null&&n!==void 0?n:!1,this.accessToken=(s=t==null?void 0:t.accessToken)!==null&&s!==void 0?s:null;const g={};g.timeout=(r=t==null?void 0:t.timeout)!==null&&r!==void 0?r:Bg,g.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:pl.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:pl.HEARTBEAT_INTERVAL),g.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:Lg.getWebSocketConstructor(),g.params=t==null?void 0:t.params,g.logger=t==null?void 0:t.logger,g.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),g.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:pm(),g.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:m=>dm[m-1]||hm;let b,T;const E=(d=t==null?void 0:t.vsn)!==null&&d!==void 0?d:Ug;switch(E){case Dg:b=(m,x)=>x(JSON.stringify(m)),T=(m,x)=>x(JSON.parse(m));break;case Cu:b=this.serializer.encode.bind(this.serializer),T=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${g.vsn}`)}if(g.vsn=E,g.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:b,g.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:T,g.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,g.params=Object.assign(Object.assign({},g.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,g.autoSendHeartbeat=!this.worker}return g}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var zs=class extends Error{constructor(e,t){var n;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)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function bm(e,t,n){const s=new URL(t,e);if(n)for(const[r,i]of Object.entries(n))i!==void 0&&s.searchParams.set(r,i);return s.toString()}async function vm(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 ym(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:s,query:r,body:i,headers:o}){const a=bm(e.baseUrl,s,r),l=await vm(e.auth),c=await t(a,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),h=d&&u?JSON.parse(u):u;if(!c.ok){const f=d?h:void 0,g=f==null?void 0:f.error;throw new zs((g==null?void 0:g.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:g==null?void 0:g.type,icebergCode:g==null?void 0:g.code,details:f})}return{status:c.status,headers:c.headers,data:h}}}}function fr(e){return e.join("")}var _m=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:fr(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(s=>({namespace:s}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${fr(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${fr(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${fr(e.namespace)}`}),!0}catch(t){if(t instanceof zs&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof zs&&n.status===409)return;throw n}}};function Vn(e){return e.join("")}var wm=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Vn(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Vn(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Vn(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Vn(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/${Vn(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/${Vn(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof zs&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof zs&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},xm=class{constructor(e){var s;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=ym({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(s=e.accessDelegation)==null?void 0:s.join(","),this.namespaceOps=new _m(this.client,t),this.tableOps=new wm(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 Js(e){"@babel/helpers - typeof";return Js=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},Js(e)}function Em(e,t){if(Js(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Js(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function km(e){var t=Em(e,"string");return Js(t)=="symbol"?t:t+""}function Sm(e,t,n){return(t=km(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gl(Object(n),!0).forEach(function(s){Sm(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gl(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}var li=class extends Error{constructor(e,t="storage",n,s){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function ci(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var lo=class extends li{constructor(e,t,n,s="storage"){super(e,s,t,n),this.name=s==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return _e({},super.toJSON())}},Pu=class extends li{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Mr(e,t,n){const s=_e({},e),r=t.toLowerCase();for(const i of Object.keys(s))i.toLowerCase()===r&&delete s[i];return s[r]=n,s}function Tm(e){const t={};for(const[n,s]of Object.entries(e))t[n.toLowerCase()]=s;return t}const Am=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Rm=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)},co=e=>{if(Array.isArray(e))return e.map(n=>co(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,s])=>{const r=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[r]=co(s)}),t},Cm=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),ml=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 n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},Om=async(e,t,n,s)=>{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(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";t(new lo(ml(o),i,a,s))}).catch(()=>{const o=i+"";t(new lo(r.statusText||`HTTP ${i} error`,i,o,s))})}else t(new Pu(ml(e),e,s))},$m=(e,t,n,s)=>{const r={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!s)return _e(_e({},r),n);if(Rm(s)){var i;const o=(t==null?void 0:t.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);r.headers=Mr(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),r.body=JSON.stringify(s)}else r.body=s;return t!=null&&t.duplex&&(r.duplex=t.duplex),_e(_e({},r),n)};async function _s(e,t,n,s,r,i,o){return new Promise((a,l)=>{e(n,$m(t,s,r,i)).then(c=>{if(!c.ok)throw c;if(s!=null&&s.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Om(c,l,s,o))})}function Lu(e="storage"){return{get:async(t,n,s,r)=>_s(t,"GET",n,s,r,void 0,e),post:async(t,n,s,r,i)=>_s(t,"POST",n,r,i,s,e),put:async(t,n,s,r,i)=>_s(t,"PUT",n,r,i,s,e),head:async(t,n,s,r)=>_s(t,"HEAD",n,_e(_e({},s),{},{noResolveJson:!0}),r,void 0,e),remove:async(t,n,s,r,i)=>_s(t,"DELETE",n,r,i,s,e)}}const Nm=Lu("storage"),{get:Zs,post:Et,put:uo,head:Im,remove:Fo}=Nm,ht=Lu("vectors");var ps=class{constructor(e,t={},n,s="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Tm(t),this.fetch=Am(n),this.namespace=s}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Mr(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(ci(n))return{data:null,error:n};throw n}}},Pm=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(ci(t))return{data:null,error:t};throw t}}};let Mu;Mu=Symbol.toStringTag;var Lm=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[Mu]="BlobDownloadBuilder",this.promise=null}asStream(){return new Pm(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(ci(t))return{data:null,error:t};throw t}}};const Mm={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var jm=class extends ps{constructor(e,t={},n,s){super(e,t,s,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,s){var r=this;return r.handleOperation(async()=>{let i;const o=_e(_e({},bl),s);let a=_e(_e({},r.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",r.encodeMetadata(l)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",r.encodeMetadata(l))):(i=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=r.toBase64(r.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),s!=null&&s.headers)for(const[h,f]of Object.entries(s.headers))a=Mr(a,h,f);const c=r._removeEmptyFolders(t),u=r._getFinalPath(c),d=await(e=="PUT"?uo:Et)(r.fetch,`${r.url}/object/${u}`,i,_e({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:d.Id,fullPath:d.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,s){var r=this;const i=r._removeEmptyFolders(e),o=r._getFinalPath(i),a=new URL(r.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),r.handleOperation(async()=>{let l;const c=_e(_e({},bl),s);let u=_e(_e({},r.headers),{"x-upsert":String(c.upsert)});const d=c.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),d&&l.append("metadata",r.encodeMetadata(d)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),d&&!l.has("metadata")&&l.append("metadata",r.encodeMetadata(d))):(l=n,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")),s!=null&&s.headers)for(const[h,f]of Object.entries(s.headers))u=Mr(u,h,f);return{path:i,fullPath:(await uo(r.fetch,a.toString(),l,_e({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(e);const r=_e({},n.headers);t!=null&&t.upsert&&(r["x-upsert"]="true");const i=await Et(n.fetch,`${n.url}/object/upload/sign/${s}`,{},{headers:r}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new li("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var s=this;return s.handleOperation(async()=>await Et(s.fetch,`${s.url}/object/move`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:s.headers}))}async copy(e,t,n){var s=this;return s.handleOperation(async()=>({path:(await Et(s.fetch,`${s.url}/object/copy`,{bucketId:s.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:s.headers})).Key}))}async createSignedUrl(e,t,n){var s=this;return s.handleOperation(async()=>{let r=s._getFinalPath(e);const i=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await Et(s.fetch,`${s.url}/object/sign/${r}`,_e({expiresIn:t},i?{transform:n.transform}:{}),{headers:s.headers});const a=new URLSearchParams;n!=null&&n.download&&a.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&a.set("cacheNonce",String(n.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${s.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,n){var s=this;return s.handleOperation(async()=>{const r=await Et(s.fetch,`${s.url}/object/sign/${s.bucketId}`,{expiresIn:t,paths:e},{headers:s.headers}),i=new URLSearchParams;n!=null&&n.download&&i.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return r.map(a=>_e(_e({},a),{},{signedUrl:a.signedURL?encodeURI(`${s.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,n){const s=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(),o=this._getFinalPath(e),a=()=>Zs(this.fetch,`${this.url}/${s}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new Lm(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>co(await Zs(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await Im(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(ci(r)){var s;const i=r instanceof lo?r.status:r instanceof Pu?(s=r.originalError)===null||s===void 0?void 0:s.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:r}}throw r}}getPublicUrl(e,t){const n=this._getFinalPath(e),s=new URLSearchParams;t!=null&&t.download&&s.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const r=s.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/${n}`)+(r?`?${r}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Fo(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var s=this;return s.handleOperation(async()=>{const r=_e(_e(_e({},Mm),t),{},{prefix:e||""});return await Et(s.fetch,`${s.url}/object/list/${s.bucketId}`,r,{headers:s.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const s=_e({},e);return await Et(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,s,{headers:n.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 Dm="2.105.4",ir={"X-Client-Info":`storage-js/${Dm}`};var Um=class extends ps{constructor(e,t={},n,s){const r=new URL(e);s!=null&&s.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(/\/$/,""),o=_e(_e({},ir),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Zs(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Zs(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await Et(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await uo(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await Et(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Fo(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():""}},Bm=class extends ps{constructor(e,t={},n){const s=e.replace(/\/$/,""),r=_e(_e({},ir),t);super(s,r,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Et(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const s=n.toString(),r=s?`${t.url}/bucket?${s}`:`${t.url}/bucket`;return await Zs(t.fetch,r,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Fo(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Cm(e))throw new li("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 n=new xm({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),s=this.shouldThrowOnError;return new Proxy(n,{get(r,i){const o=r[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(r,a),error:null}}catch(l){if(s)throw l;return{data:null,error:l}}}}})}},Hm=class extends ps{constructor(e,t={},n){const s=e.replace(/\/$/,""),r=_e(_e({},ir),{},{"Content-Type":"application/json"},t);super(s,r,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ht.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await ht.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ht.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await ht.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},Fm=class extends ps{constructor(e,t={},n){const s=e.replace(/\/$/,""),r=_e(_e({},ir),{},{"Content-Type":"application/json"},t);super(s,r,n,"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 ht.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ht.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 ht.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ht.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 ht.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Vm=class extends ps{constructor(e,t={},n){const s=e.replace(/\/$/,""),r=_e(_e({},ir),{},{"Content-Type":"application/json"},t);super(s,r,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ht.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ht.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ht.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ht.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},qm=class extends Vm{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Km(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},Km=class extends Hm{constructor(e,t,n,s){super(e,t,s),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new Wm(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Wm=class extends Fm{constructor(e,t,n,s,r){super(e,t,r),this.vectorBucketName=n,this.indexName=s}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,_e(_e({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Gm=class extends Um{constructor(e,t={},n,s){super(e,t,n,s)}from(e){return new jm(this.url,this.headers,e,this.fetch)}get vectors(){return new qm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Bm(this.url+"/iceberg",this.headers,this.fetch)}};const ju="2.105.4",Xn=30*1e3,ho=3,Oi=ho*Xn,zm="http://localhost:9999",Jm="supabase.auth.token",Zm={"X-Client-Info":`gotrue-js/${ju}`},fo="X-Supabase-Api-Version",Du={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Ym=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Xm=10*60*1e3;class Ys extends Error{constructor(t,n,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function ie(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Qm extends Ys{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function eb(e){return ie(e)&&e.name==="AuthApiError"}class St extends Ys{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class ln extends Ys{constructor(t,n,s,r){super(t,s,r),this.name=n,this.status=s}}class Ye extends ln{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function pr(e){return ie(e)&&e.name==="AuthSessionMissingError"}class qn extends ln{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class gr extends ln{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class mr extends ln{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function tb(e){return ie(e)&&e.name==="AuthImplicitGrantRedirectError"}class vl extends ln{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class nb extends ln{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 po extends ln{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function $i(e){return ie(e)&&e.name==="AuthRetryableFetchError"}class yl extends ln{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class go extends ln{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),_l=`
|
|
56
|
-
\r=`.split(""),sb=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<_l.length;t+=1)e[_l[t].charCodeAt(0)]=-2;for(let t=0;t<jr.length;t+=1)e[jr[t].charCodeAt(0)]=t;return e})();function wl(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(jr[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(jr[s]),t.queuedBits-=6}}function Uu(e,t,n){const s=sb[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function xl(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},s={utf8seq:0,codepoint:0},r={queue:0,queuedBits:0},i=o=>{ob(o,s,n)};for(let o=0;o<e.length;o+=1)Uu(e.charCodeAt(o),r,i);return t.join("")}function rb(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 ib(e,t){for(let n=0;n<e.length;n+=1){let s=e.charCodeAt(n);if(s>55295&&s<=56319){const r=(s-55296)*1024&65535;s=(e.charCodeAt(n+1)-56320&65535|r)+65536,n+=1}rb(s,t)}}function ob(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let s=1;s<6;s+=1)if(!(e>>7-s&1)){t.utf8seq=s;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&&n(t.codepoint)}}function is(e){const t=[],n={queue:0,queuedBits:0},s=r=>{t.push(r)};for(let r=0;r<e.length;r+=1)Uu(e.charCodeAt(r),n,s);return new Uint8Array(t)}function ab(e){const t=[];return ib(e,n=>t.push(n)),new Uint8Array(t)}function Pn(e){const t=[],n={queue:0,queuedBits:0},s=r=>{t.push(r)};return e.forEach(r=>wl(r,n,s)),wl(null,n,s),t.join("")}function lb(e){return Math.round(Date.now()/1e3)+e}function cb(){return Symbol("auth-callback")}const Qe=()=>typeof window<"u"&&typeof document<"u",An={tested:!1,writable:!1},Bu=()=>{if(!Qe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(An.tested)return An.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),An.tested=!0,An.writable=!0}catch{An.tested=!0,An.writable=!1}return An.writable};function ub(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((r,i)=>{t[i]=r})}catch{}return n.searchParams.forEach((s,r)=>{t[r]=s}),t}const Hu=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),db=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Qn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},Rn=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},Xe=async(e,t)=>{await e.removeItem(t)};class ui{constructor(){this.promise=new ui.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ui.promiseConstructor=Promise;function br(e){const t=e.split(".");if(t.length!==3)throw new go("Invalid JWT structure");for(let s=0;s<t.length;s++)if(!Ym.test(t[s]))throw new go("JWT not in base64url format");return{header:JSON.parse(xl(t[0])),payload:JSON.parse(xl(t[1])),signature:is(t[2]),raw:{header:t[0],payload:t[1]}}}async function hb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function fb(e,t){return new Promise((s,r)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){s(o);return}}catch(o){if(!t(i,o)){r(o);return}}})()})}function pb(e){return("0"+e.toString(16)).substr(-2)}function gb(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let r="";for(let i=0;i<56;i++)r+=n.charAt(Math.floor(Math.random()*s));return r}return crypto.getRandomValues(t),Array.from(t,pb).join("")}async function mb(e){const n=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",n),r=new Uint8Array(s);return Array.from(r).map(i=>String.fromCharCode(i)).join("")}async function bb(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 n=await mb(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Kn(e,t,n=!1){const s=gb();let r=s;n&&(r+="/recovery"),await Qn(e,`${t}-code-verifier`,r);const i=await bb(s);return[i,s===i?"plain":"s256"]}const vb=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function yb(e){const t=e.headers.get(fo);if(!t||!t.match(vb))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function _b(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 wb(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 xb=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Kt(e){if(!xb.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function xt(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 Ni(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Eb(e,t){return new Proxy(e,{get:(n,s,r)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const i=s.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,s,r)}return!t.value&&typeof s=="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(n,s,r)}})}function El(e){return JSON.parse(JSON.stringify(e))}const On=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)},kb=[502,503,504,520,521,522,523,524,530];async function kl(e){var t;if(!db(e))throw new po(On(e),0);if(kb.includes(e.status))throw new po(On(e),e.status);let n;try{n=await e.json()}catch(i){throw new St(On(i),i)}let s;const r=yb(e);if(r&&r.getTime()>=Du["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new yl(On(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Ye}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new yl(On(n),e.status,n.weak_password.reasons);throw new Qm(On(n),e.status||500,s)}const Sb=(e,t,n,s)=>{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(s),Object.assign(Object.assign({},r),n))};async function de(e,t,n,s){var r;const i=Object.assign({},s==null?void 0:s.headers);i[fo]||(i[fo]=Du["2024-01-01"].name),s!=null&&s.jwt&&(i.Authorization=`Bearer ${s.jwt}`);const o=(r=s==null?void 0:s.query)!==null&&r!==void 0?r:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Tb(e,t,n+a,{headers:i,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(l):{data:Object.assign({},l),error:null}}async function Tb(e,t,n,s,r,i){const o=Sb(t,s,r,i);let a;try{a=await e(n,Object.assign({},o))}catch(l){throw console.error(l),new po(On(l),0)}if(a.ok||await kl(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(l){await kl(l)}}function yt(e){var t;let n=null;Cb(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=lb(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function Sl(e){const t=yt(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((n,s)=>n&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function bn(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Ab(e){return{data:e,error:null}}function Rb(e){const{action_link:t,email_otp:n,hashed_token:s,redirect_to:r,verification_type:i}=e,o=ai(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:s,redirect_to:r,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function Tl(e){return e}function Cb(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Ii=["global","local","others"];class Ob{constructor({url:t="",headers:n={},fetch:s,experimental:r}){this.url=t,this.headers=n,this.fetch=Hu(s),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,n=Ii[0]){if(Ii.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ii.join(", ")}`);try{return await de(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(ie(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,n={}){try{return await de(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:bn})}catch(s){if(ie(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:n}=t,s=ai(t,["options"]),r=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(r.new_email=s==null?void 0:s.newEmail,delete r.newEmail),await de(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:r,headers:this.headers,xform:Rb,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(ie(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await de(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:bn})}catch(n){if(ie(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,s,r,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await de(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:Tl});if(u.error)throw u.error;const d=await u.json(),h=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const b=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(g.split(";")[1].split("=")[1]);c[`${T}Page`]=b}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(ie(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){Kt(t);try{return await de(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:bn})}catch(n){if(ie(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Kt(t);try{return await de(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:bn})}catch(s){if(ie(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){Kt(t);try{return await de(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:bn})}catch(s){if(ie(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){Kt(t.userId);try{const{data:n,error:s}=await de(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:n,error:s}}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Kt(t.userId),Kt(t.id);try{return{data:await de(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,s,r,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await de(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(i=(r=t==null?void 0:t.perPage)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:""},xform:Tl});if(u.error)throw u.error;const d=await u.json(),h=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(g=>{const b=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),T=JSON.parse(g.split(";")[1].split("=")[1]);c[`${T}Page`]=b}),c.total=parseInt(h)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(ie(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await de(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await de(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await de(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ie(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{return await de(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await de(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await de(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:s=>{var r;return{data:{providers:(r=s==null?void 0:s.providers)!==null&&r!==void 0?r:[]},error:null}}})}catch(n){if(ie(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await de(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await de(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await de(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(ie(s))return{data:null,error:s};throw s}}async _deleteCustomProvider(t){try{return await de(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){xt(this.experimental),Kt(t.userId);try{return await de(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ie(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){xt(this.experimental),Kt(t.userId),Kt(t.passkeyId);try{return await de(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ie(n))return{data:null,error:n};throw n}}}function Al(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const It={debug:!!(globalThis&&Bu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Fu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Rl extends Fu{}async function $b(e,t,n){It.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;let r;t>0&&(r=setTimeout(()=>{s.abort(),It.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:s.signal},async i=>{if(i){clearTimeout(r),It.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{It.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw It.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Rl(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(It.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(r),await n()}})}catch(i){if(t>0&&clearTimeout(r),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(s.signal.aborted)return It.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 o=>{if(o){It.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await n()}finally{It.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw It.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new Rl(`Lock "${e}" was released because another request stole it`)}throw i}}function Nb(){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 Vu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function Ib(e){return parseInt(e,16)}function Pb(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function Lb(e){var t;const{chainId:n,domain:s,expirationTime:r,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:d,version:h}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(h!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${h}`);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 f=Vu(e.address),g=u?`${u}://${s}`:s,b=e.statement?`${e.statement}
|
|
58
|
-
`:"",T=`${g} wants you to sign in with your Ethereum account:
|
|
59
|
-
${f}
|
|
60
|
-
|
|
61
|
-
${b}`;let E=`URI: ${d}
|
|
62
|
-
Version: ${h}
|
|
63
|
-
Chain ID: ${n}${o?`
|
|
64
|
-
Nonce: ${o}`:""}
|
|
65
|
-
Issued At: ${i.toISOString()}`;if(r&&(E+=`
|
|
66
|
-
Expiration Time: ${r.toISOString()}`),a&&(E+=`
|
|
67
|
-
Not Before: ${a.toISOString()}`),l&&(E+=`
|
|
68
|
-
Request ID: ${l}`),c){let m=`
|
|
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}`);m+=`
|
|
70
|
-
- ${x}`}E+=m}return`${T}
|
|
71
|
-
${E}`}class Ke extends Error{constructor({message:t,code:n,cause:s,name:r}){var i;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(i=r??(s instanceof Error?s.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Dr extends Ke{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Mb({error:e,options:t}){var n,s,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 Ke({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ke({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Ke({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 Ke({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 Ke({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Ke({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Ke({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Ke({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 o=window.location.hostname;if(qu(o)){if(i.rp.id!==o)return new Ke({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ke({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 Ke({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 Ke({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 Ke({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function jb({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Ke({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Ke({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(qu(s)){if(n.rpId!==s)return new Ke({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Ke({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Ke({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 Ke({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Db{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}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 mo=new Db;function Cl(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:n,excludeCredentials:s}=e,r=ai(e,["challenge","user","excludeCredentials"]),i=is(t).buffer,o=Object.assign(Object.assign({},n),{id:is(n.id).buffer}),a=Object.assign(Object.assign({},r),{challenge:i,user:o});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let l=0;l<s.length;l++){const c=s[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:is(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Ol(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:n}=e,s=ai(e,["challenge","allowCredentials"]),r=is(t).buffer,i=Object.assign(Object.assign({},s),{challenge:r});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:is(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function $l(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Pn(new Uint8Array(e.response.attestationObject)),clientDataJSON:Pn(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Nl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,s=e.getClientExtensionResults(),r=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Pn(new Uint8Array(r.authenticatorData)),clientDataJSON:Pn(new Uint8Array(r.clientDataJSON)),signature:Pn(new Uint8Array(r.signature)),userHandle:r.userHandle?Pn(new Uint8Array(r.userHandle)):void 0},type:"public-key",clientExtensionResults:s,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function qu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ur(){var e,t;return!!(Qe()&&"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 Ku(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Dr("Browser returned unexpected credential type",t)}:{data:null,error:new Dr("Empty credential response",t)}}catch(t){return{data:null,error:Mb({error:t,options:e})}}}async function Wu(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Dr("Browser returned unexpected credential type",t)}:{data:null,error:new Dr("Empty credential response",t)}}catch(t){return{data:null,error:jb({error:t,options:e})}}}const Ub={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Bb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Br(...e){const t=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),n=r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),s={};for(const r of e)if(r)for(const i in r){const o=r[i];if(o!==void 0)if(Array.isArray(o))s[i]=o;else if(n(o))s[i]=o;else if(t(o)){const a=s[i];t(a)?s[i]=Br(a,o):s[i]=Br(o)}else s[i]=o}return s}function Hb(e,t){return Br(Ub,e,t||{})}function Fb(e,t){return Br(Bb,e,t||{})}class Vb{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:n,friendlyName:s,signal:r},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:l};const c=r??mo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const d=s;if(d)u.name=`${u.id}:${d}`;else{const f=(await this.client.getUser()).data.user,g=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${g}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=Hb(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:d,error:h}=await Ku({publicKey:u,signal:c});return d?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}case"request":{const u=Fb(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:d,error:h}=await Wu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return d?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:d}},error:null}:{data:null,error:h}}}}catch(a){return ie(a)?{data:null,error:a}:{data:null,error:new St("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:s}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:s})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!n)return{data:null,error:new Ys("rpId is required for WebAuthn authentication")};try{if(!Ur())return{data:null,error:new St("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:s},signal:r},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:s,credential_response:l.credential_response}})}catch(o){return ie(o)?{data:null,error:o}:{data:null,error:new St("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:r}={}},i){if(!n)return{data:null,error:new Ys("rpId is required for WebAuthn registration")};try{if(!Ur())return{data:null,error:new St("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(h=>h.factor_type==="webauthn"&&h.friendly_name===t&&h.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:r},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:s,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return ie(o)?{data:null,error:o}:{data:null,error:new St("Unexpected error in register",o)}}}}Nb();const qb={url:zm,storageKey:Jm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Zm,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Il(e,t,n){return await n()}const Wn={};class Xs{get jwks(){var t,n;return(n=(t=Wn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Wn[this.storageKey]=Object.assign(Object.assign({},Wn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Wn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Wn[this.storageKey]=Object.assign(Object.assign({},Wn[this.storageKey]),{cachedAt:t})}constructor(t){var n,s,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 o=Object.assign(Object.assign({},qb),t);if(this.storageKey=o.storageKey,this.instanceID=(n=Xs.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Xs.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Qe()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(s=o.experimental)!==null&&s!==void 0?s:{},this.admin=new Ob({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Hu(o.fetch),this.lock=o.lock||Il,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&Qe()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=$b:this.lock=Il,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 Vb(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:Bu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Al(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=Al(this.memoryStorage)),Qe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${ju}) ${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 n={},s="none";if(Qe()&&(n=ub(window.location.href),this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce")),Qe()&&this.detectSessionInUrl&&s!=="none"){const{data:r,error:i}=await this._getSessionFromURL(n,s);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),tb(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:o,redirectType:a}=r;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return ie(n)?this._returnResult({error:n}):this._returnResult({error:new St("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,s,r;try{const i=await de(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}},xform:yt}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(ie(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,s,r;try{let i;if("email"in t){const{email:u,password:d,options:h}=t;let f=null,g=null;this.flowType==="pkce"&&([f,g]=await Kn(this.storage,this.storageKey)),i=await de(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:h==null?void 0:h.emailRedirectTo,body:{email:u,password:d,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:f,code_challenge_method:g},xform:yt})}else if("phone"in t){const{phone:u,password:d,options:h}=t;i=await de(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(s=h==null?void 0:h.data)!==null&&s!==void 0?s:{},channel:(r=h==null?void 0:h.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken}},xform:yt})}else throw new gr("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Xe(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:a}=t;n=await de(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Sl})}else if("phone"in t){const{phone:i,password:o,options:a}=t;n=await de(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Sl})}else throw new gr("You must provide either an email or phone number and a password");const{data:s,error:r}=n;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const i=new qn;return this._returnResult({data:{user:null,session:null},error:i})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(n){if(ie(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,s,r,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.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:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,s,r,i,o,a,l,c,u,d,h;let f,g;if("message"in t)f=t.message,g=t.signature;else{const{chain:b,wallet:T,statement:E,options:m}=t;let x;if(Qe())if(typeof T=="object")x=T;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")x=C.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"||!(m!=null&&m.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=T}const k=new URL((n=m==null?void 0:m.url)!==null&&n!==void 0?n:window.location.href),$=await x.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!$||$.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const D=Vu($[0]);let S=(s=m==null?void 0:m.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!S){const C=await x.request({method:"eth_chainId"});S=Ib(C)}const R={domain:k.host,address:D,statement:E,uri:k.href,version:"1",chainId:S,nonce:(r=m==null?void 0:m.signInWithEthereum)===null||r===void 0?void 0:r.nonce,issuedAt:(o=(i=m==null?void 0:m.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=m==null?void 0:m.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=m==null?void 0:m.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=m==null?void 0:m.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=m==null?void 0:m.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Lb(R),g=await x.request({method:"personal_sign",params:[Pb(f),D]})}try{const{data:b,error:T}=await de(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:g},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(h=t.options)===null||h===void 0?void 0:h.captchaToken}}:null),xform:yt});if(T)throw T;if(!b||!b.session||!b.user){const E=new qn;return this._returnResult({data:{user:null,session:null},error:E})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:T})}catch(b){if(ie(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async signInWithSolana(t){var n,s,r,i,o,a,l,c,u,d,h,f;let g,b;if("message"in t)g=t.message,b=t.signature;else{const{chain:T,wallet:E,statement:m,options:x}=t;let k;if(Qe())if(typeof E=="object")k=E;else{const D=window;if("solana"in D&&typeof D.solana=="object"&&("signIn"in D.solana&&typeof D.solana.signIn=="function"||"signMessage"in D.solana&&typeof D.solana.signMessage=="function"))k=D.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 E!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=E}const $=new URL((n=x==null?void 0:x.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in k&&k.signIn){const D=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},x==null?void 0:x.signInWithSolana),{version:"1",domain:$.host,uri:$.href}),m?{statement:m}:null));let S;if(Array.isArray(D)&&D[0]&&typeof D[0]=="object")S=D[0];else if(D&&typeof D=="object"&&"signedMessage"in D&&"signature"in D)S=D;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in S&&"signature"in S&&(typeof S.signedMessage=="string"||S.signedMessage instanceof Uint8Array)&&S.signature instanceof Uint8Array)g=typeof S.signedMessage=="string"?S.signedMessage:new TextDecoder().decode(S.signedMessage),b=S.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${$.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...m?["",m,""]:[""],"Version: 1",`URI: ${$.href}`,`Issued At: ${(r=(s=x==null?void 0:x.signInWithSolana)===null||s===void 0?void 0:s.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}`]:[],...!((o=x==null?void 0:x.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${x.signInWithSolana.expirationTime}`]:[],...!((a=x==null?void 0:x.signInWithSolana)===null||a===void 0)&&a.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(S=>`- ${S}`)]:[]].join(`
|
|
72
|
-
`);const D=await k.signMessage(new TextEncoder().encode(g),"utf8");if(!D||!(D instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");b=D}}try{const{data:T,error:E}=await de(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:Pn(b)},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:yt});if(E)throw E;if(!T||!T.session||!T.user){const m=new qn;return this._returnResult({data:{user:null,session:null},error:m})}return T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("SIGNED_IN",T.session)),this._returnResult({data:Object.assign({},T),error:E})}catch(T){if(ie(T))return this._returnResult({data:{user:null,session:null},error:T});throw T}}async _exchangeCodeForSession(t){const n=await Rn(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(n??"").split("/");try{if(!s&&this.flowType==="pkce")throw new nb;const{data:i,error:o}=await de(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:yt});if(await Xe(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new qn;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}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:o})}catch(i){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:s,token:r,access_token:i,nonce:o}=t,a=await de(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:yt}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new qn;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(n){if(ie(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,s,r,i,o;try{if("email"in t){const{email:a,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Kn(this.storage,this.storageKey));const{error:d}=await de(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!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:a,options:l}=t,{data:c,error:u}=await de(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,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:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new gr("You must provide either an email or phone number.")}catch(a){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(t){var n,s;try{let r,i;"options"in t&&(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:a}=await de(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:yt});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(r){if(ie(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithSSO(t){var n,s,r,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Kn(this.storage,this.storageKey));const c=await de(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:(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s: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:a,code_challenge_method:l}),headers:this.headers,xform:Ab});return!((i=c.data)===null||i===void 0)&&i.url&&Qe()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;if(s)throw s;if(!n)throw new Ye;const{error:r}=await de(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(t){if(ie(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:s,type:r,options:i}=t,{error:o}=await de(this.fetch,"POST",n,{headers:this.headers,body:{email:s,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:o})}else if("phone"in t){const{phone:s,type:r,options:i}=t,{data:o,error:a}=await de(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new gr("You must provide either an email or phone number and a type")}catch(n){if(ie(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await s,await n()))();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 s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}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 n=await Rn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()<Oi:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",t.expires_at),!s){if(this.userStorage){const o=await Rn(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=Ni()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=Eb(t.user,o),o.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 n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await de(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:bn}):await this._useSession(async n=>{var s,r,i;const{data:o,error:a}=n;if(a)throw a;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Ye}:await de(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0,xform:bn})})}catch(n){if(ie(n))return pr(n)&&(await this._removeSession(),await Xe(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new Ye;const o=r.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await Kn(this.storage,this.storageKey));const{data:c,error:u}=await de(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:bn});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(s){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(s))return this._returnResult({data:{user:null},error:s});throw s}}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 Ye;const n=Date.now()/1e3;let s=n,r=!0,i=null;const{payload:o}=br(t.access_token);if(o.exp&&(s=o.exp,r=s<=n),r){const{data:a,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(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:a.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(ie(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}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 n=>{var s;if(!t){const{data:o,error:a}=n;if(a)throw a;t=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new Ye;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(n){if(ie(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var s;try{if(!Qe())throw new mr("No browser detected.");if(t.error||t.error_description||t.error_code)throw new mr(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new vl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new mr("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new vl("No code detected.");const{data:x,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const $=new URL(window.location.href);return $.searchParams.delete("code"),window.history.replaceState(window.history.state,"",$.toString()),{data:{session:x.session,redirectType:(s=x.redirectType)!==null&&s!==void 0?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=t;if(!o||!l||!a||!u)throw new mr("No session defined in URL");const d=Math.round(Date.now()/1e3),h=parseInt(l);let f=d+h;c&&(f=parseInt(c));const g=f-d;g*1e3<=Xn&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${g}s, should have been closer to ${h}s`);const b=f-h;d-b>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",b,f,d):d-b<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",b,f,d);const{data:T,error:E}=await this._getUser(o);if(E)throw E;const m={provider_token:r,provider_refresh_token:i,access_token:o,expires_in:h,expires_at:f,refresh_token:a,token_type:u,user:T.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:m,redirectType:t.type},error:null})}catch(r){if(ie(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 n=await Rn(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}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 n=>{var s;const{data:r,error:i}=n;if(i&&!pr(i))return this._returnResult({error:i});const o=(s=r.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:a}=await this.admin.signOut(o,t);if(a&&!(eb(a)&&(a.status===404||a.status===401||a.status===403)||pr(a)))return this._returnResult({error:a})}return t!=="others"&&(await this._removeSession(),await Xe(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=cb(),s={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,s),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async n=>{var s,r;try{const{data:{session:i},error:o}=n;if(o)throw o;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.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),pr(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,n={}){let s=null,r=null;this.flowType==="pkce"&&([s,r]=await Kn(this.storage,this.storageKey,!0));try{return await de(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:s,error:r}=await this._useSession(async i=>{var o,a,l,c,u;const{data:d,error:h}=i;if(h)throw h;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await de(this.fetch,"GET",f,{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 Qe()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),this._returnResult({data:{provider:t.provider,url:s==null?void 0:s.url},error:null})}catch(s){if(ie(s))return this._returnResult({data:{provider:t.provider,url:null},error:s});throw s}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var s;try{const{error:r,data:{session:i}}=n;if(r)throw r;const{options:o,provider:a,token:l,access_token:c,nonce:u}=t,d=await de(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=i==null?void 0:i.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:yt}),{data:h,error:f}=d;return f?this._returnResult({data:{user:null,session:null},error:f}):!h||!h.session||!h.user?this._returnResult({data:{user:null,session:null},error:new qn}):(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("USER_UPDATED",h.session)),this._returnResult({data:h,error:f}))}catch(r){if(await Xe(this.storage,`${this.storageKey}-code-verifier`),ie(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var s,r;const{data:i,error:o}=n;if(o)throw o;return await de(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(r=(s=i.session)===null||s===void 0?void 0:s.access_token)!==null&&r!==void 0?r:void 0})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await fb(async r=>(r>0&&await hb(200*Math.pow(2,r-1)),this._debug(n,"refreshing attempt",r),await de(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:yt})),(r,i)=>{const o=200*Math.pow(2,r);return i&&$i(i)&&Date.now()+o-s<Xn})}catch(s){if(this._debug(n,"error",s),ie(s))return this._returnResult({data:{session:null,user:null},error:s});throw s}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const s=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",s),Qe()&&!n.skipBrowserRedirect&&window.location.assign(s),{data:{provider:t,url:s},error:null}}async _recoverAndRefresh(){var t,n;const s="#_recoverAndRefresh()";this._debug(s,"begin");try{const r=await Rn(this.storage,this.storageKey);if(r&&this.userStorage){let o=await Rn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:r.user},await Qn(this.userStorage,this.storageKey+"-user",o)),r.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:Ni()}else if(r&&!r.user&&!r.user){const o=await Rn(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(r.user=o.user,await Xe(this.storage,this.storageKey+"-user"),await Qn(this.storage,this.storageKey,r)):r.user=Ni()}if(this._debug(s,"session from storage",r),!this._isValidSession(r)){this._debug(s,"session is not valid"),r!==null&&await this._removeSession();return}const i=((n=r.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Oi;if(this._debug(s,`session has${i?"":" not"} expired with margin of ${Oi}s`),i){if(this.autoRefreshToken&&r.refresh_token){const{error:o}=await this._callRefreshToken(r.refresh_token);o&&(console.error(o),$i(o)||(this._debug(s,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(r.user&&r.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(r.access_token);!a&&(o!=null&&o.user)?(r.user=o.user,await this._saveSession(r),await this._notifyAllSubscribers("SIGNED_IN",r)):this._debug(s,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(s,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",r)}catch(r){this._debug(s,"error",r),console.error(r);return}finally{this._debug(s,"end")}}async _callRefreshToken(t){var n,s;if(!t)throw new Ye;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const r=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{this.refreshingDeferred=new ui;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new Ye;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(r,"error",i),ie(i)){const o={data:null,error:i};return $i(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(s=this.refreshingDeferred)===null||s===void 0||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,"end")}}async _notifyAllSubscribers(t,n,s=!0){const r=`#_notifyAllSubscribers(${t})`;this._debug(r,"begin",n,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(r,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Xe(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),s=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!s&&n.user&&await Qn(this.userStorage,this.storageKey+"-user",{user:n.user});const r=Object.assign({},n);delete r.user;const i=El(r);await Qn(this.storage,this.storageKey,i)}else{const r=El(n);await Qn(this.storage,this.storageKey,r)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Xe(this.storage,this.storageKey),await Xe(this.storage,this.storageKey+"-code-verifier"),await Xe(this.storage,this.storageKey+"-user"),this.userStorage&&await Xe(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Qe()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Xn);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}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 n=>{const{data:{session:s}}=n;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((s.expires_at*1e3-t)/Xn);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${Xn}ms, refresh threshold is ${ho} ticks`),r<=ho&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Fu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Qe()||!(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 n=`#_onVisibilityChanged(${t})`;this._debug(n,"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(n,"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,n,s){const r=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[i,o]=await Kn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});r.push(a.toString())}if(s!=null&&s.queryParams){const i=new URLSearchParams(s.queryParams);r.push(i.toString())}return s!=null&&s.skipBrowserRedirect&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${r.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var s;const{data:r,error:i}=n;return i?this._returnResult({data:null,error:i}):await de(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=r==null?void 0:r.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var s,r;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=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 de(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.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(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var s;const{data:r,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=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):Nl(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await de(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(s=r==null?void 0:r.session)===null||s===void 0?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var s;const{data:r,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await de(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=r==null?void 0:r.session)===null||s===void 0?void 0:s.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Cl(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Ol(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:s}=await this._challenge({factorId:t.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n==null?void 0:n.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 n,s,r,i;if(t)try{const{payload:f}=br(t);let g=null;f.aal&&(g=f.aal);let b=g;const{data:{user:T},error:E}=await this.getUser(t);if(E)return this._returnResult({data:null,error:E});((s=(n=T==null?void 0:T.factors)===null||n===void 0?void 0:n.filter(k=>k.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(b="aal2");const x=f.amr||[];return{data:{currentLevel:g,nextLevel:b,currentAuthenticationMethods:x},error:null}}catch(f){if(ie(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=br(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(r=o.user.factors)===null||r===void 0?void 0:r.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const h=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:h},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:s},error:r}=n;return r?this._returnResult({data:null,error:r}):s?await de(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Ye})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Ye});const o=await de(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Qe()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(ie(s))return this._returnResult({data:null,error:s});throw s}}async _denyAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new Ye});const o=await de(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Qe()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(s){if(ie(s))return this._returnResult({data:null,error:s});throw s}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;return s?this._returnResult({data:null,error:s}):n?await de(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:r=>({data:r,error:null})}):this._returnResult({data:null,error:new Ye})})}catch(t){if(ie(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:s},error:r}=n;return r?this._returnResult({data:null,error:r}):s?(await de(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Ye})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let s=n.keys.find(a=>a.kid===t);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(a=>a.kid===t),s&&this.jwks_cached_at+Xm>r)return s;const{data:i,error:o}=await de(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(a=>a.kid===t),!s)?null:s}async getClaims(t,n={}){try{let s=t;if(!s){const{data:f,error:g}=await this.getSession();if(g||!f.session)return this._returnResult({data:null,error:g});s=f.session.access_token}const{header:r,payload:i,signature:o,raw:{header:a,payload:l}}=br(s);n!=null&&n.allowExpired||_b(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,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:f}=await this.getUser(s);if(f)throw f;return{data:{claims:i,header:r,signature:o},error:null}}const u=wb(r.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,o,ab(`${a}.${l}`)))throw new go("Invalid JWT signature");return{data:{claims:i,header:r,signature:o},error:null}}catch(s){if(ie(s))return this._returnResult({data:null,error:s});throw s}}async signInWithPasskey(t){var n,s,r;xt(this.experimental);try{if(!Ur())return this._returnResult({data:null,error:new St("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=Ol(i.options),l=(r=(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.signal)!==null&&r!==void 0?r:mo.createNewAbortSignal(),{data:c,error:u}=await Wu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new St("WebAuthn ceremony failed",null)});const d=Nl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:d})}catch(i){if(ie(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var n,s;xt(this.experimental);try{if(!Ur())return this._returnResult({data:null,error:new St("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 o=Cl(r.options),a=(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:mo.createNewAbortSignal(),{data:l,error:c}=await Ku({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new St("WebAuthn ceremony failed",null)});const u=$l(l);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(r){if(ie(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyRegistration(){xt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ye});const{data:r,error:i}=await de(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(ie(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){xt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:s},error:r}=n;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Ye});const{data:i,error:o}=await de(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;xt(this.experimental);try{const{data:s,error:r}=await de(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(s){if(ie(s))return this._returnResult({data:null,error:s});throw s}}async _verifyPasskeyAuthentication(t){xt(this.experimental);try{const{data:n,error:s}=await de(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:yt});return s?this._returnResult({data:null,error:s}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){xt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Ye});const{data:r,error:i}=await de(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(t){if(ie(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){xt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:s},error:r}=n;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Ye});const{data:i,error:o}=await de(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){xt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:s},error:r}=n;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new Ye});const{error:i}=await de(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(ie(n))return this._returnResult({data:null,error:n});throw n}}}Xs.nextInstanceID={};const Kb=Xs,Wb="2.105.4";let Ss="";typeof Deno<"u"?Ss="deno":typeof document<"u"?Ss="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ss="react-native":Ss="node";const Gb={"X-Client-Info":`supabase-js-${Ss}/${Wb}`},zb={headers:Gb},Jb={schema:"public"},Zb={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Yb={};function Qs(e){"@babel/helpers - typeof";return Qs=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},Qs(e)}function Xb(e,t){if(Qs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Qs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qb(e){var t=Xb(e,"string");return Qs(t)=="symbol"?t:t+""}function ev(e,t,n){return(t=Qb(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pl(Object(n),!0).forEach(function(s){ev(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}const tv=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),nv=()=>Headers,sv=(e,t,n)=>{const s=tv(n),r=nv();return async(i,o)=>{var a;const l=(a=await t())!==null&&a!==void 0?a:e;let c=new r(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),s(i,He(He({},o),{},{headers:c}))}};function rv(e){return e.endsWith("/")?e:e+"/"}function iv(e,t){var n,s;const{db:r,auth:i,realtime:o,global:a}=e,{db:l,auth:c,realtime:u,global:d}=t,h={db:He(He({},l),r),auth:He(He({},c),i),realtime:He(He({},u),o),storage:{},global:He(He(He({},d),a),{},{headers:He(He({},(n=d==null?void 0:d.headers)!==null&&n!==void 0?n:{}),(s=a==null?void 0:a.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return e.accessToken?h.accessToken=e.accessToken:delete h.accessToken,h}function ov(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(rv(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var av=class extends Kb{constructor(e){super(e)}},lv=class{constructor(e,t,n){var s,r;this.supabaseUrl=e,this.supabaseKey=t;const i=ov(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 o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Jb,realtime:Yb,auth:He(He({},Zb),{},{storageKey:o}),global:zb},l=iv(n??{},a);if(this.storageKey=(s=l.auth.storageKey)!==null&&s!==void 0?s:"",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=sv(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(He({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 Pg(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 Gm(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new kg(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={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}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,n;if(e.accessToken)return await e.accessToken();const{data:s}=await e.auth.getSession();return(t=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:s,userStorage:r,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:d,skipAutoInitialize:h},f,g){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new av({url:this.authUrl.href,headers:He(He({},b),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:s,userStorage:r,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:g,lockAcquireTimeout:d,skipAutoInitialize:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(T=>T.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new mm(this.realtimeUrl.href,He(He({},e),{},{params:He(He({},{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,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const cv=(e,t,n)=>new lv(e,t,n);function uv(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}uv()&&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 vr=null,yr=null;async function Gu(){if(yr)return yr;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);return yr=await e.json(),yr}catch{return{authEnabled:!1,supabaseUrl:null,supabaseAnonKey:null}}}async function es(){if(vr)return vr;const e=await Gu();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(vr=cv(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),vr)}const Dn=fu("auth",()=>{const e=B(null),t=B(null),n=B(!1),s=B(!1),r=B(!1);let i=null;async function o(){const d=await Gu();if(r.value=d.authEnabled,!d.authEnabled){s.value=!0;return}const h=await es();if(!h){s.value=!0;return}await new Promise(f=>{h.auth.onAuthStateChange((g,b)=>{b?(t.value=b,e.value=b.user??null):g==="SIGNED_OUT"&&(t.value=null,e.value=null),g==="INITIAL_SESSION"&&f()})}),s.value=!0}async function a(){if(!s.value)return i||(i=o().catch(()=>{i=null})),i}async function l(d,h){const f=await es();if(!f)return"Auth not configured";n.value=!0;try{const{error:g}=await f.auth.signInWithPassword({email:d,password:h});return g?g.message:null}finally{n.value=!1}}async function c(){const d=await es();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 h=await es();if(h){const{data:f}=await h.auth.refreshSession();if(f.session)return f.session.access_token}}catch{}return d.access_token}if(r.value)try{const h=await es();if(h){const{data:f}=await h.auth.refreshSession();if(f.session)return f.session.access_token}}catch{}return null}return{user:e,session:t,loading:n,initialized:s,authEnabled:r,init:a,signIn:l,signOut:c,getAccessToken:u}});async function xe(e,t){const n=Dn(),s=await n.getAccessToken(),r=new Headers(t==null?void 0:t.headers);s&&r.set("Authorization",`Bearer ${s}`);const i=await fetch(e,{...t,headers:r});if(i.status===401&&n.authEnabled){const o=await es();if(o){const{data:a,error:l}=await o.auth.refreshSession();if(a.session){const c=new Headers(t==null?void 0:t.headers);return c.set("Authorization",`Bearer ${a.session.access_token}`),fetch(e,{...t,headers:c})}l||await n.signOut()}}return i}async function di(e){const n=await Dn().getAccessToken();if(!n)return e;const s=e.includes("?")?"&":"?";return`${e}${s}token=${encodeURIComponent(n)}`}const dv={class:"shrink-0 h-11 bg-bg-surface border-b border-border flex items-center justify-between px-4"},hv={class:"flex items-center gap-0 min-w-0"},fv={key:0,class:"absolute -top-1 -right-1 min-w-[16px] h-4 flex items-center justify-center rounded-full bg-accent-red text-text text-[9px] font-bold leading-none px-1"},pv=Ge({__name:"AppHeader",emits:["toggle-sidebar"],setup(e){const t=Dn(),n=B(0);function s(){n.value=0}return nt(async()=>{if(await t.init(),!(t.authEnabled&&!t.user))try{const r=await xe("/api/feed/count");if(r.ok){const i=await r.json();n.value=i.count??0}}catch{}}),(r,i)=>{const o=Mc("router-link");return y(),w("header",dv,[p("div",hv,[p("button",{class:"md:hidden w-7 h-7 flex items-center justify-center rounded text-text-muted hover:text-text mr-2",onClick:i[0]||(i[0]=a=>r.$emit("toggle-sidebar"))},[...i[1]||(i[1]=[p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M2 4.75A.75.75 0 0 1 2.75 4h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 4.75Zm0 5A.75.75 0 0 1 2.75 9h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 9.75Zm0 5a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z","clip-rule":"evenodd"})],-1)])]),i[2]||(i[2]=p("span",{class:"text-accent-cyan font-mono font-bold text-lg tracking-tight select-none"},"IO",-1)),i[3]||(i[3]=p("div",{class:"w-px h-3.5 bg-border mx-3"},null,-1)),i[4]||(i[4]=p("span",{class:"text-text-muted text-xs tracking-wide hidden sm:block truncate"},"Mission Control · Developer AI Assistant",-1))]),Me(o,{to:"/feed",class:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-text-muted hover:text-text hover:bg-bg-elevated transition-colors",onClick:s},{default:yn(()=>[i[5]||(i[5]=p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{d:"M10 2a5.92 5.92 0 0 1 5.98 5.36l.02.22V11.4l.92 2.22a1 1 0 0 1-.75.97l-.11.02L16 15h-3.5v.17a2.5 2.5 0 0 1-5 0V15H4a1 1 0 0 1-.86-1.5l.92-2.1V7.57A5.9 5.9 0 0 1 10 2Z"})],-1)),i[6]||(i[6]=p("span",{class:"text-xs"},"Feed",-1)),n.value>0?(y(),w("span",fv,U(n.value>99?"99+":n.value),1)):Q("",!0)]),_:1})])}}}),gv={class:"relative w-48 h-full bg-bg-surface border-r border-border flex flex-col py-2 overflow-y-auto"},mv=["innerHTML"],bv={key:0,class:"ml-auto w-2 h-2 rounded-full bg-accent-red"},vv={class:"hidden md:flex shrink-0 w-[39px] flex-col items-center py-2 gap-0.5 bg-bg-surface border-r border-border relative"},yv={key:0,class:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-[23px] bg-accent-cyan rounded-r"},_v=["innerHTML"],wv={key:1,class:"absolute top-1.5 right-1.5 w-2 h-2 rounded-full bg-accent-red"},xv=Ge({__name:"AppSidebar",props:{visible:{type:Boolean}},emits:["navigate"],setup(e){const t=Bo(),n=Dn(),s=B(0),r=[{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 3Z"/>',label:"Chat"},{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:"/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:"/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:"/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.5Z"/>',label:"Skills"},{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:"/mcp",name:"mcp",icon:'<path d="M13.5 5a1.5 1.5 0 1 1 0 3h-1v1.5a.5.5 0 0 1-1 0V8h-3v1.5a.5.5 0 0 1-1 0V8h-1a1.5 1.5 0 1 1 0-3h1V3.5a.5.5 0 0 1 1 0V5h3V3.5a.5.5 0 0 1 1 0V5h1Zm0 1h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1ZM4 12.5A2.5 2.5 0 0 1 6.5 10h7a2.5 2.5 0 0 1 2.5 2.5v2a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 4 14.5v-2Zm2.5-1.5A1.5 1.5 0 0 0 5 12.5v2A1.5 1.5 0 0 0 6.5 16h7a1.5 1.5 0 0 0 1.5-1.5v-2a1.5 1.5 0 0 0-1.5-1.5h-7Z"/>',label:"MCP"},{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"}];function i(o){return t.name===o}return nt(async()=>{if(await n.init(),!(n.authEnabled&&!n.user))try{const o=await xe("/api/inbox/count");if(o.ok){const a=await o.json();s.value=a.count??0}}catch{}}),(o,a)=>{const l=Mc("router-link");return y(),w(be,null,[(y(),rn(Co,{to:"body"},[e.visible?(y(),w("div",{key:0,class:"fixed inset-0 z-50 md:hidden flex",onClick:a[2]||(a[2]=en(c=>o.$emit("navigate"),["self"]))},[p("div",{class:"absolute inset-0 bg-black/60",onClick:a[0]||(a[0]=c=>o.$emit("navigate"))}),p("nav",gv,[(y(),w(be,null,Ne(r,c=>Me(l,{key:c.to,to:c.to,onClick:a[1]||(a[1]=u=>o.$emit("navigate")),class:Te(["flex items-center gap-3 px-4 py-2.5 text-xs transition-colors",i(c.name)?"text-accent-cyan bg-bg-elevated":"text-text-muted hover:text-text hover:bg-bg-elevated"])},{default:yn(()=>[(y(),w("svg",{class:"w-4 h-4 shrink-0",viewBox:"0 0 20 20",fill:"currentColor",innerHTML:c.icon},null,8,mv)),on(" "+U(c.label)+" ",1),c.name==="inbox"&&s.value>0?(y(),w("span",bv)):Q("",!0)]),_:2},1032,["to","class"])),64))])])):Q("",!0)])),p("aside",vv,[(y(),w(be,null,Ne(r,c=>Me(l,{key:c.to,to:c.to,title:c.label,class:Te(["relative flex items-center justify-center w-[39px] h-[39px] transition-colors",i(c.name)?"text-accent-cyan":"text-text-muted hover:text-text hover:bg-bg-elevated"])},{default:yn(()=>[i(c.name)?(y(),w("span",yv)):Q("",!0),(y(),w("svg",{class:"w-[18px] h-[18px]",viewBox:"0 0 20 20",fill:"currentColor",innerHTML:c.icon},null,8,_v)),c.name==="inbox"&&s.value>0?(y(),w("span",wv)):Q("",!0)]),_:2},1032,["to","title","class"])),64))])],64)}}}),Ev={class:"shrink-0 h-[30px] bg-bg-surface border-t border-border flex items-center justify-between px-4 gap-4"},kv={class:"flex items-center gap-2 text-[11px] min-w-0"},Sv={class:"text-text-muted"},Tv={class:"text-accent-purple"},Av={class:"text-text-muted truncate"},Rv={class:"text-[11px] text-text-muted flex items-center gap-1.5 shrink-0"},Cv=Ge({__name:"AppStatusBar",setup(e){const t=Dn(),n=B(0),s=B(0),r=B(""),i=B("just now");let o=Date.now(),a=null;function l(){const u=Math.floor((Date.now()-o)/1e3);u<10?i.value="just now":u<60?i.value=`${u}s ago`:i.value=`${Math.floor(u/60)}m ago`}async function c(){try{const u=await xe("/api/squads");if(u.ok){const h=(await u.json()).squads??[];n.value=h.length,s.value=h.reduce((b,T)=>b+(T.agents_count??0),0);const f=h.reduce((b,T)=>b+(T.instances_active??0),0),g=h.reduce((b,T)=>b+(T.instances_total??0),0);g>0?r.value=`${f}/${g} instances active`:r.value=""}}catch{}o=Date.now(),l()}return nt(async()=>{await t.init(),!(t.authEnabled&&!t.user)&&(c(),a=setInterval(l,1e4))}),fs(()=>{a&&clearInterval(a)}),(u,d)=>(y(),w("div",Ev,[p("div",kv,[d[1]||(d[1]=p("span",{class:"w-1.5 h-1.5 rounded-full bg-accent-green"},null,-1)),d[2]||(d[2]=p("span",{class:"text-text-muted"},"Connected",-1)),d[3]||(d[3]=p("span",{class:"text-border-bright"},"·",-1)),p("span",Sv,U(n.value)+" squad"+U(n.value!==1?"s":""),1),d[4]||(d[4]=p("span",{class:"text-border-bright"},"·",-1)),p("span",Tv,U(s.value)+" agent"+U(s.value!==1?"s":""),1),r.value?(y(),w(be,{key:0},[d[0]||(d[0]=p("span",{class:"text-border-bright"},"·",-1)),p("span",Av,U(r.value),1)],64)):Q("",!0)]),p("div",Rv,[d[5]||(d[5]=p("svg",{class:"w-3 h-3",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z","clip-rule":"evenodd"})],-1)),on(" Last sync: "+U(i.value),1)])]))}}),Ov={key:0,class:"fixed bottom-10 left-1/2 -translate-x-1/2 z-40 w-[360px]"},$v={class:"text-[10px] font-mono bg-bg-elevated border border-border rounded px-1.5 py-0.5 text-text-muted"},Nv=Ge({__name:"CommandBar",props:{chatOpen:{type:Boolean}},emits:["open"],setup(e,{emit:t}){const n=e,s=t,r=B(!1);function i(){s("open")}function o(a){(a.metaKey||a.ctrlKey)&&a.key==="k"&&(a.preventDefault(),n.chatOpen||i())}return nt(()=>{r.value=navigator.platform.toUpperCase().includes("MAC"),document.addEventListener("keydown",o)}),fs(()=>{document.removeEventListener("keydown",o)}),(a,l)=>(y(),rn(jo,{name:"cmdbar"},{default:yn(()=>[n.chatOpen?Q("",!0):(y(),w("div",Ov,[p("button",{onClick:i,class:"w-full flex items-center gap-2.5 bg-bg-surface border border-border rounded-full px-4 py-2 text-text-muted hover:border-border-bright hover:text-text transition-colors cursor-text group"},[l[0]||(l[0]=p("svg",{class:"w-3.5 h-3.5 shrink-0 text-text-muted group-hover:text-accent-cyan transition-colors",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M9 3.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Z","clip-rule":"evenodd"})],-1)),l[1]||(l[1]=p("span",{class:"flex-1 text-left text-sm"},"Command IO...",-1)),p("kbd",$v,U(r.value?"⌘K":"Ctrl K"),1)])]))]),_:1}))}}),hi=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Iv=hi(Nv,[["__scopeId","data-v-fb5b9e31"]]),zu=fu("chat",()=>{const e=B([]),t=B(!1);function n(i){e.value.push(i)}function s(i){const o=e.value[e.value.length-1];o&&o.role==="assistant"&&(o.content+=i)}function r(i){const o=e.value[e.value.length-1];o&&o.role==="assistant"&&(o.streaming=i)}return{messages:e,isLoading:t,addMessage:n,appendToLast:s,setLastStreaming:r}});function Pv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ju(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 n=e[t],s=typeof n;(s==="object"||s==="function")&&!Object.isFrozen(n)&&Ju(n)}),e}class Ll{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Zu(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function vn(e,...t){const n=Object.create(null);for(const s in e)n[s]=e[s];return t.forEach(function(s){for(const r in s)n[r]=s[r]}),n}const Lv="</span>",Ml=e=>!!e.scope,Mv=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((s,r)=>`${s}${"_".repeat(r+1)}`)].join(" ")}return`${t}${e}`};class jv{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Zu(t)}openNode(t){if(!Ml(t))return;const n=Mv(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Ml(t)&&(this.buffer+=Lv)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const jl=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class Vo{constructor(){this.rootNode=jl(),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 n=jl({scope:t});this.add(n),this.stack.push(n)}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,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(s=>this._walk(t,s)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{Vo._collapse(n)}))}}class Dv extends Vo{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const s=t.root;n&&(s.scope=`language:${n}`),this.add(s)}toHTML(){return new jv(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function er(e){return e?typeof e=="string"?e:e.source:null}function Yu(e){return Un("(?=",e,")")}function Uv(e){return Un("(?:",e,")*")}function Bv(e){return Un("(?:",e,")?")}function Un(...e){return e.map(n=>er(n)).join("")}function Hv(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function qo(...e){return"("+(Hv(e).capture?"":"?:")+e.map(s=>er(s)).join("|")+")"}function Xu(e){return new RegExp(e.toString()+"|").exec("").length-1}function Fv(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Vv=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Ko(e,{joinWith:t}){let n=0;return e.map(s=>{n+=1;const r=n;let i=er(s),o="";for(;i.length>0;){const a=Vv.exec(i);if(!a){o+=i;break}o+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+r):(o+=a[0],a[0]==="("&&n++)}return o}).map(s=>`(${s})`).join(t)}const qv=/\b\B/,Qu="[a-zA-Z]\\w*",Wo="[a-zA-Z_]\\w*",ed="\\b\\d+(\\.\\d+)?",td="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",nd="\\b(0b[01]+)",Kv="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Wv=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Un(t,/.*\b/,e.binary,/\b.*/)),vn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,s)=>{n.index!==0&&s.ignoreMatch()}},e)},tr={begin:"\\\\[\\s\\S]",relevance:0},Gv={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[tr]},zv={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[tr]},Jv={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/},fi=function(e,t,n={}){const s=vn({scope:"comment",begin:e,end:t,contains:[]},n);s.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=qo("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 s.contains.push({begin:Un(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),s},Zv=fi("//","$"),Yv=fi("/\\*","\\*/"),Xv=fi("#","$"),Qv={scope:"number",begin:ed,relevance:0},ey={scope:"number",begin:td,relevance:0},ty={scope:"number",begin:nd,relevance:0},ny={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[tr,{begin:/\[/,end:/\]/,relevance:0,contains:[tr]}]},sy={scope:"title",begin:Qu,relevance:0},ry={scope:"title",begin:Wo,relevance:0},iy={begin:"\\.\\s*"+Wo,relevance:0},oy=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var _r=Object.freeze({__proto__:null,APOS_STRING_MODE:Gv,BACKSLASH_ESCAPE:tr,BINARY_NUMBER_MODE:ty,BINARY_NUMBER_RE:nd,COMMENT:fi,C_BLOCK_COMMENT_MODE:Yv,C_LINE_COMMENT_MODE:Zv,C_NUMBER_MODE:ey,C_NUMBER_RE:td,END_SAME_AS_BEGIN:oy,HASH_COMMENT_MODE:Xv,IDENT_RE:Qu,MATCH_NOTHING_RE:qv,METHOD_GUARD:iy,NUMBER_MODE:Qv,NUMBER_RE:ed,PHRASAL_WORDS_MODE:Jv,QUOTE_STRING_MODE:zv,REGEXP_MODE:ny,RE_STARTERS_RE:Kv,SHEBANG:Wv,TITLE_MODE:sy,UNDERSCORE_IDENT_RE:Wo,UNDERSCORE_TITLE_MODE:ry});function ay(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function ly(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function cy(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=ay,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function uy(e,t){Array.isArray(e.illegal)&&(e.illegal=qo(...e.illegal))}function dy(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 hy(e,t){e.relevance===void 0&&(e.relevance=1)}const fy=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(s=>{delete e[s]}),e.keywords=n.keywords,e.begin=Un(n.beforeMatch,Yu(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},py=["of","and","for","in","not","or","if","then","parent","list","value"],gy="keyword";function sd(e,t,n=gy){const s=Object.create(null);return typeof e=="string"?r(n,e.split(" ")):Array.isArray(e)?r(n,e):Object.keys(e).forEach(function(i){Object.assign(s,sd(e[i],t,i))}),s;function r(i,o){t&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");s[l[0]]=[i,my(l[0],l[1])]})}}function my(e,t){return t?Number(t):by(e)?0:1}function by(e){return py.includes(e.toLowerCase())}const Dl={},jn=e=>{console.error(e)},Ul=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Gn=(e,t)=>{Dl[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Dl[`${e}/${t}`]=!0)},Hr=new Error;function rd(e,t,{key:n}){let s=0;const r=e[n],i={},o={};for(let a=1;a<=t.length;a++)o[a+s]=r[a],i[a+s]=!0,s+=Xu(t[a-1]);e[n]=o,e[n]._emit=i,e[n]._multi=!0}function vy(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw jn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Hr;if(typeof e.beginScope!="object"||e.beginScope===null)throw jn("beginScope must be object"),Hr;rd(e,e.begin,{key:"beginScope"}),e.begin=Ko(e.begin,{joinWith:""})}}function yy(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw jn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Hr;if(typeof e.endScope!="object"||e.endScope===null)throw jn("endScope must be object"),Hr;rd(e,e.end,{key:"endScope"}),e.end=Ko(e.end,{joinWith:""})}}function _y(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function wy(e){_y(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),vy(e),yy(e)}function xy(e){function t(o,a){return new RegExp(er(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Xu(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=t(Ko(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((d,h)=>h>0&&d!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class s{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function r(o){const a=new s;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function i(o,a){const l=o;if(o.isCompiled)return l;[ly,dy,wy,fy].forEach(u=>u(o,a)),e.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[cy,uy,hy].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=sd(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=er(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return Ey(u==="self"?o:u)})),o.contains.forEach(function(u){i(u,l)}),o.starts&&i(o.starts,a),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=vn(e.classNameAliases||{}),i(e)}function id(e){return e?e.endsWithParent||id(e.starts):!1}function Ey(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return vn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:id(e)?vn(e,{starts:e.starts?vn(e.starts):null}):Object.isFrozen(e)?vn(e):e}var ky="11.11.1";class Sy extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Pi=Zu,Bl=vn,Hl=Symbol("nomatch"),Ty=7,od=function(e){const t=Object.create(null),n=Object.create(null),s=[];let r=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Dv};function l(A){return a.noHighlightRe.test(A)}function c(A){let j=A.className+" ";j+=A.parentNode?A.parentNode.className:"";const q=a.languageDetectRe.exec(j);if(q){const ae=R(q[1]);return ae||(Ul(i.replace("{}",q[1])),Ul("Falling back to no-highlight mode for this block.",A)),ae?q[1]:"no-highlight"}return j.split(/\s+/).find(ae=>l(ae)||R(ae))}function u(A,j,q){let ae="",pe="";typeof j=="object"?(ae=A,q=j.ignoreIllegals,pe=j.language):(Gn("10.7.0","highlight(lang, code, ...args) has been deprecated."),Gn("10.7.0",`Please use highlight(code, options) instead.
|
|
73
|
-
https://github.com/highlightjs/highlight.js/issues/2277`),pe=A,ae=j),q===void 0&&(q=!0);const we={code:ae,language:pe};P("before:highlight",we);const V=we.result?we.result:d(we.language,we.code,q);return V.code=we.code,P("after:highlight",V),V}function d(A,j,q,ae){const pe=Object.create(null);function we(J,ee){return J.keywords[ee]}function V(){if(!W.keywords){Z.addText(F);return}let J=0;W.keywordPatternRe.lastIndex=0;let ee=W.keywordPatternRe.exec(F),ue="";for(;ee;){ue+=F.substring(J,ee.index);const ye=H.case_insensitive?ee[0].toLowerCase():ee[0],Se=we(W,ye);if(Se){const[qe,bt]=Se;if(Z.addText(ue),ue="",pe[ye]=(pe[ye]||0)+1,pe[ye]<=Ty&&(ge+=bt),qe.startsWith("_"))ue+=ee[0];else{const xn=H.classNameAliases[qe]||qe;ce(ee[0],xn)}}else ue+=ee[0];J=W.keywordPatternRe.lastIndex,ee=W.keywordPatternRe.exec(F)}ue+=F.substring(J),Z.addText(ue)}function le(){if(F==="")return;let J=null;if(typeof W.subLanguage=="string"){if(!t[W.subLanguage]){Z.addText(F);return}J=d(W.subLanguage,F,!0,te[W.subLanguage]),te[W.subLanguage]=J._top}else J=f(F,W.subLanguage.length?W.subLanguage:null);W.relevance>0&&(ge+=J.relevance),Z.__addSublanguage(J._emitter,J.language)}function Y(){W.subLanguage!=null?le():V(),F=""}function ce(J,ee){J!==""&&(Z.startScope(ee),Z.addText(J),Z.endScope())}function ne(J,ee){let ue=1;const ye=ee.length-1;for(;ue<=ye;){if(!J._emit[ue]){ue++;continue}const Se=H.classNameAliases[J[ue]]||J[ue],qe=ee[ue];Se?ce(qe,Se):(F=qe,V(),F=""),ue++}}function M(J,ee){return J.scope&&typeof J.scope=="string"&&Z.openNode(H.classNameAliases[J.scope]||J.scope),J.beginScope&&(J.beginScope._wrap?(ce(F,H.classNameAliases[J.beginScope._wrap]||J.beginScope._wrap),F=""):J.beginScope._multi&&(ne(J.beginScope,ee),F="")),W=Object.create(J,{parent:{value:W}}),W}function X(J,ee,ue){let ye=Fv(J.endRe,ue);if(ye){if(J["on:end"]){const Se=new Ll(J);J["on:end"](ee,Se),Se.isMatchIgnored&&(ye=!1)}if(ye){for(;J.endsParent&&J.parent;)J=J.parent;return J}}if(J.endsWithParent)return X(J.parent,ee,ue)}function se(J){return W.matcher.regexIndex===0?(F+=J[0],1):(ve=!0,0)}function fe(J){const ee=J[0],ue=J.rule,ye=new Ll(ue),Se=[ue.__beforeBegin,ue["on:begin"]];for(const qe of Se)if(qe&&(qe(J,ye),ye.isMatchIgnored))return se(ee);return ue.skip?F+=ee:(ue.excludeBegin&&(F+=ee),Y(),!ue.returnBegin&&!ue.excludeBegin&&(F=ee)),M(ue,J),ue.returnBegin?0:ee.length}function ke(J){const ee=J[0],ue=j.substring(J.index),ye=X(W,J,ue);if(!ye)return Hl;const Se=W;W.endScope&&W.endScope._wrap?(Y(),ce(ee,W.endScope._wrap)):W.endScope&&W.endScope._multi?(Y(),ne(W.endScope,J)):Se.skip?F+=ee:(Se.returnEnd||Se.excludeEnd||(F+=ee),Y(),Se.excludeEnd&&(F=ee));do W.scope&&Z.closeNode(),!W.skip&&!W.subLanguage&&(ge+=W.relevance),W=W.parent;while(W!==ye.parent);return ye.starts&&M(ye.starts,J),Se.returnEnd?0:ee.length}function v(){const J=[];for(let ee=W;ee!==H;ee=ee.parent)ee.scope&&J.unshift(ee.scope);J.forEach(ee=>Z.openNode(ee))}let _={};function O(J,ee){const ue=ee&&ee[0];if(F+=J,ue==null)return Y(),0;if(_.type==="begin"&&ee.type==="end"&&_.index===ee.index&&ue===""){if(F+=j.slice(ee.index,ee.index+1),!r){const ye=new Error(`0 width match regex (${A})`);throw ye.languageName=A,ye.badRule=_.rule,ye}return 1}if(_=ee,ee.type==="begin")return fe(ee);if(ee.type==="illegal"&&!q){const ye=new Error('Illegal lexeme "'+ue+'" for mode "'+(W.scope||"<unnamed>")+'"');throw ye.mode=W,ye}else if(ee.type==="end"){const ye=ke(ee);if(ye!==Hl)return ye}if(ee.type==="illegal"&&ue==="")return F+=`
|
|
74
|
-
`,1;if(he>1e5&&he>ee.index*3)throw new Error("potential infinite loop, way more iterations than matches");return F+=ue,ue.length}const H=R(A);if(!H)throw jn(i.replace("{}",A)),new Error('Unknown language: "'+A+'"');const z=xy(H);let K="",W=ae||z;const te={},Z=new a.__emitter(a);v();let F="",ge=0,re=0,he=0,ve=!1;try{if(H.__emitTokens)H.__emitTokens(j,Z);else{for(W.matcher.considerAll();;){he++,ve?ve=!1:W.matcher.considerAll(),W.matcher.lastIndex=re;const J=W.matcher.exec(j);if(!J)break;const ee=j.substring(re,J.index),ue=O(ee,J);re=J.index+ue}O(j.substring(re))}return Z.finalize(),K=Z.toHTML(),{language:A,value:K,relevance:ge,illegal:!1,_emitter:Z,_top:W}}catch(J){if(J.message&&J.message.includes("Illegal"))return{language:A,value:Pi(j),illegal:!0,relevance:0,_illegalBy:{message:J.message,index:re,context:j.slice(re-100,re+100),mode:J.mode,resultSoFar:K},_emitter:Z};if(r)return{language:A,value:Pi(j),illegal:!1,relevance:0,errorRaised:J,_emitter:Z,_top:W};throw J}}function h(A){const j={value:Pi(A),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return j._emitter.addText(A),j}function f(A,j){j=j||a.languages||Object.keys(t);const q=h(A),ae=j.filter(R).filter(G).map(Y=>d(Y,A,!1));ae.unshift(q);const pe=ae.sort((Y,ce)=>{if(Y.relevance!==ce.relevance)return ce.relevance-Y.relevance;if(Y.language&&ce.language){if(R(Y.language).supersetOf===ce.language)return 1;if(R(ce.language).supersetOf===Y.language)return-1}return 0}),[we,V]=pe,le=we;return le.secondBest=V,le}function g(A,j,q){const ae=j&&n[j]||q;A.classList.add("hljs"),A.classList.add(`language-${ae}`)}function b(A){let j=null;const q=c(A);if(l(q))return;if(P("before:highlightElement",{el:A,language:q}),A.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",A);return}if(A.children.length>0&&(a.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(A)),a.throwUnescapedHTML))throw new Sy("One of your code blocks includes unescaped HTML.",A.innerHTML);j=A;const ae=j.textContent,pe=q?u(ae,{language:q,ignoreIllegals:!0}):f(ae);A.innerHTML=pe.value,A.dataset.highlighted="yes",g(A,q,pe.language),A.result={language:pe.language,re:pe.relevance,relevance:pe.relevance},pe.secondBest&&(A.secondBest={language:pe.secondBest.language,relevance:pe.secondBest.relevance}),P("after:highlightElement",{el:A,result:pe,text:ae})}function T(A){a=Bl(a,A)}const E=()=>{k(),Gn("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function m(){k(),Gn("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function k(){function A(){k()}if(document.readyState==="loading"){x||window.addEventListener("DOMContentLoaded",A,!1),x=!0;return}document.querySelectorAll(a.cssSelector).forEach(b)}function $(A,j){let q=null;try{q=j(e)}catch(ae){if(jn("Language definition for '{}' could not be registered.".replace("{}",A)),r)jn(ae);else throw ae;q=o}q.name||(q.name=A),t[A]=q,q.rawDefinition=j.bind(null,e),q.aliases&&C(q.aliases,{languageName:A})}function D(A){delete t[A];for(const j of Object.keys(n))n[j]===A&&delete n[j]}function S(){return Object.keys(t)}function R(A){return A=(A||"").toLowerCase(),t[A]||t[n[A]]}function C(A,{languageName:j}){typeof A=="string"&&(A=[A]),A.forEach(q=>{n[q.toLowerCase()]=j})}function G(A){const j=R(A);return j&&!j.disableAutodetect}function oe(A){A["before:highlightBlock"]&&!A["before:highlightElement"]&&(A["before:highlightElement"]=j=>{A["before:highlightBlock"](Object.assign({block:j.el},j))}),A["after:highlightBlock"]&&!A["after:highlightElement"]&&(A["after:highlightElement"]=j=>{A["after:highlightBlock"](Object.assign({block:j.el},j))})}function L(A){oe(A),s.push(A)}function N(A){const j=s.indexOf(A);j!==-1&&s.splice(j,1)}function P(A,j){const q=A;s.forEach(function(ae){ae[q]&&ae[q](j)})}function I(A){return Gn("10.7.0","highlightBlock will be removed entirely in v12.0"),Gn("10.7.0","Please use highlightElement now."),b(A)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:k,highlightElement:b,highlightBlock:I,configure:T,initHighlighting:E,initHighlightingOnLoad:m,registerLanguage:$,unregisterLanguage:D,listLanguages:S,getLanguage:R,registerAliases:C,autoDetection:G,inherit:Bl,addPlugin:L,removePlugin:N}),e.debugMode=function(){r=!1},e.safeMode=function(){r=!0},e.versionString=ky,e.regex={concat:Un,lookahead:Yu,either:qo,optional:Bv,anyNumberOfTimes:Uv};for(const A in _r)typeof _r[A]=="object"&&Ju(_r[A]);return Object.assign(e,_r),e},us=od({});us.newInstance=()=>od({});var Ay=us;us.HighlightJS=us;us.default=us;const We=Pv(Ay),Fr="[A-Za-z$_][0-9A-Za-z$_]*",ad=["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"],ld=["true","false","null","undefined","NaN","Infinity"],cd=["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"],ud=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],dd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],hd=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],fd=[].concat(dd,cd,ud);function Ry(e){const t=e.regex,n=(q,{after:ae})=>{const pe="</"+q[0].slice(1);return q.input.indexOf(pe,ae)!==-1},s=Fr,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(q,ae)=>{const pe=q[0].length+q.index,we=q.input[pe];if(we==="<"||we===","){ae.ignoreMatch();return}we===">"&&(n(q,{after:pe})||ae.ignoreMatch());let V;const le=q.input.substring(pe);if(V=le.match(/^\s*=/)){ae.ignoreMatch();return}if((V=le.match(/^\s+extends\s+/))&&V.index===0){ae.ignoreMatch();return}}},a={$pattern:Fr,keyword:ad,literal:ld,built_in:fd,"variable.language":hd},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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},m={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:s+"(?=\\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,f,g,b,T,{match:/\$\d+/},d];h.contains=x.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(x)});const k=[].concat(m,h.contains),$=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),D={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:$},S={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},R={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:{_:[...cd,...ud]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},G={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[D],illegal:/%/},oe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(q){return t.concat("(?!",q.join("|"),")")}const N={match:t.concat(/\b/,L([...dd,"super","import"].map(q=>`${q}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},I={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},D]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[D]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,T,m,{match:/\$\d+/},d,R,{scope:"attr",match:s+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:A,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:a,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},G,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[D,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[D]},N,oe,S,I,{match:/\$[(.]/}]}}function pd(e){const t=e.regex,n=Ry(e),s=Fr,r=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:r},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Fr,keyword:ad.concat(l),literal:ld,built_in:fd.concat(r),"variable.language":hd},u={className:"meta",begin:"@"+s},d=(b,T,E)=>{const m=b.contains.findIndex(x=>x.label===T);if(m===-1)throw new Error("can not find mode to replace");b.contains.splice(m,1,E)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const h=n.contains.find(b=>b.scope==="attr"),f=Object.assign({},h,{match:t.concat(s,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,f]),n.contains=n.contains.concat([u,i,o,f]),d(n,"shebang",e.SHEBANG()),d(n,"use_strict",a);const g=n.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const Fl="[A-Za-z$_][0-9A-Za-z$_]*",Cy=["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"],Oy=["true","false","null","undefined","NaN","Infinity"],gd=["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"],md=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],bd=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],$y=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ny=[].concat(bd,gd,md);function vd(e){const t=e.regex,n=(q,{after:ae})=>{const pe="</"+q[0].slice(1);return q.input.indexOf(pe,ae)!==-1},s=Fl,r={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(q,ae)=>{const pe=q[0].length+q.index,we=q.input[pe];if(we==="<"||we===","){ae.ignoreMatch();return}we===">"&&(n(q,{after:pe})||ae.ignoreMatch());let V;const le=q.input.substring(pe);if(V=le.match(/^\s*=/)){ae.ignoreMatch();return}if((V=le.match(/^\s+extends\s+/))&&V.index===0){ae.ignoreMatch();return}}},a={$pattern:Fl,keyword:Cy,literal:Oy,built_in:Ny,"variable.language":$y},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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},T={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},m={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:s+"(?=\\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,f,g,b,T,{match:/\$\d+/},d];h.contains=x.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(x)});const k=[].concat(m,h.contains),$=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),D={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:$},S={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},R={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:{_:[...gd,...md]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},G={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[D],illegal:/%/},oe={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function L(q){return t.concat("(?!",q.join("|"),")")}const N={match:t.concat(/\b/,L([...bd,"super","import"].map(q=>`${q}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},P={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},I={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},D]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[D]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,g,b,T,m,{match:/\$\d+/},d,R,{scope:"attr",match:s+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[m,e.REGEXP_MODE,{className:"function",begin:A,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:a,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:r.begin,end:r.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},G,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[D,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},P,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[D]},N,oe,S,I,{match:/\$[(.]/}]}}function yd(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["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"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,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:a,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]},h="[0-9](_?[0-9])*",f=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${s.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${f}))[eE][+-]?(${h})[jJ]?(?=${g})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${h})[jJ](?=${g})`}]},T={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},E={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,b,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,b,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,T,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[E]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,E,d]}]}}function _d(e){const t=e.regex,n={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const r={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,r]};r.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],T=["true","false"],E={match:/(\/[a-z._-]+)+/},m=["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"],k=["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"],$=["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:b,literal:T,built_in:[...m,...x,"set","shopt",...k,...$]},contains:[f,e.SHEBANG(),g,d,i,o,E,a,l,c,u,n]}}function Iy(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],r={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,n,e.QUOTE_STRING_MODE,r,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const Py=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_-]*/}}),Ly=["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"],My=["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"],jy=[...Ly,...My],Dy=["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(),Uy=["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(),By=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Hy=["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 Fy(e){const t=e.regex,n=Py(e),s={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},r="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,s,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Uy.join("|")+")"},{begin:":(:)?("+By.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Hy.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.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:Dy.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+jy.join("|")+")\\b"}]}}function wd(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s=/[\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/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),a=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:s,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,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},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(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Vy(e){const t=e.regex,n=e.COMMENT("--","$"),s={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},r={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["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"],h=["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"],f=u,g=[...c,...l].filter($=>!u.includes($)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},T={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},E={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function m($){return t.concat(/\b/,t.either(...$.map(D=>D.replace(/\s+/,"\\s+"))),/\b/)}const x={scope:"keyword",match:m(h),relevance:0};function k($,{exceptions:D,when:S}={}){const R=S;return D=D||[],$.map(C=>C.match(/\|\d+$/)||D.includes(C)?C:R(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(g,{when:$=>$.length<3}),literal:i,type:a,built_in:d},contains:[{scope:"type",match:m(o)},x,E,b,s,r,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,T]}}function xd(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={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}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},T=[s,{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+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{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}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},g,b,i,o],E=[...T];return E.pop(),E.push(a),f.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:T}}function Ed(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},s={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},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),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:[]}),h=e.inherit(u,{contains:[]});c.contains.push(h),u.contains.push(d);let f=[n,l];return[c,u,d,h].forEach(E=>{E.contains=E.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},r,s,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}We.registerLanguage("typescript",pd);We.registerLanguage("ts",pd);We.registerLanguage("javascript",vd);We.registerLanguage("js",vd);We.registerLanguage("python",yd);We.registerLanguage("py",yd);We.registerLanguage("bash",_d);We.registerLanguage("sh",_d);We.registerLanguage("json",Iy);We.registerLanguage("css",Fy);We.registerLanguage("html",wd);We.registerLanguage("xml",wd);We.registerLanguage("sql",Vy);We.registerLanguage("yaml",xd);We.registerLanguage("yml",xd);We.registerLanguage("markdown",Ed);We.registerLanguage("md",Ed);function kt(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,n,s)=>`<a href="${/^https?:\/\//i.test(s)||s.startsWith("/")||s.startsWith("#")?s:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${n}</a>`)}function kd(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Vl(e){return kd(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Li(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function qy(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function Ky(e){if(e.length<2)return e.map(a=>`<p class="my-1">${kt(a)}</p>`).join(`
|
|
75
|
-
`);const t=Li(e[0]),n=e[1],s=Vl(n)?Li(n).map(qy):t.map(()=>"text-left"),r=Vl(n)?e.slice(2):e.slice(1),i=t.map((a,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${s[l]??"text-left"}">${kt(a)}</th>`).join(""),o=r.map(a=>{const l=Li(a);return`<tr class="border-b border-gray-800">${t.map((u,d)=>`<td class="px-3 py-1.5 text-gray-400 ${s[d]??"text-left"}">${kt(l[d]??"")}</td>`).join("")}</tr>`}).join("");return`<div class="overflow-x-auto my-2"><table class="border-collapse w-full text-sm"><thead><tr class="border-b border-gray-700">${i}</tr></thead><tbody>${o}</tbody></table></div>`}function Wy(e){if(!e.startsWith(`---
|
|
76
|
-
`)&&e!=="---")return{frontmatter:null,body:e};const t=e.indexOf(`
|
|
77
|
-
---
|
|
78
|
-
`,3),n=e.indexOf(`
|
|
79
|
-
---`,3),s=t!==-1?t:n!==-1&&e.slice(n).trimEnd()==="---"?n:-1;if(s===-1)return{frontmatter:null,body:e};const r=e.slice(4,s),i=t!==-1?e.slice(t+5):"",o={};for(const a of r.split(`
|
|
80
|
-
`)){const l=a.match(/^([^:]+):\s*(.*)$/);if(!l)continue;const c=l[1].trim();let u=l[2].trim();(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),o[c]=u}return{frontmatter:Object.keys(o).length>0?o:null,body:i}}function gs(e){if(!e)return"";const t=e.split(`
|
|
81
|
-
`),n=[];let s=!1,r=null,i=!1,o=!1,a=[],l="",c=[];function u(){r&&(n.push(`</${r}>`),r=null)}function d(){o&&(n.push(Ky(c)),c=[],o=!1)}function h(){i&&(n.push("</blockquote>"),i=!1)}for(const f of t){if(f.startsWith("```")){if(u(),d(),!s)s=!0,l=f.slice(3).trim().split(/\s+/)[0].toLowerCase(),a=[];else{const $=a.join(`
|
|
82
|
-
`);let D;try{D=l&&We.getLanguage(l)?We.highlight($,{language:l,ignoreIllegals:!0}).value:We.highlightAuto($).value}catch{D=$.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const S=l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),R=S?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${S}</span>`:"";n.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">${D}</code></pre>${R}</div>`),s=!1,l="",a=[]}continue}if(s){a.push(f);continue}if(kd(f)){u(),o=!0,c.push(f);continue}o&&d();const g=f.match(/^####\s+(.+)/),b=f.match(/^###\s+(.+)/),T=f.match(/^##\s+(.+)/),E=f.match(/^#\s+(.+)/);if(g){u(),h(),n.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${kt(g[1])}</h4>`);continue}if(b){u(),h(),n.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${kt(b[1])}</h3>`);continue}if(T){u(),h(),n.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${kt(T[1])}</h2>`);continue}if(E){u(),h(),n.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${kt(E[1])}</h1>`);continue}if(/^---+$/.test(f.trim())){u(),h(),n.push('<hr class="border-gray-800 my-4" />');continue}const m=f.match(/^[-*+]\s+(.+)/);if(m){r==="ol"&&u(),h(),r||(n.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),r="ul"),n.push(`<li>${kt(m[1])}</li>`);continue}const x=f.match(/^\d+\.\s+(.+)/);if(x){r==="ul"&&u(),h(),r||(n.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),r="ol"),n.push(`<li>${kt(x[1])}</li>`);continue}const k=f.match(/^>\s?(.*)/);if(k){u(),i||(n.push('<blockquote class="border-l-2 border-txt-muted pl-3 my-2 text-txt-muted italic">'),i=!0),n.push(`<p class="my-0">${kt(k[1])}</p>`);continue}if(f.trim()===""){u(),h(),n.push('<div class="my-2"></div>');continue}u(),h(),n.push(`<p class="my-1">${kt(f)}</p>`)}if(s&&a.length){const f=a.join(`
|
|
83
|
-
`).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.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">${f}</code></pre>`)}return d(),u(),h(),n.join(`
|
|
84
|
-
`)}const Gy=["onKeydown"],zy={class:"relative w-full max-w-2xl h-[70vh] sm:h-[600px] bg-bg-surface border border-border rounded-xl flex flex-col overflow-hidden animate-fade-in"},Jy={key:0,class:"h-full flex flex-col items-center justify-center text-text-muted gap-2"},Zy=["innerHTML"],Yy={class:"whitespace-pre-wrap"},Xy={key:0,class:"mt-2 flex flex-wrap gap-1.5 pt-2 border-t border-current/10"},Qy={key:1,class:"flex justify-start"},e_={class:"shrink-0 border-t border-border p-3"},t_=["disabled"],n_=["disabled"],s_='<span class="stream-cursor"></span>',r_=Ge({__name:"FloatingChat",setup(e,{expose:t}){const n=zu(),s=B(!1),r=B(""),i=B(null),o=B(null),a=B(!1),l=B(n.messages.length),c=Oe(()=>n.messages.some(E=>E.streaming));function u(){s.value=!0,a.value=!1,l.value=n.messages.length,At(()=>h())}function d(){s.value=!1}t({open:u,isOpen:s});function h(){At(()=>{i.value&&i.value.scrollTo({top:i.value.scrollHeight,behavior:"instant"})})}mt(()=>n.messages.length,E=>{if(s.value)h(),l.value=E;else{const m=n.messages[E-1];E>l.value&&(m==null?void 0:m.role)==="assistant"&&(a.value=!0)}}),mt(()=>{var E;return(E=n.messages[n.messages.length-1])==null?void 0:E.content},()=>{s.value&&h()});function f(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),T())}function g(){const E=o.value;E&&(E.style.height="auto",E.style.height=Math.min(E.scrollHeight,100)+"px")}async function b(){try{await xe("/api/orchestrator/abort",{method:"POST"})}catch{}}async function T(){const E=r.value.trim();if(!E||n.isLoading)return;r.value="",At(()=>{o.value&&(o.value.style.height="auto")}),n.isLoading=!0,n.addMessage({id:crypto.randomUUID(),role:"user",content:E}),n.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),h();const m=new EventSource(await di("/api/events"));m.onmessage=x=>{try{const k=JSON.parse(x.data);k.type==="delta"?n.appendToLast(k.text):k.type==="done"&&(n.setLastStreaming(!1),n.isLoading=!1,m.close())}catch{}},m.onerror=()=>{n.setLastStreaming(!1),n.isLoading=!1,m.close()};try{await xe("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:E})})}catch{n.appendToLast(`
|
|
85
|
-
|
|
86
|
-
[Error: failed to reach IO]`),n.setLastStreaming(!1),n.isLoading=!1,m.close()}}return(E,m)=>(y(),rn(Co,{to:"body"},[Me(jo,{name:"chat-overlay"},{default:yn(()=>[s.value?(y(),w("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center sm:items-center p-4",onKeydown:lu(en(d,["self"]),["escape"])},[p("div",{class:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:d}),p("div",zy,[p("div",{class:"h-11 shrink-0 border-b border-border flex items-center justify-between px-4"},[m[2]||(m[2]=p("div",{class:"flex items-center gap-2"},[p("span",{class:"text-accent-cyan font-mono font-bold text-sm"},"IO"),p("span",{class:"w-px h-3 bg-border"}),p("span",{class:"text-text-muted text-xs"},"Chat")],-1)),p("button",{onClick:d,class:"w-7 h-7 flex items-center justify-center rounded-md text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},[...m[1]||(m[1]=[p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("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)])])]),p("div",{ref_key:"messagesEl",ref:i,class:"flex-1 overflow-y-auto p-4 space-y-3"},[De(n).messages.length?Q("",!0):(y(),w("div",Jy,[...m[3]||(m[3]=[p("span",{class:"text-2xl font-mono font-bold text-accent-cyan/30"},"IO",-1),p("p",{class:"text-xs"},"Ask me anything...",-1)])])),(y(!0),w(be,null,Ne(De(n).messages,x=>{var k;return y(),w("div",{key:x.id,class:Te(x.role==="user"?"flex justify-end":"flex justify-start")},[p("div",{class:Te(["max-w-[80%] rounded-lg px-3 py-2",x.role==="user"?"bg-accent-cyan/10 border border-accent-cyan/20 text-text text-sm":"chat-markdown bg-bg-card border border-border text-text-secondary font-mono text-xs leading-relaxed"])},[x.role==="assistant"?(y(),w("div",{key:0,class:"wiki-content",innerHTML:De(gs)(x.content)+(x.streaming?s_:"")},null,8,Zy)):(y(),w(be,{key:1},[p("span",Yy,U(x.content),1),(k=x.attachments)!=null&&k.length?(y(),w("div",Xy,[(y(!0),w(be,null,Ne(x.attachments,$=>(y(),w("span",{key:$.displayName??$.mimeType,class:"inline-flex items-center gap-1 text-[10px] bg-black/20 rounded px-1.5 py-0.5"},[m[4]||(m[4]=p("svg",{class:"w-2.5 h-2.5",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a3 3 0 0 0 4.241 4.243h.001l.497-.5a.75.75 0 0 1 1.064 1.057l-.498.501a4.5 4.5 0 0 1-6.364-6.364l7-7a4.5 4.5 0 0 1 6.368 6.36l-3.455 3.553A2.625 2.625 0 1 1 9.52 9.52l3.45-3.451a.75.75 0 1 1 1.061 1.06l-3.45 3.451a1.125 1.125 0 0 0 1.587 1.595l3.454-3.553a3 3 0 0 0 0-4.242Z","clip-rule":"evenodd"})],-1)),on(" "+U($.displayName??$.mimeType),1)]))),128))])):Q("",!0)],64))],2)],2)}),128)),De(n).isLoading&&!c.value?(y(),w("div",Qy,[...m[5]||(m[5]=[p("div",{class:"bg-bg-card border border-border rounded-lg px-3 py-2"},[p("span",{class:"flex gap-1"},[p("span",{class:"thinking-dot"}),p("span",{class:"thinking-dot",style:{"animation-delay":"0.15s"}}),p("span",{class:"thinking-dot",style:{"animation-delay":"0.3s"}})])],-1)])])):Q("",!0)],512),p("div",e_,[p("form",{class:"flex items-end gap-2",onSubmit:en(T,["prevent"])},[Ue(p("textarea",{ref_key:"inputEl",ref:o,"onUpdate:modelValue":m[0]||(m[0]=x=>r.value=x),onKeydown:f,onInput:g,disabled:De(n).isLoading,placeholder:"Type a message...",rows:"1",class:"flex-1 bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none resize-none transition-colors leading-relaxed",style:{"min-height":"40px","max-height":"100px","overflow-y":"auto"}},null,40,t_),[[Ve,r.value]]),De(n).isLoading?(y(),w("button",{key:0,type:"button",onClick:b,class:"w-8 h-8 shrink-0 flex items-center justify-center rounded-lg border border-accent-red/20 bg-accent-red/10 text-accent-red hover:bg-accent-red/20 transition-colors"},[...m[6]||(m[6]=[p("span",{class:"w-2.5 h-2.5 rounded-[2px] bg-current"},null,-1)])])):(y(),w("button",{key:1,type:"submit",disabled:!r.value.trim(),class:"w-8 h-8 shrink-0 flex items-center justify-center rounded-lg bg-accent-cyan/10 border border-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-30 disabled:cursor-not-allowed transition-colors"},[...m[7]||(m[7]=[p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{d:"M3.105 3.71a.75.75 0 0 1 .855-.163l13 6.5a.75.75 0 0 1 0 1.342l-13 6.5a.75.75 0 0 1-1.036-.86L5.25 10l-2.326-6.29a.75.75 0 0 1 .18-.8Z"})],-1)])],8,n_))],32)])])],40,Gy)):Q("",!0)]),_:1})]))}}),i_=hi(r_,[["__scopeId","data-v-ae19b2b6"]]),o_={key:0,class:"h-screen"},a_={key:1,class:"flex flex-col h-screen bg-bg-app text-text overflow-hidden"},l_={class:"flex flex-1 min-h-0"},c_={class:"flex-1 overflow-auto relative"},u_=Ge({__name:"App",setup(e){const t=Bo(),n=B(!1),s=B(null);return(r,i)=>{var o;return De(t).name==="login"?(y(),w("div",o_,[Me(De(no))])):(y(),w("div",a_,[Me(pv,{onToggleSidebar:i[0]||(i[0]=a=>n.value=!n.value)}),p("div",l_,[Me(xv,{visible:n.value,onNavigate:i[1]||(i[1]=a=>n.value=!1)},null,8,["visible"]),p("main",c_,[Me(De(no),null,{default:yn(({Component:a})=>[Me(jo,{name:"view",mode:"out-in"},{default:yn(()=>[(y(),rn(jh(a)))]),_:2},1024)]),_:1})])]),Me(Cv),Me(Iv,{"chat-open":((o=s.value)==null?void 0:o.isOpen)??!1,onOpen:i[2]||(i[2]=a=>{var l;return(l=s.value)==null?void 0:l.open()})},null,8,["chat-open"]),Me(i_,{ref_key:"chatRef",ref:s},null,512)]))}}}),d_=hi(u_,[["__scopeId","data-v-6f759343"]]),h_={class:"h-full p-5 flex flex-col gap-4"},f_={class:"flex-1 min-h-0 bg-bg-card border border-border rounded-lg flex flex-col overflow-hidden"},p_={key:0,class:"h-full flex flex-col items-center justify-center text-center"},g_={class:"mt-4 flex flex-wrap justify-center gap-2"},m_=["onClick"],b_=["innerHTML"],v_={class:"whitespace-pre-wrap"},y_={key:0,class:"mt-2 flex flex-wrap gap-1.5 pt-2 border-t border-current/10"},__={key:1,class:"flex justify-start"},w_={class:"shrink-0 border-t border-border bg-bg-surface px-4 py-3 space-y-2"},x_={key:0,class:"text-xs text-accent-red"},E_={key:1,class:"flex flex-wrap gap-1.5"},k_={class:"font-mono text-[10px]"},S_=["onClick"],T_=["disabled"],A_=["disabled"],R_=["disabled"],C_=5*1024*1024,Mi=5,O_='<span class="stream-cursor"></span>',$_=Ge({__name:"ChatView",setup(e){const t=zu(),n=Bo(),s=B(""),r=B(!1),i=B(!1),o=B(null),a=B([]),l=B(null),c=B(!1),u=B(null),d=B(null),h=["Check squad status","Run my schedules","Summarize recent activity","What skills are installed?"],f=Oe(()=>(s.value.trim().length>0||a.value.length>0)&&!t.isLoading);function g(I){return I<1024?`${I} B`:I<1024*1024?`${(I/1024).toFixed(1)} KB`:`${(I/(1024*1024)).toFixed(1)} MB`}function b(I){a.value.splice(I,1)}function T(I){o.value=I,setTimeout(()=>{o.value=null},4e3)}function E(I){return new Promise((A,j)=>{const q=new FileReader;q.onload=()=>{const ae=q.result,pe=ae.split(",")[1]??"";A({dataUrl:ae,base64:pe})},q.onerror=j,q.readAsDataURL(I)})}async function m(I){const A=Array.from(I),j=Mi-a.value.length;if(j<=0){T(`Maximum ${Mi} files per message.`);return}const q=A.slice(0,j);A.length>j&&T(`Only ${j} more file(s) can be added (max ${Mi}).`);for(const ae of q){if(ae.size>C_){T(`"${ae.name}" exceeds the 5 MB limit and was skipped.`);continue}try{const{dataUrl:pe,base64:we}=await E(ae);a.value.push({file:ae,dataUrl:pe,base64:we,mimeType:ae.type||"application/octet-stream"})}catch{T(`Failed to read "${ae.name}".`)}}}function x(I){var j;const A=I.target;(j=A.files)!=null&&j.length&&m(A.files),A.value=""}function k(){i.value=!0}function $(){i.value=!1}function D(I){var A;i.value=!1,(A=I.dataTransfer)!=null&&A.files.length&&m(I.dataTransfer.files)}function S(I){s.value=I,At(()=>P())}async function R(){if(!r.value){r.value=!0;try{await xe("/api/orchestrator/abort",{method:"POST"})}catch{}finally{r.value=!1}}}const C=Oe(()=>t.messages.some(I=>I.streaming));function G(){const I=l.value;I&&(c.value=I.scrollTop+I.clientHeight<I.scrollHeight-100)}function oe(I=!0){At(()=>{l.value&&l.value.scrollTo({top:l.value.scrollHeight,behavior:I?"smooth":"instant"})})}nt(()=>{oe(!1)}),mt(()=>n.name,I=>{I==="chat"&&oe(!1)}),mt(()=>t.messages.length,()=>{c.value||oe()});function L(I){I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P())}function N(){const I=u.value;I&&(I.style.height="auto",I.style.height=Math.min(I.scrollHeight,200)+"px")}async function P(){const I=s.value.trim(),A=[...a.value];if(!I&&!A.length||t.isLoading)return;const j=I||"Please analyze these files.",q=A.map(we=>({type:"blob",data:we.base64,mimeType:we.mimeType,displayName:we.file.name}));s.value="",a.value=[],At(()=>{u.value&&(u.value.style.height="auto")}),t.isLoading=!0;const ae={id:crypto.randomUUID(),role:"user",content:I,...q.length?{attachments:q}:{}};t.addMessage(ae),t.addMessage({id:crypto.randomUUID(),role:"assistant",content:"",streaming:!0}),oe();const pe=new EventSource(await di("/api/events"));pe.onmessage=we=>{try{const V=JSON.parse(we.data);V.type==="delta"?(t.appendToLast(V.text),oe()):V.type==="done"&&(t.setLastStreaming(!1),t.isLoading=!1,pe.close(),oe())}catch{}},pe.onerror=()=>{t.setLastStreaming(!1),t.isLoading=!1,pe.close()};try{await xe("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:j,...q.length?{attachments:q}:{}})})}catch{t.appendToLast(`
|
|
87
|
-
|
|
88
|
-
[Error: failed to reach IO]`),t.setLastStreaming(!1),t.isLoading=!1,pe.close()}}return(I,A)=>(y(),w("div",h_,[p("div",f_,[p("div",{ref_key:"messagesEl",ref:l,class:"flex-1 overflow-y-auto p-5 space-y-4",onScroll:G},[De(t).messages.length?Q("",!0):(y(),w("div",p_,[A[2]||(A[2]=p("div",{class:"text-accent-cyan/20 font-mono font-bold text-5xl mb-3"},"IO",-1)),A[3]||(A[3]=p("p",{class:"text-text-muted text-sm"},"How can I help you today?",-1)),p("div",g_,[(y(),w(be,null,Ne(h,j=>p("button",{key:j,onClick:q=>S(j),class:"text-xs px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},U(j),9,m_)),64))])])),(y(!0),w(be,null,Ne(De(t).messages,j=>{var q;return y(),w("div",{key:j.id,class:Te(j.role==="user"?"flex justify-end":"flex justify-start")},[p("div",{class:Te(["max-w-[75%] rounded-xl px-4 py-3",j.role==="user"?"bg-accent-cyan/10 border border-accent-cyan/20 text-text text-sm":"chat-md bg-bg-card border border-border text-text-secondary font-mono text-xs leading-relaxed"])},[j.role==="assistant"?(y(),w("div",{key:0,class:"wiki-content",innerHTML:De(gs)(j.content)+(j.streaming?O_:"")},null,8,b_)):(y(),w(be,{key:1},[p("span",v_,U(j.content),1),(q=j.attachments)!=null&&q.length?(y(),w("div",y_,[(y(!0),w(be,null,Ne(j.attachments,ae=>(y(),w("span",{key:ae.displayName??ae.mimeType,class:"inline-flex items-center gap-1 text-[10px] bg-black/20 rounded px-1.5 py-0.5"},[A[4]||(A[4]=p("svg",{class:"w-2.5 h-2.5",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a3 3 0 0 0 4.241 4.243h.001l.497-.5a.75.75 0 0 1 1.064 1.057l-.498.501a4.5 4.5 0 0 1-6.364-6.364l7-7a4.5 4.5 0 0 1 6.368 6.36l-3.455 3.553A2.625 2.625 0 1 1 9.52 9.52l3.45-3.451a.75.75 0 1 1 1.061 1.06l-3.45 3.451a1.125 1.125 0 0 0 1.587 1.595l3.454-3.553a3 3 0 0 0 0-4.242Z","clip-rule":"evenodd"})],-1)),on(U(ae.displayName??ae.mimeType),1)]))),128))])):Q("",!0)],64))],2)],2)}),128)),De(t).isLoading&&!C.value?(y(),w("div",__,[...A[5]||(A[5]=[pf('<div class="bg-bg-card border border-border rounded-xl px-4 py-3" data-v-445f96e0><span class="flex gap-1.5 items-center" data-v-445f96e0><span class="thinking-dot" data-v-445f96e0></span><span class="thinking-dot" style="animation-delay:0.15s;" data-v-445f96e0></span><span class="thinking-dot" style="animation-delay:0.3s;" data-v-445f96e0></span></span></div>',1)])])):Q("",!0)],544),p("div",w_,[o.value?(y(),w("p",x_,U(o.value),1)):Q("",!0),a.value.length?(y(),w("div",E_,[(y(!0),w(be,null,Ne(a.value,(j,q)=>(y(),w("span",{key:j.file.name+q,class:"inline-flex items-center gap-1.5 text-xs bg-bg-elevated border border-border rounded-md px-2 py-1 text-text-muted"},[A[6]||(A[6]=p("svg",{class:"w-3 h-3",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a3 3 0 0 0 4.241 4.243h.001l.497-.5a.75.75 0 0 1 1.064 1.057l-.498.501a4.5 4.5 0 0 1-6.364-6.364l7-7a4.5 4.5 0 0 1 6.368 6.36l-3.455 3.553A2.625 2.625 0 1 1 9.52 9.52l3.45-3.451a.75.75 0 1 1 1.061 1.06l-3.45 3.451a1.125 1.125 0 0 0 1.587 1.595l3.454-3.553a3 3 0 0 0 0-4.242Z","clip-rule":"evenodd"})],-1)),on(U(j.file.name),1),p("span",k_,U(g(j.file.size)),1),p("button",{onClick:ae=>b(q),class:"text-text-muted hover:text-accent-red ml-0.5"},"×",8,S_)]))),128))])):Q("",!0),p("div",{class:"flex items-end gap-2",onDragover:en(k,["prevent"]),onDragleave:en($,["prevent"]),onDrop:en(D,["prevent"])},[p("button",{onClick:A[0]||(A[0]=j=>{var q;return(q=d.value)==null?void 0:q.click()}),title:"Attach file",class:"shrink-0 w-8 h-8 flex items-center justify-center rounded-lg text-text-muted hover:text-accent-cyan hover:bg-bg-elevated transition-colors"},[A[7]||(A[7]=p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M15.621 4.379a3 3 0 0 0-4.242 0l-7 7a3 3 0 0 0 4.241 4.243h.001l.497-.5a.75.75 0 0 1 1.064 1.057l-.498.501a4.5 4.5 0 0 1-6.364-6.364l7-7a4.5 4.5 0 0 1 6.368 6.36l-3.455 3.553A2.625 2.625 0 1 1 9.52 9.52l3.45-3.451a.75.75 0 1 1 1.061 1.06l-3.45 3.451a1.125 1.125 0 0 0 1.587 1.595l3.454-3.553a3 3 0 0 0 0-4.242Z","clip-rule":"evenodd"})],-1)),p("input",{ref_key:"fileInputEl",ref:d,type:"file",multiple:"",class:"hidden",onChange:x},null,544)]),Ue(p("textarea",{ref_key:"inputEl",ref:u,"onUpdate:modelValue":A[1]||(A[1]=j=>s.value=j),onKeydown:L,onInput:N,disabled:De(t).isLoading,placeholder:"Message IO...",rows:"1",class:Te(["flex-1 bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none resize-none transition-colors leading-relaxed",i.value?"border-accent-cyan/40":""]),style:{"min-height":"40px","max-height":"120px","overflow-y":"auto"}},null,42,T_),[[Ve,s.value]]),De(t).isLoading?(y(),w("button",{key:0,onClick:R,disabled:r.value,class:"shrink-0 w-8 h-8 flex items-center justify-center rounded-lg border border-accent-red/20 bg-accent-red/10 text-accent-red hover:bg-accent-red/20 disabled:opacity-40 transition-colors"},[...A[8]||(A[8]=[p("span",{class:"w-2.5 h-2.5 rounded-[2px] bg-current"},null,-1)])],8,A_)):(y(),w("button",{key:1,onClick:P,disabled:!f.value,class:"shrink-0 w-8 h-8 flex items-center justify-center rounded-lg bg-accent-cyan/10 border border-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-30 disabled:cursor-not-allowed transition-colors"},[...A[9]||(A[9]=[p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{d:"M3.105 3.71a.75.75 0 0 1 .855-.163l13 6.5a.75.75 0 0 1 0 1.342l-13 6.5a.75.75 0 0 1-1.036-.86L5.25 10l-2.326-6.29a.75.75 0 0 1 .18-.8Z"})],-1)])],8,R_))],32)])])]))}}),N_=hi($_,[["__scopeId","data-v-445f96e0"]]),I_={class:"h-full p-5"},P_={class:"h-full flex overflow-hidden bg-bg-card border border-border rounded-lg"},L_={class:"w-64 shrink-0 border-r border-border bg-bg-surface flex flex-col overflow-hidden"},M_={class:"p-3 border-b border-border space-y-2"},j_={class:"p-3 border-b border-border space-y-2"},D_={class:"flex items-center gap-2"},U_=["disabled"],B_=["disabled"],H_={key:2,class:"text-[10px] text-accent-red"},F_={key:3,class:"text-[10px] text-accent-green"},V_={class:"flex-1 overflow-y-auto py-1"},q_={key:0,class:"px-4 py-3 text-text-muted text-xs"},K_={key:1,class:"px-4 py-3 text-accent-red text-xs"},W_=["onClick"],G_={class:"text-[10px] truncate mt-0.5"},z_={key:2,class:"px-4 py-3 text-text-muted text-xs"},J_={class:"flex-1 overflow-y-auto p-5"},Z_={key:0,class:"h-full flex items-center justify-center text-text-muted text-sm"},Y_={class:"flex items-start justify-between mb-5"},X_={class:"text-base font-semibold text-text"},Q_={class:"text-xs font-mono text-text-muted mt-0.5"},e0={class:"flex items-center gap-2"},t0={key:0,class:"text-text-muted text-sm"},n0={key:1,class:"text-accent-red text-sm"},s0={key:0,class:"bg-bg-card border border-border rounded-lg p-4 mb-5 space-y-1.5"},r0={key:0,class:"text-xs"},i0={class:"text-text-muted"},o0={class:"text-text-secondary"},a0={class:"text-text-muted"},l0={class:"text-text-secondary"},c0=["innerHTML"],u0=Ge({__name:"SkillsView",setup(e){const t=B([]),n=B(!0),s=B(null),r=B(""),i=B(!1),o=B(null),a=B(null),l=B("url"),c=B(""),u=B(""),d=B(!1),h=B(null),f=B(""),g=B(!1),b=B(null),T=Oe(()=>Wy(f.value)),E=Oe(()=>T.value.frontmatter),m=Oe(()=>gs(T.value.body)),x=["name","description","version","author"],k=Oe(()=>E.value?Object.entries(E.value).filter(([N])=>!x.includes(N)):[]),$=B(""),D=Oe(()=>{const N=$.value.toLowerCase().trim();return N?t.value.filter(P=>P.name.toLowerCase().includes(N)||P.slug.toLowerCase().includes(N)||(P.description??"").toLowerCase().includes(N)):t.value});async function S(N){h.value=N,f.value="",b.value=null,g.value=!0;try{const P=await xe(`/api/skills/${encodeURIComponent(N.slug)}`);if(P.status===404)b.value="Skill not found";else if(!P.ok)b.value=`Failed to load skill (HTTP ${P.status})`;else{const I=await P.json();f.value=I.content??""}}catch(P){b.value=P instanceof Error?P.message:"Failed to load skill"}finally{g.value=!1}}function R(){h.value=null,f.value="",b.value=null}async function C(){try{const N=await xe("/api/skills");if(!N.ok)throw new Error(`HTTP error! status: ${N.status}`);const P=await N.json();t.value=P.skills}catch(N){s.value=N instanceof Error?N.message:"Failed to load skills"}finally{n.value=!1}}async function G(){if(!(i.value||r.value.trim()==="")){i.value=!0,o.value=null,a.value=null;try{const N=await xe("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoUrl:r.value.trim()})});if(N.ok){const P=await N.json();t.value=[P.skill,...t.value],r.value="",a.value=`✓ Installed: ${P.skill.name}`,setTimeout(()=>{a.value=null},4e3),C()}else{let P="Install failed";try{P=(await N.json()).error??N.statusText??P}catch{P=N.statusText||P}o.value=P}}catch(N){o.value=N instanceof Error?N.message:"Install failed"}finally{i.value=!1}}}async function oe(){if(!(d.value||c.value.trim()===""||u.value.trim()==="")){d.value=!0,o.value=null,a.value=null;try{const N=await xe("/api/skills/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u.value.trim(),slug:c.value.trim()})});if(N.ok){const P=await N.json();t.value=[P.skill,...t.value],c.value="",u.value="",a.value=`✓ Installed: ${P.skill.name}`,setTimeout(()=>{a.value=null},4e3),C()}else{let P="Install failed";try{P=(await N.json()).error??N.statusText??P}catch{P=N.statusText||P}o.value=P}}catch(N){o.value=N instanceof Error?N.message:"Install failed"}finally{d.value=!1}}}async function L(N){if(confirm(`Delete skill "${N.name}"? This cannot be undone.`))try{const P=await xe(`/api/skills/${encodeURIComponent(N.slug)}`,{method:"DELETE"});if(P.ok)t.value=t.value.filter(I=>I.slug!==N.slug),a.value=`✓ Deleted: ${N.name}`,setTimeout(()=>{a.value=null},3e3);else{const I=await P.json().catch(()=>({}));o.value=I.error??(P.status===404?"Skill not found":`Delete failed (HTTP ${P.status})`)}}catch(P){o.value=P instanceof Error?P.message:"Delete failed"}}return nt(C),(N,P)=>(y(),w("div",I_,[p("div",P_,[p("div",L_,[p("div",M_,[Ue(p("input",{"onUpdate:modelValue":P[0]||(P[0]=I=>$.value=I),placeholder:"Search skills...",class:"w-full bg-bg-elevated border border-border rounded-md px-2.5 py-1.5 text-xs text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512),[[Ve,$.value]])]),p("div",j_,[p("div",D_,[p("button",{onClick:P[1]||(P[1]=I=>l.value="url"),class:Te(["text-[11px] transition-colors",l.value==="url"?"text-accent-cyan":"text-text-muted hover:text-text"])},"URL",2),P[7]||(P[7]=p("span",{class:"text-border-bright"},"|",-1)),p("button",{onClick:P[2]||(P[2]=I=>l.value="paste"),class:Te(["text-[11px] transition-colors",l.value==="paste"?"text-accent-cyan":"text-text-muted hover:text-text"])},"Paste",2)]),l.value==="url"?(y(),w(be,{key:0},[Ue(p("input",{"onUpdate:modelValue":P[3]||(P[3]=I=>r.value=I),placeholder:"Git repo URL",class:"w-full bg-bg-elevated border border-border rounded px-2 py-1.5 text-[11px] text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,r.value]]),p("button",{onClick:G,disabled:i.value||!r.value.trim(),class:"text-[11px] px-2.5 py-1 rounded bg-accent-cyan/10 border border-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-40 transition-colors"},U(i.value?"Installing...":"Install"),9,U_)],64)):(y(),w(be,{key:1},[Ue(p("input",{"onUpdate:modelValue":P[4]||(P[4]=I=>c.value=I),placeholder:"skill-slug",class:"w-full bg-bg-elevated border border-border rounded px-2 py-1.5 text-[11px] font-mono text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,c.value]]),Ue(p("textarea",{"onUpdate:modelValue":P[5]||(P[5]=I=>u.value=I),placeholder:"Paste markdown skill content...",rows:"3",class:"w-full bg-bg-elevated border border-border rounded px-2 py-1.5 text-[11px] text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none resize-none"},null,512),[[Ve,u.value]]),p("button",{onClick:oe,disabled:d.value||!c.value.trim()||!u.value.trim(),class:"text-[11px] px-2.5 py-1 rounded bg-accent-cyan/10 border border-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-40 transition-colors"},U(d.value?"Installing...":"Install"),9,B_)],64)),o.value?(y(),w("p",H_,U(o.value),1)):Q("",!0),a.value?(y(),w("p",F_,U(a.value),1)):Q("",!0)]),p("div",V_,[n.value?(y(),w("div",q_,"Loading...")):s.value?(y(),w("div",K_,U(s.value),1)):Q("",!0),(y(!0),w(be,null,Ne(D.value,I=>{var A,j;return y(),w("button",{key:I.slug,onClick:q=>S(I),class:Te(["w-full text-left px-4 py-2.5 border-b border-border transition-colors",((A=h.value)==null?void 0:A.slug)===I.slug?"bg-bg-elevated text-text border-l-2 border-l-accent-cyan":"text-text-muted hover:text-text hover:bg-bg-elevated/50 border-l-2 border-l-transparent"])},[p("p",{class:Te(["text-xs font-medium truncate",((j=h.value)==null?void 0:j.slug)===I.slug?"text-accent-cyan":"text-text"])},U(I.name),3),p("p",G_,U(I.description),1)],10,W_)}),128)),!n.value&&!D.value.length?(y(),w("div",z_,"No skills found")):Q("",!0)])]),p("div",J_,[h.value?(y(),w(be,{key:1},[p("div",Y_,[p("div",null,[p("h2",X_,U(h.value.name),1),p("p",Q_,U(h.value.slug),1)]),p("div",e0,[p("button",{onClick:P[6]||(P[6]=I=>L(h.value)),class:"text-[11px] px-2.5 py-1 rounded border border-accent-red/30 text-accent-red hover:bg-accent-red/10 transition-colors"},"Delete"),p("button",{onClick:R,class:"w-7 h-7 flex items-center justify-center rounded-md text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},[...P[8]||(P[8]=[p("svg",{class:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor"},[p("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)])])])]),g.value?(y(),w("div",t0,"Loading...")):b.value?(y(),w("div",n0,U(b.value),1)):(y(),w(be,{key:2},[E.value?(y(),w("div",s0,[(y(),w(be,null,Ne(x,I=>(y(),w(be,{key:I},[E.value[I]?(y(),w("div",r0,[p("span",i0,U(I)+":",1),p("span",o0,U(E.value[I]),1)])):Q("",!0)],64))),64)),(y(!0),w(be,null,Ne(k.value,([I,A])=>(y(),w("div",{key:I,class:"text-xs"},[p("span",a0,U(I)+":",1),p("span",l0,U(A),1)]))),128))])):Q("",!0),p("div",{class:"wiki-content text-sm",innerHTML:m.value},null,8,c0)],64))],64)):(y(),w("div",Z_,"Select a skill to view details"))])])]))}}),d0={class:"px-4 py-3 space-y-2"},h0={class:"flex items-center justify-between"},f0={class:"flex items-center gap-2"},p0={key:0,class:"bg-bg-elevated border border-border rounded-md p-3 space-y-2"},g0={class:"flex items-center gap-2"},m0=["disabled"],b0={key:0,class:"text-[10px] text-accent-red"},v0={key:1,class:"text-[11px] text-text-muted py-2 text-center"},y0={key:2,class:"text-[11px] text-accent-red"},_0={key:3,class:"text-[11px] text-text-muted py-2 text-center"},w0={key:4,class:"space-y-1.5"},x0={class:"flex items-center justify-between gap-3"},E0={class:"flex items-center gap-2 min-w-0"},k0={class:"text-xs text-text truncate"},S0={class:"flex items-center gap-1.5"},T0=["onClick","disabled"],A0=["onClick","disabled"],R0=["onClick"],C0={class:"text-[10px] font-mono text-text-muted truncate"},O0={class:"text-[10px] text-text-muted"},$0={key:0},N0={key:0,class:"text-[10px] text-accent-red"},I0={key:1,class:"border-t border-border pt-2 mt-1 space-y-1.5"},P0={key:0,class:"text-[10px] text-text-muted"},L0={class:"text-text-secondary"},M0={key:0,class:"text-text-muted italic mt-0.5"},j0={key:2,class:"text-[10px] text-text-muted"},D0=Ge({__name:"SquadInstances",props:{squadSlug:{}},setup(e){const t=e,n=B([]),s=B(!1),r=B(null),i=B(!1),o=B(new Set),a=at({}),l=at({}),c=at({}),u=at({}),d=B(!1),h=B(!1),f=B(null),g=at({issueRef:"",baseBranch:""});function b(R){switch(R){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(R){return R==="active"||R==="pending"}function E(R){try{const C=R.includes("T")||R.endsWith("Z")?R:R.replace(" ","T")+"Z";return new Date(C).toLocaleString()}catch{return R}}async function m(){s.value=!0,r.value=null;try{const R=`/api/squads/${t.squadSlug}/instances${i.value?"?include_completed=true":""}`,C=await xe(R);if(!C.ok)throw new Error(`HTTP ${C.status}`);const G=await C.json();n.value=G.instances??[]}catch(R){r.value=R instanceof Error?R.message:"Failed to load instances"}finally{s.value=!1}}async function x(R){const C=new Set(o.value);if(C.has(R)){C.delete(R),o.value=C;return}if(C.add(R),o.value=C,!a[R]){l[R]=!0;try{const G=await xe(`/api/squads/${t.squadSlug}/instances/${R}`);if(!G.ok)throw new Error(`HTTP ${G.status}`);const oe=await G.json();a[R]=oe.decisions??[]}catch{a[R]=[]}finally{l[R]=!1}}}async function k(R){c[R]="completing",u[R]=null;try{const C=await xe(`/api/squads/${t.squadSlug}/instances/${R}/complete`,{method:"POST"});if(!C.ok)throw new Error(`HTTP ${C.status}`);await m(),o.value.has(R)&&(delete a[R],await x(R))}catch(C){u[R]=C instanceof Error?C.message:"Complete failed"}finally{c[R]=null}}async function $(R){c[R]="aborting",u[R]=null;try{const C=await xe(`/api/squads/${t.squadSlug}/instances/${R}/abort`,{method:"POST"});if(!C.ok)throw new Error(`HTTP ${C.status}`);await m()}catch(C){u[R]=C instanceof Error?C.message:"Abort failed"}finally{c[R]=null}}async function D(){const R=g.issueRef.trim();if(R){h.value=!0,f.value=null;try{const C={issue_ref:R};g.baseBranch.trim()&&(C.base_branch=g.baseBranch.trim());const G=await xe(`/api/squads/${t.squadSlug}/instances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)});if(!G.ok){const oe=await G.json().catch(()=>({error:`HTTP ${G.status}`}));throw new Error(oe.error??`HTTP ${G.status}`)}g.issueRef="",g.baseBranch="",d.value=!1,await m()}catch(C){f.value=C instanceof Error?C.message:"Failed to create instance"}finally{h.value=!1}}}async function S(){i.value=!i.value,await m()}return mt(()=>t.squadSlug,()=>m()),nt(()=>m()),(R,C)=>(y(),w("div",d0,[p("div",h0,[C[4]||(C[4]=p("span",{class:"text-[11px] font-medium text-text-muted uppercase tracking-wider"},"Instances",-1)),p("div",f0,[p("button",{onClick:S,class:"text-[10px] text-text-muted hover:text-text transition-colors"},U(i.value?"Hide completed":"Show completed"),1),p("button",{onClick:C[0]||(C[0]=G=>d.value=!d.value),class:"text-[10px] text-accent-cyan hover:text-accent-cyan/80 transition-colors"},"+ New")])]),d.value?(y(),w("div",p0,[Ue(p("input",{"onUpdate:modelValue":C[1]||(C[1]=G=>g.issueRef=G),placeholder:"Issue ref (e.g. #42)",class:"w-full bg-bg-app border border-border rounded px-2.5 py-1.5 text-xs text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,g.issueRef]]),Ue(p("input",{"onUpdate:modelValue":C[2]||(C[2]=G=>g.baseBranch=G),placeholder:"Base branch (optional)",class:"w-full bg-bg-app border border-border rounded px-2.5 py-1.5 text-xs text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,g.baseBranch]]),p("div",g0,[p("button",{onClick:D,disabled:h.value,class:"text-[10px] px-2.5 py-1 rounded bg-accent-cyan/10 border border-accent-cyan/20 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-40 transition-colors"},"Create",8,m0),p("button",{onClick:C[3]||(C[3]=G=>d.value=!1),class:"text-[10px] text-text-muted hover:text-text"},"Cancel"),f.value?(y(),w("span",b0,U(f.value),1)):Q("",!0)])])):Q("",!0),s.value?(y(),w("div",v0,"Loading...")):r.value?(y(),w("div",y0,U(r.value),1)):n.value.length?(y(),w("div",w0,[(y(!0),w(be,null,Ne(n.value,G=>{var oe;return y(),w("div",{key:G.id,class:"bg-bg-elevated border border-border rounded-md px-3 py-2 space-y-1"},[p("div",x0,[p("div",E0,[p("span",{class:Te([b(G.status),"text-[9px] px-1.5 py-0.5 rounded border font-mono shrink-0"])},U(G.status),3),p("span",k0,U(G.issue_ref??G.id.slice(0,8)),1)]),p("div",S0,[T(G.status)?(y(),w("button",{key:0,onClick:L=>k(G.id),disabled:!!c[G.id],class:"text-[10px] text-accent-green hover:text-accent-green/80 disabled:opacity-40"},"Complete",8,T0)):Q("",!0),T(G.status)?(y(),w("button",{key:1,onClick:L=>$(G.id),disabled:!!c[G.id],class:"text-[10px] text-accent-red hover:text-accent-red/80 disabled:opacity-40"},"Abort",8,A0)):Q("",!0),p("button",{onClick:L=>x(G.id),class:"text-[10px] text-text-muted hover:text-text transition-colors"},U(o.value.has(G.id)?"▾":"▸")+" Decisions",9,R0)])]),p("p",C0,U(G.branch_name),1),p("p",O0,[on("Created "+U(E(G.created_at)),1),G.completed_at?(y(),w("span",$0," · Completed "+U(E(G.completed_at)),1)):Q("",!0)]),u[G.id]?(y(),w("p",N0,U(u[G.id]),1)):Q("",!0),o.value.has(G.id)?(y(),w("div",I0,[l[G.id]?(y(),w("p",P0,"Loading...")):(oe=a[G.id])!=null&&oe.length?(y(!0),w(be,{key:1},Ne(a[G.id],(L,N)=>(y(),w("div",{key:N,class:"text-[11px] bg-bg-card border border-border rounded p-2"},[p("p",L0,U(L.decision),1),L.context?(y(),w("p",M0,U(L.context),1)):Q("",!0)]))),128)):(y(),w("p",j0,"No decisions logged"))])):Q("",!0)])}),128))])):(y(),w("div",_0,"No instances"))]))}}),U0={class:"p-5 space-y-4"},B0={class:"flex items-center justify-between"},H0={key:0,class:"bg-bg-card border border-border rounded-lg p-4 space-y-3"},F0={class:"grid sm:grid-cols-3 gap-3"},V0={class:"flex items-center gap-3"},q0=["disabled"],K0={key:0,class:"text-xs text-accent-red"},W0={key:1,class:"py-12 text-center text-text-muted text-sm"},G0={key:2,class:"text-accent-red text-sm"},z0={key:3,class:"grid grid-cols-1 xl:grid-cols-2 gap-3"},J0=["onClick"],Z0={class:"w-8 h-8 rounded-md bg-accent-cyan/10 border border-accent-cyan/20 flex items-center justify-center shrink-0"},Y0={class:"text-accent-cyan font-mono font-bold text-sm"},X0={class:"flex-1 min-w-0"},Q0={class:"text-sm text-text font-medium truncate"},ew={class:"text-[11px] text-text-muted font-mono"},tw={class:"flex items-center gap-2"},nw={key:0,class:"text-[10px] text-accent-purple bg-accent-purple/10 px-1.5 py-0.5 rounded border border-accent-purple/20"},sw={key:0,class:"border-t border-border"},rw={key:0,class:"px-4 py-3 text-xs text-text-muted"},iw={key:1,class:"px-4 py-3 text-xs text-accent-red"},ow={key:2},aw={key:0,class:"divide-y divide-border"},lw={class:"flex items-center gap-2.5 min-w-0"},cw={class:"min-w-0"},uw={class:"text-xs text-text truncate"},dw={class:"text-[10px] text-text-muted truncate"},hw={class:"flex items-center gap-2 shrink-0"},fw=["onClick"],pw={key:1,class:"text-[10px] text-accent-cyan truncate max-w-[100px]"},gw=["onClick","disabled"],mw={key:1,class:"px-4 py-3 text-xs text-text-muted"},bw={class:"border-t border-border px-4 py-2.5 flex items-center justify-between"},vw=["onClick"],yw={class:"text-[10px] text-text-muted"},_w={key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4"},ww={class:"relative w-full max-w-3xl h-[70vh] bg-bg-surface border border-border rounded-xl flex flex-col overflow-hidden animate-fade-in"},xw={class:"h-11 shrink-0 border-b border-border flex items-center justify-between px-4 gap-4"},Ew={class:"min-w-0"},kw={class:"text-sm text-text font-medium truncate"},Sw={class:"text-[11px] text-text-muted truncate"},Tw={class:"flex items-center gap-3 shrink-0"},Aw={key:0,class:"text-accent-red"},Rw={class:"flex items-center justify-between gap-3"},Cw={class:"text-text-secondary truncate"},Ow={class:"text-text-muted shrink-0"},$w={key:0,class:"mt-2 text-[11px] text-text-muted whitespace-pre-wrap"},Nw={key:1,class:"text-text-muted"},Iw=Ge({__name:"SquadsView",setup(e){const t=new Set(["system"]),n={"a-team":"The A-Team",transformers:"Transformers",thundercats:"ThunderCats","gi-joe":"G.I. Joe",aliens:"Aliens",ghostbusters:"Ghostbusters"},s=B([]),r=B(!0),i=B(null),o=B(!1),a=B(!1),l=B(null),c=at({}),u=at({}),d=at({});function h(Y){return[...Y].sort((ce,ne)=>{const M=X=>X.is_lead?0:X.is_qa?1:2;return M(ce)-M(ne)})}const f=at({}),g=at({}),b=B(new Set),T=B(null),E=B([]),m=B(null),x=B(!1),k=B(!0),$=B(null);let D=null;const S=Oe(()=>m.value?"Disconnected":x.value?"Live":"Connecting…"),R=Oe(()=>E.value.filter(Y=>!(!Y.summary||t.has(Y.summary.kind)||Y.type==="assistant.message_delta"))),C=Y=>{try{return new Date(Y).toLocaleTimeString()}catch{return""}},G=Y=>{const ce=Y.data;if(!ce||typeof ce!="object")return"";if(typeof ce.deltaContent=="string")return ce.deltaContent;if(typeof ce.content=="string")return ce.content;if(typeof ce.text=="string")return ce.text;try{return JSON.stringify(ce,null,2)}catch{return String(ce)}},oe=()=>{At(()=>{const Y=$.value;Y&&(Y.scrollTop=Y.scrollHeight)})},L=async Y=>{if(!Y.currentTaskId)return;N(),T.value=Y,E.value=[],m.value=null,x.value=!1,k.value=!0;const ce=await di(`/api/tasks/${encodeURIComponent(Y.currentTaskId)}/events`),ne=new EventSource(ce);D=ne,ne.onopen=()=>{x.value=!0},ne.onmessage=M=>{try{const X=JSON.parse(M.data);E.value.push(X),oe()}catch{}},ne.onerror=()=>{x.value=!1,E.value.length===0&&(m.value="Connection error. Retrying…")}},N=()=>{if(D){try{D.close()}catch{}D=null}T.value=null,E.value=[],m.value=null,x.value=!1};Oo(()=>{N()});const P=async(Y,ce)=>{if(!b.value.has(ce)){b.value=new Set(b.value).add(ce);try{await xe(`/api/tasks/${encodeURIComponent(ce)}/cancel`,{method:"POST"}),await we(Y,!0)}catch(ne){g[Y]=ne instanceof Error?ne.message:"Failed to stop task"}finally{const ne=new Set(b.value);ne.delete(ce),b.value=ne}}},I=B({slug:"",name:"",projectPath:""}),A=Y=>Y?n[Y]??Y:"",j=Y=>new Date(Y).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}),q=Y=>!!c[Y],ae=async Y=>{c[Y]=!c[Y],c[Y]&&!d[Y]&&!f[Y]&&await we(Y)},pe=Y=>{u[Y]=!u[Y]},we=async(Y,ce=!1)=>{if(!(!ce&&f[Y])){f[Y]=!0,g[Y]=null;try{const ne=await xe(`/api/squads/${encodeURIComponent(Y)}/agents`);if(!ne.ok)throw new Error(`HTTP error! status: ${ne.status}`);const M=await ne.json();d[Y]=M.agents}catch(ne){g[Y]=ne instanceof Error?ne.message:"Failed to load agents"}finally{f[Y]=!1}}},V=async()=>{try{const Y=await xe("/api/squads");if(!Y.ok)throw new Error(`HTTP error! status: ${Y.status}`);const ce=await Y.json();s.value=ce.squads}catch(Y){i.value=Y instanceof Error?Y.message:"Failed to load squads"}finally{r.value=!1}},le=async()=>{if(!I.value.slug||!I.value.name||!I.value.projectPath){l.value="All fields are required";return}a.value=!0,l.value=null;try{const Y=await xe("/api/squads",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:I.value.slug,name:I.value.name,projectPath:I.value.projectPath})});if(!Y.ok)throw new Error(`HTTP error! status: ${Y.status}`);I.value={slug:"",name:"",projectPath:""},o.value=!1,await V()}catch(Y){l.value=Y instanceof Error?Y.message:"Failed to create squad"}finally{a.value=!1}};return nt(()=>{V()}),(Y,ce)=>(y(),w("div",U0,[p("div",B0,[ce[5]||(ce[5]=p("h1",{class:"text-base font-semibold text-text"},"Squads",-1)),p("button",{onClick:ce[0]||(ce[0]=ne=>o.value=!o.value),class:"text-xs px-2.5 py-1 rounded-md border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/10 transition-colors"},U(o.value?"Cancel":"+ New squad"),1)]),o.value?(y(),w("div",H0,[p("div",F0,[Ue(p("input",{"onUpdate:modelValue":ce[1]||(ce[1]=ne=>I.value.slug=ne),placeholder:"slug",class:"bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,I.value.slug]]),Ue(p("input",{"onUpdate:modelValue":ce[2]||(ce[2]=ne=>I.value.name=ne),placeholder:"Display name",class:"bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,I.value.name]]),Ue(p("input",{"onUpdate:modelValue":ce[3]||(ce[3]=ne=>I.value.projectPath=ne),placeholder:"/path/to/project",class:"bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,512),[[Ve,I.value.projectPath]])]),p("div",V0,[p("button",{onClick:le,disabled:a.value,class:"text-xs px-3 py-1.5 rounded-md bg-accent-cyan/10 border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-50 transition-colors"},U(a.value?"Creating...":"Create"),9,q0),l.value?(y(),w("span",K0,U(l.value),1)):Q("",!0)])])):Q("",!0),r.value?(y(),w("div",W0,"Loading...")):i.value?(y(),w("div",G0,U(i.value),1)):(y(),w("div",z0,[(y(!0),w(be,null,Ne(s.value,ne=>(y(),w("div",{key:ne.slug,class:"bg-bg-card border border-border rounded-lg overflow-hidden"},[p("button",{onClick:M=>ae(ne.slug),class:"w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-bg-elevated/50 transition-colors"},[p("div",Z0,[p("span",Y0,U(ne.slug.charAt(0).toUpperCase()),1)]),p("div",X0,[p("p",Q0,U(ne.name),1),p("p",ew,U(ne.slug),1)]),p("div",tw,[ne.universe?(y(),w("span",nw,U(A(ne.universe)),1)):Q("",!0),(y(),w("svg",{class:Te([q(ne.slug)?"rotate-90":"","w-4 h-4 text-text-muted transition-transform shrink-0"]),viewBox:"0 0 20 20",fill:"currentColor"},[...ce[6]||(ce[6]=[p("path",{"fill-rule":"evenodd",d:"M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z","clip-rule":"evenodd"},null,-1)])],2))])],8,J0),q(ne.slug)?(y(),w("div",sw,[f[ne.slug]?(y(),w("div",rw,"Loading agents...")):g[ne.slug]?(y(),w("div",iw,U(g[ne.slug]),1)):(y(),w("div",ow,[(d[ne.slug]??[]).length?(y(),w("div",aw,[(y(!0),w(be,null,Ne(h(d[ne.slug]??[]),M=>(y(),w("div",{key:`${ne.slug}-${M.character_name}-${M.role_title}`,class:"px-4 py-2 flex items-center justify-between gap-3"},[p("div",lw,[p("span",{class:Te(["w-1.5 h-1.5 rounded-full shrink-0",M.status==="working"?"bg-accent-cyan animate-pulse":M.status==="error"?"bg-accent-red":"bg-text-muted/40"])},null,2),p("div",cw,[p("p",uw,U(M.character_name),1),p("p",dw,U(M.role_title),1)])]),p("div",hw,[M.currentTaskId?(y(),w("button",{key:0,onClick:en(X=>L(M),["stop"]),class:"text-[10px] text-text-muted hover:text-text transition-colors"},"View",8,fw)):Q("",!0),M.currentTask?(y(),w("span",pw,U(M.currentTask),1)):Q("",!0),M.currentTaskId?(y(),w("button",{key:2,onClick:en(X=>P(ne.slug,M.currentTaskId),["stop"]),disabled:b.value.has(M.currentTaskId),class:"text-[10px] text-accent-red hover:text-accent-red/80 disabled:opacity-40"},"Stop",8,gw)):Q("",!0)])]))),128))])):(y(),w("div",mw,"No agents"))])),p("div",bw,[p("button",{onClick:en(M=>pe(ne.slug),["stop"]),class:"text-[11px] text-text-muted hover:text-text transition-colors"},U(u[ne.slug]?"▾ Instances":"▸ Instances"),9,vw),p("span",yw,"Created "+U(j(ne.created_at)),1)]),u[ne.slug]?(y(),rn(D0,{key:3,"squad-slug":ne.slug,class:"border-t border-border"},null,8,["squad-slug"])):Q("",!0)])):Q("",!0)]))),128))])),(y(),rn(Co,{to:"body"},[T.value?(y(),w("div",_w,[p("div",{class:"absolute inset-0 bg-black/50",onClick:N}),p("div",ww,[p("div",xw,[p("div",Ew,[p("p",kw,U(T.value.character_name),1),p("p",Sw,U(T.value.role_title),1)]),p("div",Tw,[p("button",{onClick:ce[4]||(ce[4]=ne=>k.value=!k.value),class:"text-[11px] text-text-muted hover:text-text transition-colors"},U(k.value?"Show all events":"Show summary"),1),p("span",{class:Te(["text-[11px]",x.value?"text-accent-cyan":"text-text-muted"])},U(S.value),3),p("button",{onClick:N,class:"w-7 h-7 flex items-center justify-center rounded-md text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},[...ce[7]||(ce[7]=[p("svg",{class:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor"},[p("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)])])])]),p("div",{ref_key:"previewScrollEl",ref:$,class:"flex-1 overflow-y-auto p-4 space-y-2 font-mono text-xs"},[m.value?(y(),w("p",Aw,U(m.value),1)):Q("",!0),(y(!0),w(be,null,Ne(k.value?R.value:E.value,(ne,M)=>(y(),w("div",{key:M,class:"bg-bg-card border border-border rounded-lg px-3 py-2"},[p("div",Rw,[p("span",Cw,U(ne.summary.summary),1),p("span",Ow,U(C(ne.ts)),1)]),G(ne).trim()?(y(),w("pre",$w,U(G(ne)),1)):Q("",!0)]))),128)),!(k.value?R.value:E.value).length&&!m.value?(y(),w("p",Nw,"Waiting for activity...")):Q("",!0)],512)])])):Q("",!0)]))]))}}),Pw={class:"h-full p-5"},Lw={class:"h-full flex overflow-hidden bg-bg-card border border-border rounded-lg"},Mw={class:"w-72 shrink-0 bg-bg-surface border-r border-border flex flex-col overflow-hidden"},jw={class:"px-4 h-11 border-b border-border flex items-center justify-between shrink-0"},Dw={key:0,class:"flex items-center gap-1.5 text-[11px] text-accent-cyan"},Uw={class:"flex-1 overflow-y-auto"},Bw={key:0,class:"p-4 text-text-muted text-xs text-center"},Hw=["onClick"],Fw={key:0,class:"absolute left-0 top-0 h-full w-[3px] bg-accent-cyan rounded-r"},Vw={class:"flex items-center justify-between mb-1 gap-2"},qw={class:"text-[10px] text-text-muted font-mono shrink-0"},Kw={class:"text-xs text-text truncate"},Ww={class:"text-[10px] text-text-muted font-mono truncate mt-0.5"},Gw={key:1,class:"p-4 text-text-muted text-xs text-center"},zw={class:"flex-1 flex flex-col overflow-hidden"},Jw={key:0,class:"flex-1 flex items-center justify-center text-text-muted text-sm"},Zw={class:"h-11 shrink-0 border-b border-border flex items-center justify-between px-4 gap-4"},Yw={class:"flex items-center gap-2 min-w-0"},Xw={key:1,class:"text-[11px] text-text-muted font-mono shrink-0"},Qw={class:"text-sm text-text truncate"},ex={class:"flex items-center gap-2 shrink-0"},tx=["disabled"],nx={class:"flex-1 overflow-y-auto p-4 space-y-4"},sx={key:0,class:"text-text-muted text-xs text-center py-4"},rx={key:1,class:"text-accent-red text-xs"},ix={class:"flex items-center gap-2"},ox={class:"flex items-center gap-1.5 text-[11px] text-text-muted cursor-pointer"},ax={key:0,class:"text-[11px] text-text-muted font-mono"},lx={key:2,class:"text-text-muted text-xs text-center py-4"},cx={key:3,class:"space-y-1"},ux=["onClick"],dx={class:"flex items-start gap-2"},hx={class:"text-base shrink-0 mt-0.5"},fx={class:"flex-1 min-w-0"},px={class:"flex items-center gap-2"},gx={class:"text-[10px] text-text-muted font-mono shrink-0"},mx={key:0,class:"mt-1.5 text-[11px] text-text-secondary font-mono whitespace-pre-wrap border-t border-border pt-1.5 max-h-40 overflow-y-auto"},bx={key:0,class:"text-text-muted text-xs text-center py-4"},vx={key:4,class:"bg-bg-card border border-border rounded-lg p-4"},yx=["innerHTML"],_x=Ge({__name:"AgentActivityView",setup(e){const t=B([]),n=Oe(()=>t.value.filter(V=>V.status!=="idle")),s=B([]),r=B(!0),i=B(null),o=B(new Set),a=B(null),l=B(null),c=B(!1),u=B(null),d=B([]),h=B(!1),f=B(!1),g=B(new Set),b=Oe(()=>f.value?d.value:d.value.filter(V=>!(V.rawType==="assistant.message"&&(!V.detail||!V.detail.trim())||V.rawType.includes("tool.execution_complete")&&V.status==="success")));let T=null,E=null,m=null;const x=V=>{if(!V)return"";const le=V.includes("T")?V:V.replace(" ","T")+"Z",Y=new Date(le);return Number.isNaN(Y.getTime())?V:Y.toLocaleString()},k=V=>{switch(V){case"running":return"bg-accent-cyan/10 text-accent-cyan border-accent-cyan/30";case"done":return"bg-emerald-500/10 text-emerald-400 border-emerald-500/30";case"failed":return"bg-red-500/10 text-red-400 border-red-500/30";case"cancelled":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-bg-elevated text-text-muted border-border"}},$=V=>{if(!V)return"";const le=V.includes("T")?V:V.replace(" ","T")+"Z",Y=new Date(le);return Number.isNaN(Y.getTime())?V:Y.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})},D=Oe(()=>{if(!l.value)return null;const V=l.value.started_at,le=l.value.completed_at;if(!V||!le)return null;const Y=new Date(V.includes("T")?V:V.replace(" ","T")+"Z").getTime(),ce=new Date(le.includes("T")?le:le.replace(" ","T")+"Z").getTime();if(Number.isNaN(Y)||Number.isNaN(ce))return null;const ne=Math.max(0,Math.round((ce-Y)/1e3));if(ne<60)return`${ne}s`;const M=Math.floor(ne/60),X=ne%60;return`${M}m ${X}s`}),S=async V=>{if(!o.value.has(V)){o.value=new Set(o.value).add(V);try{await xe(`/api/tasks/${encodeURIComponent(V)}/cancel`,{method:"POST"}),await G(),a.value===V&&await oe(V)}catch(le){i.value=le instanceof Error?le.message:"Failed to stop task"}finally{const le=new Set(o.value);le.delete(V),o.value=le}}},R=async()=>{try{const V=await xe("/api/agents");if(!V.ok)throw new Error(`HTTP error! status: ${V.status}`);const le=await V.json();t.value=le.agents}catch(V){i.value=V instanceof Error?V.message:"Failed to load agents"}},C=async()=>{try{const V=await xe("/api/tasks?limit=50");if(!V.ok)throw new Error(`HTTP error! status: ${V.status}`);const le=await V.json();s.value=le.tasks}catch(V){i.value=V instanceof Error?V.message:"Failed to load tasks"}},G=async()=>{r.value=!0,i.value=null;try{await Promise.all([R(),C()])}finally{r.value=!1}},oe=async V=>{c.value=!0,u.value=null;try{const le=await xe(`/api/tasks/${encodeURIComponent(V)}`);if(!le.ok)throw new Error(`HTTP error! status: ${le.status}`);const Y=await le.json();l.value=Y.task}catch(le){u.value=le instanceof Error?le.message:"Failed to load task",l.value=null}finally{c.value=!1}},L=V=>{if(!V)return"";const le=new Date(V);return Number.isNaN(le.getTime())?"":le.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})},N=V=>{if(V.status==="success")return"text-emerald-300";if(V.status==="error")return"text-red-300";if(V.status==="pending")return"text-accent";switch(V.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"}},P=V=>{if(f.value)return;const le=new Set(g.value);le.has(V)?le.delete(V):le.add(V),g.value=le},I=async(V,le={})=>{le.initial&&(h.value=!0);try{const Y=await xe(`/api/tasks/${encodeURIComponent(V)}/activity`);if(!Y.ok)return;const ce=await Y.json();d.value=ce.activity??[]}catch{}finally{le.initial&&(h.value=!1)}},A=V=>{E||(E=setTimeout(()=>{E=null,a.value===V&&I(V)},250))},j=async V=>{q(),I(V,{initial:!0});try{T=new EventSource(await di(`/api/tasks/${encodeURIComponent(V)}/events`)),T.onmessage=()=>{A(V)},T.onerror=()=>{}}catch{T=null}},q=()=>{T&&(T.close(),T=null),E&&(clearTimeout(E),E=null)},ae=V=>{a.value=V,l.value=null,d.value=[],g.value=new Set,oe(V),j(V)},pe=()=>{a.value=null,l.value=null,u.value=null,d.value=[],g.value=new Set,q()},we=V=>{V.key==="Escape"&&a.value&&pe()};return mt(a,V=>{V?document.addEventListener("keydown",we):document.removeEventListener("keydown",we)}),nt(()=>{G(),m=setInterval(G,5e3)}),mt(()=>{var V;return(V=l.value)==null?void 0:V.status},V=>{V&&V!=="running"&&(a.value&&I(a.value),q())}),fs(()=>{m&&clearInterval(m),document.removeEventListener("keydown",we),q()}),(V,le)=>{var Y,ce,ne,M;return y(),w("div",Pw,[p("div",Lw,[p("div",Mw,[p("div",jw,[le[3]||(le[3]=p("span",{class:"text-sm font-medium text-text"},"Activity",-1)),n.value.length?(y(),w("span",Dw,[le[2]||(le[2]=p("span",{class:"w-1.5 h-1.5 rounded-full bg-accent-cyan animate-pulse"},null,-1)),on(U(n.value.length)+" active",1)])):Q("",!0)]),p("div",Uw,[r.value&&!s.value.length?(y(),w("div",Bw,"Loading...")):Q("",!0),(y(!0),w(be,null,Ne(s.value,X=>(y(),w("button",{key:X.task_id,onClick:se=>ae(X.task_id),class:Te(["w-full text-left px-4 py-3 border-b border-border transition-colors hover:bg-bg-elevated/50 relative",a.value===X.task_id?"bg-bg-elevated":""])},[a.value===X.task_id?(y(),w("span",Fw)):Q("",!0),p("div",Vw,[p("span",{class:Te([k(X.status),"text-[9px] px-1.5 py-0.5 rounded-sm font-mono border"])},U(X.status),3),p("span",qw,U($(X.started_at)),1)]),p("p",Kw,U(X.description),1),p("p",Ww,U(X.agent_slug),1)],10,Hw))),128)),!r.value&&!s.value.length?(y(),w("div",Gw,"No tasks")):Q("",!0)])]),p("div",zw,[a.value?(y(),w(be,{key:1},[p("div",Zw,[p("div",Yw,[l.value?(y(),w("span",{key:0,class:Te([k(l.value.status),"text-[9px] px-1.5 py-0.5 rounded-sm font-mono border shrink-0"])},U(l.value.status),3)):Q("",!0),D.value?(y(),w("span",Xw,U(D.value),1)):Q("",!0),p("span",Qw,U(((Y=l.value)==null?void 0:Y.description)??"..."),1)]),p("div",ex,[((ce=l.value)==null?void 0:ce.status)==="running"?(y(),w("button",{key:0,onClick:le[0]||(le[0]=X=>S(l.value.task_id)),disabled:o.value.has(l.value.task_id),class:"text-[11px] px-2 py-1 rounded border border-accent-red/30 text-accent-red hover:bg-accent-red/10 disabled:opacity-40 transition-colors"},"Cancel",8,tx)):Q("",!0),p("button",{onClick:pe,class:"w-7 h-7 flex items-center justify-center rounded-md text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},[...le[4]||(le[4]=[p("svg",{class:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor"},[p("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)])])])]),p("div",nx,[c.value?(y(),w("div",sx,"Loading task details...")):u.value?(y(),w("div",rx,U(u.value),1)):Q("",!0),p("div",ix,[p("label",ox,[Ue(p("input",{"onUpdate:modelValue":le[1]||(le[1]=X=>f.value=X),type:"checkbox",class:"w-3 h-3 accent-accent-cyan rounded"},null,512),[[Qf,f.value]]),le[5]||(le[5]=on("Show all events",-1))]),(ne=l.value)!=null&&ne.completed_at?(y(),w("span",ax,"Completed "+U(x(l.value.completed_at)),1)):Q("",!0)]),h.value?(y(),w("div",lx,"Loading activity...")):(y(),w("div",cx,[(y(!0),w(be,null,Ne(b.value,(X,se)=>(y(),w("div",{key:se,onClick:fe=>P(se),class:"rounded-md px-3 py-2 bg-bg-card border border-border hover:border-border-bright transition-colors cursor-pointer"},[p("div",dx,[p("span",hx,U(X.icon),1),p("div",fx,[p("div",px,[p("span",{class:Te([N(X),"text-xs flex-1 truncate"])},U(X.summary),3),p("span",gx,U(L(X.ts)),1)]),(f.value||g.value.has(se))&&X.detail?(y(),w("div",mx,U(X.detail),1)):Q("",!0)])])],8,ux))),128)),b.value.length?Q("",!0):(y(),w("div",bx,"No activity"))])),(M=l.value)!=null&&M.result?(y(),w("div",vx,[le[6]||(le[6]=p("p",{class:"text-[11px] text-text-muted uppercase tracking-wider mb-2"},"Result",-1)),p("div",{class:"wiki-content text-sm",innerHTML:De(gs)(l.value.result)},null,8,yx)])):Q("",!0)])],64)):(y(),w("div",Jw,"Select a task to view activity"))])])])}}}),wx={class:"p-5 space-y-5"},xx={key:0,class:"py-12 text-center text-text-muted text-sm"},Ex={key:1,class:"text-accent-red text-sm"},kx={key:0,class:"space-y-2"},Sx={class:"flex items-start justify-between gap-3"},Tx={class:"flex items-center gap-2.5 min-w-0"},Ax={class:"min-w-0"},Rx={class:"text-sm text-text font-medium truncate"},Cx={class:"flex items-center gap-2 mt-0.5"},Ox={class:"text-[10px] font-mono text-accent-cyan bg-accent-cyan/10 px-1.5 py-0.5 rounded"},$x={key:0,class:"flex items-center gap-3 text-[11px] text-text-muted flex-wrap"},Nx={key:0},Ix={key:1},Px=["onClick"],Lx={key:0,class:"mt-2 text-[11px] font-mono text-text-secondary bg-bg-elevated border border-border rounded p-3 whitespace-pre-wrap max-h-28 overflow-y-auto"},Mx={class:"flex items-center gap-2 flex-wrap"},jx=["onClick","disabled"],Dx=["onClick","disabled"],Ux=["onClick","disabled"],Bx=["onClick"],Hx={key:1,class:"border-t border-border pt-3 space-y-1"},Fx={key:0,class:"text-[11px] text-text-muted"},Vx={key:1,class:"text-[11px] text-text-muted"},qx={class:"text-text-muted"},Kx={key:0,class:"text-accent-red truncate"},Wx={key:1,class:"space-y-2"},Gx={class:"flex items-start justify-between gap-3"},zx={class:"flex items-center gap-2.5 min-w-0"},Jx={class:"min-w-0"},Zx={class:"text-sm text-text font-medium truncate"},Yx={class:"flex items-center gap-2 mt-0.5 flex-wrap"},Xx={class:"text-[10px] font-mono text-accent-cyan bg-accent-cyan/10 px-1.5 py-0.5 rounded"},Qx={class:"text-[10px] font-mono text-accent-purple bg-accent-purple/10 px-1.5 py-0.5 rounded border border-accent-purple/20"},e1={key:0,class:"flex items-center gap-3 text-[11px] text-text-muted flex-wrap"},t1={key:0},n1={key:1},s1=["onClick"],r1={key:0,class:"mt-2 text-[11px] font-mono text-text-secondary bg-bg-elevated border border-border rounded p-3 whitespace-pre-wrap max-h-28 overflow-y-auto"},i1={class:"flex items-center gap-2 flex-wrap"},o1=["onClick","disabled"],a1=["onClick","disabled"],l1=["onClick","disabled"],c1=["onClick"],u1={key:1,class:"border-t border-border pt-3 space-y-1"},d1={key:0,class:"text-[11px] text-text-muted"},h1={key:1,class:"text-[11px] text-text-muted"},f1={class:"text-text-muted"},p1={key:0,class:"text-accent-red truncate"},g1={key:2,class:"py-12 text-center text-text-muted text-sm"},m1=Ge({__name:"SchedulesView",setup(e){const t=B([]),n=B([]),s=B(!0),r=B(null),i=B(new Set),o=B(new Map),a=B(new Map),l=B(new Set),c=B(new Set);function u($){const D=$.includes("T")||$.endsWith("Z")?$:$.replace(" ","T")+"Z";return new Date(D).toLocaleString()}function d($){return $==="done"?"bg-emerald-400":$==="failed"?"bg-red-400":"bg-accent animate-pulse"}function h($){return $==="done"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":$==="failed"?"bg-red-500/10 text-red-400 border-red-500/20":"bg-accent/10 text-accent border-accent/20"}function f($,D){const S=`${$}-${D}`,R=new Set(c.value);R.has(S)?R.delete(S):R.add(S),c.value=R}async function g($,D){const S=`${$}-${D}`,R=o.value.get(S)??!1,C=new Map(o.value);if(C.set(S,!R),o.value=C,!R&&!a.value.has(S)){const G=new Set(l.value);G.add(S),l.value=G;try{const oe=await xe(`/api/schedules/${$}/${D}/runs?limit=25`);if(oe.ok){const L=await oe.json(),N=new Map(a.value);N.set(S,L.runs??[]),a.value=N}}catch{}finally{const oe=new Set(l.value);oe.delete(S),l.value=oe}}}async function b(){s.value=!0,r.value=null,a.value=new Map;try{const $=await xe("/api/schedules");if(!$.ok)throw new Error(`HTTP ${$.status}`);const D=await $.json();t.value=D.io,n.value=D.squads}catch($){r.value=$ instanceof Error?$.message:"Failed to load schedules"}finally{s.value=!1}}async function T($,D){if(!i.value.has($)){i.value=new Set(i.value).add($);try{await D(),await b()}catch(S){r.value=S instanceof Error?S.message:"Action failed"}finally{const S=new Set(i.value);S.delete($),i.value=S}}}async function E($,D){await T(`${$}-${D}`,async()=>{const S=await xe(`/api/schedules/${$}/${D}/pause`,{method:"POST"});if(!S.ok)throw new Error(`HTTP ${S.status}`)})}async function m($,D){await T(`${$}-${D}`,async()=>{const S=await xe(`/api/schedules/${$}/${D}/resume`,{method:"POST"});if(!S.ok)throw new Error(`HTTP ${S.status}`)})}async function x($,D){await T(`${$}-${D}`,async()=>{const S=await xe(`/api/schedules/${$}/${D}/run-now`,{method:"POST"});if(!S.ok)throw new Error(`HTTP ${S.status}`)})}async function k($,D,S){window.confirm(`Delete schedule '${S}'?`)&&await T(`${$}-${D}`,async()=>{const R=await xe(`/api/schedules/${$}/${D}`,{method:"DELETE"});if(!R.ok)throw new Error(`HTTP ${R.status}`)})}return nt(b),($,D)=>(y(),w("div",wx,[D[2]||(D[2]=p("h1",{class:"text-base font-semibold text-text"},"Schedules",-1)),s.value?(y(),w("div",xx,"Loading...")):r.value?(y(),w("div",Ex,U(r.value),1)):(y(),w(be,{key:2},[t.value.length?(y(),w("section",kx,[D[0]||(D[0]=p("h2",{class:"text-[11px] text-text-muted uppercase tracking-wider font-medium"},"IO Schedules",-1)),(y(!0),w(be,null,Ne(t.value,S=>(y(),w("div",{key:S.id,class:"bg-bg-card border border-border rounded-lg p-4 space-y-3"},[p("div",Sx,[p("div",Tx,[p("span",{class:Te([S.enabled?"bg-accent-green":"bg-text-muted/40","w-2 h-2 rounded-full shrink-0 mt-0.5"])},null,2),p("div",Ax,[p("p",Rx,U(S.name),1),p("div",Cx,[p("code",Ox,U(S.cron_expr),1)])])])]),S.last_run_at||S.next_run_at?(y(),w("div",$x,[S.last_run_at?(y(),w("span",Nx,"Last: "+U(u(S.last_run_at)),1)):Q("",!0),S.next_run_at?(y(),w("span",Ix,"Next: "+U(u(S.next_run_at)),1)):Q("",!0)])):Q("",!0),p("div",null,[p("button",{onClick:R=>f("io",S.id),class:"text-[11px] text-text-muted hover:text-text transition-colors"},U(c.value.has(`io-${S.id}`)?"▾ Hide prompt":"▸ Show prompt"),9,Px),c.value.has(`io-${S.id}`)?(y(),w("pre",Lx,U(S.prompt),1)):Q("",!0)]),p("div",Mx,[p("button",{onClick:R=>x("io",S.id),disabled:i.value.has(`io-${S.id}`),class:"text-[11px] px-2.5 py-1 rounded-md border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/10 disabled:opacity-40 transition-colors"},"Run now",8,jx),p("button",{onClick:R=>S.enabled?E("io",S.id):m("io",S.id),disabled:i.value.has(`io-${S.id}`),class:"text-[11px] px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated disabled:opacity-40 transition-colors"},U(S.enabled?"Pause":"Resume"),9,Dx),p("button",{onClick:R=>k("io",S.id,S.name),disabled:i.value.has(`io-${S.id}`),class:"text-[11px] px-2.5 py-1 rounded-md border border-accent-red/30 text-accent-red hover:bg-accent-red/10 disabled:opacity-40 transition-colors"},"Delete",8,Ux),p("button",{onClick:R=>g("io",S.id),class:"text-[11px] px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},"History",8,Bx)]),o.value.get(`io-${S.id}`)?(y(),w("div",Hx,[l.value.has(`io-${S.id}`)?(y(),w("p",Fx,"Loading...")):(a.value.get(`io-${S.id}`)??[]).length?(y(!0),w(be,{key:2},Ne(a.value.get(`io-${S.id}`)??[],R=>(y(),w("div",{key:R.id,class:"flex items-center gap-2 text-[11px]"},[p("span",{class:Te([d(R.status),"w-1.5 h-1.5 rounded-full shrink-0"])},null,2),p("span",{class:Te([h(R.status),"font-mono px-1.5 py-0.5 rounded border"])},U(R.status),3),p("span",qx,U(u(R.started_at)),1),R.error_text?(y(),w("span",Kx,U(R.error_text),1)):Q("",!0)]))),128)):(y(),w("p",Vx,"No runs recorded"))])):Q("",!0)]))),128))])):Q("",!0),n.value.length?(y(),w("section",Wx,[D[1]||(D[1]=p("h2",{class:"text-[11px] text-text-muted uppercase tracking-wider font-medium"},"Squad Schedules",-1)),(y(!0),w(be,null,Ne(n.value,S=>(y(),w("div",{key:S.id,class:"bg-bg-card border border-border rounded-lg p-4 space-y-3"},[p("div",Gx,[p("div",zx,[p("span",{class:Te([S.enabled?"bg-accent-green":"bg-text-muted/40","w-2 h-2 rounded-full shrink-0 mt-0.5"])},null,2),p("div",Jx,[p("p",Zx,U(S.name),1),p("div",Yx,[p("code",Xx,U(S.cron_expr),1),p("span",Qx,U(S.squad_slug),1)])])])]),S.last_run_at||S.next_run_at?(y(),w("div",e1,[S.last_run_at?(y(),w("span",t1,"Last: "+U(u(S.last_run_at)),1)):Q("",!0),S.next_run_at?(y(),w("span",n1,"Next: "+U(u(S.next_run_at)),1)):Q("",!0)])):Q("",!0),p("div",null,[p("button",{onClick:R=>f("squads",S.id),class:"text-[11px] text-text-muted hover:text-text transition-colors"},U(c.value.has(`squads-${S.id}`)?"▾ Hide prompt":"▸ Show prompt"),9,s1),c.value.has(`squads-${S.id}`)?(y(),w("pre",r1,U(S.prompt),1)):Q("",!0)]),p("div",i1,[p("button",{onClick:R=>x("squads",S.id),disabled:i.value.has(`squads-${S.id}`),class:"text-[11px] px-2.5 py-1 rounded-md border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/10 disabled:opacity-40 transition-colors"},"Run now",8,o1),p("button",{onClick:R=>S.enabled?E("squads",S.id):m("squads",S.id),disabled:i.value.has(`squads-${S.id}`),class:"text-[11px] px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated disabled:opacity-40 transition-colors"},U(S.enabled?"Pause":"Resume"),9,a1),p("button",{onClick:R=>k("squads",S.id,S.name),disabled:i.value.has(`squads-${S.id}`),class:"text-[11px] px-2.5 py-1 rounded-md border border-accent-red/30 text-accent-red hover:bg-accent-red/10 disabled:opacity-40 transition-colors"},"Delete",8,l1),p("button",{onClick:R=>g("squads",S.id),class:"text-[11px] px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},"History",8,c1)]),o.value.get(`squads-${S.id}`)?(y(),w("div",u1,[l.value.has(`squads-${S.id}`)?(y(),w("p",d1,"Loading...")):(a.value.get(`squads-${S.id}`)??[]).length?(y(!0),w(be,{key:2},Ne(a.value.get(`squads-${S.id}`)??[],R=>(y(),w("div",{key:R.id,class:"flex items-center gap-2 text-[11px]"},[p("span",{class:Te([d(R.status),"w-1.5 h-1.5 rounded-full shrink-0"])},null,2),p("span",{class:Te([h(R.status),"font-mono px-1.5 py-0.5 rounded border"])},U(R.status),3),p("span",f1,U(u(R.started_at)),1),R.error_text?(y(),w("span",p1,U(R.error_text),1)):Q("",!0)]))),128)):(y(),w("p",h1,"No runs recorded"))])):Q("",!0)]))),128))])):Q("",!0),!t.value.length&&!n.value.length?(y(),w("p",g1,"No schedules configured")):Q("",!0)],64))]))}}),b1={class:"group flex items-start gap-3 bg-bg-card border border-border rounded-lg px-3.5 py-2.5 hover:border-border-bright transition-colors"},v1=["checked"],y1={class:"flex-1 min-w-0"},_1={class:"flex items-center justify-between gap-2"},w1={class:"text-sm text-text truncate font-medium"},x1={class:"text-[11px] text-text-muted shrink-0 font-mono"},E1={key:0,class:"text-xs text-text-muted mt-0.5 truncate"},k1={key:0,class:"mt-2 pt-2 border-t border-border text-sm text-text-secondary whitespace-pre-wrap"},S1={class:"shrink-0 flex items-center gap-2 mt-0.5"},T1=["disabled"],ql=Ge({__name:"FeedEntryCard",props:{entry:{},selectMode:{type:Boolean},selected:{type:Boolean},expanded:{type:Boolean},unread:{type:Boolean},deleting:{type:Boolean}},emits:["select","expand","delete","read"],setup(e){function t(n){if(!n)return"";const s=n.includes("T")?n:n.replace(" ","T")+"Z",r=new Date(s);return Number.isNaN(r.getTime())?n:r.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}return(n,s)=>(y(),w("div",b1,[e.selectMode?(y(),w("input",{key:0,type:"checkbox",checked:e.selected,onChange:s[0]||(s[0]=r=>n.$emit("select")),class:"mt-0.5 shrink-0 w-3.5 h-3.5 accent-accent-cyan rounded"},null,40,v1)):(y(),w("span",{key:1,class:Te(["mt-1.5 shrink-0 w-1.5 h-1.5 rounded-full",e.unread?e.entry.type==="inbox"?"bg-accent-cyan":"bg-accent-purple":"bg-text-muted/40"])},null,2)),p("div",y1,[p("button",{onClick:s[1]||(s[1]=r=>n.$emit("expand")),class:"w-full text-left"},[p("div",_1,[p("span",w1,U(e.entry.title),1),p("span",x1,U(t(e.entry.created_at)),1)]),!e.expanded&&e.entry.body?(y(),w("p",E1,U(e.entry.body),1)):Q("",!0)]),e.expanded?(y(),w("div",k1,U(e.entry.body),1)):Q("",!0)]),p("div",S1,[e.unread?(y(),w("button",{key:0,onClick:s[2]||(s[2]=r=>n.$emit("read")),class:"opacity-0 group-hover:opacity-100 text-[10px] text-text-muted hover:text-accent-cyan transition-all"},"Read")):Q("",!0),p("button",{onClick:s[3]||(s[3]=r=>n.$emit("delete")),disabled:e.deleting,class:"opacity-0 group-hover:opacity-100 text-text-muted hover:text-accent-red disabled:opacity-30 transition-all"},[...s[4]||(s[4]=[p("svg",{class:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor"},[p("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,T1)])]))}}),A1={class:"p-5 space-y-4"},R1={class:"flex items-center justify-between gap-3"},C1={class:"flex items-center gap-2 flex-wrap justify-end"},O1={class:"relative"},$1={key:0,class:"flex items-center justify-between gap-2 bg-bg-card border border-border rounded-lg px-3 py-2"},N1={class:"flex items-center gap-2 text-xs text-text-muted"},I1={class:"flex items-center gap-2"},P1=["disabled"],L1=["disabled"],M1={key:1,class:"py-12 text-center text-text-muted text-sm"},j1={key:2,class:"text-accent-red text-sm"},D1=["onClick"],U1={class:"font-mono text-text-secondary"},B1={class:"text-text-muted"},H1={key:0,class:"pl-5 space-y-1"},F1={key:0,class:"py-12 text-center text-text-muted text-sm"},V1={class:"space-y-1"},q1={key:0,class:"py-12 text-center text-text-muted text-sm"},K1=Ge({__name:"FeedView",setup(e){const t=B([]),n=B(!0),s=B(new Set),r=B(new Set),i=B(null),o=B("");let a=null;const l=B(!1),c=B(new Set),u=B(!1),d=B(new Set),h=B(!1);function f(L){const N=L.match(/^\[([^\]]+)\]/);return N?N[1]:null}const g=Oe(()=>t.value),b=Oe(()=>{const L=new Map;for(const P of g.value){const I=f(P.title)??"__ungrouped__";L.has(I)||L.set(I,[]),L.get(I).push(P)}const N=[];for(const[P,I]of L)N.push({key:P,label:P==="__ungrouped__"?"Ungrouped":P,entries:I});return N.sort((P,I)=>P.key==="__ungrouped__"?1:I.key==="__ungrouped__"?-1:P.key.localeCompare(I.key)),N}),T=Oe(()=>g.value.length>0&&g.value.every(L=>d.value.has(L.id)));function E(L){const N=new Set(s.value);N.has(L)?N.delete(L):N.add(L),s.value=N}function m(){u.value=!u.value,u.value||(d.value=new Set)}function x(L){const N=new Set(d.value);N.has(L)?N.delete(L):N.add(L),d.value=N}function k(){T.value?d.value=new Set:d.value=new Set(g.value.map(L=>L.id))}function $(L){const N=new Set(c.value);N.has(L)?N.delete(L):N.add(L),c.value=N}async function D(L){n.value=!0,i.value=null;try{const N=new URLSearchParams({limit:"100",type:"notification"});L&&N.set("search",L);const P=await xe(`/api/feed?${N}`);if(P.ok){const I=await P.json();t.value=I.entries??[]}}catch{}n.value=!1}async function S(L){try{await xe(`/api/feed/${L}/read`,{method:"POST"});const N=t.value.find(P=>P.id===L);N&&(N.read_at=new Date().toISOString())}catch{}}async function R(){try{await xe("/api/feed/read-all?type=notification",{method:"POST"});const L=new Date().toISOString();for(const N of t.value)N.read_at||(N.read_at=L)}catch{}}async function C(L){if(!window.confirm("Delete this entry?"))return;const N=new Set(r.value);N.add(L),r.value=N;try{const P=await xe(`/api/feed/${L}`,{method:"DELETE"});if(P.ok){t.value=t.value.filter(A=>A.id!==L);const I=new Set(s.value);I.delete(L),s.value=I}else i.value=`Failed to delete entry (HTTP ${P.status})`}catch(P){i.value=P instanceof Error?P.message:"Delete failed"}finally{const P=new Set(r.value);P.delete(L),r.value=P}}async function G(){const L=Array.from(d.value);if(L.length!==0){h.value=!0;try{const N=await xe("/api/feed/batch-read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:L})});if(N.ok){const P=new Date().toISOString();for(const I of t.value)L.includes(I.id)&&(I.read_at=I.read_at??P);d.value=new Set}else i.value=`Bulk mark-read failed (HTTP ${N.status})`}catch(N){i.value=N instanceof Error?N.message:"Bulk mark-read failed"}finally{h.value=!1}}}async function oe(){const L=Array.from(d.value);if(L.length!==0&&window.confirm(`Delete ${L.length} item${L.length===1?"":"s"}?`)){h.value=!0;try{const N=await xe("/api/feed/batch-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:L})});if(N.ok){t.value=t.value.filter(I=>!L.includes(I.id));const P=new Set(s.value);L.forEach(I=>P.delete(I)),s.value=P,d.value=new Set}else i.value=`Bulk delete failed (HTTP ${N.status})`}catch(N){i.value=N instanceof Error?N.message:"Bulk delete failed"}finally{h.value=!1}}}return mt(o,L=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{D(L.trim()||void 0)},300)}),nt(()=>D()),(L,N)=>(y(),w("div",A1,[p("div",R1,[N[3]||(N[3]=p("div",null,[p("h1",{class:"text-base font-semibold text-text"},"Activity Feed"),p("p",{class:"text-xs text-text-muted mt-1"},"Recent notifications across IO.")],-1)),p("div",C1,[p("button",{onClick:R,class:"text-xs px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated transition-colors"},"Mark all read"),p("button",{onClick:N[0]||(N[0]=P=>l.value=!l.value),class:Te(["text-xs px-2.5 py-1 rounded-md border transition-colors",l.value?"border-accent-cyan/30 text-accent-cyan bg-accent-cyan/5":"border-border text-text-muted hover:text-text hover:bg-bg-elevated"])},"Group by team",2),p("button",{onClick:m,class:Te(["text-xs px-2.5 py-1 rounded-md border transition-colors",u.value?"border-accent-cyan/30 text-accent-cyan bg-accent-cyan/5":"border-border text-text-muted hover:text-text hover:bg-bg-elevated"])},U(u.value?"Done selecting":"Select"),3)])]),p("div",O1,[N[4]||(N[4]=p("svg",{class:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-text-muted pointer-events-none",viewBox:"0 0 20 20",fill:"currentColor"},[p("path",{"fill-rule":"evenodd",d:"M9 3.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Z","clip-rule":"evenodd"})],-1)),Ue(p("input",{"onUpdate:modelValue":N[1]||(N[1]=P=>o.value=P),placeholder:"Search feed...",class:"w-full bg-bg-elevated border border-border rounded-lg pl-9 pr-8 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512),[[Ve,o.value]]),o.value?(y(),w("button",{key:0,onClick:N[2]||(N[2]=P=>o.value=""),class:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-muted hover:text-text text-base leading-none"},"×")):Q("",!0)]),u.value?(y(),w("div",$1,[p("div",N1,[p("button",{onClick:k,class:"text-accent-cyan hover:text-accent-cyan/80"},U(T.value?"Clear selection":"Select all"),1),N[5]||(N[5]=p("span",null,"·",-1)),p("span",null,U(d.value.size)+" selected",1)]),p("div",I1,[p("button",{onClick:G,disabled:!d.value.size||h.value,class:"text-xs px-2.5 py-1 rounded-md border border-border text-text-muted hover:text-text hover:bg-bg-elevated disabled:opacity-40 transition-colors"},"Mark read",8,P1),p("button",{onClick:oe,disabled:!d.value.size||h.value,class:"text-xs px-2.5 py-1 rounded-md border border-accent-red/30 text-accent-red hover:bg-accent-red/10 disabled:opacity-40 transition-colors"},"Delete",8,L1)])])):Q("",!0),n.value?(y(),w("div",M1,"Loading...")):i.value?(y(),w("div",j1,U(i.value),1)):l.value?(y(),w(be,{key:3},[(y(!0),w(be,null,Ne(b.value,P=>(y(),w("div",{key:P.key,class:"space-y-1.5"},[p("button",{onClick:I=>$(P.key),class:"flex items-center gap-2 text-xs text-text-muted hover:text-text transition-colors w-full text-left"},[(y(),w("svg",{class:Te([c.value.has(P.key)?"":"rotate-90","w-3 h-3 transition-transform shrink-0"]),viewBox:"0 0 20 20",fill:"currentColor"},[...N[6]||(N[6]=[p("path",{"fill-rule":"evenodd",d:"M7.21 14.77a.75.75 0 0 1 .02-1.06L11.168 10 7.23 6.29a.75.75 0 1 1 1.04-1.08l4.5 4.25a.75.75 0 0 1 0 1.08l-4.5 4.25a.75.75 0 0 1-1.06-.02Z","clip-rule":"evenodd"},null,-1)])],2)),p("span",U1,U(P.label),1),p("span",B1,"("+U(P.entries.length)+")",1)],8,D1),c.value.has(P.key)?Q("",!0):(y(),w("div",H1,[(y(!0),w(be,null,Ne(P.entries,I=>(y(),rn(ql,{key:I.id,entry:I,"select-mode":u.value,selected:d.value.has(I.id),expanded:s.value.has(I.id),unread:!I.read_at,deleting:r.value.has(I.id),onSelect:A=>x(I.id),onExpand:A=>E(I.id),onRead:A=>S(I.id),onDelete:A=>C(I.id)},null,8,["entry","select-mode","selected","expanded","unread","deleting","onSelect","onExpand","onRead","onDelete"]))),128))]))]))),128)),b.value.length?Q("",!0):(y(),w("div",F1,"No entries"))],64)):(y(),w(be,{key:4},[p("div",V1,[(y(!0),w(be,null,Ne(g.value,P=>(y(),rn(ql,{key:P.id,entry:P,"select-mode":u.value,selected:d.value.has(P.id),expanded:s.value.has(P.id),unread:!P.read_at,deleting:r.value.has(P.id),onSelect:I=>x(P.id),onExpand:I=>E(P.id),onRead:I=>S(P.id),onDelete:I=>C(P.id)},null,8,["entry","select-mode","selected","expanded","unread","deleting","onSelect","onExpand","onRead","onDelete"]))),128))]),g.value.length?Q("",!0):(y(),w("div",q1,"No entries"))],64))]))}}),W1={class:"p-5 space-y-4"},G1={key:0,class:"py-12 text-center text-text-muted text-sm"},z1={key:1,class:"text-accent-red text-sm"},J1={key:2,class:"py-12 text-center text-text-muted text-sm"},Z1={key:3,class:"space-y-2"},Y1={class:"flex items-start justify-between gap-3"},X1={class:"min-w-0 flex-1"},Q1={class:"text-sm text-text font-medium"},eE={class:"text-[11px] text-text-muted font-mono mt-0.5"},tE=["onClick","disabled"],nE={key:0,class:"flex flex-wrap gap-1 mt-2"},sE={key:0,class:"text-[10px] font-mono text-accent-cyan bg-accent-cyan/10 px-1.5 py-0.5 rounded border border-accent-cyan/20"},rE={key:1,class:"text-[10px] font-mono text-text-muted bg-bg-elevated px-1.5 py-0.5 rounded border border-border"},iE={key:2,class:"text-[10px] font-mono text-text-muted bg-bg-elevated px-1.5 py-0.5 rounded border border-border"},oE=["innerHTML"],aE="inbox-last-seen-id",lE=Ge({__name:"InboxView",setup(e){const t=B([]),n=B(!1),s=B(null),r=B(new Set);let i=null;const o=u=>{if(!u)return"";const d=u.includes("T")?u:u.replace(" ","T")+"Z",h=new Date(d);return Number.isNaN(h.getTime())?u:h.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})},a=u=>{if(u.length===0)return;const d=Math.max(...u.map(h=>h.id));try{localStorage.setItem(aE,String(d))}catch{}},l=async(u=!1)=>{u&&(n.value=!0),s.value=null;try{const d=await xe("/api/inbox");if(!d.ok)throw new Error(`HTTP ${d.status}`);const h=await d.json();t.value=h.entries??[],a(t.value)}catch(d){u&&(s.value=d instanceof Error?d.message:"Failed to load inbox")}finally{u&&(n.value=!1)}},c=async u=>{if(!r.value.has(u)){r.value=new Set(r.value).add(u);try{const d=await xe(`/api/inbox/${encodeURIComponent(u)}`,{method:"DELETE"});if(!d.ok&&d.status!==204)throw new Error(`HTTP ${d.status}`);t.value=t.value.filter(h=>h.id!==u)}catch(d){s.value=d instanceof Error?d.message:"Failed to delete entry"}finally{const d=new Set(r.value);d.delete(u),r.value=d}}};return nt(()=>{l(!0),i=setInterval(()=>l(),1e4)}),fs(()=>{i&&clearInterval(i)}),(u,d)=>(y(),w("div",W1,[d[1]||(d[1]=p("h1",{class:"text-base font-semibold text-text"},"Inbox",-1)),n.value?(y(),w("div",G1,"Loading...")):s.value?(y(),w("div",z1,U(s.value),1)):t.value.length?(y(),w("ul",Z1,[(y(!0),w(be,null,Ne(t.value,h=>(y(),w("li",{key:h.id,class:"group bg-bg-card border border-border rounded-lg p-4 hover:border-border-bright transition-colors"},[p("div",Y1,[p("div",X1,[p("p",Q1,U(h.title),1),p("p",eE,U(o(h.created_at)),1)]),p("button",{onClick:f=>c(h.id),disabled:r.value.has(h.id),class:"shrink-0 opacity-0 group-hover:opacity-100 text-text-muted hover:text-accent-red disabled:opacity-30 transition-all"},[...d[0]||(d[0]=[p("svg",{class:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor"},[p("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 4Z","clip-rule":"evenodd"})],-1)])],8,tE)]),h.squad_slug||h.instance_id||h.task_id?(y(),w("div",nE,[h.squad_slug?(y(),w("span",sE,U(h.squad_slug),1)):Q("",!0),h.instance_id?(y(),w("span",rE,"inst:"+U(h.instance_id),1)):Q("",!0),h.task_id?(y(),w("span",iE,"task:"+U(h.task_id),1)):Q("",!0)])):Q("",!0),p("div",{class:"mt-3 text-xs text-text-secondary wiki-content",innerHTML:De(gs)(h.body)},null,8,oE)]))),128))])):(y(),w("div",J1,"Your inbox is empty"))]))}}),cE={class:"h-full p-5"},uE={class:"h-full flex bg-bg-card border border-border rounded-lg overflow-hidden"},dE={class:"w-56 shrink-0 border-r border-border flex flex-col bg-bg-surface"},hE={class:"p-3 border-b border-border"},fE={class:"flex-1 overflow-y-auto py-1"},pE={key:0,class:"px-4 py-3 text-text-muted text-xs"},gE={key:1,class:"px-4 py-3 text-accent-red text-xs"},mE=["onClick"],bE={key:2,class:"px-4 py-3 text-text-muted text-xs"},vE={class:"flex-1 overflow-y-auto p-5"},yE={key:0,class:"h-full flex items-center justify-center text-text-muted text-sm"},_E={key:1,class:"text-text-muted text-sm"},wE={key:2,class:"text-accent-red text-sm"},xE=["innerHTML"],EE=Ge({__name:"WikiView",setup(e){const t=B([]),n=B(null),s=B(""),r=B(""),i=B(!1),o=B(!1),a=B(""),l=B(""),c=Oe(()=>{const f=r.value.trim().toLowerCase();return f?t.value.filter(g=>g.title.toLowerCase().includes(f)):t.value}),u=Oe(()=>gs(s.value));async function d(){i.value=!0,a.value="";try{const f=await xe("/api/wiki");if(!f.ok)throw new Error(`HTTP ${f.status}`);const g=await f.json();t.value=g.pages??[]}catch(f){a.value=f instanceof Error?f.message:"Failed to load pages"}finally{i.value=!1}}async function h(f){var g;if(((g=n.value)==null?void 0:g.path)!==f.path){n.value=f,s.value="",o.value=!0,l.value="";try{const b=await xe(`/api/wiki/${encodeURIComponent(f.path)}`);if(!b.ok)throw new Error(`HTTP ${b.status}`);const T=await b.json();s.value=T.content??""}catch(b){l.value=b instanceof Error?b.message:"Failed to load page"}finally{o.value=!1}}}return nt(d),(f,g)=>(y(),w("div",cE,[p("div",uE,[p("div",dE,[p("div",hE,[Ue(p("input",{"onUpdate:modelValue":g[0]||(g[0]=b=>r.value=b),placeholder:"Filter pages...",class:"w-full bg-bg-elevated border border-border rounded-md px-2.5 py-1.5 text-xs text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512),[[Ve,r.value]])]),p("div",fE,[i.value?(y(),w("div",pE,"Loading...")):a.value?(y(),w("div",gE,U(a.value),1)):Q("",!0),(y(!0),w(be,null,Ne(c.value,b=>{var T;return y(),w("button",{key:b.path,onClick:E=>h(b),class:Te(["w-full text-left px-4 py-2 text-xs transition-colors truncate",((T=n.value)==null?void 0:T.path)===b.path?"text-accent-cyan bg-bg-elevated":"text-text-muted hover:text-text hover:bg-bg-elevated"])},U(b.title),11,mE)}),128)),!i.value&&!c.value.length?(y(),w("div",bE,"No pages")):Q("",!0)])]),p("div",vE,[n.value?o.value?(y(),w("div",_E,"Loading...")):l.value?(y(),w("div",wE,U(l.value),1)):(y(),w("div",{key:3,class:"wiki-content max-w-3xl",innerHTML:u.value},null,8,xE)):(y(),w("div",yE,"Select a page"))])])]))}}),kE={class:"min-h-screen bg-bg-app flex items-center justify-center p-4"},SE={class:"w-full max-w-sm"},TE={class:"bg-bg-card border border-border rounded-xl p-6 space-y-4"},AE={class:"space-y-1.5"},RE={class:"space-y-1.5"},CE={key:0,class:"text-xs text-accent-red"},OE=Ge({__name:"LoginView",setup(e){const t=Dn(),n=_g(),s=B(""),r=B(""),i=B(null);async function o(){i.value=null;const a=await t.signIn(s.value,r.value);a?i.value=a:n.push("/chat")}return(a,l)=>(y(),w("div",kE,[p("div",SE,[l[4]||(l[4]=p("div",{class:"mb-8 text-center"},[p("div",{class:"text-accent-cyan font-mono font-bold text-3xl tracking-tight mb-1"},"IO"),p("p",{class:"text-text-muted text-sm"},"Mission Control")],-1)),p("div",TE,[p("div",AE,[l[2]||(l[2]=p("label",{class:"text-xs text-text-muted"},"Email",-1)),Ue(p("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>s.value=c),type:"email",autocomplete:"email",placeholder:"you@example.com",class:"w-full bg-bg-elevated border border-border rounded-lg px-3 py-2.5 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/50 outline-none transition-colors"},null,512),[[Ve,s.value]])]),p("div",RE,[l[3]||(l[3]=p("label",{class:"text-xs text-text-muted"},"Password",-1)),Ue(p("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>r.value=c),type:"password",autocomplete:"current-password",placeholder:"••••••••",onKeydown:lu(o,["enter"]),class:"w-full bg-bg-elevated border border-border rounded-lg px-3 py-2.5 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/50 outline-none transition-colors"},null,544),[[Ve,r.value]])]),i.value?(y(),w("p",CE,U(i.value),1)):Q("",!0),p("button",{onClick:o,class:"w-full bg-accent-cyan/10 border border-accent-cyan/30 text-accent-cyan text-sm font-medium rounded-lg py-2.5 hover:bg-accent-cyan/20 transition-colors"},"Sign In")])])]))}}),$E={class:"p-5 space-y-5"},NE={class:"flex items-center justify-between"},IE=["disabled"],PE={key:0,class:"text-xs text-accent-green"},LE={key:1,class:"text-xs text-accent-red"},ME={key:2,class:"text-text-muted text-sm py-4 text-center"},jE={key:3,class:"text-text-muted text-sm py-8 text-center"},DE={key:4,class:"space-y-2"},UE={class:"flex items-center gap-3 min-w-0"},BE={class:"min-w-0"},HE={class:"text-sm text-text font-medium"},FE={class:"text-[11px] text-text-muted font-mono truncate"},VE={class:"flex items-center gap-1.5 shrink-0"},qE=["onClick","disabled"],KE=["onClick","disabled"],WE={class:"bg-bg-card border border-border rounded-lg p-4 space-y-3"},GE={class:"grid sm:grid-cols-2 gap-3"},zE=["onUpdate:modelValue"],JE=["onUpdate:modelValue"],ZE=["onClick"],YE=["disabled"],XE=Ge({__name:"McpView",setup(e){const t=B([]),n=B(!1),s=B(!1),r=B(!1),i=B(new Set),o=B(new Set),a=B(null),l=B(null),c=B({name:"",transport:"stdio",command:"",args:"",url:"",envRows:[]});function u(m){l.value=m,setTimeout(()=>{l.value=null},3e3)}function d(){c.value.envRows.push({key:"",value:""})}function h(m){c.value.envRows.splice(m,1)}async function f(){n.value=!0,a.value=null;try{const m=await xe("/api/mcp/servers");if(!m.ok)throw new Error(`HTTP ${m.status}`);const x=await m.json();t.value=x.servers??[]}catch(m){a.value=m instanceof Error?m.message:"Failed to load servers"}finally{n.value=!1}}async function g(m){const x=new Set(i.value);x.add(m),i.value=x;try{const k=await xe(`/api/mcp/servers/${encodeURIComponent(m)}/toggle`,{method:"PATCH"});if(!k.ok)throw new Error(`HTTP ${k.status}`);const $=await k.json(),D=t.value.find(S=>S.name===m);D&&(D.enabled=$.enabled),u(`${m} ${$.enabled?"enabled":"disabled"} -- reload to apply`)}catch(k){a.value=k instanceof Error?k.message:"Toggle failed"}finally{const k=new Set(i.value);k.delete(m),i.value=k}}async function b(m){if(!window.confirm(`Remove MCP server "${m}"?`))return;const x=new Set(o.value);x.add(m),o.value=x;try{const k=await xe(`/api/mcp/servers/${encodeURIComponent(m)}`,{method:"DELETE"});if(!k.ok)throw new Error(`HTTP ${k.status}`);t.value=t.value.filter($=>$.name!==m),u(`${m} removed -- reload to apply`)}catch(k){a.value=k instanceof Error?k.message:"Delete failed"}finally{const k=new Set(o.value);k.delete(m),o.value=k}}async function T(){a.value=null,r.value=!0;try{const m={};for(const $ of c.value.envRows)$.key.trim()&&(m[$.key.trim()]=$.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(m).length&&(x.env=m);const k=await xe("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!k.ok){const $=await k.json();throw new Error($.error??`HTTP ${k.status}`)}c.value={name:"",transport:"stdio",command:"",args:"",url:"",envRows:[]},await f(),u("Server added -- reload to activate tools")}catch(m){a.value=m instanceof Error?m.message:"Failed to add server"}finally{r.value=!1}}async function E(){s.value=!0,a.value=null;try{const m=await xe("/api/mcp/reload",{method:"POST"});if(!m.ok)throw new Error(`HTTP ${m.status}`);await f(),u("MCP tools reloaded successfully")}catch(m){a.value=m instanceof Error?m.message:"Reload failed"}finally{s.value=!1}}return nt(f),(m,x)=>(y(),w("div",$E,[p("div",NE,[x[5]||(x[5]=p("h1",{class:"text-base font-semibold text-text"},"MCP Servers",-1)),p("button",{onClick:E,disabled:s.value,class:"text-xs px-2.5 py-1 rounded-md border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/10 disabled:opacity-50 transition-colors"},U(s.value?"Reloading...":"Reload tools"),9,IE)]),l.value?(y(),w("p",PE,U(l.value),1)):Q("",!0),a.value?(y(),w("p",LE,U(a.value),1)):Q("",!0),n.value?(y(),w("div",ME,"Loading...")):t.value.length?(y(),w("div",DE,[(y(!0),w(be,null,Ne(t.value,k=>(y(),w("div",{key:k.name,class:"bg-bg-card border border-border rounded-lg px-4 py-3 flex items-center justify-between gap-4"},[p("div",UE,[p("span",{class:Te([k.enabled!==!1?"bg-accent-green":"bg-text-muted/40","w-2 h-2 rounded-full shrink-0"])},null,2),p("div",BE,[p("p",HE,U(k.name),1),p("p",FE,U(k.command?`${k.command} ${(k.args||[]).join(" ")}`:k.url??""),1)])]),p("div",VE,[p("button",{onClick:$=>g(k.name),disabled:i.value.has(k.name),class:"text-[11px] px-2 py-1 rounded border border-border text-text-muted hover:text-text hover:bg-bg-elevated disabled:opacity-40 transition-colors"},U(k.enabled!==!1?"Disable":"Enable"),9,qE),p("button",{onClick:$=>b(k.name),disabled:o.value.has(k.name),class:"text-[11px] px-2 py-1 rounded border border-accent-red/30 text-accent-red hover:bg-accent-red/10 disabled:opacity-40 transition-colors"},"Remove",8,KE)])]))),128))])):(y(),w("div",jE,"No MCP servers configured")),p("div",WE,[x[7]||(x[7]=p("h2",{class:"text-xs text-text-muted uppercase tracking-wider"},"Add Server",-1)),p("div",GE,[Ue(p("input",{"onUpdate:modelValue":x[0]||(x[0]=k=>c.value.name=k),placeholder:"Server name",class:"bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512),[[Ve,c.value.name]]),Ue(p("select",{"onUpdate:modelValue":x[1]||(x[1]=k=>c.value.transport=k),class:"bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text focus:border-accent-cyan/40 outline-none transition-colors"},[...x[6]||(x[6]=[p("option",{value:"stdio"},"stdio",-1),p("option",{value:"sse"},"SSE",-1)])],512),[[ep,c.value.transport]])]),c.value.transport==="stdio"?(y(),w(be,{key:0},[Ue(p("input",{"onUpdate:modelValue":x[2]||(x[2]=k=>c.value.command=k),placeholder:"Command (e.g. npx)",class:"w-full bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512),[[Ve,c.value.command]]),Ue(p("input",{"onUpdate:modelValue":x[3]||(x[3]=k=>c.value.args=k),placeholder:"Arguments (space-separated)",class:"w-full bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512),[[Ve,c.value.args]])],64)):Ue((y(),w("input",{key:1,"onUpdate:modelValue":x[4]||(x[4]=k=>c.value.url=k),placeholder:"SSE URL",class:"w-full bg-bg-elevated border border-border rounded-lg px-3 py-2 text-sm text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none transition-colors"},null,512)),[[Ve,c.value.url]]),(y(!0),w(be,null,Ne(c.value.envRows,(k,$)=>(y(),w("div",{key:$,class:"flex gap-2"},[Ue(p("input",{"onUpdate:modelValue":D=>k.key=D,placeholder:"KEY",class:"flex-1 bg-bg-elevated border border-border rounded px-2 py-1.5 text-xs font-mono text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,8,zE),[[Ve,k.key]]),Ue(p("input",{"onUpdate:modelValue":D=>k.value=D,placeholder:"value",class:"flex-1 bg-bg-elevated border border-border rounded px-2 py-1.5 text-xs font-mono text-text placeholder:text-text-muted focus:border-accent-cyan/40 outline-none"},null,8,JE),[[Ve,k.value]]),p("button",{onClick:D=>h($),class:"text-text-muted hover:text-accent-red text-sm w-6"},"×",8,ZE)]))),128)),p("button",{onClick:d,class:"text-[11px] text-text-muted hover:text-text transition-colors"},"+ Add env var"),p("button",{onClick:T,disabled:r.value||!c.value.name.trim(),class:"text-xs px-3 py-1.5 rounded-md bg-accent-cyan/10 border border-accent-cyan/30 text-accent-cyan hover:bg-accent-cyan/20 disabled:opacity-50 transition-colors"},U(r.value?"Adding...":"Add Server"),9,YE)])]))}}),Sd=yg({history:Xp("/"),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:OE,meta:{public:!0}},{path:"/chat",name:"chat",component:N_},{path:"/skills",name:"skills",component:u0},{path:"/squads",name:"squads",component:Iw},{path:"/activity",name:"activity",component:_x},{path:"/wiki",name:"wiki",component:EE},{path:"/schedules",name:"schedules",component:m1},{path:"/feed",name:"feed",component:K1},{path:"/inbox",name:"inbox",component:lE},{path:"/notifications",redirect:"/feed"},{path:"/mcp",name:"mcp",component:XE}]});Sd.beforeEach(async e=>{const t=Dn();return t.initialized||await t.init(),!t.authEnabled||e.meta.public||t.user?!0:{name:"login"}});const Go=op(d_);Go.use(cp());Go.use(Sd);Go.mount("#app");
|