codexapp 0.1.48 → 0.1.50

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.
@@ -1,1428 +0,0 @@
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 Wa(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const _t={},es=[],Fn=()=>{},Vu=()=>!1,Yo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),qa=e=>e.startsWith("onUpdate:"),Ot=Object.assign,za=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},yh=Object.prototype.hasOwnProperty,dt=(e,t)=>yh.call(e,t),Ue=Array.isArray,ts=e=>eo(e)==="[object Map]",Wu=e=>eo(e)==="[object Set]",Nl=e=>eo(e)==="[object Date]",ze=e=>typeof e=="function",It=e=>typeof e=="string",En=e=>typeof e=="symbol",pt=e=>e!==null&&typeof e=="object",qu=e=>(pt(e)||ze(e))&&ze(e.then)&&ze(e.catch),zu=Object.prototype.toString,eo=e=>zu.call(e),wh=e=>eo(e).slice(8,-1),Gu=e=>eo(e)==="[object Object]",Ga=e=>It(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,xs=Wa(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Xo=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},bh=/-\w/g,en=Xo(e=>e.replace(bh,t=>t.slice(1).toUpperCase())),_h=/\B([A-Z])/g,Sr=Xo(e=>e.replace(_h,"-$1").toLowerCase()),Qo=Xo(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ri=Xo(e=>e?`on${Qo(e)}`:""),Ln=(e,t)=>!Object.is(e,t),To=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Ku=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Ka=e=>{const t=parseFloat(e);return isNaN(t)?e:t},kh=e=>{const t=It(e)?Number(e):NaN;return isNaN(t)?e:t};let $l;const Zo=()=>$l||($l=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function zr(e){if(Ue(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=It(r)?Eh(r):zr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(It(e)||pt(e))return e}const Th=/;(?![^(]*\))/g,Sh=/:([^]+)/,Ih=/\/\*[^]*?\*\//g;function Eh(e){const t={};return e.replace(Ih,"").split(Th).forEach(n=>{if(n){const r=n.split(Sh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function at(e){let t="";if(It(e))t=e;else if(Ue(e))for(let n=0;n<e.length;n++){const r=at(e[n]);r&&(t+=r+" ")}else if(pt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Ch="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Ah=Wa(Ch);function Ju(e){return!!e||e===""}function Rh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ja(e[r],t[r]);return n}function Ja(e,t){if(e===t)return!0;let n=Nl(e),r=Nl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=En(e),r=En(t),n||r)return e===t;if(n=Ue(e),r=Ue(t),n||r)return n&&r?Rh(e,t):!1;if(n=pt(e),r=pt(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||!Ja(e[i],t[i]))return!1}}return String(e)===String(t)}const Yu=e=>!!(e&&e.__v_isRef===!0),se=e=>It(e)?e:e==null?"":Ue(e)||pt(e)&&(e.toString===zu||!ze(e.toString))?Yu(e)?se(e.value):JSON.stringify(e,Xu,2):String(e),Xu=(e,t)=>Yu(t)?Xu(e,t.value):ts(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[Pi(r,o)+" =>"]=s,n),{})}:Wu(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Pi(n))}:En(t)?Pi(t):pt(t)&&!Ue(t)&&!Gu(t)?String(t):t,Pi=(e,t="")=>{var n;return En(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 an;class Ph{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=an,!t&&an&&(this.index=(an.scopes||(an.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=an;try{return an=this,t()}finally{an=n}}}on(){++this._on===1&&(this.prevScope=an,an=this)}off(){this._on>0&&--this._on===0&&(an=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 xh(){return an}let Tt;const xi=new WeakSet;class Qu{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,an&&an.active&&an.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,xi.has(this)&&(xi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||ed(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Dl(this),td(this);const t=Tt,n=Tn;Tt=this,Tn=!0;try{return this.fn()}finally{nd(this),Tt=t,Tn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Qa(t);this.deps=this.depsTail=void 0,Dl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?xi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ua(this)&&this.run()}get dirty(){return ua(this)}}let Zu=0,Ms,Os;function ed(e,t=!1){if(e.flags|=8,t){e.next=Os,Os=e;return}e.next=Ms,Ms=e}function Ya(){Zu++}function Xa(){if(--Zu>0)return;if(Os){let t=Os;for(Os=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Ms;){let t=Ms;for(Ms=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 td(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function nd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Qa(r),Mh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function ua(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(rd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function rd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Bs)||(e.globalVersion=Bs,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ua(e))))return;e.flags|=2;const t=e.dep,n=Tt,r=Tn;Tt=e,Tn=!0;try{td(e);const s=e.fn(e._value);(t.version===0||Ln(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Tt=n,Tn=r,nd(e),e.flags&=-3}}function Qa(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)Qa(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Mh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Tn=!0;const sd=[];function er(){sd.push(Tn),Tn=!1}function tr(){const e=sd.pop();Tn=e===void 0?!0:e}function Dl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Tt;Tt=void 0;try{t()}finally{Tt=n}}}let Bs=0;class Oh{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 Za{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(!Tt||!Tn||Tt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Tt)n=this.activeLink=new Oh(Tt,this),Tt.deps?(n.prevDep=Tt.depsTail,Tt.depsTail.nextDep=n,Tt.depsTail=n):Tt.deps=Tt.depsTail=n,od(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=Tt.depsTail,n.nextDep=void 0,Tt.depsTail.nextDep=n,Tt.depsTail=n,Tt.deps===n&&(Tt.deps=r)}return n}trigger(t){this.version++,Bs++,this.notify(t)}notify(t){Ya();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Xa()}}}function od(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)od(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const da=new WeakMap,Vr=Symbol(""),fa=Symbol(""),Fs=Symbol("");function Vt(e,t,n){if(Tn&&Tt){let r=da.get(e);r||da.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Za),s.map=r,s.key=n),s.track()}}function Jn(e,t,n,r,s,o){const i=da.get(e);if(!i){Bs++;return}const a=l=>{l&&l.trigger()};if(Ya(),t==="clear")i.forEach(a);else{const l=Ue(e),d=l&&Ga(n);if(l&&n==="length"){const u=Number(r);i.forEach((h,g)=>{(g==="length"||g===Fs||!En(g)&&g>=u)&&a(h)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),d&&a(i.get(Fs)),t){case"add":l?d&&a(i.get("length")):(a(i.get(Vr)),ts(e)&&a(i.get(fa)));break;case"delete":l||(a(i.get(Vr)),ts(e)&&a(i.get(fa)));break;case"set":ts(e)&&a(i.get(Vr));break}}Xa()}function Jr(e){const t=lt(e);return t===e?t:(Vt(t,"iterate",Fs),vn(e)?t:t.map(Cn))}function ei(e){return Vt(e=lt(e),"iterate",Fs),e}function $n(e,t){return nr(e)?cs(Wr(e)?Cn(t):t):Cn(t)}const Nh={__proto__:null,[Symbol.iterator](){return Mi(this,Symbol.iterator,e=>$n(this,e))},concat(...e){return Jr(this).concat(...e.map(t=>Ue(t)?Jr(t):t))},entries(){return Mi(this,"entries",e=>(e[1]=$n(this,e[1]),e))},every(e,t){return Wn(this,"every",e,t,void 0,arguments)},filter(e,t){return Wn(this,"filter",e,t,n=>n.map(r=>$n(this,r)),arguments)},find(e,t){return Wn(this,"find",e,t,n=>$n(this,n),arguments)},findIndex(e,t){return Wn(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Wn(this,"findLast",e,t,n=>$n(this,n),arguments)},findLastIndex(e,t){return Wn(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Wn(this,"forEach",e,t,void 0,arguments)},includes(...e){return Oi(this,"includes",e)},indexOf(...e){return Oi(this,"indexOf",e)},join(e){return Jr(this).join(e)},lastIndexOf(...e){return Oi(this,"lastIndexOf",e)},map(e,t){return Wn(this,"map",e,t,void 0,arguments)},pop(){return Ss(this,"pop")},push(...e){return Ss(this,"push",e)},reduce(e,...t){return Ll(this,"reduce",e,t)},reduceRight(e,...t){return Ll(this,"reduceRight",e,t)},shift(){return Ss(this,"shift")},some(e,t){return Wn(this,"some",e,t,void 0,arguments)},splice(...e){return Ss(this,"splice",e)},toReversed(){return Jr(this).toReversed()},toSorted(e){return Jr(this).toSorted(e)},toSpliced(...e){return Jr(this).toSpliced(...e)},unshift(...e){return Ss(this,"unshift",e)},values(){return Mi(this,"values",e=>$n(this,e))}};function Mi(e,t,n){const r=ei(e),s=r[t]();return r!==e&&!vn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const $h=Array.prototype;function Wn(e,t,n,r,s,o){const i=ei(e),a=i!==e&&!vn(e),l=i[t];if(l!==$h[t]){const h=l.apply(e,o);return a?Cn(h):h}let d=n;i!==e&&(a?d=function(h,g){return n.call(this,$n(e,h),g,e)}:n.length>2&&(d=function(h,g){return n.call(this,h,g,e)}));const u=l.call(i,d,r);return a&&s?s(u):u}function Ll(e,t,n,r){const s=ei(e),o=s!==e&&!vn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(d,u,h){return a&&(a=!1,d=$n(e,d)),n.call(this,d,$n(e,u),h,e)}):n.length>3&&(i=function(d,u,h){return n.call(this,d,u,h,e)}));const l=s[t](i,...r);return a?$n(e,l):l}function Oi(e,t,n){const r=lt(e);Vt(r,"iterate",Fs);const s=r[t](...n);return(s===-1||s===!1)&&nl(n[0])?(n[0]=lt(n[0]),r[t](...n)):s}function Ss(e,t,n=[]){er(),Ya();const r=lt(e)[t].apply(e,n);return Xa(),tr(),r}const Dh=Wa("__proto__,__v_isRef,__isVue"),id=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(En));function Lh(e){En(e)||(e=String(e));const t=lt(this);return Vt(t,"has",e),t.hasOwnProperty(e)}class ad{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?Gh:dd:o?ud:cd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ue(t);if(!s){let l;if(i&&(l=Nh[n]))return l;if(n==="hasOwnProperty")return Lh}const a=Reflect.get(t,n,zt(t)?t:r);if((En(n)?id.has(n):Dh(n))||(s||Vt(t,"get",n),o))return a;if(zt(a)){const l=i&&Ga(n)?a:a.value;return s&&pt(l)?pa(l):l}return pt(a)?s?pa(a):ti(a):a}}class ld extends ad{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ue(t)&&Ga(n);if(!this._isShallow){const d=nr(o);if(!vn(r)&&!nr(r)&&(o=lt(o),r=lt(r)),!i&&zt(o)&&!zt(r))return d||(o.value=r),!0}const a=i?Number(n)<t.length:dt(t,n),l=Reflect.set(t,n,r,zt(t)?t:s);return t===lt(s)&&(a?Ln(r,o)&&Jn(t,"set",n,r):Jn(t,"add",n,r)),l}deleteProperty(t,n){const r=dt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Jn(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!En(n)||!id.has(n))&&Vt(t,"has",n),r}ownKeys(t){return Vt(t,"iterate",Ue(t)?"length":Vr),Reflect.ownKeys(t)}}class jh extends ad{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Uh=new ld,Bh=new jh,Fh=new ld(!0);const ha=e=>e,po=e=>Reflect.getPrototypeOf(e);function Hh(e,t,n){return function(...r){const s=this.__v_raw,o=lt(s),i=ts(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,d=s[e](...r),u=n?ha:t?cs:Cn;return!t&&Vt(o,"iterate",l?fa:Vr),Ot(Object.create(d),{next(){const{value:h,done:g}=d.next();return g?{value:h,done:g}:{value:a?[u(h[0]),u(h[1])]:u(h),done:g}}})}}function mo(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Vh(e,t){const n={get(s){const o=this.__v_raw,i=lt(o),a=lt(s);e||(Ln(s,a)&&Vt(i,"get",s),Vt(i,"get",a));const{has:l}=po(i),d=t?ha:e?cs:Cn;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&&Vt(lt(s),"iterate",Vr),s.size},has(s){const o=this.__v_raw,i=lt(o),a=lt(s);return e||(Ln(s,a)&&Vt(i,"has",s),Vt(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=lt(a),d=t?ha:e?cs:Cn;return!e&&Vt(l,"iterate",Vr),a.forEach((u,h)=>s.call(o,d(u),d(h),i))}};return Ot(n,e?{add:mo("add"),set:mo("set"),delete:mo("delete"),clear:mo("clear")}:{add(s){const o=lt(this),i=po(o),a=lt(s),l=!t&&!vn(s)&&!nr(s)?a:s;return i.has.call(o,l)||Ln(s,l)&&i.has.call(o,s)||Ln(a,l)&&i.has.call(o,a)||(o.add(l),Jn(o,"add",l,l)),this},set(s,o){!t&&!vn(o)&&!nr(o)&&(o=lt(o));const i=lt(this),{has:a,get:l}=po(i);let d=a.call(i,s);d||(s=lt(s),d=a.call(i,s));const u=l.call(i,s);return i.set(s,o),d?Ln(o,u)&&Jn(i,"set",s,o):Jn(i,"add",s,o),this},delete(s){const o=lt(this),{has:i,get:a}=po(o);let l=i.call(o,s);l||(s=lt(s),l=i.call(o,s)),a&&a.call(o,s);const d=o.delete(s);return l&&Jn(o,"delete",s,void 0),d},clear(){const s=lt(this),o=s.size!==0,i=s.clear();return o&&Jn(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Hh(s,e,t)}),n}function el(e,t){const n=Vh(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(dt(n,s)&&s in r?n:r,s,o)}const Wh={get:el(!1,!1)},qh={get:el(!1,!0)},zh={get:el(!0,!1)};const cd=new WeakMap,ud=new WeakMap,dd=new WeakMap,Gh=new WeakMap;function Kh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Jh(e){return e.__v_skip||!Object.isExtensible(e)?0:Kh(wh(e))}function ti(e){return nr(e)?e:tl(e,!1,Uh,Wh,cd)}function fd(e){return tl(e,!1,Fh,qh,ud)}function pa(e){return tl(e,!0,Bh,zh,dd)}function tl(e,t,n,r,s){if(!pt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Jh(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 Wr(e){return nr(e)?Wr(e.__v_raw):!!(e&&e.__v_isReactive)}function nr(e){return!!(e&&e.__v_isReadonly)}function vn(e){return!!(e&&e.__v_isShallow)}function nl(e){return e?!!e.__v_raw:!1}function lt(e){const t=e&&e.__v_raw;return t?lt(t):e}function Yh(e){return!dt(e,"__v_skip")&&Object.isExtensible(e)&&Ku(e,"__v_skip",!0),e}const Cn=e=>pt(e)?ti(e):e,cs=e=>pt(e)?pa(e):e;function zt(e){return e?e.__v_isRef===!0:!1}function j(e){return hd(e,!1)}function Xh(e){return hd(e,!0)}function hd(e,t){return zt(e)?e:new Qh(e,t)}class Qh{constructor(t,n){this.dep=new Za,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:lt(t),this._value=n?t:Cn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||vn(t)||nr(t);t=r?t:lt(t),Ln(t,n)&&(this._rawValue=t,this._value=r?t:Cn(t),this.dep.trigger())}}function we(e){return zt(e)?e.value:e}const Zh={get:(e,t,n)=>t==="__v_raw"?e:we(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return zt(s)&&!zt(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function pd(e){return Wr(e)?e:new Proxy(e,Zh)}class ep{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Za(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Bs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Tt!==this)return ed(this,!0),!0}get value(){const t=this.dep.track();return rd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function tp(e,t,n=!1){let r,s;return ze(e)?r=e:(r=e.get,s=e.set),new ep(r,s,n)}const go={},Oo=new WeakMap;let Lr;function np(e,t=!1,n=Lr){if(n){let r=Oo.get(n);r||Oo.set(n,r=[]),r.push(e)}}function rp(e,t,n=_t){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,d=B=>s?B:vn(B)||s===!1||s===0?Yn(B,1):Yn(B);let u,h,g,T,H=!1,M=!1;if(zt(e)?(h=()=>e.value,H=vn(e)):Wr(e)?(h=()=>d(e),H=!0):Ue(e)?(M=!0,H=e.some(B=>Wr(B)||vn(B)),h=()=>e.map(B=>{if(zt(B))return B.value;if(Wr(B))return d(B);if(ze(B))return l?l(B,2):B()})):ze(e)?t?h=l?()=>l(e,2):e:h=()=>{if(g){er();try{g()}finally{tr()}}const B=Lr;Lr=u;try{return l?l(e,3,[T]):e(T)}finally{Lr=B}}:h=Fn,t&&s){const B=h,ce=s===!0?1/0:s;h=()=>Yn(B(),ce)}const D=xh(),N=()=>{u.stop(),D&&D.active&&za(D.effects,u)};if(o&&t){const B=t;t=(...ce)=>{B(...ce),N()}}let P=M?new Array(e.length).fill(go):go;const V=B=>{if(!(!(u.flags&1)||!u.dirty&&!B))if(t){const ce=u.run();if(s||H||(M?ce.some((de,me)=>Ln(de,P[me])):Ln(ce,P))){g&&g();const de=Lr;Lr=u;try{const me=[ce,P===go?void 0:M&&P[0]===go?[]:P,T];P=ce,l?l(t,3,me):t(...me)}finally{Lr=de}}}else u.run()};return a&&a(V),u=new Qu(h),u.scheduler=i?()=>i(V,!1):V,T=B=>np(B,!1,u),g=u.onStop=()=>{const B=Oo.get(u);if(B){if(l)l(B,4);else for(const ce of B)ce();Oo.delete(u)}},t?r?V(!0):P=u.run():i?i(V.bind(null,!0),!0):u.run(),N.pause=u.pause.bind(u),N.resume=u.resume.bind(u),N.stop=N,N}function Yn(e,t=1/0,n){if(t<=0||!pt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,zt(e))Yn(e.value,t,n);else if(Ue(e))for(let r=0;r<e.length;r++)Yn(e[r],t,n);else if(Wu(e)||ts(e))e.forEach(r=>{Yn(r,t,n)});else if(Gu(e)){for(const r in e)Yn(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Yn(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){ni(s,t,n)}}function An(e,t,n,r){if(ze(e)){const s=to(e,t,n,r);return s&&qu(s)&&s.catch(o=>{ni(o,t,n)}),s}if(Ue(e)){const s=[];for(let o=0;o<e.length;o++)s.push(An(e[o],t,n,r));return s}}function ni(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||_t;if(t){let a=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](e,l,d)===!1)return}a=a.parent}if(o){er(),to(o,null,10,[e,l,d]),tr();return}}sp(e,n,s,r,i)}function sp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const Qt=[];let On=-1;const ns=[];let mr=null,Xr=0;const md=Promise.resolve();let No=null;function Ut(e){const t=No||md;return e?t.then(this?e.bind(this):e):t}function op(e){let t=On+1,n=Qt.length;for(;t<n;){const r=t+n>>>1,s=Qt[r],o=Hs(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function rl(e){if(!(e.flags&1)){const t=Hs(e),n=Qt[Qt.length-1];!n||!(e.flags&2)&&t>=Hs(n)?Qt.push(e):Qt.splice(op(t),0,e),e.flags|=1,gd()}}function gd(){No||(No=md.then(yd))}function ip(e){Ue(e)?ns.push(...e):mr&&e.id===-1?mr.splice(Xr+1,0,e):e.flags&1||(ns.push(e),e.flags|=1),gd()}function jl(e,t,n=On+1){for(;n<Qt.length;n++){const r=Qt[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Qt.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function vd(e){if(ns.length){const t=[...new Set(ns)].sort((n,r)=>Hs(n)-Hs(r));if(ns.length=0,mr){mr.push(...t);return}for(mr=t,Xr=0;Xr<mr.length;Xr++){const n=mr[Xr];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}mr=null,Xr=0}}const Hs=e=>e.id==null?e.flags&2?-1:1/0:e.id;function yd(e){try{for(On=0;On<Qt.length;On++){const t=Qt[On];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(;On<Qt.length;On++){const t=Qt[On];t&&(t.flags&=-2)}On=-1,Qt.length=0,vd(),No=null,(Qt.length||ns.length)&&yd()}}let Bt=null,wd=null;function $o(e){const t=Bt;return Bt=e,wd=e&&e.type.__scopeId||null,t}function gt(e,t=Bt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Uo(-1);const o=$o(t);let i;try{i=e(...s)}finally{$o(o),r._d&&Uo(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function rr(e,t){if(Bt===null)return e;const n=li(Bt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=_t]=t[s];o&&(ze(o)&&(o={mounted:o,updated:o}),o.deep&&Yn(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Mr(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&&(er(),An(l,n,8,[e.el,a,e,t]),tr())}}function So(e,t){if(qt){let n=qt.provides;const r=qt.parent&&qt.parent.provides;r===n&&(n=qt.provides=Object.create(r)),n[e]=t}}function Sn(e,t,n=!1){const r=ll();if(r||ss){let s=ss?ss._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&&ze(t)?t.call(r&&r.proxy):t}}const ap=Symbol.for("v-scx"),lp=()=>Sn(ap);function ht(e,t,n){return bd(e,t,n)}function bd(e,t,n=_t){const{immediate:r,deep:s,flush:o,once:i}=n,a=Ot({},n),l=t&&r||!t&&o!=="post";let d;if(Gs){if(o==="sync"){const T=lp();d=T.__watcherHandles||(T.__watcherHandles=[])}else if(!l){const T=()=>{};return T.stop=Fn,T.resume=Fn,T.pause=Fn,T}}const u=qt;a.call=(T,H,M)=>An(T,u,H,M);let h=!1;o==="post"?a.scheduler=T=>{Ht(T,u&&u.suspense)}:o!=="sync"&&(h=!0,a.scheduler=(T,H)=>{H?T():rl(T)}),a.augmentJob=T=>{t&&(T.flags|=4),h&&(T.flags|=2,u&&(T.id=u.uid,T.i=u))};const g=rp(e,t,a);return Gs&&(d?d.push(g):l&&g()),g}function cp(e,t,n){const r=this.proxy,s=It(e)?e.includes(".")?_d(r,e):()=>r[e]:e.bind(r,r);let o;ze(t)?o=t:(o=t.handler,n=t);const i=no(this),a=bd(s,o.bind(r),n);return i(),a}function _d(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 kd=Symbol("_vte"),Td=e=>e.__isTeleport,Ns=e=>e&&(e.disabled||e.disabled===""),Ul=e=>e&&(e.defer||e.defer===""),Bl=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Fl=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,ma=(e,t)=>{const n=e&&e.to;return It(n)?t?t(n):null:n},Sd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,d){const{mc:u,pc:h,pbc:g,o:{insert:T,querySelector:H,createText:M,createComment:D}}=d,N=Ns(t.props);let{shapeFlag:P,children:V,dynamicChildren:B}=t;if(e==null){const ce=t.el=M(""),de=t.anchor=M("");T(ce,n,r),T(de,n,r);const me=(ne,ie)=>{P&16&&u(V,ne,ie,s,o,i,a,l)},_e=()=>{const ne=t.target=ma(t.props,H),ie=ga(ne,t,M,T);ne&&(i!=="svg"&&Bl(ne)?i="svg":i!=="mathml"&&Fl(ne)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ne),N||(me(ne,ie),Io(t,!1)))};N&&(me(n,de),Io(t,!0)),Ul(t.props)?(t.el.__isMounted=!1,Ht(()=>{_e(),delete t.el.__isMounted},o)):_e()}else{if(Ul(t.props)&&e.el.__isMounted===!1){Ht(()=>{Sd.process(e,t,n,r,s,o,i,a,l,d)},o);return}t.el=e.el,t.targetStart=e.targetStart;const ce=t.anchor=e.anchor,de=t.target=e.target,me=t.targetAnchor=e.targetAnchor,_e=Ns(e.props),ne=_e?n:de,ie=_e?ce:me;if(i==="svg"||Bl(de)?i="svg":(i==="mathml"||Fl(de))&&(i="mathml"),B?(g(e.dynamicChildren,B,ne,s,o,i,a),il(e,t,!0)):l||h(e,t,ne,ie,s,o,i,a,!1),N)_e?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):vo(t,n,ce,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const pe=t.target=ma(t.props,H);pe&&vo(t,pe,null,d,0)}else _e&&vo(t,de,me,d,1);Io(t,N)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:d,targetAnchor:u,target:h,props:g}=e;if(h&&(s(d),s(u)),o&&s(l),i&16){const T=o||!Ns(g);for(let H=0;H<a.length;H++){const M=a[H];r(M,t,n,T,!!M.dynamicChildren)}}},move:vo,hydrate:up};function vo(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:u}=e,h=o===2;if(h&&r(i,t,n),(!h||Ns(u))&&l&16)for(let g=0;g<d.length;g++)s(d[g],t,n,2);h&&r(a,t,n)}function up(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:d,createText:u}},h){function g(D,N){let P=N;for(;P;){if(P&&P.nodeType===8){if(P.data==="teleport start anchor")t.targetStart=P;else if(P.data==="teleport anchor"){t.targetAnchor=P,D._lpa=t.targetAnchor&&i(t.targetAnchor);break}}P=i(P)}}function T(D,N){N.anchor=h(i(D),N,a(D),n,r,s,o)}const H=t.target=ma(t.props,l),M=Ns(t.props);if(H){const D=H._lpa||H.firstChild;t.shapeFlag&16&&(M?(T(e,t),g(H,D),t.targetAnchor||ga(H,t,u,d,a(e)===H?e:null)):(t.anchor=i(e),g(H,D),t.targetAnchor||ga(H,t,u,d),h(D&&i(D),t,H,n,r,s,o))),Io(t,M)}else M&&t.shapeFlag&16&&(T(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Do=Sd;function Io(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 ga(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[kd]=i,e&&(r(o,e,s),r(i,e,s)),i}const Nn=Symbol("_leaveCb"),Is=Symbol("_enterCb");function dp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return lr(()=>{e.isMounted=!0}),cr(()=>{e.isUnmounting=!0}),e}const mn=[Function,Array],Id={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:mn,onEnter:mn,onAfterEnter:mn,onEnterCancelled:mn,onBeforeLeave:mn,onLeave:mn,onAfterLeave:mn,onLeaveCancelled:mn,onBeforeAppear:mn,onAppear:mn,onAfterAppear:mn,onAppearCancelled:mn},Ed=e=>{const t=e.subTree;return t.component?Ed(t.component):t},fp={name:"BaseTransition",props:Id,setup(e,{slots:t}){const n=ll(),r=dp();return()=>{const s=t.default&&Rd(t.default(),!0);if(!s||!s.length)return;const o=Cd(s),i=lt(e),{mode:a}=i;if(r.isLeaving)return Ni(o);const l=Hl(o);if(!l)return Ni(o);let d=va(l,i,r,n,h=>d=h);l.type!==Wt&&Vs(l,d);let u=n.subTree&&Hl(n.subTree);if(u&&u.type!==Wt&&!Ur(u,l)&&Ed(n).type!==Wt){let h=va(u,i,r,n);if(Vs(u,h),a==="out-in"&&l.type!==Wt)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,u=void 0},Ni(o);a==="in-out"&&l.type!==Wt?h.delayLeave=(g,T,H)=>{const M=Ad(r,u);M[String(u.key)]=u,g[Nn]=()=>{T(),g[Nn]=void 0,delete d.delayedLeave,u=void 0},d.delayedLeave=()=>{H(),delete d.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return o}}};function Cd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Wt){t=n;break}}return t}const hp=fp;function Ad(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 va(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:g,onLeave:T,onAfterLeave:H,onLeaveCancelled:M,onBeforeAppear:D,onAppear:N,onAfterAppear:P,onAppearCancelled:V}=t,B=String(e.key),ce=Ad(n,e),de=(ne,ie)=>{ne&&An(ne,r,9,ie)},me=(ne,ie)=>{const pe=ie[1];de(ne,ie),Ue(ne)?ne.every(Q=>Q.length<=1)&&pe():ne.length<=1&&pe()},_e={mode:i,persisted:a,beforeEnter(ne){let ie=l;if(!n.isMounted)if(o)ie=D||l;else return;ne[Nn]&&ne[Nn](!0);const pe=ce[B];pe&&Ur(e,pe)&&pe.el[Nn]&&pe.el[Nn](),de(ie,[ne])},enter(ne){if(ce[B]===e)return;let ie=d,pe=u,Q=h;if(!n.isMounted)if(o)ie=N||d,pe=P||u,Q=V||h;else return;let ke=!1;ne[Is]=Me=>{ke||(ke=!0,Me?de(Q,[ne]):de(pe,[ne]),_e.delayedLeave&&_e.delayedLeave(),ne[Is]=void 0)};const Pe=ne[Is].bind(null,!1);ie?me(ie,[ne,Pe]):Pe()},leave(ne,ie){const pe=String(e.key);if(ne[Is]&&ne[Is](!0),n.isUnmounting)return ie();de(g,[ne]);let Q=!1;ne[Nn]=Pe=>{Q||(Q=!0,ie(),Pe?de(M,[ne]):de(H,[ne]),ne[Nn]=void 0,ce[pe]===e&&delete ce[pe])};const ke=ne[Nn].bind(null,!1);ce[pe]=e,T?me(T,[ne,ke]):ke()},clone(ne){const ie=va(ne,t,n,r,s);return s&&s(ie),ie}};return _e}function Ni(e){if(ri(e))return e=Tr(e),e.children=null,e}function Hl(e){if(!ri(e))return Td(e.type)&&e.children?Cd(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&&ze(n.default))return n.default()}}function Vs(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Vs(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 Rd(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===je?(i.patchFlag&128&&s++,r=r.concat(Rd(i.children,t,a))):(t||i.type!==Wt)&&r.push(a!=null?Tr(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Nt(e,t){return ze(e)?Ot({name:e.name},t,{setup:e}):e}function Pd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Vl(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Lo=new WeakMap;function $s(e,t,n,r,s=!1){if(Ue(e)){e.forEach((M,D)=>$s(M,t&&(Ue(t)?t[D]:t),n,r,s));return}if(rs(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&$s(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?li(r.component):r.el,i=s?null:o,{i:a,r:l}=e,d=t&&t.r,u=a.refs===_t?a.refs={}:a.refs,h=a.setupState,g=lt(h),T=h===_t?Vu:M=>Vl(u,M)?!1:dt(g,M),H=(M,D)=>!(D&&Vl(u,D));if(d!=null&&d!==l){if(Wl(t),It(d))u[d]=null,T(d)&&(h[d]=null);else if(zt(d)){const M=t;H(d,M.k)&&(d.value=null),M.k&&(u[M.k]=null)}}if(ze(l))to(l,a,12,[i,u]);else{const M=It(l),D=zt(l);if(M||D){const N=()=>{if(e.f){const P=M?T(l)?h[l]:u[l]:H()||!e.k?l.value:u[e.k];if(s)Ue(P)&&za(P,o);else if(Ue(P))P.includes(o)||P.push(o);else if(M)u[l]=[o],T(l)&&(h[l]=u[l]);else{const V=[o];H(l,e.k)&&(l.value=V),e.k&&(u[e.k]=V)}}else M?(u[l]=i,T(l)&&(h[l]=i)):D&&(H(l,e.k)&&(l.value=i),e.k&&(u[e.k]=i))};if(i){const P=()=>{N(),Lo.delete(e)};P.id=-1,Lo.set(e,P),Ht(P,n)}else Wl(e),N()}}}function Wl(e){const t=Lo.get(e);t&&(t.flags|=8,Lo.delete(e))}Zo().requestIdleCallback;Zo().cancelIdleCallback;const rs=e=>!!e.type.__asyncLoader,ri=e=>e.type.__isKeepAlive;function pp(e,t){xd(e,"a",t)}function mp(e,t){xd(e,"da",t)}function xd(e,t,n=qt){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(si(t,r,n),n){let s=n.parent;for(;s&&s.parent;)ri(s.parent.vnode)&&gp(r,t,n,s),s=s.parent}}function gp(e,t,n,r){const s=si(t,e,r,!0);oi(()=>{za(r[t],s)},n)}function si(e,t,n=qt,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{er();const a=no(n),l=An(t,n,e,i);return a(),tr(),l});return r?s.unshift(o):s.push(o),o}}const ar=e=>(t,n=qt)=>{(!Gs||e==="sp")&&si(e,(...r)=>t(...r),n)},vp=ar("bm"),lr=ar("m"),yp=ar("bu"),wp=ar("u"),cr=ar("bum"),oi=ar("um"),bp=ar("sp"),_p=ar("rtg"),kp=ar("rtc");function Tp(e,t=qt){si("ec",e,t)}const Sp="components",Md=Symbol.for("v-ndc");function ya(e){return It(e)?Ip(Sp,e,!1)||e:e||Md}function Ip(e,t,n=!0,r=!1){const s=Bt||qt;if(s){const o=s.type;{const a=cm(o,!1);if(a&&(a===t||a===en(t)||a===Qo(en(t))))return o}const i=ql(s[e]||o[e],t)||ql(s.appContext[e],t);return!i&&r?o:i}}function ql(e,t){return e&&(e[t]||e[en(t)]||e[Qo(en(t))])}function bt(e,t,n,r){let s;const o=n,i=Ue(e);if(i||It(e)){const a=i&&Wr(e);let l=!1,d=!1;a&&(l=!vn(e),d=nr(e),e=ei(e)),s=new Array(e.length);for(let u=0,h=e.length;u<h;u++)s[u]=t(l?d?cs(Cn(e[u])):Cn(e[u]):e[u],u,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(pt(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 u=a[l];s[l]=t(e[u],u,l,o)}}else s=[];return s}function Bn(e,t,n={},r,s){if(Bt.ce||Bt.parent&&rs(Bt.parent)&&Bt.parent.ce){const d=Object.keys(n).length>0;return t!=="default"&&(n.name=t),y(),ft(je,null,[Re("slot",n,r)],d?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),y();const i=o&&Od(o(n)),a=n.key||i&&i.key,l=ft(je,{key:(a&&!En(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Od(e){return e.some(t=>qs(t)?!(t.type===Wt||t.type===je&&!Od(t.children)):!0)?e:null}const wa=e=>e?Zd(e)?li(e):wa(e.parent):null,Ds=Ot(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=>wa(e.parent),$root:e=>wa(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>$d(e),$forceUpdate:e=>e.f||(e.f=()=>{rl(e.update)}),$nextTick:e=>e.n||(e.n=Ut.bind(e.proxy)),$watch:e=>cp.bind(e)}),$i=(e,t)=>e!==_t&&!e.__isScriptSetup&&dt(e,t),Ep={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 g=i[t];if(g!==void 0)switch(g){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if($i(r,t))return i[t]=1,r[t];if(s!==_t&&dt(s,t))return i[t]=2,s[t];if(dt(o,t))return i[t]=3,o[t];if(n!==_t&&dt(n,t))return i[t]=4,n[t];ba&&(i[t]=0)}}const d=Ds[t];let u,h;if(d)return t==="$attrs"&&Vt(e.attrs,"get",""),d(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==_t&&dt(n,t))return i[t]=4,n[t];if(h=l.config.globalProperties,dt(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return $i(s,t)?(s[t]=n,!0):r!==_t&&dt(r,t)?(r[t]=n,!0):dt(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!==_t&&a[0]!=="$"&&dt(e,a)||$i(t,a)||dt(o,a)||dt(r,a)||dt(Ds,a)||dt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:dt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Cp(){return Ap().slots}function Ap(e){const t=ll();return t.setupContext||(t.setupContext=tf(t))}function zl(e){return Ue(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let ba=!0;function Rp(e){const t=$d(e),n=e.proxy,r=e.ctx;ba=!1,t.beforeCreate&&Gl(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:d,created:u,beforeMount:h,mounted:g,beforeUpdate:T,updated:H,activated:M,deactivated:D,beforeDestroy:N,beforeUnmount:P,destroyed:V,unmounted:B,render:ce,renderTracked:de,renderTriggered:me,errorCaptured:_e,serverPrefetch:ne,expose:ie,inheritAttrs:pe,components:Q,directives:ke,filters:Pe}=t;if(d&&Pp(d,r,null),i)for(const $e in i){const Se=i[$e];ze(Se)&&(r[$e]=Se.bind(n))}if(s){const $e=s.call(n,n);pt($e)&&(e.data=ti($e))}if(ba=!0,o)for(const $e in o){const Se=o[$e],Ne=ze(Se)?Se.bind(n,n):ze(Se.get)?Se.get.bind(n,n):Fn,Ye=!ze(Se)&&ze(Se.set)?Se.set.bind(n):Fn,et=ue({get:Ne,set:Ye});Object.defineProperty(r,$e,{enumerable:!0,configurable:!0,get:()=>et.value,set:Qe=>et.value=Qe})}if(a)for(const $e in a)Nd(a[$e],r,n,$e);if(l){const $e=ze(l)?l.call(n):l;Reflect.ownKeys($e).forEach(Se=>{So(Se,$e[Se])})}u&&Gl(u,e,"c");function Te($e,Se){Ue(Se)?Se.forEach(Ne=>$e(Ne.bind(n))):Se&&$e(Se.bind(n))}if(Te(vp,h),Te(lr,g),Te(yp,T),Te(wp,H),Te(pp,M),Te(mp,D),Te(Tp,_e),Te(kp,de),Te(_p,me),Te(cr,P),Te(oi,B),Te(bp,ne),Ue(ie))if(ie.length){const $e=e.exposed||(e.exposed={});ie.forEach(Se=>{Object.defineProperty($e,Se,{get:()=>n[Se],set:Ne=>n[Se]=Ne,enumerable:!0})})}else e.exposed||(e.exposed={});ce&&e.render===Fn&&(e.render=ce),pe!=null&&(e.inheritAttrs=pe),Q&&(e.components=Q),ke&&(e.directives=ke),ne&&Pd(e)}function Pp(e,t,n=Fn){Ue(e)&&(e=_a(e));for(const r in e){const s=e[r];let o;pt(s)?"default"in s?o=Sn(s.from||r,s.default,!0):o=Sn(s.from||r):o=Sn(s),zt(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function Gl(e,t,n){An(Ue(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Nd(e,t,n,r){let s=r.includes(".")?_d(n,r):()=>n[r];if(It(e)){const o=t[e];ze(o)&&ht(s,o)}else if(ze(e))ht(s,e.bind(n));else if(pt(e))if(Ue(e))e.forEach(o=>Nd(o,t,n,r));else{const o=ze(e.handler)?e.handler.bind(n):t[e.handler];ze(o)&&ht(s,o,e)}}function $d(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=>jo(l,d,i,!0)),jo(l,t,i)),pt(t)&&o.set(t,l),l}function jo(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&jo(e,o,n,!0),s&&s.forEach(i=>jo(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=xp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const xp={data:Kl,props:Jl,emits:Jl,methods:Ps,computed:Ps,beforeCreate:Yt,created:Yt,beforeMount:Yt,mounted:Yt,beforeUpdate:Yt,updated:Yt,beforeDestroy:Yt,beforeUnmount:Yt,destroyed:Yt,unmounted:Yt,activated:Yt,deactivated:Yt,errorCaptured:Yt,serverPrefetch:Yt,components:Ps,directives:Ps,watch:Op,provide:Kl,inject:Mp};function Kl(e,t){return t?e?function(){return Ot(ze(e)?e.call(this,this):e,ze(t)?t.call(this,this):t)}:t:e}function Mp(e,t){return Ps(_a(e),_a(t))}function _a(e){if(Ue(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Yt(e,t){return e?[...new Set([].concat(e,t))]:t}function Ps(e,t){return e?Ot(Object.create(null),e,t):t}function Jl(e,t){return e?Ue(e)&&Ue(t)?[...new Set([...e,...t])]:Ot(Object.create(null),zl(e),zl(t??{})):t}function Op(e,t){if(!e)return t;if(!t)return e;const n=Ot(Object.create(null),e);for(const r in t)n[r]=Yt(e[r],t[r]);return n}function Dd(){return{app:null,config:{isNativeTag:Vu,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 Np=0;function $p(e,t){return function(r,s=null){ze(r)||(r=Ot({},r)),s!=null&&!pt(s)&&(s=null);const o=Dd(),i=new WeakSet,a=[];let l=!1;const d=o.app={_uid:Np++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:dm,get config(){return o.config},set config(u){},use(u,...h){return i.has(u)||(u&&ze(u.install)?(i.add(u),u.install(d,...h)):ze(u)&&(i.add(u),u(d,...h))),d},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),d},component(u,h){return h?(o.components[u]=h,d):o.components[u]},directive(u,h){return h?(o.directives[u]=h,d):o.directives[u]},mount(u,h,g){if(!l){const T=d._ceVNode||Re(r,s);return T.appContext=o,g===!0?g="svg":g===!1&&(g=void 0),e(T,u,g),l=!0,d._container=u,u.__vue_app__=d,li(T.component)}},onUnmount(u){a.push(u)},unmount(){l&&(An(a,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(u,h){return o.provides[u]=h,d},runWithContext(u){const h=ss;ss=d;try{return u()}finally{ss=h}}};return d}}let ss=null;const Dp=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${en(t)}Modifiers`]||e[`${Sr(t)}Modifiers`];function Lp(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||_t;let s=n;const o=t.startsWith("update:"),i=o&&Dp(r,t.slice(7));i&&(i.trim&&(s=n.map(u=>It(u)?u.trim():u)),i.number&&(s=n.map(Ka)));let a,l=r[a=Ri(t)]||r[a=Ri(en(t))];!l&&o&&(l=r[a=Ri(Sr(t))]),l&&An(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,An(d,e,6,s)}}const jp=new WeakMap;function Ld(e,t,n=!1){const r=n?jp:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!ze(e)){const l=d=>{const u=Ld(d,t,!0);u&&(a=!0,Ot(i,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(pt(e)&&r.set(e,null),null):(Ue(o)?o.forEach(l=>i[l]=null):Ot(i,o),pt(e)&&r.set(e,i),i)}function ii(e,t){return!e||!Yo(t)?!1:(t=t.slice(2).replace(/Once$/,""),dt(e,t[0].toLowerCase()+t.slice(1))||dt(e,Sr(t))||dt(e,t))}function Yl(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:d,renderCache:u,props:h,data:g,setupState:T,ctx:H,inheritAttrs:M}=e,D=$o(e);let N,P;try{if(n.shapeFlag&4){const B=s||r,ce=B;N=Dn(d.call(ce,B,u,h,T,g,H)),P=a}else{const B=t;N=Dn(B.length>1?B(h,{attrs:a,slots:i,emit:l}):B(h,null)),P=t.props?a:Up(a)}}catch(B){Ls.length=0,ni(B,e,1),N=Re(Wt)}let V=N;if(P&&M!==!1){const B=Object.keys(P),{shapeFlag:ce}=V;B.length&&ce&7&&(o&&B.some(qa)&&(P=Bp(P,o)),V=Tr(V,P,!1,!0))}return n.dirs&&(V=Tr(V,null,!1,!0),V.dirs=V.dirs?V.dirs.concat(n.dirs):n.dirs),n.transition&&Vs(V,n.transition),N=V,$o(D),N}const Up=e=>{let t;for(const n in e)(n==="class"||n==="style"||Yo(n))&&((t||(t={}))[n]=e[n]);return t},Bp=(e,t)=>{const n={};for(const r in e)(!qa(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Fp(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?Xl(r,i,d):!!i;if(l&8){const u=t.dynamicProps;for(let h=0;h<u.length;h++){const g=u[h];if(jd(i,r,g)&&!ii(d,g))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?Xl(r,i,d):!0:!!i;return!1}function Xl(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(jd(t,e,o)&&!ii(n,o))return!0}return!1}function jd(e,t,n){const r=e[n],s=t[n];return n==="style"&&pt(r)&&pt(s)?!Ja(r,s):r!==s}function Hp({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 Ud={},Bd=()=>Object.create(Ud),Fd=e=>Object.getPrototypeOf(e)===Ud;function Vp(e,t,n,r=!1){const s={},o=Bd();e.propsDefaults=Object.create(null),Hd(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:fd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function Wp(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=lt(s),[l]=e.propsOptions;let d=!1;if((r||i>0)&&!(i&16)){if(i&8){const u=e.vnode.dynamicProps;for(let h=0;h<u.length;h++){let g=u[h];if(ii(e.emitsOptions,g))continue;const T=t[g];if(l)if(dt(o,g))T!==o[g]&&(o[g]=T,d=!0);else{const H=en(g);s[H]=ka(l,a,H,T,e,!1)}else T!==o[g]&&(o[g]=T,d=!0)}}}else{Hd(e,t,s,o)&&(d=!0);let u;for(const h in a)(!t||!dt(t,h)&&((u=Sr(h))===h||!dt(t,u)))&&(l?n&&(n[h]!==void 0||n[u]!==void 0)&&(s[h]=ka(l,a,h,void 0,e,!0)):delete s[h]);if(o!==a)for(const h in o)(!t||!dt(t,h))&&(delete o[h],d=!0)}d&&Jn(e.attrs,"set","")}function Hd(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(xs(l))continue;const d=t[l];let u;s&&dt(s,u=en(l))?!o||!o.includes(u)?n[u]=d:(a||(a={}))[u]=d:ii(e.emitsOptions,l)||(!(l in r)||d!==r[l])&&(r[l]=d,i=!0)}if(o){const l=lt(n),d=a||_t;for(let u=0;u<o.length;u++){const h=o[u];n[h]=ka(s,l,h,d[h],e,!dt(d,h))}}return i}function ka(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=dt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&ze(l)){const{propsDefaults:d}=s;if(n in d)r=d[n];else{const u=no(s);r=d[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===Sr(n))&&(r=!0))}return r}const qp=new WeakMap;function Vd(e,t,n=!1){const r=n?qp:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!ze(e)){const u=h=>{l=!0;const[g,T]=Vd(h,t,!0);Ot(i,g),T&&a.push(...T)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!o&&!l)return pt(e)&&r.set(e,es),es;if(Ue(o))for(let u=0;u<o.length;u++){const h=en(o[u]);Ql(h)&&(i[h]=_t)}else if(o)for(const u in o){const h=en(u);if(Ql(h)){const g=o[u],T=i[h]=Ue(g)||ze(g)?{type:g}:Ot({},g),H=T.type;let M=!1,D=!0;if(Ue(H))for(let N=0;N<H.length;++N){const P=H[N],V=ze(P)&&P.name;if(V==="Boolean"){M=!0;break}else V==="String"&&(D=!1)}else M=ze(H)&&H.name==="Boolean";T[0]=M,T[1]=D,(M||dt(T,"default"))&&a.push(h)}}const d=[i,a];return pt(e)&&r.set(e,d),d}function Ql(e){return e[0]!=="$"&&!xs(e)}const sl=e=>e==="_"||e==="_ctx"||e==="$stable",ol=e=>Ue(e)?e.map(Dn):[Dn(e)],zp=(e,t,n)=>{if(t._n)return t;const r=gt((...s)=>ol(t(...s)),n);return r._c=!1,r},Wd=(e,t,n)=>{const r=e._ctx;for(const s in e){if(sl(s))continue;const o=e[s];if(ze(o))t[s]=zp(s,o,r);else if(o!=null){const i=ol(o);t[s]=()=>i}}},qd=(e,t)=>{const n=ol(t);e.slots.default=()=>n},zd=(e,t,n)=>{for(const r in t)(n||!sl(r))&&(e[r]=t[r])},Gp=(e,t,n)=>{const r=e.slots=Bd();if(e.vnode.shapeFlag&32){const s=t._;s?(zd(r,t,n),n&&Ku(r,"_",s,!0)):Wd(t,r)}else t&&qd(e,t)},Kp=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=_t;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:zd(s,t,n):(o=!t.$stable,Wd(t,s)),i=t}else t&&(qd(e,t),i={default:1});if(o)for(const a in s)!sl(a)&&i[a]==null&&delete s[a]},Ht=Zp;function Jp(e){return Yp(e)}function Yp(e,t){const n=Zo();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:d,setElementText:u,parentNode:h,nextSibling:g,setScopeId:T=Fn,insertStaticContent:H}=e,M=(v,b,A,J=null,z=null,x=null,U=void 0,G=null,Y=!!b.dynamicChildren)=>{if(v===b)return;v&&!Ur(v,b)&&(J=W(v),Qe(v,z,x,!0),v=null),b.patchFlag===-2&&(Y=!1,b.dynamicChildren=null);const{type:K,ref:ye,shapeFlag:fe}=b;switch(K){case ai:D(v,b,A,J);break;case Wt:N(v,b,A,J);break;case Li:v==null&&P(b,A,J,U);break;case je:Q(v,b,A,J,z,x,U,G,Y);break;default:fe&1?ce(v,b,A,J,z,x,U,G,Y):fe&6?ke(v,b,A,J,z,x,U,G,Y):(fe&64||fe&128)&&K.process(v,b,A,J,z,x,U,G,Y,be)}ye!=null&&z?$s(ye,v&&v.ref,x,b||v,!b):ye==null&&v&&v.ref!=null&&$s(v.ref,null,x,v,!0)},D=(v,b,A,J)=>{if(v==null)r(b.el=a(b.children),A,J);else{const z=b.el=v.el;b.children!==v.children&&d(z,b.children)}},N=(v,b,A,J)=>{v==null?r(b.el=l(b.children||""),A,J):b.el=v.el},P=(v,b,A,J)=>{[v.el,v.anchor]=H(v.children,b,A,J,v.el,v.anchor)},V=({el:v,anchor:b},A,J)=>{let z;for(;v&&v!==b;)z=g(v),r(v,A,J),v=z;r(b,A,J)},B=({el:v,anchor:b})=>{let A;for(;v&&v!==b;)A=g(v),s(v),v=A;s(b)},ce=(v,b,A,J,z,x,U,G,Y)=>{if(b.type==="svg"?U="svg":b.type==="math"&&(U="mathml"),v==null)de(b,A,J,z,x,U,G,Y);else{const K=v.el&&v.el._isVueCE?v.el:null;try{K&&K._beginPatch(),ne(v,b,z,x,U,G,Y)}finally{K&&K._endPatch()}}},de=(v,b,A,J,z,x,U,G)=>{let Y,K;const{props:ye,shapeFlag:fe,transition:ge,dirs:xe}=v;if(Y=v.el=i(v.type,x,ye&&ye.is,ye),fe&8?u(Y,v.children):fe&16&&_e(v.children,Y,null,J,z,Di(v,x),U,G),xe&&Mr(v,null,J,"created"),me(Y,v,v.scopeId,U,J),ye){for(const qe in ye)qe!=="value"&&!xs(qe)&&o(Y,qe,null,ye[qe],x,J);"value"in ye&&o(Y,"value",null,ye.value,x),(K=ye.onVnodeBeforeMount)&&Mn(K,J,v)}xe&&Mr(v,null,J,"beforeMount");const Be=Xp(z,ge);Be&&ge.beforeEnter(Y),r(Y,b,A),((K=ye&&ye.onVnodeMounted)||Be||xe)&&Ht(()=>{K&&Mn(K,J,v),Be&&ge.enter(Y),xe&&Mr(v,null,J,"mounted")},z)},me=(v,b,A,J,z)=>{if(A&&T(v,A),J)for(let x=0;x<J.length;x++)T(v,J[x]);if(z){let x=z.subTree;if(b===x||Jd(x.type)&&(x.ssContent===b||x.ssFallback===b)){const U=z.vnode;me(v,U,U.scopeId,U.slotScopeIds,z.parent)}}},_e=(v,b,A,J,z,x,U,G,Y=0)=>{for(let K=Y;K<v.length;K++){const ye=v[K]=G?Kn(v[K]):Dn(v[K]);M(null,ye,b,A,J,z,x,U,G)}},ne=(v,b,A,J,z,x,U)=>{const G=b.el=v.el;let{patchFlag:Y,dynamicChildren:K,dirs:ye}=b;Y|=v.patchFlag&16;const fe=v.props||_t,ge=b.props||_t;let xe;if(A&&Or(A,!1),(xe=ge.onVnodeBeforeUpdate)&&Mn(xe,A,b,v),ye&&Mr(b,v,A,"beforeUpdate"),A&&Or(A,!0),(fe.innerHTML&&ge.innerHTML==null||fe.textContent&&ge.textContent==null)&&u(G,""),K?ie(v.dynamicChildren,K,G,A,J,Di(b,z),x):U||Se(v,b,G,null,A,J,Di(b,z),x,!1),Y>0){if(Y&16)pe(G,fe,ge,A,z);else if(Y&2&&fe.class!==ge.class&&o(G,"class",null,ge.class,z),Y&4&&o(G,"style",fe.style,ge.style,z),Y&8){const Be=b.dynamicProps;for(let qe=0;qe<Be.length;qe++){const He=Be[qe],nt=fe[He],Ke=ge[He];(Ke!==nt||He==="value")&&o(G,He,nt,Ke,z,A)}}Y&1&&v.children!==b.children&&u(G,b.children)}else!U&&K==null&&pe(G,fe,ge,A,z);((xe=ge.onVnodeUpdated)||ye)&&Ht(()=>{xe&&Mn(xe,A,b,v),ye&&Mr(b,v,A,"updated")},J)},ie=(v,b,A,J,z,x,U)=>{for(let G=0;G<b.length;G++){const Y=v[G],K=b[G],ye=Y.el&&(Y.type===je||!Ur(Y,K)||Y.shapeFlag&198)?h(Y.el):A;M(Y,K,ye,null,J,z,x,U,!0)}},pe=(v,b,A,J,z)=>{if(b!==A){if(b!==_t)for(const x in b)!xs(x)&&!(x in A)&&o(v,x,b[x],null,z,J);for(const x in A){if(xs(x))continue;const U=A[x],G=b[x];U!==G&&x!=="value"&&o(v,x,G,U,z,J)}"value"in A&&o(v,"value",b.value,A.value,z)}},Q=(v,b,A,J,z,x,U,G,Y)=>{const K=b.el=v?v.el:a(""),ye=b.anchor=v?v.anchor:a("");let{patchFlag:fe,dynamicChildren:ge,slotScopeIds:xe}=b;xe&&(G=G?G.concat(xe):xe),v==null?(r(K,A,J),r(ye,A,J),_e(b.children||[],A,ye,z,x,U,G,Y)):fe>0&&fe&64&&ge&&v.dynamicChildren&&v.dynamicChildren.length===ge.length?(ie(v.dynamicChildren,ge,A,z,x,U,G),(b.key!=null||z&&b===z.subTree)&&il(v,b,!0)):Se(v,b,A,ye,z,x,U,G,Y)},ke=(v,b,A,J,z,x,U,G,Y)=>{b.slotScopeIds=G,v==null?b.shapeFlag&512?z.ctx.activate(b,A,J,U,Y):Pe(b,A,J,z,x,U,Y):Me(v,b,Y)},Pe=(v,b,A,J,z,x,U)=>{const G=v.component=om(v,J,z);if(ri(v)&&(G.ctx.renderer=be),im(G,!1,U),G.asyncDep){if(z&&z.registerDep(G,Te,U),!v.el){const Y=G.subTree=Re(Wt);N(null,Y,b,A),v.placeholder=Y.el}}else Te(G,v,b,A,z,x,U)},Me=(v,b,A)=>{const J=b.component=v.component;if(Fp(v,b,A))if(J.asyncDep&&!J.asyncResolved){$e(J,b,A);return}else J.next=b,J.update();else b.el=v.el,J.vnode=b},Te=(v,b,A,J,z,x,U)=>{const G=()=>{if(v.isMounted){let{next:fe,bu:ge,u:xe,parent:Be,vnode:qe}=v;{const Et=Gd(v);if(Et){fe&&(fe.el=qe.el,$e(v,fe,U)),Et.asyncDep.then(()=>{Ht(()=>{v.isUnmounted||K()},z)});return}}let He=fe,nt;Or(v,!1),fe?(fe.el=qe.el,$e(v,fe,U)):fe=qe,ge&&To(ge),(nt=fe.props&&fe.props.onVnodeBeforeUpdate)&&Mn(nt,Be,fe,qe),Or(v,!0);const Ke=Yl(v),vt=v.subTree;v.subTree=Ke,M(vt,Ke,h(vt.el),W(vt),v,z,x),fe.el=Ke.el,He===null&&Hp(v,Ke.el),xe&&Ht(xe,z),(nt=fe.props&&fe.props.onVnodeUpdated)&&Ht(()=>Mn(nt,Be,fe,qe),z)}else{let fe;const{el:ge,props:xe}=b,{bm:Be,m:qe,parent:He,root:nt,type:Ke}=v,vt=rs(b);Or(v,!1),Be&&To(Be),!vt&&(fe=xe&&xe.onVnodeBeforeMount)&&Mn(fe,He,b),Or(v,!0);{nt.ce&&nt.ce._hasShadowRoot()&&nt.ce._injectChildStyle(Ke,v.parent?v.parent.type:void 0);const Et=v.subTree=Yl(v);M(null,Et,A,J,v,z,x),b.el=Et.el}if(qe&&Ht(qe,z),!vt&&(fe=xe&&xe.onVnodeMounted)){const Et=b;Ht(()=>Mn(fe,He,Et),z)}(b.shapeFlag&256||He&&rs(He.vnode)&&He.vnode.shapeFlag&256)&&v.a&&Ht(v.a,z),v.isMounted=!0,b=A=J=null}};v.scope.on();const Y=v.effect=new Qu(G);v.scope.off();const K=v.update=Y.run.bind(Y),ye=v.job=Y.runIfDirty.bind(Y);ye.i=v,ye.id=v.uid,Y.scheduler=()=>rl(ye),Or(v,!0),K()},$e=(v,b,A)=>{b.component=v;const J=v.vnode.props;v.vnode=b,v.next=null,Wp(v,b.props,J,A),Kp(v,b.children,A),er(),jl(v),tr()},Se=(v,b,A,J,z,x,U,G,Y=!1)=>{const K=v&&v.children,ye=v?v.shapeFlag:0,fe=b.children,{patchFlag:ge,shapeFlag:xe}=b;if(ge>0){if(ge&128){Ye(K,fe,A,J,z,x,U,G,Y);return}else if(ge&256){Ne(K,fe,A,J,z,x,U,G,Y);return}}xe&8?(ye&16&&We(K,z,x),fe!==K&&u(A,fe)):ye&16?xe&16?Ye(K,fe,A,J,z,x,U,G,Y):We(K,z,x,!0):(ye&8&&u(A,""),xe&16&&_e(fe,A,J,z,x,U,G,Y))},Ne=(v,b,A,J,z,x,U,G,Y)=>{v=v||es,b=b||es;const K=v.length,ye=b.length,fe=Math.min(K,ye);let ge;for(ge=0;ge<fe;ge++){const xe=b[ge]=Y?Kn(b[ge]):Dn(b[ge]);M(v[ge],xe,A,null,z,x,U,G,Y)}K>ye?We(v,z,x,!0,!1,fe):_e(b,A,J,z,x,U,G,Y,fe)},Ye=(v,b,A,J,z,x,U,G,Y)=>{let K=0;const ye=b.length;let fe=v.length-1,ge=ye-1;for(;K<=fe&&K<=ge;){const xe=v[K],Be=b[K]=Y?Kn(b[K]):Dn(b[K]);if(Ur(xe,Be))M(xe,Be,A,null,z,x,U,G,Y);else break;K++}for(;K<=fe&&K<=ge;){const xe=v[fe],Be=b[ge]=Y?Kn(b[ge]):Dn(b[ge]);if(Ur(xe,Be))M(xe,Be,A,null,z,x,U,G,Y);else break;fe--,ge--}if(K>fe){if(K<=ge){const xe=ge+1,Be=xe<ye?b[xe].el:J;for(;K<=ge;)M(null,b[K]=Y?Kn(b[K]):Dn(b[K]),A,Be,z,x,U,G,Y),K++}}else if(K>ge)for(;K<=fe;)Qe(v[K],z,x,!0),K++;else{const xe=K,Be=K,qe=new Map;for(K=Be;K<=ge;K++){const Ze=b[K]=Y?Kn(b[K]):Dn(b[K]);Ze.key!=null&&qe.set(Ze.key,K)}let He,nt=0;const Ke=ge-Be+1;let vt=!1,Et=0;const Pt=new Array(Ke);for(K=0;K<Ke;K++)Pt[K]=0;for(K=xe;K<=fe;K++){const Ze=v[K];if(nt>=Ke){Qe(Ze,z,x,!0);continue}let kt;if(Ze.key!=null)kt=qe.get(Ze.key);else for(He=Be;He<=ge;He++)if(Pt[He-Be]===0&&Ur(Ze,b[He])){kt=He;break}kt===void 0?Qe(Ze,z,x,!0):(Pt[kt-Be]=K+1,kt>=Et?Et=kt:vt=!0,M(Ze,b[kt],A,null,z,x,U,G,Y),nt++)}const St=vt?Qp(Pt):es;for(He=St.length-1,K=Ke-1;K>=0;K--){const Ze=Be+K,kt=b[Ze],mt=b[Ze+1],Je=Ze+1<ye?mt.el||Kd(mt):J;Pt[K]===0?M(null,kt,A,Je,z,x,U,G,Y):vt&&(He<0||K!==St[He]?et(kt,A,Je,2):He--)}}},et=(v,b,A,J,z=null)=>{const{el:x,type:U,transition:G,children:Y,shapeFlag:K}=v;if(K&6){et(v.component.subTree,b,A,J);return}if(K&128){v.suspense.move(b,A,J);return}if(K&64){U.move(v,b,A,be);return}if(U===je){r(x,b,A);for(let fe=0;fe<Y.length;fe++)et(Y[fe],b,A,J);r(v.anchor,b,A);return}if(U===Li){V(v,b,A);return}if(J!==2&&K&1&&G)if(J===0)G.beforeEnter(x),r(x,b,A),Ht(()=>G.enter(x),z);else{const{leave:fe,delayLeave:ge,afterLeave:xe}=G,Be=()=>{v.ctx.isUnmounted?s(x):r(x,b,A)},qe=()=>{x._isLeaving&&x[Nn](!0),fe(x,()=>{Be(),xe&&xe()})};ge?ge(x,Be,qe):qe()}else r(x,b,A)},Qe=(v,b,A,J=!1,z=!1)=>{const{type:x,props:U,ref:G,children:Y,dynamicChildren:K,shapeFlag:ye,patchFlag:fe,dirs:ge,cacheIndex:xe}=v;if(fe===-2&&(z=!1),G!=null&&(er(),$s(G,null,A,v,!0),tr()),xe!=null&&(b.renderCache[xe]=void 0),ye&256){b.ctx.deactivate(v);return}const Be=ye&1&&ge,qe=!rs(v);let He;if(qe&&(He=U&&U.onVnodeBeforeUnmount)&&Mn(He,b,v),ye&6)ct(v.component,A,J);else{if(ye&128){v.suspense.unmount(A,J);return}Be&&Mr(v,null,b,"beforeUnmount"),ye&64?v.type.remove(v,b,A,be,J):K&&!K.hasOnce&&(x!==je||fe>0&&fe&64)?We(K,b,A,!1,!0):(x===je&&fe&384||!z&&ye&16)&&We(Y,b,A),J&&Xe(v)}(qe&&(He=U&&U.onVnodeUnmounted)||Be)&&Ht(()=>{He&&Mn(He,b,v),Be&&Mr(v,null,b,"unmounted")},A)},Xe=v=>{const{type:b,el:A,anchor:J,transition:z}=v;if(b===je){tt(A,J);return}if(b===Li){B(v);return}const x=()=>{s(A),z&&!z.persisted&&z.afterLeave&&z.afterLeave()};if(v.shapeFlag&1&&z&&!z.persisted){const{leave:U,delayLeave:G}=z,Y=()=>U(A,x);G?G(v.el,x,Y):Y()}else x()},tt=(v,b)=>{let A;for(;v!==b;)A=g(v),s(v),v=A;s(b)},ct=(v,b,A)=>{const{bum:J,scope:z,job:x,subTree:U,um:G,m:Y,a:K}=v;Zl(Y),Zl(K),J&&To(J),z.stop(),x&&(x.flags|=8,Qe(U,v,b,A)),G&&Ht(G,b),Ht(()=>{v.isUnmounted=!0},b)},We=(v,b,A,J=!1,z=!1,x=0)=>{for(let U=x;U<v.length;U++)Qe(v[U],b,A,J,z)},W=v=>{if(v.shapeFlag&6)return W(v.component.subTree);if(v.shapeFlag&128)return v.suspense.next();const b=g(v.anchor||v.el),A=b&&b[kd];return A?g(A):b};let le=!1;const te=(v,b,A)=>{let J;v==null?b._vnode&&(Qe(b._vnode,null,null,!0),J=b._vnode.component):M(b._vnode||null,v,b,null,null,null,A),b._vnode=v,le||(le=!0,jl(J),vd(),le=!1)},be={p:M,um:Qe,m:et,r:Xe,mt:Pe,mc:_e,pc:Se,pbc:ie,n:W,o:e};return{render:te,hydrate:void 0,createApp:$p(te)}}function Di({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 Or({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Xp(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function il(e,t,n=!1){const r=e.children,s=t.children;if(Ue(r)&&Ue(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]=Kn(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&il(i,a)),a.type===ai&&(a.patchFlag===-1&&(a=s[o]=Kn(a)),a.el=i.el),a.type===Wt&&!a.el&&(a.el=i.el)}}function Qp(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 Gd(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Gd(t)}function Zl(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Kd(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Kd(t.subTree):null}const Jd=e=>e.__isSuspense;function Zp(e,t){t&&t.pendingBranch?Ue(e)?t.effects.push(...e):t.effects.push(e):ip(e)}const je=Symbol.for("v-fgt"),ai=Symbol.for("v-txt"),Wt=Symbol.for("v-cmt"),Li=Symbol.for("v-stc"),Ls=[];let fn=null;function y(e=!1){Ls.push(fn=e?null:[])}function em(){Ls.pop(),fn=Ls[Ls.length-1]||null}let Ws=1;function Uo(e,t=!1){Ws+=e,e<0&&fn&&t&&(fn.hasOnce=!0)}function Yd(e){return e.dynamicChildren=Ws>0?fn||es:null,em(),Ws>0&&fn&&fn.push(e),e}function k(e,t,n,r,s,o){return Yd(p(e,t,n,r,s,o,!0))}function ft(e,t,n,r,s){return Yd(Re(e,t,n,r,s,!0))}function qs(e){return e?e.__v_isVNode===!0:!1}function Ur(e,t){return e.type===t.type&&e.key===t.key}const Xd=({key:e})=>e??null,Eo=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?It(e)||zt(e)||ze(e)?{i:Bt,r:e,k:t,f:!!n}:e:null);function p(e,t=null,n=null,r=0,s=null,o=e===je?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Xd(t),ref:t&&Eo(t),scopeId:wd,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:Bt};return a?(al(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=It(n)?8:16),Ws>0&&!i&&fn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&fn.push(l),l}const Re=tm;function tm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Md)&&(e=Wt),qs(e)){const a=Tr(e,t,!0);return n&&al(a,n),Ws>0&&!o&&fn&&(a.shapeFlag&6?fn[fn.indexOf(e)]=a:fn.push(a)),a.patchFlag=-2,a}if(um(e)&&(e=e.__vccOpts),t){t=nm(t);let{class:a,style:l}=t;a&&!It(a)&&(t.class=at(a)),pt(l)&&(nl(l)&&!Ue(l)&&(l=Ot({},l)),t.style=zr(l))}const i=It(e)?1:Jd(e)?128:Td(e)?64:pt(e)?4:ze(e)?2:0;return p(e,t,n,r,s,i,o,!0)}function nm(e){return e?nl(e)||Fd(e)?Ot({},e):e:null}function Tr(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,d=t?Qd(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&Xd(d),ref:t&&t.ref?n&&o?Ue(o)?o.concat(Eo(t)):[o,Eo(t)]:Eo(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!==je?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&&Tr(e.ssContent),ssFallback:e.ssFallback&&Tr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Vs(u,l.clone(u)),u}function zs(e=" ",t=0){return Re(ai,null,e,t)}function re(e="",t=!1){return t?(y(),ft(Wt,null,e)):Re(Wt,null,e)}function Dn(e){return e==null||typeof e=="boolean"?Re(Wt):Ue(e)?Re(je,null,e.slice()):qs(e)?Kn(e):Re(ai,null,String(e))}function Kn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Tr(e)}function al(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ue(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&&!Fd(t)?t._ctx=Bt:s===3&&Bt&&(Bt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else ze(t)?(t={default:t,_ctx:Bt},n=32):(t=String(t),r&64?(n=16,t=[zs(t)]):n=8);e.children=t,e.shapeFlag|=n}function Qd(...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=zr([t.style,r.style]);else if(Yo(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ue(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function Mn(e,t,n,r=null){An(e,t,7,[n,r])}const rm=Dd();let sm=0;function om(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||rm,o={uid:sm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ph(!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:Vd(r,s),emitsOptions:Ld(r,s),emit:null,emitted:null,propsDefaults:_t,inheritAttrs:r.inheritAttrs,ctx:_t,data:_t,props:_t,attrs:_t,slots:_t,refs:_t,setupState:_t,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=Lp.bind(null,o),e.ce&&e.ce(o),o}let qt=null;const ll=()=>qt||Bt;let Bo,Ta;{const e=Zo(),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)}};Bo=t("__VUE_INSTANCE_SETTERS__",n=>qt=n),Ta=t("__VUE_SSR_SETTERS__",n=>Gs=n)}const no=e=>{const t=qt;return Bo(e),e.scope.on(),()=>{e.scope.off(),Bo(t)}},ec=()=>{qt&&qt.scope.off(),Bo(null)};function Zd(e){return e.vnode.shapeFlag&4}let Gs=!1;function im(e,t=!1,n=!1){t&&Ta(t);const{props:r,children:s}=e.vnode,o=Zd(e);Vp(e,r,o,t),Gp(e,s,n||t);const i=o?am(e,t):void 0;return t&&Ta(!1),i}function am(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Ep);const{setup:r}=n;if(r){er();const s=e.setupContext=r.length>1?tf(e):null,o=no(e),i=to(r,e,0,[e.props,s]),a=qu(i);if(tr(),o(),(a||e.sp)&&!rs(e)&&Pd(e),a){if(i.then(ec,ec),t)return i.then(l=>{tc(e,l)}).catch(l=>{ni(l,e,0)});e.asyncDep=i}else tc(e,i)}else ef(e)}function tc(e,t,n){ze(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:pt(t)&&(e.setupState=pd(t)),ef(e)}function ef(e,t,n){const r=e.type;e.render||(e.render=r.render||Fn);{const s=no(e);er();try{Rp(e)}finally{tr(),s()}}}const lm={get(e,t){return Vt(e,"get",""),e[t]}};function tf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,lm),slots:e.slots,emit:e.emit,expose:t}}function li(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(pd(Yh(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ds)return Ds[n](e)},has(t,n){return n in t||n in Ds}})):e.proxy}function cm(e,t=!0){return ze(e)?e.displayName||e.name:e.name||t&&e.__name}function um(e){return ze(e)&&"__vccOpts"in e}const ue=(e,t)=>tp(e,t,Gs);function cl(e,t,n){try{Uo(-1);const r=arguments.length;return r===2?pt(t)&&!Ue(t)?qs(t)?Re(e,null,[t]):Re(e,t):Re(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&qs(n)&&(n=[n]),Re(e,t,n))}finally{Uo(1)}}const dm="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 Sa;const nc=typeof window<"u"&&window.trustedTypes;if(nc)try{Sa=nc.createPolicy("vue",{createHTML:e=>e})}catch{}const nf=Sa?e=>Sa.createHTML(e):e=>e,fm="http://www.w3.org/2000/svg",hm="http://www.w3.org/1998/Math/MathML",Gn=typeof document<"u"?document:null,rc=Gn&&Gn.createElement("template"),pm={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"?Gn.createElementNS(fm,e):t==="mathml"?Gn.createElementNS(hm,e):n?Gn.createElement(e,{is:n}):Gn.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Gn.createTextNode(e),createComment:e=>Gn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Gn.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{rc.innerHTML=nf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=rc.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]}},dr="transition",Es="animation",Ks=Symbol("_vtc"),rf={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},mm=Ot({},Id,rf),gm=e=>(e.displayName="Transition",e.props=mm,e),sf=gm((e,{slots:t})=>cl(hp,vm(e),t)),Nr=(e,t=[])=>{Ue(e)?e.forEach(n=>n(...t)):e&&e(...t)},sc=e=>e?Ue(e)?e.some(t=>t.length>1):e.length>1:!1;function vm(e){const t={};for(const Q in e)Q in rf||(t[Q]=e[Q]);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:u=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:g=`${n}-leave-active`,leaveToClass:T=`${n}-leave-to`}=e,H=ym(s),M=H&&H[0],D=H&&H[1],{onBeforeEnter:N,onEnter:P,onEnterCancelled:V,onLeave:B,onLeaveCancelled:ce,onBeforeAppear:de=N,onAppear:me=P,onAppearCancelled:_e=V}=t,ne=(Q,ke,Pe,Me)=>{Q._enterCancelled=Me,$r(Q,ke?u:a),$r(Q,ke?d:i),Pe&&Pe()},ie=(Q,ke)=>{Q._isLeaving=!1,$r(Q,h),$r(Q,T),$r(Q,g),ke&&ke()},pe=Q=>(ke,Pe)=>{const Me=Q?me:P,Te=()=>ne(ke,Q,Pe);Nr(Me,[ke,Te]),oc(()=>{$r(ke,Q?l:o),qn(ke,Q?u:a),sc(Me)||ic(ke,r,M,Te)})};return Ot(t,{onBeforeEnter(Q){Nr(N,[Q]),qn(Q,o),qn(Q,i)},onBeforeAppear(Q){Nr(de,[Q]),qn(Q,l),qn(Q,d)},onEnter:pe(!1),onAppear:pe(!0),onLeave(Q,ke){Q._isLeaving=!0;const Pe=()=>ie(Q,ke);qn(Q,h),Q._enterCancelled?(qn(Q,g),cc(Q)):(cc(Q),qn(Q,g)),oc(()=>{Q._isLeaving&&($r(Q,h),qn(Q,T),sc(B)||ic(Q,r,D,Pe))}),Nr(B,[Q,Pe])},onEnterCancelled(Q){ne(Q,!1,void 0,!0),Nr(V,[Q])},onAppearCancelled(Q){ne(Q,!0,void 0,!0),Nr(_e,[Q])},onLeaveCancelled(Q){ie(Q),Nr(ce,[Q])}})}function ym(e){if(e==null)return null;if(pt(e))return[ji(e.enter),ji(e.leave)];{const t=ji(e);return[t,t]}}function ji(e){return kh(e)}function qn(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ks]||(e[Ks]=new Set)).add(t)}function $r(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ks];n&&(n.delete(t),n.size||(e[Ks]=void 0))}function oc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let wm=0;function ic(e,t,n,r){const s=e._endId=++wm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=bm(e,t);if(!i)return r();const d=i+"end";let u=0;const h=()=>{e.removeEventListener(d,g),o()},g=T=>{T.target===e&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),e.addEventListener(d,g)}function bm(e,t){const n=window.getComputedStyle(e),r=H=>(n[H]||"").split(", "),s=r(`${dr}Delay`),o=r(`${dr}Duration`),i=ac(s,o),a=r(`${Es}Delay`),l=r(`${Es}Duration`),d=ac(a,l);let u=null,h=0,g=0;t===dr?i>0&&(u=dr,h=i,g=o.length):t===Es?d>0&&(u=Es,h=d,g=l.length):(h=Math.max(i,d),u=h>0?i>d?dr:Es:null,g=u?u===dr?o.length:l.length:0);const T=u===dr&&/\b(?:transform|all)(?:,|$)/.test(r(`${dr}Property`).toString());return{type:u,timeout:h,propCount:g,hasTransform:T}}function ac(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>lc(n)+lc(e[r])))}function lc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function cc(e){return(e?e.ownerDocument:document).body.offsetHeight}function _m(e,t,n){const r=e[Ks];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const uc=Symbol("_vod"),km=Symbol("_vsh"),Tm=Symbol(""),Sm=/(?:^|;)\s*display\s*:/;function Im(e,t,n){const r=e.style,s=It(n);let o=!1;if(n&&!s){if(t)if(It(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&Co(r,a,"")}else for(const i in t)n[i]==null&&Co(r,i,"");for(const i in n)i==="display"&&(o=!0),Co(r,i,n[i])}else if(s){if(t!==n){const i=r[Tm];i&&(n+=";"+i),r.cssText=n,o=Sm.test(n)}}else t&&e.removeAttribute("style");uc in e&&(e[uc]=o?r.display:"",e[km]&&(r.display="none"))}const dc=/\s*!important$/;function Co(e,t,n){if(Ue(n))n.forEach(r=>Co(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Em(e,t);dc.test(n)?e.setProperty(Sr(r),n.replace(dc,""),"important"):e[r]=n}}const fc=["Webkit","Moz","ms"],Ui={};function Em(e,t){const n=Ui[t];if(n)return n;let r=en(t);if(r!=="filter"&&r in e)return Ui[t]=r;r=Qo(r);for(let s=0;s<fc.length;s++){const o=fc[s]+r;if(o in e)return Ui[t]=o}return t}const hc="http://www.w3.org/1999/xlink";function pc(e,t,n,r,s,o=Ah(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(hc,t.slice(6,t.length)):e.setAttributeNS(hc,t,n):n==null||o&&!Ju(n)?e.removeAttribute(t):e.setAttribute(t,o?"":En(n)?String(n):n)}function mc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?nf(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=Ju(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 Qr(e,t,n,r){e.addEventListener(t,n,r)}function Cm(e,t,n,r){e.removeEventListener(t,n,r)}const gc=Symbol("_vei");function Am(e,t,n,r,s=null){const o=e[gc]||(e[gc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=Rm(t);if(r){const d=o[t]=Mm(r,s);Qr(e,a,d,l)}else i&&(Cm(e,a,i,l),o[t]=void 0)}}const vc=/(?:Once|Passive|Capture)$/;function Rm(e){let t;if(vc.test(e)){t={};let r;for(;r=e.match(vc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Sr(e.slice(2)),t]}let Bi=0;const Pm=Promise.resolve(),xm=()=>Bi||(Pm.then(()=>Bi=0),Bi=Date.now());function Mm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;An(Om(r,n.value),t,5,[r])};return n.value=e,n.attached=xm(),n}function Om(e,t){if(Ue(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 yc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Nm=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?_m(e,r,i):t==="style"?Im(e,n,r):Yo(t)?qa(t)||Am(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):$m(e,t,r,i))?(mc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&pc(e,t,r,i,o,t!=="value")):e._isVueCE&&(Dm(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!It(r)))?mc(e,en(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),pc(e,t,r,i))};function $m(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&yc(t)&&ze(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 yc(t)&&It(n)?!1:t in e}function Dm(e,t){const n=e._def.props;if(!n)return!1;const r=en(t);return Array.isArray(n)?n.some(s=>en(s)===r):Object.keys(n).some(s=>en(s)===r)}const wc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ue(t)?n=>To(t,n):t};function Lm(e){e.target.composing=!0}function bc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Fi=Symbol("_assign");function _c(e,t,n){return t&&(e=e.trim()),n&&(e=Ka(e)),e}const sr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Fi]=wc(s);const o=r||s.props&&s.props.type==="number";Qr(e,t?"change":"input",i=>{i.target.composing||e[Fi](_c(e.value,n,o))}),(n||o)&&Qr(e,"change",()=>{e.value=_c(e.value,n,o)}),t||(Qr(e,"compositionstart",Lm),Qr(e,"compositionend",bc),Qr(e,"change",bc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Fi]=wc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?Ka(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))}},jm=["ctrl","shift","alt","meta"],Um={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)=>jm.some(n=>e[`${n}Key`]&&!t.includes(n))},it=(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=Um[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},Bm={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Zt=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Sr(s.key);if(t.some(i=>i===o||Bm[i]===o))return e(s)}))},Fm=Ot({patchProp:Nm},pm);let kc;function Hm(){return kc||(kc=Jp(Fm))}const Vm=((...e)=>{const t=Hm().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=qm(r);if(!s)return;const o=t._component;!ze(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,Wm(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function Wm(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function qm(e){return It(e)?document.querySelector(e):e}/*!
18
- * vue-router v4.6.4
19
- * (c) 2025 Eduardo San Martin Morote
20
- * @license MIT
21
- */const Zr=typeof document<"u";function of(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function zm(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&of(e.default)}const ut=Object.assign;function Hi(e,t){const n={};for(const r in t){const s=t[r];n[r]=Rn(s)?s.map(e):e(s)}return n}const js=()=>{},Rn=Array.isArray;function Tc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const af=/#/g,Gm=/&/g,Km=/\//g,Jm=/=/g,Ym=/\?/g,lf=/\+/g,Xm=/%5B/g,Qm=/%5D/g,cf=/%5E/g,Zm=/%60/g,uf=/%7B/g,eg=/%7C/g,df=/%7D/g,tg=/%20/g;function ul(e){return e==null?"":encodeURI(""+e).replace(eg,"|").replace(Xm,"[").replace(Qm,"]")}function ng(e){return ul(e).replace(uf,"{").replace(df,"}").replace(cf,"^")}function Ia(e){return ul(e).replace(lf,"%2B").replace(tg,"+").replace(af,"%23").replace(Gm,"%26").replace(Zm,"`").replace(uf,"{").replace(df,"}").replace(cf,"^")}function rg(e){return Ia(e).replace(Jm,"%3D")}function sg(e){return ul(e).replace(af,"%23").replace(Ym,"%3F")}function og(e){return sg(e).replace(Km,"%2F")}function Js(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const ig=/\/$/,ag=e=>e.replace(ig,"");function Vi(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=dg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Js(i)}}function lg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Sc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function cg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&us(t.matched[r],n.matched[s])&&ff(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function us(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function ff(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!ug(e[n],t[n]))return!1;return!0}function ug(e,t){return Rn(e)?Ic(e,t):Rn(t)?Ic(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Ic(e,t){return Rn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function dg(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 fr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ea=(function(e){return e.pop="pop",e.push="push",e})({}),Wi=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function fg(e){if(!e)if(Zr){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),ag(e)}const hg=/^[^#]+#/;function pg(e,t){return e.replace(hg,"#")+t}function mg(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 ci=()=>({left:window.scrollX,top:window.scrollY});function gg(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=mg(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 Ec(e,t){return(history.state?history.state.position-t:-1)+e}const Ca=new Map;function vg(e,t){Ca.set(e,t)}function yg(e){const t=Ca.get(e);return Ca.delete(e),t}function wg(e){return typeof e=="string"||e&&typeof e=="object"}function hf(e){return typeof e=="string"||typeof e=="symbol"}let Rt=(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 pf=Symbol("");Rt.MATCHER_NOT_FOUND+"",Rt.NAVIGATION_GUARD_REDIRECT+"",Rt.NAVIGATION_ABORTED+"",Rt.NAVIGATION_CANCELLED+"",Rt.NAVIGATION_DUPLICATED+"";function ds(e,t){return ut(new Error,{type:e,[pf]:!0},t)}function zn(e,t){return e instanceof Error&&pf in e&&(t==null||!!(e.type&t))}const bg=["params","query","hash"];function _g(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of bg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function kg(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(lf," "),o=s.indexOf("="),i=Js(o<0?s:s.slice(0,o)),a=o<0?null:Js(s.slice(o+1));if(i in t){let l=t[i];Rn(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Cc(e){let t="";for(let n in e){const r=e[n];if(n=rg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(Rn(r)?r.map(s=>s&&Ia(s)):[r&&Ia(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Tg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Rn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Sg=Symbol(""),Ac=Symbol(""),ui=Symbol(""),dl=Symbol(""),Aa=Symbol("");function Cs(){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 gr(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const d=g=>{g===!1?l(ds(Rt.NAVIGATION_ABORTED,{from:n,to:t})):g instanceof Error?l(g):wg(g)?l(ds(Rt.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(i&&r.enterCallbacks[s]===i&&typeof g=="function"&&i.push(g),a())},u=o(()=>e.call(r&&r.instances[s],t,n,d));let h=Promise.resolve(u);e.length<3&&(h=h.then(d)),h.catch(g=>l(g))})}function qi(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(of(l)){const d=(l.__vccOpts||l)[t];d&&o.push(gr(d,n,r,i,a,s))}else{let d=l();o.push(()=>d.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const h=zm(u)?u.default:u;i.mods[a]=u,i.components[a]=h;const g=(h.__vccOpts||h)[t];return g&&gr(g,n,r,i,a,s)()}))}}return o}function Ig(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=>us(d,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(d=>us(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 Eg=()=>location.protocol+"//"+location.host;function mf(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),Sc(a,"")}return Sc(n,e)+r+s}function Cg(e,t,n,r){let s=[],o=[],i=null;const a=({state:g})=>{const T=mf(e,location),H=n.value,M=t.value;let D=0;if(g){if(n.value=T,t.value=g,i&&i===H){i=null;return}D=M?g.position-M.position:0}else r(T);s.forEach(N=>{N(n.value,H,{delta:D,type:Ea.pop,direction:D?D>0?Wi.forward:Wi.back:Wi.unknown})})};function l(){i=n.value}function d(g){s.push(g);const T=()=>{const H=s.indexOf(g);H>-1&&s.splice(H,1)};return o.push(T),T}function u(){if(document.visibilityState==="hidden"){const{history:g}=window;if(!g.state)return;g.replaceState(ut({},g.state,{scroll:ci()}),"")}}function h(){for(const g of o)g();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:d,destroy:h}}function Rc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?ci():null}}function Ag(e){const{history:t,location:n}=window,r={value:mf(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,u){const h=e.indexOf("#"),g=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Eg()+e+l;try{t[u?"replaceState":"pushState"](d,"",g),s.value=d}catch(T){console.error(T),n[u?"replace":"assign"](g)}}function i(l,d){o(l,ut({},t.state,Rc(s.value.back,l,s.value.forward,!0),d,{position:s.value.position}),!0),r.value=l}function a(l,d){const u=ut({},s.value,t.state,{forward:l,scroll:ci()});o(u.current,u,!0),o(l,ut({},Rc(r.value,l,null),{position:u.position+1},d),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function Rg(e){e=fg(e);const t=Ag(e),n=Cg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=ut({location:"",base:e,go:r,createHref:pg.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 Pg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Rg(e)}let Fr=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Mt=(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})(Mt||{});const xg={type:Fr.Static,value:""},Mg=/[a-zA-Z0-9_]/;function Og(e){if(!e)return[[]];if(e==="/")return[[xg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(T){throw new Error(`ERR (${n})/"${d}": ${T}`)}let n=Mt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,d="",u="";function h(){d&&(n===Mt.Static?o.push({type:Fr.Static,value:d}):n===Mt.Param||n===Mt.ParamRegExp||n===Mt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Fr.Param,value:d,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function g(){d+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Mt.ParamRegExp){r=n,n=Mt.EscapeNext;continue}switch(n){case Mt.Static:l==="/"?(d&&h(),i()):l===":"?(h(),n=Mt.Param):g();break;case Mt.EscapeNext:g(),n=r;break;case Mt.Param:l==="("?n=Mt.ParamRegExp:Mg.test(l)?g():(h(),n=Mt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Mt.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Mt.ParamRegExpEnd:u+=l;break;case Mt.ParamRegExpEnd:h(),n=Mt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Mt.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),h(),i(),s}const Pc="[^/]+?",Ng={sensitive:!1,strict:!1,start:!0,end:!0};var Xt=(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})(Xt||{});const $g=/[.+*?^${}()[\]/\\]/g;function Dg(e,t){const n=ut({},Ng,t),r=[];let s=n.start?"^":"";const o=[];for(const d of e){const u=d.length?[]:[Xt.Root];n.strict&&!d.length&&(s+="/");for(let h=0;h<d.length;h++){const g=d[h];let T=Xt.Segment+(n.sensitive?Xt.BonusCaseSensitive:0);if(g.type===Fr.Static)h||(s+="/"),s+=g.value.replace($g,"\\$&"),T+=Xt.Static;else if(g.type===Fr.Param){const{value:H,repeatable:M,optional:D,regexp:N}=g;o.push({name:H,repeatable:M,optional:D});const P=N||Pc;if(P!==Pc){T+=Xt.BonusCustomRegExp;try{`${P}`}catch(B){throw new Error(`Invalid custom RegExp for param "${H}" (${P}): `+B.message)}}let V=M?`((?:${P})(?:/(?:${P}))*)`:`(${P})`;h||(V=D&&d.length<2?`(?:/${V})`:"/"+V),D&&(V+="?"),s+=V,T+=Xt.Dynamic,D&&(T+=Xt.BonusOptional),M&&(T+=Xt.BonusRepeatable),P===".*"&&(T+=Xt.BonusWildcard)}u.push(T)}r.push(u)}if(n.strict&&n.end){const d=r.length-1;r[d][r[d].length-1]+=Xt.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(d){const u=d.match(i),h={};if(!u)return null;for(let g=1;g<u.length;g++){const T=u[g]||"",H=o[g-1];h[H.name]=T&&H.repeatable?T.split("/"):T}return h}function l(d){let u="",h=!1;for(const g of e){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const T of g)if(T.type===Fr.Static)u+=T.value;else if(T.type===Fr.Param){const{value:H,repeatable:M,optional:D}=T,N=H in d?d[H]:"";if(Rn(N)&&!M)throw new Error(`Provided param "${H}" is an array but it is not repeatable (* or + modifiers)`);const P=Rn(N)?N.join("/"):N;if(!P)if(D)g.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${H}"`);u+=P}}return u||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function Lg(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]===Xt.Static+Xt.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Xt.Static+Xt.Segment?1:-1:0}function gf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=Lg(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 jg={strict:!1,end:!0,sensitive:!1};function Ug(e,t,n){const r=Dg(Og(e.path),n),s=ut(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function Bg(e,t){const n=[],r=new Map;t=Tc(jg,t);function s(h){return r.get(h)}function o(h,g,T){const H=!T,M=Oc(h);M.aliasOf=T&&T.record;const D=Tc(t,h),N=[M];if("alias"in h){const B=typeof h.alias=="string"?[h.alias]:h.alias;for(const ce of B)N.push(Oc(ut({},M,{components:T?T.record.components:M.components,path:ce,aliasOf:T?T.record:M})))}let P,V;for(const B of N){const{path:ce}=B;if(g&&ce[0]!=="/"){const de=g.record.path,me=de[de.length-1]==="/"?"":"/";B.path=g.record.path+(ce&&me+ce)}if(P=Ug(B,g,D),T?T.alias.push(P):(V=V||P,V!==P&&V.alias.push(P),H&&h.name&&!Nc(P)&&i(h.name)),vf(P)&&l(P),M.children){const de=M.children;for(let me=0;me<de.length;me++)o(de[me],P,T&&T.children[me])}T=T||P}return V?()=>{i(V)}:js}function i(h){if(hf(h)){const g=r.get(h);g&&(r.delete(h),n.splice(n.indexOf(g),1),g.children.forEach(i),g.alias.forEach(i))}else{const g=n.indexOf(h);g>-1&&(n.splice(g,1),h.record.name&&r.delete(h.record.name),h.children.forEach(i),h.alias.forEach(i))}}function a(){return n}function l(h){const g=Vg(h,n);n.splice(g,0,h),h.record.name&&!Nc(h)&&r.set(h.record.name,h)}function d(h,g){let T,H={},M,D;if("name"in h&&h.name){if(T=r.get(h.name),!T)throw ds(Rt.MATCHER_NOT_FOUND,{location:h});D=T.record.name,H=ut(Mc(g.params,T.keys.filter(V=>!V.optional).concat(T.parent?T.parent.keys.filter(V=>V.optional):[]).map(V=>V.name)),h.params&&Mc(h.params,T.keys.map(V=>V.name))),M=T.stringify(H)}else if(h.path!=null)M=h.path,T=n.find(V=>V.re.test(M)),T&&(H=T.parse(M),D=T.record.name);else{if(T=g.name?r.get(g.name):n.find(V=>V.re.test(g.path)),!T)throw ds(Rt.MATCHER_NOT_FOUND,{location:h,currentLocation:g});D=T.record.name,H=ut({},g.params,h.params),M=T.stringify(H)}const N=[];let P=T;for(;P;)N.unshift(P.record),P=P.parent;return{name:D,path:M,params:H,matched:N,meta:Hg(N)}}e.forEach(h=>o(h));function u(){n.length=0,r.clear()}return{addRoute:o,resolve:d,removeRoute:i,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Mc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Oc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Fg(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 Fg(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 Nc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Hg(e){return e.reduce((t,n)=>ut(t,n.meta),{})}function Vg(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;gf(e,t[o])<0?r=o:n=o+1}const s=Wg(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function Wg(e){let t=e;for(;t=t.parent;)if(vf(t)&&gf(e,t)===0)return t}function vf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function $c(e){const t=Sn(ui),n=Sn(dl),r=ue(()=>{const l=we(e.to);return t.resolve(l)}),s=ue(()=>{const{matched:l}=r.value,{length:d}=l,u=l[d-1],h=n.matched;if(!u||!h.length)return-1;const g=h.findIndex(us.bind(null,u));if(g>-1)return g;const T=Dc(l[d-2]);return d>1&&Dc(u)===T&&h[h.length-1].path!==T?h.findIndex(us.bind(null,l[d-2])):g}),o=ue(()=>s.value>-1&&Jg(n.params,r.value.params)),i=ue(()=>s.value>-1&&s.value===n.matched.length-1&&ff(n.params,r.value.params));function a(l={}){if(Kg(l)){const d=t[we(e.replace)?"replace":"push"](we(e.to)).catch(js);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:r,href:ue(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function qg(e){return e.length===1?e[0]:e}const zg=Nt({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:$c,setup(e,{slots:t}){const n=ti($c(e)),{options:r}=Sn(ui),s=ue(()=>({[Lc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Lc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&qg(t.default(n));return e.custom?o:cl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Gg=zg;function Kg(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 Jg(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(!Rn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function Dc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Lc=(e,t,n)=>e??t??n,Yg=Nt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Sn(Aa),s=ue(()=>e.route||r.value),o=Sn(Ac,0),i=ue(()=>{let d=we(o);const{matched:u}=s.value;let h;for(;(h=u[d])&&!h.components;)d++;return d}),a=ue(()=>s.value.matched[i.value]);So(Ac,ue(()=>i.value+1)),So(Sg,a),So(Aa,s);const l=j();return ht(()=>[l.value,a.value,e.name],([d,u,h],[g,T,H])=>{u&&(u.instances[h]=d,T&&T!==u&&d&&d===g&&(u.leaveGuards.size||(u.leaveGuards=T.leaveGuards),u.updateGuards.size||(u.updateGuards=T.updateGuards))),d&&u&&(!T||!us(u,T)||!g)&&(u.enterCallbacks[h]||[]).forEach(M=>M(d))},{flush:"post"}),()=>{const d=s.value,u=e.name,h=a.value,g=h&&h.components[u];if(!g)return jc(n.default,{Component:g,route:d});const T=h.props[u],H=T?T===!0?d.params:typeof T=="function"?T(d):T:null,D=cl(g,ut({},H,t,{onVnodeUnmounted:N=>{N.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return jc(n.default,{Component:D,route:d})||D}}});function jc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Xg=Yg;function Qg(e){const t=Bg(e.routes,e),n=e.parseQuery||kg,r=e.stringifyQuery||Cc,s=e.history,o=Cs(),i=Cs(),a=Cs(),l=Xh(fr);let d=fr;Zr&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Hi.bind(null,W=>""+W),h=Hi.bind(null,og),g=Hi.bind(null,Js);function T(W,le){let te,be;return hf(W)?(te=t.getRecordMatcher(W),be=le):be=W,t.addRoute(be,te)}function H(W){const le=t.getRecordMatcher(W);le&&t.removeRoute(le)}function M(){return t.getRoutes().map(W=>W.record)}function D(W){return!!t.getRecordMatcher(W)}function N(W,le){if(le=ut({},le||l.value),typeof W=="string"){const A=Vi(n,W,le.path),J=t.resolve({path:A.path},le),z=s.createHref(A.fullPath);return ut(A,J,{params:g(J.params),hash:Js(A.hash),redirectedFrom:void 0,href:z})}let te;if(W.path!=null)te=ut({},W,{path:Vi(n,W.path,le.path).path});else{const A=ut({},W.params);for(const J in A)A[J]==null&&delete A[J];te=ut({},W,{params:h(A)}),le.params=h(le.params)}const be=t.resolve(te,le),Le=W.hash||"";be.params=u(g(be.params));const v=lg(r,ut({},W,{hash:ng(Le),path:be.path})),b=s.createHref(v);return ut({fullPath:v,hash:Le,query:r===Cc?Tg(W.query):W.query||{}},be,{redirectedFrom:void 0,href:b})}function P(W){return typeof W=="string"?Vi(n,W,l.value.path):ut({},W)}function V(W,le){if(d!==W)return ds(Rt.NAVIGATION_CANCELLED,{from:le,to:W})}function B(W){return me(W)}function ce(W){return B(ut(P(W),{replace:!0}))}function de(W,le){const te=W.matched[W.matched.length-1];if(te&&te.redirect){const{redirect:be}=te;let Le=typeof be=="function"?be(W,le):be;return typeof Le=="string"&&(Le=Le.includes("?")||Le.includes("#")?Le=P(Le):{path:Le},Le.params={}),ut({query:W.query,hash:W.hash,params:Le.path!=null?{}:W.params},Le)}}function me(W,le){const te=d=N(W),be=l.value,Le=W.state,v=W.force,b=W.replace===!0,A=de(te,be);if(A)return me(ut(P(A),{state:typeof A=="object"?ut({},Le,A.state):Le,force:v,replace:b}),le||te);const J=te;J.redirectedFrom=le;let z;return!v&&cg(r,be,te)&&(z=ds(Rt.NAVIGATION_DUPLICATED,{to:J,from:be}),et(be,be,!0,!1)),(z?Promise.resolve(z):ie(J,be)).catch(x=>zn(x)?zn(x,Rt.NAVIGATION_GUARD_REDIRECT)?x:Ye(x):Se(x,J,be)).then(x=>{if(x){if(zn(x,Rt.NAVIGATION_GUARD_REDIRECT))return me(ut({replace:b},P(x.to),{state:typeof x.to=="object"?ut({},Le,x.to.state):Le,force:v}),le||J)}else x=Q(J,be,!0,b,Le);return pe(J,be,x),x})}function _e(W,le){const te=V(W,le);return te?Promise.reject(te):Promise.resolve()}function ne(W){const le=tt.values().next().value;return le&&typeof le.runWithContext=="function"?le.runWithContext(W):W()}function ie(W,le){let te;const[be,Le,v]=Ig(W,le);te=qi(be.reverse(),"beforeRouteLeave",W,le);for(const A of be)A.leaveGuards.forEach(J=>{te.push(gr(J,W,le))});const b=_e.bind(null,W,le);return te.push(b),We(te).then(()=>{te=[];for(const A of o.list())te.push(gr(A,W,le));return te.push(b),We(te)}).then(()=>{te=qi(Le,"beforeRouteUpdate",W,le);for(const A of Le)A.updateGuards.forEach(J=>{te.push(gr(J,W,le))});return te.push(b),We(te)}).then(()=>{te=[];for(const A of v)if(A.beforeEnter)if(Rn(A.beforeEnter))for(const J of A.beforeEnter)te.push(gr(J,W,le));else te.push(gr(A.beforeEnter,W,le));return te.push(b),We(te)}).then(()=>(W.matched.forEach(A=>A.enterCallbacks={}),te=qi(v,"beforeRouteEnter",W,le,ne),te.push(b),We(te))).then(()=>{te=[];for(const A of i.list())te.push(gr(A,W,le));return te.push(b),We(te)}).catch(A=>zn(A,Rt.NAVIGATION_CANCELLED)?A:Promise.reject(A))}function pe(W,le,te){a.list().forEach(be=>ne(()=>be(W,le,te)))}function Q(W,le,te,be,Le){const v=V(W,le);if(v)return v;const b=le===fr,A=Zr?history.state:{};te&&(be||b?s.replace(W.fullPath,ut({scroll:b&&A&&A.scroll},Le)):s.push(W.fullPath,Le)),l.value=W,et(W,le,te,b),Ye()}let ke;function Pe(){ke||(ke=s.listen((W,le,te)=>{if(!ct.listening)return;const be=N(W),Le=de(be,ct.currentRoute.value);if(Le){me(ut(Le,{replace:!0,force:!0}),be).catch(js);return}d=be;const v=l.value;Zr&&vg(Ec(v.fullPath,te.delta),ci()),ie(be,v).catch(b=>zn(b,Rt.NAVIGATION_ABORTED|Rt.NAVIGATION_CANCELLED)?b:zn(b,Rt.NAVIGATION_GUARD_REDIRECT)?(me(ut(P(b.to),{force:!0}),be).then(A=>{zn(A,Rt.NAVIGATION_ABORTED|Rt.NAVIGATION_DUPLICATED)&&!te.delta&&te.type===Ea.pop&&s.go(-1,!1)}).catch(js),Promise.reject()):(te.delta&&s.go(-te.delta,!1),Se(b,be,v))).then(b=>{b=b||Q(be,v,!1),b&&(te.delta&&!zn(b,Rt.NAVIGATION_CANCELLED)?s.go(-te.delta,!1):te.type===Ea.pop&&zn(b,Rt.NAVIGATION_ABORTED|Rt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),pe(be,v,b)}).catch(js)}))}let Me=Cs(),Te=Cs(),$e;function Se(W,le,te){Ye(W);const be=Te.list();return be.length?be.forEach(Le=>Le(W,le,te)):console.error(W),Promise.reject(W)}function Ne(){return $e&&l.value!==fr?Promise.resolve():new Promise((W,le)=>{Me.add([W,le])})}function Ye(W){return $e||($e=!W,Pe(),Me.list().forEach(([le,te])=>W?te(W):le()),Me.reset()),W}function et(W,le,te,be){const{scrollBehavior:Le}=e;if(!Zr||!Le)return Promise.resolve();const v=!te&&yg(Ec(W.fullPath,0))||(be||!te)&&history.state&&history.state.scroll||null;return Ut().then(()=>Le(W,le,v)).then(b=>b&&gg(b)).catch(b=>Se(b,W,le))}const Qe=W=>s.go(W);let Xe;const tt=new Set,ct={currentRoute:l,listening:!0,addRoute:T,removeRoute:H,clearRoutes:t.clearRoutes,hasRoute:D,getRoutes:M,resolve:N,options:e,push:B,replace:ce,go:Qe,back:()=>Qe(-1),forward:()=>Qe(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Te.add,isReady:Ne,install(W){W.component("RouterLink",Gg),W.component("RouterView",Xg),W.config.globalProperties.$router=ct,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>we(l)}),Zr&&!Xe&&l.value===fr&&(Xe=!0,B(s.location).catch(be=>{}));const le={};for(const be in fr)Object.defineProperty(le,be,{get:()=>l.value[be],enumerable:!0});W.provide(ui,ct),W.provide(dl,fd(le)),W.provide(Aa,l);const te=W.unmount;tt.add(W),W.unmount=function(){tt.delete(W),tt.size<1&&(d=fr,ke&&ke(),ke=null,l.value=fr,Xe=!1,$e=!1),te()}}};function We(W){return W.reduce((le,te)=>le.then(()=>ne(te)),Promise.resolve())}return ct}function Zg(){return Sn(ui)}function ev(e){return Sn(dl)}const Uc=768;function yf(){const e=j(typeof window<"u"?window.innerWidth<Uc:!1);let t=null;function n(r){e.value=r.matches}return lr(()=>{t=window.matchMedia(`(max-width: ${Uc-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),oi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const tv={key:0,class:"desktop-sidebar"},nv={class:"desktop-main"},Bc="codex-web-local.sidebar-width.v1",rv=260,sv=620,Fc=320,ov=Nt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=yf();function r(d){return Math.min(sv,Math.max(rv,d))}function s(){if(typeof window>"u")return Fc;const d=window.localStorage.getItem(Bc),u=Number(d);return Number.isFinite(u)?r(u):Fc}const o=j(s()),i=ue(()=>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(Bc,String(d))}function l(d){d.preventDefault();const u=d.clientX,h=o.value,g=H=>{const M=H.clientX-u;o.value=r(h+M)},T=()=>{a(o.value),window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",g),window.addEventListener("mouseup",T)}return(d,u)=>(y(),k("div",{class:at(["desktop-layout",{"is-mobile":we(n)}]),style:zr(i.value)},[we(n)?(y(),ft(Do,{key:0,to:"body"},[Re(sf,{name:"drawer"},{default:gt(()=>[e.isSidebarCollapsed?re("",!0):(y(),k("div",{key:0,class:"mobile-drawer-backdrop",onClick:u[1]||(u[1]=h=>d.$emit("close-sidebar"))},[p("aside",{class:"mobile-drawer",onClick:u[0]||(u[0]=it(()=>{},["stop"]))},[Bn(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):re("",!0),we(n)?re("",!0):(y(),k(je,{key:1},[e.isSidebarCollapsed?re("",!0):(y(),k("aside",tv,[Bn(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?re("",!0):(y(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),p("section",nv,[Bn(d.$slots,"content",{},void 0)])],6))}}),rt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},iv=rt(ov,[["__scopeId","data-v-df29c633"]]),av={},lv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function cv(e,t){return y(),k("svg",lv,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const di=rt(av,[["render",cv]]),uv={},dv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function fv(e,t){return y(),k("svg",dv,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const wf=rt(uv,[["render",fv]]),hv={},pv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mv(e,t){return y(),k("svg",pv,[...t[0]||(t[0]=[p("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 As=rt(hv,[["render",mv]]),gv={},vv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function yv(e,t){return y(),k("svg",vv,[...t[0]||(t[0]=[p("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 Fo=rt(gv,[["render",yv]]),wv={},bv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function _v(e,t){return y(),k("svg",bv,[...t[0]||(t[0]=[p("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 fl=rt(wv,[["render",_v]]),kv={},Tv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Sv(e,t){return y(),k("svg",Tv,[...t[0]||(t[0]=[p("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 Iv=rt(kv,[["render",Sv]]),Ev={},Cv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Av(e,t){return y(),k("svg",Cv,[...t[0]||(t[0]=[p("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 Ao=rt(Ev,[["render",Av]]),Rv={},Pv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function xv(e,t){return y(),k("svg",Pv,[...t[0]||(t[0]=[p("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 zi=rt(Rv,[["render",xv]]),Mv={key:0,class:"sidebar-menu-row-left"},Ov={class:"sidebar-menu-row-main"},Nv={key:1,class:"sidebar-menu-row-right"},$v={key:0,class:"sidebar-menu-row-right-default"},Dv={key:1,class:"sidebar-menu-row-right-hover"},Lv=Nt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Cp(),r=ue(()=>!!n.left),s=ue(()=>!!n.right),o=ue(()=>!!n["right-hover"]),i=ue(()=>s.value||o.value);return(a,l)=>(y(),ft(ya(t.as),Qd({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:gt(()=>[r.value?(y(),k("span",Mv,[Bn(a.$slots,"left",{},void 0,!0)])):re("",!0),p("span",Ov,[Bn(a.$slots,"default",{},void 0,!0)]),i.value?(y(),k("span",Nv,[s.value?(y(),k("span",$v,[Bn(a.$slots,"right",{},void 0,!0)])):re("",!0),o.value?(y(),k("span",Dv,[Bn(a.$slots,"right-hover",{},void 0,!0)])):re("",!0)])):re("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Dr=rt(Lv,[["__scopeId","data-v-daeca4df"]]),jv={class:"thread-tree-root"},Uv={key:0,class:"pinned-section"},Bv={class:"thread-list"},Fv={class:"thread-left-stack"},Hv=["data-state"],Vv=["onClick"],Wv=["onClick"],qv={class:"thread-row-title-wrap"},zv={class:"thread-row-title"},Gv={class:"thread-row-time"},Kv=["onClick"],Jv=["onClick"],Yv=["onClick"],Xv=["onClick"],Qv=["aria-expanded"],Zv=["data-active"],ey={key:0},ty=["data-active"],ny={key:0},ry={key:1,class:"thread-tree-no-results"},sy={key:2,class:"thread-tree-loading"},oy={key:3,class:"thread-list thread-list-global"},iy={class:"thread-left-stack"},ay=["data-state"],ly=["onClick"],cy=["onClick"],uy={class:"thread-row-title-wrap"},dy={class:"thread-row-title"},fy={class:"thread-row-time"},hy=["onClick"],py=["onClick"],my=["onClick"],gy=["onClick"],vy=["data-project-name","data-expanded","data-dragging"],yy={class:"project-icon-stack"},wy={class:"project-icon-folder"},by={class:"project-icon-chevron"},_y=["data-dragging-handle","onMousedown"],ky={class:"project-title"},Ty={class:"project-hover-controls"},Sy=["onClick"],Iy=["onClick"],Ey=["onClick"],Cy=["onClick"],Ay=["onInput"],Ry=["aria-label","title","onClick"],Py={key:0,class:"thread-list"},xy={class:"thread-left-stack"},My=["data-state"],Oy=["onClick"],Ny=["onClick"],$y={class:"thread-row-title-wrap"},Dy={class:"thread-row-title"},Ly={class:"thread-row-time"},jy=["onClick"],Uy=["onClick"],By=["onClick"],Fy=["onClick"],Hy=["onClick"],Vy={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},Wy=["onKeydown"],qy={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},zy={class:"rename-thread-subtitle"},Gy=4,Hc=6,Vc="codex-web-local.thread-view-mode.v1",Wc="codex-web-local.collapsed-projects.v1",Ky=Nt({__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=j({}),o=j({}),i=j([]),a=j(""),l=j(""),d=j("actions"),u=j(""),h=j(!1),g=j(""),T=j(""),H=j(null),M=j(!1),D=j(""),N=j(""),P=j(null),V=j(null),B=j(null);let ce=null,de=null;const me=j(""),_e=j({}),ne=new Map,ie=new Map,pe=new Map,Q=new WeakMap,ke=j(null),Pe=j(!1),Me=j(Se()),Te=typeof window<"u"?new ResizeObserver(E=>{for(const O of E){const L=O.target,ee=Q.get(L);ee&&q(ee,L)}}):null;function $e(){if(typeof window>"u")return{};try{const E=window.localStorage.getItem(Wc);if(!E)return{};const O=JSON.parse(E);return!O||typeof O!="object"||Array.isArray(O)?{}:O}catch{return{}}}function Se(){return typeof window>"u"?"project":window.localStorage.getItem(Vc)==="chronological"?"chronological":"project"}o.value=$e(),ht(o,E=>{typeof window>"u"||window.localStorage.setItem(Wc,JSON.stringify(E))},{deep:!0}),ht(Me,E=>{typeof window>"u"||window.localStorage.setItem(Vc,E)});const Ne=ue(()=>n.searchQuery.trim().toLowerCase()),Ye=ue(()=>Ne.value.length>0),et=ue(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function Qe(E){if(!Ye.value)return!0;if(et.value)return et.value.has(E.id);const O=Ne.value;return E.title.toLowerCase().includes(O)||E.preview.toLowerCase().includes(O)}const Xe=ue(()=>Ye.value?n.groups.map(E=>({...E,threads:E.threads.filter(Qe)})).filter(E=>E.threads.length>0):n.groups),tt=ue(()=>Me.value==="chronological"),ct=ue(()=>{const E=Xe.value,O=[];for(const L of E)for(const ee of L.threads)b(ee.id)||O.push(ee);return O.sort((L,ee)=>{const Fe=new Date(L.updatedAtIso||L.createdAtIso).getTime();return new Date(ee.updatedAtIso||ee.createdAtIso).getTime()-Fe})}),We=ue(()=>{const E=new Map;for(const O of n.groups)for(const L of O.threads)E.set(L.id,L);return E}),W=ue(()=>i.value.map(E=>We.value.get(E)??null).filter(E=>E!==null).filter(Qe)),le=ue(()=>{const E=B.value;if(!E||E.dropTargetIndexFull===null||n.groups.length===0)return null;const O=Math.max(0,Math.min(E.dropTargetIndexFull,n.groups.length)),L=O>E.fromIndex?O-1:O,ee=Math.max(0,Math.min(L,n.groups.length-1));return ee===E.fromIndex?null:ee}),te=ue(()=>{const O=(Ye.value?Xe.value:n.groups).map(dn=>dn.projectName),L=B.value,ee=le.value;if(!L||ee===null)return O;const Fe=[...O],[At]=Fe.splice(L.fromIndex,1);return At?(Fe.splice(ee,0,At),Fe):O}),be=ue(()=>{const E={};let O=0;for(const L of te.value)E[L]=O,O+=Kt(L);return E}),Le=ue(()=>{let E=0;for(const O of te.value)E+=Kt(O);return{height:`${Math.max(0,E)}px`}});function v(E){const O=new Date(E).getTime();if(Number.isNaN(O))return"n/a";const L=Math.abs(Date.now()-O);if(L<6e4)return"now";const ee=Math.floor(L/6e4);if(ee<60)return`${ee}m`;const Fe=Math.floor(ee/60);return Fe<24?`${Fe}h`:`${Math.floor(Fe/24)}d`}function b(E){return i.value.includes(E)}function A(E){if(b(E)){i.value=i.value.filter(O=>O!==E);return}i.value=[E,...i.value]}function J(E){r("select",E)}function z(E){r("export-thread",E),K()}function x(E){return`start new thread ${nt(E)}`}function U(E){r("start-new-thread",E)}function G(E){l.value===E&&K()}function Y(E){return l.value===E}function K(){l.value=""}function ye(E){if(l.value===E){K();return}l.value=E}function fe(E,O){g.value=E,T.value=O,h.value=!0,K(),Ut(()=>{var L,ee;(L=H.value)==null||L.focus(),(ee=H.value)==null||ee.select()})}function ge(){h.value=!1,g.value="",T.value=""}function xe(){const E=g.value,O=T.value.trim();!E||!O||(r("rename-thread",{threadId:E,title:O}),ge())}function Be(E,O){D.value=E,N.value=O,M.value=!0,K()}function qe(){M.value=!1,D.value="",N.value=""}function He(){const E=D.value;E&&(i.value=i.value.filter(O=>O!==E),r("archive",E),qe())}function nt(E){return n.projectDisplayNameById[E]??E}function Ke(E){return a.value===E}function vt(){a.value="",d.value="actions",u.value=""}function Et(){Pe.value=!Pe.value}function Pt(E){Me.value=E,Pe.value=!1}function St(E){if(a.value===E){vt();return}a.value=E,d.value="actions",u.value=nt(E)}function Ze(E){a.value=E,d.value="rename",u.value=nt(E)}function kt(E){r("rename-project",{projectName:E,displayName:u.value})}function mt(E){r("remove-project",E),vt()}function Je(E){r("browse-project-files",E),vt()}function Gt(E,O){if(!E.altKey||E.key!=="ArrowUp"&&E.key!=="ArrowDown")return;const L=n.groups.findIndex(At=>At.projectName===O);if(L<0)return;const ee=E.key==="ArrowUp"?-1:1,Fe=Math.max(0,Math.min(L+ee,n.groups.length-1));Fe!==L&&(E.preventDefault(),r("reorder-project",{projectName:O,toIndex:Fe}))}function rn(E){return s.value[E]===!0}function xt(E){return o.value[E]===!0}function ln(E){s.value={...s.value,[E]:!rn(E)}}function cn(E){if(me.value===E){me.value="";return}o.value={...o.value,[E]:!xt(E)}}function Kt(E){const O=_e.value[E]??0,L=B.value,Fe=((L==null?void 0:L.projectName)===E?L.groupHeight:null)??O,At=xt(E)?0:Hc;return Math.max(0,Fe+At)}function Lt(E,O){const L=O instanceof HTMLElement?O:O&&"$el"in O&&O.$el instanceof HTMLElement?O.$el:null;if(L){ie.set(E,L);return}ie.delete(E)}function jt(E,O){const L=O instanceof HTMLElement?O:O&&"$el"in O&&O.$el instanceof HTMLElement?O.$el:null;if(L){pe.set(E,L);return}pe.delete(E)}function De(E){const O=a.value;if(!O)return!1;const L=ie.get(O);if(!L)return!1;if((typeof E.composedPath=="function"?E.composedPath():[]).includes(L))return!0;const Fe=E.target;return Fe instanceof Node?L.contains(Fe):!1}function Ie(E){const O=l.value;if(!O)return!1;const L=pe.get(O);if(!L)return!1;if((typeof E.composedPath=="function"?E.composedPath():[]).includes(L))return!0;const Fe=E.target;return Fe instanceof Node?L.contains(Fe):!1}function Jt(E){if(Pe.value){const O=ke.value,L=typeof E.composedPath=="function"?E.composedPath():[];!!O&&(L.includes(O)||E.target instanceof Node&&O.contains(E.target))||(Pe.value=!1)}a.value&&(De(E)||vt(),l.value&&(Ie(E)||K()))}function yn(E){a.value&&!De(E)&&vt(),l.value&&!Ie(E)&&K()}function w(){Pe.value&&(Pe.value=!1),a.value&&vt(),l.value&&K()}function I(){window.addEventListener("pointerdown",Jt,{capture:!0}),window.addEventListener("focusin",yn,{capture:!0}),window.addEventListener("blur",w)}function C(){window.removeEventListener("pointerdown",Jt,{capture:!0}),window.removeEventListener("focusin",yn,{capture:!0}),window.removeEventListener("blur",w)}function q(E,O){const L=O.getBoundingClientRect().height;if(!Number.isFinite(L)||L<=0)return;const ee=_e.value[E];ee!==void 0&&Math.abs(ee-L)<.5||(_e.value={..._e.value,[E]:L})}function oe(E,O){const L=ne.get(E);L&&L!==O&&Te&&Te.unobserve(L);const ee=O instanceof HTMLElement?O:O&&"$el"in O&&O.$el instanceof HTMLElement?O.$el:null;if(ee){ne.set(E,ee),Q.set(ee,E),q(E,ee),Te==null||Te.observe(ee);return}L&&(Te==null||Te.unobserve(L)),ne.delete(E)}function ae(E,O){if(E.button!==0||V.value||B.value)return;const L=n.groups.findIndex(dn=>dn.projectName===O),ee=ne.get(O);if(L<0||!ee)return;const Fe=ee.getBoundingClientRect(),At=xt(O)?0:Hc;V.value={projectName:O,fromIndex:L,startClientX:E.clientX,startClientY:E.clientY,pointerOffsetY:E.clientY-Fe.top,groupLeft:Fe.left,groupWidth:Fe.width,groupHeight:Fe.height,groupOuterHeight:Fe.height+At},E.preventDefault(),Ce()}function Ce(){window.addEventListener("mousemove",R),window.addEventListener("mouseup",F),window.addEventListener("keydown",X)}function ve(){window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",F),window.removeEventListener("keydown",X)}function R(E){ce={clientX:E.clientX,clientY:E.clientY},yt()}function F(E){un({clientX:E.clientX,clientY:E.clientY});const O=B.value;if(O&&le.value!==null){const L=n.groups.findIndex(ee=>ee.projectName===O.projectName);if(L>=0){const ee=le.value;ee!==L&&r("reorder-project",{projectName:O.projectName,toIndex:ee})}}Oe()}function X(E){E.key==="Escape"&&(!V.value&&!B.value||(E.preventDefault(),Oe()))}function Oe(){de!==null&&(window.cancelAnimationFrame(de),de=null),ce=null,V.value=null,B.value=null,me.value="",ve()}function yt(){de===null&&(de=window.requestAnimationFrame(()=>{if(de=null,!ce)return;const E=ce;ce=null,un(E)}))}function un(E){const O=V.value;if(!B.value&&O){const L=E.clientX-O.startClientX,ee=E.clientY-O.startClientY;if(Math.hypot(L,ee)<Gy)return;vt(),me.value=O.projectName,B.value={projectName:O.projectName,fromIndex:O.fromIndex,pointerOffsetY:O.pointerOffsetY,groupLeft:O.groupLeft,groupWidth:O.groupWidth,groupHeight:O.groupHeight,groupOuterHeight:O.groupOuterHeight,ghostTop:E.clientY-O.pointerOffsetY,dropTargetIndexFull:null}}B.value&&Ct(E)}function Ct(E){const O=B.value;if(!O)return;if(O.ghostTop=E.clientY-O.pointerOffsetY,!sn(E)){O.dropTargetIndexFull=null;return}const L=E.clientY,ee=P.value;if(!ee){O.dropTargetIndexFull=null;return}const Fe=ee.getBoundingClientRect(),At=new Map(n.groups.map((on,wn)=>[on.projectName,wn])),dn=n.groups.map(on=>on.projectName).filter(on=>on!==O.projectName);let Cr=0,Ar=n.groups.length;for(const on of dn){const wn=At.get(on);if(wn===void 0)continue;const Rr=Kt(on),ks=Fe.top+Cr+Rr/2;if(L<ks){Ar=wn;break}Cr+=Rr}O.dropTargetIndexFull=Ar}function sn(E){const O=P.value;if(!O)return!1;const L=O.getBoundingClientRect(),ee=E.clientX>=L.left&&E.clientX<=L.right,Fe=E.clientY>=L.top-32&&E.clientY<=L.bottom+32;return ee&&Fe}function $t(E){var O;return((O=B.value)==null?void 0:O.projectName)===E}function Pn(E){const O=B.value,L=be.value[E]??0,ee=a.value===E;return!O||O.projectName!==E?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ee?"40":"1",transform:`translate3d(0, ${L}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${O.groupLeft}px`,width:`${O.groupWidth}px`,height:`${O.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${O.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function hn(E){return E.threads.filter(O=>!b(O.id))}function ys(E){if(Ye.value)return hn(E);if(xt(E.projectName))return[];const O=hn(E);return rn(E.projectName)?O:O.slice(0,10)}function ws(E){return Ye.value?!1:!xt(E.projectName)&&hn(E).length>10}function bs(E){return hn(E).length>0}function Er(E){return E.inProgress?"working":E.unread?"unread":"idle"}ht(()=>n.groups.map(E=>E.projectName),E=>{var Fe,At;const O=((Fe=B.value)==null?void 0:Fe.projectName)??((At=V.value)==null?void 0:At.projectName)??"";O&&!n.groups.some(dn=>dn.projectName===O)&&Oe();const L=new Set(E),ee=Object.fromEntries(Object.entries(_e.value).filter(([dn])=>L.has(dn)));Object.keys(ee).length!==Object.keys(_e.value).length&&(_e.value=ee)});const _s=ue(()=>Pe.value||a.value!=="");return ht(_s,E=>{if(E){I();return}C()}),cr(()=>{for(const E of ne.values())Te==null||Te.unobserve(E);ne.clear(),ie.clear(),C(),Oe()}),(E,O)=>(y(),k("section",jv,[W.value.length>0?(y(),k("section",Uv,[p("ul",Bv,[(y(!0),k(je,null,bt(W.value,L=>(y(),k("li",{key:L.id,class:"thread-row-item"},[Re(Dr,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":b(L.id),onMouseleave:ee=>G(L.id)},{left:gt(()=>[p("span",Fv,[L.inProgress||L.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Er(L)},null,8,Hv)):re("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ee=>A(L.id)},[Re(zi,{class:"thread-icon"})],8,Vv)])]),right:gt(()=>[p("span",Gv,se(v(L.createdAtIso||L.updatedAtIso)),1)]),"right-hover":gt(()=>[p("div",{ref_for:!0,ref:ee=>jt(L.id,ee),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:it(ee=>ye(L.id),["stop"])},[Re(As,{class:"thread-icon"})],8,Kv),Y(L.id)?(y(),k("div",{key:0,class:"thread-menu-panel",onClick:O[0]||(O[0]=it(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:ee=>z(L.id)}," Export chat ",8,Jv),p("button",{class:"thread-menu-item",type:"button",onClick:ee=>fe(L.id,L.title)}," Rename thread ",8,Yv),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:ee=>Be(L.id,L.title)}," Delete thread ",8,Xv)])):re("",!0)],512)]),default:gt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:ee=>J(L.id)},[p("span",qv,[p("span",zv,se(L.title),1),L.hasWorktree?(y(),ft(Ao,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):re("",!0)])],8,Wv)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])])):re("",!0),Re(Dr,{as:"header",class:"thread-tree-header-row"},{right:gt(()=>[p("div",{ref_key:"organizeMenuWrapRef",ref:ke,class:"organize-menu-wrap"},[p("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Pe.value,"aria-label":"Organize threads",title:"Organize threads",onClick:Et},[Re(As,{class:"thread-icon"})],8,Qv),Pe.value?(y(),k("div",{key:0,class:"organize-menu-panel",onClick:O[3]||(O[3]=it(()=>{},["stop"]))},[O[11]||(O[11]=p("p",{class:"organize-menu-title"},"Organize",-1)),p("button",{class:"organize-menu-item","data-active":Me.value==="project",type:"button",onClick:O[1]||(O[1]=L=>Pt("project"))},[O[9]||(O[9]=p("span",null,"By project",-1)),Me.value==="project"?(y(),k("span",ey,"✓")):re("",!0)],8,Zv),p("button",{class:"organize-menu-item","data-active":Me.value==="chronological",type:"button",onClick:O[2]||(O[2]=L=>Pt("chronological"))},[O[10]||(O[10]=p("span",null,"Chronological list",-1)),Me.value==="chronological"?(y(),k("span",ny,"✓")):re("",!0)],8,ty)])):re("",!0)],512)]),default:gt(()=>[O[12]||(O[12]=p("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),Ye.value&&Xe.value.length===0?(y(),k("p",ry,"No matching threads")):e.isLoading&&e.groups.length===0?(y(),k("p",sy,"Loading threads...")):tt.value?(y(),k("ul",oy,[(y(!0),k(je,null,bt(ct.value,L=>(y(),k("li",{key:L.id,class:"thread-row-item"},[Re(Dr,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":b(L.id),onMouseleave:ee=>G(L.id)},{left:gt(()=>[p("span",iy,[L.inProgress||L.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Er(L)},null,8,ay)):re("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ee=>A(L.id)},[Re(zi,{class:"thread-icon"})],8,ly)])]),right:gt(()=>[p("span",fy,se(v(L.createdAtIso||L.updatedAtIso)),1)]),"right-hover":gt(()=>[p("div",{ref_for:!0,ref:ee=>jt(L.id,ee),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:it(ee=>ye(L.id),["stop"])},[Re(As,{class:"thread-icon"})],8,hy),Y(L.id)?(y(),k("div",{key:0,class:"thread-menu-panel",onClick:O[4]||(O[4]=it(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:ee=>z(L.id)}," Export chat ",8,py),p("button",{class:"thread-menu-item",type:"button",onClick:ee=>fe(L.id,L.title)}," Rename thread ",8,my),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:ee=>Be(L.id,L.title)}," Delete thread ",8,gy)])):re("",!0)],512)]),default:gt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:ee=>J(L.id)},[p("span",uy,[p("span",dy,se(L.title),1),L.hasWorktree?(y(),ft(Ao,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):re("",!0)])],8,cy)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(y(),k("div",{key:4,ref_key:"groupsContainerRef",ref:P,class:"thread-tree-groups",style:zr(Le.value)},[(y(!0),k(je,null,bt(Xe.value,L=>(y(),k("article",{key:L.projectName,ref_for:!0,ref:ee=>oe(L.projectName,ee),class:"project-group","data-project-name":L.projectName,"data-expanded":!xt(L.projectName),"data-dragging":$t(L.projectName),style:zr(Pn(L.projectName))},[Re(Dr,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:ee=>cn(L.projectName),onKeydown:[ee=>Gt(ee,L.projectName),Zt(it(ee=>cn(L.projectName),["prevent"]),["enter"]),Zt(it(ee=>cn(L.projectName),["prevent"]),["space"])]},{left:gt(()=>[p("span",yy,[p("span",wy,[xt(L.projectName)?(y(),ft(fl,{key:0,class:"thread-icon"})):(y(),ft(Iv,{key:1,class:"thread-icon"}))]),p("span",by,[xt(L.projectName)?(y(),ft(wf,{key:0,class:"thread-icon"})):(y(),ft(di,{key:1,class:"thread-icon"}))])])]),right:gt(()=>[p("div",Ty,[p("div",{ref_for:!0,ref:ee=>Lt(L.projectName,ee),class:"project-menu-wrap"},[p("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:it(ee=>St(L.projectName),["stop"])},[Re(As,{class:"thread-icon"})],8,Sy),Ke(L.projectName)?(y(),k("div",{key:0,class:"project-menu-panel",onClick:O[6]||(O[6]=it(()=>{},["stop"]))},[d.value==="actions"?(y(),k(je,{key:0},[p("button",{class:"project-menu-item",type:"button",onClick:ee=>Je(L.projectName)}," Browse files ",8,Iy),p("button",{class:"project-menu-item",type:"button",onClick:ee=>Ze(L.projectName)}," Edit name ",8,Ey),p("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:ee=>mt(L.projectName)}," Remove ",8,Cy)],64)):(y(),k(je,{key:1},[O[13]||(O[13]=p("label",{class:"project-menu-label"},"Project name",-1)),rr(p("input",{"onUpdate:modelValue":O[5]||(O[5]=ee=>u.value=ee),class:"project-menu-input",type:"text",onInput:ee=>kt(L.projectName)},null,40,Ay),[[sr,u.value]])],64))])):re("",!0)],512),p("button",{class:"thread-start-button",type:"button","aria-label":x(L.projectName),title:x(L.projectName),onClick:it(ee=>U(L.projectName),["stop"])},[Re(Fo,{class:"thread-icon"})],8,Ry)])]),default:gt(()=>[p("span",{class:"project-main-button","data-dragging-handle":$t(L.projectName),onMousedown:it(ee=>ae(ee,L.projectName),["left"])},[p("span",ky,se(nt(L.projectName)),1)],40,_y)]),_:2},1032,["onClick","onKeydown"]),bs(L)?(y(),k("ul",Py,[(y(!0),k(je,null,bt(ys(L),ee=>(y(),k("li",{key:ee.id,class:"thread-row-item"},[Re(Dr,{class:"thread-row","data-active":ee.id===e.selectedThreadId,"data-pinned":b(ee.id),onMouseleave:Fe=>G(ee.id)},{left:gt(()=>[p("span",xy,[ee.inProgress||ee.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Er(ee)},null,8,My)):re("",!0),p("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Fe=>A(ee.id)},[Re(zi,{class:"thread-icon"})],8,Oy)])]),right:gt(()=>[p("span",Ly,se(v(ee.createdAtIso||ee.updatedAtIso)),1)]),"right-hover":gt(()=>[p("div",{ref_for:!0,ref:Fe=>jt(ee.id,Fe),class:"thread-menu-wrap"},[p("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:it(Fe=>ye(ee.id),["stop"])},[Re(As,{class:"thread-icon"})],8,jy),Y(ee.id)?(y(),k("div",{key:0,class:"thread-menu-panel",onClick:O[7]||(O[7]=it(()=>{},["stop"]))},[p("button",{class:"thread-menu-item",type:"button",onClick:Fe=>z(ee.id)}," Export chat ",8,Uy),p("button",{class:"thread-menu-item",type:"button",onClick:Fe=>fe(ee.id,ee.title)}," Rename thread ",8,By),p("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Fe=>Be(ee.id,ee.title)}," Delete thread ",8,Fy)])):re("",!0)],512)]),default:gt(()=>[p("button",{class:"thread-main-button",type:"button",onClick:Fe=>J(ee.id)},[p("span",$y,[p("span",Dy,se(ee.title),1),ee.hasWorktree?(y(),ft(Ao,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):re("",!0)])],8,Ny)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(y(),ft(Dr,{key:1,as:"p",class:"project-empty-row"},{left:gt(()=>[...O[14]||(O[14]=[p("span",{class:"project-empty-spacer"},null,-1)])]),default:gt(()=>[O[15]||(O[15]=p("span",{class:"project-empty"},"No threads",-1))]),_:1})),ws(L)?(y(),ft(Dr,{key:2,class:"thread-show-more-row"},{left:gt(()=>[...O[16]||(O[16]=[p("span",{class:"thread-show-more-spacer"},null,-1)])]),default:gt(()=>[p("button",{class:"thread-show-more-button",type:"button",onClick:ee=>ln(L.projectName)},se(rn(L.projectName)?"Show less":"Show more"),9,Hy)]),_:2},1024)):re("",!0)],12,vy))),128))],4)),(y(),ft(Do,{to:"body"},[h.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:it(ge,["self"])},[p("div",Vy,[O[17]||(O[17]=p("h3",{class:"rename-thread-title"},"Rename thread",-1)),O[18]||(O[18]=p("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),rr(p("input",{ref_key:"renameThreadInputRef",ref:H,"onUpdate:modelValue":O[8]||(O[8]=L=>T.value=L),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[Zt(it(xe,["prevent"]),["enter"]),Zt(it(ge,["prevent"]),["esc"])]},null,40,Wy),[[sr,T.value]]),p("div",{class:"rename-thread-actions"},[p("button",{class:"rename-thread-button",type:"button",onClick:ge},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:xe},"Save")])])])):re("",!0)])),(y(),ft(Do,{to:"body"},[M.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:it(qe,["self"])},[p("div",qy,[O[19]||(O[19]=p("h3",{class:"rename-thread-title"},"Delete thread?",-1)),p("p",zy,' This will archive the thread "'+se(N.value)+'". You can find it later in archived threads. ',1),p("div",{class:"rename-thread-actions"},[p("button",{class:"rename-thread-button",type:"button",onClick:qe},"Cancel"),p("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:He},"Delete")])])])):re("",!0)]))]))}}),Jy=rt(Ky,[["__scopeId","data-v-e2f8a8e1"]]),Yy={class:"content-header"},Xy={class:"content-leading"},Qy={class:"content-title"},Zy={class:"content-actions"},ew=Nt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(y(),k("header",Yy,[p("div",Xy,[Bn(t.$slots,"leading",{},void 0)]),p("h1",Qy,se(e.title),1),p("div",Zy,[Bn(t.$slots,"actions",{},void 0)])]))}}),tw=rt(ew,[["__scopeId","data-v-66ee223c"]]),nw={},rw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function sw(e,t){return y(),k("svg",rw,[...t[0]||(t[0]=[p("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const hl=rt(nw,[["render",sw]]),ow={},iw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function aw(e,t){return y(),k("svg",iw,[...t[0]||(t[0]=[p("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 lw=rt(ow,[["render",aw]]),cw={},uw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function dw(e,t){return y(),k("svg",uw,[...t[0]||(t[0]=[p("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 fw=rt(cw,[["render",dw]]),hw={class:"conversation-root"},pw={key:0,class:"conversation-loading"},mw={key:1,class:"conversation-empty"},gw={class:"message-row"},vw={class:"message-stack"},yw={class:"request-card"},ww={class:"request-title"},bw={class:"request-meta"},_w={key:0,class:"request-reason"},kw={key:1,class:"request-actions"},Tw=["onClick"],Sw=["onClick"],Iw=["onClick"],Ew=["onClick"],Cw={key:2,class:"request-actions"},Aw=["onClick"],Rw=["onClick"],Pw=["onClick"],xw=["onClick"],Mw={key:3,class:"request-user-input"},Ow={class:"request-question-title"},Nw={key:0,class:"request-question-text"},$w=["value","onChange"],Dw=["value"],Lw=["value","onInput"],jw=["onClick"],Uw={key:4,class:"request-actions"},Bw=["onClick"],Fw=["onClick"],Hw={key:5,class:"request-actions"},Vw=["onClick"],Ww=["onClick"],qw=["data-role","data-message-type"],zw={key:0,class:"message-row","data-role":"system"},Gw={class:"message-stack","data-role":"system"},Kw=["onClick"],Jw={class:"cmd-label"},Yw={class:"cmd-status"},Xw={class:"cmd-output-inner"},Qw={class:"cmd-output"},Zw=["data-role","data-message-type"],eb=["data-role"],tb=["data-role"],nb=["data-role"],rb=["onClick"],sb=["src"],ob={key:1,class:"message-file-attachments"},ib={class:"message-file-link-wrap"},ab=["href","title"],lb=["href","title"],cb=["data-role"],ub={key:0,class:"worked-separator-wrap","aria-live":"polite"},db=["onClick"],fb={class:"worked-separator-text"},hb={key:0,class:"worked-details"},pb=["onClick"],mb={class:"cmd-label"},gb={class:"cmd-status"},vb={class:"cmd-output-inner"},yb={class:"cmd-output"},wb={key:1,class:"message-text-flow"},bb={key:0,class:"message-text"},_b={key:0},kb={key:1,class:"message-bold-text"},Tb={key:2,class:"message-file-link-wrap"},Sb=["href","title"],Ib=["href","title"],Eb=["href","title"],Cb={key:4,class:"message-inline-code"},Ab={key:1,class:"message-text"},Rb=["onClick"],Pb=["src","alt","onError"],xb={key:0,class:"message-actions"},Mb=["onClick"],Ob=["onClick"],Nb={key:0,class:"conversation-item conversation-item-overlay"},$b={class:"message-row"},Db={class:"message-stack"},Lb={class:"live-overlay-inline","aria-live":"polite"},jb={class:"live-overlay-label"},Ub={key:1,class:"live-overlay-error"},Bb=["src"],Fb=16,Hb=Nt({__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=j(new Set),r=j(new Set),s=j(new Set),o=j({});function i(w){return w.messageType==="commandExecution"&&!!w.commandExecution}function a(w){var I;return((I=w.commandExecution)==null?void 0:I.status)==="inProgress"||r.value.has(w.id)?!0:n.value.has(w.id)}function l(w){return r.value.has(w.id)}function d(w){var C;if(((C=w.commandExecution)==null?void 0:C.status)==="inProgress")return;const I=new Set(n.value);I.has(w.id)?I.delete(w.id):I.add(w.id),n.value=I}function u(w){const I=new Set(s.value);I.has(w.id)?I.delete(w.id):I.add(w.id),s.value=I}function h(w){return s.value.has(w.id)}function g(w){const I=w.commandExecution;if(!I)return"";switch(I.status){case"inProgress":return"⟳ Running";case"completed":return I.exitCode===0?"✓ Completed":`✗ Exit ${I.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function T(w){var C,q;const I=(C=w.commandExecution)==null?void 0:C.status;return I==="inProgress"?"cmd-status-running":I==="completed"&&((q=w.commandExecution)==null?void 0:q.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function H(w){const I=new Set(r.value);I.add(w),r.value=I,setTimeout(()=>{const C=new Set(r.value);C.delete(w),r.value=C},1e3)}function M(w,I){const C=[];for(let q=I-1;q>=0;q--){const oe=w[q];if(oe.messageType==="commandExecution")C.unshift(oe);else if(oe.role==="user"||oe.messageType==="worked")break}return C}const D=e,N=t,P=j(null),V=j(null),B=j(null),ce=j(""),de=j({}),me=j({});let _e=0,ne=0,ie=0;const pe=new WeakSet,Q=j(new Set);function ke(w){if(!w||w.endsWith("/")||w.endsWith("\\"))return!1;if(w.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(w))return!1;const I=w.startsWith("/"),C=/^[A-Za-z]:[\\/]/u.test(w),q=w.startsWith("./")||w.startsWith("../")||w.startsWith("~/"),oe=w.includes("/")||w.includes("\\");return I||C||q||oe}function Pe(w){return w.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||w}function Me(w){return w.replace(/\\/gu,"/")}function Te(w){if(!w.startsWith("file://"))return w;let I=w.replace(/^file:\/\//u,"");try{I=decodeURIComponent(I)}catch{}return/^\/[A-Za-z]:\//u.test(I)&&(I=I.slice(1)),I}function $e(w){const I=Me(w),C=I.match(/^\/Users\/([^/]+)/u);if(C)return`/Users/${C[1]}`;const q=I.match(/^\/home\/([^/]+)/u);return q?`/home/${q[1]}`:""}function Se(w){const I=Me(w);if(!I)return I;let C="",q=I;const oe=q.match(/^([A-Za-z]:)(\/.*)?$/u);oe?(C=`${oe[1]}/`,q=(oe[2]??"").replace(/^\/+/u,"")):q.startsWith("/")&&(C="/",q=q.slice(1));const ae=q.split("/").filter(Boolean),Ce=[];for(const R of ae)if(R!=="."){if(R===".."){Ce.length>0&&Ce.pop();continue}Ce.push(R)}const ve=Ce.join("/");return C?`${C}${ve}`.replace(/\/+$/u,"")||C:ve||I}function Ne(w,I){const C=Me(Te(w.trim()));if(!C)return"";if(C.startsWith("/")||/^[A-Za-z]:\//u.test(C))return Se(C);if(C.startsWith("~/")){const ae=$e(I);if(ae)return Se(`${ae}/${C.slice(2)}`)}const oe=Me(I.trim());return Se(oe?`${oe.replace(/\/+$/u,"")}/${C}`:C)}function Ye(w){if(!w)return null;let I=w.trim();I=et(I).core.trim();let q=null;const oe=I.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(oe)I=oe[1],q=Number(oe[2]);else{const ae=I.match(/^(.*):(\d+)(?::\d+)?$/u);ae&&(I=ae[1],q=Number(ae[2]))}return I=Te(I),ke(I)?{path:I,line:q}:null}function et(w){let I=w,C="",q="";for(;/^['"`“‘]/u.test(I);)C+=I[0],I=I.slice(1);for(;/['"`”’]$/u.test(I);)q=I.slice(-1)+q,I=I.slice(0,-1);return{core:I,leading:C,trailing:q}}function Qe(w){const I=w.trim(),C=Xe(I,0);if(!C||C.end!==I.length)return null;const q=C.label.trim(),oe=C.target.trim(),ae=et(q).core.trim()||q,Ce=et(oe).core.trim();return Ce?{label:ae,target:Ce}:null}function Xe(w,I){if(w[I]!=="[")return null;const C=w.indexOf("](",I+1);if(C<0)return null;const q=w.slice(I+1,C);if(!q||q.includes(`
26
- `))return null;let oe=C+2,ae=1;for(;oe<w.length;){const Ce=w[oe];if(Ce===`
27
- `)return null;if(Ce==="(")ae+=1;else if(Ce===")"&&(ae-=1,ae===0)){const ve=w.slice(C+2,oe);return ve.trim()?{label:q,target:ve,end:oe+1}:null}oe+=1}return null}function tt(w){const I=[],C=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let q=0;for(const oe of w.matchAll(C)){if(typeof oe.index!="number")continue;const ae=oe.index,Ce=ae+oe[0].length;ae>q&&I.push({kind:"text",value:w.slice(q,ae)});let ve=oe[0],R="";for(;/[.,;:]$/u.test(ve);)R=ve.slice(-1)+R,ve=ve.slice(0,-1);const F=et(ve);ve=F.core;const X=F.leading,Oe=F.trailing+R;if(X&&I.push({kind:"text",value:X}),ve.startsWith("**")&&ve.endsWith("**")&&ve.length>4)I.push({kind:"bold",value:ve.slice(2,-2)}),Oe&&I.push({kind:"text",value:Oe});else if(/^https?:\/\//u.test(ve))I.push({kind:"url",value:ve,href:ve}),Oe&&I.push({kind:"text",value:Oe});else{const yt=Ye(ve);yt?(I.push({kind:"file",value:ve,path:yt.path,displayPath:ve,downloadName:Pe(yt.path)}),Oe&&I.push({kind:"text",value:Oe})):I.push({kind:"text",value:oe[0]})}q=Ce}return q<w.length&&I.push({kind:"text",value:w.slice(q)}),ct(I)}function ct(w){const I=[];let C=!1,q="";const oe=ae=>{ae&&I.push({kind:"text",value:ae})};for(const ae of w){if(ae.kind!=="text"){C&&(oe(`**${q}`),C=!1,q=""),I.push(ae);continue}let Ce=ae.value;for(;Ce.length>0;){const ve=Ce.indexOf("**");if(ve<0){C?q+=Ce:oe(Ce);break}const R=Ce.slice(0,ve);C?q+=R:oe(R),Ce=Ce.slice(ve+2),C?(q.length>0?I.push({kind:"bold",value:q}):oe("****"),q="",C=!1):C=!0}}return C&&oe(`**${q}`),I}function We(w){const I=[];let C=0;for(;C<w.length;){const q=w.indexOf("[",C);if(q<0)break;const oe=Xe(w,q);if(!oe){C=q+1;continue}q>C&&I.push(...tt(w.slice(C,q)));const ae=et(oe.label.trim()).core.trim()||oe.label.trim(),Ce=et(oe.target.trim()).core.trim();if(/^https?:\/\//u.test(Ce))I.push({kind:"url",value:ae||Ce,href:Ce});else{const ve=Ye(Ce);ve?I.push({kind:"file",value:Ce,path:ve.path,displayPath:ae||Ce,downloadName:Pe(ve.path)}):I.push({kind:"text",value:w.slice(q,oe.end)})}C=oe.end}return C<w.length&&I.push(...tt(w.slice(C))),I}function W(w){if(!w.includes("`"))return We(w);const I=[];let C=0,q=0;for(;C<w.length;){if(w[C]!=="`"){C+=1;continue}let oe=1;for(;C+oe<w.length&&w[C+oe]==="`";)oe+=1;const ae="`".repeat(oe);let Ce=C+oe,ve=-1;for(;Ce<w.length;){const F=w.indexOf(ae,Ce);if(F<0)break;const X=F>0&&w[F-1]==="`",Oe=F+oe<w.length&&w[F+oe]==="`",yt=w.slice(C+oe,F).includes(`
28
- `);if(!X&&!Oe&&!yt){ve=F;break}Ce=F+1}if(ve<0){C+=oe;continue}C>q&&I.push(...We(w.slice(q,C)));const R=w.slice(C+oe,ve);if(R.length>0){const F=Qe(R);if(F)if(/^https?:\/\//u.test(F.target))I.push({kind:"url",value:F.label||F.target,href:F.target});else{const X=Ye(F.target);X?I.push({kind:"file",value:F.target,path:X.path,displayPath:F.label||F.target,downloadName:Pe(X.path)}):I.push({kind:"code",value:R})}else{const X=Ye(R);if(X){const Oe=X.line?`${X.path}:${String(X.line)}`:X.path;I.push({kind:"file",value:R,path:X.path,displayPath:Oe,downloadName:Pe(X.path)})}else I.push({kind:"code",value:R})}}else I.push({kind:"text",value:`${ae}${ae}`});C=ve+oe,q=C}return q<w.length&&I.push(...We(w.slice(q))),I}function le(w){const I=w.trim();if(!I)return"";if(I.startsWith("data:")||I.startsWith("blob:")||I.startsWith("http://")||I.startsWith("https://")||I.startsWith("/codex-local-image?"))return I;if(I.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(I)}`;const C=I.startsWith("/"),q=/^[A-Za-z]:[\\/]/u.test(I);return C||q?`/codex-local-image?path=${encodeURIComponent(I)}`:I}function te(w){const I=w.trim();if(!I)return"#";const C=Ce=>Ce.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Ce),q=Ye(I),oe=(q==null?void 0:q.path)??I,ae=Ne(oe,D.cwd);if(C(ae)){const Ce=ae.startsWith("/")?ae:`/${ae}`;return`/codex-local-browse${encodeURI(Ce)}`}return"#"}function be(w){return Le(w)!=="#"}function Le(w){const I=w.trim();if(!I)return"#";const C=Ye(I),q=(C==null?void 0:C.path)??I,oe=Ne(q,D.cwd);if(!(ve=>ve.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(ve))(oe))return"#";const Ce=oe.startsWith("/")?oe:`/${oe}`;return`/codex-local-edit${encodeURI(Ce)}`}function v(w){if(!w.includes("![")||!w.includes("]("))return[{kind:"text",value:w}];const I=[],C=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let q=0;for(const oe of w.matchAll(C)){const[ae,Ce,ve]=oe;if(typeof oe.index!="number")continue;const R=oe.index,F=R+ae.length,X=le(ve.trim());X&&(R>q&&I.push({kind:"text",value:w.slice(q,R)}),I.push({kind:"image",url:X,alt:Ce.trim(),markdown:ae}),q=F)}return q<w.length&&I.push({kind:"text",value:w.slice(q)}),I.length>0?I:[{kind:"text",value:w}]}function b(w){return w!==null&&typeof w=="object"&&!Array.isArray(w)?w:null}function A(w){const I=new Date(w);return Number.isNaN(I.getTime())?w:I.toLocaleTimeString()}function J(w){const I=b(w.params),C=I==null?void 0:I.reason;return typeof C=="string"?C.trim():""}function z(w,I){return`${String(w)}:${I}`}function x(w){const I=b(w.params),C=Array.isArray(I==null?void 0:I.questions)?I.questions:[],q=[];for(const oe of C){const ae=b(oe);if(!ae)continue;const Ce=typeof ae.id=="string"?ae.id:"";if(!Ce)continue;const ve=Array.isArray(ae.options)?ae.options.map(R=>b(R)).map(R=>R==null?void 0:R.label).filter(R=>typeof R=="string"&&R.length>0):[];q.push({id:Ce,header:typeof ae.header=="string"?ae.header:"",question:typeof ae.question=="string"?ae.question:"",isOther:ae.isOther===!0,options:ve})}return q}function U(w,I,C){const q=z(w,I),oe=de.value[q];return typeof oe=="string"&&oe.length>0?oe:C}function G(w,I){const C=z(w,I);return me.value[C]??""}function Y(w,I,C){const q=C.target;if(!(q instanceof HTMLSelectElement))return;const oe=z(w,I);de.value={...de.value,[oe]:q.value}}function K(w,I,C){const q=C.target;if(!(q instanceof HTMLInputElement))return;const oe=z(w,I);me.value={...me.value,[oe]:q.value}}function ye(w,I){N("respondServerRequest",{id:w,result:{decision:I}})}function fe(w){const I=x(w),C={};for(const q of I){const oe=U(w.id,q.id,q.options[0]||""),ae=G(w.id,q.id).trim(),Ce=[oe,ae].map(ve=>ve.trim()).filter(ve=>ve.length>0);C[q.id]={answers:Ce}}N("respondServerRequest",{id:w.id,result:{answers:C}})}function ge(w){N("respondServerRequest",{id:w,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function xe(w){N("respondServerRequest",{id:w,result:{success:!0,contentItems:[]}})}function Be(w){N("respondServerRequest",{id:w,result:{}})}function qe(w){N("respondServerRequest",{id:w,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function He(w){return!(w.role!=="user"&&w.role!=="assistant"||typeof w.turnIndex!="number"||D.isTurnInProgress||D.isRollingBack)}function nt(w){return w.role!=="user"&&w.role!=="assistant"?!1:w.text.trim().length>0}function Ke(w){return nt(w)||He(w)}async function vt(w){if(!nt(w))return;const I=w.text.trim();try{await navigator.clipboard.writeText(I)}catch{const C=document.createElement("textarea");C.value=I,C.setAttribute("readonly","true"),C.style.position="fixed",C.style.opacity="0",document.body.appendChild(C),C.select(),document.execCommand("copy"),document.body.removeChild(C)}}function Et(w){if(!He(w))return;const I=w.role==="user"?w.text.trim():"";N("rollback",{turnIndex:w.turnIndex,prependText:I.length>0?I:void 0})}function Pt(){const w=P.value,I=V.value;!w||!I||(w.scrollTop=w.scrollHeight,I.scrollIntoView({block:"end"}))}function St(w){return w.scrollHeight-(w.scrollTop+w.clientHeight)<=Fb}function Ze(w){if(!D.activeThreadId)return;const I=Math.max(w.scrollHeight-w.clientHeight,0),C=I>0?Math.min(Math.max(w.scrollTop/I,0),1):1;N("updateScrollState",{threadId:D.activeThreadId,state:{scrollTop:w.scrollTop,isAtBottom:St(w),scrollRatio:C}})}function kt(){const w=P.value;if(!w)return;const I=D.scrollState;if(!I||I.isAtBottom){mt();return}const C=Math.max(w.scrollHeight-w.clientHeight,0),q=typeof I.scrollRatio=="number"?I.scrollRatio*C:I.scrollTop;w.scrollTop=Math.min(Math.max(q,0),C),Ze(w)}function mt(){const w=P.value;w&&(Pt(),Ze(w))}function Je(){const w=D.scrollState;return!w||w.isAtBottom===!0}function Gt(){if(!Je()){ie=0,ne=0;return}if(mt(),ie-=1,ie<=0){ne=0;return}ne=requestAnimationFrame(Gt)}function rn(w=6){Je()&&(ne&&(cancelAnimationFrame(ne),ne=0),ie=Math.max(w,1),ne=requestAnimationFrame(Gt))}function xt(){rn(3)}function ln(){if(!Je())return;const w=P.value;if(!w)return;const I=w.querySelectorAll("img.message-image-preview");for(const C of I)C.complete||pe.has(C)||(pe.add(C),C.addEventListener("load",xt,{once:!0}),C.addEventListener("error",xt,{once:!0}))}async function cn(){await Ut(),_e&&cancelAnimationFrame(_e),_e=requestAnimationFrame(()=>{_e=0,kt(),ln(),rn()})}ht(()=>D.messages,async w=>{if(!D.isLoading){for(const I of w){if(I.messageType!=="commandExecution"||!I.commandExecution)continue;const C=o.value[I.id],q=I.commandExecution.status;C==="inProgress"&&q!=="inProgress"&&H(I.id),o.value[I.id]=q}await cn()}}),ht(()=>D.liveOverlay,async w=>{w&&(await Ut(),mt(),rn(8))},{deep:!0}),ht(()=>D.isLoading,async w=>{w||await cn()}),ht(()=>D.activeThreadId,()=>{ce.value="",Q.value=new Set},{flush:"post"});function Kt(){const w=P.value;!w||D.isLoading||Ze(w)}function Lt(w){ce.value=le(w)}function jt(w,I){return`${w}:${String(I)}`}function De(w,I){const C=new Set(Q.value);C.add(jt(w,I)),Q.value=C}function Ie(w,I){return Q.value.has(jt(w,I))}function Jt(){ce.value=""}function yn(){const w=B.value;w&&(w.scrollTop=w.scrollHeight)}return ht(()=>{var w;return(w=D.liveOverlay)==null?void 0:w.reasoningText},async w=>{w&&(await Ut(),yn())}),cr(()=>{_e&&cancelAnimationFrame(_e),ne&&cancelAnimationFrame(ne)}),(w,I)=>(y(),k("section",hw,[e.isLoading?(y(),k("p",pw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(y(),k("p",mw," No messages in this thread yet. ")):(y(),k("ul",{key:2,ref_key:"conversationListRef",ref:P,class:"conversation-list",onScroll:Kt},[(y(!0),k(je,null,bt(e.pendingRequests,C=>(y(),k("li",{key:`server-request:${C.id}`,class:"conversation-item conversation-item-request"},[p("div",gw,[p("div",vw,[p("article",yw,[p("p",ww,se(C.method),1),p("p",bw,"Request #"+se(C.id)+" · "+se(A(C.receivedAtIso)),1),J(C)?(y(),k("p",_w,se(J(C)),1)):re("",!0),C.method==="item/commandExecution/requestApproval"?(y(),k("section",kw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>ye(C.id,"accept")},"Accept",8,Tw),p("button",{type:"button",class:"request-button",onClick:q=>ye(C.id,"acceptForSession")},"Accept for Session",8,Sw),p("button",{type:"button",class:"request-button",onClick:q=>ye(C.id,"decline")},"Decline",8,Iw),p("button",{type:"button",class:"request-button",onClick:q=>ye(C.id,"cancel")},"Cancel",8,Ew)])):C.method==="item/fileChange/requestApproval"?(y(),k("section",Cw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>ye(C.id,"accept")},"Accept",8,Aw),p("button",{type:"button",class:"request-button",onClick:q=>ye(C.id,"acceptForSession")},"Accept for Session",8,Rw),p("button",{type:"button",class:"request-button",onClick:q=>ye(C.id,"decline")},"Decline",8,Pw),p("button",{type:"button",class:"request-button",onClick:q=>ye(C.id,"cancel")},"Cancel",8,xw)])):C.method==="item/tool/requestUserInput"?(y(),k("section",Mw,[(y(!0),k(je,null,bt(x(C),q=>(y(),k("div",{key:`${C.id}:${q.id}`,class:"request-question"},[p("p",Ow,se(q.header||q.question),1),q.header&&q.question?(y(),k("p",Nw,se(q.question),1)):re("",!0),p("select",{class:"request-select",value:U(C.id,q.id,q.options[0]||""),onChange:oe=>Y(C.id,q.id,oe)},[(y(!0),k(je,null,bt(q.options,oe=>(y(),k("option",{key:`${C.id}:${q.id}:${oe}`,value:oe},se(oe),9,Dw))),128))],40,$w),q.isOther?(y(),k("input",{key:1,class:"request-input",type:"text",value:G(C.id,q.id),placeholder:"Other answer",onInput:oe=>K(C.id,q.id,oe)},null,40,Lw)):re("",!0)]))),128)),p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>fe(C)}," Submit Answers ",8,jw)])):C.method==="item/tool/call"?(y(),k("section",Uw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>ge(C.id)},"Fail Tool Call",8,Bw),p("button",{type:"button",class:"request-button",onClick:q=>xe(C.id)},"Success (Empty)",8,Fw)])):(y(),k("section",Hw,[p("button",{type:"button",class:"request-button request-button-primary",onClick:q=>Be(C.id)},"Return Empty Result",8,Vw),p("button",{type:"button",class:"request-button",onClick:q=>qe(C.id)},"Reject Request",8,Ww)]))])])])]))),128)),(y(!0),k(je,null,bt(e.messages,C=>{var q,oe;return y(),k("li",{key:C.id,class:at(["conversation-item",{"conversation-item-actionable":Ke(C)}]),"data-role":C.role,"data-message-type":C.messageType||""},[i(C)?(y(),k("div",zw,[p("div",Gw,[p("button",{type:"button",class:at(["cmd-row",[T(C),{"cmd-expanded":a(C)}]]),onClick:ae=>d(C)},[p("span",{class:at(["cmd-chevron",{"cmd-chevron-open":a(C)}])},"▶",2),p("code",Jw,se(((q=C.commandExecution)==null?void 0:q.command)||"(command)"),1),p("span",Yw,se(g(C)),1)],10,Kw),p("div",{class:at(["cmd-output-wrap",{"cmd-output-visible":a(C),"cmd-output-collapsing":l(C)}])},[p("div",Xw,[p("pre",Qw,se(((oe=C.commandExecution)==null?void 0:oe.aggregatedOutput)||"(no output)"),1)])],2)])])):(y(),k("div",{key:1,class:"message-row","data-role":C.role,"data-message-type":C.messageType||""},[p("div",{class:"message-stack","data-role":C.role},[p("article",{class:"message-body","data-role":C.role},[C.images&&C.images.length>0?(y(),k("ul",{key:0,class:"message-image-list","data-role":C.role},[(y(!0),k(je,null,bt(C.images,ae=>(y(),k("li",{key:ae,class:"message-image-item"},[p("button",{class:"message-image-button",type:"button",onClick:Ce=>Lt(ae)},[p("img",{class:"message-image-preview",src:le(ae),alt:"Message image preview",loading:"lazy"},null,8,sb)],8,rb)]))),128))],8,nb)):re("",!0),C.fileAttachments&&C.fileAttachments.length>0?(y(),k("div",ob,[(y(!0),k(je,null,bt(C.fileAttachments,ae=>(y(),k("span",{key:ae.path,class:"message-file-chip"},[I[1]||(I[1]=p("span",{class:"message-file-chip-icon"},"📄",-1)),p("span",ib,[p("a",{class:"message-file-link message-file-chip-name",href:te(ae.path),target:"_blank",rel:"noopener noreferrer",title:ae.path},se(ae.path),9,ab),be(ae.path)?(y(),k("a",{key:0,class:"message-file-edit-link",href:Le(ae.path),target:"_blank",rel:"noopener noreferrer",title:`Edit ${ae.path}`,"aria-label":"Edit file"}," Edit ",8,lb)):re("",!0)])]))),128))])):re("",!0),C.text.length>0?(y(),k("article",{key:2,class:"message-card","data-role":C.role},[C.messageType==="worked"?(y(),k("div",ub,[p("button",{type:"button",class:"worked-separator",onClick:ae=>u(C)},[I[2]||(I[2]=p("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),p("span",{class:at(["worked-chevron",{"worked-chevron-open":h(C)}])},"▶",2),p("p",fb,se(C.text),1),I[3]||(I[3]=p("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,db),h(C)?(y(),k("div",hb,[(y(!0),k(je,null,bt(M(e.messages,e.messages.indexOf(C)),ae=>{var Ce,ve;return y(),k("div",{key:`worked-cmd-${ae.id}`,class:"worked-cmd-item"},[p("button",{type:"button",class:at(["cmd-row",[T(ae),{"cmd-expanded":a(ae)}]]),onClick:R=>d(ae)},[p("span",{class:at(["cmd-chevron",{"cmd-chevron-open":a(ae)}])},"▶",2),p("code",mb,se(((Ce=ae.commandExecution)==null?void 0:Ce.command)||"(command)"),1),p("span",gb,se(g(ae)),1)],10,pb),p("div",{class:at(["cmd-output-wrap",{"cmd-output-visible":a(ae),"cmd-output-collapsing":l(ae)}])},[p("div",vb,[p("pre",yb,se(((ve=ae.commandExecution)==null?void 0:ve.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):re("",!0)])):(y(),k("div",wb,[(y(!0),k(je,null,bt(v(C.text),(ae,Ce)=>(y(),k(je,{key:`block-${Ce}`},[ae.kind==="text"?(y(),k("p",bb,[(y(!0),k(je,null,bt(W(ae.value),(ve,R)=>(y(),k(je,{key:`seg-${Ce}-${R}`},[ve.kind==="text"?(y(),k("span",_b,se(ve.value),1)):ve.kind==="bold"?(y(),k("strong",kb,se(ve.value),1)):ve.kind==="file"?(y(),k("span",Tb,[p("a",{class:"message-file-link",href:te(ve.path),target:"_blank",rel:"noopener noreferrer",title:ve.path},se(ve.displayPath),9,Sb),be(ve.path)?(y(),k("a",{key:0,class:"message-file-edit-link",href:Le(ve.path),target:"_blank",rel:"noopener noreferrer",title:`Edit ${ve.path}`,"aria-label":"Edit file"}," Edit ",8,Ib)):re("",!0)])):ve.kind==="url"?(y(),k("a",{key:3,class:"message-file-link",href:ve.href,target:"_blank",rel:"noopener noreferrer",title:ve.href},se(ve.value),9,Eb)):(y(),k("code",Cb,se(ve.value),1))],64))),128))])):Ie(C.id,Ce)?(y(),k("p",Ab,se(ae.markdown),1)):(y(),k("button",{key:2,class:"message-image-button",type:"button",onClick:ve=>Lt(ae.url)},[p("img",{class:"message-image-preview message-markdown-image",src:ae.url,alt:ae.alt||"Embedded message image",loading:"lazy",onError:ve=>De(C.id,Ce)},null,40,Pb)],8,Rb))],64))),128))]))],8,cb)):re("",!0)],8,tb),Ke(C)?(y(),k("div",xb,[nt(C)?(y(),k("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:ae=>vt(C)},[Re(fw,{class:"message-action-icon"}),I[4]||(I[4]=p("span",{class:"message-action-label"},"Copy",-1))],8,Mb)):re("",!0),He(C)?(y(),k("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:ae=>Et(C)},[Re(lw,{class:"message-action-icon"}),I[5]||(I[5]=p("span",{class:"message-action-label"},"Rollback",-1))],8,Ob)):re("",!0)])):re("",!0)],8,eb)],8,Zw))],10,qw)}),128)),e.liveOverlay?(y(),k("li",Nb,[p("div",$b,[p("div",Db,[p("article",Lb,[p("p",jb,se(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(y(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:B},se(e.liveOverlay.reasoningText),513)):re("",!0),e.liveOverlay.errorText?(y(),k("p",Ub,se(e.liveOverlay.errorText),1)):re("",!0)])])])])):re("",!0),p("li",{ref_key:"bottomAnchorRef",ref:V,class:"conversation-bottom-anchor"},null,512)],544)),ce.value.length>0?(y(),k("div",{key:3,class:"image-modal-backdrop",onClick:Jt},[p("div",{class:"image-modal-content",onClick:I[0]||(I[0]=it(()=>{},["stop"]))},[p("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Jt},[Re(hl,{class:"icon-svg"})]),p("img",{class:"image-modal-image",src:ce.value,alt:"Expanded message image"},null,8,Bb)])])):re("",!0)]))}}),Vb=rt(Hb,[["__scopeId","data-v-bc40021f"]]),qc=.0025,Gi=3,zc=2,Wb=256;function qb(e){var pe;const t=j("idle"),n=j(typeof navigator<"u"&&!!((pe=navigator.mediaDevices)!=null&&pe.getUserMedia)),r=j(0),s=j(null);let o=null,i=null,a=[],l=null,d=null,u=null,h=null,g=[],T=!1,H=!1,M=null;function D(){M&&(M.abort(),M=null),t.value==="transcribing"&&(t.value="idle")}function N(){const Q=s.value;if(!Q||typeof window>"u")return;const ke=Q.getContext("2d");if(!ke)return;const Pe=Math.max(1,Math.floor(Q.clientWidth)),Me=Math.max(1,Math.floor(Q.clientHeight||36)),Te=window.devicePixelRatio||1,$e=Math.max(1,Math.floor(Pe*Te)),Se=Math.max(1,Math.floor(Me*Te));(Q.width!==$e||Q.height!==Se)&&(Q.width=$e,Q.height=Se),ke.setTransform(Te,0,0,Te,0,0),ke.clearRect(0,0,Pe,Me);const Ne=Math.max(12,Math.floor(Pe/(Gi+zc))),Ye=g.slice(-Ne),et=Math.max(0,Ne-Ye.length),Qe=Me/2,Xe=getComputedStyle(Q).color||"#000000";for(let tt=0;tt<Ne;tt+=1){const ct=Ye[tt-et]??0,W=Math.max(.08,Math.min(1,ct*18))*Qe,le=tt*(Gi+zc);ke.globalAlpha=ct<=qc?.35:1,ke.fillStyle=Xe,ke.fillRect(le,Qe-W,Gi,W*2)}ke.globalAlpha=1}function P(){g=[],r.value=0,N()}function V(){u&&(u.disconnect(),u.onaudioprocess=null,u=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),h=null}function B(Q){if(typeof window>"u")return;const ke=window.webkitAudioContext,Pe=window.AudioContext??ke;Pe&&(V(),P(),l=new Pe,d=l.createMediaStreamSource(Q),u=l.createScriptProcessor(2048,1,1),h=performance.now(),u.onaudioprocess=Me=>{const Te=Me.inputBuffer.getChannelData(0);let $e=0;for(let Se=0;Se<Te.length;Se+=1){const Ne=Math.abs(Te[Se]??0);$e+=Ne<qc?0:Ne}g.push($e/Te.length),g.length>Wb&&g.shift(),h!==null&&(r.value=Math.max(0,performance.now()-h)),N()},d.connect(u),u.connect(l.destination),N())}async function ce(){var Q;if(t.value==="transcribing"&&D(),!(t.value!=="idle"||!n.value||T)){T=!0,H=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=ke=>{ke.data.size>0&&a.push(ke.data)},o.onstop=()=>{var Me;const ke=a,Pe=(o==null?void 0:o.mimeType)||((Me=ke[0])==null?void 0:Me.type)||"audio/webm";ne(),_e(ke,Pe)},B(i),o.start(250),t.value="recording",H&&de()}catch(ke){ne(),t.value="idle",(Q=e.onError)==null||Q.call(e,ke)}finally{T=!1}}}function de(){if(T&&t.value==="idle"){H=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function me(){H=!1,D(),ne(),t.value="idle"}async function _e(Q,ke){var Te,$e,Se,Ne,Ye;if(Q.length===0){(Te=e.onEmpty)==null||Te.call(e),t.value="idle";return}const Pe=new Blob(Q,{type:ke});t.value="transcribing";let Me=null;try{const et=ke.split(/[/;]/)[1]??"webm",Qe=new FormData;Qe.append("file",Pe,`codex.${et}`);const Xe=(($e=e.getLanguage)==null?void 0:$e.call(e).trim())??"";Xe&&Xe.toLowerCase()!=="auto"&&Qe.append("language",Xe),Me=new AbortController,M=Me;const tt=await fetch("/codex-api/transcribe",{method:"POST",body:Qe,signal:Me.signal}),ct=await tt.text();let We=null;try{We=ct.trim()?JSON.parse(ct):null}catch{We=null}if(!tt.ok){const le=(Se=We==null?void 0:We.error)==null?void 0:Se.trim(),te=ct.trim();throw new Error(le||te||`Transcription failed: ${tt.status}`)}const W=((We==null?void 0:We.text)??"").trim();W.length>0?e.onTranscript(W):(Ne=e.onEmpty)==null||Ne.call(e)}catch(et){if(et instanceof DOMException&&et.name==="AbortError")return;(Ye=e.onError)==null||Ye.call(e,et)}finally{Me&&M===Me&&(M=null),t.value==="transcribing"&&(t.value="idle")}}function ne(){V(),P(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(Q=>Q.stop()),i=null),a=[]}cr(()=>{me()});function ie(){if(t.value==="recording"){de();return}(t.value==="idle"||t.value==="transcribing")&&ce()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ce,stopRecording:de,toggleRecording:ie,cancel:me}}function Gc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Zn extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function pl(e,t){const n=Gc(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=Gc(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function ms(e,t,n){return e instanceof Zn?e:e instanceof Error?new Zn(e.message||t,{code:"unknown_error",method:n}):new Zn(t,{code:"unknown_error",method:n})}function bf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function zb(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 Zn(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 Zn(pl(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 Zn(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function Kc(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 Gb(e){if(typeof window>"u")return()=>{};let t=null,n=!1;const r=()=>{if(typeof EventSource>"u"||n)return;const s=new EventSource("/codex-api/events");s.onmessage=o=>{try{const i=JSON.parse(o.data),a=Kc(i);a&&e(a)}catch{}},t=()=>s.close()};if(typeof WebSocket<"u"){const s=window.location.protocol==="https:"?"wss:":"ws:",o=new WebSocket(`${s}//${window.location.host}/codex-api/ws`);let i=!1,a=window.setTimeout(()=>{i||n||(o.close(),r())},2500);o.onopen=()=>{i=!0,a!==null&&(window.clearTimeout(a),a=null)},o.onmessage=l=>{try{const d=JSON.parse(String(l.data)),u=Kc(d);u&&e(u)}catch{}},o.onerror=()=>{!i&&!n&&r()},o.onclose=()=>{a!==null&&(window.clearTimeout(a),a=null),!i&&!n&&r()},t=()=>o.close()}else r();return()=>{n=!0,t==null||t()}}async function Kb(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 Zn(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 Zn(pl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Jb(){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 Zn(pl(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 Jc(e){return new Date(e*1e3).toISOString()}function Yb(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Xb(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Qb=/^##\s+(.+?):\s+(.+?)\s*$/,Zb=/^#\s*files mentioned by the user\s*:?\s*$/i;function e_(e){var s,o;const t=e.split(`
29
- `).findIndex(i=>Zb.test(i.trim()));if(t<0)return[];const n=e.split(`
30
- `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(Qb);if(!l)break;const d=(s=l[1])==null?void 0:s.trim(),u=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&u&&r.push({label:d,path:u})}return r}function t_(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 n_(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:Xb(l),isUnhandled:!0});const o=n.join(`
31
- `),i=e_(o);return{text:t_(o),images:r,fileAttachments:i,rawBlocks:s}}function r_(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=n_(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==="commandExecution"){const t=e,n=s_(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 s_(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function o_(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function i_(e){const t=o_(e);return t.length>0?t:"Untitled thread"}function _f(e){return(e==null?void 0:e.status)==="inProgress"}function a_(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 _f(r)}function l_(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:i_(e),projectName:Yb(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:Jc(e.createdAt),updatedAtIso:Jc(e.updatedAt),preview:e.preview,unread:!1,inProgress:a_(e)}}function c_(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 u_(e){const t=e.data.map(l_);return c_(t)}function kf(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 r_(i))n.push({...a,turnIndex:r})}return n}function d_(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return _f(t.at(-1))}async function nn(e,t){try{return await zb(e,t)}catch(n){throw ms(n,`RPC ${e} failed`,e)}}function f_(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function h_(){const e=await nn("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return u_(e)}async function p_(e){const t=await nn("thread/read",{threadId:e,includeTurns:!0});return{messages:kf(t),inProgress:d_(t)}}async function m_(){try{return await h_()}catch(e){throw ms(e,"Failed to load thread groups","thread/list")}}async function g_(e){try{return await p_(e)}catch(t){throw ms(t,`Failed to load thread ${e}`,"thread/read")}}function v_(e){return Gb(e)}async function y_(e,t){await Kb({id:e,...t})}async function w_(){return Jb()}async function Ki(e){await nn("thread/resume",{threadId:e})}async function b_(e){await nn("thread/archive",{threadId:e})}async function __(e,t){await nn("thread/name/set",{threadId:e,name:t})}async function Yc(e,t){const n=await nn("thread/rollback",{threadId:e,numTurns:t});return kf(n)}function k_(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 Xc(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 nn("thread/start",n),s=k_(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw ms(n,"Failed to start a new thread","thread/start")}}function T_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
32
- `;for(const r of t)n+=`
33
- ## ${r.label}: ${r.path}
34
- `;return`${n}
35
- ## My request for Codex:
36
-
37
- ${e}
38
- `}async function Ji(e,t,n=[],r,s,o,i=[]){try{const l=[{type:"text",text:T_(t,i)}];for(const h of n){const g=h.trim();g&&l.push({type:"image",url:g,image_url:g})}if(o)for(const h of o)l.push({type:"skill",name:h.name,path:h.path});const d=i.map(h=>({label:h.label,path:h.path,fsPath:h.fsPath})),u={threadId:e,input:l};d.length>0&&(u.attachments=d),typeof r=="string"&&r.length>0&&(u.model=r),typeof s=="string"&&s.length>0&&(u.effort=s),await nn("turn/start",u)}catch(a){throw ms(a,`Failed to start turn for thread ${e}`,"turn/start")}}async function S_(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 nn("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw ms(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function I_(e){await nn("setDefaultModel",{model:e})}async function E_(){const e=await nn("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 C_(){const e=await nn("config/read",{}),t=e.config.model??"",n=f_(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}async function A_(){return await nn("account/rateLimits/read")}function R_(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 Ra(){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 R_(n.data)}async function P_(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 Qc(){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 x_(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 Zc(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=ml(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 M_(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=ml(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 O_(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=ml(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 h=d.path,g=typeof h=="string"?h.trim():"";g&&l.push({path:g})}return l}async function N_(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 ml(e,t){const r=(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).error;return typeof r=="string"&&r.trim().length>0?r:t}async function $_(){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 Yi(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 D_(e,t){var n;try{return((n=(await nn("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function L_(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await nn("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}async function eu(e){try{const t=new FormData;t.append("file",e);const n=await fetch("/codex-api/upload-file",{method:"POST",body:t});return n.ok?(await n.json()).path??null:null}catch{return null}}const j_={},U_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function B_(e,t){return y(),k("svg",U_,[...t[0]||(t[0]=[p("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 F_=rt(j_,[["render",B_]]),H_={},V_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function W_(e,t){return y(),k("svg",V_,[...t[0]||(t[0]=[p("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 q_=rt(H_,[["render",W_]]),z_={},G_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function K_(e,t){return y(),k("svg",G_,[...t[0]||(t[0]=[p("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),p("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 tu=rt(z_,[["render",K_]]),J_=["disabled"],Y_={class:"composer-dropdown-value"},X_={class:"composer-dropdown-menu"},Q_={key:0,class:"composer-dropdown-search-wrap"},Z_=["placeholder","onKeydown"],ek={class:"composer-dropdown-options",role:"listbox"},tk=["onClick"],nk={key:0,class:"composer-dropdown-empty"},rk={key:1,class:"composer-dropdown-add-wrap"},sk=["placeholder","onKeydown"],ok=Nt({__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=j(null),o=j(null),i=j(null),a=j(!1),l=j(""),d=j(!1),u=j(""),h=ue(()=>{var pe;const ie=n.options.find(Q=>Q.value===n.modelValue);return ie?ie.label:((pe=n.placeholder)==null?void 0:pe.trim())||""}),g=ue(()=>n.openDirection??"down"),T=ue(()=>n.enableSearch===!0),H=ue(()=>n.showAddAction===!0),M=ue(()=>{var ie;return((ie=n.searchPlaceholder)==null?void 0:ie.trim())||"Quick search projects"}),D=ue(()=>{var ie;return((ie=n.addActionLabel)==null?void 0:ie.trim())||"Add new project"}),N=ue(()=>{var ie;return((ie=n.addPlaceholder)==null?void 0:ie.trim())||"Project name or absolute path"}),P=ue(()=>{const ie=l.value.trim().toLowerCase();return ie?n.options.filter(pe=>pe.label.toLowerCase().includes(ie)||pe.value.toLowerCase().includes(ie)):n.options});function V(){n.disabled||(a.value=!a.value)}function B(ie){r("update:modelValue",ie),a.value=!1,l.value=""}function ce(){var ie;d.value=!0,u.value=((ie=n.defaultAddValue)==null?void 0:ie.trim())||"",Ut(()=>{var pe;return(pe=i.value)==null?void 0:pe.focus()})}function de(){if(l.value.length>0){l.value="";return}a.value=!1}function me(){const ie=u.value.trim();ie&&(r("add",ie),d.value=!1,u.value="",a.value=!1,l.value="")}function _e(){d.value=!1,u.value="",a.value=!1,l.value=""}function ne(ie){if(!a.value)return;const pe=s.value;if(!pe)return;const Q=ie.target;Q instanceof Node&&(pe.contains(Q)||(a.value=!1,l.value="",d.value=!1,u.value=""))}return ht(a,ie=>{if(!ie){d.value=!1,u.value="";return}T.value&&Ut(()=>{var pe;return(pe=o.value)==null?void 0:pe.focus()})}),lr(()=>{window.addEventListener("pointerdown",ne)}),cr(()=>{window.removeEventListener("pointerdown",ne)}),(ie,pe)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[p("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:V},[p("span",Y_,se(h.value),1),Re(di,{class:"composer-dropdown-chevron"})],8,J_),a.value?(y(),k("div",{key:0,class:at(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":g.value==="up","composer-dropdown-menu-wrap-down":g.value==="down"}])},[p("div",X_,[T.value?(y(),k("div",Q_,[rr(p("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":pe[0]||(pe[0]=Q=>l.value=Q),class:"composer-dropdown-search-input",type:"text",placeholder:M.value,onKeydown:Zt(it(de,["prevent"]),["esc"])},null,40,Z_),[[sr,l.value]])])):re("",!0),p("ul",ek,[(y(!0),k(je,null,bt(P.value,Q=>(y(),k("li",{key:Q.value},[p("button",{class:at(["composer-dropdown-option",{"is-selected":Q.value===e.modelValue}]),type:"button",onClick:ke=>B(Q.value)},se(Q.label),11,tk)]))),128)),P.value.length===0?(y(),k("li",nk," No matching projects ")):re("",!0)]),H.value?(y(),k("div",rk,[d.value?(y(),k(je,{key:0},[rr(p("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":pe[1]||(pe[1]=Q=>u.value=Q),class:"composer-dropdown-add-input",type:"text",placeholder:N.value,onKeydown:[Zt(it(me,["prevent"]),["enter"]),Zt(it(_e,["prevent"]),["esc"])]},null,40,sk),[[sr,u.value]]),p("div",{class:"composer-dropdown-add-actions"},[p("button",{type:"button",class:"composer-dropdown-add-btn",onClick:me},"Open"),p("button",{type:"button",class:"composer-dropdown-add-btn",onClick:_e},"Cancel")])],64)):(y(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:ce},se(D.value),1))])):re("",!0)])],2)):re("",!0)],512))}}),Ho=rt(ok,[["__scopeId","data-v-7cfa2012"]]),ik=["disabled"],ak={class:"search-dropdown-value"},lk={class:"search-dropdown-search-wrap"},ck=["placeholder","onKeydown"],uk={key:0,class:"search-dropdown-list",role:"listbox"},dk=["onClick","onPointerenter"],fk={class:"search-dropdown-option-check"},hk={class:"search-dropdown-option-label"},pk={key:0,class:"search-dropdown-option-desc"},mk={key:1,class:"search-dropdown-empty"},gk=Nt({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(!1),a=j(""),l=j(0),d=ue(()=>n.openDirection??"down"),u=ue(()=>new Set(n.selectedValues)),h=ue(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const P=n.options.find(V=>V.value===n.selectedValues[0]);return(P==null?void 0:P.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),g=ue(()=>{const P=a.value.toLowerCase().trim();return P?n.options.filter(V=>{var B;return V.label.toLowerCase().includes(P)||(((B=V.description)==null?void 0:B.toLowerCase().includes(P))??!1)}):n.options});function T(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,Ut(()=>{var P;return(P=o.value)==null?void 0:P.focus()})))}function H(P){r("toggle",P.value,!u.value.has(P.value))}function M(P){g.value.length!==0&&(l.value=(l.value+P+g.value.length)%g.value.length)}function D(){const P=g.value[l.value];P&&H(P)}function N(P){if(!i.value)return;const V=s.value;if(!V)return;const B=P.target;B instanceof Node&&(V.contains(B)||(i.value=!1))}return ht(a,()=>{l.value=0}),lr(()=>window.addEventListener("pointerdown",N)),cr(()=>window.removeEventListener("pointerdown",N)),(P,V)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[p("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:T},[p("span",ak,se(h.value),1),Re(di,{class:"search-dropdown-chevron"})],8,ik),i.value?(y(),k("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"}])},[p("div",lk,[rr(p("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":V[0]||(V[0]=B=>a.value=B),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[V[1]||(V[1]=Zt(it(B=>i.value=!1,["prevent"]),["escape"])),Zt(it(D,["prevent"]),["enter"]),V[2]||(V[2]=Zt(it(B=>M(1),["prevent"]),["arrow-down"])),V[3]||(V[3]=Zt(it(B=>M(-1),["prevent"]),["arrow-up"]))]},null,40,ck),[[sr,a.value]])]),g.value.length>0?(y(),k("ul",uk,[(y(!0),k(je,null,bt(g.value,(B,ce)=>(y(),k("li",{key:B.value},[p("button",{class:at(["search-dropdown-option",{"is-selected":u.value.has(B.value),"is-highlighted":ce===l.value}]),type:"button",onClick:de=>H(B),onPointerenter:de=>l.value=ce},[p("span",fk,se(u.value.has(B.value)?"✓":""),1),p("span",hk,se(B.label),1),B.description?(y(),k("span",pk,se(B.description),1)):re("",!0)],42,dk)]))),128))])):(y(),k("div",mk,"No results"))],2)):re("",!0)],512))}}),vk=rt(gk,[["__scopeId","data-v-a0f2edd4"]]),yk={class:"skill-picker-header"},wk=["onKeydown"],bk={key:0,class:"skill-picker-list",role:"listbox"},_k=["onClick","onPointerenter"],kk={class:"skill-picker-name"},Tk={key:0,class:"skill-picker-desc"},Sk={key:1,class:"skill-picker-empty"},Ik=Nt({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(""),a=j(0),l=ue(()=>{const g=i.value.toLowerCase().trim();return g?n.skills.filter(T=>T.name.toLowerCase().includes(g)||T.description.toLowerCase().includes(g)):n.skills}),d=ue(()=>{const g={};return n.anchorBottom!=null&&(g.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(g.left=`${n.anchorLeft}px`),g});function u(g){l.value.length!==0&&(a.value=(a.value+g+l.value.length)%l.value.length)}function h(){const g=l.value[a.value];g&&r("select",g)}return ht(()=>n.visible,g=>{g&&(i.value="",a.value=0,Ut(()=>{var T;return(T=o.value)==null?void 0:T.focus()}))}),ht(i,()=>{a.value=0}),(g,T)=>e.visible?(y(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:zr(d.value)},[p("div",yk,[rr(p("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":T[0]||(T[0]=H=>i.value=H),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[T[1]||(T[1]=Zt(it(H=>g.$emit("close"),["prevent"]),["escape"])),Zt(it(h,["prevent"]),["enter"]),T[2]||(T[2]=Zt(it(H=>u(1),["prevent"]),["arrow-down"])),T[3]||(T[3]=Zt(it(H=>u(-1),["prevent"]),["arrow-up"]))]},null,40,wk),[[sr,i.value]])]),l.value.length>0?(y(),k("ul",bk,[(y(!0),k(je,null,bt(l.value,(H,M)=>(y(),k("li",{key:H.path},[p("button",{class:at(["skill-picker-item",{"is-highlighted":M===a.value}]),type:"button",onClick:D=>g.$emit("select",H),onPointerenter:D=>a.value=M},[p("span",kk,se(H.name),1),H.description?(y(),k("span",Tk,se(H.description),1)):re("",!0)],42,_k)]))),128))])):(y(),k("div",Sk,"No skills found"))],4)):re("",!0)}}),Ek=rt(Ik,[["__scopeId","data-v-ff3fb7dc"]]),Ck={key:0,class:"thread-composer-dictation-error"},Ak={key:0,class:"thread-composer-attachments"},Rk=["src","alt"],Pk=["aria-label","disabled","onClick"],xk={key:1,class:"thread-composer-folder-chips"},Mk=["title"],Ok={class:"thread-composer-folder-chip-meta"},Nk=["aria-label","disabled","onClick"],$k={key:2,class:"thread-composer-file-chips"},Dk=["title"],Lk=["aria-label","disabled","onClick"],jk={key:3,class:"thread-composer-skill-chips"},Uk={class:"thread-composer-skill-chip-name"},Bk=["aria-label","onClick"],Fk={class:"thread-composer-input-wrap"},Hk={key:0,class:"thread-composer-file-mentions"},Vk=["onMousedown"],Wk={key:1,class:"thread-composer-file-mention-icon-markdown"},qk={class:"thread-composer-file-mention-text"},zk={class:"thread-composer-file-mention-name"},Gk={key:0,class:"thread-composer-file-mention-dir"},Kk={key:1,class:"thread-composer-file-mention-empty"},Jk=["placeholder","disabled"],Yk=["disabled"],Xk={key:0,class:"thread-composer-attach-menu"},Qk=["disabled"],Zk=["disabled"],e0=["disabled"],t0={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},n0={key:1,class:"thread-composer-dictation-timer"},r0=["aria-label","title","disabled"],s0=["disabled"],o0=["aria-label","title","disabled"],i0=["disabled"],a0=["disabled"],l0=["disabled"],c0=Nt({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},models:{},selectedModel:{},selectedReasoningEffort:{},skills:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},prependDraftRequest:{},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=j(""),i=j([]),a=j([]),l=j([]),d=j([]),u=j(""),{state:h,isSupported:g,recordingDurationMs:T,waveformCanvasRef:H,startRecording:M,stopRecording:D,toggleRecording:N,cancel:P}=qb({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:R=>{if(o.value=o.value?`${o.value}
39
- ${R}`:R,u.value="",r.dictationAutoSend!==!1){const F=r.isTurnInProgress?be.value:"steer";z(F,{rollbackLatestUserTurn:F==="steer"&&Ne}),Ne=!1;return}Ut(()=>{var F;return(F=me.value)==null?void 0:F.focus()})},onEmpty:()=>{u.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:R=>{if(R instanceof DOMException&&R.name==="NotAllowedError"){u.value="Microphone access was denied.";return}u.value=R instanceof Error?R.message:"Dictation failed."}}),V=j(null),B=j(null),ce=j(null),de=j(null),me=j(null),_e=j(!1),ne=j(!1),ie=j(null),pe=j(""),Q=j([]),ke=j(!1),Pe=j(0),Me=j(0);let Te=0,$e=null,Se=!1,Ne=!1;const Ye=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),et=[{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"}],Qe=ue(()=>r.models.map(R=>({value:R,label:R}))),Xe=ue(()=>r.skills??[]),tt=ue(()=>a.value.map(R=>R.path)),ct=ue(()=>(r.skills??[]).map(R=>({value:R.path,label:R.name,description:R.description}))),We=ue(()=>r.disabled||!r.activeThreadId?!1:o.value.trim().length>0||i.value.length>0||l.value.length>0),W=ue(()=>o.value.trim().length>0||i.value.length>0||a.value.length>0||l.value.length>0||d.value.length>0),le=ue(()=>{const R=new Set;for(const F of d.value)for(const X of F.filePaths)R.add(X);return l.value.filter(F=>!R.has(F.fsPath))}),te=ue(()=>r.disabled||!r.activeThreadId),be=ue(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),Le=ue(()=>h.value==="recording"),v=ue(()=>h.value==="recording"?"Stop dictation":r.dictationClickToToggle?"Click to dictate":"Hold to dictate"),b=ue(()=>h.value==="idle"?u.value.trim():""),A=ue(()=>{const R=Math.max(0,Math.floor(T.value/1e3)),F=Math.floor(R/60),X=R%60;return`${F}:${String(X).padStart(2,"0")}`}),J=ue(()=>r.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message");function z(R="steer",F){var Oe;const X=o.value.trim();if(We.value){if(s("submit",{text:X,imageUrls:i.value.map(yt=>yt.url),fileAttachments:[...l.value],skills:a.value.map(yt=>({name:yt.name,path:yt.path})),mode:R,rollbackLatestUserTurn:(F==null?void 0:F.rollbackLatestUserTurn)===!0}),U(),Ye){(Oe=me.value)==null||Oe.blur();return}Ut(()=>{var yt;return(yt=me.value)==null?void 0:yt.focus()})}}function x(R){Me.value+=1,o.value=R.text,i.value=R.imageUrls.map((F,X)=>({id:`queued-${Date.now()}-${X}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${X+1}`,url:F})),a.value=R.skills.map(F=>(r.skills??[]).find(X=>X.path===F.path)??{name:F.name,description:"",path:F.path}),l.value=R.fileAttachments.map(F=>({...F})),d.value=[],u.value="",_e.value=!1,ne.value=!1,Lt()}function U(){x({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function G(){s("interrupt")}function Y(R){s("update:selected-model",R)}function K(R){s("update:selected-reasoning-effort",R)}function ye(){r.dictationClickToToggle&&(u.value&&(u.value=""),h.value==="idle"&&(Ne=r.isTurnInProgress===!0&&r.inProgressSubmitMode==="steer"),N())}function fe(R){if(r.dictationClickToToggle||(R.preventDefault(),Se))return;Se=!0;const F=R.currentTarget;if(F)try{F.setPointerCapture(R.pointerId)}catch{}u.value&&(u.value=""),Ne=r.isTurnInProgress===!0&&r.inProgressSubmitMode==="steer",window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge),window.addEventListener("blur",ge),M()}function ge(){r.dictationClickToToggle||Se&&(Se=!1,window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge),window.removeEventListener("blur",ge),D())}function xe(){te.value||(_e.value=!_e.value)}function Be(){var R;(R=B.value)==null||R.click()}function qe(){var R;(R=ce.value)==null||R.click()}function He(){var R;(R=de.value)==null||R.click()}function nt(R){i.value=i.value.filter(F=>F.id!==R)}function Ke(R){a.value=a.value.filter(F=>F.path!==R)}function vt(R){l.value=l.value.filter(F=>F.fsPath!==R)}function Et(R){const F=d.value.find(Oe=>Oe.id===R);if(!F)return;const X=new Set(F.filePaths);l.value=l.value.filter(Oe=>!X.has(Oe.fsPath)),d.value=d.value.filter(Oe=>Oe.id!==R)}function Pt(R){return R.total<=0?0:Math.round(R.processed/R.total*100)}function St(R,F){const X=R.replace(/\\/g,"/");if(l.value.some(un=>un.fsPath===X))return;const Oe=X.split("/").filter(Boolean),yt=(F==null?void 0:F.trim())||Oe[Oe.length-1]||X;l.value=[...l.value,{label:yt,path:X,fsPath:X}]}function Ze(R){return R.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(R.name)}function kt(R){if(!R||R.length===0)return;const F=Me.value;for(const X of Array.from(R))if(Ze(X)){const Oe=new FileReader;Oe.onload=()=>{F===Me.value&&typeof Oe.result=="string"&&i.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:X.name,url:Oe.result})},Oe.readAsDataURL(X)}else eu(X).then(Oe=>{F===Me.value&&Oe&&St(Oe)}).catch(()=>{})}async function mt(R){if(!R||R.length===0)return;const F=Me.value,X=Array.from(R),yt=(X[0].webkitRelativePath||X[0].name).split("/").filter(Boolean)[0]||"Folder",un=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:un,name:yt,total:X.length,processed:0,filePaths:[],isUploading:!0}];const Ct=sn=>{F===Me.value&&(d.value=d.value.map($t=>$t.id===un?sn($t):$t))};for(const sn of X)try{const $t=await eu(sn);if(F!==Me.value)return;if($t){const Pn=sn.webkitRelativePath||sn.name;St($t,Pn),Ct(hn=>({...hn,processed:hn.processed+1,filePaths:[...hn.filePaths,$t]}));continue}Ct(Pn=>({...Pn,processed:Pn.processed+1}))}catch{Ct($t=>({...$t,processed:$t.processed+1}))}Ct(sn=>({...sn,isUploading:!1}))}function Je(R){R&&(R.value="")}function Gt(R){const F=R.target;kt((F==null?void 0:F.files)??null),Je(F),_e.value=!1}function rn(R){const F=R.target;kt((F==null?void 0:F.files)??null),Je(F),_e.value=!1}function xt(R){const F=R.target;mt((F==null?void 0:F.files)??null),Je(F),_e.value=!1}function ln(){u.value&&(u.value="");const F=o.value.startsWith("/");F!==ne.value&&(ne.value=F),jt()}function cn(R){if(ke.value){if(R.key==="Escape"){R.preventDefault(),Lt();return}if(R.key==="ArrowDown"){R.preventDefault(),Q.value.length>0&&(Pe.value=(Pe.value+1)%Q.value.length);return}if(R.key==="ArrowUp"){if(R.preventDefault(),Q.value.length>0){const X=Q.value.length;Pe.value=(Pe.value+X-1)%X}return}if(R.key==="Enter"||R.key==="Tab"){R.preventDefault();const X=Q.value[Pe.value];X?Ie(X):Lt();return}}if(r.sendWithEnter!==!1?R.key==="Enter"&&!R.shiftKey:R.key==="Enter"&&(R.metaKey||R.ctrlKey)){R.preventDefault(),z(r.isTurnInProgress?be.value:"steer");return}if(ne.value){if(R.key==="Escape"){R.preventDefault(),Kt();return}if(R.key==="ArrowDown"||R.key==="ArrowUp"){R.preventDefault();return}}}function Kt(){var R;ne.value=!1,(R=me.value)==null||R.focus()}function Lt(){ke.value=!1,ie.value=null,pe.value="",Q.value=[],Pe.value=0}function jt(){const R=me.value;if(!R){Lt();return}const F=R.selectionStart??o.value.length,Oe=o.value.slice(0,F).match(/(^|\s)(@[^\s@]*)$/);if(!Oe){Lt();return}const yt=Oe[2]??"",un=yt.length,Ct=F-un;ie.value=Ct,pe.value=yt.slice(1),ke.value=!0,De()}async function De(){if(!ke.value)return;const R=(r.cwd??"").trim();if(!R){Q.value=[];return}$e&&clearTimeout($e);const F=++Te;$e=setTimeout(async()=>{try{const X=await O_(R,pe.value,20);if(!ke.value||F!==Te)return;Q.value=X,Pe.value=0}catch{if(!ke.value||F!==Te)return;Q.value=[]}},120)}function Ie(R){const F=me.value,X=ie.value;if(X!==null&&F){const Oe=F.selectionStart??o.value.length;o.value=`${o.value.slice(0,X)}${o.value.slice(Oe)}`.trimEnd()}St(R.path),Lt(),Ut(()=>F==null?void 0:F.focus())}function Jt(R){P(),x(R),Ut(()=>{var F;return(F=me.value)==null?void 0:F.focus()})}function yn(R){const F=R.lastIndexOf("/");return F<0?R:R.slice(F+1)}function w(R){const F=R.lastIndexOf("/");return F<=0?"":R.slice(0,F)}function I(R){const F=yn(R),X=F.lastIndexOf(".");return X<=0?"":F.slice(X+1).toLowerCase()}function C(R){const F=I(R);return F==="ts"?"TS":F==="tsx"?"TSX":F==="js"?"JS":F==="jsx"?"JSX":F==="json"?"{}":""}function q(R){const F=I(R);return F.startsWith("ts")?"ts":F.startsWith("js")?"js":F==="json"?"json":"default"}function oe(R){const F=I(R);return F==="md"||F==="mdx"}function ae(R){var F;a.value.some(X=>X.path===R.path)||(a.value=[...a.value,R]),o.value=o.value.startsWith("/")?"":o.value,ne.value=!1,(F=me.value)==null||F.focus()}function Ce(R,F){if(F){const X=(r.skills??[]).find(Oe=>Oe.path===R);X&&!a.value.some(Oe=>Oe.path===R)&&(a.value=[...a.value,X])}else a.value=a.value.filter(X=>X.path!==R)}function ve(R){if(!_e.value)return;const F=V.value;if(!F)return;const X=R.target;!X||F.contains(X)||(_e.value=!1)}return lr(()=>{document.addEventListener("click",ve)}),t({hydrateDraft:Jt,hasUnsavedDraft:()=>W.value}),cr(()=>{document.removeEventListener("click",ve),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge),window.removeEventListener("blur",ge),$e&&clearTimeout($e)}),ht(()=>r.activeThreadId,()=>{P(),U()}),ht(()=>r.cwd,()=>{ke.value&&De()}),ht(()=>{var R;return(R=r.prependDraftRequest)==null?void 0:R.id},()=>{var F,X;const R=((X=(F=r.prependDraftRequest)==null?void 0:F.text)==null?void 0:X.trim())??"";R&&(o.value=o.value?`${R}
40
- ${o.value}`:R,ln(),Ut(()=>{var Oe;return(Oe=me.value)==null?void 0:Oe.focus()}))}),(R,F)=>(y(),k("form",{class:"thread-composer",onSubmit:F[2]||(F[2]=it(X=>z("steer"),["prevent"]))},[b.value?(y(),k("p",Ck,se(b.value),1)):re("",!0),p("div",{class:at(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[i.value.length>0?(y(),k("div",Ak,[(y(!0),k(je,null,bt(i.value,X=>(y(),k("div",{key:X.id,class:"thread-composer-attachment"},[p("img",{class:"thread-composer-attachment-image",src:X.url,alt:X.name||"Selected image"},null,8,Rk),p("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${X.name||"image"}`,disabled:te.value,onClick:Oe=>nt(X.id)}," x ",8,Pk)]))),128))])):re("",!0),d.value.length>0?(y(),k("div",xk,[(y(!0),k(je,null,bt(d.value,X=>(y(),k("span",{key:X.id,class:"thread-composer-folder-chip"},[Re(fl,{class:"thread-composer-folder-chip-icon"}),p("span",{class:"thread-composer-folder-chip-name",title:X.name},se(X.name),9,Mk),p("span",Ok,[X.isUploading?(y(),k(je,{key:0},[zs(se(Pt(X))+"% uploading ("+se(X.processed)+"/"+se(X.total)+") ",1)],64)):(y(),k(je,{key:1},[zs(se(X.filePaths.length)+" file"+se(X.filePaths.length===1?"":"s"),1)],64))]),p("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${X.name}`,disabled:te.value,onClick:Oe=>Et(X.id)},"×",8,Nk)]))),128))])):re("",!0),le.value.length>0?(y(),k("div",$k,[(y(!0),k(je,null,bt(le.value,X=>(y(),k("span",{key:X.fsPath,class:"thread-composer-file-chip"},[Re(Fo,{class:"thread-composer-file-chip-icon"}),p("span",{class:"thread-composer-file-chip-name",title:X.fsPath},se(X.label),9,Dk),p("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${X.label}`,disabled:te.value,onClick:Oe=>vt(X.fsPath)},"×",8,Lk)]))),128))])):re("",!0),a.value.length>0?(y(),k("div",jk,[(y(!0),k(je,null,bt(a.value,X=>(y(),k("span",{key:X.path,class:"thread-composer-skill-chip"},[p("span",Uk,se(X.name),1),p("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${X.name}`,onClick:Oe=>Ke(X.path)},"×",8,Bk)]))),128))])):re("",!0),p("div",Fk,[ke.value?(y(),k("div",Hk,[Q.value.length>0?(y(!0),k(je,{key:0},bt(Q.value,(X,Oe)=>(y(),k("button",{key:X.path,class:at(["thread-composer-file-mention-row",{"is-active":Oe===Pe.value}]),type:"button",onMousedown:it(yt=>Ie(X),["prevent"])},[C(X.path)?(y(),k("span",{key:0,class:at(["thread-composer-file-mention-icon-badge",`is-${q(X.path)}`])},se(C(X.path)),3)):oe(X.path)?(y(),k("span",Wk,"↓")):(y(),ft(Fo,{key:2,class:"thread-composer-file-mention-icon-file"})),p("span",qk,[p("span",zk,se(yn(X.path)),1),w(X.path)?(y(),k("span",Gk,se(w(X.path)),1)):re("",!0)])],42,Vk))),128)):(y(),k("div",Kk,"No matching files"))])):re("",!0),rr(p("textarea",{ref_key:"inputRef",ref:me,"onUpdate:modelValue":F[0]||(F[0]=X=>o.value=X),class:"thread-composer-input",placeholder:J.value,disabled:te.value,onInput:ln,onKeydown:cn},null,40,Jk),[[sr,o.value]]),Re(Ek,{skills:Xe.value,visible:ne.value,"anchor-bottom":44,"anchor-left":0,onSelect:ae,onClose:Kt},null,8,["skills","visible"])]),p("div",{class:at(["thread-composer-controls",{"thread-composer-controls--recording":Le.value}])},[p("div",{ref_key:"attachMenuRootRef",ref:V,class:"thread-composer-attach"},[p("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:te.value,onClick:xe}," + ",8,Yk),_e.value?(y(),k("div",Xk,[p("button",{class:"thread-composer-attach-item",type:"button",disabled:te.value,onClick:Be}," Add photos & files ",8,Qk),p("button",{class:"thread-composer-attach-item",type:"button",disabled:te.value,onClick:He}," Add folder ",8,Zk),p("button",{class:"thread-composer-attach-item",type:"button",disabled:te.value,onClick:qe}," Take photo ",8,e0)])):re("",!0)],512),Le.value?re("",!0):(y(),k(je,{key:0},[Re(Ho,{class:"thread-composer-control","model-value":e.selectedModel,options:Qe.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":Y},null,8,["model-value","options","disabled"]),Re(vk,{class:"thread-composer-control",options:ct.value,"selected-values":tt.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:Ce},null,8,["options","selected-values","disabled"]),Re(Ho,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:et,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":K},null,8,["model-value","disabled"])],64)),p("div",{class:at(["thread-composer-actions",{"thread-composer-actions--recording":Le.value}])},[we(h)==="recording"?(y(),k("div",t0,[p("canvas",{ref_key:"dictationWaveformCanvasRef",ref:H,class:"thread-composer-dictation-waveform"},null,512)])):re("",!0),we(h)==="recording"?(y(),k("span",n0,se(A.value),1)):re("",!0),we(g)?(y(),k("button",{key:2,class:at(["thread-composer-mic",{"thread-composer-mic--active":we(h)==="recording"}]),type:"button","aria-label":v.value,title:v.value,disabled:te.value,onClick:ye,onPointerdown:fe,onPointerup:ge,onPointercancel:ge},[we(h)==="recording"?(y(),ft(tu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(y(),ft(q_,{key:1,class:"thread-composer-mic-icon"}))],42,r0)):re("",!0),e.isTurnInProgress?(y(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:G},[Re(tu,{class:"thread-composer-stop-icon"})],8,s0)):(y(),k("button",{key:4,class:at(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&be.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&be.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${be.value}`:"Send",disabled:!We.value,onClick:F[1]||(F[1]=X=>z(e.isTurnInProgress?be.value:"steer"))},[Re(F_,{class:"thread-composer-submit-icon"})],10,o0))],2)],2)],2),p("input",{ref_key:"photoLibraryInputRef",ref:B,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:te.value,onChange:Gt},null,40,i0),p("input",{ref_key:"cameraCaptureInputRef",ref:ce,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:te.value,onChange:rn},null,40,a0),p("input",{ref_key:"folderPickerInputRef",ref:de,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:te.value,onChange:xt},null,40,l0)],32))}}),nu=rt(c0,[["__scopeId","data-v-2027dd06"]]),u0={key:0,class:"queued-messages"},d0={class:"queued-messages-inner"},f0={class:"queued-row-text"},h0={class:"queued-row-actions"},p0=["onClick"],m0=["onClick"],g0=["onClick"],v0=Nt({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){function t(n){var l,d,u;const r=n.text.trim();if(r)return r;const s=[],o=((l=n.imageUrls)==null?void 0:l.length)??0,i=((d=n.fileAttachments)==null?void 0:d.length)??0,a=((u=n.skills)==null?void 0:u.length)??0;return o>0&&s.push(`${o} image${o===1?"":"s"}`),i>0&&s.push(`${i} file${i===1?"":"s"}`),a>0&&s.push(`${a} skill${a===1?"":"s"}`),s.join(", ")||"(empty queued message)"}return(n,r)=>e.messages.length>0?(y(),k("div",u0,[p("div",d0,[(y(!0),k(je,null,bt(e.messages,s=>(y(),k("div",{key:s.id,class:"queued-row"},[r[1]||(r[1]=p("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("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)),p("span",f0,se(t(s)),1),p("div",h0,[p("button",{class:"queued-row-edit",type:"button",title:"Edit queued message",onClick:o=>n.$emit("edit",s.id)},"Edit",8,p0),p("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:o=>n.$emit("steer",s.id)},"Steer",8,m0),p("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:o=>n.$emit("delete",s.id)},[...r[0]||(r[0]=[p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[p("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,g0)])]))),128))])])):re("",!0)}}),y0=rt(v0,[["__scopeId","data-v-1394d0f8"]]),w0={key:0,class:"rate-limit-status","aria-live":"polite"},b0=["title"],_0={class:"rate-limit-card-header"},k0={class:"rate-limit-card-title"},T0={key:0,class:"rate-limit-card-plan"},S0={class:"rate-limit-card-metrics"},I0={key:0,class:"rate-limit-card-footer"},E0=Nt({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(N){var P,V;return((P=N.limitId)==null?void 0:P.trim())||((V=N.limitName)==null?void 0:V.trim())||"__default__"}function n(N){var P,V;return((P=N.limitName)==null?void 0:P.trim())||((V=N.limitId)==null?void 0:V.trim())||"Rate limits"}function r(N){const P=N.trim();return P?P.replace(/[_-]+/g," ").replace(/\b\w/g,V=>V.toUpperCase()):""}function s(N){return!N||N<=0?"Window":N%1440===0?`${N/1440}d`:N%60===0?`${N/60}h`:N<60?`${N}m`:`${Math.round(N/60*10)/10}h`}function o(N){const P=Math.max(0,Math.min(100,100-N));return`${Math.round(P)}% left`}function i(N){return`${Math.round(N)}%`}function a(N,P){return{key:P,label:`${s(N.windowDurationMins)} ${o(N.usedPercent)}`}}function l(N){const P=[];return N.primary&&P.push(a(N.primary,"primary")),N.secondary&&P.push(a(N.secondary,"secondary")),P}function d(N){if(!N)return"";const P=new Date(N*1e3),V=P.getMonth()+1,B=String(P.getDate()).padStart(2,"0"),ce=String(P.getHours()).padStart(2,"0"),de=String(P.getMinutes()).padStart(2,"0");return`${V}.${B} ${ce}:${de}`}function u(N){if(!(N!=null&&N.resetsAt))return"";const P=N.resetsAt*1e3-Date.now();if(P<=0)return"Resetting now";const V=Math.round(P/6e4);if(V<60)return`Resets in ${V}m`;const B=Math.round(V/60);return B<24?`Resets in ${B}h`:`Resets in ${Math.round(B/24)}d`}function h(N){return[N.primary,N.secondary].filter(P=>P!==null)}function g(N){const P=h(N);return P.length===0?null:[...P].sort((V,B)=>{const ce=V.windowDurationMins??Number.MAX_SAFE_INTEGER,de=B.windowDurationMins??Number.MAX_SAFE_INTEGER;return ce!==de?ce-de:(V.resetsAt??Number.MAX_SAFE_INTEGER)-(B.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function T(N){const P=h(N);if(P.length===0)return"";const V=[...P].sort((ce,de)=>{const me=ce.windowDurationMins??-1,_e=de.windowDurationMins??-1;return me!==_e?_e-me:(de.resetsAt??-1)-(ce.resetsAt??-1)})[0],B=d(V.resetsAt);return B||""}function H(N){const P=N.credits;return P?P.unlimited?"Unlimited credits":P.balance?`Credits ${P.balance}`:P.hasCredits?"Credits available":"":""}function M(N){return[u(g(N)),T(N),H(N)].filter(P=>P.length>0)}function D(N){const P=[n(N)];for(const V of l(N))P.push(V.label);for(const V of h(N))P.push(`${s(V.windowDurationMins)} used ${i(V.usedPercent)}`);for(const V of M(N))P.push(V);return P.join(`
41
- `)}return(N,P)=>e.snapshots.length>0?(y(),k("aside",w0,[(y(!0),k(je,null,bt(e.snapshots,V=>(y(),k("div",{key:t(V),class:"rate-limit-card",title:D(V)},[p("div",_0,[p("span",k0,se(n(V)),1),V.planType?(y(),k("span",T0,se(r(V.planType)),1)):re("",!0)]),p("div",S0,[(y(!0),k(je,null,bt(l(V),B=>(y(),k("span",{key:B.key,class:"rate-limit-card-metric"},se(B.label),1))),128))]),M(V).length>0?(y(),k("div",I0,se(M(V).join(" | ")),1)):re("",!0)],8,b0))),128))])):re("",!0)}}),C0=rt(E0,[["__scopeId","data-v-df88906b"]]),A0={class:"runtime-dropdown-trigger-label"},R0={key:0,class:"runtime-dropdown-menu-wrap"},P0={class:"runtime-dropdown-menu"},x0=["onClick"],M0={class:"runtime-dropdown-option-label"},O0={key:0,class:"runtime-dropdown-option-check"},N0=Nt({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(!1),i=[{value:"local",label:"Local project",icon:fl},{value:"worktree",label:"New worktree",icon:Ao}],a=ue(()=>i.find(u=>u.value===n.modelValue)??i[0]);function l(u){r("update:modelValue",u),o.value=!1}function d(u){if(!o.value)return;const h=s.value;if(!h)return;const g=u.target;g instanceof Node&&(h.contains(g)||(o.value=!1))}return lr(()=>{window.addEventListener("pointerdown",d)}),cr(()=>{window.removeEventListener("pointerdown",d)}),(u,h)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[p("button",{class:"runtime-dropdown-trigger",type:"button",onClick:h[0]||(h[0]=g=>o.value=!o.value)},[(y(),ft(ya(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),p("span",A0,se(a.value.label),1),Re(di,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(y(),k("div",R0,[p("div",P0,[h[1]||(h[1]=p("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(y(),k(je,null,bt(i,g=>p("button",{key:g.value,class:at(["runtime-dropdown-option",{"is-selected":e.modelValue===g.value}]),type:"button",onClick:T=>l(g.value)},[(y(),ft(ya(g.icon),{class:"runtime-dropdown-option-icon"})),p("span",M0,se(g.label),1),e.modelValue===g.value?(y(),k("span",O0,"✓")):re("",!0)],10,x0)),64))])])):re("",!0)],512))}}),$0=rt(N0,[["__scopeId","data-v-9c9b71e5"]]),D0={},L0={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function j0(e,t){return y(),k("svg",L0,[...t[0]||(t[0]=[p("circle",{cx:"11",cy:"11",r:"8"},null,-1),p("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Pa=rt(D0,[["render",j0]]),U0={class:"skill-card-top"},B0=["src","alt"],F0={key:1,class:"skill-card-avatar-fallback"},H0={class:"skill-card-info"},V0={class:"skill-card-header"},W0={class:"skill-card-name"},q0={key:0,class:"skill-card-badge-disabled"},z0={key:1,class:"skill-card-badge"},G0={class:"skill-card-owner"},K0={key:0,class:"skill-card-desc"},J0={key:1,class:"skill-card-date"},Y0=Nt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=ue(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),a=Date.now()-s;return a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<2592e6?`${Math.floor(a/864e5)}d ago`:o.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function r(s){const o=s.target;o.style.display="none"}return(s,o)=>(y(),k("button",{class: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))},[p("div",U0,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,B0)):(y(),k("div",F0,se(e.skill.owner.charAt(0)),1)),p("div",H0,[p("div",V0,[p("span",W0,se(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(y(),k("span",q0,"Disabled")):e.skill.installed?(y(),k("span",z0,"Installed")):re("",!0)]),p("span",G0,se(e.skill.owner),1)])]),e.skill.description?(y(),k("p",K0,se(e.skill.description),1)):re("",!0),n.value?(y(),k("span",J0,se(n.value),1)):re("",!0)],2))}}),ru=rt(Y0,[["__scopeId","data-v-2a1e8196"]]),X0={class:"sdm-panel"},Q0={class:"sdm-header"},Z0={class:"sdm-title-area"},eT=["src","alt"],tT={class:"sdm-title-col"},nT={class:"sdm-title-row"},rT={class:"sdm-title"},sT={key:0,class:"sdm-badge-disabled"},oT={class:"sdm-owner"},iT={class:"sdm-body"},aT={key:0,class:"sdm-desc"},lT={key:1,class:"sdm-readme-loading"},cT=["innerHTML"],uT=["href"],dT={class:"sdm-footer"},fT={class:"sdm-footer-actions"},hT=["disabled"],pT=["disabled"],mT=["disabled"],gT=Nt({__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=j(null),o=j(""),i=j(!1),a=ue(()=>s.value??n.skill.enabled??!0),l=ue(()=>n.isInstalling===!0||n.isUninstalling===!0),d=ue(()=>{const M=o.value;if(!M)return"";const D=M.replace(/^---[\s\S]*?---\s*/,"");return u(D)});function u(M){return M.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 h(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const M=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),D=await fetch(`/codex-api/skills-hub/readme?${M}`);if(!D.ok)return;const N=await D.json();o.value=N.content??""}catch{}finally{i.value=!1}}}ht(()=>n.visible,M=>{M&&(s.value=null,o.value="",h())});function g(){r("install",n.skill)}function T(){r("uninstall",n.skill)}function H(){const M=!a.value;s.value=M,r("toggle-enabled",n.skill,M)}return(M,D)=>(y(),ft(Do,{to:"body"},[e.visible?(y(),k("div",{key:0,class:"sdm-overlay",onClick:D[1]||(D[1]=it(N=>M.$emit("close"),["self"]))},[p("div",X0,[p("div",Q0,[p("div",Z0,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,eT)):re("",!0),p("div",tT,[p("div",nT,[p("h3",rT,se(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(y(),k("span",sT,"Disabled")):re("",!0)]),p("span",oT,se(e.skill.owner),1)])]),p("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:D[0]||(D[0]=N=>M.$emit("close"))},[Re(hl,{class:"sdm-close-icon"})])]),p("div",iT,[e.skill.description?(y(),k("p",aT,se(e.skill.description),1)):re("",!0),i.value?(y(),k("div",lT,"Loading skill contents...")):o.value?(y(),k("div",{key:2,class:"sdm-readme",innerHTML:d.value},null,8,cT)):re("",!0),p("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,uT)]),p("div",dT,[p("div",fT,[e.skill.installed?(y(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:T},se(n.isUninstalling?"Uninstalling...":"Uninstall"),9,hT)):(y(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:g},se(n.isInstalling?"Installing...":"Install"),9,pT)),e.skill.installed?(y(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:H},se(a.value?"Disable":"Enable"),9,mT)):re("",!0)])])])])):re("",!0)]))}}),vT=rt(gT,[["__scopeId","data-v-19a385ca"]]),yT=()=>{};var su={};/**
42
- * @license
43
- * Copyright 2017 Google LLC
44
- *
45
- * Licensed under the Apache License, Version 2.0 (the "License");
46
- * you may not use this file except in compliance with the License.
47
- * You may obtain a copy of the License at
48
- *
49
- * http://www.apache.org/licenses/LICENSE-2.0
50
- *
51
- * Unless required by applicable law or agreed to in writing, software
52
- * distributed under the License is distributed on an "AS IS" BASIS,
53
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54
- * See the License for the specific language governing permissions and
55
- * limitations under the License.
56
- */const Tf=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},wT=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("")},Sf={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,u=o>>2,h=(o&3)<<4|a>>4;let g=(a&15)<<2|d>>6,T=d&63;l||(T=64,i||(g=64)),r.push(n[u],n[h],n[g],n[T])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Tf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):wT(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 h=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||d==null||h==null)throw new bT;const g=o<<2|a>>4;if(r.push(g),d!==64){const T=a<<4&240|d>>2;if(r.push(T),h!==64){const H=d<<6&192|h;r.push(H)}}}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 bT extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const _T=function(e){const t=Tf(e);return Sf.encodeByteArray(t,!0)},If=function(e){return _T(e).replace(/\./g,"")},Ef=function(e){try{return Sf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
57
- * @license
58
- * Copyright 2022 Google LLC
59
- *
60
- * Licensed under the Apache License, Version 2.0 (the "License");
61
- * you may not use this file except in compliance with the License.
62
- * You may obtain a copy of the License at
63
- *
64
- * http://www.apache.org/licenses/LICENSE-2.0
65
- *
66
- * Unless required by applicable law or agreed to in writing, software
67
- * distributed under the License is distributed on an "AS IS" BASIS,
68
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69
- * See the License for the specific language governing permissions and
70
- * limitations under the License.
71
- */function kT(){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.")}/**
72
- * @license
73
- * Copyright 2022 Google LLC
74
- *
75
- * Licensed under the Apache License, Version 2.0 (the "License");
76
- * you may not use this file except in compliance with the License.
77
- * You may obtain a copy of the License at
78
- *
79
- * http://www.apache.org/licenses/LICENSE-2.0
80
- *
81
- * Unless required by applicable law or agreed to in writing, software
82
- * distributed under the License is distributed on an "AS IS" BASIS,
83
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84
- * See the License for the specific language governing permissions and
85
- * limitations under the License.
86
- */const TT=()=>kT().__FIREBASE_DEFAULTS__,ST=()=>{if(typeof process>"u"||typeof su>"u")return;const e=su.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},IT=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Ef(e[1]);return t&&JSON.parse(t)},gl=()=>{try{return yT()||TT()||ST()||IT()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},ET=e=>{var t,n;return(n=(t=gl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},Cf=()=>{var e;return(e=gl())==null?void 0:e.config},Af=e=>{var t;return(t=gl())==null?void 0:t[`_${e}`]};/**
87
- * @license
88
- * Copyright 2017 Google LLC
89
- *
90
- * Licensed under the Apache License, Version 2.0 (the "License");
91
- * you may not use this file except in compliance with the License.
92
- * You may obtain a copy of the License at
93
- *
94
- * http://www.apache.org/licenses/LICENSE-2.0
95
- *
96
- * Unless required by applicable law or agreed to in writing, software
97
- * distributed under the License is distributed on an "AS IS" BASIS,
98
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
- * See the License for the specific language governing permissions and
100
- * limitations under the License.
101
- */class CT{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))}}}/**
102
- * @license
103
- * Copyright 2017 Google LLC
104
- *
105
- * Licensed under the Apache License, Version 2.0 (the "License");
106
- * you may not use this file except in compliance with the License.
107
- * You may obtain a copy of the License at
108
- *
109
- * http://www.apache.org/licenses/LICENSE-2.0
110
- *
111
- * Unless required by applicable law or agreed to in writing, software
112
- * distributed under the License is distributed on an "AS IS" BASIS,
113
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
- * See the License for the specific language governing permissions and
115
- * limitations under the License.
116
- */function tn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function AT(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(tn())}function RT(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function PT(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function xT(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function MT(){const e=tn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function OT(){try{return typeof indexedDB=="object"}catch{return!1}}function NT(){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)}})}/**
117
- * @license
118
- * Copyright 2017 Google LLC
119
- *
120
- * Licensed under the Apache License, Version 2.0 (the "License");
121
- * you may not use this file except in compliance with the License.
122
- * You may obtain a copy of the License at
123
- *
124
- * http://www.apache.org/licenses/LICENSE-2.0
125
- *
126
- * Unless required by applicable law or agreed to in writing, software
127
- * distributed under the License is distributed on an "AS IS" BASIS,
128
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129
- * See the License for the specific language governing permissions and
130
- * limitations under the License.
131
- */const $T="FirebaseError";class Ir extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=$T,Object.setPrototypeOf(this,Ir.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ro.prototype.create)}}class ro{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?DT(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Ir(s,a,r)}}function DT(e,t){return e.replace(LT,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const LT=/\{\$([^}]+)}/g;function jT(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function fs(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(ou(o)&&ou(i)){if(!fs(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function ou(e){return e!==null&&typeof e=="object"}/**
132
- * @license
133
- * Copyright 2017 Google LLC
134
- *
135
- * Licensed under the Apache License, Version 2.0 (the "License");
136
- * you may not use this file except in compliance with the License.
137
- * You may obtain a copy of the License at
138
- *
139
- * http://www.apache.org/licenses/LICENSE-2.0
140
- *
141
- * Unless required by applicable law or agreed to in writing, software
142
- * distributed under the License is distributed on an "AS IS" BASIS,
143
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144
- * See the License for the specific language governing permissions and
145
- * limitations under the License.
146
- */function so(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 UT(e,t){const n=new BT(e,t);return n.subscribe.bind(n)}class BT{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.");FT(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Xi),s.error===void 0&&(s.error=Xi),s.complete===void 0&&(s.complete=Xi);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 FT(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 Xi(){}/**
147
- * @license
148
- * Copyright 2021 Google LLC
149
- *
150
- * Licensed under the Apache License, Version 2.0 (the "License");
151
- * you may not use this file except in compliance with the License.
152
- * You may obtain a copy of the License at
153
- *
154
- * http://www.apache.org/licenses/LICENSE-2.0
155
- *
156
- * Unless required by applicable law or agreed to in writing, software
157
- * distributed under the License is distributed on an "AS IS" BASIS,
158
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159
- * See the License for the specific language governing permissions and
160
- * limitations under the License.
161
- */function gs(e){return e&&e._delegate?e._delegate:e}/**
162
- * @license
163
- * Copyright 2025 Google LLC
164
- *
165
- * Licensed under the Apache License, Version 2.0 (the "License");
166
- * you may not use this file except in compliance with the License.
167
- * You may obtain a copy of the License at
168
- *
169
- * http://www.apache.org/licenses/LICENSE-2.0
170
- *
171
- * Unless required by applicable law or agreed to in writing, software
172
- * distributed under the License is distributed on an "AS IS" BASIS,
173
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
174
- * See the License for the specific language governing permissions and
175
- * limitations under the License.
176
- */function vl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function HT(e){return(await fetch(e,{credentials:"include"})).ok}class hs{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}}/**
177
- * @license
178
- * Copyright 2019 Google LLC
179
- *
180
- * Licensed under the Apache License, Version 2.0 (the "License");
181
- * you may not use this file except in compliance with the License.
182
- * You may obtain a copy of the License at
183
- *
184
- * http://www.apache.org/licenses/LICENSE-2.0
185
- *
186
- * Unless required by applicable law or agreed to in writing, software
187
- * distributed under the License is distributed on an "AS IS" BASIS,
188
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
- * See the License for the specific language governing permissions and
190
- * limitations under the License.
191
- */const jr="[DEFAULT]";/**
192
- * @license
193
- * Copyright 2019 Google LLC
194
- *
195
- * Licensed under the Apache License, Version 2.0 (the "License");
196
- * you may not use this file except in compliance with the License.
197
- * You may obtain a copy of the License at
198
- *
199
- * http://www.apache.org/licenses/LICENSE-2.0
200
- *
201
- * Unless required by applicable law or agreed to in writing, software
202
- * distributed under the License is distributed on an "AS IS" BASIS,
203
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204
- * See the License for the specific language governing permissions and
205
- * limitations under the License.
206
- */class VT{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 CT;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(qT(t))try{this.getOrInitializeService({instanceIdentifier:jr})}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=jr){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=jr){return this.instances.has(t)}getOptions(t=jr){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:WT(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=jr){return this.component?this.component.multipleInstances?t:jr:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function WT(e){return e===jr?void 0:e}function qT(e){return e.instantiationMode==="EAGER"}/**
207
- * @license
208
- * Copyright 2019 Google LLC
209
- *
210
- * Licensed under the Apache License, Version 2.0 (the "License");
211
- * you may not use this file except in compliance with the License.
212
- * You may obtain a copy of the License at
213
- *
214
- * http://www.apache.org/licenses/LICENSE-2.0
215
- *
216
- * Unless required by applicable law or agreed to in writing, software
217
- * distributed under the License is distributed on an "AS IS" BASIS,
218
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
219
- * See the License for the specific language governing permissions and
220
- * limitations under the License.
221
- */class zT{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 VT(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
222
- * @license
223
- * Copyright 2017 Google LLC
224
- *
225
- * Licensed under the Apache License, Version 2.0 (the "License");
226
- * you may not use this file except in compliance with the License.
227
- * You may obtain a copy of the License at
228
- *
229
- * http://www.apache.org/licenses/LICENSE-2.0
230
- *
231
- * Unless required by applicable law or agreed to in writing, software
232
- * distributed under the License is distributed on an "AS IS" BASIS,
233
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
234
- * See the License for the specific language governing permissions and
235
- * limitations under the License.
236
- */var wt;(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"})(wt||(wt={}));const GT={debug:wt.DEBUG,verbose:wt.VERBOSE,info:wt.INFO,warn:wt.WARN,error:wt.ERROR,silent:wt.SILENT},KT=wt.INFO,JT={[wt.DEBUG]:"log",[wt.VERBOSE]:"log",[wt.INFO]:"info",[wt.WARN]:"warn",[wt.ERROR]:"error"},YT=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=JT[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 Rf{constructor(t){this.name=t,this._logLevel=KT,this._logHandler=YT,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in wt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?GT[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,wt.DEBUG,...t),this._logHandler(this,wt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,wt.VERBOSE,...t),this._logHandler(this,wt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,wt.INFO,...t),this._logHandler(this,wt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,wt.WARN,...t),this._logHandler(this,wt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,wt.ERROR,...t),this._logHandler(this,wt.ERROR,...t)}}const XT=(e,t)=>t.some(n=>e instanceof n);let iu,au;function QT(){return iu||(iu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ZT(){return au||(au=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Pf=new WeakMap,xa=new WeakMap,xf=new WeakMap,Qi=new WeakMap,yl=new WeakMap;function eS(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(_r(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&Pf.set(n,e)}).catch(()=>{}),yl.set(t,e),t}function tS(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 Ma={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return xa.get(e);if(t==="objectStoreNames")return e.objectStoreNames||xf.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return _r(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 nS(e){Ma=e(Ma)}function rS(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Zi(this),t,...n);return xf.set(r,t.sort?t.sort():[t]),_r(r)}:ZT().includes(e)?function(...t){return e.apply(Zi(this),t),_r(Pf.get(this))}:function(...t){return _r(e.apply(Zi(this),t))}}function sS(e){return typeof e=="function"?rS(e):(e instanceof IDBTransaction&&tS(e),XT(e,QT())?new Proxy(e,Ma):e)}function _r(e){if(e instanceof IDBRequest)return eS(e);if(Qi.has(e))return Qi.get(e);const t=sS(e);return t!==e&&(Qi.set(e,t),yl.set(t,e)),t}const Zi=e=>yl.get(e);function oS(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=_r(i);return r&&i.addEventListener("upgradeneeded",l=>{r(_r(i.result),l.oldVersion,l.newVersion,_r(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 iS=["get","getKey","getAll","getAllKeys","count"],aS=["put","add","delete","clear"],ea=new Map;function lu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(ea.get(t))return ea.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=aS.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||iS.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 ea.set(t,o),o}nS(e=>({...e,get:(t,n,r)=>lu(t,n)||e.get(t,n,r),has:(t,n)=>!!lu(t,n)||e.has(t,n)}));/**
237
- * @license
238
- * Copyright 2019 Google LLC
239
- *
240
- * Licensed under the Apache License, Version 2.0 (the "License");
241
- * you may not use this file except in compliance with the License.
242
- * You may obtain a copy of the License at
243
- *
244
- * http://www.apache.org/licenses/LICENSE-2.0
245
- *
246
- * Unless required by applicable law or agreed to in writing, software
247
- * distributed under the License is distributed on an "AS IS" BASIS,
248
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
249
- * See the License for the specific language governing permissions and
250
- * limitations under the License.
251
- */class lS{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(cS(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function cS(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const Oa="@firebase/app",cu="0.14.10";/**
252
- * @license
253
- * Copyright 2019 Google LLC
254
- *
255
- * Licensed under the Apache License, Version 2.0 (the "License");
256
- * you may not use this file except in compliance with the License.
257
- * You may obtain a copy of the License at
258
- *
259
- * http://www.apache.org/licenses/LICENSE-2.0
260
- *
261
- * Unless required by applicable law or agreed to in writing, software
262
- * distributed under the License is distributed on an "AS IS" BASIS,
263
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
264
- * See the License for the specific language governing permissions and
265
- * limitations under the License.
266
- */const or=new Rf("@firebase/app"),uS="@firebase/app-compat",dS="@firebase/analytics-compat",fS="@firebase/analytics",hS="@firebase/app-check-compat",pS="@firebase/app-check",mS="@firebase/auth",gS="@firebase/auth-compat",vS="@firebase/database",yS="@firebase/data-connect",wS="@firebase/database-compat",bS="@firebase/functions",_S="@firebase/functions-compat",kS="@firebase/installations",TS="@firebase/installations-compat",SS="@firebase/messaging",IS="@firebase/messaging-compat",ES="@firebase/performance",CS="@firebase/performance-compat",AS="@firebase/remote-config",RS="@firebase/remote-config-compat",PS="@firebase/storage",xS="@firebase/storage-compat",MS="@firebase/firestore",OS="@firebase/ai",NS="@firebase/firestore-compat",$S="firebase",DS="12.11.0";/**
267
- * @license
268
- * Copyright 2019 Google LLC
269
- *
270
- * Licensed under the Apache License, Version 2.0 (the "License");
271
- * you may not use this file except in compliance with the License.
272
- * You may obtain a copy of the License at
273
- *
274
- * http://www.apache.org/licenses/LICENSE-2.0
275
- *
276
- * Unless required by applicable law or agreed to in writing, software
277
- * distributed under the License is distributed on an "AS IS" BASIS,
278
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
279
- * See the License for the specific language governing permissions and
280
- * limitations under the License.
281
- */const Na="[DEFAULT]",LS={[Oa]:"fire-core",[uS]:"fire-core-compat",[fS]:"fire-analytics",[dS]:"fire-analytics-compat",[pS]:"fire-app-check",[hS]:"fire-app-check-compat",[mS]:"fire-auth",[gS]:"fire-auth-compat",[vS]:"fire-rtdb",[yS]:"fire-data-connect",[wS]:"fire-rtdb-compat",[bS]:"fire-fn",[_S]:"fire-fn-compat",[kS]:"fire-iid",[TS]:"fire-iid-compat",[SS]:"fire-fcm",[IS]:"fire-fcm-compat",[ES]:"fire-perf",[CS]:"fire-perf-compat",[AS]:"fire-rc",[RS]:"fire-rc-compat",[PS]:"fire-gcs",[xS]:"fire-gcs-compat",[MS]:"fire-fst",[NS]:"fire-fst-compat",[OS]:"fire-vertex","fire-js":"fire-js",[$S]:"fire-js-all"};/**
282
- * @license
283
- * Copyright 2019 Google LLC
284
- *
285
- * Licensed under the Apache License, Version 2.0 (the "License");
286
- * you may not use this file except in compliance with the License.
287
- * You may obtain a copy of the License at
288
- *
289
- * http://www.apache.org/licenses/LICENSE-2.0
290
- *
291
- * Unless required by applicable law or agreed to in writing, software
292
- * distributed under the License is distributed on an "AS IS" BASIS,
293
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
294
- * See the License for the specific language governing permissions and
295
- * limitations under the License.
296
- */const Ys=new Map,jS=new Map,$a=new Map;function uu(e,t){try{e.container.addComponent(t)}catch(n){or.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Xs(e){const t=e.name;if($a.has(t))return or.debug(`There were multiple attempts to register component ${t}.`),!1;$a.set(t,e);for(const n of Ys.values())uu(n,e);for(const n of jS.values())uu(n,e);return!0}function Mf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function jn(e){return e==null?!1:e.settings!==void 0}/**
297
- * @license
298
- * Copyright 2019 Google LLC
299
- *
300
- * Licensed under the Apache License, Version 2.0 (the "License");
301
- * you may not use this file except in compliance with the License.
302
- * You may obtain a copy of the License at
303
- *
304
- * http://www.apache.org/licenses/LICENSE-2.0
305
- *
306
- * Unless required by applicable law or agreed to in writing, software
307
- * distributed under the License is distributed on an "AS IS" BASIS,
308
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
309
- * See the License for the specific language governing permissions and
310
- * limitations under the License.
311
- */const US={"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."},kr=new ro("app","Firebase",US);/**
312
- * @license
313
- * Copyright 2019 Google LLC
314
- *
315
- * Licensed under the Apache License, Version 2.0 (the "License");
316
- * you may not use this file except in compliance with the License.
317
- * You may obtain a copy of the License at
318
- *
319
- * http://www.apache.org/licenses/LICENSE-2.0
320
- *
321
- * Unless required by applicable law or agreed to in writing, software
322
- * distributed under the License is distributed on an "AS IS" BASIS,
323
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
324
- * See the License for the specific language governing permissions and
325
- * limitations under the License.
326
- */class BS{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 hs("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 kr.create("app-deleted",{appName:this._name})}}/**
327
- * @license
328
- * Copyright 2019 Google LLC
329
- *
330
- * Licensed under the Apache License, Version 2.0 (the "License");
331
- * you may not use this file except in compliance with the License.
332
- * You may obtain a copy of the License at
333
- *
334
- * http://www.apache.org/licenses/LICENSE-2.0
335
- *
336
- * Unless required by applicable law or agreed to in writing, software
337
- * distributed under the License is distributed on an "AS IS" BASIS,
338
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
339
- * See the License for the specific language governing permissions and
340
- * limitations under the License.
341
- */const oo=DS;function Of(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:Na,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw kr.create("bad-app-name",{appName:String(s)});if(n||(n=Cf()),!n)throw kr.create("no-options");const o=Ys.get(s);if(o){if(fs(n,o.options)&&fs(r,o.config))return o;throw kr.create("duplicate-app",{appName:s})}const i=new zT(s);for(const l of $a.values())i.addComponent(l);const a=new BS(n,r,i);return Ys.set(s,a),a}function Nf(e=Na){const t=Ys.get(e);if(!t&&e===Na&&Cf())return Of();if(!t)throw kr.create("no-app",{appName:e});return t}function FS(){return Array.from(Ys.values())}function os(e,t,n){let r=LS[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 "/")`),or.warn(i.join(" "));return}Xs(new hs(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
342
- * @license
343
- * Copyright 2021 Google LLC
344
- *
345
- * Licensed under the Apache License, Version 2.0 (the "License");
346
- * you may not use this file except in compliance with the License.
347
- * You may obtain a copy of the License at
348
- *
349
- * http://www.apache.org/licenses/LICENSE-2.0
350
- *
351
- * Unless required by applicable law or agreed to in writing, software
352
- * distributed under the License is distributed on an "AS IS" BASIS,
353
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
354
- * See the License for the specific language governing permissions and
355
- * limitations under the License.
356
- */const HS="firebase-heartbeat-database",VS=1,Qs="firebase-heartbeat-store";let ta=null;function $f(){return ta||(ta=oS(HS,VS,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Qs)}catch(n){console.warn(n)}}}}).catch(e=>{throw kr.create("idb-open",{originalErrorMessage:e.message})})),ta}async function WS(e){try{const n=(await $f()).transaction(Qs),r=await n.objectStore(Qs).get(Df(e));return await n.done,r}catch(t){if(t instanceof Ir)or.warn(t.message);else{const n=kr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});or.warn(n.message)}}}async function du(e,t){try{const r=(await $f()).transaction(Qs,"readwrite");await r.objectStore(Qs).put(t,Df(e)),await r.done}catch(n){if(n instanceof Ir)or.warn(n.message);else{const r=kr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});or.warn(r.message)}}}function Df(e){return`${e.name}!${e.options.appId}`}/**
357
- * @license
358
- * Copyright 2021 Google LLC
359
- *
360
- * Licensed under the Apache License, Version 2.0 (the "License");
361
- * you may not use this file except in compliance with the License.
362
- * You may obtain a copy of the License at
363
- *
364
- * http://www.apache.org/licenses/LICENSE-2.0
365
- *
366
- * Unless required by applicable law or agreed to in writing, software
367
- * distributed under the License is distributed on an "AS IS" BASIS,
368
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
369
- * See the License for the specific language governing permissions and
370
- * limitations under the License.
371
- */const qS=1024,zS=30;class GS{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new JS(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=fu();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>zS){const i=YS(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){or.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=fu(),{heartbeatsToSend:r,unsentEntries:s}=KS(this._heartbeatsCache.heartbeats),o=If(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 or.warn(n),""}}}function fu(){return new Date().toISOString().substring(0,10)}function KS(e,t=qS){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),hu(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),hu(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class JS{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return OT()?NT().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await WS(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return du(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return du(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function hu(e){return If(JSON.stringify({version:2,heartbeats:e})).length}function YS(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}/**
372
- * @license
373
- * Copyright 2019 Google LLC
374
- *
375
- * Licensed under the Apache License, Version 2.0 (the "License");
376
- * you may not use this file except in compliance with the License.
377
- * You may obtain a copy of the License at
378
- *
379
- * http://www.apache.org/licenses/LICENSE-2.0
380
- *
381
- * Unless required by applicable law or agreed to in writing, software
382
- * distributed under the License is distributed on an "AS IS" BASIS,
383
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
384
- * See the License for the specific language governing permissions and
385
- * limitations under the License.
386
- */function XS(e){Xs(new hs("platform-logger",t=>new lS(t),"PRIVATE")),Xs(new hs("heartbeat",t=>new GS(t),"PRIVATE")),os(Oa,cu,e),os(Oa,cu,"esm2020"),os("fire-js","")}XS("");var QS="firebase",ZS="12.11.0";/**
387
- * @license
388
- * Copyright 2020 Google LLC
389
- *
390
- * Licensed under the Apache License, Version 2.0 (the "License");
391
- * you may not use this file except in compliance with the License.
392
- * You may obtain a copy of the License at
393
- *
394
- * http://www.apache.org/licenses/LICENSE-2.0
395
- *
396
- * Unless required by applicable law or agreed to in writing, software
397
- * distributed under the License is distributed on an "AS IS" BASIS,
398
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
399
- * See the License for the specific language governing permissions and
400
- * limitations under the License.
401
- */os(QS,ZS,"app");function Lf(){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 eI=Lf,jf=new ro("auth","Firebase",Lf());/**
402
- * @license
403
- * Copyright 2020 Google LLC
404
- *
405
- * Licensed under the Apache License, Version 2.0 (the "License");
406
- * you may not use this file except in compliance with the License.
407
- * You may obtain a copy of the License at
408
- *
409
- * http://www.apache.org/licenses/LICENSE-2.0
410
- *
411
- * Unless required by applicable law or agreed to in writing, software
412
- * distributed under the License is distributed on an "AS IS" BASIS,
413
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
414
- * See the License for the specific language governing permissions and
415
- * limitations under the License.
416
- */const Vo=new Rf("@firebase/auth");function tI(e,...t){Vo.logLevel<=wt.WARN&&Vo.warn(`Auth (${oo}): ${e}`,...t)}function Ro(e,...t){Vo.logLevel<=wt.ERROR&&Vo.error(`Auth (${oo}): ${e}`,...t)}/**
417
- * @license
418
- * Copyright 2020 Google LLC
419
- *
420
- * Licensed under the Apache License, Version 2.0 (the "License");
421
- * you may not use this file except in compliance with the License.
422
- * You may obtain a copy of the License at
423
- *
424
- * http://www.apache.org/licenses/LICENSE-2.0
425
- *
426
- * Unless required by applicable law or agreed to in writing, software
427
- * distributed under the License is distributed on an "AS IS" BASIS,
428
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
429
- * See the License for the specific language governing permissions and
430
- * limitations under the License.
431
- */function Vn(e,...t){throw bl(e,...t)}function In(e,...t){return bl(e,...t)}function wl(e,t,n){const r={...eI(),[t]:n};return new ro("auth","Firebase",r).create(t,{appName:e.name})}function qr(e){return wl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function nI(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Vn(e,"argument-error"),wl(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 jf.create(e,...t)}function Ve(e,t,...n){if(!e)throw bl(t,...n)}function Xn(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ro(t),new Error(t)}function ir(e,t){e||Xn(t)}/**
432
- * @license
433
- * Copyright 2020 Google LLC
434
- *
435
- * Licensed under the Apache License, Version 2.0 (the "License");
436
- * you may not use this file except in compliance with the License.
437
- * You may obtain a copy of the License at
438
- *
439
- * http://www.apache.org/licenses/LICENSE-2.0
440
- *
441
- * Unless required by applicable law or agreed to in writing, software
442
- * distributed under the License is distributed on an "AS IS" BASIS,
443
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
444
- * See the License for the specific language governing permissions and
445
- * limitations under the License.
446
- */function Da(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function rI(){return pu()==="http:"||pu()==="https:"}function pu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
447
- * @license
448
- * Copyright 2020 Google LLC
449
- *
450
- * Licensed under the Apache License, Version 2.0 (the "License");
451
- * you may not use this file except in compliance with the License.
452
- * You may obtain a copy of the License at
453
- *
454
- * http://www.apache.org/licenses/LICENSE-2.0
455
- *
456
- * Unless required by applicable law or agreed to in writing, software
457
- * distributed under the License is distributed on an "AS IS" BASIS,
458
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
459
- * See the License for the specific language governing permissions and
460
- * limitations under the License.
461
- */function sI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(rI()||PT()||"connection"in navigator)?navigator.onLine:!0}function oI(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
462
- * @license
463
- * Copyright 2020 Google LLC
464
- *
465
- * Licensed under the Apache License, Version 2.0 (the "License");
466
- * you may not use this file except in compliance with the License.
467
- * You may obtain a copy of the License at
468
- *
469
- * http://www.apache.org/licenses/LICENSE-2.0
470
- *
471
- * Unless required by applicable law or agreed to in writing, software
472
- * distributed under the License is distributed on an "AS IS" BASIS,
473
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
474
- * See the License for the specific language governing permissions and
475
- * limitations under the License.
476
- */class io{constructor(t,n){this.shortDelay=t,this.longDelay=n,ir(n>t,"Short delay should be less than long delay!"),this.isMobile=AT()||xT()}get(){return sI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
477
- * @license
478
- * Copyright 2020 Google LLC
479
- *
480
- * Licensed under the Apache License, Version 2.0 (the "License");
481
- * you may not use this file except in compliance with the License.
482
- * You may obtain a copy of the License at
483
- *
484
- * http://www.apache.org/licenses/LICENSE-2.0
485
- *
486
- * Unless required by applicable law or agreed to in writing, software
487
- * distributed under the License is distributed on an "AS IS" BASIS,
488
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
489
- * See the License for the specific language governing permissions and
490
- * limitations under the License.
491
- */function _l(e,t){ir(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
492
- * @license
493
- * Copyright 2020 Google LLC
494
- *
495
- * Licensed under the Apache License, Version 2.0 (the "License");
496
- * you may not use this file except in compliance with the License.
497
- * You may obtain a copy of the License at
498
- *
499
- * http://www.apache.org/licenses/LICENSE-2.0
500
- *
501
- * Unless required by applicable law or agreed to in writing, software
502
- * distributed under the License is distributed on an "AS IS" BASIS,
503
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
504
- * See the License for the specific language governing permissions and
505
- * limitations under the License.
506
- */class Uf{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;Xn("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;Xn("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;Xn("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
507
- * @license
508
- * Copyright 2020 Google LLC
509
- *
510
- * Licensed under the Apache License, Version 2.0 (the "License");
511
- * you may not use this file except in compliance with the License.
512
- * You may obtain a copy of the License at
513
- *
514
- * http://www.apache.org/licenses/LICENSE-2.0
515
- *
516
- * Unless required by applicable law or agreed to in writing, software
517
- * distributed under the License is distributed on an "AS IS" BASIS,
518
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
519
- * See the License for the specific language governing permissions and
520
- * limitations under the License.
521
- */const iI={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"};/**
522
- * @license
523
- * Copyright 2020 Google LLC
524
- *
525
- * Licensed under the Apache License, Version 2.0 (the "License");
526
- * you may not use this file except in compliance with the License.
527
- * You may obtain a copy of the License at
528
- *
529
- * http://www.apache.org/licenses/LICENSE-2.0
530
- *
531
- * Unless required by applicable law or agreed to in writing, software
532
- * distributed under the License is distributed on an "AS IS" BASIS,
533
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
534
- * See the License for the specific language governing permissions and
535
- * limitations under the License.
536
- */const aI=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],lI=new io(3e4,6e4);function kl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function vs(e,t,n,r,s={}){return Bf(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=so({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 RT()||(d.referrerPolicy="no-referrer"),e.emulatorConfig&&vl(e.emulatorConfig.host)&&(d.credentials="include"),Uf.fetch()(await Ff(e,e.config.apiHost,n,a),d)})}async function Bf(e,t,n){e._canInitEmulator=!1;const r={...iI,...t};try{const s=new uI(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw yo(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 yo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw yo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw yo(e,"user-disabled",i);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw wl(e,u,d);Vn(e,u)}}catch(s){if(s instanceof Ir)throw s;Vn(e,"network-request-failed",{message:String(s)})}}async function cI(e,t,n,r,s={}){const o=await vs(e,t,n,r,s);return"mfaPendingCredential"in o&&Vn(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function Ff(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?_l(e.config,s):`${e.config.apiScheme}://${s}`;return aI.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class uI{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(In(this.auth,"network-request-failed")),lI.get())})}}function yo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=In(e,t,r);return s.customData._tokenResponse=n,s}/**
537
- * @license
538
- * Copyright 2020 Google LLC
539
- *
540
- * Licensed under the Apache License, Version 2.0 (the "License");
541
- * you may not use this file except in compliance with the License.
542
- * You may obtain a copy of the License at
543
- *
544
- * http://www.apache.org/licenses/LICENSE-2.0
545
- *
546
- * Unless required by applicable law or agreed to in writing, software
547
- * distributed under the License is distributed on an "AS IS" BASIS,
548
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
549
- * See the License for the specific language governing permissions and
550
- * limitations under the License.
551
- */async function dI(e,t){return vs(e,"POST","/v1/accounts:delete",t)}async function Wo(e,t){return vs(e,"POST","/v1/accounts:lookup",t)}/**
552
- * @license
553
- * Copyright 2020 Google LLC
554
- *
555
- * Licensed under the Apache License, Version 2.0 (the "License");
556
- * you may not use this file except in compliance with the License.
557
- * You may obtain a copy of the License at
558
- *
559
- * http://www.apache.org/licenses/LICENSE-2.0
560
- *
561
- * Unless required by applicable law or agreed to in writing, software
562
- * distributed under the License is distributed on an "AS IS" BASIS,
563
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
564
- * See the License for the specific language governing permissions and
565
- * limitations under the License.
566
- */function Us(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function fI(e,t=!1){const n=gs(e),r=await n.getIdToken(t),s=Tl(r);Ve(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:Us(na(s.auth_time)),issuedAtTime:Us(na(s.iat)),expirationTime:Us(na(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function na(e){return Number(e)*1e3}function Tl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Ro("JWT malformed, contained fewer than 3 sections"),null;try{const s=Ef(n);return s?JSON.parse(s):(Ro("Failed to decode base64 JWT payload"),null)}catch(s){return Ro("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function mu(e){const t=Tl(e);return Ve(t,"internal-error"),Ve(typeof t.exp<"u","internal-error"),Ve(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
567
- * @license
568
- * Copyright 2020 Google LLC
569
- *
570
- * Licensed under the Apache License, Version 2.0 (the "License");
571
- * you may not use this file except in compliance with the License.
572
- * You may obtain a copy of the License at
573
- *
574
- * http://www.apache.org/licenses/LICENSE-2.0
575
- *
576
- * Unless required by applicable law or agreed to in writing, software
577
- * distributed under the License is distributed on an "AS IS" BASIS,
578
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
579
- * See the License for the specific language governing permissions and
580
- * limitations under the License.
581
- */async function Zs(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Ir&&hI(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function hI({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
582
- * @license
583
- * Copyright 2020 Google LLC
584
- *
585
- * Licensed under the Apache License, Version 2.0 (the "License");
586
- * you may not use this file except in compliance with the License.
587
- * You may obtain a copy of the License at
588
- *
589
- * http://www.apache.org/licenses/LICENSE-2.0
590
- *
591
- * Unless required by applicable law or agreed to in writing, software
592
- * distributed under the License is distributed on an "AS IS" BASIS,
593
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
594
- * See the License for the specific language governing permissions and
595
- * limitations under the License.
596
- */class pI{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()}}/**
597
- * @license
598
- * Copyright 2020 Google LLC
599
- *
600
- * Licensed under the Apache License, Version 2.0 (the "License");
601
- * you may not use this file except in compliance with the License.
602
- * You may obtain a copy of the License at
603
- *
604
- * http://www.apache.org/licenses/LICENSE-2.0
605
- *
606
- * Unless required by applicable law or agreed to in writing, software
607
- * distributed under the License is distributed on an "AS IS" BASIS,
608
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
609
- * See the License for the specific language governing permissions and
610
- * limitations under the License.
611
- */class La{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Us(this.lastLoginAt),this.creationTime=Us(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
612
- * @license
613
- * Copyright 2019 Google LLC
614
- *
615
- * Licensed under the Apache License, Version 2.0 (the "License");
616
- * you may not use this file except in compliance with the License.
617
- * You may obtain a copy of the License at
618
- *
619
- * http://www.apache.org/licenses/LICENSE-2.0
620
- *
621
- * Unless required by applicable law or agreed to in writing, software
622
- * distributed under the License is distributed on an "AS IS" BASIS,
623
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
624
- * See the License for the specific language governing permissions and
625
- * limitations under the License.
626
- */async function qo(e){var h;const t=e.auth,n=await e.getIdToken(),r=await Zs(e,Wo(t,{idToken:n}));Ve(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(h=s.providerUserInfo)!=null&&h.length?Hf(s.providerUserInfo):[],i=gI(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),d=a?l:!1,u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new La(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,u)}async function mI(e){const t=gs(e);await qo(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function gI(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function Hf(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}))}/**
627
- * @license
628
- * Copyright 2020 Google LLC
629
- *
630
- * Licensed under the Apache License, Version 2.0 (the "License");
631
- * you may not use this file except in compliance with the License.
632
- * You may obtain a copy of the License at
633
- *
634
- * http://www.apache.org/licenses/LICENSE-2.0
635
- *
636
- * Unless required by applicable law or agreed to in writing, software
637
- * distributed under the License is distributed on an "AS IS" BASIS,
638
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
639
- * See the License for the specific language governing permissions and
640
- * limitations under the License.
641
- */async function vI(e,t){const n=await Bf(e,{},async()=>{const r=so({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await Ff(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&&vl(e.emulatorConfig.host)&&(l.credentials="include"),Uf.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function yI(e,t){return vs(e,"POST","/v2/accounts:revokeToken",kl(e,t))}/**
642
- * @license
643
- * Copyright 2020 Google LLC
644
- *
645
- * Licensed under the Apache License, Version 2.0 (the "License");
646
- * you may not use this file except in compliance with the License.
647
- * You may obtain a copy of the License at
648
- *
649
- * http://www.apache.org/licenses/LICENSE-2.0
650
- *
651
- * Unless required by applicable law or agreed to in writing, software
652
- * distributed under the License is distributed on an "AS IS" BASIS,
653
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
654
- * See the License for the specific language governing permissions and
655
- * limitations under the License.
656
- */class is{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Ve(t.idToken,"internal-error"),Ve(typeof t.idToken<"u","internal-error"),Ve(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):mu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Ve(t.length!==0,"internal-error");const n=mu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ve(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 vI(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 is;return r&&(Ve(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(Ve(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(Ve(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 is,this.toJSON())}_performRefresh(){return Xn("not implemented")}}/**
657
- * @license
658
- * Copyright 2020 Google LLC
659
- *
660
- * Licensed under the Apache License, Version 2.0 (the "License");
661
- * you may not use this file except in compliance with the License.
662
- * You may obtain a copy of the License at
663
- *
664
- * http://www.apache.org/licenses/LICENSE-2.0
665
- *
666
- * Unless required by applicable law or agreed to in writing, software
667
- * distributed under the License is distributed on an "AS IS" BASIS,
668
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
669
- * See the License for the specific language governing permissions and
670
- * limitations under the License.
671
- */function hr(e,t){Ve(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class kn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new pI(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 La(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await Zs(this,this.stsTokenManager.getToken(this.auth,t));return Ve(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return fI(this,t)}reload(){return mI(this)}_assign(t){this!==t&&(Ve(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 kn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){Ve(!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 qo(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(jn(this.auth.app))return Promise.reject(qr(this.auth));const t=await this.getIdToken();return await Zs(this,dI(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,u=n.lastLoginAt??void 0,{uid:h,emailVerified:g,isAnonymous:T,providerData:H,stsTokenManager:M}=n;Ve(h&&M,t,"internal-error");const D=is.fromJSON(this.name,M);Ve(typeof h=="string",t,"internal-error"),hr(r,t.name),hr(s,t.name),Ve(typeof g=="boolean",t,"internal-error"),Ve(typeof T=="boolean",t,"internal-error"),hr(o,t.name),hr(i,t.name),hr(a,t.name),hr(l,t.name),hr(d,t.name),hr(u,t.name);const N=new kn({uid:h,auth:t,email:s,emailVerified:g,displayName:r,isAnonymous:T,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:D,createdAt:d,lastLoginAt:u});return H&&Array.isArray(H)&&(N.providerData=H.map(P=>({...P}))),l&&(N._redirectEventId=l),N}static async _fromIdTokenResponse(t,n,r=!1){const s=new is;s.updateFromServerResponse(n);const o=new kn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await qo(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];Ve(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?Hf(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new is;a.updateFromIdToken(r);const l=new kn({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 La(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,d),l}}/**
672
- * @license
673
- * Copyright 2020 Google LLC
674
- *
675
- * Licensed under the Apache License, Version 2.0 (the "License");
676
- * you may not use this file except in compliance with the License.
677
- * You may obtain a copy of the License at
678
- *
679
- * http://www.apache.org/licenses/LICENSE-2.0
680
- *
681
- * Unless required by applicable law or agreed to in writing, software
682
- * distributed under the License is distributed on an "AS IS" BASIS,
683
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
684
- * See the License for the specific language governing permissions and
685
- * limitations under the License.
686
- */const gu=new Map;function Qn(e){ir(e instanceof Function,"Expected a class definition");let t=gu.get(e);return t?(ir(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,gu.set(e,t),t)}/**
687
- * @license
688
- * Copyright 2019 Google LLC
689
- *
690
- * Licensed under the Apache License, Version 2.0 (the "License");
691
- * you may not use this file except in compliance with the License.
692
- * You may obtain a copy of the License at
693
- *
694
- * http://www.apache.org/licenses/LICENSE-2.0
695
- *
696
- * Unless required by applicable law or agreed to in writing, software
697
- * distributed under the License is distributed on an "AS IS" BASIS,
698
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
699
- * See the License for the specific language governing permissions and
700
- * limitations under the License.
701
- */class Vf{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){}}Vf.type="NONE";const vu=Vf;/**
702
- * @license
703
- * Copyright 2019 Google LLC
704
- *
705
- * Licensed under the Apache License, Version 2.0 (the "License");
706
- * you may not use this file except in compliance with the License.
707
- * You may obtain a copy of the License at
708
- *
709
- * http://www.apache.org/licenses/LICENSE-2.0
710
- *
711
- * Unless required by applicable law or agreed to in writing, software
712
- * distributed under the License is distributed on an "AS IS" BASIS,
713
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
714
- * See the License for the specific language governing permissions and
715
- * limitations under the License.
716
- */function Po(e,t,n){return`firebase:${e}:${t}:${n}`}class as{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=Po(this.userKey,s.apiKey,o),this.fullPersistenceKey=Po("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 Wo(this.auth,{idToken:t}).catch(()=>{});return n?kn._fromGetAccountInfoResponse(this.auth,n,t):null}return kn._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 as(Qn(vu),t,r);const s=(await Promise.all(n.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let o=s[0]||Qn(vu);const i=Po(r,t.config.apiKey,t.name);let a=null;for(const d of n)try{const u=await d._get(i);if(u){let h;if(typeof u=="string"){const g=await Wo(t,{idToken:u}).catch(()=>{});if(!g)break;h=await kn._fromGetAccountInfoResponse(t,g,u)}else h=kn._fromJSON(t,u);d!==o&&(a=h),o=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new as(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 as(o,t,r))}}/**
717
- * @license
718
- * Copyright 2020 Google LLC
719
- *
720
- * Licensed under the Apache License, Version 2.0 (the "License");
721
- * you may not use this file except in compliance with the License.
722
- * You may obtain a copy of the License at
723
- *
724
- * http://www.apache.org/licenses/LICENSE-2.0
725
- *
726
- * Unless required by applicable law or agreed to in writing, software
727
- * distributed under the License is distributed on an "AS IS" BASIS,
728
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
729
- * See the License for the specific language governing permissions and
730
- * limitations under the License.
731
- */function yu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Gf(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Wf(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Jf(t))return"Blackberry";if(Yf(t))return"Webos";if(qf(t))return"Safari";if((t.includes("chrome/")||zf(t))&&!t.includes("edge/"))return"Chrome";if(Kf(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 Wf(e=tn()){return/firefox\//i.test(e)}function qf(e=tn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function zf(e=tn()){return/crios\//i.test(e)}function Gf(e=tn()){return/iemobile/i.test(e)}function Kf(e=tn()){return/android/i.test(e)}function Jf(e=tn()){return/blackberry/i.test(e)}function Yf(e=tn()){return/webos/i.test(e)}function Sl(e=tn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function wI(e=tn()){var t;return Sl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function bI(){return MT()&&document.documentMode===10}function Xf(e=tn()){return Sl(e)||Kf(e)||Yf(e)||Jf(e)||/windows phone/i.test(e)||Gf(e)}/**
732
- * @license
733
- * Copyright 2020 Google LLC
734
- *
735
- * Licensed under the Apache License, Version 2.0 (the "License");
736
- * you may not use this file except in compliance with the License.
737
- * You may obtain a copy of the License at
738
- *
739
- * http://www.apache.org/licenses/LICENSE-2.0
740
- *
741
- * Unless required by applicable law or agreed to in writing, software
742
- * distributed under the License is distributed on an "AS IS" BASIS,
743
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
744
- * See the License for the specific language governing permissions and
745
- * limitations under the License.
746
- */function Qf(e,t=[]){let n;switch(e){case"Browser":n=yu(tn());break;case"Worker":n=`${yu(tn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${oo}/${r}`}/**
747
- * @license
748
- * Copyright 2022 Google LLC
749
- *
750
- * Licensed under the Apache License, Version 2.0 (the "License");
751
- * you may not use this file except in compliance with the License.
752
- * You may obtain a copy of the License at
753
- *
754
- * http://www.apache.org/licenses/LICENSE-2.0
755
- *
756
- * Unless required by applicable law or agreed to in writing, software
757
- * distributed under the License is distributed on an "AS IS" BASIS,
758
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
759
- * See the License for the specific language governing permissions and
760
- * limitations under the License.
761
- */class _I{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})}}}/**
762
- * @license
763
- * Copyright 2023 Google LLC
764
- *
765
- * Licensed under the Apache License, Version 2.0 (the "License");
766
- * you may not use this file except in compliance with the License.
767
- * You may obtain a copy of the License at
768
- *
769
- * http://www.apache.org/licenses/LICENSE-2.0
770
- *
771
- * Unless required by applicable law or agreed to in writing, software
772
- * distributed under the License is distributed on an "AS IS" BASIS,
773
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
774
- * See the License for the specific language governing permissions and
775
- * limitations under the License.
776
- */async function kI(e,t={}){return vs(e,"GET","/v2/passwordPolicy",kl(e,t))}/**
777
- * @license
778
- * Copyright 2023 Google LLC
779
- *
780
- * Licensed under the Apache License, Version 2.0 (the "License");
781
- * you may not use this file except in compliance with the License.
782
- * You may obtain a copy of the License at
783
- *
784
- * http://www.apache.org/licenses/LICENSE-2.0
785
- *
786
- * Unless required by applicable law or agreed to in writing, software
787
- * distributed under the License is distributed on an "AS IS" BASIS,
788
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
789
- * See the License for the specific language governing permissions and
790
- * limitations under the License.
791
- */const TI=6;class SI{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??TI,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))}}/**
792
- * @license
793
- * Copyright 2020 Google LLC
794
- *
795
- * Licensed under the Apache License, Version 2.0 (the "License");
796
- * you may not use this file except in compliance with the License.
797
- * You may obtain a copy of the License at
798
- *
799
- * http://www.apache.org/licenses/LICENSE-2.0
800
- *
801
- * Unless required by applicable law or agreed to in writing, software
802
- * distributed under the License is distributed on an "AS IS" BASIS,
803
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
804
- * See the License for the specific language governing permissions and
805
- * limitations under the License.
806
- */class II{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 wu(this),this.idTokenSubscription=new wu(this),this.beforeStateQueue=new _I(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=jf,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=Qn(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await as.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 Wo(this,{idToken:t}),r=await kn._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(jn(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 Ve(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 qo(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=oI()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(jn(this.app))return Promise.reject(qr(this));const n=t?gs(t):null;return n&&Ve(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&&Ve(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 jn(this.app)?Promise.reject(qr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return jn(this.app)?Promise.reject(qr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Qn(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 kI(this),n=new SI(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 ro("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 yI(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&&Qn(t)||this._popupRedirectResolver;Ve(n,this,"argument-error"),this.redirectPersistenceManager=await as.create(this,[Qn(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(Ve(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 Ve(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Qf(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(jn(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&&tI(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function fi(e){return gs(e)}class wu{constructor(t){this.auth=t,this.observer=null,this.addObserver=UT(n=>this.observer=n)}get next(){return Ve(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
807
- * @license
808
- * Copyright 2020 Google LLC
809
- *
810
- * Licensed under the Apache License, Version 2.0 (the "License");
811
- * you may not use this file except in compliance with the License.
812
- * You may obtain a copy of the License at
813
- *
814
- * http://www.apache.org/licenses/LICENSE-2.0
815
- *
816
- * Unless required by applicable law or agreed to in writing, software
817
- * distributed under the License is distributed on an "AS IS" BASIS,
818
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
819
- * See the License for the specific language governing permissions and
820
- * limitations under the License.
821
- */let Il={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function EI(e){Il=e}function CI(e){return Il.loadJS(e)}function AI(){return Il.gapiScript}function RI(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
822
- * @license
823
- * Copyright 2020 Google LLC
824
- *
825
- * Licensed under the Apache License, Version 2.0 (the "License");
826
- * you may not use this file except in compliance with the License.
827
- * You may obtain a copy of the License at
828
- *
829
- * http://www.apache.org/licenses/LICENSE-2.0
830
- *
831
- * Unless required by applicable law or agreed to in writing, software
832
- * distributed under the License is distributed on an "AS IS" BASIS,
833
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
834
- * See the License for the specific language governing permissions and
835
- * limitations under the License.
836
- */function PI(e,t){const n=Mf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(fs(o,t??{}))return s;Vn(s,"already-initialized")}return n.initialize({options:t})}function xI(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Qn);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function MI(e,t,n){const r=fi(e);Ve(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Zf(t),{host:i,port:a}=OI(t),l=a===null?"":`:${a}`,d={url:`${o}//${i}${l}/`},u=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Ve(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Ve(fs(d,r.config.emulator)&&fs(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,vl(i)?HT(`${o}//${i}${l}`):NI()}function Zf(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function OI(e){const t=Zf(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:bu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:bu(i)}}}function bu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function NI(){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())}/**
837
- * @license
838
- * Copyright 2020 Google LLC
839
- *
840
- * Licensed under the Apache License, Version 2.0 (the "License");
841
- * you may not use this file except in compliance with the License.
842
- * You may obtain a copy of the License at
843
- *
844
- * http://www.apache.org/licenses/LICENSE-2.0
845
- *
846
- * Unless required by applicable law or agreed to in writing, software
847
- * distributed under the License is distributed on an "AS IS" BASIS,
848
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
849
- * See the License for the specific language governing permissions and
850
- * limitations under the License.
851
- */class eh{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Xn("not implemented")}_getIdTokenResponse(t){return Xn("not implemented")}_linkToIdToken(t,n){return Xn("not implemented")}_getReauthenticationResolver(t){return Xn("not implemented")}}/**
852
- * @license
853
- * Copyright 2020 Google LLC
854
- *
855
- * Licensed under the Apache License, Version 2.0 (the "License");
856
- * you may not use this file except in compliance with the License.
857
- * You may obtain a copy of the License at
858
- *
859
- * http://www.apache.org/licenses/LICENSE-2.0
860
- *
861
- * Unless required by applicable law or agreed to in writing, software
862
- * distributed under the License is distributed on an "AS IS" BASIS,
863
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
864
- * See the License for the specific language governing permissions and
865
- * limitations under the License.
866
- */async function ls(e,t){return cI(e,"POST","/v1/accounts:signInWithIdp",kl(e,t))}/**
867
- * @license
868
- * Copyright 2020 Google LLC
869
- *
870
- * Licensed under the Apache License, Version 2.0 (the "License");
871
- * you may not use this file except in compliance with the License.
872
- * You may obtain a copy of the License at
873
- *
874
- * http://www.apache.org/licenses/LICENSE-2.0
875
- *
876
- * Unless required by applicable law or agreed to in writing, software
877
- * distributed under the License is distributed on an "AS IS" BASIS,
878
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
879
- * See the License for the specific language governing permissions and
880
- * limitations under the License.
881
- */const $I="http://localhost";class Gr extends eh{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Gr(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):Vn("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 Gr(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 ls(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,ls(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,ls(t,n)}buildRequest(){const t={requestUri:$I,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=so(n)}return t}}/**
882
- * @license
883
- * Copyright 2020 Google LLC
884
- *
885
- * Licensed under the Apache License, Version 2.0 (the "License");
886
- * you may not use this file except in compliance with the License.
887
- * You may obtain a copy of the License at
888
- *
889
- * http://www.apache.org/licenses/LICENSE-2.0
890
- *
891
- * Unless required by applicable law or agreed to in writing, software
892
- * distributed under the License is distributed on an "AS IS" BASIS,
893
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
894
- * See the License for the specific language governing permissions and
895
- * limitations under the License.
896
- */class El{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}}/**
897
- * @license
898
- * Copyright 2019 Google LLC
899
- *
900
- * Licensed under the Apache License, Version 2.0 (the "License");
901
- * you may not use this file except in compliance with the License.
902
- * You may obtain a copy of the License at
903
- *
904
- * http://www.apache.org/licenses/LICENSE-2.0
905
- *
906
- * Unless required by applicable law or agreed to in writing, software
907
- * distributed under the License is distributed on an "AS IS" BASIS,
908
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
909
- * See the License for the specific language governing permissions and
910
- * limitations under the License.
911
- */class ao extends El{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
912
- * @license
913
- * Copyright 2020 Google LLC
914
- *
915
- * Licensed under the Apache License, Version 2.0 (the "License");
916
- * you may not use this file except in compliance with the License.
917
- * You may obtain a copy of the License at
918
- *
919
- * http://www.apache.org/licenses/LICENSE-2.0
920
- *
921
- * Unless required by applicable law or agreed to in writing, software
922
- * distributed under the License is distributed on an "AS IS" BASIS,
923
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
924
- * See the License for the specific language governing permissions and
925
- * limitations under the License.
926
- */class yr extends ao{constructor(){super("facebook.com")}static credential(t){return Gr._fromParams({providerId:yr.PROVIDER_ID,signInMethod:yr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return yr.credentialFromTaggedObject(t)}static credentialFromError(t){return yr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return yr.credential(t.oauthAccessToken)}catch{return null}}}yr.FACEBOOK_SIGN_IN_METHOD="facebook.com";yr.PROVIDER_ID="facebook.com";/**
927
- * @license
928
- * Copyright 2020 Google LLC
929
- *
930
- * Licensed under the Apache License, Version 2.0 (the "License");
931
- * you may not use this file except in compliance with the License.
932
- * You may obtain a copy of the License at
933
- *
934
- * http://www.apache.org/licenses/LICENSE-2.0
935
- *
936
- * Unless required by applicable law or agreed to in writing, software
937
- * distributed under the License is distributed on an "AS IS" BASIS,
938
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
939
- * See the License for the specific language governing permissions and
940
- * limitations under the License.
941
- */class wr extends ao{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Gr._fromParams({providerId:wr.PROVIDER_ID,signInMethod:wr.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return wr.credentialFromTaggedObject(t)}static credentialFromError(t){return wr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return wr.credential(n,r)}catch{return null}}}wr.GOOGLE_SIGN_IN_METHOD="google.com";wr.PROVIDER_ID="google.com";/**
942
- * @license
943
- * Copyright 2020 Google LLC
944
- *
945
- * Licensed under the Apache License, Version 2.0 (the "License");
946
- * you may not use this file except in compliance with the License.
947
- * You may obtain a copy of the License at
948
- *
949
- * http://www.apache.org/licenses/LICENSE-2.0
950
- *
951
- * Unless required by applicable law or agreed to in writing, software
952
- * distributed under the License is distributed on an "AS IS" BASIS,
953
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
954
- * See the License for the specific language governing permissions and
955
- * limitations under the License.
956
- */class Un extends ao{constructor(){super("github.com")}static credential(t){return Gr._fromParams({providerId:Un.PROVIDER_ID,signInMethod:Un.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Un.credentialFromTaggedObject(t)}static credentialFromError(t){return Un.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Un.credential(t.oauthAccessToken)}catch{return null}}}Un.GITHUB_SIGN_IN_METHOD="github.com";Un.PROVIDER_ID="github.com";/**
957
- * @license
958
- * Copyright 2020 Google LLC
959
- *
960
- * Licensed under the Apache License, Version 2.0 (the "License");
961
- * you may not use this file except in compliance with the License.
962
- * You may obtain a copy of the License at
963
- *
964
- * http://www.apache.org/licenses/LICENSE-2.0
965
- *
966
- * Unless required by applicable law or agreed to in writing, software
967
- * distributed under the License is distributed on an "AS IS" BASIS,
968
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
969
- * See the License for the specific language governing permissions and
970
- * limitations under the License.
971
- */class br extends ao{constructor(){super("twitter.com")}static credential(t,n){return Gr._fromParams({providerId:br.PROVIDER_ID,signInMethod:br.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return br.credentialFromTaggedObject(t)}static credentialFromError(t){return br.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return br.credential(n,r)}catch{return null}}}br.TWITTER_SIGN_IN_METHOD="twitter.com";br.PROVIDER_ID="twitter.com";/**
972
- * @license
973
- * Copyright 2020 Google LLC
974
- *
975
- * Licensed under the Apache License, Version 2.0 (the "License");
976
- * you may not use this file except in compliance with the License.
977
- * You may obtain a copy of the License at
978
- *
979
- * http://www.apache.org/licenses/LICENSE-2.0
980
- *
981
- * Unless required by applicable law or agreed to in writing, software
982
- * distributed under the License is distributed on an "AS IS" BASIS,
983
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
984
- * See the License for the specific language governing permissions and
985
- * limitations under the License.
986
- */class ps{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 kn._fromIdTokenResponse(t,r,s),i=_u(r);return new ps({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=_u(r);return new ps({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function _u(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
987
- * @license
988
- * Copyright 2020 Google LLC
989
- *
990
- * Licensed under the Apache License, Version 2.0 (the "License");
991
- * you may not use this file except in compliance with the License.
992
- * You may obtain a copy of the License at
993
- *
994
- * http://www.apache.org/licenses/LICENSE-2.0
995
- *
996
- * Unless required by applicable law or agreed to in writing, software
997
- * distributed under the License is distributed on an "AS IS" BASIS,
998
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
999
- * See the License for the specific language governing permissions and
1000
- * limitations under the License.
1001
- */class zo extends Ir{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,zo.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 zo(t,n,r,s)}}function th(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?zo._fromErrorAndOperation(e,o,t,r):o})}async function DI(e,t,n=!1){const r=await Zs(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ps._forOperation(e,"link",r)}/**
1002
- * @license
1003
- * Copyright 2019 Google LLC
1004
- *
1005
- * Licensed under the Apache License, Version 2.0 (the "License");
1006
- * you may not use this file except in compliance with the License.
1007
- * You may obtain a copy of the License at
1008
- *
1009
- * http://www.apache.org/licenses/LICENSE-2.0
1010
- *
1011
- * Unless required by applicable law or agreed to in writing, software
1012
- * distributed under the License is distributed on an "AS IS" BASIS,
1013
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1014
- * See the License for the specific language governing permissions and
1015
- * limitations under the License.
1016
- */async function LI(e,t,n=!1){const{auth:r}=e;if(jn(r.app))return Promise.reject(qr(r));const s="reauthenticate";try{const o=await Zs(e,th(r,s,t,e),n);Ve(o.idToken,r,"internal-error");const i=Tl(o.idToken);Ve(i,r,"internal-error");const{sub:a}=i;return Ve(e.uid===a,r,"user-mismatch"),ps._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Vn(r,"user-mismatch"),o}}/**
1017
- * @license
1018
- * Copyright 2020 Google LLC
1019
- *
1020
- * Licensed under the Apache License, Version 2.0 (the "License");
1021
- * you may not use this file except in compliance with the License.
1022
- * You may obtain a copy of the License at
1023
- *
1024
- * http://www.apache.org/licenses/LICENSE-2.0
1025
- *
1026
- * Unless required by applicable law or agreed to in writing, software
1027
- * distributed under the License is distributed on an "AS IS" BASIS,
1028
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1029
- * See the License for the specific language governing permissions and
1030
- * limitations under the License.
1031
- */async function jI(e,t,n=!1){if(jn(e.app))return Promise.reject(qr(e));const r="signIn",s=await th(e,r,t),o=await ps._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function UI(e,t,n,r){return gs(e).onIdTokenChanged(t,n,r)}function BI(e,t,n){return gs(e).beforeAuthStateChanged(t,n)}const Go="__sak";/**
1032
- * @license
1033
- * Copyright 2019 Google LLC
1034
- *
1035
- * Licensed under the Apache License, Version 2.0 (the "License");
1036
- * you may not use this file except in compliance with the License.
1037
- * You may obtain a copy of the License at
1038
- *
1039
- * http://www.apache.org/licenses/LICENSE-2.0
1040
- *
1041
- * Unless required by applicable law or agreed to in writing, software
1042
- * distributed under the License is distributed on an "AS IS" BASIS,
1043
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1044
- * See the License for the specific language governing permissions and
1045
- * limitations under the License.
1046
- */class nh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Go,"1"),this.storage.removeItem(Go),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()}}/**
1047
- * @license
1048
- * Copyright 2020 Google LLC
1049
- *
1050
- * Licensed under the Apache License, Version 2.0 (the "License");
1051
- * you may not use this file except in compliance with the License.
1052
- * You may obtain a copy of the License at
1053
- *
1054
- * http://www.apache.org/licenses/LICENSE-2.0
1055
- *
1056
- * Unless required by applicable law or agreed to in writing, software
1057
- * distributed under the License is distributed on an "AS IS" BASIS,
1058
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1059
- * See the License for the specific language governing permissions and
1060
- * limitations under the License.
1061
- */const FI=1e3,HI=10;class rh extends nh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Xf(),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);bI()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,HI):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)})},FI)}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]}}rh.type="LOCAL";const VI=rh;/**
1062
- * @license
1063
- * Copyright 2020 Google LLC
1064
- *
1065
- * Licensed under the Apache License, Version 2.0 (the "License");
1066
- * you may not use this file except in compliance with the License.
1067
- * You may obtain a copy of the License at
1068
- *
1069
- * http://www.apache.org/licenses/LICENSE-2.0
1070
- *
1071
- * Unless required by applicable law or agreed to in writing, software
1072
- * distributed under the License is distributed on an "AS IS" BASIS,
1073
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1074
- * See the License for the specific language governing permissions and
1075
- * limitations under the License.
1076
- */class sh extends nh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}sh.type="SESSION";const oh=sh;/**
1077
- * @license
1078
- * Copyright 2019 Google LLC
1079
- *
1080
- * Licensed under the Apache License, Version 2.0 (the "License");
1081
- * you may not use this file except in compliance with the License.
1082
- * You may obtain a copy of the License at
1083
- *
1084
- * http://www.apache.org/licenses/LICENSE-2.0
1085
- *
1086
- * Unless required by applicable law or agreed to in writing, software
1087
- * distributed under the License is distributed on an "AS IS" BASIS,
1088
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1089
- * See the License for the specific language governing permissions and
1090
- * limitations under the License.
1091
- */function WI(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1092
- * @license
1093
- * Copyright 2019 Google LLC
1094
- *
1095
- * Licensed under the Apache License, Version 2.0 (the "License");
1096
- * you may not use this file except in compliance with the License.
1097
- * You may obtain a copy of the License at
1098
- *
1099
- * http://www.apache.org/licenses/LICENSE-2.0
1100
- *
1101
- * Unless required by applicable law or agreed to in writing, software
1102
- * distributed under the License is distributed on an "AS IS" BASIS,
1103
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1104
- * See the License for the specific language governing permissions and
1105
- * limitations under the License.
1106
- */class hi{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 hi(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 WI(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)}}hi.receivers=[];/**
1107
- * @license
1108
- * Copyright 2020 Google LLC
1109
- *
1110
- * Licensed under the Apache License, Version 2.0 (the "License");
1111
- * you may not use this file except in compliance with the License.
1112
- * You may obtain a copy of the License at
1113
- *
1114
- * http://www.apache.org/licenses/LICENSE-2.0
1115
- *
1116
- * Unless required by applicable law or agreed to in writing, software
1117
- * distributed under the License is distributed on an "AS IS" BASIS,
1118
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1119
- * See the License for the specific language governing permissions and
1120
- * limitations under the License.
1121
- */function Cl(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1122
- * @license
1123
- * Copyright 2019 Google LLC
1124
- *
1125
- * Licensed under the Apache License, Version 2.0 (the "License");
1126
- * you may not use this file except in compliance with the License.
1127
- * You may obtain a copy of the License at
1128
- *
1129
- * http://www.apache.org/licenses/LICENSE-2.0
1130
- *
1131
- * Unless required by applicable law or agreed to in writing, software
1132
- * distributed under the License is distributed on an "AS IS" BASIS,
1133
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1134
- * See the License for the specific language governing permissions and
1135
- * limitations under the License.
1136
- */class qI{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=Cl("",20);s.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(h){const g=h;if(g.data.eventId===d)switch(g.data.status){case"ack":clearTimeout(u),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(g.data.response);break;default:clearTimeout(u),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:d,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1137
- * @license
1138
- * Copyright 2020 Google LLC
1139
- *
1140
- * Licensed under the Apache License, Version 2.0 (the "License");
1141
- * you may not use this file except in compliance with the License.
1142
- * You may obtain a copy of the License at
1143
- *
1144
- * http://www.apache.org/licenses/LICENSE-2.0
1145
- *
1146
- * Unless required by applicable law or agreed to in writing, software
1147
- * distributed under the License is distributed on an "AS IS" BASIS,
1148
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1149
- * See the License for the specific language governing permissions and
1150
- * limitations under the License.
1151
- */function Hn(){return window}function zI(e){Hn().location.href=e}/**
1152
- * @license
1153
- * Copyright 2020 Google LLC.
1154
- *
1155
- * Licensed under the Apache License, Version 2.0 (the "License");
1156
- * you may not use this file except in compliance with the License.
1157
- * You may obtain a copy of the License at
1158
- *
1159
- * http://www.apache.org/licenses/LICENSE-2.0
1160
- *
1161
- * Unless required by applicable law or agreed to in writing, software
1162
- * distributed under the License is distributed on an "AS IS" BASIS,
1163
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1164
- * See the License for the specific language governing permissions and
1165
- * limitations under the License.
1166
- */function ih(){return typeof Hn().WorkerGlobalScope<"u"&&typeof Hn().importScripts=="function"}async function GI(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function KI(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function JI(){return ih()?self:null}/**
1167
- * @license
1168
- * Copyright 2019 Google LLC
1169
- *
1170
- * Licensed under the Apache License, Version 2.0 (the "License");
1171
- * you may not use this file except in compliance with the License.
1172
- * You may obtain a copy of the License at
1173
- *
1174
- * http://www.apache.org/licenses/LICENSE-2.0
1175
- *
1176
- * Unless required by applicable law or agreed to in writing, software
1177
- * distributed under the License is distributed on an "AS IS" BASIS,
1178
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1179
- * See the License for the specific language governing permissions and
1180
- * limitations under the License.
1181
- */const ah="firebaseLocalStorageDb",YI=1,Ko="firebaseLocalStorage",lh="fbase_key";class lo{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([Ko],t?"readwrite":"readonly").objectStore(Ko)}function XI(){const e=indexedDB.deleteDatabase(ah);return new lo(e).toPromise()}function ja(){const e=indexedDB.open(ah,YI);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(Ko,{keyPath:lh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(Ko)?t(r):(r.close(),await XI(),t(await ja()))})})}async function ku(e,t,n){const r=pi(e,!0).put({[lh]:t,value:n});return new lo(r).toPromise()}async function QI(e,t){const n=pi(e,!1).get(t),r=await new lo(n).toPromise();return r===void 0?null:r.value}function Tu(e,t){const n=pi(e,!0).delete(t);return new lo(n).toPromise()}const ZI=800,eE=3;class ch{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 ja(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>eE)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return ih()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=hi._getInstance(JI()),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 GI(),!this.activeServiceWorker)return;this.sender=new qI(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||KI()!==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 ja();return await ku(t,Go,"1"),await Tu(t,Go),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>ku(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>QI(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Tu(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 lo(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(),ZI)}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()}}ch.type="LOCAL";const tE=ch;new io(3e4,6e4);/**
1182
- * @license
1183
- * Copyright 2021 Google LLC
1184
- *
1185
- * Licensed under the Apache License, Version 2.0 (the "License");
1186
- * you may not use this file except in compliance with the License.
1187
- * You may obtain a copy of the License at
1188
- *
1189
- * http://www.apache.org/licenses/LICENSE-2.0
1190
- *
1191
- * Unless required by applicable law or agreed to in writing, software
1192
- * distributed under the License is distributed on an "AS IS" BASIS,
1193
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1194
- * See the License for the specific language governing permissions and
1195
- * limitations under the License.
1196
- */function uh(e,t){return t?Qn(t):(Ve(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1197
- * @license
1198
- * Copyright 2019 Google LLC
1199
- *
1200
- * Licensed under the Apache License, Version 2.0 (the "License");
1201
- * you may not use this file except in compliance with the License.
1202
- * You may obtain a copy of the License at
1203
- *
1204
- * http://www.apache.org/licenses/LICENSE-2.0
1205
- *
1206
- * Unless required by applicable law or agreed to in writing, software
1207
- * distributed under the License is distributed on an "AS IS" BASIS,
1208
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1209
- * See the License for the specific language governing permissions and
1210
- * limitations under the License.
1211
- */class Al extends eh{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return ls(t,this._buildIdpRequest())}_linkToIdToken(t,n){return ls(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return ls(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 nE(e){return jI(e.auth,new Al(e),e.bypassAuthState)}function rE(e){const{auth:t,user:n}=e;return Ve(n,t,"internal-error"),LI(n,new Al(e),e.bypassAuthState)}async function sE(e){const{auth:t,user:n}=e;return Ve(n,t,"internal-error"),DI(n,new Al(e),e.bypassAuthState)}/**
1212
- * @license
1213
- * Copyright 2020 Google LLC
1214
- *
1215
- * Licensed under the Apache License, Version 2.0 (the "License");
1216
- * you may not use this file except in compliance with the License.
1217
- * You may obtain a copy of the License at
1218
- *
1219
- * http://www.apache.org/licenses/LICENSE-2.0
1220
- *
1221
- * Unless required by applicable law or agreed to in writing, software
1222
- * distributed under the License is distributed on an "AS IS" BASIS,
1223
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1224
- * See the License for the specific language governing permissions and
1225
- * limitations under the License.
1226
- */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 nE;case"linkViaPopup":case"linkViaRedirect":return sE;case"reauthViaPopup":case"reauthViaRedirect":return rE;default:Vn(this.auth,"internal-error")}}resolve(t){ir(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){ir(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()}}/**
1227
- * @license
1228
- * Copyright 2020 Google LLC
1229
- *
1230
- * Licensed under the Apache License, Version 2.0 (the "License");
1231
- * you may not use this file except in compliance with the License.
1232
- * You may obtain a copy of the License at
1233
- *
1234
- * http://www.apache.org/licenses/LICENSE-2.0
1235
- *
1236
- * Unless required by applicable law or agreed to in writing, software
1237
- * distributed under the License is distributed on an "AS IS" BASIS,
1238
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1239
- * See the License for the specific language governing permissions and
1240
- * limitations under the License.
1241
- */const oE=new io(2e3,1e4);async function iE(e,t,n){if(jn(e.app))return Promise.reject(In(e,"operation-not-supported-in-this-environment"));const r=fi(e);nI(e,t,El);const s=uh(r,n);return new Hr(r,"signInViaPopup",t,s).executeNotNull()}class Hr extends dh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Hr.currentPopupAction&&Hr.currentPopupAction.cancel(),Hr.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Ve(t,this.auth,"internal-error"),t}async onExecution(){ir(this.filter.length===1,"Popup operations only handle one event");const t=Cl();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(In(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(In(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Hr.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(In(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,oE.get())};t()}}Hr.currentPopupAction=null;/**
1242
- * @license
1243
- * Copyright 2020 Google LLC
1244
- *
1245
- * Licensed under the Apache License, Version 2.0 (the "License");
1246
- * you may not use this file except in compliance with the License.
1247
- * You may obtain a copy of the License at
1248
- *
1249
- * http://www.apache.org/licenses/LICENSE-2.0
1250
- *
1251
- * Unless required by applicable law or agreed to in writing, software
1252
- * distributed under the License is distributed on an "AS IS" BASIS,
1253
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254
- * See the License for the specific language governing permissions and
1255
- * limitations under the License.
1256
- */const aE="pendingRedirect",xo=new Map;class lE extends dh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=xo.get(this.auth._key());if(!t){try{const r=await cE(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}xo.set(this.auth._key(),t)}return this.bypassAuthState||xo.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 cE(e,t){const n=fE(t),r=dE(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function uE(e,t){xo.set(e._key(),t)}function dE(e){return Qn(e._redirectPersistence)}function fE(e){return Po(aE,e.config.apiKey,e.name)}async function hE(e,t,n=!1){if(jn(e.app))return Promise.reject(qr(e));const r=fi(e),s=uh(r,t),i=await new lE(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
1257
- * @license
1258
- * Copyright 2020 Google LLC
1259
- *
1260
- * Licensed under the Apache License, Version 2.0 (the "License");
1261
- * you may not use this file except in compliance with the License.
1262
- * You may obtain a copy of the License at
1263
- *
1264
- * http://www.apache.org/licenses/LICENSE-2.0
1265
- *
1266
- * Unless required by applicable law or agreed to in writing, software
1267
- * distributed under the License is distributed on an "AS IS" BASIS,
1268
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1269
- * See the License for the specific language governing permissions and
1270
- * limitations under the License.
1271
- */const pE=600*1e3;class mE{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||!gE(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!fh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(In(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>=pE&&this.cachedEventUids.clear(),this.cachedEventUids.has(Su(t))}saveEventToCache(t){this.cachedEventUids.add(Su(t)),this.lastProcessedEventTime=Date.now()}}function Su(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function fh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function gE(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return fh(e);default:return!1}}/**
1272
- * @license
1273
- * Copyright 2020 Google LLC
1274
- *
1275
- * Licensed under the Apache License, Version 2.0 (the "License");
1276
- * you may not use this file except in compliance with the License.
1277
- * You may obtain a copy of the License at
1278
- *
1279
- * http://www.apache.org/licenses/LICENSE-2.0
1280
- *
1281
- * Unless required by applicable law or agreed to in writing, software
1282
- * distributed under the License is distributed on an "AS IS" BASIS,
1283
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1284
- * See the License for the specific language governing permissions and
1285
- * limitations under the License.
1286
- */async function vE(e,t={}){return vs(e,"GET","/v1/projects",t)}/**
1287
- * @license
1288
- * Copyright 2020 Google LLC
1289
- *
1290
- * Licensed under the Apache License, Version 2.0 (the "License");
1291
- * you may not use this file except in compliance with the License.
1292
- * You may obtain a copy of the License at
1293
- *
1294
- * http://www.apache.org/licenses/LICENSE-2.0
1295
- *
1296
- * Unless required by applicable law or agreed to in writing, software
1297
- * distributed under the License is distributed on an "AS IS" BASIS,
1298
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1299
- * See the License for the specific language governing permissions and
1300
- * limitations under the License.
1301
- */const yE=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wE=/^https?/;async function bE(e){if(e.config.emulator)return;const{authorizedDomains:t}=await vE(e);for(const n of t)try{if(_E(n))return}catch{}Vn(e,"unauthorized-domain")}function _E(e){const t=Da(),{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(!wE.test(n))return!1;if(yE.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1302
- * @license
1303
- * Copyright 2020 Google LLC.
1304
- *
1305
- * Licensed under the Apache License, Version 2.0 (the "License");
1306
- * you may not use this file except in compliance with the License.
1307
- * You may obtain a copy of the License at
1308
- *
1309
- * http://www.apache.org/licenses/LICENSE-2.0
1310
- *
1311
- * Unless required by applicable law or agreed to in writing, software
1312
- * distributed under the License is distributed on an "AS IS" BASIS,
1313
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314
- * See the License for the specific language governing permissions and
1315
- * limitations under the License.
1316
- */const kE=new io(3e4,6e4);function Iu(){const e=Hn().___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 TE(e){return new Promise((t,n)=>{var s,o,i;function r(){Iu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Iu(),n(In(e,"network-request-failed"))},timeout:kE.get()})}if((o=(s=Hn().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Hn().gapi)!=null&&i.load)r();else{const a=RI("iframefcb");return Hn()[a]=()=>{gapi.load?r():n(In(e,"network-request-failed"))},CI(`${AI()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw Mo=null,t})}let Mo=null;function SE(e){return Mo=Mo||TE(e),Mo}/**
1317
- * @license
1318
- * Copyright 2020 Google LLC.
1319
- *
1320
- * Licensed under the Apache License, Version 2.0 (the "License");
1321
- * you may not use this file except in compliance with the License.
1322
- * You may obtain a copy of the License at
1323
- *
1324
- * http://www.apache.org/licenses/LICENSE-2.0
1325
- *
1326
- * Unless required by applicable law or agreed to in writing, software
1327
- * distributed under the License is distributed on an "AS IS" BASIS,
1328
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1329
- * See the License for the specific language governing permissions and
1330
- * limitations under the License.
1331
- */const IE=new io(5e3,15e3),EE="__/auth/iframe",CE="emulator/auth/iframe",AE={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},RE=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function PE(e){const t=e.config;Ve(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?_l(t,CE):`https://${e.config.authDomain}/${EE}`,r={apiKey:t.apiKey,appName:e.name,v:oo},s=RE.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${so(r).slice(1)}`}async function xE(e){const t=await SE(e),n=Hn().gapi;return Ve(n,e,"internal-error"),t.open({where:document.body,url:PE(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:AE,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=In(e,"network-request-failed"),a=Hn().setTimeout(()=>{o(i)},IE.get());function l(){Hn().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1332
- * @license
1333
- * Copyright 2020 Google LLC.
1334
- *
1335
- * Licensed under the Apache License, Version 2.0 (the "License");
1336
- * you may not use this file except in compliance with the License.
1337
- * You may obtain a copy of the License at
1338
- *
1339
- * http://www.apache.org/licenses/LICENSE-2.0
1340
- *
1341
- * Unless required by applicable law or agreed to in writing, software
1342
- * distributed under the License is distributed on an "AS IS" BASIS,
1343
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1344
- * See the License for the specific language governing permissions and
1345
- * limitations under the License.
1346
- */const ME={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},OE=500,NE=600,$E="_blank",DE="http://localhost";class Eu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function LE(e,t,n,r=OE,s=NE){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={...ME,width:r.toString(),height:s.toString(),top:o,left:i},d=tn().toLowerCase();n&&(a=zf(d)?$E:n),Wf(d)&&(t=t||DE,l.scrollbars="yes");const u=Object.entries(l).reduce((g,[T,H])=>`${g}${T}=${H},`,"");if(wI(d)&&a!=="_self")return jE(t||"",a),new Eu(null);const h=window.open(t||"",a,u);Ve(h,e,"popup-blocked");try{h.focus()}catch{}return new Eu(h)}function jE(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)}/**
1347
- * @license
1348
- * Copyright 2021 Google LLC
1349
- *
1350
- * Licensed under the Apache License, Version 2.0 (the "License");
1351
- * you may not use this file except in compliance with the License.
1352
- * You may obtain a copy of the License at
1353
- *
1354
- * http://www.apache.org/licenses/LICENSE-2.0
1355
- *
1356
- * Unless required by applicable law or agreed to in writing, software
1357
- * distributed under the License is distributed on an "AS IS" BASIS,
1358
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1359
- * See the License for the specific language governing permissions and
1360
- * limitations under the License.
1361
- */const UE="__/auth/handler",BE="emulator/auth/handler",FE=encodeURIComponent("fac");async function Cu(e,t,n,r,s,o){Ve(e.config.authDomain,e,"auth-domain-config-required"),Ve(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:oo,eventId:s};if(t instanceof El){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",jT(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[u,h]of Object.entries({}))i[u]=h}if(t instanceof ao){const u=t.getScopes().filter(h=>h!=="");u.length>0&&(i.scopes=u.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await e._getAppCheckToken(),d=l?`#${FE}=${encodeURIComponent(l)}`:"";return`${HE(e)}?${so(a).slice(1)}${d}`}function HE({config:e}){return e.emulator?_l(e,BE):`https://${e.authDomain}/${UE}`}/**
1362
- * @license
1363
- * Copyright 2020 Google LLC
1364
- *
1365
- * Licensed under the Apache License, Version 2.0 (the "License");
1366
- * you may not use this file except in compliance with the License.
1367
- * You may obtain a copy of the License at
1368
- *
1369
- * http://www.apache.org/licenses/LICENSE-2.0
1370
- *
1371
- * Unless required by applicable law or agreed to in writing, software
1372
- * distributed under the License is distributed on an "AS IS" BASIS,
1373
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1374
- * See the License for the specific language governing permissions and
1375
- * limitations under the License.
1376
- */const ra="webStorageSupport";class VE{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=oh,this._completeRedirectFn=hE,this._overrideRedirectResult=uE}async _openPopup(t,n,r,s){var i;ir((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Cu(t,n,r,Da(),s);return LE(t,o,Cl())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Cu(t,n,r,Da(),s);return zI(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):(ir(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 xE(t),r=new mE(t);return n.register("authEvent",s=>(Ve(s==null?void 0:s.authEvent,t,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,r}_isIframeWebStorageSupported(t,n){this.iframes[t._key()].send(ra,{type:ra},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[ra];o!==void 0&&n(!!o),Vn(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=bE(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Xf()||qf()||Sl()}}const WE=VE;var Au="@firebase/auth",Ru="1.12.2";/**
1377
- * @license
1378
- * Copyright 2020 Google LLC
1379
- *
1380
- * Licensed under the Apache License, Version 2.0 (the "License");
1381
- * you may not use this file except in compliance with the License.
1382
- * You may obtain a copy of the License at
1383
- *
1384
- * http://www.apache.org/licenses/LICENSE-2.0
1385
- *
1386
- * Unless required by applicable law or agreed to in writing, software
1387
- * distributed under the License is distributed on an "AS IS" BASIS,
1388
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389
- * See the License for the specific language governing permissions and
1390
- * limitations under the License.
1391
- */class qE{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(){Ve(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1392
- * @license
1393
- * Copyright 2020 Google LLC
1394
- *
1395
- * Licensed under the Apache License, Version 2.0 (the "License");
1396
- * you may not use this file except in compliance with the License.
1397
- * You may obtain a copy of the License at
1398
- *
1399
- * http://www.apache.org/licenses/LICENSE-2.0
1400
- *
1401
- * Unless required by applicable law or agreed to in writing, software
1402
- * distributed under the License is distributed on an "AS IS" BASIS,
1403
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1404
- * See the License for the specific language governing permissions and
1405
- * limitations under the License.
1406
- */function zE(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 GE(e){Xs(new hs("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;Ve(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:Qf(e)},d=new II(r,s,o,l);return xI(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),Xs(new hs("auth-internal",t=>{const n=fi(t.getProvider("auth").getImmediate());return(r=>new qE(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),os(Au,Ru,zE(e)),os(Au,Ru,"esm2020")}/**
1407
- * @license
1408
- * Copyright 2021 Google LLC
1409
- *
1410
- * Licensed under the Apache License, Version 2.0 (the "License");
1411
- * you may not use this file except in compliance with the License.
1412
- * You may obtain a copy of the License at
1413
- *
1414
- * http://www.apache.org/licenses/LICENSE-2.0
1415
- *
1416
- * Unless required by applicable law or agreed to in writing, software
1417
- * distributed under the License is distributed on an "AS IS" BASIS,
1418
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1419
- * See the License for the specific language governing permissions and
1420
- * limitations under the License.
1421
- */const KE=300,JE=Af("authIdTokenMaxAge")||KE;let Pu=null;const YE=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>JE)return;const s=n==null?void 0:n.token;Pu!==s&&(Pu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function XE(e=Nf()){const t=Mf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=PI(e,{popupRedirectResolver:WE,persistence:[tE,VI,oh]}),r=Af("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=YE(o.toString());BI(n,i,()=>i(n.currentUser)),UI(n,a=>i(a))}}const s=ET("auth");return s&&MI(n,`http://${s}`),n}function QE(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}EI({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=In("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",QE().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="});GE("Browser");const ZE={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 eC(e){const t=j(null),n=j(""),r=j(""),s=j(""),o=j({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=ue(()=>s.value==="pull"),a=ue(()=>s.value==="push"),l=ue(()=>s.value!=="");async function d(){try{const M=await fetch("/codex-api/skills-sync/status");if(!M.ok)return;const D=await M.json();D.data&&(o.value=D.data)}catch{}}async function u(){try{const M=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),D=await M.json();if(!M.ok||!D.data)throw new Error("Failed to start GitHub login");t.value=D.data;const N=30,P=Math.max((D.data.interval??5)*1e3,3e3);let V=!1;for(let B=0;B<N;B++){await new Promise(me=>setTimeout(me,P));const ce=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:D.data.device_code})}),de=await ce.json();if(!ce.ok)throw new Error(de.error||"Failed to complete GitHub login");if(de.ok){V=!0;break}if(!de.pending)throw new Error(de.error||"Failed to complete GitHub login")}if(!V)throw new Error("GitHub login timed out. Please retry.");t.value=null,await d(),e.showToast("GitHub login successful")}catch(M){e.showToast(M instanceof Error?M.message:"Failed GitHub login","error")}}async function h(){try{const M=FS().length>0?Nf():Of(ZE),D=XE(M),N=new Un;N.addScope("repo");const P=await iE(D,N),V=Un.credentialFromResult(P),B=(V==null?void 0:V.accessToken)??"";if(!B)throw new Error("GitHub access token missing from Firebase login");const ce=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:B})}),de=await ce.json();if(!ce.ok||!de.ok)throw new Error(de.error||"Failed to login with GitHub token");await d(),e.showToast("GitHub login successful")}catch(M){const D=M instanceof Error?M.message:"Failed Firebase GitHub login";e.showToast(D,"error")}}async function g(){r.value="",n.value="pull-started",s.value="pull";try{const M=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),D=await M.json();if(!M.ok||!D.ok)throw new Error(D.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(M){const D=M instanceof Error?M.message:"Failed to pull sync";r.value=D,n.value="pull-failed",e.showToast(D,"error")}finally{s.value=""}}async function T(){r.value="",n.value="push-started",s.value="push";try{const M=await fetch("/codex-api/skills-sync/push",{method:"POST"}),D=await M.json();if(!M.ok||!D.ok)throw new Error(D.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(M){const D=M instanceof Error?M.message:"Failed to push sync";r.value=D,n.value="push-failed",e.showToast(D,"error")}finally{s.value=""}}async function H(){try{const M=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),D=await M.json();if(!M.ok||!D.ok)throw new Error(D.error||"Failed to logout GitHub");await d(),e.showToast("Logged out from GitHub")}catch(M){e.showToast(M instanceof Error?M.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:d,logoutGithub:H,pullSkillsSync:g,pushSkillsSync:T,startGithubFirebaseLogin:h,startGithubLogin:u,syncActionError:r,syncActionStatus:n,syncStatus:o}}const tC={class:"skills-hub"},nC={class:"skills-sync-panel"},rC={class:"skills-sync-header"},sC={key:0,class:"skills-sync-badge"},oC={key:1,class:"skills-sync-badge"},iC={key:2,class:"skills-sync-badge"},aC={class:"skills-sync-meta"},lC={key:0,class:"skills-sync-error"},cC={key:1,class:"skills-sync-meta"},uC={key:2,class:"skills-sync-error"},dC={key:3,class:"skills-sync-device"},fC=["href"],hC={class:"skills-sync-actions"},pC=["disabled"],mC=["disabled"],gC=["disabled"],vC={key:1,class:"skills-hub-section"},yC={class:"skills-hub-section-title"},wC={key:0,class:"skills-hub-grid"},bC={class:"skills-hub-toolbar"},_C={class:"skills-hub-search-wrap"},kC={key:0,class:"skills-hub-count"},TC={class:"skills-hub-section"},SC={key:0,class:"skills-hub-loading"},IC={key:1,class:"skills-hub-error"},EC={key:0,class:"skills-hub-grid"},CC={key:1,class:"skills-hub-empty"},wo="codex-web-local.skills-hub.cache.v1",AC=Nt({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=j(null),s=j(""),o=j("date"),i=j([]),a=j([]),l=j(0),d=j(!1),u=j(""),h=j(!0),g=j(!1),T=j(n),H=j(null),M=j(""),D=j(!1),N=j(!1);let P=null,V=null;const B=t,ce=ue(()=>o.value==="date"?"Newest":"A-Z"),de=ue(()=>{var x;return((x=H.value)==null?void 0:x.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),me=ue(()=>`${T.value.owner}/${T.value.name}`),_e=ue(()=>D.value&&M.value===me.value),ne=ue(()=>N.value&&M.value===me.value),ie=ue(()=>{const x=s.value.toLowerCase().trim();return x?a.value.filter(U=>U.name.toLowerCase().includes(x)||U.owner.toLowerCase().includes(x)||(U.displayName??"").toLowerCase().includes(x)):a.value});function pe(x,U="success"){H.value={text:x,type:U},V&&clearTimeout(V),V=setTimeout(()=>{H.value=null},3e3)}function Q(){o.value=o.value==="date"?"name":"date",Se(s.value)}function ke(x){return`${o.value}::${x.trim().toLowerCase()}`}function Pe(x){var U;if(typeof window>"u")return null;try{const G=window.localStorage.getItem(wo);return G?((U=JSON.parse(G).byKey)==null?void 0:U[x])??null:null}catch{return null}}function Me(x,U){if(!(typeof window>"u"))try{const G=window.localStorage.getItem(wo),K=(G?JSON.parse(G):{}).byKey??{};K[x]=U,window.localStorage.setItem(wo,JSON.stringify({byKey:K}))}catch{}}function Te(){if(!(typeof window>"u"))try{window.localStorage.removeItem(wo)}catch{}}function $e(x){const U=x.installed??[];a.value=U;const G=new Set(U.map(Y=>Y.name));i.value=x.data.map(Y=>{if(Y.installed||G.has(Y.name)){const K=U.find(ye=>ye.name===Y.name);return{...Y,installed:!0,path:(K==null?void 0:K.path)??Y.path,enabled:(K==null?void 0:K.enabled)??Y.enabled}}return Y}).filter(Y=>!Y.installed),l.value=x.total}async function Se(x){const U=ke(x),G=Pe(U);G&&$e(G),d.value=!G,u.value="";try{const Y=new URLSearchParams;x.trim()&&Y.set("q",x.trim()),Y.set("limit","100"),Y.set("sort",o.value);const K=await fetch(`/codex-api/skills-hub?${Y}`);if(!K.ok)throw new Error(`HTTP ${K.status}`);const ye=await K.json();$e(ye),Me(U,ye)}catch(Y){u.value=Y instanceof Error?Y.message:"Failed to load skills"}finally{d.value=!1}}function Ne(){P&&clearTimeout(P),P=setTimeout(()=>Se(s.value),300)}function Ye(x){T.value=x,g.value=!0}async function et(x){M.value=`${x.owner}/${x.name}`,D.value=!0;try{const G=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:x.owner,name:x.name})})).json();if(!G.ok)throw new Error(G.error||"Install failed");const Y={...x,installed:!0,path:G.path,enabled:!0};a.value=[...a.value,Y],i.value=i.value.filter(K=>K.name!==x.name),T.value=Y,pe(`${x.displayName||x.name} skill installed`),g.value=!1,Te(),B("skills-changed")}catch(U){pe(U instanceof Error?U.message:"Failed to install skill","error")}finally{D.value=!1}}async function Qe(x){M.value=`${x.owner}/${x.name}`,N.value=!0;try{const G=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:x.name,path:x.path})})).json();if(!G.ok)throw new Error(G.error||"Uninstall failed");a.value=a.value.filter(Y=>Y.name!==x.name),x.owner!=="local"&&(i.value=[...i.value,{...x,installed:!1,path:void 0,enabled:void 0}]),pe(`${x.displayName||x.name} skill uninstalled`),g.value=!1,Te(),B("skills-changed")}catch(U){pe(U instanceof Error?U.message:"Failed to uninstall skill","error")}finally{N.value=!1}}async function Xe(x,U){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:x.path,enabled:U}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),pe(`${x.displayName||x.name} skill ${U?"enabled":"disabled"}`),await Se(s.value)}catch(G){pe(G instanceof Error?G.message:"Failed to update skill","error")}}const{deviceLogin:tt,isPullInFlight:ct,isPushInFlight:We,isSyncActionInFlight:W,loadSyncStatus:le,logoutGithub:te,pullSkillsSync:be,pushSkillsSync:Le,startGithubFirebaseLogin:v,startGithubLogin:b,syncActionError:A,syncActionStatus:J,syncStatus:z}=eC({showToast:pe,onPulled:async()=>{await Se(s.value),B("skills-changed")}});return lr(()=>{Se(""),le()}),(x,U)=>(y(),k("div",tC,[U[11]||(U[11]=p("div",{class:"skills-hub-header"},[p("h2",{class:"skills-hub-title"},"Skills Hub"),p("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),p("div",nC,[p("div",rC,[U[8]||(U[8]=p("strong",null,"Skills Sync (GitHub)",-1)),we(z).configured?(y(),k("span",sC,"Connected: "+se(we(z).repoOwner)+"/"+se(we(z).repoName),1)):we(z).loggedIn?(y(),k("span",oC,"Logged in as "+se(we(z).githubUsername),1)):(y(),k("span",iC,"Not connected"))]),p("div",aC,[p("span",null,"Startup: "+se(we(z).startup.mode),1),p("span",null,"Branch: "+se(we(z).startup.branch),1),p("span",null,"Action: "+se(we(z).startup.lastAction),1)]),we(z).startup.lastError?(y(),k("div",lC,se(we(z).startup.lastError),1)):re("",!0),we(J)?(y(),k("div",cC,[p("span",null,"Manual sync: "+se(we(J)),1)])):re("",!0),we(A)?(y(),k("div",uC,se(we(A)),1)):re("",!0),we(tt)?(y(),k("div",dC,[p("span",null,[U[9]||(U[9]=zs("Open ",-1)),p("a",{href:we(tt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,fC),U[10]||(U[10]=zs(" and enter code:",-1))]),p("code",null,se(we(tt).user_code),1)])):re("",!0),p("div",hC,[we(z).loggedIn?re("",!0):(y(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:U[0]||(U[0]=(...G)=>we(v)&&we(v)(...G))},"Login with GitHub")),we(z).loggedIn?re("",!0):(y(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:U[1]||(U[1]=(...G)=>we(b)&&we(b)(...G))},"Device Login")),we(z).loggedIn?(y(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:U[2]||(U[2]=(...G)=>we(te)&&we(te)(...G)),disabled:we(W)},"Logout GitHub",8,pC)):re("",!0),p("button",{class:"skills-hub-sort",type:"button",onClick:U[3]||(U[3]=(...G)=>we(be)&&we(be)(...G)),disabled:we(W)},se(we(ct)?"Pulling...":"Pull"),9,mC),we(z).loggedIn?(y(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:U[4]||(U[4]=(...G)=>we(Le)&&we(Le)(...G)),disabled:!we(z).configured||we(W)},se(we(We)?"Pushing...":"Push"),9,gC)):re("",!0)])]),H.value?(y(),k("div",{key:0,class:at(["skills-hub-toast",de.value])},se(H.value.text),3)):re("",!0),ie.value.length>0?(y(),k("div",vC,[p("button",{class:"skills-hub-section-toggle",type:"button",onClick:U[5]||(U[5]=G=>h.value=!h.value)},[p("span",yC,"Installed ("+se(ie.value.length)+")",1),Re(wf,{class:at(["skills-hub-section-chevron",{"is-open":h.value}])},null,8,["class"])]),h.value?(y(),k("div",wC,[(y(!0),k(je,null,bt(ie.value,G=>(y(),ft(ru,{key:G.name,skill:G,onSelect:Y=>Ye(Y)},null,8,["skill","onSelect"]))),128))])):re("",!0)])):re("",!0),p("div",bC,[p("div",_C,[Re(Pa,{class:"skills-hub-search-icon"}),rr(p("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":U[6]||(U[6]=G=>s.value=G),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:Ne},null,544),[[sr,s.value]]),l.value>0?(y(),k("span",kC,se(l.value)+" skills",1)):re("",!0)]),p("button",{class:"skills-hub-sort",type:"button",onClick:Q},se(ce.value),1)]),p("div",TC,[d.value?(y(),k("div",SC,"Loading skills...")):u.value?(y(),k("div",IC,se(u.value),1)):(y(),k(je,{key:2},[i.value.length>0?(y(),k("div",EC,[(y(!0),k(je,null,bt(i.value,G=>(y(),ft(ru,{key:G.url,skill:G,onSelect:Y=>Ye(Y)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(y(),k("div",CC,'No skills found for "'+se(s.value)+'"',1)):re("",!0)],64))]),Re(vT,{skill:T.value,visible:g.value,"is-installing":_e.value,"is-uninstalling":ne.value,onClose:U[7]||(U[7]=G=>g.value=!1),onInstall:et,onUninstall:Qe,onToggleEnabled:Xe},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),RC=rt(AC,[["__scopeId","data-v-2f6920be"]]),PC={},xC={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 MC(e,t){return y(),k("svg",xC,[...t[0]||(t[0]=[p("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),p("path",{d:"M9 4l0 16"},null,-1)])])}const OC=rt(PC,[["render",MC]]),NC={},$C={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function DC(e,t){return y(),k("svg",$C,[...t[0]||(t[0]=[p("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 LC=rt(NC,[["render",DC]]),jC={class:"sidebar-thread-controls"},UC=["aria-label","title"],BC=Nt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(y(),k("div",jC,[p("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",title:e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",onClick:n[0]||(n[0]=r=>t.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(y(),ft(LC,{key:0,class:"sidebar-thread-controls-icon"})):(y(),ft(OC,{key:1,class:"sidebar-thread-controls-icon"}))],8,UC),Bn(t.$slots,"default",{},void 0),e.showNewThreadButton?(y(),k("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":"Start new thread",title:"Start new thread",onClick:n[1]||(n[1]=r=>t.$emit("start-new-thread"))},[Re(Fo,{class:"sidebar-thread-controls-icon"})])):re("",!0)]))}}),xu=rt(BC,[["__scopeId","data-v-46a10052"]]),FC={},HC={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function VC(e,t){return y(),k("svg",HC,[...t[0]||(t[0]=[p("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[p("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"}),p("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const WC=rt(FC,[["render",VC]]);function vr(e){return e.flatMap(t=>t.threads)}const hh="codex-web-local.thread-read-state.v1",ph="codex-web-local.thread-scroll-state.v1",Ua="codex-web-local.selected-thread-id.v1",Ba="codex-web-local.selected-model-id.v1",mh="codex-web-local.project-order.v1",gh="codex-web-local.project-display-name.v1",sa=220,qC=500,Mu=["none","minimal","low","medium","high","xhigh"],Rs="__global__",gn="gpt-5.2-codex";function zC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(hh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Ou(e){typeof window>"u"||window.localStorage.setItem(hh,JSON.stringify(e))}function Fa(e,t,n){return Math.min(Math.max(e,t),n)}function GC(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=Fa(t.scrollRatio,0,1)),n}function KC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(ph);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=GC(s);o&&(n[r]=o)}return n}catch{return{}}}function Nu(e){typeof window>"u"||window.localStorage.setItem(ph,JSON.stringify(e))}function JC(){return typeof window>"u"?"":window.localStorage.getItem(Ua)??""}function YC(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Ua);return}window.localStorage.setItem(Ua,e)}}function XC(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(Ba))==null?void 0:e.trim())??""}function oa(e){if(typeof window>"u")return;const t=e.trim();if(!t){window.localStorage.removeItem(Ba);return}window.localStorage.setItem(Ba,t)}function QC(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(mh);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 Yr(e){typeof window>"u"||window.localStorage.setItem(mh,JSON.stringify(e))}function ZC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(gh);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(gh,JSON.stringify(e))}function bo(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 Br(e,n)?e:n}function aa(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??null).filter(s=>s!==null&&s.threads.length>0);for(const s of e)t.includes(s.projectName)||r.push(s);return r}function Br(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s])return!1;return!0}function eA(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}function tA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function _o(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 Ha(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Br(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&tA(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function Jo(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 nA(e,t,n={}){const r=new Map(e.map(u=>[u.id,u])),s=new Map(t.map(u=>[u.id,u])),o=t.map(u=>{const h=r.get(u.id);return h&&Ha(h,u)?h:u});if(n.preserveMissing!==!0)return Jo(e,o)?e:o;const i=e.map(u=>{const h=s.get(u.id);return!h||Ha(u,h)?u:h}),a=new Set(e.map(u=>u.id)),l=o.filter(u=>!a.has(u.id)),d=[...i,...l];return Jo(e,d)?e:d}function Va(e){return e.replace(/\s+/gu," ").trim()}function rA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>Va(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=Va(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function $u(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Ha(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const vh="worked";function pr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function sA(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 oA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function iA(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 aA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${sA(e.durationMs)}`,messageType:vh}}function lA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function cA(e,t){const n=aA(t),r=e.filter(i=>i.messageType!==vh),s=lA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Dt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function uA(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 dA(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 fA(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 Ft(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function ko(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&&uA(d,l)?d:l});return o&&o.projectName===s.projectName&&dA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return fA(e,r)?e:r}function hA(e,t,n){const r=new Set(vr(t).map(a=>a.id)),s=vr(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(u=>u.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 pA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function la(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function mA(e){const t=e.split(`
1422
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function gA(){const e=j([]),t=j([]),n=j(JC()),r=j({}),s=j({}),o=j({}),i=j({}),a=j({}),l=j({}),d=j({}),u=j({}),h=j([]),g=j(XC()),T=j("medium"),H=j(zC()),M=j(KC()),D=j(QC()),N=j(ZC()),P=j({}),V=j({}),B=j({}),ce=j({}),de=j({}),me=j({}),_e=j({}),ne=j({}),ie=j({}),pe=j({}),Q=j([]),ke=j([]),Pe=j(!1),Me=j(!1),Te=j(!1),$e=j(!1),Se=j(!1),Ne=j(""),Ye=j(!1),et=j(!1);let Qe=null,Xe=null,tt=null,ct=null,We=!1;const W=new Set;let le=!1,te=!1;const be=new Map,Le=new Set,v=ue(()=>vr(e.value)),b=ue(()=>v.value.find(c=>c.id===n.value)??null),A=ue(()=>M.value[n.value]??null),J=ue(()=>{const c=[],f=n.value;return f&&Array.isArray(ne.value[f])&&c.push(...ne.value[f]),Array.isArray(ne.value[Rs])&&c.push(...ne.value[Rs]),c.sort((m,_)=>m.receivedAtIso.localeCompare(_.receivedAtIso))}),z=ue(()=>{var $;const c=n.value;if(!c)return null;const f=de.value[c],m=(o.value[c]??"").trim(),_=((($=me.value[c])==null?void 0:$.message)??"").trim();return!f&&!m&&!_?null:{activityLabel:(f==null?void 0:f.label)||"Thinking",activityDetails:(f==null?void 0:f.details)??[],reasoningText:m,errorText:_}}),x=ue(()=>{const c=n.value;if(!c)return[];const f=r.value[c]??[],m=s.value[c]??[],_=i.value[c]??[],$=[...f,..._,...m],Z=ce.value[c];return Z?cA($,Z):$});function U(c){n.value!==c&&(n.value=c,YC(c),te=!1)}function G(c){g.value=c.trim(),oa(g.value)}async function Y(){g.value=gn,oa(g.value),h.value.includes(gn)||(h.value=[...h.value,gn]);try{await I_(gn)}catch{}}function K(c,f){ie.value={...ie.value,[c]:f}}function ye(c){ie.value[c]&&(ie.value=Dt(ie.value,c))}async function fe(c){if(Le.has(c))return;const f=ie.value[c];if(!(!f||f.fallbackRetried)){Le.add(c),K(c,{...f,fallbackRetried:!0});try{await Y();try{const m=await Yc(c,1);xt(c,m),ln(c,[]),jt(c),i.value[c]&&(i.value=Dt(i.value,c))}catch{}Je(c,null),Ne.value="",St(c,null),mt(c,{label:"Thinking",details:xe(gn,f.effort)}),Ze(c,!0),B.value[c]!==!0&&await Ki(c),await Ji(c,f.text,f.imageUrls,gn,f.effort||void 0,f.skills.length>0?f.skills:void 0,f.fileAttachments),B.value={...B.value,[c]:!0},He(),W.add(c),We=!0,await pn()}catch(m){const _=m instanceof Error?m.message:"Unknown application error";Je(c,_),Ne.value=_,Ze(c,!1),mt(c,null)}finally{Le.delete(c)}}}function ge(c){c&&!Mu.includes(c)||(T.value=c)}function xe(c,f){const m=c.trim()||"default",_=f||"default";return[`Model: ${m}`,`Thinking: ${_}`]}async function Be(){try{const[c,f]=await Promise.all([E_(),C_()]);h.value=c,g.value.length>0&&c.includes(g.value)||(f.model&&c.includes(f.model)?g.value=f.model:c.length>0?g.value=c[0]:g.value="",oa(g.value)),f.reasoningEffort&&Mu.includes(f.reasoningEffort)&&(T.value=f.reasoningEffort)}catch{}}async function qe(){if(ct){await ct;return}ct=(async()=>{try{ke.value=C(await A_())}catch{}finally{ct=null}})(),await ct}function He(){if(typeof window>"u"){qe();return}tt!==null&&window.clearTimeout(tt),tt=window.setTimeout(()=>{tt=null,qe()},qC)}function nt(c){const f=pe.value;return Object.keys(f).length===0?c:c.map(m=>({projectName:m.projectName,threads:m.threads.map(_=>{const $=f[_.id];return $?{..._,title:$}:_})}))}function Ke(){const f=nt(t.value).map(m=>({projectName:m.projectName,threads:m.threads.map(_=>{const $=a.value[_.id]===!0,Z=n.value===_.id,he=H.value[_.id],Ae=u.value[_.id]===!0,Ee=!Z&&!$&&(Ae||he!==_.updatedAtIso);return{..._,inProgress:$,unread:Ee}})}));e.value=ko(e.value,f)}function vt(c,f,m){const _=new Date().toISOString(),$=f.trim(),Z=pA($),he={id:c,title:mA(m),projectName:Z,cwd:$,hasWorktree:$.includes("/.codex/worktrees/")||$.includes("/.git/worktrees/"),createdAtIso:_,updatedAtIso:_,preview:m,unread:!1,inProgress:!1},Ae=t.value.findIndex(st=>st.projectName===Z);if(Ae>=0){const ot=t.value[Ae].threads.filter(ur=>ur.id!==c),bn={projectName:Z,threads:[he,...ot]},_n=[...t.value];_n.splice(Ae,1,bn),t.value=_n}else t.value=[{projectName:Z,threads:[he]},...t.value];const Ee=bo(D.value,t.value);Br(D.value,Ee)||(D.value=Ee,Yr(D.value)),Ke()}function Et(c){const f=new Set(c.map(Z=>Z.id)),m=Ft(H.value,f);m!==H.value&&(H.value=m,Ou(m));const _=Ft(M.value,f);_!==M.value&&(M.value=_,Nu(_)),V.value=Ft(V.value,f),P.value=Ft(P.value,f),B.value=Ft(B.value,f),r.value=Ft(r.value,f),s.value=Ft(s.value,f),o.value=Ft(o.value,f),i.value=Ft(i.value,f),ce.value=Ft(ce.value,f),de.value=Ft(de.value,f),me.value=Ft(me.value,f),_e.value=Ft(_e.value,f),u.value=Ft(u.value,f),a.value=Ft(a.value,f);const $={};for(const[Z,he]of Object.entries(ne.value))(Z===Rs||f.has(Z))&&($[Z]=he);ne.value=$}function Pt(c){const f=vr(t.value).find(m=>m.id===c);f&&(H.value={...H.value,[c]:f.updatedAtIso},Ou(H.value),u.value[c]&&(u.value=Dt(u.value,c)),Ke())}function St(c,f){if(!c)return;const m=ce.value[c];if(f){if(oA(m,f))return;ce.value={...ce.value,[c]:f}}else m&&(ce.value=Dt(ce.value,c))}function Ze(c,f){!c||a.value[c]===!0===f||(f?a.value={...a.value,[c]:!0}:a.value=Dt(a.value,c),Ke())}function kt(c){c&&c!==n.value&&u.value[c]!==!0&&(u.value={...u.value,[c]:!0},Ke())}function mt(c,f){if(!c)return;const m=de.value[c];if(!f){m&&(de.value=Dt(de.value,c));return}const _=X(f.label)||"Thinking",$=f.details.map(Ae=>X(Ae)).filter(Ae=>Ae.length>0&&Ae!==_),Z=Array.from(new Set([...(m==null?void 0:m.details)??[],...$])).slice(-3),he={label:_,details:Z};iA(m,he)||(de.value={...de.value,[c]:he})}function Je(c,f){if(!c)return;const m=me.value[c],_=f?Va(f):"";if(!_){m&&(me.value=Dt(me.value,c));return}(m==null?void 0:m.message)!==_&&(me.value={...me.value,[c]:{message:_}})}function Gt(c){const f=vr(t.value).find(m=>m.id===c);return(f==null?void 0:f.updatedAtIso)??""}function rn(c,f){if(!c)return;const m={scrollTop:Math.max(0,f.scrollTop),isAtBottom:f.isAtBottom===!0};typeof f.scrollRatio=="number"&&Number.isFinite(f.scrollRatio)&&(m.scrollRatio=Fa(f.scrollRatio,0,1));const _=M.value[c];_&&_.scrollTop===m.scrollTop&&_.isAtBottom===m.isAtBottom&&_.scrollRatio===m.scrollRatio||(M.value={...M.value,[c]:m},Nu(M.value))}function xt(c,f){const m=r.value[c]??[];Jo(m,f)||(r.value={...r.value,[c]:f})}function ln(c,f){const m=s.value[c]??[];Jo(m,f)||(s.value={...s.value,[c]:f})}function cn(c,f){const m=s.value[c]??[],_=$u(m,f);ln(c,_)}function Kt(c,f){if(!c)return;const m=f.trim(),_=o.value[c]??"";if(m.length===0){if(!_)return;o.value=Dt(o.value,c);return}_!==m&&(o.value={...o.value,[c]:m})}function Lt(c,f){if(!c)return;const m=o.value[c]??"";Kt(c,`${m}${f}`)}function jt(c){c&&c in o.value&&(o.value=Dt(o.value,c))}function De(c){return c!==null&&typeof c=="object"&&!Array.isArray(c)?c:null}function Ie(c){return typeof c=="string"?c:""}function Jt(c){return typeof c=="number"&&Number.isFinite(c)?c:null}function yn(c){var f,m;return((f=c.limitId)==null?void 0:f.trim())||((m=c.limitName)==null?void 0:m.trim())||"__default__"}function w(c){const f=De(c);return f?{usedPercent:Fa(Jt(f.usedPercent)??0,0,100),windowDurationMins:Jt(f.windowDurationMins),resetsAt:Jt(f.resetsAt)}:null}function I(c){const f=De(c);if(!f)return null;const m=De(f.credits);return{limitId:Ie(f.limitId)||null,limitName:Ie(f.limitName)||null,primary:w(f.primary),secondary:w(f.secondary),credits:m?{hasCredits:m.hasCredits===!0,unlimited:m.unlimited===!0,balance:Ie(m.balance)||null}:null,planType:Ie(f.planType)||null}}function C(c){const f=De(c);if(!f)return[];const m=[],_=new Set,$=he=>{if(!he)return;const Ae=yn(he);_.has(Ae)||(_.add(Ae),m.push(he))};$(I(f.rateLimits));const Z=De(f.rateLimitsByLimitId);if(Z)for(const he of Object.values(Z))$(I(he));return m}function q(c){const f=De(c.params);if(!f)return"";const m=Ie(f.threadId);if(m)return m;const _=Ie(f.thread_id);if(_)return _;const $=Ie(f.conversationId);if($)return $;const Z=Ie(f.conversation_id);if(Z)return Z;const he=De(f.thread),Ae=Ie(he==null?void 0:he.id);if(Ae)return Ae;const Ee=De(f.turn),st=Ie(Ee==null?void 0:Ee.threadId);if(st)return st;const ot=Ie(Ee==null?void 0:Ee.thread_id);return ot||""}function oe(c){if(c.method!=="turn/completed")return"";const f=De(c.params),m=De(f==null?void 0:f.turn);if(!m||m.status!=="failed")return"";const _=De(m.error);return Ie(_==null?void 0:_.message)}function ae(c){var m;if(c.method!=="error")return"";const f=De(c.params);return Ie(f==null?void 0:f.message)||Ie((m=De(f==null?void 0:f.error))==null?void 0:m.message)}function Ce(c){const f=De(c);if(!f)return null;const m=f.id,_=Ie(f.method),$=f.params;if(typeof m!="number"||!Number.isInteger(m)||!_)return null;const Z=De($),he=Ie(Z==null?void 0:Z.threadId)||Rs,Ae=Ie(Z==null?void 0:Z.turnId),Ee=Ie(Z==null?void 0:Z.itemId),st=Ie(f.receivedAtIso)||new Date().toISOString();return{id:m,method:_,threadId:he,turnId:Ae,itemId:Ee,receivedAtIso:st,params:$??null}}function ve(c){const f=c.threadId||Rs,m=ne.value[f]??[],_=m.findIndex(Z=>Z.id===c.id),$=[...m];_>=0?$.splice(_,1,c):$.push(c),ne.value={...ne.value,[f]:$.sort((Z,he)=>Z.receivedAtIso.localeCompare(he.receivedAtIso))}}function R(c){const f={};for(const[m,_]of Object.entries(ne.value)){const $=_.filter(Z=>Z.id!==c);$.length>0&&(f[m]=$)}ne.value=f}function F(c){if(c.method==="server/request"){const f=Ce(c.params);return f&&ve(f),!0}if(c.method==="server/request/resolved"){const f=De(c.params),m=f==null?void 0:f.id;return typeof m=="number"&&Number.isInteger(m)&&R(m),!0}return!1}function X(c){return c.replace(/\s+/gu," ").trim()}function Oe(c){const f=q(c);if(!f)return null;if(c.method==="turn/started")return{threadId:f,activity:{label:"Thinking",details:[]}};if(c.method==="item/started"){const m=De(c.params),_=De(m==null?void 0:m.item),$=Ie(_==null?void 0:_.type).toLowerCase();if($==="reasoning")return{threadId:f,activity:{label:"Thinking",details:[]}};if($==="agentmessage")return{threadId:f,activity:{label:"Writing response",details:[]}};if($==="commandexecution"){const Z=Ie(_==null?void 0:_.command);return{threadId:f,activity:{label:"Running command",details:Z?[Z]:[]}}}}return c.method==="item/commandExecution/outputDelta"?{threadId:f,activity:{label:"Running command",details:[]}}:c.method==="item/reasoning/summaryTextDelta"||c.method==="item/reasoning/summaryPartAdded"?{threadId:f,activity:{label:"Thinking",details:[]}}:c.method==="item/agentMessage/delta"?{threadId:f,activity:{label:"Writing response",details:[]}}:null}function yt(c){if(c.method!=="turn/started")return null;const f=De(c.params);if(!f)return null;const m=q(c);if(!m)return null;const _=De(f.turn),$=Ie(_==null?void 0:_.id)||Ie(f.turnId)||`${m}:unknown`;if(!$)return null;const Z=pr(Ie(_==null?void 0:_.startedAt))??pr(Ie(f.startedAt))??pr(c.atIso)??Date.now();return{threadId:m,turnId:$,startedAtMs:Z}}function un(c){if(c.method!=="turn/completed")return null;const f=De(c.params);if(!f)return null;const m=q(c);if(!m)return null;const _=De(f.turn),$=Ie(_==null?void 0:_.id)||Ie(f.turnId)||`${m}:unknown`;if(!$)return null;const Z=pr(Ie(_==null?void 0:_.completedAt))??pr(Ie(f.completedAt))??pr(c.atIso)??Date.now(),he=pr(Ie(_==null?void 0:_.startedAt))??pr(Ie(f.startedAt))??void 0;return{threadId:m,turnId:$,completedAtMs:Z,startedAtMs:he}}function Ct(c){return`${c}:live-reasoning`}function sn(c){const f=De(c.params);if(!f)return"";if(c.method==="item/started"){const m=De(f.item);return!m||m.type!=="reasoning"?"":Ie(m.id)}return""}function $t(c){const f=De(c.params);if(!f)return null;if(c.method==="item/reasoning/summaryTextDelta"){const m=Ie(f.itemId),_=Ie(f.delta);return!m||!_?null:{messageId:Ct(m),delta:_}}return null}function Pn(c){const f=De(c.params);if(!f)return"";if(c.method==="item/reasoning/summaryPartAdded"){const m=Ie(f.itemId);return m?Ct(m):""}return""}function hn(c){const f=De(c.params);if(!f)return"";if(c.method==="item/completed"){const m=De(f.item);return!m||m.type!=="reasoning"?"":Ct(Ie(m.id))}return""}function ys(c){const f=De(c.params);if(!f)return"";if(c.method==="item/started"){const m=De(f.item);return!m||m.type!=="agentMessage"?"":Ie(m.id)}return""}function ws(c){const f=De(c.params);if(!f)return null;if(c.method==="item/agentMessage/delta"){const m=Ie(f.itemId),_=Ie(f.delta);return!m||!_?null:{messageId:m,delta:_}}return null}function bs(c){const f=De(c.params);if(!f)return null;if(c.method==="item/completed"){const m=De(f.item);if(!m||m.type!=="agentMessage")return null;const _=Ie(m.id),$=Ie(m.text);return!_||!$?null:{id:_,role:"assistant",text:$,messageType:"agentMessage.live"}}return null}function Er(c){if(c.method!=="item/started")return null;const f=De(c.params),m=De(f==null?void 0:f.item);if(!m||m.type!=="commandExecution")return null;const _=Ie(m.id),$=Ie(m.command);if(!_)return null;const Z=typeof m.cwd=="string"?m.cwd:null;return{id:_,role:"system",text:$,messageType:"commandExecution",commandExecution:{command:$,cwd:Z,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function _s(c){if(c.method!=="item/commandExecution/outputDelta")return null;const f=De(c.params);if(!f)return null;const m=Ie(f.itemId),_=Ie(f.delta);return!m||!_?null:{itemId:m,delta:_}}function E(c){if(c.method!=="item/completed")return null;const f=De(c.params),m=De(f==null?void 0:f.item);if(!m||m.type!=="commandExecution")return null;const _=Ie(m.id),$=Ie(m.command);if(!_)return null;const Z=typeof m.cwd=="string"?m.cwd:null,he=Ie(m.status),Ae=he==="failed"?"failed":he==="declined"?"declined":he==="interrupted"?"interrupted":"completed",Ee=typeof m.aggregatedOutput=="string"?m.aggregatedOutput:"",st=typeof m.exitCode=="number"?m.exitCode:null;return{id:_,role:"system",text:$,messageType:"commandExecution",commandExecution:{command:$,cwd:Z,status:Ae,aggregatedOutput:Ee,exitCode:st}}}function O(c,f){const m=i.value[c]??[],_=$u(m,f);_!==m&&(i.value={...i.value,[c]:_})}function L(c,f){const m=i.value[c];if(!m||m.length===0)return;const _=new Set(f.map(Z=>Z.id)),$=m.filter(Z=>!_.has(Z.id));$.length!==m.length&&($.length===0?i.value=Dt(i.value,c):i.value={...i.value,[c]:$})}function ee(c){if(c.method==="item/agentMessage/delta")return!0;const f=De(c.params);if(!f)return!1;if(c.method==="item/completed"){const m=De(f.item);return(m==null?void 0:m.type)==="agentMessage"}return!1}function Fe(c){var Pl,xl,Ml,Ol;if(F(c))return;if(c.method==="account/rateLimits/updated"&&He(),c.method==="thread/name/updated"){const Ge=De(c.params),xn=Ie(Ge==null?void 0:Ge.threadId),xr=Ie(Ge==null?void 0:Ge.threadName);xn&&xr&&(pe.value={...pe.value,[xn]:xr},Ke(),Yi(xn,xr))}const f=Oe(c);f&&mt(f.threadId,f.activity);const m=yt(c);m&&(be.set(m.turnId,m),_e.value={..._e.value,[m.threadId]:m.turnId},St(m.threadId,null),Je(m.threadId,null),Ze(m.threadId,!0),u.value[m.threadId]&&(u.value=Dt(u.value,m.threadId)));const _=un(c),$=oe(c),he=!!((_==null?void 0:_.threadId)??q(c))&&!!$&&g.value!==gn&&_o(new Error($));if(_){const Ge=be.get(_.turnId);Ge&&be.delete(_.turnId);const xn=Jt((Pl=De(c.params))==null?void 0:Pl.durationMs)??Jt((Ml=De((xl=De(c.params))==null?void 0:xl.turn))==null?void 0:Ml.durationMs)??(typeof _.startedAtMs=="number"?_.completedAtMs-_.startedAtMs:null)??(Ge?_.completedAtMs-Ge.startedAtMs:null),xr=typeof xn=="number"?Math.max(0,xn):0;St(_.threadId,{turnId:_.turnId,durationMs:xr}),_e.value[_.threadId]&&(_e.value=Dt(_e.value,_.threadId)),Ze(_.threadId,!1),mt(_.threadId,null),kt(_.threadId),he||(ye(_.threadId),uo(_.threadId))}if($){const Ge=(_==null?void 0:_.threadId)||q(c);Ge&&Je(Ge,$),Ne.value=$,Ge&&he&&fe(Ge)}else _&&Je(_.threadId,null);const Ae=ae(c);if(Ae){const Ge=q(c);Ge&&Je(Ge,Ae),Ne.value=Ae,g.value!==gn&&_o(new Error(Ae))&&(Ge?fe(Ge):Y())}const Ee=q(c);if(!Ee||Ee!==n.value)return;ys(c);const st=ws(c);if(st){const Ge=(s.value[Ee]??[]).find(xr=>xr.id===st.messageId),xn=`${(Ge==null?void 0:Ge.text)??""}${st.delta}`;cn(Ee,{id:st.messageId,role:"assistant",text:xn,messageType:"agentMessage.live"})}const ot=bs(c);ot&&cn(Ee,ot),sn(c);const bn=$t(c);if(bn&&Lt(Ee,bn.delta),Pn(c)){const Ge=o.value[Ee]??"";Ge.trim().length>0&&!Ge.endsWith(`
1423
-
1424
- `)&&Kt(Ee,`${Ge}
1425
-
1426
- `)}hn(c);const ur=Er(c);ur&&(O(Ee,ur),mt(Ee,{label:"Running command",details:[((Ol=ur.commandExecution)==null?void 0:Ol.command)??""]}));const Ai=_s(c);if(Ai){const Ge=(i.value[Ee]??[]).find(xn=>xn.id===Ai.itemId);Ge!=null&&Ge.commandExecution&&O(Ee,{...Ge,commandExecution:{...Ge.commandExecution,aggregatedOutput:`${Ge.commandExecution.aggregatedOutput}${Ai.delta}`}})}const Rl=E(c);if(Rl&&O(Ee,Rl),ee(c)&&(te&&n.value&&rn(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),jt(Ee)),c.method==="turn/completed"){te=!1,jt(Ee),i.value[Ee]&&(i.value=Dt(i.value,Ee));const Ge=q(c);Ge&&(Ze(Ge,!1),mt(Ge,null),kt(Ge),he||(ye(Ge),uo(Ge)))}}function At(c){const f=q(c);f&&W.add(f);const m=c.method;(m.startsWith("thread/")||m.startsWith("turn/")||m.startsWith("item/"))&&(We=!0),!(Xe!==null||typeof window>"u")&&(Xe=window.setTimeout(()=>{Xe=null,pn()},sa))}async function dn(c){if(!le){le=!0;try{const f=await Ra(),m=[];for(const _ of f.order){const $=la(_);m.includes($)||m.push($)}if(m.length>0){const _=bo(m,c);Br(D.value,_)||(D.value=_,Yr(D.value))}if(Object.keys(f.labels).length>0){const _={...N.value};let $=!1;for(const[Z,he]of Object.entries(f.labels)){const Ae=la(Z);_[Ae]!==he&&(_[Ae]=he,$=!0)}$&&(N.value=_,ia(_))}}catch{}}}async function Cr(){if(!(Object.keys(pe.value).length>0))try{const c=await $_();Object.keys(c.titles).length>0&&(pe.value=c.titles)}catch{}}async function Ar(c,f,m){if(pe.value[c])return;const _=f.trim();if(!_)return;const $=_.length>300?_.slice(0,300):_;try{const Z=await D_($,m);if(!Z||pe.value[c])return;pe.value={...pe.value,[c]:Z},Ke(),Yi(c,Z)}catch{}}async function on(){var c;et.value||(Pe.value=!0);try{const[f]=await Promise.all([m_(),Cr()]);await dn(f);const m=bo(D.value,f);Br(D.value,m)||(D.value=m,Yr(D.value));const _=aa(f,D.value),$=hA(t.value,_,a.value);t.value=ko(t.value,$),a.value=Ft(a.value,new Set(vr(t.value).map(Ae=>Ae.id))),Ke(),et.value=!0;const Z=vr(e.value);Et(Z),Z.some(Ae=>Ae.id===n.value)||U(((c=Z[0])==null?void 0:c.id)??"")}finally{Pe.value=!1}}async function wn(c,f={}){if(!c)return;const m=V.value[c]===!0,_=f.silent!==!0&&!m;_&&(Me.value=!0);try{B.value[c]!==!0&&(await Ki(c),B.value={...B.value,[c]:!0});const{messages:$,inProgress:Z}=await g_(c),he=r.value[c]??[],Ae=nA(he,$,{preserveMissing:f.silent===!0});xt(c,Ae);const Ee=s.value[c]??[],st=rA(Ee,$);ln(c,st),L(c,$),V.value={...V.value,[c]:!0};const ot=Gt(c);ot&&(P.value={...P.value,[c]:ot}),Ze(c,Z),Pt(c)}finally{_&&(Me.value=!1)}}async function Rr(){try{const c=t.value.flatMap(f=>f.threads.map(m=>m.cwd)).filter(Boolean);Q.value=await L_(c.length>0?[...new Set(c)]:void 0)}catch{}}async function ks(){Ne.value="";try{await on(),await Promise.all([Be(),qe(),Rr()]),await wn(n.value)}catch(c){Ne.value=c instanceof Error?c.message:"Unknown application error"}}async function mi(c){U(c);try{await wn(c)}catch(f){Ne.value=f instanceof Error?f.message:"Unknown application error"}}async function gi(c){try{await b_(c),await on(),n.value===c&&await wn(n.value)}catch(f){Ne.value=f instanceof Error?f.message:"Unknown application error"}}async function Ts(c,f){const m=f.trim();if(!(!c||!m))try{await __(c,m),pe.value={...pe.value,[c]:m},Ke(),Yi(c,m)}catch(_){Ne.value=_ instanceof Error?_.message:"Unknown application error"}}async function co(c,f=[],m=[],_="steer",$=[],Z){const he=n.value,Ae=c.trim();if(!he||!Ae&&f.length===0&&$.length===0)return;const Ee=a.value[he]===!0;if(Ee&&_==="queue"){const st=l.value[he]??[],ot=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,bn=[...st],_n=typeof Z=="number"?Math.max(0,Math.min(Z,bn.length)):bn.length;bn.splice(_n,0,{id:ot,text:Ae,imageUrls:f,skills:m,fileAttachments:$}),l.value={...l.value,[he]:bn};return}if(Ee){te=!0,Kr(he,Ae,f,m,$).catch(st=>{const ot=st instanceof Error?st.message:"Unknown application error";Je(he,ot),Ne.value=ot});return}Ne.value="",te=!0,St(he,null),mt(he,{label:"Thinking",details:xe(g.value,T.value)}),Je(he,null),Ze(he,!0);try{await Kr(he,Ae,f,m,$)}catch(st){te=!1,Ze(he,!1),mt(he,null);const ot=st instanceof Error?st.message:"Unknown application error";throw Je(he,ot),Ne.value=ot,st}}async function vi(c,f,m=[],_=[],$=[]){const Z=c.trim(),he=f.trim(),Ae=g.value.trim();if(!Z&&m.length===0&&$.length===0)return"";Te.value=!0,Ne.value="";let Ee="";try{try{Ee=await Xc(he||void 0,Ae||void 0)}catch(_n){if(Ae&&Ae!==gn&&_o(_n))await Y(),Ee=await Xc(he||void 0,gn);else throw _n}if(!Ee)return"";vt(Ee,he,Z||"[Image]"),B.value={...B.value,[Ee]:!0},U(Ee),te=!0,St(Ee,null),mt(Ee,{label:"Thinking",details:xe(g.value,T.value)}),Je(Ee,null),Ze(Ee,!0);const st=Ee,ot=he||null,bn=Z;return Kr(Ee,Z,m,_,$).catch(_n=>{te=!1,Ze(Ee,!1),mt(Ee,null);const ur=_n instanceof Error?_n.message:"Unknown application error";Je(Ee,ur),Ne.value=ur}).finally(()=>{Te.value=!1}),Ar(st,bn,ot),Ee}catch(st){te=!1,Ee&&(Ze(Ee,!1),mt(Ee,null));const ot=st instanceof Error?st.message:"Unknown application error";throw Ee&&Je(Ee,ot),Ne.value=ot,Te.value=!1,st}}async function Kr(c,f,m=[],_=[],$=[]){const Z=g.value.trim(),he=T.value,Ae=f.trim(),Ee=_.map(ot=>({name:ot.name,path:ot.path})),st=$.map(ot=>({...ot}));K(c,{text:Ae,imageUrls:[...m],skills:Ee,fileAttachments:st,effort:he,fallbackRetried:!1});try{B.value[c]!==!0&&await Ki(c);try{await Ji(c,f,m,Z||void 0,he||void 0,_.length>0?_:void 0,$)}catch(ot){if(Z&&Z!==gn&&_o(ot))await Y(),K(c,{text:Ae,imageUrls:[...m],skills:Ee,fileAttachments:st,effort:he,fallbackRetried:!0}),await Ji(c,f,m,gn,he||void 0,_.length>0?_:void 0,$);else throw ot}B.value={...B.value,[c]:!0},W.add(c),We=!0,await pn()}catch(ot){throw ot}}async function uo(c){if(d.value[c]===!0)return;const f=l.value[c];if(!f||f.length===0)return;d.value={...d.value,[c]:!0};const[m,..._]=f;l.value=_.length>0?{...l.value,[c]:_}:Dt(l.value,c),Te.value=!0,Ne.value="",te=!0,St(c,null),mt(c,{label:"Thinking",details:xe(g.value,T.value)}),Je(c,null),Ze(c,!0);try{await Kr(c,m.text,m.imageUrls,m.skills,m.fileAttachments)}catch{Ze(c,!1),mt(c,null)}finally{d.value=Dt(d.value,c),Te.value=!1}}async function yi(){const c=n.value;if(!c||a.value[c]!==!0)return;const f=_e.value[c];$e.value=!0,Ne.value="";try{await S_(c,f),Ze(c,!1),mt(c,null),Je(c,null),_e.value[c]&&(_e.value=Dt(_e.value,c)),W.add(c),We=!0,await pn()}catch(m){const _=m instanceof Error?m.message:"Failed to interrupt active turn";Je(c,_),Ne.value=_}finally{$e.value=!1}}async function wi(c){const f=n.value;if(!f||Se.value)return;const _=(r.value[f]??[]).reduce((Z,he)=>typeof he.turnIndex=="number"&&he.turnIndex>Z?he.turnIndex:Z,-1);if(_<0||c>_)return;const $=_-c+1;if(!($<1)){Se.value=!0,Ne.value="";try{const Z=await Yc(f,$);xt(f,Z),ln(f,[]),jt(f),i.value[f]&&(i.value=Dt(i.value,f)),St(f,null),mt(f,null),Je(f,null),We=!0,await pn()}catch(Z){Ne.value=Z instanceof Error?Z.message:"Failed to rollback thread"}finally{Se.value=!1}}}function bi(c,f){c.length===0||(N.value[c]??"")===f||(N.value={...N.value,[c]:f},ia(N.value))}function _i(c){var $;if(c.length===0)return;const f=D.value.filter(Z=>Z!==c);if(Br(D.value,f)||(D.value=f,Yr(D.value)),t.value=t.value.filter(Z=>Z.projectName!==c),N.value[c]!==void 0){const Z={...N.value};delete Z[c],N.value=Z,ia(Z)}Ke();const m=vr(e.value);Et(m),m.some(Z=>Z.id===n.value)||U((($=m[0])==null?void 0:$.id)??""),Pr()}function ki(c,f){if(c.length===0||t.value.length===0)return;const m=t.value.map(Ee=>Ee.projectName),_=m.indexOf(c);if(_===-1)return;const $=Math.max(0,Math.min(f,m.length-1)),Z=eA(m,_,$);if(Z===m)return;const he=bo(Z,t.value);D.value=he,Yr(D.value);const Ae=aa(t.value,D.value);t.value=ko(t.value,Ae),Ke(),Pr()}function Ti(c){const f=c.trim();if(!f)return;const m=[f,...D.value.filter($=>$!==f)];if(Br(D.value,m))return;D.value=m,Yr(D.value);const _=aa(t.value,D.value);t.value=ko(t.value,_),Ke(),Pr()}async function Pr(){var c,f;try{const m=await Ra(),_=new Map;for(const he of m.order){const Ae=la(he);_.has(Ae)||_.set(Ae,he)}for(const he of t.value){const Ae=((f=(c=he.threads[0])==null?void 0:c.cwd)==null?void 0:f.trim())??"";Ae&&_.set(he.projectName,Ae)}const $=[];for(const he of D.value){const Ae=_.get(he);Ae&&!$.includes(Ae)&&$.push(Ae)}for(const he of m.order)$.includes(he)||$.push(he);const Z=m.active.filter(he=>$.includes(he));Z.length===0&&$.length>0&&Z.push($[0]),await x_({order:$,labels:m.labels,active:Z})}catch{}}async function pn(){if(Ye.value){typeof window<"u"&&Xe===null&&(Xe=window.setTimeout(()=>{Xe=null,pn()},sa));return}Ye.value=!0;const c=We,f=new Set(W);We=!1,W.clear();try{c&&await on();const m=n.value;if(!m)return;const _=f.has(m),$=a.value[m]===!0,Z=Gt(m),he=P.value[m]??"",Ae=Z.length>0&&Z!==he;(_||$||Ae||c)&&await wn(m,{silent:!0})}catch{}finally{Ye.value=!1,(We||W.size>0)&&typeof window<"u"&&Xe===null&&(Xe=window.setTimeout(()=>{Xe=null,pn()},sa))}}function Si(){typeof window>"u"||Qe||(Ii(),Qe=v_(c=>{Fe(c),At(c)}))}async function Ii(){try{const c=await w_();for(const f of c){const m=Ce(f);m&&ve(m)}}catch{}}async function Ei(c){try{await y_(c.id,{result:c.result,error:c.error}),R(c.id)}catch(f){Ne.value=f instanceof Error?f.message:"Failed to reply to server request"}}function Ci(){Qe&&(Qe(),Qe=null),We=!1,W.clear(),be.clear(),Xe!==null&&typeof window<"u"&&(window.clearTimeout(Xe),Xe=null),tt!==null&&typeof window<"u"&&(window.clearTimeout(tt),tt=null),te=!1,r.value={},s.value={},o.value={},i.value={},de.value={},ce.value={},me.value={},_e.value={},l.value={},d.value={}}const fo=ue(()=>{const c=n.value;return c?l.value[c]??[]:[]});function ho(c){const f=n.value;if(!f)return;const m=l.value[f];if(!m)return;const _=m.filter($=>$.id!==c);l.value=_.length>0?{...l.value,[f]:_}:Dt(l.value,f)}function S(c){const f=n.value;if(!f)return;const m=l.value[f];if(!m)return;const _=m.find($=>$.id===c);_&&(ho(c),co(_.text,_.imageUrls,_.skills,"steer",_.fileAttachments))}return{projectGroups:e,projectDisplayNameById:N,selectedThread:b,selectedThreadScrollState:A,selectedThreadServerRequests:J,selectedLiveOverlay:z,selectedThreadId:n,availableModelIds:h,selectedModelId:g,selectedReasoningEffort:T,installedSkills:Q,accountRateLimitSnapshots:ke,messages:x,isLoadingThreads:Pe,isLoadingMessages:Me,isSendingMessage:Te,isInterruptingTurn:$e,error:Ne,refreshAll:ks,refreshSkills:Rr,selectThread:mi,setThreadScrollState:rn,archiveThreadById:gi,renameThreadById:Ts,sendMessageToSelectedThread:co,sendMessageToNewThread:vi,interruptSelectedThreadTurn:yi,rollbackSelectedThread:wi,isRollingBack:Se,selectedThreadQueuedMessages:fo,removeQueuedMessage:ho,steerQueuedMessage:S,setSelectedModelId:G,setSelectedReasoningEffort:ge,respondToPendingServerRequest:Ei,renameProject:bi,removeProject:_i,reorderProject:ki,pinProjectToTop:Ti,startPolling:Si,stopPolling:Ci}}const vA={class:"sidebar-root"},yA={class:"sidebar-scrollable"},wA=["aria-pressed"],bA={key:1,class:"sidebar-search-bar"},_A={key:0,class:"sidebar-settings-area"},kA={key:0,class:"sidebar-settings-panel"},TA={class:"sidebar-settings-value"},SA={class:"sidebar-settings-value"},IA={class:"sidebar-settings-row sidebar-settings-row--select"},EA={class:"sidebar-settings-rate-limits"},CA={class:"content-root"},AA={class:"content-body"},RA={key:1,class:"content-grid"},PA={class:"new-thread-empty"},xA={class:"worktree-init-status-title"},MA={class:"worktree-init-status-message"},OA={key:2,class:"content-grid"},NA={class:"content-thread"},$A={class:"composer-with-queue"},DA={class:"build-badge","aria-label":"Worktree name and version"},Du="codex-web-local.sidebar-collapsed.v1",Lu="codex-web-local.send-with-enter.v1",ju="codex-web-local.in-progress-send-mode.v1",Uu="codex-web-local.dark-mode.v1",Bu="codex-web-local.dictation-click-to-toggle.v1",Fu="codex-web-local.dictation-auto-send.v1",Hu="codex-web-local.dictation-language.v1",LA=Nt({__name:"App",setup(e){const t="9ac6",n="0.1.48",r={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:s,projectDisplayNameById:o,selectedThread:i,selectedThreadScrollState:a,selectedThreadServerRequests:l,selectedLiveOverlay:d,selectedThreadId:u,availableModelIds:h,selectedModelId:g,selectedReasoningEffort:T,installedSkills:H,accountRateLimitSnapshots:M,messages:D,isLoadingThreads:N,isLoadingMessages:P,isInterruptingTurn:V,refreshAll:B,refreshSkills:ce,selectThread:de,setThreadScrollState:me,archiveThreadById:_e,renameThreadById:ne,sendMessageToSelectedThread:ie,sendMessageToNewThread:pe,interruptSelectedThreadTurn:Q,rollbackSelectedThread:ke,isRollingBack:Pe,selectedThreadQueuedMessages:Me,removeQueuedMessage:Te,steerQueuedMessage:$e,setSelectedModelId:Se,setSelectedReasoningEffort:Ne,respondToPendingServerRequest:Ye,renameProject:et,removeProject:Qe,reorderProject:Xe,pinProjectToTop:tt,startPolling:ct,stopPolling:We}=gA(),W=ev(),le=Zg(),{isMobile:te}=yf(),be=j(null),Le=j(null),v=j(!1),b=j(!1),A=j(""),J=j("local"),z=j({order:[],labels:{}}),x=j({phase:"idle",title:"",message:""}),U=j(Si()),G=j(""),Y=j(!1),K=j(null),ye=j(null);let fe=null;const ge=j("New Project (1)"),xe=j(""),Be=j(!1),qe=j(Ts(Lu,!0)),He=j(vi()),nt=j(co()),Ke=j(Ts(Bu,!1)),vt=j(null);let Et=0;const Pt=j(Ts(Fu,!0)),St=j(ki()),Ze=ue(()=>Ti()),kt=ue(()=>{const S=W.params.threadId;return typeof S=="string"?S:""}),mt=ue(()=>{const S=new Set;for(const c of s.value)for(const f of c.threads)S.add(f.id);return S}),Je=ue(()=>W.name==="home"),Gt=ue(()=>W.name==="skills"),rn=ue(()=>{var S;return Gt.value?"Skills":Je.value?"New thread":((S=i.value)==null?void 0:S.title)??"Choose a thread"}),xt=ue(()=>D.value.filter(S=>{const c=Ei(S.messageType,S.role);return c==="worked"?!0:!(c==="turnActivity.live"||c==="turnError.live"||c==="agentReasoning.live")})),ln=ue(()=>{let S=-1;for(const c of D.value)c.role==="user"&&typeof c.turnIndex=="number"&&c.turnIndex>S&&(S=c.turnIndex);return S}),cn=ue(()=>d.value),Kt=ue(()=>Je.value?"__new-thread__":u.value),Lt=ue(()=>{var S,c;return Je.value?A.value.trim():((c=(S=i.value)==null?void 0:S.cwd)==null?void 0:c.trim())??""}),jt=ue(()=>{var S;return!Je.value&&((S=i.value)==null?void 0:S.inProgress)===!0}),De=ue(()=>{var m,_;const S=[],c=new Set;for(const $ of z.value.order){const Z=$.trim();!Z||c.has(Z)||(c.add(Z),S.push({value:Z,label:z.value.labels[Z]||At(Z)}))}for(const $ of s.value){const Z=((_=(m=$.threads[0])==null?void 0:m.cwd)==null?void 0:_.trim())??"";!Z||c.has(Z)||(c.add(Z),S.push({value:Z,label:o.value[$.projectName]??$.projectName}))}const f=A.value.trim();return f&&!c.has(f)&&S.unshift({value:f,label:At(f)}),S}),Ie=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;lr(()=>{window.addEventListener("keydown",sn),pn(),Ie==null||Ie.addEventListener("change",pn),Ci(),bs(),L(),ee(),E()}),oi(()=>{window.removeEventListener("keydown",sn),Ie==null||Ie.removeEventListener("change",pn),fe&&(clearTimeout(fe),fe=null),We()}),ht(G,S=>{const c=S.trim();if(fe&&(clearTimeout(fe),fe=null),!c){ye.value=null;return}fe=setTimeout(()=>{N_(c,1e3).then(f=>{G.value.trim()===c&&(ye.value=f.threadIds)}).catch(()=>{G.value.trim()===c&&(ye.value=null)})},220)});function Jt(){ce()}function yn(){Y.value=!Y.value,Y.value?Ut(()=>{var S;return(S=K.value)==null?void 0:S.focus()}):G.value=""}function w(){var S;G.value="",(S=K.value)==null||S.focus()}function I(S){S.key==="Escape"&&(Y.value=!1,G.value="")}function C(S){S&&(W.name==="thread"&&kt.value===S||(le.push({name:"thread",params:{threadId:S}}),te.value&&Ct(!0)))}async function q(S){S&&(u.value!==S&&(await de(S),await le.push({name:"thread",params:{threadId:S}})),await Ut(),Rr())}function oe(S){_e(S)}function ae(S){var m,_;const c=s.value.find($=>$.projectName===S),f=((_=(m=c==null?void 0:c.threads[0])==null?void 0:m.cwd)==null?void 0:_.trim())??"";f&&(A.value=f),te.value&&Ct(!0),!Je.value&&le.push({name:"home"})}function Ce(S){var m,_;const c=s.value.find($=>$.projectName===S),f=((_=(m=c==null?void 0:c.threads[0])==null?void 0:m.cwd)==null?void 0:_.trim())??"";!f||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(f)}`,"_blank","noopener,noreferrer")}function ve(){var c,f;const S=((f=(c=i.value)==null?void 0:c.cwd)==null?void 0:f.trim())??"";S&&(A.value=S),te.value&&Ct(!0),!Je.value&&le.push({name:"home"})}function R(S){et(S.projectName,S.displayName)}function F(S){ne(S.threadId,S.title)}function X(S){Qe(S)}function Oe(S){Xe(S.projectName,S.toIndex)}function yt(S){me(S.threadId,S.state)}function un(S){Ye(S)}function Ct(S){U.value!==S&&(U.value=S,Ii(S))}function sn(S){S.defaultPrevented||!S.ctrlKey&&!S.metaKey||S.shiftKey||S.altKey||S.key.toLowerCase()==="b"&&(S.preventDefault(),Ct(!U.value))}function $t(S){const c=S.text,f=Le.value,m=S.mode==="queue"&&f&&f.threadId===u.value?f.queueIndex:void 0;if(Le.value=null,Je.value){ho(c,S.imageUrls,S.skills,S.fileAttachments);return}if(S.rollbackLatestUserTurn===!0){hn(S);return}ie(c,S.imageUrls,S.skills,S.mode,S.fileAttachments,m)}function Pn(S){const c=Me.value.findIndex($=>$.id===S),f=c>=0?Me.value[c]:void 0,m=be.value;if(!f||!m||m.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Le.value=u.value?{threadId:u.value,queueIndex:c}:null;const _={text:f.text,imageUrls:[...f.imageUrls],fileAttachments:f.fileAttachments.map($=>({...$})),skills:f.skills.map($=>({...$}))};m.hydrateDraft(_),Te(S)}async function hn(S){jt.value&&await Q();const c=ln.value;c>=0&&await ke(c),await ie(S.text,S.imageUrls,S.skills,"steer",S.fileAttachments)}function ys(S){A.value=S.trim()}async function ws(S){const c=S.trim();if(!c)return;const f=_s(c),m=await Er(),_=f?c:dn(m,c);if(_)try{const $=await Zc(_,{createIfMissing:!f,label:f?"":c});$&&(A.value=$,tt(At($)),ee(),E())}catch{}}async function bs(){var c;if(typeof window>"u")return;const S=((c=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:c.trim())??"";if(S)try{const f=await Zc(S,{createIfMissing:!1,label:""});if(!f)return;A.value=f,tt(At(f)),await le.replace({name:"home"}),await ee();const m=new URL(window.location.href);m.searchParams.delete("openProjectPath"),window.history.replaceState({},"",m.toString())}catch{}}async function Er(){const S=O();if(S)return S;try{const c=await Qc();if(c)return xe.value=c,c}catch{}return""}function _s(S){return S?S.startsWith("~/")||S.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(S):!1}async function E(){const S=O();if(!S){ge.value="New Project (1)";return}try{const c=await M_(S);ge.value=c.name||"New Project (1)"}catch{ge.value="New Project (1)"}}function O(){var f,m;const S=A.value.trim();if(S)return Fe(S);const c=((m=(f=De.value[0])==null?void 0:f.value)==null?void 0:m.trim())??"";return c?Fe(c):xe.value.trim()}async function L(){try{xe.value=await Qc()}catch{xe.value=""}}async function ee(){try{const S=await Ra();z.value={order:[...S.order],labels:{...S.labels}}}catch{z.value={order:[],labels:{}}}}function Fe(S){const c=S.trim().replace(/\/+$/,"");if(!c)return"";const f=c.lastIndexOf("/");return f<=0?"":c.slice(0,f)}function At(S){const c=S.trim().replace(/\/+$/,"");if(!c)return"";const f=c.lastIndexOf("/");return f<0?c:c.slice(f+1)}function dn(S,c){const f=S.trim().replace(/\/+$/,""),m=c.trim().replace(/^\/+/,"");return!f||!m?"":`${f}/${m}`}function Cr(S){Se(S)}function Ar(S){Ne(S)}function on(){Q()}function wn(S){var f;const c=((f=S.prependText)==null?void 0:f.trim())??"";c.length>0&&(Et+=1,vt.value={id:Et,text:c}),ke(S.turnIndex)}function Rr(){if(Je.value||Gt.value||typeof document>"u"||!i.value||xt.value.length===0)return;const S=ks(),c=mi(),f=new Blob([S],{type:"text/markdown;charset=utf-8"}),m=URL.createObjectURL(f),_=document.createElement("a");_.href=m,_.download=c,document.body.appendChild(_),_.click(),document.body.removeChild(_),window.setTimeout(()=>URL.revokeObjectURL(m),0)}function ks(){var f,m,_;const S=[],c=((m=(f=i.value)==null?void 0:f.title)==null?void 0:m.trim())||"Untitled thread";S.push(`# ${gi(c)}`),S.push(""),S.push(`- Exported: ${new Date().toISOString()}`),S.push(`- Thread ID: ${((_=i.value)==null?void 0:_.id)??""}`),S.push(""),S.push("---"),S.push("");for(const $ of xt.value){const Z=$.role?$.role.toUpperCase():"MESSAGE";S.push(`## ${Z}`),S.push("");const he=$.text.trim();if(he&&(S.push(he),S.push("")),$.commandExecution&&(S.push("```text"),S.push(`command: ${$.commandExecution.command}`),S.push(`status: ${$.commandExecution.status}`),$.commandExecution.cwd&&S.push(`cwd: ${$.commandExecution.cwd}`),$.commandExecution.exitCode!==null&&S.push(`exitCode: ${$.commandExecution.exitCode}`),S.push($.commandExecution.aggregatedOutput||"(no output)"),S.push("```"),S.push("")),$.fileAttachments&&$.fileAttachments.length>0){S.push("Attachments:");for(const Ae of $.fileAttachments)S.push(`- ${Ae.path}`);S.push("")}if($.images&&$.images.length>0){S.push("Images:");for(const Ae of $.images)S.push(`- ${Ae}`);S.push("")}}return`${S.join(`
1427
- `).trimEnd()}
1428
- `}function mi(){var _,$;const f=((($=(_=i.value)==null?void 0:_.title)==null?void 0:$.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",m=new Date().toISOString().replace(/[:.]/g,"-");return`${f}-${m}.md`}function gi(S){return S.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Ts(S,c){if(typeof window>"u")return c;const f=window.localStorage.getItem(S);return f===null?c:f==="1"}function co(){if(typeof window>"u")return"system";const S=window.localStorage.getItem(Uu);return S==="light"||S==="dark"?S:"system"}function vi(){return typeof window>"u"?"steer":window.localStorage.getItem(ju)==="queue"?"queue":"steer"}function Kr(){qe.value=!qe.value,window.localStorage.setItem(Lu,qe.value?"1":"0")}function uo(){He.value=He.value==="steer"?"queue":"steer",window.localStorage.setItem(ju,He.value)}function yi(){const S=["system","light","dark"],c=S.indexOf(nt.value);nt.value=S[(c+1)%S.length],window.localStorage.setItem(Uu,nt.value),pn()}function wi(){Ke.value=!Ke.value,window.localStorage.setItem(Bu,Ke.value?"1":"0")}function bi(){Pt.value=!Pt.value,window.localStorage.setItem(Fu,Pt.value?"1":"0")}function _i(S){const f=Pr(S.trim())||"auto";St.value=f,window.localStorage.setItem(Hu,f)}function ki(){var f;if(typeof window>"u")return"auto";const S=((f=window.localStorage.getItem(Hu))==null?void 0:f.trim())||"auto";return Pr(S)||"auto"}function Ti(){const S=[{value:"auto",label:"Auto-detect"}],c=new Set(["auto"]);function f(_){const $=r[_]||_;return`${$.charAt(0).toUpperCase()+$.slice(1)} (${_})`}for(const _ of typeof navigator<"u"?navigator.languages??[]:[]){const $=Pr(_);!$||c.has($)||(c.add($),S.push({value:$,label:`Preferred: ${f($)}`}))}for(const _ of Object.keys(r))c.has(_)||(c.add(_),S.push({value:_,label:f(_)}));const m=St.value.trim();return m&&!c.has(m)&&S.push({value:m,label:f(m)}),S}function Pr(S){const c=S.trim().toLowerCase();if(!c||c==="auto")return"";if(c in r)return c;const f=c.split("-")[0]??c;return f in r?f:""}function pn(){const S=document.documentElement;if(nt.value==="dark")S.classList.add("dark");else if(nt.value==="light")S.classList.remove("dark");else{const c=window.matchMedia("(prefers-color-scheme: dark)").matches;S.classList.toggle("dark",c)}}function Si(){return typeof window>"u"?!1:window.localStorage.getItem(Du)==="1"}function Ii(S){typeof window>"u"||window.localStorage.setItem(Du,S?"1":"0")}function Ei(S,c){const f=(S??"").trim();return f.length>0?f:c.trim()||"message"}async function Ci(){await B(),b.value=!0,await fo(),ct()}async function fo(){if(!v.value){v.value=!0;try{if(W.name==="home"||W.name==="skills"){u.value!==""&&await de("");return}if(W.name==="thread"){const S=kt.value;if(!S)return;if(!mt.value.has(S)){await le.replace({name:"home"});return}u.value!==S&&await de(S);return}}finally{v.value=!1}}}ht(()=>[W.name,kt.value,N.value,mt.value.has(kt.value),u.value],async()=>{b.value&&await fo()}),ht(()=>u.value,async S=>{if(b.value&&!v.value&&!(Je.value||Gt.value)){if(!S){W.name!=="home"&&await le.replace({name:"home"});return}W.name==="thread"&&kt.value===S||await le.replace({name:"thread",params:{threadId:S}})}}),ht(()=>De.value,S=>{if(S.length===0){A.value="";return}S.some(f=>f.value===A.value)||(A.value=S[0].value),E()},{immediate:!0}),ht(()=>A.value,()=>{x.value={phase:"idle",title:"",message:""},E()}),ht(()=>J.value,S=>{S==="local"&&(x.value={phase:"idle",title:"",message:""})}),ht(()=>W.name,S=>{S!=="home"&&(x.value={phase:"idle",title:"",message:""})}),ht(()=>u.value,()=>{x.value={phase:"idle",title:"",message:""}}),ht(te,S=>{S&&!U.value&&Ct(!0)});async function ho(S,c=[],f=[],m=[]){try{x.value={phase:"idle",title:"",message:""};let _=A.value;if(J.value==="worktree"){x.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Z=await P_(A.value);_=Z.cwd,A.value=Z.cwd,x.value={phase:"idle",title:"",message:""}}catch{x.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const $=await pe(S,_,c,f,m);if(!$)return;await le.replace({name:"thread",params:{threadId:$}})}catch{}}return(S,c)=>(y(),k(je,null,[Re(iv,{"is-sidebar-collapsed":U.value,onCloseSidebar:c[6]||(c[6]=f=>Ct(!0))},{sidebar:gt(()=>[p("section",vA,[p("div",yA,[U.value?re("",!0):(y(),ft(xu,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":U.value,"show-new-thread-button":!0,onToggleSidebar:c[0]||(c[0]=f=>Ct(!U.value)),onStartNewThread:ve},{default:gt(()=>[p("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Y.value,"aria-label":"Search threads",title:"Search threads",onClick:yn},[Re(Pa,{class:"sidebar-search-toggle-icon"})],8,wA)]),_:1},8,["is-sidebar-collapsed"])),!U.value&&Y.value?(y(),k("div",bA,[Re(Pa,{class:"sidebar-search-bar-icon"}),rr(p("input",{ref_key:"sidebarSearchInputRef",ref:K,"onUpdate:modelValue":c[1]||(c[1]=f=>G.value=f),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:I},null,544),[[sr,G.value]]),G.value.length>0?(y(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:w},[Re(hl,{class:"sidebar-search-clear-icon"})])):re("",!0)])):re("",!0),U.value?re("",!0):(y(),k("button",{key:2,class:at(["sidebar-skills-link",{"is-active":Gt.value}]),type:"button",onClick:c[2]||(c[2]=f=>{we(le).push({name:"skills"}),we(te)&&Ct(!0)})}," Skills Hub ",2)),U.value?re("",!0):(y(),ft(Jy,{key:3,groups:we(s),"project-display-name-by-id":we(o),"selected-thread-id":we(u),"is-loading":we(N),"search-query":G.value,"search-matched-thread-ids":ye.value,onSelect:C,onArchive:oe,onStartNewThread:ae,onRenameProject:R,onBrowseProjectFiles:Ce,onRenameThread:F,onRemoveProject:X,onReorderProject:Oe,onExportThread:q},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),U.value?re("",!0):(y(),k("div",_A,[Re(sf,{name:"settings-panel"},{default:gt(()=>[Be.value?(y(),k("div",kA,[p("button",{class:"sidebar-settings-row",type:"button",onClick:Kr},[c[7]||(c[7]=p("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),p("span",{class:at(["sidebar-settings-toggle",{"is-on":!qe.value}])},null,2)]),p("button",{class:"sidebar-settings-row",type:"button",onClick:uo},[c[8]||(c[8]=p("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),p("span",TA,se(He.value==="steer"?"Steer":"Queue"),1)]),p("button",{class:"sidebar-settings-row",type:"button",onClick:yi},[c[9]||(c[9]=p("span",{class:"sidebar-settings-label"},"Appearance",-1)),p("span",SA,se(nt.value==="system"?"System":nt.value==="dark"?"Dark":"Light"),1)]),p("button",{class:"sidebar-settings-row",type:"button",onClick:wi},[c[10]||(c[10]=p("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),p("span",{class:at(["sidebar-settings-toggle",{"is-on":Ke.value}])},null,2)]),p("button",{class:"sidebar-settings-row",type:"button",onClick:bi},[c[11]||(c[11]=p("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),p("span",{class:at(["sidebar-settings-toggle",{"is-on":Pt.value}])},null,2)]),p("div",IA,[c[12]||(c[12]=p("span",{class:"sidebar-settings-label"},"Dictation language",-1)),Re(Ho,{class:"sidebar-settings-language-dropdown","model-value":St.value,options:Ze.value,placeholder:"Auto-detect","open-direction":"up","enable-search":!0,"search-placeholder":"Search language...","onUpdate:modelValue":_i},null,8,["model-value","options"])]),p("div",EA,[Re(C0,{snapshots:we(M)},null,8,["snapshots"])])])):re("",!0)]),_:1}),p("button",{class:"sidebar-settings-button",type:"button",onClick:c[3]||(c[3]=f=>Be.value=!Be.value)},[Re(WC,{class:"sidebar-settings-icon"}),c[13]||(c[13]=p("span",null,"Settings",-1))])]))])]),content:gt(()=>[p("section",CA,[Re(tw,{title:rn.value},{leading:gt(()=>[U.value||we(te)?(y(),ft(xu,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":U.value,"show-new-thread-button":!0,onToggleSidebar:c[4]||(c[4]=f=>Ct(!U.value)),onStartNewThread:ve},null,8,["is-sidebar-collapsed"])):re("",!0)]),_:1},8,["title"]),p("section",AA,[Gt.value?(y(),ft(RC,{key:0,onSkillsChanged:Jt})):Je.value?(y(),k("div",RA,[p("div",PA,[c[14]||(c[14]=p("p",{class:"new-thread-hero"},"Let's build",-1)),Re(Ho,{class:"new-thread-folder-dropdown","model-value":A.value,options:De.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":ge.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":ys,onAdd:ws},null,8,["model-value","options","default-add-value"]),Re($0,{class:"new-thread-runtime-dropdown",modelValue:J.value,"onUpdate:modelValue":c[5]||(c[5]=f=>J.value=f)},null,8,["modelValue"]),x.value.phase!=="idle"?(y(),k("div",{key:0,class:at(["worktree-init-status",{"is-running":x.value.phase==="running","is-error":x.value.phase==="error"}])},[p("strong",xA,se(x.value.title),1),p("span",MA,se(x.value.message),1)],2)):re("",!0)]),Re(nu,{"active-thread-id":Kt.value,cwd:Lt.value,models:we(h),"selected-model":we(g),"selected-reasoning-effort":we(T),skills:we(H),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":qe.value,"in-progress-submit-mode":He.value,"dictation-click-to-toggle":Ke.value,"dictation-auto-send":Pt.value,"prepend-draft-request":vt.value,"dictation-language":St.value,onSubmit:$t,"onUpdate:selectedModel":Cr,"onUpdate:selectedReasoningEffort":Ar},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","skills","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])):(y(),k("div",OA,[p("div",NA,[Re(Vb,{messages:xt.value,"is-loading":we(P),"active-thread-id":Kt.value,cwd:Lt.value,"scroll-state":we(a),"live-overlay":cn.value,"pending-requests":we(l),"is-turn-in-progress":jt.value,"is-rolling-back":we(Pe),onUpdateScrollState:yt,onRespondServerRequest:un,onRollback:wn},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),p("div",$A,[Re(y0,{messages:we(Me),onEdit:Pn,onSteer:we($e),onDelete:we(Te)},null,8,["messages","onSteer","onDelete"]),Re(nu,{ref_key:"threadComposerRef",ref:be,"active-thread-id":Kt.value,cwd:Lt.value,models:we(h),"selected-model":we(g),"selected-reasoning-effort":we(T),skills:we(H),"is-turn-in-progress":jt.value,"is-interrupting-turn":we(V),"has-queue-above":we(Me).length>0,"send-with-enter":qe.value,"in-progress-submit-mode":He.value,"dictation-click-to-toggle":Ke.value,"dictation-auto-send":Pt.value,"prepend-draft-request":vt.value,"dictation-language":St.value,onSubmit:$t,"onUpdate:selectedModel":Cr,"onUpdate:selectedReasoningEffort":Ar,onInterrupt:on},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","skills","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),p("div",DA," WT "+se(we(t))+" · v"+se(we(n)),1)],64))}}),jA=rt(LA,[["__scopeId","data-v-859922a1"]]),ca={render:()=>null},UA=Qg({history:Pg(),routes:[{path:"/",name:"home",component:ca},{path:"/thread/:threadId",name:"thread",component:ca},{path:"/skills",name:"skills",component:ca},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");Vm(jA).use(UA).mount("#app");