heyio 1.5.4 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/copilot/agents.js +17 -3
- package/dist/copilot/gh-token.js +27 -17
- package/dist/copilot/orchestrator.js +32 -21
- package/dist/copilot/system-message.js +12 -0
- package/dist/mcp/registry.js +1 -0
- package/package.json +1 -1
- package/web-dist/assets/{AuditLogView-NwOkyMb3.js → AuditLogView-BPJtNXCS.js} +1 -1
- package/web-dist/assets/ChatView-Brk1nps-.js +11 -0
- package/web-dist/assets/{FeedView--RgZv0Fp.js → FeedView-DtpTOb4B.js} +1 -1
- package/web-dist/assets/{HistoryView-D8DoZMwH.js → HistoryView-CErxUNk_.js} +1 -1
- package/web-dist/assets/{LoginView-BkbYMBhW.js → LoginView-CWiUkg95.js} +1 -1
- package/web-dist/assets/McpView-C-td_je_.js +1 -0
- package/web-dist/assets/SchedulesView-DAcPfnmZ.js +6 -0
- package/web-dist/assets/{SettingsView-Dd835515.js → SettingsView-559gPpax.js} +1 -1
- package/web-dist/assets/{SkillsView-DBw8OXU2.js → SkillsView-DtnR6ZeP.js} +1 -1
- package/web-dist/assets/{SquadDetailView-BMxPW9wb.js → SquadDetailView-HYYd2HvB.js} +1 -1
- package/web-dist/assets/{SquadHealthView-DiaNJ5Fj.js → SquadHealthView-Dt_cBi_C.js} +1 -1
- package/web-dist/assets/{SquadsView-mSdbiuao.js → SquadsView-DdywGIi2.js} +1 -1
- package/web-dist/assets/ToggleSwitch.vue_vue_type_script_setup_true_lang-qLsSQnXV.js +1 -0
- package/web-dist/assets/{UsageView-gaILOX-n.js → UsageView-Dhuu6mVo.js} +1 -1
- package/web-dist/assets/{WikiView-C7Igna0s.js → WikiView-DWun-CTD.js} +1 -1
- package/web-dist/assets/{api-CKoqb3Uc.js → api-CdLJWHnn.js} +1 -1
- package/web-dist/assets/{arrow-left-DB67XHhN.js → arrow-left-27p7HUxd.js} +1 -1
- package/web-dist/assets/{file-text-G4fJOXsY.js → file-text-Dk0fT3q_.js} +1 -1
- package/web-dist/assets/{git-branch-BYVsshPr.js → git-branch-D5N3GVQo.js} +1 -1
- package/web-dist/assets/{index-BOXcmvk8.js → index-CZM0UQQJ.js} +32 -32
- package/web-dist/assets/index-CoyYyx4A.css +1 -0
- package/web-dist/assets/{plus-DgKU-0vm.js → plus-CoUrXVZm.js} +1 -1
- package/web-dist/assets/{save-C44cl5KP.js → save-CttKqFu3.js} +1 -1
- package/web-dist/assets/{search-CM4X0KHN.js → search-CMwjTbNl.js} +1 -1
- package/web-dist/assets/{trash-2-D8LQMu7D.js → trash-2-C1-PiQou.js} +1 -1
- package/web-dist/assets/{triangle-alert-CTfkTIuU.js → triangle-alert-BKZFqU_A.js} +1 -1
- package/web-dist/assets/{x-vkAu6_RE.js → x-D82kR2fu.js} +1 -1
- package/web-dist/index.html +2 -2
- package/web-dist/assets/ChatView-Bs4_ex3x.js +0 -11
- package/web-dist/assets/McpView-CDKLXC-c.js +0 -1
- package/web-dist/assets/SchedulesView-rTyYBi2M.js +0 -6
- package/web-dist/assets/index-Cd9kiyp4.css +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-
|
|
2
|
-
var rh=Object.defineProperty;var nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-Brk1nps-.js","assets/file-text-Dk0fT3q_.js","assets/x-D82kR2fu.js","assets/SquadsView-DdywGIi2.js","assets/api-CdLJWHnn.js","assets/squad-colors-B8B_Y-lz.js","assets/git-branch-D5N3GVQo.js","assets/SquadHealthView-Dt_cBi_C.js","assets/triangle-alert-BKZFqU_A.js","assets/SquadDetailView-HYYd2HvB.js","assets/trash-2-C1-PiQou.js","assets/arrow-left-27p7HUxd.js","assets/FeedView-DtpTOb4B.js","assets/SkillsView-DtnR6ZeP.js","assets/plus-CoUrXVZm.js","assets/search-CMwjTbNl.js","assets/save-CttKqFu3.js","assets/McpView-C-td_je_.js","assets/ToggleSwitch.vue_vue_type_script_setup_true_lang-qLsSQnXV.js","assets/SchedulesView-DAcPfnmZ.js","assets/HistoryView-CErxUNk_.js","assets/WikiView-DWun-CTD.js","assets/UsageView-Dhuu6mVo.js","assets/AuditLogView-BPJtNXCS.js","assets/SettingsView-559gPpax.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var rh=Object.defineProperty;var nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var pe=(t,e,r)=>nh(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 sh="modulepreload",ih=function(t){return"/"+t},zo={},Me=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=ih(c),c in zo)return;zo[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":sh,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
3
|
* @vue/shared v3.5.34
|
|
4
4
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
5
|
* @license MIT
|
|
6
|
-
**/function uo(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const
|
|
6
|
+
**/function uo(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const ge={},Vr=[],Pt=()=>{},Ul=()=>!1,Ds=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Us=t=>t.startsWith("onUpdate:"),Pe=Object.assign,ho=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},oh=Object.prototype.hasOwnProperty,oe=(t,e)=>oh.call(t,e),F=Array.isArray,zr=t=>Kn(t)==="[object Map]",nn=t=>Kn(t)==="[object Set]",Wo=t=>Kn(t)==="[object Date]",Y=t=>typeof t=="function",_e=t=>typeof t=="string",ct=t=>typeof t=="symbol",le=t=>t!==null&&typeof t=="object",Bl=t=>(le(t)||Y(t))&&Y(t.then)&&Y(t.catch),Ml=Object.prototype.toString,Kn=t=>Ml.call(t),ah=t=>Kn(t).slice(8,-1),Hl=t=>Kn(t)==="[object Object]",Bs=t=>_e(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,bn=uo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ms=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},lh=/-\w/g,We=Ms(t=>t.replace(lh,e=>e.slice(1).toUpperCase())),ch=/\B([A-Z])/g,cr=Ms(t=>t.replace(ch,"-$1").toLowerCase()),Hs=Ms(t=>t.charAt(0).toUpperCase()+t.slice(1)),ai=Ms(t=>t?`on${Hs(t)}`:""),Ot=(t,e)=>!Object.is(t,e),ps=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},ql=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},qs=t=>{const e=parseFloat(t);return isNaN(e)?t:e},uh=t=>{const e=_e(t)?Number(t):NaN;return isNaN(e)?t:e};let Ko;const Fs=()=>Ko||(Ko=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function fo(t){if(F(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],s=_e(n)?ph(n):fo(n);if(s)for(const i in s)e[i]=s[i]}return e}else if(_e(t)||le(t))return t}const hh=/;(?![^(]*\))/g,dh=/:([^]+)/,fh=/\/\*[^]*?\*\//g;function ph(t){const e={};return t.replace(fh,"").split(hh).forEach(r=>{if(r){const n=r.split(dh);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function Ye(t){let e="";if(_e(t))e=t;else if(F(t))for(let r=0;r<t.length;r++){const n=Ye(t[r]);n&&(e+=n+" ")}else if(le(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const gh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mh=uo(gh);function Fl(t){return!!t||t===""}function yh(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=Wo(t),n=Wo(e);if(r||n)return r&&n?t.getTime()===e.getTime():!1;if(r=ct(t),n=ct(e),r||n)return t===e;if(r=F(t),n=F(e),r||n)return r&&n?yh(t,e):!1;if(r=le(t),n=le(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 po(t,e){return t.findIndex(r=>sn(r,e))}const Vl=t=>!!(t&&t.__v_isRef===!0),Wr=t=>_e(t)?t:t==null?"":F(t)||le(t)&&(t.toString===Ml||!Y(t.toString))?Vl(t)?Wr(t.value):JSON.stringify(t,zl,2):String(t),zl=(t,e)=>Vl(e)?zl(t,e.value):zr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[n,s],i)=>(r[li(n,i)+" =>"]=s,r),{})}:nn(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>li(r))}:ct(e)?li(e):le(e)&&!F(e)&&!Hl(e)?String(e):e,li=(t,e="")=>{var r;return ct(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
|
|
7
7
|
* @vue/reactivity v3.5.34
|
|
8
8
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
9
|
* @license MIT
|
|
10
|
-
**/let Oe;class Wl{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&&Oe&&(Oe.active?(this.parent=Oe,this.index=(Oe.scopes||(Oe.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=Oe;try{return Oe=this,e()}finally{Oe=r}}}on(){++this._on===1&&(this.prevScope=Oe,Oe=this)}off(){if(this._on>0&&--this._on===0){if(Oe===this)Oe=this.prevScope;else{let e=Oe;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 Kl(t){return new Wl(t)}function Gl(){return Oe}function vh(t,e=!1){Oe&&Oe.cleanups.push(t)}let ye;const ci=new WeakSet;class Jl{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,Oe&&(Oe.active?Oe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ci.has(this)&&(ci.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ql(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Go(this),Zl(this);const e=ye,r=ft;ye=this,ft=!0;try{return this.fn()}finally{Xl(this),ye=e,ft=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)yo(e);this.deps=this.depsTail=void 0,Go(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ci.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Oi(this)&&this.run()}get dirty(){return Oi(this)}}let Yl=0,bn,_n;function Ql(t,e=!1){if(t.flags|=8,e){t.next=_n,_n=t;return}t.next=bn,bn=t}function go(){Yl++}function mo(){if(--Yl>0)return;if(_n){let e=_n;for(_n=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;bn;){let e=bn;for(bn=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 Zl(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Xl(t){let e,r=t.depsTail,n=r;for(;n;){const s=n.prevDep;n.version===-1?(n===r&&(r=s),yo(n),bh(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=s}t.deps=e,t.depsTail=r}function Oi(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(ec(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function ec(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Pn)||(t.globalVersion=Pn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Oi(t))))return;t.flags|=2;const e=t.dep,r=ye,n=ft;ye=t,ft=!0;try{Zl(t);const s=t.fn(t._value);(e.version===0||Ot(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{ye=r,ft=n,Xl(t),t.flags&=-3}}function yo(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)yo(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function bh(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let ft=!0;const tc=[];function Gt(){tc.push(ft),ft=!1}function Jt(){const t=tc.pop();ft=t===void 0?!0:t}function Go(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ye;ye=void 0;try{e()}finally{ye=r}}}let Pn=0;class _h{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 vo{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(!ye||!ft||ye===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==ye)r=this.activeLink=new _h(ye,this),ye.deps?(r.prevDep=ye.depsTail,ye.depsTail.nextDep=r,ye.depsTail=r):ye.deps=ye.depsTail=r,rc(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=ye.depsTail,r.nextDep=void 0,ye.depsTail.nextDep=r,ye.depsTail=r,ye.deps===r&&(ye.deps=n)}return r}trigger(e){this.version++,Pn++,this.notify(e)}notify(e){go();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{mo()}}}function rc(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)rc(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const bs=new WeakMap,Sr=Symbol(""),Pi=Symbol(""),In=Symbol("");function Le(t,e,r){if(ft&&ye){let n=bs.get(t);n||bs.set(t,n=new Map);let s=n.get(r);s||(n.set(r,s=new vo),s.map=n,s.key=r),s.track()}}function Ht(t,e,r,n,s,i){const o=bs.get(t);if(!o){Pn++;return}const a=l=>{l&&l.trigger()};if(go(),e==="clear")o.forEach(a);else{const l=F(t),c=l&&Bs(r);if(l&&r==="length"){const u=Number(n);o.forEach((h,d)=>{(d==="length"||d===In||!ct(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(In)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Sr)),zr(t)&&a(o.get(Pi)));break;case"delete":l||(a(o.get(Sr)),zr(t)&&a(o.get(Pi)));break;case"set":zr(t)&&a(o.get(Sr));break}}mo()}function wh(t,e){const r=bs.get(t);return r&&r.get(e)}function Or(t){const e=te(t);return e===t?e:(Le(e,"iterate",In),nt(t)?e:e.map(pt))}function Vs(t){return Le(t=te(t),"iterate",In),t}function xt(t,e){return Yt(t)?Jr(zt(t)?pt(e):e):pt(e)}const kh={__proto__:null,[Symbol.iterator](){return ui(this,Symbol.iterator,t=>xt(this,t))},concat(...t){return Or(this).concat(...t.map(e=>F(e)?Or(e):e))},entries(){return ui(this,"entries",t=>(t[1]=xt(this,t[1]),t))},every(t,e){return jt(this,"every",t,e,void 0,arguments)},filter(t,e){return jt(this,"filter",t,e,r=>r.map(n=>xt(this,n)),arguments)},find(t,e){return jt(this,"find",t,e,r=>xt(this,r),arguments)},findIndex(t,e){return jt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return jt(this,"findLast",t,e,r=>xt(this,r),arguments)},findLastIndex(t,e){return jt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return jt(this,"forEach",t,e,void 0,arguments)},includes(...t){return hi(this,"includes",t)},indexOf(...t){return hi(this,"indexOf",t)},join(t){return Or(this).join(t)},lastIndexOf(...t){return hi(this,"lastIndexOf",t)},map(t,e){return jt(this,"map",t,e,void 0,arguments)},pop(){return an(this,"pop")},push(...t){return an(this,"push",t)},reduce(t,...e){return Jo(this,"reduce",t,e)},reduceRight(t,...e){return Jo(this,"reduceRight",t,e)},shift(){return an(this,"shift")},some(t,e){return jt(this,"some",t,e,void 0,arguments)},splice(...t){return an(this,"splice",t)},toReversed(){return Or(this).toReversed()},toSorted(t){return Or(this).toSorted(t)},toSpliced(...t){return Or(this).toSpliced(...t)},unshift(...t){return an(this,"unshift",t)},values(){return ui(this,"values",t=>xt(this,t))}};function ui(t,e,r){const n=Vs(t),s=n[e]();return n!==t&&!nt(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=r(i.value)),i}),s}const Sh=Array.prototype;function jt(t,e,r,n,s,i){const o=Vs(t),a=o!==t&&!nt(t),l=o[e];if(l!==Sh[e]){const h=l.apply(t,i);return a?pt(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,xt(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 Jo(t,e,r,n){const s=Vs(t),i=s!==t&&!nt(t);let o=r,a=!1;s!==t&&(i?(a=n.length===0,o=function(c,u,h){return a&&(a=!1,c=xt(t,c)),r.call(this,c,xt(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?xt(t,l):l}function hi(t,e,r){const n=te(t);Le(n,"iterate",In);const s=n[e](...r);return(s===-1||s===!1)&&zs(r[0])?(r[0]=te(r[0]),n[e](...r)):s}function an(t,e,r=[]){Gt(),go();const n=te(t)[e].apply(t,r);return mo(),Jt(),n}const Eh=uo("__proto__,__v_isRef,__isVue"),nc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(ct));function Th(t){ct(t)||(t=String(t));const e=te(this);return Le(e,"has",t),e.hasOwnProperty(t)}class sc{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?Nh:lc:i?ac:oc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=F(e);if(!s){let l;if(o&&(l=kh[r]))return l;if(r==="hasOwnProperty")return Th}const a=Reflect.get(e,r,Se(e)?e:n);if((ct(r)?nc.has(r):Eh(r))||(s||Le(e,"get",r),i))return a;if(Se(a)){const l=o&&Bs(r)?a:a.value;return s&&ae(l)?ji(l):l}return ae(a)?s?ji(a):Kn(a):a}}class ic extends sc{constructor(e=!1){super(!1,e)}set(e,r,n,s){let i=e[r];const o=F(e)&&Bs(r);if(!this._isShallow){const c=Yt(i);if(!nt(n)&&!Yt(n)&&(i=te(i),n=te(n)),!o&&Se(i)&&!Se(n))return c||(i.value=n),!0}const a=o?Number(r)<e.length:ie(e,r),l=Reflect.set(e,r,n,Se(e)?e:s);return e===te(s)&&(a?Ot(n,i)&&Ht(e,"set",r,n):Ht(e,"add",r,n)),l}deleteProperty(e,r){const n=ie(e,r);e[r];const s=Reflect.deleteProperty(e,r);return s&&n&&Ht(e,"delete",r,void 0),s}has(e,r){const n=Reflect.has(e,r);return(!ct(r)||!nc.has(r))&&Le(e,"has",r),n}ownKeys(e){return Le(e,"iterate",F(e)?"length":Sr),Reflect.ownKeys(e)}}class Ah extends sc{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const xh=new ic,Rh=new Ah,Ch=new ic(!0);const Ii=t=>t,Xn=t=>Reflect.getPrototypeOf(t);function Oh(t,e,r){return function(...n){const s=this.__v_raw,i=te(s),o=zr(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=s[t](...n),u=r?Ii:e?Jr:pt;return!e&&Le(i,"iterate",l?Pi:Sr),Pe(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 es(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ph(t,e){const r={get(s){const i=this.__v_raw,o=te(i),a=te(s);t||(Ot(s,a)&&Le(o,"get",s),Le(o,"get",a));const{has:l}=Xn(o),c=e?Ii:t?Jr:pt;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&&Le(te(s),"iterate",Sr),s.size},has(s){const i=this.__v_raw,o=te(i),a=te(s);return t||(Ot(s,a)&&Le(o,"has",s),Le(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=te(a),c=e?Ii:t?Jr:pt;return!t&&Le(l,"iterate",Sr),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Pe(r,t?{add:es("add"),set:es("set"),delete:es("delete"),clear:es("clear")}:{add(s){const i=te(this),o=Xn(i),a=te(s),l=!e&&!nt(s)&&!Yt(s)?a:s;return o.has.call(i,l)||Ot(s,l)&&o.has.call(i,s)||Ot(a,l)&&o.has.call(i,a)||(i.add(l),Ht(i,"add",l,l)),this},set(s,i){!e&&!nt(i)&&!Yt(i)&&(i=te(i));const o=te(this),{has:a,get:l}=Xn(o);let c=a.call(o,s);c||(s=te(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Ot(i,u)&&Ht(o,"set",s,i):Ht(o,"add",s,i),this},delete(s){const i=te(this),{has:o,get:a}=Xn(i);let l=o.call(i,s);l||(s=te(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Ht(i,"delete",s,void 0),c},clear(){const s=te(this),i=s.size!==0,o=s.clear();return i&&Ht(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{r[s]=Oh(s,t,e)}),r}function bo(t,e){const r=Ph(t,e);return(n,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?n:Reflect.get(ie(r,s)&&s in n?r:n,s,i)}const Ih={get:bo(!1,!1)},jh={get:bo(!1,!0)},$h={get:bo(!0,!1)};const oc=new WeakMap,ac=new WeakMap,lc=new WeakMap,Nh=new WeakMap;function Lh(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Dh(t){return t.__v_skip||!Object.isExtensible(t)?0:Lh(ah(t))}function Kn(t){return Yt(t)?t:_o(t,!1,xh,Ih,oc)}function cc(t){return _o(t,!1,Ch,jh,ac)}function ji(t){return _o(t,!0,Rh,$h,lc)}function _o(t,e,r,n,s){if(!ae(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Dh(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 zt(t){return Yt(t)?zt(t.__v_raw):!!(t&&t.__v_isReactive)}function Yt(t){return!!(t&&t.__v_isReadonly)}function nt(t){return!!(t&&t.__v_isShallow)}function zs(t){return t?!!t.__v_raw:!1}function te(t){const e=t&&t.__v_raw;return e?te(e):t}function wo(t){return!ie(t,"__v_skip")&&Object.isExtensible(t)&&ql(t,"__v_skip",!0),t}const pt=t=>ae(t)?Kn(t):t,Jr=t=>ae(t)?ji(t):t;function Se(t){return t?t.__v_isRef===!0:!1}function et(t){return uc(t,!1)}function Uh(t){return uc(t,!0)}function uc(t,e){return Se(t)?t:new Bh(t,e)}class Bh{constructor(e,r){this.dep=new vo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:te(e),this._value=r?e:pt(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||nt(e)||Yt(e);e=n?e:te(e),Ot(e,r)&&(this._rawValue=e,this._value=n?e:pt(e),this.dep.trigger())}}function _e(t){return Se(t)?t.value:t}const Mh={get:(t,e,r)=>e==="__v_raw"?t:_e(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const s=t[e];return Se(s)&&!Se(r)?(s.value=r,!0):Reflect.set(t,e,r,n)}};function hc(t){return zt(t)?t:new Proxy(t,Mh)}function Hh(t){const e=F(t)?new Array(t.length):{};for(const r in t)e[r]=Fh(t,r);return e}class qh{constructor(e,r,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ct(r)?r:String(r),this._raw=te(e);let s=!0,i=e;if(!F(e)||ct(this._key)||!Bs(this._key))do s=!zs(i)||nt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=_e(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Se(this._raw[this._key])){const r=this._object[this._key];if(Se(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return wh(this._raw,this._key)}}function Fh(t,e,r){return new qh(t,e,r)}class Vh{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new vo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Pn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ye!==this)return Ql(this,!0),!0}get value(){const e=this.dep.track();return ec(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function zh(t,e,r=!1){let n,s;return Y(t)?n=t:(n=t.get,s=t.set),new Vh(n,s,r)}const ts={},_s=new WeakMap;let vr;function Wh(t,e=!1,r=vr){if(r){let n=_s.get(r);n||_s.set(r,n=[]),n.push(t)}}function Kh(t,e,r=pe){const{immediate:n,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=r,c=x=>s?x:nt(x)||s===!1||s===0?qt(x,1):qt(x);let u,h,d,f,p=!1,y=!1;if(Se(t)?(h=()=>t.value,p=nt(t)):zt(t)?(h=()=>c(t),p=!0):F(t)?(y=!0,p=t.some(x=>zt(x)||nt(x)),h=()=>t.map(x=>{if(Se(x))return x.value;if(zt(x))return c(x);if(Y(x))return l?l(x,2):x()})):Y(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Gt();try{d()}finally{Jt()}}const x=vr;vr=u;try{return l?l(t,3,[f]):t(f)}finally{vr=x}}:h=Pt,e&&s){const x=h,D=s===!0?1/0:s;h=()=>qt(x(),D)}const k=Gl(),w=()=>{u.stop(),k&&k.active&&ho(k.effects,u)};if(i&&e){const x=e;e=(...D)=>{x(...D),w()}}let b=y?new Array(t.length).fill(ts):ts;const _=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(e){const D=u.run();if(s||p||(y?D.some((M,H)=>Ot(M,b[H])):Ot(D,b))){d&&d();const M=vr;vr=u;try{const H=[D,b===ts?void 0:y&&b[0]===ts?[]:b,f];b=D,l?l(e,3,H):e(...H)}finally{vr=M}}}else u.run()};return a&&a(_),u=new Jl(h),u.scheduler=o?()=>o(_,!1):_,f=x=>Wh(x,!1,u),d=u.onStop=()=>{const x=_s.get(u);if(x){if(l)l(x,4);else for(const D of x)D();_s.delete(u)}},e?n?_(!0):b=u.run():o?o(_.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function qt(t,e=1/0,r){if(e<=0||!ae(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,Se(t))qt(t.value,e,r);else if(F(t))for(let n=0;n<t.length;n++)qt(t[n],e,r);else if(rn(t)||zr(t))t.forEach(n=>{qt(n,e,r)});else if(Hl(t)){for(const n in t)qt(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&qt(t[n],e,r)}return t}/**
|
|
10
|
+
**/let Oe;class Wl{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&&Oe&&(Oe.active?(this.parent=Oe,this.index=(Oe.scopes||(Oe.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=Oe;try{return Oe=this,e()}finally{Oe=r}}}on(){++this._on===1&&(this.prevScope=Oe,Oe=this)}off(){if(this._on>0&&--this._on===0){if(Oe===this)Oe=this.prevScope;else{let e=Oe;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 Kl(t){return new Wl(t)}function Gl(){return Oe}function vh(t,e=!1){Oe&&Oe.cleanups.push(t)}let ve;const ci=new WeakSet;class Jl{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,Oe&&(Oe.active?Oe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ci.has(this)&&(ci.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ql(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Go(this),Zl(this);const e=ve,r=ft;ve=this,ft=!0;try{return this.fn()}finally{Xl(this),ve=e,ft=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)yo(e);this.deps=this.depsTail=void 0,Go(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ci.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Oi(this)&&this.run()}get dirty(){return Oi(this)}}let Yl=0,_n,wn;function Ql(t,e=!1){if(t.flags|=8,e){t.next=wn,wn=t;return}t.next=_n,_n=t}function go(){Yl++}function mo(){if(--Yl>0)return;if(wn){let e=wn;for(wn=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;_n;){let e=_n;for(_n=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 Zl(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Xl(t){let e,r=t.depsTail,n=r;for(;n;){const s=n.prevDep;n.version===-1?(n===r&&(r=s),yo(n),bh(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=s}t.deps=e,t.depsTail=r}function Oi(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(ec(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function ec(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===In)||(t.globalVersion=In,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Oi(t))))return;t.flags|=2;const e=t.dep,r=ve,n=ft;ve=t,ft=!0;try{Zl(t);const s=t.fn(t._value);(e.version===0||Ot(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{ve=r,ft=n,Xl(t),t.flags&=-3}}function yo(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)yo(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function bh(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let ft=!0;const tc=[];function Gt(){tc.push(ft),ft=!1}function Jt(){const t=tc.pop();ft=t===void 0?!0:t}function Go(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=ve;ve=void 0;try{e()}finally{ve=r}}}let In=0;class _h{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 vo{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(!ve||!ft||ve===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==ve)r=this.activeLink=new _h(ve,this),ve.deps?(r.prevDep=ve.depsTail,ve.depsTail.nextDep=r,ve.depsTail=r):ve.deps=ve.depsTail=r,rc(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=ve.depsTail,r.nextDep=void 0,ve.depsTail.nextDep=r,ve.depsTail=r,ve.deps===r&&(ve.deps=n)}return r}trigger(e){this.version++,In++,this.notify(e)}notify(e){go();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{mo()}}}function rc(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)rc(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const bs=new WeakMap,Sr=Symbol(""),Pi=Symbol(""),jn=Symbol("");function De(t,e,r){if(ft&&ve){let n=bs.get(t);n||bs.set(t,n=new Map);let s=n.get(r);s||(n.set(r,s=new vo),s.map=n,s.key=r),s.track()}}function Ht(t,e,r,n,s,i){const o=bs.get(t);if(!o){In++;return}const a=l=>{l&&l.trigger()};if(go(),e==="clear")o.forEach(a);else{const l=F(t),c=l&&Bs(r);if(l&&r==="length"){const u=Number(n);o.forEach((h,d)=>{(d==="length"||d===jn||!ct(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(jn)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Sr)),zr(t)&&a(o.get(Pi)));break;case"delete":l||(a(o.get(Sr)),zr(t)&&a(o.get(Pi)));break;case"set":zr(t)&&a(o.get(Sr));break}}mo()}function wh(t,e){const r=bs.get(t);return r&&r.get(e)}function Or(t){const e=re(t);return e===t?e:(De(e,"iterate",jn),st(t)?e:e.map(pt))}function Vs(t){return De(t=re(t),"iterate",jn),t}function xt(t,e){return Yt(t)?Yr(zt(t)?pt(e):e):pt(e)}const kh={__proto__:null,[Symbol.iterator](){return ui(this,Symbol.iterator,t=>xt(this,t))},concat(...t){return Or(this).concat(...t.map(e=>F(e)?Or(e):e))},entries(){return ui(this,"entries",t=>(t[1]=xt(this,t[1]),t))},every(t,e){return jt(this,"every",t,e,void 0,arguments)},filter(t,e){return jt(this,"filter",t,e,r=>r.map(n=>xt(this,n)),arguments)},find(t,e){return jt(this,"find",t,e,r=>xt(this,r),arguments)},findIndex(t,e){return jt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return jt(this,"findLast",t,e,r=>xt(this,r),arguments)},findLastIndex(t,e){return jt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return jt(this,"forEach",t,e,void 0,arguments)},includes(...t){return hi(this,"includes",t)},indexOf(...t){return hi(this,"indexOf",t)},join(t){return Or(this).join(t)},lastIndexOf(...t){return hi(this,"lastIndexOf",t)},map(t,e){return jt(this,"map",t,e,void 0,arguments)},pop(){return ln(this,"pop")},push(...t){return ln(this,"push",t)},reduce(t,...e){return Jo(this,"reduce",t,e)},reduceRight(t,...e){return Jo(this,"reduceRight",t,e)},shift(){return ln(this,"shift")},some(t,e){return jt(this,"some",t,e,void 0,arguments)},splice(...t){return ln(this,"splice",t)},toReversed(){return Or(this).toReversed()},toSorted(t){return Or(this).toSorted(t)},toSpliced(...t){return Or(this).toSpliced(...t)},unshift(...t){return ln(this,"unshift",t)},values(){return ui(this,"values",t=>xt(this,t))}};function ui(t,e,r){const n=Vs(t),s=n[e]();return n!==t&&!st(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=r(i.value)),i}),s}const Sh=Array.prototype;function jt(t,e,r,n,s,i){const o=Vs(t),a=o!==t&&!st(t),l=o[e];if(l!==Sh[e]){const h=l.apply(t,i);return a?pt(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,xt(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 Jo(t,e,r,n){const s=Vs(t),i=s!==t&&!st(t);let o=r,a=!1;s!==t&&(i?(a=n.length===0,o=function(c,u,h){return a&&(a=!1,c=xt(t,c)),r.call(this,c,xt(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?xt(t,l):l}function hi(t,e,r){const n=re(t);De(n,"iterate",jn);const s=n[e](...r);return(s===-1||s===!1)&&zs(r[0])?(r[0]=re(r[0]),n[e](...r)):s}function ln(t,e,r=[]){Gt(),go();const n=re(t)[e].apply(t,r);return mo(),Jt(),n}const Eh=uo("__proto__,__v_isRef,__isVue"),nc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(ct));function Th(t){ct(t)||(t=String(t));const e=re(this);return De(e,"has",t),e.hasOwnProperty(t)}class sc{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?Nh:lc:i?ac:oc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=F(e);if(!s){let l;if(o&&(l=kh[r]))return l;if(r==="hasOwnProperty")return Th}const a=Reflect.get(e,r,Se(e)?e:n);if((ct(r)?nc.has(r):Eh(r))||(s||De(e,"get",r),i))return a;if(Se(a)){const l=o&&Bs(r)?a:a.value;return s&&le(l)?ji(l):l}return le(a)?s?ji(a):Gn(a):a}}class ic extends sc{constructor(e=!1){super(!1,e)}set(e,r,n,s){let i=e[r];const o=F(e)&&Bs(r);if(!this._isShallow){const c=Yt(i);if(!st(n)&&!Yt(n)&&(i=re(i),n=re(n)),!o&&Se(i)&&!Se(n))return c||(i.value=n),!0}const a=o?Number(r)<e.length:oe(e,r),l=Reflect.set(e,r,n,Se(e)?e:s);return e===re(s)&&(a?Ot(n,i)&&Ht(e,"set",r,n):Ht(e,"add",r,n)),l}deleteProperty(e,r){const n=oe(e,r);e[r];const s=Reflect.deleteProperty(e,r);return s&&n&&Ht(e,"delete",r,void 0),s}has(e,r){const n=Reflect.has(e,r);return(!ct(r)||!nc.has(r))&&De(e,"has",r),n}ownKeys(e){return De(e,"iterate",F(e)?"length":Sr),Reflect.ownKeys(e)}}class Ah extends sc{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const xh=new ic,Rh=new Ah,Ch=new ic(!0);const Ii=t=>t,es=t=>Reflect.getPrototypeOf(t);function Oh(t,e,r){return function(...n){const s=this.__v_raw,i=re(s),o=zr(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=s[t](...n),u=r?Ii:e?Yr:pt;return!e&&De(i,"iterate",l?Pi:Sr),Pe(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 ts(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Ph(t,e){const r={get(s){const i=this.__v_raw,o=re(i),a=re(s);t||(Ot(s,a)&&De(o,"get",s),De(o,"get",a));const{has:l}=es(o),c=e?Ii:t?Yr:pt;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&&De(re(s),"iterate",Sr),s.size},has(s){const i=this.__v_raw,o=re(i),a=re(s);return t||(Ot(s,a)&&De(o,"has",s),De(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=re(a),c=e?Ii:t?Yr:pt;return!t&&De(l,"iterate",Sr),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Pe(r,t?{add:ts("add"),set:ts("set"),delete:ts("delete"),clear:ts("clear")}:{add(s){const i=re(this),o=es(i),a=re(s),l=!e&&!st(s)&&!Yt(s)?a:s;return o.has.call(i,l)||Ot(s,l)&&o.has.call(i,s)||Ot(a,l)&&o.has.call(i,a)||(i.add(l),Ht(i,"add",l,l)),this},set(s,i){!e&&!st(i)&&!Yt(i)&&(i=re(i));const o=re(this),{has:a,get:l}=es(o);let c=a.call(o,s);c||(s=re(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Ot(i,u)&&Ht(o,"set",s,i):Ht(o,"add",s,i),this},delete(s){const i=re(this),{has:o,get:a}=es(i);let l=o.call(i,s);l||(s=re(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Ht(i,"delete",s,void 0),c},clear(){const s=re(this),i=s.size!==0,o=s.clear();return i&&Ht(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{r[s]=Oh(s,t,e)}),r}function bo(t,e){const r=Ph(t,e);return(n,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?n:Reflect.get(oe(r,s)&&s in n?r:n,s,i)}const Ih={get:bo(!1,!1)},jh={get:bo(!1,!0)},$h={get:bo(!0,!1)};const oc=new WeakMap,ac=new WeakMap,lc=new WeakMap,Nh=new WeakMap;function Lh(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Dh(t){return t.__v_skip||!Object.isExtensible(t)?0:Lh(ah(t))}function Gn(t){return Yt(t)?t:_o(t,!1,xh,Ih,oc)}function cc(t){return _o(t,!1,Ch,jh,ac)}function ji(t){return _o(t,!0,Rh,$h,lc)}function _o(t,e,r,n,s){if(!le(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Dh(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 zt(t){return Yt(t)?zt(t.__v_raw):!!(t&&t.__v_isReactive)}function Yt(t){return!!(t&&t.__v_isReadonly)}function st(t){return!!(t&&t.__v_isShallow)}function zs(t){return t?!!t.__v_raw:!1}function re(t){const e=t&&t.__v_raw;return e?re(e):t}function wo(t){return!oe(t,"__v_skip")&&Object.isExtensible(t)&&ql(t,"__v_skip",!0),t}const pt=t=>le(t)?Gn(t):t,Yr=t=>le(t)?ji(t):t;function Se(t){return t?t.__v_isRef===!0:!1}function tt(t){return uc(t,!1)}function Uh(t){return uc(t,!0)}function uc(t,e){return Se(t)?t:new Bh(t,e)}class Bh{constructor(e,r){this.dep=new vo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:re(e),this._value=r?e:pt(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||st(e)||Yt(e);e=n?e:re(e),Ot(e,r)&&(this._rawValue=e,this._value=n?e:pt(e),this.dep.trigger())}}function be(t){return Se(t)?t.value:t}const Mh={get:(t,e,r)=>e==="__v_raw"?t:be(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const s=t[e];return Se(s)&&!Se(r)?(s.value=r,!0):Reflect.set(t,e,r,n)}};function hc(t){return zt(t)?t:new Proxy(t,Mh)}function Hh(t){const e=F(t)?new Array(t.length):{};for(const r in t)e[r]=Fh(t,r);return e}class qh{constructor(e,r,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ct(r)?r:String(r),this._raw=re(e);let s=!0,i=e;if(!F(e)||ct(this._key)||!Bs(this._key))do s=!zs(i)||st(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=be(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Se(this._raw[this._key])){const r=this._object[this._key];if(Se(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return wh(this._raw,this._key)}}function Fh(t,e,r){return new qh(t,e,r)}class Vh{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new vo(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=In-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&ve!==this)return Ql(this,!0),!0}get value(){const e=this.dep.track();return ec(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function zh(t,e,r=!1){let n,s;return Y(t)?n=t:(n=t.get,s=t.set),new Vh(n,s,r)}const rs={},_s=new WeakMap;let vr;function Wh(t,e=!1,r=vr){if(r){let n=_s.get(r);n||_s.set(r,n=[]),n.push(t)}}function Kh(t,e,r=ge){const{immediate:n,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=r,c=x=>s?x:st(x)||s===!1||s===0?qt(x,1):qt(x);let u,h,d,f,p=!1,y=!1;if(Se(t)?(h=()=>t.value,p=st(t)):zt(t)?(h=()=>c(t),p=!0):F(t)?(y=!0,p=t.some(x=>zt(x)||st(x)),h=()=>t.map(x=>{if(Se(x))return x.value;if(zt(x))return c(x);if(Y(x))return l?l(x,2):x()})):Y(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Gt();try{d()}finally{Jt()}}const x=vr;vr=u;try{return l?l(t,3,[f]):t(f)}finally{vr=x}}:h=Pt,e&&s){const x=h,D=s===!0?1/0:s;h=()=>qt(x(),D)}const k=Gl(),w=()=>{u.stop(),k&&k.active&&ho(k.effects,u)};if(i&&e){const x=e;e=(...D)=>{x(...D),w()}}let b=y?new Array(t.length).fill(rs):rs;const _=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(e){const D=u.run();if(s||p||(y?D.some((M,H)=>Ot(M,b[H])):Ot(D,b))){d&&d();const M=vr;vr=u;try{const H=[D,b===rs?void 0:y&&b[0]===rs?[]:b,f];b=D,l?l(e,3,H):e(...H)}finally{vr=M}}}else u.run()};return a&&a(_),u=new Jl(h),u.scheduler=o?()=>o(_,!1):_,f=x=>Wh(x,!1,u),d=u.onStop=()=>{const x=_s.get(u);if(x){if(l)l(x,4);else for(const D of x)D();_s.delete(u)}},e?n?_(!0):b=u.run():o?o(_.bind(null,!0),!0):u.run(),w.pause=u.pause.bind(u),w.resume=u.resume.bind(u),w.stop=w,w}function qt(t,e=1/0,r){if(e<=0||!le(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,Se(t))qt(t.value,e,r);else if(F(t))for(let n=0;n<t.length;n++)qt(t[n],e,r);else if(nn(t)||zr(t))t.forEach(n=>{qt(n,e,r)});else if(Hl(t)){for(const n in t)qt(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&qt(t[n],e,r)}return t}/**
|
|
11
11
|
* @vue/runtime-core v3.5.34
|
|
12
12
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
13
|
* @license MIT
|
|
14
|
-
**/function Gn(t,e,r,n){try{return n?t(...n):t()}catch(s){Ws(s,e,r)}}function gt(t,e,r,n){if(Y(t)){const s=Gn(t,e,r,n);return s&&Bl(s)&&s.catch(i=>{Ws(i,e,r)}),s}if(F(t)){const s=[];for(let i=0;i<t.length;i++)s.push(gt(t[i],e,r,n));return s}}function Ws(t,e,r,n=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||pe;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){Gt(),Gn(i,null,10,[t,l,c]),Jt();return}}Gh(t,r,s,n,o)}function Gh(t,e,r,n=!0,s=!1){if(s)throw t;console.error(t)}const Fe=[];let Et=-1;const Wr=[];let nr=null,Dr=0;const dc=Promise.resolve();let ws=null;function Yr(t){const e=ws||dc;return t?e.then(this?t.bind(this):t):e}function Jh(t){let e=Et+1,r=Fe.length;for(;e<r;){const n=e+r>>>1,s=Fe[n],i=jn(s);i<t||i===t&&s.flags&2?e=n+1:r=n}return e}function ko(t){if(!(t.flags&1)){const e=jn(t),r=Fe[Fe.length-1];!r||!(t.flags&2)&&e>=jn(r)?Fe.push(t):Fe.splice(Jh(e),0,t),t.flags|=1,fc()}}function fc(){ws||(ws=dc.then(gc))}function Yh(t){F(t)?Wr.push(...t):nr&&t.id===-1?nr.splice(Dr+1,0,t):t.flags&1||(Wr.push(t),t.flags|=1),fc()}function Yo(t,e,r=Et+1){for(;r<Fe.length;r++){const n=Fe[r];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Fe.splice(r,1),r--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function pc(t){if(Wr.length){const e=[...new Set(Wr)].sort((r,n)=>jn(r)-jn(n));if(Wr.length=0,nr){nr.push(...e);return}for(nr=e,Dr=0;Dr<nr.length;Dr++){const r=nr[Dr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}nr=null,Dr=0}}const jn=t=>t.id==null?t.flags&2?-1:1/0:t.id;function gc(t){try{for(Et=0;Et<Fe.length;Et++){const e=Fe[Et];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Gn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Et<Fe.length;Et++){const e=Fe[Et];e&&(e.flags&=-2)}Et=-1,Fe.length=0,pc(),ws=null,(Fe.length||Wr.length)&&gc()}}let tt=null,mc=null;function ks(t){const e=tt;return tt=t,mc=t&&t.type.__scopeId||null,e}function Kr(t,e=tt,r){if(!e||t._n)return t;const n=(...s)=>{n._d&&Ts(-1);const i=ks(e);let o;try{o=t(...s)}finally{ks(i),n._d&&Ts(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function Qh(t,e){if(tt===null)return t;const r=Qs(tt),n=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,a,l=pe]=e[s];i&&(Y(i)&&(i={mounted:i,updated:i}),i.deep&&qt(o),n.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function dr(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&&(Gt(),gt(l,r,8,[t.el,a,t,e]),Jt())}}function gs(t,e){if(De){let r=De.provides;const n=De.parent&&De.parent.provides;n===r&&(r=De.provides=Object.create(n)),r[t]=e}}function lt(t,e,r=!1){const n=xo();if(n||Tr){let s=Tr?Tr._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&&Y(e)?e.call(n&&n.proxy):e}}function Zh(){return!!(xo()||Tr)}const Xh=Symbol.for("v-scx"),ed=()=>lt(Xh);function Er(t,e,r){return yc(t,e,r)}function yc(t,e,r=pe){const{immediate:n,deep:s,flush:i,once:o}=r,a=Pe({},r),l=e&&n||!e&&i!=="post";let c;if(Ln){if(i==="sync"){const f=ed();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Pt,f.resume=Pt,f.pause=Pt,f}}const u=De;a.call=(f,p,y)=>gt(f,u,p,y);let h=!1;i==="post"?a.scheduler=f=>{Je(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():ko(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=Kh(t,e,a);return Ln&&(c?c.push(d):l&&d()),d}function td(t,e,r){const n=this.proxy,s=be(t)?t.includes(".")?vc(n,t):()=>n[t]:t.bind(n,n);let i;Y(e)?i=e:(i=e.handler,r=e);const o=Jn(this),a=yc(s,i.bind(n),r);return o(),a}function vc(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 rd=Symbol("_vte"),bc=t=>t.__isTeleport,Tt=Symbol("_leaveCb"),ln=Symbol("_enterCb");function nd(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return xc(()=>{t.isMounted=!0}),Rc(()=>{t.isUnmounting=!0}),t}const it=[Function,Array],_c={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:it,onEnter:it,onAfterEnter:it,onEnterCancelled:it,onBeforeLeave:it,onLeave:it,onAfterLeave:it,onLeaveCancelled:it,onBeforeAppear:it,onAppear:it,onAfterAppear:it,onAppearCancelled:it},wc=t=>{const e=t.subTree;return e.component?wc(e.component):e},sd={name:"BaseTransition",props:_c,setup(t,{slots:e}){const r=xo(),n=nd();return()=>{const s=e.default&&Ec(e.default(),!0),i=s&&s.length?kc(s):r.subTree?Qe():void 0;if(!i)return;const o=te(t),{mode:a}=o;if(n.isLeaving)return di(i);const l=Qo(i);if(!l)return di(i);let c=$i(l,o,n,r,h=>c=h);l.type!==Ve&&$n(l,c);let u=r.subTree&&Qo(r.subTree);if(u&&u.type!==Ve&&!_r(u,l)&&wc(r).type!==Ve){let h=$i(u,o,n,r);if($n(u,h),a==="out-in"&&l.type!==Ve)return n.isLeaving=!0,h.afterLeave=()=>{n.isLeaving=!1,r.job.flags&8||r.update(),delete h.afterLeave,u=void 0},di(i);a==="in-out"&&l.type!==Ve?h.delayLeave=(d,f,p)=>{const y=Sc(n,u);y[String(u.key)]=u,d[Tt]=()=>{f(),d[Tt]=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 kc(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==Ve){e=r;break}}return e}const id=sd;function Sc(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 $i(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:k,onAppear:w,onAfterAppear:b,onAppearCancelled:_}=e,x=String(t.key),D=Sc(r,t),M=(C,q)=>{C&>(C,n,9,q)},H=(C,q)=>{const Q=q[1];M(C,q),F(C)?C.every(j=>j.length<=1)&&Q():C.length<=1&&Q()},W={mode:o,persisted:a,beforeEnter(C){let q=l;if(!r.isMounted)if(i)q=k||l;else return;C[Tt]&&C[Tt](!0);const Q=D[x];Q&&_r(t,Q)&&Q.el[Tt]&&Q.el[Tt](),M(q,[C])},enter(C){if(D[x]===t)return;let q=c,Q=u,j=h;if(!r.isMounted)if(i)q=w||c,Q=b||u,j=_||h;else return;let X=!1;C[ln]=Be=>{X||(X=!0,Be?M(j,[C]):M(Q,[C]),W.delayedLeave&&W.delayedLeave(),C[ln]=void 0)};const Ae=C[ln].bind(null,!1);q?H(q,[C,Ae]):Ae()},leave(C,q){const Q=String(t.key);if(C[ln]&&C[ln](!0),r.isUnmounting)return q();M(d,[C]);let j=!1;C[Tt]=Ae=>{j||(j=!0,q(),Ae?M(y,[C]):M(p,[C]),C[Tt]=void 0,D[Q]===t&&delete D[Q])};const X=C[Tt].bind(null,!1);D[Q]=t,f?H(f,[C,X]):X()},clone(C){const q=$i(C,e,r,n,s);return s&&s(q),q}};return W}function di(t){if(Ks(t))return t=lr(t),t.children=null,t}function Qo(t){if(!Ks(t))return bc(t.type)&&t.children?kc(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&&Y(r.default))return r.default()}}function $n(t,e){t.shapeFlag&6&&t.component?(t.transition=e,$n(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 Ec(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===Ye?(o.patchFlag&128&&s++,n=n.concat(Ec(o.children,e,a))):(e||o.type!==Ve)&&n.push(a!=null?lr(o,{key:a}):o)}if(s>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function ur(t,e){return Y(t)?Pe({name:t.name},e,{setup:t}):t}function Tc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Zo(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Ss=new WeakMap;function wn(t,e,r,n,s=!1){if(F(t)){t.forEach((y,k)=>wn(y,e&&(F(e)?e[k]:e),r,n,s));return}if(kn(n)&&!s){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&wn(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===pe?a.refs={}:a.refs,h=a.setupState,d=te(h),f=h===pe?Ul:y=>Zo(u,y)?!1:ie(d,y),p=(y,k)=>!(k&&Zo(u,k));if(c!=null&&c!==l){if(Xo(e),be(c))u[c]=null,f(c)&&(h[c]=null);else if(Se(c)){const y=e;p(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(Y(l))Gn(l,a,12,[o,u]);else{const y=be(l),k=Se(l);if(y||k){const w=()=>{if(t.f){const b=y?f(l)?h[l]:u[l]:p()||!t.k?l.value:u[t.k];if(s)F(b)&&ho(b,i);else if(F(b))b.includes(i)||b.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const _=[i];p(l,t.k)&&(l.value=_),t.k&&(u[t.k]=_)}}else y?(u[l]=o,f(l)&&(h[l]=o)):k&&(p(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const b=()=>{w(),Ss.delete(t)};b.id=-1,Ss.set(t,b),Je(b,r)}else Xo(t),w()}}}function Xo(t){const e=Ss.get(t);e&&(e.flags|=8,Ss.delete(t))}Fs().requestIdleCallback;Fs().cancelIdleCallback;const kn=t=>!!t.type.__asyncLoader,Ks=t=>t.type.__isKeepAlive;function od(t,e){Ac(t,"a",e)}function ad(t,e){Ac(t,"da",e)}function Ac(t,e,r=De){const n=t.__wdc||(t.__wdc=()=>{let s=r;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Gs(e,n,r),r){let s=r.parent;for(;s&&s.parent;)Ks(s.parent.vnode)&&ld(n,e,r,s),s=s.parent}}function ld(t,e,r,n){const s=Gs(e,t,n,!0);Cc(()=>{ho(n[e],s)},r)}function Gs(t,e,r=De,n=!1){if(r){const s=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Gt();const a=Jn(r),l=gt(e,r,t,o);return a(),Jt(),l});return n?s.unshift(i):s.push(i),i}}const Qt=t=>(e,r=De)=>{(!Ln||t==="sp")&&Gs(t,(...n)=>e(...n),r)},cd=Qt("bm"),xc=Qt("m"),ud=Qt("bu"),hd=Qt("u"),Rc=Qt("bum"),Cc=Qt("um"),dd=Qt("sp"),fd=Qt("rtg"),pd=Qt("rtc");function gd(t,e=De){Gs("ec",t,e)}const Oc="components";function So(t,e){return Ic(Oc,t,!0,e)||t}const Pc=Symbol.for("v-ndc");function ea(t){return be(t)?Ic(Oc,t,!1)||t:t||Pc}function Ic(t,e,r=!0,n=!1){const s=tt||De;if(s){const i=s.type;{const a=ef(i,!1);if(a&&(a===e||a===We(e)||a===Hs(We(e))))return i}const o=ta(s[t]||i[t],e)||ta(s.appContext[t],e);return!o&&n?i:o}}function ta(t,e){return t&&(t[e]||t[We(e)]||t[Hs(We(e))])}function Ni(t,e,r,n){let s;const i=r,o=F(t);if(o||be(t)){const a=o&&zt(t);let l=!1,c=!1;a&&(l=!nt(t),c=Yt(t),t=Vs(t)),s=new Array(t.length);for(let u=0,h=t.length;u<h;u++)s[u]=e(l?c?Jr(pt(t[u])):pt(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(ae(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 Li=t=>t?Zc(t)?Qs(t):Li(t.parent):null,Sn=Pe(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=>Li(t.parent),$root:t=>Li(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>$c(t),$forceUpdate:t=>t.f||(t.f=()=>{ko(t.update)}),$nextTick:t=>t.n||(t.n=Yr.bind(t.proxy)),$watch:t=>td.bind(t)}),fi=(t,e)=>t!==pe&&!t.__isScriptSetup&&ie(t,e),md={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(fi(n,e))return o[e]=1,n[e];if(s!==pe&&ie(s,e))return o[e]=2,s[e];if(ie(i,e))return o[e]=3,i[e];if(r!==pe&&ie(r,e))return o[e]=4,r[e];Di&&(o[e]=0)}}const c=Sn[e];let u,h;if(c)return e==="$attrs"&&Le(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==pe&&ie(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,ie(h,e))return h[e]},set({_:t},e,r){const{data:n,setupState:s,ctx:i}=t;return fi(s,e)?(s[e]=r,!0):n!==pe&&ie(n,e)?(n[e]=r,!0):ie(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!==pe&&a[0]!=="$"&&ie(t,a)||fi(e,a)||ie(i,a)||ie(n,a)||ie(Sn,a)||ie(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:ie(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function ra(t){return F(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Di=!0;function yd(t){const e=$c(t),r=t.proxy,n=t.ctx;Di=!1,e.beforeCreate&&na(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:k,beforeDestroy:w,beforeUnmount:b,destroyed:_,unmounted:x,render:D,renderTracked:M,renderTriggered:H,errorCaptured:W,serverPrefetch:C,expose:q,inheritAttrs:Q,components:j,directives:X,filters:Ae}=e;if(c&&vd(c,n,null),o)for(const Z in o){const ne=o[Z];Y(ne)&&(n[Z]=ne.bind(r))}if(s){const Z=s.call(r,r);ae(Z)&&(t.data=Kn(Z))}if(Di=!0,i)for(const Z in i){const ne=i[Z],It=Y(ne)?ne.bind(r,r):Y(ne.get)?ne.get.bind(r,r):Pt,Xt=!Y(ne)&&Y(ne.set)?ne.set.bind(r):Pt,yt=Ue({get:It,set:Xt});Object.defineProperty(n,Z,{enumerable:!0,configurable:!0,get:()=>yt.value,set:Ke=>yt.value=Ke})}if(a)for(const Z in a)jc(a[Z],n,r,Z);if(l){const Z=Y(l)?l.call(r):l;Reflect.ownKeys(Z).forEach(ne=>{gs(ne,Z[ne])})}u&&na(u,t,"c");function he(Z,ne){F(ne)?ne.forEach(It=>Z(It.bind(r))):ne&&Z(ne.bind(r))}if(he(cd,h),he(xc,d),he(ud,f),he(hd,p),he(od,y),he(ad,k),he(gd,W),he(pd,M),he(fd,H),he(Rc,b),he(Cc,x),he(dd,C),F(q))if(q.length){const Z=t.exposed||(t.exposed={});q.forEach(ne=>{Object.defineProperty(Z,ne,{get:()=>r[ne],set:It=>r[ne]=It,enumerable:!0})})}else t.exposed||(t.exposed={});D&&t.render===Pt&&(t.render=D),Q!=null&&(t.inheritAttrs=Q),j&&(t.components=j),X&&(t.directives=X),C&&Tc(t)}function vd(t,e,r=Pt){F(t)&&(t=Ui(t));for(const n in t){const s=t[n];let i;ae(s)?"default"in s?i=lt(s.from||n,s.default,!0):i=lt(s.from||n):i=lt(s),Se(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[n]=i}}function na(t,e,r){gt(F(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function jc(t,e,r,n){let s=n.includes(".")?vc(r,n):()=>r[n];if(be(t)){const i=e[t];Y(i)&&Er(s,i)}else if(Y(t))Er(s,t.bind(r));else if(ae(t))if(F(t))t.forEach(i=>jc(i,e,r,n));else{const i=Y(t.handler)?t.handler.bind(r):e[t.handler];Y(i)&&Er(s,i,t)}}function $c(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=>Es(l,c,o,!0)),Es(l,e,o)),ae(e)&&i.set(e,l),l}function Es(t,e,r,n=!1){const{mixins:s,extends:i}=e;i&&Es(t,i,r,!0),s&&s.forEach(o=>Es(t,o,r,!0));for(const o in e)if(!(n&&o==="expose")){const a=bd[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const bd={data:sa,props:ia,emits:ia,methods:pn,computed:pn,beforeCreate:He,created:He,beforeMount:He,mounted:He,beforeUpdate:He,updated:He,beforeDestroy:He,beforeUnmount:He,destroyed:He,unmounted:He,activated:He,deactivated:He,errorCaptured:He,serverPrefetch:He,components:pn,directives:pn,watch:wd,provide:sa,inject:_d};function sa(t,e){return e?t?function(){return Pe(Y(t)?t.call(this,this):t,Y(e)?e.call(this,this):e)}:e:t}function _d(t,e){return pn(Ui(t),Ui(e))}function Ui(t){if(F(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function He(t,e){return t?[...new Set([].concat(t,e))]:e}function pn(t,e){return t?Pe(Object.create(null),t,e):e}function ia(t,e){return t?F(t)&&F(e)?[...new Set([...t,...e])]:Pe(Object.create(null),ra(t),ra(e??{})):e}function wd(t,e){if(!t)return e;if(!e)return t;const r=Pe(Object.create(null),t);for(const n in e)r[n]=He(t[n],e[n]);return r}function Nc(){return{app:null,config:{isNativeTag:Ul,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 kd=0;function Sd(t,e){return function(n,s=null){Y(n)||(n=Pe({},n)),s!=null&&!ae(s)&&(s=null);const i=Nc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:kd++,_component:n,_props:s,_container:null,_context:i,_instance:null,version:rf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&Y(u.install)?(o.add(u),u.install(c,...h)):Y(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||ue(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&&(gt(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=Tr;Tr=c;try{return u()}finally{Tr=h}}};return c}}let Tr=null;const Ed=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${We(e)}Modifiers`]||t[`${cr(e)}Modifiers`];function Td(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||pe;let s=r;const i=e.startsWith("update:"),o=i&&Ed(n,e.slice(7));o&&(o.trim&&(s=r.map(u=>be(u)?u.trim():u)),o.number&&(s=r.map(qs)));let a,l=n[a=ai(e)]||n[a=ai(We(e))];!l&&i&&(l=n[a=ai(cr(e))]),l&>(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,gt(c,t,6,s)}}const Ad=new WeakMap;function Lc(t,e,r=!1){const n=r?Ad:e.emitsCache,s=n.get(t);if(s!==void 0)return s;const i=t.emits;let o={},a=!1;if(!Y(t)){const l=c=>{const u=Lc(c,e,!0);u&&(a=!0,Pe(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(ae(t)&&n.set(t,null),null):(F(i)?i.forEach(l=>o[l]=null):Pe(o,i),ae(t)&&n.set(t,o),o)}function Js(t,e){return!t||!Ds(e)?!1:(e=e.slice(2).replace(/Once$/,""),ie(t,e[0].toLowerCase()+e.slice(1))||ie(t,cr(e))||ie(t,e))}function oa(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,k=ks(t);let w,b;try{if(r.shapeFlag&4){const x=s||n,D=x;w=Rt(c.call(D,x,u,h,f,d,p)),b=a}else{const x=e;w=Rt(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),b=e.props?a:xd(a)}}catch(x){En.length=0,Ws(x,t,1),w=ue(Ve)}let _=w;if(b&&y!==!1){const x=Object.keys(b),{shapeFlag:D}=_;x.length&&D&7&&(i&&x.some(Us)&&(b=Rd(b,i)),_=lr(_,b,!1,!0))}return r.dirs&&(_=lr(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(r.dirs):r.dirs),r.transition&&$n(_,r.transition),w=_,ks(k),w}const xd=t=>{let e;for(const r in t)(r==="class"||r==="style"||Ds(r))&&((e||(e={}))[r]=t[r]);return e},Rd=(t,e)=>{const r={};for(const n in t)(!Us(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function Cd(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?aa(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Dc(o,n,d)&&!Js(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?aa(n,o,c):!0:!!o;return!1}function aa(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(Dc(e,t,i)&&!Js(r,i))return!0}return!1}function Dc(t,e,r){const n=t[r],s=e[r];return r==="style"&&ae(n)&&ae(s)?!nn(n,s):n!==s}function Od({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 Uc={},Bc=()=>Object.create(Uc),Mc=t=>Object.getPrototypeOf(t)===Uc;function Pd(t,e,r,n=!1){const s={},i=Bc();t.propsDefaults=Object.create(null),Hc(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);r?t.props=n?s:cc(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Id(t,e,r,n){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,a=te(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(Js(t.emitsOptions,d))continue;const f=e[d];if(l)if(ie(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=We(d);s[p]=Bi(l,a,p,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Hc(t,e,s,i)&&(c=!0);let u;for(const h in a)(!e||!ie(e,h)&&((u=cr(h))===h||!ie(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(s[h]=Bi(l,a,h,void 0,t,!0)):delete s[h]);if(i!==a)for(const h in i)(!e||!ie(e,h))&&(delete i[h],c=!0)}c&&Ht(t.attrs,"set","")}function Hc(t,e,r,n){const[s,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(vn(l))continue;const c=e[l];let u;s&&ie(s,u=We(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Js(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(i){const l=te(r),c=a||pe;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Bi(s,l,h,c[h],t,!ie(c,h))}}return o}function Bi(t,e,r,n,s,i){const o=t[r];if(o!=null){const a=ie(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Y(l)){const{propsDefaults:c}=s;if(r in c)n=c[r];else{const u=Jn(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===cr(r))&&(n=!0))}return n}const jd=new WeakMap;function qc(t,e,r=!1){const n=r?jd:e.propsCache,s=n.get(t);if(s)return s;const i=t.props,o={},a=[];let l=!1;if(!Y(t)){const u=h=>{l=!0;const[d,f]=qc(h,e,!0);Pe(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 ae(t)&&n.set(t,Vr),Vr;if(F(i))for(let u=0;u<i.length;u++){const h=We(i[u]);la(h)&&(o[h]=pe)}else if(i)for(const u in i){const h=We(u);if(la(h)){const d=i[u],f=o[h]=F(d)||Y(d)?{type:d}:Pe({},d),p=f.type;let y=!1,k=!0;if(F(p))for(let w=0;w<p.length;++w){const b=p[w],_=Y(b)&&b.name;if(_==="Boolean"){y=!0;break}else _==="String"&&(k=!1)}else y=Y(p)&&p.name==="Boolean";f[0]=y,f[1]=k,(y||ie(f,"default"))&&a.push(h)}}const c=[o,a];return ae(t)&&n.set(t,c),c}function la(t){return t[0]!=="$"&&!vn(t)}const Eo=t=>t==="_"||t==="_ctx"||t==="$stable",To=t=>F(t)?t.map(Rt):[Rt(t)],$d=(t,e,r)=>{if(e._n)return e;const n=Kr((...s)=>To(e(...s)),r);return n._c=!1,n},Fc=(t,e,r)=>{const n=t._ctx;for(const s in t){if(Eo(s))continue;const i=t[s];if(Y(i))e[s]=$d(s,i,n);else if(i!=null){const o=To(i);e[s]=()=>o}}},Vc=(t,e)=>{const r=To(e);t.slots.default=()=>r},zc=(t,e,r)=>{for(const n in e)(r||!Eo(n))&&(t[n]=e[n])},Nd=(t,e,r)=>{const n=t.slots=Bc();if(t.vnode.shapeFlag&32){const s=e._;s?(zc(n,e,r),r&&ql(n,"_",s,!0)):Fc(e,n)}else e&&Vc(t,e)},Ld=(t,e,r)=>{const{vnode:n,slots:s}=t;let i=!0,o=pe;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:zc(s,e,r):(i=!e.$stable,Fc(e,s)),o=e}else e&&(Vc(t,e),o={default:1});if(i)for(const a in s)!Eo(a)&&o[a]==null&&delete s[a]},Je=Hd;function Dd(t){return Ud(t)}function Ud(t,e){const r=Fs();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=Pt,insertStaticContent:p}=t,y=(g,m,v,S=null,A=null,E=null,$=void 0,P=null,O=!!m.dynamicChildren)=>{if(g===m)return;g&&!_r(g,m)&&(S=T(g),Ke(g,A,E,!0),g=null),m.patchFlag===-2&&(O=!1,m.dynamicChildren=null);const{type:R,ref:K,shapeFlag:L}=m;switch(R){case Ys:k(g,m,v,S);break;case Ve:w(g,m,v,S);break;case gi:g==null&&b(m,v,S,$);break;case Ye:j(g,m,v,S,A,E,$,P,O);break;default:L&1?D(g,m,v,S,A,E,$,P,O):L&6?X(g,m,v,S,A,E,$,P,O):(L&64||L&128)&&R.process(g,m,v,S,A,E,$,P,O,V)}K!=null&&A?wn(K,g&&g.ref,E,m||g,!m):K==null&&g&&g.ref!=null&&wn(g.ref,null,E,g,!0)},k=(g,m,v,S)=>{if(g==null)n(m.el=a(m.children),v,S);else{const A=m.el=g.el;m.children!==g.children&&c(A,m.children)}},w=(g,m,v,S)=>{g==null?n(m.el=l(m.children||""),v,S):m.el=g.el},b=(g,m,v,S)=>{[g.el,g.anchor]=p(g.children,m,v,S,g.el,g.anchor)},_=({el:g,anchor:m},v,S)=>{let A;for(;g&&g!==m;)A=d(g),n(g,v,S),g=A;n(m,v,S)},x=({el:g,anchor:m})=>{let v;for(;g&&g!==m;)v=d(g),s(g),g=v;s(m)},D=(g,m,v,S,A,E,$,P,O)=>{if(m.type==="svg"?$="svg":m.type==="math"&&($="mathml"),g==null)M(m,v,S,A,E,$,P,O);else{const R=g.el&&g.el._isVueCE?g.el:null;try{R&&R._beginPatch(),C(g,m,A,E,$,P,O)}finally{R&&R._endPatch()}}},M=(g,m,v,S,A,E,$,P)=>{let O,R;const{props:K,shapeFlag:L,transition:z,dirs:J}=g;if(O=g.el=o(g.type,E,K&&K.is,K),L&8?u(O,g.children):L&16&&W(g.children,O,null,S,A,pi(g,E),$,P),J&&dr(g,null,S,"created"),H(O,g,g.scopeId,$,S),K){for(const de in K)de!=="value"&&!vn(de)&&i(O,de,null,K[de],E,S);"value"in K&&i(O,"value",null,K.value,E),(R=K.onVnodeBeforeMount)&&wt(R,S,g)}J&&dr(g,null,S,"beforeMount");const re=Bd(A,z);re&&z.beforeEnter(O),n(O,m,v),((R=K&&K.onVnodeMounted)||re||J)&&Je(()=>{try{R&&wt(R,S,g),re&&z.enter(O),J&&dr(g,null,S,"mounted")}finally{}},A)},H=(g,m,v,S,A)=>{if(v&&f(g,v),S)for(let E=0;E<S.length;E++)f(g,S[E]);if(A){let E=A.subTree;if(m===E||Jc(E.type)&&(E.ssContent===m||E.ssFallback===m)){const $=A.vnode;H(g,$,$.scopeId,$.slotScopeIds,A.parent)}}},W=(g,m,v,S,A,E,$,P,O=0)=>{for(let R=O;R<g.length;R++){const K=g[R]=P?Mt(g[R]):Rt(g[R]);y(null,K,m,v,S,A,E,$,P)}},C=(g,m,v,S,A,E,$)=>{const P=m.el=g.el;let{patchFlag:O,dynamicChildren:R,dirs:K}=m;O|=g.patchFlag&16;const L=g.props||pe,z=m.props||pe;let J;if(v&&fr(v,!1),(J=z.onVnodeBeforeUpdate)&&wt(J,v,m,g),K&&dr(m,g,v,"beforeUpdate"),v&&fr(v,!0),(L.innerHTML&&z.innerHTML==null||L.textContent&&z.textContent==null)&&u(P,""),R?q(g.dynamicChildren,R,P,v,S,pi(m,A),E):$||ne(g,m,P,null,v,S,pi(m,A),E,!1),O>0){if(O&16)Q(P,L,z,v,A);else if(O&2&&L.class!==z.class&&i(P,"class",null,z.class,A),O&4&&i(P,"style",L.style,z.style,A),O&8){const re=m.dynamicProps;for(let de=0;de<re.length;de++){const ge=re[de],xe=L[ge],je=z[ge];(je!==xe||ge==="value")&&i(P,ge,xe,je,A,v)}}O&1&&g.children!==m.children&&u(P,m.children)}else!$&&R==null&&Q(P,L,z,v,A);((J=z.onVnodeUpdated)||K)&&Je(()=>{J&&wt(J,v,m,g),K&&dr(m,g,v,"updated")},S)},q=(g,m,v,S,A,E,$)=>{for(let P=0;P<m.length;P++){const O=g[P],R=m[P],K=O.el&&(O.type===Ye||!_r(O,R)||O.shapeFlag&198)?h(O.el):v;y(O,R,K,null,S,A,E,$,!0)}},Q=(g,m,v,S,A)=>{if(m!==v){if(m!==pe)for(const E in m)!vn(E)&&!(E in v)&&i(g,E,m[E],null,A,S);for(const E in v){if(vn(E))continue;const $=v[E],P=m[E];$!==P&&E!=="value"&&i(g,E,P,$,A,S)}"value"in v&&i(g,"value",m.value,v.value,A)}},j=(g,m,v,S,A,E,$,P,O)=>{const R=m.el=g?g.el:a(""),K=m.anchor=g?g.anchor:a("");let{patchFlag:L,dynamicChildren:z,slotScopeIds:J}=m;J&&(P=P?P.concat(J):J),g==null?(n(R,v,S),n(K,v,S),W(m.children||[],v,K,A,E,$,P,O)):L>0&&L&64&&z&&g.dynamicChildren&&g.dynamicChildren.length===z.length?(q(g.dynamicChildren,z,v,A,E,$,P),(m.key!=null||A&&m===A.subTree)&&Wc(g,m,!0)):ne(g,m,v,K,A,E,$,P,O)},X=(g,m,v,S,A,E,$,P,O)=>{m.slotScopeIds=P,g==null?m.shapeFlag&512?A.ctx.activate(m,v,S,$,O):Ae(m,v,S,A,E,$,O):Be(g,m,O)},Ae=(g,m,v,S,A,E,$)=>{const P=g.component=Jd(g,S,A);if(Ks(g)&&(P.ctx.renderer=V),Yd(P,!1,$),P.asyncDep){if(A&&A.registerDep(P,he,$),!g.el){const O=P.subTree=ue(Ve);w(null,O,m,v),g.placeholder=O.el}}else he(P,g,m,v,A,E,$)},Be=(g,m,v)=>{const S=m.component=g.component;if(Cd(g,m,v))if(S.asyncDep&&!S.asyncResolved){Z(S,m,v);return}else S.next=m,S.update();else m.el=g.el,S.vnode=m},he=(g,m,v,S,A,E,$)=>{const P=()=>{if(g.isMounted){let{next:L,bu:z,u:J,parent:re,vnode:de}=g;{const bt=Kc(g);if(bt){L&&(L.el=de.el,Z(g,L,$)),bt.asyncDep.then(()=>{Je(()=>{g.isUnmounted||R()},A)});return}}let ge=L,xe;fr(g,!1),L?(L.el=de.el,Z(g,L,$)):L=de,z&&fs(z),(xe=L.props&&L.props.onVnodeBeforeUpdate)&&wt(xe,re,L,de),fr(g,!0);const je=oa(g),vt=g.subTree;g.subTree=je,y(vt,je,h(vt.el),T(vt),g,A,E),L.el=je.el,ge===null&&Od(g,je.el),J&&Je(J,A),(xe=L.props&&L.props.onVnodeUpdated)&&Je(()=>wt(xe,re,L,de),A)}else{let L;const{el:z,props:J}=m,{bm:re,m:de,parent:ge,root:xe,type:je}=g,vt=kn(m);fr(g,!1),re&&fs(re),!vt&&(L=J&&J.onVnodeBeforeMount)&&wt(L,ge,m),fr(g,!0);{xe.ce&&xe.ce._hasShadowRoot()&&xe.ce._injectChildStyle(je,g.parent?g.parent.type:void 0);const bt=g.subTree=oa(g);y(null,bt,v,S,g,A,E),m.el=bt.el}if(de&&Je(de,A),!vt&&(L=J&&J.onVnodeMounted)){const bt=m;Je(()=>wt(L,ge,bt),A)}(m.shapeFlag&256||ge&&kn(ge.vnode)&&ge.vnode.shapeFlag&256)&&g.a&&Je(g.a,A),g.isMounted=!0,m=v=S=null}};g.scope.on();const O=g.effect=new Jl(P);g.scope.off();const R=g.update=O.run.bind(O),K=g.job=O.runIfDirty.bind(O);K.i=g,K.id=g.uid,O.scheduler=()=>ko(K),fr(g,!0),R()},Z=(g,m,v)=>{m.component=g;const S=g.vnode.props;g.vnode=m,g.next=null,Id(g,m.props,S,v),Ld(g,m.children,v),Gt(),Yo(g),Jt()},ne=(g,m,v,S,A,E,$,P,O=!1)=>{const R=g&&g.children,K=g?g.shapeFlag:0,L=m.children,{patchFlag:z,shapeFlag:J}=m;if(z>0){if(z&128){Xt(R,L,v,S,A,E,$,P,O);return}else if(z&256){It(R,L,v,S,A,E,$,P,O);return}}J&8?(K&16&&st(R,A,E),L!==R&&u(v,L)):K&16?J&16?Xt(R,L,v,S,A,E,$,P,O):st(R,A,E,!0):(K&8&&u(v,""),J&16&&W(L,v,S,A,E,$,P,O))},It=(g,m,v,S,A,E,$,P,O)=>{g=g||Vr,m=m||Vr;const R=g.length,K=m.length,L=Math.min(R,K);let z;for(z=0;z<L;z++){const J=m[z]=O?Mt(m[z]):Rt(m[z]);y(g[z],J,v,null,A,E,$,P,O)}R>K?st(g,A,E,!0,!1,L):W(m,v,S,A,E,$,P,O,L)},Xt=(g,m,v,S,A,E,$,P,O)=>{let R=0;const K=m.length;let L=g.length-1,z=K-1;for(;R<=L&&R<=z;){const J=g[R],re=m[R]=O?Mt(m[R]):Rt(m[R]);if(_r(J,re))y(J,re,v,null,A,E,$,P,O);else break;R++}for(;R<=L&&R<=z;){const J=g[L],re=m[z]=O?Mt(m[z]):Rt(m[z]);if(_r(J,re))y(J,re,v,null,A,E,$,P,O);else break;L--,z--}if(R>L){if(R<=z){const J=z+1,re=J<K?m[J].el:S;for(;R<=z;)y(null,m[R]=O?Mt(m[R]):Rt(m[R]),v,re,A,E,$,P,O),R++}}else if(R>z)for(;R<=L;)Ke(g[R],A,E,!0),R++;else{const J=R,re=R,de=new Map;for(R=re;R<=z;R++){const Ze=m[R]=O?Mt(m[R]):Rt(m[R]);Ze.key!=null&&de.set(Ze.key,R)}let ge,xe=0;const je=z-re+1;let vt=!1,bt=0;const on=new Array(je);for(R=0;R<je;R++)on[R]=0;for(R=J;R<=L;R++){const Ze=g[R];if(xe>=je){Ke(Ze,A,E,!0);continue}let _t;if(Ze.key!=null)_t=de.get(Ze.key);else for(ge=re;ge<=z;ge++)if(on[ge-re]===0&&_r(Ze,m[ge])){_t=ge;break}_t===void 0?Ke(Ze,A,E,!0):(on[_t-re]=R+1,_t>=bt?bt=_t:vt=!0,y(Ze,m[_t],v,null,A,E,$,P,O),xe++)}const qo=vt?Md(on):Vr;for(ge=qo.length-1,R=je-1;R>=0;R--){const Ze=re+R,_t=m[Ze],Fo=m[Ze+1],Vo=Ze+1<K?Fo.el||Gc(Fo):S;on[R]===0?y(null,_t,v,Vo,A,E,$,P,O):vt&&(ge<0||R!==qo[ge]?yt(_t,v,Vo,2):ge--)}}},yt=(g,m,v,S,A=null)=>{const{el:E,type:$,transition:P,children:O,shapeFlag:R}=g;if(R&6){yt(g.component.subTree,m,v,S);return}if(R&128){g.suspense.move(m,v,S);return}if(R&64){$.move(g,m,v,V);return}if($===Ye){n(E,m,v);for(let L=0;L<O.length;L++)yt(O[L],m,v,S);n(g.anchor,m,v);return}if($===gi){_(g,m,v);return}if(S!==2&&R&1&&P)if(S===0)P.beforeEnter(E),n(E,m,v),Je(()=>P.enter(E),A);else{const{leave:L,delayLeave:z,afterLeave:J}=P,re=()=>{g.ctx.isUnmounted?s(E):n(E,m,v)},de=()=>{E._isLeaving&&E[Tt](!0),L(E,()=>{re(),J&&J()})};z?z(E,re,de):de()}else n(E,m,v)},Ke=(g,m,v,S=!1,A=!1)=>{const{type:E,props:$,ref:P,children:O,dynamicChildren:R,shapeFlag:K,patchFlag:L,dirs:z,cacheIndex:J,memo:re}=g;if(L===-2&&(A=!1),P!=null&&(Gt(),wn(P,null,v,g,!0),Jt()),J!=null&&(m.renderCache[J]=void 0),K&256){m.ctx.deactivate(g);return}const de=K&1&&z,ge=!kn(g);let xe;if(ge&&(xe=$&&$.onVnodeBeforeUnmount)&&wt(xe,m,g),K&6)hr(g.component,v,S);else{if(K&128){g.suspense.unmount(v,S);return}de&&dr(g,null,m,"beforeUnmount"),K&64?g.type.remove(g,m,v,V,S):R&&!R.hasOnce&&(E!==Ye||L>0&&L&64)?st(R,m,v,!1,!0):(E===Ye&&L&384||!A&&K&16)&&st(O,m,v),S&&Rr(g)}const je=re!=null&&J==null;(ge&&(xe=$&&$.onVnodeUnmounted)||de||je)&&Je(()=>{xe&&wt(xe,m,g),de&&dr(g,null,m,"unmounted"),je&&(g.el=null)},v)},Rr=g=>{const{type:m,el:v,anchor:S,transition:A}=g;if(m===Ye){Cr(v,S);return}if(m===gi){x(g);return}const E=()=>{s(v),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(g.shapeFlag&1&&A&&!A.persisted){const{leave:$,delayLeave:P}=A,O=()=>$(v,E);P?P(g.el,E,O):O()}else E()},Cr=(g,m)=>{let v;for(;g!==m;)v=d(g),s(g),g=v;s(m)},hr=(g,m,v)=>{const{bum:S,scope:A,job:E,subTree:$,um:P,m:O,a:R}=g;ca(O),ca(R),S&&fs(S),A.stop(),E&&(E.flags|=8,Ke($,g,m,v)),P&&Je(P,m),Je(()=>{g.isUnmounted=!0},m)},st=(g,m,v,S=!1,A=!1,E=0)=>{for(let $=E;$<g.length;$++)Ke(g[$],m,v,S,A)},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[rd];return v?d(v):m};let U=!1;const N=(g,m,v)=>{let S;g==null?m._vnode&&(Ke(m._vnode,null,null,!0),S=m._vnode.component):y(m._vnode||null,g,m,null,null,null,v),m._vnode=g,U||(U=!0,Yo(S),pc(),U=!1)},V={p:y,um:Ke,m:yt,r:Rr,mt:Ae,mc:W,pc:ne,pbc:q,n:T,o:t};return{render:N,hydrate:void 0,createApp:Sd(N)}}function pi({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 fr({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Bd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Wc(t,e,r=!1){const n=t.children,s=e.children;if(F(n)&&F(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]=Mt(s[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Wc(o,a)),a.type===Ys&&(a.patchFlag===-1&&(a=s[i]=Mt(a)),a.el=o.el),a.type===Ve&&!a.el&&(a.el=o.el)}}function Md(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 Kc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Kc(e)}function ca(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Gc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Gc(e.subTree):null}const Jc=t=>t.__isSuspense;function Hd(t,e){e&&e.pendingBranch?F(t)?e.effects.push(...t):e.effects.push(t):Yh(t)}const Ye=Symbol.for("v-fgt"),Ys=Symbol.for("v-txt"),Ve=Symbol.for("v-cmt"),gi=Symbol.for("v-stc"),En=[];let rt=null;function oe(t=!1){En.push(rt=t?null:[])}function qd(){En.pop(),rt=En[En.length-1]||null}let Nn=1;function Ts(t,e=!1){Nn+=t,t<0&&rt&&e&&(rt.hasOnce=!0)}function Yc(t){return t.dynamicChildren=Nn>0?rt||Vr:null,qd(),Nn>0&&rt&&rt.push(t),t}function Ee(t,e,r,n,s,i){return Yc(ve(t,e,r,n,s,i,!0))}function Wt(t,e,r,n,s){return Yc(ue(t,e,r,n,s,!0))}function As(t){return t?t.__v_isVNode===!0:!1}function _r(t,e){return t.type===e.type&&t.key===e.key}const Qc=({key:t})=>t??null,ms=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?be(t)||Se(t)||Y(t)?{i:tt,r:t,k:e,f:!!r}:t:null);function ve(t,e=null,r=null,n=0,s=null,i=t===Ye?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Qc(e),ref:e&&ms(e),scopeId:mc,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:tt};return a?(Ao(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=be(r)?8:16),Nn>0&&!o&&rt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&rt.push(l),l}const ue=Fd;function Fd(t,e=null,r=null,n=0,s=null,i=!1){if((!t||t===Pc)&&(t=Ve),As(t)){const a=lr(t,e,!0);return r&&Ao(a,r),Nn>0&&!i&&rt&&(a.shapeFlag&6?rt[rt.indexOf(t)]=a:rt.push(a)),a.patchFlag=-2,a}if(tf(t)&&(t=t.__vccOpts),e){e=Vd(e);let{class:a,style:l}=e;a&&!be(a)&&(e.class=at(a)),ae(l)&&(zs(l)&&!F(l)&&(l=Pe({},l)),e.style=fo(l))}const o=be(t)?1:Jc(t)?128:bc(t)?64:ae(t)?4:Y(t)?2:0;return ve(t,e,r,n,s,o,i,!0)}function Vd(t){return t?zs(t)||Mc(t)?Pe({},t):t:null}function lr(t,e,r=!1,n=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?Wd(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&Qc(c),ref:e&&e.ref?r&&i?F(i)?i.concat(ms(e)):[i,ms(e)]:ms(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!==Ye?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&&lr(t.ssContent),ssFallback:t.ssFallback&&lr(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&$n(u,l.clone(u)),u}function zd(t=" ",e=0){return ue(Ys,null,t,e)}function Qe(t="",e=!1){return e?(oe(),Wt(Ve,null,t)):ue(Ve,null,t)}function Rt(t){return t==null||typeof t=="boolean"?ue(Ve):F(t)?ue(Ye,null,t.slice()):As(t)?Mt(t):ue(Ys,null,String(t))}function Mt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:lr(t)}function Ao(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(F(e))r=16;else if(typeof e=="object")if(n&65){const s=e.default;s&&(s._c&&(s._d=!1),Ao(t,s()),s._c&&(s._d=!0));return}else{r=32;const s=e._;!s&&!Mc(e)?e._ctx=tt:s===3&&tt&&(tt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Y(e)?(e={default:e,_ctx:tt},r=32):(e=String(e),n&64?(r=16,e=[zd(e)]):r=8);t.children=e,t.shapeFlag|=r}function Wd(...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=at([e.class,n.class]));else if(s==="style")e.style=fo([e.style,n.style]);else if(Ds(s)){const i=e[s],o=n[s];o&&i!==o&&!(F(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Us(s)&&(e[s]=o)}else s!==""&&(e[s]=n[s])}return e}function wt(t,e,r,n=null){gt(t,e,7,[r,n])}const Kd=Nc();let Gd=0;function Jd(t,e,r){const n=t.type,s=(e?e.appContext:t.appContext)||Kd,i={uid:Gd++,vnode:t,type:n,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Wl(!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:qc(n,s),emitsOptions:Lc(n,s),emit:null,emitted:null,propsDefaults:pe,inheritAttrs:n.inheritAttrs,ctx:pe,data:pe,props:pe,attrs:pe,slots:pe,refs:pe,setupState:pe,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=Td.bind(null,i),t.ce&&t.ce(i),i}let De=null;const xo=()=>De||tt;let xs,Mi;{const t=Fs(),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)}};xs=e("__VUE_INSTANCE_SETTERS__",r=>De=r),Mi=e("__VUE_SSR_SETTERS__",r=>Ln=r)}const Jn=t=>{const e=De;return xs(t),t.scope.on(),()=>{t.scope.off(),xs(e)}},ua=()=>{De&&De.scope.off(),xs(null)};function Zc(t){return t.vnode.shapeFlag&4}let Ln=!1;function Yd(t,e=!1,r=!1){e&&Mi(e);const{props:n,children:s}=t.vnode,i=Zc(t);Pd(t,n,i,e),Nd(t,s,r||e);const o=i?Qd(t,e):void 0;return e&&Mi(!1),o}function Qd(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,md);const{setup:n}=r;if(n){Gt();const s=t.setupContext=n.length>1?Xd(t):null,i=Jn(t),o=Gn(n,t,0,[t.props,s]),a=Bl(o);if(Jt(),i(),(a||t.sp)&&!kn(t)&&Tc(t),a){if(o.then(ua,ua),e)return o.then(l=>{ha(t,l)}).catch(l=>{Ws(l,t,0)});t.asyncDep=o}else ha(t,o)}else Xc(t)}function ha(t,e,r){Y(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ae(e)&&(t.setupState=hc(e)),Xc(t)}function Xc(t,e,r){const n=t.type;t.render||(t.render=n.render||Pt);{const s=Jn(t);Gt();try{yd(t)}finally{Jt(),s()}}}const Zd={get(t,e){return Le(t,"get",""),t[e]}};function Xd(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,Zd),slots:t.slots,emit:t.emit,expose:e}}function Qs(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(hc(wo(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in Sn)return Sn[r](t)},has(e,r){return r in e||r in Sn}})):t.proxy}function ef(t,e=!0){return Y(t)?t.displayName||t.name:t.name||e&&t.__name}function tf(t){return Y(t)&&"__vccOpts"in t}const Ue=(t,e)=>zh(t,e,Ln);function Qr(t,e,r){try{Ts(-1);const n=arguments.length;return n===2?ae(e)&&!F(e)?As(e)?ue(t,null,[e]):ue(t,e):ue(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&As(r)&&(r=[r]),ue(t,e,r))}finally{Ts(1)}}const rf="3.5.34";/**
|
|
14
|
+
**/function Jn(t,e,r,n){try{return n?t(...n):t()}catch(s){Ws(s,e,r)}}function gt(t,e,r,n){if(Y(t)){const s=Jn(t,e,r,n);return s&&Bl(s)&&s.catch(i=>{Ws(i,e,r)}),s}if(F(t)){const s=[];for(let i=0;i<t.length;i++)s.push(gt(t[i],e,r,n));return s}}function Ws(t,e,r,n=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ge;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){Gt(),Jn(i,null,10,[t,l,c]),Jt();return}}Gh(t,r,s,n,o)}function Gh(t,e,r,n=!0,s=!1){if(s)throw t;console.error(t)}const Fe=[];let Et=-1;const Kr=[];let nr=null,Dr=0;const dc=Promise.resolve();let ws=null;function Qr(t){const e=ws||dc;return t?e.then(this?t.bind(this):t):e}function Jh(t){let e=Et+1,r=Fe.length;for(;e<r;){const n=e+r>>>1,s=Fe[n],i=$n(s);i<t||i===t&&s.flags&2?e=n+1:r=n}return e}function ko(t){if(!(t.flags&1)){const e=$n(t),r=Fe[Fe.length-1];!r||!(t.flags&2)&&e>=$n(r)?Fe.push(t):Fe.splice(Jh(e),0,t),t.flags|=1,fc()}}function fc(){ws||(ws=dc.then(gc))}function Yh(t){F(t)?Kr.push(...t):nr&&t.id===-1?nr.splice(Dr+1,0,t):t.flags&1||(Kr.push(t),t.flags|=1),fc()}function Yo(t,e,r=Et+1){for(;r<Fe.length;r++){const n=Fe[r];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Fe.splice(r,1),r--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function pc(t){if(Kr.length){const e=[...new Set(Kr)].sort((r,n)=>$n(r)-$n(n));if(Kr.length=0,nr){nr.push(...e);return}for(nr=e,Dr=0;Dr<nr.length;Dr++){const r=nr[Dr];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}nr=null,Dr=0}}const $n=t=>t.id==null?t.flags&2?-1:1/0:t.id;function gc(t){try{for(Et=0;Et<Fe.length;Et++){const e=Fe[Et];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Jn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Et<Fe.length;Et++){const e=Fe[Et];e&&(e.flags&=-2)}Et=-1,Fe.length=0,pc(),ws=null,(Fe.length||Kr.length)&&gc()}}let rt=null,mc=null;function ks(t){const e=rt;return rt=t,mc=t&&t.type.__scopeId||null,e}function Gr(t,e=rt,r){if(!e||t._n)return t;const n=(...s)=>{n._d&&Ts(-1);const i=ks(e);let o;try{o=t(...s)}finally{ks(i),n._d&&Ts(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function Qh(t,e){if(rt===null)return t;const r=Qs(rt),n=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,a,l=ge]=e[s];i&&(Y(i)&&(i={mounted:i,updated:i}),i.deep&&qt(o),n.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function dr(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&&(Gt(),gt(l,r,8,[t.el,a,t,e]),Jt())}}function gs(t,e){if(Ue){let r=Ue.provides;const n=Ue.parent&&Ue.parent.provides;n===r&&(r=Ue.provides=Object.create(n)),r[t]=e}}function lt(t,e,r=!1){const n=xo();if(n||Tr){let s=Tr?Tr._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&&Y(e)?e.call(n&&n.proxy):e}}function Zh(){return!!(xo()||Tr)}const Xh=Symbol.for("v-scx"),ed=()=>lt(Xh);function Er(t,e,r){return yc(t,e,r)}function yc(t,e,r=ge){const{immediate:n,deep:s,flush:i,once:o}=r,a=Pe({},r),l=e&&n||!e&&i!=="post";let c;if(Dn){if(i==="sync"){const f=ed();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Pt,f.resume=Pt,f.pause=Pt,f}}const u=Ue;a.call=(f,p,y)=>gt(f,u,p,y);let h=!1;i==="post"?a.scheduler=f=>{Je(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():ko(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=Kh(t,e,a);return Dn&&(c?c.push(d):l&&d()),d}function td(t,e,r){const n=this.proxy,s=_e(t)?t.includes(".")?vc(n,t):()=>n[t]:t.bind(n,n);let i;Y(e)?i=e:(i=e.handler,r=e);const o=Yn(this),a=yc(s,i.bind(n),r);return o(),a}function vc(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 rd=Symbol("_vte"),bc=t=>t.__isTeleport,Tt=Symbol("_leaveCb"),cn=Symbol("_enterCb");function nd(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return xc(()=>{t.isMounted=!0}),Rc(()=>{t.isUnmounting=!0}),t}const ot=[Function,Array],_c={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ot,onEnter:ot,onAfterEnter:ot,onEnterCancelled:ot,onBeforeLeave:ot,onLeave:ot,onAfterLeave:ot,onLeaveCancelled:ot,onBeforeAppear:ot,onAppear:ot,onAfterAppear:ot,onAppearCancelled:ot},wc=t=>{const e=t.subTree;return e.component?wc(e.component):e},sd={name:"BaseTransition",props:_c,setup(t,{slots:e}){const r=xo(),n=nd();return()=>{const s=e.default&&Ec(e.default(),!0),i=s&&s.length?kc(s):r.subTree?Ze():void 0;if(!i)return;const o=re(t),{mode:a}=o;if(n.isLeaving)return di(i);const l=Qo(i);if(!l)return di(i);let c=$i(l,o,n,r,h=>c=h);l.type!==Ve&&Nn(l,c);let u=r.subTree&&Qo(r.subTree);if(u&&u.type!==Ve&&!_r(u,l)&&wc(r).type!==Ve){let h=$i(u,o,n,r);if(Nn(u,h),a==="out-in"&&l.type!==Ve)return n.isLeaving=!0,h.afterLeave=()=>{n.isLeaving=!1,r.job.flags&8||r.update(),delete h.afterLeave,u=void 0},di(i);a==="in-out"&&l.type!==Ve?h.delayLeave=(d,f,p)=>{const y=Sc(n,u);y[String(u.key)]=u,d[Tt]=()=>{f(),d[Tt]=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 kc(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==Ve){e=r;break}}return e}const id=sd;function Sc(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 $i(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:k,onAppear:w,onAfterAppear:b,onAppearCancelled:_}=e,x=String(t.key),D=Sc(r,t),M=(C,q)=>{C&>(C,n,9,q)},H=(C,q)=>{const Q=q[1];M(C,q),F(C)?C.every(j=>j.length<=1)&&Q():C.length<=1&&Q()},W={mode:o,persisted:a,beforeEnter(C){let q=l;if(!r.isMounted)if(i)q=k||l;else return;C[Tt]&&C[Tt](!0);const Q=D[x];Q&&_r(t,Q)&&Q.el[Tt]&&Q.el[Tt](),M(q,[C])},enter(C){if(D[x]===t)return;let q=c,Q=u,j=h;if(!r.isMounted)if(i)q=w||c,Q=b||u,j=_||h;else return;let X=!1;C[cn]=Be=>{X||(X=!0,Be?M(j,[C]):M(Q,[C]),W.delayedLeave&&W.delayedLeave(),C[cn]=void 0)};const Ae=C[cn].bind(null,!1);q?H(q,[C,Ae]):Ae()},leave(C,q){const Q=String(t.key);if(C[cn]&&C[cn](!0),r.isUnmounting)return q();M(d,[C]);let j=!1;C[Tt]=Ae=>{j||(j=!0,q(),Ae?M(y,[C]):M(p,[C]),C[Tt]=void 0,D[Q]===t&&delete D[Q])};const X=C[Tt].bind(null,!1);D[Q]=t,f?H(f,[C,X]):X()},clone(C){const q=$i(C,e,r,n,s);return s&&s(q),q}};return W}function di(t){if(Ks(t))return t=lr(t),t.children=null,t}function Qo(t){if(!Ks(t))return bc(t.type)&&t.children?kc(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&&Y(r.default))return r.default()}}function Nn(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Nn(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 Ec(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===Qe?(o.patchFlag&128&&s++,n=n.concat(Ec(o.children,e,a))):(e||o.type!==Ve)&&n.push(a!=null?lr(o,{key:a}):o)}if(s>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function ur(t,e){return Y(t)?Pe({name:t.name},e,{setup:t}):t}function Tc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Zo(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Ss=new WeakMap;function kn(t,e,r,n,s=!1){if(F(t)){t.forEach((y,k)=>kn(y,e&&(F(e)?e[k]:e),r,n,s));return}if(Sn(n)&&!s){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&kn(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===ge?a.refs={}:a.refs,h=a.setupState,d=re(h),f=h===ge?Ul:y=>Zo(u,y)?!1:oe(d,y),p=(y,k)=>!(k&&Zo(u,k));if(c!=null&&c!==l){if(Xo(e),_e(c))u[c]=null,f(c)&&(h[c]=null);else if(Se(c)){const y=e;p(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(Y(l))Jn(l,a,12,[o,u]);else{const y=_e(l),k=Se(l);if(y||k){const w=()=>{if(t.f){const b=y?f(l)?h[l]:u[l]:p()||!t.k?l.value:u[t.k];if(s)F(b)&&ho(b,i);else if(F(b))b.includes(i)||b.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const _=[i];p(l,t.k)&&(l.value=_),t.k&&(u[t.k]=_)}}else y?(u[l]=o,f(l)&&(h[l]=o)):k&&(p(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const b=()=>{w(),Ss.delete(t)};b.id=-1,Ss.set(t,b),Je(b,r)}else Xo(t),w()}}}function Xo(t){const e=Ss.get(t);e&&(e.flags|=8,Ss.delete(t))}Fs().requestIdleCallback;Fs().cancelIdleCallback;const Sn=t=>!!t.type.__asyncLoader,Ks=t=>t.type.__isKeepAlive;function od(t,e){Ac(t,"a",e)}function ad(t,e){Ac(t,"da",e)}function Ac(t,e,r=Ue){const n=t.__wdc||(t.__wdc=()=>{let s=r;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Gs(e,n,r),r){let s=r.parent;for(;s&&s.parent;)Ks(s.parent.vnode)&&ld(n,e,r,s),s=s.parent}}function ld(t,e,r,n){const s=Gs(e,t,n,!0);Cc(()=>{ho(n[e],s)},r)}function Gs(t,e,r=Ue,n=!1){if(r){const s=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Gt();const a=Yn(r),l=gt(e,r,t,o);return a(),Jt(),l});return n?s.unshift(i):s.push(i),i}}const Qt=t=>(e,r=Ue)=>{(!Dn||t==="sp")&&Gs(t,(...n)=>e(...n),r)},cd=Qt("bm"),xc=Qt("m"),ud=Qt("bu"),hd=Qt("u"),Rc=Qt("bum"),Cc=Qt("um"),dd=Qt("sp"),fd=Qt("rtg"),pd=Qt("rtc");function gd(t,e=Ue){Gs("ec",t,e)}const Oc="components";function So(t,e){return Ic(Oc,t,!0,e)||t}const Pc=Symbol.for("v-ndc");function ea(t){return _e(t)?Ic(Oc,t,!1)||t:t||Pc}function Ic(t,e,r=!0,n=!1){const s=rt||Ue;if(s){const i=s.type;{const a=ef(i,!1);if(a&&(a===e||a===We(e)||a===Hs(We(e))))return i}const o=ta(s[t]||i[t],e)||ta(s.appContext[t],e);return!o&&n?i:o}}function ta(t,e){return t&&(t[e]||t[We(e)]||t[Hs(We(e))])}function Ni(t,e,r,n){let s;const i=r,o=F(t);if(o||_e(t)){const a=o&&zt(t);let l=!1,c=!1;a&&(l=!st(t),c=Yt(t),t=Vs(t)),s=new Array(t.length);for(let u=0,h=t.length;u<h;u++)s[u]=e(l?c?Yr(pt(t[u])):pt(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(le(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 Li=t=>t?Zc(t)?Qs(t):Li(t.parent):null,En=Pe(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=>Li(t.parent),$root:t=>Li(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>$c(t),$forceUpdate:t=>t.f||(t.f=()=>{ko(t.update)}),$nextTick:t=>t.n||(t.n=Qr.bind(t.proxy)),$watch:t=>td.bind(t)}),fi=(t,e)=>t!==ge&&!t.__isScriptSetup&&oe(t,e),md={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(fi(n,e))return o[e]=1,n[e];if(s!==ge&&oe(s,e))return o[e]=2,s[e];if(oe(i,e))return o[e]=3,i[e];if(r!==ge&&oe(r,e))return o[e]=4,r[e];Di&&(o[e]=0)}}const c=En[e];let u,h;if(c)return e==="$attrs"&&De(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==ge&&oe(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,oe(h,e))return h[e]},set({_:t},e,r){const{data:n,setupState:s,ctx:i}=t;return fi(s,e)?(s[e]=r,!0):n!==ge&&oe(n,e)?(n[e]=r,!0):oe(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!==ge&&a[0]!=="$"&&oe(t,a)||fi(e,a)||oe(i,a)||oe(n,a)||oe(En,a)||oe(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:oe(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function ra(t){return F(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Di=!0;function yd(t){const e=$c(t),r=t.proxy,n=t.ctx;Di=!1,e.beforeCreate&&na(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:k,beforeDestroy:w,beforeUnmount:b,destroyed:_,unmounted:x,render:D,renderTracked:M,renderTriggered:H,errorCaptured:W,serverPrefetch:C,expose:q,inheritAttrs:Q,components:j,directives:X,filters:Ae}=e;if(c&&vd(c,n,null),o)for(const Z in o){const se=o[Z];Y(se)&&(n[Z]=se.bind(r))}if(s){const Z=s.call(r,r);le(Z)&&(t.data=Gn(Z))}if(Di=!0,i)for(const Z in i){const se=i[Z],It=Y(se)?se.bind(r,r):Y(se.get)?se.get.bind(r,r):Pt,Xt=!Y(se)&&Y(se.set)?se.set.bind(r):Pt,yt=Le({get:It,set:Xt});Object.defineProperty(n,Z,{enumerable:!0,configurable:!0,get:()=>yt.value,set:Ke=>yt.value=Ke})}if(a)for(const Z in a)jc(a[Z],n,r,Z);if(l){const Z=Y(l)?l.call(r):l;Reflect.ownKeys(Z).forEach(se=>{gs(se,Z[se])})}u&&na(u,t,"c");function de(Z,se){F(se)?se.forEach(It=>Z(It.bind(r))):se&&Z(se.bind(r))}if(de(cd,h),de(xc,d),de(ud,f),de(hd,p),de(od,y),de(ad,k),de(gd,W),de(pd,M),de(fd,H),de(Rc,b),de(Cc,x),de(dd,C),F(q))if(q.length){const Z=t.exposed||(t.exposed={});q.forEach(se=>{Object.defineProperty(Z,se,{get:()=>r[se],set:It=>r[se]=It,enumerable:!0})})}else t.exposed||(t.exposed={});D&&t.render===Pt&&(t.render=D),Q!=null&&(t.inheritAttrs=Q),j&&(t.components=j),X&&(t.directives=X),C&&Tc(t)}function vd(t,e,r=Pt){F(t)&&(t=Ui(t));for(const n in t){const s=t[n];let i;le(s)?"default"in s?i=lt(s.from||n,s.default,!0):i=lt(s.from||n):i=lt(s),Se(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[n]=i}}function na(t,e,r){gt(F(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function jc(t,e,r,n){let s=n.includes(".")?vc(r,n):()=>r[n];if(_e(t)){const i=e[t];Y(i)&&Er(s,i)}else if(Y(t))Er(s,t.bind(r));else if(le(t))if(F(t))t.forEach(i=>jc(i,e,r,n));else{const i=Y(t.handler)?t.handler.bind(r):e[t.handler];Y(i)&&Er(s,i,t)}}function $c(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=>Es(l,c,o,!0)),Es(l,e,o)),le(e)&&i.set(e,l),l}function Es(t,e,r,n=!1){const{mixins:s,extends:i}=e;i&&Es(t,i,r,!0),s&&s.forEach(o=>Es(t,o,r,!0));for(const o in e)if(!(n&&o==="expose")){const a=bd[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const bd={data:sa,props:ia,emits:ia,methods:gn,computed:gn,beforeCreate:He,created:He,beforeMount:He,mounted:He,beforeUpdate:He,updated:He,beforeDestroy:He,beforeUnmount:He,destroyed:He,unmounted:He,activated:He,deactivated:He,errorCaptured:He,serverPrefetch:He,components:gn,directives:gn,watch:wd,provide:sa,inject:_d};function sa(t,e){return e?t?function(){return Pe(Y(t)?t.call(this,this):t,Y(e)?e.call(this,this):e)}:e:t}function _d(t,e){return gn(Ui(t),Ui(e))}function Ui(t){if(F(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function He(t,e){return t?[...new Set([].concat(t,e))]:e}function gn(t,e){return t?Pe(Object.create(null),t,e):e}function ia(t,e){return t?F(t)&&F(e)?[...new Set([...t,...e])]:Pe(Object.create(null),ra(t),ra(e??{})):e}function wd(t,e){if(!t)return e;if(!e)return t;const r=Pe(Object.create(null),t);for(const n in e)r[n]=He(t[n],e[n]);return r}function Nc(){return{app:null,config:{isNativeTag:Ul,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 kd=0;function Sd(t,e){return function(n,s=null){Y(n)||(n=Pe({},n)),s!=null&&!le(s)&&(s=null);const i=Nc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:kd++,_component:n,_props:s,_container:null,_context:i,_instance:null,version:rf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&Y(u.install)?(o.add(u),u.install(c,...h)):Y(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||ue(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&&(gt(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=Tr;Tr=c;try{return u()}finally{Tr=h}}};return c}}let Tr=null;const Ed=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${We(e)}Modifiers`]||t[`${cr(e)}Modifiers`];function Td(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||ge;let s=r;const i=e.startsWith("update:"),o=i&&Ed(n,e.slice(7));o&&(o.trim&&(s=r.map(u=>_e(u)?u.trim():u)),o.number&&(s=r.map(qs)));let a,l=n[a=ai(e)]||n[a=ai(We(e))];!l&&i&&(l=n[a=ai(cr(e))]),l&>(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,gt(c,t,6,s)}}const Ad=new WeakMap;function Lc(t,e,r=!1){const n=r?Ad:e.emitsCache,s=n.get(t);if(s!==void 0)return s;const i=t.emits;let o={},a=!1;if(!Y(t)){const l=c=>{const u=Lc(c,e,!0);u&&(a=!0,Pe(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(le(t)&&n.set(t,null),null):(F(i)?i.forEach(l=>o[l]=null):Pe(o,i),le(t)&&n.set(t,o),o)}function Js(t,e){return!t||!Ds(e)?!1:(e=e.slice(2).replace(/Once$/,""),oe(t,e[0].toLowerCase()+e.slice(1))||oe(t,cr(e))||oe(t,e))}function oa(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,k=ks(t);let w,b;try{if(r.shapeFlag&4){const x=s||n,D=x;w=Rt(c.call(D,x,u,h,f,d,p)),b=a}else{const x=e;w=Rt(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),b=e.props?a:xd(a)}}catch(x){Tn.length=0,Ws(x,t,1),w=ue(Ve)}let _=w;if(b&&y!==!1){const x=Object.keys(b),{shapeFlag:D}=_;x.length&&D&7&&(i&&x.some(Us)&&(b=Rd(b,i)),_=lr(_,b,!1,!0))}return r.dirs&&(_=lr(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(r.dirs):r.dirs),r.transition&&Nn(_,r.transition),w=_,ks(k),w}const xd=t=>{let e;for(const r in t)(r==="class"||r==="style"||Ds(r))&&((e||(e={}))[r]=t[r]);return e},Rd=(t,e)=>{const r={};for(const n in t)(!Us(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function Cd(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?aa(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Dc(o,n,d)&&!Js(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?aa(n,o,c):!0:!!o;return!1}function aa(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(Dc(e,t,i)&&!Js(r,i))return!0}return!1}function Dc(t,e,r){const n=t[r],s=e[r];return r==="style"&&le(n)&&le(s)?!sn(n,s):n!==s}function Od({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 Uc={},Bc=()=>Object.create(Uc),Mc=t=>Object.getPrototypeOf(t)===Uc;function Pd(t,e,r,n=!1){const s={},i=Bc();t.propsDefaults=Object.create(null),Hc(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);r?t.props=n?s:cc(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Id(t,e,r,n){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,a=re(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(Js(t.emitsOptions,d))continue;const f=e[d];if(l)if(oe(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=We(d);s[p]=Bi(l,a,p,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Hc(t,e,s,i)&&(c=!0);let u;for(const h in a)(!e||!oe(e,h)&&((u=cr(h))===h||!oe(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(s[h]=Bi(l,a,h,void 0,t,!0)):delete s[h]);if(i!==a)for(const h in i)(!e||!oe(e,h))&&(delete i[h],c=!0)}c&&Ht(t.attrs,"set","")}function Hc(t,e,r,n){const[s,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(bn(l))continue;const c=e[l];let u;s&&oe(s,u=We(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Js(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(i){const l=re(r),c=a||ge;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Bi(s,l,h,c[h],t,!oe(c,h))}}return o}function Bi(t,e,r,n,s,i){const o=t[r];if(o!=null){const a=oe(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&Y(l)){const{propsDefaults:c}=s;if(r in c)n=c[r];else{const u=Yn(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===cr(r))&&(n=!0))}return n}const jd=new WeakMap;function qc(t,e,r=!1){const n=r?jd:e.propsCache,s=n.get(t);if(s)return s;const i=t.props,o={},a=[];let l=!1;if(!Y(t)){const u=h=>{l=!0;const[d,f]=qc(h,e,!0);Pe(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 le(t)&&n.set(t,Vr),Vr;if(F(i))for(let u=0;u<i.length;u++){const h=We(i[u]);la(h)&&(o[h]=ge)}else if(i)for(const u in i){const h=We(u);if(la(h)){const d=i[u],f=o[h]=F(d)||Y(d)?{type:d}:Pe({},d),p=f.type;let y=!1,k=!0;if(F(p))for(let w=0;w<p.length;++w){const b=p[w],_=Y(b)&&b.name;if(_==="Boolean"){y=!0;break}else _==="String"&&(k=!1)}else y=Y(p)&&p.name==="Boolean";f[0]=y,f[1]=k,(y||oe(f,"default"))&&a.push(h)}}const c=[o,a];return le(t)&&n.set(t,c),c}function la(t){return t[0]!=="$"&&!bn(t)}const Eo=t=>t==="_"||t==="_ctx"||t==="$stable",To=t=>F(t)?t.map(Rt):[Rt(t)],$d=(t,e,r)=>{if(e._n)return e;const n=Gr((...s)=>To(e(...s)),r);return n._c=!1,n},Fc=(t,e,r)=>{const n=t._ctx;for(const s in t){if(Eo(s))continue;const i=t[s];if(Y(i))e[s]=$d(s,i,n);else if(i!=null){const o=To(i);e[s]=()=>o}}},Vc=(t,e)=>{const r=To(e);t.slots.default=()=>r},zc=(t,e,r)=>{for(const n in e)(r||!Eo(n))&&(t[n]=e[n])},Nd=(t,e,r)=>{const n=t.slots=Bc();if(t.vnode.shapeFlag&32){const s=e._;s?(zc(n,e,r),r&&ql(n,"_",s,!0)):Fc(e,n)}else e&&Vc(t,e)},Ld=(t,e,r)=>{const{vnode:n,slots:s}=t;let i=!0,o=ge;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:zc(s,e,r):(i=!e.$stable,Fc(e,s)),o=e}else e&&(Vc(t,e),o={default:1});if(i)for(const a in s)!Eo(a)&&o[a]==null&&delete s[a]},Je=Hd;function Dd(t){return Ud(t)}function Ud(t,e){const r=Fs();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=Pt,insertStaticContent:p}=t,y=(g,m,v,S=null,A=null,E=null,$=void 0,P=null,O=!!m.dynamicChildren)=>{if(g===m)return;g&&!_r(g,m)&&(S=T(g),Ke(g,A,E,!0),g=null),m.patchFlag===-2&&(O=!1,m.dynamicChildren=null);const{type:R,ref:K,shapeFlag:L}=m;switch(R){case Ys:k(g,m,v,S);break;case Ve:w(g,m,v,S);break;case gi:g==null&&b(m,v,S,$);break;case Qe:j(g,m,v,S,A,E,$,P,O);break;default:L&1?D(g,m,v,S,A,E,$,P,O):L&6?X(g,m,v,S,A,E,$,P,O):(L&64||L&128)&&R.process(g,m,v,S,A,E,$,P,O,V)}K!=null&&A?kn(K,g&&g.ref,E,m||g,!m):K==null&&g&&g.ref!=null&&kn(g.ref,null,E,g,!0)},k=(g,m,v,S)=>{if(g==null)n(m.el=a(m.children),v,S);else{const A=m.el=g.el;m.children!==g.children&&c(A,m.children)}},w=(g,m,v,S)=>{g==null?n(m.el=l(m.children||""),v,S):m.el=g.el},b=(g,m,v,S)=>{[g.el,g.anchor]=p(g.children,m,v,S,g.el,g.anchor)},_=({el:g,anchor:m},v,S)=>{let A;for(;g&&g!==m;)A=d(g),n(g,v,S),g=A;n(m,v,S)},x=({el:g,anchor:m})=>{let v;for(;g&&g!==m;)v=d(g),s(g),g=v;s(m)},D=(g,m,v,S,A,E,$,P,O)=>{if(m.type==="svg"?$="svg":m.type==="math"&&($="mathml"),g==null)M(m,v,S,A,E,$,P,O);else{const R=g.el&&g.el._isVueCE?g.el:null;try{R&&R._beginPatch(),C(g,m,A,E,$,P,O)}finally{R&&R._endPatch()}}},M=(g,m,v,S,A,E,$,P)=>{let O,R;const{props:K,shapeFlag:L,transition:z,dirs:J}=g;if(O=g.el=o(g.type,E,K&&K.is,K),L&8?u(O,g.children):L&16&&W(g.children,O,null,S,A,pi(g,E),$,P),J&&dr(g,null,S,"created"),H(O,g,g.scopeId,$,S),K){for(const fe in K)fe!=="value"&&!bn(fe)&&i(O,fe,null,K[fe],E,S);"value"in K&&i(O,"value",null,K.value,E),(R=K.onVnodeBeforeMount)&&wt(R,S,g)}J&&dr(g,null,S,"beforeMount");const ne=Bd(A,z);ne&&z.beforeEnter(O),n(O,m,v),((R=K&&K.onVnodeMounted)||ne||J)&&Je(()=>{try{R&&wt(R,S,g),ne&&z.enter(O),J&&dr(g,null,S,"mounted")}finally{}},A)},H=(g,m,v,S,A)=>{if(v&&f(g,v),S)for(let E=0;E<S.length;E++)f(g,S[E]);if(A){let E=A.subTree;if(m===E||Jc(E.type)&&(E.ssContent===m||E.ssFallback===m)){const $=A.vnode;H(g,$,$.scopeId,$.slotScopeIds,A.parent)}}},W=(g,m,v,S,A,E,$,P,O=0)=>{for(let R=O;R<g.length;R++){const K=g[R]=P?Mt(g[R]):Rt(g[R]);y(null,K,m,v,S,A,E,$,P)}},C=(g,m,v,S,A,E,$)=>{const P=m.el=g.el;let{patchFlag:O,dynamicChildren:R,dirs:K}=m;O|=g.patchFlag&16;const L=g.props||ge,z=m.props||ge;let J;if(v&&fr(v,!1),(J=z.onVnodeBeforeUpdate)&&wt(J,v,m,g),K&&dr(m,g,v,"beforeUpdate"),v&&fr(v,!0),(L.innerHTML&&z.innerHTML==null||L.textContent&&z.textContent==null)&&u(P,""),R?q(g.dynamicChildren,R,P,v,S,pi(m,A),E):$||se(g,m,P,null,v,S,pi(m,A),E,!1),O>0){if(O&16)Q(P,L,z,v,A);else if(O&2&&L.class!==z.class&&i(P,"class",null,z.class,A),O&4&&i(P,"style",L.style,z.style,A),O&8){const ne=m.dynamicProps;for(let fe=0;fe<ne.length;fe++){const me=ne[fe],xe=L[me],je=z[me];(je!==xe||me==="value")&&i(P,me,xe,je,A,v)}}O&1&&g.children!==m.children&&u(P,m.children)}else!$&&R==null&&Q(P,L,z,v,A);((J=z.onVnodeUpdated)||K)&&Je(()=>{J&&wt(J,v,m,g),K&&dr(m,g,v,"updated")},S)},q=(g,m,v,S,A,E,$)=>{for(let P=0;P<m.length;P++){const O=g[P],R=m[P],K=O.el&&(O.type===Qe||!_r(O,R)||O.shapeFlag&198)?h(O.el):v;y(O,R,K,null,S,A,E,$,!0)}},Q=(g,m,v,S,A)=>{if(m!==v){if(m!==ge)for(const E in m)!bn(E)&&!(E in v)&&i(g,E,m[E],null,A,S);for(const E in v){if(bn(E))continue;const $=v[E],P=m[E];$!==P&&E!=="value"&&i(g,E,P,$,A,S)}"value"in v&&i(g,"value",m.value,v.value,A)}},j=(g,m,v,S,A,E,$,P,O)=>{const R=m.el=g?g.el:a(""),K=m.anchor=g?g.anchor:a("");let{patchFlag:L,dynamicChildren:z,slotScopeIds:J}=m;J&&(P=P?P.concat(J):J),g==null?(n(R,v,S),n(K,v,S),W(m.children||[],v,K,A,E,$,P,O)):L>0&&L&64&&z&&g.dynamicChildren&&g.dynamicChildren.length===z.length?(q(g.dynamicChildren,z,v,A,E,$,P),(m.key!=null||A&&m===A.subTree)&&Wc(g,m,!0)):se(g,m,v,K,A,E,$,P,O)},X=(g,m,v,S,A,E,$,P,O)=>{m.slotScopeIds=P,g==null?m.shapeFlag&512?A.ctx.activate(m,v,S,$,O):Ae(m,v,S,A,E,$,O):Be(g,m,O)},Ae=(g,m,v,S,A,E,$)=>{const P=g.component=Jd(g,S,A);if(Ks(g)&&(P.ctx.renderer=V),Yd(P,!1,$),P.asyncDep){if(A&&A.registerDep(P,de,$),!g.el){const O=P.subTree=ue(Ve);w(null,O,m,v),g.placeholder=O.el}}else de(P,g,m,v,A,E,$)},Be=(g,m,v)=>{const S=m.component=g.component;if(Cd(g,m,v))if(S.asyncDep&&!S.asyncResolved){Z(S,m,v);return}else S.next=m,S.update();else m.el=g.el,S.vnode=m},de=(g,m,v,S,A,E,$)=>{const P=()=>{if(g.isMounted){let{next:L,bu:z,u:J,parent:ne,vnode:fe}=g;{const bt=Kc(g);if(bt){L&&(L.el=fe.el,Z(g,L,$)),bt.asyncDep.then(()=>{Je(()=>{g.isUnmounted||R()},A)});return}}let me=L,xe;fr(g,!1),L?(L.el=fe.el,Z(g,L,$)):L=fe,z&&ps(z),(xe=L.props&&L.props.onVnodeBeforeUpdate)&&wt(xe,ne,L,fe),fr(g,!0);const je=oa(g),vt=g.subTree;g.subTree=je,y(vt,je,h(vt.el),T(vt),g,A,E),L.el=je.el,me===null&&Od(g,je.el),J&&Je(J,A),(xe=L.props&&L.props.onVnodeUpdated)&&Je(()=>wt(xe,ne,L,fe),A)}else{let L;const{el:z,props:J}=m,{bm:ne,m:fe,parent:me,root:xe,type:je}=g,vt=Sn(m);fr(g,!1),ne&&ps(ne),!vt&&(L=J&&J.onVnodeBeforeMount)&&wt(L,me,m),fr(g,!0);{xe.ce&&xe.ce._hasShadowRoot()&&xe.ce._injectChildStyle(je,g.parent?g.parent.type:void 0);const bt=g.subTree=oa(g);y(null,bt,v,S,g,A,E),m.el=bt.el}if(fe&&Je(fe,A),!vt&&(L=J&&J.onVnodeMounted)){const bt=m;Je(()=>wt(L,me,bt),A)}(m.shapeFlag&256||me&&Sn(me.vnode)&&me.vnode.shapeFlag&256)&&g.a&&Je(g.a,A),g.isMounted=!0,m=v=S=null}};g.scope.on();const O=g.effect=new Jl(P);g.scope.off();const R=g.update=O.run.bind(O),K=g.job=O.runIfDirty.bind(O);K.i=g,K.id=g.uid,O.scheduler=()=>ko(K),fr(g,!0),R()},Z=(g,m,v)=>{m.component=g;const S=g.vnode.props;g.vnode=m,g.next=null,Id(g,m.props,S,v),Ld(g,m.children,v),Gt(),Yo(g),Jt()},se=(g,m,v,S,A,E,$,P,O=!1)=>{const R=g&&g.children,K=g?g.shapeFlag:0,L=m.children,{patchFlag:z,shapeFlag:J}=m;if(z>0){if(z&128){Xt(R,L,v,S,A,E,$,P,O);return}else if(z&256){It(R,L,v,S,A,E,$,P,O);return}}J&8?(K&16&&it(R,A,E),L!==R&&u(v,L)):K&16?J&16?Xt(R,L,v,S,A,E,$,P,O):it(R,A,E,!0):(K&8&&u(v,""),J&16&&W(L,v,S,A,E,$,P,O))},It=(g,m,v,S,A,E,$,P,O)=>{g=g||Vr,m=m||Vr;const R=g.length,K=m.length,L=Math.min(R,K);let z;for(z=0;z<L;z++){const J=m[z]=O?Mt(m[z]):Rt(m[z]);y(g[z],J,v,null,A,E,$,P,O)}R>K?it(g,A,E,!0,!1,L):W(m,v,S,A,E,$,P,O,L)},Xt=(g,m,v,S,A,E,$,P,O)=>{let R=0;const K=m.length;let L=g.length-1,z=K-1;for(;R<=L&&R<=z;){const J=g[R],ne=m[R]=O?Mt(m[R]):Rt(m[R]);if(_r(J,ne))y(J,ne,v,null,A,E,$,P,O);else break;R++}for(;R<=L&&R<=z;){const J=g[L],ne=m[z]=O?Mt(m[z]):Rt(m[z]);if(_r(J,ne))y(J,ne,v,null,A,E,$,P,O);else break;L--,z--}if(R>L){if(R<=z){const J=z+1,ne=J<K?m[J].el:S;for(;R<=z;)y(null,m[R]=O?Mt(m[R]):Rt(m[R]),v,ne,A,E,$,P,O),R++}}else if(R>z)for(;R<=L;)Ke(g[R],A,E,!0),R++;else{const J=R,ne=R,fe=new Map;for(R=ne;R<=z;R++){const Xe=m[R]=O?Mt(m[R]):Rt(m[R]);Xe.key!=null&&fe.set(Xe.key,R)}let me,xe=0;const je=z-ne+1;let vt=!1,bt=0;const an=new Array(je);for(R=0;R<je;R++)an[R]=0;for(R=J;R<=L;R++){const Xe=g[R];if(xe>=je){Ke(Xe,A,E,!0);continue}let _t;if(Xe.key!=null)_t=fe.get(Xe.key);else for(me=ne;me<=z;me++)if(an[me-ne]===0&&_r(Xe,m[me])){_t=me;break}_t===void 0?Ke(Xe,A,E,!0):(an[_t-ne]=R+1,_t>=bt?bt=_t:vt=!0,y(Xe,m[_t],v,null,A,E,$,P,O),xe++)}const qo=vt?Md(an):Vr;for(me=qo.length-1,R=je-1;R>=0;R--){const Xe=ne+R,_t=m[Xe],Fo=m[Xe+1],Vo=Xe+1<K?Fo.el||Gc(Fo):S;an[R]===0?y(null,_t,v,Vo,A,E,$,P,O):vt&&(me<0||R!==qo[me]?yt(_t,v,Vo,2):me--)}}},yt=(g,m,v,S,A=null)=>{const{el:E,type:$,transition:P,children:O,shapeFlag:R}=g;if(R&6){yt(g.component.subTree,m,v,S);return}if(R&128){g.suspense.move(m,v,S);return}if(R&64){$.move(g,m,v,V);return}if($===Qe){n(E,m,v);for(let L=0;L<O.length;L++)yt(O[L],m,v,S);n(g.anchor,m,v);return}if($===gi){_(g,m,v);return}if(S!==2&&R&1&&P)if(S===0)P.beforeEnter(E),n(E,m,v),Je(()=>P.enter(E),A);else{const{leave:L,delayLeave:z,afterLeave:J}=P,ne=()=>{g.ctx.isUnmounted?s(E):n(E,m,v)},fe=()=>{E._isLeaving&&E[Tt](!0),L(E,()=>{ne(),J&&J()})};z?z(E,ne,fe):fe()}else n(E,m,v)},Ke=(g,m,v,S=!1,A=!1)=>{const{type:E,props:$,ref:P,children:O,dynamicChildren:R,shapeFlag:K,patchFlag:L,dirs:z,cacheIndex:J,memo:ne}=g;if(L===-2&&(A=!1),P!=null&&(Gt(),kn(P,null,v,g,!0),Jt()),J!=null&&(m.renderCache[J]=void 0),K&256){m.ctx.deactivate(g);return}const fe=K&1&&z,me=!Sn(g);let xe;if(me&&(xe=$&&$.onVnodeBeforeUnmount)&&wt(xe,m,g),K&6)hr(g.component,v,S);else{if(K&128){g.suspense.unmount(v,S);return}fe&&dr(g,null,m,"beforeUnmount"),K&64?g.type.remove(g,m,v,V,S):R&&!R.hasOnce&&(E!==Qe||L>0&&L&64)?it(R,m,v,!1,!0):(E===Qe&&L&384||!A&&K&16)&&it(O,m,v),S&&Rr(g)}const je=ne!=null&&J==null;(me&&(xe=$&&$.onVnodeUnmounted)||fe||je)&&Je(()=>{xe&&wt(xe,m,g),fe&&dr(g,null,m,"unmounted"),je&&(g.el=null)},v)},Rr=g=>{const{type:m,el:v,anchor:S,transition:A}=g;if(m===Qe){Cr(v,S);return}if(m===gi){x(g);return}const E=()=>{s(v),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(g.shapeFlag&1&&A&&!A.persisted){const{leave:$,delayLeave:P}=A,O=()=>$(v,E);P?P(g.el,E,O):O()}else E()},Cr=(g,m)=>{let v;for(;g!==m;)v=d(g),s(g),g=v;s(m)},hr=(g,m,v)=>{const{bum:S,scope:A,job:E,subTree:$,um:P,m:O,a:R}=g;ca(O),ca(R),S&&ps(S),A.stop(),E&&(E.flags|=8,Ke($,g,m,v)),P&&Je(P,m),Je(()=>{g.isUnmounted=!0},m)},it=(g,m,v,S=!1,A=!1,E=0)=>{for(let $=E;$<g.length;$++)Ke(g[$],m,v,S,A)},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[rd];return v?d(v):m};let U=!1;const N=(g,m,v)=>{let S;g==null?m._vnode&&(Ke(m._vnode,null,null,!0),S=m._vnode.component):y(m._vnode||null,g,m,null,null,null,v),m._vnode=g,U||(U=!0,Yo(S),pc(),U=!1)},V={p:y,um:Ke,m:yt,r:Rr,mt:Ae,mc:W,pc:se,pbc:q,n:T,o:t};return{render:N,hydrate:void 0,createApp:Sd(N)}}function pi({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 fr({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Bd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Wc(t,e,r=!1){const n=t.children,s=e.children;if(F(n)&&F(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]=Mt(s[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Wc(o,a)),a.type===Ys&&(a.patchFlag===-1&&(a=s[i]=Mt(a)),a.el=o.el),a.type===Ve&&!a.el&&(a.el=o.el)}}function Md(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 Kc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Kc(e)}function ca(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Gc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Gc(e.subTree):null}const Jc=t=>t.__isSuspense;function Hd(t,e){e&&e.pendingBranch?F(t)?e.effects.push(...t):e.effects.push(t):Yh(t)}const Qe=Symbol.for("v-fgt"),Ys=Symbol.for("v-txt"),Ve=Symbol.for("v-cmt"),gi=Symbol.for("v-stc"),Tn=[];let nt=null;function ae(t=!1){Tn.push(nt=t?null:[])}function qd(){Tn.pop(),nt=Tn[Tn.length-1]||null}let Ln=1;function Ts(t,e=!1){Ln+=t,t<0&&nt&&e&&(nt.hasOnce=!0)}function Yc(t){return t.dynamicChildren=Ln>0?nt||Vr:null,qd(),Ln>0&&nt&&nt.push(t),t}function Ee(t,e,r,n,s,i){return Yc(te(t,e,r,n,s,i,!0))}function Wt(t,e,r,n,s){return Yc(ue(t,e,r,n,s,!0))}function As(t){return t?t.__v_isVNode===!0:!1}function _r(t,e){return t.type===e.type&&t.key===e.key}const Qc=({key:t})=>t??null,ms=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?_e(t)||Se(t)||Y(t)?{i:rt,r:t,k:e,f:!!r}:t:null);function te(t,e=null,r=null,n=0,s=null,i=t===Qe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Qc(e),ref:e&&ms(e),scopeId:mc,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:rt};return a?(Ao(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=_e(r)?8:16),Ln>0&&!o&&nt&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&nt.push(l),l}const ue=Fd;function Fd(t,e=null,r=null,n=0,s=null,i=!1){if((!t||t===Pc)&&(t=Ve),As(t)){const a=lr(t,e,!0);return r&&Ao(a,r),Ln>0&&!i&&nt&&(a.shapeFlag&6?nt[nt.indexOf(t)]=a:nt.push(a)),a.patchFlag=-2,a}if(tf(t)&&(t=t.__vccOpts),e){e=Vd(e);let{class:a,style:l}=e;a&&!_e(a)&&(e.class=Ye(a)),le(l)&&(zs(l)&&!F(l)&&(l=Pe({},l)),e.style=fo(l))}const o=_e(t)?1:Jc(t)?128:bc(t)?64:le(t)?4:Y(t)?2:0;return te(t,e,r,n,s,o,i,!0)}function Vd(t){return t?zs(t)||Mc(t)?Pe({},t):t:null}function lr(t,e,r=!1,n=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?Wd(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&Qc(c),ref:e&&e.ref?r&&i?F(i)?i.concat(ms(e)):[i,ms(e)]:ms(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!==Qe?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&&lr(t.ssContent),ssFallback:t.ssFallback&&lr(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&Nn(u,l.clone(u)),u}function zd(t=" ",e=0){return ue(Ys,null,t,e)}function Ze(t="",e=!1){return e?(ae(),Wt(Ve,null,t)):ue(Ve,null,t)}function Rt(t){return t==null||typeof t=="boolean"?ue(Ve):F(t)?ue(Qe,null,t.slice()):As(t)?Mt(t):ue(Ys,null,String(t))}function Mt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:lr(t)}function Ao(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(F(e))r=16;else if(typeof e=="object")if(n&65){const s=e.default;s&&(s._c&&(s._d=!1),Ao(t,s()),s._c&&(s._d=!0));return}else{r=32;const s=e._;!s&&!Mc(e)?e._ctx=rt:s===3&&rt&&(rt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else Y(e)?(e={default:e,_ctx:rt},r=32):(e=String(e),n&64?(r=16,e=[zd(e)]):r=8);t.children=e,t.shapeFlag|=r}function Wd(...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=Ye([e.class,n.class]));else if(s==="style")e.style=fo([e.style,n.style]);else if(Ds(s)){const i=e[s],o=n[s];o&&i!==o&&!(F(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Us(s)&&(e[s]=o)}else s!==""&&(e[s]=n[s])}return e}function wt(t,e,r,n=null){gt(t,e,7,[r,n])}const Kd=Nc();let Gd=0;function Jd(t,e,r){const n=t.type,s=(e?e.appContext:t.appContext)||Kd,i={uid:Gd++,vnode:t,type:n,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Wl(!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:qc(n,s),emitsOptions:Lc(n,s),emit:null,emitted:null,propsDefaults:ge,inheritAttrs:n.inheritAttrs,ctx:ge,data:ge,props:ge,attrs:ge,slots:ge,refs:ge,setupState:ge,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=Td.bind(null,i),t.ce&&t.ce(i),i}let Ue=null;const xo=()=>Ue||rt;let xs,Mi;{const t=Fs(),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)}};xs=e("__VUE_INSTANCE_SETTERS__",r=>Ue=r),Mi=e("__VUE_SSR_SETTERS__",r=>Dn=r)}const Yn=t=>{const e=Ue;return xs(t),t.scope.on(),()=>{t.scope.off(),xs(e)}},ua=()=>{Ue&&Ue.scope.off(),xs(null)};function Zc(t){return t.vnode.shapeFlag&4}let Dn=!1;function Yd(t,e=!1,r=!1){e&&Mi(e);const{props:n,children:s}=t.vnode,i=Zc(t);Pd(t,n,i,e),Nd(t,s,r||e);const o=i?Qd(t,e):void 0;return e&&Mi(!1),o}function Qd(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,md);const{setup:n}=r;if(n){Gt();const s=t.setupContext=n.length>1?Xd(t):null,i=Yn(t),o=Jn(n,t,0,[t.props,s]),a=Bl(o);if(Jt(),i(),(a||t.sp)&&!Sn(t)&&Tc(t),a){if(o.then(ua,ua),e)return o.then(l=>{ha(t,l)}).catch(l=>{Ws(l,t,0)});t.asyncDep=o}else ha(t,o)}else Xc(t)}function ha(t,e,r){Y(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:le(e)&&(t.setupState=hc(e)),Xc(t)}function Xc(t,e,r){const n=t.type;t.render||(t.render=n.render||Pt);{const s=Yn(t);Gt();try{yd(t)}finally{Jt(),s()}}}const Zd={get(t,e){return De(t,"get",""),t[e]}};function Xd(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,Zd),slots:t.slots,emit:t.emit,expose:e}}function Qs(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(hc(wo(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in En)return En[r](t)},has(e,r){return r in e||r in En}})):t.proxy}function ef(t,e=!0){return Y(t)?t.displayName||t.name:t.name||e&&t.__name}function tf(t){return Y(t)&&"__vccOpts"in t}const Le=(t,e)=>zh(t,e,Dn);function Zr(t,e,r){try{Ts(-1);const n=arguments.length;return n===2?le(e)&&!F(e)?As(e)?ue(t,null,[e]):ue(t,e):ue(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&As(r)&&(r=[r]),ue(t,e,r))}finally{Ts(1)}}const rf="3.5.34";/**
|
|
15
15
|
* @vue/runtime-dom v3.5.34
|
|
16
16
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
17
|
* @license MIT
|
|
18
|
-
**/let Hi;const da=typeof window<"u"&&window.trustedTypes;if(da)try{Hi=da.createPolicy("vue",{createHTML:t=>t})}catch{}const eu=Hi?t=>Hi.createHTML(t):t=>t,nf="http://www.w3.org/2000/svg",sf="http://www.w3.org/1998/Math/MathML",Dt=typeof document<"u"?document:null,fa=Dt&&Dt.createElement("template"),of={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"?Dt.createElementNS(nf,t):e==="mathml"?Dt.createElementNS(sf,t):r?Dt.createElement(t,{is:r}):Dt.createElement(t);return t==="select"&&n&&n.multiple!=null&&s.setAttribute("multiple",n.multiple),s},createText:t=>Dt.createTextNode(t),createComment:t=>Dt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Dt.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{fa.innerHTML=eu(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=fa.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]}},er="transition",cn="animation",Dn=Symbol("_vtc"),tu={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},af=Pe({},_c,tu),lf=t=>(t.displayName="Transition",t.props=af,t),cf=lf((t,{slots:e})=>Qr(id,uf(t),e)),pr=(t,e=[])=>{F(t)?t.forEach(r=>r(...e)):t&&t(...e)},pa=t=>t?F(t)?t.some(e=>e.length>1):t.length>1:!1;function uf(t){const e={};for(const j in t)j in tu||(e[j]=t[j]);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=hf(s),y=p&&p[0],k=p&&p[1],{onBeforeEnter:w,onEnter:b,onEnterCancelled:_,onLeave:x,onLeaveCancelled:D,onBeforeAppear:M=w,onAppear:H=b,onAppearCancelled:W=_}=e,C=(j,X,Ae,Be)=>{j._enterCancelled=Be,gr(j,X?u:a),gr(j,X?c:o),Ae&&Ae()},q=(j,X)=>{j._isLeaving=!1,gr(j,h),gr(j,f),gr(j,d),X&&X()},Q=j=>(X,Ae)=>{const Be=j?H:b,he=()=>C(X,j,Ae);pr(Be,[X,he]),ga(()=>{gr(X,j?l:i),$t(X,j?u:a),pa(Be)||ma(X,n,y,he)})};return Pe(e,{onBeforeEnter(j){pr(w,[j]),$t(j,i),$t(j,o)},onBeforeAppear(j){pr(M,[j]),$t(j,l),$t(j,c)},onEnter:Q(!1),onAppear:Q(!0),onLeave(j,X){j._isLeaving=!0;const Ae=()=>q(j,X);$t(j,h),j._enterCancelled?($t(j,d),ba(j)):(ba(j),$t(j,d)),ga(()=>{j._isLeaving&&(gr(j,h),$t(j,f),pa(x)||ma(j,n,k,Ae))}),pr(x,[j,Ae])},onEnterCancelled(j){C(j,!1,void 0,!0),pr(_,[j])},onAppearCancelled(j){C(j,!0,void 0,!0),pr(W,[j])},onLeaveCancelled(j){q(j),pr(D,[j])}})}function hf(t){if(t==null)return null;if(ae(t))return[mi(t.enter),mi(t.leave)];{const e=mi(t);return[e,e]}}function mi(t){return uh(t)}function $t(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.add(r)),(t[Dn]||(t[Dn]=new Set)).add(e)}function gr(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.remove(n));const r=t[Dn];r&&(r.delete(e),r.size||(t[Dn]=void 0))}function ga(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let df=0;function ma(t,e,r,n){const s=t._endId=++df,i=()=>{s===t._endId&&n()};if(r!=null)return setTimeout(i,r);const{type:o,timeout:a,propCount:l}=ff(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 ff(t,e){const r=window.getComputedStyle(t),n=p=>(r[p]||"").split(", "),s=n(`${er}Delay`),i=n(`${er}Duration`),o=ya(s,i),a=n(`${cn}Delay`),l=n(`${cn}Duration`),c=ya(a,l);let u=null,h=0,d=0;e===er?o>0&&(u=er,h=o,d=i.length):e===cn?c>0&&(u=cn,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?er:cn:null,d=u?u===er?i.length:l.length:0);const f=u===er&&/\b(?:transform|all)(?:,|$)/.test(n(`${er}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function ya(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((r,n)=>va(r)+va(t[n])))}function va(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function ba(t){return(t?t.ownerDocument:document).body.offsetHeight}function pf(t,e,r){const n=t[Dn];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const _a=Symbol("_vod"),gf=Symbol("_vsh"),mf=Symbol(""),yf=/(?:^|;)\s*display\s*:/;function vf(t,e,r){const n=t.style,s=be(r);let i=!1;if(r&&!s){if(e)if(be(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&gn(n,a,"")}else for(const o in e)r[o]==null&&gn(n,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?_f(t,o,!be(e)&&e?e[o]:void 0,a)||gn(n,o,a):gn(n,o,"")}}else if(s){if(e!==r){const o=n[mf];o&&(r+=";"+o),n.cssText=r,i=yf.test(r)}}else e&&t.removeAttribute("style");_a in t&&(t[_a]=i?n.display:"",t[gf]&&(n.display="none"))}const wa=/\s*!important$/;function gn(t,e,r){if(F(r))r.forEach(n=>gn(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const n=bf(t,e);wa.test(r)?t.setProperty(cr(n),r.replace(wa,""),"important"):t[n]=r}}const ka=["Webkit","Moz","ms"],yi={};function bf(t,e){const r=yi[e];if(r)return r;let n=We(e);if(n!=="filter"&&n in t)return yi[e]=n;n=Hs(n);for(let s=0;s<ka.length;s++){const i=ka[s]+n;if(i in t)return yi[e]=i}return e}function _f(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&be(n)&&r===n}const Sa="http://www.w3.org/1999/xlink";function Ea(t,e,r,n,s,i=mh(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(Sa,e.slice(6,e.length)):t.setAttributeNS(Sa,e,r):r==null||i&&!Fl(r)?t.removeAttribute(e):t.setAttribute(e,i?"":ct(r)?String(r):r)}function Ta(t,e,r,n,s){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?eu(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=Fl(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 ir(t,e,r,n){t.addEventListener(e,r,n)}function wf(t,e,r,n){t.removeEventListener(e,r,n)}const Aa=Symbol("_vei");function kf(t,e,r,n,s=null){const i=t[Aa]||(t[Aa]={}),o=i[e];if(n&&o)o.value=n;else{const[a,l]=Sf(e);if(n){const c=i[e]=Af(n,s);ir(t,a,c,l)}else o&&(wf(t,a,o,l),i[e]=void 0)}}const xa=/(?:Once|Passive|Capture)$/;function Sf(t){let e;if(xa.test(t)){e={};let n;for(;n=t.match(xa);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):cr(t.slice(2)),e]}let vi=0;const Ef=Promise.resolve(),Tf=()=>vi||(Ef.then(()=>vi=0),vi=Date.now());function Af(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;gt(xf(n,r.value),e,5,[n])};return r.value=t,r.attached=Tf(),r}function xf(t,e){if(F(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 Ra=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Rf=(t,e,r,n,s,i)=>{const o=s==="svg";e==="class"?pf(t,n,o):e==="style"?vf(t,r,n):Ds(e)?Us(e)||kf(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Cf(t,e,n,o))?(Ta(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ea(t,e,n,o,i,e!=="value")):t._isVueCE&&(Of(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!be(n)))?Ta(t,We(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),Ea(t,e,n,o))};function Cf(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ra(e)&&Y(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 Ra(e)&&be(r)?!1:e in t}function Of(t,e){const r=t._def.props;if(!r)return!1;const n=We(e);return Array.isArray(r)?r.some(s=>We(s)===n):Object.keys(r).some(s=>We(s)===n)}const Zr=t=>{const e=t.props["onUpdate:modelValue"]||!1;return F(e)?r=>fs(e,r):e};function Pf(t){t.target.composing=!0}function Ca(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Kt=Symbol("_assign");function Oa(t,e,r){return e&&(t=t.trim()),r&&(t=qs(t)),t}const If={created(t,{modifiers:{lazy:e,trim:r,number:n}},s){t[Kt]=Zr(s);const i=n||s.props&&s.props.type==="number";ir(t,e?"change":"input",o=>{o.target.composing||t[Kt](Oa(t.value,r,i))}),(r||i)&&ir(t,"change",()=>{t.value=Oa(t.value,r,i)}),e||(ir(t,"compositionstart",Pf),ir(t,"compositionend",Ca),ir(t,"change",Ca))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:n,trim:s,number:i}},o){if(t[Kt]=Zr(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?qs(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)}},Hb={deep:!0,created(t,e,r){t[Kt]=Zr(r),ir(t,"change",()=>{const n=t._modelValue,s=Un(t),i=t.checked,o=t[Kt];if(F(n)){const a=po(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(rn(n)){const a=new Set(n);i?a.add(s):a.delete(s),o(a)}else o(ru(t,i))})},mounted:Pa,beforeUpdate(t,e,r){t[Kt]=Zr(r),Pa(t,e,r)}};function Pa(t,{value:e,oldValue:r},n){t._modelValue=e;let s;if(F(e))s=po(e,n.props.value)>-1;else if(rn(e))s=e.has(n.props.value);else{if(e===r)return;s=nn(e,ru(t,!0))}t.checked!==s&&(t.checked=s)}const qb={deep:!0,created(t,{value:e,modifiers:{number:r}},n){const s=rn(e);ir(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?qs(Un(o)):Un(o));t[Kt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,Yr(()=>{t._assigning=!1})}),t[Kt]=Zr(n)},mounted(t,{value:e}){Ia(t,e)},beforeUpdate(t,e,r){t[Kt]=Zr(r)},updated(t,{value:e}){t._assigning||Ia(t,e)}};function Ia(t,e){const r=t.multiple,n=F(e);if(!(r&&!n&&!rn(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],a=Un(o);if(r)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=po(e,a)>-1}else o.selected=e.has(a);else if(nn(Un(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function Un(t){return"_value"in t?t._value:t.value}function ru(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const jf=["ctrl","shift","alt","meta"],$f={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)=>jf.some(r=>t[`${r}Key`]&&!e.includes(r))},Fb=(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=$f[e[o]];if(a&&a(s,e))return}return t(s,...i)}))},Nf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Vb=(t,e)=>{const r=t._withKeys||(t._withKeys={}),n=e.join(".");return r[n]||(r[n]=(s=>{if(!("key"in s))return;const i=cr(s.key);if(e.some(o=>o===i||Nf[o]===i))return t(s)}))},Lf=Pe({patchProp:Rf},of);let ja;function Df(){return ja||(ja=Dd(Lf))}const Uf=((...t)=>{const e=Df().createApp(...t),{mount:r}=e;return e.mount=n=>{const s=Mf(n);if(!s)return;const i=e._component;!Y(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=r(s,!1,Bf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function Bf(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Mf(t){return be(t)?document.querySelector(t):t}/*!
|
|
18
|
+
**/let Hi;const da=typeof window<"u"&&window.trustedTypes;if(da)try{Hi=da.createPolicy("vue",{createHTML:t=>t})}catch{}const eu=Hi?t=>Hi.createHTML(t):t=>t,nf="http://www.w3.org/2000/svg",sf="http://www.w3.org/1998/Math/MathML",Dt=typeof document<"u"?document:null,fa=Dt&&Dt.createElement("template"),of={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"?Dt.createElementNS(nf,t):e==="mathml"?Dt.createElementNS(sf,t):r?Dt.createElement(t,{is:r}):Dt.createElement(t);return t==="select"&&n&&n.multiple!=null&&s.setAttribute("multiple",n.multiple),s},createText:t=>Dt.createTextNode(t),createComment:t=>Dt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Dt.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{fa.innerHTML=eu(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=fa.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]}},er="transition",un="animation",Un=Symbol("_vtc"),tu={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},af=Pe({},_c,tu),lf=t=>(t.displayName="Transition",t.props=af,t),cf=lf((t,{slots:e})=>Zr(id,uf(t),e)),pr=(t,e=[])=>{F(t)?t.forEach(r=>r(...e)):t&&t(...e)},pa=t=>t?F(t)?t.some(e=>e.length>1):t.length>1:!1;function uf(t){const e={};for(const j in t)j in tu||(e[j]=t[j]);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=hf(s),y=p&&p[0],k=p&&p[1],{onBeforeEnter:w,onEnter:b,onEnterCancelled:_,onLeave:x,onLeaveCancelled:D,onBeforeAppear:M=w,onAppear:H=b,onAppearCancelled:W=_}=e,C=(j,X,Ae,Be)=>{j._enterCancelled=Be,gr(j,X?u:a),gr(j,X?c:o),Ae&&Ae()},q=(j,X)=>{j._isLeaving=!1,gr(j,h),gr(j,f),gr(j,d),X&&X()},Q=j=>(X,Ae)=>{const Be=j?H:b,de=()=>C(X,j,Ae);pr(Be,[X,de]),ga(()=>{gr(X,j?l:i),$t(X,j?u:a),pa(Be)||ma(X,n,y,de)})};return Pe(e,{onBeforeEnter(j){pr(w,[j]),$t(j,i),$t(j,o)},onBeforeAppear(j){pr(M,[j]),$t(j,l),$t(j,c)},onEnter:Q(!1),onAppear:Q(!0),onLeave(j,X){j._isLeaving=!0;const Ae=()=>q(j,X);$t(j,h),j._enterCancelled?($t(j,d),ba(j)):(ba(j),$t(j,d)),ga(()=>{j._isLeaving&&(gr(j,h),$t(j,f),pa(x)||ma(j,n,k,Ae))}),pr(x,[j,Ae])},onEnterCancelled(j){C(j,!1,void 0,!0),pr(_,[j])},onAppearCancelled(j){C(j,!0,void 0,!0),pr(W,[j])},onLeaveCancelled(j){q(j),pr(D,[j])}})}function hf(t){if(t==null)return null;if(le(t))return[mi(t.enter),mi(t.leave)];{const e=mi(t);return[e,e]}}function mi(t){return uh(t)}function $t(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.add(r)),(t[Un]||(t[Un]=new Set)).add(e)}function gr(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.remove(n));const r=t[Un];r&&(r.delete(e),r.size||(t[Un]=void 0))}function ga(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let df=0;function ma(t,e,r,n){const s=t._endId=++df,i=()=>{s===t._endId&&n()};if(r!=null)return setTimeout(i,r);const{type:o,timeout:a,propCount:l}=ff(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 ff(t,e){const r=window.getComputedStyle(t),n=p=>(r[p]||"").split(", "),s=n(`${er}Delay`),i=n(`${er}Duration`),o=ya(s,i),a=n(`${un}Delay`),l=n(`${un}Duration`),c=ya(a,l);let u=null,h=0,d=0;e===er?o>0&&(u=er,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?er:un:null,d=u?u===er?i.length:l.length:0);const f=u===er&&/\b(?:transform|all)(?:,|$)/.test(n(`${er}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function ya(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((r,n)=>va(r)+va(t[n])))}function va(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function ba(t){return(t?t.ownerDocument:document).body.offsetHeight}function pf(t,e,r){const n=t[Un];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const _a=Symbol("_vod"),gf=Symbol("_vsh"),mf=Symbol(""),yf=/(?:^|;)\s*display\s*:/;function vf(t,e,r){const n=t.style,s=_e(r);let i=!1;if(r&&!s){if(e)if(_e(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&mn(n,a,"")}else for(const o in e)r[o]==null&&mn(n,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?_f(t,o,!_e(e)&&e?e[o]:void 0,a)||mn(n,o,a):mn(n,o,"")}}else if(s){if(e!==r){const o=n[mf];o&&(r+=";"+o),n.cssText=r,i=yf.test(r)}}else e&&t.removeAttribute("style");_a in t&&(t[_a]=i?n.display:"",t[gf]&&(n.display="none"))}const wa=/\s*!important$/;function mn(t,e,r){if(F(r))r.forEach(n=>mn(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const n=bf(t,e);wa.test(r)?t.setProperty(cr(n),r.replace(wa,""),"important"):t[n]=r}}const ka=["Webkit","Moz","ms"],yi={};function bf(t,e){const r=yi[e];if(r)return r;let n=We(e);if(n!=="filter"&&n in t)return yi[e]=n;n=Hs(n);for(let s=0;s<ka.length;s++){const i=ka[s]+n;if(i in t)return yi[e]=i}return e}function _f(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&_e(n)&&r===n}const Sa="http://www.w3.org/1999/xlink";function Ea(t,e,r,n,s,i=mh(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(Sa,e.slice(6,e.length)):t.setAttributeNS(Sa,e,r):r==null||i&&!Fl(r)?t.removeAttribute(e):t.setAttribute(e,i?"":ct(r)?String(r):r)}function Ta(t,e,r,n,s){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?eu(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=Fl(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 ir(t,e,r,n){t.addEventListener(e,r,n)}function wf(t,e,r,n){t.removeEventListener(e,r,n)}const Aa=Symbol("_vei");function kf(t,e,r,n,s=null){const i=t[Aa]||(t[Aa]={}),o=i[e];if(n&&o)o.value=n;else{const[a,l]=Sf(e);if(n){const c=i[e]=Af(n,s);ir(t,a,c,l)}else o&&(wf(t,a,o,l),i[e]=void 0)}}const xa=/(?:Once|Passive|Capture)$/;function Sf(t){let e;if(xa.test(t)){e={};let n;for(;n=t.match(xa);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):cr(t.slice(2)),e]}let vi=0;const Ef=Promise.resolve(),Tf=()=>vi||(Ef.then(()=>vi=0),vi=Date.now());function Af(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;gt(xf(n,r.value),e,5,[n])};return r.value=t,r.attached=Tf(),r}function xf(t,e){if(F(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 Ra=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Rf=(t,e,r,n,s,i)=>{const o=s==="svg";e==="class"?pf(t,n,o):e==="style"?vf(t,r,n):Ds(e)?Us(e)||kf(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Cf(t,e,n,o))?(Ta(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ea(t,e,n,o,i,e!=="value")):t._isVueCE&&(Of(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!_e(n)))?Ta(t,We(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),Ea(t,e,n,o))};function Cf(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ra(e)&&Y(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 Ra(e)&&_e(r)?!1:e in t}function Of(t,e){const r=t._def.props;if(!r)return!1;const n=We(e);return Array.isArray(r)?r.some(s=>We(s)===n):Object.keys(r).some(s=>We(s)===n)}const Xr=t=>{const e=t.props["onUpdate:modelValue"]||!1;return F(e)?r=>ps(e,r):e};function Pf(t){t.target.composing=!0}function Ca(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Kt=Symbol("_assign");function Oa(t,e,r){return e&&(t=t.trim()),r&&(t=qs(t)),t}const If={created(t,{modifiers:{lazy:e,trim:r,number:n}},s){t[Kt]=Xr(s);const i=n||s.props&&s.props.type==="number";ir(t,e?"change":"input",o=>{o.target.composing||t[Kt](Oa(t.value,r,i))}),(r||i)&&ir(t,"change",()=>{t.value=Oa(t.value,r,i)}),e||(ir(t,"compositionstart",Pf),ir(t,"compositionend",Ca),ir(t,"change",Ca))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:n,trim:s,number:i}},o){if(t[Kt]=Xr(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?qs(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)}},Wb={deep:!0,created(t,e,r){t[Kt]=Xr(r),ir(t,"change",()=>{const n=t._modelValue,s=Bn(t),i=t.checked,o=t[Kt];if(F(n)){const a=po(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(ru(t,i))})},mounted:Pa,beforeUpdate(t,e,r){t[Kt]=Xr(r),Pa(t,e,r)}};function Pa(t,{value:e,oldValue:r},n){t._modelValue=e;let s;if(F(e))s=po(e,n.props.value)>-1;else if(nn(e))s=e.has(n.props.value);else{if(e===r)return;s=sn(e,ru(t,!0))}t.checked!==s&&(t.checked=s)}const Kb={deep:!0,created(t,{value:e,modifiers:{number:r}},n){const s=nn(e);ir(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?qs(Bn(o)):Bn(o));t[Kt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,Qr(()=>{t._assigning=!1})}),t[Kt]=Xr(n)},mounted(t,{value:e}){Ia(t,e)},beforeUpdate(t,e,r){t[Kt]=Xr(r)},updated(t,{value:e}){t._assigning||Ia(t,e)}};function Ia(t,e){const r=t.multiple,n=F(e);if(!(r&&!n&&!nn(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],a=Bn(o);if(r)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=po(e,a)>-1}else o.selected=e.has(a);else if(sn(Bn(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function Bn(t){return"_value"in t?t._value:t.value}function ru(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const jf=["ctrl","shift","alt","meta"],$f={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)=>jf.some(r=>t[`${r}Key`]&&!e.includes(r))},Gb=(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=$f[e[o]];if(a&&a(s,e))return}return t(s,...i)}))},Nf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Jb=(t,e)=>{const r=t._withKeys||(t._withKeys={}),n=e.join(".");return r[n]||(r[n]=(s=>{if(!("key"in s))return;const i=cr(s.key);if(e.some(o=>o===i||Nf[o]===i))return t(s)}))},Lf=Pe({patchProp:Rf},of);let ja;function Df(){return ja||(ja=Dd(Lf))}const Uf=((...t)=>{const e=Df().createApp(...t),{mount:r}=e;return e.mount=n=>{const s=Mf(n);if(!s)return;const i=e._component;!Y(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=r(s,!1,Bf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function Bf(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Mf(t){return _e(t)?document.querySelector(t):t}/*!
|
|
19
19
|
* pinia v3.0.4
|
|
20
20
|
* (c) 2025 Eduardo San Martin Morote
|
|
21
21
|
* @license MIT
|
|
22
|
-
*/let nu;const Zs=t=>nu=t,su=Symbol();function qi(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var
|
|
22
|
+
*/let nu;const Zs=t=>nu=t,su=Symbol();function qi(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var An;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(An||(An={}));function Hf(){const t=Kl(!0),e=t.run(()=>tt({}));let r=[],n=[];const s=wo({install(i){Zs(s),s._a=i,i.provide(su,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 iu=()=>{};function $a(t,e,r,n=iu){t.add(e);const s=()=>{t.delete(e)&&n()};return!r&&Gl()&&vh(s),s}function Pr(t,...e){t.forEach(r=>{r(...e)})}const qf=t=>t(),Na=Symbol(),bi=Symbol();function Fi(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];qi(s)&&qi(n)&&t.hasOwnProperty(r)&&!Se(n)&&!zt(n)?t[r]=Fi(s,n):t[r]=n}return t}const Ff=Symbol();function Vf(t){return!qi(t)||!Object.prototype.hasOwnProperty.call(t,Ff)}const{assign:rr}=Object;function zf(t){return!!(Se(t)&&t.effect)}function Wf(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=Hh(r.state.value[t]);return rr(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=wo(Le(()=>{Zs(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=ou(t,c,e,r,n,!0),l}function ou(t,e,r={},n,s,i){let o;const a=rr({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 k(W){let C;c=u=!1,typeof W=="function"?(W(n.state.value[t]),C={type:An.patchFunction,storeId:t,events:f}):(Fi(n.state.value[t],W),C={type:An.patchObject,payload:W,storeId:t,events:f});const q=y=Symbol();Qr().then(()=>{y===q&&(c=!0)}),u=!0,Pr(h,C,n.state.value[t])}const w=i?function(){const{state:C}=r,q=C?C():{};this.$patch(Q=>{rr(Q,q)})}:iu;function b(){o.stop(),h.clear(),d.clear(),n._s.delete(t)}const _=(W,C="")=>{if(Na in W)return W[bi]=C,W;const q=function(){Zs(n);const Q=Array.from(arguments),j=new Set,X=new Set;function Ae(Z){j.add(Z)}function Be(Z){X.add(Z)}Pr(d,{args:Q,name:q[bi],store:D,after:Ae,onError:Be});let de;try{de=W.apply(this&&this.$id===t?this:D,Q)}catch(Z){throw Pr(X,Z),Z}return de instanceof Promise?de.then(Z=>(Pr(j,Z),Z)).catch(Z=>(Pr(X,Z),Promise.reject(Z))):(Pr(j,de),de)};return q[Na]=!0,q[bi]=C,q},x={_p:n,$id:t,$onAction:$a.bind(null,d),$patch:k,$reset:w,$subscribe(W,C={}){const q=$a(h,W,C.detached,()=>Q()),Q=o.run(()=>Er(()=>n.state.value[t],j=>{(C.flush==="sync"?u:c)&&W({storeId:t,type:An.direct,events:f},j)},rr({},l,C)));return q},$dispose:b},D=Gn(x);n._s.set(t,D);const H=(n._a&&n._a.runWithContext||qf)(()=>n._e.run(()=>(o=Kl()).run(()=>e({action:_}))));for(const W in H){const C=H[W];if(Se(C)&&!zf(C)||zt(C))i||(p&&Vf(C)&&(Se(C)?C.value=p[W]:Fi(C,p[W])),n.state.value[t][W]=C);else if(typeof C=="function"){const q=_(C,W);H[W]=q,a.actions[W]=C}}return rr(D,H),rr(re(D),H),Object.defineProperty(D,"$state",{get:()=>n.state.value[t],set:W=>{k(C=>{rr(C,W)})}}),n._p.forEach(W=>{rr(D,o.run(()=>W({store:D,app:n._a,pinia:n,options:a})))}),p&&i&&r.hydrate&&r.hydrate(D.$state,p),c=!0,u=!0,D}/*! #__NO_SIDE_EFFECTS__ */function au(t,e,r){let n;const s=typeof e=="function";n=s?r:e;function i(o,a){const l=Zh();return o=o||(l?lt(su,null):null),o&&Zs(o),o=nu,o._s.has(t)||(s?ou(t,e,n,o):Wf(t,n,o)),o._s.get(t)}return i.$id=t,i}/*!
|
|
23
23
|
* vue-router v4.6.4
|
|
24
24
|
* (c) 2025 Eduardo San Martin Morote
|
|
25
25
|
* @license MIT
|
|
26
|
-
*/const Ur=typeof document<"u";function lu(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Kf(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&lu(t.default)}const
|
|
26
|
+
*/const Ur=typeof document<"u";function lu(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Kf(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&lu(t.default)}const ie=Object.assign;function _i(t,e){const r={};for(const n in e){const s=e[n];r[n]=mt(s)?s.map(t):t(s)}return r}const xn=()=>{},mt=Array.isArray;function La(t,e){const r={};for(const n in t)r[n]=n in e?e[n]:t[n];return r}const cu=/#/g,Gf=/&/g,Jf=/\//g,Yf=/=/g,Qf=/\?/g,uu=/\+/g,Zf=/%5B/g,Xf=/%5D/g,hu=/%5E/g,ep=/%60/g,du=/%7B/g,tp=/%7C/g,fu=/%7D/g,rp=/%20/g;function Ro(t){return t==null?"":encodeURI(""+t).replace(tp,"|").replace(Zf,"[").replace(Xf,"]")}function np(t){return Ro(t).replace(du,"{").replace(fu,"}").replace(hu,"^")}function Vi(t){return Ro(t).replace(uu,"%2B").replace(rp,"+").replace(cu,"%23").replace(Gf,"%26").replace(ep,"`").replace(du,"{").replace(fu,"}").replace(hu,"^")}function sp(t){return Vi(t).replace(Yf,"%3D")}function ip(t){return Ro(t).replace(cu,"%23").replace(Qf,"%3F")}function op(t){return ip(t).replace(Jf,"%2F")}function Mn(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const ap=/\/$/,lp=t=>t.replace(ap,"");function wi(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=dp(n??e,r),{fullPath:n+i+o,path:n,query:s,hash:Mn(o)}}function cp(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function Da(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function up(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])&&pu(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 pu(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!hp(t[r],e[r]))return!1;return!0}function hp(t,e){return mt(t)?Ua(t,e):mt(e)?Ua(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function Ua(t,e){return mt(e)?t.length===e.length&&t.every((r,n)=>r===e[n]):t.length===1&&t[0]===e}function dp(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 tr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let zi=(function(t){return t.pop="pop",t.push="push",t})({}),ki=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function fp(t){if(!t)if(Ur){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),lp(t)}const pp=/^[^#]+#/;function gp(t,e){return t.replace(pp,"#")+e}function mp(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 Xs=()=>({left:window.scrollX,top:window.scrollY});function yp(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=mp(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 Ba(t,e){return(history.state?history.state.position-e:-1)+t}const Wi=new Map;function vp(t,e){Wi.set(t,e)}function bp(t){const e=Wi.get(t);return Wi.delete(t),e}function _p(t){return typeof t=="string"||t&&typeof t=="object"}function gu(t){return typeof t=="string"||typeof t=="symbol"}let we=(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 mu=Symbol("");we.MATCHER_NOT_FOUND+"",we.NAVIGATION_GUARD_REDIRECT+"",we.NAVIGATION_ABORTED+"",we.NAVIGATION_CANCELLED+"",we.NAVIGATION_DUPLICATED+"";function tn(t,e){return ie(new Error,{type:t,[mu]:!0},e)}function Nt(t,e){return t instanceof Error&&mu in t&&(e==null||!!(t.type&e))}const wp=["params","query","hash"];function kp(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of wp)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Sp(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(uu," "),i=s.indexOf("="),o=Mn(i<0?s:s.slice(0,i)),a=i<0?null:Mn(s.slice(i+1));if(o in e){let l=e[o];mt(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function Ma(t){let e="";for(let r in t){const n=t[r];if(r=sp(r),n==null){n!==void 0&&(e+=(e.length?"&":"")+r);continue}(mt(n)?n.map(s=>s&&Vi(s)):[n&&Vi(n)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+r,s!=null&&(e+="="+s))})}return e}function Ep(t){const e={};for(const r in t){const n=t[r];n!==void 0&&(e[r]=mt(n)?n.map(s=>s==null?null:""+s):n==null?n:""+n)}return e}const Tp=Symbol(""),Ha=Symbol(""),ei=Symbol(""),Co=Symbol(""),Ki=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 sr(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(we.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):_p(d)?l(tn(we.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 Si(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(lu(l)){const c=(l.__vccOpts||l)[e];c&&i.push(sr(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=Kf(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&sr(d,r,n,o,a,s)()}))}}return i}function Ap(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
27
|
* vue-router v4.6.4
|
|
28
28
|
* (c) 2025 Eduardo San Martin Morote
|
|
29
29
|
* @license MIT
|
|
30
|
-
*/let xp=()=>location.protocol+"//"+location.host;function yu(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),Da(a,"")}return Da(r,t)+n+s}function Rp(t,e,r,n){let s=[],i=[],o=null;const a=({state:d})=>{const f=yu(t,location),p=r.value,y=e.value;let k=0;if(d){if(r.value=f,e.value=d,o&&o===p){o=null;return}k=y?d.position-y.position:0}else n(f);s.forEach(w=>{w(r.value,p,{delta:k,type:zi.pop,direction:k?k>0?ki.forward:ki.back:ki.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(se({},d.state,{scroll:Xs()}),"")}}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 qa(t,e,r,n=!1,s=!1){return{back:t,current:e,forward:r,replaced:n,position:window.history.length,scroll:s?Xs():null}}function Cp(t){const{history:e,location:r}=window,n={value:yu(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:xp()+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,se({},e.state,qa(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),n.value=l}function a(l,c){const u=se({},s.value,e.state,{forward:l,scroll:Xs()});i(u.current,u,!0),i(l,se({},qa(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:s,push:a,replace:o}}function Op(t){t=fp(t);const e=Cp(t),r=Rp(t,e.state,e.location,e.replace);function n(i,o=!0){o||r.pauseListeners(),history.go(i)}const s=se({location:"",base:t,go:n,createHref:gp.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 wr=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Ce=(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})(Ce||{});const Pp={type:wr.Static,value:""},Ip=/[a-zA-Z0-9_]/;function jp(t){if(!t)return[[]];if(t==="/")return[[Pp]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=Ce.Static,n=r;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===Ce.Static?i.push({type:wr.Static,value:c}):r===Ce.Param||r===Ce.ParamRegExp||r===Ce.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:wr.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!==Ce.ParamRegExp){n=r,r=Ce.EscapeNext;continue}switch(r){case Ce.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=Ce.Param):d();break;case Ce.EscapeNext:d(),r=n;break;case Ce.Param:l==="("?r=Ce.ParamRegExp:Ip.test(l)?d():(h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ce.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=Ce.ParamRegExpEnd:u+=l;break;case Ce.ParamRegExpEnd:h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===Ce.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Fa="[^/]+?",$p={sensitive:!1,strict:!1,start:!0,end:!0};var qe=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(qe||{});const Np=/[.+*?^${}()[\]/\\]/g;function Lp(t,e){const r=se({},$p,e),n=[];let s=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[qe.Root];r.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=qe.Segment+(r.sensitive?qe.BonusCaseSensitive:0);if(d.type===wr.Static)h||(s+="/"),s+=d.value.replace(Np,"\\$&"),f+=qe.Static;else if(d.type===wr.Param){const{value:p,repeatable:y,optional:k,regexp:w}=d;i.push({name:p,repeatable:y,optional:k});const b=w||Fa;if(b!==Fa){f+=qe.BonusCustomRegExp;try{`${b}`}catch(x){throw new Error(`Invalid custom RegExp for param "${p}" (${b}): `+x.message)}}let _=y?`((?:${b})(?:/(?:${b}))*)`:`(${b})`;h||(_=k&&c.length<2?`(?:/${_})`:"/"+_),k&&(_+="?"),s+=_,f+=qe.Dynamic,k&&(f+=qe.BonusOptional),y&&(f+=qe.BonusRepeatable),b===".*"&&(f+=qe.BonusWildcard)}u.push(f)}n.push(u)}if(r.strict&&r.end){const c=n.length-1;n[c][n[c].length-1]+=qe.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===wr.Static)u+=f.value;else if(f.type===wr.Param){const{value:p,repeatable:y,optional:k}=f,w=p in c?c[p]:"";if(mt(w)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const b=mt(w)?w.join("/"):w;if(!b)if(k)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=b}}return u||"/"}return{re:o,score:n,keys:i,parse:a,stringify:l}}function Dp(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]===qe.Static+qe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===qe.Static+qe.Segment?1:-1:0}function vu(t,e){let r=0;const n=t.score,s=e.score;for(;r<n.length&&r<s.length;){const i=Dp(n[r],s[r]);if(i)return i;r++}if(Math.abs(s.length-n.length)===1){if(Va(n))return 1;if(Va(s))return-1}return s.length-n.length}function Va(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Up={strict:!1,end:!0,sensitive:!1};function Bp(t,e,r){const n=Lp(jp(t.path),r),s=se(n,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function Mp(t,e){const r=[],n=new Map;e=La(Up,e);function s(h){return n.get(h)}function i(h,d,f){const p=!f,y=Wa(h);y.aliasOf=f&&f.record;const k=La(e,h),w=[y];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const D of x)w.push(Wa(se({},y,{components:f?f.record.components:y.components,path:D,aliasOf:f?f.record:y})))}let b,_;for(const x of w){const{path:D}=x;if(d&&D[0]!=="/"){const M=d.record.path,H=M[M.length-1]==="/"?"":"/";x.path=d.record.path+(D&&H+D)}if(b=Bp(x,d,k),f?f.alias.push(b):(_=_||b,_!==b&&_.alias.push(b),p&&h.name&&!Ka(b)&&o(h.name)),bu(b)&&l(b),y.children){const M=y.children;for(let H=0;H<M.length;H++)i(M[H],b,f&&f.children[H])}f=f||b}return _?()=>{o(_)}:An}function o(h){if(gu(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=Fp(h,r);r.splice(d,0,h),h.record.name&&!Ka(h)&&n.set(h.record.name,h)}function c(h,d){let f,p={},y,k;if("name"in h&&h.name){if(f=n.get(h.name),!f)throw en(we.MATCHER_NOT_FOUND,{location:h});k=f.record.name,p=se(za(d.params,f.keys.filter(_=>!_.optional).concat(f.parent?f.parent.keys.filter(_=>_.optional):[]).map(_=>_.name)),h.params&&za(h.params,f.keys.map(_=>_.name))),y=f.stringify(p)}else if(h.path!=null)y=h.path,f=r.find(_=>_.re.test(y)),f&&(p=f.parse(y),k=f.record.name);else{if(f=d.name?n.get(d.name):r.find(_=>_.re.test(d.path)),!f)throw en(we.MATCHER_NOT_FOUND,{location:h,currentLocation:d});k=f.record.name,p=se({},d.params,h.params),y=f.stringify(p)}const w=[];let b=f;for(;b;)w.unshift(b.record),b=b.parent;return{name:k,path:y,params:p,matched:w,meta:qp(w)}}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 za(t,e){const r={};for(const n of e)n in t&&(r[n]=t[n]);return r}function Wa(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Hp(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 Hp(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 Ka(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function qp(t){return t.reduce((e,r)=>se(e,r.meta),{})}function Fp(t,e){let r=0,n=e.length;for(;r!==n;){const i=r+n>>1;vu(t,e[i])<0?n=i:r=i+1}const s=Vp(t);return s&&(n=e.lastIndexOf(s,n-1)),n}function Vp(t){let e=t;for(;e=e.parent;)if(bu(e)&&vu(t,e)===0)return e}function bu({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Ga(t){const e=lt(ei),r=lt(Co),n=Ue(()=>{const l=_e(t.to);return e.resolve(l)}),s=Ue(()=>{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(Xr.bind(null,u));if(d>-1)return d;const f=Ja(l[c-2]);return c>1&&Ja(u)===f&&h[h.length-1].path!==f?h.findIndex(Xr.bind(null,l[c-2])):d}),i=Ue(()=>s.value>-1&&Jp(r.params,n.value.params)),o=Ue(()=>s.value>-1&&s.value===r.matched.length-1&&pu(r.params,n.value.params));function a(l={}){if(Gp(l)){const c=e[_e(t.replace)?"replace":"push"](_e(t.to)).catch(An);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:Ue(()=>n.value.href),isActive:i,isExactActive:o,navigate:a}}function zp(t){return t.length===1?t[0]:t}const Wp=ur({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:Ga,setup(t,{slots:e}){const r=Kn(Ga(t)),{options:n}=lt(ei),s=Ue(()=>({[Ya(t.activeClass,n.linkActiveClass,"router-link-active")]:r.isActive,[Ya(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&zp(e.default(r));return t.custom?i:Qr("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:s.value},i)}}}),Kp=Wp;function Gp(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 Jp(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(!mt(s)||s.length!==n.length||n.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Ja(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ya=(t,e,r)=>t??e??r,Yp=ur({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const n=lt(Ki),s=Ue(()=>t.route||n.value),i=lt(Ha,0),o=Ue(()=>{let c=_e(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Ue(()=>s.value.matched[o.value]);gs(Ha,Ue(()=>o.value+1)),gs(Tp,a),gs(Ki,s);const l=et();return Er(()=>[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||!Xr(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 Qa(r.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,k=Qr(d,se({},p,e,{onVnodeUnmounted:w=>{w.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Qa(r.default,{Component:k,route:c})||k}}});function Qa(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const Qp=Yp;function Zp(t){const e=Mp(t.routes,t),r=t.parseQuery||Sp,n=t.stringifyQuery||Ma,s=t.history,i=un(),o=un(),a=un(),l=Uh(tr);let c=tr;Ur&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=_i.bind(null,T=>""+T),h=_i.bind(null,op),d=_i.bind(null,Bn);function f(T,U){let N,V;return gu(T)?(N=e.getRecordMatcher(T),V=U):V=T,e.addRoute(V,N)}function p(T){const U=e.getRecordMatcher(T);U&&e.removeRoute(U)}function y(){return e.getRoutes().map(T=>T.record)}function k(T){return!!e.getRecordMatcher(T)}function w(T,U){if(U=se({},U||l.value),typeof T=="string"){const v=wi(r,T,U.path),S=e.resolve({path:v.path},U),A=s.createHref(v.fullPath);return se(v,S,{params:d(S.params),hash:Bn(v.hash),redirectedFrom:void 0,href:A})}let N;if(T.path!=null)N=se({},T,{path:wi(r,T.path,U.path).path});else{const v=se({},T.params);for(const S in v)v[S]==null&&delete v[S];N=se({},T,{params:h(v)}),U.params=h(U.params)}const V=e.resolve(N,U),ee=T.hash||"";V.params=u(d(V.params));const g=cp(n,se({},T,{hash:np(ee),path:V.path})),m=s.createHref(g);return se({fullPath:g,hash:ee,query:n===Ma?Ep(T.query):T.query||{}},V,{redirectedFrom:void 0,href:m})}function b(T){return typeof T=="string"?wi(r,T,l.value.path):se({},T)}function _(T,U){if(c!==T)return en(we.NAVIGATION_CANCELLED,{from:U,to:T})}function x(T){return H(T)}function D(T){return x(se(b(T),{replace:!0}))}function M(T,U){const N=T.matched[T.matched.length-1];if(N&&N.redirect){const{redirect:V}=N;let ee=typeof V=="function"?V(T,U):V;return typeof ee=="string"&&(ee=ee.includes("?")||ee.includes("#")?ee=b(ee):{path:ee},ee.params={}),se({query:T.query,hash:T.hash,params:ee.path!=null?{}:T.params},ee)}}function H(T,U){const N=c=w(T),V=l.value,ee=T.state,g=T.force,m=T.replace===!0,v=M(N,V);if(v)return H(se(b(v),{state:typeof v=="object"?se({},ee,v.state):ee,force:g,replace:m}),U||N);const S=N;S.redirectedFrom=U;let A;return!g&&up(n,V,N)&&(A=en(we.NAVIGATION_DUPLICATED,{to:S,from:V}),yt(V,V,!0,!1)),(A?Promise.resolve(A):q(S,V)).catch(E=>Nt(E)?Nt(E,we.NAVIGATION_GUARD_REDIRECT)?E:Xt(E):ne(E,S,V)).then(E=>{if(E){if(Nt(E,we.NAVIGATION_GUARD_REDIRECT))return H(se({replace:m},b(E.to),{state:typeof E.to=="object"?se({},ee,E.to.state):ee,force:g}),U||S)}else E=j(S,V,!0,m,ee);return Q(S,V,E),E})}function W(T,U){const N=_(T,U);return N?Promise.reject(N):Promise.resolve()}function C(T){const U=Cr.values().next().value;return U&&typeof U.runWithContext=="function"?U.runWithContext(T):T()}function q(T,U){let N;const[V,ee,g]=Ap(T,U);N=Si(V.reverse(),"beforeRouteLeave",T,U);for(const v of V)v.leaveGuards.forEach(S=>{N.push(sr(S,T,U))});const m=W.bind(null,T,U);return N.push(m),st(N).then(()=>{N=[];for(const v of i.list())N.push(sr(v,T,U));return N.push(m),st(N)}).then(()=>{N=Si(ee,"beforeRouteUpdate",T,U);for(const v of ee)v.updateGuards.forEach(S=>{N.push(sr(S,T,U))});return N.push(m),st(N)}).then(()=>{N=[];for(const v of g)if(v.beforeEnter)if(mt(v.beforeEnter))for(const S of v.beforeEnter)N.push(sr(S,T,U));else N.push(sr(v.beforeEnter,T,U));return N.push(m),st(N)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),N=Si(g,"beforeRouteEnter",T,U,C),N.push(m),st(N))).then(()=>{N=[];for(const v of o.list())N.push(sr(v,T,U));return N.push(m),st(N)}).catch(v=>Nt(v,we.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function Q(T,U,N){a.list().forEach(V=>C(()=>V(T,U,N)))}function j(T,U,N,V,ee){const g=_(T,U);if(g)return g;const m=U===tr,v=Ur?history.state:{};N&&(V||m?s.replace(T.fullPath,se({scroll:m&&v&&v.scroll},ee)):s.push(T.fullPath,ee)),l.value=T,yt(T,U,N,m),Xt()}let X;function Ae(){X||(X=s.listen((T,U,N)=>{if(!hr.listening)return;const V=w(T),ee=M(V,hr.currentRoute.value);if(ee){H(se(ee,{replace:!0,force:!0}),V).catch(An);return}c=V;const g=l.value;Ur&&vp(Ba(g.fullPath,N.delta),Xs()),q(V,g).catch(m=>Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_CANCELLED)?m:Nt(m,we.NAVIGATION_GUARD_REDIRECT)?(H(se(b(m.to),{force:!0}),V).then(v=>{Nt(v,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&!N.delta&&N.type===zi.pop&&s.go(-1,!1)}).catch(An),Promise.reject()):(N.delta&&s.go(-N.delta,!1),ne(m,V,g))).then(m=>{m=m||j(V,g,!1),m&&(N.delta&&!Nt(m,we.NAVIGATION_CANCELLED)?s.go(-N.delta,!1):N.type===zi.pop&&Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),Q(V,g,m)}).catch(An)}))}let Be=un(),he=un(),Z;function ne(T,U,N){Xt(T);const V=he.list();return V.length?V.forEach(ee=>ee(T,U,N)):console.error(T),Promise.reject(T)}function It(){return Z&&l.value!==tr?Promise.resolve():new Promise((T,U)=>{Be.add([T,U])})}function Xt(T){return Z||(Z=!T,Ae(),Be.list().forEach(([U,N])=>T?N(T):U()),Be.reset()),T}function yt(T,U,N,V){const{scrollBehavior:ee}=t;if(!Ur||!ee)return Promise.resolve();const g=!N&&bp(Ba(T.fullPath,0))||(V||!N)&&history.state&&history.state.scroll||null;return Yr().then(()=>ee(T,U,g)).then(m=>m&&yp(m)).catch(m=>ne(m,T,U))}const Ke=T=>s.go(T);let Rr;const Cr=new Set,hr={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:k,getRoutes:y,resolve:w,options:t,push:x,replace:D,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:he.add,isReady:It,install(T){T.component("RouterLink",Kp),T.component("RouterView",Qp),T.config.globalProperties.$router=hr,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>_e(l)}),Ur&&!Rr&&l.value===tr&&(Rr=!0,x(s.location).catch(V=>{}));const U={};for(const V in tr)Object.defineProperty(U,V,{get:()=>l.value[V],enumerable:!0});T.provide(ei,hr),T.provide(Co,cc(U)),T.provide(Ki,l);const N=T.unmount;Cr.add(T),T.unmount=function(){Cr.delete(T),Cr.size<1&&(c=tr,X&&X(),X=null,l.value=tr,Rr=!1,Z=!1),N()}}};function st(T){return T.reduce((U,N)=>U.then(()=>C(N)),Promise.resolve())}return hr}function Xp(){return lt(ei)}function Oo(t){return lt(Co)}const eg="/logo.svg",tg=["width","height"],rg=ur({__name:"LogoIcon",props:{size:{}},setup(t){return(e,r)=>(oe(),Ee("img",{src:eg,alt:"IO",width:t.size??32,height:t.size??32,class:"inline-block"},null,8,tg))}});/**
|
|
30
|
+
*/let xp=()=>location.protocol+"//"+location.host;function yu(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),Da(a,"")}return Da(r,t)+n+s}function Rp(t,e,r,n){let s=[],i=[],o=null;const a=({state:d})=>{const f=yu(t,location),p=r.value,y=e.value;let k=0;if(d){if(r.value=f,e.value=d,o&&o===p){o=null;return}k=y?d.position-y.position:0}else n(f);s.forEach(w=>{w(r.value,p,{delta:k,type:zi.pop,direction:k?k>0?ki.forward:ki.back:ki.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(ie({},d.state,{scroll:Xs()}),"")}}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 qa(t,e,r,n=!1,s=!1){return{back:t,current:e,forward:r,replaced:n,position:window.history.length,scroll:s?Xs():null}}function Cp(t){const{history:e,location:r}=window,n={value:yu(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:xp()+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,ie({},e.state,qa(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),n.value=l}function a(l,c){const u=ie({},s.value,e.state,{forward:l,scroll:Xs()});i(u.current,u,!0),i(l,ie({},qa(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:s,push:a,replace:o}}function Op(t){t=fp(t);const e=Cp(t),r=Rp(t,e.state,e.location,e.replace);function n(i,o=!0){o||r.pauseListeners(),history.go(i)}const s=ie({location:"",base:t,go:n,createHref:gp.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 wr=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Ce=(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})(Ce||{});const Pp={type:wr.Static,value:""},Ip=/[a-zA-Z0-9_]/;function jp(t){if(!t)return[[]];if(t==="/")return[[Pp]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=Ce.Static,n=r;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===Ce.Static?i.push({type:wr.Static,value:c}):r===Ce.Param||r===Ce.ParamRegExp||r===Ce.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:wr.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!==Ce.ParamRegExp){n=r,r=Ce.EscapeNext;continue}switch(r){case Ce.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=Ce.Param):d();break;case Ce.EscapeNext:d(),r=n;break;case Ce.Param:l==="("?r=Ce.ParamRegExp:Ip.test(l)?d():(h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ce.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=Ce.ParamRegExpEnd:u+=l;break;case Ce.ParamRegExpEnd:h(),r=Ce.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===Ce.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Fa="[^/]+?",$p={sensitive:!1,strict:!1,start:!0,end:!0};var qe=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(qe||{});const Np=/[.+*?^${}()[\]/\\]/g;function Lp(t,e){const r=ie({},$p,e),n=[];let s=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[qe.Root];r.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=qe.Segment+(r.sensitive?qe.BonusCaseSensitive:0);if(d.type===wr.Static)h||(s+="/"),s+=d.value.replace(Np,"\\$&"),f+=qe.Static;else if(d.type===wr.Param){const{value:p,repeatable:y,optional:k,regexp:w}=d;i.push({name:p,repeatable:y,optional:k});const b=w||Fa;if(b!==Fa){f+=qe.BonusCustomRegExp;try{`${b}`}catch(x){throw new Error(`Invalid custom RegExp for param "${p}" (${b}): `+x.message)}}let _=y?`((?:${b})(?:/(?:${b}))*)`:`(${b})`;h||(_=k&&c.length<2?`(?:/${_})`:"/"+_),k&&(_+="?"),s+=_,f+=qe.Dynamic,k&&(f+=qe.BonusOptional),y&&(f+=qe.BonusRepeatable),b===".*"&&(f+=qe.BonusWildcard)}u.push(f)}n.push(u)}if(r.strict&&r.end){const c=n.length-1;n[c][n[c].length-1]+=qe.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===wr.Static)u+=f.value;else if(f.type===wr.Param){const{value:p,repeatable:y,optional:k}=f,w=p in c?c[p]:"";if(mt(w)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const b=mt(w)?w.join("/"):w;if(!b)if(k)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=b}}return u||"/"}return{re:o,score:n,keys:i,parse:a,stringify:l}}function Dp(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]===qe.Static+qe.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===qe.Static+qe.Segment?1:-1:0}function vu(t,e){let r=0;const n=t.score,s=e.score;for(;r<n.length&&r<s.length;){const i=Dp(n[r],s[r]);if(i)return i;r++}if(Math.abs(s.length-n.length)===1){if(Va(n))return 1;if(Va(s))return-1}return s.length-n.length}function Va(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Up={strict:!1,end:!0,sensitive:!1};function Bp(t,e,r){const n=Lp(jp(t.path),r),s=ie(n,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function Mp(t,e){const r=[],n=new Map;e=La(Up,e);function s(h){return n.get(h)}function i(h,d,f){const p=!f,y=Wa(h);y.aliasOf=f&&f.record;const k=La(e,h),w=[y];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const D of x)w.push(Wa(ie({},y,{components:f?f.record.components:y.components,path:D,aliasOf:f?f.record:y})))}let b,_;for(const x of w){const{path:D}=x;if(d&&D[0]!=="/"){const M=d.record.path,H=M[M.length-1]==="/"?"":"/";x.path=d.record.path+(D&&H+D)}if(b=Bp(x,d,k),f?f.alias.push(b):(_=_||b,_!==b&&_.alias.push(b),p&&h.name&&!Ka(b)&&o(h.name)),bu(b)&&l(b),y.children){const M=y.children;for(let H=0;H<M.length;H++)i(M[H],b,f&&f.children[H])}f=f||b}return _?()=>{o(_)}:xn}function o(h){if(gu(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=Fp(h,r);r.splice(d,0,h),h.record.name&&!Ka(h)&&n.set(h.record.name,h)}function c(h,d){let f,p={},y,k;if("name"in h&&h.name){if(f=n.get(h.name),!f)throw tn(we.MATCHER_NOT_FOUND,{location:h});k=f.record.name,p=ie(za(d.params,f.keys.filter(_=>!_.optional).concat(f.parent?f.parent.keys.filter(_=>_.optional):[]).map(_=>_.name)),h.params&&za(h.params,f.keys.map(_=>_.name))),y=f.stringify(p)}else if(h.path!=null)y=h.path,f=r.find(_=>_.re.test(y)),f&&(p=f.parse(y),k=f.record.name);else{if(f=d.name?n.get(d.name):r.find(_=>_.re.test(d.path)),!f)throw tn(we.MATCHER_NOT_FOUND,{location:h,currentLocation:d});k=f.record.name,p=ie({},d.params,h.params),y=f.stringify(p)}const w=[];let b=f;for(;b;)w.unshift(b.record),b=b.parent;return{name:k,path:y,params:p,matched:w,meta:qp(w)}}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 za(t,e){const r={};for(const n of e)n in t&&(r[n]=t[n]);return r}function Wa(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Hp(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 Hp(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 Ka(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function qp(t){return t.reduce((e,r)=>ie(e,r.meta),{})}function Fp(t,e){let r=0,n=e.length;for(;r!==n;){const i=r+n>>1;vu(t,e[i])<0?n=i:r=i+1}const s=Vp(t);return s&&(n=e.lastIndexOf(s,n-1)),n}function Vp(t){let e=t;for(;e=e.parent;)if(bu(e)&&vu(t,e)===0)return e}function bu({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Ga(t){const e=lt(ei),r=lt(Co),n=Le(()=>{const l=be(t.to);return e.resolve(l)}),s=Le(()=>{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=Ja(l[c-2]);return c>1&&Ja(u)===f&&h[h.length-1].path!==f?h.findIndex(en.bind(null,l[c-2])):d}),i=Le(()=>s.value>-1&&Jp(r.params,n.value.params)),o=Le(()=>s.value>-1&&s.value===r.matched.length-1&&pu(r.params,n.value.params));function a(l={}){if(Gp(l)){const c=e[be(t.replace)?"replace":"push"](be(t.to)).catch(xn);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:Le(()=>n.value.href),isActive:i,isExactActive:o,navigate:a}}function zp(t){return t.length===1?t[0]:t}const Wp=ur({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:Ga,setup(t,{slots:e}){const r=Gn(Ga(t)),{options:n}=lt(ei),s=Le(()=>({[Ya(t.activeClass,n.linkActiveClass,"router-link-active")]:r.isActive,[Ya(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&zp(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)}}}),Kp=Wp;function Gp(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 Jp(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(!mt(s)||s.length!==n.length||n.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Ja(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Ya=(t,e,r)=>t??e??r,Yp=ur({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const n=lt(Ki),s=Le(()=>t.route||n.value),i=lt(Ha,0),o=Le(()=>{let c=be(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=Le(()=>s.value.matched[o.value]);gs(Ha,Le(()=>o.value+1)),gs(Tp,a),gs(Ki,s);const l=tt();return Er(()=>[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 Qa(r.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,k=Zr(d,ie({},p,e,{onVnodeUnmounted:w=>{w.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return Qa(r.default,{Component:k,route:c})||k}}});function Qa(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const Qp=Yp;function Zp(t){const e=Mp(t.routes,t),r=t.parseQuery||Sp,n=t.stringifyQuery||Ma,s=t.history,i=hn(),o=hn(),a=hn(),l=Uh(tr);let c=tr;Ur&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=_i.bind(null,T=>""+T),h=_i.bind(null,op),d=_i.bind(null,Mn);function f(T,U){let N,V;return gu(T)?(N=e.getRecordMatcher(T),V=U):V=T,e.addRoute(V,N)}function p(T){const U=e.getRecordMatcher(T);U&&e.removeRoute(U)}function y(){return e.getRoutes().map(T=>T.record)}function k(T){return!!e.getRecordMatcher(T)}function w(T,U){if(U=ie({},U||l.value),typeof T=="string"){const v=wi(r,T,U.path),S=e.resolve({path:v.path},U),A=s.createHref(v.fullPath);return ie(v,S,{params:d(S.params),hash:Mn(v.hash),redirectedFrom:void 0,href:A})}let N;if(T.path!=null)N=ie({},T,{path:wi(r,T.path,U.path).path});else{const v=ie({},T.params);for(const S in v)v[S]==null&&delete v[S];N=ie({},T,{params:h(v)}),U.params=h(U.params)}const V=e.resolve(N,U),ee=T.hash||"";V.params=u(d(V.params));const g=cp(n,ie({},T,{hash:np(ee),path:V.path})),m=s.createHref(g);return ie({fullPath:g,hash:ee,query:n===Ma?Ep(T.query):T.query||{}},V,{redirectedFrom:void 0,href:m})}function b(T){return typeof T=="string"?wi(r,T,l.value.path):ie({},T)}function _(T,U){if(c!==T)return tn(we.NAVIGATION_CANCELLED,{from:U,to:T})}function x(T){return H(T)}function D(T){return x(ie(b(T),{replace:!0}))}function M(T,U){const N=T.matched[T.matched.length-1];if(N&&N.redirect){const{redirect:V}=N;let ee=typeof V=="function"?V(T,U):V;return typeof ee=="string"&&(ee=ee.includes("?")||ee.includes("#")?ee=b(ee):{path:ee},ee.params={}),ie({query:T.query,hash:T.hash,params:ee.path!=null?{}:T.params},ee)}}function H(T,U){const N=c=w(T),V=l.value,ee=T.state,g=T.force,m=T.replace===!0,v=M(N,V);if(v)return H(ie(b(v),{state:typeof v=="object"?ie({},ee,v.state):ee,force:g,replace:m}),U||N);const S=N;S.redirectedFrom=U;let A;return!g&&up(n,V,N)&&(A=tn(we.NAVIGATION_DUPLICATED,{to:S,from:V}),yt(V,V,!0,!1)),(A?Promise.resolve(A):q(S,V)).catch(E=>Nt(E)?Nt(E,we.NAVIGATION_GUARD_REDIRECT)?E:Xt(E):se(E,S,V)).then(E=>{if(E){if(Nt(E,we.NAVIGATION_GUARD_REDIRECT))return H(ie({replace:m},b(E.to),{state:typeof E.to=="object"?ie({},ee,E.to.state):ee,force:g}),U||S)}else E=j(S,V,!0,m,ee);return Q(S,V,E),E})}function W(T,U){const N=_(T,U);return N?Promise.reject(N):Promise.resolve()}function C(T){const U=Cr.values().next().value;return U&&typeof U.runWithContext=="function"?U.runWithContext(T):T()}function q(T,U){let N;const[V,ee,g]=Ap(T,U);N=Si(V.reverse(),"beforeRouteLeave",T,U);for(const v of V)v.leaveGuards.forEach(S=>{N.push(sr(S,T,U))});const m=W.bind(null,T,U);return N.push(m),it(N).then(()=>{N=[];for(const v of i.list())N.push(sr(v,T,U));return N.push(m),it(N)}).then(()=>{N=Si(ee,"beforeRouteUpdate",T,U);for(const v of ee)v.updateGuards.forEach(S=>{N.push(sr(S,T,U))});return N.push(m),it(N)}).then(()=>{N=[];for(const v of g)if(v.beforeEnter)if(mt(v.beforeEnter))for(const S of v.beforeEnter)N.push(sr(S,T,U));else N.push(sr(v.beforeEnter,T,U));return N.push(m),it(N)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),N=Si(g,"beforeRouteEnter",T,U,C),N.push(m),it(N))).then(()=>{N=[];for(const v of o.list())N.push(sr(v,T,U));return N.push(m),it(N)}).catch(v=>Nt(v,we.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function Q(T,U,N){a.list().forEach(V=>C(()=>V(T,U,N)))}function j(T,U,N,V,ee){const g=_(T,U);if(g)return g;const m=U===tr,v=Ur?history.state:{};N&&(V||m?s.replace(T.fullPath,ie({scroll:m&&v&&v.scroll},ee)):s.push(T.fullPath,ee)),l.value=T,yt(T,U,N,m),Xt()}let X;function Ae(){X||(X=s.listen((T,U,N)=>{if(!hr.listening)return;const V=w(T),ee=M(V,hr.currentRoute.value);if(ee){H(ie(ee,{replace:!0,force:!0}),V).catch(xn);return}c=V;const g=l.value;Ur&&vp(Ba(g.fullPath,N.delta),Xs()),q(V,g).catch(m=>Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_CANCELLED)?m:Nt(m,we.NAVIGATION_GUARD_REDIRECT)?(H(ie(b(m.to),{force:!0}),V).then(v=>{Nt(v,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&!N.delta&&N.type===zi.pop&&s.go(-1,!1)}).catch(xn),Promise.reject()):(N.delta&&s.go(-N.delta,!1),se(m,V,g))).then(m=>{m=m||j(V,g,!1),m&&(N.delta&&!Nt(m,we.NAVIGATION_CANCELLED)?s.go(-N.delta,!1):N.type===zi.pop&&Nt(m,we.NAVIGATION_ABORTED|we.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),Q(V,g,m)}).catch(xn)}))}let Be=hn(),de=hn(),Z;function se(T,U,N){Xt(T);const V=de.list();return V.length?V.forEach(ee=>ee(T,U,N)):console.error(T),Promise.reject(T)}function It(){return Z&&l.value!==tr?Promise.resolve():new Promise((T,U)=>{Be.add([T,U])})}function Xt(T){return Z||(Z=!T,Ae(),Be.list().forEach(([U,N])=>T?N(T):U()),Be.reset()),T}function yt(T,U,N,V){const{scrollBehavior:ee}=t;if(!Ur||!ee)return Promise.resolve();const g=!N&&bp(Ba(T.fullPath,0))||(V||!N)&&history.state&&history.state.scroll||null;return Qr().then(()=>ee(T,U,g)).then(m=>m&&yp(m)).catch(m=>se(m,T,U))}const Ke=T=>s.go(T);let Rr;const Cr=new Set,hr={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:k,getRoutes:y,resolve:w,options:t,push:x,replace:D,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:de.add,isReady:It,install(T){T.component("RouterLink",Kp),T.component("RouterView",Qp),T.config.globalProperties.$router=hr,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>be(l)}),Ur&&!Rr&&l.value===tr&&(Rr=!0,x(s.location).catch(V=>{}));const U={};for(const V in tr)Object.defineProperty(U,V,{get:()=>l.value[V],enumerable:!0});T.provide(ei,hr),T.provide(Co,cc(U)),T.provide(Ki,l);const N=T.unmount;Cr.add(T),T.unmount=function(){Cr.delete(T),Cr.size<1&&(c=tr,X&&X(),X=null,l.value=tr,Rr=!1,Z=!1),N()}}};function it(T){return T.reduce((U,N)=>U.then(()=>C(N)),Promise.resolve())}return hr}function Xp(){return lt(ei)}function Oo(t){return lt(Co)}const eg="/logo.svg",tg=["width","height"],rg=ur({__name:"LogoIcon",props:{size:{}},setup(t){return(e,r)=>(ae(),Ee("img",{src:eg,alt:"IO",width:t.size??32,height:t.size??32,class:"inline-block"},null,8,tg))}});/**
|
|
31
31
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
32
32
|
*
|
|
33
33
|
* This source code is licensed under the ISC license.
|
|
@@ -37,17 +37,17 @@ var rh=Object.defineProperty;var nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,config
|
|
|
37
37
|
*
|
|
38
38
|
* This source code is licensed under the ISC license.
|
|
39
39
|
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var
|
|
40
|
+
*/var ns={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
41
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the ISC license.
|
|
44
44
|
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const sg=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:n,iconNode:s,name:i,class:o,...a},{slots:l})=>
|
|
45
|
+
*/const sg=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:n,iconNode:s,name:i,class:o,...a},{slots:l})=>Zr("svg",{...ns,width:t||ns.width,height:t||ns.height,stroke:n||ns.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${ng(i??"icon")}`],...a},[...s.map(c=>Zr(...c)),...l.default?[l.default()]:[]]);/**
|
|
46
46
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
47
47
|
*
|
|
48
48
|
* This source code is licensed under the ISC license.
|
|
49
49
|
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const Te=(t,e)=>(r,{slots:n})=>
|
|
50
|
+
*/const Te=(t,e)=>(r,{slots:n})=>Zr(sg,{...r,iconNode:e,name:t},n);/**
|
|
51
51
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
52
52
|
*
|
|
53
53
|
* This source code is licensed under the ISC license.
|
|
@@ -97,12 +97,12 @@ var rh=Object.defineProperty;var nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,config
|
|
|
97
97
|
*
|
|
98
98
|
* This source code is licensed under the ISC license.
|
|
99
99
|
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const
|
|
100
|
+
*/const Za=Te("MessageCircleIcon",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
101
101
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
102
102
|
*
|
|
103
103
|
* This source code is licensed under the ISC license.
|
|
104
104
|
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const
|
|
105
|
+
*/const fg=Te("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"}]]);/**
|
|
106
106
|
* @license lucide-vue-next v0.474.0 - ISC
|
|
107
107
|
*
|
|
108
108
|
* This source code is licensed under the ISC license.
|
|
@@ -152,15 +152,15 @@ var rh=Object.defineProperty;var nh=(t,e,r)=>e in t?rh(t,e,{enumerable:!0,config
|
|
|
152
152
|
*
|
|
153
153
|
* This source code is licensed under the ISC license.
|
|
154
154
|
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const Sg=Te("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"}]]),Eg={key:0,class:"text-base font-bold tracking-tight bg-gradient-brand bg-clip-text text-transparent"},Tg=["title"],Ag={class:"flex-1 p-2 space-y-0.5 overflow-y-auto"},xg={key:0},Rg={class:"border-t border-border p-2 space-y-0.5"},Cg={key:0},Og=["href"],Xa="https://github.com/michaeljolley/io",Pg=ur({__name:"AppSidebar",setup(t){const e=Oo(),r=et(!1),n=[{name:"Chat",icon:Za,path:"/"},{name:"History",icon:hg,path:"/history"},{name:"Squads",icon:Sg,path:"/squads"},{name:"Health",icon:ig,path:"/squads/health"},{name:"Usage",icon:ag,path:"/usage"},{name:"Audit Log",icon:lg,path:"/audit-log"},{name:"Skills",icon:yg,path:"/skills"},{name:"MCP Servers",icon:bg,path:"/mcp"},{name:"Schedules",icon:cg,path:"/schedules"},{name:"Wiki",icon:og,path:"/wiki"}],s=[{name:"Chat",icon:Za,path:"/"},{name:"Feed",icon:_u,path:"/feed"},{name:"Settings",icon:_g,path:"/settings"}],i="1.5.4",o=Ue(()=>{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=So("router-link");return oe(),Ee("aside",{class:at(["border-r border-border bg-sidebar flex flex-col h-full shrink-0 transition-all duration-200",r.value?"w-16":"w-56"])},[ve("div",{class:at(["p-3 border-b border-border flex items-center",r.value?"justify-center":"justify-between"])},[ue(u,{to:"/",class:at(["flex items-center gap-2",r.value?"justify-center":""])},{default:Kr(()=>[ue(rg,{size:24}),r.value?Qe("",!0):(oe(),Ee("h1",Eg,"IO"))]),_:1},8,["class"]),r.value?Qe("",!0):(oe(),Ee("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"},[ue(_e(gg),{class:"w-4 h-4"})],8,Tg))],2),r.value?(oe(),Ee("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"},[ue(_e(mg),{class:"w-4 h-4"})])):Qe("",!0),ve("nav",Ag,[(oe(),Ee(Ye,null,Ni(n,h=>ue(u,{key:h.path,to:h.path,class:at(["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:Kr(()=>[(oe(),Wt(ea(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Qe("",!0):(oe(),Ee("span",xg,ps(h.name),1))]),_:2},1032,["to","class","title"])),64))]),ve("div",Rg,[(oe(),Ee(Ye,null,Ni(s,h=>ue(u,{key:h.path,to:h.path,class:at(["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:Kr(()=>[(oe(),Wt(ea(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Qe("",!0):(oe(),Ee("span",Cg,ps(h.name),1))]),_:2},1032,["to","class","title"])),64)),ve("div",{class:at(["flex items-center pt-2 mt-2 border-t border-border",r.value?"justify-center":"justify-between px-3"])},[r.value?Qe("",!0):(oe(),Ee("a",{key:0,href:`${Xa}/releases/tag/v${_e(i)}`,target:"_blank",class:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Release notes"}," v"+ps(_e(i)),9,Og)),ve("a",{href:Xa,target:"_blank",class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"GitHub repository"},[ue(_e(ug),{class:"w-3.5 h-3.5"})])],2)])],2)}}});function ti(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 Ig(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 jg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Po 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 $g extends Po{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class el extends Po{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class tl extends Po{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Gi;(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"})(Gi||(Gi={}));class Ng{constructor(e,{headers:r={},customFetch:n,region:s=Gi.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=jg(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ig(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 k=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(k=o.signal,u.addEventListener("abort",()=>o.abort())):k=o.signal);const w=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:k}).catch(D=>{throw new $g(D)}),b=w.headers.get("x-relay-error");if(b&&b==="true")throw new el(w);if(!w.ok)throw new tl(w);let _=((s=w.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return _==="application/json"?x=yield w.json():_==="application/octet-stream"||_==="application/pdf"?x=yield w.blob():_==="text/event-stream"?x=w:_==="multipart/form-data"?x=yield w.formData():x=yield w.text(),{data:x,error:null,response:w}}catch(a){return{data:null,error:a,response:a instanceof tl||a instanceof el?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const wu=3,rl=t=>Math.min(1e3*2**t,3e4),Lg=[520,503],ku=["GET","HEAD","OPTIONS"];var Dg=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 nl(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 Ug(t,e,r,n){return!(!n||r>=wu||!ku.includes(t)||!Lg.includes(e))}var Bg=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"||!ku.includes(r.method))throw h;if(r.retryEnabled&&o<wu){const d=rl(o);o++,await nl(d,r.signal);continue}throw h}if(Ug(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:rl(o);await u.text(),o++,await nl(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 b=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",_=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(p=o==null?void 0:o.name)!==null&&p!==void 0?p:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
155
|
+
*/const Sg=Te("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"}]]),Eg={key:0,class:"text-base font-bold tracking-tight bg-gradient-brand bg-clip-text text-transparent"},Tg=["title"],Ag={class:"flex-1 p-2 space-y-0.5 overflow-y-auto"},xg={key:0},Rg={class:"border-t border-border p-2 space-y-0.5"},Cg={key:0},Og=["href"],Xa="https://github.com/michaeljolley/io",Pg=ur({__name:"AppSidebar",setup(t){const e=Oo(),r=tt(!1),n=[{name:"History",icon:hg,path:"/history"},{name:"Squads",icon:Sg,path:"/squads"},{name:"Health",icon:ig,path:"/squads/health"},{name:"Usage",icon:ag,path:"/usage"},{name:"Audit Log",icon:lg,path:"/audit-log"},{name:"Skills",icon:yg,path:"/skills"},{name:"MCP Servers",icon:bg,path:"/mcp"},{name:"Schedules",icon:cg,path:"/schedules"},{name:"Wiki",icon:og,path:"/wiki"}],s=[{name:"Chat",icon:fg,path:"/"},{name:"Feed",icon:_u,path:"/feed"},{name:"Settings",icon:_g,path:"/settings"}],i="1.6.0",o=Le(()=>{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=So("router-link");return ae(),Ee("aside",{class:Ye(["border-r border-border bg-sidebar flex flex-col h-full shrink-0 transition-all duration-200",r.value?"w-16":"w-56"])},[te("div",{class:Ye(["p-3 border-b border-border flex items-center",r.value?"justify-center":"justify-between"])},[ue(u,{to:"/",class:Ye(["flex items-center gap-2",r.value?"justify-center":""])},{default:Gr(()=>[ue(rg,{size:24}),r.value?Ze("",!0):(ae(),Ee("h1",Eg,"IO"))]),_:1},8,["class"]),r.value?Ze("",!0):(ae(),Ee("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"},[ue(be(gg),{class:"w-4 h-4"})],8,Tg))],2),r.value?(ae(),Ee("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"},[ue(be(mg),{class:"w-4 h-4"})])):Ze("",!0),te("nav",Ag,[(ae(),Ee(Qe,null,Ni(n,h=>ue(u,{key:h.path,to:h.path,class:Ye(["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:Gr(()=>[(ae(),Wt(ea(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Ze("",!0):(ae(),Ee("span",xg,Wr(h.name),1))]),_:2},1032,["to","class","title"])),64))]),te("div",Rg,[(ae(),Ee(Qe,null,Ni(s,h=>ue(u,{key:h.path,to:h.path,class:Ye(["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:Gr(()=>[(ae(),Wt(ea(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?Ze("",!0):(ae(),Ee("span",Cg,Wr(h.name),1))]),_:2},1032,["to","class","title"])),64)),te("div",{class:Ye(["flex items-center pt-2 mt-2 border-t border-border",r.value?"justify-center":"justify-between px-3"])},[r.value?Ze("",!0):(ae(),Ee("a",{key:0,href:`${Xa}/releases/tag/v${be(i)}`,target:"_blank",class:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Release notes"}," v"+Wr(be(i)),9,Og)),te("a",{href:Xa,target:"_blank",class:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"GitHub repository"},[ue(be(ug),{class:"w-3.5 h-3.5"})])],2)])],2)}}});function ti(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 Ig(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 jg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Po 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 $g extends Po{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class el extends Po{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class tl extends Po{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Gi;(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"})(Gi||(Gi={}));class Ng{constructor(e,{headers:r={},customFetch:n,region:s=Gi.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=jg(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Ig(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 k=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(k=o.signal,u.addEventListener("abort",()=>o.abort())):k=o.signal);const w=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:k}).catch(D=>{throw new $g(D)}),b=w.headers.get("x-relay-error");if(b&&b==="true")throw new el(w);if(!w.ok)throw new tl(w);let _=((s=w.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return _==="application/json"?x=yield w.json():_==="application/octet-stream"||_==="application/pdf"?x=yield w.blob():_==="text/event-stream"?x=w:_==="multipart/form-data"?x=yield w.formData():x=yield w.text(),{data:x,error:null,response:w}}catch(a){return{data:null,error:a,response:a instanceof tl||a instanceof el?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const wu=3,rl=t=>Math.min(1e3*2**t,3e4),Lg=[520,503],ku=["GET","HEAD","OPTIONS"];var Dg=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 nl(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 Ug(t,e,r,n){return!(!n||r>=wu||!ku.includes(t)||!Lg.includes(e))}var Bg=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"||!ku.includes(r.method))throw h;if(r.retryEnabled&&o<wu){const d=rl(o);o++,await nl(d,r.signal);continue}throw h}if(Ug(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:rl(o);await u.text(),o++,await nl(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 b=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",_=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(p=o==null?void 0:o.name)!==null&&p!==void 0?p:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
156
156
|
|
|
157
157
|
Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${b}`,_&&(l+=` (${_})`),h!=null&&h.stack&&(l+=`
|
|
158
|
-
${h.stack}`)}else{var k;l=(k=o==null?void 0:o.stack)!==null&&k!==void 0?k:""}const w=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)",w>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${w} 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)",w>this.urlLengthLimit&&(c+=`. Your request URL is ${w} 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 Dg(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Mg=class extends Bg{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 sl=new RegExp("[,()]");var Br=class extends Mg{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"&&sl.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"&&sl.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}},Hg=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 Br({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 Br({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 Br({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 Br({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 Br({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 Mn(t){"@babel/helpers - typeof";return Mn=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},Mn(t)}function qg(t,e){if(Mn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Mn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fg(t){var e=qg(t,"string");return Mn(e)=="symbol"?e:e+""}function Vg(t,e,r){return(e=Fg(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function il(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 ns(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?il(Object(r),!0).forEach(function(n){Vg(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):il(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var zg=class Su{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,ns(ns({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,ns(ns({},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 Hg(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 Su(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 Br({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 Wg{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:
|
|
158
|
+
${h.stack}`)}else{var k;l=(k=o==null?void 0:o.stack)!==null&&k!==void 0?k:""}const w=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)",w>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${w} 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)",w>this.urlLengthLimit&&(c+=`. Your request URL is ${w} 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 Dg(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Mg=class extends Bg{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 sl=new RegExp("[,()]");var Br=class extends Mg{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"&&sl.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"&&sl.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}},Hg=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 Br({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 Br({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 Br({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 Br({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 Br({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 Hn(t){"@babel/helpers - typeof";return Hn=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},Hn(t)}function qg(t,e){if(Hn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Hn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fg(t){var e=qg(t,"string");return Hn(e)=="symbol"?e:e+""}function Vg(t,e,r){return(e=Fg(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function il(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 ss(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?il(Object(r),!0).forEach(function(n){Vg(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):il(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var zg=class Su{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,ss(ss({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,ss(ss({},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 Hg(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 Su(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 Br({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 Wg{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:
|
|
159
159
|
import ws from "ws"
|
|
160
160
|
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+=`
|
|
161
161
|
|
|
162
|
-
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 Kg="2.106.2",Gg=`realtime-js/${Kg}`,Jg="1.0.0",Eu="2.0.0",Yg=Eu,Qg=1e4,Zg=100,or={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Tu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Ji={connecting:"connecting",closing:"closing",closed:"closed"};class Xg{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,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(a,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(o,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(c,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(h,w=>p.setUint8(y++,w.charCodeAt(0)));var k=new Uint8Array(f.byteLength+n.byteLength);return k.set(new Uint8Array(f),0),k.set(new Uint8Array(n),f.byteLength),k.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 me;(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"})(me||(me={}));const ol=(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]=em(o,t,e,s),i),{}):{}},em=(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)?Au(i,o):Yi(o)},Au=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return sm(e,r)}switch(t){case me.bool:return tm(e);case me.float4:case me.float8:case me.int2:case me.int4:case me.int8:case me.numeric:case me.oid:return rm(e);case me.json:case me.jsonb:return nm(e);case me.timestamp:return im(e);case me.abstime:case me.date:case me.daterange:case me.int4range:case me.int8range:case me.money:case me.reltime:case me.text:case me.time:case me.timestamptz:case me.timetz:case me.tsrange:case me.tstzrange:return Yi(e);default:return Yi(e)}},Yi=t=>t,tm=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},rm=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},nm=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},sm=(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=>Au(e,a))}return t},im=t=>typeof t=="string"?t.replace(" ","T"):t,xu=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 xn=t=>typeof t=="function"?t:function(){return t},om=typeof self<"u"?self:null,Mr=typeof window<"u"?window:null,At=om||Mr||globalThis,am="2.0.0",lm=1e4,cm=1e3,Ct={connecting:0,open:1,closing:2,closed:3},Ge={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ut={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Qi={longpoll:"longpoll",websocket:"websocket"},um={complete:4},Zi="base64url.bearer.phx.",ss=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})}},Ru=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))}},hm=class{constructor(t,e,r){this.state=Ge.closed,this.topic=t,this.params=xn(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ss(this,Ut.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ru(()=>{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=Ge.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Ge.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=Ge.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=Ge.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 ss(this,Ut.leave,xn({}),this.timeout).send(),this.state=Ge.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ut.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=Ge.closed,this.bindings=[]}onClose(t){this.on(Ut.close,t)}onError(t){return this.on(Ut.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 ss(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=Ge.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ut.close,"leave")},r=new ss(this,Ut.leave,xn({}),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=Ge.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===Ge.closed}isErrored(){return this.state===Ge.errored}isJoined(){return this.state===Ge.joined}isJoining(){return this.state===Ge.joining}isLeaving(){return this.state===Ge.leaving}},Rs=class{static request(t,e,r,n,s,i,o){if(At.XDomainRequest){let a=new At.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(At.XMLHttpRequest){let a=new At.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(At.fetch&&At.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),At.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===um.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)}`}},dm=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)},Ir=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Zi)&&(this.authToken=atob(e[1].slice(Zi.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=Ct.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 Rs.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=Ct.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ct.open||this.readyState===Ct.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=Ct.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=dm(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(`
|
|
163
|
-
`),()=>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=Ct.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=Rs.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},fm=class mn{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=mn.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=mn.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=mn.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 mn.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))}},is={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:Ut.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}}},pm=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||lm,this.transport=e.transport||At.WebSocket||Ir,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=At&&At.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=is.encode.bind(is),this.defaultDecoder=is.decode.bind(is),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!==Ir?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Mr&&Mr.addEventListener&&(Mr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Mr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Mr.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=xn(e.params||{}),this.endPoint=`${t}/${Qi.websocket}`,this.vsn=e.vsn||am,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ru(()=>{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 Ir}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=Rs.appendParams(Rs.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=xn(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ir?this.connectWithFallback(Ir,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 Ir:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Zi}${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(),cm,"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===Ct.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(Ut.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ct.connecting:return"connecting";case Ct.open:return"open";case Ct.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 hm(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 Rn{constructor(e,r){const n=mm(r);this.presence=new fm(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=Rn.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Rn.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Rn.transformState(this.presence.state)}static transformState(e){return e=gm(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=ys(s),r},{})}static onJoinPayload(e,r,n){const s=al(r),i=ys(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=al(r),i=ys(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function ys(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function gm(t){return JSON.parse(JSON.stringify(t))}function mm(t){return(t==null?void 0:t.events)&&{events:t.events}}function al(t){return t!=null&&t.metas?ys(t):[]}var ll;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ll||(ll={}));class ym{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Rn(this.channel.channelAdapter,r)}}function vm(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 bm{constructor(e,r,n){const s=_m(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>Zg){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===or.joined}isJoined(){return this.state===or.joined}isJoining(){return this.state===or.joining}isClosed(){return this.state===or.closed}isLeaving(){return this.state===or.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function _m(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var cl;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(cl||(cl={}));var Fr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Fr||(Fr={}));var Bt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Bt||(Bt={}));class Cn{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 bm(this.socket.socketAdapter,e,this.params),this.presence=new ym(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=xu(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[Fr.PRESENCE]&&this.bindings[Fr.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(Bt.CHANNEL_ERROR,vm(f))}),this._onClose(()=>e==null?void 0:e(Bt.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(Bt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=or.errored;const p=Object.values(f).join(", ")||"error";e==null||e(Bt.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{e==null||e(Bt.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&&Cn.isFilterValueEqual(f.schema,u)&&Cn.isFilterValueEqual(f.table,h)&&Cn.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=or.errored,r==null||r(Bt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=or.errored&&r&&r(Bt.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===Fr.PRESENCE||e===Fr.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}=Tu;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=ol(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=ol(e.columns,e.old_record)),r}}class wm{constructor(e,r){this.socket=new pm(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()==Ji.connecting}isDisconnecting(){return this.socket.connectionState()==Ji.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ul={HEARTBEAT_INTERVAL:25e3},km=[1e3,2e3,5e3,1e4],Sm=1e4;function Em(){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 Tm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Em()}const Am=`
|
|
162
|
+
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 Kg="2.106.2",Gg=`realtime-js/${Kg}`,Jg="1.0.0",Eu="2.0.0",Yg=Eu,Qg=1e4,Zg=100,or={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Tu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Ji={connecting:"connecting",closing:"closing",closed:"closed"};class Xg{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,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(a,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(o,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(c,w=>p.setUint8(y++,w.charCodeAt(0))),Array.from(h,w=>p.setUint8(y++,w.charCodeAt(0)));var k=new Uint8Array(f.byteLength+n.byteLength);return k.set(new Uint8Array(f),0),k.set(new Uint8Array(n),f.byteLength),k.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 ye;(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"})(ye||(ye={}));const ol=(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]=em(o,t,e,s),i),{}):{}},em=(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)?Au(i,o):Yi(o)},Au=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return sm(e,r)}switch(t){case ye.bool:return tm(e);case ye.float4:case ye.float8:case ye.int2:case ye.int4:case ye.int8:case ye.numeric:case ye.oid:return rm(e);case ye.json:case ye.jsonb:return nm(e);case ye.timestamp:return im(e);case ye.abstime:case ye.date:case ye.daterange:case ye.int4range:case ye.int8range:case ye.money:case ye.reltime:case ye.text:case ye.time:case ye.timestamptz:case ye.timetz:case ye.tsrange:case ye.tstzrange:return Yi(e);default:return Yi(e)}},Yi=t=>t,tm=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},rm=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},nm=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},sm=(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=>Au(e,a))}return t},im=t=>typeof t=="string"?t.replace(" ","T"):t,xu=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 Rn=t=>typeof t=="function"?t:function(){return t},om=typeof self<"u"?self:null,Mr=typeof window<"u"?window:null,At=om||Mr||globalThis,am="2.0.0",lm=1e4,cm=1e3,Ct={connecting:0,open:1,closing:2,closed:3},Ge={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ut={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Qi={longpoll:"longpoll",websocket:"websocket"},um={complete:4},Zi="base64url.bearer.phx.",is=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})}},Ru=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))}},hm=class{constructor(t,e,r){this.state=Ge.closed,this.topic=t,this.params=Rn(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new is(this,Ut.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Ru(()=>{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=Ge.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=Ge.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=Ge.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=Ge.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 is(this,Ut.leave,Rn({}),this.timeout).send(),this.state=Ge.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ut.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=Ge.closed,this.bindings=[]}onClose(t){this.on(Ut.close,t)}onError(t){return this.on(Ut.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 is(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=Ge.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ut.close,"leave")},r=new is(this,Ut.leave,Rn({}),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=Ge.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===Ge.closed}isErrored(){return this.state===Ge.errored}isJoined(){return this.state===Ge.joined}isJoining(){return this.state===Ge.joining}isLeaving(){return this.state===Ge.leaving}},Rs=class{static request(t,e,r,n,s,i,o){if(At.XDomainRequest){let a=new At.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(At.XMLHttpRequest){let a=new At.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(At.fetch&&At.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),At.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===um.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)}`}},dm=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)},Ir=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(Zi)&&(this.authToken=atob(e[1].slice(Zi.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=Ct.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 Rs.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=Ct.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Ct.open||this.readyState===Ct.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=Ct.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=dm(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(`
|
|
163
|
+
`),()=>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=Ct.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=Rs.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},fm=class yn{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=yn.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=yn.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=yn.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 yn.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))}},os={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:Ut.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}}},pm=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||lm,this.transport=e.transport||At.WebSocket||Ir,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=At&&At.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=os.encode.bind(os),this.defaultDecoder=os.decode.bind(os),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!==Ir?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;Mr&&Mr.addEventListener&&(Mr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),Mr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),Mr.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=Rn(e.params||{}),this.endPoint=`${t}/${Qi.websocket}`,this.vsn=e.vsn||am,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Ru(()=>{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 Ir}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=Rs.appendParams(Rs.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=Rn(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ir?this.connectWithFallback(Ir,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 Ir:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${Zi}${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(),cm,"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===Ct.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(Ut.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case Ct.connecting:return"connecting";case Ct.open:return"open";case Ct.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 hm(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 Cn{constructor(e,r){const n=mm(r);this.presence=new fm(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=Cn.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Cn.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return Cn.transformState(this.presence.state)}static transformState(e){return e=gm(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=ys(s),r},{})}static onJoinPayload(e,r,n){const s=al(r),i=ys(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=al(r),i=ys(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function ys(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function gm(t){return JSON.parse(JSON.stringify(t))}function mm(t){return(t==null?void 0:t.events)&&{events:t.events}}function al(t){return t!=null&&t.metas?ys(t):[]}var ll;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(ll||(ll={}));class ym{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new Cn(this.channel.channelAdapter,r)}}function vm(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 bm{constructor(e,r,n){const s=_m(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>Zg){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===or.joined}isJoined(){return this.state===or.joined}isJoining(){return this.state===or.joining}isClosed(){return this.state===or.closed}isLeaving(){return this.state===or.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function _m(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var cl;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(cl||(cl={}));var Fr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Fr||(Fr={}));var Bt;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Bt||(Bt={}));class On{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 bm(this.socket.socketAdapter,e,this.params),this.presence=new ym(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=xu(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[Fr.PRESENCE]&&this.bindings[Fr.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(Bt.CHANNEL_ERROR,vm(f))}),this._onClose(()=>e==null?void 0:e(Bt.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(Bt.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=or.errored;const p=Object.values(f).join(", ")||"error";e==null||e(Bt.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{e==null||e(Bt.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&&On.isFilterValueEqual(f.schema,u)&&On.isFilterValueEqual(f.table,h)&&On.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=or.errored,r==null||r(Bt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=or.errored&&r&&r(Bt.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===Fr.PRESENCE||e===Fr.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}=Tu;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=ol(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=ol(e.columns,e.old_record)),r}}class wm{constructor(e,r){this.socket=new pm(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()==Ji.connecting}isDisconnecting(){return this.socket.connectionState()==Ji.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const ul={HEARTBEAT_INTERVAL:25e3},km=[1e3,2e3,5e3,1e4],Sm=1e4;function Em(){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 Tm(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Em()}const Am=`
|
|
164
164
|
addEventListener("message", (e) => {
|
|
165
165
|
if (e.data.event === "start") {
|
|
166
166
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
@@ -178,8 +178,8 @@ Option 2: Install and provide the "ws" package:
|
|
|
178
178
|
const client = new RealtimeClient(url, {
|
|
179
179
|
...options,
|
|
180
180
|
transport: ws
|
|
181
|
-
})`):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()||Ji.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 Cn(`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:Gg};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Tu.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([Am],{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:Qg,p.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:ul.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:ul.HEARTBEAT_INTERVAL),p.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Wg.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:Tm(),p.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(b=>km[b-1]||Sm);let y,k;const w=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:Yg;switch(w){case Jg:y=(b,_)=>_(JSON.stringify(b)),k=(b,_)=>_(JSON.parse(b));break;case Eu:y=this.serializer.encode.bind(this.serializer),k=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=w,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:k,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 Hn=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 Rm(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 Cm(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 Om(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=Rm(t.baseUrl,n,s),l=await Cm(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 Hn((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 os(t){return t.join("")}var Pm=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:os(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/${os(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${os(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${os(t.namespace)}`}),!0}catch(e){if(e instanceof Hn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof Hn&&r.status===409)return;throw r}}};function jr(t){return t.join("")}var Im=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/${jr(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/${jr(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/${jr(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/${jr(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/${jr(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/${jr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof Hn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof Hn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},jm=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Om({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Pm(this.client,e),this.tableOps=new Im(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 qn(t){"@babel/helpers - typeof";return qn=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},qn(t)}function $m(t,e){if(qn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Nm(t){var e=$m(t,"string");return qn(e)=="symbol"?e:e+""}function Lm(t,e,r){return(e=Nm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hl(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 G(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hl(Object(r),!0).forEach(function(n){Lm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ri=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 ni(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Xi=class extends ri{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 G({},super.toJSON())}},Cu=class extends ri{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Cs(t,e,r){const n=G({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Dm(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const Um=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Bm=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)},eo=t=>{if(Array.isArray(t))return t.map(r=>eo(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]=eo(n)}),e},Mm=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),dl=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)},Hm=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 Xi(dl(o),i,a,n))}).catch(()=>{const o=i+"";e(new Xi(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new Cu(dl(t),t,n))},qm=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return G(G({},s),r);if(Bm(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=Cs(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),G(G({},s),r)};async function hn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,qm(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=>Hm(c,l,n,o))})}function Ou(t="storage"){return{get:async(e,r,n,s)=>hn(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>hn(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>hn(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>hn(e,"HEAD",r,G(G({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>hn(e,"DELETE",r,s,i,n,t)}}const Fm=Ou("storage"),{get:Fn,post:ht,put:to,head:Vm,remove:Io}=Fm,Xe=Ou("vectors");var sn=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Dm(e),this.fetch=Um(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Cs(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(ni(r))return{data:null,error:r};throw r}}};let Pu;Pu=Symbol.toStringTag;var zm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Pu]="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(ni(e))return{data:null,error:e};throw e}}};let Iu;Iu=Symbol.toStringTag;var Wm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Iu]="BlobDownloadBuilder",this.promise=null}asStream(){return new zm(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(ni(e))return{data:null,error:e};throw e}}};const Km={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},fl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Gm=class extends sn{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=G(G({},fl),n);let a=G(G({},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=Cs(a,d,f);const c=s._removeEmptyFolders(e),u=s._getFinalPath(c),h=await(t=="PUT"?to:ht)(s.fetch,`${s.url}/object/${u}`,i,G({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=G(G({},fl),n);let u=G(G({},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=Cs(u,d,f);return{path:i,fullPath:(await to(s.fetch,a.toString(),l,G({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=G({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await ht(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 ri("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 ht(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 ht(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 ht(n.fetch,`${n.url}/object/sign/${s}`,G({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 ht(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=>G(G({},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=()=>Fn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Wm(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>eo(await Fn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Vm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ni(s)){var n;const i=s instanceof Xi?s.status:s instanceof Cu?(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 Io(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=G(G(G({},Km),e),{},{prefix:t||""});return await ht(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=G({},t);return await ht(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 Jm="2.106.2",Yn={"X-Client-Info":`storage-js/${Jm}`};var Ym=class extends sn{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=G(G({},Yn),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Fn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Fn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await ht(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 to(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 ht(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Io(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():""}},Qm=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ht(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 Fn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Io(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Mm(t))throw new ri("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 jm({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}}}}})}},Zm=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await Xe.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await Xe.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},Xm=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),{},{"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 Xe.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await Xe.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 Xe.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await Xe.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 Xe.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},ey=class extends sn{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Yn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Xe.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},ty=class extends ey{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new ry(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)}},ry=class extends Zm{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,G(G({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,G(G({},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 ny(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},ny=class extends Xm{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,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},sy=class extends Ym{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Gm(this.url,this.headers,t,this.fetch)}get vectors(){return new ty(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Qm(this.url+"/iceberg",this.headers,this.fetch)}};const ju="2.106.2",Hr=30*1e3,ro=3,Ei=ro*Hr,iy="http://localhost:9999",oy="supabase.auth.token",ay={"X-Client-Info":`gotrue-js/${ju}`},no="X-Supabase-Api-Version",$u={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},ly=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,cy=600*1e3;class tn 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 I(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class uy extends tn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function hy(t){return I(t)&&t.name==="AuthApiError"}class dt extends tn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Zt extends tn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Ie extends Zt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function as(t){return I(t)&&t.name==="AuthSessionMissingError"}class $r extends Zt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ls extends Zt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class cs extends Zt{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 dy(t){return I(t)&&t.name==="AuthImplicitGrantRedirectError"}class pl extends Zt{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 fy extends Zt{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 so extends Zt{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ti(t){return I(t)&&t.name==="AuthRetryableFetchError"}class gl extends Zt{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 io extends Zt{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ml=`
|
|
182
|
-
\r=`.split(""),py=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<ml.length;e+=1)t[ml[e].charCodeAt(0)]=-2;for(let e=0;e<Os.length;e+=1)t[Os[e].charCodeAt(0)]=e;return t})();function yl(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(Os[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(Os[n]),e.queuedBits-=6}}function Nu(t,e,r){const n=py[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 vl(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{yy(o,n,r)};for(let o=0;o<t.length;o+=1)Nu(t.charCodeAt(o),s,i);return e.join("")}function gy(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 my(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}gy(n,e)}}function yy(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 Gr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)Nu(t.charCodeAt(s),r,n);return new Uint8Array(e)}function vy(t){const e=[];return my(t,r=>e.push(r)),new Uint8Array(e)}function kr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>yl(s,r,n)),yl(null,r,n),e.join("")}function by(t){return Math.round(Date.now()/1e3)+t}function _y(){return Symbol("auth-callback")}const Ne=()=>typeof window<"u"&&typeof document<"u",mr={tested:!1,writable:!1},Lu=()=>{if(!Ne())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(mr.tested)return mr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),mr.tested=!0,mr.writable=!0}catch{mr.tested=!0,mr.writable=!1}return mr.writable};function wy(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 Du=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ky=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",qr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},yr=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},$e=async(t,e)=>{await t.removeItem(e)};class si{constructor(){this.promise=new si.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}si.promiseConstructor=Promise;function us(t){const e=t.split(".");if(e.length!==3)throw new io("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!ly.test(e[n]))throw new io("JWT not in base64url format");return{header:JSON.parse(vl(e[0])),payload:JSON.parse(vl(e[1])),signature:Gr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Sy(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Ey(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 Ty(t){return("0"+t.toString(16)).substr(-2)}function Ay(){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,Ty).join("")}async function xy(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 Ry(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 xy(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Nr(t,e,r=!1){const n=Ay();let s=n;r&&(s+="/recovery"),await qr(t,`${e}-code-verifier`,s);const i=await Ry(n);return[i,n===i?"plain":"s256"]}const Cy=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Oy(t){const e=t.headers.get(no);if(!e||!e.match(Cy))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Py(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 Iy(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 jy=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Lt(t){if(!jy.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ut(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 Ai(){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 $y(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 bl(t){return JSON.parse(JSON.stringify(t))}const br=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)},Ny=[502,503,504,520,521,522,523,524,530];async function _l(t){var e;if(!ky(t))throw new so(br(t),0);if(Ny.includes(t.status))throw new so(br(t),t.status);let r;try{r=await t.json()}catch(i){throw new dt(br(i),i)}let n;const s=Oy(t);if(s&&s.getTime()>=$u["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 gl(br(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ie}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 gl(br(r),t.status,r.weak_password.reasons);throw new uy(br(r),t.status||500,n)}const Ly=(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 B(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[no]||(i[no]=$u["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 Dy(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 Dy(t,e,r,n,s,i){const o=Ly(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new so(br(l),0)}if(a.ok||await _l(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await _l(l)}}function ot(t){var e;let r=null;My(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=by(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 wl(t){const e=ot(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 ar(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Uy(t){return{data:t,error:null}}function By(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=ti(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 kl(t){return t}function My(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const xi=["global","local","others"];class Hy{_encodePathSegment(e){if(e==="."||e==="..")throw new tn("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=Du(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=xi[0]){if(xi.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${xi.join(", ")}`);try{return await B(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(I(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await B(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ti(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 B(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:By,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(I(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await B(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ar})}catch(r){if(I(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 B(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:kl});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)),k=JSON.parse(p.split(";")[1].split("=")[1]);c[`${k}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Lt(e);try{return await B(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ar})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Lt(e);try{return await B(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Lt(e);try{return await B(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Lt(e.userId);try{const{data:r,error:n}=await B(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(I(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Lt(e.userId),Lt(e.id);try{return{data:await B(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(I(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 B(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:kl});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)),k=JSON.parse(p.split(";")[1].split("=")[1]);c[`${k}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await B(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const n=this._encodePathSegment(e);return await B(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await B(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(I(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await B(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const n=this._encodePathSegment(e);return await B(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){ut(this.experimental),Lt(e.userId);try{return await B(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){ut(this.experimental),Lt(e.userId),Lt(e.passkeyId);try{return await B(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}}function Sl(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const kt={debug:!!(globalThis&&Lu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Uu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class El extends Uu{}async function qy(t,e,r){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),kt.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),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new El(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(kt.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 kt.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){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{kt.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 kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new El(`Lock "${t}" was released because another request stole it`)}throw i}}function Fy(){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 Bu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Vy(t){return parseInt(t,16)}function zy(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Wy(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(`
|
|
181
|
+
})`):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()||Ji.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 On(`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:Gg};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Tu.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([Am],{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:Qg,p.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:ul.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:ul.HEARTBEAT_INTERVAL),p.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Wg.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:Tm(),p.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(b=>km[b-1]||Sm);let y,k;const w=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:Yg;switch(w){case Jg:y=(b,_)=>_(JSON.stringify(b)),k=(b,_)=>_(JSON.parse(b));break;case Eu:y=this.serializer.encode.bind(this.serializer),k=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=w,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:k,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 qn=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 Rm(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 Cm(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 Om(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=Rm(t.baseUrl,n,s),l=await Cm(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 qn((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 as(t){return t.join("")}var Pm=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:as(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/${as(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${as(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${as(t.namespace)}`}),!0}catch(e){if(e instanceof qn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof qn&&r.status===409)return;throw r}}};function jr(t){return t.join("")}var Im=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/${jr(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/${jr(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/${jr(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/${jr(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/${jr(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/${jr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof qn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof qn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},jm=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Om({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Pm(this.client,e),this.tableOps=new Im(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 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 $m(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 Nm(t){var e=$m(t,"string");return Fn(e)=="symbol"?e:e+""}function Lm(t,e,r){return(e=Nm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hl(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 G(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hl(Object(r),!0).forEach(function(n){Lm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var ri=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 ni(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Xi=class extends ri{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 G({},super.toJSON())}},Cu=class extends ri{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Cs(t,e,r){const n=G({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Dm(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const Um=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Bm=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)},eo=t=>{if(Array.isArray(t))return t.map(r=>eo(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]=eo(n)}),e},Mm=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),dl=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)},Hm=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 Xi(dl(o),i,a,n))}).catch(()=>{const o=i+"";e(new Xi(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new Cu(dl(t),t,n))},qm=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return G(G({},s),r);if(Bm(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=Cs(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),G(G({},s),r)};async function dn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,qm(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=>Hm(c,l,n,o))})}function Ou(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,G(G({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>dn(e,"DELETE",r,s,i,n,t)}}const Fm=Ou("storage"),{get:Vn,post:ht,put:to,head:Vm,remove:Io}=Fm,et=Ou("vectors");var on=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Dm(e),this.fetch=Um(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Cs(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(ni(r))return{data:null,error:r};throw r}}};let Pu;Pu=Symbol.toStringTag;var zm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Pu]="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(ni(e))return{data:null,error:e};throw e}}};let Iu;Iu=Symbol.toStringTag;var Wm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Iu]="BlobDownloadBuilder",this.promise=null}asStream(){return new zm(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(ni(e))return{data:null,error:e};throw e}}};const Km={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},fl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Gm=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=G(G({},fl),n);let a=G(G({},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=Cs(a,d,f);const c=s._removeEmptyFolders(e),u=s._getFinalPath(c),h=await(t=="PUT"?to:ht)(s.fetch,`${s.url}/object/${u}`,i,G({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=G(G({},fl),n);let u=G(G({},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=Cs(u,d,f);return{path:i,fullPath:(await to(s.fetch,a.toString(),l,G({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=G({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await ht(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 ri("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 ht(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 ht(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 ht(n.fetch,`${n.url}/object/sign/${s}`,G({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 ht(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=>G(G({},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=()=>Vn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Wm(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>eo(await Vn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Vm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ni(s)){var n;const i=s instanceof Xi?s.status:s instanceof Cu?(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 Io(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=G(G(G({},Km),e),{},{prefix:t||""});return await ht(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=G({},t);return await ht(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 Jm="2.106.2",Qn={"X-Client-Info":`storage-js/${Jm}`};var Ym=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=G(G({},Qn),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Vn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Vn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await ht(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 to(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 ht(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Io(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():""}},Qm=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Qn),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ht(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 Vn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Io(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Mm(t))throw new ri("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 jm({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}}}}})}},Zm=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Qn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await et.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await et.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await et.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await et.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},Xm=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},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 et.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await et.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 et.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await et.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 et.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},ey=class extends on{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=G(G({},Qn),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await et.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await et.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await et.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await et.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},ty=class extends ey{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new ry(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)}},ry=class extends Zm{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,G(G({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,G(G({},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 ny(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},ny=class extends Xm{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,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,G(G({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},sy=class extends Ym{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new Gm(this.url,this.headers,t,this.fetch)}get vectors(){return new ty(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Qm(this.url+"/iceberg",this.headers,this.fetch)}};const ju="2.106.2",Hr=30*1e3,ro=3,Ei=ro*Hr,iy="http://localhost:9999",oy="supabase.auth.token",ay={"X-Client-Info":`gotrue-js/${ju}`},no="X-Supabase-Api-Version",$u={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},ly=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,cy=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 I(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class uy extends rn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function hy(t){return I(t)&&t.name==="AuthApiError"}class dt extends rn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class Zt extends rn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Ie extends Zt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function ls(t){return I(t)&&t.name==="AuthSessionMissingError"}class $r extends Zt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class cs extends Zt{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class us extends Zt{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 dy(t){return I(t)&&t.name==="AuthImplicitGrantRedirectError"}class pl extends Zt{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 fy extends Zt{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 so extends Zt{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ti(t){return I(t)&&t.name==="AuthRetryableFetchError"}class gl extends Zt{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 io extends Zt{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Os="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),ml=`
|
|
182
|
+
\r=`.split(""),py=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<ml.length;e+=1)t[ml[e].charCodeAt(0)]=-2;for(let e=0;e<Os.length;e+=1)t[Os[e].charCodeAt(0)]=e;return t})();function yl(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(Os[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(Os[n]),e.queuedBits-=6}}function Nu(t,e,r){const n=py[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 vl(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{yy(o,n,r)};for(let o=0;o<t.length;o+=1)Nu(t.charCodeAt(o),s,i);return e.join("")}function gy(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 my(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}gy(n,e)}}function yy(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 Jr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)Nu(t.charCodeAt(s),r,n);return new Uint8Array(e)}function vy(t){const e=[];return my(t,r=>e.push(r)),new Uint8Array(e)}function kr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>yl(s,r,n)),yl(null,r,n),e.join("")}function by(t){return Math.round(Date.now()/1e3)+t}function _y(){return Symbol("auth-callback")}const Ne=()=>typeof window<"u"&&typeof document<"u",mr={tested:!1,writable:!1},Lu=()=>{if(!Ne())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(mr.tested)return mr.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),mr.tested=!0,mr.writable=!0}catch{mr.tested=!0,mr.writable=!1}return mr.writable};function wy(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 Du=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),ky=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",qr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},yr=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},$e=async(t,e)=>{await t.removeItem(e)};class si{constructor(){this.promise=new si.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}si.promiseConstructor=Promise;function hs(t){const e=t.split(".");if(e.length!==3)throw new io("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!ly.test(e[n]))throw new io("JWT not in base64url format");return{header:JSON.parse(vl(e[0])),payload:JSON.parse(vl(e[1])),signature:Jr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Sy(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Ey(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 Ty(t){return("0"+t.toString(16)).substr(-2)}function Ay(){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,Ty).join("")}async function xy(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 Ry(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 xy(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Nr(t,e,r=!1){const n=Ay();let s=n;r&&(s+="/recovery"),await qr(t,`${e}-code-verifier`,s);const i=await Ry(n);return[i,n===i?"plain":"s256"]}const Cy=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Oy(t){const e=t.headers.get(no);if(!e||!e.match(Cy))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Py(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 Iy(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 jy=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Lt(t){if(!jy.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function ut(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 Ai(){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 $y(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 bl(t){return JSON.parse(JSON.stringify(t))}const br=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)},Ny=[502,503,504,520,521,522,523,524,530];async function _l(t){var e;if(!ky(t))throw new so(br(t),0);if(Ny.includes(t.status))throw new so(br(t),t.status);let r;try{r=await t.json()}catch(i){throw new dt(br(i),i)}let n;const s=Oy(t);if(s&&s.getTime()>=$u["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 gl(br(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ie}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 gl(br(r),t.status,r.weak_password.reasons);throw new uy(br(r),t.status||500,n)}const Ly=(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 B(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[no]||(i[no]=$u["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 Dy(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 Dy(t,e,r,n,s,i){const o=Ly(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new so(br(l),0)}if(a.ok||await _l(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await _l(l)}}function at(t){var e;let r=null;My(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=by(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 wl(t){const e=at(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 ar(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function Uy(t){return{data:t,error:null}}function By(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=ti(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 kl(t){return t}function My(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const xi=["global","local","others"];class Hy{_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=Du(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=xi[0]){if(xi.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${xi.join(", ")}`);try{return await B(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if(I(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await B(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ti(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 B(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:By,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(I(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await B(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ar})}catch(r){if(I(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 B(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:kl});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)),k=JSON.parse(p.split(";")[1].split("=")[1]);c[`${k}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Lt(e);try{return await B(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ar})}catch(r){if(I(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Lt(e);try{return await B(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Lt(e);try{return await B(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ar})}catch(n){if(I(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Lt(e.userId);try{const{data:r,error:n}=await B(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(I(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Lt(e.userId),Lt(e.id);try{return{data:await B(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if(I(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 B(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:kl});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)),k=JSON.parse(p.split(";")[1].split("=")[1]);c[`${k}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(I(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await B(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const n=this._encodePathSegment(e);return await B(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await B(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(I(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await B(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const n=this._encodePathSegment(e);return await B(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if(I(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await B(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){ut(this.experimental),Lt(e.userId);try{return await B(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(I(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){ut(this.experimental),Lt(e.userId),Lt(e.passkeyId);try{return await B(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(I(r))return{data:null,error:r};throw r}}}function Sl(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const kt={debug:!!(globalThis&&Lu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Uu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class El extends Uu{}async function qy(t,e,r){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),kt.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),kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new El(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(kt.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 kt.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){kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{kt.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 kt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new El(`Lock "${t}" was released because another request stole it`)}throw i}}function Fy(){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 Bu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Vy(t){return parseInt(t,16)}function zy(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Wy(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(`
|
|
183
183
|
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Bu(t.address),p=u?`${u}://${n}`:n,y=t.statement?`${t.statement}
|
|
184
184
|
`:"",k=`${p} wants you to sign in with your Ethereum account:
|
|
185
185
|
${f}
|
|
@@ -194,14 +194,14 @@ Not Before: ${a.toISOString()}`),l&&(w+=`
|
|
|
194
194
|
Request ID: ${l}`),c){let b=`
|
|
195
195
|
Resources:`;for(const _ of c){if(!_||typeof _!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${_}`);b+=`
|
|
196
196
|
- ${_}`}w+=b}return`${k}
|
|
197
|
-
${w}`}class Re 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 Ps extends Re{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Ky({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 Re({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 Re({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 Re({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 Re({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 Re({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Re({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 Re({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Re({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(Mu(o)){if(i.rp.id!==o)return new Re({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({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 Re({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 Re({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 Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Gy({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 Re({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Re({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Mu(n)){if(r.rpId!==n)return new Re({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Re({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 Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Jy{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 oo=new Jy;function Tl(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=ti(t,["challenge","user","excludeCredentials"]),i=Gr(e).buffer,o=Object.assign(Object.assign({},r),{id:Gr(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:Gr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Al(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=ti(t,["challenge","allowCredentials"]),s=Gr(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:Gr(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function xl(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:kr(new Uint8Array(t.response.attestationObject)),clientDataJSON:kr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Rl(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:kr(new Uint8Array(s.authenticatorData)),clientDataJSON:kr(new Uint8Array(s.clientDataJSON)),signature:kr(new Uint8Array(s.signature)),userHandle:s.userHandle?kr(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Mu(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Is(){var t,e;return!!(Ne()&&"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 Hu(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ps("Browser returned unexpected credential type",e)}:{data:null,error:new Ps("Empty credential response",e)}}catch(e){return{data:null,error:Ky({error:e,options:t})}}}async function qu(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ps("Browser returned unexpected credential type",e)}:{data:null,error:new Ps("Empty credential response",e)}}catch(e){return{data:null,error:Gy({error:e,options:t})}}}const Yy={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Qy={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function js(...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]=js(a,o):n[i]=js(o)}else n[i]=o}return n}function Zy(t,e){return js(Yy,t,e||{})}function Xy(t,e){return js(Qy,t,e||{})}class ev{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??oo.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=Zy(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Hu({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=Xy(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await qu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new dt("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 tn("rpId is required for WebAuthn authentication")};try{if(!Is())return{data:null,error:new dt("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 I(o)?{data:null,error:o}:{data:null,error:new dt("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 tn("rpId is required for WebAuthn registration")};try{if(!Is())return{data:null,error:new dt("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 I(o)?{data:null,error:o}:{data:null,error:new dt("Unexpected error in register",o)}}}}Fy();const tv={url:iy,storageKey:oy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ay,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Cl(t,e,r){return await r()}const Lr={};class Vn{get jwks(){var e,r;return(r=(e=Lr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Lr[this.storageKey]=Object.assign(Object.assign({},Lr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Lr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Lr[this.storageKey]=Object.assign(Object.assign({},Lr[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({},tv),e);if(this.storageKey=o.storageKey,this.instanceID=(r=Vn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Vn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ne()){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 Hy({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Du(o.fetch),this.lock=o.lock||Cl,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&&Ne()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=qy:this.lock=Cl,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 ev(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:Lu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Sl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=Sl(this.memoryStorage)),Ne()&&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} (${ju}) ${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(Ne()&&(r=wy(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Ne()&&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),dy(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 I(r)?this._returnResult({error:r}):this._returnResult({error:new dt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await B(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:ot}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var 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 Nr(this.storage,this.storageKey)),i=await B(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:ot})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await B(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:ot})}else throw new ls("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await $e(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 $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await B(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:wl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await B(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:wl})}else throw new ls("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 $r;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(I(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:k,statement:w,options:b}=e;let _;if(Ne())if(typeof k=="object")_=k;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")_=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 k!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=k}const x=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href),D=await _.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const M=Bu(D[0]);let H=(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!H){const C=await _.request({method:"eth_chainId"});H=Vy(C)}const W={domain:x.host,address:M,statement:w,uri:x.href,version:"1",chainId:H,nonce:(s=b==null?void 0:b.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=b==null?void 0:b.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Wy(W),p=await _.request({method:"personal_sign",params:[zy(f),M]})}try{const{data:y,error:k}=await B(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:ot});if(k)throw k;if(!y||!y.session||!y.user){const w=new $r;return this._returnResult({data:{user:null,session:null},error:w})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:k})}catch(y){if(I(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:k,wallet:w,statement:b,options:_}=e;let x;if(Ne())if(typeof w=="object")x=w;else{const M=window;if("solana"in M&&typeof M.solana=="object"&&("signIn"in M.solana&&typeof M.solana.signIn=="function"||"signMessage"in M.solana&&typeof M.solana.signMessage=="function"))x=M.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 w!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const D=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in x&&x.signIn){const M=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),b?{statement:b}:null));let H;if(Array.isArray(M)&&M[0]&&typeof M[0]=="object")H=M[0];else if(M&&typeof M=="object"&&"signedMessage"in M&&"signature"in M)H=M;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)p=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),y=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${D.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(s=(n=_==null?void 0:_.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((a=_==null?void 0:_.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(u=_==null?void 0:_.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(`
|
|
198
|
-
`);const M=await x.signMessage(new TextEncoder().encode(p),"utf8");if(!M||!(M instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=M}}try{const{data:k,error:w}=await B(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:kr(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:ot});if(w)throw w;if(!k||!k.session||!k.user){const b=new $r;return this._returnResult({data:{user:null,session:null},error:b})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:w})}catch(k){if(I(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const r=await yr(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new fy;const{data:i,error:o}=await B(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ot});if(await $e(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new $r;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 $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await B(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:ot}),{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 $r;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(I(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 Nr(this.storage,this.storageKey));const{error:h}=await B(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 B(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 ls("You must provide either an email or phone number.")}catch(a){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(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 B(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ot});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(I(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 Nr(this.storage,this.storageKey));const c=await B(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:Uy});return!((i=c.data)===null||i===void 0)&&i.url&&Ne()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Ie;const{error:s}=await B(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(I(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 B(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 B(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 ls("You must provide either an email or phone number and a type")}catch(r){if(I(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 yr(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()<Ei:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await yr(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Ai()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=$y(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 B(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ar}):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 Ie}:await B(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:ar})})}catch(r){if(I(r))return as(r)&&(await this._removeSession(),await $e(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 Ie;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Nr(this.storage,this.storageKey));const{data:c,error:u}=await B(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:ar});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 $e(this.storage,`${this.storageKey}-code-verifier`),I(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 Ie;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=us(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(I(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 Ie;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(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!Ne())throw new cs("No browser detected.");if(e.error||e.error_description||e.error_code)throw new cs(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 pl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new cs("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 pl("No code detected.");const{data:_,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:_.session,redirectType:(n=_.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 cs("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<=Hr&&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:k,error:w}=await this._getUser(o);if(w)throw w;const b={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(s){if(I(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 yr(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&&!as(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&&!(hy(a)&&(a.status===404||a.status===401||a.status===403)||as(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await $e(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=_y(),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),as(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Nr(this.storage,this.storageKey,!0));try{return await B(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 $e(this.storage,`${this.storageKey}-code-verifier`),I(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(I(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 B(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 Ne()&&!(!((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(I(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 B(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:ot}),{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 $r}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(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 B(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(I(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 Ey(async s=>(s>0&&await Sy(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await B(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ot})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Ti(i)&&Date.now()+o-n<Hr})}catch(n){if(this._debug(r,"error",n),I(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),Ne()&&!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 yr(this.storage,this.storageKey);if(s&&this.userStorage){let o=await yr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await qr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Ai()}else if(s&&!s.user&&!s.user){const o=await yr(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await $e(this.storage,this.storageKey+"-user"),await qr(this.storage,this.storageKey,s)):s.user=Ai()}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()<Ei;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ei}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Ti(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 Ie;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new si;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Ie;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),I(i)){const o={data:null,error:i};return Ti(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 $e(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 qr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=bl(s);await qr(this.storage,this.storageKey,i)}else{const s=bl(r);await qr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await $e(this.storage,this.storageKey),await $e(this.storage,this.storageKey+"-code-verifier"),await $e(this.storage,this.storageKey+"-user"),this.userStorage&&await $e(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ne()&&(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(),Hr);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)/Hr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Hr}ms, refresh threshold is ${ro} ticks`),s<=ro&&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 Uu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ne()||!(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 Nr(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 B(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(I(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 B(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(I(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"?xl(e.webauthn.credential_response):Rl(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await B(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(I(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 B(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:Tl(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:Al(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(I(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}=us(e);let p=null;f.aal&&(p=f.aal);let y=p;const{data:{user:k},error:w}=await this.getUser(e);if(w)return this._returnResult({data:null,error:w});((n=(r=k==null?void 0:k.factors)===null||r===void 0?void 0:r.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const _=f.amr||[];return{data:{currentLevel:p,nextLevel:y,currentAuthenticationMethods:_},error:null}}catch(f){if(I(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=us(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 B(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 Ie})})}catch(r){if(I(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 Ie});const o=await B(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&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(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 Ie});const o=await B(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&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(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 B(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 Ie})})}catch(e){if(I(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 B(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 Ie})})}catch(r){if(I(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+cy>s)return n;const{data:i,error:o}=await B(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}}=us(n);r!=null&&r.allowExpired||Py(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=Iy(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,vy(`${a}.${l}`)))throw new io("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;ut(this.experimental);try{if(!Is())return this._returnResult({data:null,error:new dt("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=Al(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:oo.createNewAbortSignal(),{data:c,error:u}=await qu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new dt("WebAuthn ceremony failed",null)});const h=Rl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(I(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;ut(this.experimental);try{if(!Is())return this._returnResult({data:null,error:new dt("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=Tl(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:oo.createNewAbortSignal(),{data:l,error:c}=await Hu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new dt("WebAuthn ceremony failed",null)});const u=xl(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){ut(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 Ie});const{data:s,error:i}=await B(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(I(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){ut(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 Ie});const{data:i,error:o}=await B(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(I(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;ut(this.experimental);try{const{data:n,error:s}=await B(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(I(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){ut(this.experimental);try{const{data:r,error:n}=await B(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:ot});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(I(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){ut(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 Ie});const{data:s,error:i}=await B(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(I(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){ut(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 Ie});const{data:i,error:o}=await B(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(I(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){ut(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 Ie});const{error:i}=await B(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(I(r))return this._returnResult({data:null,error:r});throw r}}}Vn.nextInstanceID={};const rv=Vn,nv="2.106.2";let yn="";typeof Deno<"u"?yn="deno":typeof document<"u"?yn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?yn="react-native":yn="node";const sv={"X-Client-Info":`supabase-js-${yn}/${nv}`},iv={headers:sv},ov={schema:"public"},av={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},lv={},cv={enabled:!1,respectSamplingDecision:!0};function uv(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 Ri=null;const hv="@opentelemetry/api";function dv(){return Ri===null&&(Ri=import(hv).catch(()=>null)),Ri}function fv(){return uv(this,void 0,void 0,function*(){try{const t=yield dv();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 pv(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 gv(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(mv(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 mv(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 yv(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 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 vv(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 bv(t){var e=vv(t,"string");return zn(e)=="symbol"?e:e+""}function _v(t,e,r){return(e=bv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ol(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 ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ol(Object(r),!0).forEach(function(n){_v(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ol(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const wv=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),kv=()=>Headers,Sv=(t,e,r,n,s)=>{const i=wv(n),o=kv(),a=(s==null?void 0:s.enabled)===!0,l=(s==null?void 0:s.respectSamplingDecision)!==!1,c=a?yv(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 Ev(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,ke(ke({},h),{},{headers:p}))}};async function Ev(t,e,r){if(!gv(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await fv();if(!n||!n.traceparent)return null;if(r){const s=pv(n.traceparent);if(s&&!s.isSampled)return null}return n}function Pl(t){return typeof t=="boolean"?{enabled:t}:t}function Tv(t){return t.endsWith("/")?t:t+"/"}function Av(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,k=Pl(t.tracePropagation),w=Pl(e.tracePropagation),b={db:ke(ke({},d),l),auth:ke(ke({},f),c),realtime:ke(ke({},p),u),storage:{},global:ke(ke(ke({},y),h),{},{headers:ke(ke({},(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=k==null?void 0:k.enabled)!==null&&i!==void 0?i:w==null?void 0:w.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=k==null?void 0:k.respectSamplingDecision)!==null&&a!==void 0?a:w==null?void 0:w.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?b.accessToken=t.accessToken:delete b.accessToken,b}function xv(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(Tv(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Rv=class extends rv{constructor(t){super(t)}},Cv=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=xv(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:ov,realtime:lv,auth:ke(ke({},av),{},{storageKey:o}),global:iv,tracePropagation:cv},l=Av(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=Sv(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(ke({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 zg(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 sy(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Ng(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 Rv({url:this.authUrl.href,headers:ke(ke({},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(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new xm(this.realtimeUrl.href,ke(ke({},t),{},{params:ke(ke({},{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 Ov=(t,e,r)=>new Cv(t,e,r);function Pv(){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}Pv()&&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 Fu=null,Il=!1;async function Iv(){if(!Il){Il=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Fu=Ov(e,r))}catch{}}}function hs(){return Fu}const Qn=au("auth",()=>{const t=et(localStorage.getItem("io_token")),e=et(localStorage.getItem("io_email")),r=et(!1);let n=null;const s=Ue(()=>!!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=hs();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=hs();if(!f)throw new Error("Auth not configured");r.value=!0;try{const{data:k,error:w}=await f.auth.signInWithPassword({email:h,password:d});if(w)throw w;t.value=((p=k.session)==null?void 0:p.access_token)??null,e.value=((y=k.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=hs();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=hs();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}}),jv=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:Qn},Symbol.toStringTag,{value:"Module"})),$v={class:"h-12 border-b border-border bg-header flex items-center justify-between px-4 shrink-0"},Nv={class:"flex items-center gap-2"},Lv={class:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",title:"User"},Dv=ur({__name:"AppHeader",setup(t){const e=Qn(),r=Xp();async function n(){await e.logout(),r.push("/login")}return(s,i)=>{const o=So("router-link");return oe(),Ee("header",$v,[i[0]||(i[0]=ve("div",null,null,-1)),ve("div",Nv,[ue(o,{to:"/feed",class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Inbox"},{default:Kr(()=>[ue(_e(_u),{class:"w-4 h-4"})]),_:1}),ve("div",Lv,[ue(_e(kg),{class:"w-3.5 h-3.5 text-muted-foreground"})]),ve("button",{onClick:n,class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[ue(_e(dg),{class:"w-4 h-4"})])])])}}}),Uv=5e3;function Bv(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}const Mv=au("chat",()=>{const t=et([]),e=et(!1),r=et(null),n=et(crypto.randomUUID());function s(l,c=[]){const u={id:crypto.randomUUID(),role:"user",content:l,attachments:c,timestamp:new Date};return t.value.push(u),u}async function i(l,c=[]){s(l,c),e.value=!0;const u={id:crypto.randomUUID(),role:"assistant",content:"",attachments:[],timestamp:new Date,streaming:!0};t.value.push(u);let h=Date.now();try{const d=Qn();d.token&&Bv(d.token)&&await d.refreshToken();const f={"Content-Type":"application/json"};d.token&&(f.Authorization=`Bearer ${d.token}`);const p=await fetch("/api/message",{method:"POST",headers:f,body:JSON.stringify({prompt:l,conversationId:n.value,attachments:c})});if(!p.ok||!p.body)throw new Error(`API error: ${p.status}`);const y=p.body.getReader(),k=new TextDecoder;let w="";for(;;){const{done:b,value:_}=await y.read();if(b)break;w+=k.decode(_,{stream:!0});const x=w.split(`
|
|
199
|
-
`);w=x.pop()??"";let D="";for(const M of x)if(M.startsWith("event: "))D=M.slice(7);else if(M.startsWith("data: ")){const H=M.slice(6);try{const W=JSON.parse(H);if(D==="delta"){const C=Date.now(),q=t.value[t.value.length-1];if(q&&!q.streaming&&q.role==="assistant"&&C-h>Uv){const Q={id:crypto.randomUUID(),role:"assistant",content:W.content,attachments:[],timestamp:new Date,streaming:!0};t.value.push(Q)}else{const Q=t.value.filter(X=>X.streaming),j=Q[Q.length-1];j&&(j.content=W.content)}h=C}else if(D==="done"){const C=t.value.filter(Q=>Q.streaming),q=C[C.length-1];q&&(q.content=W.content,q.streaming=!1),W.conversationId&&(n.value=W.conversationId)}else if(D==="error"){const C=t.value.filter(Q=>Q.streaming),q=C[C.length-1];q&&(q.content=`Error: ${W.error}`,q.streaming=!1)}}catch{}D=""}else M.startsWith(":")}}catch(d){const f=t.value.filter(y=>y.streaming),p=f[f.length-1];p&&(p.content=`Error: ${d.message}`,p.streaming=!1)}finally{e.value=!1}}function o(l){const c=t.value[t.value.length-1];c!=null&&c.streaming&&(c.content=l)}function a(){t.value=[],n.value=crypto.randomUUID()}return{messages:t,isStreaming:e,eventSource:r,conversationId:n,sendMessage:i,updateStreamingMessage:o,clearMessages:a}});function jo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var xr=jo();function Vu(t){xr=t}var
|
|
200
|
-
]`).replace("lheading",Wu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gu=/^( {2,}|\\)\n(?!\s*$)/,tb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oi=/[\p{P}\p{S}]/u,Bo=/[\s\p{P}\p{S}]/u,Ju=/[^\s\p{P}\p{S}]/u,rb=
|
|
197
|
+
${w}`}class Re 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 Ps extends Re{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function Ky({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 Re({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 Re({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 Re({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 Re({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 Re({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Re({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 Re({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Re({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(Mu(o)){if(i.rp.id!==o)return new Re({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({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 Re({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 Re({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 Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function Gy({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 Re({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Re({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Mu(n)){if(r.rpId!==n)return new Re({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Re({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Re({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 Re({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class Jy{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 oo=new Jy;function Tl(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=ti(t,["challenge","user","excludeCredentials"]),i=Jr(e).buffer,o=Object.assign(Object.assign({},r),{id:Jr(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:Jr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Al(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=ti(t,["challenge","allowCredentials"]),s=Jr(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:Jr(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function xl(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:kr(new Uint8Array(t.response.attestationObject)),clientDataJSON:kr(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Rl(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:kr(new Uint8Array(s.authenticatorData)),clientDataJSON:kr(new Uint8Array(s.clientDataJSON)),signature:kr(new Uint8Array(s.signature)),userHandle:s.userHandle?kr(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Mu(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function Is(){var t,e;return!!(Ne()&&"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 Hu(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ps("Browser returned unexpected credential type",e)}:{data:null,error:new Ps("Empty credential response",e)}}catch(e){return{data:null,error:Ky({error:e,options:t})}}}async function qu(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Ps("Browser returned unexpected credential type",e)}:{data:null,error:new Ps("Empty credential response",e)}}catch(e){return{data:null,error:Gy({error:e,options:t})}}}const Yy={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Qy={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function js(...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]=js(a,o):n[i]=js(o)}else n[i]=o}return n}function Zy(t,e){return js(Yy,t,e||{})}function Xy(t,e){return js(Qy,t,e||{})}class ev{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??oo.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=Zy(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Hu({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=Xy(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await qu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return I(a)?{data:null,error:a}:{data:null,error:new dt("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(!Is())return{data:null,error:new dt("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 I(o)?{data:null,error:o}:{data:null,error:new dt("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(!Is())return{data:null,error:new dt("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 I(o)?{data:null,error:o}:{data:null,error:new dt("Unexpected error in register",o)}}}}Fy();const tv={url:iy,storageKey:oy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:ay,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Cl(t,e,r){return await r()}const Lr={};class zn{get jwks(){var e,r;return(r=(e=Lr[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Lr[this.storageKey]=Object.assign(Object.assign({},Lr[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Lr[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Lr[this.storageKey]=Object.assign(Object.assign({},Lr[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({},tv),e);if(this.storageKey=o.storageKey,this.instanceID=(r=zn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,zn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ne()){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 Hy({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Du(o.fetch),this.lock=o.lock||Cl,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&&Ne()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=qy:this.lock=Cl,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 ev(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:Lu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Sl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=Sl(this.memoryStorage)),Ne()&&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} (${ju}) ${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(Ne()&&(r=wy(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),Ne()&&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),dy(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 I(r)?this._returnResult({error:r}):this._returnResult({error:new dt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await B(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:at}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var 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 Nr(this.storage,this.storageKey)),i=await B(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:at})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await B(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:at})}else throw new cs("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await $e(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 $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await B(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:wl})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await B(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:wl})}else throw new cs("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 $r;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(I(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:k,statement:w,options:b}=e;let _;if(Ne())if(typeof k=="object")_=k;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")_=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 k!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=k}const x=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href),D=await _.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const M=Bu(D[0]);let H=(n=b==null?void 0:b.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!H){const C=await _.request({method:"eth_chainId"});H=Vy(C)}const W={domain:x.host,address:M,statement:w,uri:x.href,version:"1",chainId:H,nonce:(s=b==null?void 0:b.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=b==null?void 0:b.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=b==null?void 0:b.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=b==null?void 0:b.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=b==null?void 0:b.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=b==null?void 0:b.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Wy(W),p=await _.request({method:"personal_sign",params:[zy(f),M]})}try{const{data:y,error:k}=await B(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:at});if(k)throw k;if(!y||!y.session||!y.user){const w=new $r;return this._returnResult({data:{user:null,session:null},error:w})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:k})}catch(y){if(I(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:k,wallet:w,statement:b,options:_}=e;let x;if(Ne())if(typeof w=="object")x=w;else{const M=window;if("solana"in M&&typeof M.solana=="object"&&("signIn"in M.solana&&typeof M.solana.signIn=="function"||"signMessage"in M.solana&&typeof M.solana.signMessage=="function"))x=M.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 w!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const D=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in x&&x.signIn){const M=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},_==null?void 0:_.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),b?{statement:b}:null));let H;if(Array.isArray(M)&&M[0]&&typeof M[0]=="object")H=M[0];else if(M&&typeof M=="object"&&"signedMessage"in M&&"signature"in M)H=M;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)p=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),y=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${D.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),...b?["",b,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(s=(n=_==null?void 0:_.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=_==null?void 0:_.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${_.signInWithSolana.notBefore}`]:[],...!((o=_==null?void 0:_.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${_.signInWithSolana.expirationTime}`]:[],...!((a=_==null?void 0:_.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${_.signInWithSolana.chainId}`]:[],...!((l=_==null?void 0:_.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${_.signInWithSolana.nonce}`]:[],...!((c=_==null?void 0:_.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${_.signInWithSolana.requestId}`]:[],...!((h=(u=_==null?void 0:_.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",..._.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(`
|
|
198
|
+
`);const M=await x.signMessage(new TextEncoder().encode(p),"utf8");if(!M||!(M instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=M}}try{const{data:k,error:w}=await B(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:kr(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:at});if(w)throw w;if(!k||!k.session||!k.user){const b=new $r;return this._returnResult({data:{user:null,session:null},error:b})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:w})}catch(k){if(I(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(e){const r=await yr(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new fy;const{data:i,error:o}=await B(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:at});if(await $e(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new $r;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 $e(this.storage,`${this.storageKey}-code-verifier`),I(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await B(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:at}),{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 $r;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(I(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 Nr(this.storage,this.storageKey));const{error:h}=await B(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 B(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 cs("You must provide either an email or phone number.")}catch(a){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(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 B(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:at});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(I(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 Nr(this.storage,this.storageKey));const c=await B(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:Uy});return!((i=c.data)===null||i===void 0)&&i.url&&Ne()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Ie;const{error:s}=await B(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(I(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 B(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 B(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 cs("You must provide either an email or phone number and a type")}catch(r){if(I(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 yr(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()<Ei:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await yr(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Ai()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=$y(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 B(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ar}):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 Ie}:await B(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:ar})})}catch(r){if(I(r))return ls(r)&&(await this._removeSession(),await $e(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 Ie;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Nr(this.storage,this.storageKey));const{data:c,error:u}=await B(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:ar});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 $e(this.storage,`${this.storageKey}-code-verifier`),I(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 Ie;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=hs(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(I(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 Ie;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(I(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!Ne())throw new us("No browser detected.");if(e.error||e.error_description||e.error_code)throw new us(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 pl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new us("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 pl("No code detected.");const{data:_,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:_.session,redirectType:(n=_.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 us("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<=Hr&&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:k,error:w}=await this._getUser(o);if(w)throw w;const b={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(s){if(I(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 yr(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&&!ls(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&&!(hy(a)&&(a.status===404||a.status===401||a.status===403)||ls(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await $e(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=_y(),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),ls(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Nr(this.storage,this.storageKey,!0));try{return await B(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 $e(this.storage,`${this.storageKey}-code-verifier`),I(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(I(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 B(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 Ne()&&!(!((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(I(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 B(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:at}),{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 $r}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await $e(this.storage,`${this.storageKey}-code-verifier`),I(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 B(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(I(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 Ey(async s=>(s>0&&await Sy(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await B(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:at})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Ti(i)&&Date.now()+o-n<Hr})}catch(n){if(this._debug(r,"error",n),I(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),Ne()&&!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 yr(this.storage,this.storageKey);if(s&&this.userStorage){let o=await yr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await qr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Ai()}else if(s&&!s.user&&!s.user){const o=await yr(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await $e(this.storage,this.storageKey+"-user"),await qr(this.storage,this.storageKey,s)):s.user=Ai()}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()<Ei;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ei}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Ti(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 Ie;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new si;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Ie;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),I(i)){const o={data:null,error:i};return Ti(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 $e(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 qr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=bl(s);await qr(this.storage,this.storageKey,i)}else{const s=bl(r);await qr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await $e(this.storage,this.storageKey),await $e(this.storage,this.storageKey+"-code-verifier"),await $e(this.storage,this.storageKey+"-user"),this.userStorage&&await $e(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&Ne()&&(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(),Hr);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)/Hr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Hr}ms, refresh threshold is ${ro} ticks`),s<=ro&&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 Uu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ne()||!(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 Nr(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 B(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(I(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 B(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(I(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"?xl(e.webauthn.credential_response):Rl(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await B(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(I(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 B(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:Tl(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:Al(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(I(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}=hs(e);let p=null;f.aal&&(p=f.aal);let y=p;const{data:{user:k},error:w}=await this.getUser(e);if(w)return this._returnResult({data:null,error:w});((n=(r=k==null?void 0:k.factors)===null||r===void 0?void 0:r.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const _=f.amr||[];return{data:{currentLevel:p,nextLevel:y,currentAuthenticationMethods:_},error:null}}catch(f){if(I(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=hs(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 B(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 Ie})})}catch(r){if(I(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 Ie});const o=await B(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&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(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 Ie});const o=await B(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&&Ne()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(I(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 B(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 Ie})})}catch(e){if(I(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 B(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 Ie})})}catch(r){if(I(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+cy>s)return n;const{data:i,error:o}=await B(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}}=hs(n);r!=null&&r.allowExpired||Py(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=Iy(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,vy(`${a}.${l}`)))throw new io("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if(I(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;ut(this.experimental);try{if(!Is())return this._returnResult({data:null,error:new dt("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=Al(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:oo.createNewAbortSignal(),{data:c,error:u}=await qu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new dt("WebAuthn ceremony failed",null)});const h=Rl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(I(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;ut(this.experimental);try{if(!Is())return this._returnResult({data:null,error:new dt("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=Tl(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:oo.createNewAbortSignal(),{data:l,error:c}=await Hu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new dt("WebAuthn ceremony failed",null)});const u=xl(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(I(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){ut(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 Ie});const{data:s,error:i}=await B(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(I(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){ut(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 Ie});const{data:i,error:o}=await B(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(I(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;ut(this.experimental);try{const{data:n,error:s}=await B(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(I(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){ut(this.experimental);try{const{data:r,error:n}=await B(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:at});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(I(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){ut(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 Ie});const{data:s,error:i}=await B(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(I(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){ut(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 Ie});const{data:i,error:o}=await B(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(I(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){ut(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 Ie});const{error:i}=await B(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(I(r))return this._returnResult({data:null,error:r});throw r}}}zn.nextInstanceID={};const rv=zn,nv="2.106.2";let vn="";typeof Deno<"u"?vn="deno":typeof document<"u"?vn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?vn="react-native":vn="node";const sv={"X-Client-Info":`supabase-js-${vn}/${nv}`},iv={headers:sv},ov={schema:"public"},av={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},lv={},cv={enabled:!1,respectSamplingDecision:!0};function uv(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 Ri=null;const hv="@opentelemetry/api";function dv(){return Ri===null&&(Ri=import(hv).catch(()=>null)),Ri}function fv(){return uv(this,void 0,void 0,function*(){try{const t=yield dv();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 pv(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 gv(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(mv(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 mv(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 yv(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 Wn(t){"@babel/helpers - typeof";return Wn=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},Wn(t)}function vv(t,e){if(Wn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Wn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function bv(t){var e=vv(t,"string");return Wn(e)=="symbol"?e:e+""}function _v(t,e,r){return(e=bv(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ol(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 ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ol(Object(r),!0).forEach(function(n){_v(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ol(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const wv=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),kv=()=>Headers,Sv=(t,e,r,n,s)=>{const i=wv(n),o=kv(),a=(s==null?void 0:s.enabled)===!0,l=(s==null?void 0:s.respectSamplingDecision)!==!1,c=a?yv(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 Ev(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,ke(ke({},h),{},{headers:p}))}};async function Ev(t,e,r){if(!gv(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await fv();if(!n||!n.traceparent)return null;if(r){const s=pv(n.traceparent);if(s&&!s.isSampled)return null}return n}function Pl(t){return typeof t=="boolean"?{enabled:t}:t}function Tv(t){return t.endsWith("/")?t:t+"/"}function Av(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,k=Pl(t.tracePropagation),w=Pl(e.tracePropagation),b={db:ke(ke({},d),l),auth:ke(ke({},f),c),realtime:ke(ke({},p),u),storage:{},global:ke(ke(ke({},y),h),{},{headers:ke(ke({},(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=k==null?void 0:k.enabled)!==null&&i!==void 0?i:w==null?void 0:w.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=k==null?void 0:k.respectSamplingDecision)!==null&&a!==void 0?a:w==null?void 0:w.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?b.accessToken=t.accessToken:delete b.accessToken,b}function xv(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(Tv(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Rv=class extends rv{constructor(t){super(t)}},Cv=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=xv(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:ov,realtime:lv,auth:ke(ke({},av),{},{storageKey:o}),global:iv,tracePropagation:cv},l=Av(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=Sv(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(ke({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 zg(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 sy(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Ng(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 Rv({url:this.authUrl.href,headers:ke(ke({},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(k=>k.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new xm(this.realtimeUrl.href,ke(ke({},t),{},{params:ke(ke({},{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 Ov=(t,e,r)=>new Cv(t,e,r);function Pv(){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}Pv()&&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 Fu=null,Il=!1;async function Iv(){if(!Il){Il=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Fu=Ov(e,r))}catch{}}}function ds(){return Fu}const Zn=au("auth",()=>{const t=tt(localStorage.getItem("io_token")),e=tt(localStorage.getItem("io_email")),r=tt(!1);let n=null;const s=Le(()=>!!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=ds();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=ds();if(!f)throw new Error("Auth not configured");r.value=!0;try{const{data:k,error:w}=await f.auth.signInWithPassword({email:h,password:d});if(w)throw w;t.value=((p=k.session)==null?void 0:p.access_token)??null,e.value=((y=k.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=ds();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=ds();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}}),jv=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:Zn},Symbol.toStringTag,{value:"Module"})),$v={class:"h-12 border-b border-border bg-header flex items-center justify-between px-4 shrink-0"},Nv={class:"flex items-center gap-2"},Lv={class:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",title:"User"},Dv=ur({__name:"AppHeader",setup(t){const e=Zn(),r=Xp();async function n(){await e.logout(),r.push("/login")}return(s,i)=>{const o=So("router-link");return ae(),Ee("header",$v,[i[0]||(i[0]=te("div",null,null,-1)),te("div",Nv,[ue(o,{to:"/feed",class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Inbox"},{default:Gr(()=>[ue(be(_u),{class:"w-4 h-4"})]),_:1}),te("div",Lv,[ue(be(kg),{class:"w-3.5 h-3.5 text-muted-foreground"})]),te("button",{onClick:n,class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[ue(be(dg),{class:"w-4 h-4"})])])])}}}),Uv=5e3;function Bv(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}const Mv=au("chat",()=>{const t=tt([]),e=tt(!1),r=tt(null),n=tt(crypto.randomUUID());function s(l,c=[]){const u={id:crypto.randomUUID(),role:"user",content:l,attachments:c,timestamp:new Date};return t.value.push(u),u}async function i(l,c=[]){s(l,c),e.value=!0;const u={id:crypto.randomUUID(),role:"assistant",content:"",attachments:[],timestamp:new Date,streaming:!0};t.value.push(u);let h=Date.now();try{const d=Zn();d.token&&Bv(d.token)&&await d.refreshToken();const f={"Content-Type":"application/json"};d.token&&(f.Authorization=`Bearer ${d.token}`);const p=await fetch("/api/message",{method:"POST",headers:f,body:JSON.stringify({prompt:l,conversationId:n.value,attachments:c})});if(!p.ok||!p.body)throw new Error(`API error: ${p.status}`);const y=p.body.getReader(),k=new TextDecoder;let w="";for(;;){const{done:b,value:_}=await y.read();if(b)break;w+=k.decode(_,{stream:!0});const x=w.split(`
|
|
199
|
+
`);w=x.pop()??"";let D="";for(const M of x)if(M.startsWith("event: "))D=M.slice(7);else if(M.startsWith("data: ")){const H=M.slice(6);try{const W=JSON.parse(H);if(D==="delta"){const C=Date.now(),q=t.value[t.value.length-1];if(q&&!q.streaming&&q.role==="assistant"&&C-h>Uv){const Q={id:crypto.randomUUID(),role:"assistant",content:W.content,attachments:[],timestamp:new Date,streaming:!0};t.value.push(Q)}else{const Q=t.value.filter(X=>X.streaming),j=Q[Q.length-1];j&&(j.content=W.content)}h=C}else if(D==="done"){const C=t.value.filter(Q=>Q.streaming),q=C[C.length-1];q&&(q.content=W.content,q.streaming=!1),W.conversationId&&(n.value=W.conversationId)}else if(D==="error"){const C=t.value.filter(Q=>Q.streaming),q=C[C.length-1];q&&(q.content=`Error: ${W.error}`,q.streaming=!1)}}catch{}D=""}else M.startsWith(":")}}catch(d){const f=t.value.filter(y=>y.streaming),p=f[f.length-1];p&&(p.content=`Error: ${d.message}`,p.streaming=!1)}finally{e.value=!1}}function o(l){const c=t.value[t.value.length-1];c!=null&&c.streaming&&(c.content=l)}function a(){t.value=[],n.value=crypto.randomUUID()}return{messages:t,isStreaming:e,eventSource:r,conversationId:n,sendMessage:i,updateStreamingMessage:o,clearMessages:a}});function jo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var xr=jo();function Vu(t){xr=t}var Pn={exec:()=>null};function ce(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(ze.caret,"$1"),r=r.replace(s,o),n},getRegex:()=>new RegExp(r,e)};return n}var ze={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")},Hv=/^(?:[ \t]*(?:\n|$))+/,qv=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fv=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vv=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,$o=/(?:[*+-]|\d{1,9}[.)])/,zu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wu=ce(zu).replace(/bull/g,$o).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(),zv=ce(zu).replace(/bull/g,$o).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(),No=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Wv=/^[^\n]+/,Lo=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Kv=ce(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Lo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Gv=ce(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,$o).getRegex(),ii="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",Do=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Jv=ce("^ {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",Do).replace("tag",ii).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ku=ce(No).replace("hr",Xn).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",ii).getRegex(),Yv=ce(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ku).getRegex(),Uo={blockquote:Yv,code:qv,def:Kv,fences:Fv,heading:Vv,hr:Xn,html:Jv,lheading:Wu,list:Gv,newline:Hv,paragraph:Ku,table:Pn,text:Wv},jl=ce("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xn).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",ii).getRegex(),Qv={...Uo,lheading:zv,table:jl,paragraph:ce(No).replace("hr",Xn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",jl).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",ii).getRegex()},Zv={...Uo,html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Do).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:Pn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ce(No).replace("hr",Xn).replace("heading",` *#{1,6} *[^
|
|
200
|
+
]`).replace("lheading",Wu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xv=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,eb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gu=/^( {2,}|\\)\n(?!\s*$)/,tb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,oi=/[\p{P}\p{S}]/u,Bo=/[\s\p{P}\p{S}]/u,Ju=/[^\s\p{P}\p{S}]/u,rb=ce(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Bo).getRegex(),Yu=/(?!~)[\p{P}\p{S}]/u,nb=/(?!~)[\s\p{P}\p{S}]/u,sb=/(?:[^\s\p{P}\p{S}]|~)/u,ib=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Qu=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ob=ce(Qu,"u").replace(/punct/g,oi).getRegex(),ab=ce(Qu,"u").replace(/punct/g,Yu).getRegex(),Zu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",lb=ce(Zu,"gu").replace(/notPunctSpace/g,Ju).replace(/punctSpace/g,Bo).replace(/punct/g,oi).getRegex(),cb=ce(Zu,"gu").replace(/notPunctSpace/g,sb).replace(/punctSpace/g,nb).replace(/punct/g,Yu).getRegex(),ub=ce("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Ju).replace(/punctSpace/g,Bo).replace(/punct/g,oi).getRegex(),hb=ce(/\\(punct)/,"gu").replace(/punct/g,oi).getRegex(),db=ce(/^<(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(),fb=ce(Do).replace("(?:-->|$)","-->").getRegex(),pb=ce("^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",fb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),$s=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,gb=ce(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",$s).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xu=ce(/^!?\[(label)\]\[(ref)\]/).replace("label",$s).replace("ref",Lo).getRegex(),eh=ce(/^!?\[(ref)\](?:\[\])?/).replace("ref",Lo).getRegex(),mb=ce("reflink|nolink(?!\\()","g").replace("reflink",Xu).replace("nolink",eh).getRegex(),Mo={_backpedal:Pn,anyPunctuation:hb,autolink:db,blockSkip:ib,br:Gu,code:eb,del:Pn,emStrongLDelim:ob,emStrongRDelimAst:lb,emStrongRDelimUnd:ub,escape:Xv,link:gb,nolink:eh,punctuation:rb,reflink:Xu,reflinkSearch:mb,tag:pb,text:tb,url:Pn},yb={...Mo,link:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",$s).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",$s).getRegex()},ao={...Mo,emStrongRDelimAst:cb,emStrongLDelim:ab,url:ce(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},vb={...ao,br:ce(Gu).replace("{2,}","*").getRegex(),text:ce(ao.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},fs={normal:Uo,gfm:Qv,pedantic:Zv},fn={normal:Mo,gfm:ao,breaks:vb,pedantic:yb},bb={"&":"&","<":"<",">":">",'"':""","'":"'"},$l=t=>bb[t];function St(t,e){if(e){if(ze.escapeTest.test(t))return t.replace(ze.escapeReplace,$l)}else if(ze.escapeTestNoEncode.test(t))return t.replace(ze.escapeReplaceNoEncode,$l);return t}function Nl(t){try{t=encodeURI(t).replace(ze.percentDecode,"%")}catch{return null}return t}function Ll(t,e){var i;const r=t.replace(ze.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(ze.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(ze.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 _b(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 Dl(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 wb(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const s=n[1];return e.split(`
|
|
201
201
|
`).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(`
|
|
202
|
-
`)}var Ns=class{constructor(t){
|
|
203
|
-
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=wb(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=
|
|
204
|
-
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=
|
|
202
|
+
`)}var Ns=class{constructor(t){pe(this,"options");pe(this,"rules");pe(this,"lexer");this.options=t||xr}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,`
|
|
203
|
+
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=wb(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],`
|
|
204
|
+
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=pn(e[0],`
|
|
205
205
|
`).split(`
|
|
206
206
|
`),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(`
|
|
207
207
|
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -221,7 +221,7 @@ ${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
221
221
|
`+d}!f&&!d.trim()&&(f=!0),c+=M+`
|
|
222
222
|
`,t=t.substring(M.length+1),h=H.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,k;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(k=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!y,checked:k,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=Ll(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(`
|
|
223
223
|
`):[],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(Ll(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)===`
|
|
224
|
-
`?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=
|
|
224
|
+
`?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=_b(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)),Dl(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 Dl(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}}}},Ft=class lo{constructor(e){pe(this,"tokens");pe(this,"options");pe(this,"state");pe(this,"tokenizer");pe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||xr,this.options.tokenizer=this.options.tokenizer||new Ns,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:ze,block:fs.normal,inline:fn.normal};this.options.pedantic?(r.block=fs.pedantic,r.inline=fn.pedantic):this.options.gfm&&(r.block=fs.gfm,this.options.breaks?r.inline=fn.breaks:r.inline=fn.gfm),this.tokenizer.rules=r}static get rules(){return{block:fs,inline:fn}}static lex(e,r){return new lo(r).lex(e)}static lexInline(e,r){return new lo(r).inlineTokens(e)}lex(e){e=e.replace(ze.carriageReturn,`
|
|
225
225
|
`),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(ze.tabCharGlobal," ").replace(ze.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+=`
|
|
226
226
|
`: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+=`
|
|
227
227
|
`+a.raw,c.text+=`
|
|
@@ -231,7 +231,7 @@ ${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
231
231
|
`+a.raw,c.text+=`
|
|
232
232
|
`+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+=`
|
|
233
233
|
`+a.raw,c.text+=`
|
|
234
|
-
`+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}},Ls=class{constructor(t){
|
|
234
|
+
`+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}},Ls=class{constructor(t){pe(this,"options");pe(this,"parser");this.options=t||xr}space(t){return""}code({text:t,lang:e,escaped:r}){var i;const n=(i=(e||"").match(ze.notSpaceStart))==null?void 0:i[0],s=t.replace(ze.endingNewline,"")+`
|
|
235
235
|
`;return n?'<pre><code class="language-'+St(n)+'">'+(r?s:St(s,!0))+`</code></pre>
|
|
236
236
|
`:"<pre><code>"+(r?s:St(s,!0))+`</code></pre>
|
|
237
237
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
@@ -249,6 +249,6 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
249
249
|
`}tablerow({text:t}){return`<tr>
|
|
250
250
|
${t}</tr>
|
|
251
251
|
`}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
252
|
-
`}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>${St(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=Nl(t);if(s===null)return n;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+St(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=Nl(t);if(s===null)return St(r);t=s;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${St(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:St(t.text)}},Ho=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""}},Vt=class co{constructor(e){
|
|
253
|
-
`+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}},Ci,vs=(Ci=class{constructor(t){
|
|
254
|
-
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+St(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ar=new kb;function
|
|
252
|
+
`}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>${St(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=Nl(t);if(s===null)return n;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+St(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=Nl(t);if(s===null)return St(r);t=s;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${St(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:St(t.text)}},Ho=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""}},Vt=class co{constructor(e){pe(this,"options");pe(this,"renderer");pe(this,"textRenderer");this.options=e||xr,this.options.renderer=this.options.renderer||new Ls,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ho}static parse(e,r){return new co(r).parse(e)}static parseInline(e,r){return new co(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+=`
|
|
253
|
+
`+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}},Ci,vs=(Ci=class{constructor(t){pe(this,"options");pe(this,"block");this.options=t||xr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ft.lex:Ft.lexInline}provideParser(){return this.block?Vt.parse:Vt.parseInline}},pe(Ci,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ci),kb=class{constructor(...t){pe(this,"defaults",jo());pe(this,"options",this.setOptions);pe(this,"parse",this.parseMarkdown(!0));pe(this,"parseInline",this.parseMarkdown(!1));pe(this,"Parser",Vt);pe(this,"Renderer",Ls);pe(this,"TextRenderer",Ho);pe(this,"Lexer",Ft);pe(this,"Tokenizer",Ns);pe(this,"Hooks",vs);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 Ls(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 Ns(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 vs;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];vs.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 Ft.lex(t,e??this.defaults)}parser(t,e){return Vt.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?Ft.lex:Ft.lexInline,l=i.hooks?i.hooks.provideParser():t?Vt.parse:Vt.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+=`
|
|
254
|
+
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+St(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ar=new kb;function he(t,e){return Ar.parse(t,e)}he.options=he.setOptions=function(t){return Ar.setOptions(t),he.defaults=Ar.defaults,Vu(he.defaults),he};he.getDefaults=jo;he.defaults=xr;he.use=function(...t){return Ar.use(...t),he.defaults=Ar.defaults,Vu(he.defaults),he};he.walkTokens=function(t,e){return Ar.walkTokens(t,e)};he.parseInline=Ar.parseInline;he.Parser=Vt;he.parser=Vt.parse;he.Renderer=Ls;he.TextRenderer=Ho;he.Lexer=Ft;he.lexer=Ft.lex;he.Tokenizer=Ns;he.Hooks=vs;he.parse=he;he.options;he.setOptions;he.use;he.walkTokens;he.parseInline;Vt.parse;Ft.lex;const Sb=["innerHTML"],Eb=ur({__name:"MarkdownContent",props:{content:{}},setup(t){const e=t,r=Le(()=>e.content?he.parse(e.content,{async:!1}):"");return(n,s)=>(ae(),Ee("div",{class:"prose prose-sm dark:prose-invert max-w-none",innerHTML:r.value},null,8,Sb))}}),Tb={key:0,class:"overlay-panel","aria-label":"IO Assistant chat"},Ab={class:"overlay-header"},xb={key:0,class:"flex h-full items-center justify-center"},Rb={class:"text-center"},Cb={class:"mx-auto mb-3 flex h-9 w-9 items-center justify-center rounded-full bg-primary/15 text-primary"},Ob={key:1,class:"text-muted-foreground"},Pb={class:"mt-1.5 flex items-center justify-between gap-3"},Ib={key:2,class:"mt-1 inline-block h-3 w-1.5 animate-pulse rounded-sm bg-current"},jb={class:"overlay-footer"},$b={class:"flex items-end gap-2"},Nb=["disabled","aria-label","title"],Lb=ur({__name:"ChatOverlay",setup(t){const e=Mv(),r=Oo(),n=tt(!1),s=tt(""),i=tt(),o=Le(()=>e.messages.length>0),a=()=>r.path==="/";function l(){a()||(n.value=!n.value)}async function c(){const f=s.value.trim();!f||e.isStreaming||(s.value="",await e.sendMessage(f))}function u(f){f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),c())}function h(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}function d(f){return new Date(f).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}return Er(()=>e.messages.map(f=>f.content),async()=>{await Qr(),h()},{deep:!0}),Er(()=>e.messages.length,async()=>{await Qr(),h()}),(f,p)=>(ae(),Ee(Qe,null,[!n.value&&!a()?(ae(),Ee("button",{key:0,onClick:l,class:"overlay-fab",title:"Chat with IO","aria-label":"Open chat overlay"},[ue(be(Za),{class:"w-5 h-5 text-white"})])):Ze("",!0),ue(cf,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-95","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-95"},{default:Gr(()=>[n.value?(ae(),Ee("section",Tb,[te("header",Ab,[p[2]||(p[2]=te("div",{class:"flex items-center gap-3"},[te("div",{class:"h-2 w-2 rounded-full bg-emerald-400 animate-pulse"}),te("div",null,[te("p",{class:"text-sm font-semibold tracking-tight"},"IO Assistant"),te("p",{class:"text-[11px] text-muted-foreground font-mono"},"online")])],-1)),te("button",{onClick:p[0]||(p[0]=y=>n.value=!1),class:"overlay-icon-btn","aria-label":"Minimize chat overlay",title:"Minimize"},[ue(be(pg),{class:"h-4 w-4"})])]),te("div",{ref_key:"messagesContainer",ref:i,class:"overlay-messages"},[o.value?Ze("",!0):(ae(),Ee("div",xb,[te("div",Rb,[te("div",Cb,[ue(be(Za),{class:"h-4 w-4"})]),p[3]||(p[3]=te("p",{class:"text-sm font-medium"},"Start a quick chat",-1)),p[4]||(p[4]=te("p",{class:"mt-1 text-xs text-muted-foreground"},"Ask IO anything about your workspace.",-1))])])),(ae(!0),Ee(Qe,null,Ni(be(e).messages,y=>(ae(),Ee("div",{key:y.id,class:Ye(["flex",y.role==="user"?"justify-end":"justify-start"])},[te("article",{class:Ye(["overlay-bubble",y.role==="user"?"overlay-bubble-user":"overlay-bubble-assistant"])},[y.content?(ae(),Wt(Eb,{key:0,content:y.content,class:Ye(y.role==="user"?"prose-invert":"")},null,8,["content","class"])):(ae(),Ee("span",Ob,"...")),te("div",Pb,[te("span",{class:Ye(["text-[10px] uppercase tracking-[0.16em] font-mono",y.role==="user"?"text-primary-foreground/65":"text-muted-foreground"])},Wr(y.role),3),te("span",{class:Ye(["text-[10px] font-mono",y.role==="user"?"text-primary-foreground/65":"text-muted-foreground"])},Wr(d(y.timestamp)),3)]),y.streaming?(ae(),Ee("span",Ib)):Ze("",!0)],2)],2))),128))],512),te("footer",jb,[te("div",$b,[Qh(te("textarea",{"onUpdate:modelValue":p[1]||(p[1]=y=>s.value=y),onKeydown:u,placeholder:"Message IO...",rows:"1",class:"overlay-input"},null,544),[[If,s.value]]),te("button",{onClick:c,disabled:!s.value.trim()||be(e).isStreaming,class:"overlay-send-btn","aria-label":be(e).isStreaming?"Stop generation":"Send message",title:be(e).isStreaming?"Stop generation":"Send message"},[be(e).isStreaming?(ae(),Wt(be(wg),{key:1,class:"h-3.5 w-3.5"})):(ae(),Wt(be(vg),{key:0,class:"h-3.5 w-3.5"}))],8,Nb)])])])):Ze("",!0)]),_:1})],64))}}),Db=(t,e)=>{const r=t.__vccOpts||t;for(const[n,s]of e)r[n]=s;return r},Ub=Db(Lb,[["__scopeId","data-v-0bffe85a"]]),Bb={class:"flex h-screen overflow-hidden"},Mb={class:"flex-1 flex flex-col overflow-hidden"},Hb={class:"flex-1 overflow-auto"},qb=ur({__name:"App",setup(t){const e=Zn(),r=Oo(),n=Le(()=>e.isAuthenticated&&r.name!=="login");return(s,i)=>{const o=So("router-view");return ae(),Ee("div",Bb,[n.value?(ae(),Wt(Pg,{key:0})):Ze("",!0),te("div",Mb,[n.value?(ae(),Wt(Dv,{key:0})):Ze("",!0),te("main",Hb,[ue(o)])]),n.value?(ae(),Wt(Ub,{key:1})):Ze("",!0)])}}}),Fb=[{path:"/login",name:"login",component:()=>Me(()=>import("./LoginView-CWiUkg95.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>Me(()=>import("./ChatView-Brk1nps-.js"),__vite__mapDeps([0,1,2]))},{path:"/squads",name:"squads",component:()=>Me(()=>import("./SquadsView-DdywGIi2.js"),__vite__mapDeps([3,4,5,6]))},{path:"/squads/health",name:"squad-health",component:()=>Me(()=>import("./SquadHealthView-Dt_cBi_C.js"),__vite__mapDeps([7,4,8,6]))},{path:"/squads/:id",name:"squad-detail",component:()=>Me(()=>import("./SquadDetailView-HYYd2HvB.js"),__vite__mapDeps([9,4,5,2,6,10,11]))},{path:"/feed",name:"feed",component:()=>Me(()=>import("./FeedView-DtpTOb4B.js"),__vite__mapDeps([12,4,5,10]))},{path:"/skills",name:"skills",component:()=>Me(()=>import("./SkillsView-DtnR6ZeP.js"),__vite__mapDeps([13,4,14,15,16,2,10]))},{path:"/mcp",name:"mcp",component:()=>Me(()=>import("./McpView-C-td_je_.js"),__vite__mapDeps([17,4,18,14,10]))},{path:"/schedules",name:"schedules",component:()=>Me(()=>import("./SchedulesView-DAcPfnmZ.js"),__vite__mapDeps([19,4,5,18,14,10]))},{path:"/history",name:"history",component:()=>Me(()=>import("./HistoryView-CErxUNk_.js"),__vite__mapDeps([20,4,15,11,10]))},{path:"/wiki",name:"wiki",component:()=>Me(()=>import("./WikiView-DWun-CTD.js"),__vite__mapDeps([21,4,1,15,14,16,10,2]))},{path:"/usage",name:"usage",component:()=>Me(()=>import("./UsageView-Dhuu6mVo.js"),__vite__mapDeps([22,4,8]))},{path:"/audit-log",name:"audit-log",component:()=>Me(()=>import("./AuditLogView-BPJtNXCS.js"),__vite__mapDeps([23,4]))},{path:"/settings",name:"settings",component:()=>Me(()=>import("./SettingsView-559gPpax.js"),__vite__mapDeps([24,4]))}],th=Zp({history:Op(),routes:Fb});th.beforeEach(t=>{const e=Zn();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});async function Vb(){await Iv();const t=Uf(qb);t.use(Hf()),t.use(th);const{useAuthStore:e}=await Me(async()=>{const{useAuthStore:n}=await Promise.resolve().then(()=>jv);return{useAuthStore:n}},void 0),r=e();r.initAuthListener(),r.token&&await r.refreshToken(),t.mount("#app")}Vb();export{ig as A,og as B,ag as C,be as D,Zn as E,Qe as F,Mv as G,hg as H,_u as I,Oo as J,Xp as K,Wb as L,fg as M,Kb as N,If as O,yg as P,Er as Q,Gr as R,vg as S,Qh as T,kg as U,Jb as V,Gb as W,rg as _,lg as a,cg as b,bg as c,wg as d,Sg as e,Eb as f,Le as g,te as h,Wt as i,Ze as j,Ee as k,Te as l,zd as m,ue as n,ur as o,Qr as p,Ye as q,fo as r,xc as s,Cc as t,ae as u,tt as v,Ni as w,So as x,th as y,Wr as z};
|