@nervmor/codexui 1.0.5 → 1.0.6

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.
@@ -0,0 +1,1455 @@
1
+ (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 o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
2
+ * @vue/shared v3.5.30
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/function wl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Lt={},Gs=[],kr=()=>{},fd=()=>!1,Oi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),bl=e=>e.startsWith("onUpdate:"),nn=Object.assign,_l=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Yh=Object.prototype.hasOwnProperty,Ct=(e,t)=>Yh.call(e,t),Qe=Array.isArray,Ks=e=>Vo(e)==="[object Map]",hd=e=>Vo(e)==="[object Set]",sc=e=>Vo(e)==="[object Date]",nt=e=>typeof e=="function",zt=e=>typeof e=="string",ir=e=>typeof e=="symbol",At=e=>e!==null&&typeof e=="object",pd=e=>(At(e)||nt(e))&&nt(e.then)&&nt(e.catch),md=Object.prototype.toString,Vo=e=>md.call(e),Qh=e=>Vo(e).slice(8,-1),gd=e=>Vo(e)==="[object Object]",kl=e=>zt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,wo=wl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ni=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Xh=/-\w/g,Pn=Ni(e=>e.replace(Xh,t=>t.slice(1).toUpperCase())),Zh=/\B([A-Z])/g,fs=Ni(e=>e.replace(Zh,"-$1").toLowerCase()),Li=Ni(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zi=Ni(e=>e?`on${Li(e)}`:""),yr=(e,t)=>!Object.is(e,t),ci=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},vd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Tl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},ep=e=>{const t=zt(e)?Number(e):NaN;return isNaN(t)?e:t};let oc;const Di=()=>oc||(oc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ls(e){if(Qe(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=zt(r)?sp(r):ls(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(zt(e)||At(e))return e}const tp=/;(?![^(]*\))/g,np=/:([^]+)/,rp=/\/\*[^]*?\*\//g;function sp(e){const t={};return e.replace(rp,"").split(tp).forEach(n=>{if(n){const r=n.split(np);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function tt(e){let t="";if(zt(e))t=e;else if(Qe(e))for(let n=0;n<e.length;n++){const r=tt(e[n]);r&&(t+=r+" ")}else if(At(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const op="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",ip=wl(op);function yd(e){return!!e||e===""}function ap(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Sl(e[r],t[r]);return n}function Sl(e,t){if(e===t)return!0;let n=sc(e),r=sc(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ir(e),r=ir(t),n||r)return e===t;if(n=Qe(e),r=Qe(t),n||r)return n&&r?ap(e,t):!1;if(n=At(e),r=At(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,o=Object.keys(t).length;if(s!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),l=t.hasOwnProperty(i);if(a&&!l||!a&&l||!Sl(e[i],t[i]))return!1}}return String(e)===String(t)}const wd=e=>!!(e&&e.__v_isRef===!0),K=e=>zt(e)?e:e==null?"":Qe(e)||At(e)&&(e.toString===md||!nt(e.toString))?wd(e)?K(e.value):JSON.stringify(e,bd,2):String(e),bd=(e,t)=>wd(t)?bd(e,t.value):Ks(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ea(r,o)+" =>"]=s,n),{})}:hd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ea(n))}:ir(t)?ea(t):At(t)&&!Qe(t)&&!gd(t)?String(t):t,ea=(e,t="")=>{var n;return ir(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
6
+ * @vue/reactivity v3.5.30
7
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
+ * @license MIT
9
+ **/let jn;class lp{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=jn,!t&&jn&&(this.index=(jn.scopes||(jn.scopes=[])).push(this)-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=jn;try{return jn=this,t()}finally{jn=n}}}on(){++this._on===1&&(this.prevScope=jn,jn=this)}off(){this._on>0&&--this._on===0&&(jn=this.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 cp(){return jn}let Ft;const ta=new WeakSet;class _d{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,jn&&jn.active&&jn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ta.has(this)&&(ta.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Td(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ic(this),Sd(this);const t=Ft,n=rr;Ft=this,rr=!0;try{return this.fn()}finally{Id(this),Ft=t,rr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Cl(t);this.deps=this.depsTail=void 0,ic(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ta.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ja(this)&&this.run()}get dirty(){return ja(this)}}let kd=0,bo,_o;function Td(e,t=!1){if(e.flags|=8,t){e.next=_o,_o=e;return}e.next=bo,bo=e}function Il(){kd++}function El(){if(--kd>0)return;if(_o){let t=_o;for(_o=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;bo;){let t=bo;for(bo=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 Sd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Id(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Cl(r),up(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function ja(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ed(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ed(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ro)||(e.globalVersion=Ro,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ja(e))))return;e.flags|=2;const t=e.dep,n=Ft,r=rr;Ft=e,rr=!0;try{Sd(e);const s=e.fn(e._value);(t.version===0||yr(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ft=n,rr=r,Id(e),e.flags&=-3}}function Cl(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 o=n.computed.deps;o;o=o.nextDep)Cl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function up(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let rr=!0;const Cd=[];function Dr(){Cd.push(rr),rr=!1}function jr(){const e=Cd.pop();rr=e===void 0?!0:e}function ic(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ft;Ft=void 0;try{t()}finally{Ft=n}}}let Ro=0;class dp{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 Al{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(!Ft||!rr||Ft===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ft)n=this.activeLink=new dp(Ft,this),Ft.deps?(n.prevDep=Ft.depsTail,Ft.depsTail.nextDep=n,Ft.depsTail=n):Ft.deps=Ft.depsTail=n,Ad(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=Ft.depsTail,n.nextDep=void 0,Ft.depsTail.nextDep=n,Ft.depsTail=n,Ft.deps===n&&(Ft.deps=r)}return n}trigger(t){this.version++,Ro++,this.notify(t)}notify(t){Il();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{El()}}}function Ad(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)Ad(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Fa=new WeakMap,Ps=Symbol(""),Ba=Symbol(""),Po=Symbol("");function yn(e,t,n){if(rr&&Ft){let r=Fa.get(e);r||Fa.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Al),s.map=r,s.key=n),s.track()}}function Mr(e,t,n,r,s,o){const i=Fa.get(e);if(!i){Ro++;return}const a=l=>{l&&l.trigger()};if(Il(),t==="clear")i.forEach(a);else{const l=Qe(e),f=l&&kl(n);if(l&&n==="length"){const u=Number(r);i.forEach((g,_)=>{(_==="length"||_===Po||!ir(_)&&_>=u)&&a(g)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),f&&a(i.get(Po)),t){case"add":l?f&&a(i.get("length")):(a(i.get(Ps)),Ks(e)&&a(i.get(Ba)));break;case"delete":l||(a(i.get(Ps)),Ks(e)&&a(i.get(Ba)));break;case"set":Ks(e)&&a(i.get(Ps));break}}El()}function Bs(e){const t=St(e);return t===e?t:(yn(t,"iterate",Po),Xn(e)?t:t.map(ar))}function ji(e){return yn(e=St(e),"iterate",Po),e}function gr(e,t){return Fr(e)?no(Ms(e)?ar(t):t):ar(t)}const fp={__proto__:null,[Symbol.iterator](){return na(this,Symbol.iterator,e=>gr(this,e))},concat(...e){return Bs(this).concat(...e.map(t=>Qe(t)?Bs(t):t))},entries(){return na(this,"entries",e=>(e[1]=gr(this,e[1]),e))},every(e,t){return Cr(this,"every",e,t,void 0,arguments)},filter(e,t){return Cr(this,"filter",e,t,n=>n.map(r=>gr(this,r)),arguments)},find(e,t){return Cr(this,"find",e,t,n=>gr(this,n),arguments)},findIndex(e,t){return Cr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Cr(this,"findLast",e,t,n=>gr(this,n),arguments)},findLastIndex(e,t){return Cr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Cr(this,"forEach",e,t,void 0,arguments)},includes(...e){return ra(this,"includes",e)},indexOf(...e){return ra(this,"indexOf",e)},join(e){return Bs(this).join(e)},lastIndexOf(...e){return ra(this,"lastIndexOf",e)},map(e,t){return Cr(this,"map",e,t,void 0,arguments)},pop(){return fo(this,"pop")},push(...e){return fo(this,"push",e)},reduce(e,...t){return ac(this,"reduce",e,t)},reduceRight(e,...t){return ac(this,"reduceRight",e,t)},shift(){return fo(this,"shift")},some(e,t){return Cr(this,"some",e,t,void 0,arguments)},splice(...e){return fo(this,"splice",e)},toReversed(){return Bs(this).toReversed()},toSorted(e){return Bs(this).toSorted(e)},toSpliced(...e){return Bs(this).toSpliced(...e)},unshift(...e){return fo(this,"unshift",e)},values(){return na(this,"values",e=>gr(this,e))}};function na(e,t,n){const r=ji(e),s=r[t]();return r!==e&&!Xn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const hp=Array.prototype;function Cr(e,t,n,r,s,o){const i=ji(e),a=i!==e&&!Xn(e),l=i[t];if(l!==hp[t]){const g=l.apply(e,o);return a?ar(g):g}let f=n;i!==e&&(a?f=function(g,_){return n.call(this,gr(e,g),_,e)}:n.length>2&&(f=function(g,_){return n.call(this,g,_,e)}));const u=l.call(i,f,r);return a&&s?s(u):u}function ac(e,t,n,r){const s=ji(e),o=s!==e&&!Xn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(f,u,g){return a&&(a=!1,f=gr(e,f)),n.call(this,f,gr(e,u),g,e)}):n.length>3&&(i=function(f,u,g){return n.call(this,f,u,g,e)}));const l=s[t](i,...r);return a?gr(e,l):l}function ra(e,t,n){const r=St(e);yn(r,"iterate",Po);const s=r[t](...n);return(s===-1||s===!1)&&Pl(n[0])?(n[0]=St(n[0]),r[t](...n)):s}function fo(e,t,n=[]){Dr(),Il();const r=St(e)[t].apply(e,n);return El(),jr(),r}const pp=wl("__proto__,__v_isRef,__isVue"),xd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ir));function mp(e){ir(e)||(e=String(e));const t=St(this);return yn(t,"has",e),t.hasOwnProperty(e)}class Rd{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,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?Ip:Od:o?$d:Md).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Qe(t);if(!s){let l;if(i&&(l=fp[n]))return l;if(n==="hasOwnProperty")return mp}const a=Reflect.get(t,n,_n(t)?t:r);if((ir(n)?xd.has(n):pp(n))||(s||yn(t,"get",n),o))return a;if(_n(a)){const l=i&&kl(n)?a:a.value;return s&&At(l)?Ha(l):l}return At(a)?s?Ha(a):Fi(a):a}}class Pd extends Rd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Qe(t)&&kl(n);if(!this._isShallow){const f=Fr(o);if(!Xn(r)&&!Fr(r)&&(o=St(o),r=St(r)),!i&&_n(o)&&!_n(r))return f||(o.value=r),!0}const a=i?Number(n)<t.length:Ct(t,n),l=Reflect.set(t,n,r,_n(t)?t:s);return t===St(s)&&(a?yr(r,o)&&Mr(t,"set",n,r):Mr(t,"add",n,r)),l}deleteProperty(t,n){const r=Ct(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Mr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!ir(n)||!xd.has(n))&&yn(t,"has",n),r}ownKeys(t){return yn(t,"iterate",Qe(t)?"length":Ps),Reflect.ownKeys(t)}}class gp extends Rd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const vp=new Pd,yp=new gp,wp=new Pd(!0);const Ua=e=>e,ei=e=>Reflect.getPrototypeOf(e);function bp(e,t,n){return function(...r){const s=this.__v_raw,o=St(s),i=Ks(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,f=s[e](...r),u=n?Ua:t?no:ar;return!t&&yn(o,"iterate",l?Ba:Ps),nn(Object.create(f),{next(){const{value:g,done:_}=f.next();return _?{value:g,done:_}:{value:a?[u(g[0]),u(g[1])]:u(g),done:_}}})}}function ti(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function _p(e,t){const n={get(s){const o=this.__v_raw,i=St(o),a=St(s);e||(yr(s,a)&&yn(i,"get",s),yn(i,"get",a));const{has:l}=ei(i),f=t?Ua:e?no:ar;if(l.call(i,s))return f(o.get(s));if(l.call(i,a))return f(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&yn(St(s),"iterate",Ps),s.size},has(s){const o=this.__v_raw,i=St(o),a=St(s);return e||(yr(s,a)&&yn(i,"has",s),yn(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=St(a),f=t?Ua:e?no:ar;return!e&&yn(l,"iterate",Ps),a.forEach((u,g)=>s.call(o,f(u),f(g),i))}};return nn(n,e?{add:ti("add"),set:ti("set"),delete:ti("delete"),clear:ti("clear")}:{add(s){const o=St(this),i=ei(o),a=St(s),l=!t&&!Xn(s)&&!Fr(s)?a:s;return i.has.call(o,l)||yr(s,l)&&i.has.call(o,s)||yr(a,l)&&i.has.call(o,a)||(o.add(l),Mr(o,"add",l,l)),this},set(s,o){!t&&!Xn(o)&&!Fr(o)&&(o=St(o));const i=St(this),{has:a,get:l}=ei(i);let f=a.call(i,s);f||(s=St(s),f=a.call(i,s));const u=l.call(i,s);return i.set(s,o),f?yr(o,u)&&Mr(i,"set",s,o):Mr(i,"add",s,o),this},delete(s){const o=St(this),{has:i,get:a}=ei(o);let l=i.call(o,s);l||(s=St(s),l=i.call(o,s)),a&&a.call(o,s);const f=o.delete(s);return l&&Mr(o,"delete",s,void 0),f},clear(){const s=St(this),o=s.size!==0,i=s.clear();return o&&Mr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=bp(s,e,t)}),n}function xl(e,t){const n=_p(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(Ct(n,s)&&s in r?n:r,s,o)}const kp={get:xl(!1,!1)},Tp={get:xl(!1,!0)},Sp={get:xl(!0,!1)};const Md=new WeakMap,$d=new WeakMap,Od=new WeakMap,Ip=new WeakMap;function Ep(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Cp(e){return e.__v_skip||!Object.isExtensible(e)?0:Ep(Qh(e))}function Fi(e){return Fr(e)?e:Rl(e,!1,vp,kp,Md)}function Nd(e){return Rl(e,!1,wp,Tp,$d)}function Ha(e){return Rl(e,!0,yp,Sp,Od)}function Rl(e,t,n,r,s){if(!At(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Cp(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function Ms(e){return Fr(e)?Ms(e.__v_raw):!!(e&&e.__v_isReactive)}function Fr(e){return!!(e&&e.__v_isReadonly)}function Xn(e){return!!(e&&e.__v_isShallow)}function Pl(e){return e?!!e.__v_raw:!1}function St(e){const t=e&&e.__v_raw;return t?St(t):e}function Ap(e){return!Ct(e,"__v_skip")&&Object.isExtensible(e)&&vd(e,"__v_skip",!0),e}const ar=e=>At(e)?Fi(e):e,no=e=>At(e)?Ha(e):e;function _n(e){return e?e.__v_isRef===!0:!1}function D(e){return Ld(e,!1)}function xp(e){return Ld(e,!0)}function Ld(e,t){return _n(e)?e:new Rp(e,t)}class Rp{constructor(t,n){this.dep=new Al,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:St(t),this._value=n?t:ar(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Xn(t)||Fr(t);t=r?t:St(t),yr(t,n)&&(this._rawValue=t,this._value=r?t:ar(t),this.dep.trigger())}}function be(e){return _n(e)?e.value:e}const Pp={get:(e,t,n)=>t==="__v_raw"?e:be(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return _n(s)&&!_n(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Dd(e){return Ms(e)?e:new Proxy(e,Pp)}class Mp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Al(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ro-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ft!==this)return Td(this,!0),!0}get value(){const t=this.dep.track();return Ed(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function $p(e,t,n=!1){let r,s;return nt(e)?r=e:(r=e.get,s=e.set),new Mp(r,s,n)}const ni={},wi=new WeakMap;let Is;function Op(e,t=!1,n=Is){if(n){let r=wi.get(n);r||wi.set(n,r=[]),r.push(e)}}function Np(e,t,n=Lt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,f=te=>s?te:Xn(te)||s===!1||s===0?$r(te,1):$r(te);let u,g,_,E,F=!1,$=!1;if(_n(e)?(g=()=>e.value,F=Xn(e)):Ms(e)?(g=()=>f(e),F=!0):Qe(e)?($=!0,F=e.some(te=>Ms(te)||Xn(te)),g=()=>e.map(te=>{if(_n(te))return te.value;if(Ms(te))return f(te);if(nt(te))return l?l(te,2):te()})):nt(e)?t?g=l?()=>l(e,2):e:g=()=>{if(_){Dr();try{_()}finally{jr()}}const te=Is;Is=u;try{return l?l(e,3,[E]):e(E)}finally{Is=te}}:g=kr,t&&s){const te=g,Te=s===!0?1/0:s;g=()=>$r(te(),Te)}const Y=cp(),ae=()=>{u.stop(),Y&&Y.active&&_l(Y.effects,u)};if(o&&t){const te=t;t=(...Te)=>{te(...Te),ae()}}let G=$?new Array(e.length).fill(ni):ni;const ee=te=>{if(!(!(u.flags&1)||!u.dirty&&!te))if(t){const Te=u.run();if(s||F||($?Te.some((ve,ye)=>yr(ve,G[ye])):yr(Te,G))){_&&_();const ve=Is;Is=u;try{const ye=[Te,G===ni?void 0:$&&G[0]===ni?[]:G,E];G=Te,l?l(t,3,ye):t(...ye)}finally{Is=ve}}}else u.run()};return a&&a(ee),u=new _d(g),u.scheduler=i?()=>i(ee,!1):ee,E=te=>Op(te,!1,u),_=u.onStop=()=>{const te=wi.get(u);if(te){if(l)l(te,4);else for(const Te of te)Te();wi.delete(u)}},t?r?ee(!0):G=u.run():i?i(ee.bind(null,!0),!0):u.run(),ae.pause=u.pause.bind(u),ae.resume=u.resume.bind(u),ae.stop=ae,ae}function $r(e,t=1/0,n){if(t<=0||!At(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,_n(e))$r(e.value,t,n);else if(Qe(e))for(let r=0;r<e.length;r++)$r(e[r],t,n);else if(hd(e)||Ks(e))e.forEach(r=>{$r(r,t,n)});else if(gd(e)){for(const r in e)$r(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&$r(e[r],t,n)}return e}/**
10
+ * @vue/runtime-core v3.5.30
11
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
+ * @license MIT
13
+ **/function zo(e,t,n,r){try{return r?e(...r):e()}catch(s){Bi(s,t,n)}}function lr(e,t,n,r){if(nt(e)){const s=zo(e,t,n,r);return s&&pd(s)&&s.catch(o=>{Bi(o,t,n)}),s}if(Qe(e)){const s=[];for(let o=0;o<e.length;o++)s.push(lr(e[o],t,n,r));return s}}function Bi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Lt;if(t){let a=t.parent;const l=t.proxy,f=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let g=0;g<u.length;g++)if(u[g](e,l,f)===!1)return}a=a.parent}if(o){Dr(),zo(o,null,10,[e,l,f]),jr();return}}Lp(e,n,s,r,i)}function Lp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const xn=[];let pr=-1;const Js=[];let ns=null,Vs=0;const jd=Promise.resolve();let bi=null;function tn(e){const t=bi||jd;return e?t.then(this?e.bind(this):e):t}function Dp(e){let t=pr+1,n=xn.length;for(;t<n;){const r=t+n>>>1,s=xn[r],o=Mo(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Ml(e){if(!(e.flags&1)){const t=Mo(e),n=xn[xn.length-1];!n||!(e.flags&2)&&t>=Mo(n)?xn.push(e):xn.splice(Dp(t),0,e),e.flags|=1,Fd()}}function Fd(){bi||(bi=jd.then(Ud))}function jp(e){Qe(e)?Js.push(...e):ns&&e.id===-1?ns.splice(Vs+1,0,e):e.flags&1||(Js.push(e),e.flags|=1),Fd()}function lc(e,t,n=pr+1){for(;n<xn.length;n++){const r=xn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;xn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Bd(e){if(Js.length){const t=[...new Set(Js)].sort((n,r)=>Mo(n)-Mo(r));if(Js.length=0,ns){ns.push(...t);return}for(ns=t,Vs=0;Vs<ns.length;Vs++){const n=ns[Vs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}ns=null,Vs=0}}const Mo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ud(e){try{for(pr=0;pr<xn.length;pr++){const t=xn[pr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),zo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;pr<xn.length;pr++){const t=xn[pr];t&&(t.flags&=-2)}pr=-1,xn.length=0,Bd(),bi=null,(xn.length||Js.length)&&Ud()}}let pn=null,Hd=null;function _i(e){const t=pn;return pn=e,Hd=e&&e.type.__scopeId||null,t}function It(e,t=pn,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Ii(-1);const o=_i(t);let i;try{i=e(...s)}finally{_i(o),r._d&&Ii(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Br(e,t){if(pn===null)return e;const n=qi(pn),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Lt]=t[s];o&&(nt(o)&&(o={mounted:o,updated:o}),o.deep&&$r(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function bs(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const a=s[i];o&&(a.oldValue=o[i].value);let l=a.dir[r];l&&(Dr(),lr(l,n,8,[e.el,a,e,t]),jr())}}function ui(e,t){if(bn){let n=bn.provides;const r=bn.parent&&bn.parent.provides;r===n&&(n=bn.provides=Object.create(r)),n[e]=t}}function sr(e,t,n=!1){const r=Dl();if(r||Qs){let s=Qs?Qs._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&&nt(t)?t.call(r&&r.proxy):t}}const Fp=Symbol.for("v-scx"),Bp=()=>sr(Fp);function ft(e,t,n){return Wd(e,t,n)}function Wd(e,t,n=Lt){const{immediate:r,deep:s,flush:o,once:i}=n,a=nn({},n),l=t&&r||!t&&o!=="post";let f;if(Do){if(o==="sync"){const E=Bp();f=E.__watcherHandles||(E.__watcherHandles=[])}else if(!l){const E=()=>{};return E.stop=kr,E.resume=kr,E.pause=kr,E}}const u=bn;a.call=(E,F,$)=>lr(E,u,F,$);let g=!1;o==="post"?a.scheduler=E=>{vn(E,u&&u.suspense)}:o!=="sync"&&(g=!0,a.scheduler=(E,F)=>{F?E():Ml(E)}),a.augmentJob=E=>{t&&(E.flags|=4),g&&(E.flags|=2,u&&(E.id=u.uid,E.i=u))};const _=Np(e,t,a);return Do&&(f?f.push(_):l&&_()),_}function Up(e,t,n){const r=this.proxy,s=zt(e)?e.includes(".")?Vd(r,e):()=>r[e]:e.bind(r,r);let o;nt(t)?o=t:(o=t.handler,n=t);const i=qo(this),a=Wd(s,o.bind(r),n);return i(),a}function Vd(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 zd=Symbol("_vte"),qd=e=>e.__isTeleport,ko=e=>e&&(e.disabled||e.disabled===""),cc=e=>e&&(e.defer||e.defer===""),uc=e=>typeof SVGElement<"u"&&e instanceof SVGElement,dc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Wa=(e,t)=>{const n=e&&e.to;return zt(n)?t?t(n):null:n},Gd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,f){const{mc:u,pc:g,pbc:_,o:{insert:E,querySelector:F,createText:$,createComment:Y}}=f,ae=ko(t.props);let{shapeFlag:G,children:ee,dynamicChildren:te}=t;if(e==null){const Te=t.el=$(""),ve=t.anchor=$("");E(Te,n,r),E(ve,n,r);const ye=(le,re)=>{G&16&&u(ee,le,re,s,o,i,a,l)},De=()=>{const le=t.target=Wa(t.props,F),re=Va(le,t,$,E);le&&(i!=="svg"&&uc(le)?i="svg":i!=="mathml"&&dc(le)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(le),ae||(ye(le,re),di(t,!1)))};ae&&(ye(n,ve),di(t,!0)),cc(t.props)?(t.el.__isMounted=!1,vn(()=>{De(),delete t.el.__isMounted},o)):De()}else{if(cc(t.props)&&e.el.__isMounted===!1){vn(()=>{Gd.process(e,t,n,r,s,o,i,a,l,f)},o);return}t.el=e.el,t.targetStart=e.targetStart;const Te=t.anchor=e.anchor,ve=t.target=e.target,ye=t.targetAnchor=e.targetAnchor,De=ko(e.props),le=De?n:ve,re=De?Te:ye;if(i==="svg"||uc(ve)?i="svg":(i==="mathml"||dc(ve))&&(i="mathml"),te?(_(e.dynamicChildren,te,le,s,o,i,a),Nl(e,t,!0)):l||g(e,t,le,re,s,o,i,a,!1),ae)De?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ri(t,n,Te,f,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ce=t.target=Wa(t.props,F);ce&&ri(t,ce,null,f,0)}else De&&ri(t,ve,ye,f,1);di(t,ae)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:f,targetAnchor:u,target:g,props:_}=e;if(g&&(s(f),s(u)),o&&s(l),i&16){const E=o||!ko(_);for(let F=0;F<a.length;F++){const $=a[F];r($,t,n,E,!!$.dynamicChildren)}}},move:ri,hydrate:Hp};function ri(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:l,children:f,props:u}=e,g=o===2;if(g&&r(i,t,n),(!g||ko(u))&&l&16)for(let _=0;_<f.length;_++)s(f[_],t,n,2);g&&r(a,t,n)}function Hp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:f,createText:u}},g){function _(Y,ae){let G=ae;for(;G;){if(G&&G.nodeType===8){if(G.data==="teleport start anchor")t.targetStart=G;else if(G.data==="teleport anchor"){t.targetAnchor=G,Y._lpa=t.targetAnchor&&i(t.targetAnchor);break}}G=i(G)}}function E(Y,ae){ae.anchor=g(i(Y),ae,a(Y),n,r,s,o)}const F=t.target=Wa(t.props,l),$=ko(t.props);if(F){const Y=F._lpa||F.firstChild;t.shapeFlag&16&&($?(E(e,t),_(F,Y),t.targetAnchor||Va(F,t,u,f,a(e)===F?e:null)):(t.anchor=i(e),_(F,Y),t.targetAnchor||Va(F,t,u,f),g(Y&&i(Y),t,F,n,r,s,o))),di(t,$)}else $&&t.shapeFlag&16&&(E(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const To=Gd;function di(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 Va(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[zd]=i,e&&(r(o,e,s),r(i,e,s)),i}const mr=Symbol("_leaveCb"),ho=Symbol("_enterCb");function Wp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return zr(()=>{e.isMounted=!0}),qr(()=>{e.isUnmounting=!0}),e}const Yn=[Function,Array],Kd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Yn,onEnter:Yn,onAfterEnter:Yn,onEnterCancelled:Yn,onBeforeLeave:Yn,onLeave:Yn,onAfterLeave:Yn,onLeaveCancelled:Yn,onBeforeAppear:Yn,onAppear:Yn,onAfterAppear:Yn,onAppearCancelled:Yn},Jd=e=>{const t=e.subTree;return t.component?Jd(t.component):t},Vp={name:"BaseTransition",props:Kd,setup(e,{slots:t}){const n=Dl(),r=Wp();return()=>{const s=t.default&&Xd(t.default(),!0);if(!s||!s.length)return;const o=Yd(s),i=St(e),{mode:a}=i;if(r.isLeaving)return sa(o);const l=fc(o);if(!l)return sa(o);let f=za(l,i,r,n,g=>f=g);l.type!==wn&&$o(l,f);let u=n.subTree&&fc(n.subTree);if(u&&u.type!==wn&&!Cs(u,l)&&Jd(n).type!==wn){let g=za(u,i,r,n);if($o(u,g),a==="out-in"&&l.type!==wn)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,u=void 0},sa(o);a==="in-out"&&l.type!==wn?g.delayLeave=(_,E,F)=>{const $=Qd(r,u);$[String(u.key)]=u,_[mr]=()=>{E(),_[mr]=void 0,delete f.delayedLeave,u=void 0},f.delayedLeave=()=>{F(),delete f.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return o}}};function Yd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==wn){t=n;break}}return t}const zp=Vp;function Qd(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 za(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:f,onAfterEnter:u,onEnterCancelled:g,onBeforeLeave:_,onLeave:E,onAfterLeave:F,onLeaveCancelled:$,onBeforeAppear:Y,onAppear:ae,onAfterAppear:G,onAppearCancelled:ee}=t,te=String(e.key),Te=Qd(n,e),ve=(le,re)=>{le&&lr(le,r,9,re)},ye=(le,re)=>{const ce=re[1];ve(le,re),Qe(le)?le.every(ne=>ne.length<=1)&&ce():le.length<=1&&ce()},De={mode:i,persisted:a,beforeEnter(le){let re=l;if(!n.isMounted)if(o)re=Y||l;else return;le[mr]&&le[mr](!0);const ce=Te[te];ce&&Cs(e,ce)&&ce.el[mr]&&ce.el[mr](),ve(re,[le])},enter(le){if(Te[te]===e)return;let re=f,ce=u,ne=g;if(!n.isMounted)if(o)re=ae||f,ce=G||u,ne=ee||g;else return;let Pe=!1;le[ho]=Ge=>{Pe||(Pe=!0,Ge?ve(ne,[le]):ve(ce,[le]),De.delayedLeave&&De.delayedLeave(),le[ho]=void 0)};const Ye=le[ho].bind(null,!1);re?ye(re,[le,Ye]):Ye()},leave(le,re){const ce=String(e.key);if(le[ho]&&le[ho](!0),n.isUnmounting)return re();ve(_,[le]);let ne=!1;le[mr]=Ye=>{ne||(ne=!0,re(),Ye?ve($,[le]):ve(F,[le]),le[mr]=void 0,Te[ce]===e&&delete Te[ce])};const Pe=le[mr].bind(null,!1);Te[ce]=e,E?ye(E,[le,Pe]):Pe()},clone(le){const re=za(le,t,n,r,s);return s&&s(re),re}};return De}function sa(e){if(Ui(e))return e=ds(e),e.children=null,e}function fc(e){if(!Ui(e))return qd(e.type)&&e.children?Yd(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&&nt(n.default))return n.default()}}function $o(e,t){e.shapeFlag&6&&e.component?(e.transition=t,$o(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 Xd(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===Le?(i.patchFlag&128&&s++,r=r.concat(Xd(i.children,t,a))):(t||i.type!==wn)&&r.push(a!=null?ds(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function cn(e,t){return nt(e)?nn({name:e.name},t,{setup:e}):e}function Zd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function hc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ki=new WeakMap;function So(e,t,n,r,s=!1){if(Qe(e)){e.forEach(($,Y)=>So($,t&&(Qe(t)?t[Y]:t),n,r,s));return}if(Ys(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&So(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?qi(r.component):r.el,i=s?null:o,{i:a,r:l}=e,f=t&&t.r,u=a.refs===Lt?a.refs={}:a.refs,g=a.setupState,_=St(g),E=g===Lt?fd:$=>hc(u,$)?!1:Ct(_,$),F=($,Y)=>!(Y&&hc(u,Y));if(f!=null&&f!==l){if(pc(t),zt(f))u[f]=null,E(f)&&(g[f]=null);else if(_n(f)){const $=t;F(f,$.k)&&(f.value=null),$.k&&(u[$.k]=null)}}if(nt(l))zo(l,a,12,[i,u]);else{const $=zt(l),Y=_n(l);if($||Y){const ae=()=>{if(e.f){const G=$?E(l)?g[l]:u[l]:F()||!e.k?l.value:u[e.k];if(s)Qe(G)&&_l(G,o);else if(Qe(G))G.includes(o)||G.push(o);else if($)u[l]=[o],E(l)&&(g[l]=u[l]);else{const ee=[o];F(l,e.k)&&(l.value=ee),e.k&&(u[e.k]=ee)}}else $?(u[l]=i,E(l)&&(g[l]=i)):Y&&(F(l,e.k)&&(l.value=i),e.k&&(u[e.k]=i))};if(i){const G=()=>{ae(),ki.delete(e)};G.id=-1,ki.set(e,G),vn(G,n)}else pc(e),ae()}}}function pc(e){const t=ki.get(e);t&&(t.flags|=8,ki.delete(e))}Di().requestIdleCallback;Di().cancelIdleCallback;const Ys=e=>!!e.type.__asyncLoader,Ui=e=>e.type.__isKeepAlive;function qp(e,t){ef(e,"a",t)}function Gp(e,t){ef(e,"da",t)}function ef(e,t,n=bn){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Hi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Ui(s.parent.vnode)&&Kp(r,t,n,s),s=s.parent}}function Kp(e,t,n,r){const s=Hi(t,e,r,!0);Wi(()=>{_l(r[t],s)},n)}function Hi(e,t,n=bn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Dr();const a=qo(n),l=lr(t,n,e,i);return a(),jr(),l});return r?s.unshift(o):s.push(o),o}}const Vr=e=>(t,n=bn)=>{(!Do||e==="sp")&&Hi(e,(...r)=>t(...r),n)},Jp=Vr("bm"),zr=Vr("m"),Yp=Vr("bu"),Qp=Vr("u"),qr=Vr("bum"),Wi=Vr("um"),Xp=Vr("sp"),Zp=Vr("rtg"),em=Vr("rtc");function tm(e,t=bn){Hi("ec",e,t)}const nm="components",tf=Symbol.for("v-ndc");function Ti(e){return zt(e)?rm(nm,e,!1)||e:e||tf}function rm(e,t,n=!0,r=!1){const s=pn||bn;if(s){const o=s.type;{const a=Um(o,!1);if(a&&(a===t||a===Pn(t)||a===Li(Pn(t))))return o}const i=mc(s[e]||o[e],t)||mc(s.appContext[e],t);return!i&&r?o:i}}function mc(e,t){return e&&(e[t]||e[Pn(t)]||e[Li(Pn(t))])}function vt(e,t,n,r){let s;const o=n,i=Qe(e);if(i||zt(e)){const a=i&&Ms(e);let l=!1,f=!1;a&&(l=!Xn(e),f=Fr(e),e=ji(e)),s=new Array(e.length);for(let u=0,g=e.length;u<g;u++)s[u]=t(l?f?no(ar(e[u])):ar(e[u]):e[u],u,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(At(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,o));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,f=a.length;l<f;l++){const u=a[l];s[l]=t(e[u],u,l,o)}}else s=[];return s}function _r(e,t,n={},r,s){if(pn.ce||pn.parent&&Ys(pn.parent)&&pn.parent.ce){const f=Object.keys(n).length>0;return t!=="default"&&(n.name=t),y(),bt(Le,null,[je("slot",n,r)],f?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),y();const i=o&&nf(o(n)),a=n.key||i&&i.key,l=bt(Le,{key:(a&&!ir(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function nf(e){return e.some(t=>No(t)?!(t.type===wn||t.type===Le&&!nf(t.children)):!0)?e:null}const qa=e=>e?Tf(e)?qi(e):qa(e.parent):null,Io=nn(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=>qa(e.parent),$root:e=>qa(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>sf(e),$forceUpdate:e=>e.f||(e.f=()=>{Ml(e.update)}),$nextTick:e=>e.n||(e.n=tn.bind(e.proxy)),$watch:e=>Up.bind(e)}),oa=(e,t)=>e!==Lt&&!e.__isScriptSetup&&Ct(e,t),sm={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:a,appContext:l}=e;if(t[0]!=="$"){const _=i[t];if(_!==void 0)switch(_){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(oa(r,t))return i[t]=1,r[t];if(s!==Lt&&Ct(s,t))return i[t]=2,s[t];if(Ct(o,t))return i[t]=3,o[t];if(n!==Lt&&Ct(n,t))return i[t]=4,n[t];Ga&&(i[t]=0)}}const f=Io[t];let u,g;if(f)return t==="$attrs"&&yn(e.attrs,"get",""),f(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Lt&&Ct(n,t))return i[t]=4,n[t];if(g=l.config.globalProperties,Ct(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return oa(s,t)?(s[t]=n,!0):r!==Lt&&Ct(r,t)?(r[t]=n,!0):Ct(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:o,type:i}},a){let l;return!!(n[a]||e!==Lt&&a[0]!=="$"&&Ct(e,a)||oa(t,a)||Ct(o,a)||Ct(r,a)||Ct(Io,a)||Ct(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Ct(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function om(){return im().slots}function im(e){const t=Dl();return t.setupContext||(t.setupContext=If(t))}function gc(e){return Qe(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ga=!0;function am(e){const t=sf(e),n=e.proxy,r=e.ctx;Ga=!1,t.beforeCreate&&vc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:f,created:u,beforeMount:g,mounted:_,beforeUpdate:E,updated:F,activated:$,deactivated:Y,beforeDestroy:ae,beforeUnmount:G,destroyed:ee,unmounted:te,render:Te,renderTracked:ve,renderTriggered:ye,errorCaptured:De,serverPrefetch:le,expose:re,inheritAttrs:ce,components:ne,directives:Pe,filters:Ye}=t;if(f&&lm(f,r,null),i)for(const Ue in i){const Re=i[Ue];nt(Re)&&(r[Ue]=Re.bind(n))}if(s){const Ue=s.call(n,n);At(Ue)&&(e.data=Fi(Ue))}if(Ga=!0,o)for(const Ue in o){const Re=o[Ue],rt=nt(Re)?Re.bind(n,n):nt(Re.get)?Re.get.bind(n,n):kr,Ae=!nt(Re)&&nt(Re.set)?Re.set.bind(n):kr,Be=de({get:rt,set:Ae});Object.defineProperty(r,Ue,{enumerable:!0,configurable:!0,get:()=>Be.value,set:ct=>Be.value=ct})}if(a)for(const Ue in a)rf(a[Ue],r,n,Ue);if(l){const Ue=nt(l)?l.call(n):l;Reflect.ownKeys(Ue).forEach(Re=>{ui(Re,Ue[Re])})}u&&vc(u,e,"c");function Ve(Ue,Re){Qe(Re)?Re.forEach(rt=>Ue(rt.bind(n))):Re&&Ue(Re.bind(n))}if(Ve(Jp,g),Ve(zr,_),Ve(Yp,E),Ve(Qp,F),Ve(qp,$),Ve(Gp,Y),Ve(tm,De),Ve(em,ve),Ve(Zp,ye),Ve(qr,G),Ve(Wi,te),Ve(Xp,le),Qe(re))if(re.length){const Ue=e.exposed||(e.exposed={});re.forEach(Re=>{Object.defineProperty(Ue,Re,{get:()=>n[Re],set:rt=>n[Re]=rt,enumerable:!0})})}else e.exposed||(e.exposed={});Te&&e.render===kr&&(e.render=Te),ce!=null&&(e.inheritAttrs=ce),ne&&(e.components=ne),Pe&&(e.directives=Pe),le&&Zd(e)}function lm(e,t,n=kr){Qe(e)&&(e=Ka(e));for(const r in e){const s=e[r];let o;At(s)?"default"in s?o=sr(s.from||r,s.default,!0):o=sr(s.from||r):o=sr(s),_n(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function vc(e,t,n){lr(Qe(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function rf(e,t,n,r){let s=r.includes(".")?Vd(n,r):()=>n[r];if(zt(e)){const o=t[e];nt(o)&&ft(s,o)}else if(nt(e))ft(s,e.bind(n));else if(At(e))if(Qe(e))e.forEach(o=>rf(o,t,n,r));else{const o=nt(e.handler)?e.handler.bind(n):t[e.handler];nt(o)&&ft(s,o,e)}}function sf(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(f=>Si(l,f,i,!0)),Si(l,t,i)),At(t)&&o.set(t,l),l}function Si(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Si(e,o,n,!0),s&&s.forEach(i=>Si(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=cm[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const cm={data:yc,props:wc,emits:wc,methods:vo,computed:vo,beforeCreate:Cn,created:Cn,beforeMount:Cn,mounted:Cn,beforeUpdate:Cn,updated:Cn,beforeDestroy:Cn,beforeUnmount:Cn,destroyed:Cn,unmounted:Cn,activated:Cn,deactivated:Cn,errorCaptured:Cn,serverPrefetch:Cn,components:vo,directives:vo,watch:dm,provide:yc,inject:um};function yc(e,t){return t?e?function(){return nn(nt(e)?e.call(this,this):e,nt(t)?t.call(this,this):t)}:t:e}function um(e,t){return vo(Ka(e),Ka(t))}function Ka(e){if(Qe(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Cn(e,t){return e?[...new Set([].concat(e,t))]:t}function vo(e,t){return e?nn(Object.create(null),e,t):t}function wc(e,t){return e?Qe(e)&&Qe(t)?[...new Set([...e,...t])]:nn(Object.create(null),gc(e),gc(t??{})):t}function dm(e,t){if(!e)return t;if(!t)return e;const n=nn(Object.create(null),e);for(const r in t)n[r]=Cn(e[r],t[r]);return n}function of(){return{app:null,config:{isNativeTag:fd,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 fm=0;function hm(e,t){return function(r,s=null){nt(r)||(r=nn({},r)),s!=null&&!At(s)&&(s=null);const o=of(),i=new WeakSet,a=[];let l=!1;const f=o.app={_uid:fm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Wm,get config(){return o.config},set config(u){},use(u,...g){return i.has(u)||(u&&nt(u.install)?(i.add(u),u.install(f,...g)):nt(u)&&(i.add(u),u(f,...g))),f},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),f},component(u,g){return g?(o.components[u]=g,f):o.components[u]},directive(u,g){return g?(o.directives[u]=g,f):o.directives[u]},mount(u,g,_){if(!l){const E=f._ceVNode||je(r,s);return E.appContext=o,_===!0?_="svg":_===!1&&(_=void 0),e(E,u,_),l=!0,f._container=u,u.__vue_app__=f,qi(E.component)}},onUnmount(u){a.push(u)},unmount(){l&&(lr(a,f._instance,16),e(null,f._container),delete f._container.__vue_app__)},provide(u,g){return o.provides[u]=g,f},runWithContext(u){const g=Qs;Qs=f;try{return u()}finally{Qs=g}}};return f}}let Qs=null;const pm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Pn(t)}Modifiers`]||e[`${fs(t)}Modifiers`];function mm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Lt;let s=n;const o=t.startsWith("update:"),i=o&&pm(r,t.slice(7));i&&(i.trim&&(s=n.map(u=>zt(u)?u.trim():u)),i.number&&(s=n.map(Tl)));let a,l=r[a=Zi(t)]||r[a=Zi(Pn(t))];!l&&o&&(l=r[a=Zi(fs(t))]),l&&lr(l,e,6,s);const f=r[a+"Once"];if(f){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,lr(f,e,6,s)}}const gm=new WeakMap;function af(e,t,n=!1){const r=n?gm:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!nt(e)){const l=f=>{const u=af(f,t,!0);u&&(a=!0,nn(i,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(At(e)&&r.set(e,null),null):(Qe(o)?o.forEach(l=>i[l]=null):nn(i,o),At(e)&&r.set(e,i),i)}function Vi(e,t){return!e||!Oi(t)?!1:(t=t.slice(2).replace(/Once$/,""),Ct(e,t[0].toLowerCase()+t.slice(1))||Ct(e,fs(t))||Ct(e,t))}function bc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:f,renderCache:u,props:g,data:_,setupState:E,ctx:F,inheritAttrs:$}=e,Y=_i(e);let ae,G;try{if(n.shapeFlag&4){const te=s||r,Te=te;ae=vr(f.call(Te,te,u,g,E,_,F)),G=a}else{const te=t;ae=vr(te.length>1?te(g,{attrs:a,slots:i,emit:l}):te(g,null)),G=t.props?a:vm(a)}}catch(te){Eo.length=0,Bi(te,e,1),ae=je(wn)}let ee=ae;if(G&&$!==!1){const te=Object.keys(G),{shapeFlag:Te}=ee;te.length&&Te&7&&(o&&te.some(bl)&&(G=ym(G,o)),ee=ds(ee,G,!1,!0))}return n.dirs&&(ee=ds(ee,null,!1,!0),ee.dirs=ee.dirs?ee.dirs.concat(n.dirs):n.dirs),n.transition&&$o(ee,n.transition),ae=ee,_i(Y),ae}const vm=e=>{let t;for(const n in e)(n==="class"||n==="style"||Oi(n))&&((t||(t={}))[n]=e[n]);return t},ym=(e,t)=>{const n={};for(const r in e)(!bl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function wm(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,f=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?_c(r,i,f):!!i;if(l&8){const u=t.dynamicProps;for(let g=0;g<u.length;g++){const _=u[g];if(lf(i,r,_)&&!Vi(f,_))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?_c(r,i,f):!0:!!i;return!1}function _c(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 o=r[s];if(lf(t,e,o)&&!Vi(n,o))return!0}return!1}function lf(e,t,n){const r=e[n],s=t[n];return n==="style"&&At(r)&&At(s)?!Sl(r,s):r!==s}function bm({vnode:e,parent:t},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r===e)(e=t.vnode).el=n,t=t.parent;else break}}const cf={},uf=()=>Object.create(cf),df=e=>Object.getPrototypeOf(e)===cf;function _m(e,t,n,r=!1){const s={},o=uf();e.propsDefaults=Object.create(null),ff(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Nd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function km(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=St(s),[l]=e.propsOptions;let f=!1;if((r||i>0)&&!(i&16)){if(i&8){const u=e.vnode.dynamicProps;for(let g=0;g<u.length;g++){let _=u[g];if(Vi(e.emitsOptions,_))continue;const E=t[_];if(l)if(Ct(o,_))E!==o[_]&&(o[_]=E,f=!0);else{const F=Pn(_);s[F]=Ja(l,a,F,E,e,!1)}else E!==o[_]&&(o[_]=E,f=!0)}}}else{ff(e,t,s,o)&&(f=!0);let u;for(const g in a)(!t||!Ct(t,g)&&((u=fs(g))===g||!Ct(t,u)))&&(l?n&&(n[g]!==void 0||n[u]!==void 0)&&(s[g]=Ja(l,a,g,void 0,e,!0)):delete s[g]);if(o!==a)for(const g in o)(!t||!Ct(t,g))&&(delete o[g],f=!0)}f&&Mr(e.attrs,"set","")}function ff(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(wo(l))continue;const f=t[l];let u;s&&Ct(s,u=Pn(l))?!o||!o.includes(u)?n[u]=f:(a||(a={}))[u]=f:Vi(e.emitsOptions,l)||(!(l in r)||f!==r[l])&&(r[l]=f,i=!0)}if(o){const l=St(n),f=a||Lt;for(let u=0;u<o.length;u++){const g=o[u];n[g]=Ja(s,l,g,f[g],e,!Ct(f,g))}}return i}function Ja(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=Ct(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&nt(l)){const{propsDefaults:f}=s;if(n in f)r=f[n];else{const u=qo(s);r=f[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===fs(n))&&(r=!0))}return r}const Tm=new WeakMap;function hf(e,t,n=!1){const r=n?Tm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!nt(e)){const u=g=>{l=!0;const[_,E]=hf(g,t,!0);nn(i,_),E&&a.push(...E)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!o&&!l)return At(e)&&r.set(e,Gs),Gs;if(Qe(o))for(let u=0;u<o.length;u++){const g=Pn(o[u]);kc(g)&&(i[g]=Lt)}else if(o)for(const u in o){const g=Pn(u);if(kc(g)){const _=o[u],E=i[g]=Qe(_)||nt(_)?{type:_}:nn({},_),F=E.type;let $=!1,Y=!0;if(Qe(F))for(let ae=0;ae<F.length;++ae){const G=F[ae],ee=nt(G)&&G.name;if(ee==="Boolean"){$=!0;break}else ee==="String"&&(Y=!1)}else $=nt(F)&&F.name==="Boolean";E[0]=$,E[1]=Y,($||Ct(E,"default"))&&a.push(g)}}const f=[i,a];return At(e)&&r.set(e,f),f}function kc(e){return e[0]!=="$"&&!wo(e)}const $l=e=>e==="_"||e==="_ctx"||e==="$stable",Ol=e=>Qe(e)?e.map(vr):[vr(e)],Sm=(e,t,n)=>{if(t._n)return t;const r=It((...s)=>Ol(t(...s)),n);return r._c=!1,r},pf=(e,t,n)=>{const r=e._ctx;for(const s in e){if($l(s))continue;const o=e[s];if(nt(o))t[s]=Sm(s,o,r);else if(o!=null){const i=Ol(o);t[s]=()=>i}}},mf=(e,t)=>{const n=Ol(t);e.slots.default=()=>n},gf=(e,t,n)=>{for(const r in t)(n||!$l(r))&&(e[r]=t[r])},Im=(e,t,n)=>{const r=e.slots=uf();if(e.vnode.shapeFlag&32){const s=t._;s?(gf(r,t,n),n&&vd(r,"_",s,!0)):pf(t,r)}else t&&mf(e,t)},Em=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Lt;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:gf(s,t,n):(o=!t.$stable,pf(t,s)),i=t}else t&&(mf(e,t),i={default:1});if(o)for(const a in s)!$l(a)&&i[a]==null&&delete s[a]},vn=Pm;function Cm(e){return Am(e)}function Am(e,t){const n=Di();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:f,setElementText:u,parentNode:g,nextSibling:_,setScopeId:E=kr,insertStaticContent:F}=e,$=(T,C,O,z=null,J=null,N=null,B=void 0,H=null,Q=!!C.dynamicChildren)=>{if(T===C)return;T&&!Cs(T,C)&&(z=W(T),ct(T,J,N,!0),T=null),C.patchFlag===-2&&(Q=!1,C.dynamicChildren=null);const{type:Z,ref:Ee,shapeFlag:we}=C;switch(Z){case zi:Y(T,C,O,z);break;case wn:ae(T,C,O,z);break;case aa:T==null&&G(C,O,z,B);break;case Le:ne(T,C,O,z,J,N,B,H,Q);break;default:we&1?Te(T,C,O,z,J,N,B,H,Q):we&6?Pe(T,C,O,z,J,N,B,H,Q):(we&64||we&128)&&Z.process(T,C,O,z,J,N,B,H,Q,ge)}Ee!=null&&J?So(Ee,T&&T.ref,N,C||T,!C):Ee==null&&T&&T.ref!=null&&So(T.ref,null,N,T,!0)},Y=(T,C,O,z)=>{if(T==null)r(C.el=a(C.children),O,z);else{const J=C.el=T.el;C.children!==T.children&&f(J,C.children)}},ae=(T,C,O,z)=>{T==null?r(C.el=l(C.children||""),O,z):C.el=T.el},G=(T,C,O,z)=>{[T.el,T.anchor]=F(T.children,C,O,z,T.el,T.anchor)},ee=({el:T,anchor:C},O,z)=>{let J;for(;T&&T!==C;)J=_(T),r(T,O,z),T=J;r(C,O,z)},te=({el:T,anchor:C})=>{let O;for(;T&&T!==C;)O=_(T),s(T),T=O;s(C)},Te=(T,C,O,z,J,N,B,H,Q)=>{if(C.type==="svg"?B="svg":C.type==="math"&&(B="mathml"),T==null)ve(C,O,z,J,N,B,H,Q);else{const Z=T.el&&T.el._isVueCE?T.el:null;try{Z&&Z._beginPatch(),le(T,C,J,N,B,H,Q)}finally{Z&&Z._endPatch()}}},ve=(T,C,O,z,J,N,B,H)=>{let Q,Z;const{props:Ee,shapeFlag:we,transition:ke,dirs:xe}=T;if(Q=T.el=i(T.type,N,Ee&&Ee.is,Ee),we&8?u(Q,T.children):we&16&&De(T.children,Q,null,z,J,ia(T,N),B,H),xe&&bs(T,null,z,"created"),ye(Q,T,T.scopeId,B,z),Ee){for(const ot in Ee)ot!=="value"&&!wo(ot)&&o(Q,ot,null,Ee[ot],N,z);"value"in Ee&&o(Q,"value",null,Ee.value,N),(Z=Ee.onVnodeBeforeMount)&&hr(Z,z,T)}xe&&bs(T,null,z,"beforeMount");const ze=xm(J,ke);ze&&ke.beforeEnter(Q),r(Q,C,O),((Z=Ee&&Ee.onVnodeMounted)||ze||xe)&&vn(()=>{Z&&hr(Z,z,T),ze&&ke.enter(Q),xe&&bs(T,null,z,"mounted")},J)},ye=(T,C,O,z,J)=>{if(O&&E(T,O),z)for(let N=0;N<z.length;N++)E(T,z[N]);if(J){let N=J.subTree;if(C===N||wf(N.type)&&(N.ssContent===C||N.ssFallback===C)){const B=J.vnode;ye(T,B,B.scopeId,B.slotScopeIds,J.parent)}}},De=(T,C,O,z,J,N,B,H,Q=0)=>{for(let Z=Q;Z<T.length;Z++){const Ee=T[Z]=H?Pr(T[Z]):vr(T[Z]);$(null,Ee,C,O,z,J,N,B,H)}},le=(T,C,O,z,J,N,B)=>{const H=C.el=T.el;let{patchFlag:Q,dynamicChildren:Z,dirs:Ee}=C;Q|=T.patchFlag&16;const we=T.props||Lt,ke=C.props||Lt;let xe;if(O&&_s(O,!1),(xe=ke.onVnodeBeforeUpdate)&&hr(xe,O,C,T),Ee&&bs(C,T,O,"beforeUpdate"),O&&_s(O,!0),(we.innerHTML&&ke.innerHTML==null||we.textContent&&ke.textContent==null)&&u(H,""),Z?re(T.dynamicChildren,Z,H,O,z,ia(C,J),N):B||Re(T,C,H,null,O,z,ia(C,J),N,!1),Q>0){if(Q&16)ce(H,we,ke,O,J);else if(Q&2&&we.class!==ke.class&&o(H,"class",null,ke.class,J),Q&4&&o(H,"style",we.style,ke.style,J),Q&8){const ze=C.dynamicProps;for(let ot=0;ot<ze.length;ot++){const We=ze[ot],ht=we[We],_t=ke[We];(_t!==ht||We==="value")&&o(H,We,ht,_t,J,O)}}Q&1&&T.children!==C.children&&u(H,C.children)}else!B&&Z==null&&ce(H,we,ke,O,J);((xe=ke.onVnodeUpdated)||Ee)&&vn(()=>{xe&&hr(xe,O,C,T),Ee&&bs(C,T,O,"updated")},z)},re=(T,C,O,z,J,N,B)=>{for(let H=0;H<C.length;H++){const Q=T[H],Z=C[H],Ee=Q.el&&(Q.type===Le||!Cs(Q,Z)||Q.shapeFlag&198)?g(Q.el):O;$(Q,Z,Ee,null,z,J,N,B,!0)}},ce=(T,C,O,z,J)=>{if(C!==O){if(C!==Lt)for(const N in C)!wo(N)&&!(N in O)&&o(T,N,C[N],null,J,z);for(const N in O){if(wo(N))continue;const B=O[N],H=C[N];B!==H&&N!=="value"&&o(T,N,H,B,J,z)}"value"in O&&o(T,"value",C.value,O.value,J)}},ne=(T,C,O,z,J,N,B,H,Q)=>{const Z=C.el=T?T.el:a(""),Ee=C.anchor=T?T.anchor:a("");let{patchFlag:we,dynamicChildren:ke,slotScopeIds:xe}=C;xe&&(H=H?H.concat(xe):xe),T==null?(r(Z,O,z),r(Ee,O,z),De(C.children||[],O,Ee,J,N,B,H,Q)):we>0&&we&64&&ke&&T.dynamicChildren&&T.dynamicChildren.length===ke.length?(re(T.dynamicChildren,ke,O,J,N,B,H),(C.key!=null||J&&C===J.subTree)&&Nl(T,C,!0)):Re(T,C,O,Ee,J,N,B,H,Q)},Pe=(T,C,O,z,J,N,B,H,Q)=>{C.slotScopeIds=H,T==null?C.shapeFlag&512?J.ctx.activate(C,O,z,B,Q):Ye(C,O,z,J,N,B,Q):Ge(T,C,Q)},Ye=(T,C,O,z,J,N,B)=>{const H=T.component=Dm(T,z,J);if(Ui(T)&&(H.ctx.renderer=ge),jm(H,!1,B),H.asyncDep){if(J&&J.registerDep(H,Ve,B),!T.el){const Q=H.subTree=je(wn);ae(null,Q,C,O),T.placeholder=Q.el}}else Ve(H,T,C,O,J,N,B)},Ge=(T,C,O)=>{const z=C.component=T.component;if(wm(T,C,O))if(z.asyncDep&&!z.asyncResolved){Ue(z,C,O);return}else z.next=C,z.update();else C.el=T.el,z.vnode=C},Ve=(T,C,O,z,J,N,B)=>{const H=()=>{if(T.isMounted){let{next:we,bu:ke,u:xe,parent:ze,vnode:ot}=T;{const Ke=vf(T);if(Ke){we&&(we.el=ot.el,Ue(T,we,B)),Ke.asyncDep.then(()=>{vn(()=>{T.isUnmounted||Z()},J)});return}}let We=we,ht;_s(T,!1),we?(we.el=ot.el,Ue(T,we,B)):we=ot,ke&&ci(ke),(ht=we.props&&we.props.onVnodeBeforeUpdate)&&hr(ht,ze,we,ot),_s(T,!0);const _t=bc(T),Pt=T.subTree;T.subTree=_t,$(Pt,_t,g(Pt.el),W(Pt),T,J,N),we.el=_t.el,We===null&&bm(T,_t.el),xe&&vn(xe,J),(ht=we.props&&we.props.onVnodeUpdated)&&vn(()=>hr(ht,ze,we,ot),J)}else{let we;const{el:ke,props:xe}=C,{bm:ze,m:ot,parent:We,root:ht,type:_t}=T,Pt=Ys(C);_s(T,!1),ze&&ci(ze),!Pt&&(we=xe&&xe.onVnodeBeforeMount)&&hr(we,We,C),_s(T,!0);{ht.ce&&ht.ce._hasShadowRoot()&&ht.ce._injectChildStyle(_t,T.parent?T.parent.type:void 0);const Ke=T.subTree=bc(T);$(null,Ke,O,z,T,J,N),C.el=Ke.el}if(ot&&vn(ot,J),!Pt&&(we=xe&&xe.onVnodeMounted)){const Ke=C;vn(()=>hr(we,We,Ke),J)}(C.shapeFlag&256||We&&Ys(We.vnode)&&We.vnode.shapeFlag&256)&&T.a&&vn(T.a,J),T.isMounted=!0,C=O=z=null}};T.scope.on();const Q=T.effect=new _d(H);T.scope.off();const Z=T.update=Q.run.bind(Q),Ee=T.job=Q.runIfDirty.bind(Q);Ee.i=T,Ee.id=T.uid,Q.scheduler=()=>Ml(Ee),_s(T,!0),Z()},Ue=(T,C,O)=>{C.component=T;const z=T.vnode.props;T.vnode=C,T.next=null,km(T,C.props,z,O),Em(T,C.children,O),Dr(),lc(T),jr()},Re=(T,C,O,z,J,N,B,H,Q=!1)=>{const Z=T&&T.children,Ee=T?T.shapeFlag:0,we=C.children,{patchFlag:ke,shapeFlag:xe}=C;if(ke>0){if(ke&128){Ae(Z,we,O,z,J,N,B,H,Q);return}else if(ke&256){rt(Z,we,O,z,J,N,B,H,Q);return}}xe&8?(Ee&16&&He(Z,J,N),we!==Z&&u(O,we)):Ee&16?xe&16?Ae(Z,we,O,z,J,N,B,H,Q):He(Z,J,N,!0):(Ee&8&&u(O,""),xe&16&&De(we,O,z,J,N,B,H,Q))},rt=(T,C,O,z,J,N,B,H,Q)=>{T=T||Gs,C=C||Gs;const Z=T.length,Ee=C.length,we=Math.min(Z,Ee);let ke;for(ke=0;ke<we;ke++){const xe=C[ke]=Q?Pr(C[ke]):vr(C[ke]);$(T[ke],xe,O,null,J,N,B,H,Q)}Z>Ee?He(T,J,N,!0,!1,we):De(C,O,z,J,N,B,H,Q,we)},Ae=(T,C,O,z,J,N,B,H,Q)=>{let Z=0;const Ee=C.length;let we=T.length-1,ke=Ee-1;for(;Z<=we&&Z<=ke;){const xe=T[Z],ze=C[Z]=Q?Pr(C[Z]):vr(C[Z]);if(Cs(xe,ze))$(xe,ze,O,null,J,N,B,H,Q);else break;Z++}for(;Z<=we&&Z<=ke;){const xe=T[we],ze=C[ke]=Q?Pr(C[ke]):vr(C[ke]);if(Cs(xe,ze))$(xe,ze,O,null,J,N,B,H,Q);else break;we--,ke--}if(Z>we){if(Z<=ke){const xe=ke+1,ze=xe<Ee?C[xe].el:z;for(;Z<=ke;)$(null,C[Z]=Q?Pr(C[Z]):vr(C[Z]),O,ze,J,N,B,H,Q),Z++}}else if(Z>ke)for(;Z<=we;)ct(T[Z],J,N,!0),Z++;else{const xe=Z,ze=Z,ot=new Map;for(Z=ze;Z<=ke;Z++){const dt=C[Z]=Q?Pr(C[Z]):vr(C[Z]);dt.key!=null&&ot.set(dt.key,Z)}let We,ht=0;const _t=ke-ze+1;let Pt=!1,Ke=0;const Bt=new Array(_t);for(Z=0;Z<_t;Z++)Bt[Z]=0;for(Z=xe;Z<=we;Z++){const dt=T[Z];if(ht>=_t){ct(dt,J,N,!0);continue}let kt;if(dt.key!=null)kt=ot.get(dt.key);else for(We=ze;We<=ke;We++)if(Bt[We-ze]===0&&Cs(dt,C[We])){kt=We;break}kt===void 0?ct(dt,J,N,!0):(Bt[kt-ze]=Z+1,kt>=Ke?Ke=kt:Pt=!0,$(dt,C[kt],O,null,J,N,B,H,Q),ht++)}const Vt=Pt?Rm(Bt):Gs;for(We=Vt.length-1,Z=_t-1;Z>=0;Z--){const dt=ze+Z,kt=C[dt],mt=C[dt+1],rn=dt+1<Ee?mt.el||yf(mt):z;Bt[Z]===0?$(null,kt,O,rn,J,N,B,H,Q):Pt&&(We<0||Z!==Vt[We]?Be(kt,O,rn,2):We--)}}},Be=(T,C,O,z,J=null)=>{const{el:N,type:B,transition:H,children:Q,shapeFlag:Z}=T;if(Z&6){Be(T.component.subTree,C,O,z);return}if(Z&128){T.suspense.move(C,O,z);return}if(Z&64){B.move(T,C,O,ge);return}if(B===Le){r(N,C,O);for(let we=0;we<Q.length;we++)Be(Q[we],C,O,z);r(T.anchor,C,O);return}if(B===aa){ee(T,C,O);return}if(z!==2&&Z&1&&H)if(z===0)H.beforeEnter(N),r(N,C,O),vn(()=>H.enter(N),J);else{const{leave:we,delayLeave:ke,afterLeave:xe}=H,ze=()=>{T.ctx.isUnmounted?s(N):r(N,C,O)},ot=()=>{N._isLeaving&&N[mr](!0),we(N,()=>{ze(),xe&&xe()})};ke?ke(N,ze,ot):ot()}else r(N,C,O)},ct=(T,C,O,z=!1,J=!1)=>{const{type:N,props:B,ref:H,children:Q,dynamicChildren:Z,shapeFlag:Ee,patchFlag:we,dirs:ke,cacheIndex:xe}=T;if(we===-2&&(J=!1),H!=null&&(Dr(),So(H,null,O,T,!0),jr()),xe!=null&&(C.renderCache[xe]=void 0),Ee&256){C.ctx.deactivate(T);return}const ze=Ee&1&&ke,ot=!Ys(T);let We;if(ot&&(We=B&&B.onVnodeBeforeUnmount)&&hr(We,C,T),Ee&6)ut(T.component,O,z);else{if(Ee&128){T.suspense.unmount(O,z);return}ze&&bs(T,null,C,"beforeUnmount"),Ee&64?T.type.remove(T,C,O,ge,z):Z&&!Z.hasOnce&&(N!==Le||we>0&&we&64)?He(Z,C,O,!1,!0):(N===Le&&we&384||!J&&Ee&16)&&He(Q,C,O),z&&Ht(T)}(ot&&(We=B&&B.onVnodeUnmounted)||ze)&&vn(()=>{We&&hr(We,C,T),ze&&bs(T,null,C,"unmounted")},O)},Ht=T=>{const{type:C,el:O,anchor:z,transition:J}=T;if(C===Le){pt(O,z);return}if(C===aa){te(T);return}const N=()=>{s(O),J&&!J.persisted&&J.afterLeave&&J.afterLeave()};if(T.shapeFlag&1&&J&&!J.persisted){const{leave:B,delayLeave:H}=J,Q=()=>B(O,N);H?H(T.el,N,Q):Q()}else N()},pt=(T,C)=>{let O;for(;T!==C;)O=_(T),s(T),T=O;s(C)},ut=(T,C,O)=>{const{bum:z,scope:J,job:N,subTree:B,um:H,m:Q,a:Z}=T;Tc(Q),Tc(Z),z&&ci(z),J.stop(),N&&(N.flags|=8,ct(B,T,C,O)),H&&vn(H,C),vn(()=>{T.isUnmounted=!0},C)},He=(T,C,O,z=!1,J=!1,N=0)=>{for(let B=N;B<T.length;B++)ct(T[B],C,O,z,J)},W=T=>{if(T.shapeFlag&6)return W(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const C=_(T.anchor||T.el),O=C&&C[zd];return O?_(O):C};let _e=!1;const he=(T,C,O)=>{let z;T==null?C._vnode&&(ct(C._vnode,null,null,!0),z=C._vnode.component):$(C._vnode||null,T,C,null,null,null,O),C._vnode=T,_e||(_e=!0,lc(z),Bd(),_e=!1)},ge={p:$,um:ct,m:Be,r:Ht,mt:Ye,mc:De,pc:Re,pbc:re,n:W,o:e};return{render:he,hydrate:void 0,createApp:hm(he)}}function ia({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 _s({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function xm(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Nl(e,t,n=!1){const r=e.children,s=t.children;if(Qe(r)&&Qe(s))for(let o=0;o<r.length;o++){const i=r[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=Pr(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Nl(i,a)),a.type===zi&&(a.patchFlag===-1&&(a=s[o]=Pr(a)),a.el=i.el),a.type===wn&&!a.el&&(a.el=i.el)}}function Rm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const f=e[r];if(f!==0){if(s=n[n.length-1],e[s]<f){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<f?o=a+1:i=a;f<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function vf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:vf(t)}function Tc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function yf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?yf(t.subTree):null}const wf=e=>e.__isSuspense;function Pm(e,t){t&&t.pendingBranch?Qe(e)?t.effects.push(...e):t.effects.push(e):jp(e)}const Le=Symbol.for("v-fgt"),zi=Symbol.for("v-txt"),wn=Symbol.for("v-cmt"),aa=Symbol.for("v-stc"),Eo=[];let Vn=null;function y(e=!1){Eo.push(Vn=e?null:[])}function Mm(){Eo.pop(),Vn=Eo[Eo.length-1]||null}let Oo=1;function Ii(e,t=!1){Oo+=e,e<0&&Vn&&t&&(Vn.hasOnce=!0)}function bf(e){return e.dynamicChildren=Oo>0?Vn||Gs:null,Mm(),Oo>0&&Vn&&Vn.push(e),e}function k(e,t,n,r,s,o){return bf(v(e,t,n,r,s,o,!0))}function bt(e,t,n,r,s){return bf(je(e,t,n,r,s,!0))}function No(e){return e?e.__v_isVNode===!0:!1}function Cs(e,t){return e.type===t.type&&e.key===t.key}const _f=({key:e})=>e??null,fi=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?zt(e)||_n(e)||nt(e)?{i:pn,r:e,k:t,f:!!n}:e:null);function v(e,t=null,n=null,r=0,s=null,o=e===Le?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&_f(t),ref:t&&fi(t),scopeId:Hd,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:o,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:pn};return a?(Ll(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=zt(n)?8:16),Oo>0&&!i&&Vn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&Vn.push(l),l}const je=$m;function $m(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===tf)&&(e=wn),No(e)){const a=ds(e,t,!0);return n&&Ll(a,n),Oo>0&&!o&&Vn&&(a.shapeFlag&6?Vn[Vn.indexOf(e)]=a:Vn.push(a)),a.patchFlag=-2,a}if(Hm(e)&&(e=e.__vccOpts),t){t=Om(t);let{class:a,style:l}=t;a&&!zt(a)&&(t.class=tt(a)),At(l)&&(Pl(l)&&!Qe(l)&&(l=nn({},l)),t.style=ls(l))}const i=zt(e)?1:wf(e)?128:qd(e)?64:At(e)?4:nt(e)?2:0;return v(e,t,n,r,s,i,o,!0)}function Om(e){return e?Pl(e)||df(e)?nn({},e):e:null}function ds(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,f=t?kf(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&_f(f),ref:t&&t.ref?n&&o?Qe(o)?o.concat(fi(t)):[o,fi(t)]:fi(t):o,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!==Le?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ds(e.ssContent),ssFallback:e.ssFallback&&ds(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&$o(u,l.clone(u)),u}function Lo(e=" ",t=0){return je(zi,null,e,t)}function fe(e="",t=!1){return t?(y(),bt(wn,null,e)):je(wn,null,e)}function vr(e){return e==null||typeof e=="boolean"?je(wn):Qe(e)?je(Le,null,e.slice()):No(e)?Pr(e):je(zi,null,String(e))}function Pr(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ds(e)}function Ll(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Qe(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Ll(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!df(t)?t._ctx=pn:s===3&&pn&&(pn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else nt(t)?(t={default:t,_ctx:pn},n=32):(t=String(t),r&64?(n=16,t=[Lo(t)]):n=8);e.children=t,e.shapeFlag|=n}function kf(...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=tt([t.class,r.class]));else if(s==="style")t.style=ls([t.style,r.style]);else if(Oi(s)){const o=t[s],i=r[s];i&&o!==i&&!(Qe(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function hr(e,t,n,r=null){lr(e,t,7,[n,r])}const Nm=of();let Lm=0;function Dm(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Nm,o={uid:Lm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new lp(!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:hf(r,s),emitsOptions:af(r,s),emit:null,emitted:null,propsDefaults:Lt,inheritAttrs:r.inheritAttrs,ctx:Lt,data:Lt,props:Lt,attrs:Lt,slots:Lt,refs:Lt,setupState:Lt,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 o.ctx={_:o},o.root=t?t.root:o,o.emit=mm.bind(null,o),e.ce&&e.ce(o),o}let bn=null;const Dl=()=>bn||pn;let Ei,Ya;{const e=Di(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};Ei=t("__VUE_INSTANCE_SETTERS__",n=>bn=n),Ya=t("__VUE_SSR_SETTERS__",n=>Do=n)}const qo=e=>{const t=bn;return Ei(e),e.scope.on(),()=>{e.scope.off(),Ei(t)}},Sc=()=>{bn&&bn.scope.off(),Ei(null)};function Tf(e){return e.vnode.shapeFlag&4}let Do=!1;function jm(e,t=!1,n=!1){t&&Ya(t);const{props:r,children:s}=e.vnode,o=Tf(e);_m(e,r,o,t),Im(e,s,n||t);const i=o?Fm(e,t):void 0;return t&&Ya(!1),i}function Fm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,sm);const{setup:r}=n;if(r){Dr();const s=e.setupContext=r.length>1?If(e):null,o=qo(e),i=zo(r,e,0,[e.props,s]),a=pd(i);if(jr(),o(),(a||e.sp)&&!Ys(e)&&Zd(e),a){if(i.then(Sc,Sc),t)return i.then(l=>{Ic(e,l)}).catch(l=>{Bi(l,e,0)});e.asyncDep=i}else Ic(e,i)}else Sf(e)}function Ic(e,t,n){nt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:At(t)&&(e.setupState=Dd(t)),Sf(e)}function Sf(e,t,n){const r=e.type;e.render||(e.render=r.render||kr);{const s=qo(e);Dr();try{am(e)}finally{jr(),s()}}}const Bm={get(e,t){return yn(e,"get",""),e[t]}};function If(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Bm),slots:e.slots,emit:e.emit,expose:t}}function qi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Dd(Ap(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Io)return Io[n](e)},has(t,n){return n in t||n in Io}})):e.proxy}function Um(e,t=!0){return nt(e)?e.displayName||e.name:e.name||t&&e.__name}function Hm(e){return nt(e)&&"__vccOpts"in e}const de=(e,t)=>$p(e,t,Do);function jl(e,t,n){try{Ii(-1);const r=arguments.length;return r===2?At(t)&&!Qe(t)?No(t)?je(e,null,[t]):je(e,t):je(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&No(n)&&(n=[n]),je(e,t,n))}finally{Ii(1)}}const Wm="3.5.30";/**
14
+ * @vue/runtime-dom v3.5.30
15
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
+ * @license MIT
17
+ **/let Qa;const Ec=typeof window<"u"&&window.trustedTypes;if(Ec)try{Qa=Ec.createPolicy("vue",{createHTML:e=>e})}catch{}const Ef=Qa?e=>Qa.createHTML(e):e=>e,Vm="http://www.w3.org/2000/svg",zm="http://www.w3.org/1998/Math/MathML",Rr=typeof document<"u"?document:null,Cc=Rr&&Rr.createElement("template"),qm={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"?Rr.createElementNS(Vm,e):t==="mathml"?Rr.createElementNS(zm,e):n?Rr.createElement(e,{is:n}):Rr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Rr.createTextNode(e),createComment:e=>Rr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Rr.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{Cc.innerHTML=Ef(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Cc.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[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Xr="transition",po="animation",jo=Symbol("_vtc"),Cf={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},Gm=nn({},Kd,Cf),Km=e=>(e.displayName="Transition",e.props=Gm,e),Af=Km((e,{slots:t})=>jl(zp,Jm(e),t)),ks=(e,t=[])=>{Qe(e)?e.forEach(n=>n(...t)):e&&e(...t)},Ac=e=>e?Qe(e)?e.some(t=>t.length>1):e.length>1:!1;function Jm(e){const t={};for(const ne in e)ne in Cf||(t[ne]=e[ne]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:f=i,appearToClass:u=a,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:E=`${n}-leave-to`}=e,F=Ym(s),$=F&&F[0],Y=F&&F[1],{onBeforeEnter:ae,onEnter:G,onEnterCancelled:ee,onLeave:te,onLeaveCancelled:Te,onBeforeAppear:ve=ae,onAppear:ye=G,onAppearCancelled:De=ee}=t,le=(ne,Pe,Ye,Ge)=>{ne._enterCancelled=Ge,Ts(ne,Pe?u:a),Ts(ne,Pe?f:i),Ye&&Ye()},re=(ne,Pe)=>{ne._isLeaving=!1,Ts(ne,g),Ts(ne,E),Ts(ne,_),Pe&&Pe()},ce=ne=>(Pe,Ye)=>{const Ge=ne?ye:G,Ve=()=>le(Pe,ne,Ye);ks(Ge,[Pe,Ve]),xc(()=>{Ts(Pe,ne?l:o),Ar(Pe,ne?u:a),Ac(Ge)||Rc(Pe,r,$,Ve)})};return nn(t,{onBeforeEnter(ne){ks(ae,[ne]),Ar(ne,o),Ar(ne,i)},onBeforeAppear(ne){ks(ve,[ne]),Ar(ne,l),Ar(ne,f)},onEnter:ce(!1),onAppear:ce(!0),onLeave(ne,Pe){ne._isLeaving=!0;const Ye=()=>re(ne,Pe);Ar(ne,g),ne._enterCancelled?(Ar(ne,_),$c(ne)):($c(ne),Ar(ne,_)),xc(()=>{ne._isLeaving&&(Ts(ne,g),Ar(ne,E),Ac(te)||Rc(ne,r,Y,Ye))}),ks(te,[ne,Ye])},onEnterCancelled(ne){le(ne,!1,void 0,!0),ks(ee,[ne])},onAppearCancelled(ne){le(ne,!0,void 0,!0),ks(De,[ne])},onLeaveCancelled(ne){re(ne),ks(Te,[ne])}})}function Ym(e){if(e==null)return null;if(At(e))return[la(e.enter),la(e.leave)];{const t=la(e);return[t,t]}}function la(e){return ep(e)}function Ar(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[jo]||(e[jo]=new Set)).add(t)}function Ts(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[jo];n&&(n.delete(t),n.size||(e[jo]=void 0))}function xc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Qm=0;function Rc(e,t,n,r){const s=e._endId=++Qm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Xm(e,t);if(!i)return r();const f=i+"end";let u=0;const g=()=>{e.removeEventListener(f,_),o()},_=E=>{E.target===e&&++u>=l&&g()};setTimeout(()=>{u<l&&g()},a+1),e.addEventListener(f,_)}function Xm(e,t){const n=window.getComputedStyle(e),r=F=>(n[F]||"").split(", "),s=r(`${Xr}Delay`),o=r(`${Xr}Duration`),i=Pc(s,o),a=r(`${po}Delay`),l=r(`${po}Duration`),f=Pc(a,l);let u=null,g=0,_=0;t===Xr?i>0&&(u=Xr,g=i,_=o.length):t===po?f>0&&(u=po,g=f,_=l.length):(g=Math.max(i,f),u=g>0?i>f?Xr:po:null,_=u?u===Xr?o.length:l.length:0);const E=u===Xr&&/\b(?:transform|all)(?:,|$)/.test(r(`${Xr}Property`).toString());return{type:u,timeout:g,propCount:_,hasTransform:E}}function Pc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Mc(n)+Mc(e[r])))}function Mc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function $c(e){return(e?e.ownerDocument:document).body.offsetHeight}function Zm(e,t,n){const r=e[jo];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Oc=Symbol("_vod"),eg=Symbol("_vsh"),tg=Symbol(""),ng=/(?:^|;)\s*display\s*:/;function rg(e,t,n){const r=e.style,s=zt(n);let o=!1;if(n&&!s){if(t)if(zt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&hi(r,a,"")}else for(const i in t)n[i]==null&&hi(r,i,"");for(const i in n)i==="display"&&(o=!0),hi(r,i,n[i])}else if(s){if(t!==n){const i=r[tg];i&&(n+=";"+i),r.cssText=n,o=ng.test(n)}}else t&&e.removeAttribute("style");Oc in e&&(e[Oc]=o?r.display:"",e[eg]&&(r.display="none"))}const Nc=/\s*!important$/;function hi(e,t,n){if(Qe(n))n.forEach(r=>hi(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=sg(e,t);Nc.test(n)?e.setProperty(fs(r),n.replace(Nc,""),"important"):e[r]=n}}const Lc=["Webkit","Moz","ms"],ca={};function sg(e,t){const n=ca[t];if(n)return n;let r=Pn(t);if(r!=="filter"&&r in e)return ca[t]=r;r=Li(r);for(let s=0;s<Lc.length;s++){const o=Lc[s]+r;if(o in e)return ca[t]=o}return t}const Dc="http://www.w3.org/1999/xlink";function jc(e,t,n,r,s,o=ip(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Dc,t.slice(6,t.length)):e.setAttributeNS(Dc,t,n):n==null||o&&!yd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":ir(n)?String(n):n)}function Fc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Ef(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const a=o==="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 i=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=yd(n):n==null&&a==="string"?(n="",i=!0):a==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function zs(e,t,n,r){e.addEventListener(t,n,r)}function og(e,t,n,r){e.removeEventListener(t,n,r)}const Bc=Symbol("_vei");function ig(e,t,n,r,s=null){const o=e[Bc]||(e[Bc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=ag(t);if(r){const f=o[t]=ug(r,s);zs(e,a,f,l)}else i&&(og(e,a,i,l),o[t]=void 0)}}const Uc=/(?:Once|Passive|Capture)$/;function ag(e){let t;if(Uc.test(e)){t={};let r;for(;r=e.match(Uc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):fs(e.slice(2)),t]}let ua=0;const lg=Promise.resolve(),cg=()=>ua||(lg.then(()=>ua=0),ua=Date.now());function ug(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;lr(dg(r,n.value),t,5,[r])};return n.value=e,n.attached=cg(),n}function dg(e,t){if(Qe(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 Hc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,fg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Zm(e,r,i):t==="style"?rg(e,n,r):Oi(t)?bl(t)||ig(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):hg(e,t,r,i))?(Fc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&jc(e,t,r,i,o,t!=="value")):e._isVueCE&&(pg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!zt(r)))?Fc(e,Pn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),jc(e,t,r,i))};function hg(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Hc(t)&&nt(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 Hc(t)&&zt(n)?!1:t in e}function pg(e,t){const n=e._def.props;if(!n)return!1;const r=Pn(t);return Array.isArray(n)?n.some(s=>Pn(s)===r):Object.keys(n).some(s=>Pn(s)===r)}const Wc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Qe(t)?n=>ci(t,n):t};function mg(e){e.target.composing=!0}function Vc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const da=Symbol("_assign");function zc(e,t,n){return t&&(e=e.trim()),n&&(e=Tl(e)),e}const Ur={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[da]=Wc(s);const o=r||s.props&&s.props.type==="number";zs(e,t?"change":"input",i=>{i.target.composing||e[da](zc(e.value,n,o))}),(n||o)&&zs(e,"change",()=>{e.value=zc(e.value,n,o)}),t||(zs(e,"compositionstart",mg),zs(e,"compositionend",Vc),zs(e,"change",Vc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[da]=Wc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?Tl(e.value):e.value,l=t??"";a!==l&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l))}},gg=["ctrl","shift","alt","meta"],vg={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)=>gg.some(n=>e[`${n}Key`]&&!t.includes(n))},Tt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...o)=>{for(let i=0;i<t.length;i++){const a=vg[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},yg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Rn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=fs(s.key);if(t.some(i=>i===o||yg[i]===o))return e(s)}))},wg=nn({patchProp:fg},qm);let qc;function bg(){return qc||(qc=Cm(wg))}const _g=((...e)=>{const t=bg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Tg(r);if(!s)return;const o=t._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,kg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function kg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Tg(e){return zt(e)?document.querySelector(e):e}/*!
18
+ * vue-router v4.6.4
19
+ * (c) 2025 Eduardo San Martin Morote
20
+ * @license MIT
21
+ */const qs=typeof document<"u";function xf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Sg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&xf(e.default)}const Et=Object.assign;function fa(e,t){const n={};for(const r in t){const s=t[r];n[r]=cr(s)?s.map(e):e(s)}return n}const Co=()=>{},cr=Array.isArray;function Gc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Rf=/#/g,Ig=/&/g,Eg=/\//g,Cg=/=/g,Ag=/\?/g,Pf=/\+/g,xg=/%5B/g,Rg=/%5D/g,Mf=/%5E/g,Pg=/%60/g,$f=/%7B/g,Mg=/%7C/g,Of=/%7D/g,$g=/%20/g;function Fl(e){return e==null?"":encodeURI(""+e).replace(Mg,"|").replace(xg,"[").replace(Rg,"]")}function Og(e){return Fl(e).replace($f,"{").replace(Of,"}").replace(Mf,"^")}function Xa(e){return Fl(e).replace(Pf,"%2B").replace($g,"+").replace(Rf,"%23").replace(Ig,"%26").replace(Pg,"`").replace($f,"{").replace(Of,"}").replace(Mf,"^")}function Ng(e){return Xa(e).replace(Cg,"%3D")}function Lg(e){return Fl(e).replace(Rf,"%23").replace(Ag,"%3F")}function Dg(e){return Lg(e).replace(Eg,"%2F")}function Fo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const jg=/\/$/,Fg=e=>e.replace(jg,"");function ha(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),o=t.slice(l,a>0?a:t.length),s=e(o.slice(1))),a>=0&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Wg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Fo(i)}}function Bg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Kc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Ug(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&ro(t.matched[r],n.matched[s])&&Nf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ro(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Nf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Hg(e[n],t[n]))return!1;return!0}function Hg(e,t){return cr(e)?Jc(e,t):cr(t)?Jc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Jc(e,t){return cr(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Wg(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 o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const Zr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Za=(function(e){return e.pop="pop",e.push="push",e})({}),pa=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Vg(e){if(!e)if(qs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Fg(e)}const zg=/^[^#]+#/;function qg(e,t){return e.replace(zg,"#")+t}function Gg(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 Gi=()=>({left:window.scrollX,top:window.scrollY});function Kg(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=Gg(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 Yc(e,t){return(history.state?history.state.position-t:-1)+e}const el=new Map;function Jg(e,t){el.set(e,t)}function Yg(e){const t=el.get(e);return el.delete(e),t}function Qg(e){return typeof e=="string"||e&&typeof e=="object"}function Lf(e){return typeof e=="string"||typeof e=="symbol"}let Gt=(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 Df=Symbol("");Gt.MATCHER_NOT_FOUND+"",Gt.NAVIGATION_GUARD_REDIRECT+"",Gt.NAVIGATION_ABORTED+"",Gt.NAVIGATION_CANCELLED+"",Gt.NAVIGATION_DUPLICATED+"";function so(e,t){return Et(new Error,{type:e,[Df]:!0},t)}function xr(e,t){return e instanceof Error&&Df in e&&(t==null||!!(e.type&t))}const Xg=["params","query","hash"];function Zg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Xg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function ev(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(Pf," "),o=s.indexOf("="),i=Fo(o<0?s:s.slice(0,o)),a=o<0?null:Fo(s.slice(o+1));if(i in t){let l=t[i];cr(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Qc(e){let t="";for(let n in e){const r=e[n];if(n=Ng(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(cr(r)?r.map(s=>s&&Xa(s)):[r&&Xa(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function tv(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=cr(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const nv=Symbol(""),Xc=Symbol(""),Ki=Symbol(""),Bl=Symbol(""),tl=Symbol("");function mo(){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 rs(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const f=_=>{_===!1?l(so(Gt.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?l(_):Qg(_)?l(so(Gt.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(i&&r.enterCallbacks[s]===i&&typeof _=="function"&&i.push(_),a())},u=o(()=>e.call(r&&r.instances[s],t,n,f));let g=Promise.resolve(u);e.length<3&&(g=g.then(f)),g.catch(_=>l(_))})}function ma(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const a in i.components){let l=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(xf(l)){const f=(l.__vccOpts||l)[t];f&&o.push(rs(f,n,r,i,a,s))}else{let f=l();o.push(()=>f.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const g=Sg(u)?u.default:u;i.mods[a]=u,i.components[a]=g;const _=(g.__vccOpts||g)[t];return _&&rs(_,n,r,i,a,s)()}))}}return o}function rv(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const a=t.matched[i];a&&(e.matched.find(f=>ro(f,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(f=>ro(f,l))||s.push(l))}return[n,r,s]}/*!
22
+ * vue-router v4.6.4
23
+ * (c) 2025 Eduardo San Martin Morote
24
+ * @license MIT
25
+ */let sv=()=>location.protocol+"//"+location.host;function jf(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,a=s.slice(i);return a[0]!=="/"&&(a="/"+a),Kc(a,"")}return Kc(n,e)+r+s}function ov(e,t,n,r){let s=[],o=[],i=null;const a=({state:_})=>{const E=jf(e,location),F=n.value,$=t.value;let Y=0;if(_){if(n.value=E,t.value=_,i&&i===F){i=null;return}Y=$?_.position-$.position:0}else r(E);s.forEach(ae=>{ae(n.value,F,{delta:Y,type:Za.pop,direction:Y?Y>0?pa.forward:pa.back:pa.unknown})})};function l(){i=n.value}function f(_){s.push(_);const E=()=>{const F=s.indexOf(_);F>-1&&s.splice(F,1)};return o.push(E),E}function u(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(Et({},_.state,{scroll:Gi()}),"")}}function g(){for(const _ of o)_();o=[],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:f,destroy:g}}function Zc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Gi():null}}function iv(e){const{history:t,location:n}=window,r={value:jf(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(l,f,u){const g=e.indexOf("#"),_=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+l:sv()+e+l;try{t[u?"replaceState":"pushState"](f,"",_),s.value=f}catch(E){console.error(E),n[u?"replace":"assign"](_)}}function i(l,f){o(l,Et({},t.state,Zc(s.value.back,l,s.value.forward,!0),f,{position:s.value.position}),!0),r.value=l}function a(l,f){const u=Et({},s.value,t.state,{forward:l,scroll:Gi()});o(u.current,u,!0),o(l,Et({},Zc(r.value,l,null),{position:u.position+1},f),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function av(e){e=Vg(e);const t=iv(e),n=ov(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=Et({location:"",base:e,go:r,createHref:qg.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}function lv(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),av(e)}let xs=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var en=(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})(en||{});const cv={type:xs.Static,value:""},uv=/[a-zA-Z0-9_]/;function dv(e){if(!e)return[[]];if(e==="/")return[[cv]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(E){throw new Error(`ERR (${n})/"${f}": ${E}`)}let n=en.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,f="",u="";function g(){f&&(n===en.Static?o.push({type:xs.Static,value:f}):n===en.Param||n===en.ParamRegExp||n===en.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${f}) must be alone in its segment. eg: '/:ids+.`),o.push({type:xs.Param,value:f,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),f="")}function _(){f+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==en.ParamRegExp){r=n,n=en.EscapeNext;continue}switch(n){case en.Static:l==="/"?(f&&g(),i()):l===":"?(g(),n=en.Param):_();break;case en.EscapeNext:_(),n=r;break;case en.Param:l==="("?n=en.ParamRegExp:uv.test(l)?_():(g(),n=en.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case en.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=en.ParamRegExpEnd:u+=l;break;case en.ParamRegExpEnd:g(),n=en.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===en.ParamRegExp&&t(`Unfinished custom RegExp for param "${f}"`),g(),i(),s}const eu="[^/]+?",fv={sensitive:!1,strict:!1,start:!0,end:!0};var An=(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})(An||{});const hv=/[.+*?^${}()[\]/\\]/g;function pv(e,t){const n=Et({},fv,t),r=[];let s=n.start?"^":"";const o=[];for(const f of e){const u=f.length?[]:[An.Root];n.strict&&!f.length&&(s+="/");for(let g=0;g<f.length;g++){const _=f[g];let E=An.Segment+(n.sensitive?An.BonusCaseSensitive:0);if(_.type===xs.Static)g||(s+="/"),s+=_.value.replace(hv,"\\$&"),E+=An.Static;else if(_.type===xs.Param){const{value:F,repeatable:$,optional:Y,regexp:ae}=_;o.push({name:F,repeatable:$,optional:Y});const G=ae||eu;if(G!==eu){E+=An.BonusCustomRegExp;try{`${G}`}catch(te){throw new Error(`Invalid custom RegExp for param "${F}" (${G}): `+te.message)}}let ee=$?`((?:${G})(?:/(?:${G}))*)`:`(${G})`;g||(ee=Y&&f.length<2?`(?:/${ee})`:"/"+ee),Y&&(ee+="?"),s+=ee,E+=An.Dynamic,Y&&(E+=An.BonusOptional),$&&(E+=An.BonusRepeatable),G===".*"&&(E+=An.BonusWildcard)}u.push(E)}r.push(u)}if(n.strict&&n.end){const f=r.length-1;r[f][r[f].length-1]+=An.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(f){const u=f.match(i),g={};if(!u)return null;for(let _=1;_<u.length;_++){const E=u[_]||"",F=o[_-1];g[F.name]=E&&F.repeatable?E.split("/"):E}return g}function l(f){let u="",g=!1;for(const _ of e){(!g||!u.endsWith("/"))&&(u+="/"),g=!1;for(const E of _)if(E.type===xs.Static)u+=E.value;else if(E.type===xs.Param){const{value:F,repeatable:$,optional:Y}=E,ae=F in f?f[F]:"";if(cr(ae)&&!$)throw new Error(`Provided param "${F}" is an array but it is not repeatable (* or + modifiers)`);const G=cr(ae)?ae.join("/"):ae;if(!G)if(Y)_.length<2&&(u.endsWith("/")?u=u.slice(0,-1):g=!0);else throw new Error(`Missing required param "${F}"`);u+=G}}return u||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function mv(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]===An.Static+An.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===An.Static+An.Segment?1:-1:0}function Ff(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=mv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(tu(r))return 1;if(tu(s))return-1}return s.length-r.length}function tu(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const gv={strict:!1,end:!0,sensitive:!1};function vv(e,t,n){const r=pv(dv(e.path),n),s=Et(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function yv(e,t){const n=[],r=new Map;t=Gc(gv,t);function s(g){return r.get(g)}function o(g,_,E){const F=!E,$=ru(g);$.aliasOf=E&&E.record;const Y=Gc(t,g),ae=[$];if("alias"in g){const te=typeof g.alias=="string"?[g.alias]:g.alias;for(const Te of te)ae.push(ru(Et({},$,{components:E?E.record.components:$.components,path:Te,aliasOf:E?E.record:$})))}let G,ee;for(const te of ae){const{path:Te}=te;if(_&&Te[0]!=="/"){const ve=_.record.path,ye=ve[ve.length-1]==="/"?"":"/";te.path=_.record.path+(Te&&ye+Te)}if(G=vv(te,_,Y),E?E.alias.push(G):(ee=ee||G,ee!==G&&ee.alias.push(G),F&&g.name&&!su(G)&&i(g.name)),Bf(G)&&l(G),$.children){const ve=$.children;for(let ye=0;ye<ve.length;ye++)o(ve[ye],G,E&&E.children[ye])}E=E||G}return ee?()=>{i(ee)}:Co}function i(g){if(Lf(g)){const _=r.get(g);_&&(r.delete(g),n.splice(n.indexOf(_),1),_.children.forEach(i),_.alias.forEach(i))}else{const _=n.indexOf(g);_>-1&&(n.splice(_,1),g.record.name&&r.delete(g.record.name),g.children.forEach(i),g.alias.forEach(i))}}function a(){return n}function l(g){const _=_v(g,n);n.splice(_,0,g),g.record.name&&!su(g)&&r.set(g.record.name,g)}function f(g,_){let E,F={},$,Y;if("name"in g&&g.name){if(E=r.get(g.name),!E)throw so(Gt.MATCHER_NOT_FOUND,{location:g});Y=E.record.name,F=Et(nu(_.params,E.keys.filter(ee=>!ee.optional).concat(E.parent?E.parent.keys.filter(ee=>ee.optional):[]).map(ee=>ee.name)),g.params&&nu(g.params,E.keys.map(ee=>ee.name))),$=E.stringify(F)}else if(g.path!=null)$=g.path,E=n.find(ee=>ee.re.test($)),E&&(F=E.parse($),Y=E.record.name);else{if(E=_.name?r.get(_.name):n.find(ee=>ee.re.test(_.path)),!E)throw so(Gt.MATCHER_NOT_FOUND,{location:g,currentLocation:_});Y=E.record.name,F=Et({},_.params,g.params),$=E.stringify(F)}const ae=[];let G=E;for(;G;)ae.unshift(G.record),G=G.parent;return{name:Y,path:$,params:F,matched:ae,meta:bv(ae)}}e.forEach(g=>o(g));function u(){n.length=0,r.clear()}return{addRoute:o,resolve:f,removeRoute:i,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function nu(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function ru(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:wv(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 wv(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 su(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function bv(e){return e.reduce((t,n)=>Et(t,n.meta),{})}function _v(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;Ff(e,t[o])<0?r=o:n=o+1}const s=kv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function kv(e){let t=e;for(;t=t.parent;)if(Bf(t)&&Ff(e,t)===0)return t}function Bf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function ou(e){const t=sr(Ki),n=sr(Bl),r=de(()=>{const l=be(e.to);return t.resolve(l)}),s=de(()=>{const{matched:l}=r.value,{length:f}=l,u=l[f-1],g=n.matched;if(!u||!g.length)return-1;const _=g.findIndex(ro.bind(null,u));if(_>-1)return _;const E=iu(l[f-2]);return f>1&&iu(u)===E&&g[g.length-1].path!==E?g.findIndex(ro.bind(null,l[f-2])):_}),o=de(()=>s.value>-1&&Cv(n.params,r.value.params)),i=de(()=>s.value>-1&&s.value===n.matched.length-1&&Nf(n.params,r.value.params));function a(l={}){if(Ev(l)){const f=t[be(e.replace)?"replace":"push"](be(e.to)).catch(Co);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:r,href:de(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function Tv(e){return e.length===1?e[0]:e}const Sv=cn({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:ou,setup(e,{slots:t}){const n=Fi(ou(e)),{options:r}=sr(Ki),s=de(()=>({[au(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[au(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&Tv(t.default(n));return e.custom?o:jl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Iv=Sv;function Ev(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 Cv(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(!cr(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function iu(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const au=(e,t,n)=>e??t??n,Av=cn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=sr(tl),s=de(()=>e.route||r.value),o=sr(Xc,0),i=de(()=>{let f=be(o);const{matched:u}=s.value;let g;for(;(g=u[f])&&!g.components;)f++;return f}),a=de(()=>s.value.matched[i.value]);ui(Xc,de(()=>i.value+1)),ui(nv,a),ui(tl,s);const l=D();return ft(()=>[l.value,a.value,e.name],([f,u,g],[_,E,F])=>{u&&(u.instances[g]=f,E&&E!==u&&f&&f===_&&(u.leaveGuards.size||(u.leaveGuards=E.leaveGuards),u.updateGuards.size||(u.updateGuards=E.updateGuards))),f&&u&&(!E||!ro(u,E)||!_)&&(u.enterCallbacks[g]||[]).forEach($=>$(f))},{flush:"post"}),()=>{const f=s.value,u=e.name,g=a.value,_=g&&g.components[u];if(!_)return lu(n.default,{Component:_,route:f});const E=g.props[u],F=E?E===!0?f.params:typeof E=="function"?E(f):E:null,Y=jl(_,Et({},F,t,{onVnodeUnmounted:ae=>{ae.component.isUnmounted&&(g.instances[u]=null)},ref:l}));return lu(n.default,{Component:Y,route:f})||Y}}});function lu(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const xv=Av;function Rv(e){const t=yv(e.routes,e),n=e.parseQuery||ev,r=e.stringifyQuery||Qc,s=e.history,o=mo(),i=mo(),a=mo(),l=xp(Zr);let f=Zr;qs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=fa.bind(null,W=>""+W),g=fa.bind(null,Dg),_=fa.bind(null,Fo);function E(W,_e){let he,ge;return Lf(W)?(he=t.getRecordMatcher(W),ge=_e):ge=W,t.addRoute(ge,he)}function F(W){const _e=t.getRecordMatcher(W);_e&&t.removeRoute(_e)}function $(){return t.getRoutes().map(W=>W.record)}function Y(W){return!!t.getRecordMatcher(W)}function ae(W,_e){if(_e=Et({},_e||l.value),typeof W=="string"){const O=ha(n,W,_e.path),z=t.resolve({path:O.path},_e),J=s.createHref(O.fullPath);return Et(O,z,{params:_(z.params),hash:Fo(O.hash),redirectedFrom:void 0,href:J})}let he;if(W.path!=null)he=Et({},W,{path:ha(n,W.path,_e.path).path});else{const O=Et({},W.params);for(const z in O)O[z]==null&&delete O[z];he=Et({},W,{params:g(O)}),_e.params=g(_e.params)}const ge=t.resolve(he,_e),Ce=W.hash||"";ge.params=u(_(ge.params));const T=Bg(r,Et({},W,{hash:Og(Ce),path:ge.path})),C=s.createHref(T);return Et({fullPath:T,hash:Ce,query:r===Qc?tv(W.query):W.query||{}},ge,{redirectedFrom:void 0,href:C})}function G(W){return typeof W=="string"?ha(n,W,l.value.path):Et({},W)}function ee(W,_e){if(f!==W)return so(Gt.NAVIGATION_CANCELLED,{from:_e,to:W})}function te(W){return ye(W)}function Te(W){return te(Et(G(W),{replace:!0}))}function ve(W,_e){const he=W.matched[W.matched.length-1];if(he&&he.redirect){const{redirect:ge}=he;let Ce=typeof ge=="function"?ge(W,_e):ge;return typeof Ce=="string"&&(Ce=Ce.includes("?")||Ce.includes("#")?Ce=G(Ce):{path:Ce},Ce.params={}),Et({query:W.query,hash:W.hash,params:Ce.path!=null?{}:W.params},Ce)}}function ye(W,_e){const he=f=ae(W),ge=l.value,Ce=W.state,T=W.force,C=W.replace===!0,O=ve(he,ge);if(O)return ye(Et(G(O),{state:typeof O=="object"?Et({},Ce,O.state):Ce,force:T,replace:C}),_e||he);const z=he;z.redirectedFrom=_e;let J;return!T&&Ug(r,ge,he)&&(J=so(Gt.NAVIGATION_DUPLICATED,{to:z,from:ge}),Be(ge,ge,!0,!1)),(J?Promise.resolve(J):re(z,ge)).catch(N=>xr(N)?xr(N,Gt.NAVIGATION_GUARD_REDIRECT)?N:Ae(N):Re(N,z,ge)).then(N=>{if(N){if(xr(N,Gt.NAVIGATION_GUARD_REDIRECT))return ye(Et({replace:C},G(N.to),{state:typeof N.to=="object"?Et({},Ce,N.to.state):Ce,force:T}),_e||z)}else N=ne(z,ge,!0,C,Ce);return ce(z,ge,N),N})}function De(W,_e){const he=ee(W,_e);return he?Promise.reject(he):Promise.resolve()}function le(W){const _e=pt.values().next().value;return _e&&typeof _e.runWithContext=="function"?_e.runWithContext(W):W()}function re(W,_e){let he;const[ge,Ce,T]=rv(W,_e);he=ma(ge.reverse(),"beforeRouteLeave",W,_e);for(const O of ge)O.leaveGuards.forEach(z=>{he.push(rs(z,W,_e))});const C=De.bind(null,W,_e);return he.push(C),He(he).then(()=>{he=[];for(const O of o.list())he.push(rs(O,W,_e));return he.push(C),He(he)}).then(()=>{he=ma(Ce,"beforeRouteUpdate",W,_e);for(const O of Ce)O.updateGuards.forEach(z=>{he.push(rs(z,W,_e))});return he.push(C),He(he)}).then(()=>{he=[];for(const O of T)if(O.beforeEnter)if(cr(O.beforeEnter))for(const z of O.beforeEnter)he.push(rs(z,W,_e));else he.push(rs(O.beforeEnter,W,_e));return he.push(C),He(he)}).then(()=>(W.matched.forEach(O=>O.enterCallbacks={}),he=ma(T,"beforeRouteEnter",W,_e,le),he.push(C),He(he))).then(()=>{he=[];for(const O of i.list())he.push(rs(O,W,_e));return he.push(C),He(he)}).catch(O=>xr(O,Gt.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function ce(W,_e,he){a.list().forEach(ge=>le(()=>ge(W,_e,he)))}function ne(W,_e,he,ge,Ce){const T=ee(W,_e);if(T)return T;const C=_e===Zr,O=qs?history.state:{};he&&(ge||C?s.replace(W.fullPath,Et({scroll:C&&O&&O.scroll},Ce)):s.push(W.fullPath,Ce)),l.value=W,Be(W,_e,he,C),Ae()}let Pe;function Ye(){Pe||(Pe=s.listen((W,_e,he)=>{if(!ut.listening)return;const ge=ae(W),Ce=ve(ge,ut.currentRoute.value);if(Ce){ye(Et(Ce,{replace:!0,force:!0}),ge).catch(Co);return}f=ge;const T=l.value;qs&&Jg(Yc(T.fullPath,he.delta),Gi()),re(ge,T).catch(C=>xr(C,Gt.NAVIGATION_ABORTED|Gt.NAVIGATION_CANCELLED)?C:xr(C,Gt.NAVIGATION_GUARD_REDIRECT)?(ye(Et(G(C.to),{force:!0}),ge).then(O=>{xr(O,Gt.NAVIGATION_ABORTED|Gt.NAVIGATION_DUPLICATED)&&!he.delta&&he.type===Za.pop&&s.go(-1,!1)}).catch(Co),Promise.reject()):(he.delta&&s.go(-he.delta,!1),Re(C,ge,T))).then(C=>{C=C||ne(ge,T,!1),C&&(he.delta&&!xr(C,Gt.NAVIGATION_CANCELLED)?s.go(-he.delta,!1):he.type===Za.pop&&xr(C,Gt.NAVIGATION_ABORTED|Gt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ce(ge,T,C)}).catch(Co)}))}let Ge=mo(),Ve=mo(),Ue;function Re(W,_e,he){Ae(W);const ge=Ve.list();return ge.length?ge.forEach(Ce=>Ce(W,_e,he)):console.error(W),Promise.reject(W)}function rt(){return Ue&&l.value!==Zr?Promise.resolve():new Promise((W,_e)=>{Ge.add([W,_e])})}function Ae(W){return Ue||(Ue=!W,Ye(),Ge.list().forEach(([_e,he])=>W?he(W):_e()),Ge.reset()),W}function Be(W,_e,he,ge){const{scrollBehavior:Ce}=e;if(!qs||!Ce)return Promise.resolve();const T=!he&&Yg(Yc(W.fullPath,0))||(ge||!he)&&history.state&&history.state.scroll||null;return tn().then(()=>Ce(W,_e,T)).then(C=>C&&Kg(C)).catch(C=>Re(C,W,_e))}const ct=W=>s.go(W);let Ht;const pt=new Set,ut={currentRoute:l,listening:!0,addRoute:E,removeRoute:F,clearRoutes:t.clearRoutes,hasRoute:Y,getRoutes:$,resolve:ae,options:e,push:te,replace:Te,go:ct,back:()=>ct(-1),forward:()=>ct(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Ve.add,isReady:rt,install(W){W.component("RouterLink",Iv),W.component("RouterView",xv),W.config.globalProperties.$router=ut,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>be(l)}),qs&&!Ht&&l.value===Zr&&(Ht=!0,te(s.location).catch(ge=>{}));const _e={};for(const ge in Zr)Object.defineProperty(_e,ge,{get:()=>l.value[ge],enumerable:!0});W.provide(Ki,ut),W.provide(Bl,Nd(_e)),W.provide(tl,l);const he=W.unmount;pt.add(W),W.unmount=function(){pt.delete(W),pt.size<1&&(f=Zr,Pe&&Pe(),Pe=null,l.value=Zr,Ht=!1,Ue=!1),he()}}};function He(W){return W.reduce((_e,he)=>_e.then(()=>le(he)),Promise.resolve())}return ut}function Pv(){return sr(Ki)}function Mv(e){return sr(Bl)}const cu=768;function Uf(){const e=D(typeof window<"u"?window.innerWidth<cu:!1);let t=null;function n(r){e.value=r.matches}return zr(()=>{t=window.matchMedia(`(max-width: ${cu-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Wi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const $v={key:0,class:"desktop-sidebar"},Ov={class:"desktop-main"},uu="codex-web-local.sidebar-width.v1",Nv=260,Lv=620,du=320,Dv=cn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Uf();function r(f){return Math.min(Lv,Math.max(Nv,f))}function s(){if(typeof window>"u")return du;const f=window.localStorage.getItem(uu),u=Number(f);return Number.isFinite(u)?r(u):du}const o=D(s()),i=de(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function a(f){typeof window>"u"||window.localStorage.setItem(uu,String(f))}function l(f){f.preventDefault();const u=f.clientX,g=o.value,_=F=>{const $=F.clientX-u;o.value=r(g+$)},E=()=>{a(o.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",E)}return(f,u)=>(y(),k("div",{class:tt(["desktop-layout",{"is-mobile":be(n)}]),style:ls(i.value)},[be(n)?(y(),bt(To,{key:0,to:"body"},[je(Af,{name:"drawer"},{default:It(()=>[e.isSidebarCollapsed?fe("",!0):(y(),k("div",{key:0,class:"mobile-drawer-backdrop",onClick:u[1]||(u[1]=g=>f.$emit("close-sidebar"))},[v("aside",{class:"mobile-drawer",onClick:u[0]||(u[0]=Tt(()=>{},["stop"]))},[_r(f.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):fe("",!0),be(n)?fe("",!0):(y(),k(Le,{key:1},[e.isSidebarCollapsed?fe("",!0):(y(),k("aside",$v,[_r(f.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?fe("",!0):(y(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),v("section",Ov,[_r(f.$slots,"content",{},void 0)])],6))}}),yt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},jv=yt(Dv,[["__scopeId","data-v-068d06c5"]]),Fv={},Bv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Uv(e,t){return y(),k("svg",Bv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Ji=yt(Fv,[["render",Uv]]),Hv={},Wv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Vv(e,t){return y(),k("svg",Wv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Hf=yt(Hv,[["render",Vv]]),zv={},qv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Gv(e,t){return y(),k("svg",qv,[...t[0]||(t[0]=[v("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const go=yt(zv,[["render",Gv]]),Kv={},Jv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Yv(e,t){return y(),k("svg",Jv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4L18.5 9.5a2.828 2.828 0 1 0-4-4L4 16zm9.5-13.5l4 4"},null,-1)])])}const Ci=yt(Kv,[["render",Yv]]),Qv={},Xv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Zv(e,t){return y(),k("svg",Xv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const Ul=yt(Qv,[["render",Zv]]),ey={},ty={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ny(e,t){return y(),k("svg",ty,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const ry=yt(ey,[["render",ny]]),sy={},oy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function iy(e,t){return y(),k("svg",oy,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const pi=yt(sy,[["render",iy]]),ay={},ly={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function cy(e,t){return y(),k("svg",ly,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 4.5l-4 4L7 10l-1.5 1.5l7 7L14 17l1.5-4l4-4M9 15l-4.5 4.5M14.5 4L20 9.5"},null,-1)])])}const ga=yt(ay,[["render",cy]]),uy={key:0,class:"sidebar-menu-row-left"},dy={class:"sidebar-menu-row-main"},fy={key:1,class:"sidebar-menu-row-right"},hy={key:0,class:"sidebar-menu-row-right-default"},py={key:1,class:"sidebar-menu-row-right-hover"},my=cn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=om(),r=de(()=>!!n.left),s=de(()=>!!n.right),o=de(()=>!!n["right-hover"]),i=de(()=>s.value||o.value);return(a,l)=>(y(),bt(Ti(t.as),kf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},a.$attrs),{default:It(()=>[r.value?(y(),k("span",uy,[_r(a.$slots,"left",{},void 0,!0)])):fe("",!0),v("span",dy,[_r(a.$slots,"default",{},void 0,!0)]),i.value?(y(),k("span",fy,[s.value?(y(),k("span",hy,[_r(a.$slots,"right",{},void 0,!0)])):fe("",!0),o.value?(y(),k("span",py,[_r(a.$slots,"right-hover",{},void 0,!0)])):fe("",!0)])):fe("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Ss=yt(my,[["__scopeId","data-v-36239f39"]]),gy={class:"thread-tree-root"},vy={key:0,class:"pinned-section"},yy={class:"thread-list"},wy=["data-menu-open"],by={class:"thread-left-stack"},_y=["data-state"],ky=["onClick"],Ty=["onClick"],Sy={class:"thread-row-title-wrap"},Iy={class:"thread-row-title"},Ey={class:"thread-row-time"},Cy=["onClick"],Ay=["aria-expanded"],xy=["data-active"],Ry={key:0},Py=["data-active"],My={key:0},$y={key:1,class:"thread-tree-no-results"},Oy={key:2,class:"thread-tree-loading"},Ny={key:3,class:"thread-list thread-list-global"},Ly=["data-menu-open"],Dy={class:"thread-left-stack"},jy=["data-state"],Fy=["onClick"],By=["onClick"],Uy={class:"thread-row-title-wrap"},Hy={class:"thread-row-title"},Wy={class:"thread-row-time"},Vy=["onClick"],zy=["data-project-name","data-expanded","data-dragging"],qy={class:"project-icon-stack"},Gy={class:"project-icon-folder"},Ky={class:"project-icon-chevron"},Jy=["data-dragging-handle","onMousedown"],Yy={class:"project-title"},Qy={class:"project-hover-controls"},Xy=["onClick"],Zy=["data-open-direction"],ew=["onClick"],tw=["onClick"],nw=["onClick"],rw=["onInput"],sw=["aria-label","title","onClick"],ow={key:0,class:"thread-list"},iw=["data-menu-open"],aw={class:"thread-left-stack"},lw=["data-state"],cw=["onClick"],uw=["onClick"],dw={class:"thread-row-title-wrap"},fw={class:"thread-row-title"},hw={class:"thread-row-time"},pw=["onClick"],mw=["onClick"],gw=["data-open-direction"],vw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},yw=["onKeydown"],ww={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},bw={class:"rename-thread-subtitle"},_w=4,fu=6,hu="codex-web-local.thread-view-mode.v1",pu="codex-web-local.collapsed-projects.v1",kw=cn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-project-files","rename-project","rename-thread","remove-project","reorder-project","export-thread"],setup(e,{emit:t}){const n=e,r=t,s=D({}),o=D({}),i=D([]),a=D(""),l=D(""),f=D({}),u=D({}),g=D({}),_=D("actions"),E=D(""),F=D(!1),$=D(""),Y=D(""),ae=D(null),G=D(!1),ee=D(""),te=D(""),Te=D(null),ve=D(null),ye=D(null);let De=null,le=null;const re=D(""),ce=D({}),ne=new Map,Pe=new Map,Ye=new Map,Ge=new WeakMap,Ve=D(null),Ue=D(null),Re=D(!1),rt=D(ct()),Ae=typeof window<"u"?new ResizeObserver(S=>{for(const R of S){const P=R.target,X=Ge.get(P);X&&En(X,P)}}):null;function Be(){if(typeof window>"u")return{};try{const S=window.localStorage.getItem(pu);if(!S)return{};const R=JSON.parse(S);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function ct(){return typeof window>"u"?"project":window.localStorage.getItem(hu)==="chronological"?"chronological":"project"}o.value=Be(),ft(o,S=>{typeof window>"u"||window.localStorage.setItem(pu,JSON.stringify(S))},{deep:!0}),ft(rt,S=>{typeof window>"u"||window.localStorage.setItem(hu,S)});const Ht=de(()=>n.searchQuery.trim().toLowerCase()),pt=de(()=>Ht.value.length>0),ut=de(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function He(S){if(!pt.value)return!0;if(ut.value)return ut.value.has(S.id);const R=Ht.value;return S.title.toLowerCase().includes(R)||S.preview.toLowerCase().includes(R)}const W=de(()=>pt.value?n.groups.map(S=>({...S,threads:S.threads.filter(He)})).filter(S=>S.threads.length>0):n.groups),_e=de(()=>rt.value==="chronological"),he=de(()=>{const S=W.value,R=[];for(const P of S)for(const X of P.threads)B(X.id)||R.push(X);return R.sort((P,X)=>{const Fe=new Date(P.updatedAtIso||P.createdAtIso).getTime();return new Date(X.updatedAtIso||X.createdAtIso).getTime()-Fe})}),ge=de(()=>{const S=new Map;for(const R of n.groups)for(const P of R.threads)S.set(P.id,P);return S}),Ce=de(()=>{const S=l.value;return S?ge.value.get(S)??null:null}),T=de(()=>i.value.map(S=>ge.value.get(S)??null).filter(S=>S!==null).filter(He)),C=de(()=>{const S=ye.value;if(!S||S.dropTargetIndexFull===null||n.groups.length===0)return null;const R=Math.max(0,Math.min(S.dropTargetIndexFull,n.groups.length)),P=R>S.fromIndex?R-1:R,X=Math.max(0,Math.min(P,n.groups.length-1));return X===S.fromIndex?null:X}),O=de(()=>{const R=(pt.value?W.value:n.groups).map(Kt=>Kt.projectName),P=ye.value,X=C.value;if(!P||X===null)return R;const Fe=[...R],[wt]=Fe.splice(P.fromIndex,1);return wt?(Fe.splice(X,0,wt),Fe):R}),z=de(()=>{const S={};let R=0;for(const P of O.value)S[P]=R,R+=Tn(P);return S}),J=de(()=>{let S=0;for(const R of O.value)S+=Tn(R);return{height:`${Math.max(0,S)}px`}});function N(S){const R=new Date(S).getTime();if(Number.isNaN(R))return"n/a";const P=Math.abs(Date.now()-R);if(P<6e4)return"now";const X=Math.floor(P/6e4);if(X<60)return`${X}m`;const Fe=Math.floor(X/60);return Fe<24?`${Fe}h`:`${Math.floor(Fe/24)}d`}function B(S){return i.value.includes(S)}function H(S){if(B(S)){i.value=i.value.filter(R=>R!==S);return}i.value=[S,...i.value]}function Q(S){r("select",S)}function Z(S){r("export-thread",S),xe()}function Ee(S){return`start new thread ${Bt(S)}`}function we(S){r("start-new-thread",S)}function ke(S){return l.value===S}function xe(){l.value="",g.value={}}function ze(S){if(l.value===S){xe();return}dt(),Re.value=!1,l.value=S,tn(()=>{Oe(S)})}function ot(S,R){$.value=S,Y.value=R,F.value=!0,xe(),tn(()=>{var P,X;(P=ae.value)==null||P.focus(),(X=ae.value)==null||X.select()})}function We(){F.value=!1,$.value="",Y.value=""}function ht(){const S=$.value,R=Y.value.trim();!S||!R||(r("rename-thread",{threadId:S,title:R}),We())}function _t(S,R){ee.value=S,te.value=R,G.value=!0,xe()}function Pt(){G.value=!1,ee.value="",te.value=""}function Ke(){const S=ee.value;S&&(i.value=i.value.filter(R=>R!==S),r("archive",S),Pt())}function Bt(S){return n.projectDisplayNameById[S]??S}function Vt(S){return a.value===S}function dt(){a.value="",_.value="actions",E.value=""}function kt(){const S=!Re.value;S&&(dt(),xe()),Re.value=S}function mt(S){rt.value=S,Re.value=!1}function rn(S){if(a.value===S){dt();return}xe(),Re.value=!1,a.value=S,_.value="actions",E.value=Bt(S),tn(()=>{Nn(S)})}function xt(S){xe(),a.value=S,_.value="rename",E.value=Bt(S),tn(()=>{Nn(S)})}function Rt(S){r("rename-project",{projectName:S,displayName:E.value})}function $n(S){r("remove-project",S),dt()}function Wt(S){r("browse-project-files",S),dt()}function On(S,R){if(!S.altKey||S.key!=="ArrowUp"&&S.key!=="ArrowDown")return;const P=n.groups.findIndex(wt=>wt.projectName===R);if(P<0)return;const X=S.key==="ArrowUp"?-1:1,Fe=Math.max(0,Math.min(P+X,n.groups.length-1));Fe!==P&&(S.preventDefault(),r("reorder-project",{projectName:R,toIndex:Fe}))}function Mt(S){return s.value[S]===!0}function qt(S){return o.value[S]===!0}function Dt(S){s.value={...s.value,[S]:!Mt(S)}}function sn(S){if(re.value===S){re.value="";return}o.value={...o.value,[S]:!qt(S)}}function Tn(S){const R=ce.value[S]??0,P=ye.value,Fe=((P==null?void 0:P.projectName)===S?P.groupHeight:null)??R,wt=qt(S)?0:fu;return Math.max(0,Fe+wt)}function un(S,R){const P=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(P){Pe.set(S,P);return}Pe.delete(S)}function Fn(S,R){const P=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(P){Ye.set(S,P);return}Ye.delete(S)}function dn(S){let R=S.parentElement;for(;R;){const P=window.getComputedStyle(R),X=P.overflowY||P.overflow;if(X==="auto"||X==="scroll"||X==="hidden"||X==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Bn(S,R){const P=S.getBoundingClientRect(),X=dn(S),Fe=6,wt=X.bottom-P.bottom,Kt=P.top-X.top;return wt>=R+Fe?"down":Kt>wt?"up":"down"}function er(S,R){const P=Ye.get(S);if(!P)return"down";const X=Bn(P,R);return u.value={...u.value,[S]:X},X}function Un(S){return u.value[S]??"down"}function Nn(S){const R=Pe.get(S);R&&(f.value={...f.value,[S]:Bn(R,112)})}function Me(S,R,P){return Math.min(Math.max(S,R),P)}function Oe(S){const R=Ye.get(S);if(!R)return;const P=Ue.value,X=P==null?void 0:P.getBoundingClientRect(),Fe=(X==null?void 0:X.height)||(P==null?void 0:P.offsetHeight)||112,wt=(X==null?void 0:X.width)||(P==null?void 0:P.offsetWidth)||160,Kt=er(S,Fe),fn=R.getBoundingClientRect(),Zt=8,an=4,Kn=Math.max(Zt,window.innerWidth-wt-Zt),Jn=Me(fn.right-wt,Zt,Kn),ur=Me(Kt==="up"?fn.top-Fe-an:fn.bottom+an,Zt,Math.max(Zt,window.innerHeight-Fe-Zt));g.value={left:`${Math.round(Jn)}px`,top:`${Math.round(ur)}px`}}function Sn(){const S=l.value;S&&Oe(S)}function Yt(){window.addEventListener("resize",Sn),document.addEventListener("scroll",Sn,!0)}function zn(){window.removeEventListener("resize",Sn),document.removeEventListener("scroll",Sn,!0)}function Hn(S){const R=a.value;if(!R)return!1;const P=Pe.get(R);if(!P)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(P))return!0;const Fe=S.target;return Fe instanceof Node?P.contains(Fe):!1}function mn(S){const R=l.value;if(!R)return!1;const P=Ye.get(R);if(!P)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(P))return!0;const Fe=S.target;return Fe instanceof Node?P.contains(Fe):!1}function Ln(S){if(Re.value){const R=Ve.value,P=typeof S.composedPath=="function"?S.composedPath():[];!!R&&(P.includes(R)||S.target instanceof Node&&R.contains(S.target))||(Re.value=!1)}a.value&&(Hn(S)||dt(),l.value&&(mn(S)||xe()))}function tr(S){a.value&&!Hn(S)&&dt(),l.value&&!mn(S)&&xe()}function qn(){Re.value&&(Re.value=!1),a.value&&dt(),l.value&&xe()}function Ot(){window.addEventListener("pointerdown",Ln,{capture:!0}),window.addEventListener("focusin",tr,{capture:!0}),window.addEventListener("blur",qn)}function In(){window.removeEventListener("pointerdown",Ln,{capture:!0}),window.removeEventListener("focusin",tr,{capture:!0}),window.removeEventListener("blur",qn)}function En(S,R){const P=R.getBoundingClientRect().height;if(!Number.isFinite(P)||P<=0)return;const X=ce.value[S];X!==void 0&&Math.abs(X-P)<.5||(ce.value={...ce.value,[S]:P})}function A(S,R){const P=ne.get(S);P&&P!==R&&Ae&&Ae.unobserve(P);const X=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(X){ne.set(S,X),Ge.set(X,S),En(S,X),Ae==null||Ae.observe(X);return}P&&(Ae==null||Ae.unobserve(P)),ne.delete(S)}function U(S,R){if(S.button!==0||ve.value||ye.value)return;const P=n.groups.findIndex(Kt=>Kt.projectName===R),X=ne.get(R);if(P<0||!X)return;const Fe=X.getBoundingClientRect(),wt=qt(R)?0:fu;ve.value={projectName:R,fromIndex:P,startClientX:S.clientX,startClientY:S.clientY,pointerOffsetY:S.clientY-Fe.top,groupLeft:Fe.left,groupWidth:Fe.width,groupHeight:Fe.height,groupOuterHeight:Fe.height+wt},S.preventDefault(),ie()}function ie(){window.addEventListener("mousemove",it),window.addEventListener("mouseup",gt),window.addEventListener("keydown",at)}function Ne(){window.removeEventListener("mousemove",it),window.removeEventListener("mouseup",gt),window.removeEventListener("keydown",at)}function it(S){De={clientX:S.clientX,clientY:S.clientY},on()}function gt(S){Gn({clientX:S.clientX,clientY:S.clientY});const R=ye.value;if(R&&C.value!==null){const P=n.groups.findIndex(X=>X.projectName===R.projectName);if(P>=0){const X=C.value;X!==P&&r("reorder-project",{projectName:R.projectName,toIndex:X})}}Ut()}function at(S){S.key==="Escape"&&(!ve.value&&!ye.value||(S.preventDefault(),Ut()))}function Ut(){le!==null&&(window.cancelAnimationFrame(le),le=null),De=null,ve.value=null,ye.value=null,re.value="",Ne()}function on(){le===null&&(le=window.requestAnimationFrame(()=>{if(le=null,!De)return;const S=De;De=null,Gn(S)}))}function Gn(S){const R=ve.value;if(!ye.value&&R){const P=S.clientX-R.startClientX,X=S.clientY-R.startClientY;if(Math.hypot(P,X)<_w)return;dt(),re.value=R.projectName,ye.value={projectName:R.projectName,fromIndex:R.fromIndex,pointerOffsetY:R.pointerOffsetY,groupLeft:R.groupLeft,groupWidth:R.groupWidth,groupHeight:R.groupHeight,groupOuterHeight:R.groupOuterHeight,ghostTop:S.clientY-R.pointerOffsetY,dropTargetIndexFull:null}}ye.value&&Gr(S)}function Gr(S){const R=ye.value;if(!R)return;if(R.ghostTop=S.clientY-R.pointerOffsetY,!Kr(S)){R.dropTargetIndexFull=null;return}const P=S.clientY,X=Te.value;if(!X){R.dropTargetIndexFull=null;return}const Fe=X.getBoundingClientRect(),wt=new Map(n.groups.map((an,Kn)=>[an.projectName,Kn])),Kt=n.groups.map(an=>an.projectName).filter(an=>an!==R.projectName);let fn=0,Zt=n.groups.length;for(const an of Kt){const Kn=wt.get(an);if(Kn===void 0)continue;const Jn=Tn(an),ur=Fe.top+fn+Jn/2;if(P<ur){Zt=Kn;break}fn+=Jn}R.dropTargetIndexFull=Zt}function Kr(S){const R=Te.value;if(!R)return!1;const P=R.getBoundingClientRect(),X=S.clientX>=P.left&&S.clientX<=P.right,Fe=S.clientY>=P.top-32&&S.clientY<=P.bottom+32;return X&&Fe}function Jr(S){var R;return((R=ye.value)==null?void 0:R.projectName)===S}function ps(S){const R=ye.value,P=z.value[S]??0,X=a.value===S;return!R||R.projectName!==S?{position:"absolute",top:"0",left:"0",right:"0",zIndex:X?"40":"1",transform:`translate3d(0, ${P}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${R.groupLeft}px`,width:`${R.groupWidth}px`,height:`${R.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${R.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Xt(S){return S.threads.filter(R=>!B(R.id))}function Yr(S){if(pt.value)return Xt(S);if(qt(S.projectName))return[];const R=Xt(S);return Mt(S.projectName)?R:R.slice(0,10)}function ms(S){return pt.value?!1:!qt(S.projectName)&&Xt(S).length>10}function gs(S){return Xt(S).length>0}function Ir(S){return S.inProgress?"working":S.unread?"unread":"idle"}ft(()=>n.groups.map(S=>S.projectName),S=>{var Fe,wt;const R=((Fe=ye.value)==null?void 0:Fe.projectName)??((wt=ve.value)==null?void 0:wt.projectName)??"";R&&!n.groups.some(Kt=>Kt.projectName===R)&&Ut();const P=new Set(S),X=Object.fromEntries(Object.entries(ce.value).filter(([Kt])=>P.has(Kt)));Object.keys(X).length!==Object.keys(ce.value).length&&(ce.value=X)});const vs=de(()=>Re.value||a.value!==""||l.value!=="");return ft(vs,S=>{if(S){Ot();return}In()}),ft(l,S=>{if(!S){zn();return}Yt(),tn(()=>{Oe(S)})}),qr(()=>{for(const S of ne.values())Ae==null||Ae.unobserve(S);ne.clear(),Pe.clear(),zn(),In(),Ut()}),(S,R)=>(y(),k("section",gy,[T.value.length>0?(y(),k("section",vy,[v("ul",yy,[(y(!0),k(Le,null,vt(T.value,P=>(y(),k("li",{key:P.id,class:"thread-row-item","data-menu-open":ke(P.id)?"true":"false"},[je(Ss,{class:"thread-row","data-active":P.id===e.selectedThreadId,"data-pinned":B(P.id),"data-menu-open":ke(P.id)?"true":"false","force-right-hover":ke(P.id)},{left:It(()=>[v("span",by,[P.inProgress||P.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Ir(P)},null,8,_y)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:X=>H(P.id)},[je(ga,{class:"thread-icon"})],8,ky)])]),right:It(()=>[v("span",Ey,K(N(P.createdAtIso||P.updatedAtIso)),1)]),"right-hover":It(()=>[v("div",{ref_for:!0,ref:X=>Fn(P.id,X),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Tt(X=>ze(P.id),["stop"])},[je(go,{class:"thread-icon"})],8,Cy)],512)]),default:It(()=>[v("button",{class:"thread-main-button",type:"button",onClick:X=>Q(P.id)},[v("span",Sy,[v("span",Iy,K(P.title),1),P.hasWorktree?(y(),bt(pi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,Ty)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,wy))),128))])])):fe("",!0),je(Ss,{as:"header",class:"thread-tree-header-row"},{right:It(()=>[v("div",{ref_key:"organizeMenuWrapRef",ref:Ve,class:"organize-menu-wrap"},[v("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Re.value,"aria-label":"Organize threads",title:"Organize threads",onClick:kt},[je(go,{class:"thread-icon"})],8,Ay),Re.value?(y(),k("div",{key:0,class:"organize-menu-panel",onClick:R[2]||(R[2]=Tt(()=>{},["stop"]))},[R[12]||(R[12]=v("p",{class:"organize-menu-title"},"Organize",-1)),v("button",{class:"organize-menu-item","data-active":rt.value==="project",type:"button",onClick:R[0]||(R[0]=P=>mt("project"))},[R[10]||(R[10]=v("span",null,"By project",-1)),rt.value==="project"?(y(),k("span",Ry,"✓")):fe("",!0)],8,xy),v("button",{class:"organize-menu-item","data-active":rt.value==="chronological",type:"button",onClick:R[1]||(R[1]=P=>mt("chronological"))},[R[11]||(R[11]=v("span",null,"Chronological list",-1)),rt.value==="chronological"?(y(),k("span",My,"✓")):fe("",!0)],8,Py)])):fe("",!0)],512)]),default:It(()=>[R[13]||(R[13]=v("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),pt.value&&W.value.length===0?(y(),k("p",$y,"No matching threads")):e.isLoading&&e.groups.length===0?(y(),k("p",Oy,"Loading threads...")):_e.value?(y(),k("ul",Ny,[(y(!0),k(Le,null,vt(he.value,P=>(y(),k("li",{key:P.id,class:"thread-row-item","data-menu-open":ke(P.id)?"true":"false"},[je(Ss,{class:"thread-row","data-active":P.id===e.selectedThreadId,"data-pinned":B(P.id),"data-menu-open":ke(P.id)?"true":"false","force-right-hover":ke(P.id)},{left:It(()=>[v("span",Dy,[P.inProgress||P.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Ir(P)},null,8,jy)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:X=>H(P.id)},[je(ga,{class:"thread-icon"})],8,Fy)])]),right:It(()=>[v("span",Wy,K(N(P.createdAtIso||P.updatedAtIso)),1)]),"right-hover":It(()=>[v("div",{ref_for:!0,ref:X=>Fn(P.id,X),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Tt(X=>ze(P.id),["stop"])},[je(go,{class:"thread-icon"})],8,Vy)],512)]),default:It(()=>[v("button",{class:"thread-main-button",type:"button",onClick:X=>Q(P.id)},[v("span",Uy,[v("span",Hy,K(P.title),1),P.hasWorktree?(y(),bt(pi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,By)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Ly))),128))])):(y(),k("div",{key:4,ref_key:"groupsContainerRef",ref:Te,class:"thread-tree-groups",style:ls(J.value)},[(y(!0),k(Le,null,vt(W.value,P=>(y(),k("article",{key:P.projectName,ref_for:!0,ref:X=>A(P.projectName,X),class:"project-group","data-project-name":P.projectName,"data-expanded":!qt(P.projectName),"data-dragging":Jr(P.projectName),style:ls(ps(P.projectName))},[je(Ss,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:X=>sn(P.projectName),onKeydown:[X=>On(X,P.projectName),Rn(Tt(X=>sn(P.projectName),["prevent"]),["enter"]),Rn(Tt(X=>sn(P.projectName),["prevent"]),["space"])]},{left:It(()=>[v("span",qy,[v("span",Gy,[qt(P.projectName)?(y(),bt(Ul,{key:0,class:"thread-icon"})):(y(),bt(ry,{key:1,class:"thread-icon"}))]),v("span",Ky,[qt(P.projectName)?(y(),bt(Hf,{key:0,class:"thread-icon"})):(y(),bt(Ji,{key:1,class:"thread-icon"}))])])]),right:It(()=>[v("div",Qy,[v("div",{ref_for:!0,ref:X=>un(P.projectName,X),class:"project-menu-wrap"},[v("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Tt(X=>rn(P.projectName),["stop"])},[je(go,{class:"thread-icon"})],8,Xy),Vt(P.projectName)?(y(),k("div",{key:0,class:"project-menu-panel","data-open-direction":f.value[P.projectName]??"down",onClick:R[4]||(R[4]=Tt(()=>{},["stop"]))},[_.value==="actions"?(y(),k(Le,{key:0},[v("button",{class:"project-menu-item",type:"button",onClick:X=>Wt(P.projectName)}," Browse files ",8,ew),v("button",{class:"project-menu-item",type:"button",onClick:X=>xt(P.projectName)}," Edit name ",8,tw),v("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:X=>$n(P.projectName)}," Remove ",8,nw)],64)):(y(),k(Le,{key:1},[R[14]||(R[14]=v("label",{class:"project-menu-label"},"Project name",-1)),Br(v("input",{"onUpdate:modelValue":R[3]||(R[3]=X=>E.value=X),class:"project-menu-input",type:"text",onInput:X=>Rt(P.projectName)},null,40,rw),[[Ur,E.value]])],64))],8,Zy)):fe("",!0)],512),v("button",{class:"thread-start-button",type:"button","aria-label":Ee(P.projectName),title:Ee(P.projectName),onClick:Tt(X=>we(P.projectName),["stop"])},[je(Ci,{class:"thread-icon"})],8,sw)])]),default:It(()=>[v("span",{class:"project-main-button","data-dragging-handle":Jr(P.projectName),onMousedown:Tt(X=>U(X,P.projectName),["left"])},[v("span",Yy,K(Bt(P.projectName)),1)],40,Jy)]),_:2},1032,["onClick","onKeydown"]),gs(P)?(y(),k("ul",ow,[(y(!0),k(Le,null,vt(Yr(P),X=>(y(),k("li",{key:X.id,class:"thread-row-item","data-menu-open":ke(X.id)?"true":"false"},[je(Ss,{class:"thread-row","data-active":X.id===e.selectedThreadId,"data-pinned":B(X.id),"data-menu-open":ke(X.id)?"true":"false","force-right-hover":ke(X.id)},{left:It(()=>[v("span",aw,[X.inProgress||X.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Ir(X)},null,8,lw)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Fe=>H(X.id)},[je(ga,{class:"thread-icon"})],8,cw)])]),right:It(()=>[v("span",hw,K(N(X.createdAtIso||X.updatedAtIso)),1)]),"right-hover":It(()=>[v("div",{ref_for:!0,ref:Fe=>Fn(X.id,Fe),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Tt(Fe=>ze(X.id),["stop"])},[je(go,{class:"thread-icon"})],8,pw)],512)]),default:It(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Fe=>Q(X.id)},[v("span",dw,[v("span",fw,K(X.title),1),X.hasWorktree?(y(),bt(pi,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,uw)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,iw))),128))])):(y(),bt(Ss,{key:1,as:"p",class:"project-empty-row"},{left:It(()=>[...R[15]||(R[15]=[v("span",{class:"project-empty-spacer"},null,-1)])]),default:It(()=>[R[16]||(R[16]=v("span",{class:"project-empty"},"No threads",-1))]),_:1})),ms(P)?(y(),bt(Ss,{key:2,class:"thread-show-more-row"},{left:It(()=>[...R[17]||(R[17]=[v("span",{class:"thread-show-more-spacer"},null,-1)])]),default:It(()=>[v("button",{class:"thread-show-more-button",type:"button",onClick:X=>Dt(P.projectName)},K(Mt(P.projectName)?"Show less":"Show more"),9,mw)]),_:2},1024)):fe("",!0)],12,zy))),128))],4)),(y(),bt(To,{to:"body"},[Ce.value?(y(),k("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Ue,class:"thread-menu-panel thread-menu-panel-fixed",style:ls(g.value),"data-open-direction":Un(Ce.value.id),onClick:R[8]||(R[8]=Tt(()=>{},["stop"]))},[v("button",{class:"thread-menu-item",type:"button",onClick:R[5]||(R[5]=P=>Z(Ce.value.id))}," Export chat "),v("button",{class:"thread-menu-item",type:"button",onClick:R[6]||(R[6]=P=>ot(Ce.value.id,Ce.value.title))}," Rename thread "),v("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[7]||(R[7]=P=>_t(Ce.value.id,Ce.value.title))}," Delete thread ")],12,gw)):fe("",!0)])),(y(),bt(To,{to:"body"},[F.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:Tt(We,["self"])},[v("div",vw,[R[18]||(R[18]=v("h3",{class:"rename-thread-title"},"Rename thread",-1)),R[19]||(R[19]=v("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Br(v("input",{ref_key:"renameThreadInputRef",ref:ae,"onUpdate:modelValue":R[9]||(R[9]=P=>Y.value=P),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[Rn(Tt(ht,["prevent"]),["enter"]),Rn(Tt(We,["prevent"]),["esc"])]},null,40,yw),[[Ur,Y.value]]),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:We},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:ht},"Save")])])])):fe("",!0)])),(y(),bt(To,{to:"body"},[G.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:Tt(Pt,["self"])},[v("div",ww,[R[20]||(R[20]=v("h3",{class:"rename-thread-title"},"Delete thread?",-1)),v("p",bw,' This will archive the thread "'+K(te.value)+'". You can find it later in archived threads. ',1),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:Pt},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ke},"Delete")])])])):fe("",!0)]))]))}}),Tw=yt(kw,[["__scopeId","data-v-2e1439c4"]]),Sw={class:"content-header"},Iw={class:"content-leading"},Ew={class:"content-title"},Cw={class:"content-actions"},Aw=cn({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(y(),k("header",Sw,[v("div",Iw,[_r(t.$slots,"leading",{},void 0)]),v("h1",Ew,K(e.title),1),v("div",Cw,[_r(t.$slots,"actions",{},void 0)])]))}}),xw=yt(Aw,[["__scopeId","data-v-66ee223c"]]),Rw={},Pw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Mw(e,t){return y(),k("svg",Pw,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const Wf=yt(Rw,[["render",Mw]]),$w={},Ow={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Nw(e,t){return y(),k("svg",Ow,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const Lw=yt($w,[["render",Nw]]),Dw={},jw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Fw(e,t){return y(),k("svg",jw,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Hl=yt(Dw,[["render",Fw]]),Bw={class:"conversation-root"},Uw={key:0,class:"conversation-loading"},Hw={key:1,class:"conversation-empty"},Ww=["data-role","data-message-type"],Vw={key:0,class:"message-row","data-role":"system"},zw={class:"message-stack","data-role":"system"},qw=["onClick"],Gw={class:"cmd-group-label"},Kw={class:"cmd-status"},Jw={class:"cmd-group-inner"},Yw=["onClick"],Qw={class:"cmd-label"},Xw={class:"cmd-status"},Zw={class:"cmd-output-inner"},eb=["textContent"],tb=["onClick"],nb={class:"cmd-label"},rb={class:"cmd-status"},sb={class:"cmd-output-inner"},ob=["textContent"],ib=["data-role","data-message-type"],ab=["data-role"],lb=["data-role"],cb=["data-role"],ub=["onClick"],db=["src"],fb={key:1,class:"message-file-attachments"},hb=["href","title"],pb=["data-role"],mb={key:0,class:"worked-separator-wrap","aria-live":"polite"},gb=["onClick"],vb={class:"worked-separator-text"},yb={key:0,class:"worked-details"},wb=["onClick"],bb={class:"cmd-label"},_b={class:"cmd-status"},kb={class:"cmd-output-inner"},Tb=["textContent"],Sb=["data-streaming"],Ib={class:"plan-card-header"},Eb={key:0,class:"plan-card-badge"},Cb=["innerHTML"],Ab={key:1,class:"plan-step-list"},xb=["data-status"],Rb=["data-status"],Pb=["innerHTML"],Mb=["innerHTML"],$b={key:2,class:"message-text-flow"},Ob={key:0,class:"message-text"},Nb={key:0},Lb={key:1,class:"message-bold-text"},Db={key:2,class:"message-italic-text"},jb={key:3,class:"message-strikethrough-text"},Fb=["href","title"],Bb=["href","title"],Ub={key:6,class:"message-inline-code"},Hb={key:0},Wb={key:1,class:"message-bold-text"},Vb={key:2,class:"message-italic-text"},zb={key:3,class:"message-strikethrough-text"},qb=["href","title"],Gb=["href","title"],Kb={key:6,class:"message-inline-code"},Jb={key:2,class:"message-blockquote"},Yb={key:0},Qb={key:1,class:"message-bold-text"},Xb={key:2,class:"message-italic-text"},Zb={key:3,class:"message-strikethrough-text"},e_=["href","title"],t_=["href","title"],n_={key:6,class:"message-inline-code"},r_={key:3,class:"message-list message-list-unordered"},s_=["innerHTML"],o_={key:4,class:"message-list message-task-list"},i_=["data-checked"],a_={class:"message-list-item-text"},l_={key:0},c_={key:1,class:"message-bold-text"},u_={key:2,class:"message-italic-text"},d_={key:3,class:"message-strikethrough-text"},f_=["href","title"],h_=["href","title"],p_={key:6,class:"message-inline-code"},m_=["start"],g_=["innerHTML"],v_={key:6,class:"message-code-block"},y_={key:0,class:"message-code-language"},w_={class:"message-code-pre"},b_={key:7,class:"message-divider"},__={key:8,class:"message-text"},k_=["onClick"],T_=["src","alt","onError"],S_=["data-role"],I_=["data-copied","aria-label","title","onClick"],E_={class:"message-copy-label"},C_={key:0,class:"conversation-item conversation-item-overlay"},A_={class:"message-row"},x_={class:"message-stack"},R_={class:"live-overlay-inline","aria-live":"polite"},P_={class:"live-overlay-label"},M_={key:1,class:"live-overlay-error"},$_={class:"message-row"},O_={class:"message-stack"},N_={class:"request-card"},L_={class:"request-title"},D_={class:"request-meta"},j_={key:0,class:"request-reason"},F_={key:1,class:"request-actions"},B_=["onClick"],U_=["onClick"],H_=["onClick"],W_=["onClick"],V_={key:2,class:"request-actions"},z_=["onClick"],q_=["onClick"],G_=["onClick"],K_=["onClick"],J_={key:3,class:"request-user-input"},Y_={class:"request-question-title"},Q_={key:0,class:"request-question-text"},X_=["value","onChange"],Z_=["value"],ek={key:2,class:"request-question-option-description"},tk=["type","value","placeholder","onInput"],nk=["type","value","onInput"],rk=["onClick"],sk={key:4,class:"request-actions"},ok=["onClick"],ik=["onClick"],ak={key:5,class:"request-actions"},lk=["onClick"],ck=["onClick"],uk=["src"],dk=16,fk=cn({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","respondServerRequest"],setup(e,{emit:t}){var ys;const n=D(new Set),r=D(new Set),s=D(new Set),o=D(new Set);function i(d){var L;const p=d.replace(/\r\n/g,`
26
+ `).trim();if(!p)return null;const h=[],x=[];for(const M of p.split(`
27
+ `)){const pe=M.trim();if(!pe){h.length===0&&x.push("");continue}const V=pe.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(V){const Se=(V[1]??" ").toLowerCase();let $e="pending";Se==="x"&&($e="completed"),(Se==="~"||Se===">"||Se==="-")&&($e="inProgress"),h.push({step:((L=V[2])==null?void 0:L.trim())??"",status:$e});continue}x.push(pe)}return h.length===0?null:{explanation:x.join(`
28
+ `).trim(),steps:h.filter(M=>M.step.length>0)}}function a(d){var p;return d.plan&&d.plan.steps.length>0?{explanation:((p=d.plan.explanation)==null?void 0:p.trim())??"",steps:d.plan.steps}:i(d.text)}function l(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function f(d){return d.messageType==="plan"||d.messageType==="plan.live"}function u(d){return d.role==="assistant"&&!l(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const g=de(()=>{var d;for(let p=Ae.messages.length-1;p>=0;p-=1){const h=Ae.messages[p];if(h.messageType==="commandExecution"&&((d=h.commandExecution)==null?void 0:d.status)==="inProgress")return h.id}return""}),_=de(()=>Ae.messages.some(d=>d.role==="assistant"&&d.messageType==="agentMessage.live"&&d.text.trim().length>0)),E=de(()=>!!Ae.liveOverlay||g.value.length>0||_.value),F=de(()=>{const d={};for(let p=0;p<Ae.messages.length;){const h=Ae.messages[p];if(!l(h)){p+=1;continue}const x=[];for(;p<Ae.messages.length&&l(Ae.messages[p]);)x.push(Ae.messages[p]),p+=1;if(x.length<=1)continue;const L=x[x.length-1];d[L.id]=x.slice(0,-1)}return d}),$=de(()=>{const d=new Set;for(const p of Object.values(F.value))for(const h of p)d.add(h.id);return d});function Y(d){var p;return((p=a(d))==null?void 0:p.explanation)??""}function ae(d){var p;return((p=a(d))==null?void 0:p.steps)??[]}function G(d){switch(d){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function ee(d){return!_.value&&d.id===g.value}function te(d){return l(d)?n.value.has(d.id)||!r.value.has(d.id)&&ee(d):!1}function Te(d){return l(d)&&E.value}function ve(d){var p;return l(d)&&(E.value||((p=d.commandExecution)==null?void 0:p.status)==="inProgress")}function ye(d){if(!l(d))return;const p=new Set(n.value),h=new Set(r.value),x=ee(d);p.has(d.id)?(p.delete(d.id),x&&h.add(d.id)):x&&!h.has(d.id)?h.add(d.id):(p.add(d.id),h.delete(d.id)),n.value=p,r.value=h}function De(d){return F.value[d.id]??[]}function le(d){return l(d)?[...De(d),d]:[]}function re(d){if(De(d).length===0)return;const h=new Set(s.value);h.has(d.id)?h.delete(d.id):h.add(d.id),s.value=h}function ce(d){return s.value.has(d.id)}function ne(d){var M,pe;const h=le(d).length,x=((pe=(M=d.commandExecution)==null?void 0:M.command)==null?void 0:pe.trim())||"(command)";return`${h===1?"1 command":`${h} commands`} · latest: ${x}`}function Pe(d){return Ve(d)}function Ye(d){const p=new Set(o.value);p.has(d.id)?p.delete(d.id):p.add(d.id),o.value=p}function Ge(d){return o.value.has(d.id)}function Ve(d){const p=d.commandExecution;if(!p)return"";const h=Te(d);switch(p.status){case"inProgress":return h?"Running":"⟳ Running";case"completed":return p.exitCode===0?h?"Done":"✓ Completed":`Exit ${p.exitCode??"?"}`;case"failed":return h?"Failed":"✗ Failed";case"declined":return h?"Declined":"⊘ Declined";case"interrupted":return h?"Stopped":"⊘ Interrupted";default:return""}}function Ue(d){var h,x;const p=(h=d.commandExecution)==null?void 0:h.status;return p==="inProgress"?"cmd-status-running":p==="completed"&&((x=d.commandExecution)==null?void 0:x.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function Re(d,p){if(d.size===0)return d;const h=new Set;for(const x of d)p.has(x)&&h.add(x);return h.size===d.size?d:h}function rt(d,p){const h=[];for(let x=p-1;x>=0;x--){const L=d[x];if(L.messageType==="commandExecution")h.unshift(L);else if(L.role==="user"||L.messageType==="worked")break}return h}const Ae=e,Be=t,ct=D(null),Ht=D(null),pt=D(null),ut=D(""),He=D(""),W=D({}),_e=D({}),he=D(((ys=Ae.scrollState)==null?void 0:ys.isAtBottom)!==!1);let ge=0,Ce=0,T=0,C=null;const O=new WeakSet,z=D(new Set),J=de(()=>!he.value&&(Ae.messages.length>0||Ae.pendingRequests.length>0||!!Ae.liveOverlay));function N(d){if(!d||/\s/u.test(d)||d.endsWith("/")||d.endsWith("\\"))return!1;if(d.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(d))return!1;const p=d.startsWith("/"),h=/^[A-Za-z]:[\\/]/u.test(d),x=d.startsWith("./")||d.startsWith("../")||d.startsWith("~/"),L=d.includes("/")||d.includes("\\");return p||h||x||L}function B(d){return d.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||d}function H(d){return d.replace(/\\/gu,"/")}function Q(d){if(!d.startsWith("file://"))return d;let p=d.replace(/^file:\/\//u,"");try{p=decodeURIComponent(p)}catch{}return/^\/[A-Za-z]:\//u.test(p)&&(p=p.slice(1)),p}function Z(d){const p=H(d),h=p.match(/^\/Users\/([^/]+)/u);if(h)return`/Users/${h[1]}`;const x=p.match(/^\/home\/([^/]+)/u);return x?`/home/${x[1]}`:""}function Ee(d){const p=H(d);if(!p)return p;let h="",x=p;const L=x.match(/^([A-Za-z]:)(\/.*)?$/u);L?(h=`${L[1]}/`,x=(L[2]??"").replace(/^\/+/u,"")):x.startsWith("/")&&(h="/",x=x.slice(1));const M=x.split("/").filter(Boolean),pe=[];for(const Se of M)if(Se!=="."){if(Se===".."){pe.length>0&&pe.pop();continue}pe.push(Se)}const V=pe.join("/");return h?`${h}${V}`.replace(/\/+$/u,"")||h:V||p}function we(d,p){const h=H(Q(d.trim()));if(!h)return"";if(h.startsWith("/")||/^[A-Za-z]:\//u.test(h))return Ee(h);if(h.startsWith("~/")){const M=Z(p);if(M)return Ee(`${M}/${h.slice(2)}`)}const L=H(p.trim());return Ee(L?`${L.replace(/\/+$/u,"")}/${h}`:h)}function ke(d){if(!d)return null;let p=d.trim();p=xe(p).core.trim();let x=null;const L=p.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(L)p=L[1],x=Number(L[2]);else{const M=p.match(/^(.*):(\d+)(?::\d+)?$/u);M&&(p=M[1],x=Number(M[2]))}return p=Q(p),N(p)?{path:p,line:x}:null}function xe(d){let p=d,h="",x="";for(;/^[('"`[{<“‘]/u.test(p);)h+=p[0],p=p.slice(1);for(;/[)"'`\]}>”’]$/u.test(p);)x=p.slice(-1)+x,p=p.slice(0,-1);return{core:p,leading:h,trailing:x}}function ze(d){const h=d.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!h)return null;const x=(h[1]??"").trim(),L=(h[2]??"").trim(),M=xe(x).core.trim()||x,pe=xe(L).core.trim();return pe?{label:M,target:pe}:null}function ot(d){const p=Math.min(6,Math.max(1,Math.trunc(d)));return`h${String(p)}`}function We(d){switch(Math.min(6,Math.max(1,Math.trunc(d)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function ht(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function _t(d){var x;const p=a(d);if(!p)return"";const h=[];return(x=p.explanation)!=null&&x.trim()&&h.push(p.explanation.trim()),p.steps.length>0&&h.push(p.steps.map(L=>`- ${ht(L.status)} ${L.step}`.trim()).join(`
29
+ `)),h.join(`
30
+
31
+ `).trim()}function Pt(d){const p=[],h=d.text.trim()||_t(d),x=f(d)&&h?`Plan
32
+ ${h}`:h;x&&p.push(x);const L=(d.fileAttachments??[]).map(pe=>pe.path.trim()).filter(pe=>pe.length>0);L.length>0&&p.push(`Files:
33
+ ${L.join(`
34
+ `)}`);const M=(d.images??[]).map(pe=>pe.trim()).filter(pe=>pe.length>0);return M.length>0&&p.push(`Images:
35
+ ${M.join(`
36
+ `)}`),p.join(`
37
+
38
+ `).trim()}const Ke=de(()=>{const d=new Map;for(const h of Ae.messages){if(!u(h))continue;const x=Pt(h);if(!x)continue;const L=typeof h.turnIndex=="number"?`turn:${h.turnIndex}`:`message:${h.id}`,M=d.get(L);if(M){M.anchorMessageId=h.id,M.parts.push(x);continue}d.set(L,{anchorMessageId:h.id,parts:[x]})}const p={};for(const h of d.values()){const x=h.parts.join(`
39
+
40
+ `).trim();x&&(p[h.anchorMessageId]=x)}return p});function Bt(d){return typeof Ke.value[d.id]=="string"}function Vt(d){if(typeof document>"u")return!1;const p=document.createElement("textarea");p.value=d,p.setAttribute("readonly","true"),p.style.position="fixed",p.style.left="-9999px",p.style.opacity="0",p.style.pointerEvents="none",document.body.appendChild(p),p.focus(),p.select(),p.setSelectionRange(0,d.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(p)}}async function dt(d){var x;const p=Ke.value[d]??"";if(!p)return;let h=!1;if(typeof navigator<"u"&&((x=navigator.clipboard)!=null&&x.writeText))try{await navigator.clipboard.writeText(p),h=!0}catch{h=!1}h||(h=Vt(p)),h&&(He.value=d,C&&clearTimeout(C),C=setTimeout(()=>{He.value===d&&(He.value=""),C=null},1800))}function kt(d){const p=[],h=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let x=0;for(const L of d.matchAll(h)){if(typeof L.index!="number")continue;const M=L.index,pe=M+L[0].length;M>x&&p.push({kind:"text",value:d.slice(x,M)});let V=L[0],Se="";for(;/[.,;:]$/u.test(V);)Se=V.slice(-1)+Se,V=V.slice(0,-1);const $e=xe(V);V=$e.core;const Xe=$e.leading,$t=$e.trailing+Se;if(Xe&&p.push({kind:"text",value:Xe}),V.startsWith("**")&&V.endsWith("**")&&V.length>4)p.push({kind:"bold",value:V.slice(2,-2)}),$t&&p.push({kind:"text",value:$t});else if(/^https?:\/\//u.test(V))p.push({kind:"url",value:V,href:V}),$t&&p.push({kind:"text",value:$t});else{const c=ke(V);c?(p.push({kind:"file",value:V,path:c.path,displayPath:V,downloadName:B(c.path)}),$t&&p.push({kind:"text",value:$t})):p.push({kind:"text",value:L[0]})}x=pe}return x<d.length&&p.push({kind:"text",value:d.slice(x)}),rn(p)}function mt(d,p){const h=[];let x=!1,L="";const M=pe=>{pe&&h.push({kind:"text",value:pe})};for(const pe of d){if(pe.kind!=="text"){x&&(M(`${p.marker}${L}`),x=!1,L=""),h.push(pe);continue}let V=pe.value;for(;V.length>0;){const Se=V.indexOf(p.marker);if(Se<0){x?L+=V:M(V);break}const $e=V.slice(0,Se);if(x?L+=$e:M($e),V=V.slice(Se+p.marker.length),x){const Xe=L;Xe.length>0&&(!p.isValidContent||p.isValidContent(Xe))?h.push({kind:p.kind,value:Xe}):M(`${p.marker}${Xe}${p.marker}`),L="",x=!1}else x=!0}}return x&&M(`${p.marker}${L}`),h}function rn(d){const p=x=>x.trim().length>0&&!/^\s/u.test(x)&&!/\s$/u.test(x);let h=mt(d,{marker:"**",kind:"bold",isValidContent:p});return h=mt(h,{marker:"~~",kind:"strikethrough",isValidContent:p}),h=mt(h,{marker:"*",kind:"italic",isValidContent:p}),h}function xt(d){const p=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,h=[];let x=0;for(const L of d.matchAll(p)){if(typeof L.index!="number")continue;const[M,pe,V]=L,Se=L.index,$e=Se+M.length;Se>x&&h.push(...kt(d.slice(x,Se)));const Xe=ze(`[${pe??""}](${V??""})`),$t=(Xe==null?void 0:Xe.label)??(pe??"").trim(),c=(Xe==null?void 0:Xe.target)??(V??"").trim();if(/^https?:\/\//u.test(c))h.push({kind:"url",value:$t||c,href:c});else{const m=ke(c);m?h.push({kind:"file",value:c,path:m.path,displayPath:$t||c,downloadName:B(m.path)}):h.push({kind:"text",value:M})}x=$e}return x<d.length&&h.push(...kt(d.slice(x))),h}function Rt(d){if(!d.includes("`"))return xt(d);const p=[];let h=0,x=0;for(;h<d.length;){if(d[h]!=="`"){h+=1;continue}let L=1;for(;h+L<d.length&&d[h+L]==="`";)L+=1;const M="`".repeat(L);let pe=h+L,V=-1;for(;pe<d.length;){const $e=d.indexOf(M,pe);if($e<0)break;const Xe=$e>0&&d[$e-1]==="`",$t=$e+L<d.length&&d[$e+L]==="`",c=d.slice(h+L,$e).includes(`
41
+ `);if(!Xe&&!$t&&!c){V=$e;break}pe=$e+1}if(V<0){h+=L;continue}h>x&&p.push(...xt(d.slice(x,h)));const Se=d.slice(h+L,V);if(Se.length>0){const $e=ze(Se);if($e)if(/^https?:\/\//u.test($e.target))p.push({kind:"url",value:$e.label||$e.target,href:$e.target});else{const Xe=ke($e.target);Xe?p.push({kind:"file",value:$e.target,path:Xe.path,displayPath:$e.label||$e.target,downloadName:B(Xe.path)}):p.push({kind:"code",value:Se})}else{const Xe=ke(Se);if(Xe){const $t=Xe.line?`${Xe.path}:${String(Xe.line)}`:Xe.path;p.push({kind:"file",value:Se,path:Xe.path,displayPath:$t,downloadName:B(Xe.path)})}else p.push({kind:"code",value:Se})}}else p.push({kind:"text",value:`${M}${M}`});h=V+L,x=h}return x<d.length&&p.push(...xt(d.slice(x))),p}function $n(d){const p=d.trim();if(!p)return"";if(p.startsWith("data:")||p.startsWith("blob:")||p.startsWith("http://")||p.startsWith("https://")||p.startsWith("/codex-local-image?"))return p;if(p.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(p)}`;const h=p.startsWith("/"),x=/^[A-Za-z]:[\\/]/u.test(p);return h||x?`/codex-local-image?path=${encodeURIComponent(p)}`:p}function Wt(d){const p=d.trim();if(!p)return"#";const h=pe=>pe.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(pe),x=ke(p),L=(x==null?void 0:x.path)??p,M=we(L,Ae.cwd);if(h(M)){const pe=M.startsWith("/")?M:`/${M}`;return`/codex-local-browse${encodeURI(pe)}`}return"#"}function On(d){return d.replace(/\r\n/gu,`
42
+ `)}function Mt(d){var h;return(((h=d.match(/^\s*/u))==null?void 0:h[0])??"").replace(/\t/gu," ").length}function qt(d,p){if(p<=0)return d.trimStart();let h=0,x=0;for(;h<d.length&&x<p;){const L=d[h];x+=L===" "?4:1,h+=1}return d.slice(h)}function Dt(d){return d.trim().length===0}function sn(d){const p=d.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return p?{level:p[1].length,value:p[2].trim()}:null}function Tn(d){const p=d.match(/^\s{0,3}>\s?(.*)$/u);return p?p[1]??"":null}function un(d){var h;const p=d.match(/^\s*[-*+]\s+(.+)$/u);return((h=p==null?void 0:p[1])==null?void 0:h.trim())??null}function Fn(d){var h;const p=d.match(/^(\s*)[-*+]\s+(.+)$/u);return p?{indent:Mt(p[1]??""),text:((h=p[2])==null?void 0:h.trim())??""}:null}function dn(d){var h;const p=d.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return p?{checked:(p[1]??" ").toLowerCase()==="x",text:((h=p[2])==null?void 0:h.trim())??""}:null}function Bn(d){var h;const p=d.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return p?{indent:Mt(p[1]??""),item:{checked:(p[2]??" ").toLowerCase()==="x",text:((h=p[3])==null?void 0:h.trim())??""}}:null}function er(d){var h;const p=d.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return p?{indent:Mt(p[1]??""),start:Number.parseInt(p[2]??"1",10)||1,text:((h=p[3])==null?void 0:h.trim())??""}:null}function Un(d){var p;return((p=er(d))==null?void 0:p.text)??null}function Nn(d){return er(d)}function Me(d){return Dt(d)||mn(d)!==null||Hn(d)||sn(d)!==null||Tn(d)!==null||dn(d)!==null||un(d)!==null||Un(d)!==null}function Oe(d,p,h=-1){const x=[];let L=p;for(;L<d.length&&!(Me(d[L])||h>=0&&Mt(d[L])<=h);)x.push(h>=0?qt(d[L],h+1):d[L]),L+=1;const M=x.join(`
43
+ `).trim();return M?{value:M,nextIndex:L}:null}function Sn(d,p){for(let h=p;h<d.length;h+=1)if(!Dt(d[h]))return h;return-1}function Yt(d,p,h,x=null,L=!1){const M=[];let pe=p;for(;pe<d.length;){const V=d[pe];if(Dt(V)){const $t=Sn(d,pe+1);if($t===-1){M.push(""),pe=d.length;break}const c=x==null?void 0:x(d[$t]);if(c&&c.indent===h||Mt(d[$t])<=h)break;M.push(""),pe+=1;continue}const Se=x==null?void 0:x(V);if(Se&&Se.indent===h)break;const $e=Mt(V),Xe=L&&(dn(V)!==null||un(V)!==null);if($e<=h&&!Xe)break;M.push($e>h?qt(V,h+1):V.trimStart()),pe+=1}for(;M.length>0&&Dt(M[0]);)M.shift();for(;M.length>0&&Dt(M[M.length-1]);)M.pop();return M.length===0?null:{blocks:Ln(M.join(`
44
+ `)),nextIndex:pe}}function zn(d,p,h,x=!1){const L=[];let M=p;const pe=h(d[p]);if(!pe)return null;const V=pe.indent;for(;M<d.length;){const Se=h(d[M]);if(Se===null||Se.indent!==V)break;const $e=[Se.text],Xe=[];for(M+=1;M<d.length;){if(Dt(d[M])){const I=Sn(d,M+1);if(I===-1){M=d.length;break}const q=h(d[I]);if(q&&q.indent===V){M=I;break}if(Mt(d[I])<=V){M=I;break}M+=1;continue}const $t=h(d[M]);if($t&&$t.indent===V)break;const c=Mt(d[M])>V,m=x&&(dn(d[M])!==null||un(d[M])!==null);if(c||m){const I=Yt(d,M,V,h,x);if(I){Xe.push(...I.blocks),M=I.nextIndex;continue}}if(Mt(d[M])<=V)break;const w=Oe(d,M,V);if(!w)break;$e.push(w.value),M=w.nextIndex}L.push(Xe.length>0?{paragraphs:$e,children:Xe}:{paragraphs:$e})}return L.length>0?{items:L,nextIndex:M}:null}function Hn(d){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(d.trim())}function mn(d){const p=d.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return p?{marker:p[1],language:(p[2]??"").trim()}:null}function Ln(d){var M;const h=On(d).split(`
45
+ `),x=[];let L=0;for(;L<h.length;){if(Dt(h[L])){L+=1;continue}const pe=mn(h[L]);if(pe){L+=1;const w=[];for(;L<h.length;){if(h[L].trim()===pe.marker){L+=1;break}w.push(h[L]),L+=1}x.push({kind:"codeBlock",language:pe.language,value:w.join(`
46
+ `)});continue}if(Hn(h[L])){x.push({kind:"thematicBreak"}),L+=1;continue}const V=sn(h[L]);if(V){x.push({kind:"heading",level:V.level,value:V.value}),L+=1;continue}if(Tn(h[L])!==null){const w=[];for(;L<h.length;){const I=Tn(h[L]);if(I===null)break;w.push(I),L+=1}x.push({kind:"blockquote",value:w.join(`
47
+ `).trim()});continue}if(dn(h[L])!==null){const w=[],I=((M=Bn(h[L]))==null?void 0:M.indent)??0;for(;L<h.length;){const q=Bn(h[L]);if(q===null||q.indent!==I)break;w.push(q.item),L+=1}if(w.length>0){x.push({kind:"taskList",items:w});continue}}const Xe=un(h[L]);if(Xe!==null){const w=zn(h,L,Fn);if(w){x.push({kind:"unorderedList",items:w.items}),L=w.nextIndex;continue}if(Xe.length>0){x.push({kind:"unorderedList",items:[{paragraphs:[Xe]}]}),L+=1;continue}}const $t=Un(h[L]);if($t!==null){const w=Nn(h[L]),I=zn(h,L,Nn,!0);if(I){x.push({kind:"orderedList",items:I.items,start:(w==null?void 0:w.start)??1}),L=I.nextIndex;continue}if($t.length>0){x.push({kind:"orderedList",items:[{paragraphs:[$t]}],start:(w==null?void 0:w.start)??1}),L+=1;continue}}const c=[];for(;L<h.length&&!(Dt(h[L])||mn(h[L])||Hn(h[L])||sn(h[L])||Tn(h[L])!==null||dn(h[L])!==null||un(h[L])!==null||Un(h[L])!==null);)c.push(h[L]),L+=1;const m=c.join(`
48
+ `).trim();m&&x.push({kind:"paragraph",value:m})}return x}function tr(d){if(!d.includes("![")||!d.includes("]("))return Ln(d);const p=[],h=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let x=0;for(const L of d.matchAll(h)){const[M,pe,V]=L;if(typeof L.index!="number")continue;const Se=L.index,$e=Se+M.length,Xe=$n(V.trim());Xe&&(Se>x&&p.push(...Ln(d.slice(x,Se))),p.push({kind:"image",url:Xe,alt:pe.trim(),markdown:M}),x=$e)}return x<d.length&&p.push(...Ln(d.slice(x))),p}function qn(d){const h=On(d).split(`
49
+ `),x=[];let L=0,M=0;const pe=V=>{if(V<=M)return;const Se=h.slice(M,V).join(`
50
+ `);x.push(...tr(Se))};for(;L<h.length;){const V=mn(h[L]);if(!V){L+=1;continue}pe(L),L+=1;const Se=[];for(;L<h.length;){if(h[L].trim()===V.marker){L+=1;break}Se.push(h[L]),L+=1}x.push({kind:"codeBlock",language:V.language,value:Se.join(`
51
+ `)}),M=L}return pe(h.length),x.length>0?x:[{kind:"paragraph",value:d}]}function Ot(d){return d.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function In(d){return Rt(d).map(p=>p.kind==="text"?Ot(p.value):p.kind==="bold"?`<strong class="message-bold-text">${Ot(p.value)}</strong>`:p.kind==="italic"?`<em class="message-italic-text">${Ot(p.value)}</em>`:p.kind==="strikethrough"?`<s class="message-strikethrough-text">${Ot(p.value)}</s>`:p.kind==="file"?`<a class="message-file-link" href="${Ot(Wt(p.path))}" target="_blank" rel="noopener noreferrer" title="${Ot(p.path)}">${Ot(p.displayPath)}</a>`:p.kind==="url"?`<a class="message-file-link" href="${Ot(p.href)}" target="_blank" rel="noopener noreferrer" title="${Ot(p.href)}">${Ot(p.value)}</a>`:`<code class="message-inline-code">${Ot(p.value)}</code>`).join("")}function En(d){return d.paragraphs.map(p=>`<div class="message-list-item-text message-list-item-paragraph">${In(p)}</div>`).join("")}function A(d){var x;const p=En(d),h=((x=d.children)==null?void 0:x.map(L=>U(L)).join(""))??"";return p+h}function U(d){if(d.kind==="paragraph")return`<p class="message-text">${In(d.value)}</p>`;if(d.kind==="heading"){const p=Math.min(6,Math.max(1,Math.trunc(d.level))),h=ot(p),x=`message-heading ${We(p)}`;return`<${h} class="${x}">${In(d.value)}</${h}>`}if(d.kind==="blockquote")return`<blockquote class="message-blockquote">${In(d.value)}</blockquote>`;if(d.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${d.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${A(h)}</div></li>`).join("")}</ul>`;if(d.kind==="taskList")return`<ul class="message-list message-task-list">${d.items.map(h=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${h.checked?"true":"false"}">${h.checked?"☑":"☐"}</span><div class="message-list-item-text">${In(h.text)}</div></li>`).join("")}</ul>`;if(d.kind==="orderedList"){const p=d.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${A(h)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${d.start}">${p}</ol>`}return d.kind==="codeBlock"?`<div class="message-code-block">${d.language?`<div class="message-code-language">${Ot(d.language)}</div>`:""}<pre class="message-code-pre"><code>${Ot(d.value)}</code></pre></div>`:d.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${Ot(d.url)}" alt="${Ot(d.alt||"Embedded message image")}" loading="lazy">`}function ie(d){return qn(d).map(p=>U(p)).join("")}function Ne(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function it(d){const p=new Date(d);return Number.isNaN(p.getTime())?d:p.toLocaleTimeString()}function gt(d){const p=Ne(d.params),h=p==null?void 0:p.reason;return typeof h=="string"?h.trim():""}function at(d,p){return`${String(d)}:${p}`}function Ut(d){const p=Ne(d.params),h=Array.isArray(p==null?void 0:p.questions)?p.questions:[],x=[];for(const L of h){const M=Ne(L);if(!M)continue;const pe=typeof M.id=="string"?M.id:"";if(!pe)continue;const V=Array.isArray(M.options)?M.options.map(Se=>Ne(Se)).map(Se=>({label:typeof(Se==null?void 0:Se.label)=="string"?Se.label:"",description:typeof(Se==null?void 0:Se.description)=="string"?Se.description:""})).filter(Se=>Se.label.length>0):[];x.push({id:pe,header:typeof M.header=="string"?M.header:"",question:typeof M.question=="string"?M.question:"",isSecret:M.isSecret===!0,isOther:M.isOther===!0,options:V})}return x}function on(d,p,h){const x=at(d,p),L=W.value[x];return typeof L=="string"&&L.length>0?L:h}function Gn(d,p,h){const x=h.target;if(!(x instanceof HTMLInputElement))return;const L=at(d,p);W.value={...W.value,[L]:x.value}}function Gr(d,p){var L;const h=on(d,p.id,((L=p.options[0])==null?void 0:L.label)||""),x=p.options.find(M=>M.label===h);return(x==null?void 0:x.description)??""}function Kr(d,p){const h=at(d,p);return _e.value[h]??""}function Jr(d,p,h){const x=h.target;if(!(x instanceof HTMLSelectElement))return;const L=at(d,p);W.value={...W.value,[L]:x.value}}function ps(d,p,h){const x=h.target;if(!(x instanceof HTMLInputElement))return;const L=at(d,p);_e.value={..._e.value,[L]:x.value}}function Xt(d,p){Be("respondServerRequest",{id:d,result:{decision:p}})}function Yr(d){var x;const p=Ut(d),h={};for(const L of p){const M=on(d.id,L.id,((x=L.options[0])==null?void 0:x.label)||""),pe=Kr(d.id,L.id).trim(),V=[M,pe].map(Se=>Se.trim()).filter(Se=>Se.length>0);h[L.id]={answers:V}}Be("respondServerRequest",{id:d.id,result:{answers:h}})}function ms(d){Be("respondServerRequest",{id:d,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function gs(d){Be("respondServerRequest",{id:d,result:{success:!0,contentItems:[]}})}function Ir(d){Be("respondServerRequest",{id:d,result:{}})}function vs(d){Be("respondServerRequest",{id:d,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function S(){const d=ct.value,p=Ht.value;!d||!p||(d.scrollTop=d.scrollHeight,p.scrollIntoView({block:"end"}))}function R(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=dk}function P(d){if(!Ae.activeThreadId)return;const p=Math.max(d.scrollHeight-d.clientHeight,0),h=p>0?Math.min(Math.max(d.scrollTop/p,0),1):1;Be("updateScrollState",{threadId:Ae.activeThreadId,state:{scrollTop:d.scrollTop,isAtBottom:R(d),scrollRatio:h}})}function X(){const d=ct.value;if(!d)return;const p=Ae.scrollState;if(he.value){Fe();return}if(!p||p.isAtBottom){P(d);return}const h=Math.max(d.scrollHeight-d.clientHeight,0),x=typeof p.scrollRatio=="number"?p.scrollRatio*h:p.scrollTop;d.scrollTop=Math.min(Math.max(x,0),h),P(d)}function Fe(){const d=ct.value;d&&(S(),P(d))}function wt(){return he.value}function Kt(){if(!wt()){T=0,Ce=0;return}if(Fe(),T-=1,T<=0){Ce=0;return}Ce=requestAnimationFrame(Kt)}function fn(d=6){wt()&&(Ce&&(cancelAnimationFrame(Ce),Ce=0),T=Math.max(d,1),Ce=requestAnimationFrame(Kt))}function Zt(){fn(3)}function an(){he.value=!0,Fe(),fn(4)}function Kn(){if(!wt())return;const d=ct.value;if(!d)return;const p=d.querySelectorAll("img.message-image-preview");for(const h of p)h.complete||O.has(h)||(O.add(h),h.addEventListener("load",Zt,{once:!0}),h.addEventListener("error",Zt,{once:!0}))}async function Jn(){await tn(),ge&&cancelAnimationFrame(ge),ge=requestAnimationFrame(()=>{ge=0,X(),Kn(),fn()})}ft(()=>Ae.messages,async d=>{if(Ae.isLoading)return;const p=new Set(d.filter(h=>h.messageType==="commandExecution"&&h.commandExecution).map(h=>h.id));n.value=Re(n.value,p),r.value=Re(r.value,p),s.value=Re(s.value,new Set(Object.keys(F.value))),await Jn()}),ft(g,(d,p)=>{if(!p||p===d||!r.value.has(p))return;const h=new Set(r.value);h.delete(p),r.value=h}),ft(()=>Ae.pendingRequests,async()=>{Ae.isLoading||await Jn()},{deep:!0}),ft(()=>Ae.liveOverlay,async d=>{d&&(await tn(),wt()&&(Fe(),fn(8)))},{deep:!0}),ft(()=>Ae.isLoading,async d=>{d||await Jn()}),ft(()=>Ae.activeThreadId,()=>{var d;he.value=((d=Ae.scrollState)==null?void 0:d.isAtBottom)!==!1,ut.value="",z.value=new Set},{flush:"post"}),ft(()=>{var d;return(d=Ae.scrollState)==null?void 0:d.isAtBottom},d=>{he.value=d!==!1});function ur(){const d=ct.value;!d||Ae.isLoading||(he.value=R(d),P(d))}function Ds(d){ut.value=$n(d)}function Er(d,p){return`${d}:${String(p)}`}function dr(d,p){const h=new Set(z.value);h.add(Er(d,p)),z.value=h}function js(d,p){return z.value.has(Er(d,p))}function Fs(){ut.value=""}function Qr(){const d=pt.value;d&&(d.scrollTop=d.scrollHeight)}return ft(()=>{var d;return(d=Ae.liveOverlay)==null?void 0:d.reasoningText},async d=>{d&&(await tn(),Qr())}),qr(()=>{ge&&cancelAnimationFrame(ge),Ce&&cancelAnimationFrame(Ce),C&&clearTimeout(C)}),(d,p)=>(y(),k("section",Bw,[e.isLoading?(y(),k("p",Uw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(y(),k("p",Hw," No messages in this thread yet. ")):(y(),k("ul",{key:2,ref_key:"conversationListRef",ref:ct,class:"conversation-list",onScroll:ur},[(y(!0),k(Le,null,vt(e.messages,h=>{var x,L;return y(),k(Le,{key:h.id},[$.value.has(h.id)?fe("",!0):(y(),k("li",{key:0,class:"conversation-item","data-role":h.role,"data-message-type":h.messageType||""},[l(h)?(y(),k("div",Vw,[v("div",zw,[De(h).length>0?(y(),k("button",{key:0,type:"button",class:tt(["cmd-row cmd-row-group cmd-compact",[Ue(h),{"cmd-expanded":ce(h)}]]),onClick:M=>re(h)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":ce(h)}])},"▶",2),v("span",Gw,K(ne(h)),1),v("span",Kw,K(Pe(h)),1)],10,qw)):fe("",!0),De(h).length>0?(y(),k("div",{key:1,class:tt(["cmd-group-wrap",{"cmd-group-visible":ce(h)}])},[v("div",Jw,[(y(!0),k(Le,null,vt(le(h),M=>{var pe,V;return y(),k("div",{key:`grouped-cmd-${M.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:tt(["cmd-row",[Ue(M),{"cmd-expanded":te(M),"cmd-compact":!0}]]),onClick:Se=>ye(M)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":te(M)}])},"▶",2),v("code",Qw,K(((pe=M.commandExecution)==null?void 0:pe.command)||"(command)"),1),v("span",Xw,K(Ve(M)),1)],10,Yw),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":te(M)}])},[v("div",Zw,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ve(M)}]),textContent:K(((V=M.commandExecution)==null?void 0:V.aggregatedOutput)||"(no output)")},null,10,eb)])],2)])}),128))])],2)):(y(),k(Le,{key:2},[v("button",{type:"button",class:tt(["cmd-row",[Ue(h),{"cmd-expanded":te(h),"cmd-compact":Te(h)}]]),onClick:M=>ye(h)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":te(h)}])},"▶",2),v("code",nb,K(((x=h.commandExecution)==null?void 0:x.command)||"(command)"),1),v("span",rb,K(Ve(h)),1)],10,tb),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":te(h)}])},[v("div",sb,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ve(h)}]),textContent:K(((L=h.commandExecution)==null?void 0:L.aggregatedOutput)||"(no output)")},null,10,ob)])],2)],64))])])):(y(),k("div",{key:1,class:"message-row","data-role":h.role,"data-message-type":h.messageType||""},[v("div",{class:"message-stack","data-role":h.role},[v("article",{class:"message-body","data-role":h.role},[h.images&&h.images.length>0?(y(),k("ul",{key:0,class:"message-image-list","data-role":h.role},[(y(!0),k(Le,null,vt(h.images,M=>(y(),k("li",{key:M,class:"message-image-item"},[v("button",{class:"message-image-button",type:"button",onClick:pe=>Ds(M)},[v("img",{class:"message-image-preview",src:$n(M),alt:"Message image preview",loading:"lazy"},null,8,db)],8,ub)]))),128))],8,cb)):fe("",!0),h.fileAttachments&&h.fileAttachments.length>0?(y(),k("div",fb,[(y(!0),k(Le,null,vt(h.fileAttachments,M=>(y(),k("span",{key:M.path,class:"message-file-chip"},[p[1]||(p[1]=v("span",{class:"message-file-chip-icon"},"📄",-1)),v("a",{class:"message-file-link message-file-chip-name",href:Wt(M.path),target:"_blank",rel:"noopener noreferrer",title:M.path},K(M.path),9,hb)]))),128))])):fe("",!0),h.text.length>0?(y(),k("article",{key:2,class:"message-card","data-role":h.role},[h.messageType==="worked"?(y(),k("div",mb,[v("button",{type:"button",class:"worked-separator",onClick:M=>Ye(h)},[p[2]||(p[2]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),v("span",{class:tt(["worked-chevron",{"worked-chevron-open":Ge(h)}])},"▶",2),v("p",vb,K(h.text),1),p[3]||(p[3]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,gb),Ge(h)?(y(),k("div",yb,[(y(!0),k(Le,null,vt(rt(e.messages,e.messages.indexOf(h)),M=>{var pe,V;return y(),k("div",{key:`worked-cmd-${M.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:tt(["cmd-row",[Ue(M),{"cmd-expanded":te(M),"cmd-compact":Te(M)}]]),onClick:Se=>ye(M)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":te(M)}])},"▶",2),v("code",bb,K(((pe=M.commandExecution)==null?void 0:pe.command)||"(command)"),1),v("span",_b,K(Ve(M)),1)],10,wb),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":te(M)}])},[v("div",kb,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ve(M)}]),textContent:K(((V=M.commandExecution)==null?void 0:V.aggregatedOutput)||"(no output)")},null,10,Tb)])],2)])}),128))])):fe("",!0)])):f(h)?(y(),k("div",{key:1,class:"plan-card","data-streaming":h.messageType==="plan.live"},[v("div",Ib,[p[4]||(p[4]=v("p",{class:"plan-card-title"},"Plan",-1)),h.messageType==="plan.live"?(y(),k("span",Eb,"Updating")):fe("",!0)]),Y(h)?(y(),k("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:ie(Y(h))},null,8,Cb)):fe("",!0),ae(h).length>0?(y(),k("ol",Ab,[(y(!0),k(Le,null,vt(ae(h),(M,pe)=>(y(),k("li",{key:`${h.id}:plan-step:${pe}`,class:"plan-step-item","data-status":M.status},[v("span",{class:"plan-step-status","data-status":M.status},K(G(M.status)),9,Rb),v("div",{class:"plan-step-text plan-card-markdown",innerHTML:ie(M.step)},null,8,Pb)],8,xb))),128))])):(y(),k("div",{key:2,class:"plan-card-markdown",innerHTML:ie(h.text)},null,8,Mb))],8,Sb)):(y(),k("div",$b,[(y(!0),k(Le,null,vt(qn(h.text),(M,pe)=>(y(),k(Le,{key:`block-${pe}`},[M.kind==="paragraph"?(y(),k("p",Ob,[(y(!0),k(Le,null,vt(Rt(M.value),(V,Se)=>(y(),k(Le,{key:`seg-${pe}-${Se}`},[V.kind==="text"?(y(),k("span",Nb,K(V.value),1)):V.kind==="bold"?(y(),k("strong",Lb,K(V.value),1)):V.kind==="italic"?(y(),k("em",Db,K(V.value),1)):V.kind==="strikethrough"?(y(),k("s",jb,K(V.value),1)):V.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(V.path),target:"_blank",rel:"noopener noreferrer",title:V.path},K(V.displayPath),9,Fb)):V.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:V.href,target:"_blank",rel:"noopener noreferrer",title:V.href},K(V.value),9,Bb)):(y(),k("code",Ub,K(V.value),1))],64))),128))])):M.kind==="heading"?(y(),bt(Ti(ot(M.level)),{key:1,class:tt(["message-heading",We(M.level)])},{default:It(()=>[(y(!0),k(Le,null,vt(Rt(M.value),(V,Se)=>(y(),k(Le,{key:`heading-seg-${pe}-${Se}`},[V.kind==="text"?(y(),k("span",Hb,K(V.value),1)):V.kind==="bold"?(y(),k("strong",Wb,K(V.value),1)):V.kind==="italic"?(y(),k("em",Vb,K(V.value),1)):V.kind==="strikethrough"?(y(),k("s",zb,K(V.value),1)):V.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(V.path),target:"_blank",rel:"noopener noreferrer",title:V.path},K(V.displayPath),9,qb)):V.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:V.href,target:"_blank",rel:"noopener noreferrer",title:V.href},K(V.value),9,Gb)):(y(),k("code",Kb,K(V.value),1))],64))),128))]),_:2},1032,["class"])):M.kind==="blockquote"?(y(),k("blockquote",Jb,[(y(!0),k(Le,null,vt(Rt(M.value),(V,Se)=>(y(),k(Le,{key:`quote-seg-${pe}-${Se}`},[V.kind==="text"?(y(),k("span",Yb,K(V.value),1)):V.kind==="bold"?(y(),k("strong",Qb,K(V.value),1)):V.kind==="italic"?(y(),k("em",Xb,K(V.value),1)):V.kind==="strikethrough"?(y(),k("s",Zb,K(V.value),1)):V.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt(V.path),target:"_blank",rel:"noopener noreferrer",title:V.path},K(V.displayPath),9,e_)):V.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:V.href,target:"_blank",rel:"noopener noreferrer",title:V.href},K(V.value),9,t_)):(y(),k("code",n_,K(V.value),1))],64))),128))])):M.kind==="unorderedList"?(y(),k("ul",r_,[(y(!0),k(Le,null,vt(M.items,(V,Se)=>(y(),k("li",{key:`ul-${pe}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:A(V)},null,8,s_)]))),128))])):M.kind==="taskList"?(y(),k("ul",o_,[(y(!0),k(Le,null,vt(M.items,(V,Se)=>(y(),k("li",{key:`task-${pe}-${Se}`,class:"message-task-item"},[v("span",{class:"message-task-checkbox","data-checked":V.checked},K(V.checked?"☑":"☐"),9,i_),v("div",a_,[(y(!0),k(Le,null,vt(Rt(V.text),($e,Xe)=>(y(),k(Le,{key:`task-seg-${pe}-${Se}-${Xe}`},[$e.kind==="text"?(y(),k("span",l_,K($e.value),1)):$e.kind==="bold"?(y(),k("strong",c_,K($e.value),1)):$e.kind==="italic"?(y(),k("em",u_,K($e.value),1)):$e.kind==="strikethrough"?(y(),k("s",d_,K($e.value),1)):$e.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:Wt($e.path),target:"_blank",rel:"noopener noreferrer",title:$e.path},K($e.displayPath),9,f_)):$e.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:$e.href,target:"_blank",rel:"noopener noreferrer",title:$e.href},K($e.value),9,h_)):(y(),k("code",p_,K($e.value),1))],64))),128))])]))),128))])):M.kind==="orderedList"?(y(),k("ol",{key:5,class:"message-list message-list-ordered",start:M.start},[(y(!0),k(Le,null,vt(M.items,(V,Se)=>(y(),k("li",{key:`ol-${pe}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:A(V)},null,8,g_)]))),128))],8,m_)):M.kind==="codeBlock"?(y(),k("div",v_,[M.language?(y(),k("div",y_,K(M.language),1)):fe("",!0),v("pre",w_,[v("code",null,K(M.value),1)])])):M.kind==="thematicBreak"?(y(),k("hr",b_)):js(h.id,pe)?(y(),k("p",__,K(M.markdown),1)):(y(),k("button",{key:9,class:"message-image-button",type:"button",onClick:V=>Ds(M.url)},[v("img",{class:"message-image-preview message-markdown-image",src:M.url,alt:M.alt||"Embedded message image",loading:"lazy",onError:V=>dr(h.id,pe)},null,40,T_)],8,k_))],64))),128))]))],8,pb)):fe("",!0),Bt(h)?(y(),k("div",{key:3,class:"message-toolbar","data-role":h.role},[v("button",{type:"button",class:"message-copy-button","data-copied":He.value===h.id,"aria-label":He.value===h.id?"Response copied":"Copy response",title:He.value===h.id?"Response copied":"Copy response",onClick:M=>dt(h.id)},[je(Lw,{class:"icon-svg message-copy-icon"}),v("span",E_,K(He.value===h.id?"Copied":"Copy"),1)],8,I_)],8,S_)):fe("",!0)],8,lb)],8,ab)],8,ib))],8,Ww))],64)}),128)),e.liveOverlay?(y(),k("li",C_,[v("div",A_,[v("div",x_,[v("article",R_,[v("p",P_,K(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(y(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:pt},K(e.liveOverlay.reasoningText),513)):fe("",!0),e.liveOverlay.errorText?(y(),k("p",M_,K(e.liveOverlay.errorText),1)):fe("",!0)])])])])):fe("",!0),(y(!0),k(Le,null,vt(e.pendingRequests,h=>(y(),k("li",{key:`server-request:${h.id}`,class:"conversation-item conversation-item-request"},[v("div",$_,[v("div",O_,[v("article",N_,[v("p",L_,K(h.method),1),v("p",D_,"Request #"+K(h.id)+" · "+K(it(h.receivedAtIso)),1),gt(h)?(y(),k("p",j_,K(gt(h)),1)):fe("",!0),h.method==="item/commandExecution/requestApproval"?(y(),k("section",F_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Xt(h.id,"accept")},"Accept",8,B_),v("button",{type:"button",class:"request-button",onClick:x=>Xt(h.id,"acceptForSession")},"Accept for Session",8,U_),v("button",{type:"button",class:"request-button",onClick:x=>Xt(h.id,"decline")},"Decline",8,H_),v("button",{type:"button",class:"request-button",onClick:x=>Xt(h.id,"cancel")},"Cancel",8,W_)])):h.method==="item/fileChange/requestApproval"?(y(),k("section",V_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Xt(h.id,"accept")},"Accept",8,z_),v("button",{type:"button",class:"request-button",onClick:x=>Xt(h.id,"acceptForSession")},"Accept for Session",8,q_),v("button",{type:"button",class:"request-button",onClick:x=>Xt(h.id,"decline")},"Decline",8,G_),v("button",{type:"button",class:"request-button",onClick:x=>Xt(h.id,"cancel")},"Cancel",8,K_)])):h.method==="item/tool/requestUserInput"?(y(),k("section",J_,[(y(!0),k(Le,null,vt(Ut(h),x=>{var L;return y(),k("div",{key:`${h.id}:${x.id}`,class:"request-question"},[v("p",Y_,K(x.header||x.question),1),x.header&&x.question?(y(),k("p",Q_,K(x.question),1)):fe("",!0),x.options.length>0?(y(),k("select",{key:1,class:"request-select",value:on(h.id,x.id,((L=x.options[0])==null?void 0:L.label)||""),onChange:M=>Jr(h.id,x.id,M)},[(y(!0),k(Le,null,vt(x.options,M=>(y(),k("option",{key:`${h.id}:${x.id}:${M.label}`,value:M.label},K(M.label),9,Z_))),128))],40,X_)):fe("",!0),x.options.length>0&&Gr(h.id,x)?(y(),k("p",ek,K(Gr(h.id,x)),1)):(y(),k("input",{key:3,class:"request-input",type:x.isSecret?"password":"text",value:on(h.id,x.id,""),placeholder:x.isSecret?"Enter secret answer":"Enter answer",onInput:M=>Gn(h.id,x.id,M)},null,40,tk)),x.isOther?(y(),k("input",{key:4,class:"request-input",type:x.isSecret?"password":"text",value:Kr(h.id,x.id),placeholder:"Other answer",onInput:M=>ps(h.id,x.id,M)},null,40,nk)):fe("",!0)])}),128)),v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Yr(h)}," Submit Answers ",8,rk)])):h.method==="item/tool/call"?(y(),k("section",sk,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>ms(h.id)},"Fail Tool Call",8,ok),v("button",{type:"button",class:"request-button",onClick:x=>gs(h.id)},"Success (Empty)",8,ik)])):(y(),k("section",ak,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Ir(h.id)},"Return Empty Result",8,lk),v("button",{type:"button",class:"request-button",onClick:x=>vs(h.id)},"Reject Request",8,ck)]))])])])]))),128)),v("li",{ref_key:"bottomAnchorRef",ref:Ht,class:"conversation-bottom-anchor"},null,512)],544)),J.value?(y(),k("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:an},[je(Wf,{class:"icon-svg jump-to-latest-icon"})])):fe("",!0),ut.value.length>0?(y(),k("div",{key:4,class:"image-modal-backdrop",onClick:Fs},[v("div",{class:"image-modal-content",onClick:p[0]||(p[0]=Tt(()=>{},["stop"]))},[v("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Fs},[je(Hl,{class:"icon-svg"})]),v("img",{class:"image-modal-image",src:ut.value,alt:"Expanded message image"},null,8,uk)])])):fe("",!0)]))}}),hk=yt(fk,[["__scopeId","data-v-be5a79a8"]]),mu=.0025,va=3,gu=2,pk=256;function mk(e){var De;const t=D("idle"),n=D(typeof navigator<"u"&&!!((De=navigator.mediaDevices)!=null&&De.getUserMedia)),r=D(0),s=D(null);let o=null,i=null,a=[],l=null,f=null,u=null,g=null,_=[],E=!1,F=!1;function $(){const le=s.value;if(!le||typeof window>"u")return;const re=le.getContext("2d");if(!re)return;const ce=Math.max(1,Math.floor(le.clientWidth)),ne=Math.max(1,Math.floor(le.clientHeight||36)),Pe=window.devicePixelRatio||1,Ye=Math.max(1,Math.floor(ce*Pe)),Ge=Math.max(1,Math.floor(ne*Pe));(le.width!==Ye||le.height!==Ge)&&(le.width=Ye,le.height=Ge),re.setTransform(Pe,0,0,Pe,0,0),re.clearRect(0,0,ce,ne);const Ve=Math.max(12,Math.floor(ce/(va+gu))),Ue=_.slice(-Ve),Re=Math.max(0,Ve-Ue.length),rt=ne/2,Ae=getComputedStyle(le).color||"#000000";for(let Be=0;Be<Ve;Be+=1){const ct=Ue[Be-Re]??0,pt=Math.max(.08,Math.min(1,ct*18))*rt,ut=Be*(va+gu);re.globalAlpha=ct<=mu?.35:1,re.fillStyle=Ae,re.fillRect(ut,rt-pt,va,pt*2)}re.globalAlpha=1}function Y(){_=[],r.value=0,$()}function ae(){u&&(u.disconnect(),u.onaudioprocess=null,u=null),f&&(f.disconnect(),f=null),l&&(l.close(),l=null),g=null}function G(le){if(typeof window>"u")return;const re=window.webkitAudioContext,ce=window.AudioContext??re;ce&&(ae(),Y(),l=new ce,f=l.createMediaStreamSource(le),u=l.createScriptProcessor(2048,1,1),g=performance.now(),u.onaudioprocess=ne=>{const Pe=ne.inputBuffer.getChannelData(0);let Ye=0;for(let Ge=0;Ge<Pe.length;Ge+=1){const Ve=Math.abs(Pe[Ge]??0);Ye+=Ve<mu?0:Ve}_.push(Ye/Pe.length),_.length>pk&&_.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),$()},f.connect(u),u.connect(l.destination),$())}async function ee(){var le;if(!(t.value!=="idle"||!n.value||E)){E=!0,F=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=re=>{re.data.size>0&&a.push(re.data)},o.onstop=()=>{var ne;const re=a,ce=(o==null?void 0:o.mimeType)||((ne=re[0])==null?void 0:ne.type)||"audio/webm";ve(),Te(re,ce)},G(i),o.start(250),t.value="recording",F&&te()}catch(re){ve(),t.value="idle",(le=e.onError)==null||le.call(e,re)}finally{E=!1}}}function te(){if(E&&t.value==="idle"){F=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function Te(le,re){var ne,Pe,Ye,Ge;if(le.length===0){(ne=e.onEmpty)==null||ne.call(e),t.value="idle";return}const ce=new Blob(le,{type:re});t.value="transcribing";try{const Ve=re.split(/[/;]/)[1]??"webm",Ue=new FormData;Ue.append("file",ce,`codex.${Ve}`);const Re=await fetch("/codex-api/transcribe",{method:"POST",body:Ue}),rt=await Re.text();let Ae=null;try{Ae=rt.trim()?JSON.parse(rt):null}catch{Ae=null}if(!Re.ok){const ct=(Pe=Ae==null?void 0:Ae.error)==null?void 0:Pe.trim(),Ht=rt.trim();throw new Error(ct||Ht||`Transcription failed: ${Re.status}`)}const Be=((Ae==null?void 0:Ae.text)??"").trim();Be.length>0?e.onTranscript(Be):(Ye=e.onEmpty)==null||Ye.call(e)}catch(Ve){(Ge=e.onError)==null||Ge.call(e,Ve)}finally{t.value="idle"}}function ve(){ae(),Y(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(le=>le.stop()),i=null),a=[]}qr(ve);function ye(){if(t.value==="recording"){te();return}t.value==="idle"&&ee()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ee,stopRecording:te,toggleRecording:ye}}function vu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Lr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Wl(e,t){const n=vu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=vu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function Ns(e,t,n){return e instanceof Lr?e:e instanceof Error?new Lr(e.message||t,{code:"unknown_error",method:n}):new Lr(t,{code:"unknown_error",method:n})}function Vf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function gk(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Lr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let s=null;try{s=await r.json()}catch{s=null}if(!r.ok)throw new Lr(Wl(s,`RPC ${e} failed with HTTP ${r.status}`),{code:"http_error",method:e,status:r.status});const o=s;if(!o||typeof o!="object"||!("result"in o))throw new Lr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function vk(e){const t=Vf(e);if(!t||typeof t.method!="string"||t.method.length===0)return null;const n=typeof t.atIso=="string"&&t.atIso.length>0?t.atIso:new Date().toISOString();return{method:t.method,params:t.params??null,atIso:n}}function yu(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function yk(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(f,u)=>{if(n||r!==null)return;const g=Math.min(1e3*2**u,1e4);r=window.setTimeout(()=>{r=null,!n&&f()},g)},i=f=>{const u=vk(f);u&&e(u)},a=(f=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const u=new EventSource("/codex-api/events");let g=!1;u.onmessage=_=>{try{i(JSON.parse(_.data))}catch{}},u.addEventListener("ready",_=>{try{const E=_.data?JSON.parse(_.data):{ok:!0};yu(e,E)}catch{yu(e)}}),u.onerror=()=>{n||g||u.readyState===EventSource.CLOSED&&(g=!0,u.close(),o(()=>a(f+1),f))},t=()=>{g=!0,u.close()}},l=(f=0)=>{if(typeof WebSocket>"u"||n){a();return}t==null||t();const u=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${u}//${window.location.host}/codex-api/ws`);let _=!1,E=!1,F=window.setTimeout(()=>{_||n||E||(E=!0,g.close(),a())},2500);g.onopen=()=>{_=!0,s(),F!==null&&(window.clearTimeout(F),F=null)},g.onmessage=$=>{try{i(JSON.parse(String($.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(F!==null&&(window.clearTimeout(F),F=null),!(n||E)){if(!_){a();return}o(()=>l(f+1),f)}},t=()=>{E=!0,F!==null&&(window.clearTimeout(F),F=null),g.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function wk(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new Lr(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Lr(Wl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function bk(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Lr(Wl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Vf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function wu(e){return new Date(e*1e3).toISOString()}function _k(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function kk(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Tk=/^##\s+(.+?):\s+(.+?)\s*$/,Sk=/^#\s*files mentioned by the user\s*:?\s*$/i;function Ik(e){var s,o;const t=e.split(`
52
+ `).findIndex(i=>Sk.test(i.trim()));if(t<0)return[];const n=e.split(`
53
+ `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(Tk);if(!l)break;const f=(s=l[1])==null?void 0:s.trim(),u=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");f&&u&&r.push({label:f,path:u})}return r}function Ek(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const s=r.index+r[0].length;return e.slice(s).trim()}function Ck(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[a,l]of t.entries())l.type==="text"&&typeof l.text=="string"&&l.text.length>0&&n.push(l.text),l.type==="image"&&typeof l.url=="string"&&l.url.trim().length>0&&r.push(l.url.trim()),l.type!=="text"&&l.type!=="image"&&s.push({id:`${e}:user-content:${a}`,role:"user",text:"",messageType:`userContent.${l.type}`,rawPayload:kk(l),isUnhandled:!0});const o=n.join(`
54
+ `),i=Ik(o);return{text:Ek(o),images:r,fileAttachments:i,rawBlocks:s}}function Ak(e){var o;const t=e.replace(/\r\n/g,`
55
+ `).trim();if(!t)return null;const n=t.split(`
56
+ `),r=[],s=[];for(const i of n){const a=i.trim();if(!a){r.length===0&&s.push("");continue}const l=a.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const f=(l[1]??" ").toLowerCase(),u=(o=l[2])==null?void 0:o.trim();if(!u)continue;let g="pending";f==="x"&&(g="completed"),(f==="~"||f===">"||f==="-")&&(g="inProgress"),r.push({step:u,status:g});continue}s.push(a)}return r.length===0?null:{explanation:s.join(`
57
+ `).trim()||void 0,steps:r}}function xk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Ck(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="reasoning")return[];if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:Ak(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Rk(t.status),r=typeof t.command=="string"?t.command:"",s=typeof t.cwd=="string"?t.cwd:null,o=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",i=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:s,status:n,aggregatedOutput:o,exitCode:i}}]}return[]}function Rk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Pk(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function Mk(e){const t=Pk(e);return t.length>0?t:"Untitled thread"}function zf(e){return(e==null?void 0:e.status)==="inProgress"}function $k(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return zf(r)}function Ok(e){const t=e,n=typeof t.cwd=="string"?t.cwd:e.cwd,r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||n.includes("/.codex/worktrees/")||n.includes("/.git/worktrees/");return{id:e.id,title:Mk(e),projectName:_k(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:wu(e.createdAt),updatedAtIso:wu(e.updatedAt),preview:e.preview,unread:!1,inProgress:$k(e)}}function Nk(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((s,o)=>new Date(o.updatedAtIso).getTime()-new Date(s.updatedAtIso).getTime())})).sort((n,r)=>{var i,a;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((a=r.threads[0])==null?void 0:a.updatedAtIso)??0).getTime()-s})}function Lk(e){const t=e.data.map(Ok);return Nk(t)}function qf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const s=t[r],o=Array.isArray(s.items)?s.items:[];for(const i of o)for(const a of xk(i))n.push({...a,turnIndex:r})}return n}function Dk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return zf(t.at(-1))}function ya(e){return e&&e.length>0?e:null}function wa(e){return e&&e.length>0?e:null}const bu=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function hn(e){return typeof e=="string"&&e.length>0?e:null}function ba(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function nl(e){return typeof e=="boolean"?e:null}function jk(e){return e==="payment_required"?e:null}function Fk(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function _u(e){const t=Zn(e);if(!t)return null;const n=ba(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:ba(t.windowDurationMins??t.window_minutes),resetsAt:ba(t.resetsAt??t.resets_at)}}function Bk(e){const t=Zn(e);if(!t)return null;const n=nl(t.hasCredits??t.has_credits),r=nl(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:hn(t.balance)}}function rl(e){const t=Zn(e);if(!t)return null;const n=_u(t.primary),r=_u(t.secondary),s=Bk(t.credits);return!n&&!r&&!s?null:{limitId:hn(t.limitId??t.limit_id),limitName:hn(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:hn(t.planType??t.plan_type)}}function Gf(e,t=null){const n=Zn(e);if(!n)return null;const r=hn(n.accountId),s=hn(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:hn(n.authMode),email:hn(n.email),planType:hn(n.planType),lastRefreshedAtIso:hn(n.lastRefreshedAtIso)??"",lastActivatedAtIso:hn(n.lastActivatedAtIso),quotaSnapshot:rl(n.quotaSnapshot),quotaUpdatedAtIso:hn(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:hn(n.quotaError),unavailableReason:jk(n.unavailableReason)??(Fk(hn(n.quotaError))?"payment_required":null),isActive:nl(n.isActive)??r===t}:null}function Kf(e){const t=Zn(e);if(!t)return null;const n=Zn(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=rl(n==null?void 0:n.codex);return r||rl(t.rateLimits??t.rate_limits)}async function kn(e,t){try{return await gk(e,t)}catch(n){throw Ns(n,`RPC ${e} failed`,e)}}function Uk(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Hk(){const e=await kn("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Lk(e)}async function Wk(e){const t=await kn("thread/read",{threadId:e,includeTurns:!0});return{messages:qf(t),inProgress:Dk(t)}}async function Vk(){try{return await Hk()}catch(e){throw Ns(e,"Failed to load thread groups","thread/list")}}async function zk(e){try{return await Wk(e)}catch(t){throw Ns(t,`Failed to load thread ${e}`,"thread/read")}}function qk(e){return yk(e)}async function Gk(e,t){await wk({id:e,...t})}async function Kk(){return bk()}async function Jk(){try{const e=await kn("account/rateLimits/read");return Kf(e)}catch(e){throw Ns(e,"Failed to load account rate limits","account/rateLimits/read")}}function Vl(e){const t=Zn(e),n=hn(t==null?void 0:t.activeAccountId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,importedAccountId:hn(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>Gf(s,n)).filter(s=>s!==null)}}async function Yk(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Ls(t,"Failed to load accounts"));const n=Zn(t);return Vl(n==null?void 0:n.data)}async function Qk(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Ls(t,"Failed to refresh accounts"));const n=Zn(t);return Vl(n==null?void 0:n.data)}async function Xk(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Ls(n,"Failed to switch account"));const r=Zn(n),s=Zn(r==null?void 0:r.data),o=Gf(s==null?void 0:s.account,hn(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function Zk(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Ls(n,"Failed to remove account"));const r=Zn(n);return Vl(r==null?void 0:r.data)}async function _a(e){await kn("thread/resume",{threadId:e})}async function e0(e){await kn("thread/archive",{threadId:e})}async function t0(e,t){await kn("thread/name/set",{threadId:e,name:t})}async function n0(e,t){const n=await kn("thread/rollback",{threadId:e,numTurns:t});return qf(n)}function r0(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}async function ku(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await kn("thread/start",n),s=r0(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw Ns(n,"Failed to start a new thread","thread/start")}}function s0(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
58
+ `;for(const r of t)n+=`
59
+ ## ${r.label}: ${r.path}
60
+ `;return`${n}
61
+ ## My request for Codex:
62
+
63
+ ${e}
64
+ `}async function o0(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?ya(n):wa(n)};let s=null;try{s=await Yf()}catch{s=null}const o=(s==null?void 0:s.model.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?ya(n??(s==null?void 0:s.reasoningEffort)):wa(n??(s==null?void 0:s.reasoningEffort))};let i=[];try{i=await Jf()}catch{i=[]}const a=((l=i.find(f=>f.trim().length>0))==null?void 0:l.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?ya(n??(s==null?void 0:s.reasoningEffort)):wa(n??(s==null?void 0:s.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function ka(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",u=[{type:"text",text:s0(t,i)}];for(const E of n){const F=E.trim();F&&u.push({type:"image",url:F,image_url:F})}if(o)for(const E of o)u.push({type:"skill",name:E.name,path:E.path});const g=i.map(E=>({label:E.label,path:E.path,fsPath:E.fsPath})),_={threadId:e,input:u};if(g.length>0&&(_.attachments=g),l&&(_.model=l),typeof s=="string"&&s.length>0&&(_.effort=s),a){const E=await o0(a,l,s);_.collaborationMode={mode:a,settings:{model:E.model,reasoning_effort:E.reasoningEffort,developer_instructions:null}}}await kn("turn/start",_)}catch(l){throw Ns(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function i0(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await kn("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw Ns(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function a0(e){await kn("setDefaultModel",{model:e})}async function Jf(){const e=await kn("model/list",{}),t=[];for(const n of e.data){const r=n.id||n.model;!r||t.includes(r)||t.push(r)}return t}async function Yf(){const e=await kn("config/read",{}),t=e.config.model??"",n=Uk(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function l0(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function c0(){try{const e=await kn("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const s=r.mode;s!=="default"&&s!=="plan"||t.has(s)||(t.add(s),n.push({value:s,label:l0(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of bu)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return bu}function u0(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const a of o)typeof a=="string"&&a.length>0&&!i.includes(a)&&i.push(a);return i},r=t.labels,s={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,i]of Object.entries(r))typeof o=="string"&&o.length>0&&typeof i=="string"&&(s[o]=i);return{order:n(t.order),labels:s,active:n(t.active)}}async function yo(){const e=await fetch("/codex-api/workspace-roots-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load workspace roots state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return u0(n.data)}async function d0(e){const t=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e})}),n=await t.json();if(!t.ok||!n.data)throw new Error(n.error||"Failed to create worktree");return n.data}async function Tu(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function Su(e){if(!(await fetch("/codex-api/workspace-roots-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save workspace roots state")}async function Iu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const a=Ls(r,"Failed to open project root");throw new Error(a)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return typeof o.path=="string"?o.path.trim():""}async function f0(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const i=Ls(r,"Failed to suggest project name");throw new Error(i)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?o.path.trim():""}}async function h0(e,t,n=20){const r=e.trim();if(!r)return[];const s=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),o=await s.json();if(!s.ok){const f=Ls(o,"Failed to search files");throw new Error(f)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const f of a){if(!f||typeof f!="object"||Array.isArray(f))continue;const g=f.path,_=typeof g=="string"?g.trim():"";_&&l.push({path:_})}return l}async function p0(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function Ls(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const s=n.error;return typeof s=="string"&&s.trim().length>0?s:t}async function m0(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function Ta(e,t){try{await fetch("/codex-api/thread-titles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,title:t})})}catch{}}async function g0(e,t){var n;try{return((n=(await kn("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function v0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await kn("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}async function Eu(e){try{const t=new FormData;t.append("file",e);const n=await fetch("/codex-api/upload-file",{method:"POST",body:t});return n.ok?(await n.json()).path??null:null}catch{return null}}const y0={},w0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function b0(e,t){return y(),k("svg",w0,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 2m0 3a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3zM5 10a7 7 0 0 0 14 0M8 21h8M12 17v4"},null,-1)])])}const _0=yt(y0,[["render",b0]]),k0={},T0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function S0(e,t){return y(),k("svg",T0,[...t[0]||(t[0]=[v("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),v("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const Cu=yt(k0,[["render",S0]]),I0=["disabled"],E0={class:"composer-dropdown-value"},C0={class:"composer-dropdown-menu"},A0={key:0,class:"composer-dropdown-search-wrap"},x0=["placeholder","onKeydown"],R0={class:"composer-dropdown-options",role:"listbox"},P0=["onClick"],M0={key:0,class:"composer-dropdown-empty"},$0={key:1,class:"composer-dropdown-add-wrap"},O0=["placeholder","onKeydown"],N0=cn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},showAddAction:{type:Boolean},addActionLabel:{},defaultAddValue:{},addPlaceholder:{}},emits:["update:modelValue","add"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(null),a=D(!1),l=D(""),f=D(!1),u=D(""),g=de(()=>{var ce;const re=n.options.find(ne=>ne.value===n.modelValue);return re?re.label:((ce=n.placeholder)==null?void 0:ce.trim())||""}),_=de(()=>n.openDirection??"down"),E=de(()=>n.enableSearch===!0),F=de(()=>n.showAddAction===!0),$=de(()=>{var re;return((re=n.searchPlaceholder)==null?void 0:re.trim())||"Quick search projects"}),Y=de(()=>{var re;return((re=n.addActionLabel)==null?void 0:re.trim())||"Add new project"}),ae=de(()=>{var re;return((re=n.addPlaceholder)==null?void 0:re.trim())||"Project name or absolute path"}),G=de(()=>{const re=l.value.trim().toLowerCase();return re?n.options.filter(ce=>ce.label.toLowerCase().includes(re)||ce.value.toLowerCase().includes(re)):n.options});function ee(){n.disabled||(a.value=!a.value)}function te(re){r("update:modelValue",re),a.value=!1,l.value=""}function Te(){var re;f.value=!0,u.value=((re=n.defaultAddValue)==null?void 0:re.trim())||"",tn(()=>{var ce;return(ce=i.value)==null?void 0:ce.focus()})}function ve(){if(l.value.length>0){l.value="";return}a.value=!1}function ye(){const re=u.value.trim();re&&(r("add",re),f.value=!1,u.value="",a.value=!1,l.value="")}function De(){f.value=!1,u.value="",a.value=!1,l.value=""}function le(re){if(!a.value)return;const ce=s.value;if(!ce)return;const ne=re.target;ne instanceof Node&&(ce.contains(ne)||(a.value=!1,l.value="",f.value=!1,u.value=""))}return ft(a,re=>{if(!re){f.value=!1,u.value="";return}E.value&&tn(()=>{var ce;return(ce=o.value)==null?void 0:ce.focus()})}),zr(()=>{window.addEventListener("pointerdown",le)}),qr(()=>{window.removeEventListener("pointerdown",le)}),(re,ce)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[v("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:ee},[v("span",E0,K(g.value),1),je(Ji,{class:"composer-dropdown-chevron"})],8,I0),a.value?(y(),k("div",{key:0,class:tt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":_.value==="up","composer-dropdown-menu-wrap-down":_.value==="down"}])},[v("div",C0,[E.value?(y(),k("div",A0,[Br(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":ce[0]||(ce[0]=ne=>l.value=ne),class:"composer-dropdown-search-input",type:"text",placeholder:$.value,onKeydown:Rn(Tt(ve,["prevent"]),["esc"])},null,40,x0),[[Ur,l.value]])])):fe("",!0),v("ul",R0,[(y(!0),k(Le,null,vt(G.value,ne=>(y(),k("li",{key:ne.value},[v("button",{class:tt(["composer-dropdown-option",{"is-selected":ne.value===e.modelValue}]),type:"button",onClick:Pe=>te(ne.value)},K(ne.label),11,P0)]))),128)),G.value.length===0?(y(),k("li",M0," No matching projects ")):fe("",!0)]),F.value?(y(),k("div",$0,[f.value?(y(),k(Le,{key:0},[Br(v("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":ce[1]||(ce[1]=ne=>u.value=ne),class:"composer-dropdown-add-input",type:"text",placeholder:ae.value,onKeydown:[Rn(Tt(ye,["prevent"]),["enter"]),Rn(Tt(De,["prevent"]),["esc"])]},null,40,O0),[[Ur,u.value]]),v("div",{class:"composer-dropdown-add-actions"},[v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ye},"Open"),v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:De},"Cancel")])],64)):(y(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:Te},K(Y.value),1))])):fe("",!0)])],2)):fe("",!0)],512))}}),sl=yt(N0,[["__scopeId","data-v-7cfa2012"]]),L0=["disabled"],D0={class:"search-dropdown-value"},j0={class:"search-dropdown-search-wrap"},F0=["placeholder","onKeydown"],B0={key:0,class:"search-dropdown-list",role:"listbox"},U0=["onClick","onPointerenter"],H0={class:"search-dropdown-option-check"},W0={class:"search-dropdown-option-label"},V0={key:0,class:"search-dropdown-option-desc"},z0={key:1,class:"search-dropdown-empty"},q0=cn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(!1),a=D(""),l=D(0),f=de(()=>n.openDirection??"down"),u=de(()=>new Set(n.selectedValues)),g=de(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const G=n.options.find(ee=>ee.value===n.selectedValues[0]);return(G==null?void 0:G.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),_=de(()=>{const G=a.value.toLowerCase().trim();return G?n.options.filter(ee=>{var te;return ee.label.toLowerCase().includes(G)||(((te=ee.description)==null?void 0:te.toLowerCase().includes(G))??!1)}):n.options});function E(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,tn(()=>{var G;return(G=o.value)==null?void 0:G.focus()})))}function F(G){r("toggle",G.value,!u.value.has(G.value))}function $(G){_.value.length!==0&&(l.value=(l.value+G+_.value.length)%_.value.length)}function Y(){const G=_.value[l.value];G&&F(G)}function ae(G){if(!i.value)return;const ee=s.value;if(!ee)return;const te=G.target;te instanceof Node&&(ee.contains(te)||(i.value=!1))}return ft(a,()=>{l.value=0}),zr(()=>window.addEventListener("pointerdown",ae)),qr(()=>window.removeEventListener("pointerdown",ae)),(G,ee)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[v("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:E},[v("span",D0,K(g.value),1),je(Ji,{class:"search-dropdown-chevron"})],8,L0),i.value?(y(),k("div",{key:0,class:tt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":f.value==="up","search-dropdown-menu-wrap-down":f.value==="down"}])},[v("div",j0,[Br(v("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":ee[0]||(ee[0]=te=>a.value=te),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[ee[1]||(ee[1]=Rn(Tt(te=>i.value=!1,["prevent"]),["escape"])),Rn(Tt(Y,["prevent"]),["enter"]),ee[2]||(ee[2]=Rn(Tt(te=>$(1),["prevent"]),["arrow-down"])),ee[3]||(ee[3]=Rn(Tt(te=>$(-1),["prevent"]),["arrow-up"]))]},null,40,F0),[[Ur,a.value]])]),_.value.length>0?(y(),k("ul",B0,[(y(!0),k(Le,null,vt(_.value,(te,Te)=>(y(),k("li",{key:te.value},[v("button",{class:tt(["search-dropdown-option",{"is-selected":u.value.has(te.value),"is-highlighted":Te===l.value}]),type:"button",onClick:ve=>F(te),onPointerenter:ve=>l.value=Te},[v("span",H0,K(u.value.has(te.value)?"✓":""),1),v("span",W0,K(te.label),1),te.description?(y(),k("span",V0,K(te.description),1)):fe("",!0)],42,U0)]))),128))])):(y(),k("div",z0,"No results"))],2)):fe("",!0)],512))}}),G0=yt(q0,[["__scopeId","data-v-a0f2edd4"]]),K0={class:"skill-picker-header"},J0=["onKeydown"],Y0={key:0,class:"skill-picker-list",role:"listbox"},Q0=["onClick","onPointerenter"],X0={class:"skill-picker-name"},Z0={key:0,class:"skill-picker-desc"},eT={key:1,class:"skill-picker-empty"},tT=cn({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(""),a=D(0),l=de(()=>{const _=i.value.toLowerCase().trim();return _?n.skills.filter(E=>E.name.toLowerCase().includes(_)||E.description.toLowerCase().includes(_)):n.skills}),f=de(()=>{const _={};return n.anchorBottom!=null&&(_.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(_.left=`${n.anchorLeft}px`),_});function u(_){l.value.length!==0&&(a.value=(a.value+_+l.value.length)%l.value.length)}function g(){const _=l.value[a.value];_&&r("select",_)}return ft(()=>n.visible,_=>{_&&(i.value="",a.value=0,tn(()=>{var E;return(E=o.value)==null?void 0:E.focus()}))}),ft(i,()=>{a.value=0}),(_,E)=>e.visible?(y(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:ls(f.value)},[v("div",K0,[Br(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":E[0]||(E[0]=F=>i.value=F),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[E[1]||(E[1]=Rn(Tt(F=>_.$emit("close"),["prevent"]),["escape"])),Rn(Tt(g,["prevent"]),["enter"]),E[2]||(E[2]=Rn(Tt(F=>u(1),["prevent"]),["arrow-down"])),E[3]||(E[3]=Rn(Tt(F=>u(-1),["prevent"]),["arrow-up"]))]},null,40,J0),[[Ur,i.value]])]),l.value.length>0?(y(),k("ul",Y0,[(y(!0),k(Le,null,vt(l.value,(F,$)=>(y(),k("li",{key:F.path},[v("button",{class:tt(["skill-picker-item",{"is-highlighted":$===a.value}]),type:"button",onClick:Y=>_.$emit("select",F),onPointerenter:Y=>a.value=$},[v("span",X0,K(F.name),1),F.description?(y(),k("span",Z0,K(F.description),1)):fe("",!0)],42,Q0)]))),128))])):(y(),k("div",eT,"No skills found"))],4)):fe("",!0)}}),nT=yt(tT,[["__scopeId","data-v-ff3fb7dc"]]),rT={key:0,class:"thread-composer-dictation-error"},sT={key:0,class:"thread-composer-attachments"},oT=["src","alt"],iT=["aria-label","disabled","onClick"],aT={key:1,class:"thread-composer-folder-chips"},lT=["title"],cT={class:"thread-composer-folder-chip-meta"},uT=["aria-label","disabled","onClick"],dT={key:2,class:"thread-composer-file-chips"},fT=["title"],hT=["aria-label","disabled","onClick"],pT={key:3,class:"thread-composer-skill-chips"},mT={class:"thread-composer-skill-chip-name"},gT=["aria-label","onClick"],vT=["title"],yT={class:"thread-composer-rate-limit-row"},wT={class:"thread-composer-rate-limit-value"},bT={key:0,class:"thread-composer-rate-limit-refresh"},_T={class:"thread-composer-input-wrap"},kT={key:0,class:"thread-composer-file-mentions"},TT=["onMousedown"],ST={key:1,class:"thread-composer-file-mention-icon-markdown"},IT={class:"thread-composer-file-mention-text"},ET={class:"thread-composer-file-mention-name"},CT={key:0,class:"thread-composer-file-mention-dir"},AT={key:1,class:"thread-composer-file-mention-empty"},xT=["placeholder","disabled"],RT=["disabled"],PT={key:0,class:"thread-composer-attach-menu"},MT=["disabled"],$T=["disabled"],OT=["disabled"],NT=["aria-label","aria-pressed","disabled"],LT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},DT={key:1,class:"thread-composer-dictation-timer"},jT=["aria-label","title","disabled"],FT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},BT=["disabled"],UT=["aria-label","title","disabled"],HT=["disabled"],WT=["disabled"],VT=["disabled"],zT=cn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},skills:{},codexQuota:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,s=D(""),o=D([]),i=D([]),a=D([]),l=D([]),f=D(""),{state:u,isSupported:g,recordingDurationMs:_,waveformCanvasRef:E,startRecording:F,stopRecording:$,toggleRecording:Y}=mk({onTranscript:A=>{s.value=s.value?`${s.value}
65
+ ${A}`:A,f.value="",tn(()=>{var U;return(U=Te.value)==null?void 0:U.focus()})},onEmpty:()=>{f.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:A=>{if(A instanceof DOMException&&A.name==="NotAllowedError"){f.value="Microphone access was denied.";return}f.value=A instanceof Error?A.message:"Dictation failed."}}),ae=D(null),G=D(null),ee=D(null),te=D(null),Te=D(null),ve=D(!1),ye=D(!1),De=D(null),le=D(""),re=D([]),ce=D(!1),ne=D(0);let Pe=0,Ye=null,Ge=!1;const Ve=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),Ue=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}],Re=de(()=>n.models.map(A=>({value:A,label:A}))),rt=de(()=>n.selectedCollaborationMode==="plan"),Ae=de(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),Be=de(()=>n.skills??[]),ct=de(()=>i.value.map(A=>A.path)),Ht=de(()=>(n.skills??[]).map(A=>({value:A.path,label:A.name,description:A.description}))),pt=de(()=>n.disabled||!n.activeThreadId||Ae.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),ut=de(()=>{const A=new Set;for(const U of l.value)for(const ie of U.filePaths)A.add(ie);return a.value.filter(U=>!A.has(U.fsPath))}),He=de(()=>n.disabled||!n.activeThreadId),W=de(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),_e=de(()=>u.value==="recording"),he=de(()=>u.value==="recording"?"Stop dictation":u.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),ge=de(()=>u.value==="idle"?f.value.trim():""),Ce=de(()=>{const A=Math.max(0,Math.floor(_.value/1e3)),U=Math.floor(A/60),ie=A%60;return`${U}:${String(ie).padStart(2,"0")}`}),T=de(()=>n.activeThreadId?Ae.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),C=de(()=>we(n.codexQuota??null)),O=de(()=>""),z=de(()=>ke(n.codexQuota??null));function J(A){return!A||A==="unknown"?"":A==="edu"?"Education":`${A.slice(0,1).toUpperCase()}${A.slice(1)}`}function N(A){return typeof A!="number"||!Number.isFinite(A)||A<=0?"":A%1440===0?`${A/1440}d`:A%60===0?`${A/60}h`:`${A}m`}function B(A){if(typeof A!="number"||!Number.isFinite(A))return"";const ie=A*1e3-Date.now();if(ie<=0)return"resetting now";const Ne=Math.round(ie/6e4);if(Ne<60)return`resets in ${Math.max(1,Ne)}m`;const it=Math.round(Ne/60);if(it<48)return`resets in ${Math.max(1,it)}h`;const gt=Math.round(it/24);return`resets in ${Math.max(1,gt)}d`}function H(A){return typeof A!="number"||!Number.isFinite(A)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(A*1e3))}function Q(A){if(typeof A!="number"||!Number.isFinite(A))return"";const U=new Date(A*1e3);return`${U.getMonth()+1}月${U.getDate()}日`}function Z(A){const U=[A.primary,A.secondary].filter(it=>it!==null),ie=U.find(it=>it.windowMinutes===10080);if(ie)return ie;const Ne=U.filter(it=>typeof it.windowMinutes=="number"&&it.windowMinutes>=10080).sort((it,gt)=>(it.windowMinutes??0)-(gt.windowMinutes??0));return Ne[0]?Ne[0]:A.secondary??null}function Ee(A){const U=Math.max(0,Math.min(100,100-Math.round(A.usedPercent))),ie=N(A.windowMinutes);return ie?`${U}% / ${ie}`:`${U}%`}function we(A){var gt,at;if(!A)return"";const U=[],ie=J(A.planType);ie&&U.push(ie),A.primary&&U.push(Ee(A.primary)),A.secondary&&U.push(Ee(A.secondary));const Ne=Z(A),it=Q((Ne==null?void 0:Ne.resetsAt)??null);return it&&U.push(it),U.length===0&&((gt=A.credits)!=null&&gt.unlimited)?U.push("Unlimited credits"):U.length===0&&((at=A.credits)!=null&&at.hasCredits)&&A.credits.balance&&U.push(`${A.credits.balance} credits`),U.join(" · ")}function ke(A){var it,gt;if(!A)return"";const U=[],ie=J(A.planType);if(ie&&U.push(`Plan: ${ie}`),A.primary){const at=B(A.primary.resetsAt);U.push(`Primary window: ${Ee(A.primary)}${at?`, ${at}`:""}`)}if(A.secondary){const at=B(A.secondary.resetsAt);U.push(`Secondary window: ${Ee(A.secondary)}${at?`, ${at}`:""}`)}(it=A.credits)!=null&&it.unlimited?U.push("Credits: unlimited"):(gt=A.credits)!=null&&gt.hasCredits&&A.credits.balance&&U.push(`Credits: ${A.credits.balance}`);const Ne=Z(A);if(Ne){const at=H(Ne.resetsAt);at&&U.push(`Weekly refresh: ${at}`)}return U.join(`
66
+ `)}function xe(A="steer"){var ie;const U=s.value.trim();if(pt.value){if(r("submit",{text:U,imageUrls:o.value.map(Ne=>Ne.url),fileAttachments:[...a.value],skills:i.value.map(Ne=>({name:Ne.name,path:Ne.path})),mode:A}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],ve.value=!1,ye.value=!1,Me(),Ve){(ie=Te.value)==null||ie.blur();return}tn(()=>{var Ne;return(Ne=Te.value)==null?void 0:Ne.focus()})}}function ze(){r("interrupt")}function ot(A){r("update:selected-model",A)}function We(){r("update:selected-collaboration-mode",rt.value?"default":"plan")}function ht(A){r("update:selected-reasoning-effort",A)}function _t(){n.dictationClickToToggle&&(f.value&&(f.value=""),Y())}function Pt(A){if(n.dictationClickToToggle||(A.preventDefault(),Ge))return;Ge=!0;const U=A.currentTarget;if(U)try{U.setPointerCapture(A.pointerId)}catch{}f.value&&(f.value=""),window.addEventListener("pointerup",Ke),window.addEventListener("pointercancel",Ke),window.addEventListener("blur",Ke),F()}function Ke(){n.dictationClickToToggle||Ge&&(Ge=!1,window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",Ke),$())}function Bt(){He.value||(ve.value=!ve.value)}function Vt(){var A;(A=G.value)==null||A.click()}function dt(){var A;(A=ee.value)==null||A.click()}function kt(){var A;(A=te.value)==null||A.click()}function mt(A){o.value=o.value.filter(U=>U.id!==A)}function rn(A){i.value=i.value.filter(U=>U.path!==A)}function xt(A){a.value=a.value.filter(U=>U.fsPath!==A)}function Rt(A){const U=l.value.find(Ne=>Ne.id===A);if(!U)return;const ie=new Set(U.filePaths);a.value=a.value.filter(Ne=>!ie.has(Ne.fsPath)),l.value=l.value.filter(Ne=>Ne.id!==A)}function $n(A){return A.total<=0?0:Math.round(A.processed/A.total*100)}function Wt(A,U){const ie=A.replace(/\\/g,"/");if(a.value.some(gt=>gt.fsPath===ie))return;const Ne=ie.split("/").filter(Boolean),it=(U==null?void 0:U.trim())||Ne[Ne.length-1]||ie;a.value=[...a.value,{label:it,path:ie,fsPath:ie}]}function On(A){return A.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(A.name)}function Mt(A){const U=new FileReader;U.onload=()=>{typeof U.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:A.name||`Pasted image ${o.value.length+1}`,url:U.result})},U.readAsDataURL(A)}function qt(A){if(!(!A||A.length===0))for(const U of Array.from(A)){if(On(U)){Mt(U);continue}Eu(U).then(ie=>{ie&&Wt(ie)}).catch(()=>{})}}function Dt(A){var Ne,it;const U=(Ne=A.clipboardData)==null?void 0:Ne.items;if(U&&U.length>0){const gt=[];for(const at of Array.from(U)){if(at.kind!=="file"||!at.type.startsWith("image/"))continue;const Ut=at.getAsFile();Ut&&gt.push(Ut)}if(gt.length>0)return gt}const ie=(it=A.clipboardData)==null?void 0:it.files;return!ie||ie.length===0?[]:Array.from(ie).filter(gt=>On(gt))}function sn(A){if(He.value)return;const U=Dt(A);U.length!==0&&(A.preventDefault(),qt(U),ve.value=!1,f.value&&(f.value=""))}async function Tn(A){if(!A||A.length===0)return;const U=Array.from(A),Ne=(U[0].webkitRelativePath||U[0].name).split("/").filter(Boolean)[0]||"Folder",it=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:it,name:Ne,total:U.length,processed:0,filePaths:[],isUploading:!0}];const gt=at=>{l.value=l.value.map(Ut=>Ut.id===it?at(Ut):Ut)};for(const at of U)try{const Ut=await Eu(at);if(Ut){const on=at.webkitRelativePath||at.name;Wt(Ut,on),gt(Gn=>({...Gn,processed:Gn.processed+1,filePaths:[...Gn.filePaths,Ut]}));continue}gt(on=>({...on,processed:on.processed+1}))}catch{gt(Ut=>({...Ut,processed:Ut.processed+1}))}gt(at=>({...at,isUploading:!1}))}function un(A){A&&(A.value="")}function Fn(A){const U=A.target;qt((U==null?void 0:U.files)??null),un(U),ve.value=!1}function dn(A){const U=A.target;qt((U==null?void 0:U.files)??null),un(U),ve.value=!1}function Bn(A){const U=A.target;Tn((U==null?void 0:U.files)??null),un(U),ve.value=!1}function er(){f.value&&(f.value="");const U=s.value.startsWith("/");U!==ye.value&&(ye.value=U),Oe()}function Un(A){if(ce.value){if(A.key==="Escape"){A.preventDefault(),Me();return}if(A.key==="ArrowDown"){A.preventDefault(),re.value.length>0&&(ne.value=(ne.value+1)%re.value.length);return}if(A.key==="ArrowUp"){if(A.preventDefault(),re.value.length>0){const ie=re.value.length;ne.value=(ne.value+ie-1)%ie}return}if(A.key==="Enter"||A.key==="Tab"){A.preventDefault();const ie=re.value[ne.value];ie?Yt(ie):Me();return}}if(n.sendWithEnter!==!1?A.key==="Enter"&&!A.shiftKey:A.key==="Enter"&&(A.metaKey||A.ctrlKey)){A.preventDefault(),xe(n.isTurnInProgress?W.value:"steer");return}if(ye.value){if(A.key==="Escape"){A.preventDefault(),Nn();return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){A.preventDefault();return}}}function Nn(){var A;ye.value=!1,(A=Te.value)==null||A.focus()}function Me(){ce.value=!1,De.value=null,le.value="",re.value=[],ne.value=0}function Oe(){const A=Te.value;if(!A){Me();return}const U=A.selectionStart??s.value.length,Ne=s.value.slice(0,U).match(/(^|\s)(@[^\s@]*)$/);if(!Ne){Me();return}const it=Ne[2]??"",gt=it.length,at=U-gt;De.value=at,le.value=it.slice(1),ce.value=!0,Sn()}async function Sn(){if(!ce.value)return;const A=(n.cwd??"").trim();if(!A){re.value=[];return}Ye&&clearTimeout(Ye);const U=++Pe;Ye=setTimeout(async()=>{try{const ie=await h0(A,le.value,20);if(!ce.value||U!==Pe)return;re.value=ie,ne.value=0}catch{if(!ce.value||U!==Pe)return;re.value=[]}},120)}function Yt(A){const U=Te.value,ie=De.value;if(ie!==null&&U){const Ne=U.selectionStart??s.value.length;s.value=`${s.value.slice(0,ie)}${s.value.slice(Ne)}`.trimEnd()}Wt(A.path),Me(),tn(()=>U==null?void 0:U.focus())}function zn(A){const U=A.lastIndexOf("/");return U<0?A:A.slice(U+1)}function Hn(A){const U=A.lastIndexOf("/");return U<=0?"":A.slice(0,U)}function mn(A){const U=zn(A),ie=U.lastIndexOf(".");return ie<=0?"":U.slice(ie+1).toLowerCase()}function Ln(A){const U=mn(A);return U==="ts"?"TS":U==="tsx"?"TSX":U==="js"?"JS":U==="jsx"?"JSX":U==="json"?"{}":""}function tr(A){const U=mn(A);return U.startsWith("ts")?"ts":U.startsWith("js")?"js":U==="json"?"json":"default"}function qn(A){const U=mn(A);return U==="md"||U==="mdx"}function Ot(A){var U;i.value.some(ie=>ie.path===A.path)||(i.value=[...i.value,A]),s.value=s.value.startsWith("/")?"":s.value,ye.value=!1,(U=Te.value)==null||U.focus()}function In(A,U){if(U){const ie=(n.skills??[]).find(Ne=>Ne.path===A);ie&&!i.value.some(Ne=>Ne.path===A)&&(i.value=[...i.value,ie])}else i.value=i.value.filter(ie=>ie.path!==A)}function En(A){if(!ve.value)return;const U=ae.value;if(!U)return;const ie=A.target;!ie||U.contains(ie)||(ve.value=!1)}return zr(()=>{document.addEventListener("click",En)}),qr(()=>{document.removeEventListener("click",En),window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",Ke),Ye&&clearTimeout(Ye)}),ft(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],f.value="",ve.value=!1,ye.value=!1,Me()}),ft(()=>n.cwd,()=>{ce.value&&Sn()}),(A,U)=>(y(),k("form",{class:"thread-composer",onSubmit:U[2]||(U[2]=Tt(ie=>xe("steer"),["prevent"]))},[ge.value?(y(),k("p",rT,K(ge.value),1)):fe("",!0),v("div",{class:tt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(y(),k("div",sT,[(y(!0),k(Le,null,vt(o.value,ie=>(y(),k("div",{key:ie.id,class:"thread-composer-attachment"},[v("img",{class:"thread-composer-attachment-image",src:ie.url,alt:ie.name||"Selected image"},null,8,oT),v("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${ie.name||"image"}`,disabled:He.value,onClick:Ne=>mt(ie.id)}," x ",8,iT)]))),128))])):fe("",!0),l.value.length>0?(y(),k("div",aT,[(y(!0),k(Le,null,vt(l.value,ie=>(y(),k("span",{key:ie.id,class:"thread-composer-folder-chip"},[je(Ul,{class:"thread-composer-folder-chip-icon"}),v("span",{class:"thread-composer-folder-chip-name",title:ie.name},K(ie.name),9,lT),v("span",cT,[ie.isUploading?(y(),k(Le,{key:0},[Lo(K($n(ie))+"% uploading ("+K(ie.processed)+"/"+K(ie.total)+") ",1)],64)):(y(),k(Le,{key:1},[Lo(K(ie.filePaths.length)+" file"+K(ie.filePaths.length===1?"":"s"),1)],64))]),v("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${ie.name}`,disabled:He.value,onClick:Ne=>Rt(ie.id)},"×",8,uT)]))),128))])):fe("",!0),ut.value.length>0?(y(),k("div",dT,[(y(!0),k(Le,null,vt(ut.value,ie=>(y(),k("span",{key:ie.fsPath,class:"thread-composer-file-chip"},[je(Ci,{class:"thread-composer-file-chip-icon"}),v("span",{class:"thread-composer-file-chip-name",title:ie.fsPath},K(ie.label),9,fT),v("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${ie.label}`,disabled:He.value,onClick:Ne=>xt(ie.fsPath)},"×",8,hT)]))),128))])):fe("",!0),i.value.length>0?(y(),k("div",pT,[(y(!0),k(Le,null,vt(i.value,ie=>(y(),k("span",{key:ie.path,class:"thread-composer-skill-chip"},[v("span",mT,K(ie.name),1),v("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${ie.name}`,onClick:Ne=>rn(ie.path)},"×",8,gT)]))),128))])):fe("",!0),C.value?(y(),k("div",{key:4,class:"thread-composer-rate-limit",title:z.value,"aria-live":"polite"},[v("span",yT,[v("span",wT,K(C.value),1)]),O.value?(y(),k("span",bT,K(O.value),1)):fe("",!0)],8,vT)):fe("",!0),v("div",_T,[ce.value?(y(),k("div",kT,[re.value.length>0?(y(!0),k(Le,{key:0},vt(re.value,(ie,Ne)=>(y(),k("button",{key:ie.path,class:tt(["thread-composer-file-mention-row",{"is-active":Ne===ne.value}]),type:"button",onMousedown:Tt(it=>Yt(ie),["prevent"])},[Ln(ie.path)?(y(),k("span",{key:0,class:tt(["thread-composer-file-mention-icon-badge",`is-${tr(ie.path)}`])},K(Ln(ie.path)),3)):qn(ie.path)?(y(),k("span",ST,"↓")):(y(),bt(Ci,{key:2,class:"thread-composer-file-mention-icon-file"})),v("span",IT,[v("span",ET,K(zn(ie.path)),1),Hn(ie.path)?(y(),k("span",CT,K(Hn(ie.path)),1)):fe("",!0)])],42,TT))),128)):(y(),k("div",AT,"No matching files"))])):fe("",!0),Br(v("textarea",{ref_key:"inputRef",ref:Te,"onUpdate:modelValue":U[0]||(U[0]=ie=>s.value=ie),class:"thread-composer-input",placeholder:T.value,disabled:He.value,onInput:er,onKeydown:Un,onPaste:sn},null,40,xT),[[Ur,s.value]]),je(nT,{skills:Be.value,visible:ye.value,"anchor-bottom":44,"anchor-left":0,onSelect:Ot,onClose:Nn},null,8,["skills","visible"])]),v("div",{class:tt(["thread-composer-controls",{"thread-composer-controls--recording":_e.value}])},[v("div",{ref_key:"attachMenuRootRef",ref:ae,class:"thread-composer-attach"},[v("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:He.value,onClick:Bt}," + ",8,RT),ve.value?(y(),k("div",PT,[v("button",{class:"thread-composer-attach-item",type:"button",disabled:He.value,onClick:Vt}," Add photos & files ",8,MT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:He.value,onClick:kt}," Add folder ",8,$T),v("button",{class:"thread-composer-attach-item",type:"button",disabled:He.value,onClick:dt}," Take photo ",8,OT)])):fe("",!0)],512),_e.value?fe("",!0):(y(),k(Le,{key:0},[v("button",{class:tt(["thread-composer-plan-toggle",{"is-active":rt.value}]),type:"button","aria-label":rt.value?"Disable plan mode":"Enable plan mode","aria-pressed":rt.value,disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:We},[...U[3]||(U[3]=[v("span",{class:"thread-composer-plan-toggle-label"},"Plan",-1),v("span",{class:"thread-composer-plan-toggle-switch","aria-hidden":"true"},[v("span",{class:"thread-composer-plan-toggle-switch-thumb"})],-1)])],10,NT),je(sl,{class:"thread-composer-control","model-value":e.selectedModel,options:Re.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":ot},null,8,["model-value","options","disabled"]),je(G0,{class:"thread-composer-control",options:Ht.value,"selected-values":ct.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:In},null,8,["options","selected-values","disabled"]),je(sl,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Ue,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":ht},null,8,["model-value","disabled"])],64)),v("div",{class:tt(["thread-composer-actions",{"thread-composer-actions--recording":_e.value}])},[be(u)==="recording"?(y(),k("div",LT,[v("canvas",{ref_key:"dictationWaveformCanvasRef",ref:E,class:"thread-composer-dictation-waveform"},null,512)])):fe("",!0),be(u)==="recording"?(y(),k("span",DT,K(Ce.value),1)):fe("",!0),be(g)&&!e.isTurnInProgress?(y(),k("button",{key:2,class:tt(["thread-composer-mic",{"thread-composer-mic--active":be(u)==="recording","thread-composer-mic--transcribing":be(u)==="transcribing"}]),type:"button","aria-label":he.value,title:he.value,disabled:He.value||be(u)==="transcribing",onClick:_t,onPointerdown:Pt,onPointerup:Ke,onPointercancel:Ke},[be(u)==="recording"?(y(),bt(Cu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):be(u)==="transcribing"?(y(),k("span",FT)):(y(),bt(_0,{key:2,class:"thread-composer-mic-icon"}))],42,jT)):fe("",!0),e.isTurnInProgress?(y(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:ze},[je(Cu,{class:"thread-composer-stop-icon"})],8,BT)):fe("",!0),v("button",{class:tt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&W.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&W.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${W.value}`:"Send",disabled:!pt.value,onClick:U[1]||(U[1]=ie=>xe(e.isTurnInProgress?W.value:"steer"))},[je(Wf,{class:"thread-composer-submit-icon"})],10,UT)],2)],2)],2),v("input",{ref_key:"photoLibraryInputRef",ref:G,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:He.value,onChange:Fn},null,40,HT),v("input",{ref_key:"cameraCaptureInputRef",ref:ee,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:He.value,onChange:dn},null,40,WT),v("input",{ref_key:"folderPickerInputRef",ref:te,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:He.value,onChange:Bn},null,40,VT)],32))}}),Au=yt(zT,[["__scopeId","data-v-dc703024"]]),qT={key:0,class:"queued-messages"},GT={class:"queued-messages-inner"},KT={class:"queued-row-text"},JT={class:"queued-row-actions"},YT=["onClick"],QT=["onClick"],XT=cn({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(y(),k("div",qT,[v("div",GT,[(y(!0),k(Le,null,vt(e.messages,r=>(y(),k("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=v("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),v("span",KT,K(r.text),1),v("div",JT,[v("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,YT),v("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>t.$emit("delete",r.id)},[...n[0]||(n[0]=[v("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})],-1)])],8,QT)])]))),128))])])):fe("",!0)}}),ZT=yt(XT,[["__scopeId","data-v-ea583733"]]),eS={class:"runtime-dropdown-trigger-label"},tS={key:0,class:"runtime-dropdown-menu-wrap"},nS={class:"runtime-dropdown-menu"},rS=["onClick"],sS={class:"runtime-dropdown-option-label"},oS={key:0,class:"runtime-dropdown-option-check"},iS=cn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(!1),i=[{value:"local",label:"Local project",icon:Ul},{value:"worktree",label:"New worktree",icon:pi}],a=de(()=>i.find(u=>u.value===n.modelValue)??i[0]);function l(u){r("update:modelValue",u),o.value=!1}function f(u){if(!o.value)return;const g=s.value;if(!g)return;const _=u.target;_ instanceof Node&&(g.contains(_)||(o.value=!1))}return zr(()=>{window.addEventListener("pointerdown",f)}),qr(()=>{window.removeEventListener("pointerdown",f)}),(u,g)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[v("button",{class:"runtime-dropdown-trigger",type:"button",onClick:g[0]||(g[0]=_=>o.value=!o.value)},[(y(),bt(Ti(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),v("span",eS,K(a.value.label),1),je(Ji,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(y(),k("div",tS,[v("div",nS,[g[1]||(g[1]=v("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(y(),k(Le,null,vt(i,_=>v("button",{key:_.value,class:tt(["runtime-dropdown-option",{"is-selected":e.modelValue===_.value}]),type:"button",onClick:E=>l(_.value)},[(y(),bt(Ti(_.icon),{class:"runtime-dropdown-option-icon"})),v("span",sS,K(_.label),1),e.modelValue===_.value?(y(),k("span",oS,"✓")):fe("",!0)],10,rS)),64))])])):fe("",!0)],512))}}),aS=yt(iS,[["__scopeId","data-v-9c9b71e5"]]),lS={},cS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function uS(e,t){return y(),k("svg",cS,[...t[0]||(t[0]=[v("circle",{cx:"11",cy:"11",r:"8"},null,-1),v("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const ol=yt(lS,[["render",uS]]),dS={class:"skill-card-top"},fS=["src","alt"],hS={key:1,class:"skill-card-avatar-fallback"},pS={class:"skill-card-info"},mS={class:"skill-card-header"},gS={class:"skill-card-name"},vS={key:0,class:"skill-card-badge-disabled"},yS={key:1,class:"skill-card-badge"},wS={class:"skill-card-owner"},bS={key:0,class:"skill-card-desc"},_S={key:1,class:"skill-card-date"},kS=cn({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=de(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),a=Date.now()-s;return a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<2592e6?`${Math.floor(a/864e5)}d ago`:o.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function r(s){const o=s.target;o.style.display="none"}return(s,o)=>(y(),k("button",{class:tt(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[v("div",dS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,fS)):(y(),k("div",hS,K(e.skill.owner.charAt(0)),1)),v("div",pS,[v("div",mS,[v("span",gS,K(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(y(),k("span",vS,"Disabled")):e.skill.installed?(y(),k("span",yS,"Installed")):fe("",!0)]),v("span",wS,K(e.skill.owner),1)])]),e.skill.description?(y(),k("p",bS,K(e.skill.description),1)):fe("",!0),n.value?(y(),k("span",_S,K(n.value),1)):fe("",!0)],2))}}),xu=yt(kS,[["__scopeId","data-v-2a1e8196"]]),TS={class:"sdm-panel"},SS={class:"sdm-header"},IS={class:"sdm-title-area"},ES=["src","alt"],CS={class:"sdm-title-col"},AS={class:"sdm-title-row"},xS={class:"sdm-title"},RS={key:0,class:"sdm-badge-disabled"},PS={class:"sdm-owner"},MS={class:"sdm-body"},$S={key:0,class:"sdm-desc"},OS={key:1,class:"sdm-readme-loading"},NS=["innerHTML"],LS=["href"],DS={class:"sdm-footer"},jS={class:"sdm-footer-actions"},FS=["disabled"],BS=["disabled"],US=["disabled"],HS=cn({__name:"SkillDetailModal",props:{skill:{},visible:{type:Boolean},isInstalling:{type:Boolean},isUninstalling:{type:Boolean}},emits:["close","install","uninstall","toggle-enabled"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(""),i=D(!1),a=de(()=>s.value??n.skill.enabled??!0),l=de(()=>n.isInstalling===!0||n.isUninstalling===!0),f=de(()=>{const $=o.value;if(!$)return"";const Y=$.replace(/^---[\s\S]*?---\s*/,"");return u(Y)});function u($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^# (.+)$/gm,"<h2>$1</h2>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>").replace(/\n{2,}/g,"<br/><br/>").replace(/\n/g,"<br/>")}async function g(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const $=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),Y=await fetch(`/codex-api/skills-hub/readme?${$}`);if(!Y.ok)return;const ae=await Y.json();o.value=ae.content??""}catch{}finally{i.value=!1}}}ft(()=>n.visible,$=>{$&&(s.value=null,o.value="",g())});function _(){r("install",n.skill)}function E(){r("uninstall",n.skill)}function F(){const $=!a.value;s.value=$,r("toggle-enabled",n.skill,$)}return($,Y)=>(y(),bt(To,{to:"body"},[e.visible?(y(),k("div",{key:0,class:"sdm-overlay",onClick:Y[1]||(Y[1]=Tt(ae=>$.$emit("close"),["self"]))},[v("div",TS,[v("div",SS,[v("div",IS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,ES)):fe("",!0),v("div",CS,[v("div",AS,[v("h3",xS,K(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(y(),k("span",RS,"Disabled")):fe("",!0)]),v("span",PS,K(e.skill.owner),1)])]),v("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:Y[0]||(Y[0]=ae=>$.$emit("close"))},[je(Hl,{class:"sdm-close-icon"})])]),v("div",MS,[e.skill.description?(y(),k("p",$S,K(e.skill.description),1)):fe("",!0),i.value?(y(),k("div",OS,"Loading skill contents...")):o.value?(y(),k("div",{key:2,class:"sdm-readme",innerHTML:f.value},null,8,NS)):fe("",!0),v("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,LS)]),v("div",DS,[v("div",jS,[e.skill.installed?(y(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:E},K(n.isUninstalling?"Uninstalling...":"Uninstall"),9,FS)):(y(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:_},K(n.isInstalling?"Installing...":"Install"),9,BS)),e.skill.installed?(y(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:F},K(a.value?"Disable":"Enable"),9,US)):fe("",!0)])])])])):fe("",!0)]))}}),WS=yt(HS,[["__scopeId","data-v-19a385ca"]]),VS=()=>{};var Ru={};/**
67
+ * @license
68
+ * Copyright 2017 Google LLC
69
+ *
70
+ * Licensed under the Apache License, Version 2.0 (the "License");
71
+ * you may not use this file except in compliance with the License.
72
+ * You may obtain a copy of the License at
73
+ *
74
+ * http://www.apache.org/licenses/LICENSE-2.0
75
+ *
76
+ * Unless required by applicable law or agreed to in writing, software
77
+ * distributed under the License is distributed on an "AS IS" BASIS,
78
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
79
+ * See the License for the specific language governing permissions and
80
+ * limitations under the License.
81
+ */const Qf=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128)}return t},zS=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const o=e[n++];t[r++]=String.fromCharCode((s&31)<<6|o&63)}else if(s>239&&s<365){const o=e[n++],i=e[n++],a=e[n++],l=((s&7)<<18|(o&63)<<12|(i&63)<<6|a&63)-65536;t[r++]=String.fromCharCode(55296+(l>>10)),t[r++]=String.fromCharCode(56320+(l&1023))}else{const o=e[n++],i=e[n++];t[r++]=String.fromCharCode((s&15)<<12|(o&63)<<6|i&63)}}return t.join("")},Xf={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<e.length;s+=3){const o=e[s],i=s+1<e.length,a=i?e[s+1]:0,l=s+2<e.length,f=l?e[s+2]:0,u=o>>2,g=(o&3)<<4|a>>4;let _=(a&15)<<2|f>>6,E=f&63;l||(E=64,i||(_=64)),r.push(n[u],n[g],n[_],n[E])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Qf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):zS(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<e.length;){const o=n[e.charAt(s++)],a=s<e.length?n[e.charAt(s)]:0;++s;const f=s<e.length?n[e.charAt(s)]:64;++s;const g=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||f==null||g==null)throw new qS;const _=o<<2|a>>4;if(r.push(_),f!==64){const E=a<<4&240|f>>2;if(r.push(E),g!==64){const F=f<<6&192|g;r.push(F)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class qS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const GS=function(e){const t=Qf(e);return Xf.encodeByteArray(t,!0)},Zf=function(e){return GS(e).replace(/\./g,"")},eh=function(e){try{return Xf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
82
+ * @license
83
+ * Copyright 2022 Google LLC
84
+ *
85
+ * Licensed under the Apache License, Version 2.0 (the "License");
86
+ * you may not use this file except in compliance with the License.
87
+ * You may obtain a copy of the License at
88
+ *
89
+ * http://www.apache.org/licenses/LICENSE-2.0
90
+ *
91
+ * Unless required by applicable law or agreed to in writing, software
92
+ * distributed under the License is distributed on an "AS IS" BASIS,
93
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94
+ * See the License for the specific language governing permissions and
95
+ * limitations under the License.
96
+ */function KS(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
97
+ * @license
98
+ * Copyright 2022 Google LLC
99
+ *
100
+ * Licensed under the Apache License, Version 2.0 (the "License");
101
+ * you may not use this file except in compliance with the License.
102
+ * You may obtain a copy of the License at
103
+ *
104
+ * http://www.apache.org/licenses/LICENSE-2.0
105
+ *
106
+ * Unless required by applicable law or agreed to in writing, software
107
+ * distributed under the License is distributed on an "AS IS" BASIS,
108
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
109
+ * See the License for the specific language governing permissions and
110
+ * limitations under the License.
111
+ */const JS=()=>KS().__FIREBASE_DEFAULTS__,YS=()=>{if(typeof process>"u"||typeof Ru>"u")return;const e=Ru.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},QS=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&eh(e[1]);return t&&JSON.parse(t)},zl=()=>{try{return VS()||JS()||YS()||QS()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},XS=e=>{var t,n;return(n=(t=zl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},th=()=>{var e;return(e=zl())==null?void 0:e.config},nh=e=>{var t;return(t=zl())==null?void 0:t[`_${e}`]};/**
112
+ * @license
113
+ * Copyright 2017 Google LLC
114
+ *
115
+ * Licensed under the Apache License, Version 2.0 (the "License");
116
+ * you may not use this file except in compliance with the License.
117
+ * You may obtain a copy of the License at
118
+ *
119
+ * http://www.apache.org/licenses/LICENSE-2.0
120
+ *
121
+ * Unless required by applicable law or agreed to in writing, software
122
+ * distributed under the License is distributed on an "AS IS" BASIS,
123
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124
+ * See the License for the specific language governing permissions and
125
+ * limitations under the License.
126
+ */class ZS{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,r))}}}/**
127
+ * @license
128
+ * Copyright 2017 Google LLC
129
+ *
130
+ * Licensed under the Apache License, Version 2.0 (the "License");
131
+ * you may not use this file except in compliance with the License.
132
+ * You may obtain a copy of the License at
133
+ *
134
+ * http://www.apache.org/licenses/LICENSE-2.0
135
+ *
136
+ * Unless required by applicable law or agreed to in writing, software
137
+ * distributed under the License is distributed on an "AS IS" BASIS,
138
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139
+ * See the License for the specific language governing permissions and
140
+ * limitations under the License.
141
+ */function Mn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function eI(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Mn())}function tI(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function nI(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function rI(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function sI(){const e=Mn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function oI(){try{return typeof indexedDB=="object"}catch{return!1}}function iI(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var o;t(((o=s.error)==null?void 0:o.message)||"")}}catch(n){t(n)}})}/**
142
+ * @license
143
+ * Copyright 2017 Google LLC
144
+ *
145
+ * Licensed under the Apache License, Version 2.0 (the "License");
146
+ * you may not use this file except in compliance with the License.
147
+ * You may obtain a copy of the License at
148
+ *
149
+ * http://www.apache.org/licenses/LICENSE-2.0
150
+ *
151
+ * Unless required by applicable law or agreed to in writing, software
152
+ * distributed under the License is distributed on an "AS IS" BASIS,
153
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154
+ * See the License for the specific language governing permissions and
155
+ * limitations under the License.
156
+ */const aI="FirebaseError";class hs extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=aI,Object.setPrototypeOf(this,hs.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Go.prototype.create)}}class Go{constructor(t,n,r){this.service=t,this.serviceName=n,this.errors=r}create(t,...n){const r=n[0]||{},s=`${this.service}/${t}`,o=this.errors[t],i=o?lI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new hs(s,a,r)}}function lI(e,t){return e.replace(cI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const cI=/\{\$([^}]+)}/g;function uI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function oo(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const o=e[s],i=t[s];if(Pu(o)&&Pu(i)){if(!oo(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Pu(e){return e!==null&&typeof e=="object"}/**
157
+ * @license
158
+ * Copyright 2017 Google LLC
159
+ *
160
+ * Licensed under the Apache License, Version 2.0 (the "License");
161
+ * you may not use this file except in compliance with the License.
162
+ * You may obtain a copy of the License at
163
+ *
164
+ * http://www.apache.org/licenses/LICENSE-2.0
165
+ *
166
+ * Unless required by applicable law or agreed to in writing, software
167
+ * distributed under the License is distributed on an "AS IS" BASIS,
168
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
169
+ * See the License for the specific language governing permissions and
170
+ * limitations under the License.
171
+ */function Ko(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(s=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function dI(e,t){const n=new fI(e,t);return n.subscribe.bind(n)}class fI{constructor(t,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{t(this)}).catch(r=>{this.error(r)})}next(t){this.forEachObserver(n=>{n.next(t)})}error(t){this.forEachObserver(n=>{n.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,n,r){let s;if(t===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");hI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Sa),s.error===void 0&&(s.error=Sa),s.complete===void 0&&(s.complete=Sa);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),o}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,t)}sendOne(t,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[t]!==void 0)try{n(this.observers[t])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function hI(e,t){if(typeof e!="object"||e===null)return!1;for(const n of t)if(n in e&&typeof e[n]=="function")return!0;return!1}function Sa(){}/**
172
+ * @license
173
+ * Copyright 2021 Google LLC
174
+ *
175
+ * Licensed under the Apache License, Version 2.0 (the "License");
176
+ * you may not use this file except in compliance with the License.
177
+ * You may obtain a copy of the License at
178
+ *
179
+ * http://www.apache.org/licenses/LICENSE-2.0
180
+ *
181
+ * Unless required by applicable law or agreed to in writing, software
182
+ * distributed under the License is distributed on an "AS IS" BASIS,
183
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184
+ * See the License for the specific language governing permissions and
185
+ * limitations under the License.
186
+ */function lo(e){return e&&e._delegate?e._delegate:e}/**
187
+ * @license
188
+ * Copyright 2025 Google LLC
189
+ *
190
+ * Licensed under the Apache License, Version 2.0 (the "License");
191
+ * you may not use this file except in compliance with the License.
192
+ * You may obtain a copy of the License at
193
+ *
194
+ * http://www.apache.org/licenses/LICENSE-2.0
195
+ *
196
+ * Unless required by applicable law or agreed to in writing, software
197
+ * distributed under the License is distributed on an "AS IS" BASIS,
198
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ * See the License for the specific language governing permissions and
200
+ * limitations under the License.
201
+ */function ql(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function pI(e){return(await fetch(e,{credentials:"include"})).ok}class io{constructor(t,n,r){this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
202
+ * @license
203
+ * Copyright 2019 Google LLC
204
+ *
205
+ * Licensed under the Apache License, Version 2.0 (the "License");
206
+ * you may not use this file except in compliance with the License.
207
+ * You may obtain a copy of the License at
208
+ *
209
+ * http://www.apache.org/licenses/LICENSE-2.0
210
+ *
211
+ * Unless required by applicable law or agreed to in writing, software
212
+ * distributed under the License is distributed on an "AS IS" BASIS,
213
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214
+ * See the License for the specific language governing permissions and
215
+ * limitations under the License.
216
+ */const Es="[DEFAULT]";/**
217
+ * @license
218
+ * Copyright 2019 Google LLC
219
+ *
220
+ * Licensed under the Apache License, Version 2.0 (the "License");
221
+ * you may not use this file except in compliance with the License.
222
+ * You may obtain a copy of the License at
223
+ *
224
+ * http://www.apache.org/licenses/LICENSE-2.0
225
+ *
226
+ * Unless required by applicable law or agreed to in writing, software
227
+ * distributed under the License is distributed on an "AS IS" BASIS,
228
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
229
+ * See the License for the specific language governing permissions and
230
+ * limitations under the License.
231
+ */class mI{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const r=new ZS;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(t){const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),r=(t==null?void 0:t.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(vI(t))try{this.getOrInitializeService({instanceIdentifier:Es})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const o=this.getOrInitializeService({instanceIdentifier:s});r.resolve(o)}catch{}}}}clearInstance(t=Es){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...t.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=Es){return this.instances.has(t)}getOptions(t=Es){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,r=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[o,i]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(o);r===a&&i.resolve(s)}return s}onInit(t,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(t),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&t(o,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:gI(t),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch{}return r||null}normalizeInstanceIdentifier(t=Es){return this.component?this.component.multipleInstances?t:Es:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function gI(e){return e===Es?void 0:e}function vI(e){return e.instantiationMode==="EAGER"}/**
232
+ * @license
233
+ * Copyright 2019 Google LLC
234
+ *
235
+ * Licensed under the Apache License, Version 2.0 (the "License");
236
+ * you may not use this file except in compliance with the License.
237
+ * You may obtain a copy of the License at
238
+ *
239
+ * http://www.apache.org/licenses/LICENSE-2.0
240
+ *
241
+ * Unless required by applicable law or agreed to in writing, software
242
+ * distributed under the License is distributed on an "AS IS" BASIS,
243
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
244
+ * See the License for the specific language governing permissions and
245
+ * limitations under the License.
246
+ */class yI{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new mI(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
247
+ * @license
248
+ * Copyright 2017 Google LLC
249
+ *
250
+ * Licensed under the Apache License, Version 2.0 (the "License");
251
+ * you may not use this file except in compliance with the License.
252
+ * You may obtain a copy of the License at
253
+ *
254
+ * http://www.apache.org/licenses/LICENSE-2.0
255
+ *
256
+ * Unless required by applicable law or agreed to in writing, software
257
+ * distributed under the License is distributed on an "AS IS" BASIS,
258
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
259
+ * See the License for the specific language governing permissions and
260
+ * limitations under the License.
261
+ */var Nt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(Nt||(Nt={}));const wI={debug:Nt.DEBUG,verbose:Nt.VERBOSE,info:Nt.INFO,warn:Nt.WARN,error:Nt.ERROR,silent:Nt.SILENT},bI=Nt.INFO,_I={[Nt.DEBUG]:"log",[Nt.VERBOSE]:"log",[Nt.INFO]:"info",[Nt.WARN]:"warn",[Nt.ERROR]:"error"},kI=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=_I[t];if(s)console[s](`[${r}] ${e.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class rh{constructor(t){this.name=t,this._logLevel=bI,this._logHandler=kI,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Nt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?wI[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,Nt.DEBUG,...t),this._logHandler(this,Nt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Nt.VERBOSE,...t),this._logHandler(this,Nt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Nt.INFO,...t),this._logHandler(this,Nt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Nt.WARN,...t),this._logHandler(this,Nt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Nt.ERROR,...t),this._logHandler(this,Nt.ERROR,...t)}}const TI=(e,t)=>t.some(n=>e instanceof n);let Mu,$u;function SI(){return Mu||(Mu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function II(){return $u||($u=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const sh=new WeakMap,il=new WeakMap,oh=new WeakMap,Ia=new WeakMap,Gl=new WeakMap;function EI(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(cs(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&sh.set(n,e)}).catch(()=>{}),Gl.set(t,e),t}function CI(e){if(il.has(e))return;const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{n(),s()},i=()=>{r(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)});il.set(e,t)}let al={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return il.get(e);if(t==="objectStoreNames")return e.objectStoreNames||oh.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return cs(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function AI(e){al=e(al)}function xI(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Ea(this),t,...n);return oh.set(r,t.sort?t.sort():[t]),cs(r)}:II().includes(e)?function(...t){return e.apply(Ea(this),t),cs(sh.get(this))}:function(...t){return cs(e.apply(Ea(this),t))}}function RI(e){return typeof e=="function"?xI(e):(e instanceof IDBTransaction&&CI(e),TI(e,SI())?new Proxy(e,al):e)}function cs(e){if(e instanceof IDBRequest)return EI(e);if(Ia.has(e))return Ia.get(e);const t=RI(e);return t!==e&&(Ia.set(e,t),Gl.set(t,e)),t}const Ea=e=>Gl.get(e);function PI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=cs(i);return r&&i.addEventListener("upgradeneeded",l=>{r(cs(i.result),l.oldVersion,l.newVersion,cs(i.transaction),l)}),n&&i.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),s&&l.addEventListener("versionchange",f=>s(f.oldVersion,f.newVersion,f))}).catch(()=>{}),a}const MI=["get","getKey","getAll","getAllKeys","count"],$I=["put","add","delete","clear"],Ca=new Map;function Ou(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ca.get(t))return Ca.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=$I.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||MI.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let f=l.store;return r&&(f=f.index(a.shift())),(await Promise.all([f[n](...a),s&&l.done]))[0]};return Ca.set(t,o),o}AI(e=>({...e,get:(t,n,r)=>Ou(t,n)||e.get(t,n,r),has:(t,n)=>!!Ou(t,n)||e.has(t,n)}));/**
262
+ * @license
263
+ * Copyright 2019 Google LLC
264
+ *
265
+ * Licensed under the Apache License, Version 2.0 (the "License");
266
+ * you may not use this file except in compliance with the License.
267
+ * You may obtain a copy of the License at
268
+ *
269
+ * http://www.apache.org/licenses/LICENSE-2.0
270
+ *
271
+ * Unless required by applicable law or agreed to in writing, software
272
+ * distributed under the License is distributed on an "AS IS" BASIS,
273
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
274
+ * See the License for the specific language governing permissions and
275
+ * limitations under the License.
276
+ */class OI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(NI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function NI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const ll="@firebase/app",Nu="0.14.10";/**
277
+ * @license
278
+ * Copyright 2019 Google LLC
279
+ *
280
+ * Licensed under the Apache License, Version 2.0 (the "License");
281
+ * you may not use this file except in compliance with the License.
282
+ * You may obtain a copy of the License at
283
+ *
284
+ * http://www.apache.org/licenses/LICENSE-2.0
285
+ *
286
+ * Unless required by applicable law or agreed to in writing, software
287
+ * distributed under the License is distributed on an "AS IS" BASIS,
288
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289
+ * See the License for the specific language governing permissions and
290
+ * limitations under the License.
291
+ */const Hr=new rh("@firebase/app"),LI="@firebase/app-compat",DI="@firebase/analytics-compat",jI="@firebase/analytics",FI="@firebase/app-check-compat",BI="@firebase/app-check",UI="@firebase/auth",HI="@firebase/auth-compat",WI="@firebase/database",VI="@firebase/data-connect",zI="@firebase/database-compat",qI="@firebase/functions",GI="@firebase/functions-compat",KI="@firebase/installations",JI="@firebase/installations-compat",YI="@firebase/messaging",QI="@firebase/messaging-compat",XI="@firebase/performance",ZI="@firebase/performance-compat",eE="@firebase/remote-config",tE="@firebase/remote-config-compat",nE="@firebase/storage",rE="@firebase/storage-compat",sE="@firebase/firestore",oE="@firebase/ai",iE="@firebase/firestore-compat",aE="firebase",lE="12.11.0";/**
292
+ * @license
293
+ * Copyright 2019 Google LLC
294
+ *
295
+ * Licensed under the Apache License, Version 2.0 (the "License");
296
+ * you may not use this file except in compliance with the License.
297
+ * You may obtain a copy of the License at
298
+ *
299
+ * http://www.apache.org/licenses/LICENSE-2.0
300
+ *
301
+ * Unless required by applicable law or agreed to in writing, software
302
+ * distributed under the License is distributed on an "AS IS" BASIS,
303
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304
+ * See the License for the specific language governing permissions and
305
+ * limitations under the License.
306
+ */const cl="[DEFAULT]",cE={[ll]:"fire-core",[LI]:"fire-core-compat",[jI]:"fire-analytics",[DI]:"fire-analytics-compat",[BI]:"fire-app-check",[FI]:"fire-app-check-compat",[UI]:"fire-auth",[HI]:"fire-auth-compat",[WI]:"fire-rtdb",[VI]:"fire-data-connect",[zI]:"fire-rtdb-compat",[qI]:"fire-fn",[GI]:"fire-fn-compat",[KI]:"fire-iid",[JI]:"fire-iid-compat",[YI]:"fire-fcm",[QI]:"fire-fcm-compat",[XI]:"fire-perf",[ZI]:"fire-perf-compat",[eE]:"fire-rc",[tE]:"fire-rc-compat",[nE]:"fire-gcs",[rE]:"fire-gcs-compat",[sE]:"fire-fst",[iE]:"fire-fst-compat",[oE]:"fire-vertex","fire-js":"fire-js",[aE]:"fire-js-all"};/**
307
+ * @license
308
+ * Copyright 2019 Google LLC
309
+ *
310
+ * Licensed under the Apache License, Version 2.0 (the "License");
311
+ * you may not use this file except in compliance with the License.
312
+ * You may obtain a copy of the License at
313
+ *
314
+ * http://www.apache.org/licenses/LICENSE-2.0
315
+ *
316
+ * Unless required by applicable law or agreed to in writing, software
317
+ * distributed under the License is distributed on an "AS IS" BASIS,
318
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
319
+ * See the License for the specific language governing permissions and
320
+ * limitations under the License.
321
+ */const Bo=new Map,uE=new Map,ul=new Map;function Lu(e,t){try{e.container.addComponent(t)}catch(n){Hr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Uo(e){const t=e.name;if(ul.has(t))return Hr.debug(`There were multiple attempts to register component ${t}.`),!1;ul.set(t,e);for(const n of Bo.values())Lu(n,e);for(const n of uE.values())Lu(n,e);return!0}function ih(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function wr(e){return e==null?!1:e.settings!==void 0}/**
322
+ * @license
323
+ * Copyright 2019 Google LLC
324
+ *
325
+ * Licensed under the Apache License, Version 2.0 (the "License");
326
+ * you may not use this file except in compliance with the License.
327
+ * You may obtain a copy of the License at
328
+ *
329
+ * http://www.apache.org/licenses/LICENSE-2.0
330
+ *
331
+ * Unless required by applicable law or agreed to in writing, software
332
+ * distributed under the License is distributed on an "AS IS" BASIS,
333
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334
+ * See the License for the specific language governing permissions and
335
+ * limitations under the License.
336
+ */const dE={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},us=new Go("app","Firebase",dE);/**
337
+ * @license
338
+ * Copyright 2019 Google LLC
339
+ *
340
+ * Licensed under the Apache License, Version 2.0 (the "License");
341
+ * you may not use this file except in compliance with the License.
342
+ * You may obtain a copy of the License at
343
+ *
344
+ * http://www.apache.org/licenses/LICENSE-2.0
345
+ *
346
+ * Unless required by applicable law or agreed to in writing, software
347
+ * distributed under the License is distributed on an "AS IS" BASIS,
348
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
349
+ * See the License for the specific language governing permissions and
350
+ * limitations under the License.
351
+ */class fE{constructor(t,n,r){this._isDeleted=!1,this._options={...t},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new io("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw us.create("app-deleted",{appName:this._name})}}/**
352
+ * @license
353
+ * Copyright 2019 Google LLC
354
+ *
355
+ * Licensed under the Apache License, Version 2.0 (the "License");
356
+ * you may not use this file except in compliance with the License.
357
+ * You may obtain a copy of the License at
358
+ *
359
+ * http://www.apache.org/licenses/LICENSE-2.0
360
+ *
361
+ * Unless required by applicable law or agreed to in writing, software
362
+ * distributed under the License is distributed on an "AS IS" BASIS,
363
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
364
+ * See the License for the specific language governing permissions and
365
+ * limitations under the License.
366
+ */const Jo=lE;function ah(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:cl,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw us.create("bad-app-name",{appName:String(s)});if(n||(n=th()),!n)throw us.create("no-options");const o=Bo.get(s);if(o){if(oo(n,o.options)&&oo(r,o.config))return o;throw us.create("duplicate-app",{appName:s})}const i=new yI(s);for(const l of ul.values())i.addComponent(l);const a=new fE(n,r,i);return Bo.set(s,a),a}function lh(e=cl){const t=Bo.get(e);if(!t&&e===cl&&th())return ah();if(!t)throw us.create("no-app",{appName:e});return t}function hE(){return Array.from(Bo.values())}function Xs(e,t,n){let r=cE[e]??e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const i=[`Unable to register library "${r}" with version "${t}":`];s&&i.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&i.push("and"),o&&i.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Hr.warn(i.join(" "));return}Uo(new io(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
367
+ * @license
368
+ * Copyright 2021 Google LLC
369
+ *
370
+ * Licensed under the Apache License, Version 2.0 (the "License");
371
+ * you may not use this file except in compliance with the License.
372
+ * You may obtain a copy of the License at
373
+ *
374
+ * http://www.apache.org/licenses/LICENSE-2.0
375
+ *
376
+ * Unless required by applicable law or agreed to in writing, software
377
+ * distributed under the License is distributed on an "AS IS" BASIS,
378
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379
+ * See the License for the specific language governing permissions and
380
+ * limitations under the License.
381
+ */const pE="firebase-heartbeat-database",mE=1,Ho="firebase-heartbeat-store";let Aa=null;function ch(){return Aa||(Aa=PI(pE,mE,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Ho)}catch(n){console.warn(n)}}}}).catch(e=>{throw us.create("idb-open",{originalErrorMessage:e.message})})),Aa}async function gE(e){try{const n=(await ch()).transaction(Ho),r=await n.objectStore(Ho).get(uh(e));return await n.done,r}catch(t){if(t instanceof hs)Hr.warn(t.message);else{const n=us.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Hr.warn(n.message)}}}async function Du(e,t){try{const r=(await ch()).transaction(Ho,"readwrite");await r.objectStore(Ho).put(t,uh(e)),await r.done}catch(n){if(n instanceof hs)Hr.warn(n.message);else{const r=us.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Hr.warn(r.message)}}}function uh(e){return`${e.name}!${e.options.appId}`}/**
382
+ * @license
383
+ * Copyright 2021 Google LLC
384
+ *
385
+ * Licensed under the Apache License, Version 2.0 (the "License");
386
+ * you may not use this file except in compliance with the License.
387
+ * You may obtain a copy of the License at
388
+ *
389
+ * http://www.apache.org/licenses/LICENSE-2.0
390
+ *
391
+ * Unless required by applicable law or agreed to in writing, software
392
+ * distributed under the License is distributed on an "AS IS" BASIS,
393
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
394
+ * See the License for the specific language governing permissions and
395
+ * limitations under the License.
396
+ */const vE=1024,yE=30;class wE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new _E(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var t,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=ju();if(((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(i=>i.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:s}),this._heartbeatsCache.heartbeats.length>yE){const i=kE(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Hr.warn(r)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=ju(),{heartbeatsToSend:r,unsentEntries:s}=bE(this._heartbeatsCache.heartbeats),o=Zf(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(n){return Hr.warn(n),""}}}function ju(){return new Date().toISOString().substring(0,10)}function bE(e,t=vE){const n=[];let r=e.slice();for(const s of e){const o=n.find(i=>i.agent===s.agent);if(o){if(o.dates.push(s.date),Fu(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Fu(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class _E{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return oI()?iI().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await gE(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Du(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Du(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Fu(e){return Zf(JSON.stringify({version:2,heartbeats:e})).length}function kE(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}/**
397
+ * @license
398
+ * Copyright 2019 Google LLC
399
+ *
400
+ * Licensed under the Apache License, Version 2.0 (the "License");
401
+ * you may not use this file except in compliance with the License.
402
+ * You may obtain a copy of the License at
403
+ *
404
+ * http://www.apache.org/licenses/LICENSE-2.0
405
+ *
406
+ * Unless required by applicable law or agreed to in writing, software
407
+ * distributed under the License is distributed on an "AS IS" BASIS,
408
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
409
+ * See the License for the specific language governing permissions and
410
+ * limitations under the License.
411
+ */function TE(e){Uo(new io("platform-logger",t=>new OI(t),"PRIVATE")),Uo(new io("heartbeat",t=>new wE(t),"PRIVATE")),Xs(ll,Nu,e),Xs(ll,Nu,"esm2020"),Xs("fire-js","")}TE("");var SE="firebase",IE="12.11.0";/**
412
+ * @license
413
+ * Copyright 2020 Google LLC
414
+ *
415
+ * Licensed under the Apache License, Version 2.0 (the "License");
416
+ * you may not use this file except in compliance with the License.
417
+ * You may obtain a copy of the License at
418
+ *
419
+ * http://www.apache.org/licenses/LICENSE-2.0
420
+ *
421
+ * Unless required by applicable law or agreed to in writing, software
422
+ * distributed under the License is distributed on an "AS IS" BASIS,
423
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
424
+ * See the License for the specific language governing permissions and
425
+ * limitations under the License.
426
+ */Xs(SE,IE,"app");function dh(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const EE=dh,fh=new Go("auth","Firebase",dh());/**
427
+ * @license
428
+ * Copyright 2020 Google LLC
429
+ *
430
+ * Licensed under the Apache License, Version 2.0 (the "License");
431
+ * you may not use this file except in compliance with the License.
432
+ * You may obtain a copy of the License at
433
+ *
434
+ * http://www.apache.org/licenses/LICENSE-2.0
435
+ *
436
+ * Unless required by applicable law or agreed to in writing, software
437
+ * distributed under the License is distributed on an "AS IS" BASIS,
438
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
439
+ * See the License for the specific language governing permissions and
440
+ * limitations under the License.
441
+ */const Ai=new rh("@firebase/auth");function CE(e,...t){Ai.logLevel<=Nt.WARN&&Ai.warn(`Auth (${Jo}): ${e}`,...t)}function mi(e,...t){Ai.logLevel<=Nt.ERROR&&Ai.error(`Auth (${Jo}): ${e}`,...t)}/**
442
+ * @license
443
+ * Copyright 2020 Google LLC
444
+ *
445
+ * Licensed under the Apache License, Version 2.0 (the "License");
446
+ * you may not use this file except in compliance with the License.
447
+ * You may obtain a copy of the License at
448
+ *
449
+ * http://www.apache.org/licenses/LICENSE-2.0
450
+ *
451
+ * Unless required by applicable law or agreed to in writing, software
452
+ * distributed under the License is distributed on an "AS IS" BASIS,
453
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
454
+ * See the License for the specific language governing permissions and
455
+ * limitations under the License.
456
+ */function Sr(e,...t){throw Jl(e,...t)}function or(e,...t){return Jl(e,...t)}function Kl(e,t,n){const r={...EE(),[t]:n};return new Go("auth","Firebase",r).create(t,{appName:e.name})}function $s(e){return Kl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function AE(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Sr(e,"argument-error"),Kl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Jl(e,...t){if(typeof e!="string"){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return fh.create(e,...t)}function et(e,t,...n){if(!e)throw Jl(t,...n)}function Or(e){const t="INTERNAL ASSERTION FAILED: "+e;throw mi(t),new Error(t)}function Wr(e,t){e||Or(t)}/**
457
+ * @license
458
+ * Copyright 2020 Google LLC
459
+ *
460
+ * Licensed under the Apache License, Version 2.0 (the "License");
461
+ * you may not use this file except in compliance with the License.
462
+ * You may obtain a copy of the License at
463
+ *
464
+ * http://www.apache.org/licenses/LICENSE-2.0
465
+ *
466
+ * Unless required by applicable law or agreed to in writing, software
467
+ * distributed under the License is distributed on an "AS IS" BASIS,
468
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
469
+ * See the License for the specific language governing permissions and
470
+ * limitations under the License.
471
+ */function dl(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function xE(){return Bu()==="http:"||Bu()==="https:"}function Bu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
472
+ * @license
473
+ * Copyright 2020 Google LLC
474
+ *
475
+ * Licensed under the Apache License, Version 2.0 (the "License");
476
+ * you may not use this file except in compliance with the License.
477
+ * You may obtain a copy of the License at
478
+ *
479
+ * http://www.apache.org/licenses/LICENSE-2.0
480
+ *
481
+ * Unless required by applicable law or agreed to in writing, software
482
+ * distributed under the License is distributed on an "AS IS" BASIS,
483
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
484
+ * See the License for the specific language governing permissions and
485
+ * limitations under the License.
486
+ */function RE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(xE()||nI()||"connection"in navigator)?navigator.onLine:!0}function PE(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
487
+ * @license
488
+ * Copyright 2020 Google LLC
489
+ *
490
+ * Licensed under the Apache License, Version 2.0 (the "License");
491
+ * you may not use this file except in compliance with the License.
492
+ * You may obtain a copy of the License at
493
+ *
494
+ * http://www.apache.org/licenses/LICENSE-2.0
495
+ *
496
+ * Unless required by applicable law or agreed to in writing, software
497
+ * distributed under the License is distributed on an "AS IS" BASIS,
498
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
499
+ * See the License for the specific language governing permissions and
500
+ * limitations under the License.
501
+ */class Yo{constructor(t,n){this.shortDelay=t,this.longDelay=n,Wr(n>t,"Short delay should be less than long delay!"),this.isMobile=eI()||rI()}get(){return RE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
502
+ * @license
503
+ * Copyright 2020 Google LLC
504
+ *
505
+ * Licensed under the Apache License, Version 2.0 (the "License");
506
+ * you may not use this file except in compliance with the License.
507
+ * You may obtain a copy of the License at
508
+ *
509
+ * http://www.apache.org/licenses/LICENSE-2.0
510
+ *
511
+ * Unless required by applicable law or agreed to in writing, software
512
+ * distributed under the License is distributed on an "AS IS" BASIS,
513
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
514
+ * See the License for the specific language governing permissions and
515
+ * limitations under the License.
516
+ */function Yl(e,t){Wr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
517
+ * @license
518
+ * Copyright 2020 Google LLC
519
+ *
520
+ * Licensed under the Apache License, Version 2.0 (the "License");
521
+ * you may not use this file except in compliance with the License.
522
+ * You may obtain a copy of the License at
523
+ *
524
+ * http://www.apache.org/licenses/LICENSE-2.0
525
+ *
526
+ * Unless required by applicable law or agreed to in writing, software
527
+ * distributed under the License is distributed on an "AS IS" BASIS,
528
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
529
+ * See the License for the specific language governing permissions and
530
+ * limitations under the License.
531
+ */class hh{static initialize(t,n,r){this.fetchImpl=t,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Or("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Or("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Or("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
532
+ * @license
533
+ * Copyright 2020 Google LLC
534
+ *
535
+ * Licensed under the Apache License, Version 2.0 (the "License");
536
+ * you may not use this file except in compliance with the License.
537
+ * You may obtain a copy of the License at
538
+ *
539
+ * http://www.apache.org/licenses/LICENSE-2.0
540
+ *
541
+ * Unless required by applicable law or agreed to in writing, software
542
+ * distributed under the License is distributed on an "AS IS" BASIS,
543
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
544
+ * See the License for the specific language governing permissions and
545
+ * limitations under the License.
546
+ */const ME={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
547
+ * @license
548
+ * Copyright 2020 Google LLC
549
+ *
550
+ * Licensed under the Apache License, Version 2.0 (the "License");
551
+ * you may not use this file except in compliance with the License.
552
+ * You may obtain a copy of the License at
553
+ *
554
+ * http://www.apache.org/licenses/LICENSE-2.0
555
+ *
556
+ * Unless required by applicable law or agreed to in writing, software
557
+ * distributed under the License is distributed on an "AS IS" BASIS,
558
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
559
+ * See the License for the specific language governing permissions and
560
+ * limitations under the License.
561
+ */const $E=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],OE=new Yo(3e4,6e4);function Ql(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function co(e,t,n,r,s={}){return ph(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Ko({key:e.config.apiKey,...i}).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);const f={method:t,headers:l,...o};return tI()||(f.referrerPolicy="no-referrer"),e.emulatorConfig&&ql(e.emulatorConfig.host)&&(f.credentials="include"),hh.fetch()(await mh(e,e.config.apiHost,n,a),f)})}async function ph(e,t,n){e._canInitEmulator=!1;const r={...ME,...t};try{const s=new LE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw si(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const a=o.ok?i.errorMessage:i.error.message,[l,f]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw si(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw si(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw si(e,"user-disabled",i);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw Kl(e,u,f);Sr(e,u)}}catch(s){if(s instanceof hs)throw s;Sr(e,"network-request-failed",{message:String(s)})}}async function NE(e,t,n,r,s={}){const o=await co(e,t,n,r,s);return"mfaPendingCredential"in o&&Sr(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function mh(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Yl(e.config,s):`${e.config.apiScheme}://${s}`;return $E.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class LE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(or(this.auth,"network-request-failed")),OE.get())})}}function si(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=or(e,t,r);return s.customData._tokenResponse=n,s}/**
562
+ * @license
563
+ * Copyright 2020 Google LLC
564
+ *
565
+ * Licensed under the Apache License, Version 2.0 (the "License");
566
+ * you may not use this file except in compliance with the License.
567
+ * You may obtain a copy of the License at
568
+ *
569
+ * http://www.apache.org/licenses/LICENSE-2.0
570
+ *
571
+ * Unless required by applicable law or agreed to in writing, software
572
+ * distributed under the License is distributed on an "AS IS" BASIS,
573
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
574
+ * See the License for the specific language governing permissions and
575
+ * limitations under the License.
576
+ */async function DE(e,t){return co(e,"POST","/v1/accounts:delete",t)}async function xi(e,t){return co(e,"POST","/v1/accounts:lookup",t)}/**
577
+ * @license
578
+ * Copyright 2020 Google LLC
579
+ *
580
+ * Licensed under the Apache License, Version 2.0 (the "License");
581
+ * you may not use this file except in compliance with the License.
582
+ * You may obtain a copy of the License at
583
+ *
584
+ * http://www.apache.org/licenses/LICENSE-2.0
585
+ *
586
+ * Unless required by applicable law or agreed to in writing, software
587
+ * distributed under the License is distributed on an "AS IS" BASIS,
588
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
589
+ * See the License for the specific language governing permissions and
590
+ * limitations under the License.
591
+ */function Ao(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function jE(e,t=!1){const n=lo(e),r=await n.getIdToken(t),s=Xl(r);et(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const o=typeof s.firebase=="object"?s.firebase:void 0,i=o==null?void 0:o.sign_in_provider;return{claims:s,token:r,authTime:Ao(xa(s.auth_time)),issuedAtTime:Ao(xa(s.iat)),expirationTime:Ao(xa(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function xa(e){return Number(e)*1e3}function Xl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return mi("JWT malformed, contained fewer than 3 sections"),null;try{const s=eh(n);return s?JSON.parse(s):(mi("Failed to decode base64 JWT payload"),null)}catch(s){return mi("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Uu(e){const t=Xl(e);return et(t,"internal-error"),et(typeof t.exp<"u","internal-error"),et(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
592
+ * @license
593
+ * Copyright 2020 Google LLC
594
+ *
595
+ * Licensed under the Apache License, Version 2.0 (the "License");
596
+ * you may not use this file except in compliance with the License.
597
+ * You may obtain a copy of the License at
598
+ *
599
+ * http://www.apache.org/licenses/LICENSE-2.0
600
+ *
601
+ * Unless required by applicable law or agreed to in writing, software
602
+ * distributed under the License is distributed on an "AS IS" BASIS,
603
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
604
+ * See the License for the specific language governing permissions and
605
+ * limitations under the License.
606
+ */async function Wo(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof hs&&FE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function FE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
607
+ * @license
608
+ * Copyright 2020 Google LLC
609
+ *
610
+ * Licensed under the Apache License, Version 2.0 (the "License");
611
+ * you may not use this file except in compliance with the License.
612
+ * You may obtain a copy of the License at
613
+ *
614
+ * http://www.apache.org/licenses/LICENSE-2.0
615
+ *
616
+ * Unless required by applicable law or agreed to in writing, software
617
+ * distributed under the License is distributed on an "AS IS" BASIS,
618
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
619
+ * See the License for the specific language governing permissions and
620
+ * limitations under the License.
621
+ */class BE{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){if(t){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(t=!1){if(!this.isRunning)return;const n=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){(t==null?void 0:t.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
622
+ * @license
623
+ * Copyright 2020 Google LLC
624
+ *
625
+ * Licensed under the Apache License, Version 2.0 (the "License");
626
+ * you may not use this file except in compliance with the License.
627
+ * You may obtain a copy of the License at
628
+ *
629
+ * http://www.apache.org/licenses/LICENSE-2.0
630
+ *
631
+ * Unless required by applicable law or agreed to in writing, software
632
+ * distributed under the License is distributed on an "AS IS" BASIS,
633
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
634
+ * See the License for the specific language governing permissions and
635
+ * limitations under the License.
636
+ */class fl{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ao(this.lastLoginAt),this.creationTime=Ao(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
637
+ * @license
638
+ * Copyright 2019 Google LLC
639
+ *
640
+ * Licensed under the Apache License, Version 2.0 (the "License");
641
+ * you may not use this file except in compliance with the License.
642
+ * You may obtain a copy of the License at
643
+ *
644
+ * http://www.apache.org/licenses/LICENSE-2.0
645
+ *
646
+ * Unless required by applicable law or agreed to in writing, software
647
+ * distributed under the License is distributed on an "AS IS" BASIS,
648
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
649
+ * See the License for the specific language governing permissions and
650
+ * limitations under the License.
651
+ */async function Ri(e){var g;const t=e.auth,n=await e.getIdToken(),r=await Wo(e,xi(t,{idToken:n}));et(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(g=s.providerUserInfo)!=null&&g.length?gh(s.providerUserInfo):[],i=HE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),f=a?l:!1,u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new fl(s.createdAt,s.lastLoginAt),isAnonymous:f};Object.assign(e,u)}async function UE(e){const t=lo(e);await Ri(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function HE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function gh(e){return e.map(({providerId:t,...n})=>({providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
652
+ * @license
653
+ * Copyright 2020 Google LLC
654
+ *
655
+ * Licensed under the Apache License, Version 2.0 (the "License");
656
+ * you may not use this file except in compliance with the License.
657
+ * You may obtain a copy of the License at
658
+ *
659
+ * http://www.apache.org/licenses/LICENSE-2.0
660
+ *
661
+ * Unless required by applicable law or agreed to in writing, software
662
+ * distributed under the License is distributed on an "AS IS" BASIS,
663
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
664
+ * See the License for the specific language governing permissions and
665
+ * limitations under the License.
666
+ */async function WE(e,t){const n=await ph(e,{},async()=>{const r=Ko({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await mh(e,s,"/v1/token",`key=${o}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return e.emulatorConfig&&ql(e.emulatorConfig.host)&&(l.credentials="include"),hh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function VE(e,t){return co(e,"POST","/v2/accounts:revokeToken",Ql(e,t))}/**
667
+ * @license
668
+ * Copyright 2020 Google LLC
669
+ *
670
+ * Licensed under the Apache License, Version 2.0 (the "License");
671
+ * you may not use this file except in compliance with the License.
672
+ * You may obtain a copy of the License at
673
+ *
674
+ * http://www.apache.org/licenses/LICENSE-2.0
675
+ *
676
+ * Unless required by applicable law or agreed to in writing, software
677
+ * distributed under the License is distributed on an "AS IS" BASIS,
678
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
679
+ * See the License for the specific language governing permissions and
680
+ * limitations under the License.
681
+ */class Zs{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){et(t.idToken,"internal-error"),et(typeof t.idToken<"u","internal-error"),et(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Uu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){et(t.length!==0,"internal-error");const n=Uu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(et(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(t,n){const{accessToken:r,refreshToken:s,expiresIn:o}=await WE(t,n);this.updateTokensAndExpiration(r,s,Number(o))}updateTokensAndExpiration(t,n,r){this.refreshToken=n||null,this.accessToken=t||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(t,n){const{refreshToken:r,accessToken:s,expirationTime:o}=n,i=new Zs;return r&&(et(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(et(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(et(typeof o=="number","internal-error",{appName:t}),i.expirationTime=o),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Zs,this.toJSON())}_performRefresh(){return Or("not implemented")}}/**
682
+ * @license
683
+ * Copyright 2020 Google LLC
684
+ *
685
+ * Licensed under the Apache License, Version 2.0 (the "License");
686
+ * you may not use this file except in compliance with the License.
687
+ * You may obtain a copy of the License at
688
+ *
689
+ * http://www.apache.org/licenses/LICENSE-2.0
690
+ *
691
+ * Unless required by applicable law or agreed to in writing, software
692
+ * distributed under the License is distributed on an "AS IS" BASIS,
693
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
694
+ * See the License for the specific language governing permissions and
695
+ * limitations under the License.
696
+ */function es(e,t){et(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class nr{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new BE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new fl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await Wo(this,this.stsTokenManager.getToken(this.auth,t));return et(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return jE(this,t)}reload(){return UE(this)}_assign(t){this!==t&&(et(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(n=>({...n})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const n=new nr({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){et(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,n=!1){let r=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),n&&await Ri(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(wr(this.auth.app))return Promise.reject($s(this.auth));const t=await this.getIdToken();return await Wo(this,DE(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>({...t})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,n){const r=n.displayName??void 0,s=n.email??void 0,o=n.phoneNumber??void 0,i=n.photoURL??void 0,a=n.tenantId??void 0,l=n._redirectEventId??void 0,f=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:g,emailVerified:_,isAnonymous:E,providerData:F,stsTokenManager:$}=n;et(g&&$,t,"internal-error");const Y=Zs.fromJSON(this.name,$);et(typeof g=="string",t,"internal-error"),es(r,t.name),es(s,t.name),et(typeof _=="boolean",t,"internal-error"),et(typeof E=="boolean",t,"internal-error"),es(o,t.name),es(i,t.name),es(a,t.name),es(l,t.name),es(f,t.name),es(u,t.name);const ae=new nr({uid:g,auth:t,email:s,emailVerified:_,displayName:r,isAnonymous:E,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:Y,createdAt:f,lastLoginAt:u});return F&&Array.isArray(F)&&(ae.providerData=F.map(G=>({...G}))),l&&(ae._redirectEventId=l),ae}static async _fromIdTokenResponse(t,n,r=!1){const s=new Zs;s.updateFromServerResponse(n);const o=new nr({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Ri(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];et(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?gh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new Zs;a.updateFromIdToken(r);const l=new nr({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new fl(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,f),l}}/**
697
+ * @license
698
+ * Copyright 2020 Google LLC
699
+ *
700
+ * Licensed under the Apache License, Version 2.0 (the "License");
701
+ * you may not use this file except in compliance with the License.
702
+ * You may obtain a copy of the License at
703
+ *
704
+ * http://www.apache.org/licenses/LICENSE-2.0
705
+ *
706
+ * Unless required by applicable law or agreed to in writing, software
707
+ * distributed under the License is distributed on an "AS IS" BASIS,
708
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
709
+ * See the License for the specific language governing permissions and
710
+ * limitations under the License.
711
+ */const Hu=new Map;function Nr(e){Wr(e instanceof Function,"Expected a class definition");let t=Hu.get(e);return t?(Wr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Hu.set(e,t),t)}/**
712
+ * @license
713
+ * Copyright 2019 Google LLC
714
+ *
715
+ * Licensed under the Apache License, Version 2.0 (the "License");
716
+ * you may not use this file except in compliance with the License.
717
+ * You may obtain a copy of the License at
718
+ *
719
+ * http://www.apache.org/licenses/LICENSE-2.0
720
+ *
721
+ * Unless required by applicable law or agreed to in writing, software
722
+ * distributed under the License is distributed on an "AS IS" BASIS,
723
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
724
+ * See the License for the specific language governing permissions and
725
+ * limitations under the License.
726
+ */class vh{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,n){this.storage[t]=n}async _get(t){const n=this.storage[t];return n===void 0?null:n}async _remove(t){delete this.storage[t]}_addListener(t,n){}_removeListener(t,n){}}vh.type="NONE";const Wu=vh;/**
727
+ * @license
728
+ * Copyright 2019 Google LLC
729
+ *
730
+ * Licensed under the Apache License, Version 2.0 (the "License");
731
+ * you may not use this file except in compliance with the License.
732
+ * You may obtain a copy of the License at
733
+ *
734
+ * http://www.apache.org/licenses/LICENSE-2.0
735
+ *
736
+ * Unless required by applicable law or agreed to in writing, software
737
+ * distributed under the License is distributed on an "AS IS" BASIS,
738
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
739
+ * See the License for the specific language governing permissions and
740
+ * limitations under the License.
741
+ */function gi(e,t,n){return`firebase:${e}:${t}:${n}`}class eo{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=gi(this.userKey,s.apiKey,o),this.fullPersistenceKey=gi("persistence",s.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){const n=await xi(this.auth,{idToken:t}).catch(()=>{});return n?nr._fromGetAccountInfoResponse(this.auth,n,t):null}return nr._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=t,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,n,r="authUser"){if(!n.length)return new eo(Nr(Wu),t,r);const s=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let o=s[0]||Nr(Wu);const i=gi(r,t.config.apiKey,t.name);let a=null;for(const f of n)try{const u=await f._get(i);if(u){let g;if(typeof u=="string"){const _=await xi(t,{idToken:u}).catch(()=>{});if(!_)break;g=await nr._fromGetAccountInfoResponse(t,_,u)}else g=nr._fromJSON(t,u);f!==o&&(a=g),o=f;break}}catch{}const l=s.filter(f=>f._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new eo(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async f=>{if(f!==o)try{await f._remove(i)}catch{}})),new eo(o,t,r))}}/**
742
+ * @license
743
+ * Copyright 2020 Google LLC
744
+ *
745
+ * Licensed under the Apache License, Version 2.0 (the "License");
746
+ * you may not use this file except in compliance with the License.
747
+ * You may obtain a copy of the License at
748
+ *
749
+ * http://www.apache.org/licenses/LICENSE-2.0
750
+ *
751
+ * Unless required by applicable law or agreed to in writing, software
752
+ * distributed under the License is distributed on an "AS IS" BASIS,
753
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
754
+ * See the License for the specific language governing permissions and
755
+ * limitations under the License.
756
+ */function Vu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(_h(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(yh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Th(t))return"Blackberry";if(Sh(t))return"Webos";if(wh(t))return"Safari";if((t.includes("chrome/")||bh(t))&&!t.includes("edge/"))return"Chrome";if(kh(t))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function yh(e=Mn()){return/firefox\//i.test(e)}function wh(e=Mn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function bh(e=Mn()){return/crios\//i.test(e)}function _h(e=Mn()){return/iemobile/i.test(e)}function kh(e=Mn()){return/android/i.test(e)}function Th(e=Mn()){return/blackberry/i.test(e)}function Sh(e=Mn()){return/webos/i.test(e)}function Zl(e=Mn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function zE(e=Mn()){var t;return Zl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function qE(){return sI()&&document.documentMode===10}function Ih(e=Mn()){return Zl(e)||kh(e)||Sh(e)||Th(e)||/windows phone/i.test(e)||_h(e)}/**
757
+ * @license
758
+ * Copyright 2020 Google LLC
759
+ *
760
+ * Licensed under the Apache License, Version 2.0 (the "License");
761
+ * you may not use this file except in compliance with the License.
762
+ * You may obtain a copy of the License at
763
+ *
764
+ * http://www.apache.org/licenses/LICENSE-2.0
765
+ *
766
+ * Unless required by applicable law or agreed to in writing, software
767
+ * distributed under the License is distributed on an "AS IS" BASIS,
768
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
769
+ * See the License for the specific language governing permissions and
770
+ * limitations under the License.
771
+ */function Eh(e,t=[]){let n;switch(e){case"Browser":n=Vu(Mn());break;case"Worker":n=`${Vu(Mn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Jo}/${r}`}/**
772
+ * @license
773
+ * Copyright 2022 Google LLC
774
+ *
775
+ * Licensed under the Apache License, Version 2.0 (the "License");
776
+ * you may not use this file except in compliance with the License.
777
+ * You may obtain a copy of the License at
778
+ *
779
+ * http://www.apache.org/licenses/LICENSE-2.0
780
+ *
781
+ * Unless required by applicable law or agreed to in writing, software
782
+ * distributed under the License is distributed on an "AS IS" BASIS,
783
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
784
+ * See the License for the specific language governing permissions and
785
+ * limitations under the License.
786
+ */class GE{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,n){const r=o=>new Promise((i,a)=>{try{const l=t(o);i(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const n=[];try{for(const r of this.queue)await r(t),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
787
+ * @license
788
+ * Copyright 2023 Google LLC
789
+ *
790
+ * Licensed under the Apache License, Version 2.0 (the "License");
791
+ * you may not use this file except in compliance with the License.
792
+ * You may obtain a copy of the License at
793
+ *
794
+ * http://www.apache.org/licenses/LICENSE-2.0
795
+ *
796
+ * Unless required by applicable law or agreed to in writing, software
797
+ * distributed under the License is distributed on an "AS IS" BASIS,
798
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
799
+ * See the License for the specific language governing permissions and
800
+ * limitations under the License.
801
+ */async function KE(e,t={}){return co(e,"GET","/v2/passwordPolicy",Ql(e,t))}/**
802
+ * @license
803
+ * Copyright 2023 Google LLC
804
+ *
805
+ * Licensed under the Apache License, Version 2.0 (the "License");
806
+ * you may not use this file except in compliance with the License.
807
+ * You may obtain a copy of the License at
808
+ *
809
+ * http://www.apache.org/licenses/LICENSE-2.0
810
+ *
811
+ * Unless required by applicable law or agreed to in writing, software
812
+ * distributed under the License is distributed on an "AS IS" BASIS,
813
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814
+ * See the License for the specific language governing permissions and
815
+ * limitations under the License.
816
+ */const JE=6;class YE{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??JE,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=t.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,n),this.validatePasswordCharacterOptions(t,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(t,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=t.length>=r),s&&(n.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<t.length;s++)r=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(t,n,r,s,o){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=o))}}/**
817
+ * @license
818
+ * Copyright 2020 Google LLC
819
+ *
820
+ * Licensed under the Apache License, Version 2.0 (the "License");
821
+ * you may not use this file except in compliance with the License.
822
+ * You may obtain a copy of the License at
823
+ *
824
+ * http://www.apache.org/licenses/LICENSE-2.0
825
+ *
826
+ * Unless required by applicable law or agreed to in writing, software
827
+ * distributed under the License is distributed on an "AS IS" BASIS,
828
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
829
+ * See the License for the specific language governing permissions and
830
+ * limitations under the License.
831
+ */class QE{constructor(t,n,r,s){this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new zu(this),this.idTokenSubscription=new zu(this),this.beforeStateQueue=new GE(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=fh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=Nr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await eo.create(this,t),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((o=this.currentUser)==null?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!t)){if(this.currentUser&&t&&this.currentUser.uid===t.uid){this._currentUser._assign(t),await this.currentUser.getIdToken();return}await this._updateCurrentUser(t,!0)}}async initializeCurrentUserFromIdToken(t){try{const n=await xi(this,{idToken:t}),r=await nr._fromGetAccountInfoResponse(this,n,t);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var o;if(wr(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=(o=this.redirectUser)==null?void 0:o._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(t);(!i||i===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return et(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(t){try{await Ri(t)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=PE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(wr(this.app))return Promise.reject($s(this));const n=t?lo(t):null;return n&&et(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(t,n=!1){if(!this._deleted)return t&&et(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return wr(this.app)?Promise.reject($s(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return wr(this.app)?Promise.reject($s(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Nr(t))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(t)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await KE(this),n=new YE(t);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Go("auth","Firebase",t())}onAuthStateChanged(t,n,r){return this.registerStateListener(this.authStateSubscription,t,n,r)}beforeAuthStateChanged(t,n){return this.beforeStateQueue.pushCallback(t,n)}onIdTokenChanged(t,n,r){return this.registerStateListener(this.idTokenSubscription,t,n,r)}authStateReady(){return new Promise((t,n)=>{if(this.currentUser)t();else{const r=this.onAuthStateChanged(()=>{r(),t()},n)}})}async revokeAccessToken(t){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await VE(this,r)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(t=this._currentUser)==null?void 0:t.toJSON()}}async _setRedirectUser(t,n){const r=await this.getOrInitRedirectPersistenceManager(n);return t===null?r.removeCurrentUser():r.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const n=t&&Nr(t)||this._popupRedirectResolver;et(n,this,"argument-error"),this.redirectPersistenceManager=await eo.create(this,[Nr(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===t?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,n,r,s){if(this._deleted)return()=>{};const o=typeof n=="function"?n:n.next.bind(n);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(et(a,this,"internal-error"),a.then(()=>{i||o(this.currentUser)}),typeof n=="function"){const l=t.addObserver(n,r,s);return()=>{i=!0,l()}}else{const l=t.addObserver(n);return()=>{i=!0,l()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return et(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Eh(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var n;if(wr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return t!=null&&t.error&&CE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Yi(e){return lo(e)}class zu{constructor(t){this.auth=t,this.observer=null,this.addObserver=dI(n=>this.observer=n)}get next(){return et(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
832
+ * @license
833
+ * Copyright 2020 Google LLC
834
+ *
835
+ * Licensed under the Apache License, Version 2.0 (the "License");
836
+ * you may not use this file except in compliance with the License.
837
+ * You may obtain a copy of the License at
838
+ *
839
+ * http://www.apache.org/licenses/LICENSE-2.0
840
+ *
841
+ * Unless required by applicable law or agreed to in writing, software
842
+ * distributed under the License is distributed on an "AS IS" BASIS,
843
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
844
+ * See the License for the specific language governing permissions and
845
+ * limitations under the License.
846
+ */let ec={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function XE(e){ec=e}function ZE(e){return ec.loadJS(e)}function eC(){return ec.gapiScript}function tC(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
847
+ * @license
848
+ * Copyright 2020 Google LLC
849
+ *
850
+ * Licensed under the Apache License, Version 2.0 (the "License");
851
+ * you may not use this file except in compliance with the License.
852
+ * You may obtain a copy of the License at
853
+ *
854
+ * http://www.apache.org/licenses/LICENSE-2.0
855
+ *
856
+ * Unless required by applicable law or agreed to in writing, software
857
+ * distributed under the License is distributed on an "AS IS" BASIS,
858
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
859
+ * See the License for the specific language governing permissions and
860
+ * limitations under the License.
861
+ */function nC(e,t){const n=ih(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(oo(o,t??{}))return s;Sr(s,"already-initialized")}return n.initialize({options:t})}function rC(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Nr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function sC(e,t,n){const r=Yi(e);et(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Ch(t),{host:i,port:a}=oC(t),l=a===null?"":`:${a}`,f={url:`${o}//${i}${l}/`},u=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){et(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),et(oo(f,r.config.emulator)&&oo(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,ql(i)?pI(`${o}//${i}${l}`):iC()}function Ch(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function oC(e){const t=Ch(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const o=s[1];return{host:o,port:qu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:qu(i)}}}function qu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function iC(){function e(){const t=document.createElement("p"),n=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",e):e())}/**
862
+ * @license
863
+ * Copyright 2020 Google LLC
864
+ *
865
+ * Licensed under the Apache License, Version 2.0 (the "License");
866
+ * you may not use this file except in compliance with the License.
867
+ * You may obtain a copy of the License at
868
+ *
869
+ * http://www.apache.org/licenses/LICENSE-2.0
870
+ *
871
+ * Unless required by applicable law or agreed to in writing, software
872
+ * distributed under the License is distributed on an "AS IS" BASIS,
873
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
874
+ * See the License for the specific language governing permissions and
875
+ * limitations under the License.
876
+ */class Ah{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Or("not implemented")}_getIdTokenResponse(t){return Or("not implemented")}_linkToIdToken(t,n){return Or("not implemented")}_getReauthenticationResolver(t){return Or("not implemented")}}/**
877
+ * @license
878
+ * Copyright 2020 Google LLC
879
+ *
880
+ * Licensed under the Apache License, Version 2.0 (the "License");
881
+ * you may not use this file except in compliance with the License.
882
+ * You may obtain a copy of the License at
883
+ *
884
+ * http://www.apache.org/licenses/LICENSE-2.0
885
+ *
886
+ * Unless required by applicable law or agreed to in writing, software
887
+ * distributed under the License is distributed on an "AS IS" BASIS,
888
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
889
+ * See the License for the specific language governing permissions and
890
+ * limitations under the License.
891
+ */async function to(e,t){return NE(e,"POST","/v1/accounts:signInWithIdp",Ql(e,t))}/**
892
+ * @license
893
+ * Copyright 2020 Google LLC
894
+ *
895
+ * Licensed under the Apache License, Version 2.0 (the "License");
896
+ * you may not use this file except in compliance with the License.
897
+ * You may obtain a copy of the License at
898
+ *
899
+ * http://www.apache.org/licenses/LICENSE-2.0
900
+ *
901
+ * Unless required by applicable law or agreed to in writing, software
902
+ * distributed under the License is distributed on an "AS IS" BASIS,
903
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
904
+ * See the License for the specific language governing permissions and
905
+ * limitations under the License.
906
+ */const aC="http://localhost";class Os extends Ah{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Os(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):Sr("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const n=typeof t=="string"?JSON.parse(t):t,{providerId:r,signInMethod:s,...o}=n;if(!r||!s)return null;const i=new Os(r,s);return i.idToken=o.idToken||void 0,i.accessToken=o.accessToken||void 0,i.secret=o.secret,i.nonce=o.nonce,i.pendingToken=o.pendingToken||null,i}_getIdTokenResponse(t){const n=this.buildRequest();return to(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,to(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,to(t,n)}buildRequest(){const t={requestUri:aC,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),t.postBody=Ko(n)}return t}}/**
907
+ * @license
908
+ * Copyright 2020 Google LLC
909
+ *
910
+ * Licensed under the Apache License, Version 2.0 (the "License");
911
+ * you may not use this file except in compliance with the License.
912
+ * You may obtain a copy of the License at
913
+ *
914
+ * http://www.apache.org/licenses/LICENSE-2.0
915
+ *
916
+ * Unless required by applicable law or agreed to in writing, software
917
+ * distributed under the License is distributed on an "AS IS" BASIS,
918
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
919
+ * See the License for the specific language governing permissions and
920
+ * limitations under the License.
921
+ */class tc{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}/**
922
+ * @license
923
+ * Copyright 2019 Google LLC
924
+ *
925
+ * Licensed under the Apache License, Version 2.0 (the "License");
926
+ * you may not use this file except in compliance with the License.
927
+ * You may obtain a copy of the License at
928
+ *
929
+ * http://www.apache.org/licenses/LICENSE-2.0
930
+ *
931
+ * Unless required by applicable law or agreed to in writing, software
932
+ * distributed under the License is distributed on an "AS IS" BASIS,
933
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
934
+ * See the License for the specific language governing permissions and
935
+ * limitations under the License.
936
+ */class Qo extends tc{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
937
+ * @license
938
+ * Copyright 2020 Google LLC
939
+ *
940
+ * Licensed under the Apache License, Version 2.0 (the "License");
941
+ * you may not use this file except in compliance with the License.
942
+ * You may obtain a copy of the License at
943
+ *
944
+ * http://www.apache.org/licenses/LICENSE-2.0
945
+ *
946
+ * Unless required by applicable law or agreed to in writing, software
947
+ * distributed under the License is distributed on an "AS IS" BASIS,
948
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
949
+ * See the License for the specific language governing permissions and
950
+ * limitations under the License.
951
+ */class os extends Qo{constructor(){super("facebook.com")}static credential(t){return Os._fromParams({providerId:os.PROVIDER_ID,signInMethod:os.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return os.credentialFromTaggedObject(t)}static credentialFromError(t){return os.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return os.credential(t.oauthAccessToken)}catch{return null}}}os.FACEBOOK_SIGN_IN_METHOD="facebook.com";os.PROVIDER_ID="facebook.com";/**
952
+ * @license
953
+ * Copyright 2020 Google LLC
954
+ *
955
+ * Licensed under the Apache License, Version 2.0 (the "License");
956
+ * you may not use this file except in compliance with the License.
957
+ * You may obtain a copy of the License at
958
+ *
959
+ * http://www.apache.org/licenses/LICENSE-2.0
960
+ *
961
+ * Unless required by applicable law or agreed to in writing, software
962
+ * distributed under the License is distributed on an "AS IS" BASIS,
963
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
964
+ * See the License for the specific language governing permissions and
965
+ * limitations under the License.
966
+ */class is extends Qo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Os._fromParams({providerId:is.PROVIDER_ID,signInMethod:is.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return is.credentialFromTaggedObject(t)}static credentialFromError(t){return is.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return is.credential(n,r)}catch{return null}}}is.GOOGLE_SIGN_IN_METHOD="google.com";is.PROVIDER_ID="google.com";/**
967
+ * @license
968
+ * Copyright 2020 Google LLC
969
+ *
970
+ * Licensed under the Apache License, Version 2.0 (the "License");
971
+ * you may not use this file except in compliance with the License.
972
+ * You may obtain a copy of the License at
973
+ *
974
+ * http://www.apache.org/licenses/LICENSE-2.0
975
+ *
976
+ * Unless required by applicable law or agreed to in writing, software
977
+ * distributed under the License is distributed on an "AS IS" BASIS,
978
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
979
+ * See the License for the specific language governing permissions and
980
+ * limitations under the License.
981
+ */class br extends Qo{constructor(){super("github.com")}static credential(t){return Os._fromParams({providerId:br.PROVIDER_ID,signInMethod:br.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return br.credentialFromTaggedObject(t)}static credentialFromError(t){return br.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return br.credential(t.oauthAccessToken)}catch{return null}}}br.GITHUB_SIGN_IN_METHOD="github.com";br.PROVIDER_ID="github.com";/**
982
+ * @license
983
+ * Copyright 2020 Google LLC
984
+ *
985
+ * Licensed under the Apache License, Version 2.0 (the "License");
986
+ * you may not use this file except in compliance with the License.
987
+ * You may obtain a copy of the License at
988
+ *
989
+ * http://www.apache.org/licenses/LICENSE-2.0
990
+ *
991
+ * Unless required by applicable law or agreed to in writing, software
992
+ * distributed under the License is distributed on an "AS IS" BASIS,
993
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
994
+ * See the License for the specific language governing permissions and
995
+ * limitations under the License.
996
+ */class as extends Qo{constructor(){super("twitter.com")}static credential(t,n){return Os._fromParams({providerId:as.PROVIDER_ID,signInMethod:as.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return as.credentialFromTaggedObject(t)}static credentialFromError(t){return as.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return as.credential(n,r)}catch{return null}}}as.TWITTER_SIGN_IN_METHOD="twitter.com";as.PROVIDER_ID="twitter.com";/**
997
+ * @license
998
+ * Copyright 2020 Google LLC
999
+ *
1000
+ * Licensed under the Apache License, Version 2.0 (the "License");
1001
+ * you may not use this file except in compliance with the License.
1002
+ * You may obtain a copy of the License at
1003
+ *
1004
+ * http://www.apache.org/licenses/LICENSE-2.0
1005
+ *
1006
+ * Unless required by applicable law or agreed to in writing, software
1007
+ * distributed under the License is distributed on an "AS IS" BASIS,
1008
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1009
+ * See the License for the specific language governing permissions and
1010
+ * limitations under the License.
1011
+ */class ao{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,n,r,s=!1){const o=await nr._fromIdTokenResponse(t,r,s),i=Gu(r);return new ao({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Gu(r);return new ao({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Gu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
1012
+ * @license
1013
+ * Copyright 2020 Google LLC
1014
+ *
1015
+ * Licensed under the Apache License, Version 2.0 (the "License");
1016
+ * you may not use this file except in compliance with the License.
1017
+ * You may obtain a copy of the License at
1018
+ *
1019
+ * http://www.apache.org/licenses/LICENSE-2.0
1020
+ *
1021
+ * Unless required by applicable law or agreed to in writing, software
1022
+ * distributed under the License is distributed on an "AS IS" BASIS,
1023
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1024
+ * See the License for the specific language governing permissions and
1025
+ * limitations under the License.
1026
+ */class Pi extends hs{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Pi.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(t,n,r,s){return new Pi(t,n,r,s)}}function xh(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Pi._fromErrorAndOperation(e,o,t,r):o})}async function lC(e,t,n=!1){const r=await Wo(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ao._forOperation(e,"link",r)}/**
1027
+ * @license
1028
+ * Copyright 2019 Google LLC
1029
+ *
1030
+ * Licensed under the Apache License, Version 2.0 (the "License");
1031
+ * you may not use this file except in compliance with the License.
1032
+ * You may obtain a copy of the License at
1033
+ *
1034
+ * http://www.apache.org/licenses/LICENSE-2.0
1035
+ *
1036
+ * Unless required by applicable law or agreed to in writing, software
1037
+ * distributed under the License is distributed on an "AS IS" BASIS,
1038
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1039
+ * See the License for the specific language governing permissions and
1040
+ * limitations under the License.
1041
+ */async function cC(e,t,n=!1){const{auth:r}=e;if(wr(r.app))return Promise.reject($s(r));const s="reauthenticate";try{const o=await Wo(e,xh(r,s,t,e),n);et(o.idToken,r,"internal-error");const i=Xl(o.idToken);et(i,r,"internal-error");const{sub:a}=i;return et(e.uid===a,r,"user-mismatch"),ao._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Sr(r,"user-mismatch"),o}}/**
1042
+ * @license
1043
+ * Copyright 2020 Google LLC
1044
+ *
1045
+ * Licensed under the Apache License, Version 2.0 (the "License");
1046
+ * you may not use this file except in compliance with the License.
1047
+ * You may obtain a copy of the License at
1048
+ *
1049
+ * http://www.apache.org/licenses/LICENSE-2.0
1050
+ *
1051
+ * Unless required by applicable law or agreed to in writing, software
1052
+ * distributed under the License is distributed on an "AS IS" BASIS,
1053
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1054
+ * See the License for the specific language governing permissions and
1055
+ * limitations under the License.
1056
+ */async function uC(e,t,n=!1){if(wr(e.app))return Promise.reject($s(e));const r="signIn",s=await xh(e,r,t),o=await ao._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function dC(e,t,n,r){return lo(e).onIdTokenChanged(t,n,r)}function fC(e,t,n){return lo(e).beforeAuthStateChanged(t,n)}const Mi="__sak";/**
1057
+ * @license
1058
+ * Copyright 2019 Google LLC
1059
+ *
1060
+ * Licensed under the Apache License, Version 2.0 (the "License");
1061
+ * you may not use this file except in compliance with the License.
1062
+ * You may obtain a copy of the License at
1063
+ *
1064
+ * http://www.apache.org/licenses/LICENSE-2.0
1065
+ *
1066
+ * Unless required by applicable law or agreed to in writing, software
1067
+ * distributed under the License is distributed on an "AS IS" BASIS,
1068
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1069
+ * See the License for the specific language governing permissions and
1070
+ * limitations under the License.
1071
+ */class Rh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Mi,"1"),this.storage.removeItem(Mi),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,n){return this.storage.setItem(t,JSON.stringify(n)),Promise.resolve()}_get(t){const n=this.storage.getItem(t);return Promise.resolve(n?JSON.parse(n):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
1072
+ * @license
1073
+ * Copyright 2020 Google LLC
1074
+ *
1075
+ * Licensed under the Apache License, Version 2.0 (the "License");
1076
+ * you may not use this file except in compliance with the License.
1077
+ * You may obtain a copy of the License at
1078
+ *
1079
+ * http://www.apache.org/licenses/LICENSE-2.0
1080
+ *
1081
+ * Unless required by applicable law or agreed to in writing, software
1082
+ * distributed under the License is distributed on an "AS IS" BASIS,
1083
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1084
+ * See the License for the specific language governing permissions and
1085
+ * limitations under the License.
1086
+ */const hC=1e3,pC=10;class Ph extends Rh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ih(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&t(n,s,r)}}onStorageEvent(t,n=!1){if(!t.key){this.forAllChangedKeys((i,a,l)=>{this.notifyListeners(i,l)});return}const r=t.key;n?this.detachListener():this.stopPolling();const s=()=>{const i=this.storage.getItem(r);!n&&this.localCache[r]===i||this.notifyListeners(r,i)},o=this.storage.getItem(r);qE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,pC):s()}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)})},hC)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(t,n){await super._set(t,n),this.localCache[t]=JSON.stringify(n)}async _get(t){const n=await super._get(t);return this.localCache[t]=JSON.stringify(n),n}async _remove(t){await super._remove(t),delete this.localCache[t]}}Ph.type="LOCAL";const mC=Ph;/**
1087
+ * @license
1088
+ * Copyright 2020 Google LLC
1089
+ *
1090
+ * Licensed under the Apache License, Version 2.0 (the "License");
1091
+ * you may not use this file except in compliance with the License.
1092
+ * You may obtain a copy of the License at
1093
+ *
1094
+ * http://www.apache.org/licenses/LICENSE-2.0
1095
+ *
1096
+ * Unless required by applicable law or agreed to in writing, software
1097
+ * distributed under the License is distributed on an "AS IS" BASIS,
1098
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1099
+ * See the License for the specific language governing permissions and
1100
+ * limitations under the License.
1101
+ */class Mh extends Rh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Mh.type="SESSION";const $h=Mh;/**
1102
+ * @license
1103
+ * Copyright 2019 Google LLC
1104
+ *
1105
+ * Licensed under the Apache License, Version 2.0 (the "License");
1106
+ * you may not use this file except in compliance with the License.
1107
+ * You may obtain a copy of the License at
1108
+ *
1109
+ * http://www.apache.org/licenses/LICENSE-2.0
1110
+ *
1111
+ * Unless required by applicable law or agreed to in writing, software
1112
+ * distributed under the License is distributed on an "AS IS" BASIS,
1113
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1114
+ * See the License for the specific language governing permissions and
1115
+ * limitations under the License.
1116
+ */function gC(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1117
+ * @license
1118
+ * Copyright 2019 Google LLC
1119
+ *
1120
+ * Licensed under the Apache License, Version 2.0 (the "License");
1121
+ * you may not use this file except in compliance with the License.
1122
+ * You may obtain a copy of the License at
1123
+ *
1124
+ * http://www.apache.org/licenses/LICENSE-2.0
1125
+ *
1126
+ * Unless required by applicable law or agreed to in writing, software
1127
+ * distributed under the License is distributed on an "AS IS" BASIS,
1128
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1129
+ * See the License for the specific language governing permissions and
1130
+ * limitations under the License.
1131
+ */class Qi{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const n=this.receivers.find(s=>s.isListeningto(t));if(n)return n;const r=new Qi(t);return this.receivers.push(r),r}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const n=t,{eventId:r,eventType:s,data:o}=n.data,i=this.handlersMap[s];if(!(i!=null&&i.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(i).map(async f=>f(n.origin,o)),l=await gC(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(t,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(n)}_unsubscribe(t,n){this.handlersMap[t]&&n&&this.handlersMap[t].delete(n),(!n||this.handlersMap[t].size===0)&&delete this.handlersMap[t],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Qi.receivers=[];/**
1132
+ * @license
1133
+ * Copyright 2020 Google LLC
1134
+ *
1135
+ * Licensed under the Apache License, Version 2.0 (the "License");
1136
+ * you may not use this file except in compliance with the License.
1137
+ * You may obtain a copy of the License at
1138
+ *
1139
+ * http://www.apache.org/licenses/LICENSE-2.0
1140
+ *
1141
+ * Unless required by applicable law or agreed to in writing, software
1142
+ * distributed under the License is distributed on an "AS IS" BASIS,
1143
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1144
+ * See the License for the specific language governing permissions and
1145
+ * limitations under the License.
1146
+ */function nc(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1147
+ * @license
1148
+ * Copyright 2019 Google LLC
1149
+ *
1150
+ * Licensed under the Apache License, Version 2.0 (the "License");
1151
+ * you may not use this file except in compliance with the License.
1152
+ * You may obtain a copy of the License at
1153
+ *
1154
+ * http://www.apache.org/licenses/LICENSE-2.0
1155
+ *
1156
+ * Unless required by applicable law or agreed to in writing, software
1157
+ * distributed under the License is distributed on an "AS IS" BASIS,
1158
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1159
+ * See the License for the specific language governing permissions and
1160
+ * limitations under the License.
1161
+ */class vC{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let o,i;return new Promise((a,l)=>{const f=nc("",20);s.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(g){const _=g;if(_.data.eventId===f)switch(_.data.status){case"ack":clearTimeout(u),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(_.data.response);break;default:clearTimeout(u),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:f,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1162
+ * @license
1163
+ * Copyright 2020 Google LLC
1164
+ *
1165
+ * Licensed under the Apache License, Version 2.0 (the "License");
1166
+ * you may not use this file except in compliance with the License.
1167
+ * You may obtain a copy of the License at
1168
+ *
1169
+ * http://www.apache.org/licenses/LICENSE-2.0
1170
+ *
1171
+ * Unless required by applicable law or agreed to in writing, software
1172
+ * distributed under the License is distributed on an "AS IS" BASIS,
1173
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1174
+ * See the License for the specific language governing permissions and
1175
+ * limitations under the License.
1176
+ */function Tr(){return window}function yC(e){Tr().location.href=e}/**
1177
+ * @license
1178
+ * Copyright 2020 Google LLC.
1179
+ *
1180
+ * Licensed under the Apache License, Version 2.0 (the "License");
1181
+ * you may not use this file except in compliance with the License.
1182
+ * You may obtain a copy of the License at
1183
+ *
1184
+ * http://www.apache.org/licenses/LICENSE-2.0
1185
+ *
1186
+ * Unless required by applicable law or agreed to in writing, software
1187
+ * distributed under the License is distributed on an "AS IS" BASIS,
1188
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1189
+ * See the License for the specific language governing permissions and
1190
+ * limitations under the License.
1191
+ */function Oh(){return typeof Tr().WorkerGlobalScope<"u"&&typeof Tr().importScripts=="function"}async function wC(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function bC(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function _C(){return Oh()?self:null}/**
1192
+ * @license
1193
+ * Copyright 2019 Google LLC
1194
+ *
1195
+ * Licensed under the Apache License, Version 2.0 (the "License");
1196
+ * you may not use this file except in compliance with the License.
1197
+ * You may obtain a copy of the License at
1198
+ *
1199
+ * http://www.apache.org/licenses/LICENSE-2.0
1200
+ *
1201
+ * Unless required by applicable law or agreed to in writing, software
1202
+ * distributed under the License is distributed on an "AS IS" BASIS,
1203
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1204
+ * See the License for the specific language governing permissions and
1205
+ * limitations under the License.
1206
+ */const Nh="firebaseLocalStorageDb",kC=1,$i="firebaseLocalStorage",Lh="fbase_key";class Xo{constructor(t){this.request=t}toPromise(){return new Promise((t,n)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Xi(e,t){return e.transaction([$i],t?"readwrite":"readonly").objectStore($i)}function TC(){const e=indexedDB.deleteDatabase(Nh);return new Xo(e).toPromise()}function hl(){const e=indexedDB.open(Nh,kC);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore($i,{keyPath:Lh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains($i)?t(r):(r.close(),await TC(),t(await hl()))})})}async function Ku(e,t,n){const r=Xi(e,!0).put({[Lh]:t,value:n});return new Xo(r).toPromise()}async function SC(e,t){const n=Xi(e,!1).get(t),r=await new Xo(n).toPromise();return r===void 0?null:r.value}function Ju(e,t){const n=Xi(e,!0).delete(t);return new Xo(n).toPromise()}const IC=800,EC=3;class Dh{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await hl(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>EC)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Oh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Qi._getInstance(_C()),this.receiver._subscribe("keyChanged",async(t,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(t,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await wC(),!this.activeServiceWorker)return;this.sender=new vC(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&(n=t[0])!=null&&n.fulfilled&&(r=t[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(!(!this.sender||!this.activeServiceWorker||bC()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await hl();return await Ku(t,Mi,"1"),await Ju(t,Mi),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Ku(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>SC(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ju(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Xi(s,!1).getAll();return new Xo(o).toPromise()});if(!t)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(t.length!==0)for(const{fbase_key:s,value:o}of t)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(o)&&(this.notifyListeners(s,o),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),IC)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&this.stopPolling()}}Dh.type="LOCAL";const CC=Dh;new Yo(3e4,6e4);/**
1207
+ * @license
1208
+ * Copyright 2021 Google LLC
1209
+ *
1210
+ * Licensed under the Apache License, Version 2.0 (the "License");
1211
+ * you may not use this file except in compliance with the License.
1212
+ * You may obtain a copy of the License at
1213
+ *
1214
+ * http://www.apache.org/licenses/LICENSE-2.0
1215
+ *
1216
+ * Unless required by applicable law or agreed to in writing, software
1217
+ * distributed under the License is distributed on an "AS IS" BASIS,
1218
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1219
+ * See the License for the specific language governing permissions and
1220
+ * limitations under the License.
1221
+ */function jh(e,t){return t?Nr(t):(et(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1222
+ * @license
1223
+ * Copyright 2019 Google LLC
1224
+ *
1225
+ * Licensed under the Apache License, Version 2.0 (the "License");
1226
+ * you may not use this file except in compliance with the License.
1227
+ * You may obtain a copy of the License at
1228
+ *
1229
+ * http://www.apache.org/licenses/LICENSE-2.0
1230
+ *
1231
+ * Unless required by applicable law or agreed to in writing, software
1232
+ * distributed under the License is distributed on an "AS IS" BASIS,
1233
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1234
+ * See the License for the specific language governing permissions and
1235
+ * limitations under the License.
1236
+ */class rc extends Ah{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return to(t,this._buildIdpRequest())}_linkToIdToken(t,n){return to(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return to(t,this._buildIdpRequest())}_buildIdpRequest(t){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(n.idToken=t),n}}function AC(e){return uC(e.auth,new rc(e),e.bypassAuthState)}function xC(e){const{auth:t,user:n}=e;return et(n,t,"internal-error"),cC(n,new rc(e),e.bypassAuthState)}async function RC(e){const{auth:t,user:n}=e;return et(n,t,"internal-error"),lC(n,new rc(e),e.bypassAuthState)}/**
1237
+ * @license
1238
+ * Copyright 2020 Google LLC
1239
+ *
1240
+ * Licensed under the Apache License, Version 2.0 (the "License");
1241
+ * you may not use this file except in compliance with the License.
1242
+ * You may obtain a copy of the License at
1243
+ *
1244
+ * http://www.apache.org/licenses/LICENSE-2.0
1245
+ *
1246
+ * Unless required by applicable law or agreed to in writing, software
1247
+ * distributed under the License is distributed on an "AS IS" BASIS,
1248
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1249
+ * See the License for the specific language governing permissions and
1250
+ * limitations under the License.
1251
+ */class Fh{constructor(t,n,r,s,o=!1){this.auth=t,this.resolver=r,this.user=s,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(t,n)=>{this.pendingPromise={resolve:t,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(t){const{urlResponse:n,sessionId:r,postBody:s,tenantId:o,error:i,type:a}=t;if(i){this.reject(i);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:o||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(f){this.reject(f)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return AC;case"linkViaPopup":case"linkViaRedirect":return RC;case"reauthViaPopup":case"reauthViaRedirect":return xC;default:Sr(this.auth,"internal-error")}}resolve(t){Wr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Wr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
1252
+ * @license
1253
+ * Copyright 2020 Google LLC
1254
+ *
1255
+ * Licensed under the Apache License, Version 2.0 (the "License");
1256
+ * you may not use this file except in compliance with the License.
1257
+ * You may obtain a copy of the License at
1258
+ *
1259
+ * http://www.apache.org/licenses/LICENSE-2.0
1260
+ *
1261
+ * Unless required by applicable law or agreed to in writing, software
1262
+ * distributed under the License is distributed on an "AS IS" BASIS,
1263
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1264
+ * See the License for the specific language governing permissions and
1265
+ * limitations under the License.
1266
+ */const PC=new Yo(2e3,1e4);async function MC(e,t,n){if(wr(e.app))return Promise.reject(or(e,"operation-not-supported-in-this-environment"));const r=Yi(e);AE(e,t,tc);const s=jh(r,n);return new Rs(r,"signInViaPopup",t,s).executeNotNull()}class Rs extends Fh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Rs.currentPopupAction&&Rs.currentPopupAction.cancel(),Rs.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return et(t,this.auth,"internal-error"),t}async onExecution(){Wr(this.filter.length===1,"Popup operations only handle one event");const t=nc();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(or(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(or(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Rs.currentPopupAction=null}pollUserCancellation(){const t=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(or(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,PC.get())};t()}}Rs.currentPopupAction=null;/**
1267
+ * @license
1268
+ * Copyright 2020 Google LLC
1269
+ *
1270
+ * Licensed under the Apache License, Version 2.0 (the "License");
1271
+ * you may not use this file except in compliance with the License.
1272
+ * You may obtain a copy of the License at
1273
+ *
1274
+ * http://www.apache.org/licenses/LICENSE-2.0
1275
+ *
1276
+ * Unless required by applicable law or agreed to in writing, software
1277
+ * distributed under the License is distributed on an "AS IS" BASIS,
1278
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1279
+ * See the License for the specific language governing permissions and
1280
+ * limitations under the License.
1281
+ */const $C="pendingRedirect",vi=new Map;class OC extends Fh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=vi.get(this.auth._key());if(!t){try{const r=await NC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}vi.set(this.auth._key(),t)}return this.bypassAuthState||vi.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if(t.type==="signInViaRedirect")return super.onAuthEvent(t);if(t.type==="unknown"){this.resolve(null);return}if(t.eventId){const n=await this.auth._redirectUserForId(t.eventId);if(n)return this.user=n,super.onAuthEvent(t);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function NC(e,t){const n=jC(t),r=DC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function LC(e,t){vi.set(e._key(),t)}function DC(e){return Nr(e._redirectPersistence)}function jC(e){return gi($C,e.config.apiKey,e.name)}async function FC(e,t,n=!1){if(wr(e.app))return Promise.reject($s(e));const r=Yi(e),s=jh(r,t),i=await new OC(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
1282
+ * @license
1283
+ * Copyright 2020 Google LLC
1284
+ *
1285
+ * Licensed under the Apache License, Version 2.0 (the "License");
1286
+ * you may not use this file except in compliance with the License.
1287
+ * You may obtain a copy of the License at
1288
+ *
1289
+ * http://www.apache.org/licenses/LICENSE-2.0
1290
+ *
1291
+ * Unless required by applicable law or agreed to in writing, software
1292
+ * distributed under the License is distributed on an "AS IS" BASIS,
1293
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1294
+ * See the License for the specific language governing permissions and
1295
+ * limitations under the License.
1296
+ */const BC=600*1e3;class UC{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(t,r)&&(n=!0,this.sendToConsumer(t,r),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!HC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Bh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(or(this.auth,s))}else n.onAuthEvent(t)}isEventForConsumer(t,n){const r=n.eventId===null||!!t.eventId&&t.eventId===n.eventId;return n.filter.includes(t.type)&&r}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=BC&&this.cachedEventUids.clear(),this.cachedEventUids.has(Yu(t))}saveEventToCache(t){this.cachedEventUids.add(Yu(t)),this.lastProcessedEventTime=Date.now()}}function Yu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Bh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function HC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Bh(e);default:return!1}}/**
1297
+ * @license
1298
+ * Copyright 2020 Google LLC
1299
+ *
1300
+ * Licensed under the Apache License, Version 2.0 (the "License");
1301
+ * you may not use this file except in compliance with the License.
1302
+ * You may obtain a copy of the License at
1303
+ *
1304
+ * http://www.apache.org/licenses/LICENSE-2.0
1305
+ *
1306
+ * Unless required by applicable law or agreed to in writing, software
1307
+ * distributed under the License is distributed on an "AS IS" BASIS,
1308
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1309
+ * See the License for the specific language governing permissions and
1310
+ * limitations under the License.
1311
+ */async function WC(e,t={}){return co(e,"GET","/v1/projects",t)}/**
1312
+ * @license
1313
+ * Copyright 2020 Google LLC
1314
+ *
1315
+ * Licensed under the Apache License, Version 2.0 (the "License");
1316
+ * you may not use this file except in compliance with the License.
1317
+ * You may obtain a copy of the License at
1318
+ *
1319
+ * http://www.apache.org/licenses/LICENSE-2.0
1320
+ *
1321
+ * Unless required by applicable law or agreed to in writing, software
1322
+ * distributed under the License is distributed on an "AS IS" BASIS,
1323
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1324
+ * See the License for the specific language governing permissions and
1325
+ * limitations under the License.
1326
+ */const VC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zC=/^https?/;async function qC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await WC(e);for(const n of t)try{if(GC(n))return}catch{}Sr(e,"unauthorized-domain")}function GC(e){const t=dl(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return i.hostname===""&&r===""?n==="chrome-extension:"&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):n==="chrome-extension:"&&i.hostname===r}if(!zC.test(n))return!1;if(VC.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1327
+ * @license
1328
+ * Copyright 2020 Google LLC.
1329
+ *
1330
+ * Licensed under the Apache License, Version 2.0 (the "License");
1331
+ * you may not use this file except in compliance with the License.
1332
+ * You may obtain a copy of the License at
1333
+ *
1334
+ * http://www.apache.org/licenses/LICENSE-2.0
1335
+ *
1336
+ * Unless required by applicable law or agreed to in writing, software
1337
+ * distributed under the License is distributed on an "AS IS" BASIS,
1338
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1339
+ * See the License for the specific language governing permissions and
1340
+ * limitations under the License.
1341
+ */const KC=new Yo(3e4,6e4);function Qu(){const e=Tr().___jsl;if(e!=null&&e.H){for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n<e.CP.length;n++)e.CP[n]=null}}function JC(e){return new Promise((t,n)=>{var s,o,i;function r(){Qu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Qu(),n(or(e,"network-request-failed"))},timeout:KC.get()})}if((o=(s=Tr().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Tr().gapi)!=null&&i.load)r();else{const a=tC("iframefcb");return Tr()[a]=()=>{gapi.load?r():n(or(e,"network-request-failed"))},ZE(`${eC()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw yi=null,t})}let yi=null;function YC(e){return yi=yi||JC(e),yi}/**
1342
+ * @license
1343
+ * Copyright 2020 Google LLC.
1344
+ *
1345
+ * Licensed under the Apache License, Version 2.0 (the "License");
1346
+ * you may not use this file except in compliance with the License.
1347
+ * You may obtain a copy of the License at
1348
+ *
1349
+ * http://www.apache.org/licenses/LICENSE-2.0
1350
+ *
1351
+ * Unless required by applicable law or agreed to in writing, software
1352
+ * distributed under the License is distributed on an "AS IS" BASIS,
1353
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1354
+ * See the License for the specific language governing permissions and
1355
+ * limitations under the License.
1356
+ */const QC=new Yo(5e3,15e3),XC="__/auth/iframe",ZC="emulator/auth/iframe",e1={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},t1=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function n1(e){const t=e.config;et(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Yl(t,ZC):`https://${e.config.authDomain}/${XC}`,r={apiKey:t.apiKey,appName:e.name,v:Jo},s=t1.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Ko(r).slice(1)}`}async function r1(e){const t=await YC(e),n=Tr().gapi;return et(n,e,"internal-error"),t.open({where:document.body,url:n1(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:e1,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=or(e,"network-request-failed"),a=Tr().setTimeout(()=>{o(i)},QC.get());function l(){Tr().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1357
+ * @license
1358
+ * Copyright 2020 Google LLC.
1359
+ *
1360
+ * Licensed under the Apache License, Version 2.0 (the "License");
1361
+ * you may not use this file except in compliance with the License.
1362
+ * You may obtain a copy of the License at
1363
+ *
1364
+ * http://www.apache.org/licenses/LICENSE-2.0
1365
+ *
1366
+ * Unless required by applicable law or agreed to in writing, software
1367
+ * distributed under the License is distributed on an "AS IS" BASIS,
1368
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1369
+ * See the License for the specific language governing permissions and
1370
+ * limitations under the License.
1371
+ */const s1={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},o1=500,i1=600,a1="_blank",l1="http://localhost";class Xu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function c1(e,t,n,r=o1,s=i1){const o=Math.max((window.screen.availHeight-s)/2,0).toString(),i=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...s1,width:r.toString(),height:s.toString(),top:o,left:i},f=Mn().toLowerCase();n&&(a=bh(f)?a1:n),yh(f)&&(t=t||l1,l.scrollbars="yes");const u=Object.entries(l).reduce((_,[E,F])=>`${_}${E}=${F},`,"");if(zE(f)&&a!=="_self")return u1(t||"",a),new Xu(null);const g=window.open(t||"",a,u);et(g,e,"popup-blocked");try{g.focus()}catch{}return new Xu(g)}function u1(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
1372
+ * @license
1373
+ * Copyright 2021 Google LLC
1374
+ *
1375
+ * Licensed under the Apache License, Version 2.0 (the "License");
1376
+ * you may not use this file except in compliance with the License.
1377
+ * You may obtain a copy of the License at
1378
+ *
1379
+ * http://www.apache.org/licenses/LICENSE-2.0
1380
+ *
1381
+ * Unless required by applicable law or agreed to in writing, software
1382
+ * distributed under the License is distributed on an "AS IS" BASIS,
1383
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1384
+ * See the License for the specific language governing permissions and
1385
+ * limitations under the License.
1386
+ */const d1="__/auth/handler",f1="emulator/auth/handler",h1=encodeURIComponent("fac");async function Zu(e,t,n,r,s,o){et(e.config.authDomain,e,"auth-domain-config-required"),et(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Jo,eventId:s};if(t instanceof tc){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",uI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[u,g]of Object.entries({}))i[u]=g}if(t instanceof Qo){const u=t.getScopes().filter(g=>g!=="");u.length>0&&(i.scopes=u.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await e._getAppCheckToken(),f=l?`#${h1}=${encodeURIComponent(l)}`:"";return`${p1(e)}?${Ko(a).slice(1)}${f}`}function p1({config:e}){return e.emulator?Yl(e,f1):`https://${e.authDomain}/${d1}`}/**
1387
+ * @license
1388
+ * Copyright 2020 Google LLC
1389
+ *
1390
+ * Licensed under the Apache License, Version 2.0 (the "License");
1391
+ * you may not use this file except in compliance with the License.
1392
+ * You may obtain a copy of the License at
1393
+ *
1394
+ * http://www.apache.org/licenses/LICENSE-2.0
1395
+ *
1396
+ * Unless required by applicable law or agreed to in writing, software
1397
+ * distributed under the License is distributed on an "AS IS" BASIS,
1398
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1399
+ * See the License for the specific language governing permissions and
1400
+ * limitations under the License.
1401
+ */const Ra="webStorageSupport";class m1{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=$h,this._completeRedirectFn=FC,this._overrideRedirectResult=LC}async _openPopup(t,n,r,s){var i;Wr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Zu(t,n,r,dl(),s);return c1(t,o,nc())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Zu(t,n,r,dl(),s);return yC(o),new Promise(()=>{})}_initialize(t){const n=t._key();if(this.eventManagers[n]){const{manager:s,promise:o}=this.eventManagers[n];return s?Promise.resolve(s):(Wr(o,"If manager is not set, promise should be"),o)}const r=this.initAndGetManager(t);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(t){const n=await r1(t),r=new UC(t);return n.register("authEvent",s=>(et(s==null?void 0:s.authEvent,t,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,r}_isIframeWebStorageSupported(t,n){this.iframes[t._key()].send(Ra,{type:Ra},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[Ra];o!==void 0&&n(!!o),Sr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=qC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Ih()||wh()||Zl()}}const g1=m1;var ed="@firebase/auth",td="1.12.2";/**
1402
+ * @license
1403
+ * Copyright 2020 Google LLC
1404
+ *
1405
+ * Licensed under the Apache License, Version 2.0 (the "License");
1406
+ * you may not use this file except in compliance with the License.
1407
+ * You may obtain a copy of the License at
1408
+ *
1409
+ * http://www.apache.org/licenses/LICENSE-2.0
1410
+ *
1411
+ * Unless required by applicable law or agreed to in writing, software
1412
+ * distributed under the License is distributed on an "AS IS" BASIS,
1413
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
+ * See the License for the specific language governing permissions and
1415
+ * limitations under the License.
1416
+ */class v1{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),((t=this.auth.currentUser)==null?void 0:t.uid)||null}async getToken(t){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(t)}:null}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const n=this.auth.onIdTokenChanged(r=>{t((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(t,n),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const n=this.internalListeners.get(t);n&&(this.internalListeners.delete(t),n(),this.updateProactiveRefresh())}assertAuthConfigured(){et(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1417
+ * @license
1418
+ * Copyright 2020 Google LLC
1419
+ *
1420
+ * Licensed under the Apache License, Version 2.0 (the "License");
1421
+ * you may not use this file except in compliance with the License.
1422
+ * You may obtain a copy of the License at
1423
+ *
1424
+ * http://www.apache.org/licenses/LICENSE-2.0
1425
+ *
1426
+ * Unless required by applicable law or agreed to in writing, software
1427
+ * distributed under the License is distributed on an "AS IS" BASIS,
1428
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1429
+ * See the License for the specific language governing permissions and
1430
+ * limitations under the License.
1431
+ */function y1(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function w1(e){Uo(new io("auth",(t,{options:n})=>{const r=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),o=t.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=r.options;et(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:i,authDomain:a,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Eh(e)},f=new QE(r,s,o,l);return rC(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),Uo(new io("auth-internal",t=>{const n=Yi(t.getProvider("auth").getImmediate());return(r=>new v1(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Xs(ed,td,y1(e)),Xs(ed,td,"esm2020")}/**
1432
+ * @license
1433
+ * Copyright 2021 Google LLC
1434
+ *
1435
+ * Licensed under the Apache License, Version 2.0 (the "License");
1436
+ * you may not use this file except in compliance with the License.
1437
+ * You may obtain a copy of the License at
1438
+ *
1439
+ * http://www.apache.org/licenses/LICENSE-2.0
1440
+ *
1441
+ * Unless required by applicable law or agreed to in writing, software
1442
+ * distributed under the License is distributed on an "AS IS" BASIS,
1443
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1444
+ * See the License for the specific language governing permissions and
1445
+ * limitations under the License.
1446
+ */const b1=300,_1=nh("authIdTokenMaxAge")||b1;let nd=null;const k1=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>_1)return;const s=n==null?void 0:n.token;nd!==s&&(nd=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function T1(e=lh()){const t=ih(e,"auth");if(t.isInitialized())return t.getImmediate();const n=nC(e,{popupRedirectResolver:g1,persistence:[CC,mC,$h]}),r=nh("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=k1(o.toString());fC(n,i,()=>i(n.currentUser)),dC(n,a=>i(a))}}const s=XS("auth");return s&&sC(n,`http://${s}`),n}function S1(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}XE({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=or("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",S1().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});w1("Browser");const I1={apiKey:"AIzaSyAf0CIHBZ-wEQJ8CCUUWo1Wl9P7typ_ZPI",authDomain:"gptcall-416910.firebaseapp.com",projectId:"gptcall-416910",storageBucket:"gptcall-416910.appspot.com",messagingSenderId:"99275526699",appId:"1:99275526699:web:3b623e1e2996108b52106e"};function E1(e){const t=D(null),n=D(""),r=D(""),s=D(""),o=D({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=de(()=>s.value==="pull"),a=de(()=>s.value==="push"),l=de(()=>s.value!=="");async function f(){try{const $=await fetch("/codex-api/skills-sync/status");if(!$.ok)return;const Y=await $.json();Y.data&&(o.value=Y.data)}catch{}}async function u(){try{const $=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),Y=await $.json();if(!$.ok||!Y.data)throw new Error("Failed to start GitHub login");t.value=Y.data;const ae=30,G=Math.max((Y.data.interval??5)*1e3,3e3);let ee=!1;for(let te=0;te<ae;te++){await new Promise(ye=>setTimeout(ye,G));const Te=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:Y.data.device_code})}),ve=await Te.json();if(!Te.ok)throw new Error(ve.error||"Failed to complete GitHub login");if(ve.ok){ee=!0;break}if(!ve.pending)throw new Error(ve.error||"Failed to complete GitHub login")}if(!ee)throw new Error("GitHub login timed out. Please retry.");t.value=null,await f(),e.showToast("GitHub login successful")}catch($){e.showToast($ instanceof Error?$.message:"Failed GitHub login","error")}}async function g(){try{const $=hE().length>0?lh():ah(I1),Y=T1($),ae=new br;ae.addScope("repo");const G=await MC(Y,ae),ee=br.credentialFromResult(G),te=(ee==null?void 0:ee.accessToken)??"";if(!te)throw new Error("GitHub access token missing from Firebase login");const Te=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:te})}),ve=await Te.json();if(!Te.ok||!ve.ok)throw new Error(ve.error||"Failed to login with GitHub token");await f(),e.showToast("GitHub login successful")}catch($){const Y=$ instanceof Error?$.message:"Failed Firebase GitHub login";e.showToast(Y,"error")}}async function _(){r.value="",n.value="pull-started",s.value="pull";try{const $=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),Y=await $.json();if(!$.ok||!Y.ok)throw new Error(Y.error||"Failed to pull synced skills");await e.onPulled(),n.value="pull-success",e.showToast(o.value.loggedIn?"Pulled skills from private sync repo":"Pulled skills from upstream repo")}catch($){const Y=$ instanceof Error?$.message:"Failed to pull sync";r.value=Y,n.value="pull-failed",e.showToast(Y,"error")}finally{s.value=""}}async function E(){r.value="",n.value="push-started",s.value="push";try{const $=await fetch("/codex-api/skills-sync/push",{method:"POST"}),Y=await $.json();if(!$.ok||!Y.ok)throw new Error(Y.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch($){const Y=$ instanceof Error?$.message:"Failed to push sync";r.value=Y,n.value="push-failed",e.showToast(Y,"error")}finally{s.value=""}}async function F(){try{const $=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),Y=await $.json();if(!$.ok||!Y.ok)throw new Error(Y.error||"Failed to logout GitHub");await f(),e.showToast("Logged out from GitHub")}catch($){e.showToast($ instanceof Error?$.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:f,logoutGithub:F,pullSkillsSync:_,pushSkillsSync:E,startGithubFirebaseLogin:g,startGithubLogin:u,syncActionError:r,syncActionStatus:n,syncStatus:o}}const C1={class:"skills-hub"},A1={class:"skills-sync-panel"},x1={class:"skills-sync-header"},R1={key:0,class:"skills-sync-badge"},P1={key:1,class:"skills-sync-badge"},M1={key:2,class:"skills-sync-badge"},$1={class:"skills-sync-meta"},O1={key:0,class:"skills-sync-error"},N1={key:1,class:"skills-sync-meta"},L1={key:2,class:"skills-sync-error"},D1={key:3,class:"skills-sync-device"},j1=["href"],F1={class:"skills-sync-actions"},B1=["disabled"],U1=["disabled"],H1=["disabled"],W1={key:1,class:"skills-hub-section"},V1={class:"skills-hub-section-title"},z1={key:0,class:"skills-hub-grid"},q1={class:"skills-hub-toolbar"},G1={class:"skills-hub-search-wrap"},K1={key:0,class:"skills-hub-count"},J1={class:"skills-hub-section"},Y1={key:0,class:"skills-hub-loading"},Q1={key:1,class:"skills-hub-error"},X1={key:0,class:"skills-hub-grid"},Z1={key:1,class:"skills-hub-empty"},oi="codex-web-local.skills-hub.cache.v1",eA=cn({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=D(null),s=D(""),o=D("date"),i=D([]),a=D([]),l=D(0),f=D(!1),u=D(""),g=D(!0),_=D(!1),E=D(n),F=D(null),$=D(""),Y=D(!1),ae=D(!1);let G=null,ee=null;const te=t,Te=de(()=>o.value==="date"?"Newest":"A-Z"),ve=de(()=>{var N;return((N=F.value)==null?void 0:N.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ye=de(()=>`${E.value.owner}/${E.value.name}`),De=de(()=>Y.value&&$.value===ye.value),le=de(()=>ae.value&&$.value===ye.value),re=de(()=>{const N=s.value.toLowerCase().trim();return N?a.value.filter(B=>B.name.toLowerCase().includes(N)||B.owner.toLowerCase().includes(N)||(B.displayName??"").toLowerCase().includes(N)):a.value});function ce(N,B="success"){F.value={text:N,type:B},ee&&clearTimeout(ee),ee=setTimeout(()=>{F.value=null},3e3)}function ne(){o.value=o.value==="date"?"name":"date",Re(s.value)}function Pe(N){return`${o.value}::${N.trim().toLowerCase()}`}function Ye(N){var B;if(typeof window>"u")return null;try{const H=window.localStorage.getItem(oi);return H?((B=JSON.parse(H).byKey)==null?void 0:B[N])??null:null}catch{return null}}function Ge(N,B){if(!(typeof window>"u"))try{const H=window.localStorage.getItem(oi),Z=(H?JSON.parse(H):{}).byKey??{};Z[N]=B,window.localStorage.setItem(oi,JSON.stringify({byKey:Z}))}catch{}}function Ve(){if(!(typeof window>"u"))try{window.localStorage.removeItem(oi)}catch{}}function Ue(N){const B=N.installed??[];a.value=B;const H=new Set(B.map(Q=>Q.name));i.value=N.data.map(Q=>{if(Q.installed||H.has(Q.name)){const Z=B.find(Ee=>Ee.name===Q.name);return{...Q,installed:!0,path:(Z==null?void 0:Z.path)??Q.path,enabled:(Z==null?void 0:Z.enabled)??Q.enabled}}return Q}).filter(Q=>!Q.installed),l.value=N.total}async function Re(N){const B=Pe(N),H=Ye(B);H&&Ue(H),f.value=!H,u.value="";try{const Q=new URLSearchParams;N.trim()&&Q.set("q",N.trim()),Q.set("limit","100"),Q.set("sort",o.value);const Z=await fetch(`/codex-api/skills-hub?${Q}`);if(!Z.ok)throw new Error(`HTTP ${Z.status}`);const Ee=await Z.json();Ue(Ee),Ge(B,Ee)}catch(Q){u.value=Q instanceof Error?Q.message:"Failed to load skills"}finally{f.value=!1}}function rt(){G&&clearTimeout(G),G=setTimeout(()=>Re(s.value),300)}function Ae(N){E.value=N,_.value=!0}async function Be(N){$.value=`${N.owner}/${N.name}`,Y.value=!0;try{const H=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:N.owner,name:N.name})})).json();if(!H.ok)throw new Error(H.error||"Install failed");const Q={...N,installed:!0,path:H.path,enabled:!0};a.value=[...a.value,Q],i.value=i.value.filter(Z=>Z.name!==N.name),E.value=Q,ce(`${N.displayName||N.name} skill installed`),_.value=!1,Ve(),te("skills-changed")}catch(B){ce(B instanceof Error?B.message:"Failed to install skill","error")}finally{Y.value=!1}}async function ct(N){$.value=`${N.owner}/${N.name}`,ae.value=!0;try{const H=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:N.name,path:N.path})})).json();if(!H.ok)throw new Error(H.error||"Uninstall failed");a.value=a.value.filter(Q=>Q.name!==N.name),N.owner!=="local"&&(i.value=[...i.value,{...N,installed:!1,path:void 0,enabled:void 0}]),ce(`${N.displayName||N.name} skill uninstalled`),_.value=!1,Ve(),te("skills-changed")}catch(B){ce(B instanceof Error?B.message:"Failed to uninstall skill","error")}finally{ae.value=!1}}async function Ht(N,B){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:N.path,enabled:B}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),ce(`${N.displayName||N.name} skill ${B?"enabled":"disabled"}`),await Re(s.value)}catch(H){ce(H instanceof Error?H.message:"Failed to update skill","error")}}const{deviceLogin:pt,isPullInFlight:ut,isPushInFlight:He,isSyncActionInFlight:W,loadSyncStatus:_e,logoutGithub:he,pullSkillsSync:ge,pushSkillsSync:Ce,startGithubFirebaseLogin:T,startGithubLogin:C,syncActionError:O,syncActionStatus:z,syncStatus:J}=E1({showToast:ce,onPulled:async()=>{await Re(s.value),te("skills-changed")}});return zr(()=>{Re(""),_e()}),(N,B)=>(y(),k("div",C1,[B[11]||(B[11]=v("div",{class:"skills-hub-header"},[v("h2",{class:"skills-hub-title"},"Skills Hub"),v("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),v("div",A1,[v("div",x1,[B[8]||(B[8]=v("strong",null,"Skills Sync (GitHub)",-1)),be(J).configured?(y(),k("span",R1,"Connected: "+K(be(J).repoOwner)+"/"+K(be(J).repoName),1)):be(J).loggedIn?(y(),k("span",P1,"Logged in as "+K(be(J).githubUsername),1)):(y(),k("span",M1,"Not connected"))]),v("div",$1,[v("span",null,"Startup: "+K(be(J).startup.mode),1),v("span",null,"Branch: "+K(be(J).startup.branch),1),v("span",null,"Action: "+K(be(J).startup.lastAction),1)]),be(J).startup.lastError?(y(),k("div",O1,K(be(J).startup.lastError),1)):fe("",!0),be(z)?(y(),k("div",N1,[v("span",null,"Manual sync: "+K(be(z)),1)])):fe("",!0),be(O)?(y(),k("div",L1,K(be(O)),1)):fe("",!0),be(pt)?(y(),k("div",D1,[v("span",null,[B[9]||(B[9]=Lo("Open ",-1)),v("a",{href:be(pt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,j1),B[10]||(B[10]=Lo(" and enter code:",-1))]),v("code",null,K(be(pt).user_code),1)])):fe("",!0),v("div",F1,[be(J).loggedIn?fe("",!0):(y(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:B[0]||(B[0]=(...H)=>be(T)&&be(T)(...H))},"Login with GitHub")),be(J).loggedIn?fe("",!0):(y(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:B[1]||(B[1]=(...H)=>be(C)&&be(C)(...H))},"Device Login")),be(J).loggedIn?(y(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:B[2]||(B[2]=(...H)=>be(he)&&be(he)(...H)),disabled:be(W)},"Logout GitHub",8,B1)):fe("",!0),v("button",{class:"skills-hub-sort",type:"button",onClick:B[3]||(B[3]=(...H)=>be(ge)&&be(ge)(...H)),disabled:be(W)},K(be(ut)?"Pulling...":"Pull"),9,U1),be(J).loggedIn?(y(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:B[4]||(B[4]=(...H)=>be(Ce)&&be(Ce)(...H)),disabled:!be(J).configured||be(W)},K(be(He)?"Pushing...":"Push"),9,H1)):fe("",!0)])]),F.value?(y(),k("div",{key:0,class:tt(["skills-hub-toast",ve.value])},K(F.value.text),3)):fe("",!0),re.value.length>0?(y(),k("div",W1,[v("button",{class:"skills-hub-section-toggle",type:"button",onClick:B[5]||(B[5]=H=>g.value=!g.value)},[v("span",V1,"Installed ("+K(re.value.length)+")",1),je(Hf,{class:tt(["skills-hub-section-chevron",{"is-open":g.value}])},null,8,["class"])]),g.value?(y(),k("div",z1,[(y(!0),k(Le,null,vt(re.value,H=>(y(),bt(xu,{key:H.name,skill:H,onSelect:Q=>Ae(Q)},null,8,["skill","onSelect"]))),128))])):fe("",!0)])):fe("",!0),v("div",q1,[v("div",G1,[je(ol,{class:"skills-hub-search-icon"}),Br(v("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":B[6]||(B[6]=H=>s.value=H),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:rt},null,544),[[Ur,s.value]]),l.value>0?(y(),k("span",K1,K(l.value)+" skills",1)):fe("",!0)]),v("button",{class:"skills-hub-sort",type:"button",onClick:ne},K(Te.value),1)]),v("div",J1,[f.value?(y(),k("div",Y1,"Loading skills...")):u.value?(y(),k("div",Q1,K(u.value),1)):(y(),k(Le,{key:2},[i.value.length>0?(y(),k("div",X1,[(y(!0),k(Le,null,vt(i.value,H=>(y(),bt(xu,{key:H.url,skill:H,onSelect:Q=>Ae(Q)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(y(),k("div",Z1,'No skills found for "'+K(s.value)+'"',1)):fe("",!0)],64))]),je(WS,{skill:E.value,visible:_.value,"is-installing":De.value,"is-uninstalling":le.value,onClose:B[7]||(B[7]=H=>_.value=!1),onInstall:Be,onUninstall:ct,onToggleEnabled:Ht},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),tA=yt(eA,[["__scopeId","data-v-2f6920be"]]),nA={},rA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function sA(e,t){return y(),k("svg",rA,[...t[0]||(t[0]=[v("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),v("path",{d:"M9 4l0 16"},null,-1)])])}const oA=yt(nA,[["render",sA]]),iA={},aA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function lA(e,t){return y(),k("svg",aA,[...t[0]||(t[0]=[v("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const cA=yt(iA,[["render",lA]]),uA={class:"sidebar-thread-controls"},dA=["aria-label","title"],fA=cn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(y(),k("div",uA,[v("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",title:e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",onClick:n[0]||(n[0]=r=>t.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(y(),bt(cA,{key:0,class:"sidebar-thread-controls-icon"})):(y(),bt(oA,{key:1,class:"sidebar-thread-controls-icon"}))],8,dA),_r(t.$slots,"default",{},void 0),e.showNewThreadButton?(y(),k("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":"Start new thread",title:"Start new thread",onClick:n[1]||(n[1]=r=>t.$emit("start-new-thread"))},[je(Ci,{class:"sidebar-thread-controls-icon"})])):fe("",!0)]))}}),rd=yt(fA,[["__scopeId","data-v-46a10052"]]),hA={},pA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function mA(e,t){return y(),k("svg",pA,[...t[0]||(t[0]=[v("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[v("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),v("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const gA=yt(hA,[["render",mA]]);function ss(e){return e.flatMap(t=>t.threads)}const Uh="codex-web-local.thread-read-state.v1",Hh="codex-web-local.thread-scroll-state.v1",pl="codex-web-local.selected-thread-id.v1",Wh="codex-web-local.project-order.v1",Vh="codex-web-local.project-display-name.v1",ml="codex-web-local.collaboration-mode-by-context.v1",zh="codex-web-local.collaboration-mode.v1",qh="__new-thread__",Pa=220,sd=["none","minimal","low","medium","high","xhigh"],Us="__global__",Qn="gpt-5.2-codex";function vA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function od(e){typeof window>"u"||window.localStorage.setItem(Uh,JSON.stringify(e))}function gl(e){return e==="plan"?"plan":"default"}function Gh(e){return e.trim()||qh}function yA(){if(typeof window>"u")return{};try{const t=window.localStorage.getItem(ml);if(t){const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const r={};for(const[s,o]of Object.entries(n)){if(typeof s!="string"||s.length===0)continue;const i=gl(o);i==="plan"&&(r[s]=i)}return r}}catch{}return gl(window.localStorage.getItem(zh))==="plan"?{[qh]:"plan"}:{}}function Ma(e,t){const n=Gh(t);return gl(e[n])}function wA(e){typeof window>"u"||(Object.keys(e).length===0?window.localStorage.removeItem(ml):window.localStorage.setItem(ml,JSON.stringify(e)),window.localStorage.removeItem(zh))}function Kh(e,t,n){return Math.min(Math.max(e,t),n)}function bA(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.scrollTop!="number"||!Number.isFinite(t.scrollTop)||typeof t.isAtBottom!="boolean")return null;const n={scrollTop:Math.max(0,t.scrollTop),isAtBottom:t.isAtBottom};return typeof t.scrollRatio=="number"&&Number.isFinite(t.scrollRatio)&&(n.scrollRatio=Kh(t.scrollRatio,0,1)),n}function _A(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Hh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){if(!r)continue;const o=bA(s);o&&(n[r]=o)}return n}catch{return{}}}function id(e){typeof window>"u"||window.localStorage.setItem(Hh,JSON.stringify(e))}function kA(){return typeof window>"u"?"":window.localStorage.getItem(pl)??""}function TA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(pl);return}window.localStorage.setItem(pl,e)}}function SA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Wh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&!n.includes(r)&&n.push(r);return n}catch{return[]}}function Hs(e){typeof window>"u"||window.localStorage.setItem(Wh,JSON.stringify(e))}function IA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Vh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t))typeof r=="string"&&r.length>0&&typeof s=="string"&&(n[r]=s);return n}catch{return{}}}function $a(e){typeof window>"u"||window.localStorage.setItem(Vh,JSON.stringify(e))}function ii(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return As(e,n)?e:n}function Oa(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??{projectName:s,threads:[]});for(const s of e)t.includes(s.projectName)||r.push(s);return r}function As(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s])return!1;return!0}function EA(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}function CA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function AA(e=[],t=[]){var n,r,s,o;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i+=1)if(((n=e[i])==null?void 0:n.step)!==((r=t[i])==null?void 0:r.step)||((s=e[i])==null?void 0:s.status)!==((o=t[i])==null?void 0:o.status))return!1;return!0}function xA(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&AA(e.steps,t.steps)}function ai(e){if(!(e instanceof Error))return!1;const t=e.message.toLowerCase();return t.includes("not supported when using codex with a chatgpt account")||t.includes("model is not supported")}function vl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&As(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&CA(e.commandExecution,t.commandExecution)&&xA(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function xo(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function RA(e,t,n={}){const r=new Map(e.map(u=>[u.id,u])),s=new Map(t.map(u=>[u.id,u])),o=t.map(u=>{const g=r.get(u.id);return g&&vl(g,u)?g:u});if(n.preserveMissing!==!0)return xo(e,o)?e:o;const i=e.map(u=>{const g=s.get(u.id);return!g||vl(u,g)?u:g}),a=new Set(e.map(u=>u.id)),l=o.filter(u=>!a.has(u.id)),f=[...i,...l];return xo(e,f)?e:f}function yl(e){return e.replace(/\s+/gu," ").trim()}function PA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>yl(s.text)).filter(s=>s.length>0));if(n.size===0)return e;const r=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;const o=yl(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Na(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(vl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Jh="worked";function ts(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function MA(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const i=s>0||o.length===0?s:0;return o.push(`${i}s`),o.join(" ")}function $A(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function OA(e,t){if(!e&&!t)return!0;if(!e||!t||e.label!==t.label||e.details.length!==t.details.length)return!1;for(let n=0;n<e.details.length;n+=1)if(e.details[n]!==t.details[n])return!1;return!0}function NA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${MA(e.durationMs)}`,messageType:Jh}}function LA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function DA(e,t){const n=NA(t),r=e.filter(i=>i.messageType!==Jh),s=LA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function ln(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function jA(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[s,o]of Object.entries(e)){if(t.has(s)){n=!0;continue}r[s]=o}return n?r:e}function FA(e,t){return e.id===t.id&&e.title===t.title&&e.projectName===t.projectName&&e.cwd===t.cwd&&e.createdAtIso===t.createdAtIso&&e.updatedAtIso===t.updatedAtIso&&e.preview===t.preview&&e.unread===t.unread&&e.inProgress===t.inProgress}function BA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function UA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function gn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function li(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>{const o=n.get(s.projectName),i=new Map((o==null?void 0:o.threads.map(l=>[l.id,l]))??[]),a=s.threads.map(l=>{const f=i.get(l.id);return f&&FA(f,l)?f:l});return o&&o.projectName===s.projectName&&BA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return UA(e,r)?e:r}function HA(e,t,n){const r=new Set(ss(t).map(a=>a.id)),s=ss(e).filter(a=>n[a.id]===!0&&!r.has(a.id));if(s.length===0)return t;const o=new Map(t.map(a=>[a.projectName,a])),i=t.map(a=>({projectName:a.projectName,threads:[...a.threads]}));for(const a of s){if(o.get(a.projectName)){const f=i.findIndex(u=>u.projectName===a.projectName);f>=0&&(i[f]={projectName:i[f].projectName,threads:[a,...i[f].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function WA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Ws(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function VA(e){const t=e.split(`
1447
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function zA(){const e=D([]),t=D([]),n=D(kA()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),f=D({}),u=D({}),g=D([]),_=D([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),E=D(yA()),F=D(Ma(E.value,n.value)),$=D(""),Y=D("medium"),ae=D(vA()),G=D(_A()),ee=D(SA()),te=D(IA()),Te=D({}),ve=D({}),ye=D({}),De=D({}),le=D({}),re=D({}),ce=D({}),ne=D({}),Pe=D({}),Ye=D(null),Ge=D({}),Ve=D([]),Ue=D(!1),Re=D(!1),rt=D(!1),Ae=D(!1),Be=D(""),ct=D(!1),Ht=D(!1);let pt=null,ut=null,He=!1;const W=new Set;let _e=!1,he=!1;const ge=new Map,Ce=new Set,T=de(()=>ss(e.value)),C=de(()=>T.value.find(c=>c.id===n.value)??null),O=de(()=>G.value[n.value]??null),z=de(()=>{const c=[],m=n.value;return m&&Array.isArray(ne.value[m])&&c.push(...ne.value[m]),Array.isArray(ne.value[Us])&&c.push(...ne.value[Us]),c.sort((w,I)=>w.receivedAtIso.localeCompare(I.receivedAtIso))}),J=de(()=>{var q;const c=n.value;if(!c)return null;const m=le.value[c],w=(i.value[c]??"").trim(),I=(((q=re.value[c])==null?void 0:q.message)??"").trim();return!m&&!w&&!I?null:{activityLabel:(m==null?void 0:m.label)||"Thinking",activityDetails:(m==null?void 0:m.details)??[],reasoningText:w,errorText:I}}),N=de(()=>Ye.value),B=de(()=>{const c=n.value;if(!c)return[];const m=r.value[c]??[],w=s.value[c]??[],I=o.value[c]??[],q=a.value[c]??[],se=[...m,...w,...q,...I],ue=De.value[c];return ue?DA(se,ue):se});function H(c){n.value!==c&&(n.value=c,TA(c),F.value=Ma(E.value,c),he=!1)}function Q(c){$.value=c.trim()}function Z(c){const m=c==="plan"?"plan":"default",w=Gh(n.value);Ma(E.value,n.value)===m&&F.value===m||(F.value=m,E.value=m==="plan"?{...E.value,[w]:m}:ln(E.value,w),wA(E.value))}function Ee(c){Ye.value=c}async function we(){$.value=Qn,g.value.includes(Qn)||(g.value=[...g.value,Qn]);try{await a0(Qn)}catch{}}function ke(c,m){Pe.value={...Pe.value,[c]:m}}function xe(c){Pe.value[c]&&(Pe.value=ln(Pe.value,c))}async function ze(c){if(Ce.has(c))return;const m=Pe.value[c];if(!(!m||m.fallbackRetried)){Ce.add(c),ke(c,{...m,fallbackRetried:!0});try{await we();try{const w=await n0(c,1);On(c,w),dn(c),Mt(c,[]),Fn(c),a.value[c]&&(a.value=ln(a.value,c))}catch{}Rt(c,null),Be.value="",kt(c,null),xt(c,{label:"Thinking",details:ht(Qn,m.effort,m.collaborationMode)}),mt(c,!0),ye.value[c]!==!0&&await _a(c),await ka(c,m.text,m.imageUrls,Qn,m.effort||void 0,m.skills.length>0?m.skills:void 0,m.fileAttachments,m.collaborationMode),ye.value={...ye.value,[c]:!0},W.add(c),He=!0,await h()}catch(w){const I=w instanceof Error?w.message:"Unknown application error";Rt(c,I),Be.value=I,mt(c,!1),xt(c,null)}finally{Ce.delete(c)}}}function ot(c){c&&!sd.includes(c)||(Y.value=c)}async function We(){try{const c=await c0();_.value=c,c.some(m=>m.value===F.value)||Z("default")}catch{}}function ht(c,m,w=F.value){const I=c.trim()||"default",q=m||"default";return[`Mode: ${w==="plan"?"Plan":"Default"}`,`Model: ${I}`,`Thinking: ${q}`]}async function _t(){try{const[c,m]=await Promise.all([Jf(),Yf()]);g.value=c,$.value.length>0&&c.includes($.value)||(m.model&&c.includes(m.model)?$.value=m.model:c.length>0?$.value=c[0]:$.value=""),m.reasoningEffort&&sd.includes(m.reasoningEffort)&&(Y.value=m.reasoningEffort)}catch{}}function Pt(c){const m=Ge.value;return Object.keys(m).length===0?c:c.map(w=>({projectName:w.projectName,threads:w.threads.map(I=>{const q=m[I.id];return q?{...I,title:q}:I})}))}function Ke(){const m=Pt(t.value).map(w=>({projectName:w.projectName,threads:w.threads.map(I=>{const q=l.value[I.id]===!0,se=n.value===I.id,ue=ae.value[I.id],Ie=u.value[I.id]===!0,me=!se&&!q&&(Ie||ue!==I.updatedAtIso);return{...I,inProgress:q,unread:me}})}));e.value=li(e.value,m)}function Bt(c,m,w){const I=new Date().toISOString(),q=m.trim(),se=WA(q),ue={id:c,title:VA(w),projectName:se,cwd:q,hasWorktree:q.includes("/.codex/worktrees/")||q.includes("/.git/worktrees/"),createdAtIso:I,updatedAtIso:I,preview:w,unread:!1,inProgress:!1},Ie=t.value.findIndex(st=>st.projectName===se);if(Ie>=0){const jt=t.value[Ie].threads.filter(fr=>fr.id!==c),Qt={projectName:se,threads:[ue,...jt]},Wn=[...t.value];Wn.splice(Ie,1,Qt),t.value=Wn}else t.value=[{projectName:se,threads:[ue]},...t.value];const me=ii(ee.value,t.value);As(ee.value,me)||(ee.value=me,Hs(ee.value)),Ke()}function Vt(c){const m=new Set(c.map(se=>se.id)),w=gn(ae.value,m);w!==ae.value&&(ae.value=w,od(w));const I=gn(G.value,m);I!==G.value&&(G.value=I,id(I)),ve.value=gn(ve.value,m),Te.value=gn(Te.value,m),ye.value=gn(ye.value,m),r.value=gn(r.value,m),o.value=gn(o.value,m),i.value=gn(i.value,m),a.value=gn(a.value,m),De.value=gn(De.value,m),le.value=gn(le.value,m),re.value=gn(re.value,m),ce.value=gn(ce.value,m),u.value=gn(u.value,m),l.value=gn(l.value,m);const q={};for(const[se,ue]of Object.entries(ne.value))(se===Us||m.has(se))&&(q[se]=ue);ne.value=q}function dt(c){const m=ss(t.value).find(w=>w.id===c);m&&(ae.value={...ae.value,[c]:m.updatedAtIso},od(ae.value),u.value[c]&&(u.value=ln(u.value,c)),Ke())}function kt(c,m){if(!c)return;const w=De.value[c];if(m){if($A(w,m))return;De.value={...De.value,[c]:m}}else w&&(De.value=ln(De.value,c))}function mt(c,m){!c||l.value[c]===!0===m||(m?l.value={...l.value,[c]:!0}:l.value=ln(l.value,c),Ke())}function rn(c){c&&c!==n.value&&u.value[c]!==!0&&(u.value={...u.value,[c]:!0},Ke())}function xt(c,m){if(!c)return;const w=le.value[c];if(!m){w&&(le.value=ln(le.value,c));return}const I=En(m.label)||"Thinking",q=m.details.map(Ie=>En(Ie)).filter(Ie=>Ie.length>0&&Ie!==I),se=Array.from(new Set([...(w==null?void 0:w.details)??[],...q])).slice(-3),ue={label:I,details:se};OA(w,ue)||(le.value={...le.value,[c]:ue})}function Rt(c,m){if(!c)return;const w=re.value[c],I=m?yl(m):"";if(!I){w&&(re.value=ln(re.value,c));return}(w==null?void 0:w.message)!==I&&(re.value={...re.value,[c]:{message:I}})}function $n(c){const m=ss(t.value).find(w=>w.id===c);return(m==null?void 0:m.updatedAtIso)??""}function Wt(c,m){if(!c)return;const w={scrollTop:Math.max(0,m.scrollTop),isAtBottom:m.isAtBottom===!0};typeof m.scrollRatio=="number"&&Number.isFinite(m.scrollRatio)&&(w.scrollRatio=Kh(m.scrollRatio,0,1));const I=G.value[c];I&&I.scrollTop===w.scrollTop&&I.isAtBottom===w.isAtBottom&&I.scrollRatio===w.scrollRatio||(G.value={...G.value,[c]:w},id(G.value))}function On(c,m){const w=r.value[c]??[];xo(w,m)||(r.value={...r.value,[c]:m})}function Mt(c,m){const w=o.value[c]??[];xo(w,m)||(o.value={...o.value,[c]:m})}function qt(c,m){const w=s.value[c]??[];xo(w,m)||(s.value={...s.value,[c]:m})}function Dt(c,m){const w=s.value[c]??[],I=Na(w,m);qt(c,I)}function sn(c,m){const w=o.value[c]??[],I=Na(w,m);Mt(c,I)}function Tn(c,m){if(!c)return;const w=m.trim(),I=i.value[c]??"";if(w.length===0){if(!I)return;i.value=ln(i.value,c);return}I!==w&&(i.value={...i.value,[c]:w})}function un(c,m){if(!c)return;const w=i.value[c]??"";Tn(c,`${w}${m}`)}function Fn(c){c&&c in i.value&&(i.value=ln(i.value,c))}function dn(c){c&&c in s.value&&(s.value=ln(s.value,c))}function Bn(c){return c==="completed"?"completed":c==="inProgress"||c==="in_progress"?"inProgress":"pending"}function er(c){var w;const m=[];(w=c.explanation)!=null&&w.trim()&&m.push(c.explanation.trim());for(const I of c.steps){const q=I.status==="completed"?"x":I.status==="inProgress"?"~":" ";m.push(`- [${q}] ${I.step}`)}return m.join(`
1448
+ `).trim()}function Un(c){if(c.method!=="turn/plan/updated")return null;const m=Me(c.params),w=Yt(c),I=Oe(m==null?void 0:m.turnId)||Oe(m==null?void 0:m.turn_id),se=(Array.isArray(m==null?void 0:m.plan)?m==null?void 0:m.plan:[]).map(me=>Me(me)).map(me=>({step:Oe(me==null?void 0:me.step),status:Bn(me==null?void 0:me.status)})).filter(me=>me.step.length>0);if(!w||!I)return null;const Ie={explanation:Oe(m==null?void 0:m.explanation).trim()||void 0,steps:se,isStreaming:!0};return{threadId:w,message:{id:`${I}:plan`,role:"assistant",text:er(Ie),messageType:"plan.live",plan:Ie}}}function Nn(c){if(c.method!=="item/plan/delta")return null;const m=Me(c.params),w=Yt(c),I=Oe(m==null?void 0:m.turnId)||Oe(m==null?void 0:m.turn_id),q=Oe(m==null?void 0:m.delta);if(!w||!I||!q)return null;const se=`${I}:plan`,ue=(s.value[w]??[]).find(st=>st.id===se),Ie=`${(ue==null?void 0:ue.text)??""}${q}`,me=ue!=null&&ue.plan?{...ue.plan,isStreaming:!0}:void 0;return{threadId:w,message:{id:se,role:"assistant",text:Ie,messageType:"plan.live",plan:me}}}function Me(c){return c!==null&&typeof c=="object"&&!Array.isArray(c)?c:null}function Oe(c){return typeof c=="string"?c:""}function Sn(c){return typeof c=="number"&&Number.isFinite(c)?c:null}function Yt(c){const m=Me(c.params);if(!m)return"";const w=Oe(m.threadId);if(w)return w;const I=Oe(m.thread_id);if(I)return I;const q=Oe(m.conversationId);if(q)return q;const se=Oe(m.conversation_id);if(se)return se;const ue=Me(m.thread),Ie=Oe(ue==null?void 0:ue.id);if(Ie)return Ie;const me=Me(m.turn),st=Oe(me==null?void 0:me.threadId);if(st)return st;const jt=Oe(me==null?void 0:me.thread_id);return jt||""}function zn(c){if(c.method!=="turn/completed")return"";const m=Me(c.params),w=Me(m==null?void 0:m.turn);if(!w||w.status!=="failed")return"";const I=Me(w.error);return Oe(I==null?void 0:I.message)}function Hn(c){var w;if(c.method!=="error")return"";const m=Me(c.params);return Oe(m==null?void 0:m.message)||Oe((w=Me(m==null?void 0:m.error))==null?void 0:w.message)}function mn(c){const m=Me(c);if(!m)return null;const w=m.id,I=Oe(m.method),q=m.params;if(typeof w!="number"||!Number.isInteger(w)||!I)return null;const se=Me(q),ue=Oe(se==null?void 0:se.threadId)||Us,Ie=Oe(se==null?void 0:se.turnId),me=Oe(se==null?void 0:se.itemId),st=Oe(m.receivedAtIso)||new Date().toISOString();return{id:w,method:I,threadId:ue,turnId:Ie,itemId:me,receivedAtIso:st,params:q??null}}function Ln(c){if(c.method!=="item/tool/requestUserInput")return[];const m=Me(c.params),w=Array.isArray(m==null?void 0:m.questions)?m.questions:[],I=[];for(const q of w){const se=Me(q),ue=Oe(se==null?void 0:se.id).trim();ue&&I.push(ue)}return I}function tr(c){const m=c.threadId||Us,w=ne.value[m]??[],I=w.findIndex(se=>se.id===c.id),q=[...w];I>=0?q.splice(I,1,c):q.push(c),ne.value={...ne.value,[m]:q.sort((se,ue)=>se.receivedAtIso.localeCompare(ue.receivedAtIso))}}function qn(c){const m={};for(const[w,I]of Object.entries(ne.value)){const q=I.filter(se=>se.id!==c);q.length>0&&(m[w]=q)}ne.value=m}function Ot(c){const m={};for(const w of c){const I=w.threadId||Us,q=m[I]??[];q.push(w),m[I]=q}for(const w of Object.values(m))w.sort((I,q)=>I.receivedAtIso.localeCompare(q.receivedAtIso));ne.value=m}function In(c){if(c.method==="server/request"){const m=mn(c.params);return m&&tr(m),!0}if(c.method==="server/request/resolved"){const m=Me(c.params),w=m==null?void 0:m.id;return typeof w=="number"&&Number.isInteger(w)&&qn(w),!0}return!1}function En(c){return c.replace(/\s+/gu," ").trim()}function A(c){const m=Yt(c);if(!m)return null;if(c.method==="turn/started")return{threadId:m,activity:{label:"Thinking",details:[]}};if(c.method==="item/started"){const w=Me(c.params),I=Me(w==null?void 0:w.item),q=Oe(I==null?void 0:I.type).toLowerCase();if(q==="reasoning")return{threadId:m,activity:{label:"Thinking",details:[]}};if(q==="agentmessage")return{threadId:m,activity:{label:"Writing response",details:[]}};if(q==="commandexecution"){const se=Oe(I==null?void 0:I.command);return{threadId:m,activity:{label:"Running command",details:se?[se]:[]}}}}return c.method==="item/commandExecution/outputDelta"?{threadId:m,activity:{label:"Running command",details:[]}}:c.method==="item/reasoning/summaryTextDelta"||c.method==="item/reasoning/summaryPartAdded"?{threadId:m,activity:{label:"Thinking",details:[]}}:c.method==="item/agentMessage/delta"?{threadId:m,activity:{label:"Writing response",details:[]}}:null}function U(c){if(c.method!=="turn/started")return null;const m=Me(c.params);if(!m)return null;const w=Yt(c);if(!w)return null;const I=Me(m.turn),q=Oe(I==null?void 0:I.id)||Oe(m.turnId)||`${w}:unknown`;if(!q)return null;const se=ts(Oe(I==null?void 0:I.startedAt))??ts(Oe(m.startedAt))??ts(c.atIso)??Date.now();return{threadId:w,turnId:q,startedAtMs:se}}function ie(c){if(c.method!=="turn/completed")return null;const m=Me(c.params);if(!m)return null;const w=Yt(c);if(!w)return null;const I=Me(m.turn),q=Oe(I==null?void 0:I.id)||Oe(m.turnId)||`${w}:unknown`;if(!q)return null;const se=ts(Oe(I==null?void 0:I.completedAt))??ts(Oe(m.completedAt))??ts(c.atIso)??Date.now(),ue=ts(Oe(I==null?void 0:I.startedAt))??ts(Oe(m.startedAt))??void 0;return{threadId:w,turnId:q,completedAtMs:se,startedAtMs:ue}}function Ne(c){return`${c}:live-reasoning`}function it(c){const m=Me(c.params);if(!m)return"";if(c.method==="item/started"){const w=Me(m.item);return!w||w.type!=="reasoning"?"":Oe(w.id)}return""}function gt(c){const m=Me(c.params);if(!m)return null;if(c.method==="item/reasoning/summaryTextDelta"){const w=Oe(m.itemId),I=Oe(m.delta);return!w||!I?null:{messageId:Ne(w),delta:I}}return null}function at(c){const m=Me(c.params);if(!m)return"";if(c.method==="item/reasoning/summaryPartAdded"){const w=Oe(m.itemId);return w?Ne(w):""}return""}function Ut(c){const m=Me(c.params);if(!m)return"";if(c.method==="item/completed"){const w=Me(m.item);return!w||w.type!=="reasoning"?"":Ne(Oe(w.id))}return""}function on(c){const m=Me(c.params);if(!m)return"";if(c.method==="item/started"){const w=Me(m.item);return!w||w.type!=="agentMessage"?"":Oe(w.id)}return""}function Gn(c){const m=Me(c.params);if(!m)return null;if(c.method==="item/agentMessage/delta"){const w=Oe(m.itemId),I=Oe(m.delta);return!w||!I?null:{messageId:w,delta:I}}return null}function Gr(c){const m=Me(c.params);if(!m)return null;if(c.method==="item/completed"){const w=Me(m.item);if(!w||w.type!=="agentMessage")return null;const I=Oe(w.id),q=Oe(w.text);return!I||!q?null:{id:I,role:"assistant",text:q,messageType:"agentMessage.live"}}return null}function Kr(c){if(c.method!=="item/started")return null;const m=Me(c.params),w=Me(m==null?void 0:m.item);if(!w||w.type!=="commandExecution")return null;const I=Oe(w.id),q=Oe(w.command);if(!I)return null;const se=typeof w.cwd=="string"?w.cwd:null;return{id:I,role:"system",text:q,messageType:"commandExecution",commandExecution:{command:q,cwd:se,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Jr(c){if(c.method!=="item/commandExecution/outputDelta")return null;const m=Me(c.params);if(!m)return null;const w=Oe(m.itemId),I=Oe(m.delta);return!w||!I?null:{itemId:w,delta:I}}function ps(c){if(c.method!=="item/completed")return null;const m=Me(c.params),w=Me(m==null?void 0:m.item);if(!w||w.type!=="commandExecution")return null;const I=Oe(w.id),q=Oe(w.command);if(!I)return null;const se=typeof w.cwd=="string"?w.cwd:null,ue=Oe(w.status),Ie=ue==="failed"?"failed":ue==="declined"?"declined":ue==="interrupted"?"interrupted":"completed",me=typeof w.aggregatedOutput=="string"?w.aggregatedOutput:"",st=typeof w.exitCode=="number"?w.exitCode:null;return{id:I,role:"system",text:q,messageType:"commandExecution",commandExecution:{command:q,cwd:se,status:Ie,aggregatedOutput:me,exitCode:st}}}function Xt(c,m){const w=a.value[c]??[],I=Na(w,m);I!==w&&(a.value={...a.value,[c]:I})}function Yr(c,m){const w=a.value[c];if(!w||w.length===0)return;const I=new Set(m.map(se=>se.id)),q=w.filter(se=>!I.has(se.id));q.length!==w.length&&(q.length===0?a.value=ln(a.value,c):a.value={...a.value,[c]:q})}function ms(c){if(c.method==="item/agentMessage/delta")return!0;const m=Me(c.params);if(!m)return!1;if(c.method==="item/completed"){const w=Me(m.item);return(w==null?void 0:w.type)==="agentMessage"}return!1}function gs(c){var oe,qe,lt,Je,Jt;if(In(c))return;if(c.method==="thread/name/updated"){const Ze=Me(c.params),Dn=Oe(Ze==null?void 0:Ze.threadId),ws=Oe(Ze==null?void 0:Ze.threadName);Dn&&ws&&(Ge.value={...Ge.value,[Dn]:ws},Ke(),Ta(Dn,ws))}if(c.method==="account/rateLimits/updated"){Ee(Kf(c.params));return}const m=A(c);m&&xt(m.threadId,m.activity);const w=U(c);w&&(ge.set(w.turnId,w),ce.value={...ce.value,[w.threadId]:w.turnId},dn(w.threadId),kt(w.threadId,null),Rt(w.threadId,null),mt(w.threadId,!0),u.value[w.threadId]&&(u.value=ln(u.value,w.threadId)));const I=ie(c),q=zn(c),ue=!!((I==null?void 0:I.threadId)??Yt(c))&&!!q&&$.value!==Qn&&ai(new Error(q));if(I){const Ze=ge.get(I.turnId);Ze&&ge.delete(I.turnId);const Dn=Sn((oe=Me(c.params))==null?void 0:oe.durationMs)??Sn((lt=Me((qe=Me(c.params))==null?void 0:qe.turn))==null?void 0:lt.durationMs)??(typeof I.startedAtMs=="number"?I.completedAtMs-I.startedAtMs:null)??(Ze?I.completedAtMs-Ze.startedAtMs:null),ws=typeof Dn=="number"?Math.max(0,Dn):0;kt(I.threadId,{turnId:I.turnId,durationMs:ws}),ce.value[I.threadId]&&(ce.value=ln(ce.value,I.threadId)),mt(I.threadId,!1),xt(I.threadId,null),rn(I.threadId),ue||(xe(I.threadId),dr(I.threadId))}if(q){const Ze=(I==null?void 0:I.threadId)||Yt(c);Ze&&Rt(Ze,q),Be.value=q,Ze&&ue&&ze(Ze)}else I&&Rt(I.threadId,null);const Ie=Hn(c);if(Ie){const Ze=Yt(c);Ze&&Rt(Ze,Ie),Be.value=Ie,$.value!==Qn&&ai(new Error(Ie))&&(Ze?ze(Ze):we())}const me=Yt(c),st=Un(c);st&&(Dt(st.threadId,st.message),xt(st.threadId,{label:"Planning",details:((Je=st.message.plan)==null?void 0:Je.steps.map(Ze=>Ze.step).slice(0,2))??[]}));const jt=Nn(c);if(jt&&(Dt(jt.threadId,jt.message),xt(jt.threadId,{label:"Planning",details:[]})),!me||me!==n.value)return;on(c);const Qt=Gn(c);if(Qt){const Ze=(o.value[me]??[]).find(ws=>ws.id===Qt.messageId),Dn=`${(Ze==null?void 0:Ze.text)??""}${Qt.delta}`;sn(me,{id:Qt.messageId,role:"assistant",text:Dn,messageType:"agentMessage.live"})}const Wn=Gr(c);Wn&&sn(me,Wn),it(c);const fr=gt(c);if(fr&&un(me,fr.delta),at(c)){const Ze=i.value[me]??"";Ze.trim().length>0&&!Ze.endsWith(`
1449
+
1450
+ `)&&Tn(me,`${Ze}
1451
+
1452
+ `)}Ut(c);const uo=Kr(c);uo&&(Xt(me,uo),xt(me,{label:"Running command",details:[((Jt=uo.commandExecution)==null?void 0:Jt.command)??""]}));const b=Jr(c);if(b){const Ze=(a.value[me]??[]).find(Dn=>Dn.id===b.itemId);Ze!=null&&Ze.commandExecution&&Xt(me,{...Ze,commandExecution:{...Ze.commandExecution,aggregatedOutput:`${Ze.commandExecution.aggregatedOutput}${b.delta}`}})}const j=ps(c);if(j&&Xt(me,j),ms(c)&&(he&&n.value&&Wt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Fn(me)),c.method==="turn/completed"){he=!1,Fn(me),a.value[me]&&(a.value=ln(a.value,me));const Ze=Yt(c);Ze&&(mt(Ze,!1),xt(Ze,null),rn(Ze),ue||(xe(Ze),dr(Ze)))}}function Ir(c){const m=Yt(c);m&&W.add(m);const w=c.method;(w.startsWith("thread/")||w.startsWith("turn/")||w.startsWith("item/"))&&(He=!0),!(ut!==null||typeof window>"u")&&(ut=window.setTimeout(()=>{ut=null,h()},Pa))}async function vs(c){if(!_e){_e=!0;try{const m=await yo(),w=[];for(const I of m.order){const q=Ws(I);w.includes(q)||w.push(q)}if(w.length>0){const I=ii(w,c);As(ee.value,I)||(ee.value=I,Hs(ee.value))}if(Object.keys(m.labels).length>0){const I={...te.value};let q=!1;for(const[se,ue]of Object.entries(m.labels)){const Ie=Ws(se);I[Ie]!==ue&&(I[Ie]=ue,q=!0)}q&&(te.value=I,$a(I))}}catch{}}}async function S(){if(!(Object.keys(Ge.value).length>0))try{const c=await m0();Object.keys(c.titles).length>0&&(Ge.value=c.titles)}catch{}}async function R(c,m,w){if(Ge.value[c])return;const I=m.trim();if(!I)return;const q=I.length>300?I.slice(0,300):I;try{const se=await g0(q,w);if(!se||Ge.value[c])return;Ge.value={...Ge.value,[c]:se},Ke(),Ta(c,se)}catch{}}async function P(){var c;Ht.value||(Ue.value=!0);try{const[m]=await Promise.all([Vk(),S()]);await vs(m);const w=ii(ee.value,m);As(ee.value,w)||(ee.value=w,Hs(ee.value));const I=Oa(m,ee.value),q=HA(t.value,I,l.value);t.value=li(t.value,q),l.value=gn(l.value,new Set(ss(t.value).map(Ie=>Ie.id))),Ke(),Ht.value=!0;const se=ss(e.value);Vt(se),se.some(Ie=>Ie.id===n.value)||H(((c=se[0])==null?void 0:c.id)??"")}finally{Ue.value=!1}}async function X(c,m={}){if(!c)return;const w=ve.value[c]===!0,I=m.silent!==!0&&!w;I&&(Re.value=!0);try{ye.value[c]!==!0&&(await _a(c),ye.value={...ye.value,[c]:!0});const{messages:q,inProgress:se}=await zk(c),ue=r.value[c]??[],Ie=RA(ue,q,{preserveMissing:m.silent===!0});On(c,Ie);const me=o.value[c]??[],st=PA(me,q);Mt(c,st),Yr(c,q),ve.value={...ve.value,[c]:!0};const jt=$n(c);jt&&(Te.value={...Te.value,[c]:jt}),mt(c,se),se||dn(c),dt(c)}finally{I&&(Re.value=!1)}}async function Fe(c,m={}){c&&ve.value[c]!==!0&&await X(c,m)}async function wt(){try{const c=t.value.flatMap(m=>m.threads.map(w=>w.cwd)).filter(Boolean);Ve.value=await v0(c.length>0?[...new Set(c)]:void 0)}catch{}}async function Kt(){try{Ee(await Jk())}catch{}}async function fn(c={}){Be.value="";const m=c.includeSelectedThreadMessages!==!1,w=c.awaitAncillaryRefreshes===!0;try{await P();const I=Promise.allSettled([_t(),We(),wt(),Kt()]).then(()=>{});m&&await X(n.value),w&&await I}catch(I){Be.value=I instanceof Error?I.message:"Unknown application error"}}async function Zt(c){H(c);try{await X(c)}catch(m){Be.value=m instanceof Error?m.message:"Unknown application error"}}async function an(c){try{await e0(c),await P(),n.value===c&&await X(n.value)}catch(m){Be.value=m instanceof Error?m.message:"Unknown application error"}}async function Kn(c,m){const w=m.trim();if(!(!c||!w))try{await t0(c,w),Ge.value={...Ge.value,[c]:w},Ke(),Ta(c,w)}catch(I){Be.value=I instanceof Error?I.message:"Unknown application error"}}async function Jn(c,m,w=[],I=[],q=[]){if(!c||!m.trim()||w.length>0||I.length>0||q.length>0)return!1;const ue=(ne.value[c]??[]).filter(st=>st.method==="item/tool/requestUserInput");if(ue.length!==1)return!1;const[Ie]=ue,me=Ln(Ie);return me.length!==1?!1:pe({id:Ie.id,result:{answers:{[me[0]]:{answers:[m.trim()]}}}})}async function ur(c,m=[],w=[],I="steer",q=[]){const se=n.value,ue=c.trim();if(!se||!ue&&m.length===0&&q.length===0||await Jn(se,ue,m,w,q))return;const Ie=l.value[se]===!0;if(Ie&&I==="queue"){const me=f.value[se]??[],st=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;f.value={...f.value,[se]:[...me,{id:st,text:ue,imageUrls:m,skills:w,fileAttachments:q,collaborationMode:F.value}]};return}if(Ie){he=!0,Er(se,ue,m,w,q).catch(me=>{const st=me instanceof Error?me.message:"Unknown application error";Rt(se,st),Be.value=st});return}Be.value="",he=!0,kt(se,null),xt(se,{label:"Thinking",details:ht($.value,Y.value,F.value)}),Rt(se,null),mt(se,!0);try{await Er(se,ue,m,w,q)}catch(me){he=!1,mt(se,!1),xt(se,null);const st=me instanceof Error?me.message:"Unknown application error";throw Rt(se,st),Be.value=st,me}}async function Ds(c,m,w=[],I=[],q=[]){const se=c.trim(),ue=m.trim(),Ie=$.value.trim();if(!se&&w.length===0&&q.length===0)return"";rt.value=!0,Be.value="";let me="";try{try{me=await ku(ue||void 0,Ie||void 0)}catch(Wn){if(Ie&&Ie!==Qn&&ai(Wn))await we(),me=await ku(ue||void 0,Qn);else throw Wn}if(!me)return"";Bt(me,ue,se||"[Image]"),ye.value={...ye.value,[me]:!0},H(me),he=!0,kt(me,null),xt(me,{label:"Thinking",details:ht($.value,Y.value,F.value)}),Rt(me,null),mt(me,!0);const st=me,jt=ue||null,Qt=se;return Er(me,se,w,I,q).catch(Wn=>{he=!1,mt(me,!1),xt(me,null);const fr=Wn instanceof Error?Wn.message:"Unknown application error";Rt(me,fr),Be.value=fr}).finally(()=>{rt.value=!1}),R(st,Qt,jt),me}catch(st){he=!1,me&&(mt(me,!1),xt(me,null));const jt=st instanceof Error?st.message:"Unknown application error";throw me&&Rt(me,jt),Be.value=jt,rt.value=!1,st}}async function Er(c,m,w=[],I=[],q=[]){const se=$.value.trim(),ue=Y.value,Ie=F.value,me=m.trim(),st=I.map(Qt=>({name:Qt.name,path:Qt.path})),jt=q.map(Qt=>({...Qt}));ke(c,{text:me,imageUrls:[...w],skills:st,fileAttachments:jt,effort:ue,collaborationMode:Ie,fallbackRetried:!1});try{ye.value[c]!==!0&&await _a(c);try{await ka(c,m,w,se||void 0,ue||void 0,I.length>0?I:void 0,q,Ie)}catch(Qt){if(se&&se!==Qn&&ai(Qt))await we(),ke(c,{text:me,imageUrls:[...w],skills:st,fileAttachments:jt,effort:ue,collaborationMode:Ie,fallbackRetried:!0}),await ka(c,m,w,Qn,ue||void 0,I.length>0?I:void 0,q,Ie);else throw Qt}ye.value={...ye.value,[c]:!0},W.add(c),He=!0,await h()}catch(Qt){throw Qt}}async function dr(c){const m=f.value[c];if(!m||m.length===0)return;const[w,...I]=m;f.value=I.length>0?{...f.value,[c]:I}:ln(f.value,c),rt.value=!0,Be.value="",he=!0,kt(c,null),xt(c,{label:"Thinking",details:ht($.value,Y.value,w.collaborationMode)}),Rt(c,null),mt(c,!0);try{Z(w.collaborationMode),await Er(c,w.text,w.imageUrls,w.skills,w.fileAttachments)}catch{mt(c,!1),xt(c,null)}finally{rt.value=!1}}async function js(){const c=n.value;if(!c||l.value[c]!==!0)return;const m=ce.value[c];Ae.value=!0,Be.value="";try{await i0(c,m),mt(c,!1),xt(c,null),Rt(c,null),ce.value[c]&&(ce.value=ln(ce.value,c)),W.add(c),He=!0,await h()}catch(w){const I=w instanceof Error?w.message:"Failed to interrupt active turn";Rt(c,I),Be.value=I}finally{Ae.value=!1}}function Fs(c,m){c.length===0||(te.value[c]??"")===m||(te.value={...te.value,[c]:m},$a(te.value))}async function Qr(c){var se;if(c.length===0)return;const m=ee.value.filter(ue=>ue!==c);if(As(ee.value,m)||(ee.value=m,Hs(ee.value)),t.value=t.value.filter(ue=>ue.projectName!==c),te.value[c]!==void 0){const ue={...te.value};delete ue[c],te.value=ue,$a(ue)}Ke();const w=ss(e.value);Vt(w),w.some(ue=>ue.id===n.value)||H(((se=w[0])==null?void 0:se.id)??"");const q=new Set;try{const ue=await yo();for(const Ie of ue.order)Ws(Ie)===c&&q.add(Ie);for(const Ie of ue.active)Ws(Ie)===c&&q.add(Ie);for(const Ie of Object.keys(ue.labels))Ws(Ie)===c&&q.add(Ie)}catch{}if(q.size>0)try{const ue=await yo(),Ie=ue.order.filter(jt=>!q.has(jt)),me=ue.active.filter(jt=>!q.has(jt)),st=me.length===0&&Ie.length>0?[Ie[0]]:me;await Su({order:Ie,labels:jA(ue.labels,q),active:st});return}catch{}await p()}function ys(c,m){if(c.length===0||t.value.length===0)return;const w=t.value.map(me=>me.projectName),I=w.indexOf(c);if(I===-1)return;const q=Math.max(0,Math.min(m,w.length-1)),se=EA(w,I,q);if(se===w)return;const ue=ii(se,t.value);ee.value=ue,Hs(ee.value);const Ie=Oa(t.value,ee.value);t.value=li(t.value,Ie),Ke(),p()}function d(c){const m=c.trim();if(!m)return;const w=[m,...ee.value.filter(q=>q!==m)];if(As(ee.value,w))return;ee.value=w,Hs(ee.value);const I=Oa(t.value,ee.value);t.value=li(t.value,I),Ke(),p()}async function p(){var c,m;try{const w=await yo(),I=new Map;for(const ue of w.order){const Ie=Ws(ue);I.has(Ie)||I.set(Ie,ue)}for(const ue of t.value){const Ie=((m=(c=ue.threads[0])==null?void 0:c.cwd)==null?void 0:m.trim())??"";Ie&&I.set(ue.projectName,Ie)}const q=[];for(const ue of ee.value){const Ie=I.get(ue);Ie&&!q.includes(Ie)&&q.push(Ie)}for(const ue of w.order)q.includes(ue)||q.push(ue);const se=w.active.filter(ue=>q.includes(ue));se.length===0&&q.length>0&&se.push(q[0]),await Su({order:q,labels:w.labels,active:se})}catch{}}async function h(){if(ct.value){typeof window<"u"&&ut===null&&(ut=window.setTimeout(()=>{ut=null,h()},Pa));return}ct.value=!0;const c=He,m=new Set(W);He=!1,W.clear();try{c&&await P();const w=n.value;if(!w)return;const I=m.has(w),q=l.value[w]===!0,se=$n(w),ue=Te.value[w]??"",Ie=se.length>0&&se!==ue;(I||q||Ie||c)&&await X(w,{silent:!0})}catch{}finally{ct.value=!1,(He||W.size>0)&&typeof window<"u"&&ut===null&&(ut=window.setTimeout(()=>{ut=null,h()},Pa))}}async function x(){await M(),He=!0,n.value&&W.add(n.value),await h()}function L(){typeof window>"u"||pt||(M(),pt=qk(c=>{if(c.method==="ready"){x();return}gs(c),Ir(c)}))}async function M(){try{const m=(await Kk()).map(w=>mn(w)).filter(w=>w!==null);Ot(m)}catch{}}async function pe(c){try{return await Gk(c.id,{result:c.result,error:c.error}),qn(c.id),!0}catch(m){return Be.value=m instanceof Error?m.message:"Failed to reply to server request",!1}}function V(){pt&&(pt(),pt=null),He=!1,W.clear(),ge.clear(),ut!==null&&typeof window<"u"&&(window.clearTimeout(ut),ut=null),he=!1,r.value={},s.value={},o.value={},i.value={},a.value={},le.value={},De.value={},re.value={},ce.value={},f.value={},Ye.value=null}const Se=de(()=>{const c=n.value;return c?f.value[c]??[]:[]});function $e(c){const m=n.value;if(!m)return;const w=f.value[m];if(!w)return;const I=w.filter(q=>q.id!==c);f.value=I.length>0?{...f.value,[m]:I}:ln(f.value,m)}function Xe(c){const m=n.value;if(!m)return;const w=f.value[m];if(!w)return;const I=w.find(q=>q.id===c);I&&($e(c),Z(I.collaborationMode),ur(I.text,I.imageUrls,I.skills,"steer",I.fileAttachments))}function $t(c){H(c)}return{projectGroups:e,projectDisplayNameById:te,selectedThread:C,selectedThreadScrollState:O,selectedThreadServerRequests:z,selectedLiveOverlay:J,codexQuota:N,selectedThreadId:n,availableCollaborationModes:_,availableModelIds:g,selectedCollaborationMode:F,selectedModelId:$,selectedReasoningEffort:Y,installedSkills:Ve,messages:B,isLoadingThreads:Ue,isLoadingMessages:Re,isSendingMessage:rt,isInterruptingTurn:Ae,error:Be,refreshAll:fn,refreshSkills:wt,selectThread:Zt,loadMessages:X,ensureThreadMessagesLoaded:Fe,setThreadScrollState:Wt,archiveThreadById:an,renameThreadById:Kn,sendMessageToSelectedThread:ur,sendMessageToNewThread:Ds,interruptSelectedThreadTurn:js,selectedThreadQueuedMessages:Se,removeQueuedMessage:$e,steerQueuedMessage:Xe,setSelectedCollaborationMode:Z,setSelectedModelId:Q,setSelectedReasoningEffort:ot,respondToPendingServerRequest:pe,renameProject:Fs,removeProject:Qr,reorderProject:ys,pinProjectToTop:d,startPolling:L,stopPolling:V,primeSelectedThread:$t}}const qA={class:"sidebar-root"},GA={class:"sidebar-scrollable"},KA=["aria-pressed"],JA={key:1,class:"sidebar-search-bar"},YA={key:0,class:"sidebar-settings-area"},QA={key:0,class:"sidebar-settings-panel"},XA={class:"sidebar-settings-account-section"},ZA={class:"sidebar-settings-account-header"},ex={class:"sidebar-settings-account-header-main"},tx={class:"sidebar-settings-account-count"},nx=["disabled"],rx={key:0,class:"sidebar-settings-account-error"},sx={key:1,class:"sidebar-settings-account-empty"},ox={key:2,class:"sidebar-settings-account-list"},ix=["title","onMouseenter","onMouseleave"],ax={class:"sidebar-settings-account-main"},lx={class:"sidebar-settings-account-email"},cx={class:"sidebar-settings-account-meta"},ux={class:"sidebar-settings-account-quota"},dx={class:"sidebar-settings-account-id"},fx={class:"sidebar-settings-account-actions"},hx=["disabled","onClick"],px=["disabled","onClick"],mx={class:"sidebar-settings-value"},gx={class:"sidebar-settings-value"},vx={class:"content-root"},yx={class:"content-body"},wx={key:1,class:"content-grid"},bx={class:"new-thread-empty"},_x={class:"worktree-init-status-title"},kx={class:"worktree-init-status-message"},Tx={key:2,class:"content-grid"},Sx={class:"content-thread"},Ix={class:"composer-with-queue"},Ex={class:"build-badge","aria-label":"Author name, worktree name, and version"},ad="codex-web-local.sidebar-collapsed.v1",La="codex-web-local.last-active-thread-route.v1",ld="codex-web-local.send-with-enter.v1",cd="codex-web-local.in-progress-send-mode.v1",ud="codex-web-local.dark-mode.v1",dd="codex-web-local.dictation-click-to-toggle.v1",Cx=400,Ax=cn({__name:"App",setup(e){const t="codexui",n="1.0.6",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:f,selectedThreadId:u,availableCollaborationModes:g,availableModelIds:_,selectedCollaborationMode:E,selectedModelId:F,selectedReasoningEffort:$,installedSkills:Y,messages:ae,isLoadingThreads:G,isLoadingMessages:ee,isSendingMessage:te,isInterruptingTurn:Te,refreshAll:ve,refreshSkills:ye,selectThread:De,ensureThreadMessagesLoaded:le,setThreadScrollState:re,archiveThreadById:ce,renameThreadById:ne,sendMessageToSelectedThread:Pe,sendMessageToNewThread:Ye,interruptSelectedThreadTurn:Ge,selectedThreadQueuedMessages:Ve,removeQueuedMessage:Ue,steerQueuedMessage:Re,setSelectedCollaborationMode:rt,setSelectedModelId:Ae,setSelectedReasoningEffort:Be,respondToPendingServerRequest:ct,renameProject:Ht,removeProject:pt,reorderProject:ut,pinProjectToTop:He,startPolling:W,stopPolling:_e,primeSelectedThread:he}=zA(),ge=Mv(),Ce=Pv(),{isMobile:T}=Uf(),C=D(!1),O=D(!1),z=D(""),J=D("local"),N=D({order:[],labels:{}}),B=D({phase:"idle",title:"",message:""}),H=D(se()),Q=D(""),Z=D(!1),Ee=D(null),we=D(null);let ke=null;const xe=D("New Project (1)"),ze=D(""),ot=D(!1),We=D([]),ht=D(!1),_t=D(!1),Pt=D(""),Ke=D(""),Bt=D(""),Vt=D(""),dt=D($e(ld,!0)),kt=D($t()),mt=D(Xe()),rn=D($e(dd,!1)),xt=D(null),Rt=D(!1),$n=D(!1);let Wt=null,On=!1;const Mt=de(()=>{const b=ge.params.threadId;return typeof b=="string"?b:""}),qt=de(()=>{const b=new Set;for(const j of r.value)for(const oe of j.threads)b.add(oe.id);return b}),Dt=de(()=>ge.name==="home"),sn=de(()=>ge.name==="skills"),Tn=de(()=>{var b;return sn.value?"Skills":Dt.value?"New thread":((b=o.value)==null?void 0:b.title)??"Choose a thread"}),un=de(()=>ae.value.filter(b=>{const j=Ie(b.messageType,b.role);return j==="worked"?!0:!(j==="turnActivity.live"||j==="turnError.live"||j==="agentReasoning.live")})),Fn=de(()=>l.value),dn=de(()=>Dt.value?"__new-thread__":u.value),Bn=de(()=>{var b,j;return Dt.value?z.value.trim():((j=(b=o.value)==null?void 0:b.cwd)==null?void 0:j.trim())??""}),er=de(()=>{var b;return!Dt.value&&((b=o.value)==null?void 0:b.inProgress)===!0}),Un=de(()=>te.value||Te.value||er.value||a.value.length>0),Nn=de(()=>{var qe,lt;const b=[],j=new Set;for(const Je of N.value.order){const Jt=Je.trim();!Jt||j.has(Jt)||(j.add(Jt),b.push({value:Jt,label:N.value.labels[Jt]||d(Jt)}))}for(const Je of r.value){const Jt=((lt=(qe=Je.threads[0])==null?void 0:qe.cwd)==null?void 0:lt.trim())??"";!Jt||j.has(Jt)||(j.add(Jt),b.push({value:Jt,label:s.value[Je.projectName]??Je.projectName}))}const oe=z.value.trim();return oe&&!j.has(oe)&&b.unshift({value:oe,label:d(oe)}),b}),Me=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;zr(()=>{window.addEventListener("keydown",X),document.addEventListener("visibilitychange",Fe),window.addEventListener("pageshow",wt),window.addEventListener("focus",Kt),q(),Me==null||Me.addEventListener("change",q),st(),ur(),Fs(),Qr(),dr()}),Wi(()=>{window.removeEventListener("keydown",X),document.removeEventListener("visibilitychange",Fe),window.removeEventListener("pageshow",wt),window.removeEventListener("focus",Kt),Me==null||Me.removeEventListener("change",q),Wt!==null&&(window.clearInterval(Wt),Wt=null),ke&&(clearTimeout(ke),ke=null),_e()}),ft(Q,b=>{const j=b.trim();if(ke&&(clearTimeout(ke),ke=null),!j){we.value=null;return}ke=setTimeout(()=>{p0(j,1e3).then(oe=>{Q.value.trim()===j&&(we.value=oe.threadIds)}).catch(()=>{Q.value.trim()===j&&(we.value=null)})},220)}),ft(We,()=>{if(typeof window>"u")return;if(!We.value.some(j=>j.quotaStatus==="loading")){Wt!==null&&(window.clearInterval(Wt),Wt=null);return}Wt===null&&(Wt=window.setInterval(()=>{On||(On=!0,on({silent:!0}).finally(()=>{On=!1}))},1500))},{deep:!0});function Oe(){ye()}function Sn(){Z.value=!Z.value,Z.value?tn(()=>{var b;return(b=Ee.value)==null?void 0:b.focus()}):Q.value=""}function Yt(){var b;Q.value="",(b=Ee.value)==null||b.focus()}function zn(b){b.key==="Escape"&&(Z.value=!1,Q.value="")}function Hn(b){b&&(ge.name==="thread"&&Mt.value===b||(Ce.push({name:"thread",params:{threadId:b}}),T.value&&P(!0)))}async function mn(b){b&&(u.value!==b&&(await De(b),await Ce.push({name:"thread",params:{threadId:b}})),await tn(),M())}function Ln(b){return b.length>8?b.slice(-8):b}function tr(b){const j=[b.planType||"unknown"];return b.authMode&&j.unshift(b.authMode),j.join(" · ")}function qn(b){if(!b)return!1;const j=b.toLowerCase();return j.includes("payment required")||/\b402\b/.test(j)}function Ot(b){return b.unavailableReason==="payment_required"||qn(b.quotaError)}function In(b){return ht.value||_t.value||Pt.value.length>0||b.isActive&&Pt.value!==b.accountId&&Un.value}function En(b){return Ke.value===b.accountId}function A(b){return Bt.value===b.accountId||En(b)}function U(b){return Ot(b)?"Unavailable":b.isActive?"Active":_t.value?"Switching…":"Switch"}function ie(b){return Pt.value===b.accountId?"Removing…":En(b)?"Click again to remove":"Remove"}function Ne(b){Bt.value=b}function it(b){Bt.value===b&&(Bt.value=""),Pt.value!==b&&Ke.value===b&&(Ke.value="")}function gt(b){const j=b.quotaSnapshot;if(!j)return null;const oe=[j==null?void 0:j.primary,j==null?void 0:j.secondary].filter(Je=>Je!==null),qe=oe.find(Je=>Je.windowMinutes===10080);if(qe)return qe;const lt=oe.filter(Je=>typeof Je.windowMinutes=="number"&&Je.windowMinutes>=10080).sort((Je,Jt)=>(Je.windowMinutes??0)-(Jt.windowMinutes??0))[0]??null;return lt||(j.secondary??null)}function at(b){var qe,lt;if(Ot(b))return b.quotaError||"402 Payment Required";const j=b.quotaSnapshot,oe=gt(b);return oe?`${Math.max(0,Math.min(100,100-Math.round(oe.usedPercent)))}% weekly remaining`:(qe=j==null?void 0:j.credits)!=null&&qe.unlimited?"Unlimited credits":(lt=j==null?void 0:j.credits)!=null&&lt.hasCredits&&j.credits.balance?`${j.credits.balance} credits`:b.quotaStatus==="loading"?"Loading quota…":b.quotaStatus==="error"?b.quotaError||"Quota unavailable":"Fetching account details…"}function Ut(b){return[b.email||"Account",tr(b),Ot(b)?"Unavailable account":null,at(b),`Workspace ${b.accountId}`].filter(Boolean).join(`
1453
+ `)}async function on(b={}){try{const j=await Yk();We.value=j.accounts,j.accounts.some(oe=>oe.accountId===Bt.value)||(Bt.value=""),j.accounts.some(oe=>oe.accountId===Ke.value)||(Ke.value="")}catch(j){if(b.silent===!0)return;Vt.value=j instanceof Error?j.message:"Failed to load accounts"}}async function Gn(){if(!(ht.value||_t.value)){Vt.value="",Bt.value="",Ke.value="",ht.value=!0;try{const b=await Qk();We.value=b.accounts,_e(),W(),ve({includeSelectedThreadMessages:!0})}catch(b){Vt.value=b instanceof Error?b.message:"Failed to refresh accounts"}finally{ht.value=!1}}}async function Gr(b){if(!(_t.value||ht.value)){if(Un.value){Vt.value="Finish the current turn and pending requests before switching accounts.";return}Vt.value="",Bt.value="",Ke.value="",_t.value=!0;try{const j=await Xk(b);We.value=We.value.map(oe=>oe.accountId===b?j:{...oe,isActive:!1}),_e(),W(),ve({includeSelectedThreadMessages:!0}),on({silent:!0})}catch(j){Vt.value=j instanceof Error?j.message:"Failed to switch account"}finally{_t.value=!1}}}async function Kr(b){if(ht.value||_t.value||Pt.value.length>0)return;const j=We.value.find(qe=>qe.accountId===b)??null;if(!j)return;if(Ke.value!==b){Ke.value=b;return}if(j.isActive&&Un.value){Vt.value="Finish the current turn and pending requests before removing the active account.";return}const oe=j.isActive;Vt.value="",Ke.value="",Pt.value=b;try{const qe=await Zk(b);We.value=qe.accounts,_e(),W(),oe&&ve({includeSelectedThreadMessages:!0}),on({silent:!0})}catch(qe){Vt.value=qe instanceof Error?qe.message:"Failed to remove account"}finally{Pt.value=""}}function Jr(b){ce(b)}function ps(b){var qe,lt;const j=r.value.find(Je=>Je.projectName===b),oe=((lt=(qe=j==null?void 0:j.threads[0])==null?void 0:qe.cwd)==null?void 0:lt.trim())??"";oe&&(z.value=oe),T.value&&P(!0),!Dt.value&&Ce.push({name:"home"})}function Xt(b){var qe,lt;const j=r.value.find(Je=>Je.projectName===b),oe=((lt=(qe=j==null?void 0:j.threads[0])==null?void 0:qe.cwd)==null?void 0:lt.trim())??"";!oe||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(oe)}`,"_blank","noopener,noreferrer")}function Yr(){var j,oe;const b=((oe=(j=o.value)==null?void 0:j.cwd)==null?void 0:oe.trim())??"";b&&(z.value=b),T.value&&P(!0),!Dt.value&&Ce.push({name:"home"})}function ms(b){Ht(b.projectName,b.displayName)}function gs(b){ne(b.threadId,b.title)}async function Ir(b){await pt(b),await Qr(),dr()}function vs(b){ut(b.projectName,b.toIndex)}function S(b){re(b.threadId,b.state)}function R(b){ct(b)}function P(b){H.value!==b&&(H.value=b,ue(b))}function X(b){b.defaultPrevented||!b.ctrlKey&&!b.metaKey||b.shiftKey||b.altKey||b.key.toLowerCase()==="b"&&(b.preventDefault(),P(!H.value))}function Fe(){if(!(typeof document>"u")&&T.value){if(document.visibilityState==="hidden"){xt.value=Date.now(),Rt.value=!1;return}fn()}}function wt(b){b.persisted&&fn()}function Kt(){fn()}function fn(){typeof window>"u"||typeof document>"u"||!T.value||document.visibilityState!=="visible"||Rt.value||xt.value===null||Date.now()-xt.value<Cx||(Rt.value=!0,xt.value=null,Zt())}async function Zt(){if(!$n.value){$n.value=!0;try{await ve({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await fr(),await Zo()}finally{$n.value=!1}}}function an(b){const j=b.text;if(Dt.value){uo(j,b.imageUrls,b.skills,b.fileAttachments);return}Pe(j,b.imageUrls,b.skills,b.mode,b.fileAttachments)}function Kn(b){z.value=b.trim()}async function Jn(b){const j=b.trim();if(!j)return;const oe=Er(j),qe=await Ds(),lt=oe?j:p(qe,j);if(lt)try{const Je=await Iu(lt,{createIfMissing:!oe,label:oe?"":j});Je&&(z.value=Je,He(d(Je)),Qr(),dr())}catch{}}async function ur(){var j;if(typeof window>"u")return;const b=((j=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:j.trim())??"";if(b)try{const oe=await Iu(b,{createIfMissing:!1,label:""});if(!oe)return;z.value=oe,He(d(oe)),await Ce.replace({name:"home"}),await Qr();const qe=new URL(window.location.href);qe.searchParams.delete("openProjectPath"),window.history.replaceState({},"",qe.toString())}catch{}}async function Ds(){const b=js();if(b)return b;try{const j=await Tu();if(j)return ze.value=j,j}catch{}return""}function Er(b){return b?b.startsWith("~/")||b.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(b):!1}async function dr(){const b=js();if(!b){xe.value="New Project (1)";return}try{const j=await f0(b);xe.value=j.name||"New Project (1)"}catch{xe.value="New Project (1)"}}function js(){var oe,qe;const b=z.value.trim();if(b)return ys(b);const j=((qe=(oe=Nn.value[0])==null?void 0:oe.value)==null?void 0:qe.trim())??"";return j?ys(j):ze.value.trim()}async function Fs(){try{ze.value=await Tu()}catch{ze.value=""}}async function Qr(){try{const b=await yo();N.value={order:[...b.order],labels:{...b.labels}}}catch{N.value={order:[],labels:{}}}}function ys(b){const j=b.trim().replace(/\/+$/,"");if(!j)return"";const oe=j.lastIndexOf("/");return oe<=0?"":j.slice(0,oe)}function d(b){const j=b.trim().replace(/\/+$/,"");if(!j)return"";const oe=j.lastIndexOf("/");return oe<0?j:j.slice(oe+1)}function p(b,j){const oe=b.trim().replace(/\/+$/,""),qe=j.trim().replace(/^\/+/,"");return!oe||!qe?"":`${oe}/${qe}`}function h(b){Ae(b)}function x(b){Be(b)}function L(){Ge()}function M(){if(Dt.value||sn.value||typeof document>"u"||!o.value||un.value.length===0)return;const b=pe(),j=V(),oe=new Blob([b],{type:"text/markdown;charset=utf-8"}),qe=URL.createObjectURL(oe),lt=document.createElement("a");lt.href=qe,lt.download=j,document.body.appendChild(lt),lt.click(),document.body.removeChild(lt),window.setTimeout(()=>URL.revokeObjectURL(qe),0)}function pe(){var oe,qe,lt;const b=[],j=((qe=(oe=o.value)==null?void 0:oe.title)==null?void 0:qe.trim())||"Untitled thread";b.push(`# ${Se(j)}`),b.push(""),b.push(`- Exported: ${new Date().toISOString()}`),b.push(`- Thread ID: ${((lt=o.value)==null?void 0:lt.id)??""}`),b.push(""),b.push("---"),b.push("");for(const Je of un.value){const Jt=Je.role?Je.role.toUpperCase():"MESSAGE";b.push(`## ${Jt}`),b.push("");const Ze=Je.text.trim();if(Ze&&(b.push(Ze),b.push("")),Je.commandExecution&&(b.push("```text"),b.push(`command: ${Je.commandExecution.command}`),b.push(`status: ${Je.commandExecution.status}`),Je.commandExecution.cwd&&b.push(`cwd: ${Je.commandExecution.cwd}`),Je.commandExecution.exitCode!==null&&b.push(`exitCode: ${Je.commandExecution.exitCode}`),b.push(Je.commandExecution.aggregatedOutput||"(no output)"),b.push("```"),b.push("")),Je.fileAttachments&&Je.fileAttachments.length>0){b.push("Attachments:");for(const Dn of Je.fileAttachments)b.push(`- ${Dn.path}`);b.push("")}if(Je.images&&Je.images.length>0){b.push("Images:");for(const Dn of Je.images)b.push(`- ${Dn}`);b.push("")}}return`${b.join(`
1454
+ `).trimEnd()}
1455
+ `}function V(){var lt,Je;const oe=(((Je=(lt=o.value)==null?void 0:lt.title)==null?void 0:Je.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",qe=new Date().toISOString().replace(/[:.]/g,"-");return`${oe}-${qe}.md`}function Se(b){return b.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function $e(b,j){if(typeof window>"u")return j;const oe=window.localStorage.getItem(b);return oe===null?j:oe==="1"}function Xe(){if(typeof window>"u")return"system";const b=window.localStorage.getItem(ud);return b==="light"||b==="dark"?b:"system"}function $t(){return typeof window>"u"?"queue":window.localStorage.getItem(cd)==="steer"?"steer":"queue"}function c(){dt.value=!dt.value,window.localStorage.setItem(ld,dt.value?"1":"0")}function m(){kt.value=kt.value==="steer"?"queue":"steer",window.localStorage.setItem(cd,kt.value)}function w(){const b=["system","light","dark"],j=b.indexOf(mt.value);mt.value=b[(j+1)%b.length],window.localStorage.setItem(ud,mt.value),q()}function I(){rn.value=!rn.value,window.localStorage.setItem(dd,rn.value?"1":"0")}function q(){const b=document.documentElement;if(mt.value==="dark")b.classList.add("dark");else if(mt.value==="light")b.classList.remove("dark");else{const j=window.matchMedia("(prefers-color-scheme: dark)").matches;b.classList.toggle("dark",j)}}function se(){return typeof window>"u"?!1:window.localStorage.getItem(ad)==="1"}function ue(b){typeof window>"u"||window.localStorage.setItem(ad,b?"1":"0")}function Ie(b,j){const oe=(b??"").trim();return oe.length>0?oe:j.trim()||"message"}function me(b){rt(b)}async function st(){await Ce.isReady(),ge.name==="thread"&&Mt.value&&he(Mt.value),W(),await ve({includeSelectedThreadMessages:!0}),on({silent:!0}),await fr(),O.value=!0,await Zo()}function jt(){if(typeof window>"u")return null;try{const b=window.localStorage.getItem(La);if(!b)return null;const j=JSON.parse(b);return!j||j.routeName!=="thread"||typeof j.threadId!="string"||j.threadId.trim().length===0||typeof j.updatedAtIso!="string"||j.updatedAtIso.trim().length===0?null:{routeName:"thread",threadId:j.threadId.trim(),updatedAtIso:j.updatedAtIso}}catch{return null}}function Qt(b){if(typeof window>"u")return;const j=b.trim();if(!j)return;const oe={routeName:"thread",threadId:j,updatedAtIso:new Date().toISOString()};window.localStorage.setItem(La,JSON.stringify(oe))}function Wn(){typeof window>"u"||window.localStorage.removeItem(La)}async function fr(){if(ge.name!=="home")return!1;const b=jt(),j=u.value.trim(),oe=(b==null?void 0:b.threadId)??j;return oe?qt.value.has(oe)?(await Ce.replace({name:"thread",params:{threadId:oe}}),!0):((b==null?void 0:b.threadId)===oe&&Wn(),!1):!1}async function Zo(){if(!C.value){C.value=!0;try{if(ge.name==="home"||ge.name==="skills"){u.value!==""&&await De("");return}if(ge.name==="thread"){const b=Mt.value;if(!b)return;if(!qt.value.has(b)){await Ce.replace({name:"home"});return}u.value!==b?await De(b):le(b,{silent:!0});return}}finally{C.value=!1}}}ft(()=>[ge.name,Mt.value,u.value,O.value],([b,j,oe,qe])=>{if(!qe||b!=="thread")return;const lt=(j||oe).trim();lt&&qt.value.has(lt)&&Qt(lt)}),ft(()=>[ge.name,Mt.value,G.value,qt.value.has(Mt.value),u.value],async()=>{O.value&&await Zo()}),ft(()=>u.value,async b=>{if(O.value&&!C.value&&!(Dt.value||sn.value)){if(!b){ge.name!=="home"&&await Ce.replace({name:"home"});return}ge.name==="thread"&&Mt.value===b||await Ce.replace({name:"thread",params:{threadId:b}})}}),ft(()=>[O.value,ge.name,u.value],([b,j,oe])=>{b&&j==="thread"&&oe&&le(oe,{silent:!0})}),ft(()=>Nn.value,b=>{if(b.length===0){z.value="";return}b.some(oe=>oe.value===z.value)||(z.value=b[0].value),dr()},{immediate:!0}),ft(()=>z.value,()=>{B.value={phase:"idle",title:"",message:""},dr()}),ft(()=>J.value,b=>{b==="local"&&(B.value={phase:"idle",title:"",message:""})}),ft(()=>ge.name,b=>{b!=="home"&&(B.value={phase:"idle",title:"",message:""})}),ft(()=>u.value,()=>{B.value={phase:"idle",title:"",message:""}}),ft(T,b=>{b&&!H.value&&P(!0)});async function uo(b,j=[],oe=[],qe=[]){try{B.value={phase:"idle",title:"",message:""};let lt=z.value;if(J.value==="worktree"){B.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Jt=await d0(z.value);lt=Jt.cwd,z.value=Jt.cwd,B.value={phase:"idle",title:"",message:""}}catch{B.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Je=await Ye(b,lt,j,oe,qe);if(!Je)return;await Ce.replace({name:"thread",params:{threadId:Je}})}catch{}}return(b,j)=>(y(),k(Le,null,[je(jv,{"is-sidebar-collapsed":H.value,onCloseSidebar:j[6]||(j[6]=oe=>P(!0))},{sidebar:It(()=>[v("section",qA,[v("div",GA,[H.value?fe("",!0):(y(),bt(rd,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":H.value,"show-new-thread-button":!0,onToggleSidebar:j[0]||(j[0]=oe=>P(!H.value)),onStartNewThread:Yr},{default:It(()=>[v("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Z.value,"aria-label":"Search threads",title:"Search threads",onClick:Sn},[je(ol,{class:"sidebar-search-toggle-icon"})],8,KA)]),_:1},8,["is-sidebar-collapsed"])),!H.value&&Z.value?(y(),k("div",JA,[je(ol,{class:"sidebar-search-bar-icon"}),Br(v("input",{ref_key:"sidebarSearchInputRef",ref:Ee,"onUpdate:modelValue":j[1]||(j[1]=oe=>Q.value=oe),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:zn},null,544),[[Ur,Q.value]]),Q.value.length>0?(y(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Yt},[je(Hl,{class:"sidebar-search-clear-icon"})])):fe("",!0)])):fe("",!0),H.value?fe("",!0):(y(),k("button",{key:2,class:tt(["sidebar-skills-link",{"is-active":sn.value}]),type:"button",onClick:j[2]||(j[2]=oe=>{be(Ce).push({name:"skills"}),be(T)&&P(!0)})}," Skills Hub ",2)),H.value?fe("",!0):(y(),bt(Tw,{key:3,groups:be(r),"project-display-name-by-id":be(s),"selected-thread-id":be(u),"is-loading":be(G),"search-query":Q.value,"search-matched-thread-ids":we.value,onSelect:Hn,onArchive:Jr,onStartNewThread:ps,onRenameProject:ms,onBrowseProjectFiles:Xt,onRenameThread:gs,onRemoveProject:Ir,onReorderProject:vs,onExportThread:mn},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),H.value?fe("",!0):(y(),k("div",YA,[je(Af,{name:"settings-panel"},{default:It(()=>[ot.value?(y(),k("div",QA,[v("div",XA,[v("div",ZA,[v("div",ex,[j[7]||(j[7]=v("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),v("span",tx,K(We.value.length),1)]),v("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:ht.value||_t.value,onClick:Gn},K(ht.value?"Reloading…":"Reload"),9,nx)]),Vt.value?(y(),k("p",rx,K(Vt.value),1)):fe("",!0),We.value.length===0?(y(),k("p",sx," Run `codex login`, then click reload. ")):(y(),k("div",ox,[(y(!0),k(Le,null,vt(We.value,oe=>(y(),k("article",{key:oe.accountId,class:tt(["sidebar-settings-account-item",{"is-active":oe.isActive,"is-unavailable":Ot(oe),"is-confirming-remove":En(oe),"is-remove-visible":A(oe)}]),title:Ut(oe),onMouseenter:qe=>Ne(oe.accountId),onMouseleave:qe=>it(oe.accountId)},[v("div",ax,[v("p",lx,K(oe.email||"Account"),1),v("p",cx,K(tr(oe)),1),v("p",ux,K(at(oe)),1),v("p",dx," Workspace "+K(Ln(oe.accountId)),1)]),v("div",fx,[v("button",{class:"sidebar-settings-account-switch",type:"button",disabled:In(oe)||oe.isActive||Ot(oe),onClick:qe=>Gr(oe.accountId)},K(U(oe)),9,hx),v("button",{class:tt(["sidebar-settings-account-remove",{"is-visible":A(oe),"is-confirming":En(oe)}]),type:"button",disabled:In(oe),onClick:qe=>Kr(oe.accountId)},K(ie(oe)),11,px)])],42,ix))),128))]))]),v("button",{class:"sidebar-settings-row",type:"button",onClick:c},[j[8]||(j[8]=v("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),v("span",{class:tt(["sidebar-settings-toggle",{"is-on":!dt.value}])},null,2)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:m},[j[9]||(j[9]=v("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),v("span",mx,K(kt.value==="steer"?"Steer":"Queue"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:w},[j[10]||(j[10]=v("span",{class:"sidebar-settings-label"},"Appearance",-1)),v("span",gx,K(mt.value==="system"?"System":mt.value==="dark"?"Dark":"Light"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:I},[j[11]||(j[11]=v("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),v("span",{class:tt(["sidebar-settings-toggle",{"is-on":rn.value}])},null,2)])])):fe("",!0)]),_:1}),v("button",{class:"sidebar-settings-button",type:"button",onClick:j[3]||(j[3]=oe=>ot.value=!ot.value)},[je(gA,{class:"sidebar-settings-icon"}),j[12]||(j[12]=v("span",null,"Settings",-1))])]))])]),content:It(()=>[v("section",vx,[je(xw,{title:Tn.value},{leading:It(()=>[H.value||be(T)?(y(),bt(rd,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":H.value,"show-new-thread-button":!0,onToggleSidebar:j[4]||(j[4]=oe=>P(!H.value)),onStartNewThread:Yr},null,8,["is-sidebar-collapsed"])):fe("",!0)]),_:1},8,["title"]),v("section",yx,[sn.value?(y(),bt(tA,{key:0,onSkillsChanged:Oe})):Dt.value?(y(),k("div",wx,[v("div",bx,[j[13]||(j[13]=v("p",{class:"new-thread-hero"},"Let's build",-1)),je(sl,{class:"new-thread-folder-dropdown","model-value":z.value,options:Nn.value,placeholder:"Choose folder","enable-search":!0,"search-placeholder":"Quick search project","show-add-action":!0,"add-action-label":"+ Add new project","default-add-value":xe.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":Kn,onAdd:Jn},null,8,["model-value","options","default-add-value"]),je(aS,{class:"new-thread-runtime-dropdown",modelValue:J.value,"onUpdate:modelValue":j[5]||(j[5]=oe=>J.value=oe)},null,8,["modelValue"]),B.value.phase!=="idle"?(y(),k("div",{key:0,class:tt(["worktree-init-status",{"is-running":B.value.phase==="running","is-error":B.value.phase==="error"}])},[v("strong",_x,K(B.value.title),1),v("span",kx,K(B.value.message),1)],2)):fe("",!0)]),je(Au,{"active-thread-id":dn.value,cwd:Bn.value,"collaboration-modes":be(g),"selected-collaboration-mode":be(E),models:be(_),"selected-model":be(F),"selected-reasoning-effort":be($),skills:be(Y),"codex-quota":be(f),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":dt.value,"in-progress-submit-mode":kt.value,"dictation-click-to-toggle":rn.value,onSubmit:an,"onUpdate:selectedCollaborationMode":me,"onUpdate:selectedModel":h,"onUpdate:selectedReasoningEffort":x},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])):(y(),k("div",Tx,[v("div",Sx,[je(hk,{messages:un.value,"is-loading":be(ee),"active-thread-id":dn.value,cwd:Bn.value,"scroll-state":be(i),"live-overlay":Fn.value,"pending-requests":be(a),onUpdateScrollState:S,onRespondServerRequest:R},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),v("div",Ix,[je(ZT,{messages:be(Ve),onSteer:be(Re),onDelete:be(Ue)},null,8,["messages","onSteer","onDelete"]),je(Au,{"active-thread-id":dn.value,cwd:Bn.value,"collaboration-modes":be(g),"selected-collaboration-mode":be(E),models:be(_),"selected-model":be(F),"selected-reasoning-effort":be($),skills:be(Y),"codex-quota":be(f),"is-turn-in-progress":er.value,"is-interrupting-turn":be(Te),"has-queue-above":be(Ve).length>0,"send-with-enter":dt.value,"in-progress-submit-mode":kt.value,"dictation-click-to-toggle":rn.value,"onUpdate:selectedCollaborationMode":me,onSubmit:an,"onUpdate:selectedModel":h,"onUpdate:selectedReasoningEffort":x,onInterrupt:L},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),v("div",Ex," nervmor "+K(be(t))+" · v"+K(be(n)),1)],64))}}),xx=yt(Ax,[["__scopeId","data-v-53c48853"]]),Da={render:()=>null},Rx=Rv({history:lv(),routes:[{path:"/",name:"home",component:Da},{path:"/thread/:threadId",name:"thread",component:Da},{path:"/skills",name:"skills",component:Da},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");_g(xx).use(Rx).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});