@nervmor/codexui 1.0.1 → 1.0.3

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,1441 @@
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 dl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const At={},ks=[],lr=()=>{},cd=()=>!1,hi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),fl=e=>e.startsWith("onUpdate:"),Vt=Object.assign,hl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},qh=Object.prototype.hasOwnProperty,_t=(e,t)=>qh.call(e,t),qe=Array.isArray,Ts=e=>ko(e)==="[object Map]",ud=e=>ko(e)==="[object Set]",tc=e=>ko(e)==="[object Date]",Xe=e=>typeof e=="function",Lt=e=>typeof e=="string",Vn=e=>typeof e=="symbol",kt=e=>e!==null&&typeof e=="object",dd=e=>(kt(e)||Xe(e))&&Xe(e.then)&&Xe(e.catch),fd=Object.prototype.toString,ko=e=>fd.call(e),Kh=e=>ko(e).slice(8,-1),hd=e=>ko(e)==="[object Object]",pl=e=>Lt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ys=dl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),pi=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Jh=/-\w/g,mn=pi(e=>e.replace(Jh,t=>t.slice(1).toUpperCase())),Yh=/\B([A-Z])/g,qr=pi(e=>e.replace(Yh,"-$1").toLowerCase()),mi=pi(e=>e.charAt(0).toUpperCase()+e.slice(1)),Gi=pi(e=>e?`on${mi(e)}`:""),sr=(e,t)=>!Object.is(e,t),Ho=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},pd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ml=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Qh=e=>{const t=Lt(e)?Number(e):NaN;return isNaN(t)?e:t};let nc;const gi=()=>nc||(nc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Wr(e){if(qe(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Lt(r)?tp(r):Wr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Lt(e)||kt(e))return e}const Xh=/;(?![^(]*\))/g,Zh=/:([^]+)/,ep=/\/\*[^]*?\*\//g;function tp(e){const t={};return e.replace(ep,"").split(Xh).forEach(n=>{if(n){const r=n.split(Zh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function at(e){let t="";if(Lt(e))t=e;else if(qe(e))for(let n=0;n<e.length;n++){const r=at(e[n]);r&&(t+=r+" ")}else if(kt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const np="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",rp=dl(np);function md(e){return!!e||e===""}function sp(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=gl(e[r],t[r]);return n}function gl(e,t){if(e===t)return!0;let n=tc(e),r=tc(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Vn(e),r=Vn(t),n||r)return e===t;if(n=qe(e),r=qe(t),n||r)return n&&r?sp(e,t):!1;if(n=kt(e),r=kt(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||!gl(e[i],t[i]))return!1}}return String(e)===String(t)}const gd=e=>!!(e&&e.__v_isRef===!0),H=e=>Lt(e)?e:e==null?"":qe(e)||kt(e)&&(e.toString===fd||!Xe(e.toString))?gd(e)?H(e.value):JSON.stringify(e,vd,2):String(e),vd=(e,t)=>gd(t)?vd(e,t.value):Ts(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[qi(r,o)+" =>"]=s,n),{})}:ud(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>qi(n))}:Vn(t)?qi(t):kt(t)&&!qe(t)&&!hd(t)?String(t):t,qi=(e,t="")=>{var n;return Vn(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 Tn;class op{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=Tn,!t&&Tn&&(this.index=(Tn.scopes||(Tn.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=Tn;try{return Tn=this,t()}finally{Tn=n}}}on(){++this._on===1&&(this.prevScope=Tn,Tn=this)}off(){this._on>0&&--this._on===0&&(Tn=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 ip(){return Tn}let Rt;const Ki=new WeakSet;class yd{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,Tn&&Tn.active&&Tn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ki.has(this)&&(Ki.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||bd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,rc(this),_d(this);const t=Rt,n=Un;Rt=this,Un=!0;try{return this.fn()}finally{kd(this),Rt=t,Un=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)wl(t);this.deps=this.depsTail=void 0,rc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ki.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ra(this)&&this.run()}get dirty(){return Ra(this)}}let wd=0,Qs,Xs;function bd(e,t=!1){if(e.flags|=8,t){e.next=Xs,Xs=e;return}e.next=Qs,Qs=e}function vl(){wd++}function yl(){if(--wd>0)return;if(Xs){let t=Xs;for(Xs=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Qs;){let t=Qs;for(Qs=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 _d(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function kd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),wl(r),ap(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Ra(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Td(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Td(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ao)||(e.globalVersion=ao,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ra(e))))return;e.flags|=2;const t=e.dep,n=Rt,r=Un;Rt=e,Un=!0;try{_d(e);const s=e.fn(e._value);(t.version===0||sr(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Rt=n,Un=r,kd(e),e.flags&=-3}}function wl(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)wl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function ap(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Un=!0;const Sd=[];function Tr(){Sd.push(Un),Un=!1}function Sr(){const e=Sd.pop();Un=e===void 0?!0:e}function rc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Rt;Rt=void 0;try{t()}finally{Rt=n}}}let ao=0;class lp{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 bl{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(!Rt||!Un||Rt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Rt)n=this.activeLink=new lp(Rt,this),Rt.deps?(n.prevDep=Rt.depsTail,Rt.depsTail.nextDep=n,Rt.depsTail=n):Rt.deps=Rt.depsTail=n,Id(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=Rt.depsTail,n.nextDep=void 0,Rt.depsTail.nextDep=n,Rt.depsTail=n,Rt.deps===n&&(Rt.deps=r)}return n}trigger(t){this.version++,ao++,this.notify(t)}notify(t){vl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{yl()}}}function Id(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)Id(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Pa=new WeakMap,cs=Symbol(""),Ma=Symbol(""),lo=Symbol("");function rn(e,t,n){if(Un&&Rt){let r=Pa.get(e);r||Pa.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new bl),s.map=r,s.key=n),s.track()}}function yr(e,t,n,r,s,o){const i=Pa.get(e);if(!i){ao++;return}const a=l=>{l&&l.trigger()};if(vl(),t==="clear")i.forEach(a);else{const l=qe(e),d=l&&pl(n);if(l&&n==="length"){const c=Number(r);i.forEach((p,_)=>{(_==="length"||_===lo||!Vn(_)&&_>=c)&&a(p)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),d&&a(i.get(lo)),t){case"add":l?d&&a(i.get("length")):(a(i.get(cs)),Ts(e)&&a(i.get(Ma)));break;case"delete":l||(a(i.get(cs)),Ts(e)&&a(i.get(Ma)));break;case"set":Ts(e)&&a(i.get(cs));break}}yl()}function ms(e){const t=gt(e);return t===e?t:(rn(t,"iterate",lo),Nn(e)?t:t.map(zn))}function vi(e){return rn(e=gt(e),"iterate",lo),e}function nr(e,t){return Ir(e)?Ps(us(e)?zn(t):t):zn(t)}const cp={__proto__:null,[Symbol.iterator](){return Ji(this,Symbol.iterator,e=>nr(this,e))},concat(...e){return ms(this).concat(...e.map(t=>qe(t)?ms(t):t))},entries(){return Ji(this,"entries",e=>(e[1]=nr(this,e[1]),e))},every(e,t){return hr(this,"every",e,t,void 0,arguments)},filter(e,t){return hr(this,"filter",e,t,n=>n.map(r=>nr(this,r)),arguments)},find(e,t){return hr(this,"find",e,t,n=>nr(this,n),arguments)},findIndex(e,t){return hr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return hr(this,"findLast",e,t,n=>nr(this,n),arguments)},findLastIndex(e,t){return hr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return hr(this,"forEach",e,t,void 0,arguments)},includes(...e){return Yi(this,"includes",e)},indexOf(...e){return Yi(this,"indexOf",e)},join(e){return ms(this).join(e)},lastIndexOf(...e){return Yi(this,"lastIndexOf",e)},map(e,t){return hr(this,"map",e,t,void 0,arguments)},pop(){return Ws(this,"pop")},push(...e){return Ws(this,"push",e)},reduce(e,...t){return sc(this,"reduce",e,t)},reduceRight(e,...t){return sc(this,"reduceRight",e,t)},shift(){return Ws(this,"shift")},some(e,t){return hr(this,"some",e,t,void 0,arguments)},splice(...e){return Ws(this,"splice",e)},toReversed(){return ms(this).toReversed()},toSorted(e){return ms(this).toSorted(e)},toSpliced(...e){return ms(this).toSpliced(...e)},unshift(...e){return Ws(this,"unshift",e)},values(){return Ji(this,"values",e=>nr(this,e))}};function Ji(e,t,n){const r=vi(e),s=r[t]();return r!==e&&!Nn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const up=Array.prototype;function hr(e,t,n,r,s,o){const i=vi(e),a=i!==e&&!Nn(e),l=i[t];if(l!==up[t]){const p=l.apply(e,o);return a?zn(p):p}let d=n;i!==e&&(a?d=function(p,_){return n.call(this,nr(e,p),_,e)}:n.length>2&&(d=function(p,_){return n.call(this,p,_,e)}));const c=l.call(i,d,r);return a&&s?s(c):c}function sc(e,t,n,r){const s=vi(e),o=s!==e&&!Nn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(d,c,p){return a&&(a=!1,d=nr(e,d)),n.call(this,d,nr(e,c),p,e)}):n.length>3&&(i=function(d,c,p){return n.call(this,d,c,p,e)}));const l=s[t](i,...r);return a?nr(e,l):l}function Yi(e,t,n){const r=gt(e);rn(r,"iterate",lo);const s=r[t](...n);return(s===-1||s===!1)&&Tl(n[0])?(n[0]=gt(n[0]),r[t](...n)):s}function Ws(e,t,n=[]){Tr(),vl();const r=gt(e)[t].apply(e,n);return yl(),Sr(),r}const dp=dl("__proto__,__v_isRef,__isVue"),Ed=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Vn));function fp(e){Vn(e)||(e=String(e));const t=gt(this);return rn(t,"has",e),t.hasOwnProperty(e)}class Cd{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?kp:Pd:o?Rd:xd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=qe(t);if(!s){let l;if(i&&(l=cp[n]))return l;if(n==="hasOwnProperty")return fp}const a=Reflect.get(t,n,an(t)?t:r);if((Vn(n)?Ed.has(n):dp(n))||(s||rn(t,"get",n),o))return a;if(an(a)){const l=i&&pl(n)?a:a.value;return s&&kt(l)?Oa(l):l}return kt(a)?s?Oa(a):yi(a):a}}class Ad extends Cd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=qe(t)&&pl(n);if(!this._isShallow){const d=Ir(o);if(!Nn(r)&&!Ir(r)&&(o=gt(o),r=gt(r)),!i&&an(o)&&!an(r))return d||(o.value=r),!0}const a=i?Number(n)<t.length:_t(t,n),l=Reflect.set(t,n,r,an(t)?t:s);return t===gt(s)&&(a?sr(r,o)&&yr(t,"set",n,r):yr(t,"add",n,r)),l}deleteProperty(t,n){const r=_t(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&yr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!Vn(n)||!Ed.has(n))&&rn(t,"has",n),r}ownKeys(t){return rn(t,"iterate",qe(t)?"length":cs),Reflect.ownKeys(t)}}class hp extends Cd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const pp=new Ad,mp=new hp,gp=new Ad(!0);const $a=e=>e,$o=e=>Reflect.getPrototypeOf(e);function vp(e,t,n){return function(...r){const s=this.__v_raw,o=gt(s),i=Ts(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,d=s[e](...r),c=n?$a:t?Ps:zn;return!t&&rn(o,"iterate",l?Ma:cs),Vt(Object.create(d),{next(){const{value:p,done:_}=d.next();return _?{value:p,done:_}:{value:a?[c(p[0]),c(p[1])]:c(p),done:_}}})}}function Oo(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function yp(e,t){const n={get(s){const o=this.__v_raw,i=gt(o),a=gt(s);e||(sr(s,a)&&rn(i,"get",s),rn(i,"get",a));const{has:l}=$o(i),d=t?$a:e?Ps:zn;if(l.call(i,s))return d(o.get(s));if(l.call(i,a))return d(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&rn(gt(s),"iterate",cs),s.size},has(s){const o=this.__v_raw,i=gt(o),a=gt(s);return e||(sr(s,a)&&rn(i,"has",s),rn(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=gt(a),d=t?$a:e?Ps:zn;return!e&&rn(l,"iterate",cs),a.forEach((c,p)=>s.call(o,d(c),d(p),i))}};return Vt(n,e?{add:Oo("add"),set:Oo("set"),delete:Oo("delete"),clear:Oo("clear")}:{add(s){const o=gt(this),i=$o(o),a=gt(s),l=!t&&!Nn(s)&&!Ir(s)?a:s;return i.has.call(o,l)||sr(s,l)&&i.has.call(o,s)||sr(a,l)&&i.has.call(o,a)||(o.add(l),yr(o,"add",l,l)),this},set(s,o){!t&&!Nn(o)&&!Ir(o)&&(o=gt(o));const i=gt(this),{has:a,get:l}=$o(i);let d=a.call(i,s);d||(s=gt(s),d=a.call(i,s));const c=l.call(i,s);return i.set(s,o),d?sr(o,c)&&yr(i,"set",s,o):yr(i,"add",s,o),this},delete(s){const o=gt(this),{has:i,get:a}=$o(o);let l=i.call(o,s);l||(s=gt(s),l=i.call(o,s)),a&&a.call(o,s);const d=o.delete(s);return l&&yr(o,"delete",s,void 0),d},clear(){const s=gt(this),o=s.size!==0,i=s.clear();return o&&yr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=vp(s,e,t)}),n}function _l(e,t){const n=yp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(_t(n,s)&&s in r?n:r,s,o)}const wp={get:_l(!1,!1)},bp={get:_l(!1,!0)},_p={get:_l(!0,!1)};const xd=new WeakMap,Rd=new WeakMap,Pd=new WeakMap,kp=new WeakMap;function Tp(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Sp(e){return e.__v_skip||!Object.isExtensible(e)?0:Tp(Kh(e))}function yi(e){return Ir(e)?e:kl(e,!1,pp,wp,xd)}function Md(e){return kl(e,!1,gp,bp,Rd)}function Oa(e){return kl(e,!0,mp,_p,Pd)}function kl(e,t,n,r,s){if(!kt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Sp(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 us(e){return Ir(e)?us(e.__v_raw):!!(e&&e.__v_isReactive)}function Ir(e){return!!(e&&e.__v_isReadonly)}function Nn(e){return!!(e&&e.__v_isShallow)}function Tl(e){return e?!!e.__v_raw:!1}function gt(e){const t=e&&e.__v_raw;return t?gt(t):e}function Ip(e){return!_t(e,"__v_skip")&&Object.isExtensible(e)&&pd(e,"__v_skip",!0),e}const zn=e=>kt(e)?yi(e):e,Ps=e=>kt(e)?Oa(e):e;function an(e){return e?e.__v_isRef===!0:!1}function D(e){return $d(e,!1)}function Ep(e){return $d(e,!0)}function $d(e,t){return an(e)?e:new Cp(e,t)}class Cp{constructor(t,n){this.dep=new bl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:gt(t),this._value=n?t:zn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Nn(t)||Ir(t);t=r?t:gt(t),sr(t,n)&&(this._rawValue=t,this._value=r?t:zn(t),this.dep.trigger())}}function ye(e){return an(e)?e.value:e}const Ap={get:(e,t,n)=>t==="__v_raw"?e:ye(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return an(s)&&!an(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Od(e){return us(e)?e:new Proxy(e,Ap)}class xp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new bl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ao-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Rt!==this)return bd(this,!0),!0}get value(){const t=this.dep.track();return Td(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Rp(e,t,n=!1){let r,s;return Xe(e)?r=e:(r=e.get,s=e.set),new xp(r,s,n)}const No={},Xo=new WeakMap;let rs;function Pp(e,t=!1,n=rs){if(n){let r=Xo.get(n);r||Xo.set(n,r=[]),r.push(e)}}function Mp(e,t,n=At){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,d=re=>s?re:Nn(re)||s===!1||s===0?wr(re,1):wr(re);let c,p,_,I,j=!1,$=!1;if(an(e)?(p=()=>e.value,j=Nn(e)):us(e)?(p=()=>d(e),j=!0):qe(e)?($=!0,j=e.some(re=>us(re)||Nn(re)),p=()=>e.map(re=>{if(an(re))return re.value;if(us(re))return d(re);if(Xe(re))return l?l(re,2):re()})):Xe(e)?t?p=l?()=>l(e,2):e:p=()=>{if(_){Tr();try{_()}finally{Sr()}}const re=rs;rs=c;try{return l?l(e,3,[I]):e(I)}finally{rs=re}}:p=lr,t&&s){const re=p,_e=s===!0?1/0:s;p=()=>wr(re(),_e)}const Z=ip(),ae=()=>{c.stop(),Z&&Z.active&&hl(Z.effects,c)};if(o&&t){const re=t;t=(..._e)=>{re(..._e),ae()}}let V=$?new Array(e.length).fill(No):No;const te=re=>{if(!(!(c.flags&1)||!c.dirty&&!re))if(t){const _e=c.run();if(s||j||($?_e.some((ue,pe)=>sr(ue,V[pe])):sr(_e,V))){_&&_();const ue=rs;rs=c;try{const pe=[_e,V===No?void 0:$&&V[0]===No?[]:V,I];V=_e,l?l(t,3,pe):t(...pe)}finally{rs=ue}}}else c.run()};return a&&a(te),c=new yd(p),c.scheduler=i?()=>i(te,!1):te,I=re=>Pp(re,!1,c),_=c.onStop=()=>{const re=Xo.get(c);if(re){if(l)l(re,4);else for(const _e of re)_e();Xo.delete(c)}},t?r?te(!0):V=c.run():i?i(te.bind(null,!0),!0):c.run(),ae.pause=c.pause.bind(c),ae.resume=c.resume.bind(c),ae.stop=ae,ae}function wr(e,t=1/0,n){if(t<=0||!kt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,an(e))wr(e.value,t,n);else if(qe(e))for(let r=0;r<e.length;r++)wr(e[r],t,n);else if(ud(e)||Ts(e))e.forEach(r=>{wr(r,t,n)});else if(hd(e)){for(const r in e)wr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&wr(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 To(e,t,n,r){try{return r?e(...r):e()}catch(s){wi(s,t,n)}}function Gn(e,t,n,r){if(Xe(e)){const s=To(e,t,n,r);return s&&dd(s)&&s.catch(o=>{wi(o,t,n)}),s}if(qe(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Gn(e[o],t,n,r));return s}}function wi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||At;if(t){let a=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let p=0;p<c.length;p++)if(c[p](e,l,d)===!1)return}a=a.parent}if(o){Tr(),To(o,null,10,[e,l,d]),Sr();return}}$p(e,n,s,r,i)}function $p(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const hn=[];let er=-1;const Ss=[];let Lr=null,ws=0;const Nd=Promise.resolve();let Zo=null;function Wt(e){const t=Zo||Nd;return e?t.then(this?e.bind(this):e):t}function Op(e){let t=er+1,n=hn.length;for(;t<n;){const r=t+n>>>1,s=hn[r],o=co(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Sl(e){if(!(e.flags&1)){const t=co(e),n=hn[hn.length-1];!n||!(e.flags&2)&&t>=co(n)?hn.push(e):hn.splice(Op(t),0,e),e.flags|=1,Dd()}}function Dd(){Zo||(Zo=Nd.then(jd))}function Np(e){qe(e)?Ss.push(...e):Lr&&e.id===-1?Lr.splice(ws+1,0,e):e.flags&1||(Ss.push(e),e.flags|=1),Dd()}function oc(e,t,n=er+1){for(;n<hn.length;n++){const r=hn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;hn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Ld(e){if(Ss.length){const t=[...new Set(Ss)].sort((n,r)=>co(n)-co(r));if(Ss.length=0,Lr){Lr.push(...t);return}for(Lr=t,ws=0;ws<Lr.length;ws++){const n=Lr[ws];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Lr=null,ws=0}}const co=e=>e.id==null?e.flags&2?-1:1/0:e.id;function jd(e){try{for(er=0;er<hn.length;er++){const t=hn[er];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),To(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;er<hn.length;er++){const t=hn[er];t&&(t.flags&=-2)}er=-1,hn.length=0,Ld(),Zo=null,(hn.length||Ss.length)&&jd()}}let Yt=null,Fd=null;function ei(e){const t=Yt;return Yt=e,Fd=e&&e.type.__scopeId||null,t}function wt(e,t=Yt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&si(-1);const o=ei(t);let i;try{i=e(...s)}finally{ei(o),r._d&&si(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Er(e,t){if(Yt===null)return e;const n=Ii(Yt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=At]=t[s];o&&(Xe(o)&&(o={mounted:o,updated:o}),o.deep&&wr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Xr(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&&(Tr(),Gn(l,n,8,[e.el,a,e,t]),Sr())}}function Wo(e,t){if(on){let n=on.provides;const r=on.parent&&on.parent.provides;r===n&&(n=on.provides=Object.create(r)),n[e]=t}}function Hn(e,t,n=!1){const r=xl();if(r||Es){let s=Es?Es._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&&Xe(t)?t.call(r&&r.proxy):t}}const Dp=Symbol.for("v-scx"),Lp=()=>Hn(Dp);function lt(e,t,n){return Bd(e,t,n)}function Bd(e,t,n=At){const{immediate:r,deep:s,flush:o,once:i}=n,a=Vt({},n),l=t&&r||!t&&o!=="post";let d;if(mo){if(o==="sync"){const I=Lp();d=I.__watcherHandles||(I.__watcherHandles=[])}else if(!l){const I=()=>{};return I.stop=lr,I.resume=lr,I.pause=lr,I}}const c=on;a.call=(I,j,$)=>Gn(I,c,j,$);let p=!1;o==="post"?a.scheduler=I=>{tn(I,c&&c.suspense)}:o!=="sync"&&(p=!0,a.scheduler=(I,j)=>{j?I():Sl(I)}),a.augmentJob=I=>{t&&(I.flags|=4),p&&(I.flags|=2,c&&(I.id=c.uid,I.i=c))};const _=Mp(e,t,a);return mo&&(d?d.push(_):l&&_()),_}function jp(e,t,n){const r=this.proxy,s=Lt(e)?e.includes(".")?Ud(r,e):()=>r[e]:e.bind(r,r);let o;Xe(t)?o=t:(o=t.handler,n=t);const i=So(this),a=Bd(s,o.bind(r),n);return i(),a}function Ud(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 Hd=Symbol("_vte"),Wd=e=>e.__isTeleport,Zs=e=>e&&(e.disabled||e.disabled===""),ic=e=>e&&(e.defer||e.defer===""),ac=e=>typeof SVGElement<"u"&&e instanceof SVGElement,lc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Na=(e,t)=>{const n=e&&e.to;return Lt(n)?t?t(n):null:n},Vd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,d){const{mc:c,pc:p,pbc:_,o:{insert:I,querySelector:j,createText:$,createComment:Z}}=d,ae=Zs(t.props);let{shapeFlag:V,children:te,dynamicChildren:re}=t;if(e==null){const _e=t.el=$(""),ue=t.anchor=$("");I(_e,n,r),I(ue,n,r);const pe=(le,se)=>{V&16&&c(te,le,se,s,o,i,a,l)},Me=()=>{const le=t.target=Na(t.props,j),se=Da(le,t,$,I);le&&(i!=="svg"&&ac(le)?i="svg":i!=="mathml"&&lc(le)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(le),ae||(pe(le,se),Vo(t,!1)))};ae&&(pe(n,ue),Vo(t,!0)),ic(t.props)?(t.el.__isMounted=!1,tn(()=>{Me(),delete t.el.__isMounted},o)):Me()}else{if(ic(t.props)&&e.el.__isMounted===!1){tn(()=>{Vd.process(e,t,n,r,s,o,i,a,l,d)},o);return}t.el=e.el,t.targetStart=e.targetStart;const _e=t.anchor=e.anchor,ue=t.target=e.target,pe=t.targetAnchor=e.targetAnchor,Me=Zs(e.props),le=Me?n:ue,se=Me?_e:pe;if(i==="svg"||ac(ue)?i="svg":(i==="mathml"||lc(ue))&&(i="mathml"),re?(_(e.dynamicChildren,re,le,s,o,i,a),Cl(e,t,!0)):l||p(e,t,le,se,s,o,i,a,!1),ae)Me?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Do(t,n,_e,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ce=t.target=Na(t.props,j);ce&&Do(t,ce,null,d,0)}else Me&&Do(t,ue,pe,d,1);Vo(t,ae)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:d,targetAnchor:c,target:p,props:_}=e;if(p&&(s(d),s(c)),o&&s(l),i&16){const I=o||!Zs(_);for(let j=0;j<a.length;j++){const $=a[j];r($,t,n,I,!!$.dynamicChildren)}}},move:Do,hydrate:Fp};function Do(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:d,props:c}=e,p=o===2;if(p&&r(i,t,n),(!p||Zs(c))&&l&16)for(let _=0;_<d.length;_++)s(d[_],t,n,2);p&&r(a,t,n)}function Fp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:d,createText:c}},p){function _(Z,ae){let V=ae;for(;V;){if(V&&V.nodeType===8){if(V.data==="teleport start anchor")t.targetStart=V;else if(V.data==="teleport anchor"){t.targetAnchor=V,Z._lpa=t.targetAnchor&&i(t.targetAnchor);break}}V=i(V)}}function I(Z,ae){ae.anchor=p(i(Z),ae,a(Z),n,r,s,o)}const j=t.target=Na(t.props,l),$=Zs(t.props);if(j){const Z=j._lpa||j.firstChild;t.shapeFlag&16&&($?(I(e,t),_(j,Z),t.targetAnchor||Da(j,t,c,d,a(e)===j?e:null)):(t.anchor=i(e),_(j,Z),t.targetAnchor||Da(j,t,c,d),p(Z&&i(Z),t,j,n,r,s,o))),Vo(t,$)}else $&&t.shapeFlag&16&&(I(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const eo=Vd;function Vo(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 Da(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Hd]=i,e&&(r(o,e,s),r(i,e,s)),i}const tr=Symbol("_leaveCb"),Vs=Symbol("_enterCb");function Bp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Pr(()=>{e.isMounted=!0}),Mr(()=>{e.isUnmounting=!0}),e}const $n=[Function,Array],zd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:$n,onEnter:$n,onAfterEnter:$n,onEnterCancelled:$n,onBeforeLeave:$n,onLeave:$n,onAfterLeave:$n,onLeaveCancelled:$n,onBeforeAppear:$n,onAppear:$n,onAfterAppear:$n,onAppearCancelled:$n},Gd=e=>{const t=e.subTree;return t.component?Gd(t.component):t},Up={name:"BaseTransition",props:zd,setup(e,{slots:t}){const n=xl(),r=Bp();return()=>{const s=t.default&&Jd(t.default(),!0);if(!s||!s.length)return;const o=qd(s),i=gt(e),{mode:a}=i;if(r.isLeaving)return Qi(o);const l=cc(o);if(!l)return Qi(o);let d=La(l,i,r,n,p=>d=p);l.type!==sn&&uo(l,d);let c=n.subTree&&cc(n.subTree);if(c&&c.type!==sn&&!os(c,l)&&Gd(n).type!==sn){let p=La(c,i,r,n);if(uo(c,p),a==="out-in"&&l.type!==sn)return r.isLeaving=!0,p.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete p.afterLeave,c=void 0},Qi(o);a==="in-out"&&l.type!==sn?p.delayLeave=(_,I,j)=>{const $=Kd(r,c);$[String(c.key)]=c,_[tr]=()=>{I(),_[tr]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{j(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function qd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==sn){t=n;break}}return t}const Hp=Up;function Kd(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 La(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:p,onBeforeLeave:_,onLeave:I,onAfterLeave:j,onLeaveCancelled:$,onBeforeAppear:Z,onAppear:ae,onAfterAppear:V,onAppearCancelled:te}=t,re=String(e.key),_e=Kd(n,e),ue=(le,se)=>{le&&Gn(le,r,9,se)},pe=(le,se)=>{const ce=se[1];ue(le,se),qe(le)?le.every(ne=>ne.length<=1)&&ce():le.length<=1&&ce()},Me={mode:i,persisted:a,beforeEnter(le){let se=l;if(!n.isMounted)if(o)se=Z||l;else return;le[tr]&&le[tr](!0);const ce=_e[re];ce&&os(e,ce)&&ce.el[tr]&&ce.el[tr](),ue(se,[le])},enter(le){if(_e[re]===e)return;let se=d,ce=c,ne=p;if(!n.isMounted)if(o)se=ae||d,ce=V||c,ne=te||p;else return;let xe=!1;le[Vs]=Ne=>{xe||(xe=!0,Ne?ue(ne,[le]):ue(ce,[le]),Me.delayedLeave&&Me.delayedLeave(),le[Vs]=void 0)};const je=le[Vs].bind(null,!1);se?pe(se,[le,je]):je()},leave(le,se){const ce=String(e.key);if(le[Vs]&&le[Vs](!0),n.isUnmounting)return se();ue(_,[le]);let ne=!1;le[tr]=je=>{ne||(ne=!0,se(),je?ue($,[le]):ue(j,[le]),le[tr]=void 0,_e[ce]===e&&delete _e[ce])};const xe=le[tr].bind(null,!1);_e[ce]=e,I?pe(I,[le,xe]):xe()},clone(le){const se=La(le,t,n,r,s);return s&&s(se),se}};return Me}function Qi(e){if(bi(e))return e=Gr(e),e.children=null,e}function cc(e){if(!bi(e))return Wd(e.type)&&e.children?qd(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&&Xe(n.default))return n.default()}}function uo(e,t){e.shapeFlag&6&&e.component?(e.transition=t,uo(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 Jd(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===Pe?(i.patchFlag&128&&s++,r=r.concat(Jd(i.children,t,a))):(t||i.type!==sn)&&r.push(a!=null?Gr(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function qt(e,t){return Xe(e)?Vt({name:e.name},t,{setup:e}):e}function Yd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function uc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ti=new WeakMap;function to(e,t,n,r,s=!1){if(qe(e)){e.forEach(($,Z)=>to($,t&&(qe(t)?t[Z]:t),n,r,s));return}if(Is(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&to(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Ii(r.component):r.el,i=s?null:o,{i:a,r:l}=e,d=t&&t.r,c=a.refs===At?a.refs={}:a.refs,p=a.setupState,_=gt(p),I=p===At?cd:$=>uc(c,$)?!1:_t(_,$),j=($,Z)=>!(Z&&uc(c,Z));if(d!=null&&d!==l){if(dc(t),Lt(d))c[d]=null,I(d)&&(p[d]=null);else if(an(d)){const $=t;j(d,$.k)&&(d.value=null),$.k&&(c[$.k]=null)}}if(Xe(l))To(l,a,12,[i,c]);else{const $=Lt(l),Z=an(l);if($||Z){const ae=()=>{if(e.f){const V=$?I(l)?p[l]:c[l]:j()||!e.k?l.value:c[e.k];if(s)qe(V)&&hl(V,o);else if(qe(V))V.includes(o)||V.push(o);else if($)c[l]=[o],I(l)&&(p[l]=c[l]);else{const te=[o];j(l,e.k)&&(l.value=te),e.k&&(c[e.k]=te)}}else $?(c[l]=i,I(l)&&(p[l]=i)):Z&&(j(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const V=()=>{ae(),ti.delete(e)};V.id=-1,ti.set(e,V),tn(V,n)}else dc(e),ae()}}}function dc(e){const t=ti.get(e);t&&(t.flags|=8,ti.delete(e))}gi().requestIdleCallback;gi().cancelIdleCallback;const Is=e=>!!e.type.__asyncLoader,bi=e=>e.type.__isKeepAlive;function Wp(e,t){Qd(e,"a",t)}function Vp(e,t){Qd(e,"da",t)}function Qd(e,t,n=on){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(_i(t,r,n),n){let s=n.parent;for(;s&&s.parent;)bi(s.parent.vnode)&&zp(r,t,n,s),s=s.parent}}function zp(e,t,n,r){const s=_i(t,e,r,!0);ki(()=>{hl(r[t],s)},n)}function _i(e,t,n=on,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Tr();const a=So(n),l=Gn(t,n,e,i);return a(),Sr(),l});return r?s.unshift(o):s.push(o),o}}const Rr=e=>(t,n=on)=>{(!mo||e==="sp")&&_i(e,(...r)=>t(...r),n)},Gp=Rr("bm"),Pr=Rr("m"),qp=Rr("bu"),Kp=Rr("u"),Mr=Rr("bum"),ki=Rr("um"),Jp=Rr("sp"),Yp=Rr("rtg"),Qp=Rr("rtc");function Xp(e,t=on){_i("ec",e,t)}const Zp="components",Xd=Symbol.for("v-ndc");function ni(e){return Lt(e)?em(Zp,e,!1)||e:e||Xd}function em(e,t,n=!0,r=!1){const s=Yt||on;if(s){const o=s.type;{const a=jm(o,!1);if(a&&(a===t||a===mn(t)||a===mi(mn(t))))return o}const i=fc(s[e]||o[e],t)||fc(s.appContext[e],t);return!i&&r?o:i}}function fc(e,t){return e&&(e[t]||e[mn(t)]||e[mi(mn(t))])}function it(e,t,n,r){let s;const o=n,i=qe(e);if(i||Lt(e)){const a=i&&us(e);let l=!1,d=!1;a&&(l=!Nn(e),d=Ir(e),e=vi(e)),s=new Array(e.length);for(let c=0,p=e.length;c<p;c++)s[c]=t(l?d?Ps(zn(e[c])):zn(e[c]):e[c],c,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(kt(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,d=a.length;l<d;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function ar(e,t,n={},r,s){if(Yt.ce||Yt.parent&&Is(Yt.parent)&&Yt.parent.ce){const d=Object.keys(n).length>0;return t!=="default"&&(n.name=t),m(),ht(Pe,null,[$e("slot",n,r)],d?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),m();const i=o&&Zd(o(n)),a=n.key||i&&i.key,l=ht(Pe,{key:(a&&!Vn(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Zd(e){return e.some(t=>ho(t)?!(t.type===sn||t.type===Pe&&!Zd(t.children)):!0)?e:null}const ja=e=>e?bf(e)?Ii(e):ja(e.parent):null,no=Vt(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=>ja(e.parent),$root:e=>ja(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>tf(e),$forceUpdate:e=>e.f||(e.f=()=>{Sl(e.update)}),$nextTick:e=>e.n||(e.n=Wt.bind(e.proxy)),$watch:e=>jp.bind(e)}),Xi=(e,t)=>e!==At&&!e.__isScriptSetup&&_t(e,t),tm={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(Xi(r,t))return i[t]=1,r[t];if(s!==At&&_t(s,t))return i[t]=2,s[t];if(_t(o,t))return i[t]=3,o[t];if(n!==At&&_t(n,t))return i[t]=4,n[t];Fa&&(i[t]=0)}}const d=no[t];let c,p;if(d)return t==="$attrs"&&rn(e.attrs,"get",""),d(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==At&&_t(n,t))return i[t]=4,n[t];if(p=l.config.globalProperties,_t(p,t))return p[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return Xi(s,t)?(s[t]=n,!0):r!==At&&_t(r,t)?(r[t]=n,!0):_t(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!==At&&a[0]!=="$"&&_t(e,a)||Xi(t,a)||_t(o,a)||_t(r,a)||_t(no,a)||_t(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:_t(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function nm(){return rm().slots}function rm(e){const t=xl();return t.setupContext||(t.setupContext=kf(t))}function hc(e){return qe(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Fa=!0;function sm(e){const t=tf(e),n=e.proxy,r=e.ctx;Fa=!1,t.beforeCreate&&pc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:d,created:c,beforeMount:p,mounted:_,beforeUpdate:I,updated:j,activated:$,deactivated:Z,beforeDestroy:ae,beforeUnmount:V,destroyed:te,unmounted:re,render:_e,renderTracked:ue,renderTriggered:pe,errorCaptured:Me,serverPrefetch:le,expose:se,inheritAttrs:ce,components:ne,directives:xe,filters:je}=t;if(d&&om(d,r,null),i)for(const He in i){const Ae=i[He];Xe(Ae)&&(r[He]=Ae.bind(n))}if(s){const He=s.call(n,n);kt(He)&&(e.data=yi(He))}if(Fa=!0,o)for(const He in o){const Ae=o[He],Ze=Xe(Ae)?Ae.bind(n,n):Xe(Ae.get)?Ae.get.bind(n,n):lr,Ke=!Xe(Ae)&&Xe(Ae.set)?Ae.set.bind(n):lr,ot=fe({get:Ze,set:Ke});Object.defineProperty(r,He,{enumerable:!0,configurable:!0,get:()=>ot.value,set:Be=>ot.value=Be})}if(a)for(const He in a)ef(a[He],r,n,He);if(l){const He=Xe(l)?l.call(n):l;Reflect.ownKeys(He).forEach(Ae=>{Wo(Ae,He[Ae])})}c&&pc(c,e,"c");function Ve(He,Ae){qe(Ae)?Ae.forEach(Ze=>He(Ze.bind(n))):Ae&&He(Ae.bind(n))}if(Ve(Gp,p),Ve(Pr,_),Ve(qp,I),Ve(Kp,j),Ve(Wp,$),Ve(Vp,Z),Ve(Xp,Me),Ve(Qp,ue),Ve(Yp,pe),Ve(Mr,V),Ve(ki,re),Ve(Jp,le),qe(se))if(se.length){const He=e.exposed||(e.exposed={});se.forEach(Ae=>{Object.defineProperty(He,Ae,{get:()=>n[Ae],set:Ze=>n[Ae]=Ze,enumerable:!0})})}else e.exposed||(e.exposed={});_e&&e.render===lr&&(e.render=_e),ce!=null&&(e.inheritAttrs=ce),ne&&(e.components=ne),xe&&(e.directives=xe),le&&Yd(e)}function om(e,t,n=lr){qe(e)&&(e=Ba(e));for(const r in e){const s=e[r];let o;kt(s)?"default"in s?o=Hn(s.from||r,s.default,!0):o=Hn(s.from||r):o=Hn(s),an(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function pc(e,t,n){Gn(qe(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function ef(e,t,n,r){let s=r.includes(".")?Ud(n,r):()=>n[r];if(Lt(e)){const o=t[e];Xe(o)&&lt(s,o)}else if(Xe(e))lt(s,e.bind(n));else if(kt(e))if(qe(e))e.forEach(o=>ef(o,t,n,r));else{const o=Xe(e.handler)?e.handler.bind(n):t[e.handler];Xe(o)&&lt(s,o,e)}}function tf(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(d=>ri(l,d,i,!0)),ri(l,t,i)),kt(t)&&o.set(t,l),l}function ri(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&ri(e,o,n,!0),s&&s.forEach(i=>ri(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=im[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const im={data:mc,props:gc,emits:gc,methods:Ks,computed:Ks,beforeCreate:dn,created:dn,beforeMount:dn,mounted:dn,beforeUpdate:dn,updated:dn,beforeDestroy:dn,beforeUnmount:dn,destroyed:dn,unmounted:dn,activated:dn,deactivated:dn,errorCaptured:dn,serverPrefetch:dn,components:Ks,directives:Ks,watch:lm,provide:mc,inject:am};function mc(e,t){return t?e?function(){return Vt(Xe(e)?e.call(this,this):e,Xe(t)?t.call(this,this):t)}:t:e}function am(e,t){return Ks(Ba(e),Ba(t))}function Ba(e){if(qe(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function dn(e,t){return e?[...new Set([].concat(e,t))]:t}function Ks(e,t){return e?Vt(Object.create(null),e,t):t}function gc(e,t){return e?qe(e)&&qe(t)?[...new Set([...e,...t])]:Vt(Object.create(null),hc(e),hc(t??{})):t}function lm(e,t){if(!e)return t;if(!t)return e;const n=Vt(Object.create(null),e);for(const r in t)n[r]=dn(e[r],t[r]);return n}function nf(){return{app:null,config:{isNativeTag:cd,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 cm=0;function um(e,t){return function(r,s=null){Xe(r)||(r=Vt({},r)),s!=null&&!kt(s)&&(s=null);const o=nf(),i=new WeakSet,a=[];let l=!1;const d=o.app={_uid:cm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Bm,get config(){return o.config},set config(c){},use(c,...p){return i.has(c)||(c&&Xe(c.install)?(i.add(c),c.install(d,...p)):Xe(c)&&(i.add(c),c(d,...p))),d},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),d},component(c,p){return p?(o.components[c]=p,d):o.components[c]},directive(c,p){return p?(o.directives[c]=p,d):o.directives[c]},mount(c,p,_){if(!l){const I=d._ceVNode||$e(r,s);return I.appContext=o,_===!0?_="svg":_===!1&&(_=void 0),e(I,c,_),l=!0,d._container=c,c.__vue_app__=d,Ii(I.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Gn(a,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,p){return o.provides[c]=p,d},runWithContext(c){const p=Es;Es=d;try{return c()}finally{Es=p}}};return d}}let Es=null;const dm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${mn(t)}Modifiers`]||e[`${qr(t)}Modifiers`];function fm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||At;let s=n;const o=t.startsWith("update:"),i=o&&dm(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Lt(c)?c.trim():c)),i.number&&(s=n.map(ml)));let a,l=r[a=Gi(t)]||r[a=Gi(mn(t))];!l&&o&&(l=r[a=Gi(qr(t))]),l&&Gn(l,e,6,s);const d=r[a+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Gn(d,e,6,s)}}const hm=new WeakMap;function rf(e,t,n=!1){const r=n?hm:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!Xe(e)){const l=d=>{const c=rf(d,t,!0);c&&(a=!0,Vt(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(kt(e)&&r.set(e,null),null):(qe(o)?o.forEach(l=>i[l]=null):Vt(i,o),kt(e)&&r.set(e,i),i)}function Ti(e,t){return!e||!hi(t)?!1:(t=t.slice(2).replace(/Once$/,""),_t(e,t[0].toLowerCase()+t.slice(1))||_t(e,qr(t))||_t(e,t))}function vc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:d,renderCache:c,props:p,data:_,setupState:I,ctx:j,inheritAttrs:$}=e,Z=ei(e);let ae,V;try{if(n.shapeFlag&4){const re=s||r,_e=re;ae=rr(d.call(_e,re,c,p,I,_,j)),V=a}else{const re=t;ae=rr(re.length>1?re(p,{attrs:a,slots:i,emit:l}):re(p,null)),V=t.props?a:pm(a)}}catch(re){ro.length=0,wi(re,e,1),ae=$e(sn)}let te=ae;if(V&&$!==!1){const re=Object.keys(V),{shapeFlag:_e}=te;re.length&&_e&7&&(o&&re.some(fl)&&(V=mm(V,o)),te=Gr(te,V,!1,!0))}return n.dirs&&(te=Gr(te,null,!1,!0),te.dirs=te.dirs?te.dirs.concat(n.dirs):n.dirs),n.transition&&uo(te,n.transition),ae=te,ei(Z),ae}const pm=e=>{let t;for(const n in e)(n==="class"||n==="style"||hi(n))&&((t||(t={}))[n]=e[n]);return t},mm=(e,t)=>{const n={};for(const r in e)(!fl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function gm(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,d=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?yc(r,i,d):!!i;if(l&8){const c=t.dynamicProps;for(let p=0;p<c.length;p++){const _=c[p];if(sf(i,r,_)&&!Ti(d,_))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?yc(r,i,d):!0:!!i;return!1}function yc(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(sf(t,e,o)&&!Ti(n,o))return!0}return!1}function sf(e,t,n){const r=e[n],s=t[n];return n==="style"&&kt(r)&&kt(s)?!gl(r,s):r!==s}function vm({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 of={},af=()=>Object.create(of),lf=e=>Object.getPrototypeOf(e)===of;function ym(e,t,n,r=!1){const s={},o=af();e.propsDefaults=Object.create(null),cf(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Md(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function wm(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=gt(s),[l]=e.propsOptions;let d=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let p=0;p<c.length;p++){let _=c[p];if(Ti(e.emitsOptions,_))continue;const I=t[_];if(l)if(_t(o,_))I!==o[_]&&(o[_]=I,d=!0);else{const j=mn(_);s[j]=Ua(l,a,j,I,e,!1)}else I!==o[_]&&(o[_]=I,d=!0)}}}else{cf(e,t,s,o)&&(d=!0);let c;for(const p in a)(!t||!_t(t,p)&&((c=qr(p))===p||!_t(t,c)))&&(l?n&&(n[p]!==void 0||n[c]!==void 0)&&(s[p]=Ua(l,a,p,void 0,e,!0)):delete s[p]);if(o!==a)for(const p in o)(!t||!_t(t,p))&&(delete o[p],d=!0)}d&&yr(e.attrs,"set","")}function cf(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Ys(l))continue;const d=t[l];let c;s&&_t(s,c=mn(l))?!o||!o.includes(c)?n[c]=d:(a||(a={}))[c]=d:Ti(e.emitsOptions,l)||(!(l in r)||d!==r[l])&&(r[l]=d,i=!0)}if(o){const l=gt(n),d=a||At;for(let c=0;c<o.length;c++){const p=o[c];n[p]=Ua(s,l,p,d[p],e,!_t(d,p))}}return i}function Ua(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=_t(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Xe(l)){const{propsDefaults:d}=s;if(n in d)r=d[n];else{const c=So(s);r=d[n]=l.call(null,t),c()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===qr(n))&&(r=!0))}return r}const bm=new WeakMap;function uf(e,t,n=!1){const r=n?bm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!Xe(e)){const c=p=>{l=!0;const[_,I]=uf(p,t,!0);Vt(i,_),I&&a.push(...I)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return kt(e)&&r.set(e,ks),ks;if(qe(o))for(let c=0;c<o.length;c++){const p=mn(o[c]);wc(p)&&(i[p]=At)}else if(o)for(const c in o){const p=mn(c);if(wc(p)){const _=o[c],I=i[p]=qe(_)||Xe(_)?{type:_}:Vt({},_),j=I.type;let $=!1,Z=!0;if(qe(j))for(let ae=0;ae<j.length;++ae){const V=j[ae],te=Xe(V)&&V.name;if(te==="Boolean"){$=!0;break}else te==="String"&&(Z=!1)}else $=Xe(j)&&j.name==="Boolean";I[0]=$,I[1]=Z,($||_t(I,"default"))&&a.push(p)}}const d=[i,a];return kt(e)&&r.set(e,d),d}function wc(e){return e[0]!=="$"&&!Ys(e)}const Il=e=>e==="_"||e==="_ctx"||e==="$stable",El=e=>qe(e)?e.map(rr):[rr(e)],_m=(e,t,n)=>{if(t._n)return t;const r=wt((...s)=>El(t(...s)),n);return r._c=!1,r},df=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Il(s))continue;const o=e[s];if(Xe(o))t[s]=_m(s,o,r);else if(o!=null){const i=El(o);t[s]=()=>i}}},ff=(e,t)=>{const n=El(t);e.slots.default=()=>n},hf=(e,t,n)=>{for(const r in t)(n||!Il(r))&&(e[r]=t[r])},km=(e,t,n)=>{const r=e.slots=af();if(e.vnode.shapeFlag&32){const s=t._;s?(hf(r,t,n),n&&pd(r,"_",s,!0)):df(t,r)}else t&&ff(e,t)},Tm=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=At;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:hf(s,t,n):(o=!t.$stable,df(t,s)),i=t}else t&&(ff(e,t),i={default:1});if(o)for(const a in s)!Il(a)&&i[a]==null&&delete s[a]},tn=Am;function Sm(e){return Im(e)}function Im(e,t){const n=gi();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:d,setElementText:c,parentNode:p,nextSibling:_,setScopeId:I=lr,insertStaticContent:j}=e,$=(T,E,O,K=null,q=null,R=null,U=void 0,Y=null,z=!!E.dynamicChildren)=>{if(T===E)return;T&&!os(T,E)&&(K=W(T),Be(T,q,R,!0),T=null),E.patchFlag===-2&&(z=!1,E.dynamicChildren=null);const{type:G,ref:we,shapeFlag:ve}=E;switch(G){case Si:Z(T,E,O,K);break;case sn:ae(T,E,O,K);break;case ea:T==null&&V(E,O,K,U);break;case Pe:ne(T,E,O,K,q,R,U,Y,z);break;default:ve&1?_e(T,E,O,K,q,R,U,Y,z):ve&6?xe(T,E,O,K,q,R,U,Y,z):(ve&64||ve&128)&&G.process(T,E,O,K,q,R,U,Y,z,be)}we!=null&&q?to(we,T&&T.ref,R,E||T,!E):we==null&&T&&T.ref!=null&&to(T.ref,null,R,T,!0)},Z=(T,E,O,K)=>{if(T==null)r(E.el=a(E.children),O,K);else{const q=E.el=T.el;E.children!==T.children&&d(q,E.children)}},ae=(T,E,O,K)=>{T==null?r(E.el=l(E.children||""),O,K):E.el=T.el},V=(T,E,O,K)=>{[T.el,T.anchor]=j(T.children,E,O,K,T.el,T.anchor)},te=({el:T,anchor:E},O,K)=>{let q;for(;T&&T!==E;)q=_(T),r(T,O,K),T=q;r(E,O,K)},re=({el:T,anchor:E})=>{let O;for(;T&&T!==E;)O=_(T),s(T),T=O;s(E)},_e=(T,E,O,K,q,R,U,Y,z)=>{if(E.type==="svg"?U="svg":E.type==="math"&&(U="mathml"),T==null)ue(E,O,K,q,R,U,Y,z);else{const G=T.el&&T.el._isVueCE?T.el:null;try{G&&G._beginPatch(),le(T,E,q,R,U,Y,z)}finally{G&&G._endPatch()}}},ue=(T,E,O,K,q,R,U,Y)=>{let z,G;const{props:we,shapeFlag:ve,transition:ke,dirs:Ie}=T;if(z=T.el=i(T.type,R,we&&we.is,we),ve&8?c(z,T.children):ve&16&&Me(T.children,z,null,K,q,Zi(T,R),U,Y),Ie&&Xr(T,null,K,"created"),pe(z,T,T.scopeId,U,K),we){for(const et in we)et!=="value"&&!Ys(et)&&o(z,et,null,we[et],R,K);"value"in we&&o(z,"value",null,we.value,R),(G=we.onVnodeBeforeMount)&&Zn(G,K,T)}Ie&&Xr(T,null,K,"beforeMount");const Le=Em(q,ke);Le&&ke.beforeEnter(z),r(z,E,O),((G=we&&we.onVnodeMounted)||Le||Ie)&&tn(()=>{G&&Zn(G,K,T),Le&&ke.enter(z),Ie&&Xr(T,null,K,"mounted")},q)},pe=(T,E,O,K,q)=>{if(O&&I(T,O),K)for(let R=0;R<K.length;R++)I(T,K[R]);if(q){let R=q.subTree;if(E===R||gf(R.type)&&(R.ssContent===E||R.ssFallback===E)){const U=q.vnode;pe(T,U,U.scopeId,U.slotScopeIds,q.parent)}}},Me=(T,E,O,K,q,R,U,Y,z=0)=>{for(let G=z;G<T.length;G++){const we=T[G]=Y?vr(T[G]):rr(T[G]);$(null,we,E,O,K,q,R,U,Y)}},le=(T,E,O,K,q,R,U)=>{const Y=E.el=T.el;let{patchFlag:z,dynamicChildren:G,dirs:we}=E;z|=T.patchFlag&16;const ve=T.props||At,ke=E.props||At;let Ie;if(O&&Zr(O,!1),(Ie=ke.onVnodeBeforeUpdate)&&Zn(Ie,O,E,T),we&&Xr(E,T,O,"beforeUpdate"),O&&Zr(O,!0),(ve.innerHTML&&ke.innerHTML==null||ve.textContent&&ke.textContent==null)&&c(Y,""),G?se(T.dynamicChildren,G,Y,O,K,Zi(E,q),R):U||Ae(T,E,Y,null,O,K,Zi(E,q),R,!1),z>0){if(z&16)ce(Y,ve,ke,O,q);else if(z&2&&ve.class!==ke.class&&o(Y,"class",null,ke.class,q),z&4&&o(Y,"style",ve.style,ke.style,q),z&8){const Le=E.dynamicProps;for(let et=0;et<Le.length;et++){const Ye=Le[et],Tt=ve[Ye],Ge=ke[Ye];(Ge!==Tt||Ye==="value")&&o(Y,Ye,Tt,Ge,q,O)}}z&1&&T.children!==E.children&&c(Y,E.children)}else!U&&G==null&&ce(Y,ve,ke,O,q);((Ie=ke.onVnodeUpdated)||we)&&tn(()=>{Ie&&Zn(Ie,O,E,T),we&&Xr(E,T,O,"updated")},K)},se=(T,E,O,K,q,R,U)=>{for(let Y=0;Y<E.length;Y++){const z=T[Y],G=E[Y],we=z.el&&(z.type===Pe||!os(z,G)||z.shapeFlag&198)?p(z.el):O;$(z,G,we,null,K,q,R,U,!0)}},ce=(T,E,O,K,q)=>{if(E!==O){if(E!==At)for(const R in E)!Ys(R)&&!(R in O)&&o(T,R,E[R],null,q,K);for(const R in O){if(Ys(R))continue;const U=O[R],Y=E[R];U!==Y&&R!=="value"&&o(T,R,Y,U,q,K)}"value"in O&&o(T,"value",E.value,O.value,q)}},ne=(T,E,O,K,q,R,U,Y,z)=>{const G=E.el=T?T.el:a(""),we=E.anchor=T?T.anchor:a("");let{patchFlag:ve,dynamicChildren:ke,slotScopeIds:Ie}=E;Ie&&(Y=Y?Y.concat(Ie):Ie),T==null?(r(G,O,K),r(we,O,K),Me(E.children||[],O,we,q,R,U,Y,z)):ve>0&&ve&64&&ke&&T.dynamicChildren&&T.dynamicChildren.length===ke.length?(se(T.dynamicChildren,ke,O,q,R,U,Y),(E.key!=null||q&&E===q.subTree)&&Cl(T,E,!0)):Ae(T,E,O,we,q,R,U,Y,z)},xe=(T,E,O,K,q,R,U,Y,z)=>{E.slotScopeIds=Y,T==null?E.shapeFlag&512?q.ctx.activate(E,O,K,U,z):je(E,O,K,q,R,U,z):Ne(T,E,z)},je=(T,E,O,K,q,R,U)=>{const Y=T.component=Om(T,K,q);if(bi(T)&&(Y.ctx.renderer=be),Nm(Y,!1,U),Y.asyncDep){if(q&&q.registerDep(Y,Ve,U),!T.el){const z=Y.subTree=$e(sn);ae(null,z,E,O),T.placeholder=z.el}}else Ve(Y,T,E,O,q,R,U)},Ne=(T,E,O)=>{const K=E.component=T.component;if(gm(T,E,O))if(K.asyncDep&&!K.asyncResolved){He(K,E,O);return}else K.next=E,K.update();else E.el=T.el,K.vnode=E},Ve=(T,E,O,K,q,R,U)=>{const Y=()=>{if(T.isMounted){let{next:ve,bu:ke,u:Ie,parent:Le,vnode:et}=T;{const tt=pf(T);if(tt){ve&&(ve.el=et.el,He(T,ve,U)),tt.asyncDep.then(()=>{tn(()=>{T.isUnmounted||G()},q)});return}}let Ye=ve,Tt;Zr(T,!1),ve?(ve.el=et.el,He(T,ve,U)):ve=et,ke&&Ho(ke),(Tt=ve.props&&ve.props.onVnodeBeforeUpdate)&&Zn(Tt,Le,ve,et),Zr(T,!0);const Ge=vc(T),dt=T.subTree;T.subTree=Ge,$(dt,Ge,p(dt.el),W(dt),T,q,R),ve.el=Ge.el,Ye===null&&vm(T,Ge.el),Ie&&tn(Ie,q),(Tt=ve.props&&ve.props.onVnodeUpdated)&&tn(()=>Zn(Tt,Le,ve,et),q)}else{let ve;const{el:ke,props:Ie}=E,{bm:Le,m:et,parent:Ye,root:Tt,type:Ge}=T,dt=Is(E);Zr(T,!1),Le&&Ho(Le),!dt&&(ve=Ie&&Ie.onVnodeBeforeMount)&&Zn(ve,Ye,E),Zr(T,!0);{Tt.ce&&Tt.ce._hasShadowRoot()&&Tt.ce._injectChildStyle(Ge,T.parent?T.parent.type:void 0);const tt=T.subTree=vc(T);$(null,tt,O,K,T,q,R),E.el=tt.el}if(et&&tn(et,q),!dt&&(ve=Ie&&Ie.onVnodeMounted)){const tt=E;tn(()=>Zn(ve,Ye,tt),q)}(E.shapeFlag&256||Ye&&Is(Ye.vnode)&&Ye.vnode.shapeFlag&256)&&T.a&&tn(T.a,q),T.isMounted=!0,E=O=K=null}};T.scope.on();const z=T.effect=new yd(Y);T.scope.off();const G=T.update=z.run.bind(z),we=T.job=z.runIfDirty.bind(z);we.i=T,we.id=T.uid,z.scheduler=()=>Sl(we),Zr(T,!0),G()},He=(T,E,O)=>{E.component=T;const K=T.vnode.props;T.vnode=E,T.next=null,wm(T,E.props,K,O),Tm(T,E.children,O),Tr(),oc(T),Sr()},Ae=(T,E,O,K,q,R,U,Y,z=!1)=>{const G=T&&T.children,we=T?T.shapeFlag:0,ve=E.children,{patchFlag:ke,shapeFlag:Ie}=E;if(ke>0){if(ke&128){Ke(G,ve,O,K,q,R,U,Y,z);return}else if(ke&256){Ze(G,ve,O,K,q,R,U,Y,z);return}}Ie&8?(we&16&&Ue(G,q,R),ve!==G&&c(O,ve)):we&16?Ie&16?Ke(G,ve,O,K,q,R,U,Y,z):Ue(G,q,R,!0):(we&8&&c(O,""),Ie&16&&Me(ve,O,K,q,R,U,Y,z))},Ze=(T,E,O,K,q,R,U,Y,z)=>{T=T||ks,E=E||ks;const G=T.length,we=E.length,ve=Math.min(G,we);let ke;for(ke=0;ke<ve;ke++){const Ie=E[ke]=z?vr(E[ke]):rr(E[ke]);$(T[ke],Ie,O,null,q,R,U,Y,z)}G>we?Ue(T,q,R,!0,!1,ve):Me(E,O,K,q,R,U,Y,z,ve)},Ke=(T,E,O,K,q,R,U,Y,z)=>{let G=0;const we=E.length;let ve=T.length-1,ke=we-1;for(;G<=ve&&G<=ke;){const Ie=T[G],Le=E[G]=z?vr(E[G]):rr(E[G]);if(os(Ie,Le))$(Ie,Le,O,null,q,R,U,Y,z);else break;G++}for(;G<=ve&&G<=ke;){const Ie=T[ve],Le=E[ke]=z?vr(E[ke]):rr(E[ke]);if(os(Ie,Le))$(Ie,Le,O,null,q,R,U,Y,z);else break;ve--,ke--}if(G>ve){if(G<=ke){const Ie=ke+1,Le=Ie<we?E[Ie].el:K;for(;G<=ke;)$(null,E[G]=z?vr(E[G]):rr(E[G]),O,Le,q,R,U,Y,z),G++}}else if(G>ke)for(;G<=ve;)Be(T[G],q,R,!0),G++;else{const Ie=G,Le=G,et=new Map;for(G=Le;G<=ke;G++){const rt=E[G]=z?vr(E[G]):rr(E[G]);rt.key!=null&&et.set(rt.key,G)}let Ye,Tt=0;const Ge=ke-Le+1;let dt=!1,tt=0;const nt=new Array(Ge);for(G=0;G<Ge;G++)nt[G]=0;for(G=Ie;G<=ve;G++){const rt=T[G];if(Tt>=Ge){Be(rt,q,R,!0);continue}let vt;if(rt.key!=null)vt=et.get(rt.key);else for(Ye=Le;Ye<=ke;Ye++)if(nt[Ye-Le]===0&&os(rt,E[Ye])){vt=Ye;break}vt===void 0?Be(rt,q,R,!0):(nt[vt-Le]=G+1,vt>=tt?tt=vt:dt=!0,$(rt,E[vt],O,null,q,R,U,Y,z),Tt++)}const Kt=dt?Cm(nt):ks;for(Ye=Kt.length-1,G=Ge-1;G>=0;G--){const rt=Le+G,vt=E[rt],Pt=E[rt+1],pt=rt+1<we?Pt.el||mf(Pt):K;nt[G]===0?$(null,vt,O,pt,q,R,U,Y,z):dt&&(Ye<0||G!==Kt[Ye]?ot(vt,O,pt,2):Ye--)}}},ot=(T,E,O,K,q=null)=>{const{el:R,type:U,transition:Y,children:z,shapeFlag:G}=T;if(G&6){ot(T.component.subTree,E,O,K);return}if(G&128){T.suspense.move(E,O,K);return}if(G&64){U.move(T,E,O,be);return}if(U===Pe){r(R,E,O);for(let ve=0;ve<z.length;ve++)ot(z[ve],E,O,K);r(T.anchor,E,O);return}if(U===ea){te(T,E,O);return}if(K!==2&&G&1&&Y)if(K===0)Y.beforeEnter(R),r(R,E,O),tn(()=>Y.enter(R),q);else{const{leave:ve,delayLeave:ke,afterLeave:Ie}=Y,Le=()=>{T.ctx.isUnmounted?s(R):r(R,E,O)},et=()=>{R._isLeaving&&R[tr](!0),ve(R,()=>{Le(),Ie&&Ie()})};ke?ke(R,Le,et):et()}else r(R,E,O)},Be=(T,E,O,K=!1,q=!1)=>{const{type:R,props:U,ref:Y,children:z,dynamicChildren:G,shapeFlag:we,patchFlag:ve,dirs:ke,cacheIndex:Ie}=T;if(ve===-2&&(q=!1),Y!=null&&(Tr(),to(Y,null,O,T,!0),Sr()),Ie!=null&&(E.renderCache[Ie]=void 0),we&256){E.ctx.deactivate(T);return}const Le=we&1&&ke,et=!Is(T);let Ye;if(et&&(Ye=U&&U.onVnodeBeforeUnmount)&&Zn(Ye,E,T),we&6)It(T.component,O,K);else{if(we&128){T.suspense.unmount(O,K);return}Le&&Xr(T,null,E,"beforeUnmount"),we&64?T.type.remove(T,E,O,be,K):G&&!G.hasOnce&&(R!==Pe||ve>0&&ve&64)?Ue(G,E,O,!1,!0):(R===Pe&&ve&384||!q&&we&16)&&Ue(z,E,O),K&&Mt(T)}(et&&(Ye=U&&U.onVnodeUnmounted)||Le)&&tn(()=>{Ye&&Zn(Ye,E,T),Le&&Xr(T,null,E,"unmounted")},O)},Mt=T=>{const{type:E,el:O,anchor:K,transition:q}=T;if(E===Pe){ut(O,K);return}if(E===ea){re(T);return}const R=()=>{s(O),q&&!q.persisted&&q.afterLeave&&q.afterLeave()};if(T.shapeFlag&1&&q&&!q.persisted){const{leave:U,delayLeave:Y}=q,z=()=>U(O,R);Y?Y(T.el,R,z):z()}else R()},ut=(T,E)=>{let O;for(;T!==E;)O=_(T),s(T),T=O;s(E)},It=(T,E,O)=>{const{bum:K,scope:q,job:R,subTree:U,um:Y,m:z,a:G}=T;bc(z),bc(G),K&&Ho(K),q.stop(),R&&(R.flags|=8,Be(U,T,E,O)),Y&&tn(Y,E),tn(()=>{T.isUnmounted=!0},E)},Ue=(T,E,O,K=!1,q=!1,R=0)=>{for(let U=R;U<T.length;U++)Be(T[U],E,O,K,q)},W=T=>{if(T.shapeFlag&6)return W(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const E=_(T.anchor||T.el),O=E&&E[Hd];return O?_(O):E};let ge=!1;const me=(T,E,O)=>{let K;T==null?E._vnode&&(Be(E._vnode,null,null,!0),K=E._vnode.component):$(E._vnode||null,T,E,null,null,null,O),E._vnode=T,ge||(ge=!0,oc(K),Ld(),ge=!1)},be={p:$,um:Be,m:ot,r:Mt,mt:je,mc:Me,pc:Ae,pbc:se,n:W,o:e};return{render:me,hydrate:void 0,createApp:um(me)}}function Zi({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 Zr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Em(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Cl(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]=vr(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Cl(i,a)),a.type===Si&&(a.patchFlag===-1&&(a=s[o]=vr(a)),a.el=i.el),a.type===sn&&!a.el&&(a.el=i.el)}}function Cm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const d=e[r];if(d!==0){if(s=n[n.length-1],e[s]<d){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<d?o=a+1:i=a;d<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 pf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:pf(t)}function bc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function mf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?mf(t.subTree):null}const gf=e=>e.__isSuspense;function Am(e,t){t&&t.pendingBranch?qe(e)?t.effects.push(...e):t.effects.push(e):Np(e)}const Pe=Symbol.for("v-fgt"),Si=Symbol.for("v-txt"),sn=Symbol.for("v-cmt"),ea=Symbol.for("v-stc"),ro=[];let An=null;function m(e=!1){ro.push(An=e?null:[])}function xm(){ro.pop(),An=ro[ro.length-1]||null}let fo=1;function si(e,t=!1){fo+=e,e<0&&An&&t&&(An.hasOnce=!0)}function vf(e){return e.dynamicChildren=fo>0?An||ks:null,xm(),fo>0&&An&&An.push(e),e}function b(e,t,n,r,s,o){return vf(y(e,t,n,r,s,o,!0))}function ht(e,t,n,r,s){return vf($e(e,t,n,r,s,!0))}function ho(e){return e?e.__v_isVNode===!0:!1}function os(e,t){return e.type===t.type&&e.key===t.key}const yf=({key:e})=>e??null,zo=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Lt(e)||an(e)||Xe(e)?{i:Yt,r:e,k:t,f:!!n}:e:null);function y(e,t=null,n=null,r=0,s=null,o=e===Pe?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&yf(t),ref:t&&zo(t),scopeId:Fd,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:Yt};return a?(Al(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Lt(n)?8:16),fo>0&&!i&&An&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&An.push(l),l}const $e=Rm;function Rm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Xd)&&(e=sn),ho(e)){const a=Gr(e,t,!0);return n&&Al(a,n),fo>0&&!o&&An&&(a.shapeFlag&6?An[An.indexOf(e)]=a:An.push(a)),a.patchFlag=-2,a}if(Fm(e)&&(e=e.__vccOpts),t){t=Pm(t);let{class:a,style:l}=t;a&&!Lt(a)&&(t.class=at(a)),kt(l)&&(Tl(l)&&!qe(l)&&(l=Vt({},l)),t.style=Wr(l))}const i=Lt(e)?1:gf(e)?128:Wd(e)?64:kt(e)?4:Xe(e)?2:0;return y(e,t,n,r,s,i,o,!0)}function Pm(e){return e?Tl(e)||lf(e)?Vt({},e):e:null}function Gr(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,d=t?wf(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&yf(d),ref:t&&t.ref?n&&o?qe(o)?o.concat(zo(t)):[o,zo(t)]:zo(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!==Pe?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&&Gr(e.ssContent),ssFallback:e.ssFallback&&Gr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&uo(c,l.clone(c)),c}function po(e=" ",t=0){return $e(Si,null,e,t)}function de(e="",t=!1){return t?(m(),ht(sn,null,e)):$e(sn,null,e)}function rr(e){return e==null||typeof e=="boolean"?$e(sn):qe(e)?$e(Pe,null,e.slice()):ho(e)?vr(e):$e(Si,null,String(e))}function vr(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Gr(e)}function Al(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),Al(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!lf(t)?t._ctx=Yt:s===3&&Yt&&(Yt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Xe(t)?(t={default:t,_ctx:Yt},n=32):(t=String(t),r&64?(n=16,t=[po(t)]):n=8);e.children=t,e.shapeFlag|=n}function wf(...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=at([t.class,r.class]));else if(s==="style")t.style=Wr([t.style,r.style]);else if(hi(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 Zn(e,t,n,r=null){Gn(e,t,7,[n,r])}const Mm=nf();let $m=0;function Om(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Mm,o={uid:$m++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new op(!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:uf(r,s),emitsOptions:rf(r,s),emit:null,emitted:null,propsDefaults:At,inheritAttrs:r.inheritAttrs,ctx:At,data:At,props:At,attrs:At,slots:At,refs:At,setupState:At,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=fm.bind(null,o),e.ce&&e.ce(o),o}let on=null;const xl=()=>on||Yt;let oi,Ha;{const e=gi(),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)}};oi=t("__VUE_INSTANCE_SETTERS__",n=>on=n),Ha=t("__VUE_SSR_SETTERS__",n=>mo=n)}const So=e=>{const t=on;return oi(e),e.scope.on(),()=>{e.scope.off(),oi(t)}},_c=()=>{on&&on.scope.off(),oi(null)};function bf(e){return e.vnode.shapeFlag&4}let mo=!1;function Nm(e,t=!1,n=!1){t&&Ha(t);const{props:r,children:s}=e.vnode,o=bf(e);ym(e,r,o,t),km(e,s,n||t);const i=o?Dm(e,t):void 0;return t&&Ha(!1),i}function Dm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,tm);const{setup:r}=n;if(r){Tr();const s=e.setupContext=r.length>1?kf(e):null,o=So(e),i=To(r,e,0,[e.props,s]),a=dd(i);if(Sr(),o(),(a||e.sp)&&!Is(e)&&Yd(e),a){if(i.then(_c,_c),t)return i.then(l=>{kc(e,l)}).catch(l=>{wi(l,e,0)});e.asyncDep=i}else kc(e,i)}else _f(e)}function kc(e,t,n){Xe(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:kt(t)&&(e.setupState=Od(t)),_f(e)}function _f(e,t,n){const r=e.type;e.render||(e.render=r.render||lr);{const s=So(e);Tr();try{sm(e)}finally{Sr(),s()}}}const Lm={get(e,t){return rn(e,"get",""),e[t]}};function kf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Lm),slots:e.slots,emit:e.emit,expose:t}}function Ii(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Od(Ip(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in no)return no[n](e)},has(t,n){return n in t||n in no}})):e.proxy}function jm(e,t=!0){return Xe(e)?e.displayName||e.name:e.name||t&&e.__name}function Fm(e){return Xe(e)&&"__vccOpts"in e}const fe=(e,t)=>Rp(e,t,mo);function Rl(e,t,n){try{si(-1);const r=arguments.length;return r===2?kt(t)&&!qe(t)?ho(t)?$e(e,null,[t]):$e(e,t):$e(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ho(n)&&(n=[n]),$e(e,t,n))}finally{si(1)}}const Bm="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 Wa;const Tc=typeof window<"u"&&window.trustedTypes;if(Tc)try{Wa=Tc.createPolicy("vue",{createHTML:e=>e})}catch{}const Tf=Wa?e=>Wa.createHTML(e):e=>e,Um="http://www.w3.org/2000/svg",Hm="http://www.w3.org/1998/Math/MathML",gr=typeof document<"u"?document:null,Sc=gr&&gr.createElement("template"),Wm={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"?gr.createElementNS(Um,e):t==="mathml"?gr.createElementNS(Hm,e):n?gr.createElement(e,{is:n}):gr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>gr.createTextNode(e),createComment:e=>gr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>gr.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{Sc.innerHTML=Tf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Sc.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]}},$r="transition",zs="animation",go=Symbol("_vtc"),Sf={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},Vm=Vt({},zd,Sf),zm=e=>(e.displayName="Transition",e.props=Vm,e),If=zm((e,{slots:t})=>Rl(Hp,Gm(e),t)),es=(e,t=[])=>{qe(e)?e.forEach(n=>n(...t)):e&&e(...t)},Ic=e=>e?qe(e)?e.some(t=>t.length>1):e.length>1:!1;function Gm(e){const t={};for(const ne in e)ne in Sf||(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:d=i,appearToClass:c=a,leaveFromClass:p=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:I=`${n}-leave-to`}=e,j=qm(s),$=j&&j[0],Z=j&&j[1],{onBeforeEnter:ae,onEnter:V,onEnterCancelled:te,onLeave:re,onLeaveCancelled:_e,onBeforeAppear:ue=ae,onAppear:pe=V,onAppearCancelled:Me=te}=t,le=(ne,xe,je,Ne)=>{ne._enterCancelled=Ne,ts(ne,xe?c:a),ts(ne,xe?d:i),je&&je()},se=(ne,xe)=>{ne._isLeaving=!1,ts(ne,p),ts(ne,I),ts(ne,_),xe&&xe()},ce=ne=>(xe,je)=>{const Ne=ne?pe:V,Ve=()=>le(xe,ne,je);es(Ne,[xe,Ve]),Ec(()=>{ts(xe,ne?l:o),pr(xe,ne?c:a),Ic(Ne)||Cc(xe,r,$,Ve)})};return Vt(t,{onBeforeEnter(ne){es(ae,[ne]),pr(ne,o),pr(ne,i)},onBeforeAppear(ne){es(ue,[ne]),pr(ne,l),pr(ne,d)},onEnter:ce(!1),onAppear:ce(!0),onLeave(ne,xe){ne._isLeaving=!0;const je=()=>se(ne,xe);pr(ne,p),ne._enterCancelled?(pr(ne,_),Rc(ne)):(Rc(ne),pr(ne,_)),Ec(()=>{ne._isLeaving&&(ts(ne,p),pr(ne,I),Ic(re)||Cc(ne,r,Z,je))}),es(re,[ne,je])},onEnterCancelled(ne){le(ne,!1,void 0,!0),es(te,[ne])},onAppearCancelled(ne){le(ne,!0,void 0,!0),es(Me,[ne])},onLeaveCancelled(ne){se(ne),es(_e,[ne])}})}function qm(e){if(e==null)return null;if(kt(e))return[ta(e.enter),ta(e.leave)];{const t=ta(e);return[t,t]}}function ta(e){return Qh(e)}function pr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[go]||(e[go]=new Set)).add(t)}function ts(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[go];n&&(n.delete(t),n.size||(e[go]=void 0))}function Ec(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Km=0;function Cc(e,t,n,r){const s=e._endId=++Km,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Jm(e,t);if(!i)return r();const d=i+"end";let c=0;const p=()=>{e.removeEventListener(d,_),o()},_=I=>{I.target===e&&++c>=l&&p()};setTimeout(()=>{c<l&&p()},a+1),e.addEventListener(d,_)}function Jm(e,t){const n=window.getComputedStyle(e),r=j=>(n[j]||"").split(", "),s=r(`${$r}Delay`),o=r(`${$r}Duration`),i=Ac(s,o),a=r(`${zs}Delay`),l=r(`${zs}Duration`),d=Ac(a,l);let c=null,p=0,_=0;t===$r?i>0&&(c=$r,p=i,_=o.length):t===zs?d>0&&(c=zs,p=d,_=l.length):(p=Math.max(i,d),c=p>0?i>d?$r:zs:null,_=c?c===$r?o.length:l.length:0);const I=c===$r&&/\b(?:transform|all)(?:,|$)/.test(r(`${$r}Property`).toString());return{type:c,timeout:p,propCount:_,hasTransform:I}}function Ac(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>xc(n)+xc(e[r])))}function xc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Rc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Ym(e,t,n){const r=e[go];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Pc=Symbol("_vod"),Qm=Symbol("_vsh"),Xm=Symbol(""),Zm=/(?:^|;)\s*display\s*:/;function eg(e,t,n){const r=e.style,s=Lt(n);let o=!1;if(n&&!s){if(t)if(Lt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&Go(r,a,"")}else for(const i in t)n[i]==null&&Go(r,i,"");for(const i in n)i==="display"&&(o=!0),Go(r,i,n[i])}else if(s){if(t!==n){const i=r[Xm];i&&(n+=";"+i),r.cssText=n,o=Zm.test(n)}}else t&&e.removeAttribute("style");Pc in e&&(e[Pc]=o?r.display:"",e[Qm]&&(r.display="none"))}const Mc=/\s*!important$/;function Go(e,t,n){if(qe(n))n.forEach(r=>Go(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=tg(e,t);Mc.test(n)?e.setProperty(qr(r),n.replace(Mc,""),"important"):e[r]=n}}const $c=["Webkit","Moz","ms"],na={};function tg(e,t){const n=na[t];if(n)return n;let r=mn(t);if(r!=="filter"&&r in e)return na[t]=r;r=mi(r);for(let s=0;s<$c.length;s++){const o=$c[s]+r;if(o in e)return na[t]=o}return t}const Oc="http://www.w3.org/1999/xlink";function Nc(e,t,n,r,s,o=rp(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Oc,t.slice(6,t.length)):e.setAttributeNS(Oc,t,n):n==null||o&&!md(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Vn(n)?String(n):n)}function Dc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Tf(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=md(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 bs(e,t,n,r){e.addEventListener(t,n,r)}function ng(e,t,n,r){e.removeEventListener(t,n,r)}const Lc=Symbol("_vei");function rg(e,t,n,r,s=null){const o=e[Lc]||(e[Lc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=sg(t);if(r){const d=o[t]=ag(r,s);bs(e,a,d,l)}else i&&(ng(e,a,i,l),o[t]=void 0)}}const jc=/(?:Once|Passive|Capture)$/;function sg(e){let t;if(jc.test(e)){t={};let r;for(;r=e.match(jc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):qr(e.slice(2)),t]}let ra=0;const og=Promise.resolve(),ig=()=>ra||(og.then(()=>ra=0),ra=Date.now());function ag(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Gn(lg(r,n.value),t,5,[r])};return n.value=e,n.attached=ig(),n}function lg(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 Fc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,cg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Ym(e,r,i):t==="style"?eg(e,n,r):hi(t)?fl(t)||rg(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):ug(e,t,r,i))?(Dc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Nc(e,t,r,i,o,t!=="value")):e._isVueCE&&(dg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Lt(r)))?Dc(e,mn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Nc(e,t,r,i))};function ug(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Fc(t)&&Xe(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 Fc(t)&&Lt(n)?!1:t in e}function dg(e,t){const n=e._def.props;if(!n)return!1;const r=mn(t);return Array.isArray(n)?n.some(s=>mn(s)===r):Object.keys(n).some(s=>mn(s)===r)}const Bc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return qe(t)?n=>Ho(t,n):t};function fg(e){e.target.composing=!0}function Uc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const sa=Symbol("_assign");function Hc(e,t,n){return t&&(e=e.trim()),n&&(e=ml(e)),e}const Cr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[sa]=Bc(s);const o=r||s.props&&s.props.type==="number";bs(e,t?"change":"input",i=>{i.target.composing||e[sa](Hc(e.value,n,o))}),(n||o)&&bs(e,"change",()=>{e.value=Hc(e.value,n,o)}),t||(bs(e,"compositionstart",fg),bs(e,"compositionend",Uc),bs(e,"change",Uc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[sa]=Bc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?ml(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))}},hg=["ctrl","shift","alt","meta"],pg={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)=>hg.some(n=>e[`${n}Key`]&&!t.includes(n))},mt=(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=pg[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},mg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},pn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=qr(s.key);if(t.some(i=>i===o||mg[i]===o))return e(s)}))},gg=Vt({patchProp:cg},Wm);let Wc;function vg(){return Wc||(Wc=Sm(gg))}const yg=((...e)=>{const t=vg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=bg(r);if(!s)return;const o=t._component;!Xe(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,wg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function wg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function bg(e){return Lt(e)?document.querySelector(e):e}/*!
18
+ * vue-router v4.6.4
19
+ * (c) 2025 Eduardo San Martin Morote
20
+ * @license MIT
21
+ */const _s=typeof document<"u";function Ef(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function _g(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Ef(e.default)}const bt=Object.assign;function oa(e,t){const n={};for(const r in t){const s=t[r];n[r]=qn(s)?s.map(e):e(s)}return n}const so=()=>{},qn=Array.isArray;function Vc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Cf=/#/g,kg=/&/g,Tg=/\//g,Sg=/=/g,Ig=/\?/g,Af=/\+/g,Eg=/%5B/g,Cg=/%5D/g,xf=/%5E/g,Ag=/%60/g,Rf=/%7B/g,xg=/%7C/g,Pf=/%7D/g,Rg=/%20/g;function Pl(e){return e==null?"":encodeURI(""+e).replace(xg,"|").replace(Eg,"[").replace(Cg,"]")}function Pg(e){return Pl(e).replace(Rf,"{").replace(Pf,"}").replace(xf,"^")}function Va(e){return Pl(e).replace(Af,"%2B").replace(Rg,"+").replace(Cf,"%23").replace(kg,"%26").replace(Ag,"`").replace(Rf,"{").replace(Pf,"}").replace(xf,"^")}function Mg(e){return Va(e).replace(Sg,"%3D")}function $g(e){return Pl(e).replace(Cf,"%23").replace(Ig,"%3F")}function Og(e){return $g(e).replace(Tg,"%2F")}function vo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Ng=/\/$/,Dg=e=>e.replace(Ng,"");function ia(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=Bg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:vo(i)}}function Lg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function zc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function jg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Ms(t.matched[r],n.matched[s])&&Mf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ms(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Mf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Fg(e[n],t[n]))return!1;return!0}function Fg(e,t){return qn(e)?Gc(e,t):qn(t)?Gc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Gc(e,t){return qn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Bg(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 Or={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})({}),aa=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Ug(e){if(!e)if(_s){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Dg(e)}const Hg=/^[^#]+#/;function Wg(e,t){return e.replace(Hg,"#")+t}function Vg(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 Ei=()=>({left:window.scrollX,top:window.scrollY});function zg(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=Vg(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 qc(e,t){return(history.state?history.state.position-t:-1)+e}const Ga=new Map;function Gg(e,t){Ga.set(e,t)}function qg(e){const t=Ga.get(e);return Ga.delete(e),t}function Kg(e){return typeof e=="string"||e&&typeof e=="object"}function $f(e){return typeof e=="string"||typeof e=="symbol"}let jt=(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 Of=Symbol("");jt.MATCHER_NOT_FOUND+"",jt.NAVIGATION_GUARD_REDIRECT+"",jt.NAVIGATION_ABORTED+"",jt.NAVIGATION_CANCELLED+"",jt.NAVIGATION_DUPLICATED+"";function $s(e,t){return bt(new Error,{type:e,[Of]:!0},t)}function mr(e,t){return e instanceof Error&&Of in e&&(t==null||!!(e.type&t))}const Jg=["params","query","hash"];function Yg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Jg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Qg(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(Af," "),o=s.indexOf("="),i=vo(o<0?s:s.slice(0,o)),a=o<0?null:vo(s.slice(o+1));if(i in t){let l=t[i];qn(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Kc(e){let t="";for(let n in e){const r=e[n];if(n=Mg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(qn(r)?r.map(s=>s&&Va(s)):[r&&Va(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Xg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=qn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Zg=Symbol(""),Jc=Symbol(""),Ci=Symbol(""),Ml=Symbol(""),qa=Symbol("");function Gs(){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 jr(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const d=_=>{_===!1?l($s(jt.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?l(_):Kg(_)?l($s(jt.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(i&&r.enterCallbacks[s]===i&&typeof _=="function"&&i.push(_),a())},c=o(()=>e.call(r&&r.instances[s],t,n,d));let p=Promise.resolve(c);e.length<3&&(p=p.then(d)),p.catch(_=>l(_))})}function la(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(Ef(l)){const d=(l.__vccOpts||l)[t];d&&o.push(jr(d,n,r,i,a,s))}else{let d=l();o.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const p=_g(c)?c.default:c;i.mods[a]=c,i.components[a]=p;const _=(p.__vccOpts||p)[t];return _&&jr(_,n,r,i,a,s)()}))}}return o}function ev(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(d=>Ms(d,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(d=>Ms(d,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 tv=()=>location.protocol+"//"+location.host;function Nf(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),zc(a,"")}return zc(n,e)+r+s}function nv(e,t,n,r){let s=[],o=[],i=null;const a=({state:_})=>{const I=Nf(e,location),j=n.value,$=t.value;let Z=0;if(_){if(n.value=I,t.value=_,i&&i===j){i=null;return}Z=$?_.position-$.position:0}else r(I);s.forEach(ae=>{ae(n.value,j,{delta:Z,type:za.pop,direction:Z?Z>0?aa.forward:aa.back:aa.unknown})})};function l(){i=n.value}function d(_){s.push(_);const I=()=>{const j=s.indexOf(_);j>-1&&s.splice(j,1)};return o.push(I),I}function c(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(bt({},_.state,{scroll:Ei()}),"")}}function p(){for(const _ of o)_();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:p}}function Yc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Ei():null}}function rv(e){const{history:t,location:n}=window,r={value:Nf(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,d,c){const p=e.indexOf("#"),_=p>-1?(n.host&&document.querySelector("base")?e:e.slice(p))+l:tv()+e+l;try{t[c?"replaceState":"pushState"](d,"",_),s.value=d}catch(I){console.error(I),n[c?"replace":"assign"](_)}}function i(l,d){o(l,bt({},t.state,Yc(s.value.back,l,s.value.forward,!0),d,{position:s.value.position}),!0),r.value=l}function a(l,d){const c=bt({},s.value,t.state,{forward:l,scroll:Ei()});o(c.current,c,!0),o(l,bt({},Yc(r.value,l,null),{position:c.position+1},d),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function sv(e){e=Ug(e);const t=rv(e),n=nv(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=bt({location:"",base:e,go:r,createHref:Wg.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 ov(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),sv(e)}let as=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Ht=(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})(Ht||{});const iv={type:as.Static,value:""},av=/[a-zA-Z0-9_]/;function lv(e){if(!e)return[[]];if(e==="/")return[[iv]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(I){throw new Error(`ERR (${n})/"${d}": ${I}`)}let n=Ht.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,d="",c="";function p(){d&&(n===Ht.Static?o.push({type:as.Static,value:d}):n===Ht.Param||n===Ht.ParamRegExp||n===Ht.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:as.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function _(){d+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Ht.ParamRegExp){r=n,n=Ht.EscapeNext;continue}switch(n){case Ht.Static:l==="/"?(d&&p(),i()):l===":"?(p(),n=Ht.Param):_();break;case Ht.EscapeNext:_(),n=r;break;case Ht.Param:l==="("?n=Ht.ParamRegExp:av.test(l)?_():(p(),n=Ht.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Ht.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=Ht.ParamRegExpEnd:c+=l;break;case Ht.ParamRegExpEnd:p(),n=Ht.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===Ht.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),p(),i(),s}const Qc="[^/]+?",cv={sensitive:!1,strict:!1,start:!0,end:!0};var fn=(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})(fn||{});const uv=/[.+*?^${}()[\]/\\]/g;function dv(e,t){const n=bt({},cv,t),r=[];let s=n.start?"^":"";const o=[];for(const d of e){const c=d.length?[]:[fn.Root];n.strict&&!d.length&&(s+="/");for(let p=0;p<d.length;p++){const _=d[p];let I=fn.Segment+(n.sensitive?fn.BonusCaseSensitive:0);if(_.type===as.Static)p||(s+="/"),s+=_.value.replace(uv,"\\$&"),I+=fn.Static;else if(_.type===as.Param){const{value:j,repeatable:$,optional:Z,regexp:ae}=_;o.push({name:j,repeatable:$,optional:Z});const V=ae||Qc;if(V!==Qc){I+=fn.BonusCustomRegExp;try{`${V}`}catch(re){throw new Error(`Invalid custom RegExp for param "${j}" (${V}): `+re.message)}}let te=$?`((?:${V})(?:/(?:${V}))*)`:`(${V})`;p||(te=Z&&d.length<2?`(?:/${te})`:"/"+te),Z&&(te+="?"),s+=te,I+=fn.Dynamic,Z&&(I+=fn.BonusOptional),$&&(I+=fn.BonusRepeatable),V===".*"&&(I+=fn.BonusWildcard)}c.push(I)}r.push(c)}if(n.strict&&n.end){const d=r.length-1;r[d][r[d].length-1]+=fn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(d){const c=d.match(i),p={};if(!c)return null;for(let _=1;_<c.length;_++){const I=c[_]||"",j=o[_-1];p[j.name]=I&&j.repeatable?I.split("/"):I}return p}function l(d){let c="",p=!1;for(const _ of e){(!p||!c.endsWith("/"))&&(c+="/"),p=!1;for(const I of _)if(I.type===as.Static)c+=I.value;else if(I.type===as.Param){const{value:j,repeatable:$,optional:Z}=I,ae=j in d?d[j]:"";if(qn(ae)&&!$)throw new Error(`Provided param "${j}" is an array but it is not repeatable (* or + modifiers)`);const V=qn(ae)?ae.join("/"):ae;if(!V)if(Z)_.length<2&&(c.endsWith("/")?c=c.slice(0,-1):p=!0);else throw new Error(`Missing required param "${j}"`);c+=V}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function fv(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]===fn.Static+fn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===fn.Static+fn.Segment?1:-1:0}function Df(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=fv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(Xc(r))return 1;if(Xc(s))return-1}return s.length-r.length}function Xc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const hv={strict:!1,end:!0,sensitive:!1};function pv(e,t,n){const r=dv(lv(e.path),n),s=bt(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function mv(e,t){const n=[],r=new Map;t=Vc(hv,t);function s(p){return r.get(p)}function o(p,_,I){const j=!I,$=eu(p);$.aliasOf=I&&I.record;const Z=Vc(t,p),ae=[$];if("alias"in p){const re=typeof p.alias=="string"?[p.alias]:p.alias;for(const _e of re)ae.push(eu(bt({},$,{components:I?I.record.components:$.components,path:_e,aliasOf:I?I.record:$})))}let V,te;for(const re of ae){const{path:_e}=re;if(_&&_e[0]!=="/"){const ue=_.record.path,pe=ue[ue.length-1]==="/"?"":"/";re.path=_.record.path+(_e&&pe+_e)}if(V=pv(re,_,Z),I?I.alias.push(V):(te=te||V,te!==V&&te.alias.push(V),j&&p.name&&!tu(V)&&i(p.name)),Lf(V)&&l(V),$.children){const ue=$.children;for(let pe=0;pe<ue.length;pe++)o(ue[pe],V,I&&I.children[pe])}I=I||V}return te?()=>{i(te)}:so}function i(p){if($f(p)){const _=r.get(p);_&&(r.delete(p),n.splice(n.indexOf(_),1),_.children.forEach(i),_.alias.forEach(i))}else{const _=n.indexOf(p);_>-1&&(n.splice(_,1),p.record.name&&r.delete(p.record.name),p.children.forEach(i),p.alias.forEach(i))}}function a(){return n}function l(p){const _=yv(p,n);n.splice(_,0,p),p.record.name&&!tu(p)&&r.set(p.record.name,p)}function d(p,_){let I,j={},$,Z;if("name"in p&&p.name){if(I=r.get(p.name),!I)throw $s(jt.MATCHER_NOT_FOUND,{location:p});Z=I.record.name,j=bt(Zc(_.params,I.keys.filter(te=>!te.optional).concat(I.parent?I.parent.keys.filter(te=>te.optional):[]).map(te=>te.name)),p.params&&Zc(p.params,I.keys.map(te=>te.name))),$=I.stringify(j)}else if(p.path!=null)$=p.path,I=n.find(te=>te.re.test($)),I&&(j=I.parse($),Z=I.record.name);else{if(I=_.name?r.get(_.name):n.find(te=>te.re.test(_.path)),!I)throw $s(jt.MATCHER_NOT_FOUND,{location:p,currentLocation:_});Z=I.record.name,j=bt({},_.params,p.params),$=I.stringify(j)}const ae=[];let V=I;for(;V;)ae.unshift(V.record),V=V.parent;return{name:Z,path:$,params:j,matched:ae,meta:vv(ae)}}e.forEach(p=>o(p));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:d,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function Zc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function eu(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:gv(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 gv(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 tu(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function vv(e){return e.reduce((t,n)=>bt(t,n.meta),{})}function yv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;Df(e,t[o])<0?r=o:n=o+1}const s=wv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function wv(e){let t=e;for(;t=t.parent;)if(Lf(t)&&Df(e,t)===0)return t}function Lf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function nu(e){const t=Hn(Ci),n=Hn(Ml),r=fe(()=>{const l=ye(e.to);return t.resolve(l)}),s=fe(()=>{const{matched:l}=r.value,{length:d}=l,c=l[d-1],p=n.matched;if(!c||!p.length)return-1;const _=p.findIndex(Ms.bind(null,c));if(_>-1)return _;const I=ru(l[d-2]);return d>1&&ru(c)===I&&p[p.length-1].path!==I?p.findIndex(Ms.bind(null,l[d-2])):_}),o=fe(()=>s.value>-1&&Sv(n.params,r.value.params)),i=fe(()=>s.value>-1&&s.value===n.matched.length-1&&Mf(n.params,r.value.params));function a(l={}){if(Tv(l)){const d=t[ye(e.replace)?"replace":"push"](ye(e.to)).catch(so);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:r,href:fe(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function bv(e){return e.length===1?e[0]:e}const _v=qt({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:nu,setup(e,{slots:t}){const n=yi(nu(e)),{options:r}=Hn(Ci),s=fe(()=>({[su(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[su(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&bv(t.default(n));return e.custom?o:Rl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),kv=_v;function Tv(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 Sv(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(!qn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function ru(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const su=(e,t,n)=>e??t??n,Iv=qt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Hn(qa),s=fe(()=>e.route||r.value),o=Hn(Jc,0),i=fe(()=>{let d=ye(o);const{matched:c}=s.value;let p;for(;(p=c[d])&&!p.components;)d++;return d}),a=fe(()=>s.value.matched[i.value]);Wo(Jc,fe(()=>i.value+1)),Wo(Zg,a),Wo(qa,s);const l=D();return lt(()=>[l.value,a.value,e.name],([d,c,p],[_,I,j])=>{c&&(c.instances[p]=d,I&&I!==c&&d&&d===_&&(c.leaveGuards.size||(c.leaveGuards=I.leaveGuards),c.updateGuards.size||(c.updateGuards=I.updateGuards))),d&&c&&(!I||!Ms(c,I)||!_)&&(c.enterCallbacks[p]||[]).forEach($=>$(d))},{flush:"post"}),()=>{const d=s.value,c=e.name,p=a.value,_=p&&p.components[c];if(!_)return ou(n.default,{Component:_,route:d});const I=p.props[c],j=I?I===!0?d.params:typeof I=="function"?I(d):I:null,Z=Rl(_,bt({},j,t,{onVnodeUnmounted:ae=>{ae.component.isUnmounted&&(p.instances[c]=null)},ref:l}));return ou(n.default,{Component:Z,route:d})||Z}}});function ou(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ev=Iv;function Cv(e){const t=mv(e.routes,e),n=e.parseQuery||Qg,r=e.stringifyQuery||Kc,s=e.history,o=Gs(),i=Gs(),a=Gs(),l=Ep(Or);let d=Or;_s&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=oa.bind(null,W=>""+W),p=oa.bind(null,Og),_=oa.bind(null,vo);function I(W,ge){let me,be;return $f(W)?(me=t.getRecordMatcher(W),be=ge):be=W,t.addRoute(be,me)}function j(W){const ge=t.getRecordMatcher(W);ge&&t.removeRoute(ge)}function $(){return t.getRoutes().map(W=>W.record)}function Z(W){return!!t.getRecordMatcher(W)}function ae(W,ge){if(ge=bt({},ge||l.value),typeof W=="string"){const O=ia(n,W,ge.path),K=t.resolve({path:O.path},ge),q=s.createHref(O.fullPath);return bt(O,K,{params:_(K.params),hash:vo(O.hash),redirectedFrom:void 0,href:q})}let me;if(W.path!=null)me=bt({},W,{path:ia(n,W.path,ge.path).path});else{const O=bt({},W.params);for(const K in O)O[K]==null&&delete O[K];me=bt({},W,{params:p(O)}),ge.params=p(ge.params)}const be=t.resolve(me,ge),De=W.hash||"";be.params=c(_(be.params));const T=Lg(r,bt({},W,{hash:Pg(De),path:be.path})),E=s.createHref(T);return bt({fullPath:T,hash:De,query:r===Kc?Xg(W.query):W.query||{}},be,{redirectedFrom:void 0,href:E})}function V(W){return typeof W=="string"?ia(n,W,l.value.path):bt({},W)}function te(W,ge){if(d!==W)return $s(jt.NAVIGATION_CANCELLED,{from:ge,to:W})}function re(W){return pe(W)}function _e(W){return re(bt(V(W),{replace:!0}))}function ue(W,ge){const me=W.matched[W.matched.length-1];if(me&&me.redirect){const{redirect:be}=me;let De=typeof be=="function"?be(W,ge):be;return typeof De=="string"&&(De=De.includes("?")||De.includes("#")?De=V(De):{path:De},De.params={}),bt({query:W.query,hash:W.hash,params:De.path!=null?{}:W.params},De)}}function pe(W,ge){const me=d=ae(W),be=l.value,De=W.state,T=W.force,E=W.replace===!0,O=ue(me,be);if(O)return pe(bt(V(O),{state:typeof O=="object"?bt({},De,O.state):De,force:T,replace:E}),ge||me);const K=me;K.redirectedFrom=ge;let q;return!T&&jg(r,be,me)&&(q=$s(jt.NAVIGATION_DUPLICATED,{to:K,from:be}),ot(be,be,!0,!1)),(q?Promise.resolve(q):se(K,be)).catch(R=>mr(R)?mr(R,jt.NAVIGATION_GUARD_REDIRECT)?R:Ke(R):Ae(R,K,be)).then(R=>{if(R){if(mr(R,jt.NAVIGATION_GUARD_REDIRECT))return pe(bt({replace:E},V(R.to),{state:typeof R.to=="object"?bt({},De,R.to.state):De,force:T}),ge||K)}else R=ne(K,be,!0,E,De);return ce(K,be,R),R})}function Me(W,ge){const me=te(W,ge);return me?Promise.reject(me):Promise.resolve()}function le(W){const ge=ut.values().next().value;return ge&&typeof ge.runWithContext=="function"?ge.runWithContext(W):W()}function se(W,ge){let me;const[be,De,T]=ev(W,ge);me=la(be.reverse(),"beforeRouteLeave",W,ge);for(const O of be)O.leaveGuards.forEach(K=>{me.push(jr(K,W,ge))});const E=Me.bind(null,W,ge);return me.push(E),Ue(me).then(()=>{me=[];for(const O of o.list())me.push(jr(O,W,ge));return me.push(E),Ue(me)}).then(()=>{me=la(De,"beforeRouteUpdate",W,ge);for(const O of De)O.updateGuards.forEach(K=>{me.push(jr(K,W,ge))});return me.push(E),Ue(me)}).then(()=>{me=[];for(const O of T)if(O.beforeEnter)if(qn(O.beforeEnter))for(const K of O.beforeEnter)me.push(jr(K,W,ge));else me.push(jr(O.beforeEnter,W,ge));return me.push(E),Ue(me)}).then(()=>(W.matched.forEach(O=>O.enterCallbacks={}),me=la(T,"beforeRouteEnter",W,ge,le),me.push(E),Ue(me))).then(()=>{me=[];for(const O of i.list())me.push(jr(O,W,ge));return me.push(E),Ue(me)}).catch(O=>mr(O,jt.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function ce(W,ge,me){a.list().forEach(be=>le(()=>be(W,ge,me)))}function ne(W,ge,me,be,De){const T=te(W,ge);if(T)return T;const E=ge===Or,O=_s?history.state:{};me&&(be||E?s.replace(W.fullPath,bt({scroll:E&&O&&O.scroll},De)):s.push(W.fullPath,De)),l.value=W,ot(W,ge,me,E),Ke()}let xe;function je(){xe||(xe=s.listen((W,ge,me)=>{if(!It.listening)return;const be=ae(W),De=ue(be,It.currentRoute.value);if(De){pe(bt(De,{replace:!0,force:!0}),be).catch(so);return}d=be;const T=l.value;_s&&Gg(qc(T.fullPath,me.delta),Ei()),se(be,T).catch(E=>mr(E,jt.NAVIGATION_ABORTED|jt.NAVIGATION_CANCELLED)?E:mr(E,jt.NAVIGATION_GUARD_REDIRECT)?(pe(bt(V(E.to),{force:!0}),be).then(O=>{mr(O,jt.NAVIGATION_ABORTED|jt.NAVIGATION_DUPLICATED)&&!me.delta&&me.type===za.pop&&s.go(-1,!1)}).catch(so),Promise.reject()):(me.delta&&s.go(-me.delta,!1),Ae(E,be,T))).then(E=>{E=E||ne(be,T,!1),E&&(me.delta&&!mr(E,jt.NAVIGATION_CANCELLED)?s.go(-me.delta,!1):me.type===za.pop&&mr(E,jt.NAVIGATION_ABORTED|jt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ce(be,T,E)}).catch(so)}))}let Ne=Gs(),Ve=Gs(),He;function Ae(W,ge,me){Ke(W);const be=Ve.list();return be.length?be.forEach(De=>De(W,ge,me)):console.error(W),Promise.reject(W)}function Ze(){return He&&l.value!==Or?Promise.resolve():new Promise((W,ge)=>{Ne.add([W,ge])})}function Ke(W){return He||(He=!W,je(),Ne.list().forEach(([ge,me])=>W?me(W):ge()),Ne.reset()),W}function ot(W,ge,me,be){const{scrollBehavior:De}=e;if(!_s||!De)return Promise.resolve();const T=!me&&qg(qc(W.fullPath,0))||(be||!me)&&history.state&&history.state.scroll||null;return Wt().then(()=>De(W,ge,T)).then(E=>E&&zg(E)).catch(E=>Ae(E,W,ge))}const Be=W=>s.go(W);let Mt;const ut=new Set,It={currentRoute:l,listening:!0,addRoute:I,removeRoute:j,clearRoutes:t.clearRoutes,hasRoute:Z,getRoutes:$,resolve:ae,options:e,push:re,replace:_e,go:Be,back:()=>Be(-1),forward:()=>Be(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Ve.add,isReady:Ze,install(W){W.component("RouterLink",kv),W.component("RouterView",Ev),W.config.globalProperties.$router=It,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>ye(l)}),_s&&!Mt&&l.value===Or&&(Mt=!0,re(s.location).catch(be=>{}));const ge={};for(const be in Or)Object.defineProperty(ge,be,{get:()=>l.value[be],enumerable:!0});W.provide(Ci,It),W.provide(Ml,Md(ge)),W.provide(qa,l);const me=W.unmount;ut.add(W),W.unmount=function(){ut.delete(W),ut.size<1&&(d=Or,xe&&xe(),xe=null,l.value=Or,Mt=!1,He=!1),me()}}};function Ue(W){return W.reduce((ge,me)=>ge.then(()=>le(me)),Promise.resolve())}return It}function Av(){return Hn(Ci)}function xv(e){return Hn(Ml)}const iu=768;function jf(){const e=D(typeof window<"u"?window.innerWidth<iu:!1);let t=null;function n(r){e.value=r.matches}return Pr(()=>{t=window.matchMedia(`(max-width: ${iu-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),ki(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Rv={key:0,class:"desktop-sidebar"},Pv={class:"desktop-main"},au="codex-web-local.sidebar-width.v1",Mv=260,$v=620,lu=320,Ov=qt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=jf();function r(d){return Math.min($v,Math.max(Mv,d))}function s(){if(typeof window>"u")return lu;const d=window.localStorage.getItem(au),c=Number(d);return Number.isFinite(c)?r(c):lu}const o=D(s()),i=fe(()=>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(d){typeof window>"u"||window.localStorage.setItem(au,String(d))}function l(d){d.preventDefault();const c=d.clientX,p=o.value,_=j=>{const $=j.clientX-c;o.value=r(p+$)},I=()=>{a(o.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",I)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",I)}return(d,c)=>(m(),b("div",{class:at(["desktop-layout",{"is-mobile":ye(n)}]),style:Wr(i.value)},[ye(n)?(m(),ht(eo,{key:0,to:"body"},[$e(If,{name:"drawer"},{default:wt(()=>[e.isSidebarCollapsed?de("",!0):(m(),b("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=p=>d.$emit("close-sidebar"))},[y("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=mt(()=>{},["stop"]))},[ar(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):de("",!0),ye(n)?de("",!0):(m(),b(Pe,{key:1},[e.isSidebarCollapsed?de("",!0):(m(),b("aside",Rv,[ar(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?de("",!0):(m(),b("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),y("section",Pv,[ar(d.$slots,"content",{},void 0)])],6))}}),ct=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Nv=ct(Ov,[["__scopeId","data-v-068d06c5"]]),Dv={},Lv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function jv(e,t){return m(),b("svg",Lv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Ai=ct(Dv,[["render",jv]]),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 m(),b("svg",Bv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Ff=ct(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 m(),b("svg",Wv,[...t[0]||(t[0]=[y("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 qs=ct(Hv,[["render",Vv]]),zv={},Gv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function qv(e,t){return m(),b("svg",Gv,[...t[0]||(t[0]=[y("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 ii=ct(zv,[["render",qv]]),Kv={},Jv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Yv(e,t){return m(),b("svg",Jv,[...t[0]||(t[0]=[y("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 $l=ct(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 m(),b("svg",Xv,[...t[0]||(t[0]=[y("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 ey=ct(Qv,[["render",Zv]]),ty={},ny={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ry(e,t){return m(),b("svg",ny,[...t[0]||(t[0]=[y("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 qo=ct(ty,[["render",ry]]),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 m(),b("svg",oy,[...t[0]||(t[0]=[y("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 ca=ct(sy,[["render",iy]]),ay={key:0,class:"sidebar-menu-row-left"},ly={class:"sidebar-menu-row-main"},cy={key:1,class:"sidebar-menu-row-right"},uy={key:0,class:"sidebar-menu-row-right-default"},dy={key:1,class:"sidebar-menu-row-right-hover"},fy=qt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=nm(),r=fe(()=>!!n.left),s=fe(()=>!!n.right),o=fe(()=>!!n["right-hover"]),i=fe(()=>s.value||o.value);return(a,l)=>(m(),ht(ni(t.as),wf({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:wt(()=>[r.value?(m(),b("span",ay,[ar(a.$slots,"left",{},void 0,!0)])):de("",!0),y("span",ly,[ar(a.$slots,"default",{},void 0,!0)]),i.value?(m(),b("span",cy,[s.value?(m(),b("span",uy,[ar(a.$slots,"right",{},void 0,!0)])):de("",!0),o.value?(m(),b("span",dy,[ar(a.$slots,"right-hover",{},void 0,!0)])):de("",!0)])):de("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),ns=ct(fy,[["__scopeId","data-v-36239f39"]]),hy={class:"thread-tree-root"},py={key:0,class:"pinned-section"},my={class:"thread-list"},gy=["data-menu-open"],vy={class:"thread-left-stack"},yy=["data-state"],wy=["onClick"],by=["onClick"],_y={class:"thread-row-title-wrap"},ky={class:"thread-row-title"},Ty={class:"thread-row-time"},Sy=["onClick"],Iy=["aria-expanded"],Ey=["data-active"],Cy={key:0},Ay=["data-active"],xy={key:0},Ry={key:1,class:"thread-tree-no-results"},Py={key:2,class:"thread-tree-loading"},My={key:3,class:"thread-list thread-list-global"},$y=["data-menu-open"],Oy={class:"thread-left-stack"},Ny=["data-state"],Dy=["onClick"],Ly=["onClick"],jy={class:"thread-row-title-wrap"},Fy={class:"thread-row-title"},By={class:"thread-row-time"},Uy=["onClick"],Hy=["data-project-name","data-expanded","data-dragging"],Wy={class:"project-icon-stack"},Vy={class:"project-icon-folder"},zy={class:"project-icon-chevron"},Gy=["data-dragging-handle","onMousedown"],qy={class:"project-title"},Ky={class:"project-hover-controls"},Jy=["onClick"],Yy=["data-open-direction"],Qy=["onClick"],Xy=["onClick"],Zy=["onClick"],ew=["onInput"],tw=["aria-label","title","onClick"],nw={key:0,class:"thread-list"},rw=["data-menu-open"],sw={class:"thread-left-stack"},ow=["data-state"],iw=["onClick"],aw=["onClick"],lw={class:"thread-row-title-wrap"},cw={class:"thread-row-title"},uw={class:"thread-row-time"},dw=["onClick"],fw=["onClick"],hw=["data-open-direction"],pw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},mw=["onKeydown"],gw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},vw={class:"rename-thread-subtitle"},yw=4,cu=6,uu="codex-web-local.thread-view-mode.v1",du="codex-web-local.collapsed-projects.v1",ww=qt({__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(""),d=D({}),c=D({}),p=D({}),_=D("actions"),I=D(""),j=D(!1),$=D(""),Z=D(""),ae=D(null),V=D(!1),te=D(""),re=D(""),_e=D(null),ue=D(null),pe=D(null);let Me=null,le=null;const se=D(""),ce=D({}),ne=new Map,xe=new Map,je=new Map,Ne=new WeakMap,Ve=D(null),He=D(null),Ae=D(!1),Ze=D(Be()),Ke=typeof window<"u"?new ResizeObserver(C=>{for(const P of C){const N=P.target,Q=Ne.get(N);Q&&Cn(Q,N)}}):null;function ot(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(du);if(!C)return{};const P=JSON.parse(C);return!P||typeof P!="object"||Array.isArray(P)?{}:P}catch{return{}}}function Be(){return typeof window>"u"?"project":window.localStorage.getItem(uu)==="chronological"?"chronological":"project"}o.value=ot(),lt(o,C=>{typeof window>"u"||window.localStorage.setItem(du,JSON.stringify(C))},{deep:!0}),lt(Ze,C=>{typeof window>"u"||window.localStorage.setItem(uu,C)});const Mt=fe(()=>n.searchQuery.trim().toLowerCase()),ut=fe(()=>Mt.value.length>0),It=fe(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function Ue(C){if(!ut.value)return!0;if(It.value)return It.value.has(C.id);const P=Mt.value;return C.title.toLowerCase().includes(P)||C.preview.toLowerCase().includes(P)}const W=fe(()=>ut.value?n.groups.map(C=>({...C,threads:C.threads.filter(Ue)})).filter(C=>C.threads.length>0):n.groups),ge=fe(()=>Ze.value==="chronological"),me=fe(()=>{const C=W.value,P=[];for(const N of C)for(const Q of N.threads)U(Q.id)||P.push(Q);return P.sort((N,Q)=>{const We=new Date(N.updatedAtIso||N.createdAtIso).getTime();return new Date(Q.updatedAtIso||Q.createdAtIso).getTime()-We})}),be=fe(()=>{const C=new Map;for(const P of n.groups)for(const N of P.threads)C.set(N.id,N);return C}),De=fe(()=>{const C=l.value;return C?be.value.get(C)??null:null}),T=fe(()=>i.value.map(C=>be.value.get(C)??null).filter(C=>C!==null).filter(Ue)),E=fe(()=>{const C=pe.value;if(!C||C.dropTargetIndexFull===null||n.groups.length===0)return null;const P=Math.max(0,Math.min(C.dropTargetIndexFull,n.groups.length)),N=P>C.fromIndex?P-1:P,Q=Math.max(0,Math.min(N,n.groups.length-1));return Q===C.fromIndex?null:Q}),O=fe(()=>{const P=(ut.value?W.value:n.groups).map(Bt=>Bt.projectName),N=pe.value,Q=E.value;if(!N||Q===null)return P;const We=[...P],[xt]=We.splice(N.fromIndex,1);return xt?(We.splice(Q,0,xt),We):P}),K=fe(()=>{const C={};let P=0;for(const N of O.value)C[N]=P,P+=yn(N);return C}),q=fe(()=>{let C=0;for(const P of O.value)C+=yn(P);return{height:`${Math.max(0,C)}px`}});function R(C){const P=new Date(C).getTime();if(Number.isNaN(P))return"n/a";const N=Math.abs(Date.now()-P);if(N<6e4)return"now";const Q=Math.floor(N/6e4);if(Q<60)return`${Q}m`;const We=Math.floor(Q/60);return We<24?`${We}h`:`${Math.floor(We/24)}d`}function U(C){return i.value.includes(C)}function Y(C){if(U(C)){i.value=i.value.filter(P=>P!==C);return}i.value=[C,...i.value]}function z(C){r("select",C)}function G(C){r("export-thread",C),Ie()}function we(C){return`start new thread ${nt(C)}`}function ve(C){r("start-new-thread",C)}function ke(C){return l.value===C}function Ie(){l.value="",p.value={}}function Le(C){if(l.value===C){Ie();return}rt(),Ae.value=!1,l.value=C,Wt(()=>{Fe(C)})}function et(C,P){$.value=C,Z.value=P,j.value=!0,Ie(),Wt(()=>{var N,Q;(N=ae.value)==null||N.focus(),(Q=ae.value)==null||Q.select()})}function Ye(){j.value=!1,$.value="",Z.value=""}function Tt(){const C=$.value,P=Z.value.trim();!C||!P||(r("rename-thread",{threadId:C,title:P}),Ye())}function Ge(C,P){te.value=C,re.value=P,V.value=!0,Ie()}function dt(){V.value=!1,te.value="",re.value=""}function tt(){const C=te.value;C&&(i.value=i.value.filter(P=>P!==C),r("archive",C),dt())}function nt(C){return n.projectDisplayNameById[C]??C}function Kt(C){return a.value===C}function rt(){a.value="",_.value="actions",I.value=""}function vt(){const C=!Ae.value;C&&(rt(),Ie()),Ae.value=C}function Pt(C){Ze.value=C,Ae.value=!1}function pt(C){if(a.value===C){rt();return}Ie(),Ae.value=!1,a.value=C,_.value="actions",I.value=nt(C),Wt(()=>{Zt(C)})}function xn(C){Ie(),a.value=C,_.value="rename",I.value=nt(C),Wt(()=>{Zt(C)})}function St(C){r("rename-project",{projectName:C,displayName:I.value})}function ft(C){r("remove-project",C),rt()}function vn(C){r("browse-project-files",C),rt()}function zt(C,P){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const N=n.groups.findIndex(xt=>xt.projectName===P);if(N<0)return;const Q=C.key==="ArrowUp"?-1:1,We=Math.max(0,Math.min(N+Q,n.groups.length-1));We!==N&&(C.preventDefault(),r("reorder-project",{projectName:P,toIndex:We}))}function $t(C){return s.value[C]===!0}function yt(C){return o.value[C]===!0}function Sn(C){s.value={...s.value,[C]:!$t(C)}}function Rn(C){if(se.value===C){se.value="";return}o.value={...o.value,[C]:!yt(C)}}function yn(C){const P=ce.value[C]??0,N=pe.value,We=((N==null?void 0:N.projectName)===C?N.groupHeight:null)??P,xt=yt(C)?0:cu;return Math.max(0,We+xt)}function Pn(C,P){const N=P instanceof HTMLElement?P:P&&"$el"in P&&P.$el instanceof HTMLElement?P.$el:null;if(N){xe.set(C,N);return}xe.delete(C)}function cn(C,P){const N=P instanceof HTMLElement?P:P&&"$el"in P&&P.$el instanceof HTMLElement?P.$el:null;if(N){je.set(C,N);return}je.delete(C)}function Qt(C){let P=C.parentElement;for(;P;){const N=window.getComputedStyle(P),Q=N.overflowY||N.overflow;if(Q==="auto"||Q==="scroll"||Q==="hidden"||Q==="clip")return P.getBoundingClientRect();P=P.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Xt(C,P){const N=C.getBoundingClientRect(),Q=Qt(C),We=6,xt=Q.bottom-N.bottom,Bt=N.top-Q.top;return xt>=P+We?"down":Bt>xt?"up":"down"}function dr(C,P){const N=je.get(C);if(!N)return"down";const Q=Xt(N,P);return c.value={...c.value,[C]:Q},Q}function Dn(C){return c.value[C]??"down"}function Zt(C){const P=xe.get(C);P&&(d.value={...d.value,[C]:Xt(P,112)})}function Jt(C,P,N){return Math.min(Math.max(C,P),N)}function Fe(C){const P=je.get(C);if(!P)return;const N=He.value,Q=N==null?void 0:N.getBoundingClientRect(),We=(Q==null?void 0:Q.height)||(N==null?void 0:N.offsetHeight)||112,xt=(Q==null?void 0:Q.width)||(N==null?void 0:N.offsetWidth)||160,Bt=dr(C,We),Ln=P.getBoundingClientRect(),Gt=8,un=4,jn=Math.max(Gt,window.innerWidth-xt-Gt),Yn=Jt(Ln.right-xt,Gt,jn),Jr=Jt(Bt==="up"?Ln.top-We-un:Ln.bottom+un,Gt,Math.max(Gt,window.innerHeight-We-Gt));p.value={left:`${Math.round(Yn)}px`,top:`${Math.round(Jr)}px`}}function Re(){const C=l.value;C&&Fe(C)}function In(){window.addEventListener("resize",Re),document.addEventListener("scroll",Re,!0)}function Ot(){window.removeEventListener("resize",Re),document.removeEventListener("scroll",Re,!0)}function Mn(C){const P=a.value;if(!P)return!1;const N=xe.get(P);if(!N)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(N))return!0;const We=C.target;return We instanceof Node?N.contains(We):!1}function wn(C){const P=l.value;if(!P)return!1;const N=je.get(P);if(!N)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(N))return!0;const We=C.target;return We instanceof Node?N.contains(We):!1}function bn(C){if(Ae.value){const P=Ve.value,N=typeof C.composedPath=="function"?C.composedPath():[];!!P&&(N.includes(P)||C.target instanceof Node&&P.contains(C.target))||(Ae.value=!1)}a.value&&(Mn(C)||rt(),l.value&&(wn(C)||Ie()))}function Jn(C){a.value&&!Mn(C)&&rt(),l.value&&!wn(C)&&Ie()}function _n(){Ae.value&&(Ae.value=!1),a.value&&rt(),l.value&&Ie()}function fr(){window.addEventListener("pointerdown",bn,{capture:!0}),window.addEventListener("focusin",Jn,{capture:!0}),window.addEventListener("blur",_n)}function En(){window.removeEventListener("pointerdown",bn,{capture:!0}),window.removeEventListener("focusin",Jn,{capture:!0}),window.removeEventListener("blur",_n)}function Cn(C,P){const N=P.getBoundingClientRect().height;if(!Number.isFinite(N)||N<=0)return;const Q=ce.value[C];Q!==void 0&&Math.abs(Q-N)<.5||(ce.value={...ce.value,[C]:N})}function x(C,P){const N=ne.get(C);N&&N!==P&&Ke&&Ke.unobserve(N);const Q=P instanceof HTMLElement?P:P&&"$el"in P&&P.$el instanceof HTMLElement?P.$el:null;if(Q){ne.set(C,Q),Ne.set(Q,C),Cn(C,Q),Ke==null||Ke.observe(Q);return}N&&(Ke==null||Ke.unobserve(N)),ne.delete(C)}function F(C,P){if(C.button!==0||ue.value||pe.value)return;const N=n.groups.findIndex(Bt=>Bt.projectName===P),Q=ne.get(P);if(N<0||!Q)return;const We=Q.getBoundingClientRect(),xt=yt(P)?0:cu;ue.value={projectName:P,fromIndex:N,startClientX:C.clientX,startClientY:C.clientY,pointerOffsetY:C.clientY-We.top,groupLeft:We.left,groupWidth:We.width,groupHeight:We.height,groupOuterHeight:We.height+xt},C.preventDefault(),ie()}function ie(){window.addEventListener("mousemove",v),window.addEventListener("mouseup",g),window.addEventListener("keydown",w)}function Oe(){window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",g),window.removeEventListener("keydown",w)}function v(C){Me={clientX:C.clientX,clientY:C.clientY},B()}function g(C){J({clientX:C.clientX,clientY:C.clientY});const P=pe.value;if(P&&E.value!==null){const N=n.groups.findIndex(Q=>Q.projectName===P.projectName);if(N>=0){const Q=E.value;Q!==N&&r("reorder-project",{projectName:P.projectName,toIndex:Q})}}M()}function w(C){C.key==="Escape"&&(!ue.value&&!pe.value||(C.preventDefault(),M()))}function M(){le!==null&&(window.cancelAnimationFrame(le),le=null),Me=null,ue.value=null,pe.value=null,se.value="",Oe()}function B(){le===null&&(le=window.requestAnimationFrame(()=>{if(le=null,!Me)return;const C=Me;Me=null,J(C)}))}function J(C){const P=ue.value;if(!pe.value&&P){const N=C.clientX-P.startClientX,Q=C.clientY-P.startClientY;if(Math.hypot(N,Q)<yw)return;rt(),se.value=P.projectName,pe.value={projectName:P.projectName,fromIndex:P.fromIndex,pointerOffsetY:P.pointerOffsetY,groupLeft:P.groupLeft,groupWidth:P.groupWidth,groupHeight:P.groupHeight,groupOuterHeight:P.groupOuterHeight,ghostTop:C.clientY-P.pointerOffsetY,dropTargetIndexFull:null}}pe.value&&Ce(C)}function Ce(C){const P=pe.value;if(!P)return;if(P.ghostTop=C.clientY-P.pointerOffsetY,!X(C)){P.dropTargetIndexFull=null;return}const N=C.clientY,Q=_e.value;if(!Q){P.dropTargetIndexFull=null;return}const We=Q.getBoundingClientRect(),xt=new Map(n.groups.map((un,jn)=>[un.projectName,jn])),Bt=n.groups.map(un=>un.projectName).filter(un=>un!==P.projectName);let Ln=0,Gt=n.groups.length;for(const un of Bt){const jn=xt.get(un);if(jn===void 0)continue;const Yn=yn(un),Jr=We.top+Ln+Yn/2;if(N<Jr){Gt=jn;break}Ln+=Yn}P.dropTargetIndexFull=Gt}function X(C){const P=_e.value;if(!P)return!1;const N=P.getBoundingClientRect(),Q=C.clientX>=N.left&&C.clientX<=N.right,We=C.clientY>=N.top-32&&C.clientY<=N.bottom+32;return Q&&We}function Te(C){var P;return((P=pe.value)==null?void 0:P.projectName)===C}function he(C){const P=pe.value,N=K.value[C]??0,Q=a.value===C;return!P||P.projectName!==C?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Q?"40":"1",transform:`translate3d(0, ${N}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${P.groupLeft}px`,width:`${P.groupWidth}px`,height:`${P.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${P.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function ze(C){return C.threads.filter(P=>!U(P.id))}function Nt(C){if(ut.value)return ze(C);if(yt(C.projectName))return[];const P=ze(C);return $t(C.projectName)?P:P.slice(0,10)}function Dt(C){return ut.value?!1:!yt(C.projectName)&&ze(C).length>10}function Et(C){return ze(C).length>0}function Ft(C){return C.inProgress?"working":C.unread?"unread":"idle"}lt(()=>n.groups.map(C=>C.projectName),C=>{var We,xt;const P=((We=pe.value)==null?void 0:We.projectName)??((xt=ue.value)==null?void 0:xt.projectName)??"";P&&!n.groups.some(Bt=>Bt.projectName===P)&&M();const N=new Set(C),Q=Object.fromEntries(Object.entries(ce.value).filter(([Bt])=>N.has(Bt)));Object.keys(Q).length!==Object.keys(ce.value).length&&(ce.value=Q)});const Bs=fe(()=>Ae.value||a.value!==""||l.value!=="");return lt(Bs,C=>{if(C){fr();return}En()}),lt(l,C=>{if(!C){Ot();return}In(),Wt(()=>{Fe(C)})}),Mr(()=>{for(const C of ne.values())Ke==null||Ke.unobserve(C);ne.clear(),xe.clear(),Ot(),En(),M()}),(C,P)=>(m(),b("section",hy,[T.value.length>0?(m(),b("section",py,[y("ul",my,[(m(!0),b(Pe,null,it(T.value,N=>(m(),b("li",{key:N.id,class:"thread-row-item","data-menu-open":ke(N.id)?"true":"false"},[$e(ns,{class:"thread-row","data-active":N.id===e.selectedThreadId,"data-pinned":U(N.id),"data-menu-open":ke(N.id)?"true":"false","force-right-hover":ke(N.id)},{left:wt(()=>[y("span",vy,[N.inProgress||N.unread?(m(),b("span",{key:0,class:"thread-status-indicator","data-state":Ft(N)},null,8,yy)):de("",!0),y("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>Y(N.id)},[$e(ca,{class:"thread-icon"})],8,wy)])]),right:wt(()=>[y("span",Ty,H(R(N.createdAtIso||N.updatedAtIso)),1)]),"right-hover":wt(()=>[y("div",{ref_for:!0,ref:Q=>cn(N.id,Q),class:"thread-menu-wrap"},[y("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:mt(Q=>Le(N.id),["stop"])},[$e(qs,{class:"thread-icon"})],8,Sy)],512)]),default:wt(()=>[y("button",{class:"thread-main-button",type:"button",onClick:Q=>z(N.id)},[y("span",_y,[y("span",ky,H(N.title),1),N.hasWorktree?(m(),ht(qo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):de("",!0)])],8,by)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,gy))),128))])])):de("",!0),$e(ns,{as:"header",class:"thread-tree-header-row"},{right:wt(()=>[y("div",{ref_key:"organizeMenuWrapRef",ref:Ve,class:"organize-menu-wrap"},[y("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Ae.value,"aria-label":"Organize threads",title:"Organize threads",onClick:vt},[$e(qs,{class:"thread-icon"})],8,Iy),Ae.value?(m(),b("div",{key:0,class:"organize-menu-panel",onClick:P[2]||(P[2]=mt(()=>{},["stop"]))},[P[12]||(P[12]=y("p",{class:"organize-menu-title"},"Organize",-1)),y("button",{class:"organize-menu-item","data-active":Ze.value==="project",type:"button",onClick:P[0]||(P[0]=N=>Pt("project"))},[P[10]||(P[10]=y("span",null,"By project",-1)),Ze.value==="project"?(m(),b("span",Cy,"✓")):de("",!0)],8,Ey),y("button",{class:"organize-menu-item","data-active":Ze.value==="chronological",type:"button",onClick:P[1]||(P[1]=N=>Pt("chronological"))},[P[11]||(P[11]=y("span",null,"Chronological list",-1)),Ze.value==="chronological"?(m(),b("span",xy,"✓")):de("",!0)],8,Ay)])):de("",!0)],512)]),default:wt(()=>[P[13]||(P[13]=y("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),ut.value&&W.value.length===0?(m(),b("p",Ry,"No matching threads")):e.isLoading&&e.groups.length===0?(m(),b("p",Py,"Loading threads...")):ge.value?(m(),b("ul",My,[(m(!0),b(Pe,null,it(me.value,N=>(m(),b("li",{key:N.id,class:"thread-row-item","data-menu-open":ke(N.id)?"true":"false"},[$e(ns,{class:"thread-row","data-active":N.id===e.selectedThreadId,"data-pinned":U(N.id),"data-menu-open":ke(N.id)?"true":"false","force-right-hover":ke(N.id)},{left:wt(()=>[y("span",Oy,[N.inProgress||N.unread?(m(),b("span",{key:0,class:"thread-status-indicator","data-state":Ft(N)},null,8,Ny)):de("",!0),y("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>Y(N.id)},[$e(ca,{class:"thread-icon"})],8,Dy)])]),right:wt(()=>[y("span",By,H(R(N.createdAtIso||N.updatedAtIso)),1)]),"right-hover":wt(()=>[y("div",{ref_for:!0,ref:Q=>cn(N.id,Q),class:"thread-menu-wrap"},[y("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:mt(Q=>Le(N.id),["stop"])},[$e(qs,{class:"thread-icon"})],8,Uy)],512)]),default:wt(()=>[y("button",{class:"thread-main-button",type:"button",onClick:Q=>z(N.id)},[y("span",jy,[y("span",Fy,H(N.title),1),N.hasWorktree?(m(),ht(qo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):de("",!0)])],8,Ly)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,$y))),128))])):(m(),b("div",{key:4,ref_key:"groupsContainerRef",ref:_e,class:"thread-tree-groups",style:Wr(q.value)},[(m(!0),b(Pe,null,it(W.value,N=>(m(),b("article",{key:N.projectName,ref_for:!0,ref:Q=>x(N.projectName,Q),class:"project-group","data-project-name":N.projectName,"data-expanded":!yt(N.projectName),"data-dragging":Te(N.projectName),style:Wr(he(N.projectName))},[$e(ns,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Q=>Rn(N.projectName),onKeydown:[Q=>zt(Q,N.projectName),pn(mt(Q=>Rn(N.projectName),["prevent"]),["enter"]),pn(mt(Q=>Rn(N.projectName),["prevent"]),["space"])]},{left:wt(()=>[y("span",Wy,[y("span",Vy,[yt(N.projectName)?(m(),ht($l,{key:0,class:"thread-icon"})):(m(),ht(ey,{key:1,class:"thread-icon"}))]),y("span",zy,[yt(N.projectName)?(m(),ht(Ff,{key:0,class:"thread-icon"})):(m(),ht(Ai,{key:1,class:"thread-icon"}))])])]),right:wt(()=>[y("div",Ky,[y("div",{ref_for:!0,ref:Q=>Pn(N.projectName,Q),class:"project-menu-wrap"},[y("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:mt(Q=>pt(N.projectName),["stop"])},[$e(qs,{class:"thread-icon"})],8,Jy),Kt(N.projectName)?(m(),b("div",{key:0,class:"project-menu-panel","data-open-direction":d.value[N.projectName]??"down",onClick:P[4]||(P[4]=mt(()=>{},["stop"]))},[_.value==="actions"?(m(),b(Pe,{key:0},[y("button",{class:"project-menu-item",type:"button",onClick:Q=>vn(N.projectName)}," Browse files ",8,Qy),y("button",{class:"project-menu-item",type:"button",onClick:Q=>xn(N.projectName)}," Edit name ",8,Xy),y("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Q=>ft(N.projectName)}," Remove ",8,Zy)],64)):(m(),b(Pe,{key:1},[P[14]||(P[14]=y("label",{class:"project-menu-label"},"Project name",-1)),Er(y("input",{"onUpdate:modelValue":P[3]||(P[3]=Q=>I.value=Q),class:"project-menu-input",type:"text",onInput:Q=>St(N.projectName)},null,40,ew),[[Cr,I.value]])],64))],8,Yy)):de("",!0)],512),y("button",{class:"thread-start-button",type:"button","aria-label":we(N.projectName),title:we(N.projectName),onClick:mt(Q=>ve(N.projectName),["stop"])},[$e(ii,{class:"thread-icon"})],8,tw)])]),default:wt(()=>[y("span",{class:"project-main-button","data-dragging-handle":Te(N.projectName),onMousedown:mt(Q=>F(Q,N.projectName),["left"])},[y("span",qy,H(nt(N.projectName)),1)],40,Gy)]),_:2},1032,["onClick","onKeydown"]),Et(N)?(m(),b("ul",nw,[(m(!0),b(Pe,null,it(Nt(N),Q=>(m(),b("li",{key:Q.id,class:"thread-row-item","data-menu-open":ke(Q.id)?"true":"false"},[$e(ns,{class:"thread-row","data-active":Q.id===e.selectedThreadId,"data-pinned":U(Q.id),"data-menu-open":ke(Q.id)?"true":"false","force-right-hover":ke(Q.id)},{left:wt(()=>[y("span",sw,[Q.inProgress||Q.unread?(m(),b("span",{key:0,class:"thread-status-indicator","data-state":Ft(Q)},null,8,ow)):de("",!0),y("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:We=>Y(Q.id)},[$e(ca,{class:"thread-icon"})],8,iw)])]),right:wt(()=>[y("span",uw,H(R(Q.createdAtIso||Q.updatedAtIso)),1)]),"right-hover":wt(()=>[y("div",{ref_for:!0,ref:We=>cn(Q.id,We),class:"thread-menu-wrap"},[y("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:mt(We=>Le(Q.id),["stop"])},[$e(qs,{class:"thread-icon"})],8,dw)],512)]),default:wt(()=>[y("button",{class:"thread-main-button",type:"button",onClick:We=>z(Q.id)},[y("span",lw,[y("span",cw,H(Q.title),1),Q.hasWorktree?(m(),ht(qo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):de("",!0)])],8,aw)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,rw))),128))])):(m(),ht(ns,{key:1,as:"p",class:"project-empty-row"},{left:wt(()=>[...P[15]||(P[15]=[y("span",{class:"project-empty-spacer"},null,-1)])]),default:wt(()=>[P[16]||(P[16]=y("span",{class:"project-empty"},"No threads",-1))]),_:1})),Dt(N)?(m(),ht(ns,{key:2,class:"thread-show-more-row"},{left:wt(()=>[...P[17]||(P[17]=[y("span",{class:"thread-show-more-spacer"},null,-1)])]),default:wt(()=>[y("button",{class:"thread-show-more-button",type:"button",onClick:Q=>Sn(N.projectName)},H($t(N.projectName)?"Show less":"Show more"),9,fw)]),_:2},1024)):de("",!0)],12,Hy))),128))],4)),(m(),ht(eo,{to:"body"},[De.value?(m(),b("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:He,class:"thread-menu-panel thread-menu-panel-fixed",style:Wr(p.value),"data-open-direction":Dn(De.value.id),onClick:P[8]||(P[8]=mt(()=>{},["stop"]))},[y("button",{class:"thread-menu-item",type:"button",onClick:P[5]||(P[5]=N=>G(De.value.id))}," Export chat "),y("button",{class:"thread-menu-item",type:"button",onClick:P[6]||(P[6]=N=>et(De.value.id,De.value.title))}," Rename thread "),y("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:P[7]||(P[7]=N=>Ge(De.value.id,De.value.title))}," Delete thread ")],12,hw)):de("",!0)])),(m(),ht(eo,{to:"body"},[j.value?(m(),b("div",{key:0,class:"rename-thread-overlay",onClick:mt(Ye,["self"])},[y("div",pw,[P[18]||(P[18]=y("h3",{class:"rename-thread-title"},"Rename thread",-1)),P[19]||(P[19]=y("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Er(y("input",{ref_key:"renameThreadInputRef",ref:ae,"onUpdate:modelValue":P[9]||(P[9]=N=>Z.value=N),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[pn(mt(Tt,["prevent"]),["enter"]),pn(mt(Ye,["prevent"]),["esc"])]},null,40,mw),[[Cr,Z.value]]),y("div",{class:"rename-thread-actions"},[y("button",{class:"rename-thread-button",type:"button",onClick:Ye},"Cancel"),y("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Tt},"Save")])])])):de("",!0)])),(m(),ht(eo,{to:"body"},[V.value?(m(),b("div",{key:0,class:"rename-thread-overlay",onClick:mt(dt,["self"])},[y("div",gw,[P[20]||(P[20]=y("h3",{class:"rename-thread-title"},"Delete thread?",-1)),y("p",vw,' This will archive the thread "'+H(re.value)+'". You can find it later in archived threads. ',1),y("div",{class:"rename-thread-actions"},[y("button",{class:"rename-thread-button",type:"button",onClick:dt},"Cancel"),y("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:tt},"Delete")])])])):de("",!0)]))]))}}),bw=ct(ww,[["__scopeId","data-v-2e1439c4"]]),_w={class:"content-header"},kw={class:"content-leading"},Tw={class:"content-title"},Sw={class:"content-actions"},Iw=qt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(m(),b("header",_w,[y("div",kw,[ar(t.$slots,"leading",{},void 0)]),y("h1",Tw,H(e.title),1),y("div",Sw,[ar(t.$slots,"actions",{},void 0)])]))}}),Ew=ct(Iw,[["__scopeId","data-v-66ee223c"]]),Cw={},Aw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function xw(e,t){return m(),b("svg",Aw,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Ol=ct(Cw,[["render",xw]]),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 m(),b("svg",Pw,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const $w=ct(Rw,[["render",Mw]]),Ow={},Nw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Dw(e,t){return m(),b("svg",Nw,[...t[0]||(t[0]=[y("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=ct(Ow,[["render",Dw]]),jw={class:"conversation-root"},Fw={key:0,class:"conversation-loading"},Bw={key:1,class:"conversation-empty"},Uw=["data-role","data-message-type"],Hw={key:0,class:"message-row","data-role":"system"},Ww={class:"message-stack","data-role":"system"},Vw=["onClick"],zw={class:"cmd-label"},Gw={class:"cmd-status"},qw={class:"cmd-output-inner"},Kw={class:"cmd-output"},Jw=["data-role","data-message-type"],Yw=["data-role"],Qw=["data-role"],Xw=["data-role"],Zw=["onClick"],eb=["src"],tb={key:1,class:"message-file-attachments"},nb=["href","title"],rb=["data-role"],sb={key:0,class:"worked-separator-wrap","aria-live":"polite"},ob=["onClick"],ib={class:"worked-separator-text"},ab={key:0,class:"worked-details"},lb=["onClick"],cb={class:"cmd-label"},ub={class:"cmd-status"},db={class:"cmd-output-inner"},fb={class:"cmd-output"},hb=["data-streaming"],pb={class:"plan-card-header"},mb={key:0,class:"plan-card-badge"},gb=["innerHTML"],vb={key:1,class:"plan-step-list"},yb=["data-status"],wb=["data-status"],bb=["innerHTML"],_b=["innerHTML"],kb={key:2,class:"message-text-flow"},Tb={key:0,class:"message-text"},Sb={key:0},Ib={key:1,class:"message-bold-text"},Eb={key:2,class:"message-italic-text"},Cb={key:3,class:"message-strikethrough-text"},Ab=["href","title"],xb=["href","title"],Rb={key:6,class:"message-inline-code"},Pb={key:0},Mb={key:1,class:"message-bold-text"},$b={key:2,class:"message-italic-text"},Ob={key:3,class:"message-strikethrough-text"},Nb=["href","title"],Db=["href","title"],Lb={key:6,class:"message-inline-code"},jb={key:2,class:"message-blockquote"},Fb={key:0},Bb={key:1,class:"message-bold-text"},Ub={key:2,class:"message-italic-text"},Hb={key:3,class:"message-strikethrough-text"},Wb=["href","title"],Vb=["href","title"],zb={key:6,class:"message-inline-code"},Gb={key:3,class:"message-list message-list-unordered"},qb={class:"message-list-item-text"},Kb={key:0},Jb={key:1,class:"message-bold-text"},Yb={key:2,class:"message-italic-text"},Qb={key:3,class:"message-strikethrough-text"},Xb=["href","title"],Zb=["href","title"],e_={key:6,class:"message-inline-code"},t_={key:4,class:"message-list message-task-list"},n_=["data-checked"],r_={class:"message-list-item-text"},s_={key:0},o_={key:1,class:"message-bold-text"},i_={key:2,class:"message-italic-text"},a_={key:3,class:"message-strikethrough-text"},l_=["href","title"],c_=["href","title"],u_={key:6,class:"message-inline-code"},d_={key:5,class:"message-list message-list-ordered"},f_={class:"message-list-item-text"},h_={key:0},p_={key:1,class:"message-bold-text"},m_={key:2,class:"message-italic-text"},g_={key:3,class:"message-strikethrough-text"},v_=["href","title"],y_=["href","title"],w_={key:6,class:"message-inline-code"},b_={key:6,class:"message-code-block"},__={key:0,class:"message-code-language"},k_={class:"message-code-pre"},T_={key:7,class:"message-divider"},S_={key:8,class:"message-text"},I_=["onClick"],E_=["src","alt","onError"],C_={key:0,class:"message-actions"},A_=["onClick"],x_=["onClick"],R_={key:0,class:"conversation-item conversation-item-overlay"},P_={class:"message-row"},M_={class:"message-stack"},$_={class:"live-overlay-inline","aria-live":"polite"},O_={class:"live-overlay-label"},N_={key:1,class:"live-overlay-error"},D_={class:"message-row"},L_={class:"message-stack"},j_={class:"request-card"},F_={class:"request-title"},B_={class:"request-meta"},U_={key:0,class:"request-reason"},H_={key:1,class:"request-actions"},W_=["onClick"],V_=["onClick"],z_=["onClick"],G_=["onClick"],q_={key:2,class:"request-actions"},K_=["onClick"],J_=["onClick"],Y_=["onClick"],Q_=["onClick"],X_={key:3,class:"request-user-input"},Z_={class:"request-question-title"},ek={key:0,class:"request-question-text"},tk=["value","onChange"],nk=["value"],rk={key:2,class:"request-question-option-description"},sk=["type","value","placeholder","onInput"],ok=["type","value","onInput"],ik=["onClick"],ak={key:4,class:"request-actions"},lk=["onClick"],ck=["onClick"],uk={key:5,class:"request-actions"},dk=["onClick"],fk=["onClick"],hk=["src"],pk=16,mk=qt({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{},isTurnInProgress:{type:Boolean},isRollingBack:{type:Boolean}},emits:["updateScrollState","respondServerRequest","rollback"],setup(e,{emit:t}){const n=D(new Set),r=D(new Set),s=D(new Set),o=D({});function i(v){var B;const g=v.replace(/\r\n/g,`
26
+ `).trim();if(!g)return null;const w=[],M=[];for(const J of g.split(`
27
+ `)){const Ce=J.trim();if(!Ce){w.length===0&&M.push("");continue}const X=Ce.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(X){const Te=(X[1]??" ").toLowerCase();let he="pending";Te==="x"&&(he="completed"),(Te==="~"||Te===">"||Te==="-")&&(he="inProgress"),w.push({step:((B=X[2])==null?void 0:B.trim())??"",status:he});continue}M.push(Ce)}return w.length===0?null:{explanation:M.join(`
28
+ `).trim(),steps:w.filter(J=>J.step.length>0)}}function a(v){var g;return v.plan&&v.plan.steps.length>0?{explanation:((g=v.plan.explanation)==null?void 0:g.trim())??"",steps:v.plan.steps}:i(v.text)}function l(v){return v.messageType==="commandExecution"&&!!v.commandExecution}function d(v){return v.messageType==="plan"||v.messageType==="plan.live"}function c(v){var g;return((g=a(v))==null?void 0:g.explanation)??""}function p(v){var g;return((g=a(v))==null?void 0:g.steps)??[]}function _(v){switch(v){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function I(v){var g;return((g=v.commandExecution)==null?void 0:g.status)==="inProgress"||r.value.has(v.id)?!0:n.value.has(v.id)}function j(v){return r.value.has(v.id)}function $(v){var w;if(((w=v.commandExecution)==null?void 0:w.status)==="inProgress")return;const g=new Set(n.value);g.has(v.id)?g.delete(v.id):g.add(v.id),n.value=g}function Z(v){const g=new Set(s.value);g.has(v.id)?g.delete(v.id):g.add(v.id),s.value=g}function ae(v){return s.value.has(v.id)}function V(v){const g=v.commandExecution;if(!g)return"";switch(g.status){case"inProgress":return"⟳ Running";case"completed":return g.exitCode===0?"✓ Completed":`✗ Exit ${g.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function te(v){var w,M;const g=(w=v.commandExecution)==null?void 0:w.status;return g==="inProgress"?"cmd-status-running":g==="completed"&&((M=v.commandExecution)==null?void 0:M.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function re(v){const g=new Set(r.value);g.add(v),r.value=g,setTimeout(()=>{const w=new Set(r.value);w.delete(v),r.value=w},1e3)}function _e(v,g){const w=[];for(let M=g-1;M>=0;M--){const B=v[M];if(B.messageType==="commandExecution")w.unshift(B);else if(B.role==="user"||B.messageType==="worked")break}return w}const ue=e,pe=t,Me=D(null),le=D(null),se=D(null),ce=D(""),ne=D({}),xe=D({});let je=0,Ne=0,Ve=0;const He=new WeakSet,Ae=D(new Set);function Ze(v){if(!v||/\s/u.test(v)||v.endsWith("/")||v.endsWith("\\"))return!1;if(v.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(v))return!1;const g=v.startsWith("/"),w=/^[A-Za-z]:[\\/]/u.test(v),M=v.startsWith("./")||v.startsWith("../")||v.startsWith("~/"),B=v.includes("/")||v.includes("\\");return g||w||M||B}function Ke(v){return v.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||v}function ot(v){return v.replace(/\\/gu,"/")}function Be(v){if(!v.startsWith("file://"))return v;let g=v.replace(/^file:\/\//u,"");try{g=decodeURIComponent(g)}catch{}return/^\/[A-Za-z]:\//u.test(g)&&(g=g.slice(1)),g}function Mt(v){const g=ot(v),w=g.match(/^\/Users\/([^/]+)/u);if(w)return`/Users/${w[1]}`;const M=g.match(/^\/home\/([^/]+)/u);return M?`/home/${M[1]}`:""}function ut(v){const g=ot(v);if(!g)return g;let w="",M=g;const B=M.match(/^([A-Za-z]:)(\/.*)?$/u);B?(w=`${B[1]}/`,M=(B[2]??"").replace(/^\/+/u,"")):M.startsWith("/")&&(w="/",M=M.slice(1));const J=M.split("/").filter(Boolean),Ce=[];for(const Te of J)if(Te!=="."){if(Te===".."){Ce.length>0&&Ce.pop();continue}Ce.push(Te)}const X=Ce.join("/");return w?`${w}${X}`.replace(/\/+$/u,"")||w:X||g}function It(v,g){const w=ot(Be(v.trim()));if(!w)return"";if(w.startsWith("/")||/^[A-Za-z]:\//u.test(w))return ut(w);if(w.startsWith("~/")){const J=Mt(g);if(J)return ut(`${J}/${w.slice(2)}`)}const B=ot(g.trim());return ut(B?`${B.replace(/\/+$/u,"")}/${w}`:w)}function Ue(v){if(!v)return null;let g=v.trim();g=W(g).core.trim();let M=null;const B=g.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(B)g=B[1],M=Number(B[2]);else{const J=g.match(/^(.*):(\d+)(?::\d+)?$/u);J&&(g=J[1],M=Number(J[2]))}return g=Be(g),Ze(g)?{path:g,line:M}:null}function W(v){let g=v,w="",M="";for(;/^[('"`[{<“‘]/u.test(g);)w+=g[0],g=g.slice(1);for(;/[)"'`\]}>”’]$/u.test(g);)M=g.slice(-1)+M,g=g.slice(0,-1);return{core:g,leading:w,trailing:M}}function ge(v){const w=v.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!w)return null;const M=(w[1]??"").trim(),B=(w[2]??"").trim(),J=W(M).core.trim()||M,Ce=W(B).core.trim();return Ce?{label:J,target:Ce}:null}function me(v){const g=Math.min(6,Math.max(1,Math.trunc(v)));return`h${String(g)}`}function be(v){switch(Math.min(6,Math.max(1,Math.trunc(v)))){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 De(v){const g=[],w=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let M=0;for(const B of v.matchAll(w)){if(typeof B.index!="number")continue;const J=B.index,Ce=J+B[0].length;J>M&&g.push({kind:"text",value:v.slice(M,J)});let X=B[0],Te="";for(;/[.,;:]$/u.test(X);)Te=X.slice(-1)+Te,X=X.slice(0,-1);const he=W(X);X=he.core;const ze=he.leading,Nt=he.trailing+Te;if(ze&&g.push({kind:"text",value:ze}),X.startsWith("**")&&X.endsWith("**")&&X.length>4)g.push({kind:"bold",value:X.slice(2,-2)}),Nt&&g.push({kind:"text",value:Nt});else if(/^https?:\/\//u.test(X))g.push({kind:"url",value:X,href:X}),Nt&&g.push({kind:"text",value:Nt});else{const Dt=Ue(X);Dt?(g.push({kind:"file",value:X,path:Dt.path,displayPath:X,downloadName:Ke(Dt.path)}),Nt&&g.push({kind:"text",value:Nt})):g.push({kind:"text",value:B[0]})}M=Ce}return M<v.length&&g.push({kind:"text",value:v.slice(M)}),E(g)}function T(v,g){const w=[];let M=!1,B="";const J=Ce=>{Ce&&w.push({kind:"text",value:Ce})};for(const Ce of v){if(Ce.kind!=="text"){M&&(J(`${g.marker}${B}`),M=!1,B=""),w.push(Ce);continue}let X=Ce.value;for(;X.length>0;){const Te=X.indexOf(g.marker);if(Te<0){M?B+=X:J(X);break}const he=X.slice(0,Te);if(M?B+=he:J(he),X=X.slice(Te+g.marker.length),M){const ze=B;ze.length>0&&(!g.isValidContent||g.isValidContent(ze))?w.push({kind:g.kind,value:ze}):J(`${g.marker}${ze}${g.marker}`),B="",M=!1}else M=!0}}return M&&J(`${g.marker}${B}`),w}function E(v){const g=M=>M.trim().length>0&&!/^\s/u.test(M)&&!/\s$/u.test(M);let w=T(v,{marker:"**",kind:"bold",isValidContent:g});return w=T(w,{marker:"~~",kind:"strikethrough",isValidContent:g}),w=T(w,{marker:"*",kind:"italic",isValidContent:g}),w}function O(v){const g=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,w=[];let M=0;for(const B of v.matchAll(g)){if(typeof B.index!="number")continue;const[J,Ce,X]=B,Te=B.index,he=Te+J.length;Te>M&&w.push(...De(v.slice(M,Te)));const ze=ge(`[${Ce??""}](${X??""})`),Nt=(ze==null?void 0:ze.label)??(Ce??"").trim(),Dt=(ze==null?void 0:ze.target)??(X??"").trim();if(/^https?:\/\//u.test(Dt))w.push({kind:"url",value:Nt||Dt,href:Dt});else{const Et=Ue(Dt);Et?w.push({kind:"file",value:Dt,path:Et.path,displayPath:Nt||Dt,downloadName:Ke(Et.path)}):w.push({kind:"text",value:J})}M=he}return M<v.length&&w.push(...De(v.slice(M))),w}function K(v){if(!v.includes("`"))return O(v);const g=[];let w=0,M=0;for(;w<v.length;){if(v[w]!=="`"){w+=1;continue}let B=1;for(;w+B<v.length&&v[w+B]==="`";)B+=1;const J="`".repeat(B);let Ce=w+B,X=-1;for(;Ce<v.length;){const he=v.indexOf(J,Ce);if(he<0)break;const ze=he>0&&v[he-1]==="`",Nt=he+B<v.length&&v[he+B]==="`",Dt=v.slice(w+B,he).includes(`
29
+ `);if(!ze&&!Nt&&!Dt){X=he;break}Ce=he+1}if(X<0){w+=B;continue}w>M&&g.push(...O(v.slice(M,w)));const Te=v.slice(w+B,X);if(Te.length>0){const he=ge(Te);if(he)if(/^https?:\/\//u.test(he.target))g.push({kind:"url",value:he.label||he.target,href:he.target});else{const ze=Ue(he.target);ze?g.push({kind:"file",value:he.target,path:ze.path,displayPath:he.label||he.target,downloadName:Ke(ze.path)}):g.push({kind:"code",value:Te})}else{const ze=Ue(Te);if(ze){const Nt=ze.line?`${ze.path}:${String(ze.line)}`:ze.path;g.push({kind:"file",value:Te,path:ze.path,displayPath:Nt,downloadName:Ke(ze.path)})}else g.push({kind:"code",value:Te})}}else g.push({kind:"text",value:`${J}${J}`});w=X+B,M=w}return M<v.length&&g.push(...O(v.slice(M))),g}function q(v){const g=v.trim();if(!g)return"";if(g.startsWith("data:")||g.startsWith("blob:")||g.startsWith("http://")||g.startsWith("https://")||g.startsWith("/codex-local-image?"))return g;if(g.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(g)}`;const w=g.startsWith("/"),M=/^[A-Za-z]:[\\/]/u.test(g);return w||M?`/codex-local-image?path=${encodeURIComponent(g)}`:g}function R(v){const g=v.trim();if(!g)return"#";const w=Ce=>Ce.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Ce),M=Ue(g),B=(M==null?void 0:M.path)??g,J=It(B,ue.cwd);if(w(J)){const Ce=J.startsWith("/")?J:`/${J}`;return`/codex-local-browse${encodeURI(Ce)}`}return"#"}function U(v){return v.replace(/\r\n/gu,`
30
+ `)}function Y(v){return v.trim().length===0}function z(v){const g=v.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return g?{level:g[1].length,value:g[2].trim()}:null}function G(v){const g=v.match(/^\s{0,3}>\s?(.*)$/u);return g?g[1]??"":null}function we(v){var w;const g=v.match(/^\s*[-*+]\s+(.+)$/u);return((w=g==null?void 0:g[1])==null?void 0:w.trim())??null}function ve(v){var w;const g=v.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return g?{checked:(g[1]??" ").toLowerCase()==="x",text:((w=g[2])==null?void 0:w.trim())??""}:null}function ke(v){var w;const g=v.match(/^\s*\d+[.)]\s+(.+)$/u);return((w=g==null?void 0:g[1])==null?void 0:w.trim())??null}function Ie(v){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(v.trim())}function Le(v){const g=v.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return g?{marker:g[1],language:(g[2]??"").trim()}:null}function et(v){const w=U(v).split(`
31
+ `),M=[];let B=0;for(;B<w.length;){if(Y(w[B])){B+=1;continue}const J=Le(w[B]);if(J){B+=1;const Et=[];for(;B<w.length;){if(w[B].trim()===J.marker){B+=1;break}Et.push(w[B]),B+=1}M.push({kind:"codeBlock",language:J.language,value:Et.join(`
32
+ `)});continue}if(Ie(w[B])){M.push({kind:"thematicBreak"}),B+=1;continue}const Ce=z(w[B]);if(Ce){M.push({kind:"heading",level:Ce.level,value:Ce.value}),B+=1;continue}if(G(w[B])!==null){const Et=[];for(;B<w.length;){const Ft=G(w[B]);if(Ft===null)break;Et.push(Ft),B+=1}M.push({kind:"blockquote",value:Et.join(`
33
+ `).trim()});continue}if(ve(w[B])!==null){const Et=[];for(;B<w.length;){const Ft=ve(w[B]);if(Ft===null)break;Et.push(Ft),B+=1}if(Et.length>0){M.push({kind:"taskList",items:Et});continue}}if(we(w[B])!==null){const Et=[];for(;B<w.length;){const Ft=we(w[B]);if(Ft===null)break;Et.push(Ft),B+=1}if(Et.length>0){M.push({kind:"unorderedList",items:Et});continue}}if(ke(w[B])!==null){const Et=[];for(;B<w.length;){const Ft=ke(w[B]);if(Ft===null)break;Et.push(Ft),B+=1}if(Et.length>0){M.push({kind:"orderedList",items:Et});continue}}const Nt=[];for(;B<w.length&&!(Y(w[B])||Le(w[B])||Ie(w[B])||z(w[B])||G(w[B])!==null||ve(w[B])!==null||we(w[B])!==null||ke(w[B])!==null);)Nt.push(w[B]),B+=1;const Dt=Nt.join(`
34
+ `).trim();Dt&&M.push({kind:"paragraph",value:Dt})}return M}function Ye(v){if(!v.includes("![")||!v.includes("]("))return et(v);const g=[],w=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let M=0;for(const B of v.matchAll(w)){const[J,Ce,X]=B;if(typeof B.index!="number")continue;const Te=B.index,he=Te+J.length,ze=q(X.trim());ze&&(Te>M&&g.push(...et(v.slice(M,Te))),g.push({kind:"image",url:ze,alt:Ce.trim(),markdown:J}),M=he)}return M<v.length&&g.push(...et(v.slice(M))),g}function Tt(v){const w=U(v).split(`
35
+ `),M=[];let B=0,J=0;const Ce=X=>{if(X<=J)return;const Te=w.slice(J,X).join(`
36
+ `);M.push(...Ye(Te))};for(;B<w.length;){const X=Le(w[B]);if(!X){B+=1;continue}Ce(B),B+=1;const Te=[];for(;B<w.length;){if(w[B].trim()===X.marker){B+=1;break}Te.push(w[B]),B+=1}M.push({kind:"codeBlock",language:X.language,value:Te.join(`
37
+ `)}),J=B}return Ce(w.length),M.length>0?M:[{kind:"paragraph",value:v}]}function Ge(v){return v.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function dt(v){return K(v).map(g=>g.kind==="text"?Ge(g.value):g.kind==="bold"?`<strong class="message-bold-text">${Ge(g.value)}</strong>`:g.kind==="italic"?`<em class="message-italic-text">${Ge(g.value)}</em>`:g.kind==="strikethrough"?`<s class="message-strikethrough-text">${Ge(g.value)}</s>`:g.kind==="file"?`<a class="message-file-link" href="${Ge(R(g.path))}" target="_blank" rel="noopener noreferrer" title="${Ge(g.path)}">${Ge(g.displayPath)}</a>`:g.kind==="url"?`<a class="message-file-link" href="${Ge(g.href)}" target="_blank" rel="noopener noreferrer" title="${Ge(g.href)}">${Ge(g.value)}</a>`:`<code class="message-inline-code">${Ge(g.value)}</code>`).join("")}function tt(v){return Tt(v).map(g=>{if(g.kind==="paragraph")return`<p class="message-text">${dt(g.value)}</p>`;if(g.kind==="heading"){const w=Math.min(6,Math.max(1,Math.trunc(g.level))),M=me(w),B=`message-heading ${be(w)}`;return`<${M} class="${B}">${dt(g.value)}</${M}>`}return g.kind==="blockquote"?`<blockquote class="message-blockquote">${dt(g.value)}</blockquote>`:g.kind==="unorderedList"?`<ul class="message-list message-list-unordered">${g.items.map(M=>`<li class="message-list-item"><div class="message-list-item-text">${dt(M)}</div></li>`).join("")}</ul>`:g.kind==="taskList"?`<ul class="message-list message-task-list">${g.items.map(M=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${M.checked?"true":"false"}">${M.checked?"☑":"☐"}</span><div class="message-list-item-text">${dt(M.text)}</div></li>`).join("")}</ul>`:g.kind==="orderedList"?`<ol class="message-list message-list-ordered">${g.items.map(M=>`<li class="message-list-item"><div class="message-list-item-text">${dt(M)}</div></li>`).join("")}</ol>`:g.kind==="codeBlock"?`<div class="message-code-block">${g.language?`<div class="message-code-language">${Ge(g.language)}</div>`:""}<pre class="message-code-pre"><code>${Ge(g.value)}</code></pre></div>`:g.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${Ge(g.url)}" alt="${Ge(g.alt||"Embedded message image")}" loading="lazy">`}).join("")}function nt(v){return v!==null&&typeof v=="object"&&!Array.isArray(v)?v:null}function Kt(v){const g=new Date(v);return Number.isNaN(g.getTime())?v:g.toLocaleTimeString()}function rt(v){const g=nt(v.params),w=g==null?void 0:g.reason;return typeof w=="string"?w.trim():""}function vt(v,g){return`${String(v)}:${g}`}function Pt(v){const g=nt(v.params),w=Array.isArray(g==null?void 0:g.questions)?g.questions:[],M=[];for(const B of w){const J=nt(B);if(!J)continue;const Ce=typeof J.id=="string"?J.id:"";if(!Ce)continue;const X=Array.isArray(J.options)?J.options.map(Te=>nt(Te)).map(Te=>({label:typeof(Te==null?void 0:Te.label)=="string"?Te.label:"",description:typeof(Te==null?void 0:Te.description)=="string"?Te.description:""})).filter(Te=>Te.label.length>0):[];M.push({id:Ce,header:typeof J.header=="string"?J.header:"",question:typeof J.question=="string"?J.question:"",isSecret:J.isSecret===!0,isOther:J.isOther===!0,options:X})}return M}function pt(v,g,w){const M=vt(v,g),B=ne.value[M];return typeof B=="string"&&B.length>0?B:w}function xn(v,g,w){const M=w.target;if(!(M instanceof HTMLInputElement))return;const B=vt(v,g);ne.value={...ne.value,[B]:M.value}}function St(v,g){var B;const w=pt(v,g.id,((B=g.options[0])==null?void 0:B.label)||""),M=g.options.find(J=>J.label===w);return(M==null?void 0:M.description)??""}function ft(v,g){const w=vt(v,g);return xe.value[w]??""}function vn(v,g,w){const M=w.target;if(!(M instanceof HTMLSelectElement))return;const B=vt(v,g);ne.value={...ne.value,[B]:M.value}}function zt(v,g,w){const M=w.target;if(!(M instanceof HTMLInputElement))return;const B=vt(v,g);xe.value={...xe.value,[B]:M.value}}function $t(v,g){pe("respondServerRequest",{id:v,result:{decision:g}})}function yt(v){var M;const g=Pt(v),w={};for(const B of g){const J=pt(v.id,B.id,((M=B.options[0])==null?void 0:M.label)||""),Ce=ft(v.id,B.id).trim(),X=[J,Ce].map(Te=>Te.trim()).filter(Te=>Te.length>0);w[B.id]={answers:X}}pe("respondServerRequest",{id:v.id,result:{answers:w}})}function Sn(v){pe("respondServerRequest",{id:v,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function Rn(v){pe("respondServerRequest",{id:v,result:{success:!0,contentItems:[]}})}function yn(v){pe("respondServerRequest",{id:v,result:{}})}function Pn(v){pe("respondServerRequest",{id:v,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function cn(v){return!(v.role!=="user"&&v.role!=="assistant"||typeof v.turnIndex!="number"||ue.isTurnInProgress||ue.isRollingBack)}function Qt(v){return v.role!=="user"&&v.role!=="assistant"?!1:v.text.trim().length>0}function Xt(v){return Qt(v)||cn(v)}async function dr(v){if(!Qt(v))return;const g=v.text.trim();try{await navigator.clipboard.writeText(g)}catch{const w=document.createElement("textarea");w.value=g,w.setAttribute("readonly","true"),w.style.position="fixed",w.style.opacity="0",document.body.appendChild(w),w.select(),document.execCommand("copy"),document.body.removeChild(w)}}function Dn(v){cn(v)&&pe("rollback",{turnIndex:v.turnIndex})}function Zt(){const v=Me.value,g=le.value;!v||!g||(v.scrollTop=v.scrollHeight,g.scrollIntoView({block:"end"}))}function Jt(v){return v.scrollHeight-(v.scrollTop+v.clientHeight)<=pk}function Fe(v){if(!ue.activeThreadId)return;const g=Math.max(v.scrollHeight-v.clientHeight,0),w=g>0?Math.min(Math.max(v.scrollTop/g,0),1):1;pe("updateScrollState",{threadId:ue.activeThreadId,state:{scrollTop:v.scrollTop,isAtBottom:Jt(v),scrollRatio:w}})}function Re(){const v=Me.value;if(!v)return;const g=ue.scrollState;if(!g||g.isAtBottom){In();return}const w=Math.max(v.scrollHeight-v.clientHeight,0),M=typeof g.scrollRatio=="number"?g.scrollRatio*w:g.scrollTop;v.scrollTop=Math.min(Math.max(M,0),w),Fe(v)}function In(){const v=Me.value;v&&(Zt(),Fe(v))}function Ot(){const v=ue.scrollState;return!v||v.isAtBottom===!0}function Mn(){if(!Ot()){Ve=0,Ne=0;return}if(In(),Ve-=1,Ve<=0){Ne=0;return}Ne=requestAnimationFrame(Mn)}function wn(v=6){Ot()&&(Ne&&(cancelAnimationFrame(Ne),Ne=0),Ve=Math.max(v,1),Ne=requestAnimationFrame(Mn))}function bn(){wn(3)}function Jn(){if(!Ot())return;const v=Me.value;if(!v)return;const g=v.querySelectorAll("img.message-image-preview");for(const w of g)w.complete||He.has(w)||(He.add(w),w.addEventListener("load",bn,{once:!0}),w.addEventListener("error",bn,{once:!0}))}async function _n(){await Wt(),je&&cancelAnimationFrame(je),je=requestAnimationFrame(()=>{je=0,Re(),Jn(),wn()})}lt(()=>ue.messages,async v=>{if(!ue.isLoading){for(const g of v){if(g.messageType!=="commandExecution"||!g.commandExecution)continue;const w=o.value[g.id],M=g.commandExecution.status;w==="inProgress"&&M!=="inProgress"&&re(g.id),o.value[g.id]=M}await _n()}}),lt(()=>ue.pendingRequests,async()=>{ue.isLoading||await _n()},{deep:!0}),lt(()=>ue.liveOverlay,async v=>{v&&(await Wt(),In(),wn(8))},{deep:!0}),lt(()=>ue.isLoading,async v=>{v||await _n()}),lt(()=>ue.activeThreadId,()=>{ce.value="",Ae.value=new Set},{flush:"post"});function fr(){const v=Me.value;!v||ue.isLoading||Fe(v)}function En(v){ce.value=q(v)}function Cn(v,g){return`${v}:${String(g)}`}function x(v,g){const w=new Set(Ae.value);w.add(Cn(v,g)),Ae.value=w}function F(v,g){return Ae.value.has(Cn(v,g))}function ie(){ce.value=""}function Oe(){const v=se.value;v&&(v.scrollTop=v.scrollHeight)}return lt(()=>{var v;return(v=ue.liveOverlay)==null?void 0:v.reasoningText},async v=>{v&&(await Wt(),Oe())}),Mr(()=>{je&&cancelAnimationFrame(je),Ne&&cancelAnimationFrame(Ne)}),(v,g)=>(m(),b("section",jw,[e.isLoading?(m(),b("p",Fw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(m(),b("p",Bw," No messages in this thread yet. ")):(m(),b("ul",{key:2,ref_key:"conversationListRef",ref:Me,class:"conversation-list",onScroll:fr},[(m(!0),b(Pe,null,it(e.messages,w=>{var M,B;return m(),b("li",{key:w.id,class:at(["conversation-item",{"conversation-item-actionable":Xt(w)}]),"data-role":w.role,"data-message-type":w.messageType||""},[l(w)?(m(),b("div",Hw,[y("div",Ww,[y("button",{type:"button",class:at(["cmd-row",[te(w),{"cmd-expanded":I(w)}]]),onClick:J=>$(w)},[y("span",{class:at(["cmd-chevron",{"cmd-chevron-open":I(w)}])},"▶",2),y("code",zw,H(((M=w.commandExecution)==null?void 0:M.command)||"(command)"),1),y("span",Gw,H(V(w)),1)],10,Vw),y("div",{class:at(["cmd-output-wrap",{"cmd-output-visible":I(w),"cmd-output-collapsing":j(w)}])},[y("div",qw,[y("pre",Kw,H(((B=w.commandExecution)==null?void 0:B.aggregatedOutput)||"(no output)"),1)])],2)])])):(m(),b("div",{key:1,class:"message-row","data-role":w.role,"data-message-type":w.messageType||""},[y("div",{class:"message-stack","data-role":w.role},[y("article",{class:"message-body","data-role":w.role},[w.images&&w.images.length>0?(m(),b("ul",{key:0,class:"message-image-list","data-role":w.role},[(m(!0),b(Pe,null,it(w.images,J=>(m(),b("li",{key:J,class:"message-image-item"},[y("button",{class:"message-image-button",type:"button",onClick:Ce=>En(J)},[y("img",{class:"message-image-preview",src:q(J),alt:"Message image preview",loading:"lazy"},null,8,eb)],8,Zw)]))),128))],8,Xw)):de("",!0),w.fileAttachments&&w.fileAttachments.length>0?(m(),b("div",tb,[(m(!0),b(Pe,null,it(w.fileAttachments,J=>(m(),b("span",{key:J.path,class:"message-file-chip"},[g[1]||(g[1]=y("span",{class:"message-file-chip-icon"},"📄",-1)),y("a",{class:"message-file-link message-file-chip-name",href:R(J.path),target:"_blank",rel:"noopener noreferrer",title:J.path},H(J.path),9,nb)]))),128))])):de("",!0),w.text.length>0?(m(),b("article",{key:2,class:"message-card","data-role":w.role},[w.messageType==="worked"?(m(),b("div",sb,[y("button",{type:"button",class:"worked-separator",onClick:J=>Z(w)},[g[2]||(g[2]=y("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),y("span",{class:at(["worked-chevron",{"worked-chevron-open":ae(w)}])},"▶",2),y("p",ib,H(w.text),1),g[3]||(g[3]=y("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,ob),ae(w)?(m(),b("div",ab,[(m(!0),b(Pe,null,it(_e(e.messages,e.messages.indexOf(w)),J=>{var Ce,X;return m(),b("div",{key:`worked-cmd-${J.id}`,class:"worked-cmd-item"},[y("button",{type:"button",class:at(["cmd-row",[te(J),{"cmd-expanded":I(J)}]]),onClick:Te=>$(J)},[y("span",{class:at(["cmd-chevron",{"cmd-chevron-open":I(J)}])},"▶",2),y("code",cb,H(((Ce=J.commandExecution)==null?void 0:Ce.command)||"(command)"),1),y("span",ub,H(V(J)),1)],10,lb),y("div",{class:at(["cmd-output-wrap",{"cmd-output-visible":I(J),"cmd-output-collapsing":j(J)}])},[y("div",db,[y("pre",fb,H(((X=J.commandExecution)==null?void 0:X.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):de("",!0)])):d(w)?(m(),b("div",{key:1,class:"plan-card","data-streaming":w.messageType==="plan.live"},[y("div",pb,[g[4]||(g[4]=y("p",{class:"plan-card-title"},"Plan",-1)),w.messageType==="plan.live"?(m(),b("span",mb,"Updating")):de("",!0)]),c(w)?(m(),b("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:tt(c(w))},null,8,gb)):de("",!0),p(w).length>0?(m(),b("ol",vb,[(m(!0),b(Pe,null,it(p(w),(J,Ce)=>(m(),b("li",{key:`${w.id}:plan-step:${Ce}`,class:"plan-step-item","data-status":J.status},[y("span",{class:"plan-step-status","data-status":J.status},H(_(J.status)),9,wb),y("div",{class:"plan-step-text plan-card-markdown",innerHTML:tt(J.step)},null,8,bb)],8,yb))),128))])):(m(),b("div",{key:2,class:"plan-card-markdown",innerHTML:tt(w.text)},null,8,_b))],8,hb)):(m(),b("div",kb,[(m(!0),b(Pe,null,it(Tt(w.text),(J,Ce)=>(m(),b(Pe,{key:`block-${Ce}`},[J.kind==="paragraph"?(m(),b("p",Tb,[(m(!0),b(Pe,null,it(K(J.value),(X,Te)=>(m(),b(Pe,{key:`seg-${Ce}-${Te}`},[X.kind==="text"?(m(),b("span",Sb,H(X.value),1)):X.kind==="bold"?(m(),b("strong",Ib,H(X.value),1)):X.kind==="italic"?(m(),b("em",Eb,H(X.value),1)):X.kind==="strikethrough"?(m(),b("s",Cb,H(X.value),1)):X.kind==="file"?(m(),b("a",{key:4,class:"message-file-link",href:R(X.path),target:"_blank",rel:"noopener noreferrer",title:X.path},H(X.displayPath),9,Ab)):X.kind==="url"?(m(),b("a",{key:5,class:"message-file-link",href:X.href,target:"_blank",rel:"noopener noreferrer",title:X.href},H(X.value),9,xb)):(m(),b("code",Rb,H(X.value),1))],64))),128))])):J.kind==="heading"?(m(),ht(ni(me(J.level)),{key:1,class:at(["message-heading",be(J.level)])},{default:wt(()=>[(m(!0),b(Pe,null,it(K(J.value),(X,Te)=>(m(),b(Pe,{key:`heading-seg-${Ce}-${Te}`},[X.kind==="text"?(m(),b("span",Pb,H(X.value),1)):X.kind==="bold"?(m(),b("strong",Mb,H(X.value),1)):X.kind==="italic"?(m(),b("em",$b,H(X.value),1)):X.kind==="strikethrough"?(m(),b("s",Ob,H(X.value),1)):X.kind==="file"?(m(),b("a",{key:4,class:"message-file-link",href:R(X.path),target:"_blank",rel:"noopener noreferrer",title:X.path},H(X.displayPath),9,Nb)):X.kind==="url"?(m(),b("a",{key:5,class:"message-file-link",href:X.href,target:"_blank",rel:"noopener noreferrer",title:X.href},H(X.value),9,Db)):(m(),b("code",Lb,H(X.value),1))],64))),128))]),_:2},1032,["class"])):J.kind==="blockquote"?(m(),b("blockquote",jb,[(m(!0),b(Pe,null,it(K(J.value),(X,Te)=>(m(),b(Pe,{key:`quote-seg-${Ce}-${Te}`},[X.kind==="text"?(m(),b("span",Fb,H(X.value),1)):X.kind==="bold"?(m(),b("strong",Bb,H(X.value),1)):X.kind==="italic"?(m(),b("em",Ub,H(X.value),1)):X.kind==="strikethrough"?(m(),b("s",Hb,H(X.value),1)):X.kind==="file"?(m(),b("a",{key:4,class:"message-file-link",href:R(X.path),target:"_blank",rel:"noopener noreferrer",title:X.path},H(X.displayPath),9,Wb)):X.kind==="url"?(m(),b("a",{key:5,class:"message-file-link",href:X.href,target:"_blank",rel:"noopener noreferrer",title:X.href},H(X.value),9,Vb)):(m(),b("code",zb,H(X.value),1))],64))),128))])):J.kind==="unorderedList"?(m(),b("ul",Gb,[(m(!0),b(Pe,null,it(J.items,(X,Te)=>(m(),b("li",{key:`ul-${Ce}-${Te}`,class:"message-list-item"},[y("div",qb,[(m(!0),b(Pe,null,it(K(X),(he,ze)=>(m(),b(Pe,{key:`ul-seg-${Ce}-${Te}-${ze}`},[he.kind==="text"?(m(),b("span",Kb,H(he.value),1)):he.kind==="bold"?(m(),b("strong",Jb,H(he.value),1)):he.kind==="italic"?(m(),b("em",Yb,H(he.value),1)):he.kind==="strikethrough"?(m(),b("s",Qb,H(he.value),1)):he.kind==="file"?(m(),b("a",{key:4,class:"message-file-link",href:R(he.path),target:"_blank",rel:"noopener noreferrer",title:he.path},H(he.displayPath),9,Xb)):he.kind==="url"?(m(),b("a",{key:5,class:"message-file-link",href:he.href,target:"_blank",rel:"noopener noreferrer",title:he.href},H(he.value),9,Zb)):(m(),b("code",e_,H(he.value),1))],64))),128))])]))),128))])):J.kind==="taskList"?(m(),b("ul",t_,[(m(!0),b(Pe,null,it(J.items,(X,Te)=>(m(),b("li",{key:`task-${Ce}-${Te}`,class:"message-task-item"},[y("span",{class:"message-task-checkbox","data-checked":X.checked},H(X.checked?"☑":"☐"),9,n_),y("div",r_,[(m(!0),b(Pe,null,it(K(X.text),(he,ze)=>(m(),b(Pe,{key:`task-seg-${Ce}-${Te}-${ze}`},[he.kind==="text"?(m(),b("span",s_,H(he.value),1)):he.kind==="bold"?(m(),b("strong",o_,H(he.value),1)):he.kind==="italic"?(m(),b("em",i_,H(he.value),1)):he.kind==="strikethrough"?(m(),b("s",a_,H(he.value),1)):he.kind==="file"?(m(),b("a",{key:4,class:"message-file-link",href:R(he.path),target:"_blank",rel:"noopener noreferrer",title:he.path},H(he.displayPath),9,l_)):he.kind==="url"?(m(),b("a",{key:5,class:"message-file-link",href:he.href,target:"_blank",rel:"noopener noreferrer",title:he.href},H(he.value),9,c_)):(m(),b("code",u_,H(he.value),1))],64))),128))])]))),128))])):J.kind==="orderedList"?(m(),b("ol",d_,[(m(!0),b(Pe,null,it(J.items,(X,Te)=>(m(),b("li",{key:`ol-${Ce}-${Te}`,class:"message-list-item"},[y("div",f_,[(m(!0),b(Pe,null,it(K(X),(he,ze)=>(m(),b(Pe,{key:`ol-seg-${Ce}-${Te}-${ze}`},[he.kind==="text"?(m(),b("span",h_,H(he.value),1)):he.kind==="bold"?(m(),b("strong",p_,H(he.value),1)):he.kind==="italic"?(m(),b("em",m_,H(he.value),1)):he.kind==="strikethrough"?(m(),b("s",g_,H(he.value),1)):he.kind==="file"?(m(),b("a",{key:4,class:"message-file-link",href:R(he.path),target:"_blank",rel:"noopener noreferrer",title:he.path},H(he.displayPath),9,v_)):he.kind==="url"?(m(),b("a",{key:5,class:"message-file-link",href:he.href,target:"_blank",rel:"noopener noreferrer",title:he.href},H(he.value),9,y_)):(m(),b("code",w_,H(he.value),1))],64))),128))])]))),128))])):J.kind==="codeBlock"?(m(),b("div",b_,[J.language?(m(),b("div",__,H(J.language),1)):de("",!0),y("pre",k_,[y("code",null,H(J.value),1)])])):J.kind==="thematicBreak"?(m(),b("hr",T_)):F(w.id,Ce)?(m(),b("p",S_,H(J.markdown),1)):(m(),b("button",{key:9,class:"message-image-button",type:"button",onClick:X=>En(J.url)},[y("img",{class:"message-image-preview message-markdown-image",src:J.url,alt:J.alt||"Embedded message image",loading:"lazy",onError:X=>x(w.id,Ce)},null,40,E_)],8,I_))],64))),128))]))],8,rb)):de("",!0)],8,Qw),Xt(w)?(m(),b("div",C_,[Qt(w)?(m(),b("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:J=>dr(w)},[$e(Lw,{class:"message-action-icon"}),g[5]||(g[5]=y("span",{class:"message-action-label"},"Copy",-1))],8,A_)):de("",!0),cn(w)?(m(),b("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:J=>Dn(w)},[$e($w,{class:"message-action-icon"}),g[6]||(g[6]=y("span",{class:"message-action-label"},"Rollback",-1))],8,x_)):de("",!0)])):de("",!0)],8,Yw)],8,Jw))],10,Uw)}),128)),e.liveOverlay?(m(),b("li",R_,[y("div",P_,[y("div",M_,[y("article",$_,[y("p",O_,H(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(m(),b("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:se},H(e.liveOverlay.reasoningText),513)):de("",!0),e.liveOverlay.errorText?(m(),b("p",N_,H(e.liveOverlay.errorText),1)):de("",!0)])])])])):de("",!0),(m(!0),b(Pe,null,it(e.pendingRequests,w=>(m(),b("li",{key:`server-request:${w.id}`,class:"conversation-item conversation-item-request"},[y("div",D_,[y("div",L_,[y("article",j_,[y("p",F_,H(w.method),1),y("p",B_,"Request #"+H(w.id)+" · "+H(Kt(w.receivedAtIso)),1),rt(w)?(m(),b("p",U_,H(rt(w)),1)):de("",!0),w.method==="item/commandExecution/requestApproval"?(m(),b("section",H_,[y("button",{type:"button",class:"request-button request-button-primary",onClick:M=>$t(w.id,"accept")},"Accept",8,W_),y("button",{type:"button",class:"request-button",onClick:M=>$t(w.id,"acceptForSession")},"Accept for Session",8,V_),y("button",{type:"button",class:"request-button",onClick:M=>$t(w.id,"decline")},"Decline",8,z_),y("button",{type:"button",class:"request-button",onClick:M=>$t(w.id,"cancel")},"Cancel",8,G_)])):w.method==="item/fileChange/requestApproval"?(m(),b("section",q_,[y("button",{type:"button",class:"request-button request-button-primary",onClick:M=>$t(w.id,"accept")},"Accept",8,K_),y("button",{type:"button",class:"request-button",onClick:M=>$t(w.id,"acceptForSession")},"Accept for Session",8,J_),y("button",{type:"button",class:"request-button",onClick:M=>$t(w.id,"decline")},"Decline",8,Y_),y("button",{type:"button",class:"request-button",onClick:M=>$t(w.id,"cancel")},"Cancel",8,Q_)])):w.method==="item/tool/requestUserInput"?(m(),b("section",X_,[(m(!0),b(Pe,null,it(Pt(w),M=>{var B;return m(),b("div",{key:`${w.id}:${M.id}`,class:"request-question"},[y("p",Z_,H(M.header||M.question),1),M.header&&M.question?(m(),b("p",ek,H(M.question),1)):de("",!0),M.options.length>0?(m(),b("select",{key:1,class:"request-select",value:pt(w.id,M.id,((B=M.options[0])==null?void 0:B.label)||""),onChange:J=>vn(w.id,M.id,J)},[(m(!0),b(Pe,null,it(M.options,J=>(m(),b("option",{key:`${w.id}:${M.id}:${J.label}`,value:J.label},H(J.label),9,nk))),128))],40,tk)):de("",!0),M.options.length>0&&St(w.id,M)?(m(),b("p",rk,H(St(w.id,M)),1)):(m(),b("input",{key:3,class:"request-input",type:M.isSecret?"password":"text",value:pt(w.id,M.id,""),placeholder:M.isSecret?"Enter secret answer":"Enter answer",onInput:J=>xn(w.id,M.id,J)},null,40,sk)),M.isOther?(m(),b("input",{key:4,class:"request-input",type:M.isSecret?"password":"text",value:ft(w.id,M.id),placeholder:"Other answer",onInput:J=>zt(w.id,M.id,J)},null,40,ok)):de("",!0)])}),128)),y("button",{type:"button",class:"request-button request-button-primary",onClick:M=>yt(w)}," Submit Answers ",8,ik)])):w.method==="item/tool/call"?(m(),b("section",ak,[y("button",{type:"button",class:"request-button request-button-primary",onClick:M=>Sn(w.id)},"Fail Tool Call",8,lk),y("button",{type:"button",class:"request-button",onClick:M=>Rn(w.id)},"Success (Empty)",8,ck)])):(m(),b("section",uk,[y("button",{type:"button",class:"request-button request-button-primary",onClick:M=>yn(w.id)},"Return Empty Result",8,dk),y("button",{type:"button",class:"request-button",onClick:M=>Pn(w.id)},"Reject Request",8,fk)]))])])])]))),128)),y("li",{ref_key:"bottomAnchorRef",ref:le,class:"conversation-bottom-anchor"},null,512)],544)),ce.value.length>0?(m(),b("div",{key:3,class:"image-modal-backdrop",onClick:ie},[y("div",{class:"image-modal-content",onClick:g[0]||(g[0]=mt(()=>{},["stop"]))},[y("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:ie},[$e(Ol,{class:"icon-svg"})]),y("img",{class:"image-modal-image",src:ce.value,alt:"Expanded message image"},null,8,hk)])])):de("",!0)]))}}),gk=ct(mk,[["__scopeId","data-v-98e78ec9"]]),fu=.0025,ua=3,hu=2,vk=256;function yk(e){var Me;const t=D("idle"),n=D(typeof navigator<"u"&&!!((Me=navigator.mediaDevices)!=null&&Me.getUserMedia)),r=D(0),s=D(null);let o=null,i=null,a=[],l=null,d=null,c=null,p=null,_=[],I=!1,j=!1;function $(){const le=s.value;if(!le||typeof window>"u")return;const se=le.getContext("2d");if(!se)return;const ce=Math.max(1,Math.floor(le.clientWidth)),ne=Math.max(1,Math.floor(le.clientHeight||36)),xe=window.devicePixelRatio||1,je=Math.max(1,Math.floor(ce*xe)),Ne=Math.max(1,Math.floor(ne*xe));(le.width!==je||le.height!==Ne)&&(le.width=je,le.height=Ne),se.setTransform(xe,0,0,xe,0,0),se.clearRect(0,0,ce,ne);const Ve=Math.max(12,Math.floor(ce/(ua+hu))),He=_.slice(-Ve),Ae=Math.max(0,Ve-He.length),Ze=ne/2,Ke=getComputedStyle(le).color||"#000000";for(let ot=0;ot<Ve;ot+=1){const Be=He[ot-Ae]??0,ut=Math.max(.08,Math.min(1,Be*18))*Ze,It=ot*(ua+hu);se.globalAlpha=Be<=fu?.35:1,se.fillStyle=Ke,se.fillRect(It,Ze-ut,ua,ut*2)}se.globalAlpha=1}function Z(){_=[],r.value=0,$()}function ae(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),p=null}function V(le){if(typeof window>"u")return;const se=window.webkitAudioContext,ce=window.AudioContext??se;ce&&(ae(),Z(),l=new ce,d=l.createMediaStreamSource(le),c=l.createScriptProcessor(2048,1,1),p=performance.now(),c.onaudioprocess=ne=>{const xe=ne.inputBuffer.getChannelData(0);let je=0;for(let Ne=0;Ne<xe.length;Ne+=1){const Ve=Math.abs(xe[Ne]??0);je+=Ve<fu?0:Ve}_.push(je/xe.length),_.length>vk&&_.shift(),p!==null&&(r.value=Math.max(0,performance.now()-p)),$()},d.connect(c),c.connect(l.destination),$())}async function te(){var le;if(!(t.value!=="idle"||!n.value||I)){I=!0,j=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=se=>{se.data.size>0&&a.push(se.data)},o.onstop=()=>{var ne;const se=a,ce=(o==null?void 0:o.mimeType)||((ne=se[0])==null?void 0:ne.type)||"audio/webm";ue(),_e(se,ce)},V(i),o.start(250),t.value="recording",j&&re()}catch(se){ue(),t.value="idle",(le=e.onError)==null||le.call(e,se)}finally{I=!1}}}function re(){if(I&&t.value==="idle"){j=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function _e(le,se){var ne,xe,je,Ne;if(le.length===0){(ne=e.onEmpty)==null||ne.call(e),t.value="idle";return}const ce=new Blob(le,{type:se});t.value="transcribing";try{const Ve=se.split(/[/;]/)[1]??"webm",He=new FormData;He.append("file",ce,`codex.${Ve}`);const Ae=await fetch("/codex-api/transcribe",{method:"POST",body:He}),Ze=await Ae.text();let Ke=null;try{Ke=Ze.trim()?JSON.parse(Ze):null}catch{Ke=null}if(!Ae.ok){const Be=(xe=Ke==null?void 0:Ke.error)==null?void 0:xe.trim(),Mt=Ze.trim();throw new Error(Be||Mt||`Transcription failed: ${Ae.status}`)}const ot=((Ke==null?void 0:Ke.text)??"").trim();ot.length>0?e.onTranscript(ot):(je=e.onEmpty)==null||je.call(e)}catch(Ve){(Ne=e.onError)==null||Ne.call(e,Ve)}finally{t.value="idle"}}function ue(){ae(),Z(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(le=>le.stop()),i=null),a=[]}Mr(ue);function pe(){if(t.value==="recording"){re();return}t.value==="idle"&&te()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:te,stopRecording:re,toggleRecording:pe}}function pu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class kr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Nl(e,t){const n=pu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=pu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function hs(e,t,n){return e instanceof kr?e:e instanceof Error?new kr(e.message||t,{code:"unknown_error",method:n}):new kr(t,{code:"unknown_error",method:n})}function Bf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function wk(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 kr(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 kr(Nl(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 kr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function bk(e){const t=Bf(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 mu(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function _k(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(d,c)=>{if(n||r!==null)return;const p=Math.min(1e3*2**c,1e4);r=window.setTimeout(()=>{r=null,!n&&d()},p)},i=d=>{const c=bk(d);c&&e(c)},a=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let p=!1;c.onmessage=_=>{try{i(JSON.parse(_.data))}catch{}},c.addEventListener("ready",_=>{try{const I=_.data?JSON.parse(_.data):{ok:!0};mu(e,I)}catch{mu(e)}}),c.onerror=()=>{n||p||c.readyState===EventSource.CLOSED&&(p=!0,c.close(),o(()=>a(d+1),d))},t=()=>{p=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){a();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",p=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let _=!1,I=!1,j=window.setTimeout(()=>{_||n||I||(I=!0,p.close(),a())},2500);p.onopen=()=>{_=!0,s(),j!==null&&(window.clearTimeout(j),j=null)},p.onmessage=$=>{try{i(JSON.parse(String($.data)))}catch{}},p.onerror=()=>{},p.onclose=()=>{if(j!==null&&(window.clearTimeout(j),j=null),!(n||I)){if(!_){a();return}o(()=>l(d+1),d)}},t=()=>{I=!0,j!==null&&(window.clearTimeout(j),j=null),p.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function kk(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 kr(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 kr(Nl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Tk(){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 kr(Nl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Bf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function gu(e){return new Date(e*1e3).toISOString()}function Sk(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Ik(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Ek=/^##\s+(.+?):\s+(.+?)\s*$/,Ck=/^#\s*files mentioned by the user\s*:?\s*$/i;function Ak(e){var s,o;const t=e.split(`
38
+ `).findIndex(i=>Ck.test(i.trim()));if(t<0)return[];const n=e.split(`
39
+ `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(Ek);if(!l)break;const d=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&r.push({label:d,path:c})}return r}function xk(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 Rk(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:Ik(l),isUnhandled:!0});const o=n.join(`
40
+ `),i=Ak(o);return{text:xk(o),images:r,fileAttachments:i,rawBlocks:s}}function Pk(e){var o;const t=e.replace(/\r\n/g,`
41
+ `).trim();if(!t)return null;const n=t.split(`
42
+ `),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 d=(l[1]??" ").toLowerCase(),c=(o=l[2])==null?void 0:o.trim();if(!c)continue;let p="pending";d==="x"&&(p="completed"),(d==="~"||d===">"||d==="-")&&(p="inProgress"),r.push({step:c,status:p});continue}s.push(a)}return r.length===0?null:{explanation:s.join(`
43
+ `).trim()||void 0,steps:r}}function Mk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Rk(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:Pk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=$k(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 $k(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Ok(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function Nk(e){const t=Ok(e);return t.length>0?t:"Untitled thread"}function Uf(e){return(e==null?void 0:e.status)==="inProgress"}function Dk(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 Uf(r)}function Lk(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:Nk(e),projectName:Sk(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:gu(e.createdAt),updatedAtIso:gu(e.updatedAt),preview:e.preview,unread:!1,inProgress:Dk(e)}}function jk(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 Fk(e){const t=e.data.map(Lk);return jk(t)}function Hf(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 Mk(i))n.push({...a,turnIndex:r})}return n}function Bk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Uf(t.at(-1))}function da(e){return e&&e.length>0?e:null}const vu=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Kn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function nn(e){return typeof e=="string"&&e.length>0?e:null}function fa(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Ka(e){return typeof e=="boolean"?e:null}function yu(e){const t=Kn(e);if(!t)return null;const n=fa(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:fa(t.windowDurationMins??t.window_minutes),resetsAt:fa(t.resetsAt??t.resets_at)}}function Uk(e){const t=Kn(e);if(!t)return null;const n=Ka(t.hasCredits??t.has_credits),r=Ka(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:nn(t.balance)}}function Ja(e){const t=Kn(e);if(!t)return null;const n=yu(t.primary),r=yu(t.secondary),s=Uk(t.credits);return!n&&!r&&!s?null:{limitId:nn(t.limitId??t.limit_id),limitName:nn(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:nn(t.planType??t.plan_type)}}function Wf(e,t=null){const n=Kn(e);if(!n)return null;const r=nn(n.accountId),s=nn(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:nn(n.authMode),email:nn(n.email),planType:nn(n.planType),lastRefreshedAtIso:nn(n.lastRefreshedAtIso)??"",lastActivatedAtIso:nn(n.lastActivatedAtIso),quotaSnapshot:Ja(n.quotaSnapshot),quotaUpdatedAtIso:nn(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:nn(n.quotaError),isActive:Ka(n.isActive)??r===t}:null}function Vf(e){const t=Kn(e);if(!t)return null;const n=Kn(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Ja(n==null?void 0:n.codex);return r||Ja(t.rateLimits??t.rate_limits)}async function ln(e,t){try{return await wk(e,t)}catch(n){throw hs(n,`RPC ${e} failed`,e)}}function Hk(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Wk(){const e=await ln("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Fk(e)}async function Vk(e){const t=await ln("thread/read",{threadId:e,includeTurns:!0});return{messages:Hf(t),inProgress:Bk(t)}}async function zk(){try{return await Wk()}catch(e){throw hs(e,"Failed to load thread groups","thread/list")}}async function Gk(e){try{return await Vk(e)}catch(t){throw hs(t,`Failed to load thread ${e}`,"thread/read")}}function qk(e){return _k(e)}async function Kk(e,t){await kk({id:e,...t})}async function Jk(){return Tk()}async function Yk(){try{const e=await ln("account/rateLimits/read");return Vf(e)}catch(e){throw hs(e,"Failed to load account rate limits","account/rateLimits/read")}}function zf(e){const t=Kn(e),n=nn(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:nn(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>Wf(s,n)).filter(s=>s!==null)}}async function Qk(){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=Kn(t);return zf(n==null?void 0:n.data)}async function Xk(){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=Kn(t);return zf(n==null?void 0:n.data)}async function Zk(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=Kn(n),s=Kn(r==null?void 0:r.data),o=Wf(s==null?void 0:s.account,nn(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function ha(e){await ln("thread/resume",{threadId:e})}async function e0(e){await ln("thread/archive",{threadId:e})}async function t0(e,t){await ln("thread/name/set",{threadId:e,name:t})}async function wu(e,t){const n=await ln("thread/rollback",{threadId:e,numTurns:t});return Hf(n)}function n0(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 bu(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 ln("thread/start",n),s=n0(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw hs(n,"Failed to start a new thread","thread/start")}}function r0(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
44
+ `;for(const r of t)n+=`
45
+ ## ${r.label}: ${r.path}
46
+ `;return`${n}
47
+ ## My request for Codex:
48
+
49
+ ${e}
50
+ `}async function s0(e,t){var a;const n=(e==null?void 0:e.trim())??"";if(n)return{model:n,reasoningEffort:da(t)};let r=null;try{r=await qf()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:da(t??(r==null?void 0:r.reasoningEffort))};let o=[];try{o=await Gf()}catch{o=[]}const i=((a=o.find(l=>l.trim().length>0))==null?void 0:a.trim())??"";if(i)return{model:i,reasoningEffort:da(t??(r==null?void 0:r.reasoningEffort))};throw new Error("Plan mode requires an available model. Wait for models to load and try again.")}async function pa(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",c=[{type:"text",text:r0(t,i)}];for(const I of n){const j=I.trim();j&&c.push({type:"image",url:j,image_url:j})}if(o)for(const I of o)c.push({type:"skill",name:I.name,path:I.path});const p=i.map(I=>({label:I.label,path:I.path,fsPath:I.fsPath})),_={threadId:e,input:c};if(p.length>0&&(_.attachments=p),l&&(_.model=l),typeof s=="string"&&s.length>0&&(_.effort=s),a==="plan"){const I=await s0(l,s);_.collaborationMode={mode:"plan",settings:{model:I.model,reasoning_effort:I.reasoningEffort,developer_instructions:null}}}await ln("turn/start",_)}catch(l){throw hs(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function o0(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 ln("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw hs(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function i0(e){await ln("setDefaultModel",{model:e})}async function Gf(){const e=await ln("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 qf(){const e=await ln("config/read",{}),t=e.config.model??"",n=Hk(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function a0(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function l0(){try{const e=await ln("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:a0(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of vu)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return vu}function c0(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 Js(){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 c0(n.data)}async function u0(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 _u(){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 ku(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 d0(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 d=Ls(o,"Failed to search files");throw new Error(d)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const d of a){if(!d||typeof d!="object"||Array.isArray(d))continue;const p=d.path,_=typeof p=="string"?p.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 ma(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 ln("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 ln("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 Tu(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 m(),b("svg",w0,[...t[0]||(t[0]=[y("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 _0=ct(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 m(),b("svg",T0,[...t[0]||(t[0]=[y("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 I0=ct(k0,[["render",S0]]),E0={},C0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function A0(e,t){return m(),b("svg",C0,[...t[0]||(t[0]=[y("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),y("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 Su=ct(E0,[["render",A0]]),x0=["disabled"],R0={class:"composer-dropdown-value"},P0={class:"composer-dropdown-menu"},M0={key:0,class:"composer-dropdown-search-wrap"},$0=["placeholder","onKeydown"],O0={class:"composer-dropdown-options",role:"listbox"},N0=["onClick"],D0={key:0,class:"composer-dropdown-empty"},L0={key:1,class:"composer-dropdown-add-wrap"},j0=["placeholder","onKeydown"],F0=qt({__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(""),d=D(!1),c=D(""),p=fe(()=>{var ce;const se=n.options.find(ne=>ne.value===n.modelValue);return se?se.label:((ce=n.placeholder)==null?void 0:ce.trim())||""}),_=fe(()=>n.openDirection??"down"),I=fe(()=>n.enableSearch===!0),j=fe(()=>n.showAddAction===!0),$=fe(()=>{var se;return((se=n.searchPlaceholder)==null?void 0:se.trim())||"Quick search projects"}),Z=fe(()=>{var se;return((se=n.addActionLabel)==null?void 0:se.trim())||"Add new project"}),ae=fe(()=>{var se;return((se=n.addPlaceholder)==null?void 0:se.trim())||"Project name or absolute path"}),V=fe(()=>{const se=l.value.trim().toLowerCase();return se?n.options.filter(ce=>ce.label.toLowerCase().includes(se)||ce.value.toLowerCase().includes(se)):n.options});function te(){n.disabled||(a.value=!a.value)}function re(se){r("update:modelValue",se),a.value=!1,l.value=""}function _e(){var se;d.value=!0,c.value=((se=n.defaultAddValue)==null?void 0:se.trim())||"",Wt(()=>{var ce;return(ce=i.value)==null?void 0:ce.focus()})}function ue(){if(l.value.length>0){l.value="";return}a.value=!1}function pe(){const se=c.value.trim();se&&(r("add",se),d.value=!1,c.value="",a.value=!1,l.value="")}function Me(){d.value=!1,c.value="",a.value=!1,l.value=""}function le(se){if(!a.value)return;const ce=s.value;if(!ce)return;const ne=se.target;ne instanceof Node&&(ce.contains(ne)||(a.value=!1,l.value="",d.value=!1,c.value=""))}return lt(a,se=>{if(!se){d.value=!1,c.value="";return}I.value&&Wt(()=>{var ce;return(ce=o.value)==null?void 0:ce.focus()})}),Pr(()=>{window.addEventListener("pointerdown",le)}),Mr(()=>{window.removeEventListener("pointerdown",le)}),(se,ce)=>(m(),b("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[y("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:te},[y("span",R0,H(p.value),1),$e(Ai,{class:"composer-dropdown-chevron"})],8,x0),a.value?(m(),b("div",{key:0,class:at(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":_.value==="up","composer-dropdown-menu-wrap-down":_.value==="down"}])},[y("div",P0,[I.value?(m(),b("div",M0,[Er(y("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:pn(mt(ue,["prevent"]),["esc"])},null,40,$0),[[Cr,l.value]])])):de("",!0),y("ul",O0,[(m(!0),b(Pe,null,it(V.value,ne=>(m(),b("li",{key:ne.value},[y("button",{class:at(["composer-dropdown-option",{"is-selected":ne.value===e.modelValue}]),type:"button",onClick:xe=>re(ne.value)},H(ne.label),11,N0)]))),128)),V.value.length===0?(m(),b("li",D0," No matching projects ")):de("",!0)]),j.value?(m(),b("div",L0,[d.value?(m(),b(Pe,{key:0},[Er(y("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":ce[1]||(ce[1]=ne=>c.value=ne),class:"composer-dropdown-add-input",type:"text",placeholder:ae.value,onKeydown:[pn(mt(pe,["prevent"]),["enter"]),pn(mt(Me,["prevent"]),["esc"])]},null,40,j0),[[Cr,c.value]]),y("div",{class:"composer-dropdown-add-actions"},[y("button",{type:"button",class:"composer-dropdown-add-btn",onClick:pe},"Open"),y("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Me},"Cancel")])],64)):(m(),b("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:_e},H(Z.value),1))])):de("",!0)])],2)):de("",!0)],512))}}),Ya=ct(F0,[["__scopeId","data-v-7cfa2012"]]),B0=["disabled"],U0={class:"search-dropdown-value"},H0={class:"search-dropdown-search-wrap"},W0=["placeholder","onKeydown"],V0={key:0,class:"search-dropdown-list",role:"listbox"},z0=["onClick","onPointerenter"],G0={class:"search-dropdown-option-check"},q0={class:"search-dropdown-option-label"},K0={key:0,class:"search-dropdown-option-desc"},J0={key:1,class:"search-dropdown-empty"},Y0=qt({__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),d=fe(()=>n.openDirection??"down"),c=fe(()=>new Set(n.selectedValues)),p=fe(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const V=n.options.find(te=>te.value===n.selectedValues[0]);return(V==null?void 0:V.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),_=fe(()=>{const V=a.value.toLowerCase().trim();return V?n.options.filter(te=>{var re;return te.label.toLowerCase().includes(V)||(((re=te.description)==null?void 0:re.toLowerCase().includes(V))??!1)}):n.options});function I(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,Wt(()=>{var V;return(V=o.value)==null?void 0:V.focus()})))}function j(V){r("toggle",V.value,!c.value.has(V.value))}function $(V){_.value.length!==0&&(l.value=(l.value+V+_.value.length)%_.value.length)}function Z(){const V=_.value[l.value];V&&j(V)}function ae(V){if(!i.value)return;const te=s.value;if(!te)return;const re=V.target;re instanceof Node&&(te.contains(re)||(i.value=!1))}return lt(a,()=>{l.value=0}),Pr(()=>window.addEventListener("pointerdown",ae)),Mr(()=>window.removeEventListener("pointerdown",ae)),(V,te)=>(m(),b("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[y("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:I},[y("span",U0,H(p.value),1),$e(Ai,{class:"search-dropdown-chevron"})],8,B0),i.value?(m(),b("div",{key:0,class:at(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":d.value==="up","search-dropdown-menu-wrap-down":d.value==="down"}])},[y("div",H0,[Er(y("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":te[0]||(te[0]=re=>a.value=re),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[te[1]||(te[1]=pn(mt(re=>i.value=!1,["prevent"]),["escape"])),pn(mt(Z,["prevent"]),["enter"]),te[2]||(te[2]=pn(mt(re=>$(1),["prevent"]),["arrow-down"])),te[3]||(te[3]=pn(mt(re=>$(-1),["prevent"]),["arrow-up"]))]},null,40,W0),[[Cr,a.value]])]),_.value.length>0?(m(),b("ul",V0,[(m(!0),b(Pe,null,it(_.value,(re,_e)=>(m(),b("li",{key:re.value},[y("button",{class:at(["search-dropdown-option",{"is-selected":c.value.has(re.value),"is-highlighted":_e===l.value}]),type:"button",onClick:ue=>j(re),onPointerenter:ue=>l.value=_e},[y("span",G0,H(c.value.has(re.value)?"✓":""),1),y("span",q0,H(re.label),1),re.description?(m(),b("span",K0,H(re.description),1)):de("",!0)],42,z0)]))),128))])):(m(),b("div",J0,"No results"))],2)):de("",!0)],512))}}),Q0=ct(Y0,[["__scopeId","data-v-a0f2edd4"]]),X0={class:"skill-picker-header"},Z0=["onKeydown"],eT={key:0,class:"skill-picker-list",role:"listbox"},tT=["onClick","onPointerenter"],nT={class:"skill-picker-name"},rT={key:0,class:"skill-picker-desc"},sT={key:1,class:"skill-picker-empty"},oT=qt({__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=fe(()=>{const _=i.value.toLowerCase().trim();return _?n.skills.filter(I=>I.name.toLowerCase().includes(_)||I.description.toLowerCase().includes(_)):n.skills}),d=fe(()=>{const _={};return n.anchorBottom!=null&&(_.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(_.left=`${n.anchorLeft}px`),_});function c(_){l.value.length!==0&&(a.value=(a.value+_+l.value.length)%l.value.length)}function p(){const _=l.value[a.value];_&&r("select",_)}return lt(()=>n.visible,_=>{_&&(i.value="",a.value=0,Wt(()=>{var I;return(I=o.value)==null?void 0:I.focus()}))}),lt(i,()=>{a.value=0}),(_,I)=>e.visible?(m(),b("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:Wr(d.value)},[y("div",X0,[Er(y("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":I[0]||(I[0]=j=>i.value=j),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[I[1]||(I[1]=pn(mt(j=>_.$emit("close"),["prevent"]),["escape"])),pn(mt(p,["prevent"]),["enter"]),I[2]||(I[2]=pn(mt(j=>c(1),["prevent"]),["arrow-down"])),I[3]||(I[3]=pn(mt(j=>c(-1),["prevent"]),["arrow-up"]))]},null,40,Z0),[[Cr,i.value]])]),l.value.length>0?(m(),b("ul",eT,[(m(!0),b(Pe,null,it(l.value,(j,$)=>(m(),b("li",{key:j.path},[y("button",{class:at(["skill-picker-item",{"is-highlighted":$===a.value}]),type:"button",onClick:Z=>_.$emit("select",j),onPointerenter:Z=>a.value=$},[y("span",nT,H(j.name),1),j.description?(m(),b("span",rT,H(j.description),1)):de("",!0)],42,tT)]))),128))])):(m(),b("div",sT,"No skills found"))],4)):de("",!0)}}),iT=ct(oT,[["__scopeId","data-v-ff3fb7dc"]]),aT={key:0,class:"thread-composer-dictation-error"},lT={key:0,class:"thread-composer-attachments"},cT=["src","alt"],uT=["aria-label","disabled","onClick"],dT={key:1,class:"thread-composer-folder-chips"},fT=["title"],hT={class:"thread-composer-folder-chip-meta"},pT=["aria-label","disabled","onClick"],mT={key:2,class:"thread-composer-file-chips"},gT=["title"],vT=["aria-label","disabled","onClick"],yT={key:3,class:"thread-composer-skill-chips"},wT={class:"thread-composer-skill-chip-name"},bT=["aria-label","onClick"],_T=["title"],kT={class:"thread-composer-rate-limit-row"},TT={class:"thread-composer-rate-limit-value"},ST={key:0,class:"thread-composer-rate-limit-refresh"},IT={class:"thread-composer-input-wrap"},ET={key:0,class:"thread-composer-file-mentions"},CT=["onMousedown"],AT={key:1,class:"thread-composer-file-mention-icon-markdown"},xT={class:"thread-composer-file-mention-text"},RT={class:"thread-composer-file-mention-name"},PT={key:0,class:"thread-composer-file-mention-dir"},MT={key:1,class:"thread-composer-file-mention-empty"},$T=["placeholder","disabled"],OT=["disabled"],NT={key:0,class:"thread-composer-attach-menu"},DT=["disabled"],LT=["disabled"],jT=["disabled"],FT=["aria-label","aria-pressed","disabled"],BT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},UT={key:1,class:"thread-composer-dictation-timer"},HT=["aria-label","title","disabled"],WT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},VT=["disabled"],zT=["aria-label","title","disabled"],GT=["disabled"],qT=["disabled"],KT=["disabled"],JT=qt({__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([]),d=D(""),{state:c,isSupported:p,recordingDurationMs:_,waveformCanvasRef:I,startRecording:j,stopRecording:$,toggleRecording:Z}=yk({onTranscript:x=>{s.value=s.value?`${s.value}
51
+ ${x}`:x,d.value="",Wt(()=>{var F;return(F=_e.value)==null?void 0:F.focus()})},onEmpty:()=>{d.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:x=>{if(x instanceof DOMException&&x.name==="NotAllowedError"){d.value="Microphone access was denied.";return}d.value=x instanceof Error?x.message:"Dictation failed."}}),ae=D(null),V=D(null),te=D(null),re=D(null),_e=D(null),ue=D(!1),pe=D(!1),Me=D(null),le=D(""),se=D([]),ce=D(!1),ne=D(0);let xe=0,je=null,Ne=!1;const Ve=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),He=[{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"}],Ae=fe(()=>n.models.map(x=>({value:x,label:x}))),Ze=fe(()=>n.selectedCollaborationMode==="plan"),Ke=fe(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),ot=fe(()=>n.skills??[]),Be=fe(()=>i.value.map(x=>x.path)),Mt=fe(()=>(n.skills??[]).map(x=>({value:x.path,label:x.name,description:x.description}))),ut=fe(()=>n.disabled||!n.activeThreadId||Ke.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),It=fe(()=>{const x=new Set;for(const F of l.value)for(const ie of F.filePaths)x.add(ie);return a.value.filter(F=>!x.has(F.fsPath))}),Ue=fe(()=>n.disabled||!n.activeThreadId),W=fe(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),ge=fe(()=>c.value==="recording"),me=fe(()=>c.value==="recording"?"Stop dictation":c.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),be=fe(()=>c.value==="idle"?d.value.trim():""),De=fe(()=>{const x=Math.max(0,Math.floor(_.value/1e3)),F=Math.floor(x/60),ie=x%60;return`${F}:${String(ie).padStart(2,"0")}`}),T=fe(()=>n.activeThreadId?Ke.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),E=fe(()=>ve(n.codexQuota??null)),O=fe(()=>""),K=fe(()=>ke(n.codexQuota??null));function q(x){return!x||x==="unknown"?"":x==="edu"?"Education":`${x.slice(0,1).toUpperCase()}${x.slice(1)}`}function R(x){return typeof x!="number"||!Number.isFinite(x)||x<=0?"":x%1440===0?`${x/1440}d`:x%60===0?`${x/60}h`:`${x}m`}function U(x){if(typeof x!="number"||!Number.isFinite(x))return"";const ie=x*1e3-Date.now();if(ie<=0)return"resetting now";const Oe=Math.round(ie/6e4);if(Oe<60)return`resets in ${Math.max(1,Oe)}m`;const v=Math.round(Oe/60);if(v<48)return`resets in ${Math.max(1,v)}h`;const g=Math.round(v/24);return`resets in ${Math.max(1,g)}d`}function Y(x){return typeof x!="number"||!Number.isFinite(x)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(x*1e3))}function z(x){if(typeof x!="number"||!Number.isFinite(x))return"";const F=new Date(x*1e3);return`${F.getMonth()+1}月${F.getDate()}日`}function G(x){const F=[x.primary,x.secondary].filter(v=>v!==null),ie=F.find(v=>v.windowMinutes===10080);if(ie)return ie;const Oe=F.filter(v=>typeof v.windowMinutes=="number"&&v.windowMinutes>=10080).sort((v,g)=>(v.windowMinutes??0)-(g.windowMinutes??0));return Oe[0]?Oe[0]:x.secondary??null}function we(x){const F=Math.max(0,Math.min(100,100-Math.round(x.usedPercent))),ie=R(x.windowMinutes);return ie?`${F}% / ${ie}`:`${F}%`}function ve(x){var g,w;if(!x)return"";const F=[],ie=q(x.planType);ie&&F.push(ie),x.primary&&F.push(we(x.primary)),x.secondary&&F.push(we(x.secondary));const Oe=G(x),v=z((Oe==null?void 0:Oe.resetsAt)??null);return v&&F.push(v),F.length===0&&((g=x.credits)!=null&&g.unlimited)?F.push("Unlimited credits"):F.length===0&&((w=x.credits)!=null&&w.hasCredits)&&x.credits.balance&&F.push(`${x.credits.balance} credits`),F.join(" · ")}function ke(x){var v,g;if(!x)return"";const F=[],ie=q(x.planType);if(ie&&F.push(`Plan: ${ie}`),x.primary){const w=U(x.primary.resetsAt);F.push(`Primary window: ${we(x.primary)}${w?`, ${w}`:""}`)}if(x.secondary){const w=U(x.secondary.resetsAt);F.push(`Secondary window: ${we(x.secondary)}${w?`, ${w}`:""}`)}(v=x.credits)!=null&&v.unlimited?F.push("Credits: unlimited"):(g=x.credits)!=null&&g.hasCredits&&x.credits.balance&&F.push(`Credits: ${x.credits.balance}`);const Oe=G(x);if(Oe){const w=Y(Oe.resetsAt);w&&F.push(`Weekly refresh: ${w}`)}return F.join(`
52
+ `)}function Ie(x="steer"){var ie;const F=s.value.trim();if(ut.value){if(r("submit",{text:F,imageUrls:o.value.map(Oe=>Oe.url),fileAttachments:[...a.value],skills:i.value.map(Oe=>({name:Oe.name,path:Oe.path})),mode:x}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],ue.value=!1,pe.value=!1,Jt(),Ve){(ie=_e.value)==null||ie.blur();return}Wt(()=>{var Oe;return(Oe=_e.value)==null?void 0:Oe.focus()})}}function Le(){r("interrupt")}function et(x){r("update:selected-model",x)}function Ye(){r("update:selected-collaboration-mode",Ze.value?"default":"plan")}function Tt(x){r("update:selected-reasoning-effort",x)}function Ge(){n.dictationClickToToggle&&(d.value&&(d.value=""),Z())}function dt(x){if(n.dictationClickToToggle||(x.preventDefault(),Ne))return;Ne=!0;const F=x.currentTarget;if(F)try{F.setPointerCapture(x.pointerId)}catch{}d.value&&(d.value=""),window.addEventListener("pointerup",tt),window.addEventListener("pointercancel",tt),window.addEventListener("blur",tt),j()}function tt(){n.dictationClickToToggle||Ne&&(Ne=!1,window.removeEventListener("pointerup",tt),window.removeEventListener("pointercancel",tt),window.removeEventListener("blur",tt),$())}function nt(){Ue.value||(ue.value=!ue.value)}function Kt(){var x;(x=V.value)==null||x.click()}function rt(){var x;(x=te.value)==null||x.click()}function vt(){var x;(x=re.value)==null||x.click()}function Pt(x){o.value=o.value.filter(F=>F.id!==x)}function pt(x){i.value=i.value.filter(F=>F.path!==x)}function xn(x){a.value=a.value.filter(F=>F.fsPath!==x)}function St(x){const F=l.value.find(Oe=>Oe.id===x);if(!F)return;const ie=new Set(F.filePaths);a.value=a.value.filter(Oe=>!ie.has(Oe.fsPath)),l.value=l.value.filter(Oe=>Oe.id!==x)}function ft(x){return x.total<=0?0:Math.round(x.processed/x.total*100)}function vn(x,F){const ie=x.replace(/\\/g,"/");if(a.value.some(g=>g.fsPath===ie))return;const Oe=ie.split("/").filter(Boolean),v=(F==null?void 0:F.trim())||Oe[Oe.length-1]||ie;a.value=[...a.value,{label:v,path:ie,fsPath:ie}]}function zt(x){return x.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(x.name)}function $t(x){const F=new FileReader;F.onload=()=>{typeof F.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:x.name||`Pasted image ${o.value.length+1}`,url:F.result})},F.readAsDataURL(x)}function yt(x){if(!(!x||x.length===0))for(const F of Array.from(x)){if(zt(F)){$t(F);continue}Tu(F).then(ie=>{ie&&vn(ie)}).catch(()=>{})}}function Sn(x){var Oe,v;const F=(Oe=x.clipboardData)==null?void 0:Oe.items;if(F&&F.length>0){const g=[];for(const w of Array.from(F)){if(w.kind!=="file"||!w.type.startsWith("image/"))continue;const M=w.getAsFile();M&&g.push(M)}if(g.length>0)return g}const ie=(v=x.clipboardData)==null?void 0:v.files;return!ie||ie.length===0?[]:Array.from(ie).filter(g=>zt(g))}function Rn(x){if(Ue.value)return;const F=Sn(x);F.length!==0&&(x.preventDefault(),yt(F),ue.value=!1,d.value&&(d.value=""))}async function yn(x){if(!x||x.length===0)return;const F=Array.from(x),Oe=(F[0].webkitRelativePath||F[0].name).split("/").filter(Boolean)[0]||"Folder",v=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:v,name:Oe,total:F.length,processed:0,filePaths:[],isUploading:!0}];const g=w=>{l.value=l.value.map(M=>M.id===v?w(M):M)};for(const w of F)try{const M=await Tu(w);if(M){const B=w.webkitRelativePath||w.name;vn(M,B),g(J=>({...J,processed:J.processed+1,filePaths:[...J.filePaths,M]}));continue}g(B=>({...B,processed:B.processed+1}))}catch{g(M=>({...M,processed:M.processed+1}))}g(w=>({...w,isUploading:!1}))}function Pn(x){x&&(x.value="")}function cn(x){const F=x.target;yt((F==null?void 0:F.files)??null),Pn(F),ue.value=!1}function Qt(x){const F=x.target;yt((F==null?void 0:F.files)??null),Pn(F),ue.value=!1}function Xt(x){const F=x.target;yn((F==null?void 0:F.files)??null),Pn(F),ue.value=!1}function dr(){d.value&&(d.value="");const F=s.value.startsWith("/");F!==pe.value&&(pe.value=F),Fe()}function Dn(x){if(ce.value){if(x.key==="Escape"){x.preventDefault(),Jt();return}if(x.key==="ArrowDown"){x.preventDefault(),se.value.length>0&&(ne.value=(ne.value+1)%se.value.length);return}if(x.key==="ArrowUp"){if(x.preventDefault(),se.value.length>0){const ie=se.value.length;ne.value=(ne.value+ie-1)%ie}return}if(x.key==="Enter"||x.key==="Tab"){x.preventDefault();const ie=se.value[ne.value];ie?In(ie):Jt();return}}if(n.sendWithEnter!==!1?x.key==="Enter"&&!x.shiftKey:x.key==="Enter"&&(x.metaKey||x.ctrlKey)){x.preventDefault(),Ie(n.isTurnInProgress?W.value:"steer");return}if(pe.value){if(x.key==="Escape"){x.preventDefault(),Zt();return}if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();return}}}function Zt(){var x;pe.value=!1,(x=_e.value)==null||x.focus()}function Jt(){ce.value=!1,Me.value=null,le.value="",se.value=[],ne.value=0}function Fe(){const x=_e.value;if(!x){Jt();return}const F=x.selectionStart??s.value.length,Oe=s.value.slice(0,F).match(/(^|\s)(@[^\s@]*)$/);if(!Oe){Jt();return}const v=Oe[2]??"",g=v.length,w=F-g;Me.value=w,le.value=v.slice(1),ce.value=!0,Re()}async function Re(){if(!ce.value)return;const x=(n.cwd??"").trim();if(!x){se.value=[];return}je&&clearTimeout(je);const F=++xe;je=setTimeout(async()=>{try{const ie=await h0(x,le.value,20);if(!ce.value||F!==xe)return;se.value=ie,ne.value=0}catch{if(!ce.value||F!==xe)return;se.value=[]}},120)}function In(x){const F=_e.value,ie=Me.value;if(ie!==null&&F){const Oe=F.selectionStart??s.value.length;s.value=`${s.value.slice(0,ie)}${s.value.slice(Oe)}`.trimEnd()}vn(x.path),Jt(),Wt(()=>F==null?void 0:F.focus())}function Ot(x){const F=x.lastIndexOf("/");return F<0?x:x.slice(F+1)}function Mn(x){const F=x.lastIndexOf("/");return F<=0?"":x.slice(0,F)}function wn(x){const F=Ot(x),ie=F.lastIndexOf(".");return ie<=0?"":F.slice(ie+1).toLowerCase()}function bn(x){const F=wn(x);return F==="ts"?"TS":F==="tsx"?"TSX":F==="js"?"JS":F==="jsx"?"JSX":F==="json"?"{}":""}function Jn(x){const F=wn(x);return F.startsWith("ts")?"ts":F.startsWith("js")?"js":F==="json"?"json":"default"}function _n(x){const F=wn(x);return F==="md"||F==="mdx"}function fr(x){var F;i.value.some(ie=>ie.path===x.path)||(i.value=[...i.value,x]),s.value=s.value.startsWith("/")?"":s.value,pe.value=!1,(F=_e.value)==null||F.focus()}function En(x,F){if(F){const ie=(n.skills??[]).find(Oe=>Oe.path===x);ie&&!i.value.some(Oe=>Oe.path===x)&&(i.value=[...i.value,ie])}else i.value=i.value.filter(ie=>ie.path!==x)}function Cn(x){if(!ue.value)return;const F=ae.value;if(!F)return;const ie=x.target;!ie||F.contains(ie)||(ue.value=!1)}return Pr(()=>{document.addEventListener("click",Cn)}),Mr(()=>{document.removeEventListener("click",Cn),window.removeEventListener("pointerup",tt),window.removeEventListener("pointercancel",tt),window.removeEventListener("blur",tt),je&&clearTimeout(je)}),lt(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],d.value="",ue.value=!1,pe.value=!1,Jt()}),lt(()=>n.cwd,()=>{ce.value&&Re()}),(x,F)=>(m(),b("form",{class:"thread-composer",onSubmit:F[2]||(F[2]=mt(ie=>Ie("steer"),["prevent"]))},[be.value?(m(),b("p",aT,H(be.value),1)):de("",!0),y("div",{class:at(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(m(),b("div",lT,[(m(!0),b(Pe,null,it(o.value,ie=>(m(),b("div",{key:ie.id,class:"thread-composer-attachment"},[y("img",{class:"thread-composer-attachment-image",src:ie.url,alt:ie.name||"Selected image"},null,8,cT),y("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${ie.name||"image"}`,disabled:Ue.value,onClick:Oe=>Pt(ie.id)}," x ",8,uT)]))),128))])):de("",!0),l.value.length>0?(m(),b("div",dT,[(m(!0),b(Pe,null,it(l.value,ie=>(m(),b("span",{key:ie.id,class:"thread-composer-folder-chip"},[$e($l,{class:"thread-composer-folder-chip-icon"}),y("span",{class:"thread-composer-folder-chip-name",title:ie.name},H(ie.name),9,fT),y("span",hT,[ie.isUploading?(m(),b(Pe,{key:0},[po(H(ft(ie))+"% uploading ("+H(ie.processed)+"/"+H(ie.total)+") ",1)],64)):(m(),b(Pe,{key:1},[po(H(ie.filePaths.length)+" file"+H(ie.filePaths.length===1?"":"s"),1)],64))]),y("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${ie.name}`,disabled:Ue.value,onClick:Oe=>St(ie.id)},"×",8,pT)]))),128))])):de("",!0),It.value.length>0?(m(),b("div",mT,[(m(!0),b(Pe,null,it(It.value,ie=>(m(),b("span",{key:ie.fsPath,class:"thread-composer-file-chip"},[$e(ii,{class:"thread-composer-file-chip-icon"}),y("span",{class:"thread-composer-file-chip-name",title:ie.fsPath},H(ie.label),9,gT),y("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${ie.label}`,disabled:Ue.value,onClick:Oe=>xn(ie.fsPath)},"×",8,vT)]))),128))])):de("",!0),i.value.length>0?(m(),b("div",yT,[(m(!0),b(Pe,null,it(i.value,ie=>(m(),b("span",{key:ie.path,class:"thread-composer-skill-chip"},[y("span",wT,H(ie.name),1),y("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${ie.name}`,onClick:Oe=>pt(ie.path)},"×",8,bT)]))),128))])):de("",!0),E.value?(m(),b("div",{key:4,class:"thread-composer-rate-limit",title:K.value,"aria-live":"polite"},[y("span",kT,[y("span",TT,H(E.value),1)]),O.value?(m(),b("span",ST,H(O.value),1)):de("",!0)],8,_T)):de("",!0),y("div",IT,[ce.value?(m(),b("div",ET,[se.value.length>0?(m(!0),b(Pe,{key:0},it(se.value,(ie,Oe)=>(m(),b("button",{key:ie.path,class:at(["thread-composer-file-mention-row",{"is-active":Oe===ne.value}]),type:"button",onMousedown:mt(v=>In(ie),["prevent"])},[bn(ie.path)?(m(),b("span",{key:0,class:at(["thread-composer-file-mention-icon-badge",`is-${Jn(ie.path)}`])},H(bn(ie.path)),3)):_n(ie.path)?(m(),b("span",AT,"↓")):(m(),ht(ii,{key:2,class:"thread-composer-file-mention-icon-file"})),y("span",xT,[y("span",RT,H(Ot(ie.path)),1),Mn(ie.path)?(m(),b("span",PT,H(Mn(ie.path)),1)):de("",!0)])],42,CT))),128)):(m(),b("div",MT,"No matching files"))])):de("",!0),Er(y("textarea",{ref_key:"inputRef",ref:_e,"onUpdate:modelValue":F[0]||(F[0]=ie=>s.value=ie),class:"thread-composer-input",placeholder:T.value,disabled:Ue.value,onInput:dr,onKeydown:Dn,onPaste:Rn},null,40,$T),[[Cr,s.value]]),$e(iT,{skills:ot.value,visible:pe.value,"anchor-bottom":44,"anchor-left":0,onSelect:fr,onClose:Zt},null,8,["skills","visible"])]),y("div",{class:at(["thread-composer-controls",{"thread-composer-controls--recording":ge.value}])},[y("div",{ref_key:"attachMenuRootRef",ref:ae,class:"thread-composer-attach"},[y("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Ue.value,onClick:nt}," + ",8,OT),ue.value?(m(),b("div",NT,[y("button",{class:"thread-composer-attach-item",type:"button",disabled:Ue.value,onClick:Kt}," Add photos & files ",8,DT),y("button",{class:"thread-composer-attach-item",type:"button",disabled:Ue.value,onClick:vt}," Add folder ",8,LT),y("button",{class:"thread-composer-attach-item",type:"button",disabled:Ue.value,onClick:rt}," Take photo ",8,jT)])):de("",!0)],512),ge.value?de("",!0):(m(),b(Pe,{key:0},[y("button",{class:at(["thread-composer-plan-toggle",{"is-active":Ze.value}]),type:"button","aria-label":Ze.value?"Disable plan mode":"Enable plan mode","aria-pressed":Ze.value,disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:Ye},[...F[3]||(F[3]=[y("span",{class:"thread-composer-plan-toggle-label"},"Plan",-1),y("span",{class:"thread-composer-plan-toggle-switch","aria-hidden":"true"},[y("span",{class:"thread-composer-plan-toggle-switch-thumb"})],-1)])],10,FT),$e(Ya,{class:"thread-composer-control","model-value":e.selectedModel,options:Ae.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":et},null,8,["model-value","options","disabled"]),$e(Q0,{class:"thread-composer-control",options:Mt.value,"selected-values":Be.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:En},null,8,["options","selected-values","disabled"]),$e(Ya,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:He,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":Tt},null,8,["model-value","disabled"])],64)),y("div",{class:at(["thread-composer-actions",{"thread-composer-actions--recording":ge.value}])},[ye(c)==="recording"?(m(),b("div",BT,[y("canvas",{ref_key:"dictationWaveformCanvasRef",ref:I,class:"thread-composer-dictation-waveform"},null,512)])):de("",!0),ye(c)==="recording"?(m(),b("span",UT,H(De.value),1)):de("",!0),ye(p)&&!e.isTurnInProgress?(m(),b("button",{key:2,class:at(["thread-composer-mic",{"thread-composer-mic--active":ye(c)==="recording","thread-composer-mic--transcribing":ye(c)==="transcribing"}]),type:"button","aria-label":me.value,title:me.value,disabled:Ue.value||ye(c)==="transcribing",onClick:Ge,onPointerdown:dt,onPointerup:tt,onPointercancel:tt},[ye(c)==="recording"?(m(),ht(Su,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):ye(c)==="transcribing"?(m(),b("span",WT)):(m(),ht(I0,{key:2,class:"thread-composer-mic-icon"}))],42,HT)):de("",!0),e.isTurnInProgress?(m(),b("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Le},[$e(Su,{class:"thread-composer-stop-icon"})],8,VT)):de("",!0),y("button",{class:at(["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:!ut.value,onClick:F[1]||(F[1]=ie=>Ie(e.isTurnInProgress?W.value:"steer"))},[$e(_0,{class:"thread-composer-submit-icon"})],10,zT)],2)],2)],2),y("input",{ref_key:"photoLibraryInputRef",ref:V,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ue.value,onChange:cn},null,40,GT),y("input",{ref_key:"cameraCaptureInputRef",ref:te,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ue.value,onChange:Qt},null,40,qT),y("input",{ref_key:"folderPickerInputRef",ref:re,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ue.value,onChange:Xt},null,40,KT)],32))}}),Iu=ct(JT,[["__scopeId","data-v-dc703024"]]),YT={key:0,class:"queued-messages"},QT={class:"queued-messages-inner"},XT={class:"queued-row-text"},ZT={class:"queued-row-actions"},eS=["onClick"],tS=["onClick"],nS=qt({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(m(),b("div",YT,[y("div",QT,[(m(!0),b(Pe,null,it(e.messages,r=>(m(),b("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=y("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[y("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)),y("span",XT,H(r.text),1),y("div",ZT,[y("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,eS),y("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]=[y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[y("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,tS)])]))),128))])])):de("",!0)}}),rS=ct(nS,[["__scopeId","data-v-ea583733"]]),sS={class:"runtime-dropdown-trigger-label"},oS={key:0,class:"runtime-dropdown-menu-wrap"},iS={class:"runtime-dropdown-menu"},aS=["onClick"],lS={class:"runtime-dropdown-option-label"},cS={key:0,class:"runtime-dropdown-option-check"},uS=qt({__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:$l},{value:"worktree",label:"New worktree",icon:qo}],a=fe(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function d(c){if(!o.value)return;const p=s.value;if(!p)return;const _=c.target;_ instanceof Node&&(p.contains(_)||(o.value=!1))}return Pr(()=>{window.addEventListener("pointerdown",d)}),Mr(()=>{window.removeEventListener("pointerdown",d)}),(c,p)=>(m(),b("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[y("button",{class:"runtime-dropdown-trigger",type:"button",onClick:p[0]||(p[0]=_=>o.value=!o.value)},[(m(),ht(ni(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),y("span",sS,H(a.value.label),1),$e(Ai,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(m(),b("div",oS,[y("div",iS,[p[1]||(p[1]=y("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(m(),b(Pe,null,it(i,_=>y("button",{key:_.value,class:at(["runtime-dropdown-option",{"is-selected":e.modelValue===_.value}]),type:"button",onClick:I=>l(_.value)},[(m(),ht(ni(_.icon),{class:"runtime-dropdown-option-icon"})),y("span",lS,H(_.label),1),e.modelValue===_.value?(m(),b("span",cS,"✓")):de("",!0)],10,aS)),64))])])):de("",!0)],512))}}),dS=ct(uS,[["__scopeId","data-v-9c9b71e5"]]),fS={},hS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function pS(e,t){return m(),b("svg",hS,[...t[0]||(t[0]=[y("circle",{cx:"11",cy:"11",r:"8"},null,-1),y("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Qa=ct(fS,[["render",pS]]),mS={class:"skill-card-top"},gS=["src","alt"],vS={key:1,class:"skill-card-avatar-fallback"},yS={class:"skill-card-info"},wS={class:"skill-card-header"},bS={class:"skill-card-name"},_S={key:0,class:"skill-card-badge-disabled"},kS={key:1,class:"skill-card-badge"},TS={class:"skill-card-owner"},SS={key:0,class:"skill-card-desc"},IS={key:1,class:"skill-card-date"},ES=qt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=fe(()=>{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)=>(m(),b("button",{class:at(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[y("div",mS,[e.skill.avatarUrl?(m(),b("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,gS)):(m(),b("div",vS,H(e.skill.owner.charAt(0)),1)),y("div",yS,[y("div",wS,[y("span",bS,H(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(m(),b("span",_S,"Disabled")):e.skill.installed?(m(),b("span",kS,"Installed")):de("",!0)]),y("span",TS,H(e.skill.owner),1)])]),e.skill.description?(m(),b("p",SS,H(e.skill.description),1)):de("",!0),n.value?(m(),b("span",IS,H(n.value),1)):de("",!0)],2))}}),Eu=ct(ES,[["__scopeId","data-v-2a1e8196"]]),CS={class:"sdm-panel"},AS={class:"sdm-header"},xS={class:"sdm-title-area"},RS=["src","alt"],PS={class:"sdm-title-col"},MS={class:"sdm-title-row"},$S={class:"sdm-title"},OS={key:0,class:"sdm-badge-disabled"},NS={class:"sdm-owner"},DS={class:"sdm-body"},LS={key:0,class:"sdm-desc"},jS={key:1,class:"sdm-readme-loading"},FS=["innerHTML"],BS=["href"],US={class:"sdm-footer"},HS={class:"sdm-footer-actions"},WS=["disabled"],VS=["disabled"],zS=["disabled"],GS=qt({__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=fe(()=>s.value??n.skill.enabled??!0),l=fe(()=>n.isInstalling===!0||n.isUninstalling===!0),d=fe(()=>{const $=o.value;if(!$)return"";const Z=$.replace(/^---[\s\S]*?---\s*/,"");return c(Z)});function c($){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 p(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const $=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),Z=await fetch(`/codex-api/skills-hub/readme?${$}`);if(!Z.ok)return;const ae=await Z.json();o.value=ae.content??""}catch{}finally{i.value=!1}}}lt(()=>n.visible,$=>{$&&(s.value=null,o.value="",p())});function _(){r("install",n.skill)}function I(){r("uninstall",n.skill)}function j(){const $=!a.value;s.value=$,r("toggle-enabled",n.skill,$)}return($,Z)=>(m(),ht(eo,{to:"body"},[e.visible?(m(),b("div",{key:0,class:"sdm-overlay",onClick:Z[1]||(Z[1]=mt(ae=>$.$emit("close"),["self"]))},[y("div",CS,[y("div",AS,[y("div",xS,[e.skill.avatarUrl?(m(),b("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,RS)):de("",!0),y("div",PS,[y("div",MS,[y("h3",$S,H(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(m(),b("span",OS,"Disabled")):de("",!0)]),y("span",NS,H(e.skill.owner),1)])]),y("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:Z[0]||(Z[0]=ae=>$.$emit("close"))},[$e(Ol,{class:"sdm-close-icon"})])]),y("div",DS,[e.skill.description?(m(),b("p",LS,H(e.skill.description),1)):de("",!0),i.value?(m(),b("div",jS,"Loading skill contents...")):o.value?(m(),b("div",{key:2,class:"sdm-readme",innerHTML:d.value},null,8,FS)):de("",!0),y("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,BS)]),y("div",US,[y("div",HS,[e.skill.installed?(m(),b("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:I},H(n.isUninstalling?"Uninstalling...":"Uninstall"),9,WS)):(m(),b("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:_},H(n.isInstalling?"Installing...":"Install"),9,VS)),e.skill.installed?(m(),b("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:j},H(a.value?"Disable":"Enable"),9,zS)):de("",!0)])])])])):de("",!0)]))}}),qS=ct(GS,[["__scopeId","data-v-19a385ca"]]),KS=()=>{};var Cu={};/**
53
+ * @license
54
+ * Copyright 2017 Google LLC
55
+ *
56
+ * Licensed under the Apache License, Version 2.0 (the "License");
57
+ * you may not use this file except in compliance with the License.
58
+ * You may obtain a copy of the License at
59
+ *
60
+ * http://www.apache.org/licenses/LICENSE-2.0
61
+ *
62
+ * Unless required by applicable law or agreed to in writing, software
63
+ * distributed under the License is distributed on an "AS IS" BASIS,
64
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
+ * See the License for the specific language governing permissions and
66
+ * limitations under the License.
67
+ */const Kf=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},JS=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("")},Jf={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,d=l?e[s+2]:0,c=o>>2,p=(o&3)<<4|a>>4;let _=(a&15)<<2|d>>6,I=d&63;l||(I=64,i||(_=64)),r.push(n[c],n[p],n[_],n[I])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Kf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):JS(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 d=s<e.length?n[e.charAt(s)]:64;++s;const p=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||d==null||p==null)throw new YS;const _=o<<2|a>>4;if(r.push(_),d!==64){const I=a<<4&240|d>>2;if(r.push(I),p!==64){const j=d<<6&192|p;r.push(j)}}}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 YS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const QS=function(e){const t=Kf(e);return Jf.encodeByteArray(t,!0)},Yf=function(e){return QS(e).replace(/\./g,"")},Qf=function(e){try{return Jf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
68
+ * @license
69
+ * Copyright 2022 Google LLC
70
+ *
71
+ * Licensed under the Apache License, Version 2.0 (the "License");
72
+ * you may not use this file except in compliance with the License.
73
+ * You may obtain a copy of the License at
74
+ *
75
+ * http://www.apache.org/licenses/LICENSE-2.0
76
+ *
77
+ * Unless required by applicable law or agreed to in writing, software
78
+ * distributed under the License is distributed on an "AS IS" BASIS,
79
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80
+ * See the License for the specific language governing permissions and
81
+ * limitations under the License.
82
+ */function XS(){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.")}/**
83
+ * @license
84
+ * Copyright 2022 Google LLC
85
+ *
86
+ * Licensed under the Apache License, Version 2.0 (the "License");
87
+ * you may not use this file except in compliance with the License.
88
+ * You may obtain a copy of the License at
89
+ *
90
+ * http://www.apache.org/licenses/LICENSE-2.0
91
+ *
92
+ * Unless required by applicable law or agreed to in writing, software
93
+ * distributed under the License is distributed on an "AS IS" BASIS,
94
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
+ * See the License for the specific language governing permissions and
96
+ * limitations under the License.
97
+ */const ZS=()=>XS().__FIREBASE_DEFAULTS__,eI=()=>{if(typeof process>"u"||typeof Cu>"u")return;const e=Cu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},tI=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Qf(e[1]);return t&&JSON.parse(t)},Dl=()=>{try{return KS()||ZS()||eI()||tI()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},nI=e=>{var t,n;return(n=(t=Dl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},Xf=()=>{var e;return(e=Dl())==null?void 0:e.config},Zf=e=>{var t;return(t=Dl())==null?void 0:t[`_${e}`]};/**
98
+ * @license
99
+ * Copyright 2017 Google LLC
100
+ *
101
+ * Licensed under the Apache License, Version 2.0 (the "License");
102
+ * you may not use this file except in compliance with the License.
103
+ * You may obtain a copy of the License at
104
+ *
105
+ * http://www.apache.org/licenses/LICENSE-2.0
106
+ *
107
+ * Unless required by applicable law or agreed to in writing, software
108
+ * distributed under the License is distributed on an "AS IS" BASIS,
109
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110
+ * See the License for the specific language governing permissions and
111
+ * limitations under the License.
112
+ */class rI{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))}}}/**
113
+ * @license
114
+ * Copyright 2017 Google LLC
115
+ *
116
+ * Licensed under the Apache License, Version 2.0 (the "License");
117
+ * you may not use this file except in compliance with the License.
118
+ * You may obtain a copy of the License at
119
+ *
120
+ * http://www.apache.org/licenses/LICENSE-2.0
121
+ *
122
+ * Unless required by applicable law or agreed to in writing, software
123
+ * distributed under the License is distributed on an "AS IS" BASIS,
124
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125
+ * See the License for the specific language governing permissions and
126
+ * limitations under the License.
127
+ */function gn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function sI(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(gn())}function oI(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function iI(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function aI(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function lI(){const e=gn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function cI(){try{return typeof indexedDB=="object"}catch{return!1}}function uI(){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)}})}/**
128
+ * @license
129
+ * Copyright 2017 Google LLC
130
+ *
131
+ * Licensed under the Apache License, Version 2.0 (the "License");
132
+ * you may not use this file except in compliance with the License.
133
+ * You may obtain a copy of the License at
134
+ *
135
+ * http://www.apache.org/licenses/LICENSE-2.0
136
+ *
137
+ * Unless required by applicable law or agreed to in writing, software
138
+ * distributed under the License is distributed on an "AS IS" BASIS,
139
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
140
+ * See the License for the specific language governing permissions and
141
+ * limitations under the License.
142
+ */const dI="FirebaseError";class Kr extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=dI,Object.setPrototypeOf(this,Kr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Io.prototype.create)}}class Io{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?fI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Kr(s,a,r)}}function fI(e,t){return e.replace(hI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const hI=/\{\$([^}]+)}/g;function pI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Os(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(Au(o)&&Au(i)){if(!Os(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Au(e){return e!==null&&typeof e=="object"}/**
143
+ * @license
144
+ * Copyright 2017 Google LLC
145
+ *
146
+ * Licensed under the Apache License, Version 2.0 (the "License");
147
+ * you may not use this file except in compliance with the License.
148
+ * You may obtain a copy of the License at
149
+ *
150
+ * http://www.apache.org/licenses/LICENSE-2.0
151
+ *
152
+ * Unless required by applicable law or agreed to in writing, software
153
+ * distributed under the License is distributed on an "AS IS" BASIS,
154
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155
+ * See the License for the specific language governing permissions and
156
+ * limitations under the License.
157
+ */function Eo(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 mI(e,t){const n=new gI(e,t);return n.subscribe.bind(n)}class gI{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.");vI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=ga),s.error===void 0&&(s.error=ga),s.complete===void 0&&(s.complete=ga);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 vI(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 ga(){}/**
158
+ * @license
159
+ * Copyright 2021 Google LLC
160
+ *
161
+ * Licensed under the Apache License, Version 2.0 (the "License");
162
+ * you may not use this file except in compliance with the License.
163
+ * You may obtain a copy of the License at
164
+ *
165
+ * http://www.apache.org/licenses/LICENSE-2.0
166
+ *
167
+ * Unless required by applicable law or agreed to in writing, software
168
+ * distributed under the License is distributed on an "AS IS" BASIS,
169
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
170
+ * See the License for the specific language governing permissions and
171
+ * limitations under the License.
172
+ */function js(e){return e&&e._delegate?e._delegate:e}/**
173
+ * @license
174
+ * Copyright 2025 Google LLC
175
+ *
176
+ * Licensed under the Apache License, Version 2.0 (the "License");
177
+ * you may not use this file except in compliance with the License.
178
+ * You may obtain a copy of the License at
179
+ *
180
+ * http://www.apache.org/licenses/LICENSE-2.0
181
+ *
182
+ * Unless required by applicable law or agreed to in writing, software
183
+ * distributed under the License is distributed on an "AS IS" BASIS,
184
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
+ * See the License for the specific language governing permissions and
186
+ * limitations under the License.
187
+ */function Ll(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function yI(e){return(await fetch(e,{credentials:"include"})).ok}class Ns{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}}/**
188
+ * @license
189
+ * Copyright 2019 Google LLC
190
+ *
191
+ * Licensed under the Apache License, Version 2.0 (the "License");
192
+ * you may not use this file except in compliance with the License.
193
+ * You may obtain a copy of the License at
194
+ *
195
+ * http://www.apache.org/licenses/LICENSE-2.0
196
+ *
197
+ * Unless required by applicable law or agreed to in writing, software
198
+ * distributed under the License is distributed on an "AS IS" BASIS,
199
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ * See the License for the specific language governing permissions and
201
+ * limitations under the License.
202
+ */const ss="[DEFAULT]";/**
203
+ * @license
204
+ * Copyright 2019 Google LLC
205
+ *
206
+ * Licensed under the Apache License, Version 2.0 (the "License");
207
+ * you may not use this file except in compliance with the License.
208
+ * You may obtain a copy of the License at
209
+ *
210
+ * http://www.apache.org/licenses/LICENSE-2.0
211
+ *
212
+ * Unless required by applicable law or agreed to in writing, software
213
+ * distributed under the License is distributed on an "AS IS" BASIS,
214
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215
+ * See the License for the specific language governing permissions and
216
+ * limitations under the License.
217
+ */class wI{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 rI;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(_I(t))try{this.getOrInitializeService({instanceIdentifier:ss})}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=ss){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=ss){return this.instances.has(t)}getOptions(t=ss){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:bI(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=ss){return this.component?this.component.multipleInstances?t:ss:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function bI(e){return e===ss?void 0:e}function _I(e){return e.instantiationMode==="EAGER"}/**
218
+ * @license
219
+ * Copyright 2019 Google LLC
220
+ *
221
+ * Licensed under the Apache License, Version 2.0 (the "License");
222
+ * you may not use this file except in compliance with the License.
223
+ * You may obtain a copy of the License at
224
+ *
225
+ * http://www.apache.org/licenses/LICENSE-2.0
226
+ *
227
+ * Unless required by applicable law or agreed to in writing, software
228
+ * distributed under the License is distributed on an "AS IS" BASIS,
229
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
230
+ * See the License for the specific language governing permissions and
231
+ * limitations under the License.
232
+ */class kI{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 wI(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
233
+ * @license
234
+ * Copyright 2017 Google LLC
235
+ *
236
+ * Licensed under the Apache License, Version 2.0 (the "License");
237
+ * you may not use this file except in compliance with the License.
238
+ * You may obtain a copy of the License at
239
+ *
240
+ * http://www.apache.org/licenses/LICENSE-2.0
241
+ *
242
+ * Unless required by applicable law or agreed to in writing, software
243
+ * distributed under the License is distributed on an "AS IS" BASIS,
244
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
245
+ * See the License for the specific language governing permissions and
246
+ * limitations under the License.
247
+ */var Ct;(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"})(Ct||(Ct={}));const TI={debug:Ct.DEBUG,verbose:Ct.VERBOSE,info:Ct.INFO,warn:Ct.WARN,error:Ct.ERROR,silent:Ct.SILENT},SI=Ct.INFO,II={[Ct.DEBUG]:"log",[Ct.VERBOSE]:"log",[Ct.INFO]:"info",[Ct.WARN]:"warn",[Ct.ERROR]:"error"},EI=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=II[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 eh{constructor(t){this.name=t,this._logLevel=SI,this._logHandler=EI,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Ct))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?TI[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,Ct.DEBUG,...t),this._logHandler(this,Ct.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Ct.VERBOSE,...t),this._logHandler(this,Ct.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Ct.INFO,...t),this._logHandler(this,Ct.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Ct.WARN,...t),this._logHandler(this,Ct.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Ct.ERROR,...t),this._logHandler(this,Ct.ERROR,...t)}}const CI=(e,t)=>t.some(n=>e instanceof n);let xu,Ru;function AI(){return xu||(xu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function xI(){return Ru||(Ru=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const th=new WeakMap,Xa=new WeakMap,nh=new WeakMap,va=new WeakMap,jl=new WeakMap;function RI(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(Vr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&th.set(n,e)}).catch(()=>{}),jl.set(t,e),t}function PI(e){if(Xa.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)});Xa.set(e,t)}let Za={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return Xa.get(e);if(t==="objectStoreNames")return e.objectStoreNames||nh.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Vr(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 MI(e){Za=e(Za)}function $I(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(ya(this),t,...n);return nh.set(r,t.sort?t.sort():[t]),Vr(r)}:xI().includes(e)?function(...t){return e.apply(ya(this),t),Vr(th.get(this))}:function(...t){return Vr(e.apply(ya(this),t))}}function OI(e){return typeof e=="function"?$I(e):(e instanceof IDBTransaction&&PI(e),CI(e,AI())?new Proxy(e,Za):e)}function Vr(e){if(e instanceof IDBRequest)return RI(e);if(va.has(e))return va.get(e);const t=OI(e);return t!==e&&(va.set(e,t),jl.set(t,e)),t}const ya=e=>jl.get(e);function NI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=Vr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(Vr(i.result),l.oldVersion,l.newVersion,Vr(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",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const DI=["get","getKey","getAll","getAllKeys","count"],LI=["put","add","delete","clear"],wa=new Map;function Pu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(wa.get(t))return wa.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=LI.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||DI.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),s&&l.done]))[0]};return wa.set(t,o),o}MI(e=>({...e,get:(t,n,r)=>Pu(t,n)||e.get(t,n,r),has:(t,n)=>!!Pu(t,n)||e.has(t,n)}));/**
248
+ * @license
249
+ * Copyright 2019 Google LLC
250
+ *
251
+ * Licensed under the Apache License, Version 2.0 (the "License");
252
+ * you may not use this file except in compliance with the License.
253
+ * You may obtain a copy of the License at
254
+ *
255
+ * http://www.apache.org/licenses/LICENSE-2.0
256
+ *
257
+ * Unless required by applicable law or agreed to in writing, software
258
+ * distributed under the License is distributed on an "AS IS" BASIS,
259
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260
+ * See the License for the specific language governing permissions and
261
+ * limitations under the License.
262
+ */class jI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(FI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function FI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const el="@firebase/app",Mu="0.14.10";/**
263
+ * @license
264
+ * Copyright 2019 Google LLC
265
+ *
266
+ * Licensed under the Apache License, Version 2.0 (the "License");
267
+ * you may not use this file except in compliance with the License.
268
+ * You may obtain a copy of the License at
269
+ *
270
+ * http://www.apache.org/licenses/LICENSE-2.0
271
+ *
272
+ * Unless required by applicable law or agreed to in writing, software
273
+ * distributed under the License is distributed on an "AS IS" BASIS,
274
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
+ * See the License for the specific language governing permissions and
276
+ * limitations under the License.
277
+ */const Ar=new eh("@firebase/app"),BI="@firebase/app-compat",UI="@firebase/analytics-compat",HI="@firebase/analytics",WI="@firebase/app-check-compat",VI="@firebase/app-check",zI="@firebase/auth",GI="@firebase/auth-compat",qI="@firebase/database",KI="@firebase/data-connect",JI="@firebase/database-compat",YI="@firebase/functions",QI="@firebase/functions-compat",XI="@firebase/installations",ZI="@firebase/installations-compat",eE="@firebase/messaging",tE="@firebase/messaging-compat",nE="@firebase/performance",rE="@firebase/performance-compat",sE="@firebase/remote-config",oE="@firebase/remote-config-compat",iE="@firebase/storage",aE="@firebase/storage-compat",lE="@firebase/firestore",cE="@firebase/ai",uE="@firebase/firestore-compat",dE="firebase",fE="12.11.0";/**
278
+ * @license
279
+ * Copyright 2019 Google LLC
280
+ *
281
+ * Licensed under the Apache License, Version 2.0 (the "License");
282
+ * you may not use this file except in compliance with the License.
283
+ * You may obtain a copy of the License at
284
+ *
285
+ * http://www.apache.org/licenses/LICENSE-2.0
286
+ *
287
+ * Unless required by applicable law or agreed to in writing, software
288
+ * distributed under the License is distributed on an "AS IS" BASIS,
289
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
290
+ * See the License for the specific language governing permissions and
291
+ * limitations under the License.
292
+ */const tl="[DEFAULT]",hE={[el]:"fire-core",[BI]:"fire-core-compat",[HI]:"fire-analytics",[UI]:"fire-analytics-compat",[VI]:"fire-app-check",[WI]:"fire-app-check-compat",[zI]:"fire-auth",[GI]:"fire-auth-compat",[qI]:"fire-rtdb",[KI]:"fire-data-connect",[JI]:"fire-rtdb-compat",[YI]:"fire-fn",[QI]:"fire-fn-compat",[XI]:"fire-iid",[ZI]:"fire-iid-compat",[eE]:"fire-fcm",[tE]:"fire-fcm-compat",[nE]:"fire-perf",[rE]:"fire-perf-compat",[sE]:"fire-rc",[oE]:"fire-rc-compat",[iE]:"fire-gcs",[aE]:"fire-gcs-compat",[lE]:"fire-fst",[uE]:"fire-fst-compat",[cE]:"fire-vertex","fire-js":"fire-js",[dE]:"fire-js-all"};/**
293
+ * @license
294
+ * Copyright 2019 Google LLC
295
+ *
296
+ * Licensed under the Apache License, Version 2.0 (the "License");
297
+ * you may not use this file except in compliance with the License.
298
+ * You may obtain a copy of the License at
299
+ *
300
+ * http://www.apache.org/licenses/LICENSE-2.0
301
+ *
302
+ * Unless required by applicable law or agreed to in writing, software
303
+ * distributed under the License is distributed on an "AS IS" BASIS,
304
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
305
+ * See the License for the specific language governing permissions and
306
+ * limitations under the License.
307
+ */const yo=new Map,pE=new Map,nl=new Map;function $u(e,t){try{e.container.addComponent(t)}catch(n){Ar.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function wo(e){const t=e.name;if(nl.has(t))return Ar.debug(`There were multiple attempts to register component ${t}.`),!1;nl.set(t,e);for(const n of yo.values())$u(n,e);for(const n of pE.values())$u(n,e);return!0}function rh(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function or(e){return e==null?!1:e.settings!==void 0}/**
308
+ * @license
309
+ * Copyright 2019 Google LLC
310
+ *
311
+ * Licensed under the Apache License, Version 2.0 (the "License");
312
+ * you may not use this file except in compliance with the License.
313
+ * You may obtain a copy of the License at
314
+ *
315
+ * http://www.apache.org/licenses/LICENSE-2.0
316
+ *
317
+ * Unless required by applicable law or agreed to in writing, software
318
+ * distributed under the License is distributed on an "AS IS" BASIS,
319
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
320
+ * See the License for the specific language governing permissions and
321
+ * limitations under the License.
322
+ */const mE={"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."},zr=new Io("app","Firebase",mE);/**
323
+ * @license
324
+ * Copyright 2019 Google LLC
325
+ *
326
+ * Licensed under the Apache License, Version 2.0 (the "License");
327
+ * you may not use this file except in compliance with the License.
328
+ * You may obtain a copy of the License at
329
+ *
330
+ * http://www.apache.org/licenses/LICENSE-2.0
331
+ *
332
+ * Unless required by applicable law or agreed to in writing, software
333
+ * distributed under the License is distributed on an "AS IS" BASIS,
334
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
335
+ * See the License for the specific language governing permissions and
336
+ * limitations under the License.
337
+ */class gE{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 Ns("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 zr.create("app-deleted",{appName:this._name})}}/**
338
+ * @license
339
+ * Copyright 2019 Google LLC
340
+ *
341
+ * Licensed under the Apache License, Version 2.0 (the "License");
342
+ * you may not use this file except in compliance with the License.
343
+ * You may obtain a copy of the License at
344
+ *
345
+ * http://www.apache.org/licenses/LICENSE-2.0
346
+ *
347
+ * Unless required by applicable law or agreed to in writing, software
348
+ * distributed under the License is distributed on an "AS IS" BASIS,
349
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
350
+ * See the License for the specific language governing permissions and
351
+ * limitations under the License.
352
+ */const Co=fE;function sh(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:tl,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw zr.create("bad-app-name",{appName:String(s)});if(n||(n=Xf()),!n)throw zr.create("no-options");const o=yo.get(s);if(o){if(Os(n,o.options)&&Os(r,o.config))return o;throw zr.create("duplicate-app",{appName:s})}const i=new kI(s);for(const l of nl.values())i.addComponent(l);const a=new gE(n,r,i);return yo.set(s,a),a}function oh(e=tl){const t=yo.get(e);if(!t&&e===tl&&Xf())return sh();if(!t)throw zr.create("no-app",{appName:e});return t}function vE(){return Array.from(yo.values())}function Cs(e,t,n){let r=hE[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 "/")`),Ar.warn(i.join(" "));return}wo(new Ns(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
353
+ * @license
354
+ * Copyright 2021 Google LLC
355
+ *
356
+ * Licensed under the Apache License, Version 2.0 (the "License");
357
+ * you may not use this file except in compliance with the License.
358
+ * You may obtain a copy of the License at
359
+ *
360
+ * http://www.apache.org/licenses/LICENSE-2.0
361
+ *
362
+ * Unless required by applicable law or agreed to in writing, software
363
+ * distributed under the License is distributed on an "AS IS" BASIS,
364
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
365
+ * See the License for the specific language governing permissions and
366
+ * limitations under the License.
367
+ */const yE="firebase-heartbeat-database",wE=1,bo="firebase-heartbeat-store";let ba=null;function ih(){return ba||(ba=NI(yE,wE,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(bo)}catch(n){console.warn(n)}}}}).catch(e=>{throw zr.create("idb-open",{originalErrorMessage:e.message})})),ba}async function bE(e){try{const n=(await ih()).transaction(bo),r=await n.objectStore(bo).get(ah(e));return await n.done,r}catch(t){if(t instanceof Kr)Ar.warn(t.message);else{const n=zr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Ar.warn(n.message)}}}async function Ou(e,t){try{const r=(await ih()).transaction(bo,"readwrite");await r.objectStore(bo).put(t,ah(e)),await r.done}catch(n){if(n instanceof Kr)Ar.warn(n.message);else{const r=zr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Ar.warn(r.message)}}}function ah(e){return`${e.name}!${e.options.appId}`}/**
368
+ * @license
369
+ * Copyright 2021 Google LLC
370
+ *
371
+ * Licensed under the Apache License, Version 2.0 (the "License");
372
+ * you may not use this file except in compliance with the License.
373
+ * You may obtain a copy of the License at
374
+ *
375
+ * http://www.apache.org/licenses/LICENSE-2.0
376
+ *
377
+ * Unless required by applicable law or agreed to in writing, software
378
+ * distributed under the License is distributed on an "AS IS" BASIS,
379
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
380
+ * See the License for the specific language governing permissions and
381
+ * limitations under the License.
382
+ */const _E=1024,kE=30;class TE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new IE(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=Nu();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>kE){const i=EE(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Ar.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=Nu(),{heartbeatsToSend:r,unsentEntries:s}=SE(this._heartbeatsCache.heartbeats),o=Yf(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 Ar.warn(n),""}}}function Nu(){return new Date().toISOString().substring(0,10)}function SE(e,t=_E){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),Du(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Du(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class IE{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return cI()?uI().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await bE(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 Ou(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 Ou(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Du(e){return Yf(JSON.stringify({version:2,heartbeats:e})).length}function EE(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}/**
383
+ * @license
384
+ * Copyright 2019 Google LLC
385
+ *
386
+ * Licensed under the Apache License, Version 2.0 (the "License");
387
+ * you may not use this file except in compliance with the License.
388
+ * You may obtain a copy of the License at
389
+ *
390
+ * http://www.apache.org/licenses/LICENSE-2.0
391
+ *
392
+ * Unless required by applicable law or agreed to in writing, software
393
+ * distributed under the License is distributed on an "AS IS" BASIS,
394
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
395
+ * See the License for the specific language governing permissions and
396
+ * limitations under the License.
397
+ */function CE(e){wo(new Ns("platform-logger",t=>new jI(t),"PRIVATE")),wo(new Ns("heartbeat",t=>new TE(t),"PRIVATE")),Cs(el,Mu,e),Cs(el,Mu,"esm2020"),Cs("fire-js","")}CE("");var AE="firebase",xE="12.11.0";/**
398
+ * @license
399
+ * Copyright 2020 Google LLC
400
+ *
401
+ * Licensed under the Apache License, Version 2.0 (the "License");
402
+ * you may not use this file except in compliance with the License.
403
+ * You may obtain a copy of the License at
404
+ *
405
+ * http://www.apache.org/licenses/LICENSE-2.0
406
+ *
407
+ * Unless required by applicable law or agreed to in writing, software
408
+ * distributed under the License is distributed on an "AS IS" BASIS,
409
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
410
+ * See the License for the specific language governing permissions and
411
+ * limitations under the License.
412
+ */Cs(AE,xE,"app");function lh(){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 RE=lh,ch=new Io("auth","Firebase",lh());/**
413
+ * @license
414
+ * Copyright 2020 Google LLC
415
+ *
416
+ * Licensed under the Apache License, Version 2.0 (the "License");
417
+ * you may not use this file except in compliance with the License.
418
+ * You may obtain a copy of the License at
419
+ *
420
+ * http://www.apache.org/licenses/LICENSE-2.0
421
+ *
422
+ * Unless required by applicable law or agreed to in writing, software
423
+ * distributed under the License is distributed on an "AS IS" BASIS,
424
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
425
+ * See the License for the specific language governing permissions and
426
+ * limitations under the License.
427
+ */const ai=new eh("@firebase/auth");function PE(e,...t){ai.logLevel<=Ct.WARN&&ai.warn(`Auth (${Co}): ${e}`,...t)}function Ko(e,...t){ai.logLevel<=Ct.ERROR&&ai.error(`Auth (${Co}): ${e}`,...t)}/**
428
+ * @license
429
+ * Copyright 2020 Google LLC
430
+ *
431
+ * Licensed under the Apache License, Version 2.0 (the "License");
432
+ * you may not use this file except in compliance with the License.
433
+ * You may obtain a copy of the License at
434
+ *
435
+ * http://www.apache.org/licenses/LICENSE-2.0
436
+ *
437
+ * Unless required by applicable law or agreed to in writing, software
438
+ * distributed under the License is distributed on an "AS IS" BASIS,
439
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
440
+ * See the License for the specific language governing permissions and
441
+ * limitations under the License.
442
+ */function ur(e,...t){throw Bl(e,...t)}function Wn(e,...t){return Bl(e,...t)}function Fl(e,t,n){const r={...RE(),[t]:n};return new Io("auth","Firebase",r).create(t,{appName:e.name})}function ds(e){return Fl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ME(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&ur(e,"argument-error"),Fl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Bl(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 ch.create(e,...t)}function Je(e,t,...n){if(!e)throw Bl(t,...n)}function br(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ko(t),new Error(t)}function xr(e,t){e||br(t)}/**
443
+ * @license
444
+ * Copyright 2020 Google LLC
445
+ *
446
+ * Licensed under the Apache License, Version 2.0 (the "License");
447
+ * you may not use this file except in compliance with the License.
448
+ * You may obtain a copy of the License at
449
+ *
450
+ * http://www.apache.org/licenses/LICENSE-2.0
451
+ *
452
+ * Unless required by applicable law or agreed to in writing, software
453
+ * distributed under the License is distributed on an "AS IS" BASIS,
454
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
455
+ * See the License for the specific language governing permissions and
456
+ * limitations under the License.
457
+ */function rl(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function $E(){return Lu()==="http:"||Lu()==="https:"}function Lu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
458
+ * @license
459
+ * Copyright 2020 Google LLC
460
+ *
461
+ * Licensed under the Apache License, Version 2.0 (the "License");
462
+ * you may not use this file except in compliance with the License.
463
+ * You may obtain a copy of the License at
464
+ *
465
+ * http://www.apache.org/licenses/LICENSE-2.0
466
+ *
467
+ * Unless required by applicable law or agreed to in writing, software
468
+ * distributed under the License is distributed on an "AS IS" BASIS,
469
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
470
+ * See the License for the specific language governing permissions and
471
+ * limitations under the License.
472
+ */function OE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&($E()||iI()||"connection"in navigator)?navigator.onLine:!0}function NE(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
473
+ * @license
474
+ * Copyright 2020 Google LLC
475
+ *
476
+ * Licensed under the Apache License, Version 2.0 (the "License");
477
+ * you may not use this file except in compliance with the License.
478
+ * You may obtain a copy of the License at
479
+ *
480
+ * http://www.apache.org/licenses/LICENSE-2.0
481
+ *
482
+ * Unless required by applicable law or agreed to in writing, software
483
+ * distributed under the License is distributed on an "AS IS" BASIS,
484
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
485
+ * See the License for the specific language governing permissions and
486
+ * limitations under the License.
487
+ */class Ao{constructor(t,n){this.shortDelay=t,this.longDelay=n,xr(n>t,"Short delay should be less than long delay!"),this.isMobile=sI()||aI()}get(){return OE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
488
+ * @license
489
+ * Copyright 2020 Google LLC
490
+ *
491
+ * Licensed under the Apache License, Version 2.0 (the "License");
492
+ * you may not use this file except in compliance with the License.
493
+ * You may obtain a copy of the License at
494
+ *
495
+ * http://www.apache.org/licenses/LICENSE-2.0
496
+ *
497
+ * Unless required by applicable law or agreed to in writing, software
498
+ * distributed under the License is distributed on an "AS IS" BASIS,
499
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
500
+ * See the License for the specific language governing permissions and
501
+ * limitations under the License.
502
+ */function Ul(e,t){xr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
503
+ * @license
504
+ * Copyright 2020 Google LLC
505
+ *
506
+ * Licensed under the Apache License, Version 2.0 (the "License");
507
+ * you may not use this file except in compliance with the License.
508
+ * You may obtain a copy of the License at
509
+ *
510
+ * http://www.apache.org/licenses/LICENSE-2.0
511
+ *
512
+ * Unless required by applicable law or agreed to in writing, software
513
+ * distributed under the License is distributed on an "AS IS" BASIS,
514
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
515
+ * See the License for the specific language governing permissions and
516
+ * limitations under the License.
517
+ */class uh{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;br("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;br("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;br("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
518
+ * @license
519
+ * Copyright 2020 Google LLC
520
+ *
521
+ * Licensed under the Apache License, Version 2.0 (the "License");
522
+ * you may not use this file except in compliance with the License.
523
+ * You may obtain a copy of the License at
524
+ *
525
+ * http://www.apache.org/licenses/LICENSE-2.0
526
+ *
527
+ * Unless required by applicable law or agreed to in writing, software
528
+ * distributed under the License is distributed on an "AS IS" BASIS,
529
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
530
+ * See the License for the specific language governing permissions and
531
+ * limitations under the License.
532
+ */const DE={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"};/**
533
+ * @license
534
+ * Copyright 2020 Google LLC
535
+ *
536
+ * Licensed under the Apache License, Version 2.0 (the "License");
537
+ * you may not use this file except in compliance with the License.
538
+ * You may obtain a copy of the License at
539
+ *
540
+ * http://www.apache.org/licenses/LICENSE-2.0
541
+ *
542
+ * Unless required by applicable law or agreed to in writing, software
543
+ * distributed under the License is distributed on an "AS IS" BASIS,
544
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
545
+ * See the License for the specific language governing permissions and
546
+ * limitations under the License.
547
+ */const LE=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],jE=new Ao(3e4,6e4);function Hl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Fs(e,t,n,r,s={}){return dh(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Eo({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 d={method:t,headers:l,...o};return oI()||(d.referrerPolicy="no-referrer"),e.emulatorConfig&&Ll(e.emulatorConfig.host)&&(d.credentials="include"),uh.fetch()(await fh(e,e.config.apiHost,n,a),d)})}async function dh(e,t,n){e._canInitEmulator=!1;const r={...DE,...t};try{const s=new BE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw Lo(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,d]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Lo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw Lo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw Lo(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Fl(e,c,d);ur(e,c)}}catch(s){if(s instanceof Kr)throw s;ur(e,"network-request-failed",{message:String(s)})}}async function FE(e,t,n,r,s={}){const o=await Fs(e,t,n,r,s);return"mfaPendingCredential"in o&&ur(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function fh(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Ul(e.config,s):`${e.config.apiScheme}://${s}`;return LE.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class BE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Wn(this.auth,"network-request-failed")),jE.get())})}}function Lo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Wn(e,t,r);return s.customData._tokenResponse=n,s}/**
548
+ * @license
549
+ * Copyright 2020 Google LLC
550
+ *
551
+ * Licensed under the Apache License, Version 2.0 (the "License");
552
+ * you may not use this file except in compliance with the License.
553
+ * You may obtain a copy of the License at
554
+ *
555
+ * http://www.apache.org/licenses/LICENSE-2.0
556
+ *
557
+ * Unless required by applicable law or agreed to in writing, software
558
+ * distributed under the License is distributed on an "AS IS" BASIS,
559
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
560
+ * See the License for the specific language governing permissions and
561
+ * limitations under the License.
562
+ */async function UE(e,t){return Fs(e,"POST","/v1/accounts:delete",t)}async function li(e,t){return Fs(e,"POST","/v1/accounts:lookup",t)}/**
563
+ * @license
564
+ * Copyright 2020 Google LLC
565
+ *
566
+ * Licensed under the Apache License, Version 2.0 (the "License");
567
+ * you may not use this file except in compliance with the License.
568
+ * You may obtain a copy of the License at
569
+ *
570
+ * http://www.apache.org/licenses/LICENSE-2.0
571
+ *
572
+ * Unless required by applicable law or agreed to in writing, software
573
+ * distributed under the License is distributed on an "AS IS" BASIS,
574
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
575
+ * See the License for the specific language governing permissions and
576
+ * limitations under the License.
577
+ */function oo(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function HE(e,t=!1){const n=js(e),r=await n.getIdToken(t),s=Wl(r);Je(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:oo(_a(s.auth_time)),issuedAtTime:oo(_a(s.iat)),expirationTime:oo(_a(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function _a(e){return Number(e)*1e3}function Wl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Ko("JWT malformed, contained fewer than 3 sections"),null;try{const s=Qf(n);return s?JSON.parse(s):(Ko("Failed to decode base64 JWT payload"),null)}catch(s){return Ko("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function ju(e){const t=Wl(e);return Je(t,"internal-error"),Je(typeof t.exp<"u","internal-error"),Je(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
578
+ * @license
579
+ * Copyright 2020 Google LLC
580
+ *
581
+ * Licensed under the Apache License, Version 2.0 (the "License");
582
+ * you may not use this file except in compliance with the License.
583
+ * You may obtain a copy of the License at
584
+ *
585
+ * http://www.apache.org/licenses/LICENSE-2.0
586
+ *
587
+ * Unless required by applicable law or agreed to in writing, software
588
+ * distributed under the License is distributed on an "AS IS" BASIS,
589
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
590
+ * See the License for the specific language governing permissions and
591
+ * limitations under the License.
592
+ */async function _o(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Kr&&WE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function WE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
593
+ * @license
594
+ * Copyright 2020 Google LLC
595
+ *
596
+ * Licensed under the Apache License, Version 2.0 (the "License");
597
+ * you may not use this file except in compliance with the License.
598
+ * You may obtain a copy of the License at
599
+ *
600
+ * http://www.apache.org/licenses/LICENSE-2.0
601
+ *
602
+ * Unless required by applicable law or agreed to in writing, software
603
+ * distributed under the License is distributed on an "AS IS" BASIS,
604
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
605
+ * See the License for the specific language governing permissions and
606
+ * limitations under the License.
607
+ */class VE{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()}}/**
608
+ * @license
609
+ * Copyright 2020 Google LLC
610
+ *
611
+ * Licensed under the Apache License, Version 2.0 (the "License");
612
+ * you may not use this file except in compliance with the License.
613
+ * You may obtain a copy of the License at
614
+ *
615
+ * http://www.apache.org/licenses/LICENSE-2.0
616
+ *
617
+ * Unless required by applicable law or agreed to in writing, software
618
+ * distributed under the License is distributed on an "AS IS" BASIS,
619
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
620
+ * See the License for the specific language governing permissions and
621
+ * limitations under the License.
622
+ */class sl{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=oo(this.lastLoginAt),this.creationTime=oo(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
623
+ * @license
624
+ * Copyright 2019 Google LLC
625
+ *
626
+ * Licensed under the Apache License, Version 2.0 (the "License");
627
+ * you may not use this file except in compliance with the License.
628
+ * You may obtain a copy of the License at
629
+ *
630
+ * http://www.apache.org/licenses/LICENSE-2.0
631
+ *
632
+ * Unless required by applicable law or agreed to in writing, software
633
+ * distributed under the License is distributed on an "AS IS" BASIS,
634
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
635
+ * See the License for the specific language governing permissions and
636
+ * limitations under the License.
637
+ */async function ci(e){var p;const t=e.auth,n=await e.getIdToken(),r=await _o(e,li(t,{idToken:n}));Je(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(p=s.providerUserInfo)!=null&&p.length?hh(s.providerUserInfo):[],i=GE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),d=a?l:!1,c={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 sl(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,c)}async function zE(e){const t=js(e);await ci(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function GE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function hh(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}))}/**
638
+ * @license
639
+ * Copyright 2020 Google LLC
640
+ *
641
+ * Licensed under the Apache License, Version 2.0 (the "License");
642
+ * you may not use this file except in compliance with the License.
643
+ * You may obtain a copy of the License at
644
+ *
645
+ * http://www.apache.org/licenses/LICENSE-2.0
646
+ *
647
+ * Unless required by applicable law or agreed to in writing, software
648
+ * distributed under the License is distributed on an "AS IS" BASIS,
649
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
650
+ * See the License for the specific language governing permissions and
651
+ * limitations under the License.
652
+ */async function qE(e,t){const n=await dh(e,{},async()=>{const r=Eo({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await fh(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&&Ll(e.emulatorConfig.host)&&(l.credentials="include"),uh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function KE(e,t){return Fs(e,"POST","/v2/accounts:revokeToken",Hl(e,t))}/**
653
+ * @license
654
+ * Copyright 2020 Google LLC
655
+ *
656
+ * Licensed under the Apache License, Version 2.0 (the "License");
657
+ * you may not use this file except in compliance with the License.
658
+ * You may obtain a copy of the License at
659
+ *
660
+ * http://www.apache.org/licenses/LICENSE-2.0
661
+ *
662
+ * Unless required by applicable law or agreed to in writing, software
663
+ * distributed under the License is distributed on an "AS IS" BASIS,
664
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
665
+ * See the License for the specific language governing permissions and
666
+ * limitations under the License.
667
+ */class As{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Je(t.idToken,"internal-error"),Je(typeof t.idToken<"u","internal-error"),Je(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):ju(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Je(t.length!==0,"internal-error");const n=ju(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Je(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 qE(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 As;return r&&(Je(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(Je(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(Je(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 As,this.toJSON())}_performRefresh(){return br("not implemented")}}/**
668
+ * @license
669
+ * Copyright 2020 Google LLC
670
+ *
671
+ * Licensed under the Apache License, Version 2.0 (the "License");
672
+ * you may not use this file except in compliance with the License.
673
+ * You may obtain a copy of the License at
674
+ *
675
+ * http://www.apache.org/licenses/LICENSE-2.0
676
+ *
677
+ * Unless required by applicable law or agreed to in writing, software
678
+ * distributed under the License is distributed on an "AS IS" BASIS,
679
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
680
+ * See the License for the specific language governing permissions and
681
+ * limitations under the License.
682
+ */function Nr(e,t){Je(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class Bn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new VE(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 sl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await _o(this,this.stsTokenManager.getToken(this.auth,t));return Je(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return HE(this,t)}reload(){return zE(this)}_assign(t){this!==t&&(Je(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 Bn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){Je(!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 ci(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(or(this.auth.app))return Promise.reject(ds(this.auth));const t=await this.getIdToken();return await _o(this,UE(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,d=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:p,emailVerified:_,isAnonymous:I,providerData:j,stsTokenManager:$}=n;Je(p&&$,t,"internal-error");const Z=As.fromJSON(this.name,$);Je(typeof p=="string",t,"internal-error"),Nr(r,t.name),Nr(s,t.name),Je(typeof _=="boolean",t,"internal-error"),Je(typeof I=="boolean",t,"internal-error"),Nr(o,t.name),Nr(i,t.name),Nr(a,t.name),Nr(l,t.name),Nr(d,t.name),Nr(c,t.name);const ae=new Bn({uid:p,auth:t,email:s,emailVerified:_,displayName:r,isAnonymous:I,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:Z,createdAt:d,lastLoginAt:c});return j&&Array.isArray(j)&&(ae.providerData=j.map(V=>({...V}))),l&&(ae._redirectEventId=l),ae}static async _fromIdTokenResponse(t,n,r=!1){const s=new As;s.updateFromServerResponse(n);const o=new Bn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await ci(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];Je(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?hh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new As;a.updateFromIdToken(r);const l=new Bn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),d={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 sl(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,d),l}}/**
683
+ * @license
684
+ * Copyright 2020 Google LLC
685
+ *
686
+ * Licensed under the Apache License, Version 2.0 (the "License");
687
+ * you may not use this file except in compliance with the License.
688
+ * You may obtain a copy of the License at
689
+ *
690
+ * http://www.apache.org/licenses/LICENSE-2.0
691
+ *
692
+ * Unless required by applicable law or agreed to in writing, software
693
+ * distributed under the License is distributed on an "AS IS" BASIS,
694
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
695
+ * See the License for the specific language governing permissions and
696
+ * limitations under the License.
697
+ */const Fu=new Map;function _r(e){xr(e instanceof Function,"Expected a class definition");let t=Fu.get(e);return t?(xr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Fu.set(e,t),t)}/**
698
+ * @license
699
+ * Copyright 2019 Google LLC
700
+ *
701
+ * Licensed under the Apache License, Version 2.0 (the "License");
702
+ * you may not use this file except in compliance with the License.
703
+ * You may obtain a copy of the License at
704
+ *
705
+ * http://www.apache.org/licenses/LICENSE-2.0
706
+ *
707
+ * Unless required by applicable law or agreed to in writing, software
708
+ * distributed under the License is distributed on an "AS IS" BASIS,
709
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
710
+ * See the License for the specific language governing permissions and
711
+ * limitations under the License.
712
+ */class ph{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){}}ph.type="NONE";const Bu=ph;/**
713
+ * @license
714
+ * Copyright 2019 Google LLC
715
+ *
716
+ * Licensed under the Apache License, Version 2.0 (the "License");
717
+ * you may not use this file except in compliance with the License.
718
+ * You may obtain a copy of the License at
719
+ *
720
+ * http://www.apache.org/licenses/LICENSE-2.0
721
+ *
722
+ * Unless required by applicable law or agreed to in writing, software
723
+ * distributed under the License is distributed on an "AS IS" BASIS,
724
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
725
+ * See the License for the specific language governing permissions and
726
+ * limitations under the License.
727
+ */function Jo(e,t,n){return`firebase:${e}:${t}:${n}`}class xs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=Jo(this.userKey,s.apiKey,o),this.fullPersistenceKey=Jo("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 li(this.auth,{idToken:t}).catch(()=>{});return n?Bn._fromGetAccountInfoResponse(this.auth,n,t):null}return Bn._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 xs(_r(Bu),t,r);const s=(await Promise.all(n.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let o=s[0]||_r(Bu);const i=Jo(r,t.config.apiKey,t.name);let a=null;for(const d of n)try{const c=await d._get(i);if(c){let p;if(typeof c=="string"){const _=await li(t,{idToken:c}).catch(()=>{});if(!_)break;p=await Bn._fromGetAccountInfoResponse(t,_,c)}else p=Bn._fromJSON(t,c);d!==o&&(a=p),o=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new xs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async d=>{if(d!==o)try{await d._remove(i)}catch{}})),new xs(o,t,r))}}/**
728
+ * @license
729
+ * Copyright 2020 Google LLC
730
+ *
731
+ * Licensed under the Apache License, Version 2.0 (the "License");
732
+ * you may not use this file except in compliance with the License.
733
+ * You may obtain a copy of the License at
734
+ *
735
+ * http://www.apache.org/licenses/LICENSE-2.0
736
+ *
737
+ * Unless required by applicable law or agreed to in writing, software
738
+ * distributed under the License is distributed on an "AS IS" BASIS,
739
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
740
+ * See the License for the specific language governing permissions and
741
+ * limitations under the License.
742
+ */function Uu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(yh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(mh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(bh(t))return"Blackberry";if(_h(t))return"Webos";if(gh(t))return"Safari";if((t.includes("chrome/")||vh(t))&&!t.includes("edge/"))return"Chrome";if(wh(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 mh(e=gn()){return/firefox\//i.test(e)}function gh(e=gn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function vh(e=gn()){return/crios\//i.test(e)}function yh(e=gn()){return/iemobile/i.test(e)}function wh(e=gn()){return/android/i.test(e)}function bh(e=gn()){return/blackberry/i.test(e)}function _h(e=gn()){return/webos/i.test(e)}function Vl(e=gn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function JE(e=gn()){var t;return Vl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function YE(){return lI()&&document.documentMode===10}function kh(e=gn()){return Vl(e)||wh(e)||_h(e)||bh(e)||/windows phone/i.test(e)||yh(e)}/**
743
+ * @license
744
+ * Copyright 2020 Google LLC
745
+ *
746
+ * Licensed under the Apache License, Version 2.0 (the "License");
747
+ * you may not use this file except in compliance with the License.
748
+ * You may obtain a copy of the License at
749
+ *
750
+ * http://www.apache.org/licenses/LICENSE-2.0
751
+ *
752
+ * Unless required by applicable law or agreed to in writing, software
753
+ * distributed under the License is distributed on an "AS IS" BASIS,
754
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
755
+ * See the License for the specific language governing permissions and
756
+ * limitations under the License.
757
+ */function Th(e,t=[]){let n;switch(e){case"Browser":n=Uu(gn());break;case"Worker":n=`${Uu(gn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Co}/${r}`}/**
758
+ * @license
759
+ * Copyright 2022 Google LLC
760
+ *
761
+ * Licensed under the Apache License, Version 2.0 (the "License");
762
+ * you may not use this file except in compliance with the License.
763
+ * You may obtain a copy of the License at
764
+ *
765
+ * http://www.apache.org/licenses/LICENSE-2.0
766
+ *
767
+ * Unless required by applicable law or agreed to in writing, software
768
+ * distributed under the License is distributed on an "AS IS" BASIS,
769
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
770
+ * See the License for the specific language governing permissions and
771
+ * limitations under the License.
772
+ */class QE{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})}}}/**
773
+ * @license
774
+ * Copyright 2023 Google LLC
775
+ *
776
+ * Licensed under the Apache License, Version 2.0 (the "License");
777
+ * you may not use this file except in compliance with the License.
778
+ * You may obtain a copy of the License at
779
+ *
780
+ * http://www.apache.org/licenses/LICENSE-2.0
781
+ *
782
+ * Unless required by applicable law or agreed to in writing, software
783
+ * distributed under the License is distributed on an "AS IS" BASIS,
784
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
785
+ * See the License for the specific language governing permissions and
786
+ * limitations under the License.
787
+ */async function XE(e,t={}){return Fs(e,"GET","/v2/passwordPolicy",Hl(e,t))}/**
788
+ * @license
789
+ * Copyright 2023 Google LLC
790
+ *
791
+ * Licensed under the Apache License, Version 2.0 (the "License");
792
+ * you may not use this file except in compliance with the License.
793
+ * You may obtain a copy of the License at
794
+ *
795
+ * http://www.apache.org/licenses/LICENSE-2.0
796
+ *
797
+ * Unless required by applicable law or agreed to in writing, software
798
+ * distributed under the License is distributed on an "AS IS" BASIS,
799
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
800
+ * See the License for the specific language governing permissions and
801
+ * limitations under the License.
802
+ */const ZE=6;class e1{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??ZE,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))}}/**
803
+ * @license
804
+ * Copyright 2020 Google LLC
805
+ *
806
+ * Licensed under the Apache License, Version 2.0 (the "License");
807
+ * you may not use this file except in compliance with the License.
808
+ * You may obtain a copy of the License at
809
+ *
810
+ * http://www.apache.org/licenses/LICENSE-2.0
811
+ *
812
+ * Unless required by applicable law or agreed to in writing, software
813
+ * distributed under the License is distributed on an "AS IS" BASIS,
814
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
815
+ * See the License for the specific language governing permissions and
816
+ * limitations under the License.
817
+ */class t1{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 Hu(this),this.idTokenSubscription=new Hu(this),this.beforeStateQueue=new QE(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=ch,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=_r(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await xs.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 li(this,{idToken:t}),r=await Bn._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(or(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 Je(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 ci(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=NE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(or(this.app))return Promise.reject(ds(this));const n=t?js(t):null;return n&&Je(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&&Je(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 or(this.app)?Promise.reject(ds(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return or(this.app)?Promise.reject(ds(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(_r(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 XE(this),n=new e1(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 Io("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 KE(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&&_r(t)||this._popupRedirectResolver;Je(n,this,"argument-error"),this.redirectPersistenceManager=await xs.create(this,[_r(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(Je(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 Je(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Th(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(or(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&&PE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function xi(e){return js(e)}class Hu{constructor(t){this.auth=t,this.observer=null,this.addObserver=mI(n=>this.observer=n)}get next(){return Je(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
818
+ * @license
819
+ * Copyright 2020 Google LLC
820
+ *
821
+ * Licensed under the Apache License, Version 2.0 (the "License");
822
+ * you may not use this file except in compliance with the License.
823
+ * You may obtain a copy of the License at
824
+ *
825
+ * http://www.apache.org/licenses/LICENSE-2.0
826
+ *
827
+ * Unless required by applicable law or agreed to in writing, software
828
+ * distributed under the License is distributed on an "AS IS" BASIS,
829
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830
+ * See the License for the specific language governing permissions and
831
+ * limitations under the License.
832
+ */let zl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function n1(e){zl=e}function r1(e){return zl.loadJS(e)}function s1(){return zl.gapiScript}function o1(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
833
+ * @license
834
+ * Copyright 2020 Google LLC
835
+ *
836
+ * Licensed under the Apache License, Version 2.0 (the "License");
837
+ * you may not use this file except in compliance with the License.
838
+ * You may obtain a copy of the License at
839
+ *
840
+ * http://www.apache.org/licenses/LICENSE-2.0
841
+ *
842
+ * Unless required by applicable law or agreed to in writing, software
843
+ * distributed under the License is distributed on an "AS IS" BASIS,
844
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
845
+ * See the License for the specific language governing permissions and
846
+ * limitations under the License.
847
+ */function i1(e,t){const n=rh(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(Os(o,t??{}))return s;ur(s,"already-initialized")}return n.initialize({options:t})}function a1(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(_r);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function l1(e,t,n){const r=xi(e);Je(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Sh(t),{host:i,port:a}=c1(t),l=a===null?"":`:${a}`,d={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Je(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Je(Os(d,r.config.emulator)&&Os(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,Ll(i)?yI(`${o}//${i}${l}`):u1()}function Sh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function c1(e){const t=Sh(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:Wu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Wu(i)}}}function Wu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function u1(){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())}/**
848
+ * @license
849
+ * Copyright 2020 Google LLC
850
+ *
851
+ * Licensed under the Apache License, Version 2.0 (the "License");
852
+ * you may not use this file except in compliance with the License.
853
+ * You may obtain a copy of the License at
854
+ *
855
+ * http://www.apache.org/licenses/LICENSE-2.0
856
+ *
857
+ * Unless required by applicable law or agreed to in writing, software
858
+ * distributed under the License is distributed on an "AS IS" BASIS,
859
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
860
+ * See the License for the specific language governing permissions and
861
+ * limitations under the License.
862
+ */class Ih{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return br("not implemented")}_getIdTokenResponse(t){return br("not implemented")}_linkToIdToken(t,n){return br("not implemented")}_getReauthenticationResolver(t){return br("not implemented")}}/**
863
+ * @license
864
+ * Copyright 2020 Google LLC
865
+ *
866
+ * Licensed under the Apache License, Version 2.0 (the "License");
867
+ * you may not use this file except in compliance with the License.
868
+ * You may obtain a copy of the License at
869
+ *
870
+ * http://www.apache.org/licenses/LICENSE-2.0
871
+ *
872
+ * Unless required by applicable law or agreed to in writing, software
873
+ * distributed under the License is distributed on an "AS IS" BASIS,
874
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
875
+ * See the License for the specific language governing permissions and
876
+ * limitations under the License.
877
+ */async function Rs(e,t){return FE(e,"POST","/v1/accounts:signInWithIdp",Hl(e,t))}/**
878
+ * @license
879
+ * Copyright 2020 Google LLC
880
+ *
881
+ * Licensed under the Apache License, Version 2.0 (the "License");
882
+ * you may not use this file except in compliance with the License.
883
+ * You may obtain a copy of the License at
884
+ *
885
+ * http://www.apache.org/licenses/LICENSE-2.0
886
+ *
887
+ * Unless required by applicable law or agreed to in writing, software
888
+ * distributed under the License is distributed on an "AS IS" BASIS,
889
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
890
+ * See the License for the specific language governing permissions and
891
+ * limitations under the License.
892
+ */const d1="http://localhost";class fs extends Ih{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new fs(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):ur("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 fs(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 Rs(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,Rs(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,Rs(t,n)}buildRequest(){const t={requestUri:d1,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=Eo(n)}return t}}/**
893
+ * @license
894
+ * Copyright 2020 Google LLC
895
+ *
896
+ * Licensed under the Apache License, Version 2.0 (the "License");
897
+ * you may not use this file except in compliance with the License.
898
+ * You may obtain a copy of the License at
899
+ *
900
+ * http://www.apache.org/licenses/LICENSE-2.0
901
+ *
902
+ * Unless required by applicable law or agreed to in writing, software
903
+ * distributed under the License is distributed on an "AS IS" BASIS,
904
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
905
+ * See the License for the specific language governing permissions and
906
+ * limitations under the License.
907
+ */class Gl{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}}/**
908
+ * @license
909
+ * Copyright 2019 Google LLC
910
+ *
911
+ * Licensed under the Apache License, Version 2.0 (the "License");
912
+ * you may not use this file except in compliance with the License.
913
+ * You may obtain a copy of the License at
914
+ *
915
+ * http://www.apache.org/licenses/LICENSE-2.0
916
+ *
917
+ * Unless required by applicable law or agreed to in writing, software
918
+ * distributed under the License is distributed on an "AS IS" BASIS,
919
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
920
+ * See the License for the specific language governing permissions and
921
+ * limitations under the License.
922
+ */class xo extends Gl{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
923
+ * @license
924
+ * Copyright 2020 Google LLC
925
+ *
926
+ * Licensed under the Apache License, Version 2.0 (the "License");
927
+ * you may not use this file except in compliance with the License.
928
+ * You may obtain a copy of the License at
929
+ *
930
+ * http://www.apache.org/licenses/LICENSE-2.0
931
+ *
932
+ * Unless required by applicable law or agreed to in writing, software
933
+ * distributed under the License is distributed on an "AS IS" BASIS,
934
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
935
+ * See the License for the specific language governing permissions and
936
+ * limitations under the License.
937
+ */class Br extends xo{constructor(){super("facebook.com")}static credential(t){return fs._fromParams({providerId:Br.PROVIDER_ID,signInMethod:Br.FACEBOOK_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.FACEBOOK_SIGN_IN_METHOD="facebook.com";Br.PROVIDER_ID="facebook.com";/**
938
+ * @license
939
+ * Copyright 2020 Google LLC
940
+ *
941
+ * Licensed under the Apache License, Version 2.0 (the "License");
942
+ * you may not use this file except in compliance with the License.
943
+ * You may obtain a copy of the License at
944
+ *
945
+ * http://www.apache.org/licenses/LICENSE-2.0
946
+ *
947
+ * Unless required by applicable law or agreed to in writing, software
948
+ * distributed under the License is distributed on an "AS IS" BASIS,
949
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
950
+ * See the License for the specific language governing permissions and
951
+ * limitations under the License.
952
+ */class Ur extends xo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return fs._fromParams({providerId:Ur.PROVIDER_ID,signInMethod:Ur.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return Ur.credentialFromTaggedObject(t)}static credentialFromError(t){return Ur.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return Ur.credential(n,r)}catch{return null}}}Ur.GOOGLE_SIGN_IN_METHOD="google.com";Ur.PROVIDER_ID="google.com";/**
953
+ * @license
954
+ * Copyright 2020 Google LLC
955
+ *
956
+ * Licensed under the Apache License, Version 2.0 (the "License");
957
+ * you may not use this file except in compliance with the License.
958
+ * You may obtain a copy of the License at
959
+ *
960
+ * http://www.apache.org/licenses/LICENSE-2.0
961
+ *
962
+ * Unless required by applicable law or agreed to in writing, software
963
+ * distributed under the License is distributed on an "AS IS" BASIS,
964
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
965
+ * See the License for the specific language governing permissions and
966
+ * limitations under the License.
967
+ */class ir extends xo{constructor(){super("github.com")}static credential(t){return fs._fromParams({providerId:ir.PROVIDER_ID,signInMethod:ir.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return ir.credentialFromTaggedObject(t)}static credentialFromError(t){return ir.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return ir.credential(t.oauthAccessToken)}catch{return null}}}ir.GITHUB_SIGN_IN_METHOD="github.com";ir.PROVIDER_ID="github.com";/**
968
+ * @license
969
+ * Copyright 2020 Google LLC
970
+ *
971
+ * Licensed under the Apache License, Version 2.0 (the "License");
972
+ * you may not use this file except in compliance with the License.
973
+ * You may obtain a copy of the License at
974
+ *
975
+ * http://www.apache.org/licenses/LICENSE-2.0
976
+ *
977
+ * Unless required by applicable law or agreed to in writing, software
978
+ * distributed under the License is distributed on an "AS IS" BASIS,
979
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
980
+ * See the License for the specific language governing permissions and
981
+ * limitations under the License.
982
+ */class Hr extends xo{constructor(){super("twitter.com")}static credential(t,n){return fs._fromParams({providerId:Hr.PROVIDER_ID,signInMethod:Hr.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return Hr.credentialFromTaggedObject(t)}static credentialFromError(t){return Hr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return Hr.credential(n,r)}catch{return null}}}Hr.TWITTER_SIGN_IN_METHOD="twitter.com";Hr.PROVIDER_ID="twitter.com";/**
983
+ * @license
984
+ * Copyright 2020 Google LLC
985
+ *
986
+ * Licensed under the Apache License, Version 2.0 (the "License");
987
+ * you may not use this file except in compliance with the License.
988
+ * You may obtain a copy of the License at
989
+ *
990
+ * http://www.apache.org/licenses/LICENSE-2.0
991
+ *
992
+ * Unless required by applicable law or agreed to in writing, software
993
+ * distributed under the License is distributed on an "AS IS" BASIS,
994
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
995
+ * See the License for the specific language governing permissions and
996
+ * limitations under the License.
997
+ */class Ds{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 Bn._fromIdTokenResponse(t,r,s),i=Vu(r);return new Ds({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Vu(r);return new Ds({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Vu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
998
+ * @license
999
+ * Copyright 2020 Google LLC
1000
+ *
1001
+ * Licensed under the Apache License, Version 2.0 (the "License");
1002
+ * you may not use this file except in compliance with the License.
1003
+ * You may obtain a copy of the License at
1004
+ *
1005
+ * http://www.apache.org/licenses/LICENSE-2.0
1006
+ *
1007
+ * Unless required by applicable law or agreed to in writing, software
1008
+ * distributed under the License is distributed on an "AS IS" BASIS,
1009
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
+ * See the License for the specific language governing permissions and
1011
+ * limitations under the License.
1012
+ */class ui extends Kr{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,ui.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 ui(t,n,r,s)}}function Eh(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?ui._fromErrorAndOperation(e,o,t,r):o})}async function f1(e,t,n=!1){const r=await _o(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Ds._forOperation(e,"link",r)}/**
1013
+ * @license
1014
+ * Copyright 2019 Google LLC
1015
+ *
1016
+ * Licensed under the Apache License, Version 2.0 (the "License");
1017
+ * you may not use this file except in compliance with the License.
1018
+ * You may obtain a copy of the License at
1019
+ *
1020
+ * http://www.apache.org/licenses/LICENSE-2.0
1021
+ *
1022
+ * Unless required by applicable law or agreed to in writing, software
1023
+ * distributed under the License is distributed on an "AS IS" BASIS,
1024
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1025
+ * See the License for the specific language governing permissions and
1026
+ * limitations under the License.
1027
+ */async function h1(e,t,n=!1){const{auth:r}=e;if(or(r.app))return Promise.reject(ds(r));const s="reauthenticate";try{const o=await _o(e,Eh(r,s,t,e),n);Je(o.idToken,r,"internal-error");const i=Wl(o.idToken);Je(i,r,"internal-error");const{sub:a}=i;return Je(e.uid===a,r,"user-mismatch"),Ds._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&ur(r,"user-mismatch"),o}}/**
1028
+ * @license
1029
+ * Copyright 2020 Google LLC
1030
+ *
1031
+ * Licensed under the Apache License, Version 2.0 (the "License");
1032
+ * you may not use this file except in compliance with the License.
1033
+ * You may obtain a copy of the License at
1034
+ *
1035
+ * http://www.apache.org/licenses/LICENSE-2.0
1036
+ *
1037
+ * Unless required by applicable law or agreed to in writing, software
1038
+ * distributed under the License is distributed on an "AS IS" BASIS,
1039
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1040
+ * See the License for the specific language governing permissions and
1041
+ * limitations under the License.
1042
+ */async function p1(e,t,n=!1){if(or(e.app))return Promise.reject(ds(e));const r="signIn",s=await Eh(e,r,t),o=await Ds._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function m1(e,t,n,r){return js(e).onIdTokenChanged(t,n,r)}function g1(e,t,n){return js(e).beforeAuthStateChanged(t,n)}const di="__sak";/**
1043
+ * @license
1044
+ * Copyright 2019 Google LLC
1045
+ *
1046
+ * Licensed under the Apache License, Version 2.0 (the "License");
1047
+ * you may not use this file except in compliance with the License.
1048
+ * You may obtain a copy of the License at
1049
+ *
1050
+ * http://www.apache.org/licenses/LICENSE-2.0
1051
+ *
1052
+ * Unless required by applicable law or agreed to in writing, software
1053
+ * distributed under the License is distributed on an "AS IS" BASIS,
1054
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1055
+ * See the License for the specific language governing permissions and
1056
+ * limitations under the License.
1057
+ */class Ch{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(di,"1"),this.storage.removeItem(di),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()}}/**
1058
+ * @license
1059
+ * Copyright 2020 Google LLC
1060
+ *
1061
+ * Licensed under the Apache License, Version 2.0 (the "License");
1062
+ * you may not use this file except in compliance with the License.
1063
+ * You may obtain a copy of the License at
1064
+ *
1065
+ * http://www.apache.org/licenses/LICENSE-2.0
1066
+ *
1067
+ * Unless required by applicable law or agreed to in writing, software
1068
+ * distributed under the License is distributed on an "AS IS" BASIS,
1069
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1070
+ * See the License for the specific language governing permissions and
1071
+ * limitations under the License.
1072
+ */const v1=1e3,y1=10;class Ah extends Ch{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=kh(),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);YE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,y1):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)})},v1)}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]}}Ah.type="LOCAL";const w1=Ah;/**
1073
+ * @license
1074
+ * Copyright 2020 Google LLC
1075
+ *
1076
+ * Licensed under the Apache License, Version 2.0 (the "License");
1077
+ * you may not use this file except in compliance with the License.
1078
+ * You may obtain a copy of the License at
1079
+ *
1080
+ * http://www.apache.org/licenses/LICENSE-2.0
1081
+ *
1082
+ * Unless required by applicable law or agreed to in writing, software
1083
+ * distributed under the License is distributed on an "AS IS" BASIS,
1084
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1085
+ * See the License for the specific language governing permissions and
1086
+ * limitations under the License.
1087
+ */class xh extends Ch{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}xh.type="SESSION";const Rh=xh;/**
1088
+ * @license
1089
+ * Copyright 2019 Google LLC
1090
+ *
1091
+ * Licensed under the Apache License, Version 2.0 (the "License");
1092
+ * you may not use this file except in compliance with the License.
1093
+ * You may obtain a copy of the License at
1094
+ *
1095
+ * http://www.apache.org/licenses/LICENSE-2.0
1096
+ *
1097
+ * Unless required by applicable law or agreed to in writing, software
1098
+ * distributed under the License is distributed on an "AS IS" BASIS,
1099
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1100
+ * See the License for the specific language governing permissions and
1101
+ * limitations under the License.
1102
+ */function b1(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1103
+ * @license
1104
+ * Copyright 2019 Google LLC
1105
+ *
1106
+ * Licensed under the Apache License, Version 2.0 (the "License");
1107
+ * you may not use this file except in compliance with the License.
1108
+ * You may obtain a copy of the License at
1109
+ *
1110
+ * http://www.apache.org/licenses/LICENSE-2.0
1111
+ *
1112
+ * Unless required by applicable law or agreed to in writing, software
1113
+ * distributed under the License is distributed on an "AS IS" BASIS,
1114
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1115
+ * See the License for the specific language governing permissions and
1116
+ * limitations under the License.
1117
+ */class Ri{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 Ri(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 d=>d(n.origin,o)),l=await b1(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)}}Ri.receivers=[];/**
1118
+ * @license
1119
+ * Copyright 2020 Google LLC
1120
+ *
1121
+ * Licensed under the Apache License, Version 2.0 (the "License");
1122
+ * you may not use this file except in compliance with the License.
1123
+ * You may obtain a copy of the License at
1124
+ *
1125
+ * http://www.apache.org/licenses/LICENSE-2.0
1126
+ *
1127
+ * Unless required by applicable law or agreed to in writing, software
1128
+ * distributed under the License is distributed on an "AS IS" BASIS,
1129
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1130
+ * See the License for the specific language governing permissions and
1131
+ * limitations under the License.
1132
+ */function ql(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1133
+ * @license
1134
+ * Copyright 2019 Google LLC
1135
+ *
1136
+ * Licensed under the Apache License, Version 2.0 (the "License");
1137
+ * you may not use this file except in compliance with the License.
1138
+ * You may obtain a copy of the License at
1139
+ *
1140
+ * http://www.apache.org/licenses/LICENSE-2.0
1141
+ *
1142
+ * Unless required by applicable law or agreed to in writing, software
1143
+ * distributed under the License is distributed on an "AS IS" BASIS,
1144
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1145
+ * See the License for the specific language governing permissions and
1146
+ * limitations under the License.
1147
+ */class _1{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 d=ql("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(p){const _=p;if(_.data.eventId===d)switch(_.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(_.data.response);break;default:clearTimeout(c),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:d,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1148
+ * @license
1149
+ * Copyright 2020 Google LLC
1150
+ *
1151
+ * Licensed under the Apache License, Version 2.0 (the "License");
1152
+ * you may not use this file except in compliance with the License.
1153
+ * You may obtain a copy of the License at
1154
+ *
1155
+ * http://www.apache.org/licenses/LICENSE-2.0
1156
+ *
1157
+ * Unless required by applicable law or agreed to in writing, software
1158
+ * distributed under the License is distributed on an "AS IS" BASIS,
1159
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1160
+ * See the License for the specific language governing permissions and
1161
+ * limitations under the License.
1162
+ */function cr(){return window}function k1(e){cr().location.href=e}/**
1163
+ * @license
1164
+ * Copyright 2020 Google LLC.
1165
+ *
1166
+ * Licensed under the Apache License, Version 2.0 (the "License");
1167
+ * you may not use this file except in compliance with the License.
1168
+ * You may obtain a copy of the License at
1169
+ *
1170
+ * http://www.apache.org/licenses/LICENSE-2.0
1171
+ *
1172
+ * Unless required by applicable law or agreed to in writing, software
1173
+ * distributed under the License is distributed on an "AS IS" BASIS,
1174
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1175
+ * See the License for the specific language governing permissions and
1176
+ * limitations under the License.
1177
+ */function Ph(){return typeof cr().WorkerGlobalScope<"u"&&typeof cr().importScripts=="function"}async function T1(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function S1(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function I1(){return Ph()?self:null}/**
1178
+ * @license
1179
+ * Copyright 2019 Google LLC
1180
+ *
1181
+ * Licensed under the Apache License, Version 2.0 (the "License");
1182
+ * you may not use this file except in compliance with the License.
1183
+ * You may obtain a copy of the License at
1184
+ *
1185
+ * http://www.apache.org/licenses/LICENSE-2.0
1186
+ *
1187
+ * Unless required by applicable law or agreed to in writing, software
1188
+ * distributed under the License is distributed on an "AS IS" BASIS,
1189
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1190
+ * See the License for the specific language governing permissions and
1191
+ * limitations under the License.
1192
+ */const Mh="firebaseLocalStorageDb",E1=1,fi="firebaseLocalStorage",$h="fbase_key";class Ro{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 Pi(e,t){return e.transaction([fi],t?"readwrite":"readonly").objectStore(fi)}function C1(){const e=indexedDB.deleteDatabase(Mh);return new Ro(e).toPromise()}function ol(){const e=indexedDB.open(Mh,E1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(fi,{keyPath:$h})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(fi)?t(r):(r.close(),await C1(),t(await ol()))})})}async function zu(e,t,n){const r=Pi(e,!0).put({[$h]:t,value:n});return new Ro(r).toPromise()}async function A1(e,t){const n=Pi(e,!1).get(t),r=await new Ro(n).toPromise();return r===void 0?null:r.value}function Gu(e,t){const n=Pi(e,!0).delete(t);return new Ro(n).toPromise()}const x1=800,R1=3;class Oh{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 ol(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>R1)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Ph()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ri._getInstance(I1()),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 T1(),!this.activeServiceWorker)return;this.sender=new _1(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||S1()!==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 ol();return await zu(t,di,"1"),await Gu(t,di),!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=>zu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>A1(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Gu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Pi(s,!1).getAll();return new Ro(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(),x1)}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()}}Oh.type="LOCAL";const P1=Oh;new Ao(3e4,6e4);/**
1193
+ * @license
1194
+ * Copyright 2021 Google LLC
1195
+ *
1196
+ * Licensed under the Apache License, Version 2.0 (the "License");
1197
+ * you may not use this file except in compliance with the License.
1198
+ * You may obtain a copy of the License at
1199
+ *
1200
+ * http://www.apache.org/licenses/LICENSE-2.0
1201
+ *
1202
+ * Unless required by applicable law or agreed to in writing, software
1203
+ * distributed under the License is distributed on an "AS IS" BASIS,
1204
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1205
+ * See the License for the specific language governing permissions and
1206
+ * limitations under the License.
1207
+ */function Nh(e,t){return t?_r(t):(Je(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1208
+ * @license
1209
+ * Copyright 2019 Google LLC
1210
+ *
1211
+ * Licensed under the Apache License, Version 2.0 (the "License");
1212
+ * you may not use this file except in compliance with the License.
1213
+ * You may obtain a copy of the License at
1214
+ *
1215
+ * http://www.apache.org/licenses/LICENSE-2.0
1216
+ *
1217
+ * Unless required by applicable law or agreed to in writing, software
1218
+ * distributed under the License is distributed on an "AS IS" BASIS,
1219
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1220
+ * See the License for the specific language governing permissions and
1221
+ * limitations under the License.
1222
+ */class Kl extends Ih{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Rs(t,this._buildIdpRequest())}_linkToIdToken(t,n){return Rs(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return Rs(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 M1(e){return p1(e.auth,new Kl(e),e.bypassAuthState)}function $1(e){const{auth:t,user:n}=e;return Je(n,t,"internal-error"),h1(n,new Kl(e),e.bypassAuthState)}async function O1(e){const{auth:t,user:n}=e;return Je(n,t,"internal-error"),f1(n,new Kl(e),e.bypassAuthState)}/**
1223
+ * @license
1224
+ * Copyright 2020 Google LLC
1225
+ *
1226
+ * Licensed under the Apache License, Version 2.0 (the "License");
1227
+ * you may not use this file except in compliance with the License.
1228
+ * You may obtain a copy of the License at
1229
+ *
1230
+ * http://www.apache.org/licenses/LICENSE-2.0
1231
+ *
1232
+ * Unless required by applicable law or agreed to in writing, software
1233
+ * distributed under the License is distributed on an "AS IS" BASIS,
1234
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1235
+ * See the License for the specific language governing permissions and
1236
+ * limitations under the License.
1237
+ */class Dh{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(d){this.reject(d)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return M1;case"linkViaPopup":case"linkViaRedirect":return O1;case"reauthViaPopup":case"reauthViaRedirect":return $1;default:ur(this.auth,"internal-error")}}resolve(t){xr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){xr(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()}}/**
1238
+ * @license
1239
+ * Copyright 2020 Google LLC
1240
+ *
1241
+ * Licensed under the Apache License, Version 2.0 (the "License");
1242
+ * you may not use this file except in compliance with the License.
1243
+ * You may obtain a copy of the License at
1244
+ *
1245
+ * http://www.apache.org/licenses/LICENSE-2.0
1246
+ *
1247
+ * Unless required by applicable law or agreed to in writing, software
1248
+ * distributed under the License is distributed on an "AS IS" BASIS,
1249
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1250
+ * See the License for the specific language governing permissions and
1251
+ * limitations under the License.
1252
+ */const N1=new Ao(2e3,1e4);async function D1(e,t,n){if(or(e.app))return Promise.reject(Wn(e,"operation-not-supported-in-this-environment"));const r=xi(e);ME(e,t,Gl);const s=Nh(r,n);return new ls(r,"signInViaPopup",t,s).executeNotNull()}class ls extends Dh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,ls.currentPopupAction&&ls.currentPopupAction.cancel(),ls.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Je(t,this.auth,"internal-error"),t}async onExecution(){xr(this.filter.length===1,"Popup operations only handle one event");const t=ql();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(Wn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Wn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ls.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(Wn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,N1.get())};t()}}ls.currentPopupAction=null;/**
1253
+ * @license
1254
+ * Copyright 2020 Google LLC
1255
+ *
1256
+ * Licensed under the Apache License, Version 2.0 (the "License");
1257
+ * you may not use this file except in compliance with the License.
1258
+ * You may obtain a copy of the License at
1259
+ *
1260
+ * http://www.apache.org/licenses/LICENSE-2.0
1261
+ *
1262
+ * Unless required by applicable law or agreed to in writing, software
1263
+ * distributed under the License is distributed on an "AS IS" BASIS,
1264
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1265
+ * See the License for the specific language governing permissions and
1266
+ * limitations under the License.
1267
+ */const L1="pendingRedirect",Yo=new Map;class j1 extends Dh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=Yo.get(this.auth._key());if(!t){try{const r=await F1(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}Yo.set(this.auth._key(),t)}return this.bypassAuthState||Yo.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 F1(e,t){const n=H1(t),r=U1(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function B1(e,t){Yo.set(e._key(),t)}function U1(e){return _r(e._redirectPersistence)}function H1(e){return Jo(L1,e.config.apiKey,e.name)}async function W1(e,t,n=!1){if(or(e.app))return Promise.reject(ds(e));const r=xi(e),s=Nh(r,t),i=await new j1(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
1268
+ * @license
1269
+ * Copyright 2020 Google LLC
1270
+ *
1271
+ * Licensed under the Apache License, Version 2.0 (the "License");
1272
+ * you may not use this file except in compliance with the License.
1273
+ * You may obtain a copy of the License at
1274
+ *
1275
+ * http://www.apache.org/licenses/LICENSE-2.0
1276
+ *
1277
+ * Unless required by applicable law or agreed to in writing, software
1278
+ * distributed under the License is distributed on an "AS IS" BASIS,
1279
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1280
+ * See the License for the specific language governing permissions and
1281
+ * limitations under the License.
1282
+ */const V1=600*1e3;class z1{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||!G1(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Lh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Wn(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>=V1&&this.cachedEventUids.clear(),this.cachedEventUids.has(qu(t))}saveEventToCache(t){this.cachedEventUids.add(qu(t)),this.lastProcessedEventTime=Date.now()}}function qu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Lh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function G1(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Lh(e);default:return!1}}/**
1283
+ * @license
1284
+ * Copyright 2020 Google LLC
1285
+ *
1286
+ * Licensed under the Apache License, Version 2.0 (the "License");
1287
+ * you may not use this file except in compliance with the License.
1288
+ * You may obtain a copy of the License at
1289
+ *
1290
+ * http://www.apache.org/licenses/LICENSE-2.0
1291
+ *
1292
+ * Unless required by applicable law or agreed to in writing, software
1293
+ * distributed under the License is distributed on an "AS IS" BASIS,
1294
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1295
+ * See the License for the specific language governing permissions and
1296
+ * limitations under the License.
1297
+ */async function q1(e,t={}){return Fs(e,"GET","/v1/projects",t)}/**
1298
+ * @license
1299
+ * Copyright 2020 Google LLC
1300
+ *
1301
+ * Licensed under the Apache License, Version 2.0 (the "License");
1302
+ * you may not use this file except in compliance with the License.
1303
+ * You may obtain a copy of the License at
1304
+ *
1305
+ * http://www.apache.org/licenses/LICENSE-2.0
1306
+ *
1307
+ * Unless required by applicable law or agreed to in writing, software
1308
+ * distributed under the License is distributed on an "AS IS" BASIS,
1309
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1310
+ * See the License for the specific language governing permissions and
1311
+ * limitations under the License.
1312
+ */const K1=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,J1=/^https?/;async function Y1(e){if(e.config.emulator)return;const{authorizedDomains:t}=await q1(e);for(const n of t)try{if(Q1(n))return}catch{}ur(e,"unauthorized-domain")}function Q1(e){const t=rl(),{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(!J1.test(n))return!1;if(K1.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1313
+ * @license
1314
+ * Copyright 2020 Google LLC.
1315
+ *
1316
+ * Licensed under the Apache License, Version 2.0 (the "License");
1317
+ * you may not use this file except in compliance with the License.
1318
+ * You may obtain a copy of the License at
1319
+ *
1320
+ * http://www.apache.org/licenses/LICENSE-2.0
1321
+ *
1322
+ * Unless required by applicable law or agreed to in writing, software
1323
+ * distributed under the License is distributed on an "AS IS" BASIS,
1324
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1325
+ * See the License for the specific language governing permissions and
1326
+ * limitations under the License.
1327
+ */const X1=new Ao(3e4,6e4);function Ku(){const e=cr().___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 Z1(e){return new Promise((t,n)=>{var s,o,i;function r(){Ku(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Ku(),n(Wn(e,"network-request-failed"))},timeout:X1.get()})}if((o=(s=cr().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=cr().gapi)!=null&&i.load)r();else{const a=o1("iframefcb");return cr()[a]=()=>{gapi.load?r():n(Wn(e,"network-request-failed"))},r1(`${s1()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw Qo=null,t})}let Qo=null;function eC(e){return Qo=Qo||Z1(e),Qo}/**
1328
+ * @license
1329
+ * Copyright 2020 Google LLC.
1330
+ *
1331
+ * Licensed under the Apache License, Version 2.0 (the "License");
1332
+ * you may not use this file except in compliance with the License.
1333
+ * You may obtain a copy of the License at
1334
+ *
1335
+ * http://www.apache.org/licenses/LICENSE-2.0
1336
+ *
1337
+ * Unless required by applicable law or agreed to in writing, software
1338
+ * distributed under the License is distributed on an "AS IS" BASIS,
1339
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1340
+ * See the License for the specific language governing permissions and
1341
+ * limitations under the License.
1342
+ */const tC=new Ao(5e3,15e3),nC="__/auth/iframe",rC="emulator/auth/iframe",sC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},oC=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function iC(e){const t=e.config;Je(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Ul(t,rC):`https://${e.config.authDomain}/${nC}`,r={apiKey:t.apiKey,appName:e.name,v:Co},s=oC.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Eo(r).slice(1)}`}async function aC(e){const t=await eC(e),n=cr().gapi;return Je(n,e,"internal-error"),t.open({where:document.body,url:iC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:sC,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=Wn(e,"network-request-failed"),a=cr().setTimeout(()=>{o(i)},tC.get());function l(){cr().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1343
+ * @license
1344
+ * Copyright 2020 Google LLC.
1345
+ *
1346
+ * Licensed under the Apache License, Version 2.0 (the "License");
1347
+ * you may not use this file except in compliance with the License.
1348
+ * You may obtain a copy of the License at
1349
+ *
1350
+ * http://www.apache.org/licenses/LICENSE-2.0
1351
+ *
1352
+ * Unless required by applicable law or agreed to in writing, software
1353
+ * distributed under the License is distributed on an "AS IS" BASIS,
1354
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1355
+ * See the License for the specific language governing permissions and
1356
+ * limitations under the License.
1357
+ */const lC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},cC=500,uC=600,dC="_blank",fC="http://localhost";class Ju{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function hC(e,t,n,r=cC,s=uC){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={...lC,width:r.toString(),height:s.toString(),top:o,left:i},d=gn().toLowerCase();n&&(a=vh(d)?dC:n),mh(d)&&(t=t||fC,l.scrollbars="yes");const c=Object.entries(l).reduce((_,[I,j])=>`${_}${I}=${j},`,"");if(JE(d)&&a!=="_self")return pC(t||"",a),new Ju(null);const p=window.open(t||"",a,c);Je(p,e,"popup-blocked");try{p.focus()}catch{}return new Ju(p)}function pC(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)}/**
1358
+ * @license
1359
+ * Copyright 2021 Google LLC
1360
+ *
1361
+ * Licensed under the Apache License, Version 2.0 (the "License");
1362
+ * you may not use this file except in compliance with the License.
1363
+ * You may obtain a copy of the License at
1364
+ *
1365
+ * http://www.apache.org/licenses/LICENSE-2.0
1366
+ *
1367
+ * Unless required by applicable law or agreed to in writing, software
1368
+ * distributed under the License is distributed on an "AS IS" BASIS,
1369
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1370
+ * See the License for the specific language governing permissions and
1371
+ * limitations under the License.
1372
+ */const mC="__/auth/handler",gC="emulator/auth/handler",vC=encodeURIComponent("fac");async function Yu(e,t,n,r,s,o){Je(e.config.authDomain,e,"auth-domain-config-required"),Je(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Co,eventId:s};if(t instanceof Gl){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",pI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,p]of Object.entries({}))i[c]=p}if(t instanceof xo){const c=t.getScopes().filter(p=>p!=="");c.length>0&&(i.scopes=c.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await e._getAppCheckToken(),d=l?`#${vC}=${encodeURIComponent(l)}`:"";return`${yC(e)}?${Eo(a).slice(1)}${d}`}function yC({config:e}){return e.emulator?Ul(e,gC):`https://${e.authDomain}/${mC}`}/**
1373
+ * @license
1374
+ * Copyright 2020 Google LLC
1375
+ *
1376
+ * Licensed under the Apache License, Version 2.0 (the "License");
1377
+ * you may not use this file except in compliance with the License.
1378
+ * You may obtain a copy of the License at
1379
+ *
1380
+ * http://www.apache.org/licenses/LICENSE-2.0
1381
+ *
1382
+ * Unless required by applicable law or agreed to in writing, software
1383
+ * distributed under the License is distributed on an "AS IS" BASIS,
1384
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1385
+ * See the License for the specific language governing permissions and
1386
+ * limitations under the License.
1387
+ */const ka="webStorageSupport";class wC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Rh,this._completeRedirectFn=W1,this._overrideRedirectResult=B1}async _openPopup(t,n,r,s){var i;xr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Yu(t,n,r,rl(),s);return hC(t,o,ql())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Yu(t,n,r,rl(),s);return k1(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):(xr(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 aC(t),r=new z1(t);return n.register("authEvent",s=>(Je(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(ka,{type:ka},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[ka];o!==void 0&&n(!!o),ur(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=Y1(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return kh()||gh()||Vl()}}const bC=wC;var Qu="@firebase/auth",Xu="1.12.2";/**
1388
+ * @license
1389
+ * Copyright 2020 Google LLC
1390
+ *
1391
+ * Licensed under the Apache License, Version 2.0 (the "License");
1392
+ * you may not use this file except in compliance with the License.
1393
+ * You may obtain a copy of the License at
1394
+ *
1395
+ * http://www.apache.org/licenses/LICENSE-2.0
1396
+ *
1397
+ * Unless required by applicable law or agreed to in writing, software
1398
+ * distributed under the License is distributed on an "AS IS" BASIS,
1399
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1400
+ * See the License for the specific language governing permissions and
1401
+ * limitations under the License.
1402
+ */class _C{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(){Je(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1403
+ * @license
1404
+ * Copyright 2020 Google LLC
1405
+ *
1406
+ * Licensed under the Apache License, Version 2.0 (the "License");
1407
+ * you may not use this file except in compliance with the License.
1408
+ * You may obtain a copy of the License at
1409
+ *
1410
+ * http://www.apache.org/licenses/LICENSE-2.0
1411
+ *
1412
+ * Unless required by applicable law or agreed to in writing, software
1413
+ * distributed under the License is distributed on an "AS IS" BASIS,
1414
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1415
+ * See the License for the specific language governing permissions and
1416
+ * limitations under the License.
1417
+ */function kC(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 TC(e){wo(new Ns("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;Je(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:Th(e)},d=new t1(r,s,o,l);return a1(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),wo(new Ns("auth-internal",t=>{const n=xi(t.getProvider("auth").getImmediate());return(r=>new _C(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Cs(Qu,Xu,kC(e)),Cs(Qu,Xu,"esm2020")}/**
1418
+ * @license
1419
+ * Copyright 2021 Google LLC
1420
+ *
1421
+ * Licensed under the Apache License, Version 2.0 (the "License");
1422
+ * you may not use this file except in compliance with the License.
1423
+ * You may obtain a copy of the License at
1424
+ *
1425
+ * http://www.apache.org/licenses/LICENSE-2.0
1426
+ *
1427
+ * Unless required by applicable law or agreed to in writing, software
1428
+ * distributed under the License is distributed on an "AS IS" BASIS,
1429
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1430
+ * See the License for the specific language governing permissions and
1431
+ * limitations under the License.
1432
+ */const SC=300,IC=Zf("authIdTokenMaxAge")||SC;let Zu=null;const EC=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>IC)return;const s=n==null?void 0:n.token;Zu!==s&&(Zu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function CC(e=oh()){const t=rh(e,"auth");if(t.isInitialized())return t.getImmediate();const n=i1(e,{popupRedirectResolver:bC,persistence:[P1,w1,Rh]}),r=Zf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=EC(o.toString());g1(n,i,()=>i(n.currentUser)),m1(n,a=>i(a))}}const s=nI("auth");return s&&l1(n,`http://${s}`),n}function AC(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}n1({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=Wn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",AC().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="});TC("Browser");const xC={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 RC(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=fe(()=>s.value==="pull"),a=fe(()=>s.value==="push"),l=fe(()=>s.value!=="");async function d(){try{const $=await fetch("/codex-api/skills-sync/status");if(!$.ok)return;const Z=await $.json();Z.data&&(o.value=Z.data)}catch{}}async function c(){try{const $=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),Z=await $.json();if(!$.ok||!Z.data)throw new Error("Failed to start GitHub login");t.value=Z.data;const ae=30,V=Math.max((Z.data.interval??5)*1e3,3e3);let te=!1;for(let re=0;re<ae;re++){await new Promise(pe=>setTimeout(pe,V));const _e=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:Z.data.device_code})}),ue=await _e.json();if(!_e.ok)throw new Error(ue.error||"Failed to complete GitHub login");if(ue.ok){te=!0;break}if(!ue.pending)throw new Error(ue.error||"Failed to complete GitHub login")}if(!te)throw new Error("GitHub login timed out. Please retry.");t.value=null,await d(),e.showToast("GitHub login successful")}catch($){e.showToast($ instanceof Error?$.message:"Failed GitHub login","error")}}async function p(){try{const $=vE().length>0?oh():sh(xC),Z=CC($),ae=new ir;ae.addScope("repo");const V=await D1(Z,ae),te=ir.credentialFromResult(V),re=(te==null?void 0:te.accessToken)??"";if(!re)throw new Error("GitHub access token missing from Firebase login");const _e=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:re})}),ue=await _e.json();if(!_e.ok||!ue.ok)throw new Error(ue.error||"Failed to login with GitHub token");await d(),e.showToast("GitHub login successful")}catch($){const Z=$ instanceof Error?$.message:"Failed Firebase GitHub login";e.showToast(Z,"error")}}async function _(){r.value="",n.value="pull-started",s.value="pull";try{const $=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),Z=await $.json();if(!$.ok||!Z.ok)throw new Error(Z.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 Z=$ instanceof Error?$.message:"Failed to pull sync";r.value=Z,n.value="pull-failed",e.showToast(Z,"error")}finally{s.value=""}}async function I(){r.value="",n.value="push-started",s.value="push";try{const $=await fetch("/codex-api/skills-sync/push",{method:"POST"}),Z=await $.json();if(!$.ok||!Z.ok)throw new Error(Z.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch($){const Z=$ instanceof Error?$.message:"Failed to push sync";r.value=Z,n.value="push-failed",e.showToast(Z,"error")}finally{s.value=""}}async function j(){try{const $=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),Z=await $.json();if(!$.ok||!Z.ok)throw new Error(Z.error||"Failed to logout GitHub");await d(),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:d,logoutGithub:j,pullSkillsSync:_,pushSkillsSync:I,startGithubFirebaseLogin:p,startGithubLogin:c,syncActionError:r,syncActionStatus:n,syncStatus:o}}const PC={class:"skills-hub"},MC={class:"skills-sync-panel"},$C={class:"skills-sync-header"},OC={key:0,class:"skills-sync-badge"},NC={key:1,class:"skills-sync-badge"},DC={key:2,class:"skills-sync-badge"},LC={class:"skills-sync-meta"},jC={key:0,class:"skills-sync-error"},FC={key:1,class:"skills-sync-meta"},BC={key:2,class:"skills-sync-error"},UC={key:3,class:"skills-sync-device"},HC=["href"],WC={class:"skills-sync-actions"},VC=["disabled"],zC=["disabled"],GC=["disabled"],qC={key:1,class:"skills-hub-section"},KC={class:"skills-hub-section-title"},JC={key:0,class:"skills-hub-grid"},YC={class:"skills-hub-toolbar"},QC={class:"skills-hub-search-wrap"},XC={key:0,class:"skills-hub-count"},ZC={class:"skills-hub-section"},eA={key:0,class:"skills-hub-loading"},tA={key:1,class:"skills-hub-error"},nA={key:0,class:"skills-hub-grid"},rA={key:1,class:"skills-hub-empty"},jo="codex-web-local.skills-hub.cache.v1",sA=qt({__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),d=D(!1),c=D(""),p=D(!0),_=D(!1),I=D(n),j=D(null),$=D(""),Z=D(!1),ae=D(!1);let V=null,te=null;const re=t,_e=fe(()=>o.value==="date"?"Newest":"A-Z"),ue=fe(()=>{var R;return((R=j.value)==null?void 0:R.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),pe=fe(()=>`${I.value.owner}/${I.value.name}`),Me=fe(()=>Z.value&&$.value===pe.value),le=fe(()=>ae.value&&$.value===pe.value),se=fe(()=>{const R=s.value.toLowerCase().trim();return R?a.value.filter(U=>U.name.toLowerCase().includes(R)||U.owner.toLowerCase().includes(R)||(U.displayName??"").toLowerCase().includes(R)):a.value});function ce(R,U="success"){j.value={text:R,type:U},te&&clearTimeout(te),te=setTimeout(()=>{j.value=null},3e3)}function ne(){o.value=o.value==="date"?"name":"date",Ae(s.value)}function xe(R){return`${o.value}::${R.trim().toLowerCase()}`}function je(R){var U;if(typeof window>"u")return null;try{const Y=window.localStorage.getItem(jo);return Y?((U=JSON.parse(Y).byKey)==null?void 0:U[R])??null:null}catch{return null}}function Ne(R,U){if(!(typeof window>"u"))try{const Y=window.localStorage.getItem(jo),G=(Y?JSON.parse(Y):{}).byKey??{};G[R]=U,window.localStorage.setItem(jo,JSON.stringify({byKey:G}))}catch{}}function Ve(){if(!(typeof window>"u"))try{window.localStorage.removeItem(jo)}catch{}}function He(R){const U=R.installed??[];a.value=U;const Y=new Set(U.map(z=>z.name));i.value=R.data.map(z=>{if(z.installed||Y.has(z.name)){const G=U.find(we=>we.name===z.name);return{...z,installed:!0,path:(G==null?void 0:G.path)??z.path,enabled:(G==null?void 0:G.enabled)??z.enabled}}return z}).filter(z=>!z.installed),l.value=R.total}async function Ae(R){const U=xe(R),Y=je(U);Y&&He(Y),d.value=!Y,c.value="";try{const z=new URLSearchParams;R.trim()&&z.set("q",R.trim()),z.set("limit","100"),z.set("sort",o.value);const G=await fetch(`/codex-api/skills-hub?${z}`);if(!G.ok)throw new Error(`HTTP ${G.status}`);const we=await G.json();He(we),Ne(U,we)}catch(z){c.value=z instanceof Error?z.message:"Failed to load skills"}finally{d.value=!1}}function Ze(){V&&clearTimeout(V),V=setTimeout(()=>Ae(s.value),300)}function Ke(R){I.value=R,_.value=!0}async function ot(R){$.value=`${R.owner}/${R.name}`,Z.value=!0;try{const Y=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:R.owner,name:R.name})})).json();if(!Y.ok)throw new Error(Y.error||"Install failed");const z={...R,installed:!0,path:Y.path,enabled:!0};a.value=[...a.value,z],i.value=i.value.filter(G=>G.name!==R.name),I.value=z,ce(`${R.displayName||R.name} skill installed`),_.value=!1,Ve(),re("skills-changed")}catch(U){ce(U instanceof Error?U.message:"Failed to install skill","error")}finally{Z.value=!1}}async function Be(R){$.value=`${R.owner}/${R.name}`,ae.value=!0;try{const Y=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:R.name,path:R.path})})).json();if(!Y.ok)throw new Error(Y.error||"Uninstall failed");a.value=a.value.filter(z=>z.name!==R.name),R.owner!=="local"&&(i.value=[...i.value,{...R,installed:!1,path:void 0,enabled:void 0}]),ce(`${R.displayName||R.name} skill uninstalled`),_.value=!1,Ve(),re("skills-changed")}catch(U){ce(U instanceof Error?U.message:"Failed to uninstall skill","error")}finally{ae.value=!1}}async function Mt(R,U){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:R.path,enabled:U}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),ce(`${R.displayName||R.name} skill ${U?"enabled":"disabled"}`),await Ae(s.value)}catch(Y){ce(Y instanceof Error?Y.message:"Failed to update skill","error")}}const{deviceLogin:ut,isPullInFlight:It,isPushInFlight:Ue,isSyncActionInFlight:W,loadSyncStatus:ge,logoutGithub:me,pullSkillsSync:be,pushSkillsSync:De,startGithubFirebaseLogin:T,startGithubLogin:E,syncActionError:O,syncActionStatus:K,syncStatus:q}=RC({showToast:ce,onPulled:async()=>{await Ae(s.value),re("skills-changed")}});return Pr(()=>{Ae(""),ge()}),(R,U)=>(m(),b("div",PC,[U[11]||(U[11]=y("div",{class:"skills-hub-header"},[y("h2",{class:"skills-hub-title"},"Skills Hub"),y("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),y("div",MC,[y("div",$C,[U[8]||(U[8]=y("strong",null,"Skills Sync (GitHub)",-1)),ye(q).configured?(m(),b("span",OC,"Connected: "+H(ye(q).repoOwner)+"/"+H(ye(q).repoName),1)):ye(q).loggedIn?(m(),b("span",NC,"Logged in as "+H(ye(q).githubUsername),1)):(m(),b("span",DC,"Not connected"))]),y("div",LC,[y("span",null,"Startup: "+H(ye(q).startup.mode),1),y("span",null,"Branch: "+H(ye(q).startup.branch),1),y("span",null,"Action: "+H(ye(q).startup.lastAction),1)]),ye(q).startup.lastError?(m(),b("div",jC,H(ye(q).startup.lastError),1)):de("",!0),ye(K)?(m(),b("div",FC,[y("span",null,"Manual sync: "+H(ye(K)),1)])):de("",!0),ye(O)?(m(),b("div",BC,H(ye(O)),1)):de("",!0),ye(ut)?(m(),b("div",UC,[y("span",null,[U[9]||(U[9]=po("Open ",-1)),y("a",{href:ye(ut).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,HC),U[10]||(U[10]=po(" and enter code:",-1))]),y("code",null,H(ye(ut).user_code),1)])):de("",!0),y("div",WC,[ye(q).loggedIn?de("",!0):(m(),b("button",{key:0,class:"skills-hub-sort",type:"button",onClick:U[0]||(U[0]=(...Y)=>ye(T)&&ye(T)(...Y))},"Login with GitHub")),ye(q).loggedIn?de("",!0):(m(),b("button",{key:1,class:"skills-hub-sort",type:"button",onClick:U[1]||(U[1]=(...Y)=>ye(E)&&ye(E)(...Y))},"Device Login")),ye(q).loggedIn?(m(),b("button",{key:2,class:"skills-hub-sort",type:"button",onClick:U[2]||(U[2]=(...Y)=>ye(me)&&ye(me)(...Y)),disabled:ye(W)},"Logout GitHub",8,VC)):de("",!0),y("button",{class:"skills-hub-sort",type:"button",onClick:U[3]||(U[3]=(...Y)=>ye(be)&&ye(be)(...Y)),disabled:ye(W)},H(ye(It)?"Pulling...":"Pull"),9,zC),ye(q).loggedIn?(m(),b("button",{key:3,class:"skills-hub-sort",type:"button",onClick:U[4]||(U[4]=(...Y)=>ye(De)&&ye(De)(...Y)),disabled:!ye(q).configured||ye(W)},H(ye(Ue)?"Pushing...":"Push"),9,GC)):de("",!0)])]),j.value?(m(),b("div",{key:0,class:at(["skills-hub-toast",ue.value])},H(j.value.text),3)):de("",!0),se.value.length>0?(m(),b("div",qC,[y("button",{class:"skills-hub-section-toggle",type:"button",onClick:U[5]||(U[5]=Y=>p.value=!p.value)},[y("span",KC,"Installed ("+H(se.value.length)+")",1),$e(Ff,{class:at(["skills-hub-section-chevron",{"is-open":p.value}])},null,8,["class"])]),p.value?(m(),b("div",JC,[(m(!0),b(Pe,null,it(se.value,Y=>(m(),ht(Eu,{key:Y.name,skill:Y,onSelect:z=>Ke(z)},null,8,["skill","onSelect"]))),128))])):de("",!0)])):de("",!0),y("div",YC,[y("div",QC,[$e(Qa,{class:"skills-hub-search-icon"}),Er(y("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":U[6]||(U[6]=Y=>s.value=Y),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:Ze},null,544),[[Cr,s.value]]),l.value>0?(m(),b("span",XC,H(l.value)+" skills",1)):de("",!0)]),y("button",{class:"skills-hub-sort",type:"button",onClick:ne},H(_e.value),1)]),y("div",ZC,[d.value?(m(),b("div",eA,"Loading skills...")):c.value?(m(),b("div",tA,H(c.value),1)):(m(),b(Pe,{key:2},[i.value.length>0?(m(),b("div",nA,[(m(!0),b(Pe,null,it(i.value,Y=>(m(),ht(Eu,{key:Y.url,skill:Y,onSelect:z=>Ke(z)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(m(),b("div",rA,'No skills found for "'+H(s.value)+'"',1)):de("",!0)],64))]),$e(qS,{skill:I.value,visible:_.value,"is-installing":Me.value,"is-uninstalling":le.value,onClose:U[7]||(U[7]=Y=>_.value=!1),onInstall:ot,onUninstall:Be,onToggleEnabled:Mt},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),oA=ct(sA,[["__scopeId","data-v-2f6920be"]]),iA={},aA={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 lA(e,t){return m(),b("svg",aA,[...t[0]||(t[0]=[y("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),y("path",{d:"M9 4l0 16"},null,-1)])])}const cA=ct(iA,[["render",lA]]),uA={},dA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function fA(e,t){return m(),b("svg",dA,[...t[0]||(t[0]=[y("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 hA=ct(uA,[["render",fA]]),pA={class:"sidebar-thread-controls"},mA=["aria-label","title"],gA=qt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(m(),b("div",pA,[y("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?(m(),ht(hA,{key:0,class:"sidebar-thread-controls-icon"})):(m(),ht(cA,{key:1,class:"sidebar-thread-controls-icon"}))],8,mA),ar(t.$slots,"default",{},void 0),e.showNewThreadButton?(m(),b("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"))},[$e(ii,{class:"sidebar-thread-controls-icon"})])):de("",!0)]))}}),ed=ct(gA,[["__scopeId","data-v-46a10052"]]),vA={},yA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function wA(e,t){return m(),b("svg",yA,[...t[0]||(t[0]=[y("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[y("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"}),y("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const bA=ct(vA,[["render",wA]]);function Fr(e){return e.flatMap(t=>t.threads)}const jh="codex-web-local.thread-read-state.v1",Fh="codex-web-local.thread-scroll-state.v1",il="codex-web-local.selected-thread-id.v1",Bh="codex-web-local.project-order.v1",Uh="codex-web-local.project-display-name.v1",al="codex-web-local.collaboration-mode-by-context.v1",Hh="codex-web-local.collaboration-mode.v1",Wh="__new-thread__",Ta=220,td=["none","minimal","low","medium","high","xhigh"],gs="__global__",On="gpt-5.2-codex";function _A(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(jh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function nd(e){typeof window>"u"||window.localStorage.setItem(jh,JSON.stringify(e))}function ll(e){return e==="plan"?"plan":"default"}function Vh(e){return e.trim()||Wh}function kA(){if(typeof window>"u")return{};try{const t=window.localStorage.getItem(al);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=ll(o);i==="plan"&&(r[s]=i)}return r}}catch{}return ll(window.localStorage.getItem(Hh))==="plan"?{[Wh]:"plan"}:{}}function Sa(e,t){const n=Vh(t);return ll(e[n])}function TA(e){typeof window>"u"||(Object.keys(e).length===0?window.localStorage.removeItem(al):window.localStorage.setItem(al,JSON.stringify(e)),window.localStorage.removeItem(Hh))}function zh(e,t,n){return Math.min(Math.max(e,t),n)}function SA(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=zh(t.scrollRatio,0,1)),n}function IA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Fh);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=SA(s);o&&(n[r]=o)}return n}catch{return{}}}function rd(e){typeof window>"u"||window.localStorage.setItem(Fh,JSON.stringify(e))}function EA(){return typeof window>"u"?"":window.localStorage.getItem(il)??""}function CA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(il);return}window.localStorage.setItem(il,e)}}function AA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Bh);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 vs(e){typeof window>"u"||window.localStorage.setItem(Bh,JSON.stringify(e))}function xA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uh);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 Ia(e){typeof window>"u"||window.localStorage.setItem(Uh,JSON.stringify(e))}function Fo(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 is(e,n)?e:n}function Ea(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 is(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 RA(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 PA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function MA(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 $A(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&MA(e.steps,t.steps)}function Bo(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 cl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&is(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&PA(e.commandExecution,t.commandExecution)&&$A(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function io(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 OA(e,t,n={}){const r=new Map(e.map(c=>[c.id,c])),s=new Map(t.map(c=>[c.id,c])),o=t.map(c=>{const p=r.get(c.id);return p&&cl(p,c)?p:c});if(n.preserveMissing!==!0)return io(e,o)?e:o;const i=e.map(c=>{const p=s.get(c.id);return!p||cl(c,p)?c:p}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),d=[...i,...l];return io(e,d)?e:d}function ul(e){return e.replace(/\s+/gu," ").trim()}function NA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>ul(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=ul(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Ca(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(cl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Gh="worked";function Dr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function DA(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 LA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function jA(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 FA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${DA(e.durationMs)}`,messageType:Gh}}function BA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function UA(e,t){const n=FA(t),r=e.filter(i=>i.messageType!==Gh),s=BA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Ut(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function HA(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 WA(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 VA(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 zA(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 en(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Uo(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 d=i.get(l.id);return d&&WA(d,l)?d:l});return o&&o.projectName===s.projectName&&VA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return zA(e,r)?e:r}function GA(e,t,n){const r=new Set(Fr(t).map(a=>a.id)),s=Fr(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 d=i.findIndex(c=>c.projectName===a.projectName);d>=0&&(i[d]={projectName:i[d].projectName,threads:[a,...i[d].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function qA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function ys(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function KA(e){const t=e.split(`
1433
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function JA(){const e=D([]),t=D([]),n=D(EA()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),d=D({}),c=D({}),p=D([]),_=D([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),I=D(kA()),j=D(Sa(I.value,n.value)),$=D(""),Z=D("medium"),ae=D(_A()),V=D(IA()),te=D(AA()),re=D(xA()),_e=D({}),ue=D({}),pe=D({}),Me=D({}),le=D({}),se=D({}),ce=D({}),ne=D({}),xe=D({}),je=D(null),Ne=D({}),Ve=D([]),He=D(!1),Ae=D(!1),Ze=D(!1),Ke=D(!1),ot=D(!1),Be=D(""),Mt=D(!1),ut=D(!1);let It=null,Ue=null,W=!1;const ge=new Set;let me=!1,be=!1;const De=new Map,T=new Set,E=fe(()=>Fr(e.value)),O=fe(()=>E.value.find(u=>u.id===n.value)??null),K=fe(()=>V.value[n.value]??null),q=fe(()=>{const u=[],h=n.value;return h&&Array.isArray(ne.value[h])&&u.push(...ne.value[h]),Array.isArray(ne.value[gs])&&u.push(...ne.value[gs]),u.sort((k,A)=>k.receivedAtIso.localeCompare(A.receivedAtIso))}),R=fe(()=>{var ee;const u=n.value;if(!u)return null;const h=le.value[u],k=(i.value[u]??"").trim(),A=(((ee=se.value[u])==null?void 0:ee.message)??"").trim();return!h&&!k&&!A?null:{activityLabel:(h==null?void 0:h.label)||"Thinking",activityDetails:(h==null?void 0:h.details)??[],reasoningText:k,errorText:A}}),U=fe(()=>je.value),Y=fe(()=>{const u=n.value;if(!u)return[];const h=r.value[u]??[],k=s.value[u]??[],A=o.value[u]??[],ee=a.value[u]??[],f=[...h,...k,...ee,...A],S=Me.value[u];return S?UA(f,S):f});function z(u){n.value!==u&&(n.value=u,CA(u),j.value=Sa(I.value,u),be=!1)}function G(u){$.value=u.trim()}function we(u){const h=u==="plan"?"plan":"default",k=Vh(n.value);Sa(I.value,n.value)===h&&j.value===h||(j.value=h,I.value=h==="plan"?{...I.value,[k]:h}:Ut(I.value,k),TA(I.value))}function ve(u){je.value=u}async function ke(){$.value=On,p.value.includes(On)||(p.value=[...p.value,On]);try{await i0(On)}catch{}}function Ie(u,h){xe.value={...xe.value,[u]:h}}function Le(u){xe.value[u]&&(xe.value=Ut(xe.value,u))}async function et(u){if(T.has(u))return;const h=xe.value[u];if(!(!h||h.fallbackRetried)){T.add(u),Ie(u,{...h,fallbackRetried:!0});try{await ke();try{const k=await wu(u,1);$t(u,k),Xt(u),yt(u,[]),Qt(u),a.value[u]&&(a.value=Ut(a.value,u))}catch{}ft(u,null),Be.value="",Pt(u,null),St(u,{label:"Thinking",details:Ge(On,h.effort,h.collaborationMode)}),pt(u,!0),pe.value[u]!==!0&&await ha(u),await pa(u,h.text,h.imageUrls,On,h.effort||void 0,h.skills.length>0?h.skills:void 0,h.fileAttachments,h.collaborationMode),pe.value={...pe.value,[u]:!0},ge.add(u),W=!0,await Qn()}catch(k){const A=k instanceof Error?k.message:"Unknown application error";ft(u,A),Be.value=A,pt(u,!1),St(u,null)}finally{T.delete(u)}}}function Ye(u){u&&!td.includes(u)||(Z.value=u)}async function Tt(){try{const u=await l0();_.value=u,u.some(h=>h.value===j.value)||we("default")}catch{}}function Ge(u,h,k=j.value){const A=u.trim()||"default",ee=h||"default";return[`Mode: ${k==="plan"?"Plan":"Default"}`,`Model: ${A}`,`Thinking: ${ee}`]}async function dt(){try{const[u,h]=await Promise.all([Gf(),qf()]);p.value=u,$.value.length>0&&u.includes($.value)||(h.model&&u.includes(h.model)?$.value=h.model:u.length>0?$.value=u[0]:$.value=""),h.reasoningEffort&&td.includes(h.reasoningEffort)&&(Z.value=h.reasoningEffort)}catch{}}function tt(u){const h=Ne.value;return Object.keys(h).length===0?u:u.map(k=>({projectName:k.projectName,threads:k.threads.map(A=>{const ee=h[A.id];return ee?{...A,title:ee}:A})}))}function nt(){const h=tt(t.value).map(k=>({projectName:k.projectName,threads:k.threads.map(A=>{const ee=l.value[A.id]===!0,f=n.value===A.id,S=ae.value[A.id],L=c.value[A.id]===!0,oe=!f&&!ee&&(L||S!==A.updatedAtIso);return{...A,inProgress:ee,unread:oe}})}));e.value=Uo(e.value,h)}function Kt(u,h,k){const A=new Date().toISOString(),ee=h.trim(),f=qA(ee),S={id:u,title:KA(k),projectName:f,cwd:ee,hasWorktree:ee.includes("/.codex/worktrees/")||ee.includes("/.git/worktrees/"),createdAtIso:A,updatedAtIso:A,preview:k,unread:!1,inProgress:!1},L=t.value.findIndex(Se=>Se.projectName===f);if(L>=0){const Ee=t.value[L].threads.filter(Fn=>Fn.id!==u),st={projectName:f,threads:[S,...Ee]},kn=[...t.value];kn.splice(L,1,st),t.value=kn}else t.value=[{projectName:f,threads:[S]},...t.value];const oe=Fo(te.value,t.value);is(te.value,oe)||(te.value=oe,vs(te.value)),nt()}function rt(u){const h=new Set(u.map(f=>f.id)),k=en(ae.value,h);k!==ae.value&&(ae.value=k,nd(k));const A=en(V.value,h);A!==V.value&&(V.value=A,rd(A)),ue.value=en(ue.value,h),_e.value=en(_e.value,h),pe.value=en(pe.value,h),r.value=en(r.value,h),o.value=en(o.value,h),i.value=en(i.value,h),a.value=en(a.value,h),Me.value=en(Me.value,h),le.value=en(le.value,h),se.value=en(se.value,h),ce.value=en(ce.value,h),c.value=en(c.value,h),l.value=en(l.value,h);const ee={};for(const[f,S]of Object.entries(ne.value))(f===gs||h.has(f))&&(ee[f]=S);ne.value=ee}function vt(u){const h=Fr(t.value).find(k=>k.id===u);h&&(ae.value={...ae.value,[u]:h.updatedAtIso},nd(ae.value),c.value[u]&&(c.value=Ut(c.value,u)),nt())}function Pt(u,h){if(!u)return;const k=Me.value[u];if(h){if(LA(k,h))return;Me.value={...Me.value,[u]:h}}else k&&(Me.value=Ut(Me.value,u))}function pt(u,h){!u||l.value[u]===!0===h||(h?l.value={...l.value,[u]:!0}:l.value=Ut(l.value,u),nt())}function xn(u){u&&u!==n.value&&c.value[u]!==!0&&(c.value={...c.value,[u]:!0},nt())}function St(u,h){if(!u)return;const k=le.value[u];if(!h){k&&(le.value=Ut(le.value,u));return}const A=Cn(h.label)||"Thinking",ee=h.details.map(L=>Cn(L)).filter(L=>L.length>0&&L!==A),f=Array.from(new Set([...(k==null?void 0:k.details)??[],...ee])).slice(-3),S={label:A,details:f};jA(k,S)||(le.value={...le.value,[u]:S})}function ft(u,h){if(!u)return;const k=se.value[u],A=h?ul(h):"";if(!A){k&&(se.value=Ut(se.value,u));return}(k==null?void 0:k.message)!==A&&(se.value={...se.value,[u]:{message:A}})}function vn(u){const h=Fr(t.value).find(k=>k.id===u);return(h==null?void 0:h.updatedAtIso)??""}function zt(u,h){if(!u)return;const k={scrollTop:Math.max(0,h.scrollTop),isAtBottom:h.isAtBottom===!0};typeof h.scrollRatio=="number"&&Number.isFinite(h.scrollRatio)&&(k.scrollRatio=zh(h.scrollRatio,0,1));const A=V.value[u];A&&A.scrollTop===k.scrollTop&&A.isAtBottom===k.isAtBottom&&A.scrollRatio===k.scrollRatio||(V.value={...V.value,[u]:k},rd(V.value))}function $t(u,h){const k=r.value[u]??[];io(k,h)||(r.value={...r.value,[u]:h})}function yt(u,h){const k=o.value[u]??[];io(k,h)||(o.value={...o.value,[u]:h})}function Sn(u,h){const k=s.value[u]??[];io(k,h)||(s.value={...s.value,[u]:h})}function Rn(u,h){const k=s.value[u]??[],A=Ca(k,h);Sn(u,A)}function yn(u,h){const k=o.value[u]??[],A=Ca(k,h);yt(u,A)}function Pn(u,h){if(!u)return;const k=h.trim(),A=i.value[u]??"";if(k.length===0){if(!A)return;i.value=Ut(i.value,u);return}A!==k&&(i.value={...i.value,[u]:k})}function cn(u,h){if(!u)return;const k=i.value[u]??"";Pn(u,`${k}${h}`)}function Qt(u){u&&u in i.value&&(i.value=Ut(i.value,u))}function Xt(u){u&&u in s.value&&(s.value=Ut(s.value,u))}function dr(u){return u==="completed"?"completed":u==="inProgress"||u==="in_progress"?"inProgress":"pending"}function Dn(u){var k;const h=[];(k=u.explanation)!=null&&k.trim()&&h.push(u.explanation.trim());for(const A of u.steps){const ee=A.status==="completed"?"x":A.status==="inProgress"?"~":" ";h.push(`- [${ee}] ${A.step}`)}return h.join(`
1434
+ `).trim()}function Zt(u){if(u.method!=="turn/plan/updated")return null;const h=Fe(u.params),k=Ot(u),A=Re(h==null?void 0:h.turnId)||Re(h==null?void 0:h.turn_id),f=(Array.isArray(h==null?void 0:h.plan)?h==null?void 0:h.plan:[]).map(oe=>Fe(oe)).map(oe=>({step:Re(oe==null?void 0:oe.step),status:dr(oe==null?void 0:oe.status)})).filter(oe=>oe.step.length>0);if(!k||!A)return null;const L={explanation:Re(h==null?void 0:h.explanation).trim()||void 0,steps:f,isStreaming:!0};return{threadId:k,message:{id:`${A}:plan`,role:"assistant",text:Dn(L),messageType:"plan.live",plan:L}}}function Jt(u){if(u.method!=="item/plan/delta")return null;const h=Fe(u.params),k=Ot(u),A=Re(h==null?void 0:h.turnId)||Re(h==null?void 0:h.turn_id),ee=Re(h==null?void 0:h.delta);if(!k||!A||!ee)return null;const f=`${A}:plan`,S=(s.value[k]??[]).find(Se=>Se.id===f),L=`${(S==null?void 0:S.text)??""}${ee}`,oe=S!=null&&S.plan?{...S.plan,isStreaming:!0}:void 0;return{threadId:k,message:{id:f,role:"assistant",text:L,messageType:"plan.live",plan:oe}}}function Fe(u){return u!==null&&typeof u=="object"&&!Array.isArray(u)?u:null}function Re(u){return typeof u=="string"?u:""}function In(u){return typeof u=="number"&&Number.isFinite(u)?u:null}function Ot(u){const h=Fe(u.params);if(!h)return"";const k=Re(h.threadId);if(k)return k;const A=Re(h.thread_id);if(A)return A;const ee=Re(h.conversationId);if(ee)return ee;const f=Re(h.conversation_id);if(f)return f;const S=Fe(h.thread),L=Re(S==null?void 0:S.id);if(L)return L;const oe=Fe(h.turn),Se=Re(oe==null?void 0:oe.threadId);if(Se)return Se;const Ee=Re(oe==null?void 0:oe.thread_id);return Ee||""}function Mn(u){if(u.method!=="turn/completed")return"";const h=Fe(u.params),k=Fe(h==null?void 0:h.turn);if(!k||k.status!=="failed")return"";const A=Fe(k.error);return Re(A==null?void 0:A.message)}function wn(u){var k;if(u.method!=="error")return"";const h=Fe(u.params);return Re(h==null?void 0:h.message)||Re((k=Fe(h==null?void 0:h.error))==null?void 0:k.message)}function bn(u){const h=Fe(u);if(!h)return null;const k=h.id,A=Re(h.method),ee=h.params;if(typeof k!="number"||!Number.isInteger(k)||!A)return null;const f=Fe(ee),S=Re(f==null?void 0:f.threadId)||gs,L=Re(f==null?void 0:f.turnId),oe=Re(f==null?void 0:f.itemId),Se=Re(h.receivedAtIso)||new Date().toISOString();return{id:k,method:A,threadId:S,turnId:L,itemId:oe,receivedAtIso:Se,params:ee??null}}function Jn(u){const h=u.threadId||gs,k=ne.value[h]??[],A=k.findIndex(f=>f.id===u.id),ee=[...k];A>=0?ee.splice(A,1,u):ee.push(u),ne.value={...ne.value,[h]:ee.sort((f,S)=>f.receivedAtIso.localeCompare(S.receivedAtIso))}}function _n(u){const h={};for(const[k,A]of Object.entries(ne.value)){const ee=A.filter(f=>f.id!==u);ee.length>0&&(h[k]=ee)}ne.value=h}function fr(u){const h={};for(const k of u){const A=k.threadId||gs,ee=h[A]??[];ee.push(k),h[A]=ee}for(const k of Object.values(h))k.sort((A,ee)=>A.receivedAtIso.localeCompare(ee.receivedAtIso));ne.value=h}function En(u){if(u.method==="server/request"){const h=bn(u.params);return h&&Jn(h),!0}if(u.method==="server/request/resolved"){const h=Fe(u.params),k=h==null?void 0:h.id;return typeof k=="number"&&Number.isInteger(k)&&_n(k),!0}return!1}function Cn(u){return u.replace(/\s+/gu," ").trim()}function x(u){const h=Ot(u);if(!h)return null;if(u.method==="turn/started")return{threadId:h,activity:{label:"Thinking",details:[]}};if(u.method==="item/started"){const k=Fe(u.params),A=Fe(k==null?void 0:k.item),ee=Re(A==null?void 0:A.type).toLowerCase();if(ee==="reasoning")return{threadId:h,activity:{label:"Thinking",details:[]}};if(ee==="agentmessage")return{threadId:h,activity:{label:"Writing response",details:[]}};if(ee==="commandexecution"){const f=Re(A==null?void 0:A.command);return{threadId:h,activity:{label:"Running command",details:f?[f]:[]}}}}return u.method==="item/commandExecution/outputDelta"?{threadId:h,activity:{label:"Running command",details:[]}}:u.method==="item/reasoning/summaryTextDelta"||u.method==="item/reasoning/summaryPartAdded"?{threadId:h,activity:{label:"Thinking",details:[]}}:u.method==="item/agentMessage/delta"?{threadId:h,activity:{label:"Writing response",details:[]}}:null}function F(u){if(u.method!=="turn/started")return null;const h=Fe(u.params);if(!h)return null;const k=Ot(u);if(!k)return null;const A=Fe(h.turn),ee=Re(A==null?void 0:A.id)||Re(h.turnId)||`${k}:unknown`;if(!ee)return null;const f=Dr(Re(A==null?void 0:A.startedAt))??Dr(Re(h.startedAt))??Dr(u.atIso)??Date.now();return{threadId:k,turnId:ee,startedAtMs:f}}function ie(u){if(u.method!=="turn/completed")return null;const h=Fe(u.params);if(!h)return null;const k=Ot(u);if(!k)return null;const A=Fe(h.turn),ee=Re(A==null?void 0:A.id)||Re(h.turnId)||`${k}:unknown`;if(!ee)return null;const f=Dr(Re(A==null?void 0:A.completedAt))??Dr(Re(h.completedAt))??Dr(u.atIso)??Date.now(),S=Dr(Re(A==null?void 0:A.startedAt))??Dr(Re(h.startedAt))??void 0;return{threadId:k,turnId:ee,completedAtMs:f,startedAtMs:S}}function Oe(u){return`${u}:live-reasoning`}function v(u){const h=Fe(u.params);if(!h)return"";if(u.method==="item/started"){const k=Fe(h.item);return!k||k.type!=="reasoning"?"":Re(k.id)}return""}function g(u){const h=Fe(u.params);if(!h)return null;if(u.method==="item/reasoning/summaryTextDelta"){const k=Re(h.itemId),A=Re(h.delta);return!k||!A?null:{messageId:Oe(k),delta:A}}return null}function w(u){const h=Fe(u.params);if(!h)return"";if(u.method==="item/reasoning/summaryPartAdded"){const k=Re(h.itemId);return k?Oe(k):""}return""}function M(u){const h=Fe(u.params);if(!h)return"";if(u.method==="item/completed"){const k=Fe(h.item);return!k||k.type!=="reasoning"?"":Oe(Re(k.id))}return""}function B(u){const h=Fe(u.params);if(!h)return"";if(u.method==="item/started"){const k=Fe(h.item);return!k||k.type!=="agentMessage"?"":Re(k.id)}return""}function J(u){const h=Fe(u.params);if(!h)return null;if(u.method==="item/agentMessage/delta"){const k=Re(h.itemId),A=Re(h.delta);return!k||!A?null:{messageId:k,delta:A}}return null}function Ce(u){const h=Fe(u.params);if(!h)return null;if(u.method==="item/completed"){const k=Fe(h.item);if(!k||k.type!=="agentMessage")return null;const A=Re(k.id),ee=Re(k.text);return!A||!ee?null:{id:A,role:"assistant",text:ee,messageType:"agentMessage.live"}}return null}function X(u){if(u.method!=="item/started")return null;const h=Fe(u.params),k=Fe(h==null?void 0:h.item);if(!k||k.type!=="commandExecution")return null;const A=Re(k.id),ee=Re(k.command);if(!A)return null;const f=typeof k.cwd=="string"?k.cwd:null;return{id:A,role:"system",text:ee,messageType:"commandExecution",commandExecution:{command:ee,cwd:f,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Te(u){if(u.method!=="item/commandExecution/outputDelta")return null;const h=Fe(u.params);if(!h)return null;const k=Re(h.itemId),A=Re(h.delta);return!k||!A?null:{itemId:k,delta:A}}function he(u){if(u.method!=="item/completed")return null;const h=Fe(u.params),k=Fe(h==null?void 0:h.item);if(!k||k.type!=="commandExecution")return null;const A=Re(k.id),ee=Re(k.command);if(!A)return null;const f=typeof k.cwd=="string"?k.cwd:null,S=Re(k.status),L=S==="failed"?"failed":S==="declined"?"declined":S==="interrupted"?"interrupted":"completed",oe=typeof k.aggregatedOutput=="string"?k.aggregatedOutput:"",Se=typeof k.exitCode=="number"?k.exitCode:null;return{id:A,role:"system",text:ee,messageType:"commandExecution",commandExecution:{command:ee,cwd:f,status:L,aggregatedOutput:oe,exitCode:Se}}}function ze(u,h){const k=a.value[u]??[],A=Ca(k,h);A!==k&&(a.value={...a.value,[u]:A})}function Nt(u,h){const k=a.value[u];if(!k||k.length===0)return;const A=new Set(h.map(f=>f.id)),ee=k.filter(f=>!A.has(f.id));ee.length!==k.length&&(ee.length===0?a.value=Ut(a.value,u):a.value={...a.value,[u]:ee})}function Dt(u){if(u.method==="item/agentMessage/delta")return!0;const h=Fe(u.params);if(!h)return!1;if(u.method==="item/completed"){const k=Fe(h.item);return(k==null?void 0:k.type)==="agentMessage"}return!1}function Et(u){var Yl,Ql,Xl,Zl,ec;if(En(u))return;if(u.method==="thread/name/updated"){const Qe=Fe(u.params),Xn=Re(Qe==null?void 0:Qe.threadId),Qr=Re(Qe==null?void 0:Qe.threadName);Xn&&Qr&&(Ne.value={...Ne.value,[Xn]:Qr},nt(),ma(Xn,Qr))}if(u.method==="account/rateLimits/updated"){ve(Vf(u.params));return}const h=x(u);h&&St(h.threadId,h.activity);const k=F(u);k&&(De.set(k.turnId,k),ce.value={...ce.value,[k.threadId]:k.turnId},Xt(k.threadId),Pt(k.threadId,null),ft(k.threadId,null),pt(k.threadId,!0),c.value[k.threadId]&&(c.value=Ut(c.value,k.threadId)));const A=ie(u),ee=Mn(u),S=!!((A==null?void 0:A.threadId)??Ot(u))&&!!ee&&$.value!==On&&Bo(new Error(ee));if(A){const Qe=De.get(A.turnId);Qe&&De.delete(A.turnId);const Xn=In((Yl=Fe(u.params))==null?void 0:Yl.durationMs)??In((Xl=Fe((Ql=Fe(u.params))==null?void 0:Ql.turn))==null?void 0:Xl.durationMs)??(typeof A.startedAtMs=="number"?A.completedAtMs-A.startedAtMs:null)??(Qe?A.completedAtMs-Qe.startedAtMs:null),Qr=typeof Xn=="number"?Math.max(0,Xn):0;Pt(A.threadId,{turnId:A.turnId,durationMs:Qr}),ce.value[A.threadId]&&(ce.value=Ut(ce.value,A.threadId)),pt(A.threadId,!1),St(A.threadId,null),xn(A.threadId),S||(Le(A.threadId),Po(A.threadId))}if(ee){const Qe=(A==null?void 0:A.threadId)||Ot(u);Qe&&ft(Qe,ee),Be.value=ee,Qe&&S&&et(Qe)}else A&&ft(A.threadId,null);const L=wn(u);if(L){const Qe=Ot(u);Qe&&ft(Qe,L),Be.value=L,$.value!==On&&Bo(new Error(L))&&(Qe?et(Qe):ke())}const oe=Ot(u),Se=Zt(u);Se&&(Rn(Se.threadId,Se.message),St(Se.threadId,{label:"Planning",details:((Zl=Se.message.plan)==null?void 0:Zl.steps.map(Qe=>Qe.step).slice(0,2))??[]}));const Ee=Jt(u);if(Ee&&(Rn(Ee.threadId,Ee.message),St(Ee.threadId,{label:"Planning",details:[]})),!oe||oe!==n.value)return;B(u);const st=J(u);if(st){const Qe=(o.value[oe]??[]).find(Qr=>Qr.id===st.messageId),Xn=`${(Qe==null?void 0:Qe.text)??""}${st.delta}`;yn(oe,{id:st.messageId,role:"assistant",text:Xn,messageType:"agentMessage.live"})}const kn=Ce(u);kn&&yn(oe,kn),v(u);const Fn=g(u);if(Fn&&cn(oe,Fn.delta),w(u)){const Qe=i.value[oe]??"";Qe.trim().length>0&&!Qe.endsWith(`
1435
+
1436
+ `)&&Pn(oe,`${Qe}
1437
+
1438
+ `)}M(u);const Vi=X(u);Vi&&(ze(oe,Vi),St(oe,{label:"Running command",details:[((ec=Vi.commandExecution)==null?void 0:ec.command)??""]}));const zi=Te(u);if(zi){const Qe=(a.value[oe]??[]).find(Xn=>Xn.id===zi.itemId);Qe!=null&&Qe.commandExecution&&ze(oe,{...Qe,commandExecution:{...Qe.commandExecution,aggregatedOutput:`${Qe.commandExecution.aggregatedOutput}${zi.delta}`}})}const Jl=he(u);if(Jl&&ze(oe,Jl),Dt(u)&&(be&&n.value&&zt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Qt(oe)),u.method==="turn/completed"){be=!1,Qt(oe),a.value[oe]&&(a.value=Ut(a.value,oe));const Qe=Ot(u);Qe&&(pt(Qe,!1),St(Qe,null),xn(Qe),S||(Le(Qe),Po(Qe)))}}function Ft(u){const h=Ot(u);h&&ge.add(h);const k=u.method;(k.startsWith("thread/")||k.startsWith("turn/")||k.startsWith("item/"))&&(W=!0),!(Ue!==null||typeof window>"u")&&(Ue=window.setTimeout(()=>{Ue=null,Qn()},Ta))}async function Bs(u){if(!me){me=!0;try{const h=await Js(),k=[];for(const A of h.order){const ee=ys(A);k.includes(ee)||k.push(ee)}if(k.length>0){const A=Fo(k,u);is(te.value,A)||(te.value=A,vs(te.value))}if(Object.keys(h.labels).length>0){const A={...re.value};let ee=!1;for(const[f,S]of Object.entries(h.labels)){const L=ys(f);A[L]!==S&&(A[L]=S,ee=!0)}ee&&(re.value=A,Ia(A))}}catch{}}}async function C(){if(!(Object.keys(Ne.value).length>0))try{const u=await m0();Object.keys(u.titles).length>0&&(Ne.value=u.titles)}catch{}}async function P(u,h,k){if(Ne.value[u])return;const A=h.trim();if(!A)return;const ee=A.length>300?A.slice(0,300):A;try{const f=await g0(ee,k);if(!f||Ne.value[u])return;Ne.value={...Ne.value,[u]:f},nt(),ma(u,f)}catch{}}async function N(){var u;ut.value||(He.value=!0);try{const[h]=await Promise.all([zk(),C()]);await Bs(h);const k=Fo(te.value,h);is(te.value,k)||(te.value=k,vs(te.value));const A=Ea(h,te.value),ee=GA(t.value,A,l.value);t.value=Uo(t.value,ee),l.value=en(l.value,new Set(Fr(t.value).map(L=>L.id))),nt(),ut.value=!0;const f=Fr(e.value);rt(f),f.some(L=>L.id===n.value)||z(((u=f[0])==null?void 0:u.id)??"")}finally{He.value=!1}}async function Q(u,h={}){if(!u)return;const k=ue.value[u]===!0,A=h.silent!==!0&&!k;A&&(Ae.value=!0);try{pe.value[u]!==!0&&(await ha(u),pe.value={...pe.value,[u]:!0});const{messages:ee,inProgress:f}=await Gk(u),S=r.value[u]??[],L=OA(S,ee,{preserveMissing:h.silent===!0});$t(u,L);const oe=o.value[u]??[],Se=NA(oe,ee);yt(u,Se),Nt(u,ee),ue.value={...ue.value,[u]:!0};const Ee=vn(u);Ee&&(_e.value={..._e.value,[u]:Ee}),pt(u,f),f||Xt(u),vt(u)}finally{A&&(Ae.value=!1)}}async function We(u,h={}){u&&ue.value[u]!==!0&&await Q(u,h)}async function xt(){try{const u=t.value.flatMap(h=>h.threads.map(k=>k.cwd)).filter(Boolean);Ve.value=await v0(u.length>0?[...new Set(u)]:void 0)}catch{}}async function Bt(){try{ve(await Yk())}catch{}}async function Ln(u={}){Be.value="";const h=u.includeSelectedThreadMessages!==!1,k=u.awaitAncillaryRefreshes===!0;try{await N();const A=Promise.allSettled([dt(),Tt(),xt(),Bt()]).then(()=>{});h&&await Q(n.value),k&&await A}catch(A){Be.value=A instanceof Error?A.message:"Unknown application error"}}async function Gt(u){z(u);try{await Q(u)}catch(h){Be.value=h instanceof Error?h.message:"Unknown application error"}}async function un(u){try{await e0(u),await N(),n.value===u&&await Q(n.value)}catch(h){Be.value=h instanceof Error?h.message:"Unknown application error"}}async function jn(u,h){const k=h.trim();if(!(!u||!k))try{await t0(u,k),Ne.value={...Ne.value,[u]:k},nt(),ma(u,k)}catch(A){Be.value=A instanceof Error?A.message:"Unknown application error"}}async function Yn(u,h=[],k=[],A="steer",ee=[]){const f=n.value,S=u.trim();if(!f||!S&&h.length===0&&ee.length===0)return;const L=l.value[f]===!0;if(L&&A==="queue"){const oe=d.value[f]??[],Se=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;d.value={...d.value,[f]:[...oe,{id:Se,text:S,imageUrls:h,skills:k,fileAttachments:ee,collaborationMode:j.value}]};return}if(L){be=!0,ps(f,S,h,k,ee).catch(oe=>{const Se=oe instanceof Error?oe.message:"Unknown application error";ft(f,Se),Be.value=Se});return}Be.value="",be=!0,Pt(f,null),St(f,{label:"Thinking",details:Ge($.value,Z.value,j.value)}),ft(f,null),pt(f,!0);try{await ps(f,S,h,k,ee)}catch(oe){be=!1,pt(f,!1),St(f,null);const Se=oe instanceof Error?oe.message:"Unknown application error";throw ft(f,Se),Be.value=Se,oe}}async function Jr(u,h,k=[],A=[],ee=[]){const f=u.trim(),S=h.trim(),L=$.value.trim();if(!f&&k.length===0&&ee.length===0)return"";Ze.value=!0,Be.value="";let oe="";try{try{oe=await bu(S||void 0,L||void 0)}catch(kn){if(L&&L!==On&&Bo(kn))await ke(),oe=await bu(S||void 0,On);else throw kn}if(!oe)return"";Kt(oe,S,f||"[Image]"),pe.value={...pe.value,[oe]:!0},z(oe),be=!0,Pt(oe,null),St(oe,{label:"Thinking",details:Ge($.value,Z.value,j.value)}),ft(oe,null),pt(oe,!0);const Se=oe,Ee=S||null,st=f;return ps(oe,f,k,A,ee).catch(kn=>{be=!1,pt(oe,!1),St(oe,null);const Fn=kn instanceof Error?kn.message:"Unknown application error";ft(oe,Fn),Be.value=Fn}).finally(()=>{Ze.value=!1}),P(Se,st,Ee),oe}catch(Se){be=!1,oe&&(pt(oe,!1),St(oe,null));const Ee=Se instanceof Error?Se.message:"Unknown application error";throw oe&&ft(oe,Ee),Be.value=Ee,Ze.value=!1,Se}}async function ps(u,h,k=[],A=[],ee=[]){const f=$.value.trim(),S=Z.value,L=j.value,oe=h.trim(),Se=A.map(st=>({name:st.name,path:st.path})),Ee=ee.map(st=>({...st}));Ie(u,{text:oe,imageUrls:[...k],skills:Se,fileAttachments:Ee,effort:S,collaborationMode:L,fallbackRetried:!1});try{pe.value[u]!==!0&&await ha(u);try{await pa(u,h,k,f||void 0,S||void 0,A.length>0?A:void 0,ee,L)}catch(st){if(f&&f!==On&&Bo(st))await ke(),Ie(u,{text:oe,imageUrls:[...k],skills:Se,fileAttachments:Ee,effort:S,collaborationMode:L,fallbackRetried:!0}),await pa(u,h,k,On,S||void 0,A.length>0?A:void 0,ee,L);else throw st}pe.value={...pe.value,[u]:!0},ge.add(u),W=!0,await Qn()}catch(st){throw st}}async function Po(u){const h=d.value[u];if(!h||h.length===0)return;const[k,...A]=h;d.value=A.length>0?{...d.value,[u]:A}:Ut(d.value,u),Ze.value=!0,Be.value="",be=!0,Pt(u,null),St(u,{label:"Thinking",details:Ge($.value,Z.value,k.collaborationMode)}),ft(u,null),pt(u,!0);try{we(k.collaborationMode),await ps(u,k.text,k.imageUrls,k.skills,k.fileAttachments)}catch{pt(u,!1),St(u,null)}finally{Ze.value=!1}}async function Mi(){const u=n.value;if(!u||l.value[u]!==!0)return;const h=ce.value[u];Ke.value=!0,Be.value="";try{await o0(u,h),pt(u,!1),St(u,null),ft(u,null),ce.value[u]&&(ce.value=Ut(ce.value,u)),ge.add(u),W=!0,await Qn()}catch(k){const A=k instanceof Error?k.message:"Failed to interrupt active turn";ft(u,A),Be.value=A}finally{Ke.value=!1}}async function $i(u){const h=n.value;if(!h||ot.value)return;const A=(r.value[h]??[]).reduce((f,S)=>typeof S.turnIndex=="number"&&S.turnIndex>f?S.turnIndex:f,-1);if(A<0||u>A)return;const ee=A-u+1;if(!(ee<1)){ot.value=!0,Be.value="";try{const f=await wu(h,ee);$t(h,f),Xt(h),yt(h,[]),Qt(h),a.value[h]&&(a.value=Ut(a.value,h)),Pt(h,null),St(h,null),ft(h,null),W=!0,await Qn()}catch(f){Be.value=f instanceof Error?f.message:"Failed to rollback thread"}finally{ot.value=!1}}}function Oi(u,h){u.length===0||(re.value[u]??"")===h||(re.value={...re.value,[u]:h},Ia(re.value))}async function Mo(u){var f;if(u.length===0)return;const h=te.value.filter(S=>S!==u);if(is(te.value,h)||(te.value=h,vs(te.value)),t.value=t.value.filter(S=>S.projectName!==u),re.value[u]!==void 0){const S={...re.value};delete S[u],re.value=S,Ia(S)}nt();const k=Fr(e.value);rt(k),k.some(S=>S.id===n.value)||z(((f=k[0])==null?void 0:f.id)??"");const ee=new Set;try{const S=await Js();for(const L of S.order)ys(L)===u&&ee.add(L);for(const L of S.active)ys(L)===u&&ee.add(L);for(const L of Object.keys(S.labels))ys(L)===u&&ee.add(L)}catch{}if(ee.size>0)try{const S=await Js(),L=S.order.filter(Ee=>!ee.has(Ee)),oe=S.active.filter(Ee=>!ee.has(Ee)),Se=oe.length===0&&L.length>0?[L[0]]:oe;await ku({order:L,labels:HA(S.labels,ee),active:Se});return}catch{}await Us()}function Ni(u,h){if(u.length===0||t.value.length===0)return;const k=t.value.map(oe=>oe.projectName),A=k.indexOf(u);if(A===-1)return;const ee=Math.max(0,Math.min(h,k.length-1)),f=RA(k,A,ee);if(f===k)return;const S=Fo(f,t.value);te.value=S,vs(te.value);const L=Ea(t.value,te.value);t.value=Uo(t.value,L),nt(),Us()}function Di(u){const h=u.trim();if(!h)return;const k=[h,...te.value.filter(ee=>ee!==h)];if(is(te.value,k))return;te.value=k,vs(te.value);const A=Ea(t.value,te.value);t.value=Uo(t.value,A),nt(),Us()}async function Us(){var u,h;try{const k=await Js(),A=new Map;for(const S of k.order){const L=ys(S);A.has(L)||A.set(L,S)}for(const S of t.value){const L=((h=(u=S.threads[0])==null?void 0:u.cwd)==null?void 0:h.trim())??"";L&&A.set(S.projectName,L)}const ee=[];for(const S of te.value){const L=A.get(S);L&&!ee.includes(L)&&ee.push(L)}for(const S of k.order)ee.includes(S)||ee.push(S);const f=k.active.filter(S=>ee.includes(S));f.length===0&&ee.length>0&&f.push(ee[0]),await ku({order:ee,labels:k.labels,active:f})}catch{}}async function Qn(){if(Mt.value){typeof window<"u"&&Ue===null&&(Ue=window.setTimeout(()=>{Ue=null,Qn()},Ta));return}Mt.value=!0;const u=W,h=new Set(ge);W=!1,ge.clear();try{u&&await N();const k=n.value;if(!k)return;const A=h.has(k),ee=l.value[k]===!0,f=vn(k),S=_e.value[k]??"",L=f.length>0&&f!==S;(A||ee||L||u)&&await Q(k,{silent:!0})}catch{}finally{Mt.value=!1,(W||ge.size>0)&&typeof window<"u"&&Ue===null&&(Ue=window.setTimeout(()=>{Ue=null,Qn()},Ta))}}async function Li(){await Yr(),W=!0,n.value&&ge.add(n.value),await Qn()}function ji(){typeof window>"u"||It||(Yr(),It=qk(u=>{if(u.method==="ready"){Li();return}Et(u),Ft(u)}))}async function Yr(){try{const h=(await Jk()).map(k=>bn(k)).filter(k=>k!==null);fr(h)}catch{}}async function Fi(u){try{await Kk(u.id,{result:u.result,error:u.error}),_n(u.id)}catch(h){Be.value=h instanceof Error?h.message:"Failed to reply to server request"}}function Bi(){It&&(It(),It=null),W=!1,ge.clear(),De.clear(),Ue!==null&&typeof window<"u"&&(window.clearTimeout(Ue),Ue=null),be=!1,r.value={},s.value={},o.value={},i.value={},a.value={},le.value={},Me.value={},se.value={},ce.value={},d.value={},je.value=null}const Ui=fe(()=>{const u=n.value;return u?d.value[u]??[]:[]});function Hs(u){const h=n.value;if(!h)return;const k=d.value[h];if(!k)return;const A=k.filter(ee=>ee.id!==u);d.value=A.length>0?{...d.value,[h]:A}:Ut(d.value,h)}function Hi(u){const h=n.value;if(!h)return;const k=d.value[h];if(!k)return;const A=k.find(ee=>ee.id===u);A&&(Hs(u),we(A.collaborationMode),Yn(A.text,A.imageUrls,A.skills,"steer",A.fileAttachments))}function Wi(u){z(u)}return{projectGroups:e,projectDisplayNameById:re,selectedThread:O,selectedThreadScrollState:K,selectedThreadServerRequests:q,selectedLiveOverlay:R,codexQuota:U,selectedThreadId:n,availableCollaborationModes:_,availableModelIds:p,selectedCollaborationMode:j,selectedModelId:$,selectedReasoningEffort:Z,installedSkills:Ve,messages:Y,isLoadingThreads:He,isLoadingMessages:Ae,isSendingMessage:Ze,isInterruptingTurn:Ke,error:Be,refreshAll:Ln,refreshSkills:xt,selectThread:Gt,loadMessages:Q,ensureThreadMessagesLoaded:We,setThreadScrollState:zt,archiveThreadById:un,renameThreadById:jn,sendMessageToSelectedThread:Yn,sendMessageToNewThread:Jr,interruptSelectedThreadTurn:Mi,rollbackSelectedThread:$i,isRollingBack:ot,selectedThreadQueuedMessages:Ui,removeQueuedMessage:Hs,steerQueuedMessage:Hi,setSelectedCollaborationMode:we,setSelectedModelId:G,setSelectedReasoningEffort:Ye,respondToPendingServerRequest:Fi,renameProject:Oi,removeProject:Mo,reorderProject:Ni,pinProjectToTop:Di,startPolling:ji,stopPolling:Bi,primeSelectedThread:Wi}}const YA={class:"sidebar-root"},QA={class:"sidebar-scrollable"},XA=["aria-pressed"],ZA={key:1,class:"sidebar-search-bar"},ex={key:0,class:"sidebar-settings-area"},tx={key:0,class:"sidebar-settings-panel"},nx={class:"sidebar-settings-account-section"},rx={class:"sidebar-settings-account-header"},sx={class:"sidebar-settings-account-header-main"},ox={class:"sidebar-settings-account-count"},ix=["disabled"],ax={key:0,class:"sidebar-settings-account-error"},lx={key:1,class:"sidebar-settings-account-empty"},cx={key:2,class:"sidebar-settings-account-list"},ux=["title"],dx={class:"sidebar-settings-account-main"},fx={class:"sidebar-settings-account-email"},hx={class:"sidebar-settings-account-meta"},px={class:"sidebar-settings-account-quota"},mx={class:"sidebar-settings-account-id"},gx=["disabled","onClick"],vx={class:"sidebar-settings-value"},yx={class:"sidebar-settings-value"},wx={class:"content-root"},bx={class:"content-body"},_x={key:1,class:"content-grid"},kx={class:"new-thread-empty"},Tx={class:"worktree-init-status-title"},Sx={class:"worktree-init-status-message"},Ix={key:2,class:"content-grid"},Ex={class:"content-thread"},Cx={class:"composer-with-queue"},Ax={class:"build-badge","aria-label":"Author name, worktree name, and version"},sd="codex-web-local.sidebar-collapsed.v1",Aa="codex-web-local.last-active-thread-route.v1",od="codex-web-local.send-with-enter.v1",id="codex-web-local.in-progress-send-mode.v1",ad="codex-web-local.dark-mode.v1",ld="codex-web-local.dictation-click-to-toggle.v1",xx=400,Rx=qt({__name:"App",setup(e){const t="codexui",n="1.0.3",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:d,selectedThreadId:c,availableCollaborationModes:p,availableModelIds:_,selectedCollaborationMode:I,selectedModelId:j,selectedReasoningEffort:$,installedSkills:Z,messages:ae,isLoadingThreads:V,isLoadingMessages:te,isSendingMessage:re,isInterruptingTurn:_e,refreshAll:ue,refreshSkills:pe,selectThread:Me,ensureThreadMessagesLoaded:le,setThreadScrollState:se,archiveThreadById:ce,renameThreadById:ne,sendMessageToSelectedThread:xe,sendMessageToNewThread:je,interruptSelectedThreadTurn:Ne,rollbackSelectedThread:Ve,isRollingBack:He,selectedThreadQueuedMessages:Ae,removeQueuedMessage:Ze,steerQueuedMessage:Ke,setSelectedCollaborationMode:ot,setSelectedModelId:Be,setSelectedReasoningEffort:Mt,respondToPendingServerRequest:ut,renameProject:It,removeProject:Ue,reorderProject:W,pinProjectToTop:ge,startPolling:me,stopPolling:be,primeSelectedThread:De}=JA(),T=xv(),E=Av(),{isMobile:O}=jf(),K=D(!1),q=D(!1),R=D(""),U=D("local"),Y=D({order:[],labels:{}}),z=D({phase:"idle",title:"",message:""}),G=D(Fi()),we=D(""),ve=D(!1),ke=D(null),Ie=D(null);let Le=null;const et=D("New Project (1)"),Ye=D(""),Tt=D(!1),Ge=D([]),dt=D(!1),tt=D(!1),nt=D(""),Kt=D(Mo(od,!0)),rt=D(Di()),vt=D(Ni()),Pt=D(Mo(ld,!1)),pt=D(null),xn=D(!1),St=D(!1);let ft=null,vn=!1;const zt=fe(()=>{const f=T.params.threadId;return typeof f=="string"?f:""}),$t=fe(()=>{const f=new Set;for(const S of r.value)for(const L of S.threads)f.add(L.id);return f}),yt=fe(()=>T.name==="home"),Sn=fe(()=>T.name==="skills"),Rn=fe(()=>{var f;return Sn.value?"Skills":yt.value?"New thread":((f=o.value)==null?void 0:f.title)??"Choose a thread"}),yn=fe(()=>ae.value.filter(f=>{const S=Ui(f.messageType,f.role);return S==="worked"?!0:!(S==="turnActivity.live"||S==="turnError.live"||S==="agentReasoning.live")})),Pn=fe(()=>l.value),cn=fe(()=>yt.value?"__new-thread__":c.value),Qt=fe(()=>{var f,S;return yt.value?R.value.trim():((S=(f=o.value)==null?void 0:f.cwd)==null?void 0:S.trim())??""}),Xt=fe(()=>{var f;return!yt.value&&((f=o.value)==null?void 0:f.inProgress)===!0}),dr=fe(()=>re.value||_e.value||He.value||Xt.value||a.value.length>0),Dn=fe(()=>{var oe,Se;const f=[],S=new Set;for(const Ee of Y.value.order){const st=Ee.trim();!st||S.has(st)||(S.add(st),f.push({value:st,label:Y.value.labels[st]||Gt(st)}))}for(const Ee of r.value){const st=((Se=(oe=Ee.threads[0])==null?void 0:oe.cwd)==null?void 0:Se.trim())??"";!st||S.has(st)||(S.add(st),f.push({value:st,label:s.value[Ee.projectName]??Ee.projectName}))}const L=R.value.trim();return L&&!S.has(L)&&f.unshift({value:L,label:Gt(L)}),f}),Zt=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Pr(()=>{window.addEventListener("keydown",Te),document.addEventListener("visibilitychange",he),window.addEventListener("pageshow",ze),window.addEventListener("focus",Nt),Yr(),Zt==null||Zt.addEventListener("change",Yr),Hi(),xt(),Bt(),Q()}),ki(()=>{window.removeEventListener("keydown",Te),document.removeEventListener("visibilitychange",he),window.removeEventListener("pageshow",ze),window.removeEventListener("focus",Nt),Zt==null||Zt.removeEventListener("change",Yr),ft!==null&&(window.clearInterval(ft),ft=null),Le&&(clearTimeout(Le),Le=null),be()}),lt(we,f=>{const S=f.trim();if(Le&&(clearTimeout(Le),Le=null),!S){Ie.value=null;return}Le=setTimeout(()=>{p0(S,1e3).then(L=>{we.value.trim()===S&&(Ie.value=L.threadIds)}).catch(()=>{we.value.trim()===S&&(Ie.value=null)})},220)}),lt(Ge,()=>{if(typeof window>"u")return;if(!Ge.value.some(S=>S.quotaStatus==="loading")){ft!==null&&(window.clearInterval(ft),ft=null);return}ft===null&&(ft=window.setInterval(()=>{vn||(vn=!0,En({silent:!0}).finally(()=>{vn=!1}))},1500))},{deep:!0});function Jt(){pe()}function Fe(){ve.value=!ve.value,ve.value?Wt(()=>{var f;return(f=ke.value)==null?void 0:f.focus()}):we.value=""}function Re(){var f;we.value="",(f=ke.value)==null||f.focus()}function In(f){f.key==="Escape"&&(ve.value=!1,we.value="")}function Ot(f){f&&(T.name==="thread"&&zt.value===f||(E.push({name:"thread",params:{threadId:f}}),O.value&&X(!0)))}async function Mn(f){f&&(c.value!==f&&(await Me(f),await E.push({name:"thread",params:{threadId:f}})),await Wt(),Po())}function wn(f){return f.length>8?f.slice(-8):f}function bn(f){const S=[f.planType||"unknown"];return f.authMode&&S.unshift(f.authMode),S.join(" · ")}function Jn(f){const S=f.quotaSnapshot;if(!S)return null;const L=[S==null?void 0:S.primary,S==null?void 0:S.secondary].filter(Ee=>Ee!==null),oe=L.find(Ee=>Ee.windowMinutes===10080);if(oe)return oe;const Se=L.filter(Ee=>typeof Ee.windowMinutes=="number"&&Ee.windowMinutes>=10080).sort((Ee,st)=>(Ee.windowMinutes??0)-(st.windowMinutes??0))[0]??null;return Se||(S.secondary??null)}function _n(f){var oe,Se;const S=f.quotaSnapshot,L=Jn(f);return L?`${Math.max(0,Math.min(100,100-Math.round(L.usedPercent)))}% weekly remaining`:(oe=S==null?void 0:S.credits)!=null&&oe.unlimited?"Unlimited credits":(Se=S==null?void 0:S.credits)!=null&&Se.hasCredits&&S.credits.balance?`${S.credits.balance} credits`:f.quotaStatus==="loading"?"Loading quota…":f.quotaStatus==="error"?f.quotaError||"Quota unavailable":"Fetching account details…"}function fr(f){return[f.email||"Account",bn(f),_n(f),`Workspace ${f.accountId}`].filter(Boolean).join(`
1439
+ `)}async function En(f={}){try{const S=await Qk();Ge.value=S.accounts}catch(S){if(f.silent===!0)return;nt.value=S instanceof Error?S.message:"Failed to load accounts"}}async function Cn(){if(!(dt.value||tt.value)){nt.value="",dt.value=!0;try{const f=await Xk();Ge.value=f.accounts,be(),me(),ue({includeSelectedThreadMessages:!0})}catch(f){nt.value=f instanceof Error?f.message:"Failed to refresh accounts"}finally{dt.value=!1}}}async function x(f){if(!(tt.value||dt.value)){if(dr.value){nt.value="Finish the current turn and pending requests before switching accounts.";return}nt.value="",tt.value=!0;try{const S=await Zk(f);Ge.value=Ge.value.map(L=>L.accountId===f?S:{...L,isActive:!1}),be(),me(),ue({includeSelectedThreadMessages:!0}),En({silent:!0})}catch(S){nt.value=S instanceof Error?S.message:"Failed to switch account"}finally{tt.value=!1}}}function F(f){ce(f)}function ie(f){var oe,Se;const S=r.value.find(Ee=>Ee.projectName===f),L=((Se=(oe=S==null?void 0:S.threads[0])==null?void 0:oe.cwd)==null?void 0:Se.trim())??"";L&&(R.value=L),O.value&&X(!0),!yt.value&&E.push({name:"home"})}function Oe(f){var oe,Se;const S=r.value.find(Ee=>Ee.projectName===f),L=((Se=(oe=S==null?void 0:S.threads[0])==null?void 0:oe.cwd)==null?void 0:Se.trim())??"";!L||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(L)}`,"_blank","noopener,noreferrer")}function v(){var S,L;const f=((L=(S=o.value)==null?void 0:S.cwd)==null?void 0:L.trim())??"";f&&(R.value=f),O.value&&X(!0),!yt.value&&E.push({name:"home"})}function g(f){It(f.projectName,f.displayName)}function w(f){ne(f.threadId,f.title)}async function M(f){await Ue(f),await Bt(),Q()}function B(f){W(f.projectName,f.toIndex)}function J(f){se(f.threadId,f.state)}function Ce(f){ut(f)}function X(f){G.value!==f&&(G.value=f,Bi(f))}function Te(f){f.defaultPrevented||!f.ctrlKey&&!f.metaKey||f.shiftKey||f.altKey||f.key.toLowerCase()==="b"&&(f.preventDefault(),X(!G.value))}function he(){if(!(typeof document>"u")&&O.value){if(document.visibilityState==="hidden"){pt.value=Date.now(),xn.value=!1;return}Dt()}}function ze(f){f.persisted&&Dt()}function Nt(){Dt()}function Dt(){typeof window>"u"||typeof document>"u"||!O.value||document.visibilityState!=="visible"||xn.value||pt.value===null||Date.now()-pt.value<xx||(xn.value=!0,pt.value=null,Et())}async function Et(){if(!St.value){St.value=!0;try{await ue({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await k(),await A()}finally{St.value=!1}}}function Ft(f){const S=f.text;if(yt.value){ee(S,f.imageUrls,f.skills,f.fileAttachments);return}xe(S,f.imageUrls,f.skills,f.mode,f.fileAttachments)}function Bs(f){R.value=f.trim()}async function C(f){const S=f.trim();if(!S)return;const L=N(S),oe=await P(),Se=L?S:un(oe,S);if(Se)try{const Ee=await d0(Se,{createIfMissing:!L,label:L?"":S});Ee&&(R.value=Ee,ge(Gt(Ee)),Bt(),Q())}catch{}}async function P(){const f=We();if(f)return f;try{const S=await _u();if(S)return Ye.value=S,S}catch{}return""}function N(f){return f?f.startsWith("~/")||f.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(f):!1}async function Q(){const f=We();if(!f){et.value="New Project (1)";return}try{const S=await f0(f);et.value=S.name||"New Project (1)"}catch{et.value="New Project (1)"}}function We(){var L,oe;const f=R.value.trim();if(f)return Ln(f);const S=((oe=(L=Dn.value[0])==null?void 0:L.value)==null?void 0:oe.trim())??"";return S?Ln(S):Ye.value.trim()}async function xt(){try{Ye.value=await _u()}catch{Ye.value=""}}async function Bt(){try{const f=await Js();Y.value={order:[...f.order],labels:{...f.labels}}}catch{Y.value={order:[],labels:{}}}}function Ln(f){const S=f.trim().replace(/\/+$/,"");if(!S)return"";const L=S.lastIndexOf("/");return L<=0?"":S.slice(0,L)}function Gt(f){const S=f.trim().replace(/\/+$/,"");if(!S)return"";const L=S.lastIndexOf("/");return L<0?S:S.slice(L+1)}function un(f,S){const L=f.trim().replace(/\/+$/,""),oe=S.trim().replace(/^\/+/,"");return!L||!oe?"":`${L}/${oe}`}function jn(f){Be(f)}function Yn(f){Mt(f)}function Jr(){Ne()}function ps(f){Ve(f.turnIndex)}function Po(){if(yt.value||Sn.value||typeof document>"u"||!o.value||yn.value.length===0)return;const f=Mi(),S=$i(),L=new Blob([f],{type:"text/markdown;charset=utf-8"}),oe=URL.createObjectURL(L),Se=document.createElement("a");Se.href=oe,Se.download=S,document.body.appendChild(Se),Se.click(),document.body.removeChild(Se),window.setTimeout(()=>URL.revokeObjectURL(oe),0)}function Mi(){var L,oe,Se;const f=[],S=((oe=(L=o.value)==null?void 0:L.title)==null?void 0:oe.trim())||"Untitled thread";f.push(`# ${Oi(S)}`),f.push(""),f.push(`- Exported: ${new Date().toISOString()}`),f.push(`- Thread ID: ${((Se=o.value)==null?void 0:Se.id)??""}`),f.push(""),f.push("---"),f.push("");for(const Ee of yn.value){const st=Ee.role?Ee.role.toUpperCase():"MESSAGE";f.push(`## ${st}`),f.push("");const kn=Ee.text.trim();if(kn&&(f.push(kn),f.push("")),Ee.commandExecution&&(f.push("```text"),f.push(`command: ${Ee.commandExecution.command}`),f.push(`status: ${Ee.commandExecution.status}`),Ee.commandExecution.cwd&&f.push(`cwd: ${Ee.commandExecution.cwd}`),Ee.commandExecution.exitCode!==null&&f.push(`exitCode: ${Ee.commandExecution.exitCode}`),f.push(Ee.commandExecution.aggregatedOutput||"(no output)"),f.push("```"),f.push("")),Ee.fileAttachments&&Ee.fileAttachments.length>0){f.push("Attachments:");for(const Fn of Ee.fileAttachments)f.push(`- ${Fn.path}`);f.push("")}if(Ee.images&&Ee.images.length>0){f.push("Images:");for(const Fn of Ee.images)f.push(`- ${Fn}`);f.push("")}}return`${f.join(`
1440
+ `).trimEnd()}
1441
+ `}function $i(){var Se,Ee;const L=(((Ee=(Se=o.value)==null?void 0:Se.title)==null?void 0:Ee.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",oe=new Date().toISOString().replace(/[:.]/g,"-");return`${L}-${oe}.md`}function Oi(f){return f.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Mo(f,S){if(typeof window>"u")return S;const L=window.localStorage.getItem(f);return L===null?S:L==="1"}function Ni(){if(typeof window>"u")return"system";const f=window.localStorage.getItem(ad);return f==="light"||f==="dark"?f:"system"}function Di(){return typeof window>"u"?"queue":window.localStorage.getItem(id)==="steer"?"steer":"queue"}function Us(){Kt.value=!Kt.value,window.localStorage.setItem(od,Kt.value?"1":"0")}function Qn(){rt.value=rt.value==="steer"?"queue":"steer",window.localStorage.setItem(id,rt.value)}function Li(){const f=["system","light","dark"],S=f.indexOf(vt.value);vt.value=f[(S+1)%f.length],window.localStorage.setItem(ad,vt.value),Yr()}function ji(){Pt.value=!Pt.value,window.localStorage.setItem(ld,Pt.value?"1":"0")}function Yr(){const f=document.documentElement;if(vt.value==="dark")f.classList.add("dark");else if(vt.value==="light")f.classList.remove("dark");else{const S=window.matchMedia("(prefers-color-scheme: dark)").matches;f.classList.toggle("dark",S)}}function Fi(){return typeof window>"u"?!1:window.localStorage.getItem(sd)==="1"}function Bi(f){typeof window>"u"||window.localStorage.setItem(sd,f?"1":"0")}function Ui(f,S){const L=(f??"").trim();return L.length>0?L:S.trim()||"message"}function Hs(f){ot(f)}async function Hi(){await E.isReady(),T.name==="thread"&&zt.value&&De(zt.value),me(),await ue({includeSelectedThreadMessages:!0}),En({silent:!0}),await k(),q.value=!0,await A()}function Wi(){if(typeof window>"u")return null;try{const f=window.localStorage.getItem(Aa);if(!f)return null;const S=JSON.parse(f);return!S||S.routeName!=="thread"||typeof S.threadId!="string"||S.threadId.trim().length===0||typeof S.updatedAtIso!="string"||S.updatedAtIso.trim().length===0?null:{routeName:"thread",threadId:S.threadId.trim(),updatedAtIso:S.updatedAtIso}}catch{return null}}function u(f){if(typeof window>"u")return;const S=f.trim();if(!S)return;const L={routeName:"thread",threadId:S,updatedAtIso:new Date().toISOString()};window.localStorage.setItem(Aa,JSON.stringify(L))}function h(){typeof window>"u"||window.localStorage.removeItem(Aa)}async function k(){if(T.name!=="home")return!1;const f=Wi(),S=c.value.trim(),L=(f==null?void 0:f.threadId)??S;return L?$t.value.has(L)?(await E.replace({name:"thread",params:{threadId:L}}),!0):((f==null?void 0:f.threadId)===L&&h(),!1):!1}async function A(){if(!K.value){K.value=!0;try{if(T.name==="home"||T.name==="skills"){c.value!==""&&await Me("");return}if(T.name==="thread"){const f=zt.value;if(!f)return;if(!$t.value.has(f)){await E.replace({name:"home"});return}c.value!==f?await Me(f):le(f,{silent:!0});return}}finally{K.value=!1}}}lt(()=>[T.name,zt.value,c.value,q.value],([f,S,L,oe])=>{if(!oe||f!=="thread")return;const Se=(S||L).trim();Se&&$t.value.has(Se)&&u(Se)}),lt(()=>[T.name,zt.value,V.value,$t.value.has(zt.value),c.value],async()=>{q.value&&await A()}),lt(()=>c.value,async f=>{if(q.value&&!K.value&&!(yt.value||Sn.value)){if(!f){T.name!=="home"&&await E.replace({name:"home"});return}T.name==="thread"&&zt.value===f||await E.replace({name:"thread",params:{threadId:f}})}}),lt(()=>[q.value,T.name,c.value],([f,S,L])=>{f&&S==="thread"&&L&&le(L,{silent:!0})}),lt(()=>Dn.value,f=>{if(f.length===0){R.value="";return}f.some(L=>L.value===R.value)||(R.value=f[0].value),Q()},{immediate:!0}),lt(()=>R.value,()=>{z.value={phase:"idle",title:"",message:""},Q()}),lt(()=>U.value,f=>{f==="local"&&(z.value={phase:"idle",title:"",message:""})}),lt(()=>T.name,f=>{f!=="home"&&(z.value={phase:"idle",title:"",message:""})}),lt(()=>c.value,()=>{z.value={phase:"idle",title:"",message:""}}),lt(O,f=>{f&&!G.value&&X(!0)});async function ee(f,S=[],L=[],oe=[]){try{z.value={phase:"idle",title:"",message:""};let Se=R.value;if(U.value==="worktree"){z.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const st=await u0(R.value);Se=st.cwd,R.value=st.cwd,z.value={phase:"idle",title:"",message:""}}catch{z.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Ee=await je(f,Se,S,L,oe);if(!Ee)return;await E.replace({name:"thread",params:{threadId:Ee}})}catch{}}return(f,S)=>(m(),b(Pe,null,[$e(Nv,{"is-sidebar-collapsed":G.value,onCloseSidebar:S[6]||(S[6]=L=>X(!0))},{sidebar:wt(()=>[y("section",YA,[y("div",QA,[G.value?de("",!0):(m(),ht(ed,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":G.value,"show-new-thread-button":!0,onToggleSidebar:S[0]||(S[0]=L=>X(!G.value)),onStartNewThread:v},{default:wt(()=>[y("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":ve.value,"aria-label":"Search threads",title:"Search threads",onClick:Fe},[$e(Qa,{class:"sidebar-search-toggle-icon"})],8,XA)]),_:1},8,["is-sidebar-collapsed"])),!G.value&&ve.value?(m(),b("div",ZA,[$e(Qa,{class:"sidebar-search-bar-icon"}),Er(y("input",{ref_key:"sidebarSearchInputRef",ref:ke,"onUpdate:modelValue":S[1]||(S[1]=L=>we.value=L),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:In},null,544),[[Cr,we.value]]),we.value.length>0?(m(),b("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Re},[$e(Ol,{class:"sidebar-search-clear-icon"})])):de("",!0)])):de("",!0),G.value?de("",!0):(m(),b("button",{key:2,class:at(["sidebar-skills-link",{"is-active":Sn.value}]),type:"button",onClick:S[2]||(S[2]=L=>{ye(E).push({name:"skills"}),ye(O)&&X(!0)})}," Skills Hub ",2)),G.value?de("",!0):(m(),ht(bw,{key:3,groups:ye(r),"project-display-name-by-id":ye(s),"selected-thread-id":ye(c),"is-loading":ye(V),"search-query":we.value,"search-matched-thread-ids":Ie.value,onSelect:Ot,onArchive:F,onStartNewThread:ie,onRenameProject:g,onBrowseProjectFiles:Oe,onRenameThread:w,onRemoveProject:M,onReorderProject:B,onExportThread:Mn},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),G.value?de("",!0):(m(),b("div",ex,[$e(If,{name:"settings-panel"},{default:wt(()=>[Tt.value?(m(),b("div",tx,[y("div",nx,[y("div",rx,[y("div",sx,[S[7]||(S[7]=y("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),y("span",ox,H(Ge.value.length),1)]),y("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:dt.value||tt.value,onClick:Cn},H(dt.value?"Reloading…":"Reload"),9,ix)]),nt.value?(m(),b("p",ax,H(nt.value),1)):de("",!0),Ge.value.length===0?(m(),b("p",lx," Run `codex login`, then click reload. ")):(m(),b("div",cx,[(m(!0),b(Pe,null,it(Ge.value,L=>(m(),b("article",{key:L.accountId,class:at(["sidebar-settings-account-item",{"is-active":L.isActive}]),title:fr(L)},[y("div",dx,[y("p",fx,H(L.email||"Account"),1),y("p",hx,H(bn(L)),1),y("p",px,H(_n(L)),1),y("p",mx," Workspace "+H(wn(L.accountId)),1)]),y("button",{class:"sidebar-settings-account-switch",type:"button",disabled:tt.value||L.isActive,onClick:oe=>x(L.accountId)},H(L.isActive?"Active":tt.value?"Switching…":"Switch"),9,gx)],10,ux))),128))]))]),y("button",{class:"sidebar-settings-row",type:"button",onClick:Us},[S[8]||(S[8]=y("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),y("span",{class:at(["sidebar-settings-toggle",{"is-on":!Kt.value}])},null,2)]),y("button",{class:"sidebar-settings-row",type:"button",onClick:Qn},[S[9]||(S[9]=y("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),y("span",vx,H(rt.value==="steer"?"Steer":"Queue"),1)]),y("button",{class:"sidebar-settings-row",type:"button",onClick:Li},[S[10]||(S[10]=y("span",{class:"sidebar-settings-label"},"Appearance",-1)),y("span",yx,H(vt.value==="system"?"System":vt.value==="dark"?"Dark":"Light"),1)]),y("button",{class:"sidebar-settings-row",type:"button",onClick:ji},[S[11]||(S[11]=y("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),y("span",{class:at(["sidebar-settings-toggle",{"is-on":Pt.value}])},null,2)])])):de("",!0)]),_:1}),y("button",{class:"sidebar-settings-button",type:"button",onClick:S[3]||(S[3]=L=>Tt.value=!Tt.value)},[$e(bA,{class:"sidebar-settings-icon"}),S[12]||(S[12]=y("span",null,"Settings",-1))])]))])]),content:wt(()=>[y("section",wx,[$e(Ew,{title:Rn.value},{leading:wt(()=>[G.value||ye(O)?(m(),ht(ed,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":G.value,"show-new-thread-button":!0,onToggleSidebar:S[4]||(S[4]=L=>X(!G.value)),onStartNewThread:v},null,8,["is-sidebar-collapsed"])):de("",!0)]),_:1},8,["title"]),y("section",bx,[Sn.value?(m(),ht(oA,{key:0,onSkillsChanged:Jt})):yt.value?(m(),b("div",_x,[y("div",kx,[S[13]||(S[13]=y("p",{class:"new-thread-hero"},"Let's build",-1)),$e(Ya,{class:"new-thread-folder-dropdown","model-value":R.value,options:Dn.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":et.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":Bs,onAdd:C},null,8,["model-value","options","default-add-value"]),$e(dS,{class:"new-thread-runtime-dropdown",modelValue:U.value,"onUpdate:modelValue":S[5]||(S[5]=L=>U.value=L)},null,8,["modelValue"]),z.value.phase!=="idle"?(m(),b("div",{key:0,class:at(["worktree-init-status",{"is-running":z.value.phase==="running","is-error":z.value.phase==="error"}])},[y("strong",Tx,H(z.value.title),1),y("span",Sx,H(z.value.message),1)],2)):de("",!0)]),$e(Iu,{"active-thread-id":cn.value,cwd:Qt.value,"collaboration-modes":ye(p),"selected-collaboration-mode":ye(I),models:ye(_),"selected-model":ye(j),"selected-reasoning-effort":ye($),skills:ye(Z),"codex-quota":ye(d),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":Kt.value,"in-progress-submit-mode":rt.value,"dictation-click-to-toggle":Pt.value,onSubmit:Ft,"onUpdate:selectedCollaborationMode":Hs,"onUpdate:selectedModel":jn,"onUpdate:selectedReasoningEffort":Yn},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"])])):(m(),b("div",Ix,[y("div",Ex,[$e(gk,{messages:yn.value,"is-loading":ye(te),"active-thread-id":cn.value,cwd:Qt.value,"scroll-state":ye(i),"live-overlay":Pn.value,"pending-requests":ye(a),"is-turn-in-progress":Xt.value,"is-rolling-back":ye(He),onUpdateScrollState:J,onRespondServerRequest:Ce,onRollback:ps},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),y("div",Cx,[$e(rS,{messages:ye(Ae),onSteer:ye(Ke),onDelete:ye(Ze)},null,8,["messages","onSteer","onDelete"]),$e(Iu,{"active-thread-id":cn.value,cwd:Qt.value,"collaboration-modes":ye(p),"selected-collaboration-mode":ye(I),models:ye(_),"selected-model":ye(j),"selected-reasoning-effort":ye($),skills:ye(Z),"codex-quota":ye(d),"is-turn-in-progress":Xt.value,"is-interrupting-turn":ye(_e),"has-queue-above":ye(Ae).length>0,"send-with-enter":Kt.value,"in-progress-submit-mode":rt.value,"dictation-click-to-toggle":Pt.value,"onUpdate:selectedCollaborationMode":Hs,onSubmit:Ft,"onUpdate:selectedModel":jn,"onUpdate:selectedReasoningEffort":Yn,onInterrupt:Jr},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"]),y("div",Ax," nervmor "+H(ye(t))+" · v"+H(ye(n)),1)],64))}}),Px=ct(Rx,[["__scopeId","data-v-2691e7d4"]]),xa={render:()=>null},Mx=Cv({history:ov(),routes:[{path:"/",name:"home",component:xa},{path:"/thread/:threadId",name:"thread",component:xa},{path:"/skills",name:"skills",component:xa},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");yg(Px).use(Mx).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});