heyio 0.42.1 → 1.0.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.
Files changed (100) hide show
  1. package/README.md +40 -52
  2. package/dist/api/auth.js +35 -38
  3. package/dist/api/server.js +157 -1134
  4. package/dist/config.js +49 -32
  5. package/dist/copilot/agents.js +72 -1055
  6. package/dist/copilot/client.js +6 -17
  7. package/dist/copilot/io-scheduler.js +55 -139
  8. package/dist/copilot/model-router.js +100 -72
  9. package/dist/copilot/orchestrator.js +91 -515
  10. package/dist/copilot/scheduler.js +67 -189
  11. package/dist/copilot/skills.js +41 -366
  12. package/dist/copilot/system-message.js +40 -200
  13. package/dist/copilot/tools.js +191 -2042
  14. package/dist/daemon.js +54 -201
  15. package/dist/index.js +15 -133
  16. package/dist/mcp/config.js +23 -31
  17. package/dist/mcp/index.js +2 -3
  18. package/dist/mcp/registry.js +33 -88
  19. package/dist/notify.js +18 -100
  20. package/dist/paths.js +13 -24
  21. package/dist/setup.js +35 -0
  22. package/dist/store/db.js +111 -297
  23. package/dist/store/feed.js +29 -97
  24. package/dist/store/instances.js +56 -121
  25. package/dist/store/schedules.js +21 -73
  26. package/dist/store/squads.js +35 -186
  27. package/dist/store/tasks.js +25 -168
  28. package/dist/telegram/bot.js +20 -312
  29. package/dist/telegram/handlers.js +39 -3
  30. package/dist/watchdog.js +31 -45
  31. package/dist/wiki/fs.js +38 -155
  32. package/dist/wiki/search.js +31 -44
  33. package/package.json +5 -8
  34. package/web-dist/assets/ChatView-EFFiln1H.js +11 -0
  35. package/web-dist/assets/FeedView-bN4NMOL7.js +6 -0
  36. package/web-dist/assets/LoginView-CNtasq3n.js +1 -0
  37. package/web-dist/assets/McpView-C2CHiwsi.js +1 -0
  38. package/web-dist/assets/SchedulesView-CyilLban.js +1 -0
  39. package/web-dist/assets/SettingsView-1wLXKEF4.js +1 -0
  40. package/web-dist/assets/SkillsView-BLsD-0u0.js +1 -0
  41. package/web-dist/assets/SquadDetailView-CsCw2ZLp.js +21 -0
  42. package/web-dist/assets/SquadsView-DQ3vFlyO.js +6 -0
  43. package/web-dist/assets/WikiView-19M3oqnq.js +21 -0
  44. package/web-dist/assets/api-WGvTsXaE.js +1 -0
  45. package/web-dist/assets/index-D7M5O-_l.css +1 -0
  46. package/web-dist/assets/index-DZOS9syn.js +95 -0
  47. package/web-dist/assets/plus-BOvyX1BC.js +6 -0
  48. package/web-dist/assets/trash-2-DHoetkC4.js +6 -0
  49. package/web-dist/favicon.svg +4 -1
  50. package/web-dist/index.html +7 -10
  51. package/dist/api/logout.test.js +0 -128
  52. package/dist/api/mcp.test.js +0 -285
  53. package/dist/api/wiki.test.js +0 -283
  54. package/dist/auth/session-logic.js +0 -79
  55. package/dist/auth/session-logic.test.js +0 -201
  56. package/dist/copilot/auto-complete-instance.test.js +0 -104
  57. package/dist/copilot/cron.js +0 -136
  58. package/dist/copilot/event-summary.js +0 -286
  59. package/dist/copilot/instance-deactivate.test.js +0 -119
  60. package/dist/copilot/model-router.test.js +0 -71
  61. package/dist/copilot/review-backfill.js +0 -57
  62. package/dist/copilot/session-timeout.js +0 -112
  63. package/dist/copilot/session-timeout.test.js +0 -372
  64. package/dist/copilot/skills.test.js +0 -55
  65. package/dist/copilot/universes.js +0 -469
  66. package/dist/instance-watchdog.js +0 -104
  67. package/dist/instance-watchdog.test.js +0 -183
  68. package/dist/mcp/client.js +0 -109
  69. package/dist/mcp/client.test.js +0 -99
  70. package/dist/mcp/config.test.js +0 -49
  71. package/dist/mcp/registry.test.js +0 -79
  72. package/dist/notify.test.js +0 -232
  73. package/dist/store/feed.test.js +0 -279
  74. package/dist/store/instances.test.js +0 -310
  75. package/dist/store/io-schedules.js +0 -63
  76. package/dist/store/notifications.js +0 -79
  77. package/dist/store/notifications.test.js +0 -197
  78. package/dist/store/schedule-runs.js +0 -46
  79. package/dist/store/squads.test.js +0 -405
  80. package/dist/store/tasks.test.js +0 -150
  81. package/dist/store/worktrees.js +0 -83
  82. package/dist/tui/index.js +0 -286
  83. package/dist/update.js +0 -81
  84. package/dist/watchdog.test.js +0 -83
  85. package/dist/wiki/wiki-squad.test.js +0 -54
  86. package/web-dist/assets/AgentActivityView-B1PaNYy8.js +0 -1
  87. package/web-dist/assets/ChatView-BbpWnrtC.js +0 -4
  88. package/web-dist/assets/FeedView-B5LaMV0I.js +0 -1
  89. package/web-dist/assets/InboxView-Cwqt8rH7.js +0 -1
  90. package/web-dist/assets/LoginView-refmPLKT.js +0 -1
  91. package/web-dist/assets/McpView-B1w0dRFY.js +0 -1
  92. package/web-dist/assets/SchedulesView-D9l2DI7X.js +0 -1
  93. package/web-dist/assets/SettingsTabs.vue_vue_type_script_setup_true_lang-DncOVVEB.js +0 -1
  94. package/web-dist/assets/SkillsView-uFX0q1mV.js +0 -1
  95. package/web-dist/assets/SquadsView-B1nZW4ml.js +0 -1
  96. package/web-dist/assets/StatusIndicator.vue_vue_type_script_setup_true_lang-pTrJJwX1.js +0 -1
  97. package/web-dist/assets/WikiView-B54cCKIK.js +0 -1
  98. package/web-dist/assets/index-C0VEUWQ1.js +0 -81
  99. package/web-dist/assets/index-eluTyieM.css +0 -10
  100. package/web-dist/icons.svg +0 -24
@@ -1,81 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SquadsView-B1nZW4ml.js","assets/StatusIndicator.vue_vue_type_script_setup_true_lang-pTrJJwX1.js","assets/AgentActivityView-B1PaNYy8.js","assets/SkillsView-uFX0q1mV.js","assets/SettingsTabs.vue_vue_type_script_setup_true_lang-DncOVVEB.js","assets/McpView-B1w0dRFY.js"])))=>i.map(i=>d[i]);
2
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(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"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(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 r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/**
3
- * @vue/shared v3.5.34
4
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
- * @license MIT
6
- **/function po(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Se={},zn=[],$t=()=>{},Ml=()=>!1,Bs=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Hs=e=>e.startsWith("onUpdate:"),Ue=Object.assign,go=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},bh=Object.prototype.hasOwnProperty,we=(e,t)=>bh.call(e,t),ne=Array.isArray,Jn=e=>zr(e)==="[object Map]",Fs=e=>zr(e)==="[object Set]",qo=e=>zr(e)==="[object Date]",ce=e=>typeof e=="function",xe=e=>typeof e=="string",ut=e=>typeof e=="symbol",Ee=e=>e!==null&&typeof e=="object",jl=e=>(Ee(e)||ce(e))&&ce(e.then)&&ce(e.catch),Dl=Object.prototype.toString,zr=e=>Dl.call(e),yh=e=>zr(e).slice(8,-1),Ul=e=>zr(e)==="[object Object]",qs=e=>xe(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,br=po(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ks=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},vh=/-\w/g,rt=Ks(e=>e.replace(vh,t=>t.slice(1).toUpperCase())),_h=/\B([A-Z])/g,dn=Ks(e=>e.replace(_h,"-$1").toLowerCase()),Ws=Ks(e=>e.charAt(0).toUpperCase()+e.slice(1)),di=Ks(e=>e?`on${Ws(e)}`:""),Lt=(e,t)=>!Object.is(e,t),bs=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Bl=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Vs=e=>{const t=parseFloat(e);return isNaN(t)?e:t},wh=e=>{const t=xe(e)?Number(e):NaN;return isNaN(t)?e:t};let Ko;const Gs=()=>Ko||(Ko=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function zs(e){if(ne(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=xe(r)?Ah(r):zs(r);if(s)for(const i in s)t[i]=s[i]}return t}else if(xe(e)||Ee(e))return e}const Eh=/;(?![^(]*\))/g,Sh=/:([^]+)/,kh=/\/\*[^]*?\*\//g;function Ah(e){const t={};return e.replace(kh,"").split(Eh).forEach(n=>{if(n){const r=n.split(Sh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function vt(e){let t="";if(xe(e))t=e;else if(ne(e))for(let n=0;n<e.length;n++){const r=vt(e[n]);r&&(t+=r+" ")}else if(Ee(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Th="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",xh=po(Th);function Hl(e){return!!e||e===""}function Rh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Jr(e[r],t[r]);return n}function Jr(e,t){if(e===t)return!0;let n=qo(e),r=qo(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ut(e),r=ut(t),n||r)return e===t;if(n=ne(e),r=ne(t),n||r)return n&&r?Rh(e,t):!1;if(n=Ee(e),r=Ee(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,i=Object.keys(t).length;if(s!==i)return!1;for(const o in e){const a=e.hasOwnProperty(o),l=t.hasOwnProperty(o);if(a&&!l||!a&&l||!Jr(e[o],t[o]))return!1}}return String(e)===String(t)}function Oh(e,t){return e.findIndex(n=>Jr(n,t))}const Fl=e=>!!(e&&e.__v_isRef===!0),Te=e=>xe(e)?e:e==null?"":ne(e)||Ee(e)&&(e.toString===Dl||!ce(e.toString))?Fl(e)?Te(e.value):JSON.stringify(e,ql,2):String(e),ql=(e,t)=>Fl(t)?ql(e,t.value):Jn(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],i)=>(n[fi(r,i)+" =>"]=s,n),{})}:Fs(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>fi(n))}:ut(t)?fi(t):Ee(t)&&!ne(t)&&!Ul(t)?String(t):t,fi=(e,t="")=>{var n;return ut(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
- * @vue/reactivity v3.5.34
8
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
- * @license MIT
10
- **/let je;class Kl{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&je&&(je.active?(this.parent=je,this.index=(je.scopes||(je.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].pause();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=je;try{return je=this,t()}finally{je=n}}}on(){++this._on===1&&(this.prevScope=je,je=this)}off(){if(this._on>0&&--this._on===0){if(je===this)je=this.prevScope;else{let t=je;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Wl(e){return new Kl(e)}function Vl(){return je}function Ch(e,t=!1){je&&je.cleanups.push(e)}let Ae;const pi=new WeakSet;class Gl{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,je&&(je.active?je.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,pi.has(this)&&(pi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Jl(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Wo(this),Yl(this);const t=Ae,n=_t;Ae=this,_t=!0;try{return this.fn()}finally{Zl(this),Ae=t,_t=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)yo(t);this.deps=this.depsTail=void 0,Wo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?pi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Li(this)&&this.run()}get dirty(){return Li(this)}}let zl=0,yr,vr;function Jl(e,t=!1){if(e.flags|=8,t){e.next=vr,vr=e;return}e.next=yr,yr=e}function mo(){zl++}function bo(){if(--zl>0)return;if(vr){let t=vr;for(vr=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;yr;){let t=yr;for(yr=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Yl(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Zl(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),yo(r),Nh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Li(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xl(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xl(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Cr)||(e.globalVersion=Cr,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Li(e))))return;e.flags|=2;const t=e.dep,n=Ae,r=_t;Ae=e,_t=!0;try{Yl(e);const s=e.fn(e._value);(t.version===0||Lt(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ae=n,_t=r,Zl(e),e.flags&=-3}}function yo(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)yo(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Nh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let _t=!0;const Ql=[];function Jt(){Ql.push(_t),_t=!1}function Yt(){const e=Ql.pop();_t=e===void 0?!0:e}function Wo(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ae;Ae=void 0;try{t()}finally{Ae=n}}}let Cr=0;class Ih{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class vo{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Ae||!_t||Ae===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ae)n=this.activeLink=new Ih(Ae,this),Ae.deps?(n.prevDep=Ae.depsTail,Ae.depsTail.nextDep=n,Ae.depsTail=n):Ae.deps=Ae.depsTail=n,ec(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Ae.depsTail,n.nextDep=void 0,Ae.depsTail.nextDep=n,Ae.depsTail=n,Ae.deps===n&&(Ae.deps=r)}return n}trigger(t){this.version++,Cr++,this.notify(t)}notify(t){mo();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{bo()}}}function ec(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)ec(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Es=new WeakMap,Rn=Symbol(""),$i=Symbol(""),Nr=Symbol("");function Je(e,t,n){if(_t&&Ae){let r=Es.get(e);r||Es.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new vo),s.map=r,s.key=n),s.track()}}function Wt(e,t,n,r,s,i){const o=Es.get(e);if(!o){Cr++;return}const a=l=>{l&&l.trigger()};if(mo(),t==="clear")o.forEach(a);else{const l=ne(e),c=l&&qs(n);if(l&&n==="length"){const u=Number(r);o.forEach((h,d)=>{(d==="length"||d===Nr||!ut(d)&&d>=u)&&a(h)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(Nr)),t){case"add":l?c&&a(o.get("length")):(a(o.get(Rn)),Jn(e)&&a(o.get($i)));break;case"delete":l||(a(o.get(Rn)),Jn(e)&&a(o.get($i)));break;case"set":Jn(e)&&a(o.get(Rn));break}}bo()}function Ph(e,t){const n=Es.get(e);return n&&n.get(t)}function In(e){const t=ge(e);return t===e?t:(Je(t,"iterate",Nr),lt(e)?t:t.map(wt))}function Js(e){return Je(e=ge(e),"iterate",Nr),e}function Nt(e,t){return Zt(e)?er(Gt(e)?wt(t):t):wt(t)}const Lh={__proto__:null,[Symbol.iterator](){return gi(this,Symbol.iterator,e=>Nt(this,e))},concat(...e){return In(this).concat(...e.map(t=>ne(t)?In(t):t))},entries(){return gi(this,"entries",e=>(e[1]=Nt(this,e[1]),e))},every(e,t){return jt(this,"every",e,t,void 0,arguments)},filter(e,t){return jt(this,"filter",e,t,n=>n.map(r=>Nt(this,r)),arguments)},find(e,t){return jt(this,"find",e,t,n=>Nt(this,n),arguments)},findIndex(e,t){return jt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return jt(this,"findLast",e,t,n=>Nt(this,n),arguments)},findLastIndex(e,t){return jt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return jt(this,"forEach",e,t,void 0,arguments)},includes(...e){return mi(this,"includes",e)},indexOf(...e){return mi(this,"indexOf",e)},join(e){return In(this).join(e)},lastIndexOf(...e){return mi(this,"lastIndexOf",e)},map(e,t){return jt(this,"map",e,t,void 0,arguments)},pop(){return ar(this,"pop")},push(...e){return ar(this,"push",e)},reduce(e,...t){return Vo(this,"reduce",e,t)},reduceRight(e,...t){return Vo(this,"reduceRight",e,t)},shift(){return ar(this,"shift")},some(e,t){return jt(this,"some",e,t,void 0,arguments)},splice(...e){return ar(this,"splice",e)},toReversed(){return In(this).toReversed()},toSorted(e){return In(this).toSorted(e)},toSpliced(...e){return In(this).toSpliced(...e)},unshift(...e){return ar(this,"unshift",e)},values(){return gi(this,"values",e=>Nt(this,e))}};function gi(e,t,n){const r=Js(e),s=r[t]();return r!==e&&!lt(e)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const $h=Array.prototype;function jt(e,t,n,r,s,i){const o=Js(e),a=o!==e&&!lt(e),l=o[t];if(l!==$h[t]){const h=l.apply(e,i);return a?wt(h):h}let c=n;o!==e&&(a?c=function(h,d){return n.call(this,Nt(e,h),d,e)}:n.length>2&&(c=function(h,d){return n.call(this,h,d,e)}));const u=l.call(o,c,r);return a&&s?s(u):u}function Vo(e,t,n,r){const s=Js(e),i=s!==e&&!lt(e);let o=n,a=!1;s!==e&&(i?(a=r.length===0,o=function(c,u,h){return a&&(a=!1,c=Nt(e,c)),n.call(this,c,Nt(e,u),h,e)}):n.length>3&&(o=function(c,u,h){return n.call(this,c,u,h,e)}));const l=s[t](o,...r);return a?Nt(e,l):l}function mi(e,t,n){const r=ge(e);Je(r,"iterate",Nr);const s=r[t](...n);return(s===-1||s===!1)&&Ys(n[0])?(n[0]=ge(n[0]),r[t](...n)):s}function ar(e,t,n=[]){Jt(),mo();const r=ge(e)[t].apply(e,n);return bo(),Yt(),r}const Mh=po("__proto__,__v_isRef,__isVue"),tc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ut));function jh(e){ut(e)||(e=String(e));const t=ge(this);return Je(t,"has",e),t.hasOwnProperty(e)}class nc{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return r===(s?i?Gh:oc:i?ic:sc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const o=ne(t);if(!s){let l;if(o&&(l=Lh[n]))return l;if(n==="hasOwnProperty")return jh}const a=Reflect.get(t,n,Ce(t)?t:r);if((ut(n)?tc.has(n):Mh(n))||(s||Je(t,"get",n),i))return a;if(Ce(a)){const l=o&&qs(n)?a:a.value;return s&&Ee(l)?ji(l):l}return Ee(a)?s?ji(a):Yr(a):a}}class rc extends nc{constructor(t=!1){super(!1,t)}set(t,n,r,s){let i=t[n];const o=ne(t)&&qs(n);if(!this._isShallow){const c=Zt(i);if(!lt(r)&&!Zt(r)&&(i=ge(i),r=ge(r)),!o&&Ce(i)&&!Ce(r))return c||(i.value=r),!0}const a=o?Number(n)<t.length:we(t,n),l=Reflect.set(t,n,r,Ce(t)?t:s);return t===ge(s)&&(a?Lt(r,i)&&Wt(t,"set",n,r):Wt(t,"add",n,r)),l}deleteProperty(t,n){const r=we(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Wt(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!ut(n)||!tc.has(n))&&Je(t,"has",n),r}ownKeys(t){return Je(t,"iterate",ne(t)?"length":Rn),Reflect.ownKeys(t)}}class Dh extends nc{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Uh=new rc,Bh=new Dh,Hh=new rc(!0);const Mi=e=>e,ns=e=>Reflect.getPrototypeOf(e);function Fh(e,t,n){return function(...r){const s=this.__v_raw,i=ge(s),o=Jn(i),a=e==="entries"||e===Symbol.iterator&&o,l=e==="keys"&&o,c=s[e](...r),u=n?Mi:t?er:wt;return!t&&Je(i,"iterate",l?$i:Rn),Ue(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 rs(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function qh(e,t){const n={get(s){const i=this.__v_raw,o=ge(i),a=ge(s);e||(Lt(s,a)&&Je(o,"get",s),Je(o,"get",a));const{has:l}=ns(o),c=t?Mi:e?er:wt;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!e&&Je(ge(s),"iterate",Rn),s.size},has(s){const i=this.__v_raw,o=ge(i),a=ge(s);return e||(Lt(s,a)&&Je(o,"has",s),Je(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=ge(a),c=t?Mi:e?er:wt;return!e&&Je(l,"iterate",Rn),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Ue(n,e?{add:rs("add"),set:rs("set"),delete:rs("delete"),clear:rs("clear")}:{add(s){const i=ge(this),o=ns(i),a=ge(s),l=!t&&!lt(s)&&!Zt(s)?a:s;return o.has.call(i,l)||Lt(s,l)&&o.has.call(i,s)||Lt(a,l)&&o.has.call(i,a)||(i.add(l),Wt(i,"add",l,l)),this},set(s,i){!t&&!lt(i)&&!Zt(i)&&(i=ge(i));const o=ge(this),{has:a,get:l}=ns(o);let c=a.call(o,s);c||(s=ge(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?Lt(i,u)&&Wt(o,"set",s,i):Wt(o,"add",s,i),this},delete(s){const i=ge(this),{has:o,get:a}=ns(i);let l=o.call(i,s);l||(s=ge(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&Wt(i,"delete",s,void 0),c},clear(){const s=ge(this),i=s.size!==0,o=s.clear();return i&&Wt(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Fh(s,e,t)}),n}function _o(e,t){const n=qh(e,t);return(r,s,i)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(we(n,s)&&s in r?n:r,s,i)}const Kh={get:_o(!1,!1)},Wh={get:_o(!1,!0)},Vh={get:_o(!0,!1)};const sc=new WeakMap,ic=new WeakMap,oc=new WeakMap,Gh=new WeakMap;function zh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Jh(e){return e.__v_skip||!Object.isExtensible(e)?0:zh(yh(e))}function Yr(e){return Zt(e)?e:wo(e,!1,Uh,Kh,sc)}function ac(e){return wo(e,!1,Hh,Wh,ic)}function ji(e){return wo(e,!0,Bh,Vh,oc)}function wo(e,t,n,r,s){if(!Ee(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=Jh(e);if(i===0)return e;const o=s.get(e);if(o)return o;const a=new Proxy(e,i===2?r:n);return s.set(e,a),a}function Gt(e){return Zt(e)?Gt(e.__v_raw):!!(e&&e.__v_isReactive)}function Zt(e){return!!(e&&e.__v_isReadonly)}function lt(e){return!!(e&&e.__v_isShallow)}function Ys(e){return e?!!e.__v_raw:!1}function ge(e){const t=e&&e.__v_raw;return t?ge(t):e}function Eo(e){return!we(e,"__v_skip")&&Object.isExtensible(e)&&Bl(e,"__v_skip",!0),e}const wt=e=>Ee(e)?Yr(e):e,er=e=>Ee(e)?ji(e):e;function Ce(e){return e?e.__v_isRef===!0:!1}function ve(e){return lc(e,!1)}function Yh(e){return lc(e,!0)}function lc(e,t){return Ce(e)?e:new Zh(e,t)}class Zh{constructor(t,n){this.dep=new vo,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ge(t),this._value=n?t:wt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||lt(t)||Zt(t);t=r?t:ge(t),Lt(t,n)&&(this._rawValue=t,this._value=r?t:wt(t),this.dep.trigger())}}function ze(e){return Ce(e)?e.value:e}const Xh={get:(e,t,n)=>t==="__v_raw"?e:ze(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Ce(s)&&!Ce(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function cc(e){return Gt(e)?e:new Proxy(e,Xh)}function Qh(e){const t=ne(e)?new Array(e.length):{};for(const n in e)t[n]=td(e,n);return t}class ed{constructor(t,n,r){this._object=t,this._defaultValue=r,this.__v_isRef=!0,this._value=void 0,this._key=ut(n)?n:String(n),this._raw=ge(t);let s=!0,i=t;if(!ne(t)||ut(this._key)||!qs(this._key))do s=!Ys(i)||lt(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let t=this._object[this._key];return this._shallow&&(t=ze(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Ce(this._raw[this._key])){const n=this._object[this._key];if(Ce(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return Ph(this._raw,this._key)}}function td(e,t,n){return new ed(e,t,n)}class nd{constructor(t,n,r){this.fn=t,this.setter=n,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=Cr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ae!==this)return Jl(this,!0),!0}get value(){const t=this.dep.track();return Xl(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function rd(e,t,n=!1){let r,s;return ce(e)?r=e:(r=e.get,s=e.set),new nd(r,s,n)}const ss={},Ss=new WeakMap;let wn;function sd(e,t=!1,n=wn){if(n){let r=Ss.get(n);r||Ss.set(n,r=[]),r.push(e)}}function id(e,t,n=Se){const{immediate:r,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=n,c=k=>s?k:lt(k)||s===!1||s===0?Vt(k,1):Vt(k);let u,h,d,f,p=!1,m=!1;if(Ce(e)?(h=()=>e.value,p=lt(e)):Gt(e)?(h=()=>c(e),p=!0):ne(e)?(m=!0,p=e.some(k=>Gt(k)||lt(k)),h=()=>e.map(k=>{if(Ce(k))return k.value;if(Gt(k))return c(k);if(ce(k))return l?l(k,2):k()})):ce(e)?t?h=l?()=>l(e,2):e:h=()=>{if(d){Jt();try{d()}finally{Yt()}}const k=wn;wn=u;try{return l?l(e,3,[f]):e(f)}finally{wn=k}}:h=$t,t&&s){const k=h,C=s===!0?1/0:s;h=()=>Vt(k(),C)}const E=Vl(),v=()=>{u.stop(),E&&E.active&&go(E.effects,u)};if(i&&t){const k=t;t=(...C)=>{k(...C),v()}}let y=m?new Array(e.length).fill(ss):ss;const w=k=>{if(!(!(u.flags&1)||!u.dirty&&!k))if(t){const C=u.run();if(s||p||(m?C.some(($,N)=>Lt($,y[N])):Lt(C,y))){d&&d();const $=wn;wn=u;try{const N=[C,y===ss?void 0:m&&y[0]===ss?[]:y,f];y=C,l?l(t,3,N):t(...N)}finally{wn=$}}}else u.run()};return a&&a(w),u=new Gl(h),u.scheduler=o?()=>o(w,!1):w,f=k=>sd(k,!1,u),d=u.onStop=()=>{const k=Ss.get(u);if(k){if(l)l(k,4);else for(const C of k)C();Ss.delete(u)}},t?r?w(!0):y=u.run():o?o(w.bind(null,!0),!0):u.run(),v.pause=u.pause.bind(u),v.resume=u.resume.bind(u),v.stop=v,v}function Vt(e,t=1/0,n){if(t<=0||!Ee(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Ce(e))Vt(e.value,t,n);else if(ne(e))for(let r=0;r<e.length;r++)Vt(e[r],t,n);else if(Fs(e)||Jn(e))e.forEach(r=>{Vt(r,t,n)});else if(Ul(e)){for(const r in e)Vt(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Vt(e[r],t,n)}return e}/**
11
- * @vue/runtime-core v3.5.34
12
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
- * @license MIT
14
- **/function Zr(e,t,n,r){try{return r?e(...r):e()}catch(s){Zs(s,t,n)}}function Et(e,t,n,r){if(ce(e)){const s=Zr(e,t,n,r);return s&&jl(s)&&s.catch(i=>{Zs(i,t,n)}),s}if(ne(e)){const s=[];for(let i=0;i<e.length;i++)s.push(Et(e[i],t,n,r));return s}}function Zs(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||Se;if(t){let a=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,l,c)===!1)return}a=a.parent}if(i){Jt(),Zr(i,null,10,[e,l,c]),Yt();return}}od(e,n,s,r,o)}function od(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const nt=[];let Rt=-1;const Yn=[];let sn=null,Bn=0;const uc=Promise.resolve();let ks=null;function tr(e){const t=ks||uc;return e?t.then(this?e.bind(this):e):t}function ad(e){let t=Rt+1,n=nt.length;for(;t<n;){const r=t+n>>>1,s=nt[r],i=Ir(s);i<e||i===e&&s.flags&2?t=r+1:n=r}return t}function So(e){if(!(e.flags&1)){const t=Ir(e),n=nt[nt.length-1];!n||!(e.flags&2)&&t>=Ir(n)?nt.push(e):nt.splice(ad(t),0,e),e.flags|=1,hc()}}function hc(){ks||(ks=uc.then(fc))}function ld(e){ne(e)?Yn.push(...e):sn&&e.id===-1?sn.splice(Bn+1,0,e):e.flags&1||(Yn.push(e),e.flags|=1),hc()}function Go(e,t,n=Rt+1){for(;n<nt.length;n++){const r=nt[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;nt.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function dc(e){if(Yn.length){const t=[...new Set(Yn)].sort((n,r)=>Ir(n)-Ir(r));if(Yn.length=0,sn){sn.push(...t);return}for(sn=t,Bn=0;Bn<sn.length;Bn++){const n=sn[Bn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}sn=null,Bn=0}}const Ir=e=>e.id==null?e.flags&2?-1:1/0:e.id;function fc(e){try{for(Rt=0;Rt<nt.length;Rt++){const t=nt[Rt];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Zr(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Rt<nt.length;Rt++){const t=nt[Rt];t&&(t.flags&=-2)}Rt=-1,nt.length=0,dc(),ks=null,(nt.length||Yn.length)&&fc()}}let Ge=null,pc=null;function As(e){const t=Ge;return Ge=e,pc=e&&e.type.__scopeId||null,t}function Mt(e,t=Ge,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Rs(-1);const i=As(t);let o;try{o=e(...s)}finally{As(i),r._d&&Rs(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function cd(e,t){if(Ge===null)return e;const n=ni(Ge),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[i,o,a,l=Se]=t[s];i&&(ce(i)&&(i={mounted:i,updated:i}),i.deep&&Vt(o),r.push({dir:i,instance:n,value:o,oldValue:void 0,arg:a,modifiers:l}))}return e}function gn(e,t,n,r){const s=e.dirs,i=t&&t.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[r];l&&(Jt(),Et(l,n,8,[e.el,a,e,t]),Yt())}}function ys(e,t){if(Ze){let n=Ze.provides;const r=Ze.parent&&Ze.parent.provides;r===n&&(n=Ze.provides=Object.create(r)),n[e]=t}}function pt(e,t,n=!1){const r=Ro();if(r||On){let s=On?On._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&ce(t)?t.call(r&&r.proxy):t}}function ud(){return!!(Ro()||On)}const hd=Symbol.for("v-scx"),dd=()=>pt(hd);function un(e,t,n){return gc(e,t,n)}function gc(e,t,n=Se){const{immediate:r,deep:s,flush:i,once:o}=n,a=Ue({},n),l=t&&r||!t&&i!=="post";let c;if(Mr){if(i==="sync"){const f=dd();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=$t,f.resume=$t,f.pause=$t,f}}const u=Ze;a.call=(f,p,m)=>Et(f,u,p,m);let h=!1;i==="post"?a.scheduler=f=>{et(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():So(f)}),a.augmentJob=f=>{t&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=id(e,t,a);return Mr&&(c?c.push(d):l&&d()),d}function fd(e,t,n){const r=this.proxy,s=xe(e)?e.includes(".")?mc(r,e):()=>r[e]:e.bind(r,r);let i;ce(t)?i=t:(i=t.handler,n=t);const o=es(this),a=gc(s,i.bind(r),n);return o(),a}function mc(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const nn=new WeakMap,bc=Symbol("_vte"),yc=e=>e.__isTeleport,Sn=e=>e&&(e.disabled||e.disabled===""),pd=e=>e&&(e.defer||e.defer===""),zo=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Jo=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Di=(e,t)=>{const n=e&&e.to;return xe(n)?t?t(n):null:n},gd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,i,o,a,l,c){const{mc:u,pc:h,pbc:d,o:{insert:f,querySelector:p,createText:m,createComment:E,parentNode:v}}=c,y=Sn(t.props);let{dynamicChildren:w}=t;const k=(N,U,S)=>{N.shapeFlag&16&&u(N.children,U,S,s,i,o,a,l)},C=(N=t)=>{const U=Sn(N.props),S=N.target=Di(N.props,p),X=Ui(S,N,m,f);S&&(o!=="svg"&&zo(S)?o="svg":o!=="mathml"&&Jo(S)&&(o="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(S),U||(k(N,S,X),dr(N,!1)))},$=N=>{const U=()=>{if(nn.get(N)===U){if(nn.delete(N),Sn(N.props)){const S=v(N.el)||n;k(N,S,N.anchor),dr(N,!0)}C(N)}};nn.set(N,U),et(U,i)};if(e==null){const N=t.el=m(""),U=t.anchor=m("");if(f(N,n,r),f(U,n,r),pd(t.props)||i&&i.pendingBranch){$(t);return}y&&(k(t,n,U),dr(t,!0)),C()}else{t.el=e.el;const N=t.anchor=e.anchor,U=nn.get(e);if(U){U.flags|=8,nn.delete(e),$(t);return}t.targetStart=e.targetStart;const S=t.target=e.target,X=t.targetAnchor=e.targetAnchor,ae=Sn(e.props),H=ae?n:S,ue=ae?N:X;if(o==="svg"||zo(S)?o="svg":(o==="mathml"||Jo(S))&&(o="mathml"),w?(d(e.dynamicChildren,w,H,s,i,o,a),To(e,t,!0)):l||h(e,t,H,ue,s,i,o,a,!1),y)ae?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):is(t,n,N,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const me=t.target=Di(t.props,p);me&&is(t,me,null,c,0)}else ae&&is(t,S,X,c,1);dr(t,y)}},remove(e,t,n,{um:r,o:{remove:s}},i){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:h,props:d}=e;let f=i||!Sn(d);const p=nn.get(e);if(p&&(p.flags|=8,nn.delete(e),f=!1),h&&(s(c),s(u)),i&&s(l),o&16)for(let m=0;m<a.length;m++){const E=a[m];r(E,t,n,f,!!E.dynamicChildren)}},move:is,hydrate:md};function is(e,t,n,{o:{insert:r},m:s},i=2){i===0&&r(e.targetAnchor,t,n);const{el:o,anchor:a,shapeFlag:l,children:c,props:u}=e,h=i===2;if(h&&r(o,t,n),!nn.has(e)&&(!h||Sn(u))&&l&16)for(let d=0;d<c.length;d++)s(c[d],t,n,2);h&&r(a,t,n)}function md(e,t,n,r,s,i,{o:{nextSibling:o,parentNode:a,querySelector:l,insert:c,createText:u}},h){function d(E,v){let y=v;for(;y;){if(y&&y.nodeType===8){if(y.data==="teleport start anchor")t.targetStart=y;else if(y.data==="teleport anchor"){t.targetAnchor=y,E._lpa=t.targetAnchor&&o(t.targetAnchor);break}}y=o(y)}}function f(E,v){v.anchor=h(o(E),v,a(E),n,r,s,i)}const p=t.target=Di(t.props,l),m=Sn(t.props);if(p){const E=p._lpa||p.firstChild;t.shapeFlag&16&&(m?(f(e,t),d(p,E),t.targetAnchor||Ui(p,t,u,c,a(e)===p?e:null)):(t.anchor=o(e),d(p,E),t.targetAnchor||Ui(p,t,u,c),h(E&&o(E),t,p,n,r,s,i))),dr(t,m)}else m&&t.shapeFlag&16&&(f(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}const bd=gd;function dr(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Ui(e,t,n,r,s=null){const i=t.targetStart=n(""),o=t.targetAnchor=n("");return i[bc]=o,e&&(r(i,e,s),r(o,e,s)),o}const Ot=Symbol("_leaveCb"),lr=Symbol("_enterCb");function yd(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Xr(()=>{e.isMounted=!0}),Tc(()=>{e.isUnmounting=!0}),e}const dt=[Function,Array],vc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:dt,onEnter:dt,onAfterEnter:dt,onEnterCancelled:dt,onBeforeLeave:dt,onLeave:dt,onAfterLeave:dt,onLeaveCancelled:dt,onBeforeAppear:dt,onAppear:dt,onAfterAppear:dt,onAppearCancelled:dt},_c=e=>{const t=e.subTree;return t.component?_c(t.component):t},vd={name:"BaseTransition",props:vc,setup(e,{slots:t}){const n=Ro(),r=yd();return()=>{const s=t.default&&Sc(t.default(),!0),i=s&&s.length?wc(s):n.subTree?Fe():void 0;if(!i)return;const o=ge(e),{mode:a}=o;if(r.isLeaving)return bi(i);const l=Yo(i);if(!l)return bi(i);let c=Bi(l,o,r,n,h=>c=h);l.type!==Ye&&Pr(l,c);let u=n.subTree&&Yo(n.subTree);if(u&&u.type!==Ye&&!kn(u,l)&&_c(n).type!==Ye){let h=Bi(u,o,r,n);if(Pr(u,h),a==="out-in"&&l.type!==Ye)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,u=void 0},bi(i);a==="in-out"&&l.type!==Ye?h.delayLeave=(d,f,p)=>{const m=Ec(r,u);m[String(u.key)]=u,d[Ot]=()=>{f(),d[Ot]=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 wc(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ye){t=n;break}}return t}const _d=vd;function Ec(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Bi(e,t,n,r,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:m,onBeforeAppear:E,onAppear:v,onAfterAppear:y,onAppearCancelled:w}=t,k=String(e.key),C=Ec(n,e),$=(S,X)=>{S&&Et(S,r,9,X)},N=(S,X)=>{const ae=X[1];$(S,X),ne(S)?S.every(H=>H.length<=1)&&ae():S.length<=1&&ae()},U={mode:o,persisted:a,beforeEnter(S){let X=l;if(!n.isMounted)if(i)X=E||l;else return;S[Ot]&&S[Ot](!0);const ae=C[k];ae&&kn(e,ae)&&ae.el[Ot]&&ae.el[Ot](),$(X,[S])},enter(S){if(C[k]===e)return;let X=c,ae=u,H=h;if(!n.isMounted)if(i)X=v||c,ae=y||u,H=w||h;else return;let ue=!1;S[lr]=Ne=>{ue||(ue=!0,Ne?$(H,[S]):$(ae,[S]),U.delayedLeave&&U.delayedLeave(),S[lr]=void 0)};const me=S[lr].bind(null,!1);X?N(X,[S,me]):me()},leave(S,X){const ae=String(e.key);if(S[lr]&&S[lr](!0),n.isUnmounting)return X();$(d,[S]);let H=!1;S[Ot]=me=>{H||(H=!0,X(),me?$(m,[S]):$(p,[S]),S[Ot]=void 0,C[ae]===e&&delete C[ae])};const ue=S[Ot].bind(null,!1);C[ae]=e,f?N(f,[S,ue]):ue()},clone(S){const X=Bi(S,t,n,r,s);return s&&s(X),X}};return U}function bi(e){if(Xs(e))return e=hn(e),e.children=null,e}function Yo(e){if(!Xs(e))return yc(e.type)&&e.children?wc(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&ce(n.default))return n.default()}}function Pr(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Pr(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Sc(e,t=!1,n){let r=[],s=0;for(let i=0;i<e.length;i++){let o=e[i];const a=n==null?o.key:String(n)+String(o.key!=null?o.key:i);o.type===de?(o.patchFlag&128&&s++,r=r.concat(Sc(o.children,t,a))):(t||o.type!==Ye)&&r.push(a!=null?hn(o,{key:a}):o)}if(s>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function fn(e,t){return ce(e)?Ue({name:e.name},t,{setup:e}):e}function kc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Zo(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Ts=new WeakMap;function _r(e,t,n,r,s=!1){if(ne(e)){e.forEach((m,E)=>_r(m,t&&(ne(t)?t[E]:t),n,r,s));return}if(Zn(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&_r(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?ni(r.component):r.el,o=s?null:i,{i:a,r:l}=e,c=t&&t.r,u=a.refs===Se?a.refs={}:a.refs,h=a.setupState,d=ge(h),f=h===Se?Ml:m=>Zo(u,m)?!1:we(d,m),p=(m,E)=>!(E&&Zo(u,E));if(c!=null&&c!==l){if(Xo(t),xe(c))u[c]=null,f(c)&&(h[c]=null);else if(Ce(c)){const m=t;p(c,m.k)&&(c.value=null),m.k&&(u[m.k]=null)}}if(ce(l))Zr(l,a,12,[o,u]);else{const m=xe(l),E=Ce(l);if(m||E){const v=()=>{if(e.f){const y=m?f(l)?h[l]:u[l]:p()||!e.k?l.value:u[e.k];if(s)ne(y)&&go(y,i);else if(ne(y))y.includes(i)||y.push(i);else if(m)u[l]=[i],f(l)&&(h[l]=u[l]);else{const w=[i];p(l,e.k)&&(l.value=w),e.k&&(u[e.k]=w)}}else m?(u[l]=o,f(l)&&(h[l]=o)):E&&(p(l,e.k)&&(l.value=o),e.k&&(u[e.k]=o))};if(o){const y=()=>{v(),Ts.delete(e)};y.id=-1,Ts.set(e,y),et(y,n)}else Xo(e),v()}}}function Xo(e){const t=Ts.get(e);t&&(t.flags|=8,Ts.delete(e))}Gs().requestIdleCallback;Gs().cancelIdleCallback;const Zn=e=>!!e.type.__asyncLoader,Xs=e=>e.type.__isKeepAlive;function wd(e,t){Ac(e,"a",t)}function Ed(e,t){Ac(e,"da",t)}function Ac(e,t,n=Ze){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Qs(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Xs(s.parent.vnode)&&Sd(r,t,n,s),s=s.parent}}function Sd(e,t,n,r){const s=Qs(t,e,r,!0);Qr(()=>{go(r[t],s)},n)}function Qs(e,t,n=Ze,r=!1){if(n){const s=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{Jt();const a=es(n),l=Et(t,n,e,o);return a(),Yt(),l});return r?s.unshift(i):s.push(i),i}}const Xt=e=>(t,n=Ze)=>{(!Mr||e==="sp")&&Qs(e,(...r)=>t(...r),n)},kd=Xt("bm"),Xr=Xt("m"),Ad=Xt("bu"),Td=Xt("u"),Tc=Xt("bum"),Qr=Xt("um"),xd=Xt("sp"),Rd=Xt("rtg"),Od=Xt("rtc");function Cd(e,t=Ze){Qs("ec",e,t)}const Nd="components";function aw(e,t){return Pd(Nd,e,!0,t)||e}const Id=Symbol.for("v-ndc");function Pd(e,t,n=!0,r=!1){const s=Ge||Ze;if(s){const i=s.type;{const a=vf(i,!1);if(a&&(a===t||a===rt(t)||a===Ws(rt(t))))return i}const o=Qo(s[e]||i[e],t)||Qo(s.appContext[e],t);return!o&&r?i:o}}function Qo(e,t){return e&&(e[t]||e[rt(t)]||e[Ws(rt(t))])}function zt(e,t,n,r){let s;const i=n,o=ne(e);if(o||xe(e)){const a=o&&Gt(e);let l=!1,c=!1;a&&(l=!lt(e),c=Zt(e),e=Js(e)),s=new Array(e.length);for(let u=0,h=e.length;u<h;u++)s[u]=t(l?c?er(wt(e[u])):wt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,i)}else if(Ee(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,i));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=t(e[u],u,l,i)}}else s=[];return s}function lw(e,t,n={},r,s){if(Ge.ce||Ge.parent&&Zn(Ge.parent)&&Ge.parent.ce){const c=Object.keys(n).length>0;return K(),nr(de,null,[le("slot",n,r)],c?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),K();const o=i&&xc(i(n)),a=n.key||o&&o.key,l=nr(de,{key:(a&&!ut(a)?a:`_${t}`)+(!o&&r?"_fb":"")},o||[],o&&e._===1?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function xc(e){return e.some(t=>$r(t)?!(t.type===Ye||t.type===de&&!xc(t.children)):!0)?e:null}const Hi=e=>e?Gc(e)?ni(e):Hi(e.parent):null,wr=Ue(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Hi(e.parent),$root:e=>Hi(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Oc(e),$forceUpdate:e=>e.f||(e.f=()=>{So(e.update)}),$nextTick:e=>e.n||(e.n=tr.bind(e.proxy)),$watch:e=>fd.bind(e)}),yi=(e,t)=>e!==Se&&!e.__isScriptSetup&&we(e,t),Ld={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:i,accessCache:o,type:a,appContext:l}=e;if(t[0]!=="$"){const d=o[t];if(d!==void 0)switch(d){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return i[t]}else{if(yi(r,t))return o[t]=1,r[t];if(s!==Se&&we(s,t))return o[t]=2,s[t];if(we(i,t))return o[t]=3,i[t];if(n!==Se&&we(n,t))return o[t]=4,n[t];Fi&&(o[t]=0)}}const c=wr[t];let u,h;if(c)return t==="$attrs"&&Je(e.attrs,"get",""),c(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Se&&we(n,t))return o[t]=4,n[t];if(h=l.config.globalProperties,we(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:i}=e;return yi(s,t)?(s[t]=n,!0):r!==Se&&we(r,t)?(r[t]=n,!0):we(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:i,type:o}},a){let l;return!!(n[a]||e!==Se&&a[0]!=="$"&&we(e,a)||yi(t,a)||we(i,a)||we(r,a)||we(wr,a)||we(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:we(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ea(e){return ne(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Fi=!0;function $d(e){const t=Oc(e),n=e.proxy,r=e.ctx;Fi=!1,t.beforeCreate&&ta(t.beforeCreate,e,"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:m,deactivated:E,beforeDestroy:v,beforeUnmount:y,destroyed:w,unmounted:k,render:C,renderTracked:$,renderTriggered:N,errorCaptured:U,serverPrefetch:S,expose:X,inheritAttrs:ae,components:H,directives:ue,filters:me}=t;if(c&&Md(c,r,null),o)for(const j in o){const B=o[j];ce(B)&&(r[j]=B.bind(n))}if(s){const j=s.call(n,n);Ee(j)&&(e.data=Yr(j))}if(Fi=!0,i)for(const j in i){const B=i[j],re=ce(B)?B.bind(n,n):ce(B.get)?B.get.bind(n,n):$t,he=!ce(B)&&ce(B.set)?B.set.bind(n):$t,be=qe({get:re,set:he});Object.defineProperty(r,j,{enumerable:!0,configurable:!0,get:()=>be.value,set:ye=>be.value=ye})}if(a)for(const j in a)Rc(a[j],r,n,j);if(l){const j=ce(l)?l.call(n):l;Reflect.ownKeys(j).forEach(B=>{ys(B,j[B])})}u&&ta(u,e,"c");function x(j,B){ne(B)?B.forEach(re=>j(re.bind(n))):B&&j(B.bind(n))}if(x(kd,h),x(Xr,d),x(Ad,f),x(Td,p),x(wd,m),x(Ed,E),x(Cd,U),x(Od,$),x(Rd,N),x(Tc,y),x(Qr,k),x(xd,S),ne(X))if(X.length){const j=e.exposed||(e.exposed={});X.forEach(B=>{Object.defineProperty(j,B,{get:()=>n[B],set:re=>n[B]=re,enumerable:!0})})}else e.exposed||(e.exposed={});C&&e.render===$t&&(e.render=C),ae!=null&&(e.inheritAttrs=ae),H&&(e.components=H),ue&&(e.directives=ue),S&&kc(e)}function Md(e,t,n=$t){ne(e)&&(e=qi(e));for(const r in e){const s=e[r];let i;Ee(s)?"default"in s?i=pt(s.from||r,s.default,!0):i=pt(s.from||r):i=pt(s),Ce(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[r]=i}}function ta(e,t,n){Et(ne(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Rc(e,t,n,r){let s=r.includes(".")?mc(n,r):()=>n[r];if(xe(e)){const i=t[e];ce(i)&&un(s,i)}else if(ce(e))un(s,e.bind(n));else if(Ee(e))if(ne(e))e.forEach(i=>Rc(i,t,n,r));else{const i=ce(e.handler)?e.handler.bind(n):t[e.handler];ce(i)&&un(s,i,e)}}function Oc(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,a=i.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(c=>xs(l,c,o,!0)),xs(l,t,o)),Ee(t)&&i.set(t,l),l}function xs(e,t,n,r=!1){const{mixins:s,extends:i}=t;i&&xs(e,i,n,!0),s&&s.forEach(o=>xs(e,o,n,!0));for(const o in t)if(!(r&&o==="expose")){const a=jd[o]||n&&n[o];e[o]=a?a(e[o],t[o]):t[o]}return e}const jd={data:na,props:ra,emits:ra,methods:fr,computed:fr,beforeCreate:Qe,created:Qe,beforeMount:Qe,mounted:Qe,beforeUpdate:Qe,updated:Qe,beforeDestroy:Qe,beforeUnmount:Qe,destroyed:Qe,unmounted:Qe,activated:Qe,deactivated:Qe,errorCaptured:Qe,serverPrefetch:Qe,components:fr,directives:fr,watch:Ud,provide:na,inject:Dd};function na(e,t){return t?e?function(){return Ue(ce(e)?e.call(this,this):e,ce(t)?t.call(this,this):t)}:t:e}function Dd(e,t){return fr(qi(e),qi(t))}function qi(e){if(ne(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Qe(e,t){return e?[...new Set([].concat(e,t))]:t}function fr(e,t){return e?Ue(Object.create(null),e,t):t}function ra(e,t){return e?ne(e)&&ne(t)?[...new Set([...e,...t])]:Ue(Object.create(null),ea(e),ea(t??{})):t}function Ud(e,t){if(!e)return t;if(!t)return e;const n=Ue(Object.create(null),e);for(const r in t)n[r]=Qe(e[r],t[r]);return n}function Cc(){return{app:null,config:{isNativeTag:Ml,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 Bd=0;function Hd(e,t){return function(r,s=null){ce(r)||(r=Ue({},r)),s!=null&&!Ee(s)&&(s=null);const i=Cc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Bd++,_component:r,_props:s,_container:null,_context:i,_instance:null,version:wf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&ce(u.install)?(o.add(u),u.install(c,...h)):ce(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||le(r,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),e(f,u,d),l=!0,c._container=u,u.__vue_app__=c,ni(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(Et(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=On;On=c;try{return u()}finally{On=h}}};return c}}let On=null;const Fd=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${rt(t)}Modifiers`]||e[`${dn(t)}Modifiers`];function qd(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Se;let s=n;const i=t.startsWith("update:"),o=i&&Fd(r,t.slice(7));o&&(o.trim&&(s=n.map(u=>xe(u)?u.trim():u)),o.number&&(s=n.map(Vs)));let a,l=r[a=di(t)]||r[a=di(rt(t))];!l&&i&&(l=r[a=di(dn(t))]),l&&Et(l,e,6,s);const c=r[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Et(c,e,6,s)}}const Kd=new WeakMap;function Nc(e,t,n=!1){const r=n?Kd:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const i=e.emits;let o={},a=!1;if(!ce(e)){const l=c=>{const u=Nc(c,t,!0);u&&(a=!0,Ue(o,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Ee(e)&&r.set(e,null),null):(ne(i)?i.forEach(l=>o[l]=null):Ue(o,i),Ee(e)&&r.set(e,o),o)}function ei(e,t){return!e||!Bs(t)?!1:(t=t.slice(2).replace(/Once$/,""),we(e,t[0].toLowerCase()+t.slice(1))||we(e,dn(t))||we(e,t))}function sa(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:p,inheritAttrs:m}=e,E=As(e);let v,y;try{if(n.shapeFlag&4){const k=s||r,C=k;v=It(c.call(C,k,u,h,f,d,p)),y=a}else{const k=t;v=It(k.length>1?k(h,{attrs:a,slots:o,emit:l}):k(h,null)),y=t.props?a:Wd(a)}}catch(k){Er.length=0,Zs(k,e,1),v=le(Ye)}let w=v;if(y&&m!==!1){const k=Object.keys(y),{shapeFlag:C}=w;k.length&&C&7&&(i&&k.some(Hs)&&(y=Vd(y,i)),w=hn(w,y,!1,!0))}return n.dirs&&(w=hn(w,null,!1,!0),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&Pr(w,n.transition),v=w,As(E),v}const Wd=e=>{let t;for(const n in e)(n==="class"||n==="style"||Bs(n))&&((t||(t={}))[n]=e[n]);return t},Vd=(e,t)=>{const n={};for(const r in e)(!Hs(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Gd(e,t,n){const{props:r,children:s,component:i}=e,{props:o,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?ia(r,o,c):!!o;if(l&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Ic(o,r,d)&&!ei(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?ia(r,o,c):!0:!!o;return!1}function ia(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const i=r[s];if(Ic(t,e,i)&&!ei(n,i))return!0}return!1}function Ic(e,t,n){const r=e[n],s=t[n];return n==="style"&&Ee(r)&&Ee(s)?!Jr(r,s):r!==s}function zd({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Pc={},Lc=()=>Object.create(Pc),$c=e=>Object.getPrototypeOf(e)===Pc;function Jd(e,t,n,r=!1){const s={},i=Lc();e.propsDefaults=Object.create(null),Mc(e,t,s,i);for(const o in e.propsOptions[0])o in s||(s[o]=void 0);n?e.props=r?s:ac(s):e.type.props?e.props=s:e.props=i,e.attrs=i}function Yd(e,t,n,r){const{props:s,attrs:i,vnode:{patchFlag:o}}=e,a=ge(s),[l]=e.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=e.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(ei(e.emitsOptions,d))continue;const f=t[d];if(l)if(we(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=rt(d);s[p]=Ki(l,a,p,f,e,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{Mc(e,t,s,i)&&(c=!0);let u;for(const h in a)(!t||!we(t,h)&&((u=dn(h))===h||!we(t,u)))&&(l?n&&(n[h]!==void 0||n[u]!==void 0)&&(s[h]=Ki(l,a,h,void 0,e,!0)):delete s[h]);if(i!==a)for(const h in i)(!t||!we(t,h))&&(delete i[h],c=!0)}c&&Wt(e.attrs,"set","")}function Mc(e,t,n,r){const[s,i]=e.propsOptions;let o=!1,a;if(t)for(let l in t){if(br(l))continue;const c=t[l];let u;s&&we(s,u=rt(l))?!i||!i.includes(u)?n[u]=c:(a||(a={}))[u]=c:ei(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(i){const l=ge(n),c=a||Se;for(let u=0;u<i.length;u++){const h=i[u];n[h]=Ki(s,l,h,c[h],e,!we(c,h))}}return o}function Ki(e,t,n,r,s,i){const o=e[n];if(o!=null){const a=we(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&ce(l)){const{propsDefaults:c}=s;if(n in c)r=c[n];else{const u=es(s);r=c[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}o[0]&&(i&&!a?r=!1:o[1]&&(r===""||r===dn(n))&&(r=!0))}return r}const Zd=new WeakMap;function jc(e,t,n=!1){const r=n?Zd:t.propsCache,s=r.get(e);if(s)return s;const i=e.props,o={},a=[];let l=!1;if(!ce(e)){const u=h=>{l=!0;const[d,f]=jc(h,t,!0);Ue(o,d),f&&a.push(...f)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!l)return Ee(e)&&r.set(e,zn),zn;if(ne(i))for(let u=0;u<i.length;u++){const h=rt(i[u]);oa(h)&&(o[h]=Se)}else if(i)for(const u in i){const h=rt(u);if(oa(h)){const d=i[u],f=o[h]=ne(d)||ce(d)?{type:d}:Ue({},d),p=f.type;let m=!1,E=!0;if(ne(p))for(let v=0;v<p.length;++v){const y=p[v],w=ce(y)&&y.name;if(w==="Boolean"){m=!0;break}else w==="String"&&(E=!1)}else m=ce(p)&&p.name==="Boolean";f[0]=m,f[1]=E,(m||we(f,"default"))&&a.push(h)}}const c=[o,a];return Ee(e)&&r.set(e,c),c}function oa(e){return e[0]!=="$"&&!br(e)}const ko=e=>e==="_"||e==="_ctx"||e==="$stable",Ao=e=>ne(e)?e.map(It):[It(e)],Xd=(e,t,n)=>{if(t._n)return t;const r=Mt((...s)=>Ao(t(...s)),n);return r._c=!1,r},Dc=(e,t,n)=>{const r=e._ctx;for(const s in e){if(ko(s))continue;const i=e[s];if(ce(i))t[s]=Xd(s,i,r);else if(i!=null){const o=Ao(i);t[s]=()=>o}}},Uc=(e,t)=>{const n=Ao(t);e.slots.default=()=>n},Bc=(e,t,n)=>{for(const r in t)(n||!ko(r))&&(e[r]=t[r])},Qd=(e,t,n)=>{const r=e.slots=Lc();if(e.vnode.shapeFlag&32){const s=t._;s?(Bc(r,t,n),n&&Bl(r,"_",s,!0)):Dc(t,r)}else t&&Uc(e,t)},ef=(e,t,n)=>{const{vnode:r,slots:s}=e;let i=!0,o=Se;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Bc(s,t,n):(i=!t.$stable,Dc(t,s)),o=t}else t&&(Uc(e,t),o={default:1});if(i)for(const a in s)!ko(a)&&o[a]==null&&delete s[a]},et=of;function tf(e){return nf(e)}function nf(e,t){const n=Gs();n.__VUE__=!0;const{insert:r,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=$t,insertStaticContent:p}=e,m=(g,b,_,A=null,L=null,R=null,O=void 0,q=null,D=!!b.dynamicChildren)=>{if(g===b)return;g&&!kn(g,b)&&(A=I(g),ye(g,L,R,!0),g=null),b.patchFlag===-2&&(D=!1,b.dynamicChildren=null);const{type:T,ref:te,shapeFlag:W}=b;switch(T){case ti:E(g,b,_,A);break;case Ye:v(g,b,_,A);break;case vs:g==null&&y(b,_,A,O);break;case de:H(g,b,_,A,L,R,O,q,D);break;default:W&1?C(g,b,_,A,L,R,O,q,D):W&6?ue(g,b,_,A,L,R,O,q,D):(W&64||W&128)&&T.process(g,b,_,A,L,R,O,q,D,ee)}te!=null&&L?_r(te,g&&g.ref,R,b||g,!b):te==null&&g&&g.ref!=null&&_r(g.ref,null,R,g,!0)},E=(g,b,_,A)=>{if(g==null)r(b.el=a(b.children),_,A);else{const L=b.el=g.el;b.children!==g.children&&c(L,b.children)}},v=(g,b,_,A)=>{g==null?r(b.el=l(b.children||""),_,A):b.el=g.el},y=(g,b,_,A)=>{[g.el,g.anchor]=p(g.children,b,_,A,g.el,g.anchor)},w=({el:g,anchor:b},_,A)=>{let L;for(;g&&g!==b;)L=d(g),r(g,_,A),g=L;r(b,_,A)},k=({el:g,anchor:b})=>{let _;for(;g&&g!==b;)_=d(g),s(g),g=_;s(b)},C=(g,b,_,A,L,R,O,q,D)=>{if(b.type==="svg"?O="svg":b.type==="math"&&(O="mathml"),g==null)$(b,_,A,L,R,O,q,D);else{const T=g.el&&g.el._isVueCE?g.el:null;try{T&&T._beginPatch(),S(g,b,L,R,O,q,D)}finally{T&&T._endPatch()}}},$=(g,b,_,A,L,R,O,q)=>{let D,T;const{props:te,shapeFlag:W,transition:Q,dirs:se}=g;if(D=g.el=o(g.type,R,te&&te.is,te),W&8?u(D,g.children):W&16&&U(g.children,D,null,A,L,vi(g,R),O,q),se&&gn(g,null,A,"created"),N(D,g,g.scopeId,O,A),te){for(const F in te)F!=="value"&&!br(F)&&i(D,F,null,te[F],R,A);"value"in te&&i(D,"value",null,te.value,R),(T=te.onVnodeBeforeMount)&&At(T,A,g)}se&&gn(g,null,A,"beforeMount");const M=rf(L,Q);M&&Q.beforeEnter(D),r(D,b,_),((T=te&&te.onVnodeMounted)||M||se)&&et(()=>{try{T&&At(T,A,g),M&&Q.enter(D),se&&gn(g,null,A,"mounted")}finally{}},L)},N=(g,b,_,A,L)=>{if(_&&f(g,_),A)for(let R=0;R<A.length;R++)f(g,A[R]);if(L){let R=L.subTree;if(b===R||qc(R.type)&&(R.ssContent===b||R.ssFallback===b)){const O=L.vnode;N(g,O,O.scopeId,O.slotScopeIds,L.parent)}}},U=(g,b,_,A,L,R,O,q,D=0)=>{for(let T=D;T<g.length;T++){const te=g[T]=q?Kt(g[T]):It(g[T]);m(null,te,b,_,A,L,R,O,q)}},S=(g,b,_,A,L,R,O)=>{const q=b.el=g.el;let{patchFlag:D,dynamicChildren:T,dirs:te}=b;D|=g.patchFlag&16;const W=g.props||Se,Q=b.props||Se;let se;if(_&&mn(_,!1),(se=Q.onVnodeBeforeUpdate)&&At(se,_,b,g),te&&gn(b,g,_,"beforeUpdate"),_&&mn(_,!0),(W.innerHTML&&Q.innerHTML==null||W.textContent&&Q.textContent==null)&&u(q,""),T?X(g.dynamicChildren,T,q,_,A,vi(b,L),R):O||B(g,b,q,null,_,A,vi(b,L),R,!1),D>0){if(D&16)ae(q,W,Q,_,L);else if(D&2&&W.class!==Q.class&&i(q,"class",null,Q.class,L),D&4&&i(q,"style",W.style,Q.style,L),D&8){const M=b.dynamicProps;for(let F=0;F<M.length;F++){const Y=M[F],ie=W[Y],pe=Q[Y];(pe!==ie||Y==="value")&&i(q,Y,ie,pe,L,_)}}D&1&&g.children!==b.children&&u(q,b.children)}else!O&&T==null&&ae(q,W,Q,_,L);((se=Q.onVnodeUpdated)||te)&&et(()=>{se&&At(se,_,b,g),te&&gn(b,g,_,"updated")},A)},X=(g,b,_,A,L,R,O)=>{for(let q=0;q<b.length;q++){const D=g[q],T=b[q],te=D.el&&(D.type===de||!kn(D,T)||D.shapeFlag&198)?h(D.el):_;m(D,T,te,null,A,L,R,O,!0)}},ae=(g,b,_,A,L)=>{if(b!==_){if(b!==Se)for(const R in b)!br(R)&&!(R in _)&&i(g,R,b[R],null,L,A);for(const R in _){if(br(R))continue;const O=_[R],q=b[R];O!==q&&R!=="value"&&i(g,R,q,O,L,A)}"value"in _&&i(g,"value",b.value,_.value,L)}},H=(g,b,_,A,L,R,O,q,D)=>{const T=b.el=g?g.el:a(""),te=b.anchor=g?g.anchor:a("");let{patchFlag:W,dynamicChildren:Q,slotScopeIds:se}=b;se&&(q=q?q.concat(se):se),g==null?(r(T,_,A),r(te,_,A),U(b.children||[],_,te,L,R,O,q,D)):W>0&&W&64&&Q&&g.dynamicChildren&&g.dynamicChildren.length===Q.length?(X(g.dynamicChildren,Q,_,L,R,O,q),(b.key!=null||L&&b===L.subTree)&&To(g,b,!0)):B(g,b,_,te,L,R,O,q,D)},ue=(g,b,_,A,L,R,O,q,D)=>{b.slotScopeIds=q,g==null?b.shapeFlag&512?L.ctx.activate(b,_,A,O,D):me(b,_,A,L,R,O,D):Ne(g,b,D)},me=(g,b,_,A,L,R,O)=>{const q=g.component=pf(g,A,L);if(Xs(g)&&(q.ctx.renderer=ee),gf(q,!1,O),q.asyncDep){if(L&&L.registerDep(q,x,O),!g.el){const D=q.subTree=le(Ye);v(null,D,b,_),g.placeholder=D.el}}else x(q,g,b,_,L,R,O)},Ne=(g,b,_)=>{const A=b.component=g.component;if(Gd(g,b,_))if(A.asyncDep&&!A.asyncResolved){j(A,b,_);return}else A.next=b,A.update();else b.el=g.el,A.vnode=b},x=(g,b,_,A,L,R,O)=>{const q=()=>{if(g.isMounted){let{next:W,bu:Q,u:se,parent:M,vnode:F}=g;{const ht=Hc(g);if(ht){W&&(W.el=F.el,j(g,W,O)),ht.asyncDep.then(()=>{et(()=>{g.isUnmounted||T()},L)});return}}let Y=W,ie;mn(g,!1),W?(W.el=F.el,j(g,W,O)):W=F,Q&&bs(Q),(ie=W.props&&W.props.onVnodeBeforeUpdate)&&At(ie,M,W,F),mn(g,!0);const pe=sa(g),Pe=g.subTree;g.subTree=pe,m(Pe,pe,h(Pe.el),I(Pe),g,L,R),W.el=pe.el,Y===null&&zd(g,pe.el),se&&et(se,L),(ie=W.props&&W.props.onVnodeUpdated)&&et(()=>At(ie,M,W,F),L)}else{let W;const{el:Q,props:se}=b,{bm:M,m:F,parent:Y,root:ie,type:pe}=g,Pe=Zn(b);mn(g,!1),M&&bs(M),!Pe&&(W=se&&se.onVnodeBeforeMount)&&At(W,Y,b),mn(g,!0);{ie.ce&&ie.ce._hasShadowRoot()&&ie.ce._injectChildStyle(pe,g.parent?g.parent.type:void 0);const ht=g.subTree=sa(g);m(null,ht,_,A,g,L,R),b.el=ht.el}if(F&&et(F,L),!Pe&&(W=se&&se.onVnodeMounted)){const ht=b;et(()=>At(W,Y,ht),L)}(b.shapeFlag&256||Y&&Zn(Y.vnode)&&Y.vnode.shapeFlag&256)&&g.a&&et(g.a,L),g.isMounted=!0,b=_=A=null}};g.scope.on();const D=g.effect=new Gl(q);g.scope.off();const T=g.update=D.run.bind(D),te=g.job=D.runIfDirty.bind(D);te.i=g,te.id=g.uid,D.scheduler=()=>So(te),mn(g,!0),T()},j=(g,b,_)=>{b.component=g;const A=g.vnode.props;g.vnode=b,g.next=null,Yd(g,b.props,A,_),ef(g,b.children,_),Jt(),Go(g),Yt()},B=(g,b,_,A,L,R,O,q,D=!1)=>{const T=g&&g.children,te=g?g.shapeFlag:0,W=b.children,{patchFlag:Q,shapeFlag:se}=b;if(Q>0){if(Q&128){he(T,W,_,A,L,R,O,q,D);return}else if(Q&256){re(T,W,_,A,L,R,O,q,D);return}}se&8?(te&16&&Xe(T,L,R),W!==T&&u(_,W)):te&16?se&16?he(T,W,_,A,L,R,O,q,D):Xe(T,L,R,!0):(te&8&&u(_,""),se&16&&U(W,_,A,L,R,O,q,D))},re=(g,b,_,A,L,R,O,q,D)=>{g=g||zn,b=b||zn;const T=g.length,te=b.length,W=Math.min(T,te);let Q;for(Q=0;Q<W;Q++){const se=b[Q]=D?Kt(b[Q]):It(b[Q]);m(g[Q],se,_,null,L,R,O,q,D)}T>te?Xe(g,L,R,!0,!1,W):U(b,_,A,L,R,O,q,D,W)},he=(g,b,_,A,L,R,O,q,D)=>{let T=0;const te=b.length;let W=g.length-1,Q=te-1;for(;T<=W&&T<=Q;){const se=g[T],M=b[T]=D?Kt(b[T]):It(b[T]);if(kn(se,M))m(se,M,_,null,L,R,O,q,D);else break;T++}for(;T<=W&&T<=Q;){const se=g[W],M=b[Q]=D?Kt(b[Q]):It(b[Q]);if(kn(se,M))m(se,M,_,null,L,R,O,q,D);else break;W--,Q--}if(T>W){if(T<=Q){const se=Q+1,M=se<te?b[se].el:A;for(;T<=Q;)m(null,b[T]=D?Kt(b[T]):It(b[T]),_,M,L,R,O,q,D),T++}}else if(T>Q)for(;T<=W;)ye(g[T],L,R,!0),T++;else{const se=T,M=T,F=new Map;for(T=M;T<=Q;T++){const it=b[T]=D?Kt(b[T]):It(b[T]);it.key!=null&&F.set(it.key,T)}let Y,ie=0;const pe=Q-M+1;let Pe=!1,ht=0;const pn=new Array(pe);for(T=0;T<pe;T++)pn[T]=0;for(T=se;T<=W;T++){const it=g[T];if(ie>=pe){ye(it,L,R,!0);continue}let kt;if(it.key!=null)kt=F.get(it.key);else for(Y=M;Y<=Q;Y++)if(pn[Y-M]===0&&kn(it,b[Y])){kt=Y;break}kt===void 0?ye(it,L,R,!0):(pn[kt-M]=T+1,kt>=ht?ht=kt:Pe=!0,m(it,b[kt],_,null,L,R,O,q,D),ie++)}const Bo=Pe?sf(pn):zn;for(Y=Bo.length-1,T=pe-1;T>=0;T--){const it=M+T,kt=b[it],Ho=b[it+1],Fo=it+1<te?Ho.el||Fc(Ho):A;pn[T]===0?m(null,kt,_,Fo,L,R,O,q,D):Pe&&(Y<0||T!==Bo[Y]?be(kt,_,Fo,2):Y--)}}},be=(g,b,_,A,L=null)=>{const{el:R,type:O,transition:q,children:D,shapeFlag:T}=g;if(T&6){be(g.component.subTree,b,_,A);return}if(T&128){g.suspense.move(b,_,A);return}if(T&64){O.move(g,b,_,ee);return}if(O===de){r(R,b,_);for(let W=0;W<D.length;W++)be(D[W],b,_,A);r(g.anchor,b,_);return}if(O===vs){w(g,b,_);return}if(A!==2&&T&1&&q)if(A===0)q.beforeEnter(R),r(R,b,_),et(()=>q.enter(R),L);else{const{leave:W,delayLeave:Q,afterLeave:se}=q,M=()=>{g.ctx.isUnmounted?s(R):r(R,b,_)},F=()=>{R._isLeaving&&R[Ot](!0),W(R,()=>{M(),se&&se()})};Q?Q(R,M,F):F()}else r(R,b,_)},ye=(g,b,_,A=!1,L=!1)=>{const{type:R,props:O,ref:q,children:D,dynamicChildren:T,shapeFlag:te,patchFlag:W,dirs:Q,cacheIndex:se,memo:M}=g;if(W===-2&&(L=!1),q!=null&&(Jt(),_r(q,null,_,g,!0),Yt()),se!=null&&(b.renderCache[se]=void 0),te&256){b.ctx.deactivate(g);return}const F=te&1&&Q,Y=!Zn(g);let ie;if(Y&&(ie=O&&O.onVnodeBeforeUnmount)&&At(ie,b,g),te&6)Be(g.component,_,A);else{if(te&128){g.suspense.unmount(_,A);return}F&&gn(g,null,b,"beforeUnmount"),te&64?g.type.remove(g,b,_,ee,A):T&&!T.hasOnce&&(R!==de||W>0&&W&64)?Xe(T,b,_,!1,!0):(R===de&&W&384||!L&&te&16)&&Xe(D,b,_),A&&Ke(g)}const pe=M!=null&&se==null;(Y&&(ie=O&&O.onVnodeUnmounted)||F||pe)&&et(()=>{ie&&At(ie,b,g),F&&gn(g,null,b,"unmounted"),pe&&(g.el=null)},_)},Ke=g=>{const{type:b,el:_,anchor:A,transition:L}=g;if(b===de){Ie(_,A);return}if(b===vs){k(g);return}const R=()=>{s(_),L&&!L.persisted&&L.afterLeave&&L.afterLeave()};if(g.shapeFlag&1&&L&&!L.persisted){const{leave:O,delayLeave:q}=L,D=()=>O(_,R);q?q(g.el,R,D):D()}else R()},Ie=(g,b)=>{let _;for(;g!==b;)_=d(g),s(g),g=_;s(b)},Be=(g,b,_)=>{const{bum:A,scope:L,job:R,subTree:O,um:q,m:D,a:T}=g;aa(D),aa(T),A&&bs(A),L.stop(),R&&(R.flags|=8,ye(O,g,b,_)),q&&et(q,b),et(()=>{g.isUnmounted=!0},b)},Xe=(g,b,_,A=!1,L=!1,R=0)=>{for(let O=R;O<g.length;O++)ye(g[O],b,_,A,L)},I=g=>{if(g.shapeFlag&6)return I(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const b=d(g.anchor||g.el),_=b&&b[bc];return _?d(_):b};let J=!1;const z=(g,b,_)=>{let A;g==null?b._vnode&&(ye(b._vnode,null,null,!0),A=b._vnode.component):m(b._vnode||null,g,b,null,null,null,_),b._vnode=g,J||(J=!0,Go(A),dc(),J=!1)},ee={p:m,um:ye,m:be,r:Ke,mt:me,mc:U,pc:B,pbc:X,n:I,o:e};return{render:z,hydrate:void 0,createApp:Hd(z)}}function vi({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function mn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function rf(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function To(e,t,n=!1){const r=e.children,s=t.children;if(ne(r)&&ne(s))for(let i=0;i<r.length;i++){const o=r[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Kt(s[i]),a.el=o.el),!n&&a.patchFlag!==-2&&To(o,a)),a.type===ti&&(a.patchFlag===-1&&(a=s[i]=Kt(a)),a.el=o.el),a.type===Ye&&!a.el&&(a.el=o.el)}}function sf(e){const t=e.slice(),n=[0];let r,s,i,o,a;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(s=n[n.length-1],e[s]<c){t[r]=s,n.push(r);continue}for(i=0,o=n.length-1;i<o;)a=i+o>>1,e[n[a]]<c?i=a+1:o=a;c<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function Hc(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Hc(t)}function aa(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Fc(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Fc(t.subTree):null}const qc=e=>e.__isSuspense;function of(e,t){t&&t.pendingBranch?ne(e)?t.effects.push(...e):t.effects.push(e):ld(e)}const de=Symbol.for("v-fgt"),ti=Symbol.for("v-txt"),Ye=Symbol.for("v-cmt"),vs=Symbol.for("v-stc"),Er=[];let at=null;function K(e=!1){Er.push(at=e?null:[])}function af(){Er.pop(),at=Er[Er.length-1]||null}let Lr=1;function Rs(e,t=!1){Lr+=e,e<0&&at&&t&&(at.hasOnce=!0)}function Kc(e){return e.dynamicChildren=Lr>0?at||zn:null,af(),Lr>0&&at&&at.push(e),e}function G(e,t,n,r,s,i){return Kc(P(e,t,n,r,s,i,!0))}function nr(e,t,n,r,s){return Kc(le(e,t,n,r,s,!0))}function $r(e){return e?e.__v_isVNode===!0:!1}function kn(e,t){return e.type===t.type&&e.key===t.key}const Wc=({key:e})=>e??null,_s=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?xe(e)||Ce(e)||ce(e)?{i:Ge,r:e,k:t,f:!!n}:e:null);function P(e,t=null,n=null,r=0,s=null,i=e===de?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Wc(t),ref:t&&_s(t),scopeId:pc,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ge};return a?(xo(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=xe(n)?8:16),Lr>0&&!o&&at&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&at.push(l),l}const le=lf;function lf(e,t=null,n=null,r=0,s=null,i=!1){if((!e||e===Id)&&(e=Ye),$r(e)){const a=hn(e,t,!0);return n&&xo(a,n),Lr>0&&!i&&at&&(a.shapeFlag&6?at[at.indexOf(e)]=a:at.push(a)),a.patchFlag=-2,a}if(_f(e)&&(e=e.__vccOpts),t){t=cf(t);let{class:a,style:l}=t;a&&!xe(a)&&(t.class=vt(a)),Ee(l)&&(Ys(l)&&!ne(l)&&(l=Ue({},l)),t.style=zs(l))}const o=xe(e)?1:qc(e)?128:yc(e)?64:Ee(e)?4:ce(e)?2:0;return P(e,t,n,r,s,o,i,!0)}function cf(e){return e?Ys(e)||$c(e)?Ue({},e):e:null}function hn(e,t,n=!1,r=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=e,c=t?hf(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Wc(c),ref:t&&t.ref?n&&i?ne(i)?i.concat(_s(t)):[i,_s(t)]:_s(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==de?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&hn(e.ssContent),ssFallback:e.ssFallback&&hn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Pr(u,l.clone(u)),u}function Vc(e=" ",t=0){return le(ti,null,e,t)}function uf(e,t){const n=le(vs,null,e);return n.staticCount=t,n}function Fe(e="",t=!1){return t?(K(),nr(Ye,null,e)):le(Ye,null,e)}function It(e){return e==null||typeof e=="boolean"?le(Ye):ne(e)?le(de,null,e.slice()):$r(e)?Kt(e):le(ti,null,String(e))}function Kt(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:hn(e)}function xo(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(ne(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),xo(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!$c(t)?t._ctx=Ge:s===3&&Ge&&(Ge.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ce(t)?(t={default:t,_ctx:Ge},n=32):(t=String(t),r&64?(n=16,t=[Vc(t)]):n=8);e.children=t,e.shapeFlag|=n}function hf(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=vt([t.class,r.class]));else if(s==="style")t.style=zs([t.style,r.style]);else if(Bs(s)){const i=t[s],o=r[s];o&&i!==o&&!(ne(i)&&i.includes(o))?t[s]=i?[].concat(i,o):o:o==null&&i==null&&!Hs(s)&&(t[s]=o)}else s!==""&&(t[s]=r[s])}return t}function At(e,t,n,r=null){Et(e,t,7,[n,r])}const df=Cc();let ff=0;function pf(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||df,i={uid:ff++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Kl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:jc(r,s),emitsOptions:Nc(r,s),emit:null,emitted:null,propsDefaults:Se,inheritAttrs:r.inheritAttrs,ctx:Se,data:Se,props:Se,attrs:Se,slots:Se,refs:Se,setupState:Se,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=qd.bind(null,i),e.ce&&e.ce(i),i}let Ze=null;const Ro=()=>Ze||Ge;let Os,Wi;{const e=Gs(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Os=t("__VUE_INSTANCE_SETTERS__",n=>Ze=n),Wi=t("__VUE_SSR_SETTERS__",n=>Mr=n)}const es=e=>{const t=Ze;return Os(e),e.scope.on(),()=>{e.scope.off(),Os(t)}},la=()=>{Ze&&Ze.scope.off(),Os(null)};function Gc(e){return e.vnode.shapeFlag&4}let Mr=!1;function gf(e,t=!1,n=!1){t&&Wi(t);const{props:r,children:s}=e.vnode,i=Gc(e);Jd(e,r,i,t),Qd(e,s,n||t);const o=i?mf(e,t):void 0;return t&&Wi(!1),o}function mf(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Ld);const{setup:r}=n;if(r){Jt();const s=e.setupContext=r.length>1?yf(e):null,i=es(e),o=Zr(r,e,0,[e.props,s]),a=jl(o);if(Yt(),i(),(a||e.sp)&&!Zn(e)&&kc(e),a){if(o.then(la,la),t)return o.then(l=>{ca(e,l)}).catch(l=>{Zs(l,e,0)});e.asyncDep=o}else ca(e,o)}else zc(e)}function ca(e,t,n){ce(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ee(t)&&(e.setupState=cc(t)),zc(e)}function zc(e,t,n){const r=e.type;e.render||(e.render=r.render||$t);{const s=es(e);Jt();try{$d(e)}finally{Yt(),s()}}}const bf={get(e,t){return Je(e,"get",""),e[t]}};function yf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,bf),slots:e.slots,emit:e.emit,expose:t}}function ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(cc(Eo(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wr)return wr[n](e)},has(t,n){return n in t||n in wr}})):e.proxy}function vf(e,t=!0){return ce(e)?e.displayName||e.name:e.name||t&&e.__name}function _f(e){return ce(e)&&"__vccOpts"in e}const qe=(e,t)=>rd(e,t,Mr);function Oo(e,t,n){try{Rs(-1);const r=arguments.length;return r===2?Ee(t)&&!ne(t)?$r(t)?le(e,null,[t]):le(e,t):le(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&$r(n)&&(n=[n]),le(e,t,n))}finally{Rs(1)}}const wf="3.5.34";/**
15
- * @vue/runtime-dom v3.5.34
16
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
- * @license MIT
18
- **/let Vi;const ua=typeof window<"u"&&window.trustedTypes;if(ua)try{Vi=ua.createPolicy("vue",{createHTML:e=>e})}catch{}const Jc=Vi?e=>Vi.createHTML(e):e=>e,Ef="http://www.w3.org/2000/svg",Sf="http://www.w3.org/1998/Math/MathML",Ht=typeof document<"u"?document:null,ha=Ht&&Ht.createElement("template"),kf={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?Ht.createElementNS(Ef,e):t==="mathml"?Ht.createElementNS(Sf,e):n?Ht.createElement(e,{is:n}):Ht.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Ht.createTextNode(e),createComment:e=>Ht.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ht.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,i){const o=n?n.previousSibling:t.lastChild;if(s&&(s===i||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===i||!(s=s.nextSibling)););else{ha.innerHTML=Jc(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=ha.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},en="transition",cr="animation",jr=Symbol("_vtc"),Yc={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=Ue({},vc,Yc),Tf=e=>(e.displayName="Transition",e.props=Af,e),Sr=Tf((e,{slots:t})=>Oo(_d,xf(e),t)),bn=(e,t=[])=>{ne(e)?e.forEach(n=>n(...t)):e&&e(...t)},da=e=>e?ne(e)?e.some(t=>t.length>1):e.length>1:!1;function xf(e){const t={};for(const H in e)H in Yc||(t[H]=e[H]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:d=`${n}-leave-active`,leaveToClass:f=`${n}-leave-to`}=e,p=Rf(s),m=p&&p[0],E=p&&p[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:w,onLeave:k,onLeaveCancelled:C,onBeforeAppear:$=v,onAppear:N=y,onAppearCancelled:U=w}=t,S=(H,ue,me,Ne)=>{H._enterCancelled=Ne,yn(H,ue?u:a),yn(H,ue?c:o),me&&me()},X=(H,ue)=>{H._isLeaving=!1,yn(H,h),yn(H,f),yn(H,d),ue&&ue()},ae=H=>(ue,me)=>{const Ne=H?N:y,x=()=>S(ue,H,me);bn(Ne,[ue,x]),fa(()=>{yn(ue,H?l:i),Dt(ue,H?u:a),da(Ne)||pa(ue,r,m,x)})};return Ue(t,{onBeforeEnter(H){bn(v,[H]),Dt(H,i),Dt(H,o)},onBeforeAppear(H){bn($,[H]),Dt(H,l),Dt(H,c)},onEnter:ae(!1),onAppear:ae(!0),onLeave(H,ue){H._isLeaving=!0;const me=()=>X(H,ue);Dt(H,h),H._enterCancelled?(Dt(H,d),ba(H)):(ba(H),Dt(H,d)),fa(()=>{H._isLeaving&&(yn(H,h),Dt(H,f),da(k)||pa(H,r,E,me))}),bn(k,[H,me])},onEnterCancelled(H){S(H,!1,void 0,!0),bn(w,[H])},onAppearCancelled(H){S(H,!0,void 0,!0),bn(U,[H])},onLeaveCancelled(H){X(H),bn(C,[H])}})}function Rf(e){if(e==null)return null;if(Ee(e))return[_i(e.enter),_i(e.leave)];{const t=_i(e);return[t,t]}}function _i(e){return wh(e)}function Dt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[jr]||(e[jr]=new Set)).add(t)}function yn(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[jr];n&&(n.delete(t),n.size||(e[jr]=void 0))}function fa(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Of=0;function pa(e,t,n,r){const s=e._endId=++Of,i=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:a,propCount:l}=Cf(e,t);if(!o)return r();const c=o+"end";let u=0;const h=()=>{e.removeEventListener(c,d),i()},d=f=>{f.target===e&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),e.addEventListener(c,d)}function Cf(e,t){const n=window.getComputedStyle(e),r=p=>(n[p]||"").split(", "),s=r(`${en}Delay`),i=r(`${en}Duration`),o=ga(s,i),a=r(`${cr}Delay`),l=r(`${cr}Duration`),c=ga(a,l);let u=null,h=0,d=0;t===en?o>0&&(u=en,h=o,d=i.length):t===cr?c>0&&(u=cr,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?en:cr:null,d=u?u===en?i.length:l.length:0);const f=u===en&&/\b(?:transform|all)(?:,|$)/.test(r(`${en}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function ga(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ma(n)+ma(e[r])))}function ma(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ba(e){return(e?e.ownerDocument:document).body.offsetHeight}function Nf(e,t,n){const r=e[jr];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const ya=Symbol("_vod"),If=Symbol("_vsh"),Pf=Symbol(""),Lf=/(?:^|;)\s*display\s*:/;function $f(e,t,n){const r=e.style,s=xe(n);let i=!1;if(n&&!s){if(t)if(xe(t))for(const o of t.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&pr(r,a,"")}else for(const o in t)n[o]==null&&pr(r,o,"");for(const o in n){o==="display"&&(i=!0);const a=n[o];a!=null?jf(e,o,!xe(t)&&t?t[o]:void 0,a)||pr(r,o,a):pr(r,o,"")}}else if(s){if(t!==n){const o=r[Pf];o&&(n+=";"+o),r.cssText=n,i=Lf.test(n)}}else t&&e.removeAttribute("style");ya in e&&(e[ya]=i?r.display:"",e[If]&&(r.display="none"))}const va=/\s*!important$/;function pr(e,t,n){if(ne(n))n.forEach(r=>pr(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Mf(e,t);va.test(n)?e.setProperty(dn(r),n.replace(va,""),"important"):e[r]=n}}const _a=["Webkit","Moz","ms"],wi={};function Mf(e,t){const n=wi[t];if(n)return n;let r=rt(t);if(r!=="filter"&&r in e)return wi[t]=r;r=Ws(r);for(let s=0;s<_a.length;s++){const i=_a[s]+r;if(i in e)return wi[t]=i}return t}function jf(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&xe(r)&&n===r}const wa="http://www.w3.org/1999/xlink";function Ea(e,t,n,r,s,i=xh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(wa,t.slice(6,t.length)):e.setAttributeNS(wa,t,n):n==null||i&&!Hl(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ut(n)?String(n):n)}function Sa(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Jc(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=Hl(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(s||t)}function An(e,t,n,r){e.addEventListener(t,n,r)}function Df(e,t,n,r){e.removeEventListener(t,n,r)}const ka=Symbol("_vei");function Uf(e,t,n,r,s=null){const i=e[ka]||(e[ka]={}),o=i[t];if(r&&o)o.value=r;else{const[a,l]=Bf(t);if(r){const c=i[t]=qf(r,s);An(e,a,c,l)}else o&&(Df(e,a,o,l),i[t]=void 0)}}const Aa=/(?:Once|Passive|Capture)$/;function Bf(e){let t;if(Aa.test(e)){t={};let r;for(;r=e.match(Aa);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):dn(e.slice(2)),t]}let Ei=0;const Hf=Promise.resolve(),Ff=()=>Ei||(Hf.then(()=>Ei=0),Ei=Date.now());function qf(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Et(Kf(r,n.value),t,5,[r])};return n.value=e,n.attached=Ff(),n}function Kf(e,t){if(ne(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Ta=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Wf=(e,t,n,r,s,i)=>{const o=s==="svg";t==="class"?Nf(e,r,o):t==="style"?$f(e,n,r):Bs(t)?Hs(t)||Uf(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Vf(e,t,r,o))?(Sa(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ea(e,t,r,o,i,t!=="value")):e._isVueCE&&(Gf(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!xe(r)))?Sa(e,rt(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ea(e,t,r,o))};function Vf(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ta(t)&&ce(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ta(t)&&xe(n)?!1:t in e}function Gf(e,t){const n=e._def.props;if(!n)return!1;const r=rt(t);return Array.isArray(n)?n.some(s=>rt(s)===r):Object.keys(n).some(s=>rt(s)===r)}const Cs=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ne(t)?n=>bs(t,n):t};function zf(e){e.target.composing=!0}function xa(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Xn=Symbol("_assign");function Ra(e,t,n){return t&&(e=e.trim()),n&&(e=Vs(e)),e}const Jf={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Xn]=Cs(s);const i=r||s.props&&s.props.type==="number";An(e,t?"change":"input",o=>{o.target.composing||e[Xn](Ra(e.value,n,i))}),(n||i)&&An(e,"change",()=>{e.value=Ra(e.value,n,i)}),t||(An(e,"compositionstart",zf),An(e,"compositionend",xa),An(e,"change",xa))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:i}},o){if(e[Xn]=Cs(o),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Vs(e.value):e.value,l=t??"";if(a===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},cw={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const s=Fs(t);An(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?Vs(Ns(o)):Ns(o));e[Xn](e.multiple?s?new Set(i):i:i[0]),e._assigning=!0,tr(()=>{e._assigning=!1})}),e[Xn]=Cs(r)},mounted(e,{value:t}){Oa(e,t)},beforeUpdate(e,t,n){e[Xn]=Cs(n)},updated(e,{value:t}){e._assigning||Oa(e,t)}};function Oa(e,t){const n=e.multiple,r=ne(t);if(!(n&&!r&&!Fs(t))){for(let s=0,i=e.options.length;s<i;s++){const o=e.options[s],a=Ns(o);if(n)if(r){const l=typeof a;l==="string"||l==="number"?o.selected=t.some(c=>String(c)===String(a)):o.selected=Oh(t,a)>-1}else o.selected=t.has(a);else if(Jr(Ns(o),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ns(e){return"_value"in e?e._value:e.value}const Yf=["ctrl","shift","alt","meta"],Zf={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Yf.some(n=>e[`${n}Key`]&&!t.includes(n))},Xf=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(s,...i)=>{for(let o=0;o<t.length;o++){const a=Zf[t[o]];if(a&&a(s,t))return}return e(s,...i)})},Qf={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},uw=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=s=>{if(!("key"in s))return;const i=dn(s.key);if(t.some(o=>o===i||Qf[o]===i))return e(s)})},ep=Ue({patchProp:Wf},kf);let Ca;function tp(){return Ca||(Ca=tf(ep))}const np=(...e)=>{const t=tp().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=sp(r);if(!s)return;const i=t._component;!ce(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=n(s,!1,rp(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},t};function rp(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function sp(e){return xe(e)?document.querySelector(e):e}/*!
19
- * pinia v2.3.1
20
- * (c) 2025 Eduardo San Martin Morote
21
- * @license MIT
22
- */let Zc;const ri=e=>Zc=e,Xc=Symbol();function Gi(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var kr;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(kr||(kr={}));function ip(){const e=Wl(!0),t=e.run(()=>ve({}));let n=[],r=[];const s=Eo({install(i){ri(s),s._a=i,i.provide(Xc,s),i.config.globalProperties.$pinia=s,r.forEach(o=>n.push(o)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return s}const Qc=()=>{};function Na(e,t,n,r=Qc){e.push(t);const s=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),r())};return!n&&Vl()&&Ch(s),s}function Pn(e,...t){e.slice().forEach(n=>{n(...t)})}const op=e=>e(),Ia=Symbol(),Si=Symbol();function zi(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],s=e[n];Gi(s)&&Gi(r)&&e.hasOwnProperty(n)&&!Ce(r)&&!Gt(r)?e[n]=zi(s,r):e[n]=r}return e}const ap=Symbol();function lp(e){return!Gi(e)||!e.hasOwnProperty(ap)}const{assign:rn}=Object;function cp(e){return!!(Ce(e)&&e.effect)}function up(e,t,n,r){const{state:s,actions:i,getters:o}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=s?s():{});const u=Qh(n.state.value[e]);return rn(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=Eo(qe(()=>{ri(n);const f=n._s.get(e);return o[d].call(f,f)})),h),{}))}return l=eu(e,c,t,n,r,!0),l}function eu(e,t,n={},r,s,i){let o;const a=rn({actions:{}},n),l={deep:!0};let c,u,h=[],d=[],f;const p=r.state.value[e];!i&&!p&&(r.state.value[e]={});let m;function E(U){let S;c=u=!1,typeof U=="function"?(U(r.state.value[e]),S={type:kr.patchFunction,storeId:e,events:f}):(zi(r.state.value[e],U),S={type:kr.patchObject,payload:U,storeId:e,events:f});const X=m=Symbol();tr().then(()=>{m===X&&(c=!0)}),u=!0,Pn(h,S,r.state.value[e])}const v=i?function(){const{state:S}=n,X=S?S():{};this.$patch(ae=>{rn(ae,X)})}:Qc;function y(){o.stop(),h=[],d=[],r._s.delete(e)}const w=(U,S="")=>{if(Ia in U)return U[Si]=S,U;const X=function(){ri(r);const ae=Array.from(arguments),H=[],ue=[];function me(j){H.push(j)}function Ne(j){ue.push(j)}Pn(d,{args:ae,name:X[Si],store:C,after:me,onError:Ne});let x;try{x=U.apply(this&&this.$id===e?this:C,ae)}catch(j){throw Pn(ue,j),j}return x instanceof Promise?x.then(j=>(Pn(H,j),j)).catch(j=>(Pn(ue,j),Promise.reject(j))):(Pn(H,x),x)};return X[Ia]=!0,X[Si]=S,X},k={_p:r,$id:e,$onAction:Na.bind(null,d),$patch:E,$reset:v,$subscribe(U,S={}){const X=Na(h,U,S.detached,()=>ae()),ae=o.run(()=>un(()=>r.state.value[e],H=>{(S.flush==="sync"?u:c)&&U({storeId:e,type:kr.direct,events:f},H)},rn({},l,S)));return X},$dispose:y},C=Yr(k);r._s.set(e,C);const N=(r._a&&r._a.runWithContext||op)(()=>r._e.run(()=>(o=Wl()).run(()=>t({action:w}))));for(const U in N){const S=N[U];if(Ce(S)&&!cp(S)||Gt(S))i||(p&&lp(S)&&(Ce(S)?S.value=p[U]:zi(S,p[U])),r.state.value[e][U]=S);else if(typeof S=="function"){const X=w(S,U);N[U]=X,a.actions[U]=S}}return rn(C,N),rn(ge(C),N),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:U=>{E(S=>{rn(S,U)})}}),r._p.forEach(U=>{rn(C,o.run(()=>U({store:C,app:r._a,pinia:r,options:a})))}),p&&i&&n.hydrate&&n.hydrate(C.$state,p),c=!0,u=!0,C}/*! #__NO_SIDE_EFFECTS__ */function tu(e,t,n){let r,s;const i=typeof t=="function";typeof e=="string"?(r=e,s=i?n:t):(s=e,r=e.id);function o(a,l){const c=ud();return a=a||(c?pt(Xc,null):null),a&&ri(a),a=Zc,a._s.has(r)||(i?eu(r,t,s,a):up(r,s,a)),a._s.get(r)}return o.$id=r,o}/*!
23
- * vue-router v4.6.4
24
- * (c) 2025 Eduardo San Martin Morote
25
- * @license MIT
26
- */const Hn=typeof document<"u";function nu(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function hp(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&nu(e.default)}const _e=Object.assign;function ki(e,t){const n={};for(const r in t){const s=t[r];n[r]=St(s)?s.map(e):e(s)}return n}const Ar=()=>{},St=Array.isArray;function Pa(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const ru=/#/g,dp=/&/g,fp=/\//g,pp=/=/g,gp=/\?/g,su=/\+/g,mp=/%5B/g,bp=/%5D/g,iu=/%5E/g,yp=/%60/g,ou=/%7B/g,vp=/%7C/g,au=/%7D/g,_p=/%20/g;function Co(e){return e==null?"":encodeURI(""+e).replace(vp,"|").replace(mp,"[").replace(bp,"]")}function wp(e){return Co(e).replace(ou,"{").replace(au,"}").replace(iu,"^")}function Ji(e){return Co(e).replace(su,"%2B").replace(_p,"+").replace(ru,"%23").replace(dp,"%26").replace(yp,"`").replace(ou,"{").replace(au,"}").replace(iu,"^")}function Ep(e){return Ji(e).replace(pp,"%3D")}function Sp(e){return Co(e).replace(ru,"%23").replace(gp,"%3F")}function kp(e){return Sp(e).replace(fp,"%2F")}function Dr(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Ap=/\/$/,Tp=e=>e.replace(Ap,"");function Ai(e,t,n="/"){let r,s={},i="",o="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),i=t.slice(l,a>0?a:t.length),s=e(i.slice(1))),a>=0&&(r=r||t.slice(0,a),o=t.slice(a,t.length)),r=Cp(r??t,n),{fullPath:r+i+o,path:r,query:s,hash:Dr(o)}}function xp(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function La(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Rp(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&rr(t.matched[r],n.matched[s])&&lu(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function rr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function lu(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Op(e[n],t[n]))return!1;return!0}function Op(e,t){return St(e)?$a(e,t):St(t)?$a(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function $a(e,t){return St(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Cp(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let i=n.length-1,o,a;for(o=0;o<r.length;o++)if(a=r[o],a!==".")if(a==="..")i>1&&i--;else break;return n.slice(0,i).join("/")+"/"+r.slice(o).join("/")}const tn={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Yi=function(e){return e.pop="pop",e.push="push",e}({}),Ti=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function Np(e){if(!e)if(Hn){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Tp(e)}const Ip=/^[^#]+#/;function Pp(e,t){return e.replace(Ip,"#")+t}function Lp(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const si=()=>({left:window.scrollX,top:window.scrollY});function $p(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=Lp(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Ma(e,t){return(history.state?history.state.position-t:-1)+e}const Zi=new Map;function Mp(e,t){Zi.set(e,t)}function jp(e){const t=Zi.get(e);return Zi.delete(e),t}function Dp(e){return typeof e=="string"||e&&typeof e=="object"}function cu(e){return typeof e=="string"||typeof e=="symbol"}let Re=function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e}({});const uu=Symbol("");Re.MATCHER_NOT_FOUND+"",Re.NAVIGATION_GUARD_REDIRECT+"",Re.NAVIGATION_ABORTED+"",Re.NAVIGATION_CANCELLED+"",Re.NAVIGATION_DUPLICATED+"";function sr(e,t){return _e(new Error,{type:e,[uu]:!0},t)}function Ut(e,t){return e instanceof Error&&uu in e&&(t==null||!!(e.type&t))}const Up=["params","query","hash"];function Bp(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Up)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Hp(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(su," "),i=s.indexOf("="),o=Dr(i<0?s:s.slice(0,i)),a=i<0?null:Dr(s.slice(i+1));if(o in t){let l=t[o];St(l)||(l=t[o]=[l]),l.push(a)}else t[o]=a}return t}function ja(e){let t="";for(let n in e){const r=e[n];if(n=Ep(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(St(r)?r.map(s=>s&&Ji(s)):[r&&Ji(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Fp(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=St(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const qp=Symbol(""),Da=Symbol(""),ii=Symbol(""),No=Symbol(""),Xi=Symbol("");function ur(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function on(e,t,n,r,s,i=o=>o()){const o=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(sr(Re.NAVIGATION_ABORTED,{from:n,to:t})):d instanceof Error?l(d):Dp(d)?l(sr(Re.NAVIGATION_GUARD_REDIRECT,{from:t,to:d})):(o&&r.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>e.call(r&&r.instances[s],t,n,c));let h=Promise.resolve(u);e.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function xi(e,t,n,r,s=i=>i()){const i=[];for(const o of e)for(const a in o.components){let l=o.components[a];if(!(t!=="beforeRouteEnter"&&!o.instances[a]))if(nu(l)){const c=(l.__vccOpts||l)[t];c&&i.push(on(c,n,r,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=hp(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[t];return d&&on(d,n,r,o,a,s)()}))}}return i}function Kp(e,t){const n=[],r=[],s=[],i=Math.max(t.matched.length,e.matched.length);for(let o=0;o<i;o++){const a=t.matched[o];a&&(e.matched.find(c=>rr(c,a))?r.push(a):n.push(a));const l=e.matched[o];l&&(t.matched.find(c=>rr(c,l))||s.push(l))}return[n,r,s]}/*!
27
- * vue-router v4.6.4
28
- * (c) 2025 Eduardo San Martin Morote
29
- * @license MIT
30
- */let Wp=()=>location.protocol+"//"+location.host;function hu(e,t){const{pathname:n,search:r,hash:s}=t,i=e.indexOf("#");if(i>-1){let o=s.includes(e.slice(i))?e.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),La(a,"")}return La(n,e)+r+s}function Vp(e,t,n,r){let s=[],i=[],o=null;const a=({state:d})=>{const f=hu(e,location),p=n.value,m=t.value;let E=0;if(d){if(n.value=f,t.value=d,o&&o===p){o=null;return}E=m?d.position-m.position:0}else r(f);s.forEach(v=>{v(n.value,p,{delta:E,type:Yi.pop,direction:E?E>0?Ti.forward:Ti.back:Ti.unknown})})};function l(){o=n.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(_e({},d.state,{scroll:si()}),"")}}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 Ua(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?si():null}}function Gp(e){const{history:t,location:n}=window,r={value:hu(e,n)},s={value:t.state};s.value||i(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=e.indexOf("#"),d=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Wp()+e+l;try{t[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),n[u?"replace":"assign"](d)}}function o(l,c){i(l,_e({},t.state,Ua(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),r.value=l}function a(l,c){const u=_e({},s.value,t.state,{forward:l,scroll:si()});i(u.current,u,!0),i(l,_e({},Ua(r.value,l,null),{position:u.position+1},c),!1),r.value=l}return{location:r,state:s,push:a,replace:o}}function zp(e){e=Np(e);const t=Gp(e),n=Vp(e,t.state,t.location,t.replace);function r(i,o=!0){o||n.pauseListeners(),history.go(i)}const s=_e({location:"",base:e,go:r,createHref:Pp.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}let Tn=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Me=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e}(Me||{});const Jp={type:Tn.Static,value:""},Yp=/[a-zA-Z0-9_]/;function Zp(e){if(!e)return[[]];if(e==="/")return[[Jp]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(f){throw new Error(`ERR (${n})/"${c}": ${f}`)}let n=Me.Static,r=n;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(n===Me.Static?i.push({type:Tn.Static,value:c}):n===Me.Param||n===Me.ParamRegExp||n===Me.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Tn.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Me.ParamRegExp){r=n,n=Me.EscapeNext;continue}switch(n){case Me.Static:l==="/"?(c&&h(),o()):l===":"?(h(),n=Me.Param):d();break;case Me.EscapeNext:d(),n=r;break;case Me.Param:l==="("?n=Me.ParamRegExp:Yp.test(l)?d():(h(),n=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Me.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Me.ParamRegExpEnd:u+=l;break;case Me.ParamRegExpEnd:h(),n=Me.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Me.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Ba="[^/]+?",Xp={sensitive:!1,strict:!1,start:!0,end:!0};var tt=function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e}(tt||{});const Qp=/[.+*?^${}()[\]/\\]/g;function eg(e,t){const n=_e({},Xp,t),r=[];let s=n.start?"^":"";const i=[];for(const c of e){const u=c.length?[]:[tt.Root];n.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=tt.Segment+(n.sensitive?tt.BonusCaseSensitive:0);if(d.type===Tn.Static)h||(s+="/"),s+=d.value.replace(Qp,"\\$&"),f+=tt.Static;else if(d.type===Tn.Param){const{value:p,repeatable:m,optional:E,regexp:v}=d;i.push({name:p,repeatable:m,optional:E});const y=v||Ba;if(y!==Ba){f+=tt.BonusCustomRegExp;try{`${y}`}catch(k){throw new Error(`Invalid custom RegExp for param "${p}" (${y}): `+k.message)}}let w=m?`((?:${y})(?:/(?:${y}))*)`:`(${y})`;h||(w=E&&c.length<2?`(?:/${w})`:"/"+w),E&&(w+="?"),s+=w,f+=tt.Dynamic,E&&(f+=tt.BonusOptional),m&&(f+=tt.BonusRepeatable),y===".*"&&(f+=tt.BonusWildcard)}u.push(f)}r.push(u)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=tt.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,n.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 e){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Tn.Static)u+=f.value;else if(f.type===Tn.Param){const{value:p,repeatable:m,optional:E}=f,v=p in c?c[p]:"";if(St(v)&&!m)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const y=St(v)?v.join("/"):v;if(!y)if(E)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=y}}return u||"/"}return{re:o,score:r,keys:i,parse:a,stringify:l}}function tg(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===tt.Static+tt.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===tt.Static+tt.Segment?1:-1:0}function du(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const i=tg(r[n],s[n]);if(i)return i;n++}if(Math.abs(s.length-r.length)===1){if(Ha(r))return 1;if(Ha(s))return-1}return s.length-r.length}function Ha(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const ng={strict:!1,end:!0,sensitive:!1};function rg(e,t,n){const r=eg(Zp(e.path),n),s=_e(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function sg(e,t){const n=[],r=new Map;t=Pa(ng,t);function s(h){return r.get(h)}function i(h,d,f){const p=!f,m=qa(h);m.aliasOf=f&&f.record;const E=Pa(t,h),v=[m];if("alias"in h){const k=typeof h.alias=="string"?[h.alias]:h.alias;for(const C of k)v.push(qa(_e({},m,{components:f?f.record.components:m.components,path:C,aliasOf:f?f.record:m})))}let y,w;for(const k of v){const{path:C}=k;if(d&&C[0]!=="/"){const $=d.record.path,N=$[$.length-1]==="/"?"":"/";k.path=d.record.path+(C&&N+C)}if(y=rg(k,d,E),f?f.alias.push(y):(w=w||y,w!==y&&w.alias.push(y),p&&h.name&&!Ka(y)&&o(h.name)),fu(y)&&l(y),m.children){const $=m.children;for(let N=0;N<$.length;N++)i($[N],y,f&&f.children[N])}f=f||y}return w?()=>{o(w)}:Ar}function o(h){if(cu(h)){const d=r.get(h);d&&(r.delete(h),n.splice(n.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=n.indexOf(h);d>-1&&(n.splice(d,1),h.record.name&&r.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return n}function l(h){const d=ag(h,n);n.splice(d,0,h),h.record.name&&!Ka(h)&&r.set(h.record.name,h)}function c(h,d){let f,p={},m,E;if("name"in h&&h.name){if(f=r.get(h.name),!f)throw sr(Re.MATCHER_NOT_FOUND,{location:h});E=f.record.name,p=_e(Fa(d.params,f.keys.filter(w=>!w.optional).concat(f.parent?f.parent.keys.filter(w=>w.optional):[]).map(w=>w.name)),h.params&&Fa(h.params,f.keys.map(w=>w.name))),m=f.stringify(p)}else if(h.path!=null)m=h.path,f=n.find(w=>w.re.test(m)),f&&(p=f.parse(m),E=f.record.name);else{if(f=d.name?r.get(d.name):n.find(w=>w.re.test(d.path)),!f)throw sr(Re.MATCHER_NOT_FOUND,{location:h,currentLocation:d});E=f.record.name,p=_e({},d.params,h.params),m=f.stringify(p)}const v=[];let y=f;for(;y;)v.unshift(y.record),y=y.parent;return{name:E,path:m,params:p,matched:v,meta:og(v)}}e.forEach(h=>i(h));function u(){n.length=0,r.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Fa(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function qa(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:ig(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function ig(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Ka(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function og(e){return e.reduce((t,n)=>_e(t,n.meta),{})}function ag(e,t){let n=0,r=t.length;for(;n!==r;){const i=n+r>>1;du(e,t[i])<0?r=i:n=i+1}const s=lg(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function lg(e){let t=e;for(;t=t.parent;)if(fu(t)&&du(e,t)===0)return t}function fu({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wa(e){const t=pt(ii),n=pt(No),r=qe(()=>{const l=ze(e.to);return t.resolve(l)}),s=qe(()=>{const{matched:l}=r.value,{length:c}=l,u=l[c-1],h=n.matched;if(!u||!h.length)return-1;const d=h.findIndex(rr.bind(null,u));if(d>-1)return d;const f=Va(l[c-2]);return c>1&&Va(u)===f&&h[h.length-1].path!==f?h.findIndex(rr.bind(null,l[c-2])):d}),i=qe(()=>s.value>-1&&dg(n.params,r.value.params)),o=qe(()=>s.value>-1&&s.value===n.matched.length-1&&lu(n.params,r.value.params));function a(l={}){if(hg(l)){const c=t[ze(e.replace)?"replace":"push"](ze(e.to)).catch(Ar);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:qe(()=>r.value.href),isActive:i,isExactActive:o,navigate:a}}function cg(e){return e.length===1?e[0]:e}const ug=fn({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:Wa,setup(e,{slots:t}){const n=Yr(Wa(e)),{options:r}=pt(ii),s=qe(()=>({[Ga(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ga(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&cg(t.default(n));return e.custom?i:Oo("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},i)}}}),Tr=ug;function hg(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function dg(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!St(s)||s.length!==r.length||r.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Va(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ga=(e,t,n)=>e??t??n,fg=fn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=pt(Xi),s=qe(()=>e.route||r.value),i=pt(Da,0),o=qe(()=>{let c=ze(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=qe(()=>s.value.matched[o.value]);ys(Da,qe(()=>o.value+1)),ys(qp,a),ys(Xi,s);const l=ve();return un(()=>[l.value,a.value,e.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||!rr(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(m=>m(c))},{flush:"post"}),()=>{const c=s.value,u=e.name,h=a.value,d=h&&h.components[u];if(!d)return za(n.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,E=Oo(d,_e({},p,t,{onVnodeUnmounted:v=>{v.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return za(n.default,{Component:E,route:c})||E}}});function za(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Qi=fg;function pg(e){const t=sg(e.routes,e),n=e.parseQuery||Hp,r=e.stringifyQuery||ja,s=e.history,i=ur(),o=ur(),a=ur(),l=Yh(tn);let c=tn;Hn&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ki.bind(null,I=>""+I),h=ki.bind(null,kp),d=ki.bind(null,Dr);function f(I,J){let z,ee;return cu(I)?(z=t.getRecordMatcher(I),ee=J):ee=I,t.addRoute(ee,z)}function p(I){const J=t.getRecordMatcher(I);J&&t.removeRoute(J)}function m(){return t.getRoutes().map(I=>I.record)}function E(I){return!!t.getRecordMatcher(I)}function v(I,J){if(J=_e({},J||l.value),typeof I=="string"){const _=Ai(n,I,J.path),A=t.resolve({path:_.path},J),L=s.createHref(_.fullPath);return _e(_,A,{params:d(A.params),hash:Dr(_.hash),redirectedFrom:void 0,href:L})}let z;if(I.path!=null)z=_e({},I,{path:Ai(n,I.path,J.path).path});else{const _=_e({},I.params);for(const A in _)_[A]==null&&delete _[A];z=_e({},I,{params:h(_)}),J.params=h(J.params)}const ee=t.resolve(z,J),fe=I.hash||"";ee.params=u(d(ee.params));const g=xp(r,_e({},I,{hash:wp(fe),path:ee.path})),b=s.createHref(g);return _e({fullPath:g,hash:fe,query:r===ja?Fp(I.query):I.query||{}},ee,{redirectedFrom:void 0,href:b})}function y(I){return typeof I=="string"?Ai(n,I,l.value.path):_e({},I)}function w(I,J){if(c!==I)return sr(Re.NAVIGATION_CANCELLED,{from:J,to:I})}function k(I){return N(I)}function C(I){return k(_e(y(I),{replace:!0}))}function $(I,J){const z=I.matched[I.matched.length-1];if(z&&z.redirect){const{redirect:ee}=z;let fe=typeof ee=="function"?ee(I,J):ee;return typeof fe=="string"&&(fe=fe.includes("?")||fe.includes("#")?fe=y(fe):{path:fe},fe.params={}),_e({query:I.query,hash:I.hash,params:fe.path!=null?{}:I.params},fe)}}function N(I,J){const z=c=v(I),ee=l.value,fe=I.state,g=I.force,b=I.replace===!0,_=$(z,ee);if(_)return N(_e(y(_),{state:typeof _=="object"?_e({},fe,_.state):fe,force:g,replace:b}),J||z);const A=z;A.redirectedFrom=J;let L;return!g&&Rp(r,ee,z)&&(L=sr(Re.NAVIGATION_DUPLICATED,{to:A,from:ee}),be(ee,ee,!0,!1)),(L?Promise.resolve(L):X(A,ee)).catch(R=>Ut(R)?Ut(R,Re.NAVIGATION_GUARD_REDIRECT)?R:he(R):B(R,A,ee)).then(R=>{if(R){if(Ut(R,Re.NAVIGATION_GUARD_REDIRECT))return N(_e({replace:b},y(R.to),{state:typeof R.to=="object"?_e({},fe,R.to.state):fe,force:g}),J||A)}else R=H(A,ee,!0,b,fe);return ae(A,ee,R),R})}function U(I,J){const z=w(I,J);return z?Promise.reject(z):Promise.resolve()}function S(I){const J=Ie.values().next().value;return J&&typeof J.runWithContext=="function"?J.runWithContext(I):I()}function X(I,J){let z;const[ee,fe,g]=Kp(I,J);z=xi(ee.reverse(),"beforeRouteLeave",I,J);for(const _ of ee)_.leaveGuards.forEach(A=>{z.push(on(A,I,J))});const b=U.bind(null,I,J);return z.push(b),Xe(z).then(()=>{z=[];for(const _ of i.list())z.push(on(_,I,J));return z.push(b),Xe(z)}).then(()=>{z=xi(fe,"beforeRouteUpdate",I,J);for(const _ of fe)_.updateGuards.forEach(A=>{z.push(on(A,I,J))});return z.push(b),Xe(z)}).then(()=>{z=[];for(const _ of g)if(_.beforeEnter)if(St(_.beforeEnter))for(const A of _.beforeEnter)z.push(on(A,I,J));else z.push(on(_.beforeEnter,I,J));return z.push(b),Xe(z)}).then(()=>(I.matched.forEach(_=>_.enterCallbacks={}),z=xi(g,"beforeRouteEnter",I,J,S),z.push(b),Xe(z))).then(()=>{z=[];for(const _ of o.list())z.push(on(_,I,J));return z.push(b),Xe(z)}).catch(_=>Ut(_,Re.NAVIGATION_CANCELLED)?_:Promise.reject(_))}function ae(I,J,z){a.list().forEach(ee=>S(()=>ee(I,J,z)))}function H(I,J,z,ee,fe){const g=w(I,J);if(g)return g;const b=J===tn,_=Hn?history.state:{};z&&(ee||b?s.replace(I.fullPath,_e({scroll:b&&_&&_.scroll},fe)):s.push(I.fullPath,fe)),l.value=I,be(I,J,z,b),he()}let ue;function me(){ue||(ue=s.listen((I,J,z)=>{if(!Be.listening)return;const ee=v(I),fe=$(ee,Be.currentRoute.value);if(fe){N(_e(fe,{replace:!0,force:!0}),ee).catch(Ar);return}c=ee;const g=l.value;Hn&&Mp(Ma(g.fullPath,z.delta),si()),X(ee,g).catch(b=>Ut(b,Re.NAVIGATION_ABORTED|Re.NAVIGATION_CANCELLED)?b:Ut(b,Re.NAVIGATION_GUARD_REDIRECT)?(N(_e(y(b.to),{force:!0}),ee).then(_=>{Ut(_,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&!z.delta&&z.type===Yi.pop&&s.go(-1,!1)}).catch(Ar),Promise.reject()):(z.delta&&s.go(-z.delta,!1),B(b,ee,g))).then(b=>{b=b||H(ee,g,!1),b&&(z.delta&&!Ut(b,Re.NAVIGATION_CANCELLED)?s.go(-z.delta,!1):z.type===Yi.pop&&Ut(b,Re.NAVIGATION_ABORTED|Re.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ae(ee,g,b)}).catch(Ar)}))}let Ne=ur(),x=ur(),j;function B(I,J,z){he(I);const ee=x.list();return ee.length?ee.forEach(fe=>fe(I,J,z)):console.error(I),Promise.reject(I)}function re(){return j&&l.value!==tn?Promise.resolve():new Promise((I,J)=>{Ne.add([I,J])})}function he(I){return j||(j=!I,me(),Ne.list().forEach(([J,z])=>I?z(I):J()),Ne.reset()),I}function be(I,J,z,ee){const{scrollBehavior:fe}=e;if(!Hn||!fe)return Promise.resolve();const g=!z&&jp(Ma(I.fullPath,0))||(ee||!z)&&history.state&&history.state.scroll||null;return tr().then(()=>fe(I,J,g)).then(b=>b&&$p(b)).catch(b=>B(b,I,J))}const ye=I=>s.go(I);let Ke;const Ie=new Set,Be={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:t.clearRoutes,hasRoute:E,getRoutes:m,resolve:v,options:e,push:k,replace:C,go:ye,back:()=>ye(-1),forward:()=>ye(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:x.add,isReady:re,install(I){I.component("RouterLink",Tr),I.component("RouterView",Qi),I.config.globalProperties.$router=Be,Object.defineProperty(I.config.globalProperties,"$route",{enumerable:!0,get:()=>ze(l)}),Hn&&!Ke&&l.value===tn&&(Ke=!0,k(s.location).catch(ee=>{}));const J={};for(const ee in tn)Object.defineProperty(J,ee,{get:()=>l.value[ee],enumerable:!0});I.provide(ii,Be),I.provide(No,ac(J)),I.provide(Xi,l);const z=I.unmount;Ie.add(I),I.unmount=function(){Ie.delete(I),Ie.size<1&&(c=tn,ue&&ue(),ue=null,l.value=tn,Ke=!1,j=!1),z()}}};function Xe(I){return I.reduce((J,z)=>J.then(()=>S(z)),Promise.resolve())}return Be}function gg(){return pt(ii)}function Io(e){return pt(No)}const mg={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},bg={key:4,d:"M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v6A2.5 2.5 0 0 1 16.5 15H10l-4 4v-4.2A2.5 2.5 0 0 1 5 12.5Z"},yg={key:5,d:"M4 12h4l2.2-5 3.6 10 2.2-5H20"},vg={key:8,d:"m6 9 6 6 6-6"},_g={key:9,d:"m6 15 6-6 6 6"},wg={key:10,d:"m9 6 6 6-6 6"},Eg={key:14,d:"M13 2 5 13h5l-1 9 8-11h-5Z"},Sg={key:18,cx:"12",cy:"12",r:"4.25",fill:"currentColor",stroke:"none"},kg={key:22,cx:"12",cy:"12",r:"8","stroke-dasharray":"2 2"},De=fn({__name:"AppIcon",props:{name:{}},setup(e){return(t,n)=>(K(),G("svg",mg,[e.name==="grid"?(K(),G(de,{key:0},[n[0]||(n[0]=P("rect",{x:"4",y:"4",width:"6",height:"6",rx:"1.5"},null,-1)),n[1]||(n[1]=P("rect",{x:"14",y:"4",width:"6",height:"6",rx:"1.5"},null,-1)),n[2]||(n[2]=P("rect",{x:"4",y:"14",width:"6",height:"6",rx:"1.5"},null,-1)),n[3]||(n[3]=P("rect",{x:"14",y:"14",width:"6",height:"6",rx:"1.5"},null,-1))],64)):e.name==="book"?(K(),G(de,{key:1},[n[4]||(n[4]=P("path",{d:"M5 5.5a2.5 2.5 0 0 1 2.5-2.5H20v17H7.5A2.5 2.5 0 0 0 5 22Z"},null,-1)),n[5]||(n[5]=P("path",{d:"M5 5.5V22"},null,-1)),n[6]||(n[6]=P("path",{d:"M9 7h7"},null,-1))],64)):e.name==="settings"?(K(),G(de,{key:2},[n[7]||(n[7]=P("circle",{cx:"12",cy:"12",r:"3.25"},null,-1)),n[8]||(n[8]=P("path",{d:"M19.4 15a1 1 0 0 0 .2 1.1l.1.1a1.9 1.9 0 0 1 0 2.7 1.9 1.9 0 0 1-2.7 0l-.1-.1a1 1 0 0 0-1.1-.2 1 1 0 0 0-.6.9V20a2 2 0 0 1-4 0v-.2a1 1 0 0 0-.6-.9 1 1 0 0 0-1.1.2l-.1.1a1.9 1.9 0 0 1-2.7 0 1.9 1.9 0 0 1 0-2.7l.1-.1a1 1 0 0 0 .2-1.1 1 1 0 0 0-.9-.6H4a2 2 0 0 1 0-4h.2a1 1 0 0 0 .9-.6 1 1 0 0 0-.2-1.1l-.1-.1a1.9 1.9 0 0 1 0-2.7 1.9 1.9 0 0 1 2.7 0l.1.1a1 1 0 0 0 1.1.2 1 1 0 0 0 .6-.9V4a2 2 0 0 1 4 0v.2a1 1 0 0 0 .6.9 1 1 0 0 0 1.1-.2l.1-.1a1.9 1.9 0 0 1 2.7 0 1.9 1.9 0 0 1 0 2.7l-.1.1a1 1 0 0 0-.2 1.1 1 1 0 0 0 .9.6H20a2 2 0 0 1 0 4h-.2a1 1 0 0 0-.9.6Z"},null,-1))],64)):e.name==="terminal"?(K(),G(de,{key:3},[n[9]||(n[9]=P("path",{d:"M4 6h16v12H4z",rx:"2"},null,-1)),n[10]||(n[10]=P("path",{d:"m8 10 2 2-2 2"},null,-1)),n[11]||(n[11]=P("path",{d:"M12.5 16H16"},null,-1))],64)):e.name==="message"?(K(),G("path",bg)):e.name==="activity"?(K(),G("path",yg)):e.name==="sparkles"?(K(),G(de,{key:6},[n[12]||(n[12]=P("path",{d:"m12 3 1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5Z"},null,-1)),n[13]||(n[13]=P("path",{d:"m19 14 .7 2.1L22 16.8l-2.3.7L19 20l-.7-2.5-2.3-.7 2.3-.7Z"},null,-1)),n[14]||(n[14]=P("path",{d:"m5 15 .8 2.3L8 18l-2.2.7L5 21l-.8-2.3L2 18l2.2-.7Z"},null,-1))],64)):e.name==="git-branch"?(K(),G(de,{key:7},[n[15]||(n[15]=P("path",{d:"M6 4v9a3 3 0 1 0 2 2.8V8h8"},null,-1)),n[16]||(n[16]=P("path",{d:"M16 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"},null,-1)),n[17]||(n[17]=P("path",{d:"M8 16a3 3 0 1 0-4 2.8"},null,-1))],64)):e.name==="chevron-down"?(K(),G("path",vg)):e.name==="chevron-up"?(K(),G("path",_g)):e.name==="chevron-right"?(K(),G("path",wg)):e.name==="plus"?(K(),G(de,{key:11},[n[18]||(n[18]=P("path",{d:"M12 5v14"},null,-1)),n[19]||(n[19]=P("path",{d:"M5 12h14"},null,-1))],64)):e.name==="trash"?(K(),G(de,{key:12},[n[20]||(n[20]=uf('<path d="M4 7h16"></path><path d="M10 11v6"></path><path d="M14 11v6"></path><path d="M6 7l1 12h10l1-12"></path><path d="M9 7V4h6v3"></path>',5))],64)):e.name==="x"?(K(),G(de,{key:13},[n[21]||(n[21]=P("path",{d:"M6 6l12 12"},null,-1)),n[22]||(n[22]=P("path",{d:"M18 6 6 18"},null,-1))],64)):e.name==="zap"?(K(),G("path",Eg)):e.name==="calendar"?(K(),G(de,{key:15},[n[23]||(n[23]=P("rect",{x:"3.5",y:"5",width:"17",height:"15.5",rx:"2"},null,-1)),n[24]||(n[24]=P("path",{d:"M7 3v4"},null,-1)),n[25]||(n[25]=P("path",{d:"M17 3v4"},null,-1)),n[26]||(n[26]=P("path",{d:"M3.5 9.5h17"},null,-1))],64)):e.name==="inbox"?(K(),G(de,{key:16},[n[27]||(n[27]=P("path",{d:"M4 6h16l-2 10H6Z"},null,-1)),n[28]||(n[28]=P("path",{d:"M8 12h8"},null,-1)),n[29]||(n[29]=P("path",{d:"M7 16h10"},null,-1))],64)):e.name==="server"?(K(),G(de,{key:17},[n[30]||(n[30]=P("rect",{x:"4",y:"4",width:"16",height:"6",rx:"1.5"},null,-1)),n[31]||(n[31]=P("rect",{x:"4",y:"14",width:"16",height:"6",rx:"1.5"},null,-1)),n[32]||(n[32]=P("path",{d:"M8 7h.01"},null,-1)),n[33]||(n[33]=P("path",{d:"M8 17h.01"},null,-1))],64)):e.name==="circle"?(K(),G("circle",Sg)):e.name==="log-out"?(K(),G(de,{key:19},[n[34]||(n[34]=P("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},null,-1)),n[35]||(n[35]=P("polyline",{points:"16 17 21 12 16 7"},null,-1)),n[36]||(n[36]=P("line",{x1:"21",y1:"12",x2:"9",y2:"12"},null,-1))],64)):e.name==="pencil"?(K(),G(de,{key:20},[n[37]||(n[37]=P("path",{d:"M17 3a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"},null,-1)),n[38]||(n[38]=P("path",{d:"m15 5 4 4"},null,-1))],64)):e.name==="alert-circle"?(K(),G(de,{key:21},[n[39]||(n[39]=P("circle",{cx:"12",cy:"12",r:"10"},null,-1)),n[40]||(n[40]=P("line",{x1:"12",y1:"8",x2:"12",y2:"12"},null,-1)),n[41]||(n[41]=P("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"},null,-1))],64)):(K(),G("circle",kg))]))}});function oi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function Ag(e,t,n,r){function s(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{c(r.next(u))}catch(h){o(h)}}function l(u){try{c(r.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((r=r.apply(e,t||[])).next())})}const Tg=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Po extends Error{constructor(t,n="FunctionsError",r){super(t),this.name=n,this.context=r}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class xg extends Po{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Ja extends Po{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Ya extends Po{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var eo;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(eo||(eo={}));class Rg{constructor(t,{headers:n={},customFetch:r,region:s=eo.Any}={}){this.url=t,this.headers=n,this.region=s,this.fetch=Tg(r)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Ag(this,arguments,void 0,function*(n,r={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=r;let d={},{region:f}=r;f||(f=this.region);const p=new URL(`${this.url}/${n}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let m;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",m=c):typeof c=="string"?(d["Content-Type"]="text/plain",m=c):typeof FormData<"u"&&c instanceof FormData?m=c:(d["Content-Type"]="application/json",m=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?m=JSON.stringify(c):m=c;let E=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(E=o.signal,u.addEventListener("abort",()=>o.abort())):E=o.signal);const v=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:m,signal:E}).catch(C=>{throw new xg(C)}),y=v.headers.get("x-relay-error");if(y&&y==="true")throw new Ja(v);if(!v.ok)throw new Ya(v);let w=((s=v.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),k;return w==="application/json"?k=yield v.json():w==="application/octet-stream"||w==="application/pdf"?k=yield v.blob():w==="text/event-stream"?k=v:w==="multipart/form-data"?k=yield v.formData():k=yield v.text(),{data:k,error:null,response:v}}catch(a){return{data:null,error:a,response:a instanceof Ya||a instanceof Ja?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const pu=3,Za=e=>Math.min(1e3*2**e,3e4),Og=[520,503],gu=["GET","HEAD","OPTIONS"];var Cg=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Xa(e,t){return new Promise(n=>{if(t!=null&&t.aborted){n();return}const r=setTimeout(()=>{t==null||t.removeEventListener("abort",s),n()},e);function s(){clearTimeout(r),n()}t==null||t.addEventListener("abort",s)})}function Ng(e,t,n,r){return!(!r||n>=pu||!gu.includes(e)||!Og.includes(t))}var Ig=class{constructor(e){var t,n,r,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(r=e.shouldStripNulls)!==null&&r!==void 0?r:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=e.retry)!==null&&i!==void 0?i:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const r=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(n.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await r(n.url.toString(),{method:n.method,headers:c,body:JSON.stringify(n.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:n.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!gu.includes(n.method))throw h;if(n.retryEnabled&&o<pu){const d=Za(o);o++,await Xa(d,n.signal);continue}throw h}if(Ng(n.method,u.status,o,n.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:Za(o);await u.text(),o++,await Xa(d,n.signal);continue}return await n.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,m;const y=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",w=(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+=`
31
-
32
- Caused by: ${(m=h==null?void 0:h.name)!==null&&m!==void 0?m:"Error"}: ${y}`,w&&(l+=` (${w})`),h!=null&&h.stack&&(l+=`
33
- ${h.stack}`)}else{var E;l=(E=o==null?void 0:o.stack)!==null&&E!==void 0?E:""}const v=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)",v>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${v} 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)",v>this.urlLengthLimit&&(c+=`. Your request URL is ${v} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(e,t)}async processResponse(e){var t=this;let n=null,r=null,s=null,i=e.status,o=e.statusText;if(e.ok){var a,l;if(t.method!=="HEAD"){var c;const d=await e.text();d===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((c=t.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?r=d:r=JSON.parse(d))}const u=(a=t.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=e.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(r)&&(r.length>1?(n={code:"PGRST116",details:`Results contain ${r.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,s=null,i=406,o="Not Acceptable"):r.length===1?r=r[0]:r=null)}else{const u=await e.text();try{n=JSON.parse(u),Array.isArray(n)&&e.status===404&&(r=[],n=null,i=200,o="OK")}catch{e.status===404&&u===""?(i=204,o="No Content"):n={message:u}}if(n&&t.shouldThrowOnError)throw new Cg(n)}return{success:n===null,error:n,data:r,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Pg=class extends Ig{select(e){let t=!1;const n=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:r,referencedTable:s=r}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:r=n}={}){const s=typeof r>"u"?"offset":`${r}.offset`,i=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:r=!1,wal:s=!1,format:i="text"}={}){var o;const a=[e?"analyze":null,t?"verbose":null,n?"settings":null,r?"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(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const Qa=new RegExp("[,()]");var Fn=class extends Pg{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Qa.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(r=>typeof r=="string"&&Qa.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:r}={}){let s="";r==="plain"?s="pl":r==="phrase"?s="ph":r==="websearch"&&(s="w");const i=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},Lg=class{constructor(e,{headers:t={},schema:n,fetch:r,urlLengthLimit:s=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=r,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:r}=t??{},s=n?"HEAD":"GET";let i=!1;const o=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),r&&l.append("Prefer",`count=${r}`),new Fn({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var r;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const a=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Fn({method:s,url:i,headers:o,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:r,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&a.searchParams.set("on_conflict",t),r&&l.append("Prefer",`count=${r}`),s||l.append("Prefer","missing=default"),Array.isArray(e)){const c=e.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 Fn({method:o,url:a,headers:l,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const r="PATCH",{url:s,headers:i}=this.cloneRequestState();return t&&i.append("Prefer",`count=${t}`),new Fn({method:r,url:s,headers:i,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new Fn({method:n,url:r,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Ur(e){"@babel/helpers - typeof";return Ur=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(e)}function $g(e,t){if(Ur(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ur(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mg(e){var t=$g(e,"string");return Ur(t)=="symbol"?t:t+""}function jg(e,t,n){return(t=Mg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function os(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){jg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dg=class mu{constructor(t,{headers:n={},schema:r,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=t,this.headers=new Headers(n),this.schemaName=r,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const p=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",p,{once:!0}),l(c,os(os({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,os(os({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Lg(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new mu(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:r=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${t}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=r&&Object.values(n).some(u);h?(a="POST",c=n):r||s?(a=r?"HEAD":"GET",Object.entries(n).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=n);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 Fn({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 Ug{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const r=typeof global<"u"?global:void 0;if(r&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};if(typeof globalThis<"u"&&typeof n.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&n.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const 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:
34
- import ws from "ws"
35
- new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
36
-
37
- Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Bg="2.105.4",Hg=`realtime-js/${Bg}`,Fg="1.0.0",bu="2.0.0",qg=bu,Kg=1e4,Wg=100,an={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},yu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},to={connecting:"connecting",closing:"closing",closed:"closed"};class Vg{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var n,r;const s=(r=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,n,r){var s,i;const o=t.topic,a=(s=t.ref)!==null&&s!==void 0?s:"",l=(i=t.join_ref)!==null&&i!==void 0?i:"",c=t.payload.event,u=this.allowedMetadataKeys?this._pick(t.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),m=0;p.setUint8(m++,this.KINDS.userBroadcastPush),p.setUint8(m++,l.length),p.setUint8(m++,a.length),p.setUint8(m++,o.length),p.setUint8(m++,c.length),p.setUint8(m++,h.length),p.setUint8(m++,n),Array.from(l,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(a,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(o,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(c,v=>p.setUint8(m++,v.charCodeAt(0))),Array.from(h,v=>p.setUint8(m++,v.charCodeAt(0)));var E=new Uint8Array(f.byteLength+r.byteLength);return E.set(new Uint8Array(f),0),E.set(new Uint8Array(r),f.byteLength),E.buffer}decode(t,n){if(this._isArrayBuffer(t)){let r=this._binaryDecode(t);return n(r)}if(typeof t=="string"){const r=JSON.parse(t),[s,i,o,a,l]=r;return n({join_ref:s,ref:i,topic:o,event:a,payload:l})}return n({})}_binaryDecode(t){const n=new DataView(t),r=n.getUint8(0),s=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,n,s)}}_decodeUserBroadcast(t,n,r){const s=n.getUint8(1),i=n.getUint8(2),o=n.getUint8(3),a=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(t.slice(l,l+s));l=l+s;const u=r.decode(t.slice(l,l+i));l=l+i;const h=r.decode(t.slice(l,l+o));l=l+o;const d=t.slice(l,t.byteLength),f=a===this.JSON_ENCODING?JSON.parse(r.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(t){var n;return t instanceof ArrayBuffer||((n=t==null?void 0:t.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([r])=>n.includes(r)))}}var ke;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(ke||(ke={}));const tl=(e,t,n={})=>{var r;const s=(r=n.skipTypes)!==null&&r!==void 0?r:[];return t?Object.keys(t).reduce((i,o)=>(i[o]=Gg(o,e,t,s),i),{}):{}},Gg=(e,t,n,r)=>{const s=t.find(a=>a.name===e),i=s==null?void 0:s.type,o=n[e];return i&&!r.includes(i)?vu(i,o):no(o)},vu=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Zg(t,n)}switch(e){case ke.bool:return zg(t);case ke.float4:case ke.float8:case ke.int2:case ke.int4:case ke.int8:case ke.numeric:case ke.oid:return Jg(t);case ke.json:case ke.jsonb:return Yg(t);case ke.timestamp:return Xg(t);case ke.abstime:case ke.date:case ke.daterange:case ke.int4range:case ke.int8range:case ke.money:case ke.reltime:case ke.text:case ke.time:case ke.timestamptz:case ke.timetz:case ke.tsrange:case ke.tstzrange:return no(t);default:return no(t)}},no=e=>e,zg=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Jg=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Yg=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},Zg=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,r=e[n];if(e[0]==="{"&&r==="}"){let i;const o=e.slice(1,n);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>vu(t,a))}return e},Xg=e=>typeof e=="string"?e.replace(" ","T"):e,_u=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var xr=e=>typeof e=="function"?e:function(){return e},Qg=typeof self<"u"?self:null,qn=typeof window<"u"?window:null,Ct=Qg||qn||globalThis,em="2.0.0",tm=1e4,nm=1e3,Pt={connecting:0,open:1,closing:2,closed:3},st={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Ft={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ro={longpoll:"longpoll",websocket:"websocket"},rm={complete:4},so="base64url.bearer.phx.",as=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},wu=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},sm=class{constructor(e,t,n){this.state=st.closed,this.topic=e,this.params=xr(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new as(this,Ft.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new wu(()=>{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=st.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this.joinPush.receive("error",r=>{this.state=st.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=st.closed,this.socket.remove(this)}),this.onError(r=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,r),this.isJoining()&&this.joinPush.reset(),this.state=st.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new as(this,Ft.leave,xr({}),this.timeout).send(),this.state=st.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Ft.reply,(r,s)=>{this.trigger(this.replyEventName(s),r)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=st.closed,this.bindings=[]}onClose(e){this.on(Ft.close,e)}onError(e){return this.on(Ft.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new as(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=st.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Ft.close,"leave")},n=new as(this,Ft.leave,xr({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,r){return this.topic!==e?!1:r&&r!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=st.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,n));for(let o=0;o<i.length;o++)i[o].callback(s,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===st.closed}isErrored(){return this.state===st.errored}isJoined(){return this.state===st.joined}isJoining(){return this.state===st.joining}isLeaving(){return this.state===st.leaving}},Is=class{static request(e,t,n,r,s,i,o){if(Ct.XDomainRequest){let a=new Ct.XDomainRequest;return this.xdomainRequest(a,e,t,r,s,i,o)}else if(Ct.XMLHttpRequest){let a=new Ct.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,i,o)}else{if(Ct.fetch&&Ct.AbortController)return this.fetchRequest(e,t,n,r,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,r,s,i,o){let a={method:e,headers:n,body:r},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),Ct.fetch(t,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(e,t,n,r,s,i,o){return e.timeout=s,e.open(t,n),e.onload=()=>{let a=this.parseJSON(e.responseText);o&&o(a)},i&&(e.ontimeout=i),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,i,o,a){e.open(t,n,!0),e.timeout=i;for(let[l,c]of Object.entries(r))e.setRequestHeader(l,c);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===rm.complete&&a){let l=this.parseJSON(e.responseText);a(l)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,i=e[r];typeof i=="object"?n.push(this.serialize(i,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},im=e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let s=0;s<r;s++)t+=String.fromCharCode(n[s]);return btoa(t)},Ln=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(so)&&(this.authToken=atob(t[1].slice(so.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Pt.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ro.websocket),"$1/"+ro.longpoll)}endpointURL(){return Is.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Pt.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Pt.open||this.readyState===Pt.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:r,messages:s}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=r}else n=0;switch(n){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Pt.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(e){typeof e!="string"&&(e=im(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
38
- `),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=Pt.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let i,o=()=>{this.reqs.delete(i),r()};i=Is.request(e,this.endpointURL(),t,n,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},om=class gr{constructor(t,n={}){let r=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(r.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=gr.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=gr.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(r.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=gr.syncDiff(this.state,s,i,o),a())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return gr.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,r,s){let i=this.clone(t),o={},a={};return this.map(i,(l,c)=>{n[l]||(a[l]=c)}),this.map(n,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(m=>m.phx_ref),d=u.metas.map(m=>m.phx_ref),f=c.metas.filter(m=>d.indexOf(m.phx_ref)<0),p=u.metas.filter(m=>h.indexOf(m.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},r,s)}static syncDiff(t,n,r,s){let{joins:i,leaves:o}=this.clone(n);return r||(r=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=t[a];if(t[a]=this.clone(l),c){let u=t[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);t[a].metas.unshift(...h)}r(a,c,l)}),this.map(o,(a,l)=>{let c=t[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 t[a]}),t}static list(t,n){return n||(n=function(r,s){return s}),this.map(t,(r,s)=>n(r,s))}static map(t,n){return Object.getOwnPropertyNames(t).map(r=>n(r,t[r]))}static clone(t){return JSON.parse(JSON.stringify(t))}},ls={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,i,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:i,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:i}=e,o=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,t.length),l.setUint8(c++,n.length),l.setUint8(c++,s.length),l.setUint8(c++,r.length),Array.from(t,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,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(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+r));o=o+r;let l=n.decode(e.slice(o,o+s));o=o+s;let c=n.decode(e.slice(o,o+i));o=o+i;let u=e.slice(o,e.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=n.decode(e.slice(a,a+r));a=a+r;let c=n.decode(e.slice(a,a+s));a=a+s;let u=n.decode(e.slice(a,a+i));a=a+i;let h=n.decode(e.slice(a,a+o));a=a+o;let d=e.slice(a,e.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:Ft.reply,payload:f}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),i=this.HEADER_LENGTH+2,o=n.decode(e.slice(i,i+r));i=i+r;let a=n.decode(e.slice(i,i+s));i=i+s;let l=e.slice(i,e.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},am=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||tm,this.transport=t.transport||Ct.WebSocket||Ln,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=Ct&&Ct.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=ls.encode.bind(ls),this.defaultDecoder=ls.decode.bind(ls),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==Ln?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;qn&&qn.addEventListener&&(qn.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),r=this.connectClock)}),qn.addEventListener("pageshow",s=>{r===this.connectClock&&(r=null,this.connect())}),qn.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=xr(t.params||{}),this.endPoint=`${e}/${ro.websocket}`,this.vsn=t.vsn||em,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new wu(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return Ln}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Is.appendParams(Is.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=xr(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==Ln?this.connectWithFallback(Ln,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){switch(e){case Ln:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${so}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,r=!0,s,i,o=this.transportName(e),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),r=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),i=this.onError(l=>{this.log("transport","error",l),r&&!n&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!r){let l=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),nm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===Pt.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Ft.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case Pt.connecting:return"connecting";case Pt.open:return"open";case Pt.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new sm(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:i}=e;this.log("push",`${t} ${n} (${i}, ${s})`,r)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:r,payload:s,ref:i,join_ref:o}=t;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(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||""} ${n} ${r} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(n,r,s,o)&&l.trigger(r,s,i,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,r])=>{try{r(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Rr{constructor(t,n){const r=cm(n);this.presence=new om(t.getChannel(),r),this.presence.onJoin((s,i,o)=>{const a=Rr.onJoinPayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=Rr.onLeavePayload(s,i,o);t.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Rr.transformState(this.presence.state)}static transformState(t){return t=lm(t),Object.getOwnPropertyNames(t).reduce((n,r)=>{const s=t[r];return n[r]=ws(s),n},{})}static onJoinPayload(t,n,r){const s=nl(n),i=ws(r);return{event:"join",key:t,currentPresences:s,newPresences:i}}static onLeavePayload(t,n,r){const s=nl(n),i=ws(r);return{event:"leave",key:t,currentPresences:s,leftPresences:i}}}function ws(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function lm(e){return JSON.parse(JSON.stringify(e))}function cm(e){return(e==null?void 0:e.events)&&{events:e.events}}function nl(e){return e!=null&&e.metas?ws(e):[]}var rl;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(rl||(rl={}));class um{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Rr(this.channel.channelAdapter,n)}}function hm(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class dm{constructor(t,n,r){const s=fm(r);this.channel=t.getSocket().channel(n,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,r){let s;try{s=this.channel.push(t,n,r)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>Wg){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(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===an.joined}isJoined(){return this.state===an.joined}isJoining(){return this.state===an.joining}isClosed(){return this.state===an.closed}isLeaving(){return this.state===an.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function fm(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var sl;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(sl||(sl={}));var Gn;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Gn||(Gn={}));var qt;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(qt||(qt={}));class Or{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},r){var s,i;if(this.topic=t,this.params=n,this.socket=r,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new dm(this.socket.socketAdapter,t,this.params),this.presence=new um(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=_u(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(t,n=this.timeout){var r,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Gn.PRESENCE]&&this.bindings[Gn.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=>{t==null||t(qt.CHANNEL_ERROR,hm(f))}),this._onClose(()=>t==null?void 0:t(qt.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){t==null||t(qt.SUBSCRIBED);return}this._updatePostgresBindings(f,t)}).receive("error",f=>{this.state=an.errored;const p=Object.values(f).join(", ")||"error";t==null||t(qt.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{t==null||t(qt.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var r;const s=this.bindings.postgres_changes,i=(r=s==null?void 0:s.length)!==null&&r!==void 0?r:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=t&&t[a];if(f&&f.event===c&&Or.isFilterValueEqual(f.schema,u)&&Or.isFilterValueEqual(f.table,h)&&Or.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=an.errored,n==null||n(qt.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=an.errored&&n&&n(qt.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,r){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=t===Gn.PRESENCE||t===Gn.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,r)}async httpSend(t,n,r={}){var s;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=r.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(t,n={}){var r,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=t,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r: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(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,r){const s=new AbortController,i=setTimeout(()=>s.abort(),r),o=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:s.signal}));return clearTimeout(i),o}_on(t,n,r){const s=t.toLocaleLowerCase(),i=this.channelAdapter.on(t,r),o={type:s,filter:n,callback:r,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,r)=>{var s,i,o,a,l,c,u;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,r))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===t.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=n.ids)===null||o===void 0?void 0:o.includes(f))&&(p==="*"||(p==null?void 0:p.toLocaleLowerCase())===((a=n.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=n==null?void 0:n.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,n){const{close:r,error:s,leave:i,join:o}=yu;return n&&[r,s,i,o].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,r)=>{if(typeof n=="object"&&"ids"in n){const s=n.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 n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const r of t.bindings[n])this._on(r.type,r.filter,r.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=tl(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=tl(t.columns,t.old_record)),n}}class pm{constructor(t,n){this.socket=new am(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,r,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{t(),i("ok")},n,r)})}push(t){this.socket.push(t)}log(t,n,r){this.socket.log(t,n,r)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==to.connecting}isDisconnecting(){return this.socket.connectionState()==to.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const il={HEARTBEAT_INTERVAL:25e3},gm=[1e3,2e3,5e3,1e4],mm=1e4;function bm(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function ym(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return bm()}const vm=`
39
- addEventListener("message", (e) => {
40
- if (e.data.event === "start") {
41
- setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
42
- }
43
- });`;class _m{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var r;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new Vg,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const s=this._initializeOptions(n);this.socketAdapter=new pm(t,s),this.httpEndpoint=_u(t),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw n.includes("Node.js")?new Error(`${n}
44
-
45
- To use Realtime in Node.js, you need to provide a WebSocket implementation:
46
-
47
- Option 1: Use Node.js 22+ which has native WebSocket support
48
- Option 2: Install and provide the "ws" package:
49
-
50
- npm install ws
51
-
52
- import ws from "ws"
53
- const client = new RealtimeClient(url, {
54
- ...options,
55
- transport: ws
56
- })`):new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async r=>{const s=await r.unsubscribe();return r.teardown(),s}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,r){this.socketAdapter.log(t,n,r)}connectionState(){return this.socketAdapter.connectionState()||to.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const r=`realtime:${t}`,s=this.getChannels().find(i=>i.topic===r);if(s)return s;{const i=new Or(`realtime:${t}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let n,r=!1;if(t)n=t,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:Hg};n&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(yu.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,r)=>{n=="sent"&&this._setAuthSafely(),t&&t(n,r)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let n;if(t)n=t;else{const r=new Blob([vm],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_initializeOptions(t){var n,r,s,i,o,a,l,c,u,h,d,f;this.worker=(n=t==null?void 0:t.worker)!==null&&n!==void 0?n:!1,this.accessToken=(r=t==null?void 0:t.accessToken)!==null&&r!==void 0?r:null;const p={};p.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Kg,p.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:il.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:il.HEARTBEAT_INTERVAL),p.transport=(l=t==null?void 0:t.transport)!==null&&l!==void 0?l:Ug.getWebSocketConstructor(),p.params=t==null?void 0:t.params,p.logger=t==null?void 0:t.logger,p.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),p.sessionStorage=(c=t==null?void 0:t.sessionStorage)!==null&&c!==void 0?c:ym(),p.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>gm[y-1]||mm;let m,E;const v=(h=t==null?void 0:t.vsn)!==null&&h!==void 0?h:qg;switch(v){case Fg:m=(y,w)=>w(JSON.stringify(y)),E=(y,w)=>w(JSON.parse(y));break;case bu:m=this.serializer.encode.bind(this.serializer),E=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=v,p.encode=(d=t==null?void 0:t.encode)!==null&&d!==void 0?d:m,p.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:E,p.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.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=t==null?void 0:t.workerUrl,p.autoSendHeartbeat=!this.worker}return p}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Br=class extends Error{constructor(e,t){var n;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((n=t.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function wm(e,t,n){const r=new URL(t,e);if(n)for(const[s,i]of Object.entries(n))i!==void 0&&r.searchParams.set(s,i);return r.toString()}async function Em(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function Sm(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:s,body:i,headers:o}){const a=wm(e.baseUrl,r,s),l=await Em(e.auth),c=await t(a,{method:n,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),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 Br((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function cs(e){return e.join("")}var km=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:cs(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cs(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cs(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cs(e.namespace)}`}),!0}catch(t){if(t instanceof Br&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof Br&&n.status===409)return;throw n}}};function $n(e){return e.join("")}var Am=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${$n(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof Br&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof Br&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},Tm=class{constructor(e){var r;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=Sm({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(r=e.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new km(this.client,t),this.tableOps=new Am(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function Hr(e){"@babel/helpers - typeof";return Hr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hr(e)}function xm(e,t){if(Hr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Hr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rm(e){var t=xm(e,"string");return Hr(t)=="symbol"?t:t+""}function Om(e,t,n){return(t=Rm(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ol(Object(n),!0).forEach(function(r){Om(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ai=class extends Error{constructor(e,t="storage",n,r){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function li(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var io=class extends ai{constructor(e,t,n,r="storage"){super(e,r,t,n),this.name=r==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return oe({},super.toJSON())}},Eu=class extends ai{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Ps(e,t,n){const r=oe({},e),s=t.toLowerCase();for(const i of Object.keys(r))i.toLowerCase()===s&&delete r[i];return r[s]=n,r}function Cm(e){const t={};for(const[n,r]of Object.entries(e))t[n.toLowerCase()]=r;return t}const Nm=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Im=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},oo=e=>{if(Array.isArray(e))return e.map(n=>oo(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,r])=>{const s=n.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));t[s]=oo(r)}),t},Pm=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),al=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},Lm=async(e,t,n,r)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const s=e;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+"";t(new io(al(o),i,a,r))}).catch(()=>{const o=i+"";t(new io(s.statusText||`HTTP ${i} error`,i,o,r))})}else t(new Eu(al(e),e,r))},$m=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!r)return oe(oe({},s),n);if(Im(r)){var i;const o=(t==null?void 0:t.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Ps(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(r)}else s.body=r;return t!=null&&t.duplex&&(s.duplex=t.duplex),oe(oe({},s),n)};async function hr(e,t,n,r,s,i,o){return new Promise((a,l)=>{e(n,$m(t,r,s,i)).then(c=>{if(!c.ok)throw c;if(r!=null&&r.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Lm(c,l,r,o))})}function Su(e="storage"){return{get:async(t,n,r,s)=>hr(t,"GET",n,r,s,void 0,e),post:async(t,n,r,s,i)=>hr(t,"POST",n,s,i,r,e),put:async(t,n,r,s,i)=>hr(t,"PUT",n,s,i,r,e),head:async(t,n,r,s)=>hr(t,"HEAD",n,oe(oe({},r),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,n,r,s,i)=>hr(t,"DELETE",n,s,i,r,e)}}const Mm=Su("storage"),{get:Fr,post:mt,put:ao,head:jm,remove:Lo}=Mm,ot=Su("vectors");var or=class{constructor(e,t={},n,r="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=Cm(t),this.fetch=Nm(n),this.namespace=r}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Ps(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(li(n))return{data:null,error:n};throw n}}},Dm=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(li(t))return{data:null,error:t};throw t}}};let ku;ku=Symbol.toStringTag;var Um=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[ku]="BlobDownloadBuilder",this.promise=null}asStream(){return new Dm(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(li(t))return{data:null,error:t};throw t}}};const Bm={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ll={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Hm=class extends or{constructor(e,t={},n,r){super(e,t,r,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,r){var s=this;return s.handleOperation(async()=>{let i;const o=oe(oe({},ll),r);let a=oe(oe({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=n,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")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))a=Ps(a,d,f);const c=s._removeEmptyFolders(t),u=s._getFinalPath(c),h=await(e=="PUT"?ao:mt)(s.fetch,`${s.url}/object/${u}`,i,oe({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,r){var s=this;const i=s._removeEmptyFolders(e),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",t),s.handleOperation(async()=>{let l;const c=oe(oe({},ll),r);let u=oe(oe({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=n,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")),r!=null&&r.headers)for(const[d,f]of Object.entries(r.headers))u=Ps(u,d,f);return{path:i,fullPath:(await ao(s.fetch,a.toString(),l,oe({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let r=n._getFinalPath(e);const s=oe({},n.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const i=await mt(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:s}),o=new URL(n.url+i.url),a=o.searchParams.get("token");if(!a)throw new ai("No token returned by API");return{signedUrl:o.toString(),path:e,token:a}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var r=this;return r.handleOperation(async()=>await mt(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}))}async copy(e,t,n){var r=this;return r.handleOperation(async()=>({path:(await mt(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key}))}async createSignedUrl(e,t,n){var r=this;return r.handleOperation(async()=>{let s=r._getFinalPath(e);const i=typeof(n==null?void 0:n.transform)=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let o=await mt(r.fetch,`${r.url}/object/sign/${s}`,oe({expiresIn:t},i?{transform:n.transform}:{}),{headers:r.headers});const a=new URLSearchParams;n!=null&&n.download&&a.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&a.set("cacheNonce",String(n.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${r.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,n){var r=this;return r.handleOperation(async()=>{const s=await mt(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:t,paths:e},{headers:r.headers}),i=new URLSearchParams;n!=null&&n.download&&i.set("download",n.download===!0?"":n.download),(n==null?void 0:n.cacheNonce)!=null&&i.set("cacheNonce",String(n.cacheNonce));const o=i.toString();return s.map(a=>oe(oe({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,n){const r=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const i=s.toString(),o=this._getFinalPath(e),a=()=>Fr(this.fetch,`${this.url}/${r}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new Um(a,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>oo(await Fr(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await jm(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(li(s)){var r;const i=s instanceof io?s.status:s instanceof Eu?(r=s.originalError)===null||r===void 0?void 0:r.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const n=this._getFinalPath(e),r=new URLSearchParams;t!=null&&t.download&&r.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(r,t.transform),(t==null?void 0:t.cacheNonce)!=null&&r.set("cacheNonce",String(t.cacheNonce));const s=r.toString(),i=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${n}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,n){var r=this;return r.handleOperation(async()=>{const s=oe(oe(oe({},Bm),t),{},{prefix:e||""});return await mt(r.fetch,`${r.url}/object/list/${r.bucketId}`,s,{headers:r.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const r=oe({},e);return await mt(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const Fm="2.105.4",ts={"X-Client-Info":`storage-js/${Fm}`};var qm=class extends or{constructor(e,t={},n,r){const s=new URL(e);r!=null&&r.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=oe(oe({},ts),t);super(i,o,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await Fr(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Fr(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await mt(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await ao(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await mt(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},Km=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),t);super(r,s,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await mt(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const r=n.toString(),s=r?`${t.url}/bucket?${r}`:`${t.url}/bucket`;return await Fr(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Lo(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!Pm(e))throw new ai("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new Tm({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),r=this.shouldThrowOnError;return new Proxy(n,{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(r)throw l;return{data:null,error:l}}}}})}},Wm=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await ot.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await ot.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},Vm=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},Gm=class extends or{constructor(e,t={},n){const r=e.replace(/\/$/,""),s=oe(oe({},ts),{},{"Content-Type":"application/json"},t);super(r,s,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await ot.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},zm=class extends Gm{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Jm(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},Jm=class extends Wm{constructor(e,t,n,r){super(e,t,r),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new Ym(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Ym=class extends Vm{constructor(e,t,n,r,s){super(e,t,s),this.vectorBucketName=n,this.indexName=r}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,oe(oe({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},Zm=class extends qm{constructor(e,t={},n,r){super(e,t,n,r)}from(e){return new Hm(this.url,this.headers,e,this.fetch)}get vectors(){return new zm(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Km(this.url+"/iceberg",this.headers,this.fetch)}};const Au="2.105.4",Kn=30*1e3,lo=3,Ri=lo*Kn,Xm="http://localhost:9999",Qm="supabase.auth.token",eb={"X-Client-Info":`gotrue-js/${Au}`},co="X-Supabase-Api-Version",Tu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},tb=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,nb=10*60*1e3;class qr extends Error{constructor(t,n,r){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function V(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class rb extends qr{constructor(t,n,r){super(t,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function sb(e){return V(e)&&e.name==="AuthApiError"}class yt extends qr{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Qt extends qr{constructor(t,n,r,s){super(t,r,s),this.name=n,this.status=r}}class He extends Qt{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function us(e){return V(e)&&e.name==="AuthSessionMissingError"}class Mn extends Qt{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class hs extends Qt{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class ds extends Qt{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function ib(e){return V(e)&&e.name==="AuthImplicitGrantRedirectError"}class cl extends Qt{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class ob extends Qt{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 uo extends Qt{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Oi(e){return V(e)&&e.name==="AuthRetryableFetchError"}class ul extends Qt{constructor(t,n,r){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class ho extends Qt{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),hl=`
57
- \r=`.split(""),ab=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<hl.length;t+=1)e[hl[t].charCodeAt(0)]=-2;for(let t=0;t<Ls.length;t+=1)e[Ls[t].charCodeAt(0)]=t;return e})();function dl(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ls[r]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const r=t.queue>>t.queuedBits-6&63;n(Ls[r]),t.queuedBits-=6}}function xu(e,t,n){const r=ab[e];if(r>-1)for(t.queue=t.queue<<6|r,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function fl(e){const t=[],n=o=>{t.push(String.fromCodePoint(o))},r={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{ub(o,r,n)};for(let o=0;o<e.length;o+=1)xu(e.charCodeAt(o),s,i);return t.join("")}function lb(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function cb(e,t){for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r>55295&&r<=56319){const s=(r-55296)*1024&65535;r=(e.charCodeAt(n+1)-56320&65535|s)+65536,n+=1}lb(r,t)}}function ub(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let r=1;r<6;r+=1)if(!(e>>7-r&1)){t.utf8seq=r;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Qn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)xu(e.charCodeAt(s),n,r);return new Uint8Array(t)}function hb(e){const t=[];return cb(e,n=>t.push(n)),new Uint8Array(t)}function xn(e){const t=[],n={queue:0,queuedBits:0},r=s=>{t.push(s)};return e.forEach(s=>dl(s,n,r)),dl(null,n,r),t.join("")}function db(e){return Math.round(Date.now()/1e3)+e}function fb(){return Symbol("auth-callback")}const Ve=()=>typeof window<"u"&&typeof document<"u",vn={tested:!1,writable:!1},Ru=()=>{if(!Ve())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(vn.tested)return vn.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),vn.tested=!0,vn.writable=!0}catch{vn.tested=!0,vn.writable=!1}return vn.writable};function pb(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((s,i)=>{t[i]=s})}catch{}return n.searchParams.forEach((r,s)=>{t[s]=r}),t}const Ou=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),gb=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",Wn=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},_n=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},We=async(e,t)=>{await e.removeItem(t)};class ci{constructor(){this.promise=new ci.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}ci.promiseConstructor=Promise;function fs(e){const t=e.split(".");if(t.length!==3)throw new ho("Invalid JWT structure");for(let r=0;r<t.length;r++)if(!tb.test(t[r]))throw new ho("JWT not in base64url format");return{header:JSON.parse(fl(t[0])),payload:JSON.parse(fl(t[1])),signature:Qn(t[2]),raw:{header:t[0],payload:t[1]}}}async function mb(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function bb(e,t){return new Promise((r,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await e(i);if(!t(i,null,o)){r(o);return}}catch(o){if(!t(i,o)){s(o);return}}})()})}function yb(e){return("0"+e.toString(16)).substr(-2)}function vb(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let s="";for(let i=0;i<56;i++)s+=n.charAt(Math.floor(Math.random()*r));return s}return crypto.getRandomValues(t),Array.from(t,yb).join("")}async function _b(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function wb(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await _b(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function jn(e,t,n=!1){const r=vb();let s=r;n&&(s+="/recovery"),await Wn(e,`${t}-code-verifier`,s);const i=await wb(r);return[i,r===i?"plain":"s256"]}const Eb=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Sb(e){const t=e.headers.get(co);if(!t||!t.match(Eb))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function kb(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Ab(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Tb=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Bt(e){if(!Tb.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function gt(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Ci(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function xb(e,t){return new Proxy(e,{get:(n,r,s)=>{if(r==="__isInsecureUserWarningProxy")return!0;if(typeof r=="symbol"){const i=r.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,s)}return!t.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,r,s)}})}function pl(e){return JSON.parse(JSON.stringify(e))}const En=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},Rb=[502,503,504,520,521,522,523,524,530];async function gl(e){var t;if(!gb(e))throw new uo(En(e),0);if(Rb.includes(e.status))throw new uo(En(e),e.status);let n;try{n=await e.json()}catch(i){throw new yt(En(i),i)}let r;const s=Sb(e);if(s&&s.getTime()>=Tu["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new ul(En(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(r==="session_not_found")throw new He}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new ul(En(n),e.status,n.weak_password.reasons);throw new rb(En(n),e.status||500,r)}const Ob=(e,t,n,r)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(r),Object.assign(Object.assign({},s),n))};async function Z(e,t,n,r){var s;const i=Object.assign({},r==null?void 0:r.headers);i[co]||(i[co]=Tu["2024-01-01"].name),r!=null&&r.jwt&&(i.Authorization=`Bearer ${r.jwt}`);const o=(s=r==null?void 0:r.query)!==null&&s!==void 0?s:{};r!=null&&r.redirectTo&&(o.redirect_to=r.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Cb(e,t,n+a,{headers:i,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function Cb(e,t,n,r,s,i){const o=Ob(t,r,s,i);let a;try{a=await e(n,Object.assign({},o))}catch(l){throw console.error(l),new uo(En(l),0)}if(a.ok||await gl(a),r!=null&&r.noResolveJson)return a;try{return await a.json()}catch(l){await gl(l)}}function ft(e){var t;let n=null;Pb(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=db(e.expires_in)));const r=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:r},error:null}}function ml(e){const t=ft(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(t.data.weak_password=e.weak_password),t}function ln(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Nb(e){return{data:e,error:null}}function Ib(e){const{action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i}=e,o=oi(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:r,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function bl(e){return e}function Pb(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const Ni=["global","local","others"];class Lb{constructor({url:t="",headers:n={},fetch:r,experimental:s}){this.url=t,this.headers=n,this.fetch=Ou(r),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(t,n=Ni[0]){if(Ni.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ni.join(", ")}`);try{return await Z(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(r){if(V(r))return{data:null,error:r};throw r}}async inviteUserByEmail(t,n={}){try{return await Z(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:ln})}catch(r){if(V(r))return{data:{user:null},error:r};throw r}}async generateLink(t){try{const{options:n}=t,r=oi(t,["options"]),s=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(s.new_email=r==null?void 0:r.newEmail,delete s.newEmail),await Z(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Ib,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(V(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:ln})}catch(n){if(V(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Z(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:bl});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 m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(p.split(";")[1].split("=")[1]);c[`${E}Page`]=m}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(V(c))return{data:{users:[]},error:c};throw c}}async getUserById(t){Bt(t);try{return await Z(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:ln})}catch(n){if(V(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Bt(t);try{return await Z(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:ln})}catch(r){if(V(r))return{data:{user:null},error:r};throw r}}async deleteUser(t,n=!1){Bt(t);try{return await Z(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:ln})}catch(r){if(V(r))return{data:{user:null},error:r};throw r}}async _listFactors(t){Bt(t.userId);try{const{data:n,error:r}=await Z(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:n,error:r}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Bt(t.userId),Bt(t.id);try{return{data:await Z(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,r,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Z(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(i=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:bl});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 m=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(p.split(";")[1].split("=")[1]);c[`${E}Page`]=m}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if(V(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Z(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Z(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(V(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(t){try{return await Z(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t!=null&&t.type&&(n.type=t.type),await Z(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:r=>{var s;return{data:{providers:(s=r==null?void 0:r.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(n){if(V(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await Z(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await Z(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await Z(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(V(r))return{data:null,error:r};throw r}}async _deleteCustomProvider(t){try{return await Z(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){gt(this.experimental),Bt(t.userId);try{return await Z(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(V(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){gt(this.experimental),Bt(t.userId),Bt(t.passkeyId);try{return await Z(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(V(n))return{data:null,error:n};throw n}}}function yl(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const Tt={debug:!!(globalThis&&Ru()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Cu extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class vl extends Cu{}async function $b(e,t,n){Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const r=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{r.abort(),Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal},async i=>{if(i){clearTimeout(s),Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new vl(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Tt.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 n()}})}catch(i){if(t>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&t>0){if(r.signal.aborted)return Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async o=>{if(o){Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await n()}finally{Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await n()}));throw Tt.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new vl(`Lock "${e}" was released because another request stole it`)}throw i}}function Mb(){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 Nu(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function jb(e){return parseInt(e,16)}function Db(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function Ub(e){var t;const{chainId:n,domain:r,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!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(!((t=e.statement)===null||t===void 0)&&t.includes(`
58
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const f=Nu(e.address),p=u?`${u}://${r}`:r,m=e.statement?`${e.statement}
59
- `:"",E=`${p} wants you to sign in with your Ethereum account:
60
- ${f}
61
-
62
- ${m}`;let v=`URI: ${h}
63
- Version: ${d}
64
- Chain ID: ${n}${o?`
65
- Nonce: ${o}`:""}
66
- Issued At: ${i.toISOString()}`;if(s&&(v+=`
67
- Expiration Time: ${s.toISOString()}`),a&&(v+=`
68
- Not Before: ${a.toISOString()}`),l&&(v+=`
69
- Request ID: ${l}`),c){let y=`
70
- Resources:`;for(const w of c){if(!w||typeof w!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${w}`);y+=`
71
- - ${w}`}v+=y}return`${E}
72
- ${v}`}class Le extends Error{constructor({message:t,code:n,cause:r,name:s}){var i;super(t,{cause:r}),this.__isWebAuthnError=!0,this.name=(i=s??(r instanceof Error?r.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $s extends Le{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Bb({error:e,options:t}){var n,r,s;const{publicKey:i}=t;if(!i)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Le({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=i.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Le({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((r=i.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Le({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Le({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Le({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Le({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Le({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Le({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(Iu(o)){if(i.rp.id!==o)return new Le({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Le({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Le({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Le({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Hb({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Le({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Le({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const r=window.location.hostname;if(Iu(r)){if(n.rpId!==r)return new Le({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Le({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Le({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Le({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Fb{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const fo=new Fb;function _l(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:r}=e,s=oi(e,["challenge","user","excludeCredentials"]),i=Qn(t).buffer,o=Object.assign(Object.assign({},n),{id:Qn(n.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(r&&r.length>0){a.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Qn(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function wl(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,r=oi(e,["challenge","allowCredentials"]),s=Qn(t).buffer,i=Object.assign(Object.assign({},r),{challenge:s});if(n&&n.length>0){i.allowCredentials=new Array(n.length);for(let o=0;o<n.length;o++){const a=n[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Qn(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function El(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:xn(new Uint8Array(e.response.attestationObject)),clientDataJSON:xn(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Sl(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,r=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:xn(new Uint8Array(s.authenticatorData)),clientDataJSON:xn(new Uint8Array(s.clientDataJSON)),signature:xn(new Uint8Array(s.signature)),userHandle:s.userHandle?xn(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Iu(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function Ms(){var e,t;return!!(Ve()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function Pu(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",t)}:{data:null,error:new $s("Empty credential response",t)}}catch(t){return{data:null,error:Bb({error:t,options:e})}}}async function Lu(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",t)}:{data:null,error:new $s("Empty credential response",t)}}catch(t){return{data:null,error:Hb({error:t,options:e})}}}const qb={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},Kb={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function js(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),n=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),r={};for(const s of e)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))r[i]=o;else if(n(o))r[i]=o;else if(t(o)){const a=r[i];t(a)?r[i]=js(a,o):r[i]=js(o)}else r[i]=o}return r}function Wb(e,t){return js(qb,e,t||{})}function Vb(e,t){return js(Kb,e,t||{})}class Gb{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:r,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!a)return{data:null,error:l};const c=s??fo.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=r;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=Wb(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Pu({publicKey:u,signal:c});return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=Vb(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await Lu(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:t,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return V(a)?{data:null,error:a}:{data:null,error:new yt("Unexpected error in challenge",a)}}}async _verify({challengeId:t,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:r})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new qr("rpId is required for WebAuthn authentication")};try{if(!Ms())return{data:null,error:new yt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:r},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(o){return V(o)?{data:null,error:o}:{data:null,error:new yt("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!n)return{data:null,error:new qr("rpId is required for WebAuthn registration")};try{if(!Ms())return{data:null,error:new yt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===t&&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:n,rpOrigins:r},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return V(o)?{data:null,error:o}:{data:null,error:new yt("Unexpected error in register",o)}}}}Mb();const zb={url:Xm,storageKey:Qm,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:eb,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function kl(e,t,n){return await n()}const Dn={};class Kr{get jwks(){var t,n;return(n=(t=Dn[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=Dn[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){Dn[this.storageKey]=Object.assign(Object.assign({},Dn[this.storageKey]),{cachedAt:t})}constructor(t){var n,r,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({},zb),t);if(this.storageKey=o.storageKey,this.instanceID=(n=Kr.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,Kr.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&Ve()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(r=o.experimental)!==null&&r!==void 0?r:{},this.admin=new Lb({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Ou(o.fetch),this.lock=o.lock||kl,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&&Ve()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=$b:this.lock=kl,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 Gb(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:Ru()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=yl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=yl(this.memoryStorage)),Ve()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Au}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let n={},r="none";if(Ve()&&(n=pb(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),Ve()&&this.detectSessionInUrl&&r!=="none"){const{data:s,error:i}=await this._getSessionFromURL(n,r);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),ib(i)){const l=(t=i.details)===null||t===void 0?void 0:t.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=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(n){return V(n)?this._returnResult({error:n}):this._returnResult({error:new yt("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,r,s;try{const i=await Z(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:ft}),{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(V(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(t){var n,r,s;try{let i;if("email"in t){const{email:u,password:h,options:d}=t;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await jn(this.storage,this.storageKey)),i=await Z(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:p},xform:ft})}else if("phone"in t){const{phone:u,password:h,options:d}=t;i=await Z(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},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:ft})}else throw new hs("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await We(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 We(this.storage,`${this.storageKey}-code-verifier`),V(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(t){try{let n;if("email"in t){const{email:i,password:o,options:a}=t;n=await Z(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:ml})}else if("phone"in t){const{phone:i,password:o,options:a}=t;n=await Z(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:ml})}else throw new hs("You must provide either an email or phone number and a password");const{data:r,error:s}=n;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!r||!r.session||!r.user){const i=new Mn;return this._returnResult({data:{user:null,session:null},error:i})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:s})}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,r,s,i;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=t.options)===null||r===void 0?void 0:r.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=t.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,r,s,i,o,a,l,c,u,h,d;let f,p;if("message"in t)f=t.message,p=t.signature;else{const{chain:m,wallet:E,statement:v,options:y}=t;let w;if(Ve())if(typeof E=="object")w=E;else{const S=window;if("ethereum"in S&&typeof S.ethereum=="object"&&"request"in S.ethereum&&typeof S.ethereum.request=="function")w=S.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 E!="object"||!(y!=null&&y.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=E}const k=new URL((n=y==null?void 0:y.url)!==null&&n!==void 0?n:window.location.href),C=await w.request({method:"eth_requestAccounts"}).then(S=>S).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!C||C.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const $=Nu(C[0]);let N=(r=y==null?void 0:y.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!N){const S=await w.request({method:"eth_chainId"});N=jb(S)}const U={domain:k.host,address:$,statement:v,uri:k.href,version:"1",chainId:N,nonce:(s=y==null?void 0:y.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=y==null?void 0:y.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=y==null?void 0:y.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=y==null?void 0:y.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=y==null?void 0:y.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=y==null?void 0:y.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Ub(U),p=await w.request({method:"personal_sign",params:[Db(f),$]})}try{const{data:m,error:E}=await Z(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=t.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:ft});if(E)throw E;if(!m||!m.session||!m.user){const v=new Mn;return this._returnResult({data:{user:null,session:null},error:v})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:E})}catch(m){if(V(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async signInWithSolana(t){var n,r,s,i,o,a,l,c,u,h,d,f;let p,m;if("message"in t)p=t.message,m=t.signature;else{const{chain:E,wallet:v,statement:y,options:w}=t;let k;if(Ve())if(typeof v=="object")k=v;else{const $=window;if("solana"in $&&typeof $.solana=="object"&&("signIn"in $.solana&&typeof $.solana.signIn=="function"||"signMessage"in $.solana&&typeof $.solana.signMessage=="function"))k=$.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 v!="object"||!(w!=null&&w.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");k=v}const C=new URL((n=w==null?void 0:w.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in k&&k.signIn){const $=await k.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},w==null?void 0:w.signInWithSolana),{version:"1",domain:C.host,uri:C.href}),y?{statement:y}:null));let N;if(Array.isArray($)&&$[0]&&typeof $[0]=="object")N=$[0];else if($&&typeof $=="object"&&"signedMessage"in $&&"signature"in $)N=$;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in N&&"signature"in N&&(typeof N.signedMessage=="string"||N.signedMessage instanceof Uint8Array)&&N.signature instanceof Uint8Array)p=typeof N.signedMessage=="string"?N.signedMessage:new TextDecoder().decode(N.signedMessage),m=N.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in k)||typeof k.signMessage!="function"||!("publicKey"in k)||typeof k!="object"||!k.publicKey||!("toBase58"in k.publicKey)||typeof k.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${C.host} wants you to sign in with your Solana account:`,k.publicKey.toBase58(),...y?["",y,""]:[""],"Version: 1",`URI: ${C.href}`,`Issued At: ${(s=(r=w==null?void 0:w.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=w==null?void 0:w.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...!((o=w==null?void 0:w.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...!((a=w==null?void 0:w.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...!((l=w==null?void 0:w.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...!((c=w==null?void 0:w.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...!((h=(u=w==null?void 0:w.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...w.signInWithSolana.resources.map(N=>`- ${N}`)]:[]].join(`
73
- `);const $=await k.signMessage(new TextEncoder().encode(p),"utf8");if(!$||!($ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");m=$}}try{const{data:E,error:v}=await Z(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:xn(m)},!((d=t.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:ft});if(v)throw v;if(!E||!E.session||!E.user){const y=new Mn;return this._returnResult({data:{user:null,session:null},error:y})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:v})}catch(E){if(V(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(t){const n=await _n(this.storage,`${this.storageKey}-code-verifier`),[r,s]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new ob;const{data:i,error:o}=await Z(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:r},xform:ft});if(await We(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Mn;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 We(this.storage,`${this.storageKey}-code-verifier`),V(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(t){try{const{options:n,provider:r,token:s,access_token:i,nonce:o}=t,a=await Z(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:ft}),{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 Mn;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,r,s,i,o;try{if("email"in t){const{email:a,options:l}=t;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await jn(this.storage,this.storageKey));const{error:h}=await Z(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:a,options:l}=t,{data:c,error:u}=await Z(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new hs("You must provide either an email or phone number.")}catch(a){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(t){var n,r;try{let s,i;"options"in t&&(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo,i=(r=t.options)===null||r===void 0?void 0:r.captchaToken);const{data:o,error:a}=await Z(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:ft});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(V(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var n,r,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await jn(this.storage,this.storageKey));const c=await Z(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(r=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:Nb});return!((i=c.data)===null||i===void 0)&&i.url&&Ve()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)throw r;if(!n)throw new He;const{error:s}=await Z(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(V(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:r,type:s,options:i}=t,{error:o}=await Z(this.fetch,"POST",n,{headers:this.headers,body:{email:r,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 t){const{phone:r,type:s,options:i}=t,{data:o,error:a}=await Z(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new hs("You must provide either an email or phone number and a type")}catch(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await _n(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const r=t.expires_at?t.expires_at*1e3-Date.now()<Ri:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",t.expires_at),!r){if(this.userStorage){const o=await _n(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=Ci()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=xb(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:i}=await this._callRefreshToken(t.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(t){if(t)return await this._getUser(t);await this.initializePromise;const n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await Z(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:ln}):await this._useSession(async n=>{var r,s,i;const{data:o,error:a}=n;if(a)throw a;return!(!((r=o.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new He}:await Z(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:ln})})}catch(n){if(V(n))return us(n)&&(await this._removeSession(),await We(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async r=>{const{data:s,error:i}=r;if(i)throw i;if(!s.session)throw new He;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&t.email!=null&&([a,l]=await jn(this.storage,this.storageKey));const{data:c,error:u}=await Z(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:ln});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(r){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new He;const n=Date.now()/1e3;let r=n,s=!0,i=null;const{payload:o}=fs(t.access_token);if(o.exp&&(r=o.exp,s=r<=n),s){const{data:a,error:l}=await this._callRefreshToken(t.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(t.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(n){if(V(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var r;if(!t){const{data:o,error:a}=n;if(a)throw a;t=(r=o.session)!==null&&r!==void 0?r:void 0}if(!(t!=null&&t.refresh_token))throw new He;const{data:s,error:i}=await this._callRefreshToken(t.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(n){if(V(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var r;try{if(!Ve())throw new ds("No browser detected.");if(t.error||t.error_description||t.error_code)throw new ds(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new cl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ds("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new cl("No code detected.");const{data:w,error:k}=await this._exchangeCodeForSession(t.code);if(k)throw k;const C=new URL(window.location.href);return C.searchParams.delete("code"),window.history.replaceState(window.history.state,"",C.toString()),{data:{session:w.session,redirectType:(r=w.redirectType)!==null&&r!==void 0?r: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}=t;if(!o||!l||!a||!u)throw new ds("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const p=f-h;p*1e3<=Kn&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const m=f-d;h-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,f,h):h-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,f,h);const{data:E,error:v}=await this._getUser(o);if(v)throw v;const y={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:y,redirectType:t.type},error:null})}catch(s){if(V(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await _n(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i&&!us(i))return this._returnResult({error:i});const o=(r=s.session)===null||r===void 0?void 0:r.access_token;if(o){const{error:a}=await this.admin.signOut(o,t);if(a&&!(sb(a)&&(a.status===404||a.status===401||a.status===403)||us(a)))return this._returnResult({error:a})}return t!=="others"&&(await this._removeSession(),await We(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const n=fb(),r={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(t){return await this._useSession(async n=>{var r,s;try{const{data:{session:i},error:o}=n;if(o)throw o;await((r=this.stateChangeEmitters.get(t))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",t,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",i),us(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(t,n={}){let r=null,s=null;this.flowType==="pkce"&&([r,s]=await jn(this.storage,this.storageKey,!0));try{return await Z(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:r,code_challenge_method:s,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(i){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var t;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:r,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`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=t.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await Z(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 Ve()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:t.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(V(r))return this._returnResult({data:{provider:t.provider,url:null},error:r});throw r}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var r;try{const{error:s,data:{session:i}}=n;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=t,h=await Z(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=i==null?void 0:i.access_token)!==null&&r!==void 0?r:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:ft}),{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 Mn}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await We(this.storage,`${this.storageKey}-code-verifier`),V(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)throw o;return await Z(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(r=i.session)===null||r===void 0?void 0:r.access_token)!==null&&s!==void 0?s:void 0})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await bb(async s=>(s>0&&await mb(200*Math.pow(2,s-1)),this._debug(n,"refreshing attempt",s),await Z(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:ft})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Oi(i)&&Date.now()+o-r<Kn})}catch(r){if(this._debug(n,"error",r),V(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",r),Ve()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:t,url:r},error:null}}async _recoverAndRefresh(){var t,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const s=await _n(this.storage,this.storageKey);if(s&&this.userStorage){let o=await _n(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Wn(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:Ci()}else if(s&&!s.user&&!s.user){const o=await _n(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await We(this.storage,this.storageKey+"-user"),await Wn(this.storage,this.storageKey,s)):s.user=Ci()}if(this._debug(r,"session from storage",s),!this._isValidSession(s)){this._debug(r,"session is not valid"),s!==null&&await this._removeSession();return}const i=((n=s.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Ri;if(this._debug(r,`session has${i?"":" not"} expired with margin of ${Ri}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Oi(o)||(this._debug(r,"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(r,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(r,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(r,"error",s),console.error(s);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var n,r;if(!t)throw new He;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ci;const{data:i,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!i.session)throw new He;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),V(i)){const o={data:null,error:i};return Oi(i)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(o),o}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,n,r=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:t,session:n});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(t,n)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await We(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await Wn(this.userStorage,this.storageKey+"-user",{user:n.user});const s=Object.assign({},n);delete s.user;const i=pl(s);await Wn(this.storage,this.storageKey,i)}else{const s=pl(n);await Wn(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await We(this.storage,this.storageKey),await We(this.storage,this.storageKey+"-code-verifier"),await We(this.storage,this.storageKey+"-user"),this.userStorage&&await We(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&Ve()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Kn);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((r.expires_at*1e3-t)/Kn);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Kn}ms, refresh threshold is ${lo} ticks`),s<=lo&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof Cu)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ve()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,r){const s=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&s.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&s.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[i,o]=await jn(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(r!=null&&r.queryParams){const i=new URLSearchParams(r.queryParams);s.push(i.toString())}return r!=null&&r.skipBrowserRedirect&&s.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;return i?this._returnResult({data:null,error:i}):await Z(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var r,s;const{data:i,error:o}=n;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:l,error:c}=await Z(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(t.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(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?El(t.webauthn.credential_response):Sl(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:l}=await Z(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async n=>{var r;const{data:s,error:i}=n;if(i)return this._returnResult({data:null,error:i});const o=await Z(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:_l(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:wl(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(t){const{data:n,error:r}=await this._challenge({factorId:t.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,r,s,i;if(t)try{const{payload:f}=fs(t);let p=null;f.aal&&(p=f.aal);let m=p;const{data:{user:E},error:v}=await this.getUser(t);if(v)return this._returnResult({data:null,error:v});((r=(n=E==null?void 0:E.factors)===null||n===void 0?void 0:n.filter(k=>k.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const w=f.amr||[];return{data:{currentLevel:p,nextLevel:m,currentAuthenticationMethods:w},error:null}}catch(f){if(V(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=fs(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?await Z(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new He})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new He});const o=await Z(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ve()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(t,n){try{return await this._useSession(async r=>{const{data:{session:s},error:i}=r;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new He});const o=await Z(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&Ve()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;return r?this._returnResult({data:null,error:r}):n?await Z(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new He})})}catch(t){if(V(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;return s?this._returnResult({data:null,error:s}):r?(await Z(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new He})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let r=n.keys.find(a=>a.kid===t);if(r)return r;const s=Date.now();if(r=this.jwks.keys.find(a=>a.kid===t),r&&this.jwks_cached_at+nb>s)return r;const{data:i,error:o}=await Z(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,r=i.keys.find(a=>a.kid===t),!r)?null:r}async getClaims(t,n={}){try{let r=t;if(!r){const{data:f,error:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});r=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=fs(r);n!=null&&n.allowExpired||kb(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,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:f}=await this.getUser(r);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=Ab(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,hb(`${a}.${l}`)))throw new ho("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async signInWithPasskey(t){var n,r,s;gt(this.experimental);try{if(!Ms())return this._returnResult({data:null,error:new yt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=wl(i.options),l=(s=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&s!==void 0?s:fo.createNewAbortSignal(),{data:c,error:u}=await Lu({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new yt("WebAuthn ceremony failed",null)});const h=Sl(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if(V(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(t){var n,r;gt(this.experimental);try{if(!Ms())return this._returnResult({data:null,error:new yt("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=_l(s.options),a=(r=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&r!==void 0?r:fo.createNewAbortSignal(),{data:l,error:c}=await Pu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new yt("WebAuthn ceremony failed",null)});const u=El(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if(V(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){gt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new He});const{data:s,error:i}=await Z(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(V(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){gt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new He});const{data:i,error:o}=await Z(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:r.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;gt(this.experimental);try{const{data:r,error:s}=await Z(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:r,error:null})}catch(r){if(V(r))return this._returnResult({data:null,error:r});throw r}}async _verifyPasskeyAuthentication(t){gt(this.experimental);try{const{data:n,error:r}=await Z(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:ft});return r?this._returnResult({data:null,error:r}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){gt(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!n)return this._returnResult({data:null,error:new He});const{data:s,error:i}=await Z(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(t){if(V(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){gt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new He});const{data:i,error:o}=await Z(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){gt(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!r)return this._returnResult({data:null,error:new He});const{error:i}=await Z(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:r.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(n){if(V(n))return this._returnResult({data:null,error:n});throw n}}}Kr.nextInstanceID={};const Jb=Kr,Yb="2.105.4";let mr="";typeof Deno<"u"?mr="deno":typeof document<"u"?mr="web":typeof navigator<"u"&&navigator.product==="ReactNative"?mr="react-native":mr="node";const Zb={"X-Client-Info":`supabase-js-${mr}/${Yb}`},Xb={headers:Zb},Qb={schema:"public"},ey={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ty={};function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(e)}function ny(e,t){if(Wr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ry(e){var t=ny(e,"string");return Wr(t)=="symbol"?t:t+""}function sy(e,t,n){return(t=ry(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Al(Object(n),!0).forEach(function(r){sy(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}const iy=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),oy=()=>Headers,ay=(e,t,n)=>{const r=iy(n),s=oy();return async(i,o)=>{var a;const l=(a=await t())!==null&&a!==void 0?a:e;let c=new s(o==null?void 0:o.headers);return c.has("apikey")||c.set("apikey",e),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(i,Oe(Oe({},o),{},{headers:c}))}};function ly(e){return e.endsWith("/")?e:e+"/"}function cy(e,t){var n,r;const{db:s,auth:i,realtime:o,global:a}=e,{db:l,auth:c,realtime:u,global:h}=t,d={db:Oe(Oe({},l),s),auth:Oe(Oe({},c),i),realtime:Oe(Oe({},u),o),storage:{},global:Oe(Oe(Oe({},h),a),{},{headers:Oe(Oe({},(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{}),(r=a==null?void 0:a.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return e.accessToken?d.accessToken=e.accessToken:delete d.accessToken,d}function uy(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(ly(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var hy=class extends Jb{constructor(e){super(e)}},dy=class{constructor(e,t,n){var r,s;this.supabaseUrl=e,this.supabaseKey=t;const i=uy(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:Qb,realtime:ty,auth:Oe(Oe({},ey),{},{storageKey:o}),global:Xb},l=cy(n??{},a);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",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=ay(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Oe({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 Dg(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 Zm(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Rg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:r}=await e.auth.getSession();return(t=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,p){const m={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new hy({url:this.authUrl.href,headers:Oe(Oe({},m),f),storageKey:i,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:p,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(E=>E.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new _m(this.realtimeUrl.href,Oe(Oe({},e),{},{params:Oe(Oe({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const fy=(e,t,n)=>new dy(e,t,n);function py(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=18:!1}py()&&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 ps=null,gs=null;async function $u(){if(ps)return ps;try{const e=await fetch("/api/auth/config");if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=await e.json();return ps={authEnabled:t.authEnabled,supabaseUrl:t.supabaseUrl??void 0,supabaseAnonKey:t.supabaseAnonKey??void 0},ps}catch{return{authEnabled:!1}}}async function Vn(){if(gs)return gs;const e=await $u();return!e.authEnabled||!e.supabaseUrl||!e.supabaseAnonKey?null:(gs=fy(e.supabaseUrl,e.supabaseAnonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}}),gs)}const ui=tu("auth",()=>{const e=gg(),t=ve(null),n=ve(null),r=ve(!1),s=ve(!1),i=ve(!1),o=qe(()=>!s.value||!!t.value);let a=!1;async function l(){var E;const p=await Vn();if(!p){n.value=null,t.value=null;return}const{data:m}=await p.auth.getSession();n.value=m.session??null,t.value=((E=m.session)==null?void 0:E.user)??null}async function c(p=!1){if(r.value&&!p)return;i.value=!0;const m=await $u();if(s.value=!!m.authEnabled,!s.value){r.value=!0,i.value=!1;return}await l();const E=await Vn();E&&!a&&(E.auth.onAuthStateChange((v,y)=>{n.value=y,t.value=(y==null?void 0:y.user)??null,r.value=!0}),a=!0),r.value=!0,i.value=!1}async function u(p,m){i.value=!0;try{const E=await Vn();if(!E)throw new Error("Authentication is disabled for this workspace.");const{error:v}=await E.auth.signInWithPassword({email:p,password:m});if(v)throw v;await l()}finally{i.value=!1,r.value=!0}}async function h(){if(!s.value){t.value=null,n.value=null;return}const p=await Vn();await(p==null?void 0:p.auth.signOut()),t.value=null,n.value=null}async function d(){i.value=!0;try{if(await ct("/api/logout",{method:"POST"}).catch(()=>{}),t.value=null,n.value=null,localStorage.removeItem("token"),localStorage.removeItem("supabase.auth.token"),s.value){const p=await Vn();await(p==null?void 0:p.auth.signOut().catch(()=>{}))}return await e.push("/login"),{success:!0}}catch(p){return{success:!1,error:p instanceof Error?p.message:"Logout failed"}}finally{i.value=!1}}async function f(){var p,m;return s.value?(r.value||await c(),(p=n.value)!=null&&p.access_token?n.value.access_token:(await l(),((m=n.value)==null?void 0:m.access_token)??null)):null}return{user:t,session:n,initialized:r,authEnabled:s,loading:i,isAuthenticated:o,init:c,signIn:u,signOut:h,logout:d,getAccessToken:f}});function Mu(e){return/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`}async function ct(e,t){const n=ui(),r=Mu(e),s=new Headers(t==null?void 0:t.headers),i=await n.getAccessToken();i&&s.set("Authorization",`Bearer ${i}`);const o=await fetch(r,{...t,headers:s});if(o.status===401&&n.authEnabled){const a=await Vn();if(a){const{data:l,error:c}=await a.auth.refreshSession();if(l.session){const u=new Headers(t==null?void 0:t.headers);return u.set("Authorization",`Bearer ${l.session.access_token}`),fetch(r,{...t,headers:u})}c||await n.signOut()}}return o}async function gy(e){const n=await ui().getAccessToken(),r=Mu(e),s=/^https?:\/\//i.test(r)?new URL(r):new URL(r,window.location.origin);return n&&s.searchParams.set("token",n),s.toString()}const my={class:"hidden w-12 shrink-0 flex-col items-center border-r border-border bg-sidebar py-3 md:flex"},by={class:"flex flex-col gap-1"},yy={key:0,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},vy={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},_y={class:"flex flex-1 flex-col justify-between"},wy={class:"flex flex-col gap-1"},Ey={key:0,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},Sy={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},ky={class:"flex flex-col gap-1"},Ay={key:0,class:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 font-mono text-[9px] font-bold leading-none text-white"},Ty={key:1,class:"absolute top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary",style:{left:"-4px"}},xy={class:"pointer-events-none absolute left-full ml-2 whitespace-nowrap rounded border border-border bg-popover px-2 py-1 font-mono text-xs text-foreground opacity-0 transition-opacity group-hover:opacity-100"},Ry=fn({__name:"AppSidebar",setup(e){const t=Io(),n=ve(0),r=ve(0);let s=0;const i=[{to:"/squads",label:"Squads",icon:"grid"},{to:"/wiki",label:"Wiki",icon:"book"},{to:"/skills",label:"Settings",icon:"settings",match:["/skills","/mcp"]}],o=[{to:"/chat",label:"Chat",icon:"terminal"},{to:"/activity",label:"Activity",icon:"activity"},{to:"/schedules",label:"Schedules",icon:"calendar"},{to:"/feed",label:"Feed",icon:"message",badge:"feed"},{to:"/inbox",label:"Inbox",icon:"inbox",badge:"inbox"}];function a(u){return(u.match??[u.to]).some(d=>t.path.startsWith(d))}function l(u){return u.badge==="feed"?n.value:u.badge==="inbox"?r.value:0}async function c(){try{const[u,h]=await Promise.all([ct("/api/feed/count"),ct("/api/inbox/count")]);u.ok&&(n.value=Number((await u.json()).count??0)),h.ok&&(r.value=Number((await h.json()).count??0))}catch{n.value=0,r.value=0}}return Xr(()=>{c(),s=window.setInterval(c,15e3)}),Qr(()=>{window.clearInterval(s)}),(u,h)=>(K(),G("aside",my,[P("div",by,[(K(),G(de,null,zt(i,d=>le(ze(Tr),{key:d.to,to:d.to,class:vt(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Mt(()=>[le(De,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),a(d)?(K(),G("div",yy)):Fe("",!0),P("span",vy,Te(d.label),1)]),_:2},1032,["to","class"])),64))]),h[0]||(h[0]=P("div",{class:"my-3 h-px w-6 bg-border/80"},null,-1)),P("div",_y,[P("div",wy,[(K(!0),G(de,null,zt(o.slice(0,3),d=>(K(),nr(ze(Tr),{key:d.to,to:d.to,class:vt(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Mt(()=>[le(De,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),a(d)?(K(),G("div",Ey)):Fe("",!0),P("span",Sy,Te(d.label),1)]),_:2},1032,["to","class"]))),128))]),P("div",ky,[(K(!0),G(de,null,zt(o.slice(3),d=>(K(),nr(ze(Tr),{key:d.to,to:d.to,class:vt(["group relative flex h-9 w-9 items-center justify-center rounded-lg transition-all",a(d)?"bg-primary/15 text-primary":"text-muted-foreground/50 hover:bg-white/[0.04] hover:text-foreground"])},{default:Mt(()=>[le(De,{name:d.icon,class:"h-4 w-4"},null,8,["name"]),l(d)>0?(K(),G("span",Ay,Te(l(d)),1)):Fe("",!0),a(d)?(K(),G("div",Ty)):Fe("",!0),P("span",xy,Te(d.label),1)]),_:2},1032,["to","class"]))),128))])])]))}});function Oy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ju(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&ju(n)}),e}class Tl{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function Du(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function cn(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const Cy="</span>",xl=e=>!!e.scope,Ny=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class Iy{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Du(t)}openNode(t){if(!xl(t))return;const n=Ny(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){xl(t)&&(this.buffer+=Cy)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}const Rl=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class $o{constructor(){this.rootNode=Rl(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=Rl({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{$o._collapse(n)}))}}class Py extends $o{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new Iy(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Vr(e){return e?typeof e=="string"?e:e.source:null}function Uu(e){return Nn("(?=",e,")")}function Ly(e){return Nn("(?:",e,")*")}function $y(e){return Nn("(?:",e,")?")}function Nn(...e){return e.map(n=>Vr(n)).join("")}function My(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Mo(...e){return"("+(My(e).capture?"":"?:")+e.map(r=>Vr(r)).join("|")+")"}function Bu(e){return new RegExp(e.toString()+"|").exec("").length-1}function jy(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Dy=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function jo(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=Vr(r),o="";for(;i.length>0;){const a=Dy.exec(i);if(!a){o+=i;break}o+=i.substring(0,a.index),i=i.substring(a.index+a[0].length),a[0][0]==="\\"&&a[1]?o+="\\"+String(Number(a[1])+s):(o+=a[0],a[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(t)}const Uy=/\b\B/,Hu="[a-zA-Z]\\w*",Do="[a-zA-Z_]\\w*",Fu="\\b\\d+(\\.\\d+)?",qu="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ku="\\b(0b[01]+)",By="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Hy=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Nn(t,/.*\b/,e.binary,/\b.*/)),cn({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Gr={begin:"\\\\[\\s\\S]",relevance:0},Fy={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Gr]},qy={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Gr]},Ky={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},hi=function(e,t,n={}){const r=cn({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=Mo("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Nn(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Wy=hi("//","$"),Vy=hi("/\\*","\\*/"),Gy=hi("#","$"),zy={scope:"number",begin:Fu,relevance:0},Jy={scope:"number",begin:qu,relevance:0},Yy={scope:"number",begin:Ku,relevance:0},Zy={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Gr,{begin:/\[/,end:/\]/,relevance:0,contains:[Gr]}]},Xy={scope:"title",begin:Hu,relevance:0},Qy={scope:"title",begin:Do,relevance:0},ev={begin:"\\.\\s*"+Do,relevance:0},tv=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var ms=Object.freeze({__proto__:null,APOS_STRING_MODE:Fy,BACKSLASH_ESCAPE:Gr,BINARY_NUMBER_MODE:Yy,BINARY_NUMBER_RE:Ku,COMMENT:hi,C_BLOCK_COMMENT_MODE:Vy,C_LINE_COMMENT_MODE:Wy,C_NUMBER_MODE:Jy,C_NUMBER_RE:qu,END_SAME_AS_BEGIN:tv,HASH_COMMENT_MODE:Gy,IDENT_RE:Hu,MATCH_NOTHING_RE:Uy,METHOD_GUARD:ev,NUMBER_MODE:zy,NUMBER_RE:Fu,PHRASAL_WORDS_MODE:Ky,QUOTE_STRING_MODE:qy,REGEXP_MODE:Zy,RE_STARTERS_RE:By,SHEBANG:Hy,TITLE_MODE:Xy,UNDERSCORE_IDENT_RE:Do,UNDERSCORE_TITLE_MODE:Qy});function nv(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function rv(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function sv(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=nv,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function iv(e,t){Array.isArray(e.illegal)&&(e.illegal=Mo(...e.illegal))}function ov(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function av(e,t){e.relevance===void 0&&(e.relevance=1)}const lv=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Nn(n.beforeMatch,Uu(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},cv=["of","and","for","in","not","or","if","then","parent","list","value"],uv="keyword";function Wu(e,t,n=uv){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Wu(e[i],t,i))}),r;function s(i,o){t&&(o=o.map(a=>a.toLowerCase())),o.forEach(function(a){const l=a.split("|");r[l[0]]=[i,hv(l[0],l[1])]})}}function hv(e,t){return t?Number(t):dv(e)?0:1}function dv(e){return cv.includes(e.toLowerCase())}const Ol={},Cn=e=>{console.error(e)},Cl=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Un=(e,t)=>{Ol[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Ol[`${e}/${t}`]=!0)},Ds=new Error;function Vu(e,t,{key:n}){let r=0;const s=e[n],i={},o={};for(let a=1;a<=t.length;a++)o[a+r]=s[a],i[a+r]=!0,r+=Bu(t[a-1]);e[n]=o,e[n]._emit=i,e[n]._multi=!0}function fv(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Cn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Ds;if(typeof e.beginScope!="object"||e.beginScope===null)throw Cn("beginScope must be object"),Ds;Vu(e,e.begin,{key:"beginScope"}),e.begin=jo(e.begin,{joinWith:""})}}function pv(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Cn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Ds;if(typeof e.endScope!="object"||e.endScope===null)throw Cn("endScope must be object"),Ds;Vu(e,e.end,{key:"endScope"}),e.end=jo(e.end,{joinWith:""})}}function gv(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function mv(e){gv(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),fv(e),pv(e)}function bv(e){function t(o,a){return new RegExp(Vr(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,a]),this.matchAt+=Bu(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(l=>l[1]);this.matcherRe=t(jo(a,{joinWith:"|"}),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const l=this.matcherRe.exec(a);if(!l)return null;const c=l.findIndex((h,d)=>d>0&&h!==void 0),u=this.matchIndexes[c];return l.splice(0,c),Object.assign(l,u)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const l=new n;return this.rules.slice(a).forEach(([c,u])=>l.addRule(c,u)),l.compile(),this.multiRegexes[a]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,l){this.rules.push([a,l]),l.type==="begin"&&this.count++}exec(a){const l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let c=l.exec(a);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const u=this.getMatcher(0);u.lastIndex=this.lastIndex+1,c=u.exec(a)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function s(o){const a=new r;return o.contains.forEach(l=>a.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&a.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&a.addRule(o.illegal,{type:"illegal"}),a}function i(o,a){const l=o;if(o.isCompiled)return l;[rv,ov,mv,lv].forEach(u=>u(o,a)),e.compilerExtensions.forEach(u=>u(o,a)),o.__beforeBegin=null,[sv,iv,av].forEach(u=>u(o,a)),o.isCompiled=!0;let c=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),c=o.keywords.$pattern,delete o.keywords.$pattern),c=c||/\w+/,o.keywords&&(o.keywords=Wu(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(c,!0),a&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Vr(l.end)||"",o.endsWithParent&&a.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+a.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(u){return yv(u==="self"?o:u)})),o.contains.forEach(function(u){i(u,l)}),o.starts&&i(o.starts,a),l.matcher=s(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=cn(e.classNameAliases||{}),i(e)}function Gu(e){return e?e.endsWithParent||Gu(e.starts):!1}function yv(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return cn(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Gu(e)?cn(e,{starts:e.starts?cn(e.starts):null}):Object.isFrozen(e)?cn(e):e}var vv="11.11.1";class _v extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Ii=Du,Nl=cn,Il=Symbol("nomatch"),wv=7,zu=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]};let a={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Py};function l(x){return a.noHighlightRe.test(x)}function c(x){let j=x.className+" ";j+=x.parentNode?x.parentNode.className:"";const B=a.languageDetectRe.exec(j);if(B){const re=U(B[1]);return re||(Cl(i.replace("{}",B[1])),Cl("Falling back to no-highlight mode for this block.",x)),re?B[1]:"no-highlight"}return j.split(/\s+/).find(re=>l(re)||U(re))}function u(x,j,B){let re="",he="";typeof j=="object"?(re=x,B=j.ignoreIllegals,he=j.language):(Un("10.7.0","highlight(lang, code, ...args) has been deprecated."),Un("10.7.0",`Please use highlight(code, options) instead.
74
- https://github.com/highlightjs/highlight.js/issues/2277`),he=x,re=j),B===void 0&&(B=!0);const be={code:re,language:he};me("before:highlight",be);const ye=be.result?be.result:h(be.language,be.code,B);return ye.code=be.code,me("after:highlight",ye),ye}function h(x,j,B,re){const he=Object.create(null);function be(M,F){return M.keywords[F]}function ye(){if(!O.keywords){D.addText(T);return}let M=0;O.keywordPatternRe.lastIndex=0;let F=O.keywordPatternRe.exec(T),Y="";for(;F;){Y+=T.substring(M,F.index);const ie=A.case_insensitive?F[0].toLowerCase():F[0],pe=be(O,ie);if(pe){const[Pe,ht]=pe;if(D.addText(Y),Y="",he[ie]=(he[ie]||0)+1,he[ie]<=wv&&(te+=ht),Pe.startsWith("_"))Y+=F[0];else{const pn=A.classNameAliases[Pe]||Pe;Be(F[0],pn)}}else Y+=F[0];M=O.keywordPatternRe.lastIndex,F=O.keywordPatternRe.exec(T)}Y+=T.substring(M),D.addText(Y)}function Ke(){if(T==="")return;let M=null;if(typeof O.subLanguage=="string"){if(!t[O.subLanguage]){D.addText(T);return}M=h(O.subLanguage,T,!0,q[O.subLanguage]),q[O.subLanguage]=M._top}else M=f(T,O.subLanguage.length?O.subLanguage:null);O.relevance>0&&(te+=M.relevance),D.__addSublanguage(M._emitter,M.language)}function Ie(){O.subLanguage!=null?Ke():ye(),T=""}function Be(M,F){M!==""&&(D.startScope(F),D.addText(M),D.endScope())}function Xe(M,F){let Y=1;const ie=F.length-1;for(;Y<=ie;){if(!M._emit[Y]){Y++;continue}const pe=A.classNameAliases[M[Y]]||M[Y],Pe=F[Y];pe?Be(Pe,pe):(T=Pe,ye(),T=""),Y++}}function I(M,F){return M.scope&&typeof M.scope=="string"&&D.openNode(A.classNameAliases[M.scope]||M.scope),M.beginScope&&(M.beginScope._wrap?(Be(T,A.classNameAliases[M.beginScope._wrap]||M.beginScope._wrap),T=""):M.beginScope._multi&&(Xe(M.beginScope,F),T="")),O=Object.create(M,{parent:{value:O}}),O}function J(M,F,Y){let ie=jy(M.endRe,Y);if(ie){if(M["on:end"]){const pe=new Tl(M);M["on:end"](F,pe),pe.isMatchIgnored&&(ie=!1)}if(ie){for(;M.endsParent&&M.parent;)M=M.parent;return M}}if(M.endsWithParent)return J(M.parent,F,Y)}function z(M){return O.matcher.regexIndex===0?(T+=M[0],1):(se=!0,0)}function ee(M){const F=M[0],Y=M.rule,ie=new Tl(Y),pe=[Y.__beforeBegin,Y["on:begin"]];for(const Pe of pe)if(Pe&&(Pe(M,ie),ie.isMatchIgnored))return z(F);return Y.skip?T+=F:(Y.excludeBegin&&(T+=F),Ie(),!Y.returnBegin&&!Y.excludeBegin&&(T=F)),I(Y,M),Y.returnBegin?0:F.length}function fe(M){const F=M[0],Y=j.substring(M.index),ie=J(O,M,Y);if(!ie)return Il;const pe=O;O.endScope&&O.endScope._wrap?(Ie(),Be(F,O.endScope._wrap)):O.endScope&&O.endScope._multi?(Ie(),Xe(O.endScope,M)):pe.skip?T+=F:(pe.returnEnd||pe.excludeEnd||(T+=F),Ie(),pe.excludeEnd&&(T=F));do O.scope&&D.closeNode(),!O.skip&&!O.subLanguage&&(te+=O.relevance),O=O.parent;while(O!==ie.parent);return ie.starts&&I(ie.starts,M),pe.returnEnd?0:F.length}function g(){const M=[];for(let F=O;F!==A;F=F.parent)F.scope&&M.unshift(F.scope);M.forEach(F=>D.openNode(F))}let b={};function _(M,F){const Y=F&&F[0];if(T+=M,Y==null)return Ie(),0;if(b.type==="begin"&&F.type==="end"&&b.index===F.index&&Y===""){if(T+=j.slice(F.index,F.index+1),!s){const ie=new Error(`0 width match regex (${x})`);throw ie.languageName=x,ie.badRule=b.rule,ie}return 1}if(b=F,F.type==="begin")return ee(F);if(F.type==="illegal"&&!B){const ie=new Error('Illegal lexeme "'+Y+'" for mode "'+(O.scope||"<unnamed>")+'"');throw ie.mode=O,ie}else if(F.type==="end"){const ie=fe(F);if(ie!==Il)return ie}if(F.type==="illegal"&&Y==="")return T+=`
75
- `,1;if(Q>1e5&&Q>F.index*3)throw new Error("potential infinite loop, way more iterations than matches");return T+=Y,Y.length}const A=U(x);if(!A)throw Cn(i.replace("{}",x)),new Error('Unknown language: "'+x+'"');const L=bv(A);let R="",O=re||L;const q={},D=new a.__emitter(a);g();let T="",te=0,W=0,Q=0,se=!1;try{if(A.__emitTokens)A.__emitTokens(j,D);else{for(O.matcher.considerAll();;){Q++,se?se=!1:O.matcher.considerAll(),O.matcher.lastIndex=W;const M=O.matcher.exec(j);if(!M)break;const F=j.substring(W,M.index),Y=_(F,M);W=M.index+Y}_(j.substring(W))}return D.finalize(),R=D.toHTML(),{language:x,value:R,relevance:te,illegal:!1,_emitter:D,_top:O}}catch(M){if(M.message&&M.message.includes("Illegal"))return{language:x,value:Ii(j),illegal:!0,relevance:0,_illegalBy:{message:M.message,index:W,context:j.slice(W-100,W+100),mode:M.mode,resultSoFar:R},_emitter:D};if(s)return{language:x,value:Ii(j),illegal:!1,relevance:0,errorRaised:M,_emitter:D,_top:O};throw M}}function d(x){const j={value:Ii(x),illegal:!1,relevance:0,_top:o,_emitter:new a.__emitter(a)};return j._emitter.addText(x),j}function f(x,j){j=j||a.languages||Object.keys(t);const B=d(x),re=j.filter(U).filter(X).map(Ie=>h(Ie,x,!1));re.unshift(B);const he=re.sort((Ie,Be)=>{if(Ie.relevance!==Be.relevance)return Be.relevance-Ie.relevance;if(Ie.language&&Be.language){if(U(Ie.language).supersetOf===Be.language)return 1;if(U(Be.language).supersetOf===Ie.language)return-1}return 0}),[be,ye]=he,Ke=be;return Ke.secondBest=ye,Ke}function p(x,j,B){const re=j&&n[j]||B;x.classList.add("hljs"),x.classList.add(`language-${re}`)}function m(x){let j=null;const B=c(x);if(l(B))return;if(me("before:highlightElement",{el:x,language:B}),x.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",x);return}if(x.children.length>0&&(a.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(x)),a.throwUnescapedHTML))throw new _v("One of your code blocks includes unescaped HTML.",x.innerHTML);j=x;const re=j.textContent,he=B?u(re,{language:B,ignoreIllegals:!0}):f(re);x.innerHTML=he.value,x.dataset.highlighted="yes",p(x,B,he.language),x.result={language:he.language,re:he.relevance,relevance:he.relevance},he.secondBest&&(x.secondBest={language:he.secondBest.language,relevance:he.secondBest.relevance}),me("after:highlightElement",{el:x,result:he,text:re})}function E(x){a=Nl(a,x)}const v=()=>{k(),Un("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){k(),Un("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let w=!1;function k(){function x(){k()}if(document.readyState==="loading"){w||window.addEventListener("DOMContentLoaded",x,!1),w=!0;return}document.querySelectorAll(a.cssSelector).forEach(m)}function C(x,j){let B=null;try{B=j(e)}catch(re){if(Cn("Language definition for '{}' could not be registered.".replace("{}",x)),s)Cn(re);else throw re;B=o}B.name||(B.name=x),t[x]=B,B.rawDefinition=j.bind(null,e),B.aliases&&S(B.aliases,{languageName:x})}function $(x){delete t[x];for(const j of Object.keys(n))n[j]===x&&delete n[j]}function N(){return Object.keys(t)}function U(x){return x=(x||"").toLowerCase(),t[x]||t[n[x]]}function S(x,{languageName:j}){typeof x=="string"&&(x=[x]),x.forEach(B=>{n[B.toLowerCase()]=j})}function X(x){const j=U(x);return j&&!j.disableAutodetect}function ae(x){x["before:highlightBlock"]&&!x["before:highlightElement"]&&(x["before:highlightElement"]=j=>{x["before:highlightBlock"](Object.assign({block:j.el},j))}),x["after:highlightBlock"]&&!x["after:highlightElement"]&&(x["after:highlightElement"]=j=>{x["after:highlightBlock"](Object.assign({block:j.el},j))})}function H(x){ae(x),r.push(x)}function ue(x){const j=r.indexOf(x);j!==-1&&r.splice(j,1)}function me(x,j){const B=x;r.forEach(function(re){re[B]&&re[B](j)})}function Ne(x){return Un("10.7.0","highlightBlock will be removed entirely in v12.0"),Un("10.7.0","Please use highlightElement now."),m(x)}Object.assign(e,{highlight:u,highlightAuto:f,highlightAll:k,highlightElement:m,highlightBlock:Ne,configure:E,initHighlighting:v,initHighlightingOnLoad:y,registerLanguage:C,unregisterLanguage:$,listLanguages:N,getLanguage:U,registerAliases:S,autoDetection:X,inherit:Nl,addPlugin:H,removePlugin:ue}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=vv,e.regex={concat:Nn,lookahead:Uu,either:Mo,optional:$y,anyNumberOfTimes:Ly};for(const x in ms)typeof ms[x]=="object"&&ju(ms[x]);return Object.assign(e,ms),e},ir=zu({});ir.newInstance=()=>zu({});var Ev=ir;ir.HighlightJS=ir;ir.default=ir;const $e=Oy(Ev),Us="[A-Za-z$_][0-9A-Za-z$_]*",Ju=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Yu=["true","false","null","undefined","NaN","Infinity"],Zu=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Xu=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Qu=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],eh=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],th=[].concat(Qu,Zu,Xu);function Sv(e){const t=e.regex,n=(B,{after:re})=>{const he="</"+B[0].slice(1);return B.input.indexOf(he,re)!==-1},r=Us,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,re)=>{const he=B[0].length+B.index,be=B.input[he];if(be==="<"||be===","){re.ignoreMatch();return}be===">"&&(n(B,{after:he})||re.ignoreMatch());let ye;const Ke=B.input.substring(he);if(ye=Ke.match(/^\s*=/)){re.ignoreMatch();return}if((ye=Ke.match(/^\s+extends\s+/))&&ye.index===0){re.ignoreMatch();return}}},a={$pattern:Us,keyword:Ju,literal:Yu,built_in:th,"variable.language":eh},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(y,d.contains),C=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),$={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},U={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Zu,...Xu]}},S={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[$],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(B){return t.concat("(?!",B.join("|"),")")}const ue={match:t.concat(/\b/,H([...Qu,"super","import"].map(B=>`${B}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},me={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ne={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},$]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[$]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),S,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,y,{match:/\$\d+/},h,U,{scope:"attr",match:r+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[$,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[$]},ue,ae,N,Ne,{match:/\$[(.]/}]}}function nh(e){const t=e.regex,n=Sv(e),r=Us,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Us,keyword:Ju.concat(l),literal:Yu,built_in:th.concat(s),"variable.language":eh},u={className:"meta",begin:"@"+r},h=(m,E,v)=>{const y=m.contains.findIndex(w=>w.label===E);if(y===-1)throw new Error("can not find mode to replace");m.contains.splice(y,1,v)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const d=n.contains.find(m=>m.scope==="attr"),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([u,i,o,f]),h(n,"shebang",e.SHEBANG()),h(n,"use_strict",a);const p=n.contains.find(m=>m.label==="func.def");return p.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const Pl="[A-Za-z$_][0-9A-Za-z$_]*",kv=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],Av=["true","false","null","undefined","NaN","Infinity"],rh=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],sh=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],ih=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Tv=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],xv=[].concat(ih,rh,sh);function oh(e){const t=e.regex,n=(B,{after:re})=>{const he="</"+B[0].slice(1);return B.input.indexOf(he,re)!==-1},r=Pl,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(B,re)=>{const he=B[0].length+B.index,be=B.input[he];if(be==="<"||be===","){re.ignoreMatch();return}be===">"&&(n(B,{after:he})||re.ignoreMatch());let ye;const Ke=B.input.substring(he);if(ye=Ke.match(/^\s*=/)){re.ignoreMatch();return}if((ye=Ke.match(/^\s+extends\s+/))&&ye.index===0){re.ignoreMatch();return}}},a={$pattern:Pl,keyword:kv,literal:Av,built_in:xv,"variable.language":Tv},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",h={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},m={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},w=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,{match:/\$\d+/},h];d.contains=w.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(w)});const k=[].concat(y,d.contains),C=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),$={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C},N={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},U={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...rh,...sh]}},S={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},X={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[$],illegal:/%/},ae={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function H(B){return t.concat("(?!",B.join("|"),")")}const ue={match:t.concat(/\b/,H([...ih,"super","import"].map(B=>`${B}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},me={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},Ne={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},$]},x="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",j={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(x)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[$]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:U},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),S,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,f,p,m,E,y,{match:/\$\d+/},h,U,{scope:"attr",match:r+t.lookahead(":"),relevance:0},j,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:x,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},X,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[$,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},me,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[$]},ue,ae,N,Ne,{match:/\$[(.]/}]}}function ah(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},h={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",f=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,p=`\\b|${r.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${f}))[eE][+-]?(${d})[jJ]?(?=${p})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${p})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${p})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${p})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${p})`},{begin:`\\b(${d})[jJ](?=${p})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},v={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,m,h,e.HASH_COMMENT_MODE]}]};return c.contains=[h,m,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},h,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[v]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,v,h]}]}}function lh(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},h={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],v={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],w=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],C=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:E,built_in:[...y,...w,"set","shopt",...k,...C]},contains:[f,e.SHEBANG(),p,h,i,o,v,a,l,c,u,n]}}function Rv(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const Ov=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Cv=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Nv=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Iv=[...Cv,...Nv],Pv=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Lv=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),$v=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Mv=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function jv(e){const t=e.regex,n=Ov(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+Lv.join("|")+")"},{begin:":(:)?("+$v.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Mv.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:Pv.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Iv.join("|")+")\\b"}]}}function ch(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Dv(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],h=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,p=[...c,...l].filter(C=>!u.includes(C)),m={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},v={match:t.concat(/\b/,t.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function y(C){return t.concat(/\b/,t.either(...C.map($=>$.replace(/\s+/,"\\s+"))),/\b/)}const w={scope:"keyword",match:y(d),relevance:0};function k(C,{exceptions:$,when:N}={}){const U=N;return $=$||[],C.map(S=>S.match(/\|\d+$/)||$.includes(S)?S:U(S)?`${S}|0`:S)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(p,{when:C=>C.length<3}),literal:i,type:a,built_in:h},contains:[{scope:"type",match:y(o)},w,v,m,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function uh(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},p={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},m={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},E=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},p,m,i,o],v=[...E];return v.pop(),v.push(a),f.contains=v,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}function hh(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},h=e.inherit(c,{contains:[]}),d=e.inherit(u,{contains:[]});c.contains.push(d),u.contains.push(h);let f=[n,l];return[c,u,h,d].forEach(v=>{v.contains=v.contains.concat(f)}),f=f.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}$e.registerLanguage("typescript",nh);$e.registerLanguage("ts",nh);$e.registerLanguage("javascript",oh);$e.registerLanguage("js",oh);$e.registerLanguage("python",ah);$e.registerLanguage("py",ah);$e.registerLanguage("bash",lh);$e.registerLanguage("sh",lh);$e.registerLanguage("json",Rv);$e.registerLanguage("css",jv);$e.registerLanguage("html",ch);$e.registerLanguage("xml",ch);$e.registerLanguage("sql",Dv);$e.registerLanguage("yaml",uh);$e.registerLanguage("yml",uh);$e.registerLanguage("markdown",hh);$e.registerLanguage("md",hh);function Uv(e){if(/&(lt|gt|amp|quot|apos|#);/.test(e)){const t=e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&apos;/g,"'");if(/<[a-z]/i.test(t))return t}return e}function bt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\*\*\*(.*?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>").replace(/\*(.*?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,'<code class="bg-gray-800 px-1 rounded text-blue-300 font-mono text-xs">$1</code>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,(t,n,r)=>`<a href="${/^https?:\/\//i.test(r)||r.startsWith("/")||r.startsWith("#")?r:"#"}" target="_blank" rel="noopener" class="text-blue-400 hover:underline">${n}</a>`)}function dh(e){const t=e.trim();return t.startsWith("|")&&t.endsWith("|")&&t.length>2}function Ll(e){return dh(e)&&/^\|[\s|:\-]+\|$/.test(e.trim())}function Pi(e){return e.trim().slice(1,-1).split("|").map(t=>t.trim())}function Bv(e){const t=e.trim();return t.startsWith(":")&&t.endsWith(":")?"text-center":t.endsWith(":")?"text-right":"text-left"}function Hv(e){if(e.length<2)return e.map(a=>`<p class="my-1">${bt(a)}</p>`).join(`
76
- `);const t=Pi(e[0]),n=e[1],r=Ll(n)?Pi(n).map(Bv):t.map(()=>"text-left"),s=Ll(n)?e.slice(2):e.slice(1),i=t.map((a,l)=>`<th class="px-3 py-1.5 font-medium text-gray-300 ${r[l]??"text-left"}">${bt(a)}</th>`).join(""),o=s.map(a=>{const l=Pi(a);return`<tr class="border-b border-gray-800">${t.map((u,h)=>`<td class="px-3 py-1.5 text-gray-400 ${r[h]??"text-left"}">${bt(l[h]??"")}</td>`).join("")}</tr>`}).join("");return`<div class="overflow-x-auto my-2"><table class="border-collapse w-full text-sm"><thead><tr class="border-b border-gray-700">${i}</tr></thead><tbody>${o}</tbody></table></div>`}function fh(e){if(!e)return"";e=Uv(e);const t=e.split(`
77
- `),n=[];let r=!1,s=null,i=!1,o=!1,a=[],l="",c=[];function u(){s&&(n.push(`</${s}>`),s=null)}function h(){o&&(n.push(Hv(c)),c=[],o=!1)}function d(){i&&(n.push("</blockquote>"),i=!1)}for(const f of t){if(f.startsWith("```")){if(u(),h(),!r)r=!0,l=f.slice(3).trim().split(/\s+/)[0].toLowerCase(),a=[];else{const C=a.join(`
78
- `);let $;try{$=l&&$e.getLanguage(l)?$e.highlight(C,{language:l,ignoreIllegals:!0}).value:$e.highlightAuto(C).value}catch{$=C.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const N=l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),U=N?`<span class="text-[10px] text-txt-muted font-mono absolute top-2 right-3 select-none">${N}</span>`:"";n.push(`<div class="relative my-2"><pre class="bg-surface-1 border border-edge rounded-xl p-3 overflow-x-auto"><code class="hljs font-mono text-xs">${$}</code></pre>${U}</div>`),r=!1,l="",a=[]}continue}if(r){a.push(f);continue}if(dh(f)){u(),o=!0,c.push(f);continue}o&&h();const p=f.match(/^####\s+(.+)/),m=f.match(/^###\s+(.+)/),E=f.match(/^##\s+(.+)/),v=f.match(/^#\s+(.+)/);if(p){u(),d(),n.push(`<h4 class="text-sm font-semibold text-gray-200 mt-4 mb-1">${bt(p[1])}</h4>`);continue}if(m){u(),d(),n.push(`<h3 class="text-base font-semibold text-gray-100 mt-5 mb-2">${bt(m[1])}</h3>`);continue}if(E){u(),d(),n.push(`<h2 class="text-lg font-bold text-gray-100 mt-6 mb-2 pb-1 border-b border-gray-800">${bt(E[1])}</h2>`);continue}if(v){u(),d(),n.push(`<h1 class="text-xl font-bold text-gray-100 mt-6 mb-3">${bt(v[1])}</h1>`);continue}if(/^---+$/.test(f.trim())){u(),d(),n.push('<hr class="border-gray-800 my-4" />');continue}const y=f.match(/^[-*+]\s+(.+)/);if(y){s==="ol"&&u(),d(),s||(n.push('<ul class="list-disc list-inside my-2 space-y-1 pl-2">'),s="ul"),n.push(`<li>${bt(y[1])}</li>`);continue}const w=f.match(/^\d+\.\s+(.+)/);if(w){s==="ul"&&u(),d(),s||(n.push('<ol class="list-decimal list-inside my-2 space-y-1 pl-2">'),s="ol"),n.push(`<li>${bt(w[1])}</li>`);continue}const k=f.match(/^>\s?(.*)/);if(k){u(),i||(n.push('<blockquote class="border-l-2 border-txt-muted pl-3 my-2 text-txt-muted italic">'),i=!0),n.push(`<p class="my-0">${bt(k[1])}</p>`);continue}if(f.trim()===""){u(),d(),n.push('<div class="my-2"></div>');continue}u(),d(),n.push(`<p class="my-1">${bt(f)}</p>`)}if(r&&a.length){const f=a.join(`
79
- `).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");n.push(`<pre class="bg-gray-900 border border-gray-800 rounded p-3 my-2 overflow-x-auto"><code class="font-mono text-xs text-green-300">${f}</code></pre>`)}return h(),u(),d(),n.join(`
80
- `)}function hw(e){const t=(e??"").toLowerCase();return["error","failed","failure","cancelled","aborted"].some(n=>t.includes(n))?"error":["success","completed","done","healthy"].some(n=>t.includes(n))?"success":["working","running","active","queued","pending","in_progress","processing"].some(n=>t.includes(n))?"working":"idle"}function dw(e){const t=(e??"").toLowerCase();return["failed","error","aborted","cancelled"].some(n=>t.includes(n))?"failed":["success","completed","merged"].some(n=>t.includes(n))?"success":["pause","idle"].some(n=>t.includes(n))?"paused":"running"}function fw(e){switch(e){case"failed":return"#ff3864";case"success":return"#5fff87";case"paused":return"#8a8a99";default:return"#00d9ff"}}function Fv(e,t){const n=e.replace("#","");if(n.length!==6)return e;const r=Number.parseInt(n.slice(0,2),16),s=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return`rgba(${r}, ${s}, ${i}, ${t})`}function ph(e){return(e??"io").replace(/[_/]+/g," ").replace(/-/g," ").replace(/\.[^.]+$/,"").replace(/\w/g,t=>t.toUpperCase())}function gh(e){if(!e)return"just now";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=t.getTime()-Date.now(),r=n<=0,s=Math.abs(n),i=6e4,o=60*i,a=24*o;let l=0,c="m";return s<o?(l=Math.max(1,Math.round(s/i)),c="m"):s<a?(l=Math.round(s/o),c="h"):(l=Math.round(s/a),c="d"),r?`${l}${c} ago`:`in ${l}${c}`}function pw(e,t){const n=`${e} ${t??""}`.toLowerCase();return/(read|write|edit|glob|file|path|fs)/.test(n)?"File System":/(grep|search|code|analy|lint|semantic|test|debug)/.test(n)?"Code Intelligence":/(git|branch|commit|pr|issue|ci|build|release)/.test(n)?"Git & CI":"Communication"}function gw(e){const t=[];for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t,i="";for(const[o,a]of r.entries()){i=i?`${i}/${a}`:a;let l=s.find(c=>c.id===i);l||(l={id:i,label:o===r.length-1?n.title:ph(a),path:o===r.length-1?n.path:void 0,children:[]},s.push(l)),s=l.children}}return t}function mw(e,t){return e.some(n=>n.status==="error")?"error":e.some(n=>n.status==="working")?"working":e.some(n=>n.status==="success")?"success":((t==null?void 0:t.instances_active)??0)>0?"working":"idle"}const qv={key:0,class:"fixed inset-y-0 right-0 z-50 flex w-full flex-col border-l border-border bg-gray-950 md:w-[420px]"},Kv={class:"flex shrink-0 items-center justify-between border-b border-border px-5 py-4"},Wv={class:"flex items-center gap-2"},Vv={key:0,class:"rounded-full bg-destructive px-1.5 py-0.5 font-mono text-[9px] font-bold text-white"},Gv={class:"flex-1 overflow-y-auto"},zv={key:0,class:"px-5 py-8 font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground/50"},Jv={key:1,class:"px-5 py-8 font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground/50"},Yv={key:2},Zv={class:"sticky top-0 z-10 border-b border-border/40 bg-gray-950 px-5 py-2 backdrop-blur"},Xv=["onClick"],Qv={class:"flex items-start gap-3"},e_={class:"mt-1.5 shrink-0"},t_={key:0,class:"h-1.5 w-1.5 rounded-full bg-primary",style:{boxShadow:"var(--glow-cyan)"}},n_={key:1,class:"h-1.5 w-1.5"},r_={class:"min-w-0 flex-1"},s_={class:"flex items-start justify-between gap-1"},i_={class:"text-xs font-medium leading-tight text-foreground"},o_={class:"shrink-0 font-mono text-[9px] text-muted-foreground/40"},a_={key:0,class:"mt-1 max-w-xs text-[11px] leading-relaxed text-foreground/50"},l_={key:0,class:"mt-2 rounded border border-white/[0.06] bg-white/[0.03] p-3"},c_=["innerHTML"],u_=fn({__name:"FeedFlyout",props:{open:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,s=ve([]),i=ve({}),o=ve(null),a=ve(!1),l=qe(()=>{var d;const h=new Map;for(const f of s.value){const p=f.squad_slug??"io",m=i.value[p];h.has(p)||h.set(p,{key:p,label:(m==null?void 0:m.name)??ph(p),color:(m==null?void 0:m.color)??"#8a8a99",entries:[]}),(d=h.get(p))==null||d.entries.push(f)}return[...h.values()]});async function c(){a.value=!0;try{const[h,d]=await Promise.all([ct("/api/feed?limit=80"),ct("/api/squads")]);if(h.ok&&(s.value=(await h.json()).entries),d.ok){const f=await d.json();i.value=Object.fromEntries(f.squads.map(p=>[p.slug??p.id??p.name.toLowerCase(),{name:p.name,universe:p.universe,color:p.color??"#8a8a99"}]))}}finally{a.value=!1}}async function u(h){o.value=o.value===h.id?null:h.id,h.read_at||(await ct(`/api/feed/${h.id}/read`,{method:"POST"}).catch(()=>null),h.read_at=new Date().toISOString())}return un(()=>n.open,h=>{h?c():o.value=null}),(h,d)=>(K(),nr(bd,{to:"body"},[le(Sr,{"enter-active-class":"duration-200 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:Mt(()=>[e.open?(K(),G("div",{key:0,class:"fixed inset-0 z-40 bg-black/40",onClick:d[0]||(d[0]=f=>r("close"))})):Fe("",!0)]),_:1}),le(Sr,{"enter-active-class":"transition-transform duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]","enter-from-class":"translate-x-full","enter-to-class":"translate-x-0","leave-active-class":"transition-transform duration-200 ease-in","leave-from-class":"translate-x-0","leave-to-class":"translate-x-full"},{default:Mt(()=>[e.open?(K(),G("aside",qv,[P("div",Kv,[P("div",Wv,[le(De,{name:"message",class:"h-4 w-4 text-primary"}),d[2]||(d[2]=P("span",{class:"text-sm font-semibold"},"Activity Feed",-1)),s.value.filter(f=>!f.read_at).length?(K(),G("span",Vv,Te(s.value.filter(f=>!f.read_at).length),1)):Fe("",!0)]),P("button",{class:"flex h-7 w-7 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-white/5 hover:text-foreground",onClick:d[1]||(d[1]=f=>r("close"))},[le(De,{name:"x",class:"h-4 w-4"})])]),P("div",Gv,[a.value?(K(),G("div",zv,"Syncing feed…")):l.value.length?(K(),G("div",Yv,[(K(!0),G(de,null,zt(l.value,f=>(K(),G("section",{key:f.key,class:"border-b border-border/40 last:border-b-0"},[P("div",Zv,[P("span",{class:"rounded px-1.5 py-0.5 font-mono text-[10px]",style:zs({color:f.color,backgroundColor:ze(Fv)(f.color,.15)})},Te(f.label),5)]),P("div",null,[(K(!0),G(de,null,zt(f.entries,p=>(K(),G("article",{key:p.id,class:vt(["cursor-pointer px-5 py-3.5 transition-colors hover:bg-white/[0.02]",p.read_at?"":"bg-white/[0.015]"]),onClick:m=>u(p)},[P("div",Qv,[P("div",e_,[p.read_at?(K(),G("div",n_)):(K(),G("div",t_))]),P("div",r_,[P("div",s_,[P("h4",i_,Te(p.title),1),P("span",o_,Te(ze(gh)(p.created_at)),1)]),p.body?(K(),G("div",a_,Te(p.body.slice(0,200)),1)):Fe("",!0)])]),le(Sr,{"enter-active-class":"duration-150 ease-out","enter-from-class":"opacity-0 -translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"duration-100 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-1"},{default:Mt(()=>[o.value===p.id&&p.body?(K(),G("div",l_,[P("div",{class:"wiki-content text-xs",innerHTML:ze(fh)(p.body)},null,8,c_)])):Fe("",!0)]),_:2},1024)],10,Xv))),128))])]))),128))])):(K(),G("div",Jv,"No feed activity."))])])):Fe("",!0)]),_:1})]))}}),h_=tu("chat",()=>{const e=ve([]),t=ve(!1);let n=null,r=null;function s(d){return e.value.length?d?e.value.find(f=>f.id===d)??null:e.value[e.value.length-1]??null:null}function i(d){const f={id:d.id??crypto.randomUUID(),createdAt:d.createdAt??new Date().toISOString(),streaming:d.streaming??!1,role:d.role,text:d.text,kind:d.kind};return e.value.push(f),f}function o(d,f){const p=s(f??r??void 0);p&&(p.text+=d)}function a(d,f){const p=s(f??r??void 0);p&&(p.streaming=d)}function l(){n==null||n.close(),n=null,r=null,t.value=!1}async function c(d,f=[]){const p=d.trim();if(!p)return;l(),i({role:"user",text:p});const m=i({role:"assistant",text:"",streaming:!0});r=m.id,t.value=!0;const E=await gy("/api/events");n=new EventSource(E),n.onmessage=y=>{try{const w=JSON.parse(y.data);if(w.type==="delta"){o(String(w.text??""),m.id);return}if(w.type==="done"){a(!1,m.id),l();return}w.type==="feed"&&i({role:"system",kind:"feed",text:[w.title,w.body].filter(Boolean).join(`
81
- `)||JSON.stringify(w,null,2)})}catch{o(y.data,m.id)}},n.onerror=()=>{m.text||(m.text="stream disconnected"),a(!1,m.id),l()};const v=await ct("/api/message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:p,attachments:f})});if(!v.ok){const y=await v.text();m.text=y||`Request failed (${v.status})`,a(!1,m.id),l()}}async function u(){await ct("/api/orchestrator/abort",{method:"POST"}).catch(()=>null),a(!1),l()}function h(){l(),e.value=[]}return{messages:e,isLoading:t,addMessage:i,appendToLast:o,setLastStreaming:a,sendMessage:c,abortRun:u,clearMessages:h}}),d_={class:"fixed bottom-14 right-0 z-50 flex w-full flex-col md:bottom-10 md:right-4 md:w-[360px]"},f_={key:0,class:"flex h-[380px] flex-col overflow-hidden rounded-t-xl border border-border border-b-0 bg-sidebar"},p_={class:"flex shrink-0 items-center justify-between border-b border-border/50 px-4 py-2.5"},g_={class:"flex items-center gap-2"},m_={key:0,class:"whitespace-pre-wrap"},b_=["innerHTML"],y_={key:2,class:"mt-2 space-y-1"},v_=["src","alt"],__=["href","download"],w_={key:0,class:"flex-shrink-0 border-t border-border/50 px-3 py-2"},E_={class:"flex gap-2 overflow-x-auto"},S_=["src","alt"],k_={key:1,class:"flex h-12 w-12 items-center justify-center rounded border border-border bg-card text-[8px] text-foreground/50"},A_={class:"text-center"},T_=["onClick"],x_={type:"submit",class:"flex shrink-0 items-center gap-1 rounded bg-primary/15 px-2.5 py-1 font-mono text-xs text-primary transition-colors hover:bg-primary/25"},R_=5*1024*1024,O_=fn({__name:"FloatingChat",setup(e,{expose:t}){const n=h_(),r=ve(""),s=ve(!1),i=ve(null),o=ve(null),a=ve(null),l=ve([]),c=ve([]),u=["image/jpeg","image/png","image/gif","image/webp","application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],h=qe(()=>n.messages.length?n.messages:[{id:"welcome",role:"assistant",text:"IO online. What do you need?",createdAt:new Date().toISOString(),streaming:!1}]),d=qe(()=>h.value.map(C=>`${C.id}:${C.text.length}:${C.streaming}`).join("|"));function f(){a.value&&(a.value.scrollTop=a.value.scrollHeight)}async function p(C){const $=C.target,N=Array.from($.files||[]),U=[];for(const S of N){if(S.size>R_){U.push(`${S.name} exceeds 5MB limit`);continue}if(!u.includes(S.type)&&!S.name.match(/\.(pdf|doc|docx|txt|jpg|jpeg|png|gif|webp)$/i)){U.push(`${S.name} has unsupported file type`);continue}if(l.value.push(S),S.type.startsWith("image/")){const X=new FileReader;X.onload=ae=>{var H;c.value.push({file:S,preview:(H=ae.target)==null?void 0:H.result})},X.readAsDataURL(S)}else c.value.push({file:S,preview:null})}U.length>0&&console.warn("File validation errors:",U),$.value=""}function m(C){l.value.splice(C,1),c.value.splice(C,1)}async function E(){const C=[];for(const $ of l.value){const N=new FileReader,U=await new Promise((S,X)=>{N.onload=ae=>{var H;return S((H=ae.target)==null?void 0:H.result)},N.onerror=X,N.readAsDataURL($)});C.push({type:"blob",data:U,mimeType:$.type,displayName:$.name})}return C}async function v(){const C=r.value.trim(),$=l.value.length>0;if(!C&&!$)return;r.value="";const N=await E();l.value=[],c.value=[],await n.sendMessage(C,N)}function y(){var C;(C=o.value)==null||C.click()}function w(){s.value=!0}function k(){s.value=!1}return un(s,async C=>{var $;C&&(await tr(),($=i.value)==null||$.focus(),f())}),un(d,async()=>{s.value&&(await tr(),f())}),t({open:w,isOpen:s}),(C,$)=>(K(),G("div",d_,[le(Sr,{"enter-active-class":"duration-200 ease-out","enter-from-class":"translate-y-2 scale-[0.97] opacity-0","enter-to-class":"translate-y-0 scale-100 opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"translate-y-0 scale-100 opacity-100","leave-to-class":"translate-y-2 scale-[0.97] opacity-0"},{default:Mt(()=>[s.value?(K(),G("div",f_,[P("div",p_,[P("div",g_,[le(De,{name:"terminal",class:"h-3.5 w-3.5 text-primary"}),$[1]||($[1]=P("span",{class:"font-mono text-xs text-foreground/70"},"IO Command",-1))]),P("button",{class:"text-muted-foreground/40 transition-colors hover:text-muted-foreground",onClick:k},[le(De,{name:"chevron-down",class:"h-4 w-4"})])]),P("div",{ref_key:"scrollPanel",ref:a,class:"flex-1 space-y-2.5 overflow-y-auto px-4 py-3"},[(K(!0),G(de,null,zt(h.value,N=>(K(),G("div",{key:N.id,class:vt(["flex",N.role==="user"?"justify-end":"justify-start"])},[P("div",{class:vt(["max-w-[85%] rounded-lg px-3 py-2 text-xs leading-relaxed",N.role==="user"?"rounded-br-sm border border-primary/20 bg-primary/15 font-mono text-primary":"rounded-bl-sm border border-white/[0.06] bg-white/[0.04] text-foreground/75"])},[N.role==="user"?(K(),G("div",m_,Te(N.text),1)):(K(),G("div",{key:1,class:"wiki-content text-xs",innerHTML:ze(fh)(N.text||(N.streaming?"…":""))},null,8,b_)),N.attachments&&N.attachments.length>0?(K(),G("div",y_,[(K(!0),G(de,null,zt(N.attachments,(U,S)=>(K(),G("div",{key:`${N.id}-${S}`},[U.type==="image"?(K(),G("img",{key:0,src:U.data,alt:U.displayName,class:"max-w-full max-h-32 rounded border border-border/50"},null,8,v_)):(K(),G("a",{key:1,class:"flex items-center gap-1 text-[10px] text-primary hover:underline",href:U.data,download:U.displayName},[le(De,{name:"zap",class:"h-2.5 w-2.5"}),P("span",null,Te(U.displayName),1)],8,__))]))),128))])):Fe("",!0)],2)],2))),128))],512),c.value.length>0?(K(),G("div",w_,[P("div",E_,[(K(!0),G(de,null,zt(c.value,(N,U)=>{var S;return K(),G("div",{key:`preview-${U}`,class:"relative shrink-0"},[N.preview?(K(),G("img",{key:0,src:N.preview,alt:N.file.name,class:"h-12 w-12 rounded border border-border object-cover"},null,8,S_)):(K(),G("div",k_,[P("span",A_,Te((S=N.file.name.split(".").pop())==null?void 0:S.toUpperCase()),1)])),P("button",{class:"absolute -right-1 -top-1 rounded-full bg-destructive p-0.5 text-white transition-colors hover:bg-destructive/80",onClick:X=>m(U)},[le(De,{name:"x",class:"h-2.5 w-2.5"})],8,T_)])}),128))])])):Fe("",!0)])):Fe("",!0)]),_:1}),P("div",{class:vt(["overflow-hidden border border-border bg-sidebar",s.value?"rounded-b-xl border-t-0":"rounded-xl"])},[P("input",{ref_key:"fileInputRef",ref:o,type:"file",multiple:"",accept:"image/*,.pdf,.doc,.docx,.txt",class:"hidden",onChange:p},null,544),s.value?(K(),G("form",{key:0,class:"flex items-center gap-2 border-t border-border/50 px-3 py-2.5",onSubmit:Xf(v,["prevent"])},[P("button",{type:"button",class:"flex shrink-0 items-center rounded border border-border/50 px-2 py-1.5 text-muted-foreground/50 transition-colors hover:border-primary/50 hover:text-primary",onClick:y},[le(De,{name:"zap",class:"h-3.5 w-3.5"})]),cd(P("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":$[0]||($[0]=N=>r.value=N),type:"text",placeholder:"Command IO...",class:"flex-1 bg-transparent font-mono text-sm text-foreground placeholder:text-muted-foreground/40"},null,512),[[Jf,r.value]]),P("button",x_,[le(De,{name:"zap",class:"h-3 w-3"}),$[2]||($[2]=Vc(" send ",-1))])],32)):(K(),G("button",{key:1,class:"flex w-full items-center gap-2.5 px-4 py-3 text-left transition-colors hover:bg-white/[0.03]",onClick:w},[le(De,{name:"terminal",class:"h-4 w-4 text-primary",style:{filter:"drop-shadow(0 0 6px #00d9ff88)"}}),$[3]||($[3]=P("span",{class:"flex-1 font-mono text-sm text-muted-foreground/60"},"Command IO...",-1)),le(De,{name:"chevron-up",class:"h-4 w-4 text-muted-foreground/30"})]))],2)]))}}),C_={class:"fixed inset-x-0 bottom-0 z-30 flex items-center justify-around border-t border-border bg-sidebar px-2 pb-[env(safe-area-inset-bottom)] pt-1 md:hidden"},N_={key:0,class:"absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-destructive px-0.5 font-mono text-[8px] font-bold leading-none text-white"},I_={class:"font-mono text-[10px]"},P_={key:1,class:"absolute bottom-0 left-1/2 h-0.5 w-6 -translate-x-1/2 rounded-full bg-primary"},L_=fn({__name:"MobileNav",setup(e){const t=Io(),n=ve(0),r=ve(0);let s=0;const i=[{to:"/squads",label:"Squads",icon:"grid"},{to:"/chat",label:"Chat",icon:"terminal"},{to:"/activity",label:"Activity",icon:"activity"},{to:"/feed",label:"Feed",icon:"message",badge:"feed"},{to:"/wiki",label:"Wiki",icon:"book"},{to:"/skills",label:"Settings",icon:"settings",match:["/skills","/mcp"]}];function o(c){return(c.match??[c.to]).some(h=>t.path.startsWith(h))}function a(c){return c.badge==="feed"?n.value:c.badge==="inbox"?r.value:0}async function l(){try{const[c,u]=await Promise.all([ct("/api/feed/count"),ct("/api/inbox/count")]);c.ok&&(n.value=Number((await c.json()).count??0)),u.ok&&(r.value=Number((await u.json()).count??0))}catch{}}return Xr(()=>{l(),s=window.setInterval(l,15e3)}),Qr(()=>{window.clearInterval(s)}),(c,u)=>(K(),G("nav",C_,[(K(),G(de,null,zt(i,h=>le(ze(Tr),{key:h.to,to:h.to,class:vt(["relative flex flex-col items-center gap-0.5 rounded-lg px-3 py-1.5 transition-colors",o(h)?"text-primary":"text-muted-foreground/50"])},{default:Mt(()=>[a(h)>0?(K(),G("span",N_,Te(a(h)),1)):Fe("",!0),le(De,{name:h.icon,class:"h-5 w-5"},null,8,["name"]),P("span",I_,Te(h.label),1),o(h)?(K(),G("div",P_)):Fe("",!0)]),_:2},1032,["to","class"])),64))]))}}),$_={class:"dark flex h-full flex-col overflow-hidden bg-background text-foreground"},M_={class:"flex shrink-0 items-center justify-between border-b border-border bg-sidebar px-4 py-3 md:px-5"},j_={class:"flex items-center gap-2"},D_={key:0,class:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-destructive font-mono text-[9px] font-bold text-white"},U_=["disabled"],B_={class:"text-xs font-medium"},H_={key:0,class:"shrink-0 border-b border-destructive/50 bg-destructive/10 px-5 py-3"},F_={class:"flex items-center justify-between gap-3"},q_={class:"text-sm text-destructive"},K_={class:"flex min-h-0 flex-1 overflow-hidden"},W_={class:"flex min-w-0 flex-1 flex-col overflow-hidden"},V_={class:"min-h-0 flex-1 overflow-hidden pb-[calc(env(safe-area-inset-bottom)+3.5rem)] md:pb-0"},G_={class:"hidden shrink-0 border-t border-border bg-sidebar px-5 py-2 md:block"},z_={class:"flex items-center justify-between font-mono text-[11px]"},J_={class:"flex items-center gap-4"},Y_={class:"flex items-center gap-1.5"},Z_={class:"text-muted-foreground"},X_={class:"text-accent-foreground"},Q_={class:"flex items-center gap-4"},ew={key:0,class:"flex items-center gap-1.5 text-primary"},tw={class:"text-muted-foreground/40"},nw={key:1,class:"h-full"},rw=fn({__name:"App",setup(e){const t=Io(),n=ui(),r=ve(null),s=ve(!1),i=ve(0),o=ve(null),a=ve(""),l=ve(!1),c=ve({squads:0,agents:0,instances:0,runningInstances:0,working:0});let u=0;const h=qe(()=>t.name!=="login"&&n.isAuthenticated),d=qe(()=>gh(o.value));function f(){var v;(v=r.value)==null||v.open()}function p(v){(v.metaKey||v.ctrlKey)&&v.key==="."&&(v.preventDefault(),f())}async function m(){l.value=!0,a.value="";try{const v=await n.logout();v.success||(a.value=v.error||"Logout failed",l.value=!1)}catch(v){a.value=v instanceof Error?v.message:"Logout failed",l.value=!1}}async function E(){try{const[v,y,w]=await Promise.all([ct("/api/feed/count"),ct("/api/squads"),ct("/api/tasks")]);if(v.ok&&(i.value=Number((await v.json()).count??0)),y.ok){const k=await y.json();c.value.squads=k.squads.length,c.value.agents=k.squads.reduce((C,$)=>C+Number($.agents_count??0),0),c.value.instances=k.squads.reduce((C,$)=>C+Number($.instances_total??0),0),c.value.runningInstances=k.squads.reduce((C,$)=>C+Number($.instances_active??0),0)}if(w.ok){const k=await w.json();c.value.working=k.tasks.filter(C=>/running|working|queued|pending|in_progress/i.test(C.status)).length}o.value=new Date().toISOString()}catch{}}return Xr(()=>{n.init(),E(),u=window.setInterval(E,3e4),window.addEventListener("keydown",p)}),Qr(()=>{window.clearInterval(u),window.removeEventListener("keydown",p)}),(v,y)=>(K(),G("div",$_,[h.value?(K(),G(de,{key:0},[P("div",M_,[y[4]||(y[4]=P("div",{class:"flex items-center gap-3 md:gap-4"},[P("div",{class:"select-none font-mono text-xl font-bold tracking-tight text-primary text-glow-cyan"},"IO"),P("div",{class:"hidden h-4 w-px bg-border md:block"}),P("div",{class:"hidden font-mono text-xs text-muted-foreground md:block"},"Mission Control · Developer AI Assistant")],-1)),P("div",j_,[P("button",{class:"relative flex items-center gap-2 rounded border border-border px-3 py-1.5 text-sm text-muted-foreground transition-all hover:border-primary/40 hover:bg-primary/5 hover:text-foreground",onClick:y[0]||(y[0]=w=>s.value=!0)},[le(De,{name:"message",class:"h-4 w-4"}),y[3]||(y[3]=P("span",{class:"text-xs font-medium"},"Feed",-1)),i.value>0?(K(),G("span",D_,Te(i.value),1)):Fe("",!0)]),P("button",{class:"flex items-center gap-2 rounded border border-border px-3 py-1.5 text-sm text-muted-foreground transition-all hover:border-destructive/40 hover:bg-destructive/5 hover:text-destructive disabled:opacity-50",disabled:l.value,onClick:m,title:"Sign out"},[le(De,{name:"log-out",class:"h-4 w-4"}),P("span",B_,Te(l.value?"Signing out...":"Sign Out"),1)],8,U_)])]),le(Sr,{"enter-active-class":"duration-200 ease-out","enter-from-class":"translate-y-0 opacity-0","enter-to-class":"translate-y-1 opacity-100","leave-active-class":"duration-150 ease-in","leave-from-class":"translate-y-1 opacity-100","leave-to-class":"translate-y-0 opacity-0"},{default:Mt(()=>[a.value?(K(),G("div",H_,[P("div",F_,[P("span",q_,Te(a.value),1),P("button",{class:"text-destructive/50 hover:text-destructive",onClick:y[1]||(y[1]=w=>a.value="")},[le(De,{name:"x",class:"h-4 w-4"})])])])):Fe("",!0)]),_:1}),P("div",K_,[le(Ry),P("div",W_,[P("div",V_,[le(ze(Qi))])])]),P("div",G_,[P("div",z_,[P("div",J_,[P("div",Y_,[le(De,{name:"circle",class:"h-2 w-2 text-status-success"}),y[5]||(y[5]=P("span",{class:"text-muted-foreground"},"Daemon running",-1))]),y[6]||(y[6]=P("span",{class:"text-muted-foreground/40"},"·",-1)),P("span",Z_,Te(c.value.squads)+" squads · "+Te(c.value.agents)+" agents",1),y[7]||(y[7]=P("span",{class:"text-muted-foreground/40"},"·",-1)),P("span",X_,Te(c.value.runningInstances)+"/"+Te(c.value.instances)+" instances active",1)]),P("div",Q_,[c.value.working>0?(K(),G("div",ew,[le(De,{name:"activity",class:"h-3 w-3"}),P("span",null,Te(c.value.working)+" working",1)])):Fe("",!0),P("span",tw,"Last sync: "+Te(d.value),1)])])]),le(u_,{open:s.value,onClose:y[2]||(y[2]=w=>s.value=!1)},null,8,["open"]),le(O_,{ref_key:"floatingChat",ref:r},null,512),le(L_)],64)):(K(),G("div",nw,[le(ze(Qi))]))]))}}),sw="modulepreload",iw=function(e){return"/"+e},$l={},xt=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(l=>{if(l=iw(l),l in $l)return;$l[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":sw,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})},mh=pg({history:zp(),routes:[{path:"/",redirect:"/chat"},{path:"/login",name:"login",component:()=>xt(()=>import("./LoginView-refmPLKT.js"),[]),meta:{title:"Login",subtitle:"Authenticate against Supabase",public:!0}},{path:"/chat",name:"chat",component:()=>xt(()=>import("./ChatView-BbpWnrtC.js"),[]),meta:{title:"Chat",subtitle:"Live orchestrator stream"}},{path:"/squads",name:"squads",component:()=>xt(()=>import("./SquadsView-B1nZW4ml.js"),__vite__mapDeps([0,1])),meta:{title:"Squads",subtitle:"Project crews and worktrees"}},{path:"/activity",name:"activity",component:()=>xt(()=>import("./AgentActivityView-B1PaNYy8.js"),__vite__mapDeps([2,1])),meta:{title:"Activity",subtitle:"Task execution and event stream"}},{path:"/schedules",name:"schedules",component:()=>xt(()=>import("./SchedulesView-D9l2DI7X.js"),[]),meta:{title:"Schedules",subtitle:"Cron-driven automation matrix"}},{path:"/skills",name:"skills",component:()=>xt(()=>import("./SkillsView-uFX0q1mV.js"),__vite__mapDeps([3,4])),meta:{title:"Skills",subtitle:"Installed skill manifests and content"}},{path:"/wiki",name:"wiki",component:()=>xt(()=>import("./WikiView-B54cCKIK.js"),[]),meta:{title:"Wiki",subtitle:"Workspace knowledge browser"}},{path:"/mcp",name:"mcp",component:()=>xt(()=>import("./McpView-B1w0dRFY.js"),__vite__mapDeps([5,4])),meta:{title:"MCP",subtitle:"Server registry and transport health"}},{path:"/feed",name:"feed",component:()=>xt(()=>import("./FeedView-B5LaMV0I.js"),[]),meta:{title:"Feed",subtitle:"Notifications and durable activity"}},{path:"/inbox",name:"inbox",component:()=>xt(()=>import("./InboxView-Cwqt8rH7.js"),[]),meta:{title:"Inbox",subtitle:"Operator-facing messages"}}]});mh.beforeEach(async e=>{const t=ui();return await t.init(),e.path==="/"?"/chat":t.authEnabled?!t.user&&e.path!=="/login"&&!e.meta.public?{path:"/login",query:{redirect:e.fullPath}}:t.user&&e.path==="/login"?"/chat":!0:e.path==="/login"?"/chat":!0});const Uo=np(rw),ow=ip();Uo.use(ow);Uo.use(mh);Uo.mount("#app");export{Mt as A,Fv as B,fw as C,nr as D,ct as E,de as F,hw as G,dw as H,gh as I,mw as J,Qr as K,gy as L,bd as M,pw as N,aw as O,cw as P,gw as Q,Tr as R,lw as S,Sr as T,ph as U,De as _,P as a,ze as b,G as c,fn as d,uw as e,Xf as f,Fe as g,gg as h,Io as i,K as j,h_ as k,un as l,zt as m,le as n,Xr as o,Vc as p,qe as q,ve as r,vt as s,Te as t,ui as u,Jf as v,cd as w,fh as x,tr as y,zs as z};