heyio 1.6.1 → 1.7.1
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/dist/copilot/client.js +6 -1
- package/dist/copilot/gh-token.js +4 -0
- package/package.json +1 -1
- package/web-dist/assets/{AuditLogView-oxJKKvR2.js → AuditLogView-BKdTTuUZ.js} +2 -2
- package/web-dist/assets/ChatView-DpTWixGo.js +1 -0
- package/web-dist/assets/FeedView-DLpifZ22.js +6 -0
- package/web-dist/assets/HistoryView-DZpGvhB5.js +1 -0
- package/web-dist/assets/LoginView-D2-FBKS3.js +1 -0
- package/web-dist/assets/McpView-CRzUrNTa.js +1 -0
- package/web-dist/assets/{SchedulesView-Da2pTfUa.js → SchedulesView-nKZpyYX8.js} +2 -2
- package/web-dist/assets/SettingsView-Cng7uCir.js +1 -0
- package/web-dist/assets/{SkillsView-Dubj8VOL.js → SkillsView-p5j-mrYN.js} +4 -4
- package/web-dist/assets/SquadDetailView-D3dLQWq8.js +26 -0
- package/web-dist/assets/{SquadHealthView-BSJ5KMn5.js → SquadHealthView-C9BKBgkW.js} +3 -3
- package/web-dist/assets/SquadsView-hvOGTg2k.js +6 -0
- package/web-dist/assets/{ToggleSwitch.vue_vue_type_script_setup_true_lang-FHXcPBMk.js → ToggleSwitch.vue_vue_type_script_setup_true_lang-h2TRK3PD.js} +1 -1
- package/web-dist/assets/{UsageView-CE7sS6_n.js → UsageView-CXEO2kEU.js} +4 -4
- package/web-dist/assets/WikiView-CitkkJyn.js +26 -0
- package/web-dist/assets/{api-vVF1Oc7L.js → api-Dg3ccdl2.js} +1 -1
- package/web-dist/assets/{x-CdgExS41.js → arrow-left-ejwwm6eg.js} +2 -2
- package/web-dist/assets/{git-branch-D_pY2r5j.js → git-branch-BMAw22mD.js} +1 -1
- package/web-dist/assets/index-C5YYUXmF.css +1 -0
- package/web-dist/assets/index-DlMYQPPk.js +279 -0
- package/web-dist/assets/{plus-PnaymXR1.js → plus-B9RNjhEm.js} +1 -1
- package/web-dist/assets/{save-D0BBbT97.js → save-BHW-ttFe.js} +1 -1
- package/web-dist/assets/{search-DVR5XYa2.js → search-eMpKL6Mh.js} +1 -1
- package/web-dist/assets/{trash-2-xolVupQF.js → trash-2-E0uVesm_.js} +1 -1
- package/web-dist/assets/{triangle-alert-C4g2wb6r.js → triangle-alert-CV16lQQo.js} +2 -2
- package/web-dist/index.html +2 -2
- package/web-dist/assets/ChatView-CNVBIg3h.js +0 -11
- package/web-dist/assets/FeedView-eN_WAiS8.js +0 -6
- package/web-dist/assets/HistoryView-uxdpy_Fq.js +0 -1
- package/web-dist/assets/LoginView-eFYw6Ap_.js +0 -1
- package/web-dist/assets/McpView-CG3DdBIe.js +0 -1
- package/web-dist/assets/SettingsView-GUC--Ixb.js +0 -1
- package/web-dist/assets/SquadDetailView-BO2Zfq5o.js +0 -26
- package/web-dist/assets/SquadsView-D4gt4r9q.js +0 -6
- package/web-dist/assets/WikiView-DDQ9nt1B.js +0 -31
- package/web-dist/assets/arrow-left-DF5KDBVY.js +0 -6
- package/web-dist/assets/file-text-CLvVqElg.js +0 -6
- package/web-dist/assets/index-CFtE6hNm.js +0 -254
- package/web-dist/assets/index-CoyYyx4A.css +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SquadsView-hvOGTg2k.js","assets/api-Dg3ccdl2.js","assets/squad-colors-B8B_Y-lz.js","assets/git-branch-BMAw22mD.js","assets/SquadHealthView-C9BKBgkW.js","assets/triangle-alert-CV16lQQo.js","assets/SquadDetailView-D3dLQWq8.js","assets/trash-2-E0uVesm_.js","assets/arrow-left-ejwwm6eg.js","assets/FeedView-DLpifZ22.js","assets/SkillsView-p5j-mrYN.js","assets/plus-B9RNjhEm.js","assets/search-eMpKL6Mh.js","assets/save-BHW-ttFe.js","assets/McpView-CRzUrNTa.js","assets/ToggleSwitch.vue_vue_type_script_setup_true_lang-h2TRK3PD.js","assets/SchedulesView-nKZpyYX8.js","assets/HistoryView-DZpGvhB5.js","assets/WikiView-CitkkJyn.js","assets/UsageView-CXEO2kEU.js","assets/AuditLogView-BKdTTuUZ.js","assets/SettingsView-Cng7uCir.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var lh=Object.defineProperty;var ch=(t,e,r)=>e in t?lh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var me=(t,e,r)=>ch(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();const uh="modulepreload",hh=function(t){return"/"+t},Go={},ze=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(r.map(c=>{if(c=hh(c),c in Go)return;Go[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":uh,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};/**
|
|
3
|
+
* @vue/shared v3.5.34
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function fo(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const ye={},Wr=[],Nt=()=>{},ql=()=>!1,Bs=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Ms=t=>t.startsWith("onUpdate:"),Le=Object.assign,po=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},dh=Object.prototype.hasOwnProperty,he=(t,e)=>dh.call(t,e),W=Array.isArray,Kr=t=>Jn(t)==="[object Map]",nn=t=>Jn(t)==="[object Set]",Jo=t=>Jn(t)==="[object Date]",ne=t=>typeof t=="function",Se=t=>typeof t=="string",ft=t=>typeof t=="symbol",de=t=>t!==null&&typeof t=="object",Fl=t=>(de(t)||ne(t))&&ne(t.then)&&ne(t.catch),Vl=Object.prototype.toString,Jn=t=>Vl.call(t),fh=t=>Jn(t).slice(8,-1),zl=t=>Jn(t)==="[object Object]",Hs=t=>Se(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,_n=fo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),qs=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},ph=/-\w/g,Ze=qs(t=>t.replace(ph,e=>e.slice(1).toUpperCase())),gh=/\B([A-Z])/g,dr=qs(t=>t.replace(gh,"-$1").toLowerCase()),Fs=qs(t=>t.charAt(0).toUpperCase()+t.slice(1)),ci=qs(t=>t?`on${Fs(t)}`:""),jt=(t,e)=>!Object.is(t,e),ms=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},Wl=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},Vs=t=>{const e=parseFloat(t);return isNaN(e)?t:e},mh=t=>{const e=Se(t)?Number(t):NaN;return isNaN(e)?t:e};let Yo;const zs=()=>Yo||(Yo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function go(t){if(W(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],s=Se(n)?_h(n):go(n);if(s)for(const i in s)e[i]=s[i]}return e}else if(Se(t)||de(t))return t}const yh=/;(?![^(]*\))/g,vh=/:([^]+)/,bh=/\/\*[^]*?\*\//g;function _h(t){const e={};return t.replace(bh,"").split(yh).forEach(r=>{if(r){const n=r.split(vh);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function Ge(t){let e="";if(Se(t))e=t;else if(W(t))for(let r=0;r<t.length;r++){const n=Ge(t[r]);n&&(e+=n+" ")}else if(de(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const wh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",kh=fo(wh);function Kl(t){return!!t||t===""}function Sh(t,e){if(t.length!==e.length)return!1;let r=!0;for(let n=0;r&&n<t.length;n++)r=sn(t[n],e[n]);return r}function sn(t,e){if(t===e)return!0;let r=Jo(t),n=Jo(e);if(r||n)return r&&n?t.getTime()===e.getTime():!1;if(r=ft(t),n=ft(e),r||n)return t===e;if(r=W(t),n=W(e),r||n)return r&&n?Sh(t,e):!1;if(r=de(t),n=de(e),r||n){if(!r||!n)return!1;const s=Object.keys(t).length,i=Object.keys(e).length;if(s!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!sn(t[o],e[o]))return!1}}return String(t)===String(e)}function mo(t,e){return t.findIndex(r=>sn(r,e))}const Gl=t=>!!(t&&t.__v_isRef===!0),rt=t=>Se(t)?t:t==null?"":W(t)||de(t)&&(t.toString===Vl||!ne(t.toString))?Gl(t)?rt(t.value):JSON.stringify(t,Jl,2):String(t),Jl=(t,e)=>Gl(e)?Jl(t,e.value):Kr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[n,s],i)=>(r[ui(n,i)+" =>"]=s,r),{})}:nn(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>ui(r))}:ft(e)?ui(e):de(e)&&!W(e)&&!zl(e)?String(e):e,ui=(t,e="")=>{var r;return ft(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
|
|
7
|
+
* @vue/reactivity v3.5.34
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let $e;class Yl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&$e&&($e.active?(this.parent=$e,this.index=($e.scopes||($e.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].pause();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].resume();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].resume()}}run(e){if(this._active){const r=$e;try{return $e=this,e()}finally{$e=r}}}on(){++this._on===1&&(this.prevScope=$e,$e=this)}off(){if(this._on>0&&--this._on===0){if($e===this)$e=this.prevScope;else{let e=$e;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,n;for(r=0,n=this.effects.length;r<n;r++)this.effects[r].stop();for(this.effects.length=0,r=0,n=this.cleanups.length;r<n;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){for(r=0,n=this.scopes.length;r<n;r++)this.scopes[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Xl(t){return new Yl(t)}function Zl(){return $e}function Eh(t,e=!1){$e&&$e.cleanups.push(t)}let _e;const hi=new WeakSet;class Ql{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,$e&&($e.active?$e.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,hi.has(this)&&(hi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||tc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Xo(this),rc(this);const e=_e,r=yt;_e=this,yt=!0;try{return this.fn()}finally{nc(this),_e=e,yt=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)bo(e);this.deps=this.depsTail=void 0,Xo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?hi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){$i(this)&&this.run()}get dirty(){return $i(this)}}let ec=0,wn,kn;function tc(t,e=!1){if(t.flags|=8,e){t.next=kn,kn=t;return}t.next=wn,wn=t}function yo(){ec++}function vo(){if(--ec>0)return;if(kn){let e=kn;for(kn=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;wn;){let e=wn;for(wn=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=r}}if(t)throw t}function rc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function nc(t){let e,r=t.depsTail,n=r;for(;n;){const s=n.prevDep;n.version===-1?(n===r&&(r=s),bo(n),Th(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=s}t.deps=e,t.depsTail=r}function $i(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(sc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function sc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===jn)||(t.globalVersion=jn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!$i(t))))return;t.flags|=2;const e=t.dep,r=_e,n=yt;_e=t,yt=!0;try{rc(t);const s=t.fn(t._value);(e.version===0||jt(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{_e=r,yt=n,nc(t),t.flags&=-3}}function bo(t,e=!1){const{dep:r,prevSub:n,nextSub:s}=t;if(n&&(n.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=n,t.nextSub=void 0),r.subs===t&&(r.subs=n,!n&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)bo(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Th(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let yt=!0;const ic=[];function Xt(){ic.push(yt),yt=!1}function Zt(){const t=ic.pop();yt=t===void 0?!0:t}function Xo(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=_e;_e=void 0;try{e()}finally{_e=r}}}let jn=0;class Ah{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class _o{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!_e||!yt||_e===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==_e)r=this.activeLink=new Ah(_e,this),_e.deps?(r.prevDep=_e.depsTail,_e.depsTail.nextDep=r,_e.depsTail=r):_e.deps=_e.depsTail=r,oc(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const n=r.nextDep;n.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=n),r.prevDep=_e.depsTail,r.nextDep=void 0,_e.depsTail.nextDep=r,_e.depsTail=r,_e.deps===r&&(_e.deps=n)}return r}trigger(e){this.version++,jn++,this.notify(e)}notify(e){yo();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{vo()}}}function oc(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)oc(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const ws=new WeakMap,Ar=Symbol(""),ji=Symbol(""),Nn=Symbol("");function qe(t,e,r){if(yt&&_e){let n=ws.get(t);n||ws.set(t,n=new Map);let s=n.get(r);s||(n.set(r,s=new _o),s.map=n,s.key=r),s.track()}}function Vt(t,e,r,n,s,i){const o=ws.get(t);if(!o){jn++;return}const a=l=>{l&&l.trigger()};if(yo(),e==="clear")o.forEach(a);else{const l=W(t),c=l&&Hs(r);if(l&&r==="length"){const u=Number(n);o.forEach((h,d)=>{(d==="length"||d===Nn||!ft(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(Nn)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Ar)),Kr(t)&&a(o.get(ji)));break;case"delete":l||(a(o.get(Ar)),Kr(t)&&a(o.get(ji)));break;case"set":Kr(t)&&a(o.get(Ar));break}}vo()}function xh(t,e){const r=ws.get(t);return r&&r.get(e)}function Ir(t){const e=oe(t);return e===t?e:(qe(e,"iterate",Nn),lt(t)?e:e.map(vt))}function Ws(t){return qe(t=oe(t),"iterate",Nn),t}function Pt(t,e){return Qt(t)?Xr(Jt(t)?vt(e):e):vt(e)}const Rh={__proto__:null,[Symbol.iterator](){return di(this,Symbol.iterator,t=>Pt(this,t))},concat(...t){return Ir(this).concat(...t.map(e=>W(e)?Ir(e):e))},entries(){return di(this,"entries",t=>(t[1]=Pt(this,t[1]),t))},every(t,e){return Lt(this,"every",t,e,void 0,arguments)},filter(t,e){return Lt(this,"filter",t,e,r=>r.map(n=>Pt(this,n)),arguments)},find(t,e){return Lt(this,"find",t,e,r=>Pt(this,r),arguments)},findIndex(t,e){return Lt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Lt(this,"findLast",t,e,r=>Pt(this,r),arguments)},findLastIndex(t,e){return Lt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Lt(this,"forEach",t,e,void 0,arguments)},includes(...t){return fi(this,"includes",t)},indexOf(...t){return fi(this,"indexOf",t)},join(t){return Ir(this).join(t)},lastIndexOf(...t){return fi(this,"lastIndexOf",t)},map(t,e){return Lt(this,"map",t,e,void 0,arguments)},pop(){return ln(this,"pop")},push(...t){return ln(this,"push",t)},reduce(t,...e){return Zo(this,"reduce",t,e)},reduceRight(t,...e){return Zo(this,"reduceRight",t,e)},shift(){return ln(this,"shift")},some(t,e){return Lt(this,"some",t,e,void 0,arguments)},splice(...t){return ln(this,"splice",t)},toReversed(){return Ir(this).toReversed()},toSorted(t){return Ir(this).toSorted(t)},toSpliced(...t){return Ir(this).toSpliced(...t)},unshift(...t){return ln(this,"unshift",t)},values(){return di(this,"values",t=>Pt(this,t))}};function di(t,e,r){const n=Ws(t),s=n[e]();return n!==t&&!lt(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=r(i.value)),i}),s}const Ch=Array.prototype;function Lt(t,e,r,n,s,i){const o=Ws(t),a=o!==t&&!lt(t),l=o[e];if(l!==Ch[e]){const h=l.apply(t,i);return a?vt(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,Pt(t,h),d,t)}:r.length>2&&(c=function(h,d){return r.call(this,h,d,t)}));const u=l.call(o,c,n);return a&&s?s(u):u}function Zo(t,e,r,n){const s=Ws(t),i=s!==t&&!lt(t);let o=r,a=!1;s!==t&&(i?(a=n.length===0,o=function(c,u,h){return a&&(a=!1,c=Pt(t,c)),r.call(this,c,Pt(t,u),h,t)}):r.length>3&&(o=function(c,u,h){return r.call(this,c,u,h,t)}));const l=s[e](o,...n);return a?Pt(t,l):l}function fi(t,e,r){const n=oe(t);qe(n,"iterate",Nn);const s=n[e](...r);return(s===-1||s===!1)&&Ks(r[0])?(r[0]=oe(r[0]),n[e](...r)):s}function ln(t,e,r=[]){Xt(),yo();const n=oe(t)[e].apply(t,r);return vo(),Zt(),n}const Oh=fo("__proto__,__v_isRef,__isVue"),ac=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(ft));function Ph(t){ft(t)||(t=String(t));const e=oe(this);return qe(e,"has",t),e.hasOwnProperty(t)}class lc{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,n){if(r==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!s;if(r==="__v_isReadonly")return s;if(r==="__v_isShallow")return i;if(r==="__v_raw")return n===(s?i?Hh:dc:i?hc:uc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=W(e);if(!s){let l;if(o&&(l=Rh[r]))return l;if(r==="hasOwnProperty")return Ph}const a=Reflect.get(e,r,xe(e)?e:n);if((ft(r)?ac.has(r):Oh(r))||(s||qe(e,"get",r),i))return a;if(xe(a)){const l=o&&Hs(r)?a:a.value;return s&&de(l)?Li(l):l}return de(a)?s?Li(a):Yn(a):a}}class cc extends lc{constructor(e=!1){super(!1,e)}set(e,r,n,s){let i=e[r];const o=W(e)&&Hs(r);if(!this._isShallow){const c=Qt(i);if(!lt(n)&&!Qt(n)&&(i=oe(i),n=oe(n)),!o&&xe(i)&&!xe(n))return c||(i.value=n),!0}const a=o?Number(r)<e.length:he(e,r),l=Reflect.set(e,r,n,xe(e)?e:s);return e===oe(s)&&(a?jt(n,i)&&Vt(e,"set",r,n):Vt(e,"add",r,n)),l}deleteProperty(e,r){const n=he(e,r);e[r];const s=Reflect.deleteProperty(e,r);return s&&n&&Vt(e,"delete",r,void 0),s}has(e,r){const n=Reflect.has(e,r);return(!ft(r)||!ac.has(r))&&qe(e,"has",r),n}ownKeys(e){return qe(e,"iterate",W(e)?"length":Ar),Reflect.ownKeys(e)}}class Ih extends lc{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const $h=new cc,jh=new Ih,Nh=new cc(!0);const Ni=t=>t,rs=t=>Reflect.getPrototypeOf(t);function Lh(t,e,r){return function(...n){const s=this.__v_raw,i=oe(s),o=Kr(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=s[t](...n),u=r?Ni:e?Xr:vt;return!e&&qe(i,"iterate",l?ji:Ar),Le(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function ns(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Dh(t,e){const r={get(s){const i=this.__v_raw,o=oe(i),a=oe(s);t||(jt(s,a)&&qe(o,"get",s),qe(o,"get",a));const{has:l}=rs(o),c=e?Ni:t?Xr:vt;if(l.call(o,s))return c(i.get(s));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!t&&qe(oe(s),"iterate",Ar),s.size},has(s){const i=this.__v_raw,o=oe(i),a=oe(s);return t||(jt(s,a)&&qe(o,"has",s),qe(o,"has",a)),s===a?i.has(s):i.has(s)||i.has(a)},forEach(s,i){const o=this,a=o.__v_raw,l=oe(a),c=e?Ni:t?Xr:vt;return!t&&qe(l,"iterate",Ar),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Le(r,t?{add:ns("add"),set:ns("set"),delete:ns("delete"),clear:ns("clear")}:{add(s){const i=oe(this),o=rs(i),a=oe(s),l=!e&&!lt(s)&&!Qt(s)?a:s;return o.has.call(i,l)||jt(s,l)&&o.has.call(i,s)||jt(a,l)&&o.has.call(i,a)||(i.add(l),Vt(i,"add",l,l)),this},set(s,i){!e&&!lt(i)&&!Qt(i)&&(i=oe(i));const o=oe(this),{has:a,get:l}=rs(o);let c=a.call(o,s);c||(s=oe(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?jt(i,u)&&Vt(o,"set",s,i):Vt(o,"add",s,i),this},delete(s){const i=oe(this),{has:o,get:a}=rs(i);let l=o.call(i,s);l||(s=oe(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Vt(i,"delete",s,void 0),c},clear(){const s=oe(this),i=s.size!==0,o=s.clear();return i&&Vt(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{r[s]=Lh(s,t,e)}),r}function wo(t,e){const r=Dh(t,e);return(n,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?n:Reflect.get(he(r,s)&&s in n?r:n,s,i)}const Uh={get:wo(!1,!1)},Bh={get:wo(!1,!0)},Mh={get:wo(!0,!1)};const uc=new WeakMap,hc=new WeakMap,dc=new WeakMap,Hh=new WeakMap;function qh(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Fh(t){return t.__v_skip||!Object.isExtensible(t)?0:qh(fh(t))}function Yn(t){return Qt(t)?t:ko(t,!1,$h,Uh,uc)}function fc(t){return ko(t,!1,Nh,Bh,hc)}function Li(t){return ko(t,!0,jh,Mh,dc)}function ko(t,e,r,n,s){if(!de(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Fh(t);if(i===0)return t;const o=s.get(t);if(o)return o;const a=new Proxy(t,i===2?n:r);return s.set(t,a),a}function Jt(t){return Qt(t)?Jt(t.__v_raw):!!(t&&t.__v_isReactive)}function Qt(t){return!!(t&&t.__v_isReadonly)}function lt(t){return!!(t&&t.__v_isShallow)}function Ks(t){return t?!!t.__v_raw:!1}function oe(t){const e=t&&t.__v_raw;return e?oe(e):t}function So(t){return!he(t,"__v_skip")&&Object.isExtensible(t)&&Wl(t,"__v_skip",!0),t}const vt=t=>de(t)?Yn(t):t,Xr=t=>de(t)?Li(t):t;function xe(t){return t?t.__v_isRef===!0:!1}function Re(t){return pc(t,!1)}function Vh(t){return pc(t,!0)}function pc(t,e){return xe(t)?t:new zh(t,e)}class zh{constructor(e,r){this.dep=new _o,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:oe(e),this._value=r?e:vt(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||lt(e)||Qt(e);e=n?e:oe(e),jt(e,r)&&(this._rawValue=e,this._value=n?e:vt(e),this.dep.trigger())}}function re(t){return xe(t)?t.value:t}const Wh={get:(t,e,r)=>e==="__v_raw"?t:re(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const s=t[e];return xe(s)&&!xe(r)?(s.value=r,!0):Reflect.set(t,e,r,n)}};function gc(t){return Jt(t)?t:new Proxy(t,Wh)}function Kh(t){const e=W(t)?new Array(t.length):{};for(const r in t)e[r]=Jh(t,r);return e}class Gh{constructor(e,r,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ft(r)?r:String(r),this._raw=oe(e);let s=!0,i=e;if(!W(e)||ft(this._key)||!Hs(this._key))do s=!Ks(i)||lt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=re(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&xe(this._raw[this._key])){const r=this._object[this._key];if(xe(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return xh(this._raw,this._key)}}function Jh(t,e,r){return new Gh(t,e,r)}class Yh{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new _o(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=jn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&_e!==this)return tc(this,!0),!0}get value(){const e=this.dep.track();return sc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Xh(t,e,r=!1){let n,s;return ne(t)?n=t:(n=t.get,s=t.set),new Yh(n,s,r)}const ss={},ks=new WeakMap;let wr;function Zh(t,e=!1,r=wr){if(r){let n=ks.get(r);n||ks.set(r,n=[]),n.push(t)}}function Qh(t,e,r=ye){const{immediate:n,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=r,c=A=>s?A:lt(A)||s===!1||s===0?zt(A,1):zt(A);let u,h,d,f,p=!1,y=!1;if(xe(t)?(h=()=>t.value,p=lt(t)):Jt(t)?(h=()=>c(t),p=!0):W(t)?(y=!0,p=t.some(A=>Jt(A)||lt(A)),h=()=>t.map(A=>{if(xe(A))return A.value;if(Jt(A))return c(A);if(ne(A))return l?l(A,2):A()})):ne(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Xt();try{d()}finally{Zt()}}const A=wr;wr=u;try{return l?l(t,3,[f]):t(f)}finally{wr=A}}:h=Nt,e&&s){const A=h,U=s===!0?1/0:s;h=()=>zt(A(),U)}const w=Zl(),k=()=>{u.stop(),w&&w.active&&po(w.effects,u)};if(i&&e){const A=e;e=(...U)=>{A(...U),k()}}let _=y?new Array(t.length).fill(ss):ss;const b=A=>{if(!(!(u.flags&1)||!u.dirty&&!A))if(e){const U=u.run();if(s||p||(y?U.some((F,B)=>jt(F,_[B])):jt(U,_))){d&&d();const F=wr;wr=u;try{const B=[U,_===ss?void 0:y&&_[0]===ss?[]:_,f];_=U,l?l(e,3,B):e(...B)}finally{wr=F}}}else u.run()};return a&&a(b),u=new Ql(h),u.scheduler=o?()=>o(b,!1):b,f=A=>Zh(A,!1,u),d=u.onStop=()=>{const A=ks.get(u);if(A){if(l)l(A,4);else for(const U of A)U();ks.delete(u)}},e?n?b(!0):_=u.run():o?o(b.bind(null,!0),!0):u.run(),k.pause=u.pause.bind(u),k.resume=u.resume.bind(u),k.stop=k,k}function zt(t,e=1/0,r){if(e<=0||!de(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,xe(t))zt(t.value,e,r);else if(W(t))for(let n=0;n<t.length;n++)zt(t[n],e,r);else if(nn(t)||Kr(t))t.forEach(n=>{zt(n,e,r)});else if(zl(t)){for(const n in t)zt(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&zt(t[n],e,r)}return t}/**
|
|
11
|
+
* @vue/runtime-core v3.5.34
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function Xn(t,e,r,n){try{return n?t(...n):t()}catch(s){Gs(s,e,r)}}function bt(t,e,r,n){if(ne(t)){const s=Xn(t,e,r,n);return s&&Fl(s)&&s.catch(i=>{Gs(i,e,r)}),s}if(W(t)){const s=[];for(let i=0;i<t.length;i++)s.push(bt(t[i],e,r,n));return s}}function Gs(t,e,r,n=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ye;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){Xt(),Xn(i,null,10,[t,l,c]),Zt();return}}ed(t,r,s,n,o)}function ed(t,e,r,n=!0,s=!1){if(s)throw t;console.error(t)}const Je=[];let Rt=-1;const Gr=[];let ir=null,Br=0;const mc=Promise.resolve();let Ss=null;function ur(t){const e=Ss||mc;return t?e.then(this?t.bind(this):t):e}function td(t){let e=Rt+1,r=Je.length;for(;e<r;){const n=e+r>>>1,s=Je[n],i=Ln(s);i<t||i===t&&s.flags&2?e=n+1:r=n}return e}function Eo(t){if(!(t.flags&1)){const e=Ln(t),r=Je[Je.length-1];!r||!(t.flags&2)&&e>=Ln(r)?Je.push(t):Je.splice(td(e),0,t),t.flags|=1,yc()}}function yc(){Ss||(Ss=mc.then(bc))}function rd(t){W(t)?Gr.push(...t):ir&&t.id===-1?ir.splice(Br+1,0,t):t.flags&1||(Gr.push(t),t.flags|=1),yc()}function Qo(t,e,r=Rt+1){for(;r<Je.length;r++){const n=Je[r];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Je.splice(r,1),r--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function vc(t){if(Gr.length){const e=[...new Set(Gr)].sort((r,n)=>Ln(r)-Ln(n));if(Gr.length=0,ir){ir.push(...e);return}for(ir=e,Br=0;Br<ir.length;Br++){const r=ir[Br];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}ir=null,Br=0}}const Ln=t=>t.id==null?t.flags&2?-1:1/0:t.id;function bc(t){try{for(Rt=0;Rt<Je.length;Rt++){const e=Je[Rt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Xn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Rt<Je.length;Rt++){const e=Je[Rt];e&&(e.flags&=-2)}Rt=-1,Je.length=0,vc(),Ss=null,(Je.length||Gr.length)&&bc()}}let ot=null,_c=null;function Es(t){const e=ot;return ot=t,_c=t&&t.type.__scopeId||null,e}function Jr(t,e=ot,r){if(!e||t._n)return t;const n=(...s)=>{n._d&&xs(-1);const i=Es(e);let o;try{o=t(...s)}finally{Es(i),n._d&&xs(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function nd(t,e){if(ot===null)return t;const r=Qs(ot),n=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,a,l=ye]=e[s];i&&(ne(i)&&(i={mounted:i,updated:i}),i.deep&&zt(o),n.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function gr(t,e,r,n){const s=t.dirs,i=e&&e.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[n];l&&(Xt(),bt(l,r,8,[t.el,a,t,e]),Zt())}}function ys(t,e){if(Ve){let r=Ve.provides;const n=Ve.parent&&Ve.parent.provides;n===r&&(r=Ve.provides=Object.create(n)),r[t]=e}}function dt(t,e,r=!1){const n=Oo();if(n||xr){let s=xr?xr._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(s&&t in s)return s[t];if(arguments.length>1)return r&&ne(e)?e.call(n&&n.proxy):e}}function sd(){return!!(Oo()||xr)}const id=Symbol.for("v-scx"),od=()=>dt(id);function Wt(t,e,r){return wc(t,e,r)}function wc(t,e,r=ye){const{immediate:n,deep:s,flush:i,once:o}=r,a=Le({},r),l=e&&n||!e&&i!=="post";let c;if(Bn){if(i==="sync"){const f=od();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Nt,f.resume=Nt,f.pause=Nt,f}}const u=Ve;a.call=(f,p,y)=>bt(f,u,p,y);let h=!1;i==="post"?a.scheduler=f=>{tt(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():Eo(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=Qh(t,e,a);return Bn&&(c?c.push(d):l&&d()),d}function ad(t,e,r){const n=this.proxy,s=Se(t)?t.includes(".")?kc(n,t):()=>n[t]:t.bind(n,n);let i;ne(e)?i=e:(i=e.handler,r=e);const o=Zn(this),a=wc(s,i.bind(n),r);return o(),a}function kc(t,e){const r=e.split(".");return()=>{let n=t;for(let s=0;s<r.length&&n;s++)n=n[r[s]];return n}}const ld=Symbol("_vte"),Sc=t=>t.__isTeleport,Ct=Symbol("_leaveCb"),cn=Symbol("_enterCb");function cd(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return To(()=>{t.isMounted=!0}),Pc(()=>{t.isUnmounting=!0}),t}const ut=[Function,Array],Ec={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ut,onEnter:ut,onAfterEnter:ut,onEnterCancelled:ut,onBeforeLeave:ut,onLeave:ut,onAfterLeave:ut,onLeaveCancelled:ut,onBeforeAppear:ut,onAppear:ut,onAfterAppear:ut,onAppearCancelled:ut},Tc=t=>{const e=t.subTree;return e.component?Tc(e.component):e},ud={name:"BaseTransition",props:Ec,setup(t,{slots:e}){const r=Oo(),n=cd();return()=>{const s=e.default&&Rc(e.default(),!0),i=s&&s.length?Ac(s):r.subTree?je():void 0;if(!i)return;const o=oe(t),{mode:a}=o;if(n.isLeaving)return pi(i);const l=ea(i);if(!l)return pi(i);let c=Di(l,o,n,r,h=>c=h);l.type!==Ye&&Dn(l,c);let u=r.subTree&&ea(r.subTree);if(u&&u.type!==Ye&&!Sr(u,l)&&Tc(r).type!==Ye){let h=Di(u,o,n,r);if(Dn(u,h),a==="out-in"&&l.type!==Ye)return n.isLeaving=!0,h.afterLeave=()=>{n.isLeaving=!1,r.job.flags&8||r.update(),delete h.afterLeave,u=void 0},pi(i);a==="in-out"&&l.type!==Ye?h.delayLeave=(d,f,p)=>{const y=xc(n,u);y[String(u.key)]=u,d[Ct]=()=>{f(),d[Ct]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{p(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function Ac(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==Ye){e=r;break}}return e}const hd=ud;function xc(t,e){const{leavingVNodes:r}=t;let n=r.get(e.type);return n||(n=Object.create(null),r.set(e.type,n)),n}function Di(t,e,r,n,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:y,onBeforeAppear:w,onAppear:k,onAfterAppear:_,onAppearCancelled:b}=e,A=String(t.key),U=xc(r,t),F=(C,z)=>{C&&bt(C,n,9,z)},B=(C,z)=>{const ee=z[1];F(C,z),W(C)?C.every(O=>O.length<=1)&&ee():C.length<=1&&ee()},J={mode:o,persisted:a,beforeEnter(C){let z=l;if(!r.isMounted)if(i)z=w||l;else return;C[Ct]&&C[Ct](!0);const ee=U[A];ee&&Sr(t,ee)&&ee.el[Ct]&&ee.el[Ct](),F(z,[C])},enter(C){if(U[A]===t)return;let z=c,ee=u,O=h;if(!r.isMounted)if(i)z=k||c,ee=_||u,O=b||h;else return;let te=!1;C[cn]=Pe=>{te||(te=!0,Pe?F(O,[C]):F(ee,[C]),J.delayedLeave&&J.delayedLeave(),C[cn]=void 0)};const ke=C[cn].bind(null,!1);z?B(z,[C,ke]):ke()},leave(C,z){const ee=String(t.key);if(C[cn]&&C[cn](!0),r.isUnmounting)return z();F(d,[C]);let O=!1;C[Ct]=ke=>{O||(O=!0,z(),ke?F(y,[C]):F(p,[C]),C[Ct]=void 0,U[ee]===t&&delete U[ee])};const te=C[Ct].bind(null,!1);U[ee]=t,f?B(f,[C,te]):te()},clone(C){const z=Di(C,e,r,n,s);return s&&s(z),z}};return J}function pi(t){if(Js(t))return t=hr(t),t.children=null,t}function ea(t){if(!Js(t))return Sc(t.type)&&t.children?Ac(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:r}=t;if(r){if(e&16)return r[0];if(e&32&&ne(r.default))return r.default()}}function Dn(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Dn(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Rc(t,e=!1,r){let n=[],s=0;for(let i=0;i<t.length;i++){let o=t[i];const a=r==null?o.key:String(r)+String(o.key!=null?o.key:i);o.type===Fe?(o.patchFlag&128&&s++,n=n.concat(Rc(o.children,e,a))):(e||o.type!==Ye)&&n.push(a!=null?hr(o,{key:a}):o)}if(s>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function fr(t,e){return ne(t)?Le({name:t.name},e,{setup:t}):t}function Cc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function ta(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Ts=new WeakMap;function Sn(t,e,r,n,s=!1){if(W(t)){t.forEach((y,w)=>Sn(y,e&&(W(e)?e[w]:e),r,n,s));return}if(En(n)&&!s){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Sn(t,e,r,n.component.subTree);return}const i=n.shapeFlag&4?Qs(n.component):n.el,o=s?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ye?a.refs={}:a.refs,h=a.setupState,d=oe(h),f=h===ye?ql:y=>ta(u,y)?!1:he(d,y),p=(y,w)=>!(w&&ta(u,w));if(c!=null&&c!==l){if(ra(e),Se(c))u[c]=null,f(c)&&(h[c]=null);else if(xe(c)){const y=e;p(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(ne(l))Xn(l,a,12,[o,u]);else{const y=Se(l),w=xe(l);if(y||w){const k=()=>{if(t.f){const _=y?f(l)?h[l]:u[l]:p()||!t.k?l.value:u[t.k];if(s)W(_)&&po(_,i);else if(W(_))_.includes(i)||_.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const b=[i];p(l,t.k)&&(l.value=b),t.k&&(u[t.k]=b)}}else y?(u[l]=o,f(l)&&(h[l]=o)):w&&(p(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const _=()=>{k(),Ts.delete(t)};_.id=-1,Ts.set(t,_),tt(_,r)}else ra(t),k()}}}function ra(t){const e=Ts.get(t);e&&(e.flags|=8,Ts.delete(t))}zs().requestIdleCallback;zs().cancelIdleCallback;const En=t=>!!t.type.__asyncLoader,Js=t=>t.type.__isKeepAlive;function dd(t,e){Oc(t,"a",e)}function fd(t,e){Oc(t,"da",e)}function Oc(t,e,r=Ve){const n=t.__wdc||(t.__wdc=()=>{let s=r;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Ys(e,n,r),r){let s=r.parent;for(;s&&s.parent;)Js(s.parent.vnode)&&pd(n,e,r,s),s=s.parent}}function pd(t,e,r,n){const s=Ys(e,t,n,!0);Ic(()=>{po(n[e],s)},r)}function Ys(t,e,r=Ve,n=!1){if(r){const s=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Xt();const a=Zn(r),l=bt(e,r,t,o);return a(),Zt(),l});return n?s.unshift(i):s.push(i),i}}const er=t=>(e,r=Ve)=>{(!Bn||t==="sp")&&Ys(t,(...n)=>e(...n),r)},gd=er("bm"),To=er("m"),md=er("bu"),yd=er("u"),Pc=er("bum"),Ic=er("um"),vd=er("sp"),bd=er("rtg"),_d=er("rtc");function wd(t,e=Ve){Ys("ec",t,e)}const $c="components";function Ao(t,e){return Nc($c,t,!0,e)||t}const jc=Symbol.for("v-ndc");function na(t){return Se(t)?Nc($c,t,!1)||t:t||jc}function Nc(t,e,r=!0,n=!1){const s=ot||Ve;if(s){const i=s.type;{const a=of(i,!1);if(a&&(a===e||a===Ze(e)||a===Fs(Ze(e))))return i}const o=sa(s[t]||i[t],e)||sa(s.appContext[t],e);return!o&&n?i:o}}function sa(t,e){return t&&(t[e]||t[Ze(e)]||t[Fs(Ze(e))])}function Tn(t,e,r,n){let s;const i=r,o=W(t);if(o||Se(t)){const a=o&&Jt(t);let l=!1,c=!1;a&&(l=!lt(t),c=Qt(t),t=Ws(t)),s=new Array(t.length);for(let u=0,h=t.length;u<h;u++)s[u]=e(l?c?Xr(vt(t[u])):vt(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){s=new Array(t);for(let a=0;a<t;a++)s[a]=e(a+1,a,void 0,i)}else if(de(t))if(t[Symbol.iterator])s=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=e(t[u],u,l,i)}}else s=[];return s}const Ui=t=>t?ru(t)?Qs(t):Ui(t.parent):null,An=Le(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Ui(t.parent),$root:t=>Ui(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Dc(t),$forceUpdate:t=>t.f||(t.f=()=>{Eo(t.update)}),$nextTick:t=>t.n||(t.n=ur.bind(t.proxy)),$watch:t=>ad.bind(t)}),gi=(t,e)=>t!==ye&&!t.__isScriptSetup&&he(t,e),kd={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:n,data:s,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return n[e];case 2:return s[e];case 4:return r[e];case 3:return i[e]}else{if(gi(n,e))return o[e]=1,n[e];if(s!==ye&&he(s,e))return o[e]=2,s[e];if(he(i,e))return o[e]=3,i[e];if(r!==ye&&he(r,e))return o[e]=4,r[e];Bi&&(o[e]=0)}}const c=An[e];let u,h;if(c)return e==="$attrs"&&qe(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==ye&&he(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,he(h,e))return h[e]},set({_:t},e,r){const{data:n,setupState:s,ctx:i}=t;return gi(s,e)?(s[e]=r,!0):n!==ye&&he(n,e)?(n[e]=r,!0):he(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:n,appContext:s,props:i,type:o}},a){let l;return!!(r[a]||t!==ye&&a[0]!=="$"&&he(t,a)||gi(e,a)||he(i,a)||he(n,a)||he(An,a)||he(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:he(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function ia(t){return W(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Bi=!0;function Sd(t){const e=Dc(t),r=t.proxy,n=t.ctx;Bi=!1,e.beforeCreate&&oa(e.beforeCreate,t,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:p,activated:y,deactivated:w,beforeDestroy:k,beforeUnmount:_,destroyed:b,unmounted:A,render:U,renderTracked:F,renderTriggered:B,errorCaptured:J,serverPrefetch:C,expose:z,inheritAttrs:ee,components:O,directives:te,filters:ke}=e;if(c&&Ed(c,n,null),o)for(const $ in o){const V=o[$];ne(V)&&(n[$]=V.bind(r))}if(s){const $=s.call(r,r);de($)&&(t.data=Yn($))}if(Bi=!0,i)for(const $ in i){const V=i[$],Ee=ne(V)?V.bind(r,r):ne(V.get)?V.get.bind(r,r):Nt,Ue=!ne(V)&&ne(V.set)?V.set.bind(r):Nt,wt=Ne({get:Ee,set:Ue});Object.defineProperty(n,$,{enumerable:!0,configurable:!0,get:()=>wt.value,set:Qe=>wt.value=Qe})}if(a)for(const $ in a)Lc(a[$],n,r,$);if(l){const $=ne(l)?l.call(r):l;Reflect.ownKeys($).forEach(V=>{ys(V,$[V])})}u&&oa(u,t,"c");function M($,V){W(V)?V.forEach(Ee=>$(Ee.bind(r))):V&&$(V.bind(r))}if(M(gd,h),M(To,d),M(md,f),M(yd,p),M(dd,y),M(fd,w),M(wd,J),M(_d,F),M(bd,B),M(Pc,_),M(Ic,A),M(vd,C),W(z))if(z.length){const $=t.exposed||(t.exposed={});z.forEach(V=>{Object.defineProperty($,V,{get:()=>r[V],set:Ee=>r[V]=Ee,enumerable:!0})})}else t.exposed||(t.exposed={});U&&t.render===Nt&&(t.render=U),ee!=null&&(t.inheritAttrs=ee),O&&(t.components=O),te&&(t.directives=te),C&&Cc(t)}function Ed(t,e,r=Nt){W(t)&&(t=Mi(t));for(const n in t){const s=t[n];let i;de(s)?"default"in s?i=dt(s.from||n,s.default,!0):i=dt(s.from||n):i=dt(s),xe(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[n]=i}}function oa(t,e,r){bt(W(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function Lc(t,e,r,n){let s=n.includes(".")?kc(r,n):()=>r[n];if(Se(t)){const i=e[t];ne(i)&&Wt(s,i)}else if(ne(t))Wt(s,t.bind(r));else if(de(t))if(W(t))t.forEach(i=>Lc(i,e,r,n));else{const i=ne(t.handler)?t.handler.bind(r):e[t.handler];ne(i)&&Wt(s,i,t)}}function Dc(t){const e=t.type,{mixins:r,extends:n}=e,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!s.length&&!r&&!n?l=e:(l={},s.length&&s.forEach(c=>As(l,c,o,!0)),As(l,e,o)),de(e)&&i.set(e,l),l}function As(t,e,r,n=!1){const{mixins:s,extends:i}=e;i&&As(t,i,r,!0),s&&s.forEach(o=>As(t,o,r,!0));for(const o in e)if(!(n&&o==="expose")){const a=Td[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Td={data:aa,props:la,emits:la,methods:mn,computed:mn,beforeCreate:We,created:We,beforeMount:We,mounted:We,beforeUpdate:We,updated:We,beforeDestroy:We,beforeUnmount:We,destroyed:We,unmounted:We,activated:We,deactivated:We,errorCaptured:We,serverPrefetch:We,components:mn,directives:mn,watch:xd,provide:aa,inject:Ad};function aa(t,e){return e?t?function(){return Le(ne(t)?t.call(this,this):t,ne(e)?e.call(this,this):e)}:e:t}function Ad(t,e){return mn(Mi(t),Mi(e))}function Mi(t){if(W(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function We(t,e){return t?[...new Set([].concat(t,e))]:e}function mn(t,e){return t?Le(Object.create(null),t,e):e}function la(t,e){return t?W(t)&&W(e)?[...new Set([...t,...e])]:Le(Object.create(null),ia(t),ia(e??{})):e}function xd(t,e){if(!t)return e;if(!e)return t;const r=Le(Object.create(null),t);for(const n in e)r[n]=We(t[n],e[n]);return r}function Uc(){return{app:null,config:{isNativeTag:ql,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 Rd=0;function Cd(t,e){return function(n,s=null){ne(n)||(n=Le({},n)),s!=null&&!de(s)&&(s=null);const i=Uc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Rd++,_component:n,_props:s,_container:null,_context:i,_instance:null,version:lf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&ne(u.install)?(o.add(u),u.install(c,...h)):ne(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||le(n,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,Qs(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(bt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=xr;xr=c;try{return u()}finally{xr=h}}};return c}}let xr=null;const Od=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ze(e)}Modifiers`]||t[`${dr(e)}Modifiers`];function Pd(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||ye;let s=r;const i=e.startsWith("update:"),o=i&&Od(n,e.slice(7));o&&(o.trim&&(s=r.map(u=>Se(u)?u.trim():u)),o.number&&(s=r.map(Vs)));let a,l=n[a=ci(e)]||n[a=ci(Ze(e))];!l&&i&&(l=n[a=ci(dr(e))]),l&&bt(l,t,6,s);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,bt(c,t,6,s)}}const Id=new WeakMap;function Bc(t,e,r=!1){const n=r?Id:e.emitsCache,s=n.get(t);if(s!==void 0)return s;const i=t.emits;let o={},a=!1;if(!ne(t)){const l=c=>{const u=Bc(c,e,!0);u&&(a=!0,Le(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(de(t)&&n.set(t,null),null):(W(i)?i.forEach(l=>o[l]=null):Le(o,i),de(t)&&n.set(t,o),o)}function Xs(t,e){return!t||!Bs(e)?!1:(e=e.slice(2).replace(/Once$/,""),he(t,e[0].toLowerCase()+e.slice(1))||he(t,dr(e))||he(t,e))}function ca(t){const{type:e,vnode:r,proxy:n,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:p,inheritAttrs:y}=t,w=Es(t);let k,_;try{if(r.shapeFlag&4){const A=s||n,U=A;k=It(c.call(U,A,u,h,f,d,p)),_=a}else{const A=e;k=It(A.length>1?A(h,{attrs:a,slots:o,emit:l}):A(h,null)),_=e.props?a:$d(a)}}catch(A){xn.length=0,Gs(A,t,1),k=le(Ye)}let b=k;if(_&&y!==!1){const A=Object.keys(_),{shapeFlag:U}=b;A.length&&U&7&&(i&&A.some(Ms)&&(_=jd(_,i)),b=hr(b,_,!1,!0))}return r.dirs&&(b=hr(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(r.dirs):r.dirs),r.transition&&Dn(b,r.transition),k=b,Es(w),k}const $d=t=>{let e;for(const r in t)(r==="class"||r==="style"||Bs(r))&&((e||(e={}))[r]=t[r]);return e},jd=(t,e)=>{const r={};for(const n in t)(!Ms(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function Nd(t,e,r){const{props:n,children:s,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return n?ua(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Mc(o,n,d)&&!Xs(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?ua(n,o,c):!0:!!o;return!1}function ua(t,e,r){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let s=0;s<n.length;s++){const i=n[s];if(Mc(e,t,i)&&!Xs(r,i))return!0}return!1}function Mc(t,e,r){const n=t[r],s=e[r];return r==="style"&&de(n)&&de(s)?!sn(n,s):n!==s}function Ld({vnode:t,parent:e,suspense:r},n){for(;e;){const s=e.subTree;if(s.suspense&&s.suspense.activeBranch===t&&(s.suspense.vnode.el=s.el=n,t=s),s===t)(t=e.vnode).el=n,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=n)}const Hc={},qc=()=>Object.create(Hc),Fc=t=>Object.getPrototypeOf(t)===Hc;function Dd(t,e,r,n=!1){const s={},i=qc();t.propsDefaults=Object.create(null),Vc(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);r?t.props=n?s:fc(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Ud(t,e,r,n){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,a=oe(s),[l]=t.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(Xs(t.emitsOptions,d))continue;const f=e[d];if(l)if(he(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=Ze(d);s[p]=Hi(l,a,p,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Vc(t,e,s,i)&&(c=!0);let u;for(const h in a)(!e||!he(e,h)&&((u=dr(h))===h||!he(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(s[h]=Hi(l,a,h,void 0,t,!0)):delete s[h]);if(i!==a)for(const h in i)(!e||!he(e,h))&&(delete i[h],c=!0)}c&&Vt(t.attrs,"set","")}function Vc(t,e,r,n){const[s,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(_n(l))continue;const c=e[l];let u;s&&he(s,u=Ze(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Xs(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(i){const l=oe(r),c=a||ye;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Hi(s,l,h,c[h],t,!he(c,h))}}return o}function Hi(t,e,r,n,s,i){const o=t[r];if(o!=null){const a=he(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&ne(l)){const{propsDefaults:c}=s;if(r in c)n=c[r];else{const u=Zn(s);n=c[r]=l.call(null,e),u()}}else n=l;s.ce&&s.ce._setProp(r,n)}o[0]&&(i&&!a?n=!1:o[1]&&(n===""||n===dr(r))&&(n=!0))}return n}const Bd=new WeakMap;function zc(t,e,r=!1){const n=r?Bd:e.propsCache,s=n.get(t);if(s)return s;const i=t.props,o={},a=[];let l=!1;if(!ne(t)){const u=h=>{l=!0;const[d,f]=zc(h,e,!0);Le(o,d),f&&a.push(...f)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return de(t)&&n.set(t,Wr),Wr;if(W(i))for(let u=0;u<i.length;u++){const h=Ze(i[u]);ha(h)&&(o[h]=ye)}else if(i)for(const u in i){const h=Ze(u);if(ha(h)){const d=i[u],f=o[h]=W(d)||ne(d)?{type:d}:Le({},d),p=f.type;let y=!1,w=!0;if(W(p))for(let k=0;k<p.length;++k){const _=p[k],b=ne(_)&&_.name;if(b==="Boolean"){y=!0;break}else b==="String"&&(w=!1)}else y=ne(p)&&p.name==="Boolean";f[0]=y,f[1]=w,(y||he(f,"default"))&&a.push(h)}}const c=[o,a];return de(t)&&n.set(t,c),c}function ha(t){return t[0]!=="$"&&!_n(t)}const xo=t=>t==="_"||t==="_ctx"||t==="$stable",Ro=t=>W(t)?t.map(It):[It(t)],Md=(t,e,r)=>{if(e._n)return e;const n=Jr((...s)=>Ro(e(...s)),r);return n._c=!1,n},Wc=(t,e,r)=>{const n=t._ctx;for(const s in t){if(xo(s))continue;const i=t[s];if(ne(i))e[s]=Md(s,i,n);else if(i!=null){const o=Ro(i);e[s]=()=>o}}},Kc=(t,e)=>{const r=Ro(e);t.slots.default=()=>r},Gc=(t,e,r)=>{for(const n in e)(r||!xo(n))&&(t[n]=e[n])},Hd=(t,e,r)=>{const n=t.slots=qc();if(t.vnode.shapeFlag&32){const s=e._;s?(Gc(n,e,r),r&&Wl(n,"_",s,!0)):Wc(e,n)}else e&&Kc(t,e)},qd=(t,e,r)=>{const{vnode:n,slots:s}=t;let i=!0,o=ye;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:Gc(s,e,r):(i=!e.$stable,Wc(e,s)),o=e}else e&&(Kc(t,e),o={default:1});if(i)for(const a in s)!xo(a)&&o[a]==null&&delete s[a]},tt=Kd;function Fd(t){return Vd(t)}function Vd(t,e){const r=zs();r.__VUE__=!0;const{insert:n,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=Nt,insertStaticContent:p}=t,y=(g,m,v,S=null,x=null,E=null,N=void 0,I=null,P=!!m.dynamicChildren)=>{if(g===m)return;g&&!Sr(g,m)&&(S=T(g),Qe(g,x,E,!0),g=null),m.patchFlag===-2&&(P=!1,m.dynamicChildren=null);const{type:R,ref:Y,shapeFlag:D}=m;switch(R){case Zs:w(g,m,v,S);break;case Ye:k(g,m,v,S);break;case yi:g==null&&_(m,v,S,N);break;case Fe:O(g,m,v,S,x,E,N,I,P);break;default:D&1?U(g,m,v,S,x,E,N,I,P):D&6?te(g,m,v,S,x,E,N,I,P):(D&64||D&128)&&R.process(g,m,v,S,x,E,N,I,P,K)}Y!=null&&x?Sn(Y,g&&g.ref,E,m||g,!m):Y==null&&g&&g.ref!=null&&Sn(g.ref,null,E,g,!0)},w=(g,m,v,S)=>{if(g==null)n(m.el=a(m.children),v,S);else{const x=m.el=g.el;m.children!==g.children&&c(x,m.children)}},k=(g,m,v,S)=>{g==null?n(m.el=l(m.children||""),v,S):m.el=g.el},_=(g,m,v,S)=>{[g.el,g.anchor]=p(g.children,m,v,S,g.el,g.anchor)},b=({el:g,anchor:m},v,S)=>{let x;for(;g&&g!==m;)x=d(g),n(g,v,S),g=x;n(m,v,S)},A=({el:g,anchor:m})=>{let v;for(;g&&g!==m;)v=d(g),s(g),g=v;s(m)},U=(g,m,v,S,x,E,N,I,P)=>{if(m.type==="svg"?N="svg":m.type==="math"&&(N="mathml"),g==null)F(m,v,S,x,E,N,I,P);else{const R=g.el&&g.el._isVueCE?g.el:null;try{R&&R._beginPatch(),C(g,m,x,E,N,I,P)}finally{R&&R._endPatch()}}},F=(g,m,v,S,x,E,N,I)=>{let P,R;const{props:Y,shapeFlag:D,transition:G,dirs:Z}=g;if(P=g.el=o(g.type,E,Y&&Y.is,Y),D&8?u(P,g.children):D&16&&J(g.children,P,null,S,x,mi(g,E),N,I),Z&&gr(g,null,S,"created"),B(P,g,g.scopeId,N,S),Y){for(const ge in Y)ge!=="value"&&!_n(ge)&&i(P,ge,null,Y[ge],E,S);"value"in Y&&i(P,"value",null,Y.value,E),(R=Y.onVnodeBeforeMount)&&Tt(R,S,g)}Z&&gr(g,null,S,"beforeMount");const ae=zd(x,G);ae&&G.beforeEnter(P),n(P,m,v),((R=Y&&Y.onVnodeMounted)||ae||Z)&&tt(()=>{try{R&&Tt(R,S,g),ae&&G.enter(P),Z&&gr(g,null,S,"mounted")}finally{}},x)},B=(g,m,v,S,x)=>{if(v&&f(g,v),S)for(let E=0;E<S.length;E++)f(g,S[E]);if(x){let E=x.subTree;if(m===E||Zc(E.type)&&(E.ssContent===m||E.ssFallback===m)){const N=x.vnode;B(g,N,N.scopeId,N.slotScopeIds,x.parent)}}},J=(g,m,v,S,x,E,N,I,P=0)=>{for(let R=P;R<g.length;R++){const Y=g[R]=I?Ft(g[R]):It(g[R]);y(null,Y,m,v,S,x,E,N,I)}},C=(g,m,v,S,x,E,N)=>{const I=m.el=g.el;let{patchFlag:P,dynamicChildren:R,dirs:Y}=m;P|=g.patchFlag&16;const D=g.props||ye,G=m.props||ye;let Z;if(v&&mr(v,!1),(Z=G.onVnodeBeforeUpdate)&&Tt(Z,v,m,g),Y&&gr(m,g,v,"beforeUpdate"),v&&mr(v,!0),(D.innerHTML&&G.innerHTML==null||D.textContent&&G.textContent==null)&&u(I,""),R?z(g.dynamicChildren,R,I,v,S,mi(m,x),E):N||V(g,m,I,null,v,S,mi(m,x),E,!1),P>0){if(P&16)ee(I,D,G,v,x);else if(P&2&&D.class!==G.class&&i(I,"class",null,G.class,x),P&4&&i(I,"style",D.style,G.style,x),P&8){const ae=m.dynamicProps;for(let ge=0;ge<ae.length;ge++){const ve=ae[ge],Ce=D[ve],Be=G[ve];(Be!==Ce||ve==="value")&&i(I,ve,Ce,Be,x,v)}}P&1&&g.children!==m.children&&u(I,m.children)}else!N&&R==null&&ee(I,D,G,v,x);((Z=G.onVnodeUpdated)||Y)&&tt(()=>{Z&&Tt(Z,v,m,g),Y&&gr(m,g,v,"updated")},S)},z=(g,m,v,S,x,E,N)=>{for(let I=0;I<m.length;I++){const P=g[I],R=m[I],Y=P.el&&(P.type===Fe||!Sr(P,R)||P.shapeFlag&198)?h(P.el):v;y(P,R,Y,null,S,x,E,N,!0)}},ee=(g,m,v,S,x)=>{if(m!==v){if(m!==ye)for(const E in m)!_n(E)&&!(E in v)&&i(g,E,m[E],null,x,S);for(const E in v){if(_n(E))continue;const N=v[E],I=m[E];N!==I&&E!=="value"&&i(g,E,I,N,x,S)}"value"in v&&i(g,"value",m.value,v.value,x)}},O=(g,m,v,S,x,E,N,I,P)=>{const R=m.el=g?g.el:a(""),Y=m.anchor=g?g.anchor:a("");let{patchFlag:D,dynamicChildren:G,slotScopeIds:Z}=m;Z&&(I=I?I.concat(Z):Z),g==null?(n(R,v,S),n(Y,v,S),J(m.children||[],v,Y,x,E,N,I,P)):D>0&&D&64&&G&&g.dynamicChildren&&g.dynamicChildren.length===G.length?(z(g.dynamicChildren,G,v,x,E,N,I),(m.key!=null||x&&m===x.subTree)&&Jc(g,m,!0)):V(g,m,v,Y,x,E,N,I,P)},te=(g,m,v,S,x,E,N,I,P)=>{m.slotScopeIds=I,g==null?m.shapeFlag&512?x.ctx.activate(m,v,S,N,P):ke(m,v,S,x,E,N,P):Pe(g,m,P)},ke=(g,m,v,S,x,E,N)=>{const I=g.component=ef(g,S,x);if(Js(g)&&(I.ctx.renderer=K),tf(I,!1,N),I.asyncDep){if(x&&x.registerDep(I,M,N),!g.el){const P=I.subTree=le(Ye);k(null,P,m,v),g.placeholder=P.el}}else M(I,g,m,v,x,E,N)},Pe=(g,m,v)=>{const S=m.component=g.component;if(Nd(g,m,v))if(S.asyncDep&&!S.asyncResolved){$(S,m,v);return}else S.next=m,S.update();else m.el=g.el,S.vnode=m},M=(g,m,v,S,x,E,N)=>{const I=()=>{if(g.isMounted){let{next:D,bu:G,u:Z,parent:ae,vnode:ge}=g;{const St=Yc(g);if(St){D&&(D.el=ge.el,$(g,D,N)),St.asyncDep.then(()=>{tt(()=>{g.isUnmounted||R()},x)});return}}let ve=D,Ce;mr(g,!1),D?(D.el=ge.el,$(g,D,N)):D=ge,G&&ms(G),(Ce=D.props&&D.props.onVnodeBeforeUpdate)&&Tt(Ce,ae,D,ge),mr(g,!0);const Be=ca(g),kt=g.subTree;g.subTree=Be,y(kt,Be,h(kt.el),T(kt),g,x,E),D.el=Be.el,ve===null&&Ld(g,Be.el),Z&&tt(Z,x),(Ce=D.props&&D.props.onVnodeUpdated)&&tt(()=>Tt(Ce,ae,D,ge),x)}else{let D;const{el:G,props:Z}=m,{bm:ae,m:ge,parent:ve,root:Ce,type:Be}=g,kt=En(m);mr(g,!1),ae&&ms(ae),!kt&&(D=Z&&Z.onVnodeBeforeMount)&&Tt(D,ve,m),mr(g,!0);{Ce.ce&&Ce.ce._hasShadowRoot()&&Ce.ce._injectChildStyle(Be,g.parent?g.parent.type:void 0);const St=g.subTree=ca(g);y(null,St,v,S,g,x,E),m.el=St.el}if(ge&&tt(ge,x),!kt&&(D=Z&&Z.onVnodeMounted)){const St=m;tt(()=>Tt(D,ve,St),x)}(m.shapeFlag&256||ve&&En(ve.vnode)&&ve.vnode.shapeFlag&256)&&g.a&&tt(g.a,x),g.isMounted=!0,m=v=S=null}};g.scope.on();const P=g.effect=new Ql(I);g.scope.off();const R=g.update=P.run.bind(P),Y=g.job=P.runIfDirty.bind(P);Y.i=g,Y.id=g.uid,P.scheduler=()=>Eo(Y),mr(g,!0),R()},$=(g,m,v)=>{m.component=g;const S=g.vnode.props;g.vnode=m,g.next=null,Ud(g,m.props,S,v),qd(g,m.children,v),Xt(),Qo(g),Zt()},V=(g,m,v,S,x,E,N,I,P=!1)=>{const R=g&&g.children,Y=g?g.shapeFlag:0,D=m.children,{patchFlag:G,shapeFlag:Z}=m;if(G>0){if(G&128){Ue(R,D,v,S,x,E,N,I,P);return}else if(G&256){Ee(R,D,v,S,x,E,N,I,P);return}}Z&8?(Y&16&&ct(R,x,E),D!==R&&u(v,D)):Y&16?Z&16?Ue(R,D,v,S,x,E,N,I,P):ct(R,x,E,!0):(Y&8&&u(v,""),Z&16&&J(D,v,S,x,E,N,I,P))},Ee=(g,m,v,S,x,E,N,I,P)=>{g=g||Wr,m=m||Wr;const R=g.length,Y=m.length,D=Math.min(R,Y);let G;for(G=0;G<D;G++){const Z=m[G]=P?Ft(m[G]):It(m[G]);y(g[G],Z,v,null,x,E,N,I,P)}R>Y?ct(g,x,E,!0,!1,D):J(m,v,S,x,E,N,I,P,D)},Ue=(g,m,v,S,x,E,N,I,P)=>{let R=0;const Y=m.length;let D=g.length-1,G=Y-1;for(;R<=D&&R<=G;){const Z=g[R],ae=m[R]=P?Ft(m[R]):It(m[R]);if(Sr(Z,ae))y(Z,ae,v,null,x,E,N,I,P);else break;R++}for(;R<=D&&R<=G;){const Z=g[D],ae=m[G]=P?Ft(m[G]):It(m[G]);if(Sr(Z,ae))y(Z,ae,v,null,x,E,N,I,P);else break;D--,G--}if(R>D){if(R<=G){const Z=G+1,ae=Z<Y?m[Z].el:S;for(;R<=G;)y(null,m[R]=P?Ft(m[R]):It(m[R]),v,ae,x,E,N,I,P),R++}}else if(R>G)for(;R<=D;)Qe(g[R],x,E,!0),R++;else{const Z=R,ae=R,ge=new Map;for(R=ae;R<=G;R++){const nt=m[R]=P?Ft(m[R]):It(m[R]);nt.key!=null&&ge.set(nt.key,R)}let ve,Ce=0;const Be=G-ae+1;let kt=!1,St=0;const an=new Array(Be);for(R=0;R<Be;R++)an[R]=0;for(R=Z;R<=D;R++){const nt=g[R];if(Ce>=Be){Qe(nt,x,E,!0);continue}let Et;if(nt.key!=null)Et=ge.get(nt.key);else for(ve=ae;ve<=G;ve++)if(an[ve-ae]===0&&Sr(nt,m[ve])){Et=ve;break}Et===void 0?Qe(nt,x,E,!0):(an[Et-ae]=R+1,Et>=St?St=Et:kt=!0,y(nt,m[Et],v,null,x,E,N,I,P),Ce++)}const zo=kt?Wd(an):Wr;for(ve=zo.length-1,R=Be-1;R>=0;R--){const nt=ae+R,Et=m[nt],Wo=m[nt+1],Ko=nt+1<Y?Wo.el||Xc(Wo):S;an[R]===0?y(null,Et,v,Ko,x,E,N,I,P):kt&&(ve<0||R!==zo[ve]?wt(Et,v,Ko,2):ve--)}}},wt=(g,m,v,S,x=null)=>{const{el:E,type:N,transition:I,children:P,shapeFlag:R}=g;if(R&6){wt(g.component.subTree,m,v,S);return}if(R&128){g.suspense.move(m,v,S);return}if(R&64){N.move(g,m,v,K);return}if(N===Fe){n(E,m,v);for(let D=0;D<P.length;D++)wt(P[D],m,v,S);n(g.anchor,m,v);return}if(N===yi){b(g,m,v);return}if(S!==2&&R&1&&I)if(S===0)I.beforeEnter(E),n(E,m,v),tt(()=>I.enter(E),x);else{const{leave:D,delayLeave:G,afterLeave:Z}=I,ae=()=>{g.ctx.isUnmounted?s(E):n(E,m,v)},ge=()=>{E._isLeaving&&E[Ct](!0),D(E,()=>{ae(),Z&&Z()})};G?G(E,ae,ge):ge()}else n(E,m,v)},Qe=(g,m,v,S=!1,x=!1)=>{const{type:E,props:N,ref:I,children:P,dynamicChildren:R,shapeFlag:Y,patchFlag:D,dirs:G,cacheIndex:Z,memo:ae}=g;if(D===-2&&(x=!1),I!=null&&(Xt(),Sn(I,null,v,g,!0),Zt()),Z!=null&&(m.renderCache[Z]=void 0),Y&256){m.ctx.deactivate(g);return}const ge=Y&1&&G,ve=!En(g);let Ce;if(ve&&(Ce=N&&N.onVnodeBeforeUnmount)&&Tt(Ce,m,g),Y&6)pr(g.component,v,S);else{if(Y&128){g.suspense.unmount(v,S);return}ge&&gr(g,null,m,"beforeUnmount"),Y&64?g.type.remove(g,m,v,K,S):R&&!R.hasOnce&&(E!==Fe||D>0&&D&64)?ct(R,m,v,!1,!0):(E===Fe&&D&384||!x&&Y&16)&&ct(P,m,v),S&&Or(g)}const Be=ae!=null&&Z==null;(ve&&(Ce=N&&N.onVnodeUnmounted)||ge||Be)&&tt(()=>{Ce&&Tt(Ce,m,g),ge&&gr(g,null,m,"unmounted"),Be&&(g.el=null)},v)},Or=g=>{const{type:m,el:v,anchor:S,transition:x}=g;if(m===Fe){Pr(v,S);return}if(m===yi){A(g);return}const E=()=>{s(v),x&&!x.persisted&&x.afterLeave&&x.afterLeave()};if(g.shapeFlag&1&&x&&!x.persisted){const{leave:N,delayLeave:I}=x,P=()=>N(v,E);I?I(g.el,E,P):P()}else E()},Pr=(g,m)=>{let v;for(;g!==m;)v=d(g),s(g),g=v;s(m)},pr=(g,m,v)=>{const{bum:S,scope:x,job:E,subTree:N,um:I,m:P,a:R}=g;da(P),da(R),S&&ms(S),x.stop(),E&&(E.flags|=8,Qe(N,g,m,v)),I&&tt(I,m),tt(()=>{g.isUnmounted=!0},m)},ct=(g,m,v,S=!1,x=!1,E=0)=>{for(let N=E;N<g.length;N++)Qe(g[N],m,v,S,x)},T=g=>{if(g.shapeFlag&6)return T(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const m=d(g.anchor||g.el),v=m&&m[ld];return v?d(v):m};let H=!1;const L=(g,m,v)=>{let S;g==null?m._vnode&&(Qe(m._vnode,null,null,!0),S=m._vnode.component):y(m._vnode||null,g,m,null,null,null,v),m._vnode=g,H||(H=!0,Qo(S),vc(),H=!1)},K={p:y,um:Qe,m:wt,r:Or,mt:ke,mc:J,pc:V,pbc:z,n:T,o:t};return{render:L,hydrate:void 0,createApp:Cd(L)}}function mi({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function mr({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function zd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Jc(t,e,r=!1){const n=t.children,s=e.children;if(W(n)&&W(s))for(let i=0;i<n.length;i++){const o=n[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Ft(s[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Jc(o,a)),a.type===Zs&&(a.patchFlag===-1&&(a=s[i]=Ft(a)),a.el=o.el),a.type===Ye&&!a.el&&(a.el=o.el)}}function Wd(t){const e=t.slice(),r=[0];let n,s,i,o,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(s=r[r.length-1],t[s]<c){e[n]=s,r.push(n);continue}for(i=0,o=r.length-1;i<o;)a=i+o>>1,t[r[a]]<c?i=a+1:o=a;c<t[r[i]]&&(i>0&&(e[n]=r[i-1]),r[i]=n)}}for(i=r.length,o=r[i-1];i-- >0;)r[i]=o,o=e[o];return r}function Yc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Yc(e)}function da(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Xc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Xc(e.subTree):null}const Zc=t=>t.__isSuspense;function Kd(t,e){e&&e.pendingBranch?W(t)?e.effects.push(...t):e.effects.push(t):rd(t)}const Fe=Symbol.for("v-fgt"),Zs=Symbol.for("v-txt"),Ye=Symbol.for("v-cmt"),yi=Symbol.for("v-stc"),xn=[];let at=null;function se(t=!1){xn.push(at=t?null:[])}function Gd(){xn.pop(),at=xn[xn.length-1]||null}let Un=1;function xs(t,e=!1){Un+=t,t<0&&at&&e&&(at.hasOnce=!0)}function Qc(t){return t.dynamicChildren=Un>0?at||Wr:null,Gd(),Un>0&&at&&at.push(t),t}function ce(t,e,r,n,s,i){return Qc(Q(t,e,r,n,s,i,!0))}function st(t,e,r,n,s){return Qc(le(t,e,r,n,s,!0))}function Rs(t){return t?t.__v_isVNode===!0:!1}function Sr(t,e){return t.type===e.type&&t.key===e.key}const eu=({key:t})=>t??null,vs=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?Se(t)||xe(t)||ne(t)?{i:ot,r:t,k:e,f:!!r}:t:null);function Q(t,e=null,r=null,n=0,s=null,i=t===Fe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&eu(e),ref:e&&vs(e),scopeId:_c,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:ot};return a?(Co(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=Se(r)?8:16),Un>0&&!o&&at&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&at.push(l),l}const le=Jd;function Jd(t,e=null,r=null,n=0,s=null,i=!1){if((!t||t===jc)&&(t=Ye),Rs(t)){const a=hr(t,e,!0);return r&&Co(a,r),Un>0&&!i&&at&&(a.shapeFlag&6?at[at.indexOf(t)]=a:at.push(a)),a.patchFlag=-2,a}if(af(t)&&(t=t.__vccOpts),e){e=Yd(e);let{class:a,style:l}=e;a&&!Se(a)&&(e.class=Ge(a)),de(l)&&(Ks(l)&&!W(l)&&(l=Le({},l)),e.style=go(l))}const o=Se(t)?1:Zc(t)?128:Sc(t)?64:de(t)?4:ne(t)?2:0;return Q(t,e,r,n,s,o,i,!0)}function Yd(t){return t?Ks(t)||Fc(t)?Le({},t):t:null}function hr(t,e,r=!1,n=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?Xd(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&eu(c),ref:e&&e.ref?r&&i?W(i)?i.concat(vs(e)):[i,vs(e)]:vs(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Fe?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&hr(t.ssContent),ssFallback:t.ssFallback&&hr(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&Dn(u,l.clone(u)),u}function tu(t=" ",e=0){return le(Zs,null,t,e)}function je(t="",e=!1){return e?(se(),st(Ye,null,t)):le(Ye,null,t)}function It(t){return t==null||typeof t=="boolean"?le(Ye):W(t)?le(Fe,null,t.slice()):Rs(t)?Ft(t):le(Zs,null,String(t))}function Ft(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:hr(t)}function Co(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(W(e))r=16;else if(typeof e=="object")if(n&65){const s=e.default;s&&(s._c&&(s._d=!1),Co(t,s()),s._c&&(s._d=!0));return}else{r=32;const s=e._;!s&&!Fc(e)?e._ctx=ot:s===3&&ot&&(ot.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else ne(e)?(e={default:e,_ctx:ot},r=32):(e=String(e),n&64?(r=16,e=[tu(e)]):r=8);t.children=e,t.shapeFlag|=r}function Xd(...t){const e={};for(let r=0;r<t.length;r++){const n=t[r];for(const s in n)if(s==="class")e.class!==n.class&&(e.class=Ge([e.class,n.class]));else if(s==="style")e.style=go([e.style,n.style]);else if(Bs(s)){const i=e[s],o=n[s];o&&i!==o&&!(W(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Ms(s)&&(e[s]=o)}else s!==""&&(e[s]=n[s])}return e}function Tt(t,e,r,n=null){bt(t,e,7,[r,n])}const Zd=Uc();let Qd=0;function ef(t,e,r){const n=t.type,s=(e?e.appContext:t.appContext)||Zd,i={uid:Qd++,vnode:t,type:n,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:zc(n,s),emitsOptions:Bc(n,s),emit:null,emitted:null,propsDefaults:ye,inheritAttrs:n.inheritAttrs,ctx:ye,data:ye,props:ye,attrs:ye,slots:ye,refs:ye,setupState:ye,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=Pd.bind(null,i),t.ce&&t.ce(i),i}let Ve=null;const Oo=()=>Ve||ot;let Cs,qi;{const t=zs(),e=(r,n)=>{let s;return(s=t[r])||(s=t[r]=[]),s.push(n),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Cs=e("__VUE_INSTANCE_SETTERS__",r=>Ve=r),qi=e("__VUE_SSR_SETTERS__",r=>Bn=r)}const Zn=t=>{const e=Ve;return Cs(t),t.scope.on(),()=>{t.scope.off(),Cs(e)}},fa=()=>{Ve&&Ve.scope.off(),Cs(null)};function ru(t){return t.vnode.shapeFlag&4}let Bn=!1;function tf(t,e=!1,r=!1){e&&qi(e);const{props:n,children:s}=t.vnode,i=ru(t);Dd(t,n,i,e),Hd(t,s,r||e);const o=i?rf(t,e):void 0;return e&&qi(!1),o}function rf(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,kd);const{setup:n}=r;if(n){Xt();const s=t.setupContext=n.length>1?sf(t):null,i=Zn(t),o=Xn(n,t,0,[t.props,s]),a=Fl(o);if(Zt(),i(),(a||t.sp)&&!En(t)&&Cc(t),a){if(o.then(fa,fa),e)return o.then(l=>{pa(t,l)}).catch(l=>{Gs(l,t,0)});t.asyncDep=o}else pa(t,o)}else nu(t)}function pa(t,e,r){ne(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:de(e)&&(t.setupState=gc(e)),nu(t)}function nu(t,e,r){const n=t.type;t.render||(t.render=n.render||Nt);{const s=Zn(t);Xt();try{Sd(t)}finally{Zt(),s()}}}const nf={get(t,e){return qe(t,"get",""),t[e]}};function sf(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,nf),slots:t.slots,emit:t.emit,expose:e}}function Qs(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(gc(So(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in An)return An[r](t)},has(e,r){return r in e||r in An}})):t.proxy}function of(t,e=!0){return ne(t)?t.displayName||t.name:t.name||e&&t.__name}function af(t){return ne(t)&&"__vccOpts"in t}const Ne=(t,e)=>Xh(t,e,Bn);function Zr(t,e,r){try{xs(-1);const n=arguments.length;return n===2?de(e)&&!W(e)?Rs(e)?le(t,null,[e]):le(t,e):le(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&Rs(r)&&(r=[r]),le(t,e,r))}finally{xs(1)}}const lf="3.5.34";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.34
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let Fi;const ga=typeof window<"u"&&window.trustedTypes;if(ga)try{Fi=ga.createPolicy("vue",{createHTML:t=>t})}catch{}const su=Fi?t=>Fi.createHTML(t):t=>t,cf="http://www.w3.org/2000/svg",uf="http://www.w3.org/1998/Math/MathML",Mt=typeof document<"u"?document:null,ma=Mt&&Mt.createElement("template"),hf={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,n)=>{const s=e==="svg"?Mt.createElementNS(cf,t):e==="mathml"?Mt.createElementNS(uf,t):r?Mt.createElement(t,{is:r}):Mt.createElement(t);return t==="select"&&n&&n.multiple!=null&&s.setAttribute("multiple",n.multiple),s},createText:t=>Mt.createTextNode(t),createComment:t=>Mt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Mt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,n,s,i){const o=r?r.previousSibling:e.lastChild;if(s&&(s===i||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),r),!(s===i||!(s=s.nextSibling)););else{ma.innerHTML=su(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=ma.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[o?o.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},rr="transition",un="animation",Mn=Symbol("_vtc"),iu={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},df=Le({},Ec,iu),ff=t=>(t.displayName="Transition",t.props=df,t),pf=ff((t,{slots:e})=>Zr(hd,gf(t),e)),yr=(t,e=[])=>{W(t)?t.forEach(r=>r(...e)):t&&t(...e)},ya=t=>t?W(t)?t.some(e=>e.length>1):t.length>1:!1;function gf(t){const e={};for(const O in t)O in iu||(e[O]=t[O]);if(t.css===!1)return e;const{name:r="v",type:n,duration:s,enterFromClass:i=`${r}-enter-from`,enterActiveClass:o=`${r}-enter-active`,enterToClass:a=`${r}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${r}-leave-from`,leaveActiveClass:d=`${r}-leave-active`,leaveToClass:f=`${r}-leave-to`}=t,p=mf(s),y=p&&p[0],w=p&&p[1],{onBeforeEnter:k,onEnter:_,onEnterCancelled:b,onLeave:A,onLeaveCancelled:U,onBeforeAppear:F=k,onAppear:B=_,onAppearCancelled:J=b}=e,C=(O,te,ke,Pe)=>{O._enterCancelled=Pe,vr(O,te?u:a),vr(O,te?c:o),ke&&ke()},z=(O,te)=>{O._isLeaving=!1,vr(O,h),vr(O,f),vr(O,d),te&&te()},ee=O=>(te,ke)=>{const Pe=O?B:_,M=()=>C(te,O,ke);yr(Pe,[te,M]),va(()=>{vr(te,O?l:i),Dt(te,O?u:a),ya(Pe)||ba(te,n,y,M)})};return Le(e,{onBeforeEnter(O){yr(k,[O]),Dt(O,i),Dt(O,o)},onBeforeAppear(O){yr(F,[O]),Dt(O,l),Dt(O,c)},onEnter:ee(!1),onAppear:ee(!0),onLeave(O,te){O._isLeaving=!0;const ke=()=>z(O,te);Dt(O,h),O._enterCancelled?(Dt(O,d),ka(O)):(ka(O),Dt(O,d)),va(()=>{O._isLeaving&&(vr(O,h),Dt(O,f),ya(A)||ba(O,n,w,ke))}),yr(A,[O,ke])},onEnterCancelled(O){C(O,!1,void 0,!0),yr(b,[O])},onAppearCancelled(O){C(O,!0,void 0,!0),yr(J,[O])},onLeaveCancelled(O){z(O),yr(U,[O])}})}function mf(t){if(t==null)return null;if(de(t))return[vi(t.enter),vi(t.leave)];{const e=vi(t);return[e,e]}}function vi(t){return mh(t)}function Dt(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.add(r)),(t[Mn]||(t[Mn]=new Set)).add(e)}function vr(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.remove(n));const r=t[Mn];r&&(r.delete(e),r.size||(t[Mn]=void 0))}function va(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let yf=0;function ba(t,e,r,n){const s=t._endId=++yf,i=()=>{s===t._endId&&n()};if(r!=null)return setTimeout(i,r);const{type:o,timeout:a,propCount:l}=vf(t,e);if(!o)return n();const c=o+"end";let u=0;const h=()=>{t.removeEventListener(c,d),i()},d=f=>{f.target===t&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),t.addEventListener(c,d)}function vf(t,e){const r=window.getComputedStyle(t),n=p=>(r[p]||"").split(", "),s=n(`${rr}Delay`),i=n(`${rr}Duration`),o=_a(s,i),a=n(`${un}Delay`),l=n(`${un}Duration`),c=_a(a,l);let u=null,h=0,d=0;e===rr?o>0&&(u=rr,h=o,d=i.length):e===un?c>0&&(u=un,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?rr:un:null,d=u?u===rr?i.length:l.length:0);const f=u===rr&&/\b(?:transform|all)(?:,|$)/.test(n(`${rr}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function _a(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((r,n)=>wa(r)+wa(t[n])))}function wa(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function ka(t){return(t?t.ownerDocument:document).body.offsetHeight}function bf(t,e,r){const n=t[Mn];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const Sa=Symbol("_vod"),_f=Symbol("_vsh"),wf=Symbol(""),kf=/(?:^|;)\s*display\s*:/;function Sf(t,e,r){const n=t.style,s=Se(r);let i=!1;if(r&&!s){if(e)if(Se(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&yn(n,a,"")}else for(const o in e)r[o]==null&&yn(n,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?Tf(t,o,!Se(e)&&e?e[o]:void 0,a)||yn(n,o,a):yn(n,o,"")}}else if(s){if(e!==r){const o=n[wf];o&&(r+=";"+o),n.cssText=r,i=kf.test(r)}}else e&&t.removeAttribute("style");Sa in t&&(t[Sa]=i?n.display:"",t[_f]&&(n.display="none"))}const Ea=/\s*!important$/;function yn(t,e,r){if(W(r))r.forEach(n=>yn(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const n=Ef(t,e);Ea.test(r)?t.setProperty(dr(n),r.replace(Ea,""),"important"):t[n]=r}}const Ta=["Webkit","Moz","ms"],bi={};function Ef(t,e){const r=bi[e];if(r)return r;let n=Ze(e);if(n!=="filter"&&n in t)return bi[e]=n;n=Fs(n);for(let s=0;s<Ta.length;s++){const i=Ta[s]+n;if(i in t)return bi[e]=i}return e}function Tf(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&Se(n)&&r===n}const Aa="http://www.w3.org/1999/xlink";function xa(t,e,r,n,s,i=kh(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(Aa,e.slice(6,e.length)):t.setAttributeNS(Aa,e,r):r==null||i&&!Kl(r)?t.removeAttribute(e):t.setAttribute(e,i?"":ft(r)?String(r):r)}function Ra(t,e,r,n,s){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?su(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let o=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=Kl(r):r==null&&a==="string"?(r="",o=!0):a==="number"&&(r=0,o=!0)}try{t[e]=r}catch{}o&&t.removeAttribute(s||e)}function ar(t,e,r,n){t.addEventListener(e,r,n)}function Af(t,e,r,n){t.removeEventListener(e,r,n)}const Ca=Symbol("_vei");function xf(t,e,r,n,s=null){const i=t[Ca]||(t[Ca]={}),o=i[e];if(n&&o)o.value=n;else{const[a,l]=Rf(e);if(n){const c=i[e]=Pf(n,s);ar(t,a,c,l)}else o&&(Af(t,a,o,l),i[e]=void 0)}}const Oa=/(?:Once|Passive|Capture)$/;function Rf(t){let e;if(Oa.test(t)){e={};let n;for(;n=t.match(Oa);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):dr(t.slice(2)),e]}let _i=0;const Cf=Promise.resolve(),Of=()=>_i||(Cf.then(()=>_i=0),_i=Date.now());function Pf(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;bt(If(n,r.value),e,5,[n])};return r.value=t,r.attached=Of(),r}function If(t,e){if(W(e)){const r=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{r.call(t),t._stopped=!0},e.map(n=>s=>!s._stopped&&n&&n(s))}else return e}const Pa=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,$f=(t,e,r,n,s,i)=>{const o=s==="svg";e==="class"?bf(t,n,o):e==="style"?Sf(t,r,n):Bs(e)?Ms(e)||xf(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):jf(t,e,n,o))?(Ra(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&xa(t,e,n,o,i,e!=="value")):t._isVueCE&&(Nf(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!Se(n)))?Ra(t,Ze(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),xa(t,e,n,o))};function jf(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&Pa(e)&&ne(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Pa(e)&&Se(r)?!1:e in t}function Nf(t,e){const r=t._def.props;if(!r)return!1;const n=Ze(e);return Array.isArray(r)?r.some(s=>Ze(s)===n):Object.keys(r).some(s=>Ze(s)===n)}const Qr=t=>{const e=t.props["onUpdate:modelValue"]||!1;return W(e)?r=>ms(e,r):e};function Lf(t){t.target.composing=!0}function Ia(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Yt=Symbol("_assign");function $a(t,e,r){return e&&(t=t.trim()),r&&(t=Vs(t)),t}const Df={created(t,{modifiers:{lazy:e,trim:r,number:n}},s){t[Yt]=Qr(s);const i=n||s.props&&s.props.type==="number";ar(t,e?"change":"input",o=>{o.target.composing||t[Yt]($a(t.value,r,i))}),(r||i)&&ar(t,"change",()=>{t.value=$a(t.value,r,i)}),e||(ar(t,"compositionstart",Lf),ar(t,"compositionend",Ia),ar(t,"change",Ia))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:n,trim:s,number:i}},o){if(t[Yt]=Qr(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?Vs(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(n&&e===r||s&&t.value.trim()===l)||(t.value=l)}},p_={deep:!0,created(t,e,r){t[Yt]=Qr(r),ar(t,"change",()=>{const n=t._modelValue,s=Hn(t),i=t.checked,o=t[Yt];if(W(n)){const a=mo(n,s),l=a!==-1;if(i&&!l)o(n.concat(s));else if(!i&&l){const c=[...n];c.splice(a,1),o(c)}}else if(nn(n)){const a=new Set(n);i?a.add(s):a.delete(s),o(a)}else o(ou(t,i))})},mounted:ja,beforeUpdate(t,e,r){t[Yt]=Qr(r),ja(t,e,r)}};function ja(t,{value:e,oldValue:r},n){t._modelValue=e;let s;if(W(e))s=mo(e,n.props.value)>-1;else if(nn(e))s=e.has(n.props.value);else{if(e===r)return;s=sn(e,ou(t,!0))}t.checked!==s&&(t.checked=s)}const g_={deep:!0,created(t,{value:e,modifiers:{number:r}},n){const s=nn(e);ar(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?Vs(Hn(o)):Hn(o));t[Yt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,ur(()=>{t._assigning=!1})}),t[Yt]=Qr(n)},mounted(t,{value:e}){Na(t,e)},beforeUpdate(t,e,r){t[Yt]=Qr(r)},updated(t,{value:e}){t._assigning||Na(t,e)}};function Na(t,e){const r=t.multiple,n=W(e);if(!(r&&!n&&!nn(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],a=Hn(o);if(r)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=mo(e,a)>-1}else o.selected=e.has(a);else if(sn(Hn(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function Hn(t){return"_value"in t?t._value:t.value}function ou(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const Uf=["ctrl","shift","alt","meta"],Bf={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>Uf.some(r=>t[`${r}Key`]&&!e.includes(r))},m_=(t,e)=>{if(!t)return t;const r=t._withMods||(t._withMods={}),n=e.join(".");return r[n]||(r[n]=((s,...i)=>{for(let o=0;o<e.length;o++){const a=Bf[e[o]];if(a&&a(s,e))return}return t(s,...i)}))},Mf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},y_=(t,e)=>{const r=t._withKeys||(t._withKeys={}),n=e.join(".");return r[n]||(r[n]=(s=>{if(!("key"in s))return;const i=dr(s.key);if(e.some(o=>o===i||Mf[o]===i))return t(s)}))},Hf=Le({patchProp:$f},hf);let La;function qf(){return La||(La=Fd(Hf))}const Ff=((...t)=>{const e=qf().createApp(...t),{mount:r}=e;return e.mount=n=>{const s=zf(n);if(!s)return;const i=e._component;!ne(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=r(s,!1,Vf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function Vf(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function zf(t){return Se(t)?document.querySelector(t):t}/*!
|
|
19
|
+
* pinia v3.0.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/let au;const ei=t=>au=t,lu=Symbol();function Vi(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Rn;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Rn||(Rn={}));function Wf(){const t=Xl(!0),e=t.run(()=>Re({}));let r=[],n=[];const s=So({install(i){ei(s),s._a=i,i.provide(lu,s),i.config.globalProperties.$pinia=s,n.forEach(o=>r.push(o)),n=[]},use(i){return this._a?r.push(i):n.push(i),this},_p:r,_a:null,_e:t,_s:new Map,state:e});return s}const cu=()=>{};function Da(t,e,r,n=cu){t.add(e);const s=()=>{t.delete(e)&&n()};return!r&&Zl()&&Eh(s),s}function $r(t,...e){t.forEach(r=>{r(...e)})}const Kf=t=>t(),Ua=Symbol(),wi=Symbol();function zi(t,e){t instanceof Map&&e instanceof Map?e.forEach((r,n)=>t.set(n,r)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const r in e){if(!e.hasOwnProperty(r))continue;const n=e[r],s=t[r];Vi(s)&&Vi(n)&&t.hasOwnProperty(r)&&!xe(n)&&!Jt(n)?t[r]=zi(s,n):t[r]=n}return t}const Gf=Symbol();function Jf(t){return!Vi(t)||!Object.prototype.hasOwnProperty.call(t,Gf)}const{assign:sr}=Object;function Yf(t){return!!(xe(t)&&t.effect)}function Xf(t,e,r,n){const{state:s,actions:i,getters:o}=e,a=r.state.value[t];let l;function c(){a||(r.state.value[t]=s?s():{});const u=Kh(r.state.value[t]);return sr(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=So(Ne(()=>{ei(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=uu(t,c,e,r,n,!0),l}function uu(t,e,r={},n,s,i){let o;const a=sr({actions:{}},r),l={deep:!0};let c,u,h=new Set,d=new Set,f;const p=n.state.value[t];!i&&!p&&(n.state.value[t]={});let y;function w(J){let C;c=u=!1,typeof J=="function"?(J(n.state.value[t]),C={type:Rn.patchFunction,storeId:t,events:f}):(zi(n.state.value[t],J),C={type:Rn.patchObject,payload:J,storeId:t,events:f});const z=y=Symbol();ur().then(()=>{y===z&&(c=!0)}),u=!0,$r(h,C,n.state.value[t])}const k=i?function(){const{state:C}=r,z=C?C():{};this.$patch(ee=>{sr(ee,z)})}:cu;function _(){o.stop(),h.clear(),d.clear(),n._s.delete(t)}const b=(J,C="")=>{if(Ua in J)return J[wi]=C,J;const z=function(){ei(n);const ee=Array.from(arguments),O=new Set,te=new Set;function ke($){O.add($)}function Pe($){te.add($)}$r(d,{args:ee,name:z[wi],store:U,after:ke,onError:Pe});let M;try{M=J.apply(this&&this.$id===t?this:U,ee)}catch($){throw $r(te,$),$}return M instanceof Promise?M.then($=>($r(O,$),$)).catch($=>($r(te,$),Promise.reject($))):($r(O,M),M)};return z[Ua]=!0,z[wi]=C,z},A={_p:n,$id:t,$onAction:Da.bind(null,d),$patch:w,$reset:k,$subscribe(J,C={}){const z=Da(h,J,C.detached,()=>ee()),ee=o.run(()=>Wt(()=>n.state.value[t],O=>{(C.flush==="sync"?u:c)&&J({storeId:t,type:Rn.direct,events:f},O)},sr({},l,C)));return z},$dispose:_},U=Yn(A);n._s.set(t,U);const B=(n._a&&n._a.runWithContext||Kf)(()=>n._e.run(()=>(o=Xl()).run(()=>e({action:b}))));for(const J in B){const C=B[J];if(xe(C)&&!Yf(C)||Jt(C))i||(p&&Jf(C)&&(xe(C)?C.value=p[J]:zi(C,p[J])),n.state.value[t][J]=C);else if(typeof C=="function"){const z=b(C,J);B[J]=z,a.actions[J]=C}}return sr(U,B),sr(oe(U),B),Object.defineProperty(U,"$state",{get:()=>n.state.value[t],set:J=>{w(C=>{sr(C,J)})}}),n._p.forEach(J=>{sr(U,o.run(()=>J({store:U,app:n._a,pinia:n,options:a})))}),p&&i&&r.hydrate&&r.hydrate(U.$state,p),c=!0,u=!0,U}/*! #__NO_SIDE_EFFECTS__ */function hu(t,e,r){let n;const s=typeof e=="function";n=s?r:e;function i(o,a){const l=sd();return o=o||(l?dt(lu,null):null),o&&ei(o),o=au,o._s.has(t)||(s?uu(t,e,n,o):Xf(t,n,o)),o._s.get(t)}return i.$id=t,i}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/const Mr=typeof document<"u";function du(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Zf(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&du(t.default)}const ue=Object.assign;function ki(t,e){const r={};for(const n in e){const s=e[n];r[n]=_t(s)?s.map(t):t(s)}return r}const Cn=()=>{},_t=Array.isArray;function Ba(t,e){const r={};for(const n in t)r[n]=n in e?e[n]:t[n];return r}const fu=/#/g,Qf=/&/g,ep=/\//g,tp=/=/g,rp=/\?/g,pu=/\+/g,np=/%5B/g,sp=/%5D/g,gu=/%5E/g,ip=/%60/g,mu=/%7B/g,op=/%7C/g,yu=/%7D/g,ap=/%20/g;function Po(t){return t==null?"":encodeURI(""+t).replace(op,"|").replace(np,"[").replace(sp,"]")}function lp(t){return Po(t).replace(mu,"{").replace(yu,"}").replace(gu,"^")}function Wi(t){return Po(t).replace(pu,"%2B").replace(ap,"+").replace(fu,"%23").replace(Qf,"%26").replace(ip,"`").replace(mu,"{").replace(yu,"}").replace(gu,"^")}function cp(t){return Wi(t).replace(tp,"%3D")}function up(t){return Po(t).replace(fu,"%23").replace(rp,"%3F")}function hp(t){return up(t).replace(ep,"%2F")}function qn(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const dp=/\/$/,fp=t=>t.replace(dp,"");function Si(t,e,r="/"){let n,s={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(n=e.slice(0,l),i=e.slice(l,a>0?a:e.length),s=t(i.slice(1))),a>=0&&(n=n||e.slice(0,a),o=e.slice(a,e.length)),n=yp(n??e,r),{fullPath:n+i+o,path:n,query:s,hash:qn(o)}}function pp(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function Ma(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function gp(t,e,r){const n=e.matched.length-1,s=r.matched.length-1;return n>-1&&n===s&&en(e.matched[n],r.matched[s])&&vu(e.params,r.params)&&t(e.query)===t(r.query)&&e.hash===r.hash}function en(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function vu(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!mp(t[r],e[r]))return!1;return!0}function mp(t,e){return _t(t)?Ha(t,e):_t(e)?Ha(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Ha(t,e){return _t(e)?t.length===e.length&&t.every((r,n)=>r===e[n]):t.length===1&&t[0]===e}function yp(t,e){if(t.startsWith("/"))return t;if(!t)return e;const r=e.split("/"),n=t.split("/"),s=n[n.length-1];(s===".."||s===".")&&n.push("");let i=r.length-1,o,a;for(o=0;o<n.length;o++)if(a=n[o],a!==".")if(a==="..")i>1&&i--;else break;return r.slice(0,i).join("/")+"/"+n.slice(o).join("/")}const nr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ki=(function(t){return t.pop="pop",t.push="push",t})({}),Ei=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function vp(t){if(!t)if(Mr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),fp(t)}const bp=/^[^#]+#/;function _p(t,e){return t.replace(bp,"#")+e}function wp(t,e){const r=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-r.left-(e.left||0),top:n.top-r.top-(e.top||0)}}const ti=()=>({left:window.scrollX,top:window.scrollY});function kp(t){let e;if("el"in t){const r=t.el,n=typeof r=="string"&&r.startsWith("#"),s=typeof r=="string"?n?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!s)return;e=wp(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function qa(t,e){return(history.state?history.state.position-e:-1)+t}const Gi=new Map;function Sp(t,e){Gi.set(t,e)}function Ep(t){const e=Gi.get(t);return Gi.delete(t),e}function Tp(t){return typeof t=="string"||t&&typeof t=="object"}function bu(t){return typeof t=="string"||typeof t=="symbol"}let Te=(function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t})({});const _u=Symbol("");Te.MATCHER_NOT_FOUND+"",Te.NAVIGATION_GUARD_REDIRECT+"",Te.NAVIGATION_ABORTED+"",Te.NAVIGATION_CANCELLED+"",Te.NAVIGATION_DUPLICATED+"";function tn(t,e){return ue(new Error,{type:t,[_u]:!0},e)}function Ut(t,e){return t instanceof Error&&_u in t&&(e==null||!!(t.type&e))}const Ap=["params","query","hash"];function xp(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of Ap)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Rp(t){const e={};if(t===""||t==="?")return e;const r=(t[0]==="?"?t.slice(1):t).split("&");for(let n=0;n<r.length;++n){const s=r[n].replace(pu," "),i=s.indexOf("="),o=qn(i<0?s:s.slice(0,i)),a=i<0?null:qn(s.slice(i+1));if(o in e){let l=e[o];_t(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function Fa(t){let e="";for(let r in t){const n=t[r];if(r=cp(r),n==null){n!==void 0&&(e+=(e.length?"&":"")+r);continue}(_t(n)?n.map(s=>s&&Wi(s)):[n&&Wi(n)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+r,s!=null&&(e+="="+s))})}return e}function Cp(t){const e={};for(const r in t){const n=t[r];n!==void 0&&(e[r]=_t(n)?n.map(s=>s==null?null:""+s):n==null?n:""+n)}return e}const Op=Symbol(""),Va=Symbol(""),ri=Symbol(""),Io=Symbol(""),Ji=Symbol("");function hn(){let t=[];function e(n){return t.push(n),()=>{const s=t.indexOf(n);s>-1&&t.splice(s,1)}}function r(){t=[]}return{add:e,list:()=>t.slice(),reset:r}}function or(t,e,r,n,s,i=o=>o()){const o=n&&(n.enterCallbacks[s]=n.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(tn(Te.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):Tp(d)?l(tn(Te.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&n.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(n&&n.instances[s],e,r,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function Ti(t,e,r,n,s=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(du(l)){const c=(l.__vccOpts||l)[e];c&&i.push(or(c,r,n,o,a,s))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=Zf(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&or(d,r,n,o,a,s)()}))}}return i}function Pp(t,e){const r=[],n=[],s=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>en(c,a))?n.push(a):r.push(a));const l=t.matched[o];l&&(e.matched.find(c=>en(c,l))||s.push(l))}return[r,n,s]}/*!
|
|
27
|
+
* vue-router v4.6.4
|
|
28
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
29
|
+
* @license MIT
|
|
30
|
+
*/let Ip=()=>location.protocol+"//"+location.host;function wu(t,e){const{pathname:r,search:n,hash:s}=e,i=t.indexOf("#");if(i>-1){let o=s.includes(t.slice(i))?t.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Ma(a,"")}return Ma(r,t)+n+s}function $p(t,e,r,n){let s=[],i=[],o=null;const a=({state:d})=>{const f=wu(t,location),p=r.value,y=e.value;let w=0;if(d){if(r.value=f,e.value=d,o&&o===p){o=null;return}w=y?d.position-y.position:0}else n(f);s.forEach(k=>{k(r.value,p,{delta:w,type:Ki.pop,direction:w?w>0?Ei.forward:Ei.back:Ei.unknown})})};function l(){o=r.value}function c(d){s.push(d);const f=()=>{const p=s.indexOf(d);p>-1&&s.splice(p,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(ue({},d.state,{scroll:ti()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function za(t,e,r,n=!1,s=!1){return{back:t,current:e,forward:r,replaced:n,position:window.history.length,scroll:s?ti():null}}function jp(t){const{history:e,location:r}=window,n={value:wu(t,r)},s={value:e.state};s.value||i(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(r.host&&document.querySelector("base")?t:t.slice(h))+l:Ip()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),r[u?"replace":"assign"](d)}}function o(l,c){i(l,ue({},e.state,za(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),n.value=l}function a(l,c){const u=ue({},s.value,e.state,{forward:l,scroll:ti()});i(u.current,u,!0),i(l,ue({},za(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:s,push:a,replace:o}}function Np(t){t=vp(t);const e=jp(t),r=$p(t,e.state,e.location,e.replace);function n(i,o=!0){o||r.pauseListeners(),history.go(i)}const s=ue({location:"",base:t,go:n,createHref:_p.bind(null,t)},e,r);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}let Er=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Ie=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(Ie||{});const Lp={type:Er.Static,value:""},Dp=/[a-zA-Z0-9_]/;function Up(t){if(!t)return[[]];if(t==="/")return[[Lp]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=Ie.Static,n=r;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===Ie.Static?i.push({type:Er.Static,value:c}):r===Ie.Param||r===Ie.ParamRegExp||r===Ie.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Er.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&r!==Ie.ParamRegExp){n=r,r=Ie.EscapeNext;continue}switch(r){case Ie.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=Ie.Param):d();break;case Ie.EscapeNext:d(),r=n;break;case Ie.Param:l==="("?r=Ie.ParamRegExp:Dp.test(l)?d():(h(),r=Ie.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ie.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=Ie.ParamRegExpEnd:u+=l;break;case Ie.ParamRegExpEnd:h(),r=Ie.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===Ie.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Wa="[^/]+?",Bp={sensitive:!1,strict:!1,start:!0,end:!0};var Ke=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(Ke||{});const Mp=/[.+*?^${}()[\]/\\]/g;function Hp(t,e){const r=ue({},Bp,e),n=[];let s=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[Ke.Root];r.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=Ke.Segment+(r.sensitive?Ke.BonusCaseSensitive:0);if(d.type===Er.Static)h||(s+="/"),s+=d.value.replace(Mp,"\\$&"),f+=Ke.Static;else if(d.type===Er.Param){const{value:p,repeatable:y,optional:w,regexp:k}=d;i.push({name:p,repeatable:y,optional:w});const _=k||Wa;if(_!==Wa){f+=Ke.BonusCustomRegExp;try{`${_}`}catch(A){throw new Error(`Invalid custom RegExp for param "${p}" (${_}): `+A.message)}}let b=y?`((?:${_})(?:/(?:${_}))*)`:`(${_})`;h||(b=w&&c.length<2?`(?:/${b})`:"/"+b),w&&(b+="?"),s+=b,f+=Ke.Dynamic,w&&(f+=Ke.BonusOptional),y&&(f+=Ke.BonusRepeatable),_===".*"&&(f+=Ke.BonusWildcard)}u.push(f)}n.push(u)}if(r.strict&&r.end){const c=n.length-1;n[c][n[c].length-1]+=Ke.BonusStrict}r.strict||(s+="/?"),r.end?s+="$":r.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,r.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",p=i[d-1];h[p.name]=f&&p.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Er.Static)u+=f.value;else if(f.type===Er.Param){const{value:p,repeatable:y,optional:w}=f,k=p in c?c[p]:"";if(_t(k)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const _=_t(k)?k.join("/"):k;if(!_)if(w)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=_}}return u||"/"}return{re:o,score:n,keys:i,parse:a,stringify:l}}function qp(t,e){let r=0;for(;r<t.length&&r<e.length;){const n=e[r]-t[r];if(n)return n;r++}return t.length<e.length?t.length===1&&t[0]===Ke.Static+Ke.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===Ke.Static+Ke.Segment?1:-1:0}function ku(t,e){let r=0;const n=t.score,s=e.score;for(;r<n.length&&r<s.length;){const i=qp(n[r],s[r]);if(i)return i;r++}if(Math.abs(s.length-n.length)===1){if(Ka(n))return 1;if(Ka(s))return-1}return s.length-n.length}function Ka(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Fp={strict:!1,end:!0,sensitive:!1};function Vp(t,e,r){const n=Hp(Up(t.path),r),s=ue(n,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function zp(t,e){const r=[],n=new Map;e=Ba(Fp,e);function s(h){return n.get(h)}function i(h,d,f){const p=!f,y=Ja(h);y.aliasOf=f&&f.record;const w=Ba(e,h),k=[y];if("alias"in h){const A=typeof h.alias=="string"?[h.alias]:h.alias;for(const U of A)k.push(Ja(ue({},y,{components:f?f.record.components:y.components,path:U,aliasOf:f?f.record:y})))}let _,b;for(const A of k){const{path:U}=A;if(d&&U[0]!=="/"){const F=d.record.path,B=F[F.length-1]==="/"?"":"/";A.path=d.record.path+(U&&B+U)}if(_=Vp(A,d,w),f?f.alias.push(_):(b=b||_,b!==_&&b.alias.push(_),p&&h.name&&!Ya(_)&&o(h.name)),Su(_)&&l(_),y.children){const F=y.children;for(let B=0;B<F.length;B++)i(F[B],_,f&&f.children[B])}f=f||_}return b?()=>{o(b)}:Cn}function o(h){if(bu(h)){const d=n.get(h);d&&(n.delete(h),r.splice(r.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=r.indexOf(h);d>-1&&(r.splice(d,1),h.record.name&&n.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return r}function l(h){const d=Gp(h,r);r.splice(d,0,h),h.record.name&&!Ya(h)&&n.set(h.record.name,h)}function c(h,d){let f,p={},y,w;if("name"in h&&h.name){if(f=n.get(h.name),!f)throw tn(Te.MATCHER_NOT_FOUND,{location:h});w=f.record.name,p=ue(Ga(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&Ga(h.params,f.keys.map(b=>b.name))),y=f.stringify(p)}else if(h.path!=null)y=h.path,f=r.find(b=>b.re.test(y)),f&&(p=f.parse(y),w=f.record.name);else{if(f=d.name?n.get(d.name):r.find(b=>b.re.test(d.path)),!f)throw tn(Te.MATCHER_NOT_FOUND,{location:h,currentLocation:d});w=f.record.name,p=ue({},d.params,h.params),y=f.stringify(p)}const k=[];let _=f;for(;_;)k.unshift(_.record),_=_.parent;return{name:w,path:y,params:p,matched:k,meta:Kp(k)}}t.forEach(h=>i(h));function u(){r.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Ga(t,e){const r={};for(const n of e)n in t&&(r[n]=t[n]);return r}function Ja(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Wp(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Wp(t){const e={},r=t.props||!1;if("component"in t)e.default=r;else for(const n in t.components)e[n]=typeof r=="object"?r[n]:r;return e}function Ya(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Kp(t){return t.reduce((e,r)=>ue(e,r.meta),{})}function Gp(t,e){let r=0,n=e.length;for(;r!==n;){const i=r+n>>1;ku(t,e[i])<0?n=i:r=i+1}const s=Jp(t);return s&&(n=e.lastIndexOf(s,n-1)),n}function Jp(t){let e=t;for(;e=e.parent;)if(Su(e)&&ku(t,e)===0)return e}function Su({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Xa(t){const e=dt(ri),r=dt(Io),n=Ne(()=>{const l=re(t.to);return e.resolve(l)}),s=Ne(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],h=r.matched;if(!u||!h.length)return-1;const d=h.findIndex(en.bind(null,u));if(d>-1)return d;const f=Za(l[c-2]);return c>1&&Za(u)===f&&h[h.length-1].path!==f?h.findIndex(en.bind(null,l[c-2])):d}),i=Ne(()=>s.value>-1&&eg(r.params,n.value.params)),o=Ne(()=>s.value>-1&&s.value===r.matched.length-1&&vu(r.params,n.value.params));function a(l={}){if(Qp(l)){const c=e[re(t.replace)?"replace":"push"](re(t.to)).catch(Cn);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:Ne(()=>n.value.href),isActive:i,isExactActive:o,navigate:a}}function Yp(t){return t.length===1?t[0]:t}const Xp=fr({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:Xa,setup(t,{slots:e}){const r=Yn(Xa(t)),{options:n}=dt(ri),s=Ne(()=>({[Qa(t.activeClass,n.linkActiveClass,"router-link-active")]:r.isActive,[Qa(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&Yp(e.default(r));return t.custom?i:Zr("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:s.value},i)}}}),Zp=Xp;function Qp(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function eg(t,e){for(const r in e){const n=e[r],s=t[r];if(typeof n=="string"){if(n!==s)return!1}else if(!_t(s)||s.length!==n.length||n.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Za(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Qa=(t,e,r)=>t??e??r,tg=fr({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const n=dt(Ji),s=Ne(()=>t.route||n.value),i=dt(Va,0),o=Ne(()=>{let c=re(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Ne(()=>s.value.matched[o.value]);ys(Va,Ne(()=>o.value+1)),ys(Op,a),ys(Ji,s);const l=Re();return Wt(()=>[l.value,a.value,t.name],([c,u,h],[d,f,p])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!en(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(y=>y(c))},{flush:"post"}),()=>{const c=s.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return el(r.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,w=Zr(d,ue({},p,e,{onVnodeUnmounted:k=>{k.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return el(r.default,{Component:w,route:c})||w}}});function el(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const rg=tg;function ng(t){const e=zp(t.routes,t),r=t.parseQuery||Rp,n=t.stringifyQuery||Fa,s=t.history,i=hn(),o=hn(),a=hn(),l=Vh(nr);let c=nr;Mr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ki.bind(null,T=>""+T),h=ki.bind(null,hp),d=ki.bind(null,qn);function f(T,H){let L,K;return bu(T)?(L=e.getRecordMatcher(T),K=H):K=T,e.addRoute(K,L)}function p(T){const H=e.getRecordMatcher(T);H&&e.removeRoute(H)}function y(){return e.getRoutes().map(T=>T.record)}function w(T){return!!e.getRecordMatcher(T)}function k(T,H){if(H=ue({},H||l.value),typeof T=="string"){const v=Si(r,T,H.path),S=e.resolve({path:v.path},H),x=s.createHref(v.fullPath);return ue(v,S,{params:d(S.params),hash:qn(v.hash),redirectedFrom:void 0,href:x})}let L;if(T.path!=null)L=ue({},T,{path:Si(r,T.path,H.path).path});else{const v=ue({},T.params);for(const S in v)v[S]==null&&delete v[S];L=ue({},T,{params:h(v)}),H.params=h(H.params)}const K=e.resolve(L,H),ie=T.hash||"";K.params=u(d(K.params));const g=pp(n,ue({},T,{hash:lp(ie),path:K.path})),m=s.createHref(g);return ue({fullPath:g,hash:ie,query:n===Fa?Cp(T.query):T.query||{}},K,{redirectedFrom:void 0,href:m})}function _(T){return typeof T=="string"?Si(r,T,l.value.path):ue({},T)}function b(T,H){if(c!==T)return tn(Te.NAVIGATION_CANCELLED,{from:H,to:T})}function A(T){return B(T)}function U(T){return A(ue(_(T),{replace:!0}))}function F(T,H){const L=T.matched[T.matched.length-1];if(L&&L.redirect){const{redirect:K}=L;let ie=typeof K=="function"?K(T,H):K;return typeof ie=="string"&&(ie=ie.includes("?")||ie.includes("#")?ie=_(ie):{path:ie},ie.params={}),ue({query:T.query,hash:T.hash,params:ie.path!=null?{}:T.params},ie)}}function B(T,H){const L=c=k(T),K=l.value,ie=T.state,g=T.force,m=T.replace===!0,v=F(L,K);if(v)return B(ue(_(v),{state:typeof v=="object"?ue({},ie,v.state):ie,force:g,replace:m}),H||L);const S=L;S.redirectedFrom=H;let x;return!g&&gp(n,K,L)&&(x=tn(Te.NAVIGATION_DUPLICATED,{to:S,from:K}),wt(K,K,!0,!1)),(x?Promise.resolve(x):z(S,K)).catch(E=>Ut(E)?Ut(E,Te.NAVIGATION_GUARD_REDIRECT)?E:Ue(E):V(E,S,K)).then(E=>{if(E){if(Ut(E,Te.NAVIGATION_GUARD_REDIRECT))return B(ue({replace:m},_(E.to),{state:typeof E.to=="object"?ue({},ie,E.to.state):ie,force:g}),H||S)}else E=O(S,K,!0,m,ie);return ee(S,K,E),E})}function J(T,H){const L=b(T,H);return L?Promise.reject(L):Promise.resolve()}function C(T){const H=Pr.values().next().value;return H&&typeof H.runWithContext=="function"?H.runWithContext(T):T()}function z(T,H){let L;const[K,ie,g]=Pp(T,H);L=Ti(K.reverse(),"beforeRouteLeave",T,H);for(const v of K)v.leaveGuards.forEach(S=>{L.push(or(S,T,H))});const m=J.bind(null,T,H);return L.push(m),ct(L).then(()=>{L=[];for(const v of i.list())L.push(or(v,T,H));return L.push(m),ct(L)}).then(()=>{L=Ti(ie,"beforeRouteUpdate",T,H);for(const v of ie)v.updateGuards.forEach(S=>{L.push(or(S,T,H))});return L.push(m),ct(L)}).then(()=>{L=[];for(const v of g)if(v.beforeEnter)if(_t(v.beforeEnter))for(const S of v.beforeEnter)L.push(or(S,T,H));else L.push(or(v.beforeEnter,T,H));return L.push(m),ct(L)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),L=Ti(g,"beforeRouteEnter",T,H,C),L.push(m),ct(L))).then(()=>{L=[];for(const v of o.list())L.push(or(v,T,H));return L.push(m),ct(L)}).catch(v=>Ut(v,Te.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function ee(T,H,L){a.list().forEach(K=>C(()=>K(T,H,L)))}function O(T,H,L,K,ie){const g=b(T,H);if(g)return g;const m=H===nr,v=Mr?history.state:{};L&&(K||m?s.replace(T.fullPath,ue({scroll:m&&v&&v.scroll},ie)):s.push(T.fullPath,ie)),l.value=T,wt(T,H,L,m),Ue()}let te;function ke(){te||(te=s.listen((T,H,L)=>{if(!pr.listening)return;const K=k(T),ie=F(K,pr.currentRoute.value);if(ie){B(ue(ie,{replace:!0,force:!0}),K).catch(Cn);return}c=K;const g=l.value;Mr&&Sp(qa(g.fullPath,L.delta),ti()),z(K,g).catch(m=>Ut(m,Te.NAVIGATION_ABORTED|Te.NAVIGATION_CANCELLED)?m:Ut(m,Te.NAVIGATION_GUARD_REDIRECT)?(B(ue(_(m.to),{force:!0}),K).then(v=>{Ut(v,Te.NAVIGATION_ABORTED|Te.NAVIGATION_DUPLICATED)&&!L.delta&&L.type===Ki.pop&&s.go(-1,!1)}).catch(Cn),Promise.reject()):(L.delta&&s.go(-L.delta,!1),V(m,K,g))).then(m=>{m=m||O(K,g,!1),m&&(L.delta&&!Ut(m,Te.NAVIGATION_CANCELLED)?s.go(-L.delta,!1):L.type===Ki.pop&&Ut(m,Te.NAVIGATION_ABORTED|Te.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ee(K,g,m)}).catch(Cn)}))}let Pe=hn(),M=hn(),$;function V(T,H,L){Ue(T);const K=M.list();return K.length?K.forEach(ie=>ie(T,H,L)):console.error(T),Promise.reject(T)}function Ee(){return $&&l.value!==nr?Promise.resolve():new Promise((T,H)=>{Pe.add([T,H])})}function Ue(T){return $||($=!T,ke(),Pe.list().forEach(([H,L])=>T?L(T):H()),Pe.reset()),T}function wt(T,H,L,K){const{scrollBehavior:ie}=t;if(!Mr||!ie)return Promise.resolve();const g=!L&&Ep(qa(T.fullPath,0))||(K||!L)&&history.state&&history.state.scroll||null;return ur().then(()=>ie(T,H,g)).then(m=>m&&kp(m)).catch(m=>V(m,T,H))}const Qe=T=>s.go(T);let Or;const Pr=new Set,pr={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:w,getRoutes:y,resolve:k,options:t,push:A,replace:U,go:Qe,back:()=>Qe(-1),forward:()=>Qe(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:M.add,isReady:Ee,install(T){T.component("RouterLink",Zp),T.component("RouterView",rg),T.config.globalProperties.$router=pr,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>re(l)}),Mr&&!Or&&l.value===nr&&(Or=!0,A(s.location).catch(K=>{}));const H={};for(const K in nr)Object.defineProperty(H,K,{get:()=>l.value[K],enumerable:!0});T.provide(ri,pr),T.provide(Io,fc(H)),T.provide(Ji,l);const L=T.unmount;Pr.add(T),T.unmount=function(){Pr.delete(T),Pr.size<1&&(c=nr,te&&te(),te=null,l.value=nr,Or=!1,$=!1),L()}}};function ct(T){return T.reduce((H,L)=>H.then(()=>C(L)),Promise.resolve())}return pr}function sg(){return dt(ri)}function $o(t){return dt(Io)}const ig="/logo.svg",og=["width","height"],ag=fr({__name:"LogoIcon",props:{size:{}},setup(t){return(e,r)=>(se(),ce("img",{src:ig,alt:"IO",width:t.size??32,height:t.size??32,class:"inline-block"},null,8,og))}});/**
|
|
31
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the ISC license.
|
|
34
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/const lg=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
36
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
37
|
+
*
|
|
38
|
+
* This source code is licensed under the ISC license.
|
|
39
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
+
*/var is={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
|
|
41
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the ISC license.
|
|
44
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/const cg=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:n,iconNode:s,name:i,class:o,...a},{slots:l})=>Zr("svg",{...is,width:t||is.width,height:t||is.height,stroke:n||is.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${lg(i??"icon")}`],...a},[...s.map(c=>Zr(...c)),...l.default?[l.default()]:[]]);/**
|
|
46
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
47
|
+
*
|
|
48
|
+
* This source code is licensed under the ISC license.
|
|
49
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
+
*/const we=(t,e)=>(r,{slots:n})=>Zr(cg,{...r,iconNode:e,name:t},n);/**
|
|
51
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
52
|
+
*
|
|
53
|
+
* This source code is licensed under the ISC license.
|
|
54
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
+
*/const ug=we("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
56
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the ISC license.
|
|
59
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/const hg=we("BookOpenIcon",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
61
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/const dg=we("ChartColumnIcon",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
|
|
66
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the ISC license.
|
|
69
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/const fg=we("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
71
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
72
|
+
*
|
|
73
|
+
* This source code is licensed under the ISC license.
|
|
74
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
+
*/const pg=we("ClipboardListIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
76
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/const gg=we("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
81
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
82
|
+
*
|
|
83
|
+
* This source code is licensed under the ISC license.
|
|
84
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
+
*/const tl=we("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
86
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
87
|
+
*
|
|
88
|
+
* This source code is licensed under the ISC license.
|
|
89
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
+
*/const mg=we("GithubIcon",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
|
|
91
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the ISC license.
|
|
94
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/const yg=we("HistoryIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
|
96
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const rl=we("ImageIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
101
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the ISC license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/const Eu=we("InboxIcon",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
|
|
106
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the ISC license.
|
|
109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
+
*/const vg=we("LogOutIcon",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
111
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
112
|
+
*
|
|
113
|
+
* This source code is licensed under the ISC license.
|
|
114
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
+
*/const bg=we("MessageCircleIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
116
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the ISC license.
|
|
119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/const _g=we("MessageSquareIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
121
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
122
|
+
*
|
|
123
|
+
* This source code is licensed under the ISC license.
|
|
124
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
+
*/const wg=we("Minimize2Icon",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
126
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/const kg=we("PanelLeftCloseIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
131
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the ISC license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/const Sg=we("PanelLeftOpenIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
|
|
136
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/const Eg=we("PaperclipIcon",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
141
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the ISC license.
|
|
144
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
+
*/const Tg=we("PuzzleIcon",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
|
|
146
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the ISC license.
|
|
149
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/const Ag=we("SendIcon",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
151
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the ISC license.
|
|
154
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/const xg=we("ServerIcon",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
|
|
156
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the ISC license.
|
|
159
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
+
*/const Rg=we("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
161
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the ISC license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/const Cg=we("SquareIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
166
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
167
|
+
*
|
|
168
|
+
* This source code is licensed under the ISC license.
|
|
169
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
+
*/const Og=we("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
171
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/const Pg=we("UsersIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
176
|
+
* @license lucide-vue-next v0.474.0 - ISC
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the ISC license.
|
|
179
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/const Ig=we("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),$g={key:0,class:"text-base font-bold tracking-tight bg-gradient-brand bg-clip-text text-transparent"},jg=["title"],Ng={class:"flex-1 p-2 space-y-0.5 overflow-y-auto"},Lg={key:0},Dg={class:"border-t border-border p-2 space-y-0.5"},Ug={key:0},Bg=["href"],nl="https://github.com/michaeljolley/io",Mg=fr({__name:"AppSidebar",setup(t){const e=$o(),r=Re(!1),n=[{name:"History",icon:yg,path:"/history"},{name:"Squads",icon:Pg,path:"/squads"},{name:"Health",icon:ug,path:"/squads/health"},{name:"Usage",icon:dg,path:"/usage"},{name:"Audit Log",icon:pg,path:"/audit-log"},{name:"Skills",icon:Tg,path:"/skills"},{name:"MCP Servers",icon:xg,path:"/mcp"},{name:"Schedules",icon:gg,path:"/schedules"},{name:"Wiki",icon:hg,path:"/wiki"}],s=[{name:"Chat",icon:_g,path:"/"},{name:"Feed",icon:Eu,path:"/feed"},{name:"Settings",icon:Rg,path:"/settings"}],i="1.7.1",o=Ne(()=>{let l="";const c=[...n,...s];for(const u of c){const h=u.path;(h==="/"?e.path==="/":e.path===h||e.path.startsWith(h+"/"))&&h.length>l.length&&(l=h)}return l});function a(){r.value=!r.value}return(l,c)=>{const u=Ao("router-link");return se(),ce("aside",{class:Ge(["border-r border-border bg-sidebar flex flex-col h-full shrink-0 transition-all duration-200",r.value?"w-16":"w-56"])},[Q("div",{class:Ge(["p-3 border-b border-border flex items-center",r.value?"justify-center":"justify-between"])},[le(u,{to:"/",class:Ge(["flex items-center gap-2",r.value?"justify-center":""])},{default:Jr(()=>[le(ag,{size:24}),r.value?je("",!0):(se(),ce("h1",$g,"IO"))]),_:1},8,["class"]),r.value?je("",!0):(se(),ce("button",{key:0,onClick:a,class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:r.value?"Expand sidebar":"Collapse sidebar"},[le(re(kg),{class:"w-4 h-4"})],8,jg))],2),r.value?(se(),ce("button",{key:0,onClick:a,class:"mx-auto mt-2 p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Expand sidebar"},[le(re(Sg),{class:"w-4 h-4"})])):je("",!0),Q("nav",Ng,[(se(),ce(Fe,null,Tn(n,h=>le(u,{key:h.path,to:h.path,class:Ge(["flex items-center gap-3 rounded-md text-sm transition-colors",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Jr(()=>[(se(),st(na(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?je("",!0):(se(),ce("span",Lg,rt(h.name),1))]),_:2},1032,["to","class","title"])),64))]),Q("div",Dg,[(se(),ce(Fe,null,Tn(s,h=>le(u,{key:h.path,to:h.path,class:Ge(["flex items-center gap-3 rounded-md text-sm transition-colors",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:bg-accent hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Jr(()=>[(se(),st(na(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?je("",!0):(se(),ce("span",Ug,rt(h.name),1))]),_:2},1032,["to","class","title"])),64)),Q("div",{class:Ge(["flex items-center pt-2 mt-2 border-t border-border",r.value?"justify-center":"justify-between px-3"])},[r.value?je("",!0):(se(),ce("a",{key:0,href:`${nl}/releases/tag/v${re(i)}`,target:"_blank",class:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Release notes"}," v"+rt(re(i)),9,Bg)),Q("a",{href:nl,target:"_blank",class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"GitHub repository"},[le(re(mg),{class:"w-3.5 h-3.5"})])],2)])],2)}}});function ni(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Hg(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}const qg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class jo extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Fg extends jo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class sl extends jo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class il extends jo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Yi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Yi||(Yi={}));class Vg{constructor(e,{headers:r={},customFetch:n,region:s=Yi.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=qg(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Hg(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=n;let d={},{region:f}=n;f||(f=this.region);const p=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let y;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?y=JSON.stringify(c):y=c;let w=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(w=o.signal,u.addEventListener("abort",()=>o.abort())):w=o.signal);const k=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:w}).catch(U=>{throw new Fg(U)}),_=k.headers.get("x-relay-error");if(_&&_==="true")throw new sl(k);if(!k.ok)throw new il(k);let b=((s=k.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),A;return b==="application/json"?A=yield k.json():b==="application/octet-stream"||b==="application/pdf"?A=yield k.blob():b==="text/event-stream"?A=k:b==="multipart/form-data"?A=yield k.formData():A=yield k.text(),{data:A,error:null,response:k}}catch(a){return{data:null,error:a,response:a instanceof il||a instanceof sl?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Tu=3,ol=t=>Math.min(1e3*2**t,3e4),zg=[520,503],Au=["GET","HEAD","OPTIONS"];var Wg=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function al(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e==null||e.addEventListener("abort",s)})}function Kg(t,e,r,n){return!(!n||r>=Tu||!Au.includes(t)||!zg.includes(e))}var Gg=class{constructor(t){var e,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=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 n=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(r.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await n(r.url.toString(),{method:r.method,headers:c,body:JSON.stringify(r.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Au.includes(r.method))throw h;if(r.retryEnabled&&o<Tu){const d=ol(o);o++,await al(d,r.signal);continue}throw h}if(Kg(r.method,u.status,o,r.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:ol(o);await u.text(),o++,await al(d,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,p,y;const _=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(p=o==null?void 0:o.name)!==null&&p!==void 0?p:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
181
|
+
|
|
182
|
+
Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${_}`,b&&(l+=` (${b})`),h!=null&&h.stack&&(l+=`
|
|
183
|
+
${h.stack}`)}else{var w;l=(w=o==null?void 0:o.stack)!==null&&w!==void 0?w:""}const k=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)",k>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${k} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",k>this.urlLengthLimit&&(c+=`. Your request URL is ${k} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?n=d:n=JSON.parse(d))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(n=[],r=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new Wg(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Jg=class extends Gg{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const ll=new RegExp("[,()]");var Hr=class extends Jg{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&ll.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&ll.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Yg=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new Hr({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Hr({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new Hr({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Hr({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Hr({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Fn(t){"@babel/helpers - typeof";return Fn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn(t)}function Xg(t,e){if(Fn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Fn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zg(t){var e=Xg(t,"string");return Fn(e)=="symbol"?e:e+""}function Qg(t,e,r){return(e=Zg(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function cl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function os(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cl(Object(r),!0).forEach(function(n){Qg(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var em=class xu{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const p=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",p,{once:!0}),l(c,os(os({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,os(os({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Yg(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new xu(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=n&&Object.values(r).some(u);h?(a="POST",c=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,p])=>p!==void 0).map(([f,p])=>[f,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([f,p])=>{l.searchParams.append(f,p)})):(a="POST",c=r);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new Hr({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class tm{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.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"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.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:
|
|
184
|
+
import ws from "ws"
|
|
185
|
+
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
|
|
186
|
+
|
|
187
|
+
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const rm="2.106.2",nm=`realtime-js/${rm}`,sm="1.0.0",Ru="2.0.0",im=Ru,om=1e4,am=100,lr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Cu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Xi={connecting:"connecting",closing:"closing",closed:"closed"};class lm{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var s,i;const o=e.topic,a=(s=e.ref)!==null&&s!==void 0?s:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let p=new DataView(f),y=0;p.setUint8(y++,this.KINDS.userBroadcastPush),p.setUint8(y++,l.length),p.setUint8(y++,a.length),p.setUint8(y++,o.length),p.setUint8(y++,c.length),p.setUint8(y++,h.length),p.setUint8(y++,r),Array.from(l,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(a,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(o,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(c,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(h,k=>p.setUint8(y++,k.charCodeAt(0)));var w=new Uint8Array(f.byteLength+n.byteLength);return w.set(new Uint8Array(f),0),w.set(new Uint8Array(n),f.byteLength),w.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,i,o,a,l]=n;return r({join_ref:s,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(e.slice(l,l+s));l=l+s;const u=n.decode(e.slice(l,l+i));l=l+i;const h=n.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,p={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var be;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(be||(be={}));const ul=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=cm(o,t,e,s),i),{}):{}},cm=(t,e,r,n)=>{const s=e.find(a=>a.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?Ou(i,o):Zi(o)},Ou=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return fm(e,r)}switch(t){case be.bool:return um(e);case be.float4:case be.float8:case be.int2:case be.int4:case be.int8:case be.numeric:case be.oid:return hm(e);case be.json:case be.jsonb:return dm(e);case be.timestamp:return pm(e);case be.abstime:case be.date:case be.daterange:case be.int4range:case be.int8range:case be.money:case be.reltime:case be.text:case be.time:case be.timestamptz:case be.timetz:case be.tsrange:case be.tstzrange:return Zi(e);default:return Zi(e)}},Zi=t=>t,um=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},hm=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},dm=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},fm=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>Ou(e,a))}return t},pm=t=>typeof t=="string"?t.replace(" ","T"):t,Pu=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var On=t=>typeof t=="function"?t:function(){return t},gm=typeof self<"u"?self:null,qr=typeof window<"u"?window:null,Ot=gm||qr||globalThis,mm="2.0.0",ym=1e4,vm=1e3,$t={connecting:0,open:1,closing:2,closed:3},et={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ht={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Qi={longpoll:"longpoll",websocket:"websocket"},bm={complete:4},eo="base64url.bearer.phx.",as=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Iu=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},_m=class{constructor(t,e,r){this.state=et.closed,this.topic=t,this.params=On(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new as(this,Ht.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=et.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=et.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=et.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=et.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 as(this,Ht.leave,On({}),this.timeout).send(),this.state=et.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ht.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=et.closed,this.bindings=[]}onClose(t){this.on(Ht.close,t)}onError(t){return this.on(Ht.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new as(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=et.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ht.close,"leave")},r=new as(this,Ht.leave,On({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=et.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<i.length;o++)i[o].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===et.closed}isErrored(){return this.state===et.errored}isJoined(){return this.state===et.joined}isJoining(){return this.state===et.joining}isLeaving(){return this.state===et.leaving}},Os=class{static request(t,e,r,n,s,i,o){if(Ot.XDomainRequest){let a=new Ot.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(Ot.XMLHttpRequest){let a=new Ot.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(Ot.fetch&&Ot.AbortController)return this.fetchRequest(t,e,r,n,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,i,o){let a={method:t,headers:r,body:n},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),Ot.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,n,s,i,o){return t.timeout=s,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(n))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===bm.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,i=t[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},wm=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)},jr=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(eo)&&(this.authToken=atob(e[1].slice(eo.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=$t.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Qi.websocket),"$1/"+Qi.longpoll)}endpointURL(){return Os.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=$t.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===$t.open||this.readyState===$t.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=$t.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 ${r}`)}})}send(t){typeof t!="string"&&(t=wm(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
|
|
188
|
+
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=$t.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let i,o=()=>{this.reqs.delete(i),n()};i=Os.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},km=class vn{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=vn.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=vn.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=vn.syncDiff(this.state,s,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return vn.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(y=>y.phx_ref),d=u.metas.map(y=>y.phx_ref),f=c.metas.filter(y=>d.indexOf(y.phx_ref)<0),p=u.metas.filter(y=>h.indexOf(y.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),p.length>0&&(a[l]=this.clone(u),a[l].metas=p)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},n,s)}static syncDiff(e,r,n,s){let{joins:i,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}n(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),s(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},ls={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,i,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:i}=t,o=this.META_LENGTH+e.length+r.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,r.length),l.setUint8(c++,s.length),l.setUint8(c++,n.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+n));o=o+n;let l=r.decode(t.slice(o,o+s));o=o+s;let c=r.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(t.slice(a,a+n));a=a+n;let c=r.decode(t.slice(a,a+s));a=a+s;let u=r.decode(t.slice(a,a+i));a=a+i;let h=r.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Ht.reply,payload:f}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+n));i=i+n;let a=r.decode(t.slice(i,i+s));i=i+s;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},Sm=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||ym,this.transport=e.transport||Ot.WebSocket||jr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Ot&&Ot.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=ls.encode.bind(ls),this.defaultDecoder=ls.decode.bind(ls),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==jr?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;qr&&qr.addEventListener&&(qr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),qr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),qr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=On(e.params||{}),this.endPoint=`${t}/${Qi.websocket}`,this.vsn=e.vsn||mm,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()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return jr}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Os.appendParams(Os.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=On(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==jr?this.connectWithFallback(jr,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case jr:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${eo}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),n&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),vm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===$t.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ht.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case $t.connecting:return"connecting";case $t.open:return"open";case $t.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new _m(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.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",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,n,s,o)&&l.trigger(n,s,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class Pn{constructor(e,r){const n=Tm(r);this.presence=new km(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=Pn.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Pn.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Pn.transformState(this.presence.state)}static transformState(e){return e=Em(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=bs(s),r},{})}static onJoinPayload(e,r,n){const s=hl(r),i=bs(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=hl(r),i=bs(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function bs(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function Em(t){return JSON.parse(JSON.stringify(t))}function Tm(t){return(t==null?void 0:t.events)&&{events:t.events}}function hl(t){return t!=null&&t.metas?bs(t):[]}var dl;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(dl||(dl={}));class Am{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Pn(this.channel.channelAdapter,r)}}function xm(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Rm{constructor(e,r,n){const s=Cm(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>am){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===lr.joined}isJoined(){return this.state===lr.joined}isJoining(){return this.state===lr.joining}isClosed(){return this.state===lr.closed}isLeaving(){return this.state===lr.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function Cm(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var fl;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(fl||(fl={}));var zr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(zr||(zr={}));var qt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(qt||(qt={}));class In{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,i;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Rm(this.socket.socketAdapter,e,this.params),this.presence=new Am(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Pu(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[zr.PRESENCE]&&this.bindings[zr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(qt.CHANNEL_ERROR,xm(f))}),this._onClose(()=>e==null?void 0:e(qt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(qt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=lr.errored;const p=Object.values(f).join(", ")||"error";e==null||e(qt.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{e==null||e(qt.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&In.isFilterValueEqual(f.schema,u)&&In.isFilterValueEqual(f.table,h)&&In.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=lr.errored,r==null||r(qt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=lr.errored&&r&&r(qt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===zr.PRESENCE||e===zr.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_on(e,r,n){const s=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,n),o={type:s,filter:r,callback:n,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,p=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=r.ids)===null||o===void 0?void 0:o.includes(f))&&(p==="*"||(p==null?void 0:p.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=r==null?void 0:r.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:i,join:o}=Cu;return r&&[n,s,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(s))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=ul(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=ul(e.columns,e.old_record)),r}}class Om{constructor(e,r){this.socket=new Sm(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Xi.connecting}isDisconnecting(){return this.socket.connectionState()==Xi.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const pl={HEARTBEAT_INTERVAL:25e3},Pm=[1e3,2e3,5e3,1e4],Im=1e4;function $m(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function jm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return $m()}const Nm=`
|
|
189
|
+
addEventListener("message", (e) => {
|
|
190
|
+
if (e.data.event === "start") {
|
|
191
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
192
|
+
}
|
|
193
|
+
});`;class Lm{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new lm,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),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new Om(e,s),this.httpEndpoint=Pu(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw r.includes("Node.js")?new Error(`${r}
|
|
194
|
+
|
|
195
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
196
|
+
|
|
197
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
198
|
+
Option 2: Install and provide the "ws" package:
|
|
199
|
+
|
|
200
|
+
npm install ws
|
|
201
|
+
|
|
202
|
+
import ws from "ws"
|
|
203
|
+
const client = new RealtimeClient(url, {
|
|
204
|
+
...options,
|
|
205
|
+
transport: ws
|
|
206
|
+
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||Xi.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new In(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:nm};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Cu.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([Nm],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,i,o,a,l,c,u,h,d,f;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const p={};p.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:om,p.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:pl.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:pl.HEARTBEAT_INTERVAL),p.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:tm.getWebSocketConstructor(),p.params=e==null?void 0:e.params,p.logger=e==null?void 0:e.logger,p.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),p.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:jm(),p.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(_=>Pm[_-1]||Im);let y,w;const k=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:im;switch(k){case sm:y=(_,b)=>b(JSON.stringify(_)),w=(_,b)=>b(JSON.parse(_));break;case Ru:y=this.serializer.encode.bind(this.serializer),w=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=k,p.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:y,p.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:w,p.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,p.params=Object.assign(Object.assign({},p.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,p.autoSendHeartbeat=!this.worker}return p}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Vn=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Dm(t,e,r){const n=new URL(e,t);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function Um(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Bm(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=Dm(t.baseUrl,n,s),l=await Um(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,p=f==null?void 0:f.error;throw new Vn((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function cs(t){return t.join("")}var Mm=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:cs(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cs(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cs(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cs(t.namespace)}`}),!0}catch(e){if(e instanceof Vn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Vn&&r.status===409)return;throw r}}};function Nr(t){return t.join("")}var Hm=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Vn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Vn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},qm=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Bm({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Mm(this.client,e),this.tableOps=new Hm(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function zn(t){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zn(t)}function Fm(t,e){if(zn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(zn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Vm(t){var e=Fm(t,"string");return zn(e)=="symbol"?e:e+""}function zm(t,e,r){return(e=Vm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function X(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gl(Object(r),!0).forEach(function(n){zm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var si=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function ii(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var to=class extends si{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return X({},super.toJSON())}},$u=class extends si{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Ps(t,e,r){const n=X({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Wm(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const Km=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Gm=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ro=t=>{if(Array.isArray(t))return t.map(r=>ro(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=ro(n)}),e},Jm=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),ml=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},Ym=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new to(ml(o),i,a,n))}).catch(()=>{const o=i+"";e(new to(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new $u(ml(t),t,n))},Xm=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return X(X({},s),r);if(Gm(n)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Ps(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e!=null&&e.duplex&&(s.duplex=e.duplex),X(X({},s),r)};async function dn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,Xm(e,n,s,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.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=>Ym(c,l,n,o))})}function ju(t="storage"){return{get:async(e,r,n,s)=>dn(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>dn(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>dn(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>dn(e,"HEAD",r,X(X({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>dn(e,"DELETE",r,s,i,n,t)}}const Zm=ju("storage"),{get:Wn,post:gt,put:no,head:Qm,remove:No}=Zm,it=ju("vectors");var on=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Wm(e),this.fetch=Km(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Ps(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ii(r))return{data:null,error:r};throw r}}};let Nu;Nu=Symbol.toStringTag;var ey=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Nu]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ii(e))return{data:null,error:e};throw e}}};let Lu;Lu=Symbol.toStringTag;var ty=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Lu]="BlobDownloadBuilder",this.promise=null}asStream(){return new ey(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ii(e))return{data:null,error:e};throw e}}};const ry={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},yl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var ny=class extends on{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i;const o=X(X({},yl),n);let a=X(X({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))a=Ps(a,d,f);const c=s._removeEmptyFolders(e),u=s._getFinalPath(c),h=await(t=="PUT"?no:gt)(s.fetch,`${s.url}/object/${u}`,i,X({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;const i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l;const c=X(X({},yl),n);let u=X(X({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))u=Ps(u,d,f);return{path:i,fullPath:(await no(s.fetch,a.toString(),l,X({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=X({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await gt(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new si("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await gt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await gt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await gt(n.fetch,`${n.url}/object/sign/${s}`,X({expiresIn:e},i?{transform:r.transform}:{}),{headers:n.headers});const a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await gt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const o=i.toString();return s.map(a=>X(X({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),o=this._getFinalPath(t),a=()=>Wn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new ty(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>ro(await Wn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Qm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ii(s)){var n;const i=s instanceof to?s.status:s instanceof $u?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await No(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=X(X(X({},ry),e),{},{prefix:t||""});return await gt(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=X({},t);return await gt(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const sy="2.106.2",Qn={"X-Client-Info":`storage-js/${sy}`};var iy=class extends on{constructor(t,e={},r,n){const s=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=X(X({},Qn),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Wn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Wn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await gt(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await no(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await gt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await No(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},oy=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=X(X({},Qn),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await gt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Wn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await No(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Jm(t))throw new si("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 r=new qm({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},ay=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=X(X({},Qn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await it.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await it.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},ly=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=X(X({},Qn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},cy=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=X(X({},Qn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await it.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},uy=class extends cy{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new hy(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},hy=class extends ay{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new dy(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},dy=class extends ly{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,X(X({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},fy=class extends iy{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new ny(this.url,this.headers,t,this.fetch)}get vectors(){return new uy(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new oy(this.url+"/iceberg",this.headers,this.fetch)}};const Du="2.106.2",Fr=30*1e3,so=3,Ai=so*Fr,py="http://localhost:9999",gy="supabase.auth.token",my={"X-Client-Info":`gotrue-js/${Du}`},io="X-Supabase-Api-Version",Uu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},yy=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,vy=600*1e3;class rn extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function j(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class by extends rn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function _y(t){return j(t)&&t.name==="AuthApiError"}class mt extends rn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class tr extends rn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class De extends tr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function us(t){return j(t)&&t.name==="AuthSessionMissingError"}class Lr extends tr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class hs extends tr{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ds extends tr{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function wy(t){return j(t)&&t.name==="AuthImplicitGrantRedirectError"}class vl extends tr{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class ky extends tr{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 oo extends tr{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function xi(t){return j(t)&&t.name==="AuthRetryableFetchError"}class bl extends tr{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class ao extends tr{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Is="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),_l=`
|
|
207
|
+
\r=`.split(""),Sy=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<_l.length;e+=1)t[_l[e].charCodeAt(0)]=-2;for(let e=0;e<Is.length;e+=1)t[Is[e].charCodeAt(0)]=e;return t})();function wl(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Is[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Is[n]),e.queuedBits-=6}}function Bu(t,e,r){const n=Sy[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function kl(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{Ay(o,n,r)};for(let o=0;o<t.length;o+=1)Bu(t.charCodeAt(o),s,i);return e.join("")}function Ey(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Ty(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}Ey(n,e)}}function Ay(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Yr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)Bu(t.charCodeAt(s),r,n);return new Uint8Array(e)}function xy(t){const e=[];return Ty(t,r=>e.push(r)),new Uint8Array(e)}function Tr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>wl(s,r,n)),wl(null,r,n),e.join("")}function Ry(t){return Math.round(Date.now()/1e3)+t}function Cy(){return Symbol("auth-callback")}const He=()=>typeof window<"u"&&typeof document<"u",br={tested:!1,writable:!1},Mu=()=>{if(!He())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(br.tested)return br.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),br.tested=!0,br.writable=!0}catch{br.tested=!0,br.writable=!1}return br.writable};function Oy(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const Hu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Py=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Vr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},_r=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},Me=async(t,e)=>{await t.removeItem(e)};class oi{constructor(){this.promise=new oi.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}oi.promiseConstructor=Promise;function fs(t){const e=t.split(".");if(e.length!==3)throw new ao("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!yy.test(e[n]))throw new ao("JWT not in base64url format");return{header:JSON.parse(kl(e[0])),payload:JSON.parse(kl(e[1])),signature:Yr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Iy(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function $y(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function jy(t){return("0"+t.toString(16)).substr(-2)}function Ny(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,jy).join("")}async function Ly(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Dy(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await Ly(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Dr(t,e,r=!1){const n=Ny();let s=n;r&&(s+="/recovery"),await Vr(t,`${e}-code-verifier`,s);const i=await Dy(n);return[i,n===i?"plain":"s256"]}const Uy=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function By(t){const e=t.headers.get(io);if(!e||!e.match(Uy))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function My(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function Hy(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const qy=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Bt(t){if(!qy.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function pt(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Ri(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Fy(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function Sl(t){return JSON.parse(JSON.stringify(t))}const kr=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},Vy=[502,503,504,520,521,522,523,524,530];async function El(t){var e;if(!Py(t))throw new oo(kr(t),0);if(Vy.includes(t.status))throw new oo(kr(t),t.status);let r;try{r=await t.json()}catch(i){throw new mt(kr(i),i)}let n;const s=By(t);if(s&&s.getTime()>=Uu["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new bl(kr(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new De}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new bl(kr(r),t.status,r.weak_password.reasons);throw new by(kr(r),t.status||500,n)}const zy=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function q(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[io]||(i[io]=Uu["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Wy(t,e,r+a,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function Wy(t,e,r,n,s,i){const o=zy(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new oo(kr(l),0)}if(a.ok||await El(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await El(l)}}function ht(t){var e;let r=null;Jy(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=Ry(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function Tl(t){const e=ht(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function cr(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Ky(t){return{data:t,error:null}}function Gy(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=ni(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function Al(t){return t}function Jy(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Ci=["global","local","others"];class Yy{_encodePathSegment(e){if(e==="."||e==="..")throw new rn("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=Hu(n),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,r=Ci[0]){if(Ci.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ci.join(", ")}`);try{return await q(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(j(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await q(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:cr})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ni(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await q(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Gy,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(j(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await q(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:cr})}catch(r){if(j(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await q(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Al});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const y=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(p.split(";")[1].split("=")[1]);c[`${w}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(j(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Bt(e);try{return await q(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:cr})}catch(r){if(j(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Bt(e);try{return await q(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:cr})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Bt(e);try{return await q(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:cr})}catch(n){if(j(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Bt(e.userId);try{const{data:r,error:n}=await q(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(j(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Bt(e.userId),Bt(e.id);try{return{data:await q(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(j(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await q(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:Al});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const y=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(p.split(";")[1].split("=")[1]);c[`${w}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(j(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await q(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const n=this._encodePathSegment(e);return await q(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(j(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await q(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(j(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await q(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const n=this._encodePathSegment(e);return await q(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(j(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(j(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){pt(this.experimental),Bt(e.userId);try{return await q(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(j(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){pt(this.experimental),Bt(e.userId),Bt(e.passkeyId);try{return await q(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(j(r))return{data:null,error:r};throw r}}}function xl(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const At={debug:!!(globalThis&&Mu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class qu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Rl extends qu{}async function Xy(t,e,r){At.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),At.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(s),At.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{At.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw At.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Rl(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(At.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(s),await r()}})}catch(i){if(e>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(n.signal.aborted)return At.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){At.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{At.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw At.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new Rl(`Lock "${t}" was released because another request stole it`)}throw i}}function Zy(){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 Fu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Qy(t){return parseInt(t,16)}function ev(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function tv(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
|
208
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Fu(t.address),p=u?`${u}://${n}`:n,y=t.statement?`${t.statement}
|
|
209
|
+
`:"",w=`${p} wants you to sign in with your Ethereum account:
|
|
210
|
+
${f}
|
|
211
|
+
|
|
212
|
+
${y}`;let k=`URI: ${h}
|
|
213
|
+
Version: ${d}
|
|
214
|
+
Chain ID: ${r}${o?`
|
|
215
|
+
Nonce: ${o}`:""}
|
|
216
|
+
Issued At: ${i.toISOString()}`;if(s&&(k+=`
|
|
217
|
+
Expiration Time: ${s.toISOString()}`),a&&(k+=`
|
|
218
|
+
Not Before: ${a.toISOString()}`),l&&(k+=`
|
|
219
|
+
Request ID: ${l}`),c){let _=`
|
|
220
|
+
Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);_+=`
|
|
221
|
+
- ${b}`}k+=_}return`${w}
|
|
222
|
+
${k}`}class Oe extends Error{constructor({message:e,code:r,cause:n,name:s}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $s extends Oe{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function rv({error:t,options:e}){var r,n,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Oe({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Oe({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Oe({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Oe({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Oe({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Oe({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Oe({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Oe({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Vu(o)){if(i.rp.id!==o)return new Oe({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Oe({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Oe({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Oe({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Oe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function nv({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Oe({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Oe({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Vu(n)){if(r.rpId!==n)return new Oe({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Oe({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Oe({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Oe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class sv{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const lo=new sv;function Cl(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=ni(t,["challenge","user","excludeCredentials"]),i=Yr(e).buffer,o=Object.assign(Object.assign({},r),{id:Yr(r.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Yr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Ol(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=ni(t,["challenge","allowCredentials"]),s=Yr(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const a=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Yr(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function Pl(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:Tr(new Uint8Array(t.response.attestationObject)),clientDataJSON:Tr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Il(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Tr(new Uint8Array(s.authenticatorData)),clientDataJSON:Tr(new Uint8Array(s.clientDataJSON)),signature:Tr(new Uint8Array(s.signature)),userHandle:s.userHandle?Tr(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Vu(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function js(){var t,e;return!!(He()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function zu(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",e)}:{data:null,error:new $s("Empty credential response",e)}}catch(e){return{data:null,error:rv({error:e,options:t})}}}async function Wu(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",e)}:{data:null,error:new $s("Empty credential response",e)}}catch(e){return{data:null,error:nv({error:e,options:t})}}}const iv={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},ov={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ns(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(e(o)){const a=n[i];e(a)?n[i]=Ns(a,o):n[i]=Ns(o)}else n[i]=o}return n}function av(t,e){return Ns(iv,t,e||{})}function lv(t,e){return Ns(ov,t,e||{})}class cv{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:l};const c=s??lo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=n;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,p=((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}:${p}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=av(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await zu({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=lv(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await Wu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return j(a)?{data:null,error:a}:{data:null,error:new mt("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new rn("rpId is required for WebAuthn authentication")};try{if(!js())return{data:null,error:new mt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:r,rpOrigins:n,credential_response:l.credential_response}})}catch(o){return j(o)?{data:null,error:o}:{data:null,error:new mt("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new rn("rpId is required for WebAuthn registration")};try{if(!js())return{data:null,error:new mt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return j(o)?{data:null,error:o}:{data:null,error:new mt("Unexpected error in register",o)}}}}Zy();const uv={url:py,storageKey:gy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:my,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function $l(t,e,r){return await r()}const Ur={};class Kn{get jwks(){var e,r;return(r=(e=Ur[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ur[this.storageKey]=Object.assign(Object.assign({},Ur[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ur[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ur[this.storageKey]=Object.assign(Object.assign({},Ur[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,s,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({},uv),e);if(this.storageKey=o.storageKey,this.instanceID=(r=Kn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Kn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&He()){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=(n=o.experimental)!==null&&n!==void 0?n:{},this.admin=new Yy({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||$l,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&&He()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=Xy:this.lock=$l,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 cv(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:Mu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=xl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=xl(this.memoryStorage)),He()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Du}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(He()&&(r=Oy(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),He()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),wy(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=s;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(r){return j(r)?this._returnResult({error:r}):this._returnResult({error:new mt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:ht}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(j(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Dr(this.storage,this.storageKey)),i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:p},xform:ht})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},channel:(s=d==null?void 0:d.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:ht})}else throw new hs("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await Me(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 Me(this.storage,`${this.storageKey}-code-verifier`),j(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await q(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:Tl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await q(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:Tl})}else throw new hs("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new Lr;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(j(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,i,o,a,l,c,u,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{const{chain:y,wallet:w,statement:k,options:_}=e;let b;if(He())if(typeof w=="object")b=w;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")b=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 w!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=w}const A=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href),U=await b.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!U||U.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const F=Fu(U[0]);let B=(n=_==null?void 0:_.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!B){const C=await b.request({method:"eth_chainId"});B=Qy(C)}const J={domain:A.host,address:F,statement:k,uri:A.href,version:"1",chainId:B,nonce:(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_==null?void 0:_.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=tv(J),p=await b.request({method:"personal_sign",params:[ev(f),F]})}try{const{data:y,error:w}=await q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ht});if(w)throw w;if(!y||!y.session||!y.user){const k=new Lr;return this._returnResult({data:{user:null,session:null},error:k})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:w})}catch(y){if(j(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,s,i,o,a,l,c,u,h,d,f;let p,y;if("message"in e)p=e.message,y=e.signature;else{const{chain:w,wallet:k,statement:_,options:b}=e;let A;if(He())if(typeof k=="object")A=k;else{const F=window;if("solana"in F&&typeof F.solana=="object"&&("signIn"in F.solana&&typeof F.solana.signIn=="function"||"signMessage"in F.solana&&typeof F.solana.signMessage=="function"))A=F.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 k!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");A=k}const U=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in A&&A.signIn){const F=await A.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:U.host,uri:U.href}),_?{statement:_}:null));let B;if(Array.isArray(F)&&F[0]&&typeof F[0]=="object")B=F[0];else if(F&&typeof F=="object"&&"signedMessage"in F&&"signature"in F)B=F;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in B&&"signature"in B&&(typeof B.signedMessage=="string"||B.signedMessage instanceof Uint8Array)&&B.signature instanceof Uint8Array)p=typeof B.signedMessage=="string"?B.signedMessage:new TextDecoder().decode(B.signedMessage),y=B.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in A)||typeof A.signMessage!="function"||!("publicKey"in A)||typeof A!="object"||!A.publicKey||!("toBase58"in A.publicKey)||typeof A.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${U.host} wants you to sign in with your Solana account:`,A.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${U.href}`,`Issued At: ${(s=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(B=>`- ${B}`)]:[]].join(`
|
|
223
|
+
`);const F=await A.signMessage(new TextEncoder().encode(p),"utf8");if(!F||!(F instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=F}}try{const{data:w,error:k}=await q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Tr(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ht});if(k)throw k;if(!w||!w.session||!w.user){const _=new Lr;return this._returnResult({data:{user:null,session:null},error:_})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:k})}catch(w){if(j(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(e){const r=await _r(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new ky;const{data:i,error:o}=await q(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ht});if(await Me(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Lr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await Me(this.storage,`${this.storageKey}-code-verifier`),j(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:ht}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Lr;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(r){if(j(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Dr(this.storage,this.storageKey));const{error:h}=await q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},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 hs("You must provide either an email or phone number.")}catch(a){if(await Me(this.storage,`${this.storageKey}-code-verifier`),j(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:a}=await q(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ht});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(j(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Dr(this.storage,this.storageKey));const c=await q(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:Ky});return!((i=c.data)===null||i===void 0)&&i.url&&He()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await Me(this.storage,`${this.storageKey}-code-verifier`),j(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new De;const{error:s}=await q(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if(j(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await q(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:n,type:s,options:i}=e,{data:o,error:a}=await q(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,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 hs("You must provide either an email or phone number and a type")}catch(r){if(j(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await _r(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Ai:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await _r(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Ri()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=Fy(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:cr}):await this._useSession(async r=>{var n,s,i;const{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new De}:await q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:cr})})}catch(r){if(j(r))return us(r)&&(await this._removeSession(),await Me(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new De;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Dr(this.storage,this.storageKey));const{data:c,error:u}=await q(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:cr});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(n){if(await Me(this.storage,`${this.storageKey}-code-verifier`),j(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new De;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=fs(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if(j(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new De;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(j(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!He())throw new ds("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ds(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new vl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ds("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new vl("No code detected.");const{data:b,error:A}=await this._exchangeCodeForSession(e.code);if(A)throw A;const U=new URL(window.location.href);return U.searchParams.delete("code"),window.history.replaceState(window.history.state,"",U.toString()),{data:{session:b.session,redirectType:(n=b.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new ds("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const p=f-h;p*1e3<=Fr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const y=f-d;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,f,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,f,h);const{data:w,error:k}=await this._getUser(o);if(k)throw k;const _={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:_,redirectType:e.type},error:null})}catch(s){if(j(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await _r(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i&&!us(i))return this._returnResult({error:i});const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(_y(a)&&(a.status===404||a.status===401||a.status===403)||us(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await Me(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=Cy(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),us(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Dr(this.storage,this.storageKey,!0));try{return await q(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await Me(this.storage,`${this.storageKey}-code-verifier`),j(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await q(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return He()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(j(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ht}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new Lr}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await Me(this.storage,`${this.storageKey}-code-verifier`),j(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await q(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await $y(async s=>(s>0&&await Iy(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await q(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ht})),(s,i)=>{const o=200*Math.pow(2,s);return i&&xi(i)&&Date.now()+o-n<Fr})}catch(n){if(this._debug(r,"error",n),j(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),He()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await _r(this.storage,this.storageKey);if(s&&this.userStorage){let o=await _r(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Vr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Ri()}else if(s&&!s.user&&!s.user){const o=await _r(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await Me(this.storage,this.storageKey+"-user"),await Vr(this.storage,this.storageKey,s)):s.user=Ri()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Ai;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ai}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),xi(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new De;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new oi;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new De;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(s,"error",i),j(i)){const o={data:null,error:i};return xi(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}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(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Me(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Vr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=Sl(s);await Vr(this.storage,this.storageKey,i)}else{const s=Sl(r);await Vr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Me(this.storage,this.storageKey),await Me(this.storage,this.storageKey+"-code-verifier"),await Me(this.storage,this.storageKey+"-user"),this.userStorage&&await Me(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&He()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Fr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Fr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Fr}ms, refresh threshold is ${so} ticks`),s<=so&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof qu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!He()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await Dr(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await q(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await q(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Pl(e.webauthn.credential_response):Il(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.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(r){if(j(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,i;if(e)try{const{payload:f}=fs(e);let p=null;f.aal&&(p=f.aal);let y=p;const{data:{user:w},error:k}=await this.getUser(e);if(k)return this._returnResult({data:null,error:k});((n=(r=w==null?void 0:w.factors)===null||r===void 0?void 0:r.filter(A=>A.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const b=f.amr||[];return{data:{currentLevel:p,nextLevel:y,currentAuthenticationMethods:b},error:null}}catch(f){if(j(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}=fs(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await q(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new De})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new De});const o=await q(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&He()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new De});const o=await q(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&He()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await q(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new De})})}catch(e){if(j(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await q(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new De})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+vy>s)return n;const{data:i,error:o}=await q(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=s,n=i.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:f,error:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});n=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=fs(n);r!=null&&r.allowExpired||My(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Hy(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,xy(`${a}.${l}`)))throw new ao("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;pt(this.experimental);try{if(!js())return this._returnResult({data:null,error:new mt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=Ol(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:lo.createNewAbortSignal(),{data:c,error:u}=await Wu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new mt("WebAuthn ceremony failed",null)});const h=Il(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(j(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;pt(this.experimental);try{if(!js())return this._returnResult({data:null,error:new mt("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const o=Cl(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:lo.createNewAbortSignal(),{data:l,error:c}=await zu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new mt("WebAuthn ceremony failed",null)});const u=Pl(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(j(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){pt(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new De});const{data:s,error:i}=await q(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(j(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){pt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new De});const{data:i,error:o}=await q(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;pt(this.experimental);try{const{data:n,error:s}=await q(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(j(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){pt(this.experimental);try{const{data:r,error:n}=await q(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:ht});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){pt(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new De});const{data:s,error:i}=await q(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if(j(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){pt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new De});const{data:i,error:o}=await q(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){pt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new De});const{error:i}=await q(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if(j(r))return this._returnResult({data:null,error:r});throw r}}}Kn.nextInstanceID={};const hv=Kn,dv="2.106.2";let bn="";typeof Deno<"u"?bn="deno":typeof document<"u"?bn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?bn="react-native":bn="node";const fv={"X-Client-Info":`supabase-js-${bn}/${dv}`},pv={headers:fv},gv={schema:"public"},mv={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},yv={},vv={enabled:!1,respectSamplingDecision:!0};function bv(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,[])).next())})}let Oi=null;const _v="@opentelemetry/api";function wv(){return Oi===null&&(Oi=import(_v).catch(()=>null)),Oi}function kv(){return bv(this,void 0,void 0,function*(){try{const t=yield wv();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function Sv(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,s,i]=e;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(s)||!o.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function Ev(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(Tv(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function Tv(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function Av(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Gn(t){"@babel/helpers - typeof";return Gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gn(t)}function xv(t,e){if(Gn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Gn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rv(t){var e=xv(t,"string");return Gn(e)=="symbol"?e:e+""}function Cv(t,e,r){return(e=Rv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function jl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Ae(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jl(Object(r),!0).forEach(function(n){Cv(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const Ov=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Pv=()=>Headers,Iv=(t,e,r,n,s)=>{const i=Ov(n),o=Pv(),a=(s==null?void 0:s.enabled)===!0,l=(s==null?void 0:s.respectSamplingDecision)!==!1,c=a?Av(e):null;return async(u,h)=>{var d;const f=(d=await r())!==null&&d!==void 0?d:t;let p=new o(h==null?void 0:h.headers);if(p.has("apikey")||p.set("apikey",t),p.has("Authorization")||p.set("Authorization",`Bearer ${f}`),c){const y=await $v(u,c,l);y&&(y.traceparent&&!p.has("traceparent")&&p.set("traceparent",y.traceparent),y.tracestate&&!p.has("tracestate")&&p.set("tracestate",y.tracestate),y.baggage&&!p.has("baggage")&&p.set("baggage",y.baggage))}return i(u,Ae(Ae({},h),{},{headers:p}))}};async function $v(t,e,r){if(!Ev(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await kv();if(!n||!n.traceparent)return null;if(r){const s=Sv(n.traceparent);if(s&&!s.isSampled)return null}return n}function Nl(t){return typeof t=="boolean"?{enabled:t}:t}function jv(t){return t.endsWith("/")?t:t+"/"}function Nv(t,e){var r,n,s,i,o,a;const{db:l,auth:c,realtime:u,global:h}=t,{db:d,auth:f,realtime:p,global:y}=e,w=Nl(t.tracePropagation),k=Nl(e.tracePropagation),_={db:Ae(Ae({},d),l),auth:Ae(Ae({},f),c),realtime:Ae(Ae({},p),u),storage:{},global:Ae(Ae(Ae({},y),h),{},{headers:Ae(Ae({},(r=y==null?void 0:y.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=w==null?void 0:w.enabled)!==null&&i!==void 0?i:k==null?void 0:k.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=w==null?void 0:w.respectSamplingDecision)!==null&&a!==void 0?a:k==null?void 0:k.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function Lv(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(jv(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Dv=class extends hv{constructor(t){super(t)}},Uv=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=Lv(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:gv,realtime:yv,auth:Ae(Ae({},mv),{},{storageKey:o}),global:pv,tracePropagation:vv},l=Nv(r??{},a);if(this.settings=l,this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=Iv(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(Ae({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 em(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 fy(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Vg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,p){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Dv({url:this.authUrl.href,headers:Ae(Ae({},y),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:p,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new Lm(this.realtimeUrl.href,Ae(Ae({},t),{},{params:Ae(Ae({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Bv=(t,e,r)=>new Uv(t,e,r);function Mv(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Mv()&&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 Ku=null,Ll=!1;async function Hv(){if(!Ll){Ll=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Ku=Bv(e,r))}catch{}}}function ps(){return Ku}const es=hu("auth",()=>{const t=Re(localStorage.getItem("io_token")),e=Re(localStorage.getItem("io_email")),r=Re(!1);let n=null;const s=Ne(()=>!!t.value);function i(h,d=3e5){try{return JSON.parse(atob(h.split(".")[1])).exp*1e3<=Date.now()+d}catch{return!0}}function o(){const h=ps();h&&(h.auth.onAuthStateChange((d,f)=>{var p,y;f?(t.value=f.access_token,e.value=((p=f.user)==null?void 0:p.email)??null,localStorage.setItem("io_token",f.access_token),(y=f.user)!=null&&y.email&&localStorage.setItem("io_email",f.user.email)):(t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"))}),a())}function a(){n||(n=setInterval(async()=>{t.value&&i(t.value)&&await u()},300*1e3))}async function l(h,d){var p,y;const f=ps();if(!f)throw new Error("Auth not configured");r.value=!0;try{const{data:w,error:k}=await f.auth.signInWithPassword({email:h,password:d});if(k)throw k;t.value=((p=w.session)==null?void 0:p.access_token)??null,e.value=((y=w.user)==null?void 0:y.email)??null,t.value&&localStorage.setItem("io_token",t.value),e.value&&localStorage.setItem("io_email",e.value)}finally{r.value=!1}}async function c(){const h=ps();h&&await h.auth.signOut(),t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"),n&&(clearInterval(n),n=null)}async function u(){const h=ps();if(!h)return;const{data:d,error:f}=await h.auth.refreshSession();if(!f&&d.session){t.value=d.session.access_token,localStorage.setItem("io_token",d.session.access_token);return}const{data:p}=await h.auth.getSession();if(p.session){t.value=p.session.access_token,localStorage.setItem("io_token",p.session.access_token);return}t.value=null,localStorage.removeItem("io_token")}return{token:t,email:e,loading:r,isAuthenticated:s,login:l,logout:c,refreshToken:u,initAuthListener:o}}),qv=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:es},Symbol.toStringTag,{value:"Module"})),Fv={class:"h-12 border-b border-border bg-header flex items-center justify-between px-4 shrink-0"},Vv={class:"flex items-center gap-2"},zv={class:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",title:"User"},Wv=fr({__name:"AppHeader",setup(t){const e=es(),r=sg();async function n(){await e.logout(),r.push("/login")}return(s,i)=>{const o=Ao("router-link");return se(),ce("header",Fv,[i[0]||(i[0]=Q("div",null,null,-1)),Q("div",Vv,[le(o,{to:"/feed",class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Inbox"},{default:Jr(()=>[le(re(Eu),{class:"w-4 h-4"})]),_:1}),Q("div",zv,[le(re(Og),{class:"w-3.5 h-3.5 text-muted-foreground"})]),Q("button",{onClick:n,class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[le(re(vg),{class:"w-4 h-4"})])])])}}}),Kv=5e3;function Gv(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}const Jv=hu("chat",()=>{const t=Re([]),e=Re(!1),r=Re(null),n=Re(crypto.randomUUID()),s=Re(null);function i(u,h=[]){const d={id:crypto.randomUUID(),role:"user",content:u,attachments:h,timestamp:new Date};return t.value.push(d),d}async function o(u,h=[]){i(u,h),e.value=!0;const d={id:crypto.randomUUID(),role:"assistant",content:"",attachments:[],timestamp:new Date,streaming:!0};t.value.push(d);let f=Date.now();try{const p=es();p.token&&Gv(p.token)&&await p.refreshToken();const y={"Content-Type":"application/json"};p.token&&(y.Authorization=`Bearer ${p.token}`),s.value=new AbortController;const w=await fetch("/api/message",{method:"POST",headers:y,signal:s.value.signal,body:JSON.stringify({prompt:u,conversationId:n.value,attachments:h})});if(!w.ok||!w.body)throw new Error(`API error: ${w.status}`);const k=w.body.getReader(),_=new TextDecoder;let b="";for(;;){const{done:A,value:U}=await k.read();if(A)break;b+=_.decode(U,{stream:!0});const F=b.split(`
|
|
224
|
+
`);b=F.pop()??"";let B="";for(const J of F)if(J.startsWith("event: "))B=J.slice(7);else if(J.startsWith("data: ")){const C=J.slice(6);try{const z=JSON.parse(C);if(B==="delta"){const ee=Date.now(),O=t.value[t.value.length-1];if(O&&!O.streaming&&O.role==="assistant"&&ee-f>Kv){const te={id:crypto.randomUUID(),role:"assistant",content:z.content,attachments:[],timestamp:new Date,streaming:!0};t.value.push(te)}else{const te=t.value.filter(Pe=>Pe.streaming),ke=te[te.length-1];ke&&(ke.content=z.content)}f=ee}else if(B==="done"){const ee=t.value.filter(te=>te.streaming),O=ee[ee.length-1];O&&(O.content=z.content,O.streaming=!1),z.conversationId&&(n.value=z.conversationId)}else if(B==="error"){const ee=t.value.filter(te=>te.streaming),O=ee[ee.length-1];O&&(O.content=`Error: ${z.error}`,O.streaming=!1)}}catch{}B=""}else J.startsWith(":")}}catch(p){const y=t.value.filter(k=>k.streaming),w=y[y.length-1];w&&((p==null?void 0:p.name)==="AbortError"||(w.content=`Error: ${p.message}`),w.streaming=!1)}finally{s.value=null,e.value=!1}}function a(){var u;(u=s.value)==null||u.abort()}function l(u){const h=t.value[t.value.length-1];h!=null&&h.streaming&&(h.content=u)}function c(){t.value=[],n.value=crypto.randomUUID()}return{messages:t,isStreaming:e,eventSource:r,conversationId:n,sendMessage:o,updateStreamingMessage:l,clearMessages:c,stopStreaming:a}});function Lo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Cr=Lo();function Gu(t){Cr=t}var $n={exec:()=>null};function fe(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Xe.caret,"$1"),r=r.replace(s,o),n},getRegex:()=>new RegExp(r,e)};return n}var Xe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Yv=/^(?:[ \t]*(?:\n|$))+/,Xv=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Zv=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ts=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qv=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Do=/(?:[*+-]|\d{1,9}[.)])/,Ju=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Yu=fe(Ju).replace(/bull/g,Do).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),eb=fe(Ju).replace(/bull/g,Do).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Uo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tb=/^[^\n]+/,Bo=/(?!\s*\])(?:\\.|[^\[\]\\])+/,rb=fe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Bo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),nb=fe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Do).getRegex(),ai="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Mo=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sb=fe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Mo).replace("tag",ai).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xu=fe(Uo).replace("hr",ts).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ai).getRegex(),ib=fe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xu).getRegex(),Ho={blockquote:ib,code:Xv,def:rb,fences:Zv,heading:Qv,hr:ts,html:sb,lheading:Yu,list:nb,newline:Yv,paragraph:Xu,table:$n,text:tb},Dl=fe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ts).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ai).getRegex(),ob={...Ho,lheading:eb,table:Dl,paragraph:fe(Uo).replace("hr",ts).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Dl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ai).getRegex()},ab={...Ho,html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Mo).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$n,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:fe(Uo).replace("hr",ts).replace("heading",` *#{1,6} *[^
|
|
225
|
+
]`).replace("lheading",Yu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zu=/^( {2,}|\\)\n(?!\s*$)/,ub=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,li=/[\p{P}\p{S}]/u,qo=/[\s\p{P}\p{S}]/u,Qu=/[^\s\p{P}\p{S}]/u,hb=fe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qo).getRegex(),eh=/(?!~)[\p{P}\p{S}]/u,db=/(?!~)[\s\p{P}\p{S}]/u,fb=/(?:[^\s\p{P}\p{S}]|~)/u,pb=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,th=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,gb=fe(th,"u").replace(/punct/g,li).getRegex(),mb=fe(th,"u").replace(/punct/g,eh).getRegex(),rh="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yb=fe(rh,"gu").replace(/notPunctSpace/g,Qu).replace(/punctSpace/g,qo).replace(/punct/g,li).getRegex(),vb=fe(rh,"gu").replace(/notPunctSpace/g,fb).replace(/punctSpace/g,db).replace(/punct/g,eh).getRegex(),bb=fe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Qu).replace(/punctSpace/g,qo).replace(/punct/g,li).getRegex(),_b=fe(/\\(punct)/,"gu").replace(/punct/g,li).getRegex(),wb=fe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),kb=fe(Mo).replace("(?:-->|$)","-->").getRegex(),Sb=fe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",kb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ls=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Eb=fe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ls).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nh=fe(/^!?\[(label)\]\[(ref)\]/).replace("label",Ls).replace("ref",Bo).getRegex(),sh=fe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Bo).getRegex(),Tb=fe("reflink|nolink(?!\\()","g").replace("reflink",nh).replace("nolink",sh).getRegex(),Fo={_backpedal:$n,anyPunctuation:_b,autolink:wb,blockSkip:pb,br:Zu,code:cb,del:$n,emStrongLDelim:gb,emStrongRDelimAst:yb,emStrongRDelimUnd:bb,escape:lb,link:Eb,nolink:sh,punctuation:hb,reflink:nh,reflinkSearch:Tb,tag:Sb,text:ub,url:$n},Ab={...Fo,link:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",Ls).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ls).getRegex()},co={...Fo,emStrongRDelimAst:vb,emStrongLDelim:mb,url:fe(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},xb={...co,br:fe(Zu).replace("{2,}","*").getRegex(),text:fe(co.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},gs={normal:Ho,gfm:ob,pedantic:ab},fn={normal:Fo,gfm:co,breaks:xb,pedantic:Ab},Rb={"&":"&","<":"<",">":">",'"':""","'":"'"},Ul=t=>Rb[t];function xt(t,e){if(e){if(Xe.escapeTest.test(t))return t.replace(Xe.escapeReplace,Ul)}else if(Xe.escapeTestNoEncode.test(t))return t.replace(Xe.escapeReplaceNoEncode,Ul);return t}function Bl(t){try{t=encodeURI(t).replace(Xe.percentDecode,"%")}catch{return null}return t}function Ml(t,e){var i;const r=t.replace(Xe.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(Xe.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Xe.slashPipe,"|");return n}function pn(t,e,r){const n=t.length;if(n===0)return"";let s=0;for(;s<n&&t.charAt(n-s-1)===e;)s++;return t.slice(0,n-s)}function Cb(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function Hl(t,e,r,n,s){const i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function Ob(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const s=n[1];return e.split(`
|
|
226
|
+
`).map(i=>{const o=i.match(r.other.beginningSpace);if(o===null)return i;const[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
227
|
+
`)}var Ds=class{constructor(t){me(this,"options");me(this,"rules");me(this,"lexer");this.options=t||Cr}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:pn(r,`
|
|
228
|
+
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=Ob(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){const n=pn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:pn(e[0],`
|
|
229
|
+
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=pn(e[0],`
|
|
230
|
+
`).split(`
|
|
231
|
+
`),n="",s="";const i=[];for(;r.length>0;){let o=!1;const a=[];let l;for(l=0;l<r.length;l++)if(this.rules.other.blockquoteStart.test(r[l]))a.push(r[l]),o=!0;else if(!o)a.push(r[l]);else break;r=r.slice(l);const c=a.join(`
|
|
232
|
+
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
233
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
234
|
+
${c}`:c,s=s?`${s}
|
|
235
|
+
${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,r.length===0)break;const d=i.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){const f=d,p=f.raw+`
|
|
236
|
+
`+r.join(`
|
|
237
|
+
`),y=this.blockquote(p);i[i.length-1]=y,n=n.substring(0,n.length-f.raw.length)+y.raw,s=s.substring(0,s.length-f.text.length)+y.text;break}else if((d==null?void 0:d.type)==="list"){const f=d,p=f.raw+`
|
|
238
|
+
`+r.join(`
|
|
239
|
+
`),y=this.list(p);i[i.length-1]=y,n=n.substring(0,n.length-d.raw.length)+y.raw,s=s.substring(0,s.length-f.raw.length)+y.raw,r=p.substring(i.at(-1).raw.length).split(`
|
|
240
|
+
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim();const n=r.length>1,s={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const i=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let l=!1,c="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=e[2].split(`
|
|
241
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),d=t.split(`
|
|
242
|
+
`,1)[0],f=!h.trim(),p=0;if(this.options.pedantic?(p=2,u=h.trimStart()):f?p=e[1].length+1:(p=e[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=h.slice(p),p+=e[1].length),f&&this.rules.other.blankLine.test(d)&&(c+=d+`
|
|
243
|
+
`,t=t.substring(d.length+1),l=!0),!l){const k=this.rules.other.nextBulletRegex(p),_=this.rules.other.hrRegex(p),b=this.rules.other.fencesBeginRegex(p),A=this.rules.other.headingBeginRegex(p),U=this.rules.other.htmlBeginRegex(p);for(;t;){const F=t.split(`
|
|
244
|
+
`,1)[0];let B;if(d=F,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),B=d):B=d.replace(this.rules.other.tabCharGlobal," "),b.test(d)||A.test(d)||U.test(d)||k.test(d)||_.test(d))break;if(B.search(this.rules.other.nonSpaceChar)>=p||!d.trim())u+=`
|
|
245
|
+
`+B.slice(p);else{if(f||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(h)||A.test(h)||_.test(h))break;u+=`
|
|
246
|
+
`+d}!f&&!d.trim()&&(f=!0),c+=F+`
|
|
247
|
+
`,t=t.substring(F.length+1),h=B.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,w;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(w=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!y,checked:w,loose:!1,text:u,tokens:[]}),s.raw+=c}const a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const c=s.items[l].tokens.filter(h=>h.type==="space"),u=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:s}}}table(t){var o;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const r=Ml(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
248
|
+
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const a of n)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<r.length;a++)i.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:i.align[a]});for(const a of s)i.rows.push(Ml(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const r=e[1].charAt(e[1].length-1)===`
|
|
249
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=pn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=Cb(e[2],"()");if(i===-2)return;if(i>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),Hl(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Hl(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...n[0]].length-1;let o,a,l=i,c=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(n=u.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(a=[...o].length,n[3]||n[4]){l+=a;continue}else if((n[5]||n[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);const h=[...n[0]][0].length,d=t.slice(0,i+n.index+h+a);if(Math.min(i,a)%2){const p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}const f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let i;do i=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(i!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Kt=class uo{constructor(e){me(this,"tokens");me(this,"options");me(this,"state");me(this,"tokenizer");me(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Cr,this.options.tokenizer=this.options.tokenizer||new Ds,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Xe,block:gs.normal,inline:fn.normal};this.options.pedantic?(r.block=gs.pedantic,r.inline=fn.pedantic):this.options.gfm&&(r.block=gs.gfm,this.options.breaks?r.inline=fn.breaks:r.inline=fn.gfm),this.tokenizer.rules=r}static get rules(){return{block:gs,inline:fn}}static lex(e,r){return new uo(r).lex(e)}static lexInline(e,r){return new uo(r).inlineTokens(e)}lex(e){e=e.replace(Xe.carriageReturn,`
|
|
250
|
+
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(Xe.tabCharGlobal," ").replace(Xe.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const c=r.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
251
|
+
`:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
252
|
+
`+a.raw,c.text+=`
|
|
253
|
+
`+a.text,this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
254
|
+
`+a.raw,c.text+=`
|
|
255
|
+
`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0;const u=e.slice(1);let h;this.options.extensions.startBlock.forEach(d=>{h=d.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){const c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
|
|
256
|
+
`+a.raw,c.text+=`
|
|
257
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a),n=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
258
|
+
`+a.raw,c.text+=`
|
|
259
|
+
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var a,l,c;let n=e,s=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let u;if((l=(a=this.options.extensions)==null?void 0:a.inline)!=null&&l.some(d=>(u=d.call({lexer:this},e,r))?(e=e.substring(u.raw.length),r.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const d=r.at(-1);u.type==="text"&&(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(e,n,o)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),r.push(u);continue}let h=e;if((c=this.options.extensions)!=null&&c.startInline){let d=1/0;const f=e.slice(1);let p;this.options.extensions.startInline.forEach(y=>{p=y.call({lexer:this},f),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),d<1/0&&d>=0&&(h=e.substring(0,d+1))}if(u=this.tokenizer.inlineText(h)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(o=u.raw.slice(-1)),i=!0;const d=r.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}},Us=class{constructor(t){me(this,"options");me(this,"parser");this.options=t||Cr}space(t){return""}code({text:t,lang:e,escaped:r}){var i;const n=(i=(e||"").match(Xe.notSpaceStart))==null?void 0:i[0],s=t.replace(Xe.endingNewline,"")+`
|
|
260
|
+
`;return n?'<pre><code class="language-'+xt(n)+'">'+(r?s:xt(s,!0))+`</code></pre>
|
|
261
|
+
`:"<pre><code>"+(r?s:xt(s,!0))+`</code></pre>
|
|
262
|
+
`}blockquote({tokens:t}){return`<blockquote>
|
|
263
|
+
${this.parser.parse(t)}</blockquote>
|
|
264
|
+
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
265
|
+
`}hr(t){return`<hr>
|
|
266
|
+
`}list(t){const e=t.ordered,r=t.start;let n="";for(let o=0;o<t.items.length;o++){const a=t.items[o];n+=this.listitem(a)}const s=e?"ol":"ul",i=e&&r!==1?' start="'+r+'"':"";return"<"+s+i+`>
|
|
267
|
+
`+n+"</"+s+`>
|
|
268
|
+
`}listitem(t){var r;let e="";if(t.task){const n=this.checkbox({checked:!!t.checked});t.loose?((r=t.tokens[0])==null?void 0:r.type)==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+xt(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
269
|
+
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
270
|
+
`}table(t){let e="",r="";for(let s=0;s<t.header.length;s++)r+=this.tablecell(t.header[s]);e+=this.tablerow({text:r});let n="";for(let s=0;s<t.rows.length;s++){const i=t.rows[s];r="";for(let o=0;o<i.length;o++)r+=this.tablecell(i[o]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
271
|
+
<thead>
|
|
272
|
+
`+e+`</thead>
|
|
273
|
+
`+n+`</table>
|
|
274
|
+
`}tablerow({text:t}){return`<tr>
|
|
275
|
+
${t}</tr>
|
|
276
|
+
`}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
277
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${xt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),s=Bl(t);if(s===null)return n;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+xt(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const s=Bl(t);if(s===null)return xt(r);t=s;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${xt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:xt(t.text)}},Vo=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Gt=class ho{constructor(e){me(this,"options");me(this,"renderer");me(this,"textRenderer");this.options=e||Cr,this.options.renderer=this.options.renderer||new Us,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Vo}static parse(e,r){return new ho(r).parse(e)}static parseInline(e,r){return new ho(r).parseInline(e)}parse(e,r=!0){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){n+=u||"";continue}}const l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
|
|
278
|
+
`+this.renderer.text(c);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";continue}}const l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},Ii,_s=(Ii=class{constructor(t){me(this,"options");me(this,"block");this.options=t||Cr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Kt.lex:Kt.lexInline}provideParser(){return this.block?Gt.parse:Gt.parseInline}},me(Ii,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ii),Pb=class{constructor(...t){me(this,"defaults",Lo());me(this,"options",this.setOptions);me(this,"parse",this.parseMarkdown(!0));me(this,"parseInline",this.parseMarkdown(!1));me(this,"Parser",Gt);me(this,"Renderer",Us);me(this,"TextRenderer",Vo);me(this,"Lexer",Kt);me(this,"Tokenizer",Ds);me(this,"Hooks",_s);this.use(...t)}walkTokens(t,e){var n,s;let r=[];for(const i of t)switch(r=r.concat(e.call(this,i)),i.type){case"table":{const o=i;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,e));for(const a of o.rows)for(const l of a)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=i;r=r.concat(this.walkTokens(o.items,e));break}default:{const o=i;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const l=o[a].flat(1/0);r=r.concat(this.walkTokens(l,e))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){const s=this.defaults.renderer||new Us(this.defaults);for(const i in r.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,a=r.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}n.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new Ds(this.defaults);for(const i in r.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,a=r.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new _s;for(const i in r.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,a=r.hooks[o],l=s[o];_s.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(s,c)).then(h=>l.call(s,h));const u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Kt.lex(t,e??this.defaults)}parser(t,e){return Gt.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const a=i.hooks?i.hooks.provideLexer():t?Kt.lex:Kt.lexInline,l=i.hooks?i.hooks.provideParser():t?Gt.parse:Gt.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(c=>a(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>l(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let c=a(r,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=l(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return o(c)}}}onError(t,e){return r=>{if(r.message+=`
|
|
279
|
+
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+xt(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Rr=new Pb;function pe(t,e){return Rr.parse(t,e)}pe.options=pe.setOptions=function(t){return Rr.setOptions(t),pe.defaults=Rr.defaults,Gu(pe.defaults),pe};pe.getDefaults=Lo;pe.defaults=Cr;pe.use=function(...t){return Rr.use(...t),pe.defaults=Rr.defaults,Gu(pe.defaults),pe};pe.walkTokens=function(t,e){return Rr.walkTokens(t,e)};pe.parseInline=Rr.parseInline;pe.Parser=Gt;pe.parser=Gt.parse;pe.Renderer=Us;pe.TextRenderer=Vo;pe.Lexer=Kt;pe.lexer=Kt.lex;pe.Tokenizer=Ds;pe.Hooks=_s;pe.parse=pe;pe.options;pe.setOptions;pe.use;pe.walkTokens;pe.parseInline;Gt.parse;Kt.lex;const Ib=["innerHTML"],$b=fr({__name:"MarkdownContent",props:{content:{}},setup(t){const e=t,r=Ne(()=>e.content?pe.parse(e.content,{async:!1}):"");return(n,s)=>(se(),ce("div",{class:"prose prose-sm dark:prose-invert max-w-none",innerHTML:r.value},null,8,Ib))}}),ih=10*1024*1024,oh=25*1024*1024;function gn(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Pi(t){return t.mimeType.startsWith("image/")}function jb(t){return`data:${t.mimeType};base64,${t.content}`}async function Nb(t){const e=await new Promise((n,s)=>{const i=new FileReader;i.onload=()=>n(String(i.result??"")),i.onerror=()=>s(new Error("Unable to read file")),i.readAsDataURL(t)}),r=e.indexOf(",");if(r===-1)throw new Error(`Unable to parse file content for ${t.name}`);return{name:t.name,mimeType:t.type||"application/octet-stream",size:t.size,content:e.slice(r+1)}}function Lb(t){for(const r of t)if(r.size>ih)return{ok:!1,error:`"${r.name}" exceeds the 10MB per-file limit.`};return t.reduce((r,n)=>r+n.size,0)>oh?{ok:!1,error:"Attachments exceed the 25MB per-message limit."}:{ok:!0}}const Db={class:"overlay-header"},Ub={key:0,class:"flex h-full items-center justify-center px-8"},Bb={key:0,class:"mb-2 space-y-2"},Mb=["src","alt"],Hb={class:"flex items-center gap-2 text-xs"},qb={class:"truncate"},Fb={class:"opacity-70"},Vb={key:2,class:"text-muted-foreground"},zb={class:"mt-2 flex items-center justify-between gap-3"},Wb={key:3,class:"mt-2 inline-flex items-center gap-1","aria-label":"Streaming response"},Kb={class:"overlay-footer"},Gb={key:0,class:"mb-2 space-y-2"},Jb={class:"flex flex-wrap gap-1.5"},Yb={class:"max-w-[120px] truncate"},Xb={class:"opacity-65"},Zb=["onClick"],Qb={class:"overlay-meta text-muted-foreground"},e_={key:1,class:"text-xs text-destructive mb-2"},t_={class:"flex items-end gap-2"},r_=["disabled"],n_=["disabled","aria-label","title"],s_=fr({__name:"ChatOverlay",setup(t){const e=Jv(),r=$o(),n=Re(!1),s=Re(""),i=Re(""),o=Re(!1),a=Re([]),l=Re(),c=Re(),u=Re(),h=Re(!0),d=Re(!1),f=Ne(()=>e.messages.length>0),p=()=>r.path==="/",y=Ne(()=>a.value.reduce((M,$)=>M+$.size,0)),w=Ne(()=>!e.isStreaming&&(s.value.trim().length>0||a.value.length>0));function k(){p()||(n.value=!n.value)}function _(){u.value&&(u.value.style.height="auto",u.value.style.height=`${Math.min(u.value.scrollHeight,136)}px`)}function b(){if(!l.value)return;const M=l.value,$=M.scrollHeight-M.scrollTop-M.clientHeight;h.value=$<40,d.value=!h.value}function A(M=!1){l.value&&(M||h.value)&&(l.value.scrollTop=l.value.scrollHeight,d.value=!1)}function U(M){return new Date(M).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}async function F(M){if(!M||M.length===0)return;i.value="";const $=[];try{for(const Ue of Array.from(M))$.push(await Nb(Ue))}catch(Ue){i.value=(Ue==null?void 0:Ue.message)??"Unable to read one or more files.";return}const V=[...a.value,...$],Ee=Lb(V);if(!Ee.ok){i.value=Ee.error;return}a.value=V,c.value&&(c.value.value="")}function B(M){a.value.splice(M,1),i.value=""}function J(){var M;e.isStreaming||(M=c.value)==null||M.click()}function C(M){const $=M.target;F(($==null?void 0:$.files)??null)}async function z(){if(!w.value)return;const M=s.value.trim(),$=[...a.value],V=M||"Please review the attached file(s).";s.value="",a.value=[],i.value="",_(),await e.sendMessage(V,$)}function ee(){e.stopStreaming()}function O(M){if(M.key==="Enter"&&!M.shiftKey){if(M.preventDefault(),e.isStreaming){ee();return}z()}}function te(M){M.preventDefault(),!e.isStreaming&&(o.value=!0)}function ke(M){M.preventDefault(),o.value=!1}async function Pe(M){var $;M.preventDefault(),o.value=!1,!e.isStreaming&&await F((($=M.dataTransfer)==null?void 0:$.files)??null)}return Wt(s,()=>_()),Wt(()=>e.messages.map(M=>M.content),async()=>{await ur(),b(),A()},{deep:!0}),Wt(()=>e.messages.length,async()=>{await ur(),b(),A(!0)}),Wt(n,async M=>{M&&(await ur(),_(),b(),A(!0))}),To(async()=>{await ur(),_()}),(M,$)=>(se(),ce(Fe,null,[!n.value&&!p()?(se(),ce("button",{key:0,onClick:k,class:"overlay-fab",title:"Chat with IO","aria-label":"Open chat overlay"},[le(re(bg),{class:"h-5 w-5 text-white"}),$[4]||($[4]=Q("span",{class:"overlay-fab-label"},"IO",-1))])):je("",!0),le(pf,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-[0.98]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-[0.98]"},{default:Jr(()=>[n.value?(se(),ce("section",{key:0,class:Ge(["overlay-panel",o.value?"overlay-panel-dragging":""]),"aria-label":"IO Assistant chat",onDragover:te,onDragleave:ke,onDrop:Pe},[Q("header",Db,[$[5]||($[5]=Q("div",{class:"flex items-center gap-3"},[Q("div",{class:"overlay-status-dot"}),Q("div",null,[Q("p",{class:"overlay-title"},"IO ASSISTANT"),Q("p",{class:"overlay-meta"},"LIVE")])],-1)),Q("button",{onClick:$[0]||($[0]=V=>n.value=!1),class:"overlay-icon-btn","aria-label":"Minimize chat overlay",title:"Minimize"},[le(re(wg),{class:"h-4 w-4"})])]),Q("div",{ref_key:"messagesContainer",ref:l,class:"overlay-messages",onScroll:b},[f.value?je("",!0):(se(),ce("div",Ub,[...$[6]||($[6]=[Q("div",{class:"text-center"},[Q("p",{class:"overlay-title text-3xl"},"CHAT"),Q("p",{class:"mt-2 text-sm text-muted-foreground"},"Ask IO about your workspace, agents, or recent changes.")],-1)])])),(se(!0),ce(Fe,null,Tn(re(e).messages,V=>(se(),ce("div",{key:V.id,class:Ge(["flex",V.role==="user"?"justify-end":"justify-start"])},[Q("article",{class:Ge(["overlay-bubble",V.role==="user"?"overlay-bubble-user":"overlay-bubble-assistant"])},[V.attachments.length>0?(se(),ce("div",Bb,[(se(!0),ce(Fe,null,Tn(V.attachments,(Ee,Ue)=>(se(),ce("div",{key:`${V.id}-${Ue}`,class:"overlay-attachment"},[re(Pi)(Ee)?(se(),ce("img",{key:0,src:re(jb)(Ee),alt:Ee.name,class:"max-h-44 rounded-md mb-1 object-contain"},null,8,Mb)):je("",!0),Q("div",Hb,[re(Pi)(Ee)?(se(),st(re(rl),{key:0,class:"w-3.5 h-3.5"})):(se(),st(re(tl),{key:1,class:"w-3.5 h-3.5"})),Q("span",qb,rt(Ee.name),1),Q("span",Fb,rt(re(gn)(Ee.size)),1)])]))),128))])):je("",!0),V.content?(se(),st($b,{key:1,content:V.content,class:Ge(["overlay-markdown",V.role==="user"?"prose-invert":""])},null,8,["content","class"])):(se(),ce("span",Vb,"...")),Q("div",zb,[Q("span",{class:Ge(["overlay-meta uppercase tracking-[0.18em]",V.role==="user"?"text-primary-foreground/70":"text-muted-foreground"])},rt(V.role),3),Q("span",{class:Ge(["overlay-meta",V.role==="user"?"text-primary-foreground/70":"text-muted-foreground"])},rt(U(V.timestamp)),3)]),V.streaming?(se(),ce("div",Wb,[...$[7]||($[7]=[Q("span",{class:"overlay-dot animate-pulse"},null,-1),Q("span",{class:"overlay-dot animate-pulse [animation-delay:140ms]"},null,-1),Q("span",{class:"overlay-dot animate-pulse [animation-delay:280ms]"},null,-1)])])):je("",!0)],2)],2))),128))],544),d.value?(se(),ce("button",{key:0,class:"overlay-scroll-hint",type:"button",onClick:$[1]||($[1]=V=>A(!0)),"aria-label":"Scroll to latest message"},[le(re(fg),{class:"h-3.5 w-3.5"}),$[8]||($[8]=tu(" Latest ",-1))])):je("",!0),Q("footer",Kb,[Q("input",{ref_key:"fileInput",ref:c,type:"file",multiple:"",class:"hidden",onChange:C},null,544),a.value.length>0?(se(),ce("div",Gb,[Q("div",Jb,[(se(!0),ce(Fe,null,Tn(a.value,(V,Ee)=>(se(),ce("div",{key:`${V.name}-${Ee}`,class:"overlay-chip"},[re(Pi)(V)?(se(),st(re(rl),{key:0,class:"w-3.5 h-3.5"})):(se(),st(re(tl),{key:1,class:"w-3.5 h-3.5"})),Q("span",Yb,rt(V.name),1),Q("span",Xb,rt(re(gn)(V.size)),1),Q("button",{class:"hover:text-destructive",onClick:Ue=>B(Ee)},[le(re(Ig),{class:"w-3.5 h-3.5"})],8,Zb)]))),128))]),Q("p",Qb,rt(re(gn)(y.value))+" · Max "+rt(re(gn)(re(ih)))+" file · "+rt(re(gn)(re(oh)))+" total ",1)])):je("",!0),i.value?(se(),ce("p",e_,rt(i.value),1)):je("",!0),Q("div",t_,[Q("button",{class:"overlay-attach-btn",disabled:re(e).isStreaming,onClick:J,title:"Attach files","aria-label":"Attach files"},[le(re(Eg),{class:"w-4 h-4"})],8,r_),nd(Q("textarea",{ref_key:"textareaRef",ref:u,"onUpdate:modelValue":$[2]||($[2]=V=>s.value=V),onKeydown:O,placeholder:"Message IO...",rows:"1",class:"overlay-input"},null,544),[[Df,s.value]]),Q("button",{onClick:$[3]||($[3]=V=>re(e).isStreaming?ee():z()),disabled:!w.value&&!re(e).isStreaming,class:"overlay-send-btn","aria-label":re(e).isStreaming?"Stop generation":"Send message",title:re(e).isStreaming?"Stop generation":"Send message"},[re(e).isStreaming?(se(),st(re(Cg),{key:1,class:"h-3.5 w-3.5"})):(se(),st(re(Ag),{key:0,class:"h-4 w-4"}))],8,n_)])])],34)):je("",!0)]),_:1})],64))}}),i_=(t,e)=>{const r=t.__vccOpts||t;for(const[n,s]of e)r[n]=s;return r},o_=i_(s_,[["__scopeId","data-v-532d00e7"]]),a_={class:"flex h-screen overflow-hidden"},l_={class:"flex-1 flex flex-col overflow-hidden"},c_={class:"flex-1 overflow-auto"},u_=fr({__name:"App",setup(t){const e=es(),r=$o(),n=Ne(()=>e.isAuthenticated&&r.name!=="login");return(s,i)=>{const o=Ao("router-view");return se(),ce("div",a_,[n.value?(se(),st(Mg,{key:0})):je("",!0),Q("div",l_,[n.value?(se(),st(Wv,{key:0})):je("",!0),Q("main",c_,[le(o)])]),n.value?(se(),st(o_,{key:1})):je("",!0)])}}}),h_=[{path:"/login",name:"login",component:()=>ze(()=>import("./LoginView-D2-FBKS3.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>ze(()=>import("./ChatView-DpTWixGo.js"),[])},{path:"/squads",name:"squads",component:()=>ze(()=>import("./SquadsView-hvOGTg2k.js"),__vite__mapDeps([0,1,2,3]))},{path:"/squads/health",name:"squad-health",component:()=>ze(()=>import("./SquadHealthView-C9BKBgkW.js"),__vite__mapDeps([4,1,5,3]))},{path:"/squads/:id",name:"squad-detail",component:()=>ze(()=>import("./SquadDetailView-D3dLQWq8.js"),__vite__mapDeps([6,1,2,3,7,8]))},{path:"/feed",name:"feed",component:()=>ze(()=>import("./FeedView-DLpifZ22.js"),__vite__mapDeps([9,1,2,7]))},{path:"/skills",name:"skills",component:()=>ze(()=>import("./SkillsView-p5j-mrYN.js"),__vite__mapDeps([10,1,11,12,13,7]))},{path:"/mcp",name:"mcp",component:()=>ze(()=>import("./McpView-CRzUrNTa.js"),__vite__mapDeps([14,1,15,11,7]))},{path:"/schedules",name:"schedules",component:()=>ze(()=>import("./SchedulesView-nKZpyYX8.js"),__vite__mapDeps([16,1,2,15,11,7]))},{path:"/history",name:"history",component:()=>ze(()=>import("./HistoryView-DZpGvhB5.js"),__vite__mapDeps([17,1,12,8,7]))},{path:"/wiki",name:"wiki",component:()=>ze(()=>import("./WikiView-CitkkJyn.js"),__vite__mapDeps([18,1,12,11,13,7]))},{path:"/usage",name:"usage",component:()=>ze(()=>import("./UsageView-CXEO2kEU.js"),__vite__mapDeps([19,1,5]))},{path:"/audit-log",name:"audit-log",component:()=>ze(()=>import("./AuditLogView-BKdTTuUZ.js"),__vite__mapDeps([20,1]))},{path:"/settings",name:"settings",component:()=>ze(()=>import("./SettingsView-Cng7uCir.js"),__vite__mapDeps([21,1]))}],ah=ng({history:Np(),routes:h_});ah.beforeEach(t=>{const e=es();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});async function d_(){await Hv();const t=Ff(u_);t.use(Wf()),t.use(ah);const{useAuthStore:e}=await ze(async()=>{const{useAuthStore:n}=await Promise.resolve().then(()=>qv);return{useAuthStore:n}},void 0),r=e();r.initAuthListener(),r.token&&await r.refreshToken(),t.mount("#app")}d_();export{p_ as $,ug as A,hg as B,dg as C,go as D,To as E,tl as F,Ic as G,yg as H,rl as I,se as J,Re as K,Tn as L,ih as M,Ao as N,ah as O,Eg as P,jb as Q,rt as R,Ag as S,re as T,Og as U,es as V,Jv as W,Ig as X,$o as Y,sg as Z,ag as _,fg as a,g_ as a0,Df as a1,Lb as a2,Wt as a3,Jr as a4,nd as a5,y_ as a6,m_ as a7,pg as b,gg as c,Fe as d,Eu as e,oh as f,_g as g,Tg as h,xg as i,Cg as j,Pg as k,$b as l,Ne as m,Q as n,st as o,je as p,ce as q,we as r,tu as s,le as t,fr as u,Nb as v,gn as w,Pi as x,ur as y,Ge as z};
|