codexapp 0.1.42 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-B6BqKv1b.css +1 -0
- package/dist/assets/index-DFsz7W1m.js +50 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +447 -1269
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -2
- package/dist/assets/index-Dwgxc732.js +0 -1424
- package/dist/assets/index-eKA4YUIc.css +0 -1
|
@@ -1,1424 +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 xa(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const gt={},es=[],An=()=>{},Ru=()=>!1,Wo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Ma=e=>e.startsWith("onUpdate:"),At=Object.assign,Oa=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},oh=Object.prototype.hasOwnProperty,at=(e,t)=>oh.call(e,t),Le=Array.isArray,ts=e=>Zs(e)==="[object Map]",Pu=e=>Zs(e)==="[object Set]",_l=e=>Zs(e)==="[object Date]",We=e=>typeof e=="function",kt=e=>typeof e=="string",pn=e=>typeof e=="symbol",ct=e=>e!==null&&typeof e=="object",xu=e=>(ct(e)||We(e))&&We(e.then)&&We(e.catch),Mu=Object.prototype.toString,Zs=e=>Mu.call(e),ih=e=>Zs(e).slice(8,-1),Ou=e=>Zs(e)==="[object Object]",Na=e=>kt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ps=xa(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Go=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ah=/-\w/g,Kt=Go(e=>e.replace(ah,t=>t.slice(1).toUpperCase())),lh=/\B([A-Z])/g,br=Go(e=>e.replace(lh,"-$1").toLowerCase()),qo=Go(e=>e.charAt(0).toUpperCase()+e.slice(1)),yi=Go(e=>e?`on${qo(e)}`:""),In=(e,t)=>!Object.is(e,t),yo=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Nu=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},$a=e=>{const t=parseFloat(e);return isNaN(t)?e:t},ch=e=>{const t=kt(e)?Number(e):NaN;return isNaN(t)?e:t};let kl;const zo=()=>kl||(kl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Fr(e){if(Le(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=kt(r)?hh(r):Fr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(kt(e)||ct(e))return e}const uh=/;(?![^(]*\))/g,dh=/:([^]+)/,fh=/\/\*[^]*?\*\//g;function hh(e){const t={};return e.replace(fh,"").split(uh).forEach(n=>{if(n){const r=n.split(dh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function rt(e){let t="";if(kt(e))t=e;else if(Le(e))for(let n=0;n<e.length;n++){const r=rt(e[n]);r&&(t+=r+" ")}else if(ct(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const ph="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mh=xa(ph);function $u(e){return!!e||e===""}function gh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Da(e[r],t[r]);return n}function Da(e,t){if(e===t)return!0;let n=_l(e),r=_l(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=pn(e),r=pn(t),n||r)return e===t;if(n=Le(e),r=Le(t),n||r)return n&&r?gh(e,t):!1;if(n=ct(e),r=ct(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 l=e.hasOwnProperty(i),c=t.hasOwnProperty(i);if(l&&!c||!l&&c||!Da(e[i],t[i]))return!1}}return String(e)===String(t)}const Du=e=>!!(e&&e.__v_isRef===!0),ne=e=>kt(e)?e:e==null?"":Le(e)||ct(e)&&(e.toString===Mu||!We(e.toString))?Du(e)?ne(e.value):JSON.stringify(e,Lu,2):String(e),Lu=(e,t)=>Du(t)?Lu(e,t.value):ts(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[wi(r,o)+" =>"]=s,n),{})}:Pu(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>wi(n))}:pn(t)?wi(t):ct(t)&&!Le(t)&&!Ou(t)?String(t):t,wi=(e,t="")=>{var n;return pn(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 Zt;class vh{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=Zt,!t&&Zt&&(this.index=(Zt.scopes||(Zt.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=Zt;try{return Zt=this,t()}finally{Zt=n}}}on(){++this._on===1&&(this.prevScope=Zt,Zt=this)}off(){this._on>0&&--this._on===0&&(Zt=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 yh(){return Zt}let vt;const bi=new WeakSet;class ju{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,Zt&&Zt.active&&Zt.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,bi.has(this)&&(bi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Fu(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Tl(this),Uu(this);const t=vt,n=dn;vt=this,dn=!0;try{return this.fn()}finally{Hu(this),vt=t,dn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Ba(t);this.deps=this.depsTail=void 0,Tl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?bi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Qi(this)&&this.run()}get dirty(){return Qi(this)}}let Bu=0,xs,Ms;function Fu(e,t=!1){if(e.flags|=8,t){e.next=Ms,Ms=e;return}e.next=xs,xs=e}function La(){Bu++}function ja(){if(--Bu>0)return;if(Ms){let t=Ms;for(Ms=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;xs;){let t=xs;for(xs=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 Uu(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Hu(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Ba(r),wh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Qi(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Vu(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Vu(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||!Qi(e))))return;e.flags|=2;const t=e.dep,n=vt,r=dn;vt=e,dn=!0;try{Uu(e);const s=e.fn(e._value);(t.version===0||In(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{vt=n,dn=r,Hu(e),e.flags&=-3}}function Ba(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)Ba(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function wh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let dn=!0;const Wu=[];function Gn(){Wu.push(dn),dn=!1}function qn(){const e=Wu.pop();dn=e===void 0?!0:e}function Tl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=vt;vt=void 0;try{t()}finally{vt=n}}}let Bs=0;class bh{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 Fa{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(!vt||!dn||vt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==vt)n=this.activeLink=new bh(vt,this),vt.deps?(n.prevDep=vt.depsTail,vt.depsTail.nextDep=n,vt.depsTail=n):vt.deps=vt.depsTail=n,Gu(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=vt.depsTail,n.nextDep=void 0,vt.depsTail.nextDep=n,vt.depsTail=n,vt.deps===n&&(vt.deps=r)}return n}trigger(t){this.version++,Bs++,this.notify(t)}notify(t){La();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ja()}}}function Gu(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)Gu(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Zi=new WeakMap,Lr=Symbol(""),ea=Symbol(""),Fs=Symbol("");function Lt(e,t,n){if(dn&&vt){let r=Zi.get(e);r||Zi.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Fa),s.map=r,s.key=n),s.track()}}function Fn(e,t,n,r,s,o){const i=Zi.get(e);if(!i){Bs++;return}const l=c=>{c&&c.trigger()};if(La(),t==="clear")i.forEach(l);else{const c=Le(e),u=c&&Na(n);if(c&&n==="length"){const d=Number(r);i.forEach((h,g)=>{(g==="length"||g===Fs||!pn(g)&&g>=d)&&l(h)})}else switch((n!==void 0||i.has(void 0))&&l(i.get(n)),u&&l(i.get(Fs)),t){case"add":c?u&&l(i.get("length")):(l(i.get(Lr)),ts(e)&&l(i.get(ea)));break;case"delete":c||(l(i.get(Lr)),ts(e)&&l(i.get(ea)));break;case"set":ts(e)&&l(i.get(Lr));break}}ja()}function Jr(e){const t=st(e);return t===e?t:(Lt(t,"iterate",Fs),an(e)?t:t.map(mn))}function Ko(e){return Lt(e=st(e),"iterate",Fs),e}function kn(e,t){return zn(e)?cs(jr(e)?mn(t):t):mn(t)}const _h={__proto__:null,[Symbol.iterator](){return _i(this,Symbol.iterator,e=>kn(this,e))},concat(...e){return Jr(this).concat(...e.map(t=>Le(t)?Jr(t):t))},entries(){return _i(this,"entries",e=>(e[1]=kn(this,e[1]),e))},every(e,t){return $n(this,"every",e,t,void 0,arguments)},filter(e,t){return $n(this,"filter",e,t,n=>n.map(r=>kn(this,r)),arguments)},find(e,t){return $n(this,"find",e,t,n=>kn(this,n),arguments)},findIndex(e,t){return $n(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return $n(this,"findLast",e,t,n=>kn(this,n),arguments)},findLastIndex(e,t){return $n(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return $n(this,"forEach",e,t,void 0,arguments)},includes(...e){return ki(this,"includes",e)},indexOf(...e){return ki(this,"indexOf",e)},join(e){return Jr(this).join(e)},lastIndexOf(...e){return ki(this,"lastIndexOf",e)},map(e,t){return $n(this,"map",e,t,void 0,arguments)},pop(){return Ts(this,"pop")},push(...e){return Ts(this,"push",e)},reduce(e,...t){return Il(this,"reduce",e,t)},reduceRight(e,...t){return Il(this,"reduceRight",e,t)},shift(){return Ts(this,"shift")},some(e,t){return $n(this,"some",e,t,void 0,arguments)},splice(...e){return Ts(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 Ts(this,"unshift",e)},values(){return _i(this,"values",e=>kn(this,e))}};function _i(e,t,n){const r=Ko(e),s=r[t]();return r!==e&&!an(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const kh=Array.prototype;function $n(e,t,n,r,s,o){const i=Ko(e),l=i!==e&&!an(e),c=i[t];if(c!==kh[t]){const h=c.apply(e,o);return l?mn(h):h}let u=n;i!==e&&(l?u=function(h,g){return n.call(this,kn(e,h),g,e)}:n.length>2&&(u=function(h,g){return n.call(this,h,g,e)}));const d=c.call(i,u,r);return l&&s?s(d):d}function Il(e,t,n,r){const s=Ko(e),o=s!==e&&!an(e);let i=n,l=!1;s!==e&&(o?(l=r.length===0,i=function(u,d,h){return l&&(l=!1,u=kn(e,u)),n.call(this,u,kn(e,d),h,e)}):n.length>3&&(i=function(u,d,h){return n.call(this,u,d,h,e)}));const c=s[t](i,...r);return l?kn(e,c):c}function ki(e,t,n){const r=st(e);Lt(r,"iterate",Fs);const s=r[t](...n);return(s===-1||s===!1)&&Va(n[0])?(n[0]=st(n[0]),r[t](...n)):s}function Ts(e,t,n=[]){Gn(),La();const r=st(e)[t].apply(e,n);return ja(),qn(),r}const Th=xa("__proto__,__v_isRef,__isVue"),qu=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(pn));function Ih(e){pn(e)||(e=String(e));const t=st(this);return Lt(t,"has",e),t.hasOwnProperty(e)}class zu{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?Nh:Xu:o?Yu:Ju).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Le(t);if(!s){let c;if(i&&(c=_h[n]))return c;if(n==="hasOwnProperty")return Ih}const l=Reflect.get(t,n,Ft(t)?t:r);if((pn(n)?qu.has(n):Th(n))||(s||Lt(t,"get",n),o))return l;if(Ft(l)){const c=i&&Na(n)?l:l.value;return s&&ct(c)?na(c):c}return ct(l)?s?na(l):Jo(l):l}}class Ku extends zu{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Le(t)&&Na(n);if(!this._isShallow){const u=zn(o);if(!an(r)&&!zn(r)&&(o=st(o),r=st(r)),!i&&Ft(o)&&!Ft(r))return u||(o.value=r),!0}const l=i?Number(n)<t.length:at(t,n),c=Reflect.set(t,n,r,Ft(t)?t:s);return t===st(s)&&(l?In(r,o)&&Fn(t,"set",n,r):Fn(t,"add",n,r)),c}deleteProperty(t,n){const r=at(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Fn(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!pn(n)||!qu.has(n))&&Lt(t,"has",n),r}ownKeys(t){return Lt(t,"iterate",Le(t)?"length":Lr),Reflect.ownKeys(t)}}class Sh extends zu{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Eh=new Ku,Ch=new Sh,Ah=new Ku(!0);const ta=e=>e,lo=e=>Reflect.getPrototypeOf(e);function Rh(e,t,n){return function(...r){const s=this.__v_raw,o=st(s),i=ts(o),l=e==="entries"||e===Symbol.iterator&&i,c=e==="keys"&&i,u=s[e](...r),d=n?ta:t?cs:mn;return!t&&Lt(o,"iterate",c?ea:Lr),At(Object.create(u),{next(){const{value:h,done:g}=u.next();return g?{value:h,done:g}:{value:l?[d(h[0]),d(h[1])]:d(h),done:g}}})}}function co(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Ph(e,t){const n={get(s){const o=this.__v_raw,i=st(o),l=st(s);e||(In(s,l)&&Lt(i,"get",s),Lt(i,"get",l));const{has:c}=lo(i),u=t?ta:e?cs:mn;if(c.call(i,s))return u(o.get(s));if(c.call(i,l))return u(o.get(l));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&Lt(st(s),"iterate",Lr),s.size},has(s){const o=this.__v_raw,i=st(o),l=st(s);return e||(In(s,l)&&Lt(i,"has",s),Lt(i,"has",l)),s===l?o.has(s):o.has(s)||o.has(l)},forEach(s,o){const i=this,l=i.__v_raw,c=st(l),u=t?ta:e?cs:mn;return!e&&Lt(c,"iterate",Lr),l.forEach((d,h)=>s.call(o,u(d),u(h),i))}};return At(n,e?{add:co("add"),set:co("set"),delete:co("delete"),clear:co("clear")}:{add(s){const o=st(this),i=lo(o),l=st(s),c=!t&&!an(s)&&!zn(s)?l:s;return i.has.call(o,c)||In(s,c)&&i.has.call(o,s)||In(l,c)&&i.has.call(o,l)||(o.add(c),Fn(o,"add",c,c)),this},set(s,o){!t&&!an(o)&&!zn(o)&&(o=st(o));const i=st(this),{has:l,get:c}=lo(i);let u=l.call(i,s);u||(s=st(s),u=l.call(i,s));const d=c.call(i,s);return i.set(s,o),u?In(o,d)&&Fn(i,"set",s,o):Fn(i,"add",s,o),this},delete(s){const o=st(this),{has:i,get:l}=lo(o);let c=i.call(o,s);c||(s=st(s),c=i.call(o,s)),l&&l.call(o,s);const u=o.delete(s);return c&&Fn(o,"delete",s,void 0),u},clear(){const s=st(this),o=s.size!==0,i=s.clear();return o&&Fn(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Rh(s,e,t)}),n}function Ua(e,t){const n=Ph(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(at(n,s)&&s in r?n:r,s,o)}const xh={get:Ua(!1,!1)},Mh={get:Ua(!1,!0)},Oh={get:Ua(!0,!1)};const Ju=new WeakMap,Yu=new WeakMap,Xu=new WeakMap,Nh=new WeakMap;function $h(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Dh(e){return e.__v_skip||!Object.isExtensible(e)?0:$h(ih(e))}function Jo(e){return zn(e)?e:Ha(e,!1,Eh,xh,Ju)}function Qu(e){return Ha(e,!1,Ah,Mh,Yu)}function na(e){return Ha(e,!0,Ch,Oh,Xu)}function Ha(e,t,n,r,s){if(!ct(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Dh(e);if(o===0)return e;const i=s.get(e);if(i)return i;const l=new Proxy(e,o===2?r:n);return s.set(e,l),l}function jr(e){return zn(e)?jr(e.__v_raw):!!(e&&e.__v_isReactive)}function zn(e){return!!(e&&e.__v_isReadonly)}function an(e){return!!(e&&e.__v_isShallow)}function Va(e){return e?!!e.__v_raw:!1}function st(e){const t=e&&e.__v_raw;return t?st(t):e}function Lh(e){return!at(e,"__v_skip")&&Object.isExtensible(e)&&Nu(e,"__v_skip",!0),e}const mn=e=>ct(e)?Jo(e):e,cs=e=>ct(e)?na(e):e;function Ft(e){return e?e.__v_isRef===!0:!1}function $(e){return Zu(e,!1)}function jh(e){return Zu(e,!0)}function Zu(e,t){return Ft(e)?e:new Bh(e,t)}class Bh{constructor(t,n){this.dep=new Fa,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:st(t),this._value=n?t:mn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||an(t)||zn(t);t=r?t:st(t),In(t,n)&&(this._rawValue=t,this._value=r?t:mn(t),this.dep.trigger())}}function ge(e){return Ft(e)?e.value:e}const Fh={get:(e,t,n)=>t==="__v_raw"?e:ge(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return Ft(s)&&!Ft(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function ed(e){return jr(e)?e:new Proxy(e,Fh)}class Uh{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Fa(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)&&vt!==this)return Fu(this,!0),!0}get value(){const t=this.dep.track();return Vu(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Hh(e,t,n=!1){let r,s;return We(e)?r=e:(r=e.get,s=e.set),new Uh(r,s,n)}const uo={},Ao=new WeakMap;let xr;function Vh(e,t=!1,n=xr){if(n){let r=Ao.get(n);r||Ao.set(n,r=[]),r.push(e)}}function Wh(e,t,n=gt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:l,call:c}=n,u=z=>s?z:an(z)||s===!1||s===0?Un(z,1):Un(z);let d,h,g,k,j=!1,A=!1;if(Ft(e)?(h=()=>e.value,j=an(e)):jr(e)?(h=()=>u(e),j=!0):Le(e)?(A=!0,j=e.some(z=>jr(z)||an(z)),h=()=>e.map(z=>{if(Ft(z))return z.value;if(jr(z))return u(z);if(We(z))return c?c(z,2):z()})):We(e)?t?h=c?()=>c(e,2):e:h=()=>{if(g){Gn();try{g()}finally{qn()}}const z=xr;xr=d;try{return c?c(e,3,[k]):e(k)}finally{xr=z}}:h=An,t&&s){const z=h,ae=s===!0?1/0:s;h=()=>Un(z(),ae)}const B=yh(),Z=()=>{d.stop(),B&&B.active&&Oa(B.effects,d)};if(o&&t){const z=t;t=(...ae)=>{z(...ae),Z()}}let V=A?new Array(e.length).fill(uo):uo;const X=z=>{if(!(!(d.flags&1)||!d.dirty&&!z))if(t){const ae=d.run();if(s||j||(A?ae.some((ue,me)=>In(ue,V[me])):In(ae,V))){g&&g();const ue=xr;xr=d;try{const me=[ae,V===uo?void 0:A&&V[0]===uo?[]:V,k];V=ae,c?c(t,3,me):t(...me)}finally{xr=ue}}}else d.run()};return l&&l(X),d=new ju(h),d.scheduler=i?()=>i(X,!1):X,k=z=>Vh(z,!1,d),g=d.onStop=()=>{const z=Ao.get(d);if(z){if(c)c(z,4);else for(const ae of z)ae();Ao.delete(d)}},t?r?X(!0):V=d.run():i?i(X.bind(null,!0),!0):d.run(),Z.pause=d.pause.bind(d),Z.resume=d.resume.bind(d),Z.stop=Z,Z}function Un(e,t=1/0,n){if(t<=0||!ct(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Ft(e))Un(e.value,t,n);else if(Le(e))for(let r=0;r<e.length;r++)Un(e[r],t,n);else if(Pu(e)||ts(e))e.forEach(r=>{Un(r,t,n)});else if(Ou(e)){for(const r in e)Un(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Un(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 eo(e,t,n,r){try{return r?e(...r):e()}catch(s){Yo(s,t,n)}}function gn(e,t,n,r){if(We(e)){const s=eo(e,t,n,r);return s&&xu(s)&&s.catch(o=>{Yo(o,t,n)}),s}if(Le(e)){const s=[];for(let o=0;o<e.length;o++)s.push(gn(e[o],t,n,r));return s}}function Yo(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||gt;if(t){let l=t.parent;const c=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const d=l.ec;if(d){for(let h=0;h<d.length;h++)if(d[h](e,c,u)===!1)return}l=l.parent}if(o){Gn(),eo(o,null,10,[e,c,u]),qn();return}}Gh(e,n,s,r,i)}function Gh(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const qt=[];let bn=-1;const ns=[];let dr=null,Xr=0;const td=Promise.resolve();let Ro=null;function Jt(e){const t=Ro||td;return e?t.then(this?e.bind(this):e):t}function qh(e){let t=bn+1,n=qt.length;for(;t<n;){const r=t+n>>>1,s=qt[r],o=Us(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Wa(e){if(!(e.flags&1)){const t=Us(e),n=qt[qt.length-1];!n||!(e.flags&2)&&t>=Us(n)?qt.push(e):qt.splice(qh(t),0,e),e.flags|=1,nd()}}function nd(){Ro||(Ro=td.then(sd))}function zh(e){Le(e)?ns.push(...e):dr&&e.id===-1?dr.splice(Xr+1,0,e):e.flags&1||(ns.push(e),e.flags|=1),nd()}function Sl(e,t,n=bn+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 rd(e){if(ns.length){const t=[...new Set(ns)].sort((n,r)=>Us(n)-Us(r));if(ns.length=0,dr){dr.push(...t);return}for(dr=t,Xr=0;Xr<dr.length;Xr++){const n=dr[Xr];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}dr=null,Xr=0}}const Us=e=>e.id==null?e.flags&2?-1:1/0:e.id;function sd(e){try{for(bn=0;bn<qt.length;bn++){const t=qt[bn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),eo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;bn<qt.length;bn++){const t=qt[bn];t&&(t.flags&=-2)}bn=-1,qt.length=0,rd(),Ro=null,(qt.length||ns.length)&&sd()}}let Nt=null,od=null;function Po(e){const t=Nt;return Nt=e,od=e&&e.type.__scopeId||null,t}function ht(e,t=Nt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&No(-1);const o=Po(t);let i;try{i=e(...s)}finally{Po(o),r._d&&No(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Kn(e,t){if(Nt===null)return e;const n=ni(Nt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,l,c=gt]=t[s];o&&(We(o)&&(o={mounted:o,updated:o}),o.deep&&Un(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:l,modifiers:c}))}return e}function Er(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const l=s[i];o&&(l.oldValue=o[i].value);let c=l.dir[r];c&&(Gn(),gn(c,n,8,[e.el,l,e,t]),qn())}}function wo(e,t){if(Bt){let n=Bt.provides;const r=Bt.parent&&Bt.parent.provides;r===n&&(n=Bt.provides=Object.create(r)),n[e]=t}}function fn(e,t,n=!1){const r=Ja();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&&We(t)?t.call(r&&r.proxy):t}}const Kh=Symbol.for("v-scx"),Jh=()=>fn(Kh);function pt(e,t,n){return id(e,t,n)}function id(e,t,n=gt){const{immediate:r,deep:s,flush:o,once:i}=n,l=At({},n),c=t&&r||!t&&o!=="post";let u;if(qs){if(o==="sync"){const k=Jh();u=k.__watcherHandles||(k.__watcherHandles=[])}else if(!c){const k=()=>{};return k.stop=An,k.resume=An,k.pause=An,k}}const d=Bt;l.call=(k,j,A)=>gn(k,d,j,A);let h=!1;o==="post"?l.scheduler=k=>{Dt(k,d&&d.suspense)}:o!=="sync"&&(h=!0,l.scheduler=(k,j)=>{j?k():Wa(k)}),l.augmentJob=k=>{t&&(k.flags|=4),h&&(k.flags|=2,d&&(k.id=d.uid,k.i=d))};const g=Wh(e,t,l);return qs&&(u?u.push(g):c&&g()),g}function Yh(e,t,n){const r=this.proxy,s=kt(e)?e.includes(".")?ad(r,e):()=>r[e]:e.bind(r,r);let o;We(t)?o=t:(o=t.handler,n=t);const i=to(this),l=id(s,o.bind(r),n);return i(),l}function ad(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 ld=Symbol("_vte"),cd=e=>e.__isTeleport,Os=e=>e&&(e.disabled||e.disabled===""),El=e=>e&&(e.defer||e.defer===""),Cl=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Al=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,ra=(e,t)=>{const n=e&&e.to;return kt(n)?t?t(n):null:n},ud={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,l,c,u){const{mc:d,pc:h,pbc:g,o:{insert:k,querySelector:j,createText:A,createComment:B}}=u,Z=Os(t.props);let{shapeFlag:V,children:X,dynamicChildren:z}=t;if(e==null){const ae=t.el=A(""),ue=t.anchor=A("");k(ae,n,r),k(ue,n,r);const me=(oe,ee)=>{V&16&&d(X,oe,ee,s,o,i,l,c)},be=()=>{const oe=t.target=ra(t.props,j),ee=sa(oe,t,A,k);oe&&(i!=="svg"&&Cl(oe)?i="svg":i!=="mathml"&&Al(oe)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(oe),Z||(me(oe,ee),bo(t,!1)))};Z&&(me(n,ue),bo(t,!0)),El(t.props)?(t.el.__isMounted=!1,Dt(()=>{be(),delete t.el.__isMounted},o)):be()}else{if(El(t.props)&&e.el.__isMounted===!1){Dt(()=>{ud.process(e,t,n,r,s,o,i,l,c,u)},o);return}t.el=e.el,t.targetStart=e.targetStart;const ae=t.anchor=e.anchor,ue=t.target=e.target,me=t.targetAnchor=e.targetAnchor,be=Os(e.props),oe=be?n:ue,ee=be?ae:me;if(i==="svg"||Cl(ue)?i="svg":(i==="mathml"||Al(ue))&&(i="mathml"),z?(g(e.dynamicChildren,z,oe,s,o,i,l),za(e,t,!0)):c||h(e,t,oe,ee,s,o,i,l,!1),Z)be?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):fo(t,n,ae,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const te=t.target=ra(t.props,j);te&&fo(t,te,null,u,0)}else be&&fo(t,ue,me,u,1);bo(t,Z)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:l,anchor:c,targetStart:u,targetAnchor:d,target:h,props:g}=e;if(h&&(s(u),s(d)),o&&s(c),i&16){const k=o||!Os(g);for(let j=0;j<l.length;j++){const A=l[j];r(A,t,n,k,!!A.dynamicChildren)}}},move:fo,hydrate:Xh};function fo(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:l,shapeFlag:c,children:u,props:d}=e,h=o===2;if(h&&r(i,t,n),(!h||Os(d))&&c&16)for(let g=0;g<u.length;g++)s(u[g],t,n,2);h&&r(l,t,n)}function Xh(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:l,querySelector:c,insert:u,createText:d}},h){function g(B,Z){let V=Z;for(;V;){if(V&&V.nodeType===8){if(V.data==="teleport start anchor")t.targetStart=V;else if(V.data==="teleport anchor"){t.targetAnchor=V,B._lpa=t.targetAnchor&&i(t.targetAnchor);break}}V=i(V)}}function k(B,Z){Z.anchor=h(i(B),Z,l(B),n,r,s,o)}const j=t.target=ra(t.props,c),A=Os(t.props);if(j){const B=j._lpa||j.firstChild;t.shapeFlag&16&&(A?(k(e,t),g(j,B),t.targetAnchor||sa(j,t,d,u,l(e)===j?e:null)):(t.anchor=i(e),g(j,B),t.targetAnchor||sa(j,t,d,u),h(B&&i(B),t,j,n,r,s,o))),bo(t,A)}else A&&t.shapeFlag&16&&(k(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const xo=ud;function bo(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 sa(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[ld]=i,e&&(r(o,e,s),r(i,e,s)),i}const _n=Symbol("_leaveCb"),Is=Symbol("_enterCb");function Qh(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Zn(()=>{e.isMounted=!0}),er(()=>{e.isUnmounting=!0}),e}const sn=[Function,Array],dd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:sn,onEnter:sn,onAfterEnter:sn,onEnterCancelled:sn,onBeforeLeave:sn,onLeave:sn,onAfterLeave:sn,onLeaveCancelled:sn,onBeforeAppear:sn,onAppear:sn,onAfterAppear:sn,onAppearCancelled:sn},fd=e=>{const t=e.subTree;return t.component?fd(t.component):t},Zh={name:"BaseTransition",props:dd,setup(e,{slots:t}){const n=Ja(),r=Qh();return()=>{const s=t.default&&md(t.default(),!0);if(!s||!s.length)return;const o=hd(s),i=st(e),{mode:l}=i;if(r.isLeaving)return Ti(o);const c=Rl(o);if(!c)return Ti(o);let u=oa(c,i,r,n,h=>u=h);c.type!==jt&&Hs(c,u);let d=n.subTree&&Rl(n.subTree);if(d&&d.type!==jt&&!Or(d,c)&&fd(n).type!==jt){let h=oa(d,i,r,n);if(Hs(d,h),l==="out-in"&&c.type!==jt)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,d=void 0},Ti(o);l==="in-out"&&c.type!==jt?h.delayLeave=(g,k,j)=>{const A=pd(r,d);A[String(d.key)]=d,g[_n]=()=>{k(),g[_n]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{j(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return o}}};function hd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==jt){t=n;break}}return t}const ep=Zh;function pd(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 oa(e,t,n,r,s){const{appear:o,mode:i,persisted:l=!1,onBeforeEnter:c,onEnter:u,onAfterEnter:d,onEnterCancelled:h,onBeforeLeave:g,onLeave:k,onAfterLeave:j,onLeaveCancelled:A,onBeforeAppear:B,onAppear:Z,onAfterAppear:V,onAppearCancelled:X}=t,z=String(e.key),ae=pd(n,e),ue=(oe,ee)=>{oe&&gn(oe,r,9,ee)},me=(oe,ee)=>{const te=ee[1];ue(oe,ee),Le(oe)?oe.every(Y=>Y.length<=1)&&te():oe.length<=1&&te()},be={mode:i,persisted:l,beforeEnter(oe){let ee=c;if(!n.isMounted)if(o)ee=B||c;else return;oe[_n]&&oe[_n](!0);const te=ae[z];te&&Or(e,te)&&te.el[_n]&&te.el[_n](),ue(ee,[oe])},enter(oe){if(ae[z]===e)return;let ee=u,te=d,Y=h;if(!n.isMounted)if(o)ee=Z||u,te=V||d,Y=X||h;else return;let Ce=!1;oe[Is]=Oe=>{Ce||(Ce=!0,Oe?ue(Y,[oe]):ue(te,[oe]),be.delayedLeave&&be.delayedLeave(),oe[Is]=void 0)};const _e=oe[Is].bind(null,!1);ee?me(ee,[oe,_e]):_e()},leave(oe,ee){const te=String(e.key);if(oe[Is]&&oe[Is](!0),n.isUnmounting)return ee();ue(g,[oe]);let Y=!1;oe[_n]=_e=>{Y||(Y=!0,ee(),_e?ue(A,[oe]):ue(j,[oe]),oe[_n]=void 0,ae[te]===e&&delete ae[te])};const Ce=oe[_n].bind(null,!1);ae[te]=e,k?me(k,[oe,Ce]):Ce()},clone(oe){const ee=oa(oe,t,n,r,s);return s&&s(ee),ee}};return be}function Ti(e){if(Xo(e))return e=wr(e),e.children=null,e}function Rl(e){if(!Xo(e))return cd(e.type)&&e.children?hd(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&&We(n.default))return n.default()}}function Hs(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Hs(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 md(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const l=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===De?(i.patchFlag&128&&s++,r=r.concat(md(i.children,t,l))):(t||i.type!==jt)&&r.push(l!=null?wr(i,{key:l}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Rt(e,t){return We(e)?At({name:e.name},t,{setup:e}):e}function gd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Pl(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Mo=new WeakMap;function Ns(e,t,n,r,s=!1){if(Le(e)){e.forEach((A,B)=>Ns(A,t&&(Le(t)?t[B]:t),n,r,s));return}if(rs(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ns(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?ni(r.component):r.el,i=s?null:o,{i:l,r:c}=e,u=t&&t.r,d=l.refs===gt?l.refs={}:l.refs,h=l.setupState,g=st(h),k=h===gt?Ru:A=>Pl(d,A)?!1:at(g,A),j=(A,B)=>!(B&&Pl(d,B));if(u!=null&&u!==c){if(xl(t),kt(u))d[u]=null,k(u)&&(h[u]=null);else if(Ft(u)){const A=t;j(u,A.k)&&(u.value=null),A.k&&(d[A.k]=null)}}if(We(c))eo(c,l,12,[i,d]);else{const A=kt(c),B=Ft(c);if(A||B){const Z=()=>{if(e.f){const V=A?k(c)?h[c]:d[c]:j()||!e.k?c.value:d[e.k];if(s)Le(V)&&Oa(V,o);else if(Le(V))V.includes(o)||V.push(o);else if(A)d[c]=[o],k(c)&&(h[c]=d[c]);else{const X=[o];j(c,e.k)&&(c.value=X),e.k&&(d[e.k]=X)}}else A?(d[c]=i,k(c)&&(h[c]=i)):B&&(j(c,e.k)&&(c.value=i),e.k&&(d[e.k]=i))};if(i){const V=()=>{Z(),Mo.delete(e)};V.id=-1,Mo.set(e,V),Dt(V,n)}else xl(e),Z()}}}function xl(e){const t=Mo.get(e);t&&(t.flags|=8,Mo.delete(e))}zo().requestIdleCallback;zo().cancelIdleCallback;const rs=e=>!!e.type.__asyncLoader,Xo=e=>e.type.__isKeepAlive;function tp(e,t){vd(e,"a",t)}function np(e,t){vd(e,"da",t)}function vd(e,t,n=Bt){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Qo(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Xo(s.parent.vnode)&&rp(r,t,n,s),s=s.parent}}function rp(e,t,n,r){const s=Qo(t,e,r,!0);Zo(()=>{Oa(r[t],s)},n)}function Qo(e,t,n=Bt,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Gn();const l=to(n),c=gn(t,n,e,i);return l(),qn(),c});return r?s.unshift(o):s.push(o),o}}const Qn=e=>(t,n=Bt)=>{(!qs||e==="sp")&&Qo(e,(...r)=>t(...r),n)},sp=Qn("bm"),Zn=Qn("m"),op=Qn("bu"),ip=Qn("u"),er=Qn("bum"),Zo=Qn("um"),ap=Qn("sp"),lp=Qn("rtg"),cp=Qn("rtc");function up(e,t=Bt){Qo("ec",e,t)}const dp="components",yd=Symbol.for("v-ndc");function ia(e){return kt(e)?fp(dp,e,!1)||e:e||yd}function fp(e,t,n=!0,r=!1){const s=Nt||Bt;if(s){const o=s.type;{const l=Yp(o,!1);if(l&&(l===t||l===Kt(t)||l===qo(Kt(t))))return o}const i=Ml(s[e]||o[e],t)||Ml(s.appContext[e],t);return!i&&r?o:i}}function Ml(e,t){return e&&(e[t]||e[Kt(t)]||e[qo(Kt(t))])}function yt(e,t,n,r){let s;const o=n,i=Le(e);if(i||kt(e)){const l=i&&jr(e);let c=!1,u=!1;l&&(c=!an(e),u=zn(e),e=Ko(e)),s=new Array(e.length);for(let d=0,h=e.length;d<h;d++)s[d]=t(c?u?cs(mn(e[d])):mn(e[d]):e[d],d,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let l=0;l<e;l++)s[l]=t(l+1,l,void 0,o)}else if(ct(e))if(e[Symbol.iterator])s=Array.from(e,(l,c)=>t(l,c,void 0,o));else{const l=Object.keys(e);s=new Array(l.length);for(let c=0,u=l.length;c<u;c++){const d=l[c];s[c]=t(e[d],d,c,o)}}else s=[];return s}function Cn(e,t,n={},r,s){if(Nt.ce||Nt.parent&&rs(Nt.parent)&&Nt.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),w(),lt(De,null,[Ee("slot",n,r)],u?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),w();const i=o&&wd(o(n)),l=n.key||i&&i.key,c=lt(De,{key:(l&&!pn(l)?l:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),c}function wd(e){return e.some(t=>Ws(t)?!(t.type===jt||t.type===De&&!wd(t.children)):!0)?e:null}const aa=e=>e?Bd(e)?ni(e):aa(e.parent):null,$s=At(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=>aa(e.parent),$root:e=>aa(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>_d(e),$forceUpdate:e=>e.f||(e.f=()=>{Wa(e.update)}),$nextTick:e=>e.n||(e.n=Jt.bind(e.proxy)),$watch:e=>Yh.bind(e)}),Ii=(e,t)=>e!==gt&&!e.__isScriptSetup&&at(e,t),hp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:l,appContext:c}=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(Ii(r,t))return i[t]=1,r[t];if(s!==gt&&at(s,t))return i[t]=2,s[t];if(at(o,t))return i[t]=3,o[t];if(n!==gt&&at(n,t))return i[t]=4,n[t];la&&(i[t]=0)}}const u=$s[t];let d,h;if(u)return t==="$attrs"&&Lt(e.attrs,"get",""),u(e);if((d=l.__cssModules)&&(d=d[t]))return d;if(n!==gt&&at(n,t))return i[t]=4,n[t];if(h=c.config.globalProperties,at(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return Ii(s,t)?(s[t]=n,!0):r!==gt&&at(r,t)?(r[t]=n,!0):at(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}},l){let c;return!!(n[l]||e!==gt&&l[0]!=="$"&&at(e,l)||Ii(t,l)||at(o,l)||at(r,l)||at($s,l)||at(s.config.globalProperties,l)||(c=i.__cssModules)&&c[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:at(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function pp(){return mp().slots}function mp(e){const t=Ja();return t.setupContext||(t.setupContext=Ud(t))}function Ol(e){return Le(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let la=!0;function gp(e){const t=_d(e),n=e.proxy,r=e.ctx;la=!1,t.beforeCreate&&Nl(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:l,provide:c,inject:u,created:d,beforeMount:h,mounted:g,beforeUpdate:k,updated:j,activated:A,deactivated:B,beforeDestroy:Z,beforeUnmount:V,destroyed:X,unmounted:z,render:ae,renderTracked:ue,renderTriggered:me,errorCaptured:be,serverPrefetch:oe,expose:ee,inheritAttrs:te,components:Y,directives:Ce,filters:_e}=t;if(u&&vp(u,r,null),i)for(const ye in i){const Ie=i[ye];We(Ie)&&(r[ye]=Ie.bind(n))}if(s){const ye=s.call(n,n);ct(ye)&&(e.data=Jo(ye))}if(la=!0,o)for(const ye in o){const Ie=o[ye],ut=We(Ie)?Ie.bind(n,n):We(Ie.get)?Ie.get.bind(n,n):An,Ge=!We(Ie)&&We(Ie.set)?Ie.set.bind(n):An,He=ie({get:ut,set:Ge});Object.defineProperty(r,ye,{enumerable:!0,configurable:!0,get:()=>He.value,set:qe=>He.value=qe})}if(l)for(const ye in l)bd(l[ye],r,n,ye);if(c){const ye=We(c)?c.call(n):c;Reflect.ownKeys(ye).forEach(Ie=>{wo(Ie,ye[Ie])})}d&&Nl(d,e,"c");function Ae(ye,Ie){Le(Ie)?Ie.forEach(ut=>ye(ut.bind(n))):Ie&&ye(Ie.bind(n))}if(Ae(sp,h),Ae(Zn,g),Ae(op,k),Ae(ip,j),Ae(tp,A),Ae(np,B),Ae(up,be),Ae(cp,ue),Ae(lp,me),Ae(er,V),Ae(Zo,z),Ae(ap,oe),Le(ee))if(ee.length){const ye=e.exposed||(e.exposed={});ee.forEach(Ie=>{Object.defineProperty(ye,Ie,{get:()=>n[Ie],set:ut=>n[Ie]=ut,enumerable:!0})})}else e.exposed||(e.exposed={});ae&&e.render===An&&(e.render=ae),te!=null&&(e.inheritAttrs=te),Y&&(e.components=Y),Ce&&(e.directives=Ce),oe&&gd(e)}function vp(e,t,n=An){Le(e)&&(e=ca(e));for(const r in e){const s=e[r];let o;ct(s)?"default"in s?o=fn(s.from||r,s.default,!0):o=fn(s.from||r):o=fn(s),Ft(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function Nl(e,t,n){gn(Le(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function bd(e,t,n,r){let s=r.includes(".")?ad(n,r):()=>n[r];if(kt(e)){const o=t[e];We(o)&&pt(s,o)}else if(We(e))pt(s,e.bind(n));else if(ct(e))if(Le(e))e.forEach(o=>bd(o,t,n,r));else{const o=We(e.handler)?e.handler.bind(n):t[e.handler];We(o)&&pt(s,o,e)}}function _d(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,l=o.get(t);let c;return l?c=l:!s.length&&!n&&!r?c=t:(c={},s.length&&s.forEach(u=>Oo(c,u,i,!0)),Oo(c,t,i)),ct(t)&&o.set(t,c),c}function Oo(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Oo(e,o,n,!0),s&&s.forEach(i=>Oo(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const l=yp[i]||n&&n[i];e[i]=l?l(e[i],t[i]):t[i]}return e}const yp={data:$l,props:Dl,emits:Dl,methods:Rs,computed:Rs,beforeCreate:Wt,created:Wt,beforeMount:Wt,mounted:Wt,beforeUpdate:Wt,updated:Wt,beforeDestroy:Wt,beforeUnmount:Wt,destroyed:Wt,unmounted:Wt,activated:Wt,deactivated:Wt,errorCaptured:Wt,serverPrefetch:Wt,components:Rs,directives:Rs,watch:bp,provide:$l,inject:wp};function $l(e,t){return t?e?function(){return At(We(e)?e.call(this,this):e,We(t)?t.call(this,this):t)}:t:e}function wp(e,t){return Rs(ca(e),ca(t))}function ca(e){if(Le(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Wt(e,t){return e?[...new Set([].concat(e,t))]:t}function Rs(e,t){return e?At(Object.create(null),e,t):t}function Dl(e,t){return e?Le(e)&&Le(t)?[...new Set([...e,...t])]:At(Object.create(null),Ol(e),Ol(t??{})):t}function bp(e,t){if(!e)return t;if(!t)return e;const n=At(Object.create(null),e);for(const r in t)n[r]=Wt(e[r],t[r]);return n}function kd(){return{app:null,config:{isNativeTag:Ru,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 _p=0;function kp(e,t){return function(r,s=null){We(r)||(r=At({},r)),s!=null&&!ct(s)&&(s=null);const o=kd(),i=new WeakSet,l=[];let c=!1;const u=o.app={_uid:_p++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Qp,get config(){return o.config},set config(d){},use(d,...h){return i.has(d)||(d&&We(d.install)?(i.add(d),d.install(u,...h)):We(d)&&(i.add(d),d(u,...h))),u},mixin(d){return o.mixins.includes(d)||o.mixins.push(d),u},component(d,h){return h?(o.components[d]=h,u):o.components[d]},directive(d,h){return h?(o.directives[d]=h,u):o.directives[d]},mount(d,h,g){if(!c){const k=u._ceVNode||Ee(r,s);return k.appContext=o,g===!0?g="svg":g===!1&&(g=void 0),e(k,d,g),c=!0,u._container=d,d.__vue_app__=u,ni(k.component)}},onUnmount(d){l.push(d)},unmount(){c&&(gn(l,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,h){return o.provides[d]=h,u},runWithContext(d){const h=ss;ss=u;try{return d()}finally{ss=h}}};return u}}let ss=null;const Tp=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Kt(t)}Modifiers`]||e[`${br(t)}Modifiers`];function Ip(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||gt;let s=n;const o=t.startsWith("update:"),i=o&&Tp(r,t.slice(7));i&&(i.trim&&(s=n.map(d=>kt(d)?d.trim():d)),i.number&&(s=n.map($a)));let l,c=r[l=yi(t)]||r[l=yi(Kt(t))];!c&&o&&(c=r[l=yi(br(t))]),c&&gn(c,e,6,s);const u=r[l+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,gn(u,e,6,s)}}const Sp=new WeakMap;function Td(e,t,n=!1){const r=n?Sp:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},l=!1;if(!We(e)){const c=u=>{const d=Td(u,t,!0);d&&(l=!0,At(i,d))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!o&&!l?(ct(e)&&r.set(e,null),null):(Le(o)?o.forEach(c=>i[c]=null):At(i,o),ct(e)&&r.set(e,i),i)}function ei(e,t){return!e||!Wo(t)?!1:(t=t.slice(2).replace(/Once$/,""),at(e,t[0].toLowerCase()+t.slice(1))||at(e,br(t))||at(e,t))}function Ll(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:l,emit:c,render:u,renderCache:d,props:h,data:g,setupState:k,ctx:j,inheritAttrs:A}=e,B=Po(e);let Z,V;try{if(n.shapeFlag&4){const z=s||r,ae=z;Z=Tn(u.call(ae,z,d,h,k,g,j)),V=l}else{const z=t;Z=Tn(z.length>1?z(h,{attrs:l,slots:i,emit:c}):z(h,null)),V=t.props?l:Ep(l)}}catch(z){Ds.length=0,Yo(z,e,1),Z=Ee(jt)}let X=Z;if(V&&A!==!1){const z=Object.keys(V),{shapeFlag:ae}=X;z.length&&ae&7&&(o&&z.some(Ma)&&(V=Cp(V,o)),X=wr(X,V,!1,!0))}return n.dirs&&(X=wr(X,null,!1,!0),X.dirs=X.dirs?X.dirs.concat(n.dirs):n.dirs),n.transition&&Hs(X,n.transition),Z=X,Po(B),Z}const Ep=e=>{let t;for(const n in e)(n==="class"||n==="style"||Wo(n))&&((t||(t={}))[n]=e[n]);return t},Cp=(e,t)=>{const n={};for(const r in e)(!Ma(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ap(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:l,patchFlag:c}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?jl(r,i,u):!!i;if(c&8){const d=t.dynamicProps;for(let h=0;h<d.length;h++){const g=d[h];if(Id(i,r,g)&&!ei(u,g))return!0}}}else return(s||l)&&(!l||!l.$stable)?!0:r===i?!1:r?i?jl(r,i,u):!0:!!i;return!1}function jl(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(Id(t,e,o)&&!ei(n,o))return!0}return!1}function Id(e,t,n){const r=e[n],s=t[n];return n==="style"&&ct(r)&&ct(s)?!Da(r,s):r!==s}function Rp({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 Sd={},Ed=()=>Object.create(Sd),Cd=e=>Object.getPrototypeOf(e)===Sd;function Pp(e,t,n,r=!1){const s={},o=Ed();e.propsDefaults=Object.create(null),Ad(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Qu(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function xp(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,l=st(s),[c]=e.propsOptions;let u=!1;if((r||i>0)&&!(i&16)){if(i&8){const d=e.vnode.dynamicProps;for(let h=0;h<d.length;h++){let g=d[h];if(ei(e.emitsOptions,g))continue;const k=t[g];if(c)if(at(o,g))k!==o[g]&&(o[g]=k,u=!0);else{const j=Kt(g);s[j]=ua(c,l,j,k,e,!1)}else k!==o[g]&&(o[g]=k,u=!0)}}}else{Ad(e,t,s,o)&&(u=!0);let d;for(const h in l)(!t||!at(t,h)&&((d=br(h))===h||!at(t,d)))&&(c?n&&(n[h]!==void 0||n[d]!==void 0)&&(s[h]=ua(c,l,h,void 0,e,!0)):delete s[h]);if(o!==l)for(const h in o)(!t||!at(t,h))&&(delete o[h],u=!0)}u&&Fn(e.attrs,"set","")}function Ad(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,l;if(t)for(let c in t){if(Ps(c))continue;const u=t[c];let d;s&&at(s,d=Kt(c))?!o||!o.includes(d)?n[d]=u:(l||(l={}))[d]=u:ei(e.emitsOptions,c)||(!(c in r)||u!==r[c])&&(r[c]=u,i=!0)}if(o){const c=st(n),u=l||gt;for(let d=0;d<o.length;d++){const h=o[d];n[h]=ua(s,c,h,u[h],e,!at(u,h))}}return i}function ua(e,t,n,r,s,o){const i=e[n];if(i!=null){const l=at(i,"default");if(l&&r===void 0){const c=i.default;if(i.type!==Function&&!i.skipFactory&&We(c)){const{propsDefaults:u}=s;if(n in u)r=u[n];else{const d=to(s);r=u[n]=c.call(null,t),d()}}else r=c;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!l?r=!1:i[1]&&(r===""||r===br(n))&&(r=!0))}return r}const Mp=new WeakMap;function Rd(e,t,n=!1){const r=n?Mp:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},l=[];let c=!1;if(!We(e)){const d=h=>{c=!0;const[g,k]=Rd(h,t,!0);At(i,g),k&&l.push(...k)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!o&&!c)return ct(e)&&r.set(e,es),es;if(Le(o))for(let d=0;d<o.length;d++){const h=Kt(o[d]);Bl(h)&&(i[h]=gt)}else if(o)for(const d in o){const h=Kt(d);if(Bl(h)){const g=o[d],k=i[h]=Le(g)||We(g)?{type:g}:At({},g),j=k.type;let A=!1,B=!0;if(Le(j))for(let Z=0;Z<j.length;++Z){const V=j[Z],X=We(V)&&V.name;if(X==="Boolean"){A=!0;break}else X==="String"&&(B=!1)}else A=We(j)&&j.name==="Boolean";k[0]=A,k[1]=B,(A||at(k,"default"))&&l.push(h)}}const u=[i,l];return ct(e)&&r.set(e,u),u}function Bl(e){return e[0]!=="$"&&!Ps(e)}const Ga=e=>e==="_"||e==="_ctx"||e==="$stable",qa=e=>Le(e)?e.map(Tn):[Tn(e)],Op=(e,t,n)=>{if(t._n)return t;const r=ht((...s)=>qa(t(...s)),n);return r._c=!1,r},Pd=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Ga(s))continue;const o=e[s];if(We(o))t[s]=Op(s,o,r);else if(o!=null){const i=qa(o);t[s]=()=>i}}},xd=(e,t)=>{const n=qa(t);e.slots.default=()=>n},Md=(e,t,n)=>{for(const r in t)(n||!Ga(r))&&(e[r]=t[r])},Np=(e,t,n)=>{const r=e.slots=Ed();if(e.vnode.shapeFlag&32){const s=t._;s?(Md(r,t,n),n&&Nu(r,"_",s,!0)):Pd(t,r)}else t&&xd(e,t)},$p=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=gt;if(r.shapeFlag&32){const l=t._;l?n&&l===1?o=!1:Md(s,t,n):(o=!t.$stable,Pd(t,s)),i=t}else t&&(xd(e,t),i={default:1});if(o)for(const l in s)!Ga(l)&&i[l]==null&&delete s[l]},Dt=Fp;function Dp(e){return Lp(e)}function Lp(e,t){const n=zo();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:l,createComment:c,setText:u,setElementText:d,parentNode:h,nextSibling:g,setScopeId:k=An,insertStaticContent:j}=e,A=(v,y,R,G=null,U=null,x=null,D=void 0,F=null,J=!!y.dynamicChildren)=>{if(v===y)return;v&&!Or(v,y)&&(G=W(v),qe(v,U,x,!0),v=null),y.patchFlag===-2&&(J=!1,y.dynamicChildren=null);const{type:q,ref:we,shapeFlag:de}=y;switch(q){case ti:B(v,y,R,G);break;case jt:Z(v,y,R,G);break;case Ei:v==null&&V(y,R,G,D);break;case De:Y(v,y,R,G,U,x,D,F,J);break;default:de&1?ae(v,y,R,G,U,x,D,F,J):de&6?Ce(v,y,R,G,U,x,D,F,J):(de&64||de&128)&&q.process(v,y,R,G,U,x,D,F,J,he)}we!=null&&U?Ns(we,v&&v.ref,x,y||v,!y):we==null&&v&&v.ref!=null&&Ns(v.ref,null,x,v,!0)},B=(v,y,R,G)=>{if(v==null)r(y.el=l(y.children),R,G);else{const U=y.el=v.el;y.children!==v.children&&u(U,y.children)}},Z=(v,y,R,G)=>{v==null?r(y.el=c(y.children||""),R,G):y.el=v.el},V=(v,y,R,G)=>{[v.el,v.anchor]=j(v.children,y,R,G,v.el,v.anchor)},X=({el:v,anchor:y},R,G)=>{let U;for(;v&&v!==y;)U=g(v),r(v,R,G),v=U;r(y,R,G)},z=({el:v,anchor:y})=>{let R;for(;v&&v!==y;)R=g(v),s(v),v=R;s(y)},ae=(v,y,R,G,U,x,D,F,J)=>{if(y.type==="svg"?D="svg":y.type==="math"&&(D="mathml"),v==null)ue(y,R,G,U,x,D,F,J);else{const q=v.el&&v.el._isVueCE?v.el:null;try{q&&q._beginPatch(),oe(v,y,U,x,D,F,J)}finally{q&&q._endPatch()}}},ue=(v,y,R,G,U,x,D,F)=>{let J,q;const{props:we,shapeFlag:de,transition:pe,dirs:ke}=v;if(J=v.el=i(v.type,x,we&&we.is,we),de&8?d(J,v.children):de&16&&be(v.children,J,null,G,U,Si(v,x),D,F),ke&&Er(v,null,G,"created"),me(J,v,v.scopeId,D,G),we){for(const Ve in we)Ve!=="value"&&!Ps(Ve)&&o(J,Ve,null,we[Ve],x,G);"value"in we&&o(J,"value",null,we.value,x),(q=we.onVnodeBeforeMount)&&wn(q,G,v)}ke&&Er(v,null,G,"beforeMount");const Me=jp(U,pe);Me&&pe.beforeEnter(J),r(J,y,R),((q=we&&we.onVnodeMounted)||Me||ke)&&Dt(()=>{q&&wn(q,G,v),Me&&pe.enter(J),ke&&Er(v,null,G,"mounted")},U)},me=(v,y,R,G,U)=>{if(R&&k(v,R),G)for(let x=0;x<G.length;x++)k(v,G[x]);if(U){let x=U.subTree;if(y===x||$d(x.type)&&(x.ssContent===y||x.ssFallback===y)){const D=U.vnode;me(v,D,D.scopeId,D.slotScopeIds,U.parent)}}},be=(v,y,R,G,U,x,D,F,J=0)=>{for(let q=J;q<v.length;q++){const we=v[q]=F?Bn(v[q]):Tn(v[q]);A(null,we,y,R,G,U,x,D,F)}},oe=(v,y,R,G,U,x,D)=>{const F=y.el=v.el;let{patchFlag:J,dynamicChildren:q,dirs:we}=y;J|=v.patchFlag&16;const de=v.props||gt,pe=y.props||gt;let ke;if(R&&Cr(R,!1),(ke=pe.onVnodeBeforeUpdate)&&wn(ke,R,y,v),we&&Er(y,v,R,"beforeUpdate"),R&&Cr(R,!0),(de.innerHTML&&pe.innerHTML==null||de.textContent&&pe.textContent==null)&&d(F,""),q?ee(v.dynamicChildren,q,F,R,G,Si(y,U),x):D||Ie(v,y,F,null,R,G,Si(y,U),x,!1),J>0){if(J&16)te(F,de,pe,R,U);else if(J&2&&de.class!==pe.class&&o(F,"class",null,pe.class,U),J&4&&o(F,"style",de.style,pe.style,U),J&8){const Me=y.dynamicProps;for(let Ve=0;Ve<Me.length;Ve++){const $e=Me[Ve],Xe=de[$e],ot=pe[$e];(ot!==Xe||$e==="value")&&o(F,$e,Xe,ot,U,R)}}J&1&&v.children!==y.children&&d(F,y.children)}else!D&&q==null&&te(F,de,pe,R,U);((ke=pe.onVnodeUpdated)||we)&&Dt(()=>{ke&&wn(ke,R,y,v),we&&Er(y,v,R,"updated")},G)},ee=(v,y,R,G,U,x,D)=>{for(let F=0;F<y.length;F++){const J=v[F],q=y[F],we=J.el&&(J.type===De||!Or(J,q)||J.shapeFlag&198)?h(J.el):R;A(J,q,we,null,G,U,x,D,!0)}},te=(v,y,R,G,U)=>{if(y!==R){if(y!==gt)for(const x in y)!Ps(x)&&!(x in R)&&o(v,x,y[x],null,U,G);for(const x in R){if(Ps(x))continue;const D=R[x],F=y[x];D!==F&&x!=="value"&&o(v,x,F,D,U,G)}"value"in R&&o(v,"value",y.value,R.value,U)}},Y=(v,y,R,G,U,x,D,F,J)=>{const q=y.el=v?v.el:l(""),we=y.anchor=v?v.anchor:l("");let{patchFlag:de,dynamicChildren:pe,slotScopeIds:ke}=y;ke&&(F=F?F.concat(ke):ke),v==null?(r(q,R,G),r(we,R,G),be(y.children||[],R,we,U,x,D,F,J)):de>0&&de&64&&pe&&v.dynamicChildren&&v.dynamicChildren.length===pe.length?(ee(v.dynamicChildren,pe,R,U,x,D,F),(y.key!=null||U&&y===U.subTree)&&za(v,y,!0)):Ie(v,y,R,we,U,x,D,F,J)},Ce=(v,y,R,G,U,x,D,F,J)=>{y.slotScopeIds=F,v==null?y.shapeFlag&512?U.ctx.activate(y,R,G,D,J):_e(y,R,G,U,x,D,J):Oe(v,y,J)},_e=(v,y,R,G,U,x,D)=>{const F=v.component=qp(v,G,U);if(Xo(v)&&(F.ctx.renderer=he),zp(F,!1,D),F.asyncDep){if(U&&U.registerDep(F,Ae,D),!v.el){const J=F.subTree=Ee(jt);Z(null,J,y,R),v.placeholder=J.el}}else Ae(F,v,y,R,U,x,D)},Oe=(v,y,R)=>{const G=y.component=v.component;if(Ap(v,y,R))if(G.asyncDep&&!G.asyncResolved){ye(G,y,R);return}else G.next=y,G.update();else y.el=v.el,G.vnode=y},Ae=(v,y,R,G,U,x,D)=>{const F=()=>{if(v.isMounted){let{next:de,bu:pe,u:ke,parent:Me,vnode:Ve}=v;{const je=Od(v);if(je){de&&(de.el=Ve.el,ye(v,de,D)),je.asyncDep.then(()=>{Dt(()=>{v.isUnmounted||q()},U)});return}}let $e=de,Xe;Cr(v,!1),de?(de.el=Ve.el,ye(v,de,D)):de=Ve,pe&&yo(pe),(Xe=de.props&&de.props.onVnodeBeforeUpdate)&&wn(Xe,Me,de,Ve),Cr(v,!0);const ot=Ll(v),Je=v.subTree;v.subTree=ot,A(Je,ot,h(Je.el),W(Je),v,U,x),de.el=ot.el,$e===null&&Rp(v,ot.el),ke&&Dt(ke,U),(Xe=de.props&&de.props.onVnodeUpdated)&&Dt(()=>wn(Xe,Me,de,Ve),U)}else{let de;const{el:pe,props:ke}=y,{bm:Me,m:Ve,parent:$e,root:Xe,type:ot}=v,Je=rs(y);Cr(v,!1),Me&&yo(Me),!Je&&(de=ke&&ke.onVnodeBeforeMount)&&wn(de,$e,y),Cr(v,!0);{Xe.ce&&Xe.ce._hasShadowRoot()&&Xe.ce._injectChildStyle(ot,v.parent?v.parent.type:void 0);const je=v.subTree=Ll(v);A(null,je,R,G,v,U,x),y.el=je.el}if(Ve&&Dt(Ve,U),!Je&&(de=ke&&ke.onVnodeMounted)){const je=y;Dt(()=>wn(de,$e,je),U)}(y.shapeFlag&256||$e&&rs($e.vnode)&&$e.vnode.shapeFlag&256)&&v.a&&Dt(v.a,U),v.isMounted=!0,y=R=G=null}};v.scope.on();const J=v.effect=new ju(F);v.scope.off();const q=v.update=J.run.bind(J),we=v.job=J.runIfDirty.bind(J);we.i=v,we.id=v.uid,J.scheduler=()=>Wa(we),Cr(v,!0),q()},ye=(v,y,R)=>{y.component=v;const G=v.vnode.props;v.vnode=y,v.next=null,xp(v,y.props,G,R),$p(v,y.children,R),Gn(),Sl(v),qn()},Ie=(v,y,R,G,U,x,D,F,J=!1)=>{const q=v&&v.children,we=v?v.shapeFlag:0,de=y.children,{patchFlag:pe,shapeFlag:ke}=y;if(pe>0){if(pe&128){Ge(q,de,R,G,U,x,D,F,J);return}else if(pe&256){ut(q,de,R,G,U,x,D,F,J);return}}ke&8?(we&16&&Ue(q,U,x),de!==q&&d(R,de)):we&16?ke&16?Ge(q,de,R,G,U,x,D,F,J):Ue(q,U,x,!0):(we&8&&d(R,""),ke&16&&be(de,R,G,U,x,D,F,J))},ut=(v,y,R,G,U,x,D,F,J)=>{v=v||es,y=y||es;const q=v.length,we=y.length,de=Math.min(q,we);let pe;for(pe=0;pe<de;pe++){const ke=y[pe]=J?Bn(y[pe]):Tn(y[pe]);A(v[pe],ke,R,null,U,x,D,F,J)}q>we?Ue(v,U,x,!0,!1,de):be(y,R,G,U,x,D,F,J,de)},Ge=(v,y,R,G,U,x,D,F,J)=>{let q=0;const we=y.length;let de=v.length-1,pe=we-1;for(;q<=de&&q<=pe;){const ke=v[q],Me=y[q]=J?Bn(y[q]):Tn(y[q]);if(Or(ke,Me))A(ke,Me,R,null,U,x,D,F,J);else break;q++}for(;q<=de&&q<=pe;){const ke=v[de],Me=y[pe]=J?Bn(y[pe]):Tn(y[pe]);if(Or(ke,Me))A(ke,Me,R,null,U,x,D,F,J);else break;de--,pe--}if(q>de){if(q<=pe){const ke=pe+1,Me=ke<we?y[ke].el:G;for(;q<=pe;)A(null,y[q]=J?Bn(y[q]):Tn(y[q]),R,Me,U,x,D,F,J),q++}}else if(q>pe)for(;q<=de;)qe(v[q],U,x,!0),q++;else{const ke=q,Me=q,Ve=new Map;for(q=Me;q<=pe;q++){const ft=y[q]=J?Bn(y[q]):Tn(y[q]);ft.key!=null&&Ve.set(ft.key,q)}let $e,Xe=0;const ot=pe-Me+1;let Je=!1,je=0;const It=new Array(ot);for(q=0;q<ot;q++)It[q]=0;for(q=ke;q<=de;q++){const ft=v[q];if(Xe>=ot){qe(ft,U,x,!0);continue}let _t;if(ft.key!=null)_t=Ve.get(ft.key);else for($e=Me;$e<=pe;$e++)if(It[$e-Me]===0&&Or(ft,y[$e])){_t=$e;break}_t===void 0?qe(ft,U,x,!0):(It[_t-Me]=q+1,_t>=je?je=_t:Je=!0,A(ft,y[_t],R,null,U,x,D,F,J),Xe++)}const Ut=Je?Bp(It):es;for($e=Ut.length-1,q=ot-1;q>=0;q--){const ft=Me+q,_t=y[ft],Ht=y[ft+1],Pt=ft+1<we?Ht.el||Nd(Ht):G;It[q]===0?A(null,_t,R,Pt,U,x,D,F,J):Je&&($e<0||q!==Ut[$e]?He(_t,R,Pt,2):$e--)}}},He=(v,y,R,G,U=null)=>{const{el:x,type:D,transition:F,children:J,shapeFlag:q}=v;if(q&6){He(v.component.subTree,y,R,G);return}if(q&128){v.suspense.move(y,R,G);return}if(q&64){D.move(v,y,R,he);return}if(D===De){r(x,y,R);for(let de=0;de<J.length;de++)He(J[de],y,R,G);r(v.anchor,y,R);return}if(D===Ei){X(v,y,R);return}if(G!==2&&q&1&&F)if(G===0)F.beforeEnter(x),r(x,y,R),Dt(()=>F.enter(x),U);else{const{leave:de,delayLeave:pe,afterLeave:ke}=F,Me=()=>{v.ctx.isUnmounted?s(x):r(x,y,R)},Ve=()=>{x._isLeaving&&x[_n](!0),de(x,()=>{Me(),ke&&ke()})};pe?pe(x,Me,Ve):Ve()}else r(x,y,R)},qe=(v,y,R,G=!1,U=!1)=>{const{type:x,props:D,ref:F,children:J,dynamicChildren:q,shapeFlag:we,patchFlag:de,dirs:pe,cacheIndex:ke}=v;if(de===-2&&(U=!1),F!=null&&(Gn(),Ns(F,null,R,v,!0),qn()),ke!=null&&(y.renderCache[ke]=void 0),we&256){y.ctx.deactivate(v);return}const Me=we&1&&pe,Ve=!rs(v);let $e;if(Ve&&($e=D&&D.onVnodeBeforeUnmount)&&wn($e,y,v),we&6)Te(v.component,R,G);else{if(we&128){v.suspense.unmount(R,G);return}Me&&Er(v,null,y,"beforeUnmount"),we&64?v.type.remove(v,y,R,he,G):q&&!q.hasOnce&&(x!==De||de>0&&de&64)?Ue(q,y,R,!1,!0):(x===De&&de&384||!U&&we&16)&&Ue(J,y,R),G&&Qe(v)}(Ve&&($e=D&&D.onVnodeUnmounted)||Me)&&Dt(()=>{$e&&wn($e,y,v),Me&&Er(v,null,y,"unmounted")},R)},Qe=v=>{const{type:y,el:R,anchor:G,transition:U}=v;if(y===De){dt(R,G);return}if(y===Ei){z(v);return}const x=()=>{s(R),U&&!U.persisted&&U.afterLeave&&U.afterLeave()};if(v.shapeFlag&1&&U&&!U.persisted){const{leave:D,delayLeave:F}=U,J=()=>D(R,x);F?F(v.el,x,J):J()}else x()},dt=(v,y)=>{let R;for(;v!==y;)R=g(v),s(v),v=R;s(y)},Te=(v,y,R)=>{const{bum:G,scope:U,job:x,subTree:D,um:F,m:J,a:q}=v;Fl(J),Fl(q),G&&yo(G),U.stop(),x&&(x.flags|=8,qe(D,v,y,R)),F&&Dt(F,y),Dt(()=>{v.isUnmounted=!0},y)},Ue=(v,y,R,G=!1,U=!1,x=0)=>{for(let D=x;D<v.length;D++)qe(v[D],y,R,G,U)},W=v=>{if(v.shapeFlag&6)return W(v.component.subTree);if(v.shapeFlag&128)return v.suspense.next();const y=g(v.anchor||v.el),R=y&&y[ld];return R?g(R):y};let fe=!1;const le=(v,y,R)=>{let G;v==null?y._vnode&&(qe(y._vnode,null,null,!0),G=y._vnode.component):A(y._vnode||null,v,y,null,null,null,R),y._vnode=v,fe||(fe=!0,Sl(G),rd(),fe=!1)},he={p:A,um:qe,m:He,r:Qe,mt:_e,mc:be,pc:Ie,pbc:ee,n:W,o:e};return{render:le,hydrate:void 0,createApp:kp(le)}}function Si({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 Cr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function jp(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function za(e,t,n=!1){const r=e.children,s=t.children;if(Le(r)&&Le(s))for(let o=0;o<r.length;o++){const i=r[o];let l=s[o];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=s[o]=Bn(s[o]),l.el=i.el),!n&&l.patchFlag!==-2&&za(i,l)),l.type===ti&&(l.patchFlag===-1&&(l=s[o]=Bn(l)),l.el=i.el),l.type===jt&&!l.el&&(l.el=i.el)}}function Bp(e){const t=e.slice(),n=[0];let r,s,o,i,l;const c=e.length;for(r=0;r<c;r++){const u=e[r];if(u!==0){if(s=n[n.length-1],e[s]<u){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)l=o+i>>1,e[n[l]]<u?o=l+1:i=l;u<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 Od(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Od(t)}function Fl(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Nd(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Nd(t.subTree):null}const $d=e=>e.__isSuspense;function Fp(e,t){t&&t.pendingBranch?Le(e)?t.effects.push(...e):t.effects.push(e):zh(e)}const De=Symbol.for("v-fgt"),ti=Symbol.for("v-txt"),jt=Symbol.for("v-cmt"),Ei=Symbol.for("v-stc"),Ds=[];let rn=null;function w(e=!1){Ds.push(rn=e?null:[])}function Up(){Ds.pop(),rn=Ds[Ds.length-1]||null}let Vs=1;function No(e,t=!1){Vs+=e,e<0&&rn&&t&&(rn.hasOnce=!0)}function Dd(e){return e.dynamicChildren=Vs>0?rn||es:null,Up(),Vs>0&&rn&&rn.push(e),e}function T(e,t,n,r,s,o){return Dd(m(e,t,n,r,s,o,!0))}function lt(e,t,n,r,s){return Dd(Ee(e,t,n,r,s,!0))}function Ws(e){return e?e.__v_isVNode===!0:!1}function Or(e,t){return e.type===t.type&&e.key===t.key}const Ld=({key:e})=>e??null,_o=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?kt(e)||Ft(e)||We(e)?{i:Nt,r:e,k:t,f:!!n}:e:null);function m(e,t=null,n=null,r=0,s=null,o=e===De?0:1,i=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ld(t),ref:t&&_o(t),scopeId:od,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:Nt};return l?(Ka(c,n),o&128&&e.normalize(c)):n&&(c.shapeFlag|=kt(n)?8:16),Vs>0&&!i&&rn&&(c.patchFlag>0||o&6)&&c.patchFlag!==32&&rn.push(c),c}const Ee=Hp;function Hp(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===yd)&&(e=jt),Ws(e)){const l=wr(e,t,!0);return n&&Ka(l,n),Vs>0&&!o&&rn&&(l.shapeFlag&6?rn[rn.indexOf(e)]=l:rn.push(l)),l.patchFlag=-2,l}if(Xp(e)&&(e=e.__vccOpts),t){t=Vp(t);let{class:l,style:c}=t;l&&!kt(l)&&(t.class=rt(l)),ct(c)&&(Va(c)&&!Le(c)&&(c=At({},c)),t.style=Fr(c))}const i=kt(e)?1:$d(e)?128:cd(e)?64:ct(e)?4:We(e)?2:0;return m(e,t,n,r,s,i,o,!0)}function Vp(e){return e?Va(e)||Cd(e)?At({},e):e:null}function wr(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:l,transition:c}=e,u=t?jd(s||{},t):s,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Ld(u),ref:t&&t.ref?n&&o?Le(o)?o.concat(_o(t)):[o,_o(t)]:_o(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==De?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&wr(e.ssContent),ssFallback:e.ssFallback&&wr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Hs(d,c.clone(d)),d}function Gs(e=" ",t=0){return Ee(ti,null,e,t)}function se(e="",t=!1){return t?(w(),lt(jt,null,e)):Ee(jt,null,e)}function Tn(e){return e==null||typeof e=="boolean"?Ee(jt):Le(e)?Ee(De,null,e.slice()):Ws(e)?Bn(e):Ee(ti,null,String(e))}function Bn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:wr(e)}function Ka(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Le(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Ka(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Cd(t)?t._ctx=Nt:s===3&&Nt&&(Nt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else We(t)?(t={default:t,_ctx:Nt},n=32):(t=String(t),r&64?(n=16,t=[Gs(t)]):n=8);e.children=t,e.shapeFlag|=n}function jd(...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=rt([t.class,r.class]));else if(s==="style")t.style=Fr([t.style,r.style]);else if(Wo(s)){const o=t[s],i=r[s];i&&o!==i&&!(Le(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function wn(e,t,n,r=null){gn(e,t,7,[n,r])}const Wp=kd();let Gp=0;function qp(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Wp,o={uid:Gp++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new vh(!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:Rd(r,s),emitsOptions:Td(r,s),emit:null,emitted:null,propsDefaults:gt,inheritAttrs:r.inheritAttrs,ctx:gt,data:gt,props:gt,attrs:gt,slots:gt,refs:gt,setupState:gt,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=Ip.bind(null,o),e.ce&&e.ce(o),o}let Bt=null;const Ja=()=>Bt||Nt;let $o,da;{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)}};$o=t("__VUE_INSTANCE_SETTERS__",n=>Bt=n),da=t("__VUE_SSR_SETTERS__",n=>qs=n)}const to=e=>{const t=Bt;return $o(e),e.scope.on(),()=>{e.scope.off(),$o(t)}},Ul=()=>{Bt&&Bt.scope.off(),$o(null)};function Bd(e){return e.vnode.shapeFlag&4}let qs=!1;function zp(e,t=!1,n=!1){t&&da(t);const{props:r,children:s}=e.vnode,o=Bd(e);Pp(e,r,o,t),Np(e,s,n||t);const i=o?Kp(e,t):void 0;return t&&da(!1),i}function Kp(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,hp);const{setup:r}=n;if(r){Gn();const s=e.setupContext=r.length>1?Ud(e):null,o=to(e),i=eo(r,e,0,[e.props,s]),l=xu(i);if(qn(),o(),(l||e.sp)&&!rs(e)&&gd(e),l){if(i.then(Ul,Ul),t)return i.then(c=>{Hl(e,c)}).catch(c=>{Yo(c,e,0)});e.asyncDep=i}else Hl(e,i)}else Fd(e)}function Hl(e,t,n){We(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:ct(t)&&(e.setupState=ed(t)),Fd(e)}function Fd(e,t,n){const r=e.type;e.render||(e.render=r.render||An);{const s=to(e);Gn();try{gp(e)}finally{qn(),s()}}}const Jp={get(e,t){return Lt(e,"get",""),e[t]}};function Ud(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Jp),slots:e.slots,emit:e.emit,expose:t}}function ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ed(Lh(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in $s)return $s[n](e)},has(t,n){return n in t||n in $s}})):e.proxy}function Yp(e,t=!0){return We(e)?e.displayName||e.name:e.name||t&&e.__name}function Xp(e){return We(e)&&"__vccOpts"in e}const ie=(e,t)=>Hh(e,t,qs);function Ya(e,t,n){try{No(-1);const r=arguments.length;return r===2?ct(t)&&!Le(t)?Ws(t)?Ee(e,null,[t]):Ee(e,t):Ee(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ws(n)&&(n=[n]),Ee(e,t,n))}finally{No(1)}}const Qp="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 fa;const Vl=typeof window<"u"&&window.trustedTypes;if(Vl)try{fa=Vl.createPolicy("vue",{createHTML:e=>e})}catch{}const Hd=fa?e=>fa.createHTML(e):e=>e,Zp="http://www.w3.org/2000/svg",em="http://www.w3.org/1998/Math/MathML",jn=typeof document<"u"?document:null,Wl=jn&&jn.createElement("template"),tm={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"?jn.createElementNS(Zp,e):t==="mathml"?jn.createElementNS(em,e):n?jn.createElement(e,{is:n}):jn.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>jn.createTextNode(e),createComment:e=>jn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>jn.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{Wl.innerHTML=Hd(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const l=Wl.content;if(r==="svg"||r==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ar="transition",Ss="animation",zs=Symbol("_vtc"),Vd={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},nm=At({},dd,Vd),rm=e=>(e.displayName="Transition",e.props=nm,e),Wd=rm((e,{slots:t})=>Ya(ep,sm(e),t)),Ar=(e,t=[])=>{Le(e)?e.forEach(n=>n(...t)):e&&e(...t)},Gl=e=>e?Le(e)?e.some(t=>t.length>1):e.length>1:!1;function sm(e){const t={};for(const Y in e)Y in Vd||(t[Y]=e[Y]);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:l=`${n}-enter-to`,appearFromClass:c=o,appearActiveClass:u=i,appearToClass:d=l,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:g=`${n}-leave-active`,leaveToClass:k=`${n}-leave-to`}=e,j=om(s),A=j&&j[0],B=j&&j[1],{onBeforeEnter:Z,onEnter:V,onEnterCancelled:X,onLeave:z,onLeaveCancelled:ae,onBeforeAppear:ue=Z,onAppear:me=V,onAppearCancelled:be=X}=t,oe=(Y,Ce,_e,Oe)=>{Y._enterCancelled=Oe,Rr(Y,Ce?d:l),Rr(Y,Ce?u:i),_e&&_e()},ee=(Y,Ce)=>{Y._isLeaving=!1,Rr(Y,h),Rr(Y,k),Rr(Y,g),Ce&&Ce()},te=Y=>(Ce,_e)=>{const Oe=Y?me:V,Ae=()=>oe(Ce,Y,_e);Ar(Oe,[Ce,Ae]),ql(()=>{Rr(Ce,Y?c:o),Dn(Ce,Y?d:l),Gl(Oe)||zl(Ce,r,A,Ae)})};return At(t,{onBeforeEnter(Y){Ar(Z,[Y]),Dn(Y,o),Dn(Y,i)},onBeforeAppear(Y){Ar(ue,[Y]),Dn(Y,c),Dn(Y,u)},onEnter:te(!1),onAppear:te(!0),onLeave(Y,Ce){Y._isLeaving=!0;const _e=()=>ee(Y,Ce);Dn(Y,h),Y._enterCancelled?(Dn(Y,g),Yl(Y)):(Yl(Y),Dn(Y,g)),ql(()=>{Y._isLeaving&&(Rr(Y,h),Dn(Y,k),Gl(z)||zl(Y,r,B,_e))}),Ar(z,[Y,_e])},onEnterCancelled(Y){oe(Y,!1,void 0,!0),Ar(X,[Y])},onAppearCancelled(Y){oe(Y,!0,void 0,!0),Ar(be,[Y])},onLeaveCancelled(Y){ee(Y),Ar(ae,[Y])}})}function om(e){if(e==null)return null;if(ct(e))return[Ci(e.enter),Ci(e.leave)];{const t=Ci(e);return[t,t]}}function Ci(e){return ch(e)}function Dn(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[zs]||(e[zs]=new Set)).add(t)}function Rr(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[zs];n&&(n.delete(t),n.size||(e[zs]=void 0))}function ql(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let im=0;function zl(e,t,n,r){const s=e._endId=++im,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:l,propCount:c}=am(e,t);if(!i)return r();const u=i+"end";let d=0;const h=()=>{e.removeEventListener(u,g),o()},g=k=>{k.target===e&&++d>=c&&h()};setTimeout(()=>{d<c&&h()},l+1),e.addEventListener(u,g)}function am(e,t){const n=window.getComputedStyle(e),r=j=>(n[j]||"").split(", "),s=r(`${ar}Delay`),o=r(`${ar}Duration`),i=Kl(s,o),l=r(`${Ss}Delay`),c=r(`${Ss}Duration`),u=Kl(l,c);let d=null,h=0,g=0;t===ar?i>0&&(d=ar,h=i,g=o.length):t===Ss?u>0&&(d=Ss,h=u,g=c.length):(h=Math.max(i,u),d=h>0?i>u?ar:Ss:null,g=d?d===ar?o.length:c.length:0);const k=d===ar&&/\b(?:transform|all)(?:,|$)/.test(r(`${ar}Property`).toString());return{type:d,timeout:h,propCount:g,hasTransform:k}}function Kl(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Jl(n)+Jl(e[r])))}function Jl(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Yl(e){return(e?e.ownerDocument:document).body.offsetHeight}function lm(e,t,n){const r=e[zs];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Xl=Symbol("_vod"),cm=Symbol("_vsh"),um=Symbol(""),dm=/(?:^|;)\s*display\s*:/;function fm(e,t,n){const r=e.style,s=kt(n);let o=!1;if(n&&!s){if(t)if(kt(t))for(const i of t.split(";")){const l=i.slice(0,i.indexOf(":")).trim();n[l]==null&&ko(r,l,"")}else for(const i in t)n[i]==null&&ko(r,i,"");for(const i in n)i==="display"&&(o=!0),ko(r,i,n[i])}else if(s){if(t!==n){const i=r[um];i&&(n+=";"+i),r.cssText=n,o=dm.test(n)}}else t&&e.removeAttribute("style");Xl in e&&(e[Xl]=o?r.display:"",e[cm]&&(r.display="none"))}const Ql=/\s*!important$/;function ko(e,t,n){if(Le(n))n.forEach(r=>ko(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=hm(e,t);Ql.test(n)?e.setProperty(br(r),n.replace(Ql,""),"important"):e[r]=n}}const Zl=["Webkit","Moz","ms"],Ai={};function hm(e,t){const n=Ai[t];if(n)return n;let r=Kt(t);if(r!=="filter"&&r in e)return Ai[t]=r;r=qo(r);for(let s=0;s<Zl.length;s++){const o=Zl[s]+r;if(o in e)return Ai[t]=o}return t}const ec="http://www.w3.org/1999/xlink";function tc(e,t,n,r,s,o=mh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(ec,t.slice(6,t.length)):e.setAttributeNS(ec,t,n):n==null||o&&!$u(n)?e.removeAttribute(t):e.setAttribute(t,o?"":pn(n)?String(n):n)}function nc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Hd(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const l=o==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(l!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=$u(n):n==null&&l==="string"?(n="",i=!0):l==="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 pm(e,t,n,r){e.removeEventListener(t,n,r)}const rc=Symbol("_vei");function mm(e,t,n,r,s=null){const o=e[rc]||(e[rc]={}),i=o[t];if(r&&i)i.value=r;else{const[l,c]=gm(t);if(r){const u=o[t]=wm(r,s);Qr(e,l,u,c)}else i&&(pm(e,l,i,c),o[t]=void 0)}}const sc=/(?:Once|Passive|Capture)$/;function gm(e){let t;if(sc.test(e)){t={};let r;for(;r=e.match(sc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):br(e.slice(2)),t]}let Ri=0;const vm=Promise.resolve(),ym=()=>Ri||(vm.then(()=>Ri=0),Ri=Date.now());function wm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;gn(bm(r,n.value),t,5,[r])};return n.value=e,n.attached=ym(),n}function bm(e,t){if(Le(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 oc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,_m=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?lm(e,r,i):t==="style"?fm(e,n,r):Wo(t)?Ma(t)||mm(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):km(e,t,r,i))?(nc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&tc(e,t,r,i,o,t!=="value")):e._isVueCE&&(Tm(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!kt(r)))?nc(e,Kt(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),tc(e,t,r,i))};function km(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&oc(t)&&We(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 oc(t)&&kt(n)?!1:t in e}function Tm(e,t){const n=e._def.props;if(!n)return!1;const r=Kt(t);return Array.isArray(n)?n.some(s=>Kt(s)===r):Object.keys(n).some(s=>Kt(s)===r)}const ic=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Le(t)?n=>yo(t,n):t};function Im(e){e.target.composing=!0}function ac(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Pi=Symbol("_assign");function lc(e,t,n){return t&&(e=e.trim()),n&&(e=$a(e)),e}const Jn={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Pi]=ic(s);const o=r||s.props&&s.props.type==="number";Qr(e,t?"change":"input",i=>{i.target.composing||e[Pi](lc(e.value,n,o))}),(n||o)&&Qr(e,"change",()=>{e.value=lc(e.value,n,o)}),t||(Qr(e,"compositionstart",Im),Qr(e,"compositionend",ac),Qr(e,"change",ac))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Pi]=ic(i),e.composing)return;const l=(o||e.type==="number")&&!/^0\d/.test(e.value)?$a(e.value):e.value,c=t??"";l!==c&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===c)||(e.value=c))}},Sm=["ctrl","shift","alt","meta"],Em={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)=>Sm.some(n=>e[`${n}Key`]&&!t.includes(n))},nt=(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 l=Em[t[i]];if(l&&l(s,t))return}return e(s,...o)}))},Cm={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=br(s.key);if(t.some(i=>i===o||Cm[i]===o))return e(s)}))},Am=At({patchProp:_m},tm);let cc;function Rm(){return cc||(cc=Dp(Am))}const Pm=((...e)=>{const t=Rm().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Mm(r);if(!s)return;const o=t._component;!We(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,xm(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function xm(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Mm(e){return kt(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 Gd(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Om(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Gd(e.default)}const it=Object.assign;function xi(e,t){const n={};for(const r in t){const s=t[r];n[r]=vn(s)?s.map(e):e(s)}return n}const Ls=()=>{},vn=Array.isArray;function uc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const qd=/#/g,Nm=/&/g,$m=/\//g,Dm=/=/g,Lm=/\?/g,zd=/\+/g,jm=/%5B/g,Bm=/%5D/g,Kd=/%5E/g,Fm=/%60/g,Jd=/%7B/g,Um=/%7C/g,Yd=/%7D/g,Hm=/%20/g;function Xa(e){return e==null?"":encodeURI(""+e).replace(Um,"|").replace(jm,"[").replace(Bm,"]")}function Vm(e){return Xa(e).replace(Jd,"{").replace(Yd,"}").replace(Kd,"^")}function ha(e){return Xa(e).replace(zd,"%2B").replace(Hm,"+").replace(qd,"%23").replace(Nm,"%26").replace(Fm,"`").replace(Jd,"{").replace(Yd,"}").replace(Kd,"^")}function Wm(e){return ha(e).replace(Dm,"%3D")}function Gm(e){return Xa(e).replace(qd,"%23").replace(Lm,"%3F")}function qm(e){return Gm(e).replace($m,"%2F")}function Ks(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const zm=/\/$/,Km=e=>e.replace(zm,"");function Mi(e,t,n="/"){let r,s={},o="",i="";const l=t.indexOf("#");let c=t.indexOf("?");return c=l>=0&&c>l?-1:c,c>=0&&(r=t.slice(0,c),o=t.slice(c,l>0?l:t.length),s=e(o.slice(1))),l>=0&&(r=r||t.slice(0,l),i=t.slice(l,t.length)),r=Qm(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Ks(i)}}function Jm(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function dc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Ym(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])&&Xd(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 Xd(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Xm(e[n],t[n]))return!1;return!0}function Xm(e,t){return vn(e)?fc(e,t):vn(t)?fc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function fc(e,t){return vn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Qm(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,l;for(i=0;i<r.length;i++)if(l=r[i],l!==".")if(l==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const lr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let pa=(function(e){return e.pop="pop",e.push="push",e})({}),Oi=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Zm(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),Km(e)}const eg=/^[^#]+#/;function tg(e,t){return e.replace(eg,"#")+t}function ng(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 ri=()=>({left:window.scrollX,top:window.scrollY});function rg(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=ng(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 hc(e,t){return(history.state?history.state.position-t:-1)+e}const ma=new Map;function sg(e,t){ma.set(e,t)}function og(e){const t=ma.get(e);return ma.delete(e),t}function ig(e){return typeof e=="string"||e&&typeof e=="object"}function Qd(e){return typeof e=="string"||typeof e=="symbol"}let Tt=(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 Zd=Symbol("");Tt.MATCHER_NOT_FOUND+"",Tt.NAVIGATION_GUARD_REDIRECT+"",Tt.NAVIGATION_ABORTED+"",Tt.NAVIGATION_CANCELLED+"",Tt.NAVIGATION_DUPLICATED+"";function ds(e,t){return it(new Error,{type:e,[Zd]:!0},t)}function Ln(e,t){return e instanceof Error&&Zd in e&&(t==null||!!(e.type&t))}const ag=["params","query","hash"];function lg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of ag)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function cg(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(zd," "),o=s.indexOf("="),i=Ks(o<0?s:s.slice(0,o)),l=o<0?null:Ks(s.slice(o+1));if(i in t){let c=t[i];vn(c)||(c=t[i]=[c]),c.push(l)}else t[i]=l}return t}function pc(e){let t="";for(let n in e){const r=e[n];if(n=Wm(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(vn(r)?r.map(s=>s&&ha(s)):[r&&ha(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function ug(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=vn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const dg=Symbol(""),mc=Symbol(""),si=Symbol(""),Qa=Symbol(""),ga=Symbol("");function Es(){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 fr(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((l,c)=>{const u=g=>{g===!1?c(ds(Tt.NAVIGATION_ABORTED,{from:n,to:t})):g instanceof Error?c(g):ig(g)?c(ds(Tt.NAVIGATION_GUARD_REDIRECT,{from:t,to:g})):(i&&r.enterCallbacks[s]===i&&typeof g=="function"&&i.push(g),l())},d=o(()=>e.call(r&&r.instances[s],t,n,u));let h=Promise.resolve(d);e.length<3&&(h=h.then(u)),h.catch(g=>c(g))})}function Ni(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const l in i.components){let c=i.components[l];if(!(t!=="beforeRouteEnter"&&!i.instances[l]))if(Gd(c)){const u=(c.__vccOpts||c)[t];u&&o.push(fr(u,n,r,i,l,s))}else{let u=c();o.push(()=>u.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${l}" at "${i.path}"`);const h=Om(d)?d.default:d;i.mods[l]=d,i.components[l]=h;const g=(h.__vccOpts||h)[t];return g&&fr(g,n,r,i,l,s)()}))}}return o}function fg(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const l=t.matched[i];l&&(e.matched.find(u=>us(u,l))?r.push(l):n.push(l));const c=e.matched[i];c&&(t.matched.find(u=>us(u,c))||s.push(c))}return[n,r,s]}/*!
|
|
22
|
-
* vue-router v4.6.4
|
|
23
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
24
|
-
* @license MIT
|
|
25
|
-
*/let hg=()=>location.protocol+"//"+location.host;function ef(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,l=s.slice(i);return l[0]!=="/"&&(l="/"+l),dc(l,"")}return dc(n,e)+r+s}function pg(e,t,n,r){let s=[],o=[],i=null;const l=({state:g})=>{const k=ef(e,location),j=n.value,A=t.value;let B=0;if(g){if(n.value=k,t.value=g,i&&i===j){i=null;return}B=A?g.position-A.position:0}else r(k);s.forEach(Z=>{Z(n.value,j,{delta:B,type:pa.pop,direction:B?B>0?Oi.forward:Oi.back:Oi.unknown})})};function c(){i=n.value}function u(g){s.push(g);const k=()=>{const j=s.indexOf(g);j>-1&&s.splice(j,1)};return o.push(k),k}function d(){if(document.visibilityState==="hidden"){const{history:g}=window;if(!g.state)return;g.replaceState(it({},g.state,{scroll:ri()}),"")}}function h(){for(const g of o)g();o=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",d)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",d),document.addEventListener("visibilitychange",d),{pauseListeners:c,listen:u,destroy:h}}function gc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?ri():null}}function mg(e){const{history:t,location:n}=window,r={value:ef(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(c,u,d){const h=e.indexOf("#"),g=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+c:hg()+e+c;try{t[d?"replaceState":"pushState"](u,"",g),s.value=u}catch(k){console.error(k),n[d?"replace":"assign"](g)}}function i(c,u){o(c,it({},t.state,gc(s.value.back,c,s.value.forward,!0),u,{position:s.value.position}),!0),r.value=c}function l(c,u){const d=it({},s.value,t.state,{forward:c,scroll:ri()});o(d.current,d,!0),o(c,it({},gc(r.value,c,null),{position:d.position+1},u),!1),r.value=c}return{location:r,state:s,push:l,replace:i}}function gg(e){e=Zm(e);const t=mg(e),n=pg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=it({location:"",base:e,go:r,createHref:tg.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 vg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),gg(e)}let $r=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Ct=(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})(Ct||{});const yg={type:$r.Static,value:""},wg=/[a-zA-Z0-9_]/;function bg(e){if(!e)return[[]];if(e==="/")return[[yg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(k){throw new Error(`ERR (${n})/"${u}": ${k}`)}let n=Ct.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let l=0,c,u="",d="";function h(){u&&(n===Ct.Static?o.push({type:$r.Static,value:u}):n===Ct.Param||n===Ct.ParamRegExp||n===Ct.ParamRegExpEnd?(o.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),o.push({type:$r.Param,value:u,regexp:d,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function g(){u+=c}for(;l<e.length;){if(c=e[l++],c==="\\"&&n!==Ct.ParamRegExp){r=n,n=Ct.EscapeNext;continue}switch(n){case Ct.Static:c==="/"?(u&&h(),i()):c===":"?(h(),n=Ct.Param):g();break;case Ct.EscapeNext:g(),n=r;break;case Ct.Param:c==="("?n=Ct.ParamRegExp:wg.test(c)?g():(h(),n=Ct.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--);break;case Ct.ParamRegExp:c===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+c:n=Ct.ParamRegExpEnd:d+=c;break;case Ct.ParamRegExpEnd:h(),n=Ct.Static,c!=="*"&&c!=="?"&&c!=="+"&&l--,d="";break;default:t("Unknown state");break}}return n===Ct.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),h(),i(),s}const vc="[^/]+?",_g={sensitive:!1,strict:!1,start:!0,end:!0};var Gt=(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})(Gt||{});const kg=/[.+*?^${}()[\]/\\]/g;function Tg(e,t){const n=it({},_g,t),r=[];let s=n.start?"^":"";const o=[];for(const u of e){const d=u.length?[]:[Gt.Root];n.strict&&!u.length&&(s+="/");for(let h=0;h<u.length;h++){const g=u[h];let k=Gt.Segment+(n.sensitive?Gt.BonusCaseSensitive:0);if(g.type===$r.Static)h||(s+="/"),s+=g.value.replace(kg,"\\$&"),k+=Gt.Static;else if(g.type===$r.Param){const{value:j,repeatable:A,optional:B,regexp:Z}=g;o.push({name:j,repeatable:A,optional:B});const V=Z||vc;if(V!==vc){k+=Gt.BonusCustomRegExp;try{`${V}`}catch(z){throw new Error(`Invalid custom RegExp for param "${j}" (${V}): `+z.message)}}let X=A?`((?:${V})(?:/(?:${V}))*)`:`(${V})`;h||(X=B&&u.length<2?`(?:/${X})`:"/"+X),B&&(X+="?"),s+=X,k+=Gt.Dynamic,B&&(k+=Gt.BonusOptional),A&&(k+=Gt.BonusRepeatable),V===".*"&&(k+=Gt.BonusWildcard)}d.push(k)}r.push(d)}if(n.strict&&n.end){const u=r.length-1;r[u][r[u].length-1]+=Gt.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function l(u){const d=u.match(i),h={};if(!d)return null;for(let g=1;g<d.length;g++){const k=d[g]||"",j=o[g-1];h[j.name]=k&&j.repeatable?k.split("/"):k}return h}function c(u){let d="",h=!1;for(const g of e){(!h||!d.endsWith("/"))&&(d+="/"),h=!1;for(const k of g)if(k.type===$r.Static)d+=k.value;else if(k.type===$r.Param){const{value:j,repeatable:A,optional:B}=k,Z=j in u?u[j]:"";if(vn(Z)&&!A)throw new Error(`Provided param "${j}" is an array but it is not repeatable (* or + modifiers)`);const V=vn(Z)?Z.join("/"):Z;if(!V)if(B)g.length<2&&(d.endsWith("/")?d=d.slice(0,-1):h=!0);else throw new Error(`Missing required param "${j}"`);d+=V}}return d||"/"}return{re:i,score:r,keys:o,parse:l,stringify:c}}function Ig(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]===Gt.Static+Gt.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Gt.Static+Gt.Segment?1:-1:0}function tf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=Ig(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(yc(r))return 1;if(yc(s))return-1}return s.length-r.length}function yc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Sg={strict:!1,end:!0,sensitive:!1};function Eg(e,t,n){const r=Tg(bg(e.path),n),s=it(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function Cg(e,t){const n=[],r=new Map;t=uc(Sg,t);function s(h){return r.get(h)}function o(h,g,k){const j=!k,A=bc(h);A.aliasOf=k&&k.record;const B=uc(t,h),Z=[A];if("alias"in h){const z=typeof h.alias=="string"?[h.alias]:h.alias;for(const ae of z)Z.push(bc(it({},A,{components:k?k.record.components:A.components,path:ae,aliasOf:k?k.record:A})))}let V,X;for(const z of Z){const{path:ae}=z;if(g&&ae[0]!=="/"){const ue=g.record.path,me=ue[ue.length-1]==="/"?"":"/";z.path=g.record.path+(ae&&me+ae)}if(V=Eg(z,g,B),k?k.alias.push(V):(X=X||V,X!==V&&X.alias.push(V),j&&h.name&&!_c(V)&&i(h.name)),nf(V)&&c(V),A.children){const ue=A.children;for(let me=0;me<ue.length;me++)o(ue[me],V,k&&k.children[me])}k=k||V}return X?()=>{i(X)}:Ls}function i(h){if(Qd(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 l(){return n}function c(h){const g=Pg(h,n);n.splice(g,0,h),h.record.name&&!_c(h)&&r.set(h.record.name,h)}function u(h,g){let k,j={},A,B;if("name"in h&&h.name){if(k=r.get(h.name),!k)throw ds(Tt.MATCHER_NOT_FOUND,{location:h});B=k.record.name,j=it(wc(g.params,k.keys.filter(X=>!X.optional).concat(k.parent?k.parent.keys.filter(X=>X.optional):[]).map(X=>X.name)),h.params&&wc(h.params,k.keys.map(X=>X.name))),A=k.stringify(j)}else if(h.path!=null)A=h.path,k=n.find(X=>X.re.test(A)),k&&(j=k.parse(A),B=k.record.name);else{if(k=g.name?r.get(g.name):n.find(X=>X.re.test(g.path)),!k)throw ds(Tt.MATCHER_NOT_FOUND,{location:h,currentLocation:g});B=k.record.name,j=it({},g.params,h.params),A=k.stringify(j)}const Z=[];let V=k;for(;V;)Z.unshift(V.record),V=V.parent;return{name:B,path:A,params:j,matched:Z,meta:Rg(Z)}}e.forEach(h=>o(h));function d(){n.length=0,r.clear()}return{addRoute:o,resolve:u,removeRoute:i,clearRoutes:d,getRoutes:l,getRecordMatcher:s}}function wc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function bc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Ag(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 Ag(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 _c(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Rg(e){return e.reduce((t,n)=>it(t,n.meta),{})}function Pg(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;tf(e,t[o])<0?r=o:n=o+1}const s=xg(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function xg(e){let t=e;for(;t=t.parent;)if(nf(t)&&tf(e,t)===0)return t}function nf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function kc(e){const t=fn(si),n=fn(Qa),r=ie(()=>{const c=ge(e.to);return t.resolve(c)}),s=ie(()=>{const{matched:c}=r.value,{length:u}=c,d=c[u-1],h=n.matched;if(!d||!h.length)return-1;const g=h.findIndex(us.bind(null,d));if(g>-1)return g;const k=Tc(c[u-2]);return u>1&&Tc(d)===k&&h[h.length-1].path!==k?h.findIndex(us.bind(null,c[u-2])):g}),o=ie(()=>s.value>-1&&Dg(n.params,r.value.params)),i=ie(()=>s.value>-1&&s.value===n.matched.length-1&&Xd(n.params,r.value.params));function l(c={}){if($g(c)){const u=t[ge(e.replace)?"replace":"push"](ge(e.to)).catch(Ls);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:ie(()=>r.value.href),isActive:o,isExactActive:i,navigate:l}}function Mg(e){return e.length===1?e[0]:e}const Og=Rt({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:kc,setup(e,{slots:t}){const n=Jo(kc(e)),{options:r}=fn(si),s=ie(()=>({[Ic(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Ic(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&Mg(t.default(n));return e.custom?o:Ya("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Ng=Og;function $g(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Dg(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!vn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function Tc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Ic=(e,t,n)=>e??t??n,Lg=Rt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=fn(ga),s=ie(()=>e.route||r.value),o=fn(mc,0),i=ie(()=>{let u=ge(o);const{matched:d}=s.value;let h;for(;(h=d[u])&&!h.components;)u++;return u}),l=ie(()=>s.value.matched[i.value]);wo(mc,ie(()=>i.value+1)),wo(dg,l),wo(ga,s);const c=$();return pt(()=>[c.value,l.value,e.name],([u,d,h],[g,k,j])=>{d&&(d.instances[h]=u,k&&k!==d&&u&&u===g&&(d.leaveGuards.size||(d.leaveGuards=k.leaveGuards),d.updateGuards.size||(d.updateGuards=k.updateGuards))),u&&d&&(!k||!us(d,k)||!g)&&(d.enterCallbacks[h]||[]).forEach(A=>A(u))},{flush:"post"}),()=>{const u=s.value,d=e.name,h=l.value,g=h&&h.components[d];if(!g)return Sc(n.default,{Component:g,route:u});const k=h.props[d],j=k?k===!0?u.params:typeof k=="function"?k(u):k:null,B=Ya(g,it({},j,t,{onVnodeUnmounted:Z=>{Z.component.isUnmounted&&(h.instances[d]=null)},ref:c}));return Sc(n.default,{Component:B,route:u})||B}}});function Sc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const jg=Lg;function Bg(e){const t=Cg(e.routes,e),n=e.parseQuery||cg,r=e.stringifyQuery||pc,s=e.history,o=Es(),i=Es(),l=Es(),c=jh(lr);let u=lr;Zr&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=xi.bind(null,W=>""+W),h=xi.bind(null,qm),g=xi.bind(null,Ks);function k(W,fe){let le,he;return Qd(W)?(le=t.getRecordMatcher(W),he=fe):he=W,t.addRoute(he,le)}function j(W){const fe=t.getRecordMatcher(W);fe&&t.removeRoute(fe)}function A(){return t.getRoutes().map(W=>W.record)}function B(W){return!!t.getRecordMatcher(W)}function Z(W,fe){if(fe=it({},fe||c.value),typeof W=="string"){const R=Mi(n,W,fe.path),G=t.resolve({path:R.path},fe),U=s.createHref(R.fullPath);return it(R,G,{params:g(G.params),hash:Ks(R.hash),redirectedFrom:void 0,href:U})}let le;if(W.path!=null)le=it({},W,{path:Mi(n,W.path,fe.path).path});else{const R=it({},W.params);for(const G in R)R[G]==null&&delete R[G];le=it({},W,{params:h(R)}),fe.params=h(fe.params)}const he=t.resolve(le,fe),Ne=W.hash||"";he.params=d(g(he.params));const v=Jm(r,it({},W,{hash:Vm(Ne),path:he.path})),y=s.createHref(v);return it({fullPath:v,hash:Ne,query:r===pc?ug(W.query):W.query||{}},he,{redirectedFrom:void 0,href:y})}function V(W){return typeof W=="string"?Mi(n,W,c.value.path):it({},W)}function X(W,fe){if(u!==W)return ds(Tt.NAVIGATION_CANCELLED,{from:fe,to:W})}function z(W){return me(W)}function ae(W){return z(it(V(W),{replace:!0}))}function ue(W,fe){const le=W.matched[W.matched.length-1];if(le&&le.redirect){const{redirect:he}=le;let Ne=typeof he=="function"?he(W,fe):he;return typeof Ne=="string"&&(Ne=Ne.includes("?")||Ne.includes("#")?Ne=V(Ne):{path:Ne},Ne.params={}),it({query:W.query,hash:W.hash,params:Ne.path!=null?{}:W.params},Ne)}}function me(W,fe){const le=u=Z(W),he=c.value,Ne=W.state,v=W.force,y=W.replace===!0,R=ue(le,he);if(R)return me(it(V(R),{state:typeof R=="object"?it({},Ne,R.state):Ne,force:v,replace:y}),fe||le);const G=le;G.redirectedFrom=fe;let U;return!v&&Ym(r,he,le)&&(U=ds(Tt.NAVIGATION_DUPLICATED,{to:G,from:he}),He(he,he,!0,!1)),(U?Promise.resolve(U):ee(G,he)).catch(x=>Ln(x)?Ln(x,Tt.NAVIGATION_GUARD_REDIRECT)?x:Ge(x):Ie(x,G,he)).then(x=>{if(x){if(Ln(x,Tt.NAVIGATION_GUARD_REDIRECT))return me(it({replace:y},V(x.to),{state:typeof x.to=="object"?it({},Ne,x.to.state):Ne,force:v}),fe||G)}else x=Y(G,he,!0,y,Ne);return te(G,he,x),x})}function be(W,fe){const le=X(W,fe);return le?Promise.reject(le):Promise.resolve()}function oe(W){const fe=dt.values().next().value;return fe&&typeof fe.runWithContext=="function"?fe.runWithContext(W):W()}function ee(W,fe){let le;const[he,Ne,v]=fg(W,fe);le=Ni(he.reverse(),"beforeRouteLeave",W,fe);for(const R of he)R.leaveGuards.forEach(G=>{le.push(fr(G,W,fe))});const y=be.bind(null,W,fe);return le.push(y),Ue(le).then(()=>{le=[];for(const R of o.list())le.push(fr(R,W,fe));return le.push(y),Ue(le)}).then(()=>{le=Ni(Ne,"beforeRouteUpdate",W,fe);for(const R of Ne)R.updateGuards.forEach(G=>{le.push(fr(G,W,fe))});return le.push(y),Ue(le)}).then(()=>{le=[];for(const R of v)if(R.beforeEnter)if(vn(R.beforeEnter))for(const G of R.beforeEnter)le.push(fr(G,W,fe));else le.push(fr(R.beforeEnter,W,fe));return le.push(y),Ue(le)}).then(()=>(W.matched.forEach(R=>R.enterCallbacks={}),le=Ni(v,"beforeRouteEnter",W,fe,oe),le.push(y),Ue(le))).then(()=>{le=[];for(const R of i.list())le.push(fr(R,W,fe));return le.push(y),Ue(le)}).catch(R=>Ln(R,Tt.NAVIGATION_CANCELLED)?R:Promise.reject(R))}function te(W,fe,le){l.list().forEach(he=>oe(()=>he(W,fe,le)))}function Y(W,fe,le,he,Ne){const v=X(W,fe);if(v)return v;const y=fe===lr,R=Zr?history.state:{};le&&(he||y?s.replace(W.fullPath,it({scroll:y&&R&&R.scroll},Ne)):s.push(W.fullPath,Ne)),c.value=W,He(W,fe,le,y),Ge()}let Ce;function _e(){Ce||(Ce=s.listen((W,fe,le)=>{if(!Te.listening)return;const he=Z(W),Ne=ue(he,Te.currentRoute.value);if(Ne){me(it(Ne,{replace:!0,force:!0}),he).catch(Ls);return}u=he;const v=c.value;Zr&&sg(hc(v.fullPath,le.delta),ri()),ee(he,v).catch(y=>Ln(y,Tt.NAVIGATION_ABORTED|Tt.NAVIGATION_CANCELLED)?y:Ln(y,Tt.NAVIGATION_GUARD_REDIRECT)?(me(it(V(y.to),{force:!0}),he).then(R=>{Ln(R,Tt.NAVIGATION_ABORTED|Tt.NAVIGATION_DUPLICATED)&&!le.delta&&le.type===pa.pop&&s.go(-1,!1)}).catch(Ls),Promise.reject()):(le.delta&&s.go(-le.delta,!1),Ie(y,he,v))).then(y=>{y=y||Y(he,v,!1),y&&(le.delta&&!Ln(y,Tt.NAVIGATION_CANCELLED)?s.go(-le.delta,!1):le.type===pa.pop&&Ln(y,Tt.NAVIGATION_ABORTED|Tt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),te(he,v,y)}).catch(Ls)}))}let Oe=Es(),Ae=Es(),ye;function Ie(W,fe,le){Ge(W);const he=Ae.list();return he.length?he.forEach(Ne=>Ne(W,fe,le)):console.error(W),Promise.reject(W)}function ut(){return ye&&c.value!==lr?Promise.resolve():new Promise((W,fe)=>{Oe.add([W,fe])})}function Ge(W){return ye||(ye=!W,_e(),Oe.list().forEach(([fe,le])=>W?le(W):fe()),Oe.reset()),W}function He(W,fe,le,he){const{scrollBehavior:Ne}=e;if(!Zr||!Ne)return Promise.resolve();const v=!le&&og(hc(W.fullPath,0))||(he||!le)&&history.state&&history.state.scroll||null;return Jt().then(()=>Ne(W,fe,v)).then(y=>y&&rg(y)).catch(y=>Ie(y,W,fe))}const qe=W=>s.go(W);let Qe;const dt=new Set,Te={currentRoute:c,listening:!0,addRoute:k,removeRoute:j,clearRoutes:t.clearRoutes,hasRoute:B,getRoutes:A,resolve:Z,options:e,push:z,replace:ae,go:qe,back:()=>qe(-1),forward:()=>qe(1),beforeEach:o.add,beforeResolve:i.add,afterEach:l.add,onError:Ae.add,isReady:ut,install(W){W.component("RouterLink",Ng),W.component("RouterView",jg),W.config.globalProperties.$router=Te,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>ge(c)}),Zr&&!Qe&&c.value===lr&&(Qe=!0,z(s.location).catch(he=>{}));const fe={};for(const he in lr)Object.defineProperty(fe,he,{get:()=>c.value[he],enumerable:!0});W.provide(si,Te),W.provide(Qa,Qu(fe)),W.provide(ga,c);const le=W.unmount;dt.add(W),W.unmount=function(){dt.delete(W),dt.size<1&&(u=lr,Ce&&Ce(),Ce=null,c.value=lr,Qe=!1,ye=!1),le()}}};function Ue(W){return W.reduce((fe,le)=>fe.then(()=>oe(le)),Promise.resolve())}return Te}function Fg(){return fn(si)}function Ug(e){return fn(Qa)}const Ec=768;function rf(){const e=$(typeof window<"u"?window.innerWidth<Ec:!1);let t=null;function n(r){e.value=r.matches}return Zn(()=>{t=window.matchMedia(`(max-width: ${Ec-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Zo(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Hg={key:0,class:"desktop-sidebar"},Vg={class:"desktop-main"},Cc="codex-web-local.sidebar-width.v1",Wg=260,Gg=620,Ac=320,qg=Rt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=rf();function r(u){return Math.min(Gg,Math.max(Wg,u))}function s(){if(typeof window>"u")return Ac;const u=window.localStorage.getItem(Cc),d=Number(u);return Number.isFinite(d)?r(d):Ac}const o=$(s()),i=ie(()=>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 l(u){typeof window>"u"||window.localStorage.setItem(Cc,String(u))}function c(u){u.preventDefault();const d=u.clientX,h=o.value,g=j=>{const A=j.clientX-d;o.value=r(h+A)},k=()=>{l(o.value),window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",k)};window.addEventListener("mousemove",g),window.addEventListener("mouseup",k)}return(u,d)=>(w(),T("div",{class:rt(["desktop-layout",{"is-mobile":ge(n)}]),style:Fr(i.value)},[ge(n)?(w(),lt(xo,{key:0,to:"body"},[Ee(Wd,{name:"drawer"},{default:ht(()=>[e.isSidebarCollapsed?se("",!0):(w(),T("div",{key:0,class:"mobile-drawer-backdrop",onClick:d[1]||(d[1]=h=>u.$emit("close-sidebar"))},[m("aside",{class:"mobile-drawer",onClick:d[0]||(d[0]=nt(()=>{},["stop"]))},[Cn(u.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):se("",!0),ge(n)?se("",!0):(w(),T(De,{key:1},[e.isSidebarCollapsed?se("",!0):(w(),T("aside",Hg,[Cn(u.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?se("",!0):(w(),T("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:c},null,32))],64)),m("section",Vg,[Cn(u.$slots,"content",{},void 0)])],6))}}),et=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},zg=et(qg,[["__scopeId","data-v-df29c633"]]),Kg={},Jg={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Yg(e,t){return w(),T("svg",Jg,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const oi=et(Kg,[["render",Yg]]),Xg={},Qg={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Zg(e,t){return w(),T("svg",Qg,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const sf=et(Xg,[["render",Zg]]),ev={},tv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function nv(e,t){return w(),T("svg",tv,[...t[0]||(t[0]=[m("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 Cs=et(ev,[["render",nv]]),rv={},sv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function ov(e,t){return w(),T("svg",sv,[...t[0]||(t[0]=[m("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 Do=et(rv,[["render",ov]]),iv={},av={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function lv(e,t){return w(),T("svg",av,[...t[0]||(t[0]=[m("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 Za=et(iv,[["render",lv]]),cv={},uv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function dv(e,t){return w(),T("svg",uv,[...t[0]||(t[0]=[m("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 fv=et(cv,[["render",dv]]),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 w(),T("svg",pv,[...t[0]||(t[0]=[m("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 To=et(hv,[["render",mv]]),gv={},vv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function yv(e,t){return w(),T("svg",vv,[...t[0]||(t[0]=[m("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 $i=et(gv,[["render",yv]]),wv={key:0,class:"sidebar-menu-row-left"},bv={class:"sidebar-menu-row-main"},_v={key:1,class:"sidebar-menu-row-right"},kv={key:0,class:"sidebar-menu-row-right-default"},Tv={key:1,class:"sidebar-menu-row-right-hover"},Iv=Rt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=pp(),r=ie(()=>!!n.left),s=ie(()=>!!n.right),o=ie(()=>!!n["right-hover"]),i=ie(()=>s.value||o.value);return(l,c)=>(w(),lt(ia(t.as),jd({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},l.$attrs),{default:ht(()=>[r.value?(w(),T("span",wv,[Cn(l.$slots,"left",{},void 0,!0)])):se("",!0),m("span",bv,[Cn(l.$slots,"default",{},void 0,!0)]),i.value?(w(),T("span",_v,[s.value?(w(),T("span",kv,[Cn(l.$slots,"right",{},void 0,!0)])):se("",!0),o.value?(w(),T("span",Tv,[Cn(l.$slots,"right-hover",{},void 0,!0)])):se("",!0)])):se("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Pr=et(Iv,[["__scopeId","data-v-daeca4df"]]),Sv={class:"thread-tree-root"},Ev={key:0,class:"pinned-section"},Cv={class:"thread-list"},Av={class:"thread-left-stack"},Rv=["data-state"],Pv=["onClick"],xv=["onClick"],Mv={class:"thread-row-title-wrap"},Ov={class:"thread-row-title"},Nv={class:"thread-row-time"},$v=["onClick"],Dv=["onClick"],Lv=["onClick"],jv=["onClick"],Bv=["aria-expanded"],Fv=["data-active"],Uv={key:0},Hv=["data-active"],Vv={key:0},Wv={key:1,class:"thread-tree-no-results"},Gv={key:2,class:"thread-tree-loading"},qv={key:3,class:"thread-list thread-list-global"},zv={class:"thread-left-stack"},Kv=["data-state"],Jv=["onClick"],Yv=["onClick"],Xv={class:"thread-row-title-wrap"},Qv={class:"thread-row-title"},Zv={class:"thread-row-time"},ey=["onClick"],ty=["onClick"],ny=["onClick"],ry=["onClick"],sy=["data-project-name","data-expanded","data-dragging"],oy={class:"project-icon-stack"},iy={class:"project-icon-folder"},ay={class:"project-icon-chevron"},ly=["data-dragging-handle","onMousedown"],cy={class:"project-title"},uy={class:"project-hover-controls"},dy=["onClick"],fy=["onClick"],hy=["onClick"],py=["onClick"],my=["onInput"],gy=["aria-label","title","onClick"],vy={key:0,class:"thread-list"},yy={class:"thread-left-stack"},wy=["data-state"],by=["onClick"],_y=["onClick"],ky={class:"thread-row-title-wrap"},Ty={class:"thread-row-title"},Iy={class:"thread-row-time"},Sy=["onClick"],Ey=["onClick"],Cy=["onClick"],Ay=["onClick"],Ry=["onClick"],Py={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},xy=["onKeydown"],My={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},Oy={class:"rename-thread-subtitle"},Ny=4,Rc=6,Pc="codex-web-local.thread-view-mode.v1",xc="codex-web-local.collapsed-projects.v1",$y=Rt({__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=$({}),o=$({}),i=$([]),l=$(""),c=$(""),u=$("actions"),d=$(""),h=$(!1),g=$(""),k=$(""),j=$(null),A=$(!1),B=$(""),Z=$(""),V=$(null),X=$(null),z=$(null);let ae=null,ue=null;const me=$(""),be=$({}),oe=new Map,ee=new Map,te=new Map,Y=new WeakMap,Ce=$(null),_e=$(!1),Oe=$(Ie()),Ae=typeof window<"u"?new ResizeObserver(S=>{for(const M of S){const O=M.target,Q=Y.get(O);Q&&H(Q,O)}}):null;function ye(){if(typeof window>"u")return{};try{const S=window.localStorage.getItem(xc);if(!S)return{};const M=JSON.parse(S);return!M||typeof M!="object"||Array.isArray(M)?{}:M}catch{return{}}}function Ie(){return typeof window>"u"?"project":window.localStorage.getItem(Pc)==="chronological"?"chronological":"project"}o.value=ye(),pt(o,S=>{typeof window>"u"||window.localStorage.setItem(xc,JSON.stringify(S))},{deep:!0}),pt(Oe,S=>{typeof window>"u"||window.localStorage.setItem(Pc,S)});const ut=ie(()=>n.searchQuery.trim().toLowerCase()),Ge=ie(()=>ut.value.length>0),He=ie(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function qe(S){if(!Ge.value)return!0;if(He.value)return He.value.has(S.id);const M=ut.value;return S.title.toLowerCase().includes(M)||S.preview.toLowerCase().includes(M)}const Qe=ie(()=>Ge.value?n.groups.map(S=>({...S,threads:S.threads.filter(qe)})).filter(S=>S.threads.length>0):n.groups),dt=ie(()=>Oe.value==="chronological"),Te=ie(()=>{const S=Qe.value,M=[];for(const O of S)for(const Q of O.threads)y(Q.id)||M.push(Q);return M.sort((O,Q)=>{const Be=new Date(O.updatedAtIso||O.createdAtIso).getTime();return new Date(Q.updatedAtIso||Q.createdAtIso).getTime()-Be})}),Ue=ie(()=>{const S=new Map;for(const M of n.groups)for(const O of M.threads)S.set(O.id,O);return S}),W=ie(()=>i.value.map(S=>Ue.value.get(S)??null).filter(S=>S!==null).filter(qe)),fe=ie(()=>{const S=z.value;if(!S||S.dropTargetIndexFull===null||n.groups.length===0)return null;const M=Math.max(0,Math.min(S.dropTargetIndexFull,n.groups.length)),O=M>S.fromIndex?M-1:M,Q=Math.max(0,Math.min(O,n.groups.length-1));return Q===S.fromIndex?null:Q}),le=ie(()=>{const M=(Ge.value?Qe.value:n.groups).map(Qt=>Qt.projectName),O=z.value,Q=fe.value;if(!O||Q===null)return M;const Be=[...M],[Et]=Be.splice(O.fromIndex,1);return Et?(Be.splice(Q,0,Et),Be):M}),he=ie(()=>{const S={};let M=0;for(const O of le.value)S[O]=M,M+=St(O);return S}),Ne=ie(()=>{let S=0;for(const M of le.value)S+=St(M);return{height:`${Math.max(0,S)}px`}});function v(S){const M=new Date(S).getTime();if(Number.isNaN(M))return"n/a";const O=Math.abs(Date.now()-M);if(O<6e4)return"now";const Q=Math.floor(O/6e4);if(Q<60)return`${Q}m`;const Be=Math.floor(Q/60);return Be<24?`${Be}h`:`${Math.floor(Be/24)}d`}function y(S){return i.value.includes(S)}function R(S){if(y(S)){i.value=i.value.filter(M=>M!==S);return}i.value=[S,...i.value]}function G(S){r("select",S)}function U(S){r("export-thread",S),q()}function x(S){return`start new thread ${Xe(S)}`}function D(S){r("start-new-thread",S)}function F(S){c.value===S&&q()}function J(S){return c.value===S}function q(){c.value=""}function we(S){if(c.value===S){q();return}c.value=S}function de(S,M){g.value=S,k.value=M,h.value=!0,q(),Jt(()=>{var O,Q;(O=j.value)==null||O.focus(),(Q=j.value)==null||Q.select()})}function pe(){h.value=!1,g.value="",k.value=""}function ke(){const S=g.value,M=k.value.trim();!S||!M||(r("rename-thread",{threadId:S,title:M}),pe())}function Me(S,M){B.value=S,Z.value=M,A.value=!0,q()}function Ve(){A.value=!1,B.value="",Z.value=""}function $e(){const S=B.value;S&&(i.value=i.value.filter(M=>M!==S),r("archive",S),Ve())}function Xe(S){return n.projectDisplayNameById[S]??S}function ot(S){return l.value===S}function Je(){l.value="",u.value="actions",d.value=""}function je(){_e.value=!_e.value}function It(S){Oe.value=S,_e.value=!1}function Ut(S){if(l.value===S){Je();return}l.value=S,u.value="actions",d.value=Xe(S)}function ft(S){l.value=S,u.value="rename",d.value=Xe(S)}function _t(S){r("rename-project",{projectName:S,displayName:d.value})}function Ht(S){r("remove-project",S),Je()}function Pt(S){r("browse-project-files",S),Je()}function xt(S,M){if(!S.altKey||S.key!=="ArrowUp"&&S.key!=="ArrowDown")return;const O=n.groups.findIndex(Et=>Et.projectName===M);if(O<0)return;const Q=S.key==="ArrowUp"?-1:1,Be=Math.max(0,Math.min(O+Q,n.groups.length-1));Be!==O&&(S.preventDefault(),r("reorder-project",{projectName:M,toIndex:Be}))}function Mt(S){return s.value[S]===!0}function xe(S){return o.value[S]===!0}function Se(S){s.value={...s.value,[S]:!Mt(S)}}function Xt(S){if(me.value===S){me.value="";return}o.value={...o.value,[S]:!xe(S)}}function St(S){const M=be.value[S]??0,O=z.value,Be=((O==null?void 0:O.projectName)===S?O.groupHeight:null)??M,Et=xe(S)?0:Rc;return Math.max(0,Be+Et)}function ln(S,M){const O=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(O){ee.set(S,O);return}ee.delete(S)}function tn(S,M){const O=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(O){te.set(S,O);return}te.delete(S)}function cn(S){const M=l.value;if(!M)return!1;const O=ee.get(M);if(!O)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(O))return!0;const Be=S.target;return Be instanceof Node?O.contains(Be):!1}function _(S){const M=c.value;if(!M)return!1;const O=te.get(M);if(!O)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes(O))return!0;const Be=S.target;return Be instanceof Node?O.contains(Be):!1}function E(S){if(_e.value){const M=Ce.value,O=typeof S.composedPath=="function"?S.composedPath():[];!!M&&(O.includes(M)||S.target instanceof Node&&M.contains(S.target))||(_e.value=!1)}l.value&&(cn(S)||Je(),c.value&&(_(S)||q()))}function C(S){l.value&&!cn(S)&&Je(),c.value&&!_(S)&&q()}function K(){_e.value&&(_e.value=!1),l.value&&Je(),c.value&&q()}function I(){window.addEventListener("pointerdown",E,{capture:!0}),window.addEventListener("focusin",C,{capture:!0}),window.addEventListener("blur",K)}function P(){window.removeEventListener("pointerdown",E,{capture:!0}),window.removeEventListener("focusin",C,{capture:!0}),window.removeEventListener("blur",K)}function H(S,M){const O=M.getBoundingClientRect().height;if(!Number.isFinite(O)||O<=0)return;const Q=be.value[S];Q!==void 0&&Math.abs(Q-O)<.5||(be.value={...be.value,[S]:O})}function re(S,M){const O=oe.get(S);O&&O!==M&&Ae&&Ae.unobserve(O);const Q=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(Q){oe.set(S,Q),Y.set(Q,S),H(S,Q),Ae==null||Ae.observe(Q);return}O&&(Ae==null||Ae.unobserve(O)),oe.delete(S)}function Re(S,M){if(S.button!==0||X.value||z.value)return;const O=n.groups.findIndex(Qt=>Qt.projectName===M),Q=oe.get(M);if(O<0||!Q)return;const Be=Q.getBoundingClientRect(),Et=xe(M)?0:Rc;X.value={projectName:M,fromIndex:O,startClientX:S.clientX,startClientY:S.clientY,pointerOffsetY:S.clientY-Be.top,groupLeft:Be.left,groupWidth:Be.width,groupHeight:Be.height,groupOuterHeight:Be.height+Et},S.preventDefault(),Ye()}function Ye(){window.addEventListener("mousemove",Ze),window.addEventListener("mouseup",wt),window.addEventListener("keydown",Vt)}function ze(){window.removeEventListener("mousemove",Ze),window.removeEventListener("mouseup",wt),window.removeEventListener("keydown",Vt)}function Ze(S){ae={clientX:S.clientX,clientY:S.clientY},ys()}function wt(S){Hr({clientX:S.clientX,clientY:S.clientY});const M=z.value;if(M&&fe.value!==null){const O=n.groups.findIndex(Q=>Q.projectName===M.projectName);if(O>=0){const Q=fe.value;Q!==O&&r("reorder-project",{projectName:M.projectName,toIndex:Q})}}tr()}function Vt(S){S.key==="Escape"&&(!X.value&&!z.value||(S.preventDefault(),tr()))}function tr(){ue!==null&&(window.cancelAnimationFrame(ue),ue=null),ae=null,X.value=null,z.value=null,me.value="",ze()}function ys(){ue===null&&(ue=window.requestAnimationFrame(()=>{if(ue=null,!ae)return;const S=ae;ae=null,Hr(S)}))}function Hr(S){const M=X.value;if(!z.value&&M){const O=S.clientX-M.startClientX,Q=S.clientY-M.startClientY;if(Math.hypot(O,Q)<Ny)return;Je(),me.value=M.projectName,z.value={projectName:M.projectName,fromIndex:M.fromIndex,pointerOffsetY:M.pointerOffsetY,groupLeft:M.groupLeft,groupWidth:M.groupWidth,groupHeight:M.groupHeight,groupOuterHeight:M.groupOuterHeight,ghostTop:S.clientY-M.pointerOffsetY,dropTargetIndexFull:null}}z.value&&ws(S)}function ws(S){const M=z.value;if(!M)return;if(M.ghostTop=S.clientY-M.pointerOffsetY,!kr(S)){M.dropTargetIndexFull=null;return}const O=S.clientY,Q=V.value;if(!Q){M.dropTargetIndexFull=null;return}const Be=Q.getBoundingClientRect(),Et=new Map(n.groups.map((nn,or)=>[nn.projectName,or])),Qt=n.groups.map(nn=>nn.projectName).filter(nn=>nn!==M.projectName);let sr=0,Mn=n.groups.length;for(const nn of Qt){const or=Et.get(nn);if(or===void 0)continue;const qr=St(nn),bs=Be.top+sr+qr/2;if(O<bs){Mn=or;break}sr+=qr}M.dropTargetIndexFull=Mn}function kr(S){const M=V.value;if(!M)return!1;const O=M.getBoundingClientRect(),Q=S.clientX>=O.left&&S.clientX<=O.right,Be=S.clientY>=O.top-32&&S.clientY<=O.bottom+32;return Q&&Be}function xn(S){var M;return((M=z.value)==null?void 0:M.projectName)===S}function Vr(S){const M=z.value,O=he.value[S]??0,Q=l.value===S;return!M||M.projectName!==S?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Q?"40":"1",transform:`translate3d(0, ${O}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${M.groupLeft}px`,width:`${M.groupWidth}px`,height:`${M.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${M.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function nr(S){return S.threads.filter(M=>!y(M.id))}function Wr(S){if(Ge.value)return nr(S);if(xe(S.projectName))return[];const M=nr(S);return Mt(S.projectName)?M:M.slice(0,10)}function Gr(S){return Ge.value?!1:!xe(S.projectName)&&nr(S).length>10}function Tr(S){return nr(S).length>0}function Ir(S){return S.inProgress?"working":S.unread?"unread":"idle"}pt(()=>n.groups.map(S=>S.projectName),S=>{var Be,Et;const M=((Be=z.value)==null?void 0:Be.projectName)??((Et=X.value)==null?void 0:Et.projectName)??"";M&&!n.groups.some(Qt=>Qt.projectName===M)&&tr();const O=new Set(S),Q=Object.fromEntries(Object.entries(be.value).filter(([Qt])=>O.has(Qt)));Object.keys(Q).length!==Object.keys(be.value).length&&(be.value=Q)});const rr=ie(()=>_e.value||l.value!=="");return pt(rr,S=>{if(S){I();return}P()}),er(()=>{for(const S of oe.values())Ae==null||Ae.unobserve(S);oe.clear(),ee.clear(),P(),tr()}),(S,M)=>(w(),T("section",Sv,[W.value.length>0?(w(),T("section",Ev,[m("ul",Cv,[(w(!0),T(De,null,yt(W.value,O=>(w(),T("li",{key:O.id,class:"thread-row-item"},[Ee(Pr,{class:"thread-row","data-active":O.id===e.selectedThreadId,"data-pinned":y(O.id),onMouseleave:Q=>F(O.id)},{left:ht(()=>[m("span",Av,[O.inProgress||O.unread?(w(),T("span",{key:0,class:"thread-status-indicator","data-state":Ir(O)},null,8,Rv)):se("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>R(O.id)},[Ee($i,{class:"thread-icon"})],8,Pv)])]),right:ht(()=>[m("span",Nv,ne(v(O.createdAtIso||O.updatedAtIso)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:Q=>tn(O.id,Q),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:nt(Q=>we(O.id),["stop"])},[Ee(Cs,{class:"thread-icon"})],8,$v),J(O.id)?(w(),T("div",{key:0,class:"thread-menu-panel",onClick:M[0]||(M[0]=nt(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:Q=>U(O.id)}," Export chat ",8,Dv),m("button",{class:"thread-menu-item",type:"button",onClick:Q=>de(O.id,O.title)}," Rename thread ",8,Lv),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Q=>Me(O.id,O.title)}," Delete thread ",8,jv)])):se("",!0)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Q=>G(O.id)},[m("span",Mv,[m("span",Ov,ne(O.title),1),O.hasWorktree?(w(),lt(To,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):se("",!0)])],8,xv)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])])):se("",!0),Ee(Pr,{as:"header",class:"thread-tree-header-row"},{right:ht(()=>[m("div",{ref_key:"organizeMenuWrapRef",ref:Ce,class:"organize-menu-wrap"},[m("button",{class:"organize-menu-trigger",type:"button","aria-expanded":_e.value,"aria-label":"Organize threads",title:"Organize threads",onClick:je},[Ee(Cs,{class:"thread-icon"})],8,Bv),_e.value?(w(),T("div",{key:0,class:"organize-menu-panel",onClick:M[3]||(M[3]=nt(()=>{},["stop"]))},[M[11]||(M[11]=m("p",{class:"organize-menu-title"},"Organize",-1)),m("button",{class:"organize-menu-item","data-active":Oe.value==="project",type:"button",onClick:M[1]||(M[1]=O=>It("project"))},[M[9]||(M[9]=m("span",null,"By project",-1)),Oe.value==="project"?(w(),T("span",Uv,"✓")):se("",!0)],8,Fv),m("button",{class:"organize-menu-item","data-active":Oe.value==="chronological",type:"button",onClick:M[2]||(M[2]=O=>It("chronological"))},[M[10]||(M[10]=m("span",null,"Chronological list",-1)),Oe.value==="chronological"?(w(),T("span",Vv,"✓")):se("",!0)],8,Hv)])):se("",!0)],512)]),default:ht(()=>[M[12]||(M[12]=m("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),Ge.value&&Qe.value.length===0?(w(),T("p",Wv,"No matching threads")):e.isLoading&&e.groups.length===0?(w(),T("p",Gv,"Loading threads...")):dt.value?(w(),T("ul",qv,[(w(!0),T(De,null,yt(Te.value,O=>(w(),T("li",{key:O.id,class:"thread-row-item"},[Ee(Pr,{class:"thread-row","data-active":O.id===e.selectedThreadId,"data-pinned":y(O.id),onMouseleave:Q=>F(O.id)},{left:ht(()=>[m("span",zv,[O.inProgress||O.unread?(w(),T("span",{key:0,class:"thread-status-indicator","data-state":Ir(O)},null,8,Kv)):se("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>R(O.id)},[Ee($i,{class:"thread-icon"})],8,Jv)])]),right:ht(()=>[m("span",Zv,ne(v(O.createdAtIso||O.updatedAtIso)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:Q=>tn(O.id,Q),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:nt(Q=>we(O.id),["stop"])},[Ee(Cs,{class:"thread-icon"})],8,ey),J(O.id)?(w(),T("div",{key:0,class:"thread-menu-panel",onClick:M[4]||(M[4]=nt(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:Q=>U(O.id)}," Export chat ",8,ty),m("button",{class:"thread-menu-item",type:"button",onClick:Q=>de(O.id,O.title)}," Rename thread ",8,ny),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Q=>Me(O.id,O.title)}," Delete thread ",8,ry)])):se("",!0)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Q=>G(O.id)},[m("span",Xv,[m("span",Qv,ne(O.title),1),O.hasWorktree?(w(),lt(To,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):se("",!0)])],8,Yv)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(w(),T("div",{key:4,ref_key:"groupsContainerRef",ref:V,class:"thread-tree-groups",style:Fr(Ne.value)},[(w(!0),T(De,null,yt(Qe.value,O=>(w(),T("article",{key:O.projectName,ref_for:!0,ref:Q=>re(O.projectName,Q),class:"project-group","data-project-name":O.projectName,"data-expanded":!xe(O.projectName),"data-dragging":xn(O.projectName),style:Fr(Vr(O.projectName))},[Ee(Pr,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Q=>Xt(O.projectName),onKeydown:[Q=>xt(Q,O.projectName),zt(nt(Q=>Xt(O.projectName),["prevent"]),["enter"]),zt(nt(Q=>Xt(O.projectName),["prevent"]),["space"])]},{left:ht(()=>[m("span",oy,[m("span",iy,[xe(O.projectName)?(w(),lt(Za,{key:0,class:"thread-icon"})):(w(),lt(fv,{key:1,class:"thread-icon"}))]),m("span",ay,[xe(O.projectName)?(w(),lt(sf,{key:0,class:"thread-icon"})):(w(),lt(oi,{key:1,class:"thread-icon"}))])])]),right:ht(()=>[m("div",uy,[m("div",{ref_for:!0,ref:Q=>ln(O.projectName,Q),class:"project-menu-wrap"},[m("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:nt(Q=>Ut(O.projectName),["stop"])},[Ee(Cs,{class:"thread-icon"})],8,dy),ot(O.projectName)?(w(),T("div",{key:0,class:"project-menu-panel",onClick:M[6]||(M[6]=nt(()=>{},["stop"]))},[u.value==="actions"?(w(),T(De,{key:0},[m("button",{class:"project-menu-item",type:"button",onClick:Q=>Pt(O.projectName)}," Browse files ",8,fy),m("button",{class:"project-menu-item",type:"button",onClick:Q=>ft(O.projectName)}," Edit name ",8,hy),m("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Q=>Ht(O.projectName)}," Remove ",8,py)],64)):(w(),T(De,{key:1},[M[13]||(M[13]=m("label",{class:"project-menu-label"},"Project name",-1)),Kn(m("input",{"onUpdate:modelValue":M[5]||(M[5]=Q=>d.value=Q),class:"project-menu-input",type:"text",onInput:Q=>_t(O.projectName)},null,40,my),[[Jn,d.value]])],64))])):se("",!0)],512),m("button",{class:"thread-start-button",type:"button","aria-label":x(O.projectName),title:x(O.projectName),onClick:nt(Q=>D(O.projectName),["stop"])},[Ee(Do,{class:"thread-icon"})],8,gy)])]),default:ht(()=>[m("span",{class:"project-main-button","data-dragging-handle":xn(O.projectName),onMousedown:nt(Q=>Re(Q,O.projectName),["left"])},[m("span",cy,ne(Xe(O.projectName)),1)],40,ly)]),_:2},1032,["onClick","onKeydown"]),Tr(O)?(w(),T("ul",vy,[(w(!0),T(De,null,yt(Wr(O),Q=>(w(),T("li",{key:Q.id,class:"thread-row-item"},[Ee(Pr,{class:"thread-row","data-active":Q.id===e.selectedThreadId,"data-pinned":y(Q.id),onMouseleave:Be=>F(Q.id)},{left:ht(()=>[m("span",yy,[Q.inProgress||Q.unread?(w(),T("span",{key:0,class:"thread-status-indicator","data-state":Ir(Q)},null,8,wy)):se("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Be=>R(Q.id)},[Ee($i,{class:"thread-icon"})],8,by)])]),right:ht(()=>[m("span",Iy,ne(v(Q.createdAtIso||Q.updatedAtIso)),1)]),"right-hover":ht(()=>[m("div",{ref_for:!0,ref:Be=>tn(Q.id,Be),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:nt(Be=>we(Q.id),["stop"])},[Ee(Cs,{class:"thread-icon"})],8,Sy),J(Q.id)?(w(),T("div",{key:0,class:"thread-menu-panel",onClick:M[7]||(M[7]=nt(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:Be=>U(Q.id)}," Export chat ",8,Ey),m("button",{class:"thread-menu-item",type:"button",onClick:Be=>de(Q.id,Q.title)}," Rename thread ",8,Cy),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Be=>Me(Q.id,Q.title)}," Delete thread ",8,Ay)])):se("",!0)],512)]),default:ht(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Be=>G(Q.id)},[m("span",ky,[m("span",Ty,ne(Q.title),1),Q.hasWorktree?(w(),lt(To,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):se("",!0)])],8,_y)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(w(),lt(Pr,{key:1,as:"p",class:"project-empty-row"},{left:ht(()=>[...M[14]||(M[14]=[m("span",{class:"project-empty-spacer"},null,-1)])]),default:ht(()=>[M[15]||(M[15]=m("span",{class:"project-empty"},"No threads",-1))]),_:1})),Gr(O)?(w(),lt(Pr,{key:2,class:"thread-show-more-row"},{left:ht(()=>[...M[16]||(M[16]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ht(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:Q=>Se(O.projectName)},ne(Mt(O.projectName)?"Show less":"Show more"),9,Ry)]),_:2},1024)):se("",!0)],12,sy))),128))],4)),(w(),lt(xo,{to:"body"},[h.value?(w(),T("div",{key:0,class:"rename-thread-overlay",onClick:nt(pe,["self"])},[m("div",Py,[M[17]||(M[17]=m("h3",{class:"rename-thread-title"},"Rename thread",-1)),M[18]||(M[18]=m("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Kn(m("input",{ref_key:"renameThreadInputRef",ref:j,"onUpdate:modelValue":M[8]||(M[8]=O=>k.value=O),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[zt(nt(ke,["prevent"]),["enter"]),zt(nt(pe,["prevent"]),["esc"])]},null,40,xy),[[Jn,k.value]]),m("div",{class:"rename-thread-actions"},[m("button",{class:"rename-thread-button",type:"button",onClick:pe},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:ke},"Save")])])])):se("",!0)])),(w(),lt(xo,{to:"body"},[A.value?(w(),T("div",{key:0,class:"rename-thread-overlay",onClick:nt(Ve,["self"])},[m("div",My,[M[19]||(M[19]=m("h3",{class:"rename-thread-title"},"Delete thread?",-1)),m("p",Oy,' This will archive the thread "'+ne(Z.value)+'". You can find it later in archived threads. ',1),m("div",{class:"rename-thread-actions"},[m("button",{class:"rename-thread-button",type:"button",onClick:Ve},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:$e},"Delete")])])])):se("",!0)]))]))}}),Dy=et($y,[["__scopeId","data-v-e2f8a8e1"]]),Ly={class:"content-header"},jy={class:"content-leading"},By={class:"content-title"},Fy={class:"content-actions"},Uy=Rt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(w(),T("header",Ly,[m("div",jy,[Cn(t.$slots,"leading",{},void 0)]),m("h1",By,ne(e.title),1),m("div",Fy,[Cn(t.$slots,"actions",{},void 0)])]))}}),Hy=et(Uy,[["__scopeId","data-v-66ee223c"]]),Vy={},Wy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Gy(e,t){return w(),T("svg",Wy,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const el=et(Vy,[["render",Gy]]),qy={},zy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ky(e,t){return w(),T("svg",zy,[...t[0]||(t[0]=[m("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 Jy=et(qy,[["render",Ky]]),Yy={},Xy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Qy(e,t){return w(),T("svg",Xy,[...t[0]||(t[0]=[m("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 Zy=et(Yy,[["render",Qy]]),ew={class:"conversation-root"},tw={key:0,class:"conversation-loading"},nw={key:1,class:"conversation-empty"},rw={class:"message-row"},sw={class:"message-stack"},ow={class:"request-card"},iw={class:"request-title"},aw={class:"request-meta"},lw={key:0,class:"request-reason"},cw={key:1,class:"request-actions"},uw=["onClick"],dw=["onClick"],fw=["onClick"],hw=["onClick"],pw={key:2,class:"request-actions"},mw=["onClick"],gw=["onClick"],vw=["onClick"],yw=["onClick"],ww={key:3,class:"request-user-input"},bw={class:"request-question-title"},_w={key:0,class:"request-question-text"},kw=["value","onChange"],Tw=["value"],Iw=["value","onInput"],Sw=["onClick"],Ew={key:4,class:"request-actions"},Cw=["onClick"],Aw=["onClick"],Rw={key:5,class:"request-actions"},Pw=["onClick"],xw=["onClick"],Mw=["data-role","data-message-type"],Ow={key:0,class:"message-row","data-role":"system"},Nw={class:"message-stack","data-role":"system"},$w=["onClick"],Dw={class:"cmd-label"},Lw={class:"cmd-status"},jw={class:"cmd-output-inner"},Bw={class:"cmd-output"},Fw=["data-role","data-message-type"],Uw=["data-role"],Hw=["data-role"],Vw=["data-role"],Ww=["onClick"],Gw=["src"],qw={key:1,class:"message-file-attachments"},zw=["href","title"],Kw=["data-role"],Jw={key:0,class:"worked-separator-wrap","aria-live":"polite"},Yw=["onClick"],Xw={class:"worked-separator-text"},Qw={key:0,class:"worked-details"},Zw=["onClick"],eb={class:"cmd-label"},tb={class:"cmd-status"},nb={class:"cmd-output-inner"},rb={class:"cmd-output"},sb={key:1,class:"message-text-flow"},ob={key:0,class:"message-text"},ib={key:0},ab={key:1,class:"message-bold-text"},lb=["href","title"],cb=["href","title"],ub={key:4,class:"message-inline-code"},db={key:1,class:"message-text"},fb=["onClick"],hb=["src","alt","onError"],pb={key:0,class:"message-actions"},mb=["onClick"],gb=["onClick"],vb={key:0,class:"conversation-item conversation-item-overlay"},yb={class:"message-row"},wb={class:"message-stack"},bb={class:"live-overlay-inline","aria-live":"polite"},_b={class:"live-overlay-label"},kb={key:1,class:"live-overlay-error"},Tb=["src"],Ib=16,Sb=Rt({__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=$(new Set),r=$(new Set),s=$(new Set),o=$({});function i(_){return _.messageType==="commandExecution"&&!!_.commandExecution}function l(_){var E;return((E=_.commandExecution)==null?void 0:E.status)==="inProgress"||r.value.has(_.id)?!0:n.value.has(_.id)}function c(_){return r.value.has(_.id)}function u(_){var C;if(((C=_.commandExecution)==null?void 0:C.status)==="inProgress")return;const E=new Set(n.value);E.has(_.id)?E.delete(_.id):E.add(_.id),n.value=E}function d(_){const E=new Set(s.value);E.has(_.id)?E.delete(_.id):E.add(_.id),s.value=E}function h(_){return s.value.has(_.id)}function g(_){const E=_.commandExecution;if(!E)return"";switch(E.status){case"inProgress":return"⟳ Running";case"completed":return E.exitCode===0?"✓ Completed":`✗ Exit ${E.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function k(_){var C,K;const E=(C=_.commandExecution)==null?void 0:C.status;return E==="inProgress"?"cmd-status-running":E==="completed"&&((K=_.commandExecution)==null?void 0:K.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function j(_){const E=new Set(r.value);E.add(_),r.value=E,setTimeout(()=>{const C=new Set(r.value);C.delete(_),r.value=C},1e3)}function A(_,E){const C=[];for(let K=E-1;K>=0;K--){const I=_[K];if(I.messageType==="commandExecution")C.unshift(I);else if(I.role==="user"||I.messageType==="worked")break}return C}const B=e,Z=t,V=$(null),X=$(null),z=$(null),ae=$(""),ue=$({}),me=$({});let be=0,oe=0,ee=0;const te=new WeakSet,Y=$(new Set);function Ce(_){if(!_||/\s/u.test(_)||_.endsWith("/")||_.endsWith("\\"))return!1;if(_.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(_))return!1;const E=_.startsWith("/"),C=/^[A-Za-z]:[\\/]/u.test(_),K=_.startsWith("./")||_.startsWith("../")||_.startsWith("~/"),I=_.includes("/")||_.includes("\\");return E||C||K||I}function _e(_){return _.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||_}function Oe(_){return _.replace(/\\/gu,"/")}function Ae(_){if(!_.startsWith("file://"))return _;let E=_.replace(/^file:\/\//u,"");try{E=decodeURIComponent(E)}catch{}return/^\/[A-Za-z]:\//u.test(E)&&(E=E.slice(1)),E}function ye(_){const E=Oe(_),C=E.match(/^\/Users\/([^/]+)/u);if(C)return`/Users/${C[1]}`;const K=E.match(/^\/home\/([^/]+)/u);return K?`/home/${K[1]}`:""}function Ie(_){const E=Oe(_);if(!E)return E;let C="",K=E;const I=K.match(/^([A-Za-z]:)(\/.*)?$/u);I?(C=`${I[1]}/`,K=(I[2]??"").replace(/^\/+/u,"")):K.startsWith("/")&&(C="/",K=K.slice(1));const P=K.split("/").filter(Boolean),H=[];for(const Re of P)if(Re!=="."){if(Re===".."){H.length>0&&H.pop();continue}H.push(Re)}const re=H.join("/");return C?`${C}${re}`.replace(/\/+$/u,"")||C:re||E}function ut(_,E){const C=Oe(Ae(_.trim()));if(!C)return"";if(C.startsWith("/")||/^[A-Za-z]:\//u.test(C))return Ie(C);if(C.startsWith("~/")){const P=ye(E);if(P)return Ie(`${P}/${C.slice(2)}`)}const I=Oe(E.trim());return Ie(I?`${I.replace(/\/+$/u,"")}/${C}`:C)}function Ge(_){if(!_)return null;let E=_.trim();E=He(E).core.trim();let K=null;const I=E.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(I)E=I[1],K=Number(I[2]);else{const P=E.match(/^(.*):(\d+)(?::\d+)?$/u);P&&(E=P[1],K=Number(P[2]))}return E=Ae(E),Ce(E)?{path:E,line:K}:null}function He(_){let E=_,C="",K="";for(;/^[('"`[{<“‘]/u.test(E);)C+=E[0],E=E.slice(1);for(;/[)"'`\]}>”’]$/u.test(E);)K=E.slice(-1)+K,E=E.slice(0,-1);return{core:E,leading:C,trailing:K}}function qe(_){const C=_.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!C)return null;const K=(C[1]??"").trim(),I=(C[2]??"").trim(),P=He(K).core.trim()||K,H=He(I).core.trim();return H?{label:P,target:H}:null}function Qe(_){const E=[],C=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let K=0;for(const I of _.matchAll(C)){if(typeof I.index!="number")continue;const P=I.index,H=P+I[0].length;P>K&&E.push({kind:"text",value:_.slice(K,P)});let re=I[0],Re="";for(;/[.,;:]$/u.test(re);)Re=re.slice(-1)+Re,re=re.slice(0,-1);const Ye=He(re);re=Ye.core;const ze=Ye.leading,Ze=Ye.trailing+Re;if(ze&&E.push({kind:"text",value:ze}),re.startsWith("**")&&re.endsWith("**")&&re.length>4)E.push({kind:"bold",value:re.slice(2,-2)}),Ze&&E.push({kind:"text",value:Ze});else if(/^https?:\/\//u.test(re))E.push({kind:"url",value:re,href:re}),Ze&&E.push({kind:"text",value:Ze});else{const wt=Ge(re);wt?(E.push({kind:"file",value:re,path:wt.path,displayPath:re,downloadName:_e(wt.path)}),Ze&&E.push({kind:"text",value:Ze})):E.push({kind:"text",value:I[0]})}K=H}return K<_.length&&E.push({kind:"text",value:_.slice(K)}),dt(E)}function dt(_){const E=[];let C=!1,K="";const I=P=>{P&&E.push({kind:"text",value:P})};for(const P of _){if(P.kind!=="text"){C&&(I(`**${K}`),C=!1,K=""),E.push(P);continue}let H=P.value;for(;H.length>0;){const re=H.indexOf("**");if(re<0){C?K+=H:I(H);break}const Re=H.slice(0,re);C?K+=Re:I(Re),H=H.slice(re+2),C?(K.length>0?E.push({kind:"bold",value:K}):I("****"),K="",C=!1):C=!0}}return C&&I(`**${K}`),E}function Te(_){const E=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,C=[];let K=0;for(const I of _.matchAll(E)){if(typeof I.index!="number")continue;const[P,H,re]=I,Re=I.index,Ye=Re+P.length;Re>K&&C.push(...Qe(_.slice(K,Re)));const ze=qe(`[${H??""}](${re??""})`),Ze=(ze==null?void 0:ze.label)??(H??"").trim(),wt=(ze==null?void 0:ze.target)??(re??"").trim();if(/^https?:\/\//u.test(wt))C.push({kind:"url",value:Ze||wt,href:wt});else{const Vt=Ge(wt);Vt?C.push({kind:"file",value:wt,path:Vt.path,displayPath:Ze||wt,downloadName:_e(Vt.path)}):C.push({kind:"text",value:P})}K=Ye}return K<_.length&&C.push(...Qe(_.slice(K))),C}function Ue(_){if(!_.includes("`"))return Te(_);const E=[];let C=0,K=0;for(;C<_.length;){if(_[C]!=="`"){C+=1;continue}let I=1;for(;C+I<_.length&&_[C+I]==="`";)I+=1;const P="`".repeat(I);let H=C+I,re=-1;for(;H<_.length;){const Ye=_.indexOf(P,H);if(Ye<0)break;const ze=Ye>0&&_[Ye-1]==="`",Ze=Ye+I<_.length&&_[Ye+I]==="`",wt=_.slice(C+I,Ye).includes(`
|
|
26
|
-
`);if(!ze&&!Ze&&!wt){re=Ye;break}H=Ye+1}if(re<0){C+=I;continue}C>K&&E.push(...Te(_.slice(K,C)));const Re=_.slice(C+I,re);if(Re.length>0){const Ye=qe(Re);if(Ye)if(/^https?:\/\//u.test(Ye.target))E.push({kind:"url",value:Ye.label||Ye.target,href:Ye.target});else{const ze=Ge(Ye.target);ze?E.push({kind:"file",value:Ye.target,path:ze.path,displayPath:Ye.label||Ye.target,downloadName:_e(ze.path)}):E.push({kind:"code",value:Re})}else{const ze=Ge(Re);if(ze){const Ze=ze.line?`${ze.path}:${String(ze.line)}`:ze.path;E.push({kind:"file",value:Re,path:ze.path,displayPath:Ze,downloadName:_e(ze.path)})}else E.push({kind:"code",value:Re})}}else E.push({kind:"text",value:`${P}${P}`});C=re+I,K=C}return K<_.length&&E.push(...Te(_.slice(K))),E}function W(_){const E=_.trim();if(!E)return"";if(E.startsWith("data:")||E.startsWith("blob:")||E.startsWith("http://")||E.startsWith("https://")||E.startsWith("/codex-local-image?"))return E;if(E.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(E)}`;const C=E.startsWith("/"),K=/^[A-Za-z]:[\\/]/u.test(E);return C||K?`/codex-local-image?path=${encodeURIComponent(E)}`:E}function fe(_){const E=_.trim();if(!E)return"#";const C=H=>H.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(H),K=Ge(E),I=(K==null?void 0:K.path)??E,P=ut(I,B.cwd);if(C(P)){const H=P.startsWith("/")?P:`/${P}`;return`/codex-local-browse${encodeURI(H)}`}return"#"}function le(_){if(!_.includes(")return[{kind:"text",value:_}];const E=[],C=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let K=0;for(const I of _.matchAll(C)){const[P,H,re]=I;if(typeof I.index!="number")continue;const Re=I.index,Ye=Re+P.length,ze=W(re.trim());ze&&(Re>K&&E.push({kind:"text",value:_.slice(K,Re)}),E.push({kind:"image",url:ze,alt:H.trim(),markdown:P}),K=Ye)}return K<_.length&&E.push({kind:"text",value:_.slice(K)}),E.length>0?E:[{kind:"text",value:_}]}function he(_){return _!==null&&typeof _=="object"&&!Array.isArray(_)?_:null}function Ne(_){const E=new Date(_);return Number.isNaN(E.getTime())?_:E.toLocaleTimeString()}function v(_){const E=he(_.params),C=E==null?void 0:E.reason;return typeof C=="string"?C.trim():""}function y(_,E){return`${String(_)}:${E}`}function R(_){const E=he(_.params),C=Array.isArray(E==null?void 0:E.questions)?E.questions:[],K=[];for(const I of C){const P=he(I);if(!P)continue;const H=typeof P.id=="string"?P.id:"";if(!H)continue;const re=Array.isArray(P.options)?P.options.map(Re=>he(Re)).map(Re=>Re==null?void 0:Re.label).filter(Re=>typeof Re=="string"&&Re.length>0):[];K.push({id:H,header:typeof P.header=="string"?P.header:"",question:typeof P.question=="string"?P.question:"",isOther:P.isOther===!0,options:re})}return K}function G(_,E,C){const K=y(_,E),I=ue.value[K];return typeof I=="string"&&I.length>0?I:C}function U(_,E){const C=y(_,E);return me.value[C]??""}function x(_,E,C){const K=C.target;if(!(K instanceof HTMLSelectElement))return;const I=y(_,E);ue.value={...ue.value,[I]:K.value}}function D(_,E,C){const K=C.target;if(!(K instanceof HTMLInputElement))return;const I=y(_,E);me.value={...me.value,[I]:K.value}}function F(_,E){Z("respondServerRequest",{id:_,result:{decision:E}})}function J(_){const E=R(_),C={};for(const K of E){const I=G(_.id,K.id,K.options[0]||""),P=U(_.id,K.id).trim(),H=[I,P].map(re=>re.trim()).filter(re=>re.length>0);C[K.id]={answers:H}}Z("respondServerRequest",{id:_.id,result:{answers:C}})}function q(_){Z("respondServerRequest",{id:_,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function we(_){Z("respondServerRequest",{id:_,result:{success:!0,contentItems:[]}})}function de(_){Z("respondServerRequest",{id:_,result:{}})}function pe(_){Z("respondServerRequest",{id:_,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function ke(_){return!(_.role!=="user"&&_.role!=="assistant"||typeof _.turnIndex!="number"||B.isTurnInProgress||B.isRollingBack)}function Me(_){return _.role!=="user"&&_.role!=="assistant"?!1:_.text.trim().length>0}function Ve(_){return Me(_)||ke(_)}async function $e(_){if(!Me(_))return;const E=_.text.trim();try{await navigator.clipboard.writeText(E)}catch{const C=document.createElement("textarea");C.value=E,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 Xe(_){ke(_)&&Z("rollback",{turnIndex:_.turnIndex})}function ot(){const _=V.value,E=X.value;!_||!E||(_.scrollTop=_.scrollHeight,E.scrollIntoView({block:"end"}))}function Je(_){return _.scrollHeight-(_.scrollTop+_.clientHeight)<=Ib}function je(_){if(!B.activeThreadId)return;const E=Math.max(_.scrollHeight-_.clientHeight,0),C=E>0?Math.min(Math.max(_.scrollTop/E,0),1):1;Z("updateScrollState",{threadId:B.activeThreadId,state:{scrollTop:_.scrollTop,isAtBottom:Je(_),scrollRatio:C}})}function It(){const _=V.value;if(!_)return;const E=B.scrollState;if(!E||E.isAtBottom){Ut();return}const C=Math.max(_.scrollHeight-_.clientHeight,0),K=typeof E.scrollRatio=="number"?E.scrollRatio*C:E.scrollTop;_.scrollTop=Math.min(Math.max(K,0),C),je(_)}function Ut(){const _=V.value;_&&(ot(),je(_))}function ft(){const _=B.scrollState;return!_||_.isAtBottom===!0}function _t(){if(!ft()){ee=0,oe=0;return}if(Ut(),ee-=1,ee<=0){oe=0;return}oe=requestAnimationFrame(_t)}function Ht(_=6){ft()&&(oe&&(cancelAnimationFrame(oe),oe=0),ee=Math.max(_,1),oe=requestAnimationFrame(_t))}function Pt(){Ht(3)}function xt(){if(!ft())return;const _=V.value;if(!_)return;const E=_.querySelectorAll("img.message-image-preview");for(const C of E)C.complete||te.has(C)||(te.add(C),C.addEventListener("load",Pt,{once:!0}),C.addEventListener("error",Pt,{once:!0}))}async function Mt(){await Jt(),be&&cancelAnimationFrame(be),be=requestAnimationFrame(()=>{be=0,It(),xt(),Ht()})}pt(()=>B.messages,async _=>{if(!B.isLoading){for(const E of _){if(E.messageType!=="commandExecution"||!E.commandExecution)continue;const C=o.value[E.id],K=E.commandExecution.status;C==="inProgress"&&K!=="inProgress"&&j(E.id),o.value[E.id]=K}await Mt()}}),pt(()=>B.liveOverlay,async _=>{_&&(await Jt(),Ut(),Ht(8))},{deep:!0}),pt(()=>B.isLoading,async _=>{_||await Mt()}),pt(()=>B.activeThreadId,()=>{ae.value="",Y.value=new Set},{flush:"post"});function xe(){const _=V.value;!_||B.isLoading||je(_)}function Se(_){ae.value=W(_)}function Xt(_,E){return`${_}:${String(E)}`}function St(_,E){const C=new Set(Y.value);C.add(Xt(_,E)),Y.value=C}function ln(_,E){return Y.value.has(Xt(_,E))}function tn(){ae.value=""}function cn(){const _=z.value;_&&(_.scrollTop=_.scrollHeight)}return pt(()=>{var _;return(_=B.liveOverlay)==null?void 0:_.reasoningText},async _=>{_&&(await Jt(),cn())}),er(()=>{be&&cancelAnimationFrame(be),oe&&cancelAnimationFrame(oe)}),(_,E)=>(w(),T("section",ew,[e.isLoading?(w(),T("p",tw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(w(),T("p",nw," No messages in this thread yet. ")):(w(),T("ul",{key:2,ref_key:"conversationListRef",ref:V,class:"conversation-list",onScroll:xe},[(w(!0),T(De,null,yt(e.pendingRequests,C=>(w(),T("li",{key:`server-request:${C.id}`,class:"conversation-item conversation-item-request"},[m("div",rw,[m("div",sw,[m("article",ow,[m("p",iw,ne(C.method),1),m("p",aw,"Request #"+ne(C.id)+" · "+ne(Ne(C.receivedAtIso)),1),v(C)?(w(),T("p",lw,ne(v(C)),1)):se("",!0),C.method==="item/commandExecution/requestApproval"?(w(),T("section",cw,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>F(C.id,"accept")},"Accept",8,uw),m("button",{type:"button",class:"request-button",onClick:K=>F(C.id,"acceptForSession")},"Accept for Session",8,dw),m("button",{type:"button",class:"request-button",onClick:K=>F(C.id,"decline")},"Decline",8,fw),m("button",{type:"button",class:"request-button",onClick:K=>F(C.id,"cancel")},"Cancel",8,hw)])):C.method==="item/fileChange/requestApproval"?(w(),T("section",pw,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>F(C.id,"accept")},"Accept",8,mw),m("button",{type:"button",class:"request-button",onClick:K=>F(C.id,"acceptForSession")},"Accept for Session",8,gw),m("button",{type:"button",class:"request-button",onClick:K=>F(C.id,"decline")},"Decline",8,vw),m("button",{type:"button",class:"request-button",onClick:K=>F(C.id,"cancel")},"Cancel",8,yw)])):C.method==="item/tool/requestUserInput"?(w(),T("section",ww,[(w(!0),T(De,null,yt(R(C),K=>(w(),T("div",{key:`${C.id}:${K.id}`,class:"request-question"},[m("p",bw,ne(K.header||K.question),1),K.header&&K.question?(w(),T("p",_w,ne(K.question),1)):se("",!0),m("select",{class:"request-select",value:G(C.id,K.id,K.options[0]||""),onChange:I=>x(C.id,K.id,I)},[(w(!0),T(De,null,yt(K.options,I=>(w(),T("option",{key:`${C.id}:${K.id}:${I}`,value:I},ne(I),9,Tw))),128))],40,kw),K.isOther?(w(),T("input",{key:1,class:"request-input",type:"text",value:U(C.id,K.id),placeholder:"Other answer",onInput:I=>D(C.id,K.id,I)},null,40,Iw)):se("",!0)]))),128)),m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>J(C)}," Submit Answers ",8,Sw)])):C.method==="item/tool/call"?(w(),T("section",Ew,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>q(C.id)},"Fail Tool Call",8,Cw),m("button",{type:"button",class:"request-button",onClick:K=>we(C.id)},"Success (Empty)",8,Aw)])):(w(),T("section",Rw,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>de(C.id)},"Return Empty Result",8,Pw),m("button",{type:"button",class:"request-button",onClick:K=>pe(C.id)},"Reject Request",8,xw)]))])])])]))),128)),(w(!0),T(De,null,yt(e.messages,C=>{var K,I;return w(),T("li",{key:C.id,class:rt(["conversation-item",{"conversation-item-actionable":Ve(C)}]),"data-role":C.role,"data-message-type":C.messageType||""},[i(C)?(w(),T("div",Ow,[m("div",Nw,[m("button",{type:"button",class:rt(["cmd-row",[k(C),{"cmd-expanded":l(C)}]]),onClick:P=>u(C)},[m("span",{class:rt(["cmd-chevron",{"cmd-chevron-open":l(C)}])},"▶",2),m("code",Dw,ne(((K=C.commandExecution)==null?void 0:K.command)||"(command)"),1),m("span",Lw,ne(g(C)),1)],10,$w),m("div",{class:rt(["cmd-output-wrap",{"cmd-output-visible":l(C),"cmd-output-collapsing":c(C)}])},[m("div",jw,[m("pre",Bw,ne(((I=C.commandExecution)==null?void 0:I.aggregatedOutput)||"(no output)"),1)])],2)])])):(w(),T("div",{key:1,class:"message-row","data-role":C.role,"data-message-type":C.messageType||""},[m("div",{class:"message-stack","data-role":C.role},[m("article",{class:"message-body","data-role":C.role},[C.images&&C.images.length>0?(w(),T("ul",{key:0,class:"message-image-list","data-role":C.role},[(w(!0),T(De,null,yt(C.images,P=>(w(),T("li",{key:P,class:"message-image-item"},[m("button",{class:"message-image-button",type:"button",onClick:H=>Se(P)},[m("img",{class:"message-image-preview",src:W(P),alt:"Message image preview",loading:"lazy"},null,8,Gw)],8,Ww)]))),128))],8,Vw)):se("",!0),C.fileAttachments&&C.fileAttachments.length>0?(w(),T("div",qw,[(w(!0),T(De,null,yt(C.fileAttachments,P=>(w(),T("span",{key:P.path,class:"message-file-chip"},[E[1]||(E[1]=m("span",{class:"message-file-chip-icon"},"📄",-1)),m("a",{class:"message-file-link message-file-chip-name",href:fe(P.path),target:"_blank",rel:"noopener noreferrer",title:P.path},ne(P.path),9,zw)]))),128))])):se("",!0),C.text.length>0?(w(),T("article",{key:2,class:"message-card","data-role":C.role},[C.messageType==="worked"?(w(),T("div",Jw,[m("button",{type:"button",class:"worked-separator",onClick:P=>d(C)},[E[2]||(E[2]=m("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),m("span",{class:rt(["worked-chevron",{"worked-chevron-open":h(C)}])},"▶",2),m("p",Xw,ne(C.text),1),E[3]||(E[3]=m("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,Yw),h(C)?(w(),T("div",Qw,[(w(!0),T(De,null,yt(A(e.messages,e.messages.indexOf(C)),P=>{var H,re;return w(),T("div",{key:`worked-cmd-${P.id}`,class:"worked-cmd-item"},[m("button",{type:"button",class:rt(["cmd-row",[k(P),{"cmd-expanded":l(P)}]]),onClick:Re=>u(P)},[m("span",{class:rt(["cmd-chevron",{"cmd-chevron-open":l(P)}])},"▶",2),m("code",eb,ne(((H=P.commandExecution)==null?void 0:H.command)||"(command)"),1),m("span",tb,ne(g(P)),1)],10,Zw),m("div",{class:rt(["cmd-output-wrap",{"cmd-output-visible":l(P),"cmd-output-collapsing":c(P)}])},[m("div",nb,[m("pre",rb,ne(((re=P.commandExecution)==null?void 0:re.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):se("",!0)])):(w(),T("div",sb,[(w(!0),T(De,null,yt(le(C.text),(P,H)=>(w(),T(De,{key:`block-${H}`},[P.kind==="text"?(w(),T("p",ob,[(w(!0),T(De,null,yt(Ue(P.value),(re,Re)=>(w(),T(De,{key:`seg-${H}-${Re}`},[re.kind==="text"?(w(),T("span",ib,ne(re.value),1)):re.kind==="bold"?(w(),T("strong",ab,ne(re.value),1)):re.kind==="file"?(w(),T("a",{key:2,class:"message-file-link",href:fe(re.path),target:"_blank",rel:"noopener noreferrer",title:re.path},ne(re.displayPath),9,lb)):re.kind==="url"?(w(),T("a",{key:3,class:"message-file-link",href:re.href,target:"_blank",rel:"noopener noreferrer",title:re.href},ne(re.value),9,cb)):(w(),T("code",ub,ne(re.value),1))],64))),128))])):ln(C.id,H)?(w(),T("p",db,ne(P.markdown),1)):(w(),T("button",{key:2,class:"message-image-button",type:"button",onClick:re=>Se(P.url)},[m("img",{class:"message-image-preview message-markdown-image",src:P.url,alt:P.alt||"Embedded message image",loading:"lazy",onError:re=>St(C.id,H)},null,40,hb)],8,fb))],64))),128))]))],8,Kw)):se("",!0)],8,Hw),Ve(C)?(w(),T("div",pb,[Me(C)?(w(),T("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:P=>$e(C)},[Ee(Zy,{class:"message-action-icon"}),E[4]||(E[4]=m("span",{class:"message-action-label"},"Copy",-1))],8,mb)):se("",!0),ke(C)?(w(),T("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:P=>Xe(C)},[Ee(Jy,{class:"message-action-icon"}),E[5]||(E[5]=m("span",{class:"message-action-label"},"Rollback",-1))],8,gb)):se("",!0)])):se("",!0)],8,Uw)],8,Fw))],10,Mw)}),128)),e.liveOverlay?(w(),T("li",vb,[m("div",yb,[m("div",wb,[m("article",bb,[m("p",_b,ne(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(w(),T("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:z},ne(e.liveOverlay.reasoningText),513)):se("",!0),e.liveOverlay.errorText?(w(),T("p",kb,ne(e.liveOverlay.errorText),1)):se("",!0)])])])])):se("",!0),m("li",{ref_key:"bottomAnchorRef",ref:X,class:"conversation-bottom-anchor"},null,512)],544)),ae.value.length>0?(w(),T("div",{key:3,class:"image-modal-backdrop",onClick:tn},[m("div",{class:"image-modal-content",onClick:E[0]||(E[0]=nt(()=>{},["stop"]))},[m("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:tn},[Ee(el,{class:"icon-svg"})]),m("img",{class:"image-modal-image",src:ae.value,alt:"Expanded message image"},null,8,Tb)])])):se("",!0)]))}}),Eb=et(Sb,[["__scopeId","data-v-b2208f01"]]),Mc=.0025,Di=3,Oc=2,Cb=256;function Ab(e){var ee;const t=$("idle"),n=$(typeof navigator<"u"&&!!((ee=navigator.mediaDevices)!=null&&ee.getUserMedia)),r=$(0),s=$(null);let o=null,i=null,l=[],c=null,u=null,d=null,h=null,g=[],k=!1,j=!1,A=null;function B(){A&&(A.abort(),A=null),t.value==="transcribing"&&(t.value="idle")}function Z(){const te=s.value;if(!te||typeof window>"u")return;const Y=te.getContext("2d");if(!Y)return;const Ce=Math.max(1,Math.floor(te.clientWidth)),_e=Math.max(1,Math.floor(te.clientHeight||36)),Oe=window.devicePixelRatio||1,Ae=Math.max(1,Math.floor(Ce*Oe)),ye=Math.max(1,Math.floor(_e*Oe));(te.width!==Ae||te.height!==ye)&&(te.width=Ae,te.height=ye),Y.setTransform(Oe,0,0,Oe,0,0),Y.clearRect(0,0,Ce,_e);const Ie=Math.max(12,Math.floor(Ce/(Di+Oc))),ut=g.slice(-Ie),Ge=Math.max(0,Ie-ut.length),He=_e/2,qe=getComputedStyle(te).color||"#000000";for(let Qe=0;Qe<Ie;Qe+=1){const dt=ut[Qe-Ge]??0,Ue=Math.max(.08,Math.min(1,dt*18))*He,W=Qe*(Di+Oc);Y.globalAlpha=dt<=Mc?.35:1,Y.fillStyle=qe,Y.fillRect(W,He-Ue,Di,Ue*2)}Y.globalAlpha=1}function V(){g=[],r.value=0,Z()}function X(){d&&(d.disconnect(),d.onaudioprocess=null,d=null),u&&(u.disconnect(),u=null),c&&(c.close(),c=null),h=null}function z(te){if(typeof window>"u")return;const Y=window.webkitAudioContext,Ce=window.AudioContext??Y;Ce&&(X(),V(),c=new Ce,u=c.createMediaStreamSource(te),d=c.createScriptProcessor(2048,1,1),h=performance.now(),d.onaudioprocess=_e=>{const Oe=_e.inputBuffer.getChannelData(0);let Ae=0;for(let ye=0;ye<Oe.length;ye+=1){const Ie=Math.abs(Oe[ye]??0);Ae+=Ie<Mc?0:Ie}g.push(Ae/Oe.length),g.length>Cb&&g.shift(),h!==null&&(r.value=Math.max(0,performance.now()-h)),Z()},u.connect(d),d.connect(c.destination),Z())}async function ae(){var te;if(t.value==="transcribing"&&B(),!(t.value!=="idle"||!n.value||k)){k=!0,j=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],o=new MediaRecorder(i),o.ondataavailable=Y=>{Y.data.size>0&&l.push(Y.data)},o.onstop=()=>{var _e;const Y=l,Ce=(o==null?void 0:o.mimeType)||((_e=Y[0])==null?void 0:_e.type)||"audio/webm";be(),me(Y,Ce)},z(i),o.start(250),t.value="recording",j&&ue()}catch(Y){be(),t.value="idle",(te=e.onError)==null||te.call(e,Y)}finally{k=!1}}}function ue(){if(k&&t.value==="idle"){j=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function me(te,Y){var Oe,Ae,ye,Ie,ut;if(te.length===0){(Oe=e.onEmpty)==null||Oe.call(e),t.value="idle";return}const Ce=new Blob(te,{type:Y});t.value="transcribing";let _e=null;try{const Ge=Y.split(/[/;]/)[1]??"webm",He=new FormData;He.append("file",Ce,`codex.${Ge}`);const qe=((Ae=e.getLanguage)==null?void 0:Ae.call(e).trim())??"";qe&&qe.toLowerCase()!=="auto"&&He.append("language",qe),_e=new AbortController,A=_e;const Qe=await fetch("/codex-api/transcribe",{method:"POST",body:He,signal:_e.signal}),dt=await Qe.text();let Te=null;try{Te=dt.trim()?JSON.parse(dt):null}catch{Te=null}if(!Qe.ok){const W=(ye=Te==null?void 0:Te.error)==null?void 0:ye.trim(),fe=dt.trim();throw new Error(W||fe||`Transcription failed: ${Qe.status}`)}const Ue=((Te==null?void 0:Te.text)??"").trim();Ue.length>0?e.onTranscript(Ue):(Ie=e.onEmpty)==null||Ie.call(e)}catch(Ge){if(Ge instanceof DOMException&&Ge.name==="AbortError")return;(ut=e.onError)==null||ut.call(e,Ge)}finally{_e&&A===_e&&(A=null),t.value==="transcribing"&&(t.value="idle")}}function be(){X(),V(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(te=>te.stop()),i=null),l=[]}er(()=>{B(),be()});function oe(){if(t.value==="recording"){ue();return}(t.value==="idle"||t.value==="transcribing")&&ae()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ae,stopRecording:ue,toggleRecording:oe}}function Nc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Wn extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function tl(e,t){const n=Nc(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=Nc(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function ms(e,t,n){return e instanceof Wn?e:e instanceof Error?new Wn(e.message||t,{code:"unknown_error",method:n}):new Wn(t,{code:"unknown_error",method:n})}function of(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function Rb(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 Wn(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 Wn(tl(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 Wn(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function $c(e){const t=of(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 Pb(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),l=$c(i);l&&e(l)}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,l=window.setTimeout(()=>{i||n||(o.close(),r())},2500);o.onopen=()=>{i=!0,l!==null&&(window.clearTimeout(l),l=null)},o.onmessage=c=>{try{const u=JSON.parse(String(c.data)),d=$c(u);d&&e(d)}catch{}},o.onerror=()=>{!i&&!n&&r()},o.onclose=()=>{l!==null&&(window.clearTimeout(l),l=null),!i&&!n&&r()},t=()=>o.close()}else r();return()=>{n=!0,t==null||t()}}async function xb(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 Wn(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 Wn(tl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Mb(){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 Wn(tl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=of(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function Dc(e){return new Date(e*1e3).toISOString()}function Ob(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Nb(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const $b=/^##\s+(.+?):\s+(.+?)\s*$/,Db=/^#\s*files mentioned by the user\s*:?\s*$/i;function Lb(e){var s,o;const t=e.split(`
|
|
27
|
-
`).findIndex(i=>Db.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
-
`).slice(t+1),r=[];for(const i of n){const l=i.trim();if(!l)continue;const c=l.match($b);if(!c)break;const u=(s=c[1])==null?void 0:s.trim(),d=(o=c[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");u&&d&&r.push({label:u,path:d})}return r}function jb(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 Bb(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[l,c]of t.entries())c.type==="text"&&typeof c.text=="string"&&c.text.length>0&&n.push(c.text),c.type==="image"&&typeof c.url=="string"&&c.url.trim().length>0&&r.push(c.url.trim()),c.type!=="text"&&c.type!=="image"&&s.push({id:`${e}:user-content:${l}`,role:"user",text:"",messageType:`userContent.${c.type}`,rawPayload:Nb(c),isUnhandled:!0});const o=n.join(`
|
|
29
|
-
`),i=Lb(o);return{text:jb(o),images:r,fileAttachments:i,rawBlocks:s}}function Fb(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Bb(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=Ub(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 Ub(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Hb(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function Vb(e){const t=Hb(e);return t.length>0?t:"Untitled thread"}function af(e){return(e==null?void 0:e.status)==="inProgress"}function Wb(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 af(r)}function Gb(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:Vb(e),projectName:Ob(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:Dc(e.createdAt),updatedAtIso:Dc(e.updatedAt),preview:e.preview,unread:!1,inProgress:Wb(e)}}function qb(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,l;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((l=r.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-s})}function zb(e){const t=e.data.map(Gb);return qb(t)}function lf(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 l of Fb(i))n.push({...l,turnIndex:r})}return n}function Kb(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return af(t.at(-1))}async function en(e,t){try{return await Rb(e,t)}catch(n){throw ms(n,`RPC ${e} failed`,e)}}function Jb(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Yb(){const e=await en("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return zb(e)}async function Xb(e){const t=await en("thread/read",{threadId:e,includeTurns:!0});return{messages:lf(t),inProgress:Kb(t)}}async function Qb(){try{return await Yb()}catch(e){throw ms(e,"Failed to load thread groups","thread/list")}}async function Zb(e){try{return await Xb(e)}catch(t){throw ms(t,`Failed to load thread ${e}`,"thread/read")}}function e_(e){return Pb(e)}async function t_(e,t){await xb({id:e,...t})}async function n_(){return Mb()}async function Li(e){await en("thread/resume",{threadId:e})}async function r_(e){await en("thread/archive",{threadId:e})}async function s_(e,t){await en("thread/name/set",{threadId:e,name:t})}async function Lc(e,t){const n=await en("thread/rollback",{threadId:e,numTurns:t});return lf(n)}function o_(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 jc(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 en("thread/start",n),s=o_(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 i_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
30
|
-
`;for(const r of t)n+=`
|
|
31
|
-
## ${r.label}: ${r.path}
|
|
32
|
-
`;return`${n}
|
|
33
|
-
## My request for Codex:
|
|
34
|
-
|
|
35
|
-
${e}
|
|
36
|
-
`}async function ji(e,t,n=[],r,s,o,i=[]){try{const c=[{type:"text",text:i_(t,i)}];for(const h of n){const g=h.trim();g&&c.push({type:"image",url:g,image_url:g})}if(o)for(const h of o)c.push({type:"skill",name:h.name,path:h.path});const u=i.map(h=>({label:h.label,path:h.path,fsPath:h.fsPath})),d={threadId:e,input:c};u.length>0&&(d.attachments=u),typeof r=="string"&&r.length>0&&(d.model=r),typeof s=="string"&&s.length>0&&(d.effort=s),await en("turn/start",d)}catch(l){throw ms(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function a_(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 en("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw ms(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function l_(e){await en("setDefaultModel",{model:e})}async function c_(){const e=await en("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 u_(){const e=await en("config/read",{}),t=e.config.model??"",n=Jb(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function d_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const l of o)typeof l=="string"&&l.length>0&&!i.includes(l)&&i.push(l);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 va(){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 d_(n.data)}async function f_(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 Bc(){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 h_(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 p_(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 l=nl(r,"Failed to open project root");throw new Error(l)}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=nl(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 g_(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 u=nl(o,"Failed to search files");throw new Error(u)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},l=Array.isArray(i.data)?i.data:[],c=[];for(const u of l){if(!u||typeof u!="object"||Array.isArray(u))continue;const h=u.path,g=typeof h=="string"?h.trim():"";g&&c.push({path:g})}return c}async function v_(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 nl(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 y_(){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 Bi(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 w_(e,t){var n;try{return((n=(await en("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function b_(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await en("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 Fc(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 __={},k_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function T_(e,t){return w(),T("svg",k_,[...t[0]||(t[0]=[m("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 I_=et(__,[["render",T_]]),S_={},E_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function C_(e,t){return w(),T("svg",E_,[...t[0]||(t[0]=[m("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 A_=et(S_,[["render",C_]]),R_={},P_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function x_(e,t){return w(),T("svg",P_,[...t[0]||(t[0]=[m("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),m("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 Uc=et(R_,[["render",x_]]),M_=["disabled"],O_={class:"composer-dropdown-value"},N_={class:"composer-dropdown-menu"},$_={key:0,class:"composer-dropdown-search-wrap"},D_=["placeholder","onKeydown"],L_={class:"composer-dropdown-options",role:"listbox"},j_=["onClick"],B_={key:0,class:"composer-dropdown-empty"},F_={key:1,class:"composer-dropdown-add-wrap"},U_=["placeholder","onKeydown"],H_=Rt({__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=$(null),o=$(null),i=$(null),l=$(!1),c=$(""),u=$(!1),d=$(""),h=ie(()=>{var te;const ee=n.options.find(Y=>Y.value===n.modelValue);return ee?ee.label:((te=n.placeholder)==null?void 0:te.trim())||""}),g=ie(()=>n.openDirection??"down"),k=ie(()=>n.enableSearch===!0),j=ie(()=>n.showAddAction===!0),A=ie(()=>{var ee;return((ee=n.searchPlaceholder)==null?void 0:ee.trim())||"Quick search projects"}),B=ie(()=>{var ee;return((ee=n.addActionLabel)==null?void 0:ee.trim())||"Add new project"}),Z=ie(()=>{var ee;return((ee=n.addPlaceholder)==null?void 0:ee.trim())||"Project name or absolute path"}),V=ie(()=>{const ee=c.value.trim().toLowerCase();return ee?n.options.filter(te=>te.label.toLowerCase().includes(ee)||te.value.toLowerCase().includes(ee)):n.options});function X(){n.disabled||(l.value=!l.value)}function z(ee){r("update:modelValue",ee),l.value=!1,c.value=""}function ae(){var ee;u.value=!0,d.value=((ee=n.defaultAddValue)==null?void 0:ee.trim())||"",Jt(()=>{var te;return(te=i.value)==null?void 0:te.focus()})}function ue(){if(c.value.length>0){c.value="";return}l.value=!1}function me(){const ee=d.value.trim();ee&&(r("add",ee),u.value=!1,d.value="",l.value=!1,c.value="")}function be(){u.value=!1,d.value="",l.value=!1,c.value=""}function oe(ee){if(!l.value)return;const te=s.value;if(!te)return;const Y=ee.target;Y instanceof Node&&(te.contains(Y)||(l.value=!1,c.value="",u.value=!1,d.value=""))}return pt(l,ee=>{if(!ee){u.value=!1,d.value="";return}k.value&&Jt(()=>{var te;return(te=o.value)==null?void 0:te.focus()})}),Zn(()=>{window.addEventListener("pointerdown",oe)}),er(()=>{window.removeEventListener("pointerdown",oe)}),(ee,te)=>(w(),T("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[m("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:X},[m("span",O_,ne(h.value),1),Ee(oi,{class:"composer-dropdown-chevron"})],8,M_),l.value?(w(),T("div",{key:0,class:rt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":g.value==="up","composer-dropdown-menu-wrap-down":g.value==="down"}])},[m("div",N_,[k.value?(w(),T("div",$_,[Kn(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":te[0]||(te[0]=Y=>c.value=Y),class:"composer-dropdown-search-input",type:"text",placeholder:A.value,onKeydown:zt(nt(ue,["prevent"]),["esc"])},null,40,D_),[[Jn,c.value]])])):se("",!0),m("ul",L_,[(w(!0),T(De,null,yt(V.value,Y=>(w(),T("li",{key:Y.value},[m("button",{class:rt(["composer-dropdown-option",{"is-selected":Y.value===e.modelValue}]),type:"button",onClick:Ce=>z(Y.value)},ne(Y.label),11,j_)]))),128)),V.value.length===0?(w(),T("li",B_," No matching projects ")):se("",!0)]),j.value?(w(),T("div",F_,[u.value?(w(),T(De,{key:0},[Kn(m("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":te[1]||(te[1]=Y=>d.value=Y),class:"composer-dropdown-add-input",type:"text",placeholder:Z.value,onKeydown:[zt(nt(me,["prevent"]),["enter"]),zt(nt(be,["prevent"]),["esc"])]},null,40,U_),[[Jn,d.value]]),m("div",{class:"composer-dropdown-add-actions"},[m("button",{type:"button",class:"composer-dropdown-add-btn",onClick:me},"Open"),m("button",{type:"button",class:"composer-dropdown-add-btn",onClick:be},"Cancel")])],64)):(w(),T("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:ae},ne(B.value),1))])):se("",!0)])],2)):se("",!0)],512))}}),ya=et(H_,[["__scopeId","data-v-7cfa2012"]]),V_=["disabled"],W_={class:"search-dropdown-value"},G_={class:"search-dropdown-search-wrap"},q_=["placeholder","onKeydown"],z_={key:0,class:"search-dropdown-list",role:"listbox"},K_=["onClick","onPointerenter"],J_={class:"search-dropdown-option-check"},Y_={class:"search-dropdown-option-label"},X_={key:0,class:"search-dropdown-option-desc"},Q_={key:1,class:"search-dropdown-empty"},Z_=Rt({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=$(null),o=$(null),i=$(!1),l=$(""),c=$(0),u=ie(()=>n.openDirection??"down"),d=ie(()=>new Set(n.selectedValues)),h=ie(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const V=n.options.find(X=>X.value===n.selectedValues[0]);return(V==null?void 0:V.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),g=ie(()=>{const V=l.value.toLowerCase().trim();return V?n.options.filter(X=>{var z;return X.label.toLowerCase().includes(V)||(((z=X.description)==null?void 0:z.toLowerCase().includes(V))??!1)}):n.options});function k(){n.disabled||(i.value=!i.value,i.value&&(l.value="",c.value=0,Jt(()=>{var V;return(V=o.value)==null?void 0:V.focus()})))}function j(V){r("toggle",V.value,!d.value.has(V.value))}function A(V){g.value.length!==0&&(c.value=(c.value+V+g.value.length)%g.value.length)}function B(){const V=g.value[c.value];V&&j(V)}function Z(V){if(!i.value)return;const X=s.value;if(!X)return;const z=V.target;z instanceof Node&&(X.contains(z)||(i.value=!1))}return pt(l,()=>{c.value=0}),Zn(()=>window.addEventListener("pointerdown",Z)),er(()=>window.removeEventListener("pointerdown",Z)),(V,X)=>(w(),T("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[m("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:k},[m("span",W_,ne(h.value),1),Ee(oi,{class:"search-dropdown-chevron"})],8,V_),i.value?(w(),T("div",{key:0,class:rt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":u.value==="up","search-dropdown-menu-wrap-down":u.value==="down"}])},[m("div",G_,[Kn(m("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":X[0]||(X[0]=z=>l.value=z),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[X[1]||(X[1]=zt(nt(z=>i.value=!1,["prevent"]),["escape"])),zt(nt(B,["prevent"]),["enter"]),X[2]||(X[2]=zt(nt(z=>A(1),["prevent"]),["arrow-down"])),X[3]||(X[3]=zt(nt(z=>A(-1),["prevent"]),["arrow-up"]))]},null,40,q_),[[Jn,l.value]])]),g.value.length>0?(w(),T("ul",z_,[(w(!0),T(De,null,yt(g.value,(z,ae)=>(w(),T("li",{key:z.value},[m("button",{class:rt(["search-dropdown-option",{"is-selected":d.value.has(z.value),"is-highlighted":ae===c.value}]),type:"button",onClick:ue=>j(z),onPointerenter:ue=>c.value=ae},[m("span",J_,ne(d.value.has(z.value)?"✓":""),1),m("span",Y_,ne(z.label),1),z.description?(w(),T("span",X_,ne(z.description),1)):se("",!0)],42,K_)]))),128))])):(w(),T("div",Q_,"No results"))],2)):se("",!0)],512))}}),ek=et(Z_,[["__scopeId","data-v-a0f2edd4"]]),tk={class:"skill-picker-header"},nk=["onKeydown"],rk={key:0,class:"skill-picker-list",role:"listbox"},sk=["onClick","onPointerenter"],ok={class:"skill-picker-name"},ik={key:0,class:"skill-picker-desc"},ak={key:1,class:"skill-picker-empty"},lk=Rt({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=$(null),o=$(null),i=$(""),l=$(0),c=ie(()=>{const g=i.value.toLowerCase().trim();return g?n.skills.filter(k=>k.name.toLowerCase().includes(g)||k.description.toLowerCase().includes(g)):n.skills}),u=ie(()=>{const g={};return n.anchorBottom!=null&&(g.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(g.left=`${n.anchorLeft}px`),g});function d(g){c.value.length!==0&&(l.value=(l.value+g+c.value.length)%c.value.length)}function h(){const g=c.value[l.value];g&&r("select",g)}return pt(()=>n.visible,g=>{g&&(i.value="",l.value=0,Jt(()=>{var k;return(k=o.value)==null?void 0:k.focus()}))}),pt(i,()=>{l.value=0}),(g,k)=>e.visible?(w(),T("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:Fr(u.value)},[m("div",tk,[Kn(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":k[0]||(k[0]=j=>i.value=j),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[k[1]||(k[1]=zt(nt(j=>g.$emit("close"),["prevent"]),["escape"])),zt(nt(h,["prevent"]),["enter"]),k[2]||(k[2]=zt(nt(j=>d(1),["prevent"]),["arrow-down"])),k[3]||(k[3]=zt(nt(j=>d(-1),["prevent"]),["arrow-up"]))]},null,40,nk),[[Jn,i.value]])]),c.value.length>0?(w(),T("ul",rk,[(w(!0),T(De,null,yt(c.value,(j,A)=>(w(),T("li",{key:j.path},[m("button",{class:rt(["skill-picker-item",{"is-highlighted":A===l.value}]),type:"button",onClick:B=>g.$emit("select",j),onPointerenter:B=>l.value=A},[m("span",ok,ne(j.name),1),j.description?(w(),T("span",ik,ne(j.description),1)):se("",!0)],42,sk)]))),128))])):(w(),T("div",ak,"No skills found"))],4)):se("",!0)}}),ck=et(lk,[["__scopeId","data-v-ff3fb7dc"]]),uk={key:0,class:"thread-composer-dictation-error"},dk={key:0,class:"thread-composer-attachments"},fk=["src","alt"],hk=["aria-label","disabled","onClick"],pk={key:1,class:"thread-composer-folder-chips"},mk=["title"],gk={class:"thread-composer-folder-chip-meta"},vk=["aria-label","disabled","onClick"],yk={key:2,class:"thread-composer-file-chips"},wk=["title"],bk=["aria-label","disabled","onClick"],_k={key:3,class:"thread-composer-skill-chips"},kk={class:"thread-composer-skill-chip-name"},Tk=["aria-label","onClick"],Ik={class:"thread-composer-input-wrap"},Sk={key:0,class:"thread-composer-file-mentions"},Ek=["onMousedown"],Ck={key:1,class:"thread-composer-file-mention-icon-markdown"},Ak={class:"thread-composer-file-mention-text"},Rk={class:"thread-composer-file-mention-name"},Pk={key:0,class:"thread-composer-file-mention-dir"},xk={key:1,class:"thread-composer-file-mention-empty"},Mk=["placeholder","disabled"],Ok=["disabled"],Nk={key:0,class:"thread-composer-attach-menu"},$k=["disabled"],Dk=["disabled"],Lk=["disabled"],jk={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},Bk={key:1,class:"thread-composer-dictation-timer"},Fk=["aria-label","title","disabled"],Uk=["disabled"],Hk=["aria-label","title","disabled"],Vk=["disabled"],Wk=["disabled"],Gk=["disabled"],qk=Rt({__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},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,s=$(""),o=$([]),i=$([]),l=$([]),c=$([]),u=$(""),{state:d,isSupported:h,recordingDurationMs:g,waveformCanvasRef:k,startRecording:j,stopRecording:A,toggleRecording:B}=Ab({getLanguage:()=>n.dictationLanguage??"auto",onTranscript:I=>{if(s.value=s.value?`${s.value}
|
|
37
|
-
${I}`:I,u.value="",n.dictationAutoSend!==!1){const P=n.isTurnInProgress?Ue.value:"steer";v(P,{rollbackLatestUserTurn:P==="steer"&&Ae}),Ae=!1;return}Jt(()=>{var P;return(P=ae.value)==null?void 0:P.focus()})},onEmpty:()=>{u.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:I=>{if(I instanceof DOMException&&I.name==="NotAllowedError"){u.value="Microphone access was denied.";return}u.value=I instanceof Error?I.message:"Dictation failed."}}),Z=$(null),V=$(null),X=$(null),z=$(null),ae=$(null),ue=$(!1),me=$(!1),be=$(null),oe=$(""),ee=$([]),te=$(!1),Y=$(0);let Ce=0,_e=null,Oe=!1,Ae=!1;const ye=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),Ie=[{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"}],ut=ie(()=>n.models.map(I=>({value:I,label:I}))),Ge=ie(()=>n.skills??[]),He=ie(()=>i.value.map(I=>I.path)),qe=ie(()=>(n.skills??[]).map(I=>({value:I.path,label:I.name,description:I.description}))),Qe=ie(()=>n.disabled||!n.activeThreadId?!1:s.value.trim().length>0||o.value.length>0||l.value.length>0),dt=ie(()=>{const I=new Set;for(const P of c.value)for(const H of P.filePaths)I.add(H);return l.value.filter(P=>!I.has(P.fsPath))}),Te=ie(()=>n.disabled||!n.activeThreadId),Ue=ie(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),W=ie(()=>d.value==="recording"),fe=ie(()=>d.value==="recording"?"Stop dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),le=ie(()=>d.value==="idle"?u.value.trim():""),he=ie(()=>{const I=Math.max(0,Math.floor(g.value/1e3)),P=Math.floor(I/60),H=I%60;return`${P}:${String(H).padStart(2,"0")}`}),Ne=ie(()=>n.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message");function v(I="steer",P){var re;const H=s.value.trim();if(Qe.value){if(r("submit",{text:H,imageUrls:o.value.map(Re=>Re.url),fileAttachments:[...l.value],skills:i.value.map(Re=>({name:Re.name,path:Re.path})),mode:I,rollbackLatestUserTurn:(P==null?void 0:P.rollbackLatestUserTurn)===!0}),s.value="",o.value=[],i.value=[],l.value=[],c.value=[],ue.value=!1,me.value=!1,xt(),ye){(re=ae.value)==null||re.blur();return}Jt(()=>{var Re;return(Re=ae.value)==null?void 0:Re.focus()})}}function y(){r("interrupt")}function R(I){r("update:selected-model",I)}function G(I){r("update:selected-reasoning-effort",I)}function U(){n.dictationClickToToggle&&(u.value&&(u.value=""),d.value==="idle"&&(Ae=n.isTurnInProgress===!0&&n.inProgressSubmitMode==="steer"),B())}function x(I){if(n.dictationClickToToggle||(I.preventDefault(),Oe))return;Oe=!0;const P=I.currentTarget;if(P)try{P.setPointerCapture(I.pointerId)}catch{}u.value&&(u.value=""),Ae=n.isTurnInProgress===!0&&n.inProgressSubmitMode==="steer",window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D),window.addEventListener("blur",D),j()}function D(){n.dictationClickToToggle||Oe&&(Oe=!1,window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D),window.removeEventListener("blur",D),A())}function F(){Te.value||(ue.value=!ue.value)}function J(){var I;(I=V.value)==null||I.click()}function q(){var I;(I=X.value)==null||I.click()}function we(){var I;(I=z.value)==null||I.click()}function de(I){o.value=o.value.filter(P=>P.id!==I)}function pe(I){i.value=i.value.filter(P=>P.path!==I)}function ke(I){l.value=l.value.filter(P=>P.fsPath!==I)}function Me(I){const P=c.value.find(re=>re.id===I);if(!P)return;const H=new Set(P.filePaths);l.value=l.value.filter(re=>!H.has(re.fsPath)),c.value=c.value.filter(re=>re.id!==I)}function Ve(I){return I.total<=0?0:Math.round(I.processed/I.total*100)}function $e(I,P){const H=I.replace(/\\/g,"/");if(l.value.some(Ye=>Ye.fsPath===H))return;const re=H.split("/").filter(Boolean),Re=(P==null?void 0:P.trim())||re[re.length-1]||H;l.value=[...l.value,{label:Re,path:H,fsPath:H}]}function Xe(I){return I.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(I.name)}function ot(I){if(!(!I||I.length===0))for(const P of Array.from(I))if(Xe(P)){const H=new FileReader;H.onload=()=>{typeof H.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:P.name,url:H.result})},H.readAsDataURL(P)}else Fc(P).then(H=>{H&&$e(H)}).catch(()=>{})}async function Je(I){if(!I||I.length===0)return;const P=Array.from(I),re=(P[0].webkitRelativePath||P[0].name).split("/").filter(Boolean)[0]||"Folder",Re=`${Date.now()}-${Math.random().toString(36).slice(2)}`;c.value=[...c.value,{id:Re,name:re,total:P.length,processed:0,filePaths:[],isUploading:!0}];const Ye=ze=>{c.value=c.value.map(Ze=>Ze.id===Re?ze(Ze):Ze)};for(const ze of P)try{const Ze=await Fc(ze);if(Ze){const wt=ze.webkitRelativePath||ze.name;$e(Ze,wt),Ye(Vt=>({...Vt,processed:Vt.processed+1,filePaths:[...Vt.filePaths,Ze]}));continue}Ye(wt=>({...wt,processed:wt.processed+1}))}catch{Ye(Ze=>({...Ze,processed:Ze.processed+1}))}Ye(ze=>({...ze,isUploading:!1}))}function je(I){I&&(I.value="")}function It(I){const P=I.target;ot((P==null?void 0:P.files)??null),je(P),ue.value=!1}function Ut(I){const P=I.target;ot((P==null?void 0:P.files)??null),je(P),ue.value=!1}function ft(I){const P=I.target;Je((P==null?void 0:P.files)??null),je(P),ue.value=!1}function _t(){u.value&&(u.value="");const P=s.value.startsWith("/");P!==me.value&&(me.value=P),Mt()}function Ht(I){if(te.value){if(I.key==="Escape"){I.preventDefault(),xt();return}if(I.key==="ArrowDown"){I.preventDefault(),ee.value.length>0&&(Y.value=(Y.value+1)%ee.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),ee.value.length>0){const H=ee.value.length;Y.value=(Y.value+H-1)%H}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const H=ee.value[Y.value];H?Se(H):xt();return}}if(n.sendWithEnter!==!1?I.key==="Enter"&&!I.shiftKey:I.key==="Enter"&&(I.metaKey||I.ctrlKey)){I.preventDefault(),v(n.isTurnInProgress?Ue.value:"steer");return}if(me.value){if(I.key==="Escape"){I.preventDefault(),Pt();return}if(I.key==="ArrowDown"||I.key==="ArrowUp"){I.preventDefault();return}}}function Pt(){var I;me.value=!1,(I=ae.value)==null||I.focus()}function xt(){te.value=!1,be.value=null,oe.value="",ee.value=[],Y.value=0}function Mt(){const I=ae.value;if(!I){xt();return}const P=I.selectionStart??s.value.length,re=s.value.slice(0,P).match(/(^|\s)(@[^\s@]*)$/);if(!re){xt();return}const Re=re[2]??"",Ye=Re.length,ze=P-Ye;be.value=ze,oe.value=Re.slice(1),te.value=!0,xe()}async function xe(){if(!te.value)return;const I=(n.cwd??"").trim();if(!I){ee.value=[];return}_e&&clearTimeout(_e);const P=++Ce;_e=setTimeout(async()=>{try{const H=await g_(I,oe.value,20);if(!te.value||P!==Ce)return;ee.value=H,Y.value=0}catch{if(!te.value||P!==Ce)return;ee.value=[]}},120)}function Se(I){const P=ae.value,H=be.value;if(H!==null&&P){const re=P.selectionStart??s.value.length;s.value=`${s.value.slice(0,H)}${s.value.slice(re)}`.trimEnd()}$e(I.path),xt(),Jt(()=>P==null?void 0:P.focus())}function Xt(I){const P=I.lastIndexOf("/");return P<0?I:I.slice(P+1)}function St(I){const P=I.lastIndexOf("/");return P<=0?"":I.slice(0,P)}function ln(I){const P=Xt(I),H=P.lastIndexOf(".");return H<=0?"":P.slice(H+1).toLowerCase()}function tn(I){const P=ln(I);return P==="ts"?"TS":P==="tsx"?"TSX":P==="js"?"JS":P==="jsx"?"JSX":P==="json"?"{}":""}function cn(I){const P=ln(I);return P.startsWith("ts")?"ts":P.startsWith("js")?"js":P==="json"?"json":"default"}function _(I){const P=ln(I);return P==="md"||P==="mdx"}function E(I){var P;i.value.some(H=>H.path===I.path)||(i.value=[...i.value,I]),s.value=s.value.startsWith("/")?"":s.value,me.value=!1,(P=ae.value)==null||P.focus()}function C(I,P){if(P){const H=(n.skills??[]).find(re=>re.path===I);H&&!i.value.some(re=>re.path===I)&&(i.value=[...i.value,H])}else i.value=i.value.filter(H=>H.path!==I)}function K(I){if(!ue.value)return;const P=Z.value;if(!P)return;const H=I.target;!H||P.contains(H)||(ue.value=!1)}return Zn(()=>{document.addEventListener("click",K)}),er(()=>{document.removeEventListener("click",K),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D),window.removeEventListener("blur",D),_e&&clearTimeout(_e)}),pt(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],l.value=[],c.value=[],u.value="",ue.value=!1,me.value=!1,xt()}),pt(()=>n.cwd,()=>{te.value&&xe()}),(I,P)=>(w(),T("form",{class:"thread-composer",onSubmit:P[2]||(P[2]=nt(H=>v("steer"),["prevent"]))},[le.value?(w(),T("p",uk,ne(le.value),1)):se("",!0),m("div",{class:rt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(w(),T("div",dk,[(w(!0),T(De,null,yt(o.value,H=>(w(),T("div",{key:H.id,class:"thread-composer-attachment"},[m("img",{class:"thread-composer-attachment-image",src:H.url,alt:H.name||"Selected image"},null,8,fk),m("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${H.name||"image"}`,disabled:Te.value,onClick:re=>de(H.id)}," x ",8,hk)]))),128))])):se("",!0),c.value.length>0?(w(),T("div",pk,[(w(!0),T(De,null,yt(c.value,H=>(w(),T("span",{key:H.id,class:"thread-composer-folder-chip"},[Ee(Za,{class:"thread-composer-folder-chip-icon"}),m("span",{class:"thread-composer-folder-chip-name",title:H.name},ne(H.name),9,mk),m("span",gk,[H.isUploading?(w(),T(De,{key:0},[Gs(ne(Ve(H))+"% uploading ("+ne(H.processed)+"/"+ne(H.total)+") ",1)],64)):(w(),T(De,{key:1},[Gs(ne(H.filePaths.length)+" file"+ne(H.filePaths.length===1?"":"s"),1)],64))]),m("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${H.name}`,disabled:Te.value,onClick:re=>Me(H.id)},"×",8,vk)]))),128))])):se("",!0),dt.value.length>0?(w(),T("div",yk,[(w(!0),T(De,null,yt(dt.value,H=>(w(),T("span",{key:H.fsPath,class:"thread-composer-file-chip"},[Ee(Do,{class:"thread-composer-file-chip-icon"}),m("span",{class:"thread-composer-file-chip-name",title:H.fsPath},ne(H.label),9,wk),m("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${H.label}`,disabled:Te.value,onClick:re=>ke(H.fsPath)},"×",8,bk)]))),128))])):se("",!0),i.value.length>0?(w(),T("div",_k,[(w(!0),T(De,null,yt(i.value,H=>(w(),T("span",{key:H.path,class:"thread-composer-skill-chip"},[m("span",kk,ne(H.name),1),m("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${H.name}`,onClick:re=>pe(H.path)},"×",8,Tk)]))),128))])):se("",!0),m("div",Ik,[te.value?(w(),T("div",Sk,[ee.value.length>0?(w(!0),T(De,{key:0},yt(ee.value,(H,re)=>(w(),T("button",{key:H.path,class:rt(["thread-composer-file-mention-row",{"is-active":re===Y.value}]),type:"button",onMousedown:nt(Re=>Se(H),["prevent"])},[tn(H.path)?(w(),T("span",{key:0,class:rt(["thread-composer-file-mention-icon-badge",`is-${cn(H.path)}`])},ne(tn(H.path)),3)):_(H.path)?(w(),T("span",Ck,"↓")):(w(),lt(Do,{key:2,class:"thread-composer-file-mention-icon-file"})),m("span",Ak,[m("span",Rk,ne(Xt(H.path)),1),St(H.path)?(w(),T("span",Pk,ne(St(H.path)),1)):se("",!0)])],42,Ek))),128)):(w(),T("div",xk,"No matching files"))])):se("",!0),Kn(m("textarea",{ref_key:"inputRef",ref:ae,"onUpdate:modelValue":P[0]||(P[0]=H=>s.value=H),class:"thread-composer-input",placeholder:Ne.value,disabled:Te.value,onInput:_t,onKeydown:Ht},null,40,Mk),[[Jn,s.value]]),Ee(ck,{skills:Ge.value,visible:me.value,"anchor-bottom":44,"anchor-left":0,onSelect:E,onClose:Pt},null,8,["skills","visible"])]),m("div",{class:rt(["thread-composer-controls",{"thread-composer-controls--recording":W.value}])},[m("div",{ref_key:"attachMenuRootRef",ref:Z,class:"thread-composer-attach"},[m("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Te.value,onClick:F}," + ",8,Ok),ue.value?(w(),T("div",Nk,[m("button",{class:"thread-composer-attach-item",type:"button",disabled:Te.value,onClick:J}," Add photos & files ",8,$k),m("button",{class:"thread-composer-attach-item",type:"button",disabled:Te.value,onClick:we}," Add folder ",8,Dk),m("button",{class:"thread-composer-attach-item",type:"button",disabled:Te.value,onClick:q}," Take photo ",8,Lk)])):se("",!0)],512),W.value?se("",!0):(w(),T(De,{key:0},[Ee(ya,{class:"thread-composer-control","model-value":e.selectedModel,options:ut.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":R},null,8,["model-value","options","disabled"]),Ee(ek,{class:"thread-composer-control",options:qe.value,"selected-values":He.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:C},null,8,["options","selected-values","disabled"]),Ee(ya,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Ie,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":G},null,8,["model-value","disabled"])],64)),m("div",{class:rt(["thread-composer-actions",{"thread-composer-actions--recording":W.value}])},[ge(d)==="recording"?(w(),T("div",jk,[m("canvas",{ref_key:"dictationWaveformCanvasRef",ref:k,class:"thread-composer-dictation-waveform"},null,512)])):se("",!0),ge(d)==="recording"?(w(),T("span",Bk,ne(he.value),1)):se("",!0),ge(h)?(w(),T("button",{key:2,class:rt(["thread-composer-mic",{"thread-composer-mic--active":ge(d)==="recording"}]),type:"button","aria-label":fe.value,title:fe.value,disabled:Te.value,onClick:U,onPointerdown:x,onPointerup:D,onPointercancel:D},[ge(d)==="recording"?(w(),lt(Uc,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(w(),lt(A_,{key:1,class:"thread-composer-mic-icon"}))],42,Fk)):se("",!0),e.isTurnInProgress?(w(),T("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:y},[Ee(Uc,{class:"thread-composer-stop-icon"})],8,Uk)):(w(),T("button",{key:4,class:rt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ue.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&Ue.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${Ue.value}`:"Send",disabled:!Qe.value,onClick:P[1]||(P[1]=H=>v(e.isTurnInProgress?Ue.value:"steer"))},[Ee(I_,{class:"thread-composer-submit-icon"})],10,Hk))],2)],2)],2),m("input",{ref_key:"photoLibraryInputRef",ref:V,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Te.value,onChange:It},null,40,Vk),m("input",{ref_key:"cameraCaptureInputRef",ref:X,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Te.value,onChange:Ut},null,40,Wk),m("input",{ref_key:"folderPickerInputRef",ref:z,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Te.value,onChange:ft},null,40,Gk)],32))}}),Hc=et(qk,[["__scopeId","data-v-a8c1f2e0"]]),zk={key:0,class:"queued-messages"},Kk={class:"queued-messages-inner"},Jk={class:"queued-row-text"},Yk={class:"queued-row-actions"},Xk=["onClick"],Qk=["onClick"],Zk=Rt({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(w(),T("div",zk,[m("div",Kk,[(w(!0),T(De,null,yt(e.messages,r=>(w(),T("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=m("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("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)),m("span",Jk,ne(r.text),1),m("div",Yk,[m("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,Xk),m("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>t.$emit("delete",r.id)},[...n[0]||(n[0]=[m("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[m("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,Qk)])]))),128))])])):se("",!0)}}),e0=et(Zk,[["__scopeId","data-v-ea583733"]]),t0={class:"runtime-dropdown-trigger-label"},n0={key:0,class:"runtime-dropdown-menu-wrap"},r0={class:"runtime-dropdown-menu"},s0=["onClick"],o0={class:"runtime-dropdown-option-label"},i0={key:0,class:"runtime-dropdown-option-check"},a0=Rt({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=$(null),o=$(!1),i=[{value:"local",label:"Local project",icon:Za},{value:"worktree",label:"New worktree",icon:To}],l=ie(()=>i.find(d=>d.value===n.modelValue)??i[0]);function c(d){r("update:modelValue",d),o.value=!1}function u(d){if(!o.value)return;const h=s.value;if(!h)return;const g=d.target;g instanceof Node&&(h.contains(g)||(o.value=!1))}return Zn(()=>{window.addEventListener("pointerdown",u)}),er(()=>{window.removeEventListener("pointerdown",u)}),(d,h)=>(w(),T("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[m("button",{class:"runtime-dropdown-trigger",type:"button",onClick:h[0]||(h[0]=g=>o.value=!o.value)},[(w(),lt(ia(l.value.icon),{class:"runtime-dropdown-trigger-icon"})),m("span",t0,ne(l.value.label),1),Ee(oi,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(w(),T("div",n0,[m("div",r0,[h[1]||(h[1]=m("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(w(),T(De,null,yt(i,g=>m("button",{key:g.value,class:rt(["runtime-dropdown-option",{"is-selected":e.modelValue===g.value}]),type:"button",onClick:k=>c(g.value)},[(w(),lt(ia(g.icon),{class:"runtime-dropdown-option-icon"})),m("span",o0,ne(g.label),1),e.modelValue===g.value?(w(),T("span",i0,"✓")):se("",!0)],10,s0)),64))])])):se("",!0)],512))}}),l0=et(a0,[["__scopeId","data-v-9c9b71e5"]]),c0={},u0={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function d0(e,t){return w(),T("svg",u0,[...t[0]||(t[0]=[m("circle",{cx:"11",cy:"11",r:"8"},null,-1),m("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const wa=et(c0,[["render",d0]]),f0={class:"skill-card-top"},h0=["src","alt"],p0={key:1,class:"skill-card-avatar-fallback"},m0={class:"skill-card-info"},g0={class:"skill-card-header"},v0={class:"skill-card-name"},y0={key:0,class:"skill-card-badge-disabled"},w0={key:1,class:"skill-card-badge"},b0={class:"skill-card-owner"},_0={key:0,class:"skill-card-desc"},k0={key:1,class:"skill-card-date"},T0=Rt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=ie(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),l=Date.now()-s;return l<36e5?`${Math.floor(l/6e4)}m ago`:l<864e5?`${Math.floor(l/36e5)}h ago`:l<2592e6?`${Math.floor(l/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)=>(w(),T("button",{class:rt(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[m("div",f0,[e.skill.avatarUrl?(w(),T("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,h0)):(w(),T("div",p0,ne(e.skill.owner.charAt(0)),1)),m("div",m0,[m("div",g0,[m("span",v0,ne(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(w(),T("span",y0,"Disabled")):e.skill.installed?(w(),T("span",w0,"Installed")):se("",!0)]),m("span",b0,ne(e.skill.owner),1)])]),e.skill.description?(w(),T("p",_0,ne(e.skill.description),1)):se("",!0),n.value?(w(),T("span",k0,ne(n.value),1)):se("",!0)],2))}}),Vc=et(T0,[["__scopeId","data-v-2a1e8196"]]),I0={class:"sdm-panel"},S0={class:"sdm-header"},E0={class:"sdm-title-area"},C0=["src","alt"],A0={class:"sdm-title-col"},R0={class:"sdm-title-row"},P0={class:"sdm-title"},x0={key:0,class:"sdm-badge-disabled"},M0={class:"sdm-owner"},O0={class:"sdm-body"},N0={key:0,class:"sdm-desc"},$0={key:1,class:"sdm-readme-loading"},D0=["innerHTML"],L0=["href"],j0={class:"sdm-footer"},B0={class:"sdm-footer-actions"},F0=["disabled"],U0=["disabled"],H0=["disabled"],V0=Rt({__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=$(null),o=$(""),i=$(!1),l=ie(()=>s.value??n.skill.enabled??!0),c=ie(()=>n.isInstalling===!0||n.isUninstalling===!0),u=ie(()=>{const A=o.value;if(!A)return"";const B=A.replace(/^---[\s\S]*?---\s*/,"");return d(B)});function d(A){return A.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").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 A=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),B=await fetch(`/codex-api/skills-hub/readme?${A}`);if(!B.ok)return;const Z=await B.json();o.value=Z.content??""}catch{}finally{i.value=!1}}}pt(()=>n.visible,A=>{A&&(s.value=null,o.value="",h())});function g(){r("install",n.skill)}function k(){r("uninstall",n.skill)}function j(){const A=!l.value;s.value=A,r("toggle-enabled",n.skill,A)}return(A,B)=>(w(),lt(xo,{to:"body"},[e.visible?(w(),T("div",{key:0,class:"sdm-overlay",onClick:B[1]||(B[1]=nt(Z=>A.$emit("close"),["self"]))},[m("div",I0,[m("div",S0,[m("div",E0,[e.skill.avatarUrl?(w(),T("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,C0)):se("",!0),m("div",A0,[m("div",R0,[m("h3",P0,ne(e.skill.displayName||e.skill.name),1),e.skill.installed&&!l.value?(w(),T("span",x0,"Disabled")):se("",!0)]),m("span",M0,ne(e.skill.owner),1)])]),m("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:B[0]||(B[0]=Z=>A.$emit("close"))},[Ee(el,{class:"sdm-close-icon"})])]),m("div",O0,[e.skill.description?(w(),T("p",N0,ne(e.skill.description),1)):se("",!0),i.value?(w(),T("div",$0,"Loading skill contents...")):o.value?(w(),T("div",{key:2,class:"sdm-readme",innerHTML:u.value},null,8,D0)):se("",!0),m("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,L0)]),m("div",j0,[m("div",B0,[e.skill.installed?(w(),T("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:c.value,onClick:k},ne(n.isUninstalling?"Uninstalling...":"Uninstall"),9,F0)):(w(),T("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:c.value,onClick:g},ne(n.isInstalling?"Installing...":"Install"),9,U0)),e.skill.installed?(w(),T("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:c.value,onClick:j},ne(l.value?"Disable":"Enable"),9,H0)):se("",!0)])])])])):se("",!0)]))}}),W0=et(V0,[["__scopeId","data-v-19a385ca"]]),G0=()=>{};var Wc={};/**
|
|
38
|
-
* @license
|
|
39
|
-
* Copyright 2017 Google LLC
|
|
40
|
-
*
|
|
41
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
42
|
-
* you may not use this file except in compliance with the License.
|
|
43
|
-
* You may obtain a copy of the License at
|
|
44
|
-
*
|
|
45
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
46
|
-
*
|
|
47
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
49
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
-
* See the License for the specific language governing permissions and
|
|
51
|
-
* limitations under the License.
|
|
52
|
-
*/const cf=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},q0=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++],l=e[n++],c=((s&7)<<18|(o&63)<<12|(i&63)<<6|l&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{const o=e[n++],i=e[n++];t[r++]=String.fromCharCode((s&15)<<12|(o&63)<<6|i&63)}}return t.join("")},uf={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,l=i?e[s+1]:0,c=s+2<e.length,u=c?e[s+2]:0,d=o>>2,h=(o&3)<<4|l>>4;let g=(l&15)<<2|u>>6,k=u&63;c||(k=64,i||(g=64)),r.push(n[d],n[h],n[g],n[k])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(cf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):q0(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++)],l=s<e.length?n[e.charAt(s)]:0;++s;const u=s<e.length?n[e.charAt(s)]:64;++s;const h=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||l==null||u==null||h==null)throw new z0;const g=o<<2|l>>4;if(r.push(g),u!==64){const k=l<<4&240|u>>2;if(r.push(k),h!==64){const j=u<<6&192|h;r.push(j)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class z0 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const K0=function(e){const t=cf(e);return uf.encodeByteArray(t,!0)},df=function(e){return K0(e).replace(/\./g,"")},ff=function(e){try{return uf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
|
|
53
|
-
* @license
|
|
54
|
-
* Copyright 2022 Google LLC
|
|
55
|
-
*
|
|
56
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
57
|
-
* you may not use this file except in compliance with the License.
|
|
58
|
-
* You may obtain a copy of the License at
|
|
59
|
-
*
|
|
60
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
61
|
-
*
|
|
62
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
63
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
64
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
65
|
-
* See the License for the specific language governing permissions and
|
|
66
|
-
* limitations under the License.
|
|
67
|
-
*/function J0(){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.")}/**
|
|
68
|
-
* @license
|
|
69
|
-
* Copyright 2022 Google LLC
|
|
70
|
-
*
|
|
71
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
72
|
-
* you may not use this file except in compliance with the License.
|
|
73
|
-
* You may obtain a copy of the License at
|
|
74
|
-
*
|
|
75
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
76
|
-
*
|
|
77
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
78
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
79
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
80
|
-
* See the License for the specific language governing permissions and
|
|
81
|
-
* limitations under the License.
|
|
82
|
-
*/const Y0=()=>J0().__FIREBASE_DEFAULTS__,X0=()=>{if(typeof process>"u"||typeof Wc>"u")return;const e=Wc.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},Q0=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&ff(e[1]);return t&&JSON.parse(t)},rl=()=>{try{return G0()||Y0()||X0()||Q0()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},Z0=e=>{var t,n;return(n=(t=rl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},hf=()=>{var e;return(e=rl())==null?void 0:e.config},pf=e=>{var t;return(t=rl())==null?void 0:t[`_${e}`]};/**
|
|
83
|
-
* @license
|
|
84
|
-
* Copyright 2017 Google LLC
|
|
85
|
-
*
|
|
86
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
87
|
-
* you may not use this file except in compliance with the License.
|
|
88
|
-
* You may obtain a copy of the License at
|
|
89
|
-
*
|
|
90
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
91
|
-
*
|
|
92
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
93
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
94
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
95
|
-
* See the License for the specific language governing permissions and
|
|
96
|
-
* limitations under the License.
|
|
97
|
-
*/class eT{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))}}}/**
|
|
98
|
-
* @license
|
|
99
|
-
* Copyright 2017 Google LLC
|
|
100
|
-
*
|
|
101
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
102
|
-
* you may not use this file except in compliance with the License.
|
|
103
|
-
* You may obtain a copy of the License at
|
|
104
|
-
*
|
|
105
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
106
|
-
*
|
|
107
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
108
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
109
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
110
|
-
* See the License for the specific language governing permissions and
|
|
111
|
-
* limitations under the License.
|
|
112
|
-
*/function Yt(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function tT(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Yt())}function nT(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function rT(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function sT(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function oT(){const e=Yt();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function iT(){try{return typeof indexedDB=="object"}catch{return!1}}function aT(){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)}})}/**
|
|
113
|
-
* @license
|
|
114
|
-
* Copyright 2017 Google LLC
|
|
115
|
-
*
|
|
116
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
117
|
-
* you may not use this file except in compliance with the License.
|
|
118
|
-
* You may obtain a copy of the License at
|
|
119
|
-
*
|
|
120
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
121
|
-
*
|
|
122
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
123
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
124
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
125
|
-
* See the License for the specific language governing permissions and
|
|
126
|
-
* limitations under the License.
|
|
127
|
-
*/const lT="FirebaseError";class _r extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=lT,Object.setPrototypeOf(this,_r.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,no.prototype.create)}}class no{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?cT(o,r):"Error",l=`${this.serviceName}: ${i} (${s}).`;return new _r(s,l,r)}}function cT(e,t){return e.replace(uT,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const uT=/\{\$([^}]+)}/g;function dT(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(Gc(o)&&Gc(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 Gc(e){return e!==null&&typeof e=="object"}/**
|
|
128
|
-
* @license
|
|
129
|
-
* Copyright 2017 Google LLC
|
|
130
|
-
*
|
|
131
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
132
|
-
* you may not use this file except in compliance with the License.
|
|
133
|
-
* You may obtain a copy of the License at
|
|
134
|
-
*
|
|
135
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
136
|
-
*
|
|
137
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
138
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
139
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
140
|
-
* See the License for the specific language governing permissions and
|
|
141
|
-
* limitations under the License.
|
|
142
|
-
*/function ro(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 fT(e,t){const n=new hT(e,t);return n.subscribe.bind(n)}class hT{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.");pT(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Fi),s.error===void 0&&(s.error=Fi),s.complete===void 0&&(s.complete=Fi);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 pT(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 Fi(){}/**
|
|
143
|
-
* @license
|
|
144
|
-
* Copyright 2021 Google LLC
|
|
145
|
-
*
|
|
146
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
147
|
-
* you may not use this file except in compliance with the License.
|
|
148
|
-
* You may obtain a copy of the License at
|
|
149
|
-
*
|
|
150
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
151
|
-
*
|
|
152
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
153
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
154
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
155
|
-
* See the License for the specific language governing permissions and
|
|
156
|
-
* limitations under the License.
|
|
157
|
-
*/function gs(e){return e&&e._delegate?e._delegate:e}/**
|
|
158
|
-
* @license
|
|
159
|
-
* Copyright 2025 Google LLC
|
|
160
|
-
*
|
|
161
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
162
|
-
* you may not use this file except in compliance with the License.
|
|
163
|
-
* You may obtain a copy of the License at
|
|
164
|
-
*
|
|
165
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
166
|
-
*
|
|
167
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
168
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
169
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
170
|
-
* See the License for the specific language governing permissions and
|
|
171
|
-
* limitations under the License.
|
|
172
|
-
*/function sl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function mT(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}}/**
|
|
173
|
-
* @license
|
|
174
|
-
* Copyright 2019 Google LLC
|
|
175
|
-
*
|
|
176
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
177
|
-
* you may not use this file except in compliance with the License.
|
|
178
|
-
* You may obtain a copy of the License at
|
|
179
|
-
*
|
|
180
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
181
|
-
*
|
|
182
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
183
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
184
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
185
|
-
* See the License for the specific language governing permissions and
|
|
186
|
-
* limitations under the License.
|
|
187
|
-
*/const Mr="[DEFAULT]";/**
|
|
188
|
-
* @license
|
|
189
|
-
* Copyright 2019 Google LLC
|
|
190
|
-
*
|
|
191
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
* you may not use this file except in compliance with the License.
|
|
193
|
-
* You may obtain a copy of the License at
|
|
194
|
-
*
|
|
195
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
*
|
|
197
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
* See the License for the specific language governing permissions and
|
|
201
|
-
* limitations under the License.
|
|
202
|
-
*/class gT{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 eT;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(yT(t))try{this.getOrInitializeService({instanceIdentifier:Mr})}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=Mr){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=Mr){return this.instances.has(t)}getOptions(t=Mr){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 l=this.normalizeInstanceIdentifier(o);r===l&&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:vT(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=Mr){return this.component?this.component.multipleInstances?t:Mr:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function vT(e){return e===Mr?void 0:e}function yT(e){return e.instantiationMode==="EAGER"}/**
|
|
203
|
-
* @license
|
|
204
|
-
* Copyright 2019 Google LLC
|
|
205
|
-
*
|
|
206
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
207
|
-
* you may not use this file except in compliance with the License.
|
|
208
|
-
* You may obtain a copy of the License at
|
|
209
|
-
*
|
|
210
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
211
|
-
*
|
|
212
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
213
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
214
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
215
|
-
* See the License for the specific language governing permissions and
|
|
216
|
-
* limitations under the License.
|
|
217
|
-
*/class wT{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 gT(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
|
218
|
-
* @license
|
|
219
|
-
* Copyright 2017 Google LLC
|
|
220
|
-
*
|
|
221
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
222
|
-
* you may not use this file except in compliance with the License.
|
|
223
|
-
* You may obtain a copy of the License at
|
|
224
|
-
*
|
|
225
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
226
|
-
*
|
|
227
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
228
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
229
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
230
|
-
* See the License for the specific language governing permissions and
|
|
231
|
-
* limitations under the License.
|
|
232
|
-
*/var mt;(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"})(mt||(mt={}));const bT={debug:mt.DEBUG,verbose:mt.VERBOSE,info:mt.INFO,warn:mt.WARN,error:mt.ERROR,silent:mt.SILENT},_T=mt.INFO,kT={[mt.DEBUG]:"log",[mt.VERBOSE]:"log",[mt.INFO]:"info",[mt.WARN]:"warn",[mt.ERROR]:"error"},TT=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=kT[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 mf{constructor(t){this.name=t,this._logLevel=_T,this._logHandler=TT,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in mt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?bT[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,mt.DEBUG,...t),this._logHandler(this,mt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,mt.VERBOSE,...t),this._logHandler(this,mt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,mt.INFO,...t),this._logHandler(this,mt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,mt.WARN,...t),this._logHandler(this,mt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,mt.ERROR,...t),this._logHandler(this,mt.ERROR,...t)}}const IT=(e,t)=>t.some(n=>e instanceof n);let qc,zc;function ST(){return qc||(qc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ET(){return zc||(zc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const gf=new WeakMap,ba=new WeakMap,vf=new WeakMap,Ui=new WeakMap,ol=new WeakMap;function CT(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(vr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&gf.set(n,e)}).catch(()=>{}),ol.set(t,e),t}function AT(e){if(ba.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)});ba.set(e,t)}let _a={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return ba.get(e);if(t==="objectStoreNames")return e.objectStoreNames||vf.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return vr(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function RT(e){_a=e(_a)}function PT(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Hi(this),t,...n);return vf.set(r,t.sort?t.sort():[t]),vr(r)}:ET().includes(e)?function(...t){return e.apply(Hi(this),t),vr(gf.get(this))}:function(...t){return vr(e.apply(Hi(this),t))}}function xT(e){return typeof e=="function"?PT(e):(e instanceof IDBTransaction&&AT(e),IT(e,ST())?new Proxy(e,_a):e)}function vr(e){if(e instanceof IDBRequest)return CT(e);if(Ui.has(e))return Ui.get(e);const t=xT(e);return t!==e&&(Ui.set(e,t),ol.set(t,e)),t}const Hi=e=>ol.get(e);function MT(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),l=vr(i);return r&&i.addEventListener("upgradeneeded",c=>{r(vr(i.result),c.oldVersion,c.newVersion,vr(i.transaction),c)}),n&&i.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),l.then(c=>{o&&c.addEventListener("close",()=>o()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const OT=["get","getKey","getAll","getAllKeys","count"],NT=["put","add","delete","clear"],Vi=new Map;function Kc(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Vi.get(t))return Vi.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=NT.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||OT.includes(n)))return;const o=async function(i,...l){const c=this.transaction(i,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(l.shift())),(await Promise.all([u[n](...l),s&&c.done]))[0]};return Vi.set(t,o),o}RT(e=>({...e,get:(t,n,r)=>Kc(t,n)||e.get(t,n,r),has:(t,n)=>!!Kc(t,n)||e.has(t,n)}));/**
|
|
233
|
-
* @license
|
|
234
|
-
* Copyright 2019 Google LLC
|
|
235
|
-
*
|
|
236
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
237
|
-
* you may not use this file except in compliance with the License.
|
|
238
|
-
* You may obtain a copy of the License at
|
|
239
|
-
*
|
|
240
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
241
|
-
*
|
|
242
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
243
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
244
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
245
|
-
* See the License for the specific language governing permissions and
|
|
246
|
-
* limitations under the License.
|
|
247
|
-
*/class $T{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(DT(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function DT(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const ka="@firebase/app",Jc="0.14.10";/**
|
|
248
|
-
* @license
|
|
249
|
-
* Copyright 2019 Google LLC
|
|
250
|
-
*
|
|
251
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
252
|
-
* you may not use this file except in compliance with the License.
|
|
253
|
-
* You may obtain a copy of the License at
|
|
254
|
-
*
|
|
255
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
256
|
-
*
|
|
257
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
258
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
259
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
260
|
-
* See the License for the specific language governing permissions and
|
|
261
|
-
* limitations under the License.
|
|
262
|
-
*/const Yn=new mf("@firebase/app"),LT="@firebase/app-compat",jT="@firebase/analytics-compat",BT="@firebase/analytics",FT="@firebase/app-check-compat",UT="@firebase/app-check",HT="@firebase/auth",VT="@firebase/auth-compat",WT="@firebase/database",GT="@firebase/data-connect",qT="@firebase/database-compat",zT="@firebase/functions",KT="@firebase/functions-compat",JT="@firebase/installations",YT="@firebase/installations-compat",XT="@firebase/messaging",QT="@firebase/messaging-compat",ZT="@firebase/performance",eI="@firebase/performance-compat",tI="@firebase/remote-config",nI="@firebase/remote-config-compat",rI="@firebase/storage",sI="@firebase/storage-compat",oI="@firebase/firestore",iI="@firebase/ai",aI="@firebase/firestore-compat",lI="firebase",cI="12.11.0";/**
|
|
263
|
-
* @license
|
|
264
|
-
* Copyright 2019 Google LLC
|
|
265
|
-
*
|
|
266
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
267
|
-
* you may not use this file except in compliance with the License.
|
|
268
|
-
* You may obtain a copy of the License at
|
|
269
|
-
*
|
|
270
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
271
|
-
*
|
|
272
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
273
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
274
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
275
|
-
* See the License for the specific language governing permissions and
|
|
276
|
-
* limitations under the License.
|
|
277
|
-
*/const Ta="[DEFAULT]",uI={[ka]:"fire-core",[LT]:"fire-core-compat",[BT]:"fire-analytics",[jT]:"fire-analytics-compat",[UT]:"fire-app-check",[FT]:"fire-app-check-compat",[HT]:"fire-auth",[VT]:"fire-auth-compat",[WT]:"fire-rtdb",[GT]:"fire-data-connect",[qT]:"fire-rtdb-compat",[zT]:"fire-fn",[KT]:"fire-fn-compat",[JT]:"fire-iid",[YT]:"fire-iid-compat",[XT]:"fire-fcm",[QT]:"fire-fcm-compat",[ZT]:"fire-perf",[eI]:"fire-perf-compat",[tI]:"fire-rc",[nI]:"fire-rc-compat",[rI]:"fire-gcs",[sI]:"fire-gcs-compat",[oI]:"fire-fst",[aI]:"fire-fst-compat",[iI]:"fire-vertex","fire-js":"fire-js",[lI]:"fire-js-all"};/**
|
|
278
|
-
* @license
|
|
279
|
-
* Copyright 2019 Google LLC
|
|
280
|
-
*
|
|
281
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
282
|
-
* you may not use this file except in compliance with the License.
|
|
283
|
-
* You may obtain a copy of the License at
|
|
284
|
-
*
|
|
285
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
286
|
-
*
|
|
287
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
288
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
289
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
290
|
-
* See the License for the specific language governing permissions and
|
|
291
|
-
* limitations under the License.
|
|
292
|
-
*/const Js=new Map,dI=new Map,Ia=new Map;function Yc(e,t){try{e.container.addComponent(t)}catch(n){Yn.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Ys(e){const t=e.name;if(Ia.has(t))return Yn.debug(`There were multiple attempts to register component ${t}.`),!1;Ia.set(t,e);for(const n of Js.values())Yc(n,e);for(const n of dI.values())Yc(n,e);return!0}function yf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Sn(e){return e==null?!1:e.settings!==void 0}/**
|
|
293
|
-
* @license
|
|
294
|
-
* Copyright 2019 Google LLC
|
|
295
|
-
*
|
|
296
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
297
|
-
* you may not use this file except in compliance with the License.
|
|
298
|
-
* You may obtain a copy of the License at
|
|
299
|
-
*
|
|
300
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
301
|
-
*
|
|
302
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
303
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
304
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
305
|
-
* See the License for the specific language governing permissions and
|
|
306
|
-
* limitations under the License.
|
|
307
|
-
*/const fI={"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."},yr=new no("app","Firebase",fI);/**
|
|
308
|
-
* @license
|
|
309
|
-
* Copyright 2019 Google LLC
|
|
310
|
-
*
|
|
311
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
312
|
-
* you may not use this file except in compliance with the License.
|
|
313
|
-
* You may obtain a copy of the License at
|
|
314
|
-
*
|
|
315
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
316
|
-
*
|
|
317
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
318
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
319
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
320
|
-
* See the License for the specific language governing permissions and
|
|
321
|
-
* limitations under the License.
|
|
322
|
-
*/class hI{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 yr.create("app-deleted",{appName:this._name})}}/**
|
|
323
|
-
* @license
|
|
324
|
-
* Copyright 2019 Google LLC
|
|
325
|
-
*
|
|
326
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
327
|
-
* you may not use this file except in compliance with the License.
|
|
328
|
-
* You may obtain a copy of the License at
|
|
329
|
-
*
|
|
330
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
331
|
-
*
|
|
332
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
333
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
334
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
335
|
-
* See the License for the specific language governing permissions and
|
|
336
|
-
* limitations under the License.
|
|
337
|
-
*/const so=cI;function wf(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:Ta,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw yr.create("bad-app-name",{appName:String(s)});if(n||(n=hf()),!n)throw yr.create("no-options");const o=Js.get(s);if(o){if(fs(n,o.options)&&fs(r,o.config))return o;throw yr.create("duplicate-app",{appName:s})}const i=new wT(s);for(const c of Ia.values())i.addComponent(c);const l=new hI(n,r,i);return Js.set(s,l),l}function bf(e=Ta){const t=Js.get(e);if(!t&&e===Ta&&hf())return wf();if(!t)throw yr.create("no-app",{appName:e});return t}function pI(){return Array.from(Js.values())}function os(e,t,n){let r=uI[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 "/")`),Yn.warn(i.join(" "));return}Ys(new hs(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
|
|
338
|
-
* @license
|
|
339
|
-
* Copyright 2021 Google LLC
|
|
340
|
-
*
|
|
341
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
342
|
-
* you may not use this file except in compliance with the License.
|
|
343
|
-
* You may obtain a copy of the License at
|
|
344
|
-
*
|
|
345
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
346
|
-
*
|
|
347
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
348
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
349
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
350
|
-
* See the License for the specific language governing permissions and
|
|
351
|
-
* limitations under the License.
|
|
352
|
-
*/const mI="firebase-heartbeat-database",gI=1,Xs="firebase-heartbeat-store";let Wi=null;function _f(){return Wi||(Wi=MT(mI,gI,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Xs)}catch(n){console.warn(n)}}}}).catch(e=>{throw yr.create("idb-open",{originalErrorMessage:e.message})})),Wi}async function vI(e){try{const n=(await _f()).transaction(Xs),r=await n.objectStore(Xs).get(kf(e));return await n.done,r}catch(t){if(t instanceof _r)Yn.warn(t.message);else{const n=yr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Yn.warn(n.message)}}}async function Xc(e,t){try{const r=(await _f()).transaction(Xs,"readwrite");await r.objectStore(Xs).put(t,kf(e)),await r.done}catch(n){if(n instanceof _r)Yn.warn(n.message);else{const r=yr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Yn.warn(r.message)}}}function kf(e){return`${e.name}!${e.options.appId}`}/**
|
|
353
|
-
* @license
|
|
354
|
-
* Copyright 2021 Google LLC
|
|
355
|
-
*
|
|
356
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
357
|
-
* you may not use this file except in compliance with the License.
|
|
358
|
-
* You may obtain a copy of the License at
|
|
359
|
-
*
|
|
360
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
361
|
-
*
|
|
362
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
363
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
364
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
365
|
-
* See the License for the specific language governing permissions and
|
|
366
|
-
* limitations under the License.
|
|
367
|
-
*/const yI=1024,wI=30;class bI{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new kI(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=Qc();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>wI){const i=TI(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Yn.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=Qc(),{heartbeatsToSend:r,unsentEntries:s}=_I(this._heartbeatsCache.heartbeats),o=df(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 Yn.warn(n),""}}}function Qc(){return new Date().toISOString().substring(0,10)}function _I(e,t=yI){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),Zc(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Zc(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class kI{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return iT()?aT().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await vI(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 Xc(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 Xc(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Zc(e){return df(JSON.stringify({version:2,heartbeats:e})).length}function TI(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}/**
|
|
368
|
-
* @license
|
|
369
|
-
* Copyright 2019 Google LLC
|
|
370
|
-
*
|
|
371
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
372
|
-
* you may not use this file except in compliance with the License.
|
|
373
|
-
* You may obtain a copy of the License at
|
|
374
|
-
*
|
|
375
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
376
|
-
*
|
|
377
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
378
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
379
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
380
|
-
* See the License for the specific language governing permissions and
|
|
381
|
-
* limitations under the License.
|
|
382
|
-
*/function II(e){Ys(new hs("platform-logger",t=>new $T(t),"PRIVATE")),Ys(new hs("heartbeat",t=>new bI(t),"PRIVATE")),os(ka,Jc,e),os(ka,Jc,"esm2020"),os("fire-js","")}II("");var SI="firebase",EI="12.11.0";/**
|
|
383
|
-
* @license
|
|
384
|
-
* Copyright 2020 Google LLC
|
|
385
|
-
*
|
|
386
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
387
|
-
* you may not use this file except in compliance with the License.
|
|
388
|
-
* You may obtain a copy of the License at
|
|
389
|
-
*
|
|
390
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
391
|
-
*
|
|
392
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
393
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
394
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
395
|
-
* See the License for the specific language governing permissions and
|
|
396
|
-
* limitations under the License.
|
|
397
|
-
*/os(SI,EI,"app");function Tf(){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 CI=Tf,If=new no("auth","Firebase",Tf());/**
|
|
398
|
-
* @license
|
|
399
|
-
* Copyright 2020 Google LLC
|
|
400
|
-
*
|
|
401
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
402
|
-
* you may not use this file except in compliance with the License.
|
|
403
|
-
* You may obtain a copy of the License at
|
|
404
|
-
*
|
|
405
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
406
|
-
*
|
|
407
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
408
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
409
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
410
|
-
* See the License for the specific language governing permissions and
|
|
411
|
-
* limitations under the License.
|
|
412
|
-
*/const Lo=new mf("@firebase/auth");function AI(e,...t){Lo.logLevel<=mt.WARN&&Lo.warn(`Auth (${so}): ${e}`,...t)}function Io(e,...t){Lo.logLevel<=mt.ERROR&&Lo.error(`Auth (${so}): ${e}`,...t)}/**
|
|
413
|
-
* @license
|
|
414
|
-
* Copyright 2020 Google LLC
|
|
415
|
-
*
|
|
416
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
417
|
-
* you may not use this file except in compliance with the License.
|
|
418
|
-
* You may obtain a copy of the License at
|
|
419
|
-
*
|
|
420
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
421
|
-
*
|
|
422
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
423
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
424
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
425
|
-
* See the License for the specific language governing permissions and
|
|
426
|
-
* limitations under the License.
|
|
427
|
-
*/function Pn(e,...t){throw al(e,...t)}function hn(e,...t){return al(e,...t)}function il(e,t,n){const r={...CI(),[t]:n};return new no("auth","Firebase",r).create(t,{appName:e.name})}function Br(e){return il(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function RI(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Pn(e,"argument-error"),il(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function al(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 If.create(e,...t)}function Fe(e,t,...n){if(!e)throw al(t,...n)}function Hn(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Io(t),new Error(t)}function Xn(e,t){e||Hn(t)}/**
|
|
428
|
-
* @license
|
|
429
|
-
* Copyright 2020 Google LLC
|
|
430
|
-
*
|
|
431
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
432
|
-
* you may not use this file except in compliance with the License.
|
|
433
|
-
* You may obtain a copy of the License at
|
|
434
|
-
*
|
|
435
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
436
|
-
*
|
|
437
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
438
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
439
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
440
|
-
* See the License for the specific language governing permissions and
|
|
441
|
-
* limitations under the License.
|
|
442
|
-
*/function Sa(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function PI(){return eu()==="http:"||eu()==="https:"}function eu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
|
|
443
|
-
* @license
|
|
444
|
-
* Copyright 2020 Google LLC
|
|
445
|
-
*
|
|
446
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
447
|
-
* you may not use this file except in compliance with the License.
|
|
448
|
-
* You may obtain a copy of the License at
|
|
449
|
-
*
|
|
450
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
451
|
-
*
|
|
452
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
453
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
454
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
455
|
-
* See the License for the specific language governing permissions and
|
|
456
|
-
* limitations under the License.
|
|
457
|
-
*/function xI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(PI()||rT()||"connection"in navigator)?navigator.onLine:!0}function MI(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
|
|
458
|
-
* @license
|
|
459
|
-
* Copyright 2020 Google LLC
|
|
460
|
-
*
|
|
461
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
462
|
-
* you may not use this file except in compliance with the License.
|
|
463
|
-
* You may obtain a copy of the License at
|
|
464
|
-
*
|
|
465
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
466
|
-
*
|
|
467
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
468
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
469
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
470
|
-
* See the License for the specific language governing permissions and
|
|
471
|
-
* limitations under the License.
|
|
472
|
-
*/class oo{constructor(t,n){this.shortDelay=t,this.longDelay=n,Xn(n>t,"Short delay should be less than long delay!"),this.isMobile=tT()||sT()}get(){return xI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
473
|
-
* @license
|
|
474
|
-
* Copyright 2020 Google LLC
|
|
475
|
-
*
|
|
476
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
477
|
-
* you may not use this file except in compliance with the License.
|
|
478
|
-
* You may obtain a copy of the License at
|
|
479
|
-
*
|
|
480
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
481
|
-
*
|
|
482
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
483
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
484
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
485
|
-
* See the License for the specific language governing permissions and
|
|
486
|
-
* limitations under the License.
|
|
487
|
-
*/function ll(e,t){Xn(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
|
|
488
|
-
* @license
|
|
489
|
-
* Copyright 2020 Google LLC
|
|
490
|
-
*
|
|
491
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
492
|
-
* you may not use this file except in compliance with the License.
|
|
493
|
-
* You may obtain a copy of the License at
|
|
494
|
-
*
|
|
495
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
496
|
-
*
|
|
497
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
498
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
499
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
500
|
-
* See the License for the specific language governing permissions and
|
|
501
|
-
* limitations under the License.
|
|
502
|
-
*/class Sf{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;Hn("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;Hn("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;Hn("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
503
|
-
* @license
|
|
504
|
-
* Copyright 2020 Google LLC
|
|
505
|
-
*
|
|
506
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
507
|
-
* you may not use this file except in compliance with the License.
|
|
508
|
-
* You may obtain a copy of the License at
|
|
509
|
-
*
|
|
510
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
511
|
-
*
|
|
512
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
513
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
514
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
515
|
-
* See the License for the specific language governing permissions and
|
|
516
|
-
* limitations under the License.
|
|
517
|
-
*/const OI={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"};/**
|
|
518
|
-
* @license
|
|
519
|
-
* Copyright 2020 Google LLC
|
|
520
|
-
*
|
|
521
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
522
|
-
* you may not use this file except in compliance with the License.
|
|
523
|
-
* You may obtain a copy of the License at
|
|
524
|
-
*
|
|
525
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
526
|
-
*
|
|
527
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
528
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
529
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
530
|
-
* See the License for the specific language governing permissions and
|
|
531
|
-
* limitations under the License.
|
|
532
|
-
*/const NI=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$I=new oo(3e4,6e4);function cl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function vs(e,t,n,r,s={}){return Ef(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const l=ro({key:e.config.apiKey,...i}).slice(1),c=await e._getAdditionalHeaders();c["Content-Type"]="application/json",e.languageCode&&(c["X-Firebase-Locale"]=e.languageCode);const u={method:t,headers:c,...o};return nT()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&sl(e.emulatorConfig.host)&&(u.credentials="include"),Sf.fetch()(await Cf(e,e.config.apiHost,n,l),u)})}async function Ef(e,t,n){e._canInitEmulator=!1;const r={...OI,...t};try{const s=new LI(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw ho(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const l=o.ok?i.errorMessage:i.error.message,[c,u]=l.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ho(e,"credential-already-in-use",i);if(c==="EMAIL_EXISTS")throw ho(e,"email-already-in-use",i);if(c==="USER_DISABLED")throw ho(e,"user-disabled",i);const d=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw il(e,d,u);Pn(e,d)}}catch(s){if(s instanceof _r)throw s;Pn(e,"network-request-failed",{message:String(s)})}}async function DI(e,t,n,r,s={}){const o=await vs(e,t,n,r,s);return"mfaPendingCredential"in o&&Pn(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function Cf(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?ll(e.config,s):`${e.config.apiScheme}://${s}`;return NI.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class LI{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(hn(this.auth,"network-request-failed")),$I.get())})}}function ho(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=hn(e,t,r);return s.customData._tokenResponse=n,s}/**
|
|
533
|
-
* @license
|
|
534
|
-
* Copyright 2020 Google LLC
|
|
535
|
-
*
|
|
536
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
537
|
-
* you may not use this file except in compliance with the License.
|
|
538
|
-
* You may obtain a copy of the License at
|
|
539
|
-
*
|
|
540
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
541
|
-
*
|
|
542
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
543
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
544
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
545
|
-
* See the License for the specific language governing permissions and
|
|
546
|
-
* limitations under the License.
|
|
547
|
-
*/async function jI(e,t){return vs(e,"POST","/v1/accounts:delete",t)}async function jo(e,t){return vs(e,"POST","/v1/accounts:lookup",t)}/**
|
|
548
|
-
* @license
|
|
549
|
-
* Copyright 2020 Google LLC
|
|
550
|
-
*
|
|
551
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
552
|
-
* you may not use this file except in compliance with the License.
|
|
553
|
-
* You may obtain a copy of the License at
|
|
554
|
-
*
|
|
555
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
556
|
-
*
|
|
557
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
558
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
559
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
560
|
-
* See the License for the specific language governing permissions and
|
|
561
|
-
* limitations under the License.
|
|
562
|
-
*/function js(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function BI(e,t=!1){const n=gs(e),r=await n.getIdToken(t),s=ul(r);Fe(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:js(Gi(s.auth_time)),issuedAtTime:js(Gi(s.iat)),expirationTime:js(Gi(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Gi(e){return Number(e)*1e3}function ul(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Io("JWT malformed, contained fewer than 3 sections"),null;try{const s=ff(n);return s?JSON.parse(s):(Io("Failed to decode base64 JWT payload"),null)}catch(s){return Io("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function tu(e){const t=ul(e);return Fe(t,"internal-error"),Fe(typeof t.exp<"u","internal-error"),Fe(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
|
|
563
|
-
* @license
|
|
564
|
-
* Copyright 2020 Google LLC
|
|
565
|
-
*
|
|
566
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
567
|
-
* you may not use this file except in compliance with the License.
|
|
568
|
-
* You may obtain a copy of the License at
|
|
569
|
-
*
|
|
570
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
571
|
-
*
|
|
572
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
573
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
574
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
575
|
-
* See the License for the specific language governing permissions and
|
|
576
|
-
* limitations under the License.
|
|
577
|
-
*/async function Qs(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof _r&&FI(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function FI({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
|
|
578
|
-
* @license
|
|
579
|
-
* Copyright 2020 Google LLC
|
|
580
|
-
*
|
|
581
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
582
|
-
* you may not use this file except in compliance with the License.
|
|
583
|
-
* You may obtain a copy of the License at
|
|
584
|
-
*
|
|
585
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
586
|
-
*
|
|
587
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
588
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
589
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
590
|
-
* See the License for the specific language governing permissions and
|
|
591
|
-
* limitations under the License.
|
|
592
|
-
*/class UI{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()}}/**
|
|
593
|
-
* @license
|
|
594
|
-
* Copyright 2020 Google LLC
|
|
595
|
-
*
|
|
596
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
597
|
-
* you may not use this file except in compliance with the License.
|
|
598
|
-
* You may obtain a copy of the License at
|
|
599
|
-
*
|
|
600
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
601
|
-
*
|
|
602
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
603
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
604
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
605
|
-
* See the License for the specific language governing permissions and
|
|
606
|
-
* limitations under the License.
|
|
607
|
-
*/class Ea{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=js(this.lastLoginAt),this.creationTime=js(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
608
|
-
* @license
|
|
609
|
-
* Copyright 2019 Google LLC
|
|
610
|
-
*
|
|
611
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
612
|
-
* you may not use this file except in compliance with the License.
|
|
613
|
-
* You may obtain a copy of the License at
|
|
614
|
-
*
|
|
615
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
616
|
-
*
|
|
617
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
618
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
619
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
620
|
-
* See the License for the specific language governing permissions and
|
|
621
|
-
* limitations under the License.
|
|
622
|
-
*/async function Bo(e){var h;const t=e.auth,n=await e.getIdToken(),r=await Qs(e,jo(t,{idToken:n}));Fe(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?Af(s.providerUserInfo):[],i=VI(e.providerData,o),l=e.isAnonymous,c=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),u=l?c:!1,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:i,metadata:new Ea(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(e,d)}async function HI(e){const t=gs(e);await Bo(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function VI(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function Af(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}))}/**
|
|
623
|
-
* @license
|
|
624
|
-
* Copyright 2020 Google LLC
|
|
625
|
-
*
|
|
626
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
627
|
-
* you may not use this file except in compliance with the License.
|
|
628
|
-
* You may obtain a copy of the License at
|
|
629
|
-
*
|
|
630
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
631
|
-
*
|
|
632
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
633
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
634
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
635
|
-
* See the License for the specific language governing permissions and
|
|
636
|
-
* limitations under the License.
|
|
637
|
-
*/async function WI(e,t){const n=await Ef(e,{},async()=>{const r=ro({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await Cf(e,s,"/v1/token",`key=${o}`),l=await e._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:l,body:r};return e.emulatorConfig&&sl(e.emulatorConfig.host)&&(c.credentials="include"),Sf.fetch()(i,c)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function GI(e,t){return vs(e,"POST","/v2/accounts:revokeToken",cl(e,t))}/**
|
|
638
|
-
* @license
|
|
639
|
-
* Copyright 2020 Google LLC
|
|
640
|
-
*
|
|
641
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
642
|
-
* you may not use this file except in compliance with the License.
|
|
643
|
-
* You may obtain a copy of the License at
|
|
644
|
-
*
|
|
645
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
646
|
-
*
|
|
647
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
648
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
649
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
650
|
-
* See the License for the specific language governing permissions and
|
|
651
|
-
* limitations under the License.
|
|
652
|
-
*/class is{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Fe(t.idToken,"internal-error"),Fe(typeof t.idToken<"u","internal-error"),Fe(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):tu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Fe(t.length!==0,"internal-error");const n=tu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Fe(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 WI(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&&(Fe(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(Fe(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(Fe(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 Hn("not implemented")}}/**
|
|
653
|
-
* @license
|
|
654
|
-
* Copyright 2020 Google LLC
|
|
655
|
-
*
|
|
656
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
657
|
-
* you may not use this file except in compliance with the License.
|
|
658
|
-
* You may obtain a copy of the License at
|
|
659
|
-
*
|
|
660
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
661
|
-
*
|
|
662
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
663
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
664
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
665
|
-
* See the License for the specific language governing permissions and
|
|
666
|
-
* limitations under the License.
|
|
667
|
-
*/function cr(e,t){Fe(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class un{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new UI(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 Ea(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await Qs(this,this.stsTokenManager.getToken(this.auth,t));return Fe(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return BI(this,t)}reload(){return HI(this)}_assign(t){this!==t&&(Fe(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 un({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){Fe(!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 Bo(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Sn(this.auth.app))return Promise.reject(Br(this.auth));const t=await this.getIdToken();return await Qs(this,jI(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,l=n.tenantId??void 0,c=n._redirectEventId??void 0,u=n.createdAt??void 0,d=n.lastLoginAt??void 0,{uid:h,emailVerified:g,isAnonymous:k,providerData:j,stsTokenManager:A}=n;Fe(h&&A,t,"internal-error");const B=is.fromJSON(this.name,A);Fe(typeof h=="string",t,"internal-error"),cr(r,t.name),cr(s,t.name),Fe(typeof g=="boolean",t,"internal-error"),Fe(typeof k=="boolean",t,"internal-error"),cr(o,t.name),cr(i,t.name),cr(l,t.name),cr(c,t.name),cr(u,t.name),cr(d,t.name);const Z=new un({uid:h,auth:t,email:s,emailVerified:g,displayName:r,isAnonymous:k,photoURL:i,phoneNumber:o,tenantId:l,stsTokenManager:B,createdAt:u,lastLoginAt:d});return j&&Array.isArray(j)&&(Z.providerData=j.map(V=>({...V}))),c&&(Z._redirectEventId=c),Z}static async _fromIdTokenResponse(t,n,r=!1){const s=new is;s.updateFromServerResponse(n);const o=new un({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Bo(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];Fe(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?Af(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),l=new is;l.updateFromIdToken(r);const c=new un({uid:s.localId,auth:t,stsTokenManager:l,isAnonymous:i}),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:o,metadata:new Ea(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(c,u),c}}/**
|
|
668
|
-
* @license
|
|
669
|
-
* Copyright 2020 Google LLC
|
|
670
|
-
*
|
|
671
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
672
|
-
* you may not use this file except in compliance with the License.
|
|
673
|
-
* You may obtain a copy of the License at
|
|
674
|
-
*
|
|
675
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
676
|
-
*
|
|
677
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
678
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
679
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
680
|
-
* See the License for the specific language governing permissions and
|
|
681
|
-
* limitations under the License.
|
|
682
|
-
*/const nu=new Map;function Vn(e){Xn(e instanceof Function,"Expected a class definition");let t=nu.get(e);return t?(Xn(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,nu.set(e,t),t)}/**
|
|
683
|
-
* @license
|
|
684
|
-
* Copyright 2019 Google LLC
|
|
685
|
-
*
|
|
686
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
687
|
-
* you may not use this file except in compliance with the License.
|
|
688
|
-
* You may obtain a copy of the License at
|
|
689
|
-
*
|
|
690
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
691
|
-
*
|
|
692
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
693
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
694
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
695
|
-
* See the License for the specific language governing permissions and
|
|
696
|
-
* limitations under the License.
|
|
697
|
-
*/class Rf{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){}}Rf.type="NONE";const ru=Rf;/**
|
|
698
|
-
* @license
|
|
699
|
-
* Copyright 2019 Google LLC
|
|
700
|
-
*
|
|
701
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
702
|
-
* you may not use this file except in compliance with the License.
|
|
703
|
-
* You may obtain a copy of the License at
|
|
704
|
-
*
|
|
705
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
706
|
-
*
|
|
707
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
708
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
709
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
710
|
-
* See the License for the specific language governing permissions and
|
|
711
|
-
* limitations under the License.
|
|
712
|
-
*/function So(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=So(this.userKey,s.apiKey,o),this.fullPersistenceKey=So("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 jo(this.auth,{idToken:t}).catch(()=>{});return n?un._fromGetAccountInfoResponse(this.auth,n,t):null}return un._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(Vn(ru),t,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let o=s[0]||Vn(ru);const i=So(r,t.config.apiKey,t.name);let l=null;for(const u of n)try{const d=await u._get(i);if(d){let h;if(typeof d=="string"){const g=await jo(t,{idToken:d}).catch(()=>{});if(!g)break;h=await un._fromGetAccountInfoResponse(t,g,d)}else h=un._fromJSON(t,d);u!==o&&(l=h),o=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!o._shouldAllowMigration||!c.length?new as(o,t,r):(o=c[0],l&&await o._set(i,l.toJSON()),await Promise.all(n.map(async u=>{if(u!==o)try{await u._remove(i)}catch{}})),new as(o,t,r))}}/**
|
|
713
|
-
* @license
|
|
714
|
-
* Copyright 2020 Google LLC
|
|
715
|
-
*
|
|
716
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
717
|
-
* you may not use this file except in compliance with the License.
|
|
718
|
-
* You may obtain a copy of the License at
|
|
719
|
-
*
|
|
720
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
721
|
-
*
|
|
722
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
723
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
724
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
725
|
-
* See the License for the specific language governing permissions and
|
|
726
|
-
* limitations under the License.
|
|
727
|
-
*/function su(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Of(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Pf(t))return"Firefox";if(t.includes("silk/"))return"Silk";if($f(t))return"Blackberry";if(Df(t))return"Webos";if(xf(t))return"Safari";if((t.includes("chrome/")||Mf(t))&&!t.includes("edge/"))return"Chrome";if(Nf(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 Pf(e=Yt()){return/firefox\//i.test(e)}function xf(e=Yt()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Mf(e=Yt()){return/crios\//i.test(e)}function Of(e=Yt()){return/iemobile/i.test(e)}function Nf(e=Yt()){return/android/i.test(e)}function $f(e=Yt()){return/blackberry/i.test(e)}function Df(e=Yt()){return/webos/i.test(e)}function dl(e=Yt()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function qI(e=Yt()){var t;return dl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function zI(){return oT()&&document.documentMode===10}function Lf(e=Yt()){return dl(e)||Nf(e)||Df(e)||$f(e)||/windows phone/i.test(e)||Of(e)}/**
|
|
728
|
-
* @license
|
|
729
|
-
* Copyright 2020 Google LLC
|
|
730
|
-
*
|
|
731
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
732
|
-
* you may not use this file except in compliance with the License.
|
|
733
|
-
* You may obtain a copy of the License at
|
|
734
|
-
*
|
|
735
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
736
|
-
*
|
|
737
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
738
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
739
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
740
|
-
* See the License for the specific language governing permissions and
|
|
741
|
-
* limitations under the License.
|
|
742
|
-
*/function jf(e,t=[]){let n;switch(e){case"Browser":n=su(Yt());break;case"Worker":n=`${su(Yt())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${so}/${r}`}/**
|
|
743
|
-
* @license
|
|
744
|
-
* Copyright 2022 Google LLC
|
|
745
|
-
*
|
|
746
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
747
|
-
* you may not use this file except in compliance with the License.
|
|
748
|
-
* You may obtain a copy of the License at
|
|
749
|
-
*
|
|
750
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
751
|
-
*
|
|
752
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
753
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
754
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
755
|
-
* See the License for the specific language governing permissions and
|
|
756
|
-
* limitations under the License.
|
|
757
|
-
*/class KI{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,n){const r=o=>new Promise((i,l)=>{try{const c=t(o);i(c)}catch(c){l(c)}});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})}}}/**
|
|
758
|
-
* @license
|
|
759
|
-
* Copyright 2023 Google LLC
|
|
760
|
-
*
|
|
761
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
762
|
-
* you may not use this file except in compliance with the License.
|
|
763
|
-
* You may obtain a copy of the License at
|
|
764
|
-
*
|
|
765
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
766
|
-
*
|
|
767
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
768
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
769
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
770
|
-
* See the License for the specific language governing permissions and
|
|
771
|
-
* limitations under the License.
|
|
772
|
-
*/async function JI(e,t={}){return vs(e,"GET","/v2/passwordPolicy",cl(e,t))}/**
|
|
773
|
-
* @license
|
|
774
|
-
* Copyright 2023 Google LLC
|
|
775
|
-
*
|
|
776
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
777
|
-
* you may not use this file except in compliance with the License.
|
|
778
|
-
* You may obtain a copy of the License at
|
|
779
|
-
*
|
|
780
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
781
|
-
*
|
|
782
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
783
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
784
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
785
|
-
* See the License for the specific language governing permissions and
|
|
786
|
-
* limitations under the License.
|
|
787
|
-
*/const YI=6;class XI{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??YI,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))}}/**
|
|
788
|
-
* @license
|
|
789
|
-
* Copyright 2020 Google LLC
|
|
790
|
-
*
|
|
791
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
792
|
-
* you may not use this file except in compliance with the License.
|
|
793
|
-
* You may obtain a copy of the License at
|
|
794
|
-
*
|
|
795
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
796
|
-
*
|
|
797
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
798
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
799
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
800
|
-
* See the License for the specific language governing permissions and
|
|
801
|
-
* limitations under the License.
|
|
802
|
-
*/class QI{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 ou(this),this.idTokenSubscription=new ou(this),this.beforeStateQueue=new KI(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=If,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=Vn(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 jo(this,{idToken:t}),r=await un._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(Sn(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(l=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(l,l))}):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,l=r==null?void 0:r._redirectEventId,c=await this.tryRedirectSignIn(t);(!i||i===l)&&(c!=null&&c.user)&&(r=c.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 Fe(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 Bo(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=MI()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Sn(this.app))return Promise.reject(Br(this));const n=t?gs(t):null;return n&&Fe(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&&Fe(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 Sn(this.app)?Promise.reject(Br(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Sn(this.app)?Promise.reject(Br(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Vn(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 JI(this),n=new XI(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 no("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 GI(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&&Vn(t)||this._popupRedirectResolver;Fe(n,this,"argument-error"),this.redirectPersistenceManager=await as.create(this,[Vn(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 l=this._isInitialized?Promise.resolve():this._initializationPromise;if(Fe(l,this,"internal-error"),l.then(()=>{i||o(this.currentUser)}),typeof n=="function"){const c=t.addObserver(n,r,s);return()=>{i=!0,c()}}else{const c=t.addObserver(n);return()=>{i=!0,c()}}}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 Fe(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=jf(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(Sn(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&&AI(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function ii(e){return gs(e)}class ou{constructor(t){this.auth=t,this.observer=null,this.addObserver=fT(n=>this.observer=n)}get next(){return Fe(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
803
|
-
* @license
|
|
804
|
-
* Copyright 2020 Google LLC
|
|
805
|
-
*
|
|
806
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
807
|
-
* you may not use this file except in compliance with the License.
|
|
808
|
-
* You may obtain a copy of the License at
|
|
809
|
-
*
|
|
810
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
811
|
-
*
|
|
812
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
813
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
814
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
815
|
-
* See the License for the specific language governing permissions and
|
|
816
|
-
* limitations under the License.
|
|
817
|
-
*/let fl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function ZI(e){fl=e}function eS(e){return fl.loadJS(e)}function tS(){return fl.gapiScript}function nS(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
|
|
818
|
-
* @license
|
|
819
|
-
* Copyright 2020 Google LLC
|
|
820
|
-
*
|
|
821
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
822
|
-
* you may not use this file except in compliance with the License.
|
|
823
|
-
* You may obtain a copy of the License at
|
|
824
|
-
*
|
|
825
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
826
|
-
*
|
|
827
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
828
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
829
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
830
|
-
* See the License for the specific language governing permissions and
|
|
831
|
-
* limitations under the License.
|
|
832
|
-
*/function rS(e,t){const n=yf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(fs(o,t??{}))return s;Pn(s,"already-initialized")}return n.initialize({options:t})}function sS(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Vn);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function oS(e,t,n){const r=ii(e);Fe(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Bf(t),{host:i,port:l}=iS(t),c=l===null?"":`:${l}`,u={url:`${o}//${i}${c}/`},d=Object.freeze({host:i,port:l,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Fe(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Fe(fs(u,r.config.emulator)&&fs(d,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=d,r.settings.appVerificationDisabledForTesting=!0,sl(i)?mT(`${o}//${i}${c}`):aS()}function Bf(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function iS(e){const t=Bf(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:iu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:iu(i)}}}function iu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function aS(){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())}/**
|
|
833
|
-
* @license
|
|
834
|
-
* Copyright 2020 Google LLC
|
|
835
|
-
*
|
|
836
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
837
|
-
* you may not use this file except in compliance with the License.
|
|
838
|
-
* You may obtain a copy of the License at
|
|
839
|
-
*
|
|
840
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
841
|
-
*
|
|
842
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
843
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
844
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
845
|
-
* See the License for the specific language governing permissions and
|
|
846
|
-
* limitations under the License.
|
|
847
|
-
*/class Ff{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Hn("not implemented")}_getIdTokenResponse(t){return Hn("not implemented")}_linkToIdToken(t,n){return Hn("not implemented")}_getReauthenticationResolver(t){return Hn("not implemented")}}/**
|
|
848
|
-
* @license
|
|
849
|
-
* Copyright 2020 Google LLC
|
|
850
|
-
*
|
|
851
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
852
|
-
* you may not use this file except in compliance with the License.
|
|
853
|
-
* You may obtain a copy of the License at
|
|
854
|
-
*
|
|
855
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
856
|
-
*
|
|
857
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
858
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
859
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
860
|
-
* See the License for the specific language governing permissions and
|
|
861
|
-
* limitations under the License.
|
|
862
|
-
*/async function ls(e,t){return DI(e,"POST","/v1/accounts:signInWithIdp",cl(e,t))}/**
|
|
863
|
-
* @license
|
|
864
|
-
* Copyright 2020 Google LLC
|
|
865
|
-
*
|
|
866
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
867
|
-
* you may not use this file except in compliance with the License.
|
|
868
|
-
* You may obtain a copy of the License at
|
|
869
|
-
*
|
|
870
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
871
|
-
*
|
|
872
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
873
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
874
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
875
|
-
* See the License for the specific language governing permissions and
|
|
876
|
-
* limitations under the License.
|
|
877
|
-
*/const lS="http://localhost";class Ur extends Ff{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Ur(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):Pn("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 Ur(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:lS,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=ro(n)}return t}}/**
|
|
878
|
-
* @license
|
|
879
|
-
* Copyright 2020 Google LLC
|
|
880
|
-
*
|
|
881
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
882
|
-
* you may not use this file except in compliance with the License.
|
|
883
|
-
* You may obtain a copy of the License at
|
|
884
|
-
*
|
|
885
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
886
|
-
*
|
|
887
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
888
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
889
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
890
|
-
* See the License for the specific language governing permissions and
|
|
891
|
-
* limitations under the License.
|
|
892
|
-
*/class hl{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}}/**
|
|
893
|
-
* @license
|
|
894
|
-
* Copyright 2019 Google LLC
|
|
895
|
-
*
|
|
896
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
897
|
-
* you may not use this file except in compliance with the License.
|
|
898
|
-
* You may obtain a copy of the License at
|
|
899
|
-
*
|
|
900
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
901
|
-
*
|
|
902
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
903
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
904
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
905
|
-
* See the License for the specific language governing permissions and
|
|
906
|
-
* limitations under the License.
|
|
907
|
-
*/class io extends hl{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
|
|
908
|
-
* @license
|
|
909
|
-
* Copyright 2020 Google LLC
|
|
910
|
-
*
|
|
911
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
912
|
-
* you may not use this file except in compliance with the License.
|
|
913
|
-
* You may obtain a copy of the License at
|
|
914
|
-
*
|
|
915
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
916
|
-
*
|
|
917
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
918
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
919
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
920
|
-
* See the License for the specific language governing permissions and
|
|
921
|
-
* limitations under the License.
|
|
922
|
-
*/class pr extends io{constructor(){super("facebook.com")}static credential(t){return Ur._fromParams({providerId:pr.PROVIDER_ID,signInMethod:pr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return pr.credentialFromTaggedObject(t)}static credentialFromError(t){return pr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return pr.credential(t.oauthAccessToken)}catch{return null}}}pr.FACEBOOK_SIGN_IN_METHOD="facebook.com";pr.PROVIDER_ID="facebook.com";/**
|
|
923
|
-
* @license
|
|
924
|
-
* Copyright 2020 Google LLC
|
|
925
|
-
*
|
|
926
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
927
|
-
* you may not use this file except in compliance with the License.
|
|
928
|
-
* You may obtain a copy of the License at
|
|
929
|
-
*
|
|
930
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
931
|
-
*
|
|
932
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
933
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
934
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
935
|
-
* See the License for the specific language governing permissions and
|
|
936
|
-
* limitations under the License.
|
|
937
|
-
*/class mr extends io{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Ur._fromParams({providerId:mr.PROVIDER_ID,signInMethod:mr.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return mr.credentialFromTaggedObject(t)}static credentialFromError(t){return mr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return mr.credential(n,r)}catch{return null}}}mr.GOOGLE_SIGN_IN_METHOD="google.com";mr.PROVIDER_ID="google.com";/**
|
|
938
|
-
* @license
|
|
939
|
-
* Copyright 2020 Google LLC
|
|
940
|
-
*
|
|
941
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
942
|
-
* you may not use this file except in compliance with the License.
|
|
943
|
-
* You may obtain a copy of the License at
|
|
944
|
-
*
|
|
945
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
946
|
-
*
|
|
947
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
948
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
949
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
950
|
-
* See the License for the specific language governing permissions and
|
|
951
|
-
* limitations under the License.
|
|
952
|
-
*/class En extends io{constructor(){super("github.com")}static credential(t){return Ur._fromParams({providerId:En.PROVIDER_ID,signInMethod:En.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return En.credentialFromTaggedObject(t)}static credentialFromError(t){return En.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return En.credential(t.oauthAccessToken)}catch{return null}}}En.GITHUB_SIGN_IN_METHOD="github.com";En.PROVIDER_ID="github.com";/**
|
|
953
|
-
* @license
|
|
954
|
-
* Copyright 2020 Google LLC
|
|
955
|
-
*
|
|
956
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
957
|
-
* you may not use this file except in compliance with the License.
|
|
958
|
-
* You may obtain a copy of the License at
|
|
959
|
-
*
|
|
960
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
961
|
-
*
|
|
962
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
963
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
964
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
965
|
-
* See the License for the specific language governing permissions and
|
|
966
|
-
* limitations under the License.
|
|
967
|
-
*/class gr extends io{constructor(){super("twitter.com")}static credential(t,n){return Ur._fromParams({providerId:gr.PROVIDER_ID,signInMethod:gr.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return gr.credentialFromTaggedObject(t)}static credentialFromError(t){return gr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return gr.credential(n,r)}catch{return null}}}gr.TWITTER_SIGN_IN_METHOD="twitter.com";gr.PROVIDER_ID="twitter.com";/**
|
|
968
|
-
* @license
|
|
969
|
-
* Copyright 2020 Google LLC
|
|
970
|
-
*
|
|
971
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
972
|
-
* you may not use this file except in compliance with the License.
|
|
973
|
-
* You may obtain a copy of the License at
|
|
974
|
-
*
|
|
975
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
976
|
-
*
|
|
977
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
978
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
979
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
980
|
-
* See the License for the specific language governing permissions and
|
|
981
|
-
* limitations under the License.
|
|
982
|
-
*/class 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 un._fromIdTokenResponse(t,r,s),i=au(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=au(r);return new ps({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function au(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
|
|
983
|
-
* @license
|
|
984
|
-
* Copyright 2020 Google LLC
|
|
985
|
-
*
|
|
986
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
987
|
-
* you may not use this file except in compliance with the License.
|
|
988
|
-
* You may obtain a copy of the License at
|
|
989
|
-
*
|
|
990
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
991
|
-
*
|
|
992
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
993
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
994
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
995
|
-
* See the License for the specific language governing permissions and
|
|
996
|
-
* limitations under the License.
|
|
997
|
-
*/class Fo extends _r{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Fo.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 Fo(t,n,r,s)}}function Uf(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Fo._fromErrorAndOperation(e,o,t,r):o})}async function cS(e,t,n=!1){const r=await Qs(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ps._forOperation(e,"link",r)}/**
|
|
998
|
-
* @license
|
|
999
|
-
* Copyright 2019 Google LLC
|
|
1000
|
-
*
|
|
1001
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1002
|
-
* you may not use this file except in compliance with the License.
|
|
1003
|
-
* You may obtain a copy of the License at
|
|
1004
|
-
*
|
|
1005
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1006
|
-
*
|
|
1007
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1008
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1009
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1010
|
-
* See the License for the specific language governing permissions and
|
|
1011
|
-
* limitations under the License.
|
|
1012
|
-
*/async function uS(e,t,n=!1){const{auth:r}=e;if(Sn(r.app))return Promise.reject(Br(r));const s="reauthenticate";try{const o=await Qs(e,Uf(r,s,t,e),n);Fe(o.idToken,r,"internal-error");const i=ul(o.idToken);Fe(i,r,"internal-error");const{sub:l}=i;return Fe(e.uid===l,r,"user-mismatch"),ps._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Pn(r,"user-mismatch"),o}}/**
|
|
1013
|
-
* @license
|
|
1014
|
-
* Copyright 2020 Google LLC
|
|
1015
|
-
*
|
|
1016
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1017
|
-
* you may not use this file except in compliance with the License.
|
|
1018
|
-
* You may obtain a copy of the License at
|
|
1019
|
-
*
|
|
1020
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1021
|
-
*
|
|
1022
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1023
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1024
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1025
|
-
* See the License for the specific language governing permissions and
|
|
1026
|
-
* limitations under the License.
|
|
1027
|
-
*/async function dS(e,t,n=!1){if(Sn(e.app))return Promise.reject(Br(e));const r="signIn",s=await Uf(e,r,t),o=await ps._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function fS(e,t,n,r){return gs(e).onIdTokenChanged(t,n,r)}function hS(e,t,n){return gs(e).beforeAuthStateChanged(t,n)}const Uo="__sak";/**
|
|
1028
|
-
* @license
|
|
1029
|
-
* Copyright 2019 Google LLC
|
|
1030
|
-
*
|
|
1031
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1032
|
-
* you may not use this file except in compliance with the License.
|
|
1033
|
-
* You may obtain a copy of the License at
|
|
1034
|
-
*
|
|
1035
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1036
|
-
*
|
|
1037
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1038
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1039
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1040
|
-
* See the License for the specific language governing permissions and
|
|
1041
|
-
* limitations under the License.
|
|
1042
|
-
*/class Hf{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Uo,"1"),this.storage.removeItem(Uo),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()}}/**
|
|
1043
|
-
* @license
|
|
1044
|
-
* Copyright 2020 Google LLC
|
|
1045
|
-
*
|
|
1046
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1047
|
-
* you may not use this file except in compliance with the License.
|
|
1048
|
-
* You may obtain a copy of the License at
|
|
1049
|
-
*
|
|
1050
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1051
|
-
*
|
|
1052
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1053
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1054
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1055
|
-
* See the License for the specific language governing permissions and
|
|
1056
|
-
* limitations under the License.
|
|
1057
|
-
*/const pS=1e3,mS=10;class Vf extends Hf{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Lf(),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,l,c)=>{this.notifyListeners(i,c)});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);zI()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,mS):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)})},pS)}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]}}Vf.type="LOCAL";const gS=Vf;/**
|
|
1058
|
-
* @license
|
|
1059
|
-
* Copyright 2020 Google LLC
|
|
1060
|
-
*
|
|
1061
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1062
|
-
* you may not use this file except in compliance with the License.
|
|
1063
|
-
* You may obtain a copy of the License at
|
|
1064
|
-
*
|
|
1065
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1066
|
-
*
|
|
1067
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1068
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1069
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1070
|
-
* See the License for the specific language governing permissions and
|
|
1071
|
-
* limitations under the License.
|
|
1072
|
-
*/class Wf extends Hf{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Wf.type="SESSION";const Gf=Wf;/**
|
|
1073
|
-
* @license
|
|
1074
|
-
* Copyright 2019 Google LLC
|
|
1075
|
-
*
|
|
1076
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1077
|
-
* you may not use this file except in compliance with the License.
|
|
1078
|
-
* You may obtain a copy of the License at
|
|
1079
|
-
*
|
|
1080
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1081
|
-
*
|
|
1082
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1083
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1084
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1085
|
-
* See the License for the specific language governing permissions and
|
|
1086
|
-
* limitations under the License.
|
|
1087
|
-
*/function vS(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
|
1088
|
-
* @license
|
|
1089
|
-
* Copyright 2019 Google LLC
|
|
1090
|
-
*
|
|
1091
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1092
|
-
* you may not use this file except in compliance with the License.
|
|
1093
|
-
* You may obtain a copy of the License at
|
|
1094
|
-
*
|
|
1095
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1096
|
-
*
|
|
1097
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1098
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1099
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1100
|
-
* See the License for the specific language governing permissions and
|
|
1101
|
-
* limitations under the License.
|
|
1102
|
-
*/class ai{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 ai(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 l=Array.from(i).map(async u=>u(n.origin,o)),c=await vS(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_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)}}ai.receivers=[];/**
|
|
1103
|
-
* @license
|
|
1104
|
-
* Copyright 2020 Google LLC
|
|
1105
|
-
*
|
|
1106
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1107
|
-
* you may not use this file except in compliance with the License.
|
|
1108
|
-
* You may obtain a copy of the License at
|
|
1109
|
-
*
|
|
1110
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1111
|
-
*
|
|
1112
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1113
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1114
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1115
|
-
* See the License for the specific language governing permissions and
|
|
1116
|
-
* limitations under the License.
|
|
1117
|
-
*/function pl(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
|
|
1118
|
-
* @license
|
|
1119
|
-
* Copyright 2019 Google LLC
|
|
1120
|
-
*
|
|
1121
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1122
|
-
* you may not use this file except in compliance with the License.
|
|
1123
|
-
* You may obtain a copy of the License at
|
|
1124
|
-
*
|
|
1125
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1126
|
-
*
|
|
1127
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1128
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1129
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1130
|
-
* See the License for the specific language governing permissions and
|
|
1131
|
-
* limitations under the License.
|
|
1132
|
-
*/class yS{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((l,c)=>{const u=pl("",20);s.port1.start();const d=setTimeout(()=>{c(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(h){const g=h;if(g.data.eventId===u)switch(g.data.status){case"ack":clearTimeout(d),o=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),l(g.data.response);break;default:clearTimeout(d),clearTimeout(o),c(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:u,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
|
|
1133
|
-
* @license
|
|
1134
|
-
* Copyright 2020 Google LLC
|
|
1135
|
-
*
|
|
1136
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1137
|
-
* you may not use this file except in compliance with the License.
|
|
1138
|
-
* You may obtain a copy of the License at
|
|
1139
|
-
*
|
|
1140
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1141
|
-
*
|
|
1142
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1143
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1144
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1145
|
-
* See the License for the specific language governing permissions and
|
|
1146
|
-
* limitations under the License.
|
|
1147
|
-
*/function Rn(){return window}function wS(e){Rn().location.href=e}/**
|
|
1148
|
-
* @license
|
|
1149
|
-
* Copyright 2020 Google LLC.
|
|
1150
|
-
*
|
|
1151
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1152
|
-
* you may not use this file except in compliance with the License.
|
|
1153
|
-
* You may obtain a copy of the License at
|
|
1154
|
-
*
|
|
1155
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1156
|
-
*
|
|
1157
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1158
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1159
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1160
|
-
* See the License for the specific language governing permissions and
|
|
1161
|
-
* limitations under the License.
|
|
1162
|
-
*/function qf(){return typeof Rn().WorkerGlobalScope<"u"&&typeof Rn().importScripts=="function"}async function bS(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function _S(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function kS(){return qf()?self:null}/**
|
|
1163
|
-
* @license
|
|
1164
|
-
* Copyright 2019 Google LLC
|
|
1165
|
-
*
|
|
1166
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1167
|
-
* you may not use this file except in compliance with the License.
|
|
1168
|
-
* You may obtain a copy of the License at
|
|
1169
|
-
*
|
|
1170
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1171
|
-
*
|
|
1172
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1173
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1174
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1175
|
-
* See the License for the specific language governing permissions and
|
|
1176
|
-
* limitations under the License.
|
|
1177
|
-
*/const zf="firebaseLocalStorageDb",TS=1,Ho="firebaseLocalStorage",Kf="fbase_key";class ao{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 li(e,t){return e.transaction([Ho],t?"readwrite":"readonly").objectStore(Ho)}function IS(){const e=indexedDB.deleteDatabase(zf);return new ao(e).toPromise()}function Ca(){const e=indexedDB.open(zf,TS);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(Ho,{keyPath:Kf})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(Ho)?t(r):(r.close(),await IS(),t(await Ca()))})})}async function lu(e,t,n){const r=li(e,!0).put({[Kf]:t,value:n});return new ao(r).toPromise()}async function SS(e,t){const n=li(e,!1).get(t),r=await new ao(n).toPromise();return r===void 0?null:r.value}function cu(e,t){const n=li(e,!0).delete(t);return new ao(n).toPromise()}const ES=800,CS=3;class Jf{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 Ca(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>CS)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return qf()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ai._getInstance(kS()),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 bS(),!this.activeServiceWorker)return;this.sender=new yS(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||_S()!==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 Ca();return await lu(t,Uo,"1"),await cu(t,Uo),!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=>lu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>SS(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>cu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=li(s,!1).getAll();return new ao(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(),ES)}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()}}Jf.type="LOCAL";const AS=Jf;new oo(3e4,6e4);/**
|
|
1178
|
-
* @license
|
|
1179
|
-
* Copyright 2021 Google LLC
|
|
1180
|
-
*
|
|
1181
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1182
|
-
* you may not use this file except in compliance with the License.
|
|
1183
|
-
* You may obtain a copy of the License at
|
|
1184
|
-
*
|
|
1185
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1186
|
-
*
|
|
1187
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1188
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1189
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1190
|
-
* See the License for the specific language governing permissions and
|
|
1191
|
-
* limitations under the License.
|
|
1192
|
-
*/function Yf(e,t){return t?Vn(t):(Fe(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
|
|
1193
|
-
* @license
|
|
1194
|
-
* Copyright 2019 Google LLC
|
|
1195
|
-
*
|
|
1196
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1197
|
-
* you may not use this file except in compliance with the License.
|
|
1198
|
-
* You may obtain a copy of the License at
|
|
1199
|
-
*
|
|
1200
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1201
|
-
*
|
|
1202
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1203
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1204
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1205
|
-
* See the License for the specific language governing permissions and
|
|
1206
|
-
* limitations under the License.
|
|
1207
|
-
*/class ml extends Ff{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 RS(e){return dS(e.auth,new ml(e),e.bypassAuthState)}function PS(e){const{auth:t,user:n}=e;return Fe(n,t,"internal-error"),uS(n,new ml(e),e.bypassAuthState)}async function xS(e){const{auth:t,user:n}=e;return Fe(n,t,"internal-error"),cS(n,new ml(e),e.bypassAuthState)}/**
|
|
1208
|
-
* @license
|
|
1209
|
-
* Copyright 2020 Google LLC
|
|
1210
|
-
*
|
|
1211
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1212
|
-
* you may not use this file except in compliance with the License.
|
|
1213
|
-
* You may obtain a copy of the License at
|
|
1214
|
-
*
|
|
1215
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1216
|
-
*
|
|
1217
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1218
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1219
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1220
|
-
* See the License for the specific language governing permissions and
|
|
1221
|
-
* limitations under the License.
|
|
1222
|
-
*/class Xf{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:l}=t;if(i){this.reject(i);return}const c={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(l)(c))}catch(u){this.reject(u)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return RS;case"linkViaPopup":case"linkViaRedirect":return xS;case"reauthViaPopup":case"reauthViaRedirect":return PS;default:Pn(this.auth,"internal-error")}}resolve(t){Xn(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Xn(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()}}/**
|
|
1223
|
-
* @license
|
|
1224
|
-
* Copyright 2020 Google LLC
|
|
1225
|
-
*
|
|
1226
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1227
|
-
* you may not use this file except in compliance with the License.
|
|
1228
|
-
* You may obtain a copy of the License at
|
|
1229
|
-
*
|
|
1230
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1231
|
-
*
|
|
1232
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1233
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1234
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1235
|
-
* See the License for the specific language governing permissions and
|
|
1236
|
-
* limitations under the License.
|
|
1237
|
-
*/const MS=new oo(2e3,1e4);async function OS(e,t,n){if(Sn(e.app))return Promise.reject(hn(e,"operation-not-supported-in-this-environment"));const r=ii(e);RI(e,t,hl);const s=Yf(r,n);return new Dr(r,"signInViaPopup",t,s).executeNotNull()}class Dr extends Xf{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Dr.currentPopupAction&&Dr.currentPopupAction.cancel(),Dr.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Fe(t,this.auth,"internal-error"),t}async onExecution(){Xn(this.filter.length===1,"Popup operations only handle one event");const t=pl();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(hn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(hn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Dr.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(hn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,MS.get())};t()}}Dr.currentPopupAction=null;/**
|
|
1238
|
-
* @license
|
|
1239
|
-
* Copyright 2020 Google LLC
|
|
1240
|
-
*
|
|
1241
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1242
|
-
* you may not use this file except in compliance with the License.
|
|
1243
|
-
* You may obtain a copy of the License at
|
|
1244
|
-
*
|
|
1245
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1246
|
-
*
|
|
1247
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1248
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1249
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1250
|
-
* See the License for the specific language governing permissions and
|
|
1251
|
-
* limitations under the License.
|
|
1252
|
-
*/const NS="pendingRedirect",Eo=new Map;class $S extends Xf{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=Eo.get(this.auth._key());if(!t){try{const r=await DS(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}Eo.set(this.auth._key(),t)}return this.bypassAuthState||Eo.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 DS(e,t){const n=BS(t),r=jS(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function LS(e,t){Eo.set(e._key(),t)}function jS(e){return Vn(e._redirectPersistence)}function BS(e){return So(NS,e.config.apiKey,e.name)}async function FS(e,t,n=!1){if(Sn(e.app))return Promise.reject(Br(e));const r=ii(e),s=Yf(r,t),i=await new $S(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
|
|
1253
|
-
* @license
|
|
1254
|
-
* Copyright 2020 Google LLC
|
|
1255
|
-
*
|
|
1256
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1257
|
-
* you may not use this file except in compliance with the License.
|
|
1258
|
-
* You may obtain a copy of the License at
|
|
1259
|
-
*
|
|
1260
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1261
|
-
*
|
|
1262
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1263
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1264
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1265
|
-
* See the License for the specific language governing permissions and
|
|
1266
|
-
* limitations under the License.
|
|
1267
|
-
*/const US=600*1e3;class HS{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||!VS(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Qf(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(hn(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>=US&&this.cachedEventUids.clear(),this.cachedEventUids.has(uu(t))}saveEventToCache(t){this.cachedEventUids.add(uu(t)),this.lastProcessedEventTime=Date.now()}}function uu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Qf({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function VS(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Qf(e);default:return!1}}/**
|
|
1268
|
-
* @license
|
|
1269
|
-
* Copyright 2020 Google LLC
|
|
1270
|
-
*
|
|
1271
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1272
|
-
* you may not use this file except in compliance with the License.
|
|
1273
|
-
* You may obtain a copy of the License at
|
|
1274
|
-
*
|
|
1275
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1276
|
-
*
|
|
1277
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1278
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1279
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1280
|
-
* See the License for the specific language governing permissions and
|
|
1281
|
-
* limitations under the License.
|
|
1282
|
-
*/async function WS(e,t={}){return vs(e,"GET","/v1/projects",t)}/**
|
|
1283
|
-
* @license
|
|
1284
|
-
* Copyright 2020 Google LLC
|
|
1285
|
-
*
|
|
1286
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1287
|
-
* you may not use this file except in compliance with the License.
|
|
1288
|
-
* You may obtain a copy of the License at
|
|
1289
|
-
*
|
|
1290
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1291
|
-
*
|
|
1292
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1293
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1294
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1295
|
-
* See the License for the specific language governing permissions and
|
|
1296
|
-
* limitations under the License.
|
|
1297
|
-
*/const GS=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,qS=/^https?/;async function zS(e){if(e.config.emulator)return;const{authorizedDomains:t}=await WS(e);for(const n of t)try{if(KS(n))return}catch{}Pn(e,"unauthorized-domain")}function KS(e){const t=Sa(),{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(!qS.test(n))return!1;if(GS.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
1298
|
-
* @license
|
|
1299
|
-
* Copyright 2020 Google LLC.
|
|
1300
|
-
*
|
|
1301
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1302
|
-
* you may not use this file except in compliance with the License.
|
|
1303
|
-
* You may obtain a copy of the License at
|
|
1304
|
-
*
|
|
1305
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1306
|
-
*
|
|
1307
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1308
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1309
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1310
|
-
* See the License for the specific language governing permissions and
|
|
1311
|
-
* limitations under the License.
|
|
1312
|
-
*/const JS=new oo(3e4,6e4);function du(){const e=Rn().___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 YS(e){return new Promise((t,n)=>{var s,o,i;function r(){du(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{du(),n(hn(e,"network-request-failed"))},timeout:JS.get()})}if((o=(s=Rn().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Rn().gapi)!=null&&i.load)r();else{const l=nS("iframefcb");return Rn()[l]=()=>{gapi.load?r():n(hn(e,"network-request-failed"))},eS(`${tS()}?onload=${l}`).catch(c=>n(c))}}).catch(t=>{throw Co=null,t})}let Co=null;function XS(e){return Co=Co||YS(e),Co}/**
|
|
1313
|
-
* @license
|
|
1314
|
-
* Copyright 2020 Google LLC.
|
|
1315
|
-
*
|
|
1316
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1317
|
-
* you may not use this file except in compliance with the License.
|
|
1318
|
-
* You may obtain a copy of the License at
|
|
1319
|
-
*
|
|
1320
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1321
|
-
*
|
|
1322
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1323
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1324
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1325
|
-
* See the License for the specific language governing permissions and
|
|
1326
|
-
* limitations under the License.
|
|
1327
|
-
*/const QS=new oo(5e3,15e3),ZS="__/auth/iframe",eE="emulator/auth/iframe",tE={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},nE=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function rE(e){const t=e.config;Fe(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?ll(t,eE):`https://${e.config.authDomain}/${ZS}`,r={apiKey:t.apiKey,appName:e.name,v:so},s=nE.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${ro(r).slice(1)}`}async function sE(e){const t=await XS(e),n=Rn().gapi;return Fe(n,e,"internal-error"),t.open({where:document.body,url:rE(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:tE,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=hn(e,"network-request-failed"),l=Rn().setTimeout(()=>{o(i)},QS.get());function c(){Rn().clearTimeout(l),s(r)}r.ping(c).then(c,()=>{o(i)})}))}/**
|
|
1328
|
-
* @license
|
|
1329
|
-
* Copyright 2020 Google LLC.
|
|
1330
|
-
*
|
|
1331
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1332
|
-
* you may not use this file except in compliance with the License.
|
|
1333
|
-
* You may obtain a copy of the License at
|
|
1334
|
-
*
|
|
1335
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1336
|
-
*
|
|
1337
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1338
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1339
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1340
|
-
* See the License for the specific language governing permissions and
|
|
1341
|
-
* limitations under the License.
|
|
1342
|
-
*/const oE={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},iE=500,aE=600,lE="_blank",cE="http://localhost";class fu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function uE(e,t,n,r=iE,s=aE){const o=Math.max((window.screen.availHeight-s)/2,0).toString(),i=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const c={...oE,width:r.toString(),height:s.toString(),top:o,left:i},u=Yt().toLowerCase();n&&(l=Mf(u)?lE:n),Pf(u)&&(t=t||cE,c.scrollbars="yes");const d=Object.entries(c).reduce((g,[k,j])=>`${g}${k}=${j},`,"");if(qI(u)&&l!=="_self")return dE(t||"",l),new fu(null);const h=window.open(t||"",l,d);Fe(h,e,"popup-blocked");try{h.focus()}catch{}return new fu(h)}function dE(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)}/**
|
|
1343
|
-
* @license
|
|
1344
|
-
* Copyright 2021 Google LLC
|
|
1345
|
-
*
|
|
1346
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1347
|
-
* you may not use this file except in compliance with the License.
|
|
1348
|
-
* You may obtain a copy of the License at
|
|
1349
|
-
*
|
|
1350
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1351
|
-
*
|
|
1352
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1353
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1354
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1355
|
-
* See the License for the specific language governing permissions and
|
|
1356
|
-
* limitations under the License.
|
|
1357
|
-
*/const fE="__/auth/handler",hE="emulator/auth/handler",pE=encodeURIComponent("fac");async function hu(e,t,n,r,s,o){Fe(e.config.authDomain,e,"auth-domain-config-required"),Fe(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:so,eventId:s};if(t instanceof hl){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",dT(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[d,h]of Object.entries({}))i[d]=h}if(t instanceof io){const d=t.getScopes().filter(h=>h!=="");d.length>0&&(i.scopes=d.join(","))}e.tenantId&&(i.tid=e.tenantId);const l=i;for(const d of Object.keys(l))l[d]===void 0&&delete l[d];const c=await e._getAppCheckToken(),u=c?`#${pE}=${encodeURIComponent(c)}`:"";return`${mE(e)}?${ro(l).slice(1)}${u}`}function mE({config:e}){return e.emulator?ll(e,hE):`https://${e.authDomain}/${fE}`}/**
|
|
1358
|
-
* @license
|
|
1359
|
-
* Copyright 2020 Google LLC
|
|
1360
|
-
*
|
|
1361
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1362
|
-
* you may not use this file except in compliance with the License.
|
|
1363
|
-
* You may obtain a copy of the License at
|
|
1364
|
-
*
|
|
1365
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1366
|
-
*
|
|
1367
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1368
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1369
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1370
|
-
* See the License for the specific language governing permissions and
|
|
1371
|
-
* limitations under the License.
|
|
1372
|
-
*/const qi="webStorageSupport";class gE{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Gf,this._completeRedirectFn=FS,this._overrideRedirectResult=LS}async _openPopup(t,n,r,s){var i;Xn((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await hu(t,n,r,Sa(),s);return uE(t,o,pl())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await hu(t,n,r,Sa(),s);return wS(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):(Xn(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 sE(t),r=new HS(t);return n.register("authEvent",s=>(Fe(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(qi,{type:qi},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[qi];o!==void 0&&n(!!o),Pn(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=zS(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Lf()||xf()||dl()}}const vE=gE;var pu="@firebase/auth",mu="1.12.2";/**
|
|
1373
|
-
* @license
|
|
1374
|
-
* Copyright 2020 Google LLC
|
|
1375
|
-
*
|
|
1376
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1377
|
-
* you may not use this file except in compliance with the License.
|
|
1378
|
-
* You may obtain a copy of the License at
|
|
1379
|
-
*
|
|
1380
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1381
|
-
*
|
|
1382
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1383
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1384
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1385
|
-
* See the License for the specific language governing permissions and
|
|
1386
|
-
* limitations under the License.
|
|
1387
|
-
*/class yE{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(){Fe(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1388
|
-
* @license
|
|
1389
|
-
* Copyright 2020 Google LLC
|
|
1390
|
-
*
|
|
1391
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1392
|
-
* you may not use this file except in compliance with the License.
|
|
1393
|
-
* You may obtain a copy of the License at
|
|
1394
|
-
*
|
|
1395
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1396
|
-
*
|
|
1397
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1398
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1399
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1400
|
-
* See the License for the specific language governing permissions and
|
|
1401
|
-
* limitations under the License.
|
|
1402
|
-
*/function wE(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 bE(e){Ys(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:l}=r.options;Fe(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:i,authDomain:l,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:jf(e)},u=new QI(r,s,o,c);return sS(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),Ys(new hs("auth-internal",t=>{const n=ii(t.getProvider("auth").getImmediate());return(r=>new yE(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),os(pu,mu,wE(e)),os(pu,mu,"esm2020")}/**
|
|
1403
|
-
* @license
|
|
1404
|
-
* Copyright 2021 Google LLC
|
|
1405
|
-
*
|
|
1406
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1407
|
-
* you may not use this file except in compliance with the License.
|
|
1408
|
-
* You may obtain a copy of the License at
|
|
1409
|
-
*
|
|
1410
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1411
|
-
*
|
|
1412
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1413
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1414
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1415
|
-
* See the License for the specific language governing permissions and
|
|
1416
|
-
* limitations under the License.
|
|
1417
|
-
*/const _E=300,kE=pf("authIdTokenMaxAge")||_E;let gu=null;const TE=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>kE)return;const s=n==null?void 0:n.token;gu!==s&&(gu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function IE(e=bf()){const t=yf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=rS(e,{popupRedirectResolver:vE,persistence:[AS,gS,Gf]}),r=pf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=TE(o.toString());hS(n,i,()=>i(n.currentUser)),fS(n,l=>i(l))}}const s=Z0("auth");return s&&oS(n,`http://${s}`),n}function SE(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}ZI({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=hn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",SE().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="});bE("Browser");const EE={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 CE(e){const t=$(null),n=$(""),r=$(""),s=$(""),o=$({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=ie(()=>s.value==="pull"),l=ie(()=>s.value==="push"),c=ie(()=>s.value!=="");async function u(){try{const A=await fetch("/codex-api/skills-sync/status");if(!A.ok)return;const B=await A.json();B.data&&(o.value=B.data)}catch{}}async function d(){try{const A=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),B=await A.json();if(!A.ok||!B.data)throw new Error("Failed to start GitHub login");t.value=B.data;const Z=30,V=Math.max((B.data.interval??5)*1e3,3e3);let X=!1;for(let z=0;z<Z;z++){await new Promise(me=>setTimeout(me,V));const ae=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:B.data.device_code})}),ue=await ae.json();if(!ae.ok)throw new Error(ue.error||"Failed to complete GitHub login");if(ue.ok){X=!0;break}if(!ue.pending)throw new Error(ue.error||"Failed to complete GitHub login")}if(!X)throw new Error("GitHub login timed out. Please retry.");t.value=null,await u(),e.showToast("GitHub login successful")}catch(A){e.showToast(A instanceof Error?A.message:"Failed GitHub login","error")}}async function h(){try{const A=pI().length>0?bf():wf(EE),B=IE(A),Z=new En;Z.addScope("repo");const V=await OS(B,Z),X=En.credentialFromResult(V),z=(X==null?void 0:X.accessToken)??"";if(!z)throw new Error("GitHub access token missing from Firebase login");const ae=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:z})}),ue=await ae.json();if(!ae.ok||!ue.ok)throw new Error(ue.error||"Failed to login with GitHub token");await u(),e.showToast("GitHub login successful")}catch(A){const B=A instanceof Error?A.message:"Failed Firebase GitHub login";e.showToast(B,"error")}}async function g(){r.value="",n.value="pull-started",s.value="pull";try{const A=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),B=await A.json();if(!A.ok||!B.ok)throw new Error(B.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(A){const B=A instanceof Error?A.message:"Failed to pull sync";r.value=B,n.value="pull-failed",e.showToast(B,"error")}finally{s.value=""}}async function k(){r.value="",n.value="push-started",s.value="push";try{const A=await fetch("/codex-api/skills-sync/push",{method:"POST"}),B=await A.json();if(!A.ok||!B.ok)throw new Error(B.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(A){const B=A instanceof Error?A.message:"Failed to push sync";r.value=B,n.value="push-failed",e.showToast(B,"error")}finally{s.value=""}}async function j(){try{const A=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),B=await A.json();if(!A.ok||!B.ok)throw new Error(B.error||"Failed to logout GitHub");await u(),e.showToast("Logged out from GitHub")}catch(A){e.showToast(A instanceof Error?A.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:l,isSyncActionInFlight:c,loadSyncStatus:u,logoutGithub:j,pullSkillsSync:g,pushSkillsSync:k,startGithubFirebaseLogin:h,startGithubLogin:d,syncActionError:r,syncActionStatus:n,syncStatus:o}}const AE={class:"skills-hub"},RE={class:"skills-sync-panel"},PE={class:"skills-sync-header"},xE={key:0,class:"skills-sync-badge"},ME={key:1,class:"skills-sync-badge"},OE={key:2,class:"skills-sync-badge"},NE={class:"skills-sync-meta"},$E={key:0,class:"skills-sync-error"},DE={key:1,class:"skills-sync-meta"},LE={key:2,class:"skills-sync-error"},jE={key:3,class:"skills-sync-device"},BE=["href"],FE={class:"skills-sync-actions"},UE=["disabled"],HE=["disabled"],VE=["disabled"],WE={key:1,class:"skills-hub-section"},GE={class:"skills-hub-section-title"},qE={key:0,class:"skills-hub-grid"},zE={class:"skills-hub-toolbar"},KE={class:"skills-hub-search-wrap"},JE={key:0,class:"skills-hub-count"},YE={class:"skills-hub-section"},XE={key:0,class:"skills-hub-loading"},QE={key:1,class:"skills-hub-error"},ZE={key:0,class:"skills-hub-grid"},eC={key:1,class:"skills-hub-empty"},po="codex-web-local.skills-hub.cache.v1",tC=Rt({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=$(null),s=$(""),o=$("date"),i=$([]),l=$([]),c=$(0),u=$(!1),d=$(""),h=$(!0),g=$(!1),k=$(n),j=$(null),A=$(""),B=$(!1),Z=$(!1);let V=null,X=null;const z=t,ae=ie(()=>o.value==="date"?"Newest":"A-Z"),ue=ie(()=>{var x;return((x=j.value)==null?void 0:x.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),me=ie(()=>`${k.value.owner}/${k.value.name}`),be=ie(()=>B.value&&A.value===me.value),oe=ie(()=>Z.value&&A.value===me.value),ee=ie(()=>{const x=s.value.toLowerCase().trim();return x?l.value.filter(D=>D.name.toLowerCase().includes(x)||D.owner.toLowerCase().includes(x)||(D.displayName??"").toLowerCase().includes(x)):l.value});function te(x,D="success"){j.value={text:x,type:D},X&&clearTimeout(X),X=setTimeout(()=>{j.value=null},3e3)}function Y(){o.value=o.value==="date"?"name":"date",Ie(s.value)}function Ce(x){return`${o.value}::${x.trim().toLowerCase()}`}function _e(x){var D;if(typeof window>"u")return null;try{const F=window.localStorage.getItem(po);return F?((D=JSON.parse(F).byKey)==null?void 0:D[x])??null:null}catch{return null}}function Oe(x,D){if(!(typeof window>"u"))try{const F=window.localStorage.getItem(po),q=(F?JSON.parse(F):{}).byKey??{};q[x]=D,window.localStorage.setItem(po,JSON.stringify({byKey:q}))}catch{}}function Ae(){if(!(typeof window>"u"))try{window.localStorage.removeItem(po)}catch{}}function ye(x){const D=x.installed??[];l.value=D;const F=new Set(D.map(J=>J.name));i.value=x.data.map(J=>{if(J.installed||F.has(J.name)){const q=D.find(we=>we.name===J.name);return{...J,installed:!0,path:(q==null?void 0:q.path)??J.path,enabled:(q==null?void 0:q.enabled)??J.enabled}}return J}).filter(J=>!J.installed),c.value=x.total}async function Ie(x){const D=Ce(x),F=_e(D);F&&ye(F),u.value=!F,d.value="";try{const J=new URLSearchParams;x.trim()&&J.set("q",x.trim()),J.set("limit","100"),J.set("sort",o.value);const q=await fetch(`/codex-api/skills-hub?${J}`);if(!q.ok)throw new Error(`HTTP ${q.status}`);const we=await q.json();ye(we),Oe(D,we)}catch(J){d.value=J instanceof Error?J.message:"Failed to load skills"}finally{u.value=!1}}function ut(){V&&clearTimeout(V),V=setTimeout(()=>Ie(s.value),300)}function Ge(x){k.value=x,g.value=!0}async function He(x){A.value=`${x.owner}/${x.name}`,B.value=!0;try{const F=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(!F.ok)throw new Error(F.error||"Install failed");const J={...x,installed:!0,path:F.path,enabled:!0};l.value=[...l.value,J],i.value=i.value.filter(q=>q.name!==x.name),k.value=J,te(`${x.displayName||x.name} skill installed`),g.value=!1,Ae(),z("skills-changed")}catch(D){te(D instanceof Error?D.message:"Failed to install skill","error")}finally{B.value=!1}}async function qe(x){A.value=`${x.owner}/${x.name}`,Z.value=!0;try{const F=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(!F.ok)throw new Error(F.error||"Uninstall failed");l.value=l.value.filter(J=>J.name!==x.name),x.owner!=="local"&&(i.value=[...i.value,{...x,installed:!1,path:void 0,enabled:void 0}]),te(`${x.displayName||x.name} skill uninstalled`),g.value=!1,Ae(),z("skills-changed")}catch(D){te(D instanceof Error?D.message:"Failed to uninstall skill","error")}finally{Z.value=!1}}async function Qe(x,D){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:D}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),te(`${x.displayName||x.name} skill ${D?"enabled":"disabled"}`),await Ie(s.value)}catch(F){te(F instanceof Error?F.message:"Failed to update skill","error")}}const{deviceLogin:dt,isPullInFlight:Te,isPushInFlight:Ue,isSyncActionInFlight:W,loadSyncStatus:fe,logoutGithub:le,pullSkillsSync:he,pushSkillsSync:Ne,startGithubFirebaseLogin:v,startGithubLogin:y,syncActionError:R,syncActionStatus:G,syncStatus:U}=CE({showToast:te,onPulled:async()=>{await Ie(s.value),z("skills-changed")}});return Zn(()=>{Ie(""),fe()}),(x,D)=>(w(),T("div",AE,[D[11]||(D[11]=m("div",{class:"skills-hub-header"},[m("h2",{class:"skills-hub-title"},"Skills Hub"),m("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),m("div",RE,[m("div",PE,[D[8]||(D[8]=m("strong",null,"Skills Sync (GitHub)",-1)),ge(U).configured?(w(),T("span",xE,"Connected: "+ne(ge(U).repoOwner)+"/"+ne(ge(U).repoName),1)):ge(U).loggedIn?(w(),T("span",ME,"Logged in as "+ne(ge(U).githubUsername),1)):(w(),T("span",OE,"Not connected"))]),m("div",NE,[m("span",null,"Startup: "+ne(ge(U).startup.mode),1),m("span",null,"Branch: "+ne(ge(U).startup.branch),1),m("span",null,"Action: "+ne(ge(U).startup.lastAction),1)]),ge(U).startup.lastError?(w(),T("div",$E,ne(ge(U).startup.lastError),1)):se("",!0),ge(G)?(w(),T("div",DE,[m("span",null,"Manual sync: "+ne(ge(G)),1)])):se("",!0),ge(R)?(w(),T("div",LE,ne(ge(R)),1)):se("",!0),ge(dt)?(w(),T("div",jE,[m("span",null,[D[9]||(D[9]=Gs("Open ",-1)),m("a",{href:ge(dt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,BE),D[10]||(D[10]=Gs(" and enter code:",-1))]),m("code",null,ne(ge(dt).user_code),1)])):se("",!0),m("div",FE,[ge(U).loggedIn?se("",!0):(w(),T("button",{key:0,class:"skills-hub-sort",type:"button",onClick:D[0]||(D[0]=(...F)=>ge(v)&&ge(v)(...F))},"Login with GitHub")),ge(U).loggedIn?se("",!0):(w(),T("button",{key:1,class:"skills-hub-sort",type:"button",onClick:D[1]||(D[1]=(...F)=>ge(y)&&ge(y)(...F))},"Device Login")),ge(U).loggedIn?(w(),T("button",{key:2,class:"skills-hub-sort",type:"button",onClick:D[2]||(D[2]=(...F)=>ge(le)&&ge(le)(...F)),disabled:ge(W)},"Logout GitHub",8,UE)):se("",!0),m("button",{class:"skills-hub-sort",type:"button",onClick:D[3]||(D[3]=(...F)=>ge(he)&&ge(he)(...F)),disabled:ge(W)},ne(ge(Te)?"Pulling...":"Pull"),9,HE),ge(U).loggedIn?(w(),T("button",{key:3,class:"skills-hub-sort",type:"button",onClick:D[4]||(D[4]=(...F)=>ge(Ne)&&ge(Ne)(...F)),disabled:!ge(U).configured||ge(W)},ne(ge(Ue)?"Pushing...":"Push"),9,VE)):se("",!0)])]),j.value?(w(),T("div",{key:0,class:rt(["skills-hub-toast",ue.value])},ne(j.value.text),3)):se("",!0),ee.value.length>0?(w(),T("div",WE,[m("button",{class:"skills-hub-section-toggle",type:"button",onClick:D[5]||(D[5]=F=>h.value=!h.value)},[m("span",GE,"Installed ("+ne(ee.value.length)+")",1),Ee(sf,{class:rt(["skills-hub-section-chevron",{"is-open":h.value}])},null,8,["class"])]),h.value?(w(),T("div",qE,[(w(!0),T(De,null,yt(ee.value,F=>(w(),lt(Vc,{key:F.name,skill:F,onSelect:J=>Ge(J)},null,8,["skill","onSelect"]))),128))])):se("",!0)])):se("",!0),m("div",zE,[m("div",KE,[Ee(wa,{class:"skills-hub-search-icon"}),Kn(m("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":D[6]||(D[6]=F=>s.value=F),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:ut},null,544),[[Jn,s.value]]),c.value>0?(w(),T("span",JE,ne(c.value)+" skills",1)):se("",!0)]),m("button",{class:"skills-hub-sort",type:"button",onClick:Y},ne(ae.value),1)]),m("div",YE,[u.value?(w(),T("div",XE,"Loading skills...")):d.value?(w(),T("div",QE,ne(d.value),1)):(w(),T(De,{key:2},[i.value.length>0?(w(),T("div",ZE,[(w(!0),T(De,null,yt(i.value,F=>(w(),lt(Vc,{key:F.url,skill:F,onSelect:J=>Ge(J)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(w(),T("div",eC,'No skills found for "'+ne(s.value)+'"',1)):se("",!0)],64))]),Ee(W0,{skill:k.value,visible:g.value,"is-installing":be.value,"is-uninstalling":oe.value,onClose:D[7]||(D[7]=F=>g.value=!1),onInstall:He,onUninstall:qe,onToggleEnabled:Qe},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),nC=et(tC,[["__scopeId","data-v-2f6920be"]]),rC={},sC={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 oC(e,t){return w(),T("svg",sC,[...t[0]||(t[0]=[m("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),m("path",{d:"M9 4l0 16"},null,-1)])])}const iC=et(rC,[["render",oC]]),aC={},lC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function cC(e,t){return w(),T("svg",lC,[...t[0]||(t[0]=[m("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 uC=et(aC,[["render",cC]]),dC={class:"sidebar-thread-controls"},fC=["aria-label","title"],hC=Rt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(w(),T("div",dC,[m("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?(w(),lt(uC,{key:0,class:"sidebar-thread-controls-icon"})):(w(),lt(iC,{key:1,class:"sidebar-thread-controls-icon"}))],8,fC),Cn(t.$slots,"default",{},void 0),e.showNewThreadButton?(w(),T("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"))},[Ee(Do,{class:"sidebar-thread-controls-icon"})])):se("",!0)]))}}),vu=et(hC,[["__scopeId","data-v-46a10052"]]),pC={},mC={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function gC(e,t){return w(),T("svg",mC,[...t[0]||(t[0]=[m("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[m("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"}),m("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const vC=et(pC,[["render",gC]]);function hr(e){return e.flatMap(t=>t.threads)}const Zf="codex-web-local.thread-read-state.v1",eh="codex-web-local.thread-scroll-state.v1",Aa="codex-web-local.selected-thread-id.v1",th="codex-web-local.project-order.v1",nh="codex-web-local.project-display-name.v1",zi=220,yu=["none","minimal","low","medium","high","xhigh"],As="__global__",on="gpt-5.2-codex";function yC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Zf);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function wu(e){typeof window>"u"||window.localStorage.setItem(Zf,JSON.stringify(e))}function rh(e,t,n){return Math.min(Math.max(e,t),n)}function wC(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=rh(t.scrollRatio,0,1)),n}function bC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(eh);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=wC(s);o&&(n[r]=o)}return n}catch{return{}}}function bu(e){typeof window>"u"||window.localStorage.setItem(eh,JSON.stringify(e))}function _C(){return typeof window>"u"?"":window.localStorage.getItem(Aa)??""}function kC(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Aa);return}window.localStorage.setItem(Aa,e)}}function TC(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(th);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(th,JSON.stringify(e))}function IC(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(nh);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 Ki(e){typeof window>"u"||window.localStorage.setItem(nh,JSON.stringify(e))}function mo(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 Nr(e,n)?e:n}function Ji(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??{projectName:s,threads:[]});for(const s of e)t.includes(s.projectName)||r.push(s);return r}function Nr(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 SC(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 EC(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function go(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 Ra(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Nr(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&EC(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function Vo(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 CC(e,t,n={}){const r=new Map(e.map(d=>[d.id,d])),s=new Map(t.map(d=>[d.id,d])),o=t.map(d=>{const h=r.get(d.id);return h&&Ra(h,d)?h:d});if(n.preserveMissing!==!0)return Vo(e,o)?e:o;const i=e.map(d=>{const h=s.get(d.id);return!h||Ra(d,h)?d:h}),l=new Set(e.map(d=>d.id)),c=o.filter(d=>!l.has(d.id)),u=[...i,...c];return Vo(e,u)?e:u}function Pa(e){return e.replace(/\s+/gu," ").trim()}function AC(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>Pa(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=Pa(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(Ra(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const sh="worked";function ur(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function RC(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 PC(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function xC(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 MC(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${RC(e.durationMs)}`,messageType:sh}}function OC(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function NC(e,t){const n=MC(t),r=e.filter(i=>i.messageType!==sh),s=OC(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Ot(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function $C(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 DC(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 LC(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 $t(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function vo(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(c=>[c.id,c]))??[]),l=s.threads.map(c=>{const u=i.get(c.id);return u&&$C(u,c)?u:c});return o&&o.projectName===s.projectName&&DC(o.threads,l)?o:{projectName:s.projectName,threads:l}});return LC(e,r)?e:r}function jC(e,t,n){const r=new Set(hr(t).map(l=>l.id)),s=hr(e).filter(l=>n[l.id]===!0&&!r.has(l.id));if(s.length===0)return t;const o=new Map(t.map(l=>[l.projectName,l])),i=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of s){if(o.get(l.projectName)){const u=i.findIndex(d=>d.projectName===l.projectName);u>=0&&(i[u]={projectName:i[u].projectName,threads:[l,...i[u].threads]});continue}i.push({projectName:l.projectName,threads:[l]})}return i}function BC(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Yi(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function FC(e){const t=e.split(`
|
|
1418
|
-
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function UC(){const e=$([]),t=$([]),n=$(_C()),r=$({}),s=$({}),o=$({}),i=$({}),l=$({}),c=$({}),u=$({}),d=$([]),h=$(""),g=$("medium"),k=$(yC()),j=$(bC()),A=$(TC()),B=$(IC()),Z=$({}),V=$({}),X=$({}),z=$({}),ae=$({}),ue=$({}),me=$({}),be=$({}),oe=$({}),ee=$({}),te=$([]),Y=$(!1),Ce=$(!1),_e=$(!1),Oe=$(!1),Ae=$(!1),ye=$(""),Ie=$(!1),ut=$(!1);let Ge=null,He=null,qe=!1;const Qe=new Set;let dt=!1,Te=!1;const Ue=new Map,W=new Set,fe=ie(()=>hr(e.value)),le=ie(()=>fe.value.find(a=>a.id===n.value)??null),he=ie(()=>j.value[n.value]??null),Ne=ie(()=>{const a=[],f=n.value;return f&&Array.isArray(be.value[f])&&a.push(...be.value[f]),Array.isArray(be.value[As])&&a.push(...be.value[As]),a.sort((p,b)=>p.receivedAtIso.localeCompare(b.receivedAtIso))}),v=ie(()=>{var L;const a=n.value;if(!a)return null;const f=ae.value[a],p=(o.value[a]??"").trim(),b=(((L=ue.value[a])==null?void 0:L.message)??"").trim();return!f&&!p&&!b?null:{activityLabel:(f==null?void 0:f.label)||"Thinking",activityDetails:(f==null?void 0:f.details)??[],reasoningText:p,errorText:b}}),y=ie(()=>{const a=n.value;if(!a)return[];const f=r.value[a]??[],p=s.value[a]??[],b=i.value[a]??[],L=[...f,...b,...p],N=z.value[a];return N?NC(L,N):L});function R(a){n.value!==a&&(n.value=a,kC(a),Te=!1)}function G(a){h.value=a.trim()}async function U(){h.value=on,d.value.includes(on)||(d.value=[...d.value,on]);try{await l_(on)}catch{}}function x(a,f){oe.value={...oe.value,[a]:f}}function D(a){oe.value[a]&&(oe.value=Ot(oe.value,a))}async function F(a){if(W.has(a))return;const f=oe.value[a];if(!(!f||f.fallbackRetried)){W.add(a),x(a,{...f,fallbackRetried:!0});try{await U();try{const p=await Lc(a,1);ft(a,p),_t(a,[]),Mt(a),i.value[a]&&(i.value=Ot(i.value,a))}catch{}je(a,null),ye.value="",$e(a,null),Je(a,{label:"Thinking",details:q(on,f.effort)}),Xe(a,!0),X.value[a]!==!0&&await Li(a),await ji(a,f.text,f.imageUrls,on,f.effort||void 0,f.skills.length>0?f.skills:void 0,f.fileAttachments),X.value={...X.value,[a]:!0},Qe.add(a),qe=!0,await On()}catch(p){const b=p instanceof Error?p.message:"Unknown application error";je(a,b),ye.value=b,Xe(a,!1),Je(a,null)}finally{W.delete(a)}}}function J(a){a&&!yu.includes(a)||(g.value=a)}function q(a,f){const p=a.trim()||"default",b=f||"default";return[`Model: ${p}`,`Thinking: ${b}`]}async function we(){try{const[a,f]=await Promise.all([c_(),u_()]);d.value=a,h.value.length>0&&a.includes(h.value)||(f.model&&a.includes(f.model)?h.value=f.model:a.length>0?h.value=a[0]:h.value=""),f.reasoningEffort&&yu.includes(f.reasoningEffort)&&(g.value=f.reasoningEffort)}catch{}}function de(a){const f=ee.value;return Object.keys(f).length===0?a:a.map(p=>({projectName:p.projectName,threads:p.threads.map(b=>{const L=f[b.id];return L?{...b,title:L}:b})}))}function pe(){const f=de(t.value).map(p=>({projectName:p.projectName,threads:p.threads.map(b=>{const L=l.value[b.id]===!0,N=n.value===b.id,ce=k.value[b.id],Pe=u.value[b.id]===!0,ve=!N&&!L&&(Pe||ce!==b.updatedAtIso);return{...b,inProgress:L,unread:ve}})}));e.value=vo(e.value,f)}function ke(a,f,p){const b=new Date().toISOString(),L=f.trim(),N=BC(L),ce={id:a,title:FC(p),projectName:N,cwd:L,hasWorktree:L.includes("/.codex/worktrees/")||L.includes("/.git/worktrees/"),createdAtIso:b,updatedAtIso:b,preview:p,unread:!1,inProgress:!1},Pe=t.value.findIndex(tt=>tt.projectName===N);if(Pe>=0){const bt=t.value[Pe].threads.filter(ir=>ir.id!==a),Kr={projectName:N,threads:[ce,...bt]},Nn=[...t.value];Nn.splice(Pe,1,Kr),t.value=Nn}else t.value=[{projectName:N,threads:[ce]},...t.value];const ve=mo(A.value,t.value);Nr(A.value,ve)||(A.value=ve,Yr(A.value)),pe()}function Me(a){const f=new Set(a.map(N=>N.id)),p=$t(k.value,f);p!==k.value&&(k.value=p,wu(p));const b=$t(j.value,f);b!==j.value&&(j.value=b,bu(b)),V.value=$t(V.value,f),Z.value=$t(Z.value,f),X.value=$t(X.value,f),r.value=$t(r.value,f),s.value=$t(s.value,f),o.value=$t(o.value,f),i.value=$t(i.value,f),z.value=$t(z.value,f),ae.value=$t(ae.value,f),ue.value=$t(ue.value,f),me.value=$t(me.value,f),u.value=$t(u.value,f),l.value=$t(l.value,f);const L={};for(const[N,ce]of Object.entries(be.value))(N===As||f.has(N))&&(L[N]=ce);be.value=L}function Ve(a){const f=hr(t.value).find(p=>p.id===a);f&&(k.value={...k.value,[a]:f.updatedAtIso},wu(k.value),u.value[a]&&(u.value=Ot(u.value,a)),pe())}function $e(a,f){if(!a)return;const p=z.value[a];if(f){if(PC(p,f))return;z.value={...z.value,[a]:f}}else p&&(z.value=Ot(z.value,a))}function Xe(a,f){!a||l.value[a]===!0===f||(f?l.value={...l.value,[a]:!0}:l.value=Ot(l.value,a),pe())}function ot(a){a&&a!==n.value&&u.value[a]!==!0&&(u.value={...u.value,[a]:!0},pe())}function Je(a,f){if(!a)return;const p=ae.value[a];if(!f){p&&(ae.value=Ot(ae.value,a));return}const b=K(f.label)||"Thinking",L=f.details.map(Pe=>K(Pe)).filter(Pe=>Pe.length>0&&Pe!==b),N=Array.from(new Set([...(p==null?void 0:p.details)??[],...L])).slice(-3),ce={label:b,details:N};xC(p,ce)||(ae.value={...ae.value,[a]:ce})}function je(a,f){if(!a)return;const p=ue.value[a],b=f?Pa(f):"";if(!b){p&&(ue.value=Ot(ue.value,a));return}(p==null?void 0:p.message)!==b&&(ue.value={...ue.value,[a]:{message:b}})}function It(a){const f=hr(t.value).find(p=>p.id===a);return(f==null?void 0:f.updatedAtIso)??""}function Ut(a,f){if(!a)return;const p={scrollTop:Math.max(0,f.scrollTop),isAtBottom:f.isAtBottom===!0};typeof f.scrollRatio=="number"&&Number.isFinite(f.scrollRatio)&&(p.scrollRatio=rh(f.scrollRatio,0,1));const b=j.value[a];b&&b.scrollTop===p.scrollTop&&b.isAtBottom===p.isAtBottom&&b.scrollRatio===p.scrollRatio||(j.value={...j.value,[a]:p},bu(j.value))}function ft(a,f){const p=r.value[a]??[];Vo(p,f)||(r.value={...r.value,[a]:f})}function _t(a,f){const p=s.value[a]??[];Vo(p,f)||(s.value={...s.value,[a]:f})}function Ht(a,f){const p=s.value[a]??[],b=_u(p,f);_t(a,b)}function Pt(a,f){if(!a)return;const p=f.trim(),b=o.value[a]??"";if(p.length===0){if(!b)return;o.value=Ot(o.value,a);return}b!==p&&(o.value={...o.value,[a]:p})}function xt(a,f){if(!a)return;const p=o.value[a]??"";Pt(a,`${p}${f}`)}function Mt(a){a&&a in o.value&&(o.value=Ot(o.value,a))}function xe(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)?a:null}function Se(a){return typeof a=="string"?a:""}function Xt(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function St(a){const f=xe(a.params);if(!f)return"";const p=Se(f.threadId);if(p)return p;const b=Se(f.thread_id);if(b)return b;const L=Se(f.conversationId);if(L)return L;const N=Se(f.conversation_id);if(N)return N;const ce=xe(f.thread),Pe=Se(ce==null?void 0:ce.id);if(Pe)return Pe;const ve=xe(f.turn),tt=Se(ve==null?void 0:ve.threadId);if(tt)return tt;const bt=Se(ve==null?void 0:ve.thread_id);return bt||""}function ln(a){if(a.method!=="turn/completed")return"";const f=xe(a.params),p=xe(f==null?void 0:f.turn);if(!p||p.status!=="failed")return"";const b=xe(p.error);return Se(b==null?void 0:b.message)}function tn(a){var p;if(a.method!=="error")return"";const f=xe(a.params);return Se(f==null?void 0:f.message)||Se((p=xe(f==null?void 0:f.error))==null?void 0:p.message)}function cn(a){const f=xe(a);if(!f)return null;const p=f.id,b=Se(f.method),L=f.params;if(typeof p!="number"||!Number.isInteger(p)||!b)return null;const N=xe(L),ce=Se(N==null?void 0:N.threadId)||As,Pe=Se(N==null?void 0:N.turnId),ve=Se(N==null?void 0:N.itemId),tt=Se(f.receivedAtIso)||new Date().toISOString();return{id:p,method:b,threadId:ce,turnId:Pe,itemId:ve,receivedAtIso:tt,params:L??null}}function _(a){const f=a.threadId||As,p=be.value[f]??[],b=p.findIndex(N=>N.id===a.id),L=[...p];b>=0?L.splice(b,1,a):L.push(a),be.value={...be.value,[f]:L.sort((N,ce)=>N.receivedAtIso.localeCompare(ce.receivedAtIso))}}function E(a){const f={};for(const[p,b]of Object.entries(be.value)){const L=b.filter(N=>N.id!==a);L.length>0&&(f[p]=L)}be.value=f}function C(a){if(a.method==="server/request"){const f=cn(a.params);return f&&_(f),!0}if(a.method==="server/request/resolved"){const f=xe(a.params),p=f==null?void 0:f.id;return typeof p=="number"&&Number.isInteger(p)&&E(p),!0}return!1}function K(a){return a.replace(/\s+/gu," ").trim()}function I(a){const f=St(a);if(!f)return null;if(a.method==="turn/started")return{threadId:f,activity:{label:"Thinking",details:[]}};if(a.method==="item/started"){const p=xe(a.params),b=xe(p==null?void 0:p.item),L=Se(b==null?void 0:b.type).toLowerCase();if(L==="reasoning")return{threadId:f,activity:{label:"Thinking",details:[]}};if(L==="agentmessage")return{threadId:f,activity:{label:"Writing response",details:[]}};if(L==="commandexecution"){const N=Se(b==null?void 0:b.command);return{threadId:f,activity:{label:"Running command",details:N?[N]:[]}}}}return a.method==="item/commandExecution/outputDelta"?{threadId:f,activity:{label:"Running command",details:[]}}:a.method==="item/reasoning/summaryTextDelta"||a.method==="item/reasoning/summaryPartAdded"?{threadId:f,activity:{label:"Thinking",details:[]}}:a.method==="item/agentMessage/delta"?{threadId:f,activity:{label:"Writing response",details:[]}}:null}function P(a){if(a.method!=="turn/started")return null;const f=xe(a.params);if(!f)return null;const p=St(a);if(!p)return null;const b=xe(f.turn),L=Se(b==null?void 0:b.id)||Se(f.turnId)||`${p}:unknown`;if(!L)return null;const N=ur(Se(b==null?void 0:b.startedAt))??ur(Se(f.startedAt))??ur(a.atIso)??Date.now();return{threadId:p,turnId:L,startedAtMs:N}}function H(a){if(a.method!=="turn/completed")return null;const f=xe(a.params);if(!f)return null;const p=St(a);if(!p)return null;const b=xe(f.turn),L=Se(b==null?void 0:b.id)||Se(f.turnId)||`${p}:unknown`;if(!L)return null;const N=ur(Se(b==null?void 0:b.completedAt))??ur(Se(f.completedAt))??ur(a.atIso)??Date.now(),ce=ur(Se(b==null?void 0:b.startedAt))??ur(Se(f.startedAt))??void 0;return{threadId:p,turnId:L,completedAtMs:N,startedAtMs:ce}}function re(a){return`${a}:live-reasoning`}function Re(a){const f=xe(a.params);if(!f)return"";if(a.method==="item/started"){const p=xe(f.item);return!p||p.type!=="reasoning"?"":Se(p.id)}return""}function Ye(a){const f=xe(a.params);if(!f)return null;if(a.method==="item/reasoning/summaryTextDelta"){const p=Se(f.itemId),b=Se(f.delta);return!p||!b?null:{messageId:re(p),delta:b}}return null}function ze(a){const f=xe(a.params);if(!f)return"";if(a.method==="item/reasoning/summaryPartAdded"){const p=Se(f.itemId);return p?re(p):""}return""}function Ze(a){const f=xe(a.params);if(!f)return"";if(a.method==="item/completed"){const p=xe(f.item);return!p||p.type!=="reasoning"?"":re(Se(p.id))}return""}function wt(a){const f=xe(a.params);if(!f)return"";if(a.method==="item/started"){const p=xe(f.item);return!p||p.type!=="agentMessage"?"":Se(p.id)}return""}function Vt(a){const f=xe(a.params);if(!f)return null;if(a.method==="item/agentMessage/delta"){const p=Se(f.itemId),b=Se(f.delta);return!p||!b?null:{messageId:p,delta:b}}return null}function tr(a){const f=xe(a.params);if(!f)return null;if(a.method==="item/completed"){const p=xe(f.item);if(!p||p.type!=="agentMessage")return null;const b=Se(p.id),L=Se(p.text);return!b||!L?null:{id:b,role:"assistant",text:L,messageType:"agentMessage.live"}}return null}function ys(a){if(a.method!=="item/started")return null;const f=xe(a.params),p=xe(f==null?void 0:f.item);if(!p||p.type!=="commandExecution")return null;const b=Se(p.id),L=Se(p.command);if(!b)return null;const N=typeof p.cwd=="string"?p.cwd:null;return{id:b,role:"system",text:L,messageType:"commandExecution",commandExecution:{command:L,cwd:N,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Hr(a){if(a.method!=="item/commandExecution/outputDelta")return null;const f=xe(a.params);if(!f)return null;const p=Se(f.itemId),b=Se(f.delta);return!p||!b?null:{itemId:p,delta:b}}function ws(a){if(a.method!=="item/completed")return null;const f=xe(a.params),p=xe(f==null?void 0:f.item);if(!p||p.type!=="commandExecution")return null;const b=Se(p.id),L=Se(p.command);if(!b)return null;const N=typeof p.cwd=="string"?p.cwd:null,ce=Se(p.status),Pe=ce==="failed"?"failed":ce==="declined"?"declined":ce==="interrupted"?"interrupted":"completed",ve=typeof p.aggregatedOutput=="string"?p.aggregatedOutput:"",tt=typeof p.exitCode=="number"?p.exitCode:null;return{id:b,role:"system",text:L,messageType:"commandExecution",commandExecution:{command:L,cwd:N,status:Pe,aggregatedOutput:ve,exitCode:tt}}}function kr(a,f){const p=i.value[a]??[],b=_u(p,f);b!==p&&(i.value={...i.value,[a]:b})}function xn(a,f){const p=i.value[a];if(!p||p.length===0)return;const b=new Set(f.map(N=>N.id)),L=p.filter(N=>!b.has(N.id));L.length!==p.length&&(L.length===0?i.value=Ot(i.value,a):i.value={...i.value,[a]:L})}function Vr(a){if(a.method==="item/agentMessage/delta")return!0;const f=xe(a.params);if(!f)return!1;if(a.method==="item/completed"){const p=xe(f.item);return(p==null?void 0:p.type)==="agentMessage"}return!1}function nr(a){var vl,yl,wl,bl;if(C(a))return;if(a.method==="thread/name/updated"){const Ke=xe(a.params),yn=Se(Ke==null?void 0:Ke.threadId),Sr=Se(Ke==null?void 0:Ke.threadName);yn&&Sr&&(ee.value={...ee.value,[yn]:Sr},pe(),Bi(yn,Sr))}const f=I(a);f&&Je(f.threadId,f.activity);const p=P(a);p&&(Ue.set(p.turnId,p),me.value={...me.value,[p.threadId]:p.turnId},$e(p.threadId,null),je(p.threadId,null),Xe(p.threadId,!0),u.value[p.threadId]&&(u.value=Ot(u.value,p.threadId)));const b=H(a),L=ln(a),ce=!!((b==null?void 0:b.threadId)??St(a))&&!!L&&h.value!==on&&go(new Error(L));if(b){const Ke=Ue.get(b.turnId);Ke&&Ue.delete(b.turnId);const yn=Xt((vl=xe(a.params))==null?void 0:vl.durationMs)??Xt((wl=xe((yl=xe(a.params))==null?void 0:yl.turn))==null?void 0:wl.durationMs)??(typeof b.startedAtMs=="number"?b.completedAtMs-b.startedAtMs:null)??(Ke?b.completedAtMs-Ke.startedAtMs:null),Sr=typeof yn=="number"?Math.max(0,yn):0;$e(b.threadId,{turnId:b.turnId,durationMs:Sr}),me.value[b.threadId]&&(me.value=Ot(me.value,b.threadId)),Xe(b.threadId,!1),Je(b.threadId,null),ot(b.threadId),ce||(D(b.threadId),nn(b.threadId))}if(L){const Ke=(b==null?void 0:b.threadId)||St(a);Ke&&je(Ke,L),ye.value=L,Ke&&ce&&F(Ke)}else b&&je(b.threadId,null);const Pe=tn(a);if(Pe){const Ke=St(a);Ke&&je(Ke,Pe),ye.value=Pe,h.value!==on&&go(new Error(Pe))&&(Ke?F(Ke):U())}const ve=St(a);if(!ve||ve!==n.value)return;wt(a);const tt=Vt(a);if(tt){const Ke=(s.value[ve]??[]).find(Sr=>Sr.id===tt.messageId),yn=`${(Ke==null?void 0:Ke.text)??""}${tt.delta}`;Ht(ve,{id:tt.messageId,role:"assistant",text:yn,messageType:"agentMessage.live"})}const bt=tr(a);bt&&Ht(ve,bt),Re(a);const Kr=Ye(a);if(Kr&&xt(ve,Kr.delta),ze(a)){const Ke=o.value[ve]??"";Ke.trim().length>0&&!Ke.endsWith(`
|
|
1419
|
-
|
|
1420
|
-
`)&&Pt(ve,`${Ke}
|
|
1421
|
-
|
|
1422
|
-
`)}Ze(a);const ir=ys(a);ir&&(kr(ve,ir),Je(ve,{label:"Running command",details:[((bl=ir.commandExecution)==null?void 0:bl.command)??""]}));const vi=Hr(a);if(vi){const Ke=(i.value[ve]??[]).find(yn=>yn.id===vi.itemId);Ke!=null&&Ke.commandExecution&&kr(ve,{...Ke,commandExecution:{...Ke.commandExecution,aggregatedOutput:`${Ke.commandExecution.aggregatedOutput}${vi.delta}`}})}const gl=ws(a);if(gl&&kr(ve,gl),Vr(a)&&(Te&&n.value&&Ut(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Mt(ve)),a.method==="turn/completed"){Te=!1,Mt(ve),i.value[ve]&&(i.value=Ot(i.value,ve));const Ke=St(a);Ke&&(Xe(Ke,!1),Je(Ke,null),ot(Ke),ce||(D(Ke),nn(Ke)))}}function Wr(a){const f=St(a);f&&Qe.add(f);const p=a.method;(p.startsWith("thread/")||p.startsWith("turn/")||p.startsWith("item/"))&&(qe=!0),!(He!==null||typeof window>"u")&&(He=window.setTimeout(()=>{He=null,On()},zi))}async function Gr(a){if(!dt){dt=!0;try{const f=await va(),p=[];for(const b of f.order){const L=Yi(b);p.includes(L)||p.push(L)}if(p.length>0){const b=mo(p,a);Nr(A.value,b)||(A.value=b,Yr(A.value))}if(Object.keys(f.labels).length>0){const b={...B.value};let L=!1;for(const[N,ce]of Object.entries(f.labels)){const Pe=Yi(N);b[Pe]!==ce&&(b[Pe]=ce,L=!0)}L&&(B.value=b,Ki(b))}}catch{}}}async function Tr(){if(!(Object.keys(ee.value).length>0))try{const a=await y_();Object.keys(a.titles).length>0&&(ee.value=a.titles)}catch{}}async function Ir(a,f,p){if(ee.value[a])return;const b=f.trim();if(!b)return;const L=b.length>300?b.slice(0,300):b;try{const N=await w_(L,p);if(!N||ee.value[a])return;ee.value={...ee.value,[a]:N},pe(),Bi(a,N)}catch{}}async function rr(){var a;ut.value||(Y.value=!0);try{const[f]=await Promise.all([Qb(),Tr()]);await Gr(f);const p=mo(A.value,f);Nr(A.value,p)||(A.value=p,Yr(A.value));const b=Ji(f,A.value),L=jC(t.value,b,l.value);t.value=vo(t.value,L),l.value=$t(l.value,new Set(hr(t.value).map(Pe=>Pe.id))),pe(),ut.value=!0;const N=hr(e.value);Me(N),N.some(Pe=>Pe.id===n.value)||R(((a=N[0])==null?void 0:a.id)??"")}finally{Y.value=!1}}async function S(a,f={}){if(!a)return;const p=V.value[a]===!0,b=f.silent!==!0&&!p;b&&(Ce.value=!0);try{X.value[a]!==!0&&(await Li(a),X.value={...X.value,[a]:!0});const{messages:L,inProgress:N}=await Zb(a),ce=r.value[a]??[],Pe=CC(ce,L,{preserveMissing:f.silent===!0});ft(a,Pe);const ve=s.value[a]??[],tt=AC(ve,L);_t(a,tt),xn(a,L),V.value={...V.value,[a]:!0};const bt=It(a);bt&&(Z.value={...Z.value,[a]:bt}),Xe(a,N),Ve(a)}finally{b&&(Ce.value=!1)}}async function M(){try{const a=t.value.flatMap(f=>f.threads.map(p=>p.cwd)).filter(Boolean);te.value=await b_(a.length>0?[...new Set(a)]:void 0)}catch{}}async function O(){ye.value="";try{await rr(),await Promise.all([we(),M()]),await S(n.value)}catch(a){ye.value=a instanceof Error?a.message:"Unknown application error"}}async function Q(a){R(a);try{await S(a)}catch(f){ye.value=f instanceof Error?f.message:"Unknown application error"}}async function Be(a){try{await r_(a),await rr(),n.value===a&&await S(n.value)}catch(f){ye.value=f instanceof Error?f.message:"Unknown application error"}}async function Et(a,f){const p=f.trim();if(!(!a||!p))try{await s_(a,p),ee.value={...ee.value,[a]:p},pe(),Bi(a,p)}catch(b){ye.value=b instanceof Error?b.message:"Unknown application error"}}async function Qt(a,f=[],p=[],b="steer",L=[]){const N=n.value,ce=a.trim();if(!N||!ce&&f.length===0&&L.length===0)return;const Pe=l.value[N]===!0;if(Pe&&b==="queue"){const ve=c.value[N]??[],tt=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;c.value={...c.value,[N]:[...ve,{id:tt,text:ce,imageUrls:f,skills:p,fileAttachments:L}]};return}if(Pe){Te=!0,Mn(N,ce,f,p,L).catch(ve=>{const tt=ve instanceof Error?ve.message:"Unknown application error";je(N,tt),ye.value=tt});return}ye.value="",Te=!0,$e(N,null),Je(N,{label:"Thinking",details:q(h.value,g.value)}),je(N,null),Xe(N,!0);try{await Mn(N,ce,f,p,L)}catch(ve){Te=!1,Xe(N,!1),Je(N,null);const tt=ve instanceof Error?ve.message:"Unknown application error";throw je(N,tt),ye.value=tt,ve}}async function sr(a,f,p=[],b=[],L=[]){const N=a.trim(),ce=f.trim(),Pe=h.value.trim();if(!N&&p.length===0&&L.length===0)return"";_e.value=!0,ye.value="";let ve="";try{try{ve=await jc(ce||void 0,Pe||void 0)}catch(Nn){if(Pe&&Pe!==on&&go(Nn))await U(),ve=await jc(ce||void 0,on);else throw Nn}if(!ve)return"";ke(ve,ce,N||"[Image]"),X.value={...X.value,[ve]:!0},R(ve),Te=!0,$e(ve,null),Je(ve,{label:"Thinking",details:q(h.value,g.value)}),je(ve,null),Xe(ve,!0);const tt=ve,bt=ce||null,Kr=N;return Mn(ve,N,p,b,L).catch(Nn=>{Te=!1,Xe(ve,!1),Je(ve,null);const ir=Nn instanceof Error?Nn.message:"Unknown application error";je(ve,ir),ye.value=ir}).finally(()=>{_e.value=!1}),Ir(tt,Kr,bt),ve}catch(tt){Te=!1,ve&&(Xe(ve,!1),Je(ve,null));const bt=tt instanceof Error?tt.message:"Unknown application error";throw ve&&je(ve,bt),ye.value=bt,_e.value=!1,tt}}async function Mn(a,f,p=[],b=[],L=[]){const N=h.value.trim(),ce=g.value,Pe=f.trim(),ve=b.map(bt=>({name:bt.name,path:bt.path})),tt=L.map(bt=>({...bt}));x(a,{text:Pe,imageUrls:[...p],skills:ve,fileAttachments:tt,effort:ce,fallbackRetried:!1});try{X.value[a]!==!0&&await Li(a);try{await ji(a,f,p,N||void 0,ce||void 0,b.length>0?b:void 0,L)}catch(bt){if(N&&N!==on&&go(bt))await U(),x(a,{text:Pe,imageUrls:[...p],skills:ve,fileAttachments:tt,effort:ce,fallbackRetried:!0}),await ji(a,f,p,on,ce||void 0,b.length>0?b:void 0,L);else throw bt}X.value={...X.value,[a]:!0},Qe.add(a),qe=!0,await On()}catch(bt){throw bt}}async function nn(a){const f=c.value[a];if(!f||f.length===0)return;const[p,...b]=f;c.value=b.length>0?{...c.value,[a]:b}:Ot(c.value,a),_e.value=!0,ye.value="",Te=!0,$e(a,null),Je(a,{label:"Thinking",details:q(h.value,g.value)}),je(a,null),Xe(a,!0);try{await Mn(a,p.text,p.imageUrls,p.skills,p.fileAttachments)}catch{Xe(a,!1),Je(a,null)}finally{_e.value=!1}}async function or(){const a=n.value;if(!a||l.value[a]!==!0)return;const f=me.value[a];Oe.value=!0,ye.value="";try{await a_(a,f),Xe(a,!1),Je(a,null),je(a,null),me.value[a]&&(me.value=Ot(me.value,a)),Qe.add(a),qe=!0,await On()}catch(p){const b=p instanceof Error?p.message:"Failed to interrupt active turn";je(a,b),ye.value=b}finally{Oe.value=!1}}async function qr(a){const f=n.value;if(!f||Ae.value)return;const b=(r.value[f]??[]).reduce((N,ce)=>typeof ce.turnIndex=="number"&&ce.turnIndex>N?ce.turnIndex:N,-1);if(b<0||a>b)return;const L=b-a+1;if(!(L<1)){Ae.value=!0,ye.value="";try{const N=await Lc(f,L);ft(f,N),_t(f,[]),Mt(f),i.value[f]&&(i.value=Ot(i.value,f)),$e(f,null),Je(f,null),je(f,null),qe=!0,await On()}catch(N){ye.value=N instanceof Error?N.message:"Failed to rollback thread"}finally{Ae.value=!1}}}function bs(a,f){a.length===0||(B.value[a]??"")===f||(B.value={...B.value,[a]:f},Ki(B.value))}function ci(a){var L;if(a.length===0)return;const f=A.value.filter(N=>N!==a);if(Nr(A.value,f)||(A.value=f,Yr(A.value)),t.value=t.value.filter(N=>N.projectName!==a),B.value[a]!==void 0){const N={...B.value};delete N[a],B.value=N,Ki(N)}pe();const p=hr(e.value);Me(p),p.some(N=>N.id===n.value)||R(((L=p[0])==null?void 0:L.id)??""),_s()}function ui(a,f){if(a.length===0||t.value.length===0)return;const p=t.value.map(ve=>ve.projectName),b=p.indexOf(a);if(b===-1)return;const L=Math.max(0,Math.min(f,p.length-1)),N=SC(p,b,L);if(N===p)return;const ce=mo(N,t.value);A.value=ce,Yr(A.value);const Pe=Ji(t.value,A.value);t.value=vo(t.value,Pe),pe(),_s()}function di(a){const f=a.trim();if(!f)return;const p=[f,...A.value.filter(L=>L!==f)];if(Nr(A.value,p))return;A.value=p,Yr(A.value);const b=Ji(t.value,A.value);t.value=vo(t.value,b),pe(),_s()}async function _s(){var a,f;try{const p=await va(),b=new Map;for(const ce of p.order){const Pe=Yi(ce);b.has(Pe)||b.set(Pe,ce)}for(const ce of t.value){const Pe=((f=(a=ce.threads[0])==null?void 0:a.cwd)==null?void 0:f.trim())??"";Pe&&b.set(ce.projectName,Pe)}const L=[];for(const ce of A.value){const Pe=b.get(ce);Pe&&!L.includes(Pe)&&L.push(Pe)}for(const ce of p.order)L.includes(ce)||L.push(ce);const N=p.active.filter(ce=>L.includes(ce));N.length===0&&L.length>0&&N.push(L[0]),await h_({order:L,labels:p.labels,active:N})}catch{}}async function On(){if(Ie.value){typeof window<"u"&&He===null&&(He=window.setTimeout(()=>{He=null,On()},zi));return}Ie.value=!0;const a=qe,f=new Set(Qe);qe=!1,Qe.clear();try{a&&await rr();const p=n.value;if(!p)return;const b=f.has(p),L=l.value[p]===!0,N=It(p),ce=Z.value[p]??"",Pe=N.length>0&&N!==ce;(b||L||Pe||a)&&await S(p,{silent:!0})}catch{}finally{Ie.value=!1,(qe||Qe.size>0)&&typeof window<"u"&&He===null&&(He=window.setTimeout(()=>{He=null,On()},zi))}}function zr(){typeof window>"u"||Ge||(fi(),Ge=e_(a=>{nr(a),Wr(a)}))}async function fi(){try{const a=await n_();for(const f of a){const p=cn(f);p&&_(p)}}catch{}}async function hi(a){try{await t_(a.id,{result:a.result,error:a.error}),E(a.id)}catch(f){ye.value=f instanceof Error?f.message:"Failed to reply to server request"}}function pi(){Ge&&(Ge(),Ge=null),qe=!1,Qe.clear(),Ue.clear(),He!==null&&typeof window<"u"&&(window.clearTimeout(He),He=null),Te=!1,r.value={},s.value={},o.value={},i.value={},ae.value={},z.value={},ue.value={},me.value={},c.value={}}const mi=ie(()=>{const a=n.value;return a?c.value[a]??[]:[]});function ks(a){const f=n.value;if(!f)return;const p=c.value[f];if(!p)return;const b=p.filter(L=>L.id!==a);c.value=b.length>0?{...c.value,[f]:b}:Ot(c.value,f)}function gi(a){const f=n.value;if(!f)return;const p=c.value[f];if(!p)return;const b=p.find(L=>L.id===a);b&&(ks(a),Qt(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments))}return{projectGroups:e,projectDisplayNameById:B,selectedThread:le,selectedThreadScrollState:he,selectedThreadServerRequests:Ne,selectedLiveOverlay:v,selectedThreadId:n,availableModelIds:d,selectedModelId:h,selectedReasoningEffort:g,installedSkills:te,messages:y,isLoadingThreads:Y,isLoadingMessages:Ce,isSendingMessage:_e,isInterruptingTurn:Oe,error:ye,refreshAll:O,refreshSkills:M,selectThread:Q,setThreadScrollState:Ut,archiveThreadById:Be,renameThreadById:Et,sendMessageToSelectedThread:Qt,sendMessageToNewThread:sr,interruptSelectedThreadTurn:or,rollbackSelectedThread:qr,isRollingBack:Ae,selectedThreadQueuedMessages:mi,removeQueuedMessage:ks,steerQueuedMessage:gi,setSelectedModelId:G,setSelectedReasoningEffort:J,respondToPendingServerRequest:hi,renameProject:bs,removeProject:ci,reorderProject:ui,pinProjectToTop:di,startPolling:zr,stopPolling:pi}}const HC={class:"sidebar-root"},VC={class:"sidebar-scrollable"},WC=["aria-pressed"],GC={key:1,class:"sidebar-search-bar"},qC={key:0,class:"sidebar-settings-area"},zC={key:0,class:"sidebar-settings-panel"},KC={class:"sidebar-settings-value"},JC={class:"sidebar-settings-value"},YC={class:"sidebar-settings-row sidebar-settings-row--select"},XC=["value"],QC=["value"],ZC={class:"content-root"},eA={class:"content-body"},tA={key:1,class:"content-grid"},nA={class:"new-thread-empty"},rA={class:"worktree-init-status-title"},sA={class:"worktree-init-status-message"},oA={key:2,class:"content-grid"},iA={class:"content-thread"},aA={class:"composer-with-queue"},lA={class:"build-badge","aria-label":"Worktree name and version"},ku="codex-web-local.sidebar-collapsed.v1",Tu="codex-web-local.send-with-enter.v1",Iu="codex-web-local.in-progress-send-mode.v1",Su="codex-web-local.dark-mode.v1",Eu="codex-web-local.dictation-click-to-toggle.v1",Cu="codex-web-local.dictation-auto-send.v1",Au="codex-web-local.dictation-language.v1",cA=Rt({__name:"App",setup(e){const t="d205",n="0.1.42",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:l,selectedLiveOverlay:c,selectedThreadId:u,availableModelIds:d,selectedModelId:h,selectedReasoningEffort:g,installedSkills:k,messages:j,isLoadingThreads:A,isLoadingMessages:B,isInterruptingTurn:Z,refreshAll:V,refreshSkills:X,selectThread:z,setThreadScrollState:ae,archiveThreadById:ue,renameThreadById:me,sendMessageToSelectedThread:be,sendMessageToNewThread:oe,interruptSelectedThreadTurn:ee,rollbackSelectedThread:te,isRollingBack:Y,selectedThreadQueuedMessages:Ce,removeQueuedMessage:_e,steerQueuedMessage:Oe,setSelectedModelId:Ae,setSelectedReasoningEffort:ye,respondToPendingServerRequest:Ie,renameProject:ut,removeProject:Ge,reorderProject:He,pinProjectToTop:qe,startPolling:Qe,stopPolling:dt}=UC(),Te=Ug(),Ue=Fg(),{isMobile:W}=rf(),fe=$(!1),le=$(!1),he=$(""),Ne=$("local"),v=$({order:[],labels:{}}),y=$({phase:"idle",title:"",message:""}),R=$(fi()),G=$(""),U=$(!1),x=$(null),D=$(null);let F=null;const J=$("New Project (1)"),q=$(""),we=$(!1),de=$(sr(Tu,!0)),pe=$(nn()),ke=$(Mn()),Me=$(sr(Eu,!1)),Ve=$(sr(Cu,!0)),$e=$(_s()),Xe=ie(()=>On()),ot=ie(()=>{const a=Te.params.threadId;return typeof a=="string"?a:""}),Je=ie(()=>{const a=new Set;for(const f of r.value)for(const p of f.threads)a.add(p.id);return a}),je=ie(()=>Te.name==="home"),It=ie(()=>Te.name==="skills"),Ut=ie(()=>{var a;return It.value?"Skills":je.value?"New thread":((a=o.value)==null?void 0:a.title)??"Choose a thread"}),ft=ie(()=>j.value.filter(a=>{const f=pi(a.messageType,a.role);return f==="worked"?!0:!(f==="turnActivity.live"||f==="turnError.live"||f==="agentReasoning.live")})),_t=ie(()=>{let a=-1;for(const f of j.value)f.role==="user"&&typeof f.turnIndex=="number"&&f.turnIndex>a&&(a=f.turnIndex);return a}),Ht=ie(()=>c.value),Pt=ie(()=>je.value?"__new-thread__":u.value),xt=ie(()=>{var a,f;return je.value?he.value.trim():((f=(a=o.value)==null?void 0:a.cwd)==null?void 0:f.trim())??""}),Mt=ie(()=>{var a;return!je.value&&((a=o.value)==null?void 0:a.inProgress)===!0}),xe=ie(()=>{var b,L;const a=[],f=new Set;for(const N of v.value.order){const ce=N.trim();!ce||f.has(ce)||(f.add(ce),a.push({value:ce,label:v.value.labels[ce]||Tr(ce)}))}for(const N of r.value){const ce=((L=(b=N.threads[0])==null?void 0:b.cwd)==null?void 0:L.trim())??"";!ce||f.has(ce)||(f.add(ce),a.push({value:ce,label:s.value[N.projectName]??N.projectName}))}const p=he.value.trim();return p&&!f.has(p)&&a.unshift({value:p,label:Tr(p)}),a}),Se=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Zn(()=>{window.addEventListener("keydown",wt),zr(),Se==null||Se.addEventListener("change",zr),mi(),nr(),Wr(),xn()}),Zo(()=>{window.removeEventListener("keydown",wt),Se==null||Se.removeEventListener("change",zr),F&&(clearTimeout(F),F=null),dt()}),pt(G,a=>{const f=a.trim();if(F&&(clearTimeout(F),F=null),!f){D.value=null;return}F=setTimeout(()=>{v_(f,1e3).then(p=>{G.value.trim()===f&&(D.value=p.threadIds)}).catch(()=>{G.value.trim()===f&&(D.value=null)})},220)});function Xt(){X()}function St(){U.value=!U.value,U.value?Jt(()=>{var a;return(a=x.value)==null?void 0:a.focus()}):G.value=""}function ln(){var a;G.value="",(a=x.value)==null||a.focus()}function tn(a){a.key==="Escape"&&(U.value=!1,G.value="")}function cn(a){a&&(Te.name==="thread"&&ot.value===a||(Ue.push({name:"thread",params:{threadId:a}}),W.value&&Ze(!0)))}async function _(a){a&&(u.value!==a&&(await z(a),await Ue.push({name:"thread",params:{threadId:a}})),await Jt(),Q())}function E(a){ue(a)}function C(a){var b,L;const f=r.value.find(N=>N.projectName===a),p=((L=(b=f==null?void 0:f.threads[0])==null?void 0:b.cwd)==null?void 0:L.trim())??"";p&&(he.value=p),W.value&&Ze(!0),!je.value&&Ue.push({name:"home"})}function K(a){var b,L;const f=r.value.find(N=>N.projectName===a),p=((L=(b=f==null?void 0:f.threads[0])==null?void 0:b.cwd)==null?void 0:L.trim())??"";!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function I(){var f,p;const a=((p=(f=o.value)==null?void 0:f.cwd)==null?void 0:p.trim())??"";a&&(he.value=a),W.value&&Ze(!0),!je.value&&Ue.push({name:"home"})}function P(a){ut(a.projectName,a.displayName)}function H(a){me(a.threadId,a.title)}function re(a){Ge(a)}function Re(a){He(a.projectName,a.toIndex)}function Ye(a){ae(a.threadId,a.state)}function ze(a){Ie(a)}function Ze(a){R.value!==a&&(R.value=a,hi(a))}function wt(a){a.defaultPrevented||!a.ctrlKey&&!a.metaKey||a.shiftKey||a.altKey||a.key.toLowerCase()==="b"&&(a.preventDefault(),Ze(!R.value))}function Vt(a){const f=a.text;if(je.value){gi(f,a.imageUrls,a.skills,a.fileAttachments);return}if(a.rollbackLatestUserTurn===!0){tr(a);return}be(f,a.imageUrls,a.skills,a.mode,a.fileAttachments)}async function tr(a){Mt.value&&await ee();const f=_t.value;f>=0&&await te(f),await be(a.text,a.imageUrls,a.skills,"steer",a.fileAttachments)}function ys(a){he.value=a.trim()}async function Hr(a){const f=a.trim();if(!f)return;const p=kr(f),b=await ws(),L=p?f:Ir(b,f);if(L)try{const N=await p_(L,{createIfMissing:!p,label:p?"":f});N&&(he.value=N,qe(Tr(N)),Wr(),xn())}catch{}}async function ws(){const a=Vr();if(a)return a;try{const f=await Bc();if(f)return q.value=f,f}catch{}return""}function kr(a){return a?a.startsWith("~/")||a.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(a):!1}async function xn(){const a=Vr();if(!a){J.value="New Project (1)";return}try{const f=await m_(a);J.value=f.name||"New Project (1)"}catch{J.value="New Project (1)"}}function Vr(){var p,b;const a=he.value.trim();if(a)return Gr(a);const f=((b=(p=xe.value[0])==null?void 0:p.value)==null?void 0:b.trim())??"";return f?Gr(f):q.value.trim()}async function nr(){try{q.value=await Bc()}catch{q.value=""}}async function Wr(){try{const a=await va();v.value={order:[...a.order],labels:{...a.labels}}}catch{v.value={order:[],labels:{}}}}function Gr(a){const f=a.trim().replace(/\/+$/,"");if(!f)return"";const p=f.lastIndexOf("/");return p<=0?"":f.slice(0,p)}function Tr(a){const f=a.trim().replace(/\/+$/,"");if(!f)return"";const p=f.lastIndexOf("/");return p<0?f:f.slice(p+1)}function Ir(a,f){const p=a.trim().replace(/\/+$/,""),b=f.trim().replace(/^\/+/,"");return!p||!b?"":`${p}/${b}`}function rr(a){Ae(a)}function S(a){ye(a)}function M(){ee()}function O(a){te(a.turnIndex)}function Q(){if(je.value||It.value||typeof document>"u"||!o.value||ft.value.length===0)return;const a=Be(),f=Et(),p=new Blob([a],{type:"text/markdown;charset=utf-8"}),b=URL.createObjectURL(p),L=document.createElement("a");L.href=b,L.download=f,document.body.appendChild(L),L.click(),document.body.removeChild(L),window.setTimeout(()=>URL.revokeObjectURL(b),0)}function Be(){var p,b,L;const a=[],f=((b=(p=o.value)==null?void 0:p.title)==null?void 0:b.trim())||"Untitled thread";a.push(`# ${Qt(f)}`),a.push(""),a.push(`- Exported: ${new Date().toISOString()}`),a.push(`- Thread ID: ${((L=o.value)==null?void 0:L.id)??""}`),a.push(""),a.push("---"),a.push("");for(const N of ft.value){const ce=N.role?N.role.toUpperCase():"MESSAGE";a.push(`## ${ce}`),a.push("");const Pe=N.text.trim();if(Pe&&(a.push(Pe),a.push("")),N.commandExecution&&(a.push("```text"),a.push(`command: ${N.commandExecution.command}`),a.push(`status: ${N.commandExecution.status}`),N.commandExecution.cwd&&a.push(`cwd: ${N.commandExecution.cwd}`),N.commandExecution.exitCode!==null&&a.push(`exitCode: ${N.commandExecution.exitCode}`),a.push(N.commandExecution.aggregatedOutput||"(no output)"),a.push("```"),a.push("")),N.fileAttachments&&N.fileAttachments.length>0){a.push("Attachments:");for(const ve of N.fileAttachments)a.push(`- ${ve.path}`);a.push("")}if(N.images&&N.images.length>0){a.push("Images:");for(const ve of N.images)a.push(`- ${ve}`);a.push("")}}return`${a.join(`
|
|
1423
|
-
`).trimEnd()}
|
|
1424
|
-
`}function Et(){var L,N;const p=(((N=(L=o.value)==null?void 0:L.title)==null?void 0:N.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",b=new Date().toISOString().replace(/[:.]/g,"-");return`${p}-${b}.md`}function Qt(a){return a.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function sr(a,f){if(typeof window>"u")return f;const p=window.localStorage.getItem(a);return p===null?f:p==="1"}function Mn(){if(typeof window>"u")return"system";const a=window.localStorage.getItem(Su);return a==="light"||a==="dark"?a:"system"}function nn(){return typeof window>"u"?"steer":window.localStorage.getItem(Iu)==="queue"?"queue":"steer"}function or(){de.value=!de.value,window.localStorage.setItem(Tu,de.value?"1":"0")}function qr(){pe.value=pe.value==="steer"?"queue":"steer",window.localStorage.setItem(Iu,pe.value)}function bs(){const a=["system","light","dark"],f=a.indexOf(ke.value);ke.value=a[(f+1)%a.length],window.localStorage.setItem(Su,ke.value),zr()}function ci(){Me.value=!Me.value,window.localStorage.setItem(Eu,Me.value?"1":"0")}function ui(){Ve.value=!Ve.value,window.localStorage.setItem(Cu,Ve.value?"1":"0")}function di(a){var b;const f=a.target,p=((b=f==null?void 0:f.value)==null?void 0:b.trim())||"auto";$e.value=p,window.localStorage.setItem(Au,p)}function _s(){var f;return typeof window>"u"?"auto":((f=window.localStorage.getItem(Au))==null?void 0:f.trim())||"auto"}function On(){const a=[{value:"auto",label:"Auto (Browser)"}];if(typeof navigator>"u")return a;const f=new Set(["auto"]),p=typeof Intl<"u"&&"DisplayNames"in Intl?new Intl.DisplayNames(["en"],{type:"language"}):null;for(const b of navigator.languages??[]){const L=b.trim();if(!L||f.has(L))continue;f.add(L);const N=L.split("-")[0]??L,ce=(p==null?void 0:p.of(N))||N;a.push({value:L,label:`${ce} (${L})`})}return a}function zr(){const a=document.documentElement;if(ke.value==="dark")a.classList.add("dark");else if(ke.value==="light")a.classList.remove("dark");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;a.classList.toggle("dark",f)}}function fi(){return typeof window>"u"?!1:window.localStorage.getItem(ku)==="1"}function hi(a){typeof window>"u"||window.localStorage.setItem(ku,a?"1":"0")}function pi(a,f){const p=(a??"").trim();return p.length>0?p:f.trim()||"message"}async function mi(){await V(),le.value=!0,await ks(),Qe()}async function ks(){if(!fe.value){fe.value=!0;try{if(Te.name==="home"||Te.name==="skills"){u.value!==""&&await z("");return}if(Te.name==="thread"){const a=ot.value;if(!a)return;if(!Je.value.has(a)){await Ue.replace({name:"home"});return}u.value!==a&&await z(a);return}}finally{fe.value=!1}}}pt(()=>[Te.name,ot.value,A.value,Je.value.has(ot.value),u.value],async()=>{le.value&&await ks()}),pt(()=>u.value,async a=>{if(le.value&&!fe.value&&!(je.value||It.value)){if(!a){Te.name!=="home"&&await Ue.replace({name:"home"});return}Te.name==="thread"&&ot.value===a||await Ue.replace({name:"thread",params:{threadId:a}})}}),pt(()=>xe.value,a=>{if(a.length===0){he.value="";return}a.some(p=>p.value===he.value)||(he.value=a[0].value),xn()},{immediate:!0}),pt(()=>he.value,()=>{y.value={phase:"idle",title:"",message:""},xn()}),pt(()=>Ne.value,a=>{a==="local"&&(y.value={phase:"idle",title:"",message:""})}),pt(()=>Te.name,a=>{a!=="home"&&(y.value={phase:"idle",title:"",message:""})}),pt(()=>u.value,()=>{y.value={phase:"idle",title:"",message:""}}),pt(W,a=>{a&&!R.value&&Ze(!0)});async function gi(a,f=[],p=[],b=[]){try{y.value={phase:"idle",title:"",message:""};let L=he.value;if(Ne.value==="worktree"){y.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const ce=await f_(he.value);L=ce.cwd,he.value=ce.cwd,y.value={phase:"idle",title:"",message:""}}catch{y.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const N=await oe(a,L,f,p,b);if(!N)return;await Ue.replace({name:"thread",params:{threadId:N}})}catch{}}return(a,f)=>(w(),T(De,null,[Ee(zg,{"is-sidebar-collapsed":R.value,onCloseSidebar:f[6]||(f[6]=p=>Ze(!0))},{sidebar:ht(()=>[m("section",HC,[m("div",VC,[R.value?se("",!0):(w(),lt(vu,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":R.value,"show-new-thread-button":!0,onToggleSidebar:f[0]||(f[0]=p=>Ze(!R.value)),onStartNewThread:I},{default:ht(()=>[m("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":U.value,"aria-label":"Search threads",title:"Search threads",onClick:St},[Ee(wa,{class:"sidebar-search-toggle-icon"})],8,WC)]),_:1},8,["is-sidebar-collapsed"])),!R.value&&U.value?(w(),T("div",GC,[Ee(wa,{class:"sidebar-search-bar-icon"}),Kn(m("input",{ref_key:"sidebarSearchInputRef",ref:x,"onUpdate:modelValue":f[1]||(f[1]=p=>G.value=p),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:tn},null,544),[[Jn,G.value]]),G.value.length>0?(w(),T("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:ln},[Ee(el,{class:"sidebar-search-clear-icon"})])):se("",!0)])):se("",!0),R.value?se("",!0):(w(),T("button",{key:2,class:rt(["sidebar-skills-link",{"is-active":It.value}]),type:"button",onClick:f[2]||(f[2]=p=>{ge(Ue).push({name:"skills"}),ge(W)&&Ze(!0)})}," Skills Hub ",2)),R.value?se("",!0):(w(),lt(Dy,{key:3,groups:ge(r),"project-display-name-by-id":ge(s),"selected-thread-id":ge(u),"is-loading":ge(A),"search-query":G.value,"search-matched-thread-ids":D.value,onSelect:cn,onArchive:E,onStartNewThread:C,onRenameProject:P,onBrowseProjectFiles:K,onRenameThread:H,onRemoveProject:re,onReorderProject:Re,onExportThread:_},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),R.value?se("",!0):(w(),T("div",qC,[Ee(Wd,{name:"settings-panel"},{default:ht(()=>[we.value?(w(),T("div",zC,[m("button",{class:"sidebar-settings-row",type:"button",onClick:or},[f[7]||(f[7]=m("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),m("span",{class:rt(["sidebar-settings-toggle",{"is-on":!de.value}])},null,2)]),m("button",{class:"sidebar-settings-row",type:"button",onClick:qr},[f[8]||(f[8]=m("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),m("span",KC,ne(pe.value==="steer"?"Steer":"Queue"),1)]),m("button",{class:"sidebar-settings-row",type:"button",onClick:bs},[f[9]||(f[9]=m("span",{class:"sidebar-settings-label"},"Appearance",-1)),m("span",JC,ne(ke.value==="system"?"System":ke.value==="dark"?"Dark":"Light"),1)]),m("button",{class:"sidebar-settings-row",type:"button",onClick:ci},[f[10]||(f[10]=m("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),m("span",{class:rt(["sidebar-settings-toggle",{"is-on":Me.value}])},null,2)]),m("button",{class:"sidebar-settings-row",type:"button",onClick:ui},[f[11]||(f[11]=m("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),m("span",{class:rt(["sidebar-settings-toggle",{"is-on":Ve.value}])},null,2)]),m("div",YC,[f[12]||(f[12]=m("span",{class:"sidebar-settings-label"},"Dictation language",-1)),m("select",{class:"sidebar-settings-select",value:$e.value,onChange:di},[(w(!0),T(De,null,yt(Xe.value,p=>(w(),T("option",{key:p.value,value:p.value},ne(p.label),9,QC))),128))],40,XC)])])):se("",!0)]),_:1}),m("button",{class:"sidebar-settings-button",type:"button",onClick:f[3]||(f[3]=p=>we.value=!we.value)},[Ee(vC,{class:"sidebar-settings-icon"}),f[13]||(f[13]=m("span",null,"Settings",-1))])]))])]),content:ht(()=>[m("section",ZC,[Ee(Hy,{title:Ut.value},{leading:ht(()=>[R.value||ge(W)?(w(),lt(vu,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":R.value,"show-new-thread-button":!0,onToggleSidebar:f[4]||(f[4]=p=>Ze(!R.value)),onStartNewThread:I},null,8,["is-sidebar-collapsed"])):se("",!0)]),_:1},8,["title"]),m("section",eA,[It.value?(w(),lt(nC,{key:0,onSkillsChanged:Xt})):je.value?(w(),T("div",tA,[m("div",nA,[f[14]||(f[14]=m("p",{class:"new-thread-hero"},"Let's build",-1)),Ee(ya,{class:"new-thread-folder-dropdown","model-value":he.value,options:xe.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":J.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":ys,onAdd:Hr},null,8,["model-value","options","default-add-value"]),Ee(l0,{class:"new-thread-runtime-dropdown",modelValue:Ne.value,"onUpdate:modelValue":f[5]||(f[5]=p=>Ne.value=p)},null,8,["modelValue"]),y.value.phase!=="idle"?(w(),T("div",{key:0,class:rt(["worktree-init-status",{"is-running":y.value.phase==="running","is-error":y.value.phase==="error"}])},[m("strong",rA,ne(y.value.title),1),m("span",sA,ne(y.value.message),1)],2)):se("",!0)]),Ee(Hc,{"active-thread-id":Pt.value,cwd:xt.value,models:ge(d),"selected-model":ge(h),"selected-reasoning-effort":ge(g),skills:ge(k),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":de.value,"in-progress-submit-mode":pe.value,"dictation-click-to-toggle":Me.value,"dictation-auto-send":Ve.value,"dictation-language":$e.value,onSubmit:Vt,"onUpdate:selectedModel":rr,"onUpdate:selectedReasoningEffort":S},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","dictation-language"])])):(w(),T("div",oA,[m("div",iA,[Ee(Eb,{messages:ft.value,"is-loading":ge(B),"active-thread-id":Pt.value,cwd:xt.value,"scroll-state":ge(i),"live-overlay":Ht.value,"pending-requests":ge(l),"is-turn-in-progress":Mt.value,"is-rolling-back":ge(Y),onUpdateScrollState:Ye,onRespondServerRequest:ze,onRollback:O},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),m("div",aA,[Ee(e0,{messages:ge(Ce),onSteer:ge(Oe),onDelete:ge(_e)},null,8,["messages","onSteer","onDelete"]),Ee(Hc,{"active-thread-id":Pt.value,cwd:xt.value,models:ge(d),"selected-model":ge(h),"selected-reasoning-effort":ge(g),skills:ge(k),"is-turn-in-progress":Mt.value,"is-interrupting-turn":ge(Z),"has-queue-above":ge(Ce).length>0,"send-with-enter":de.value,"in-progress-submit-mode":pe.value,"dictation-click-to-toggle":Me.value,"dictation-auto-send":Ve.value,"dictation-language":$e.value,onSubmit:Vt,"onUpdate:selectedModel":rr,"onUpdate:selectedReasoningEffort":S,onInterrupt:M},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","dictation-language"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),m("div",lA," WT "+ne(ge(t))+" · v"+ne(ge(n)),1)],64))}}),uA=et(cA,[["__scopeId","data-v-8987d45d"]]),Xi={render:()=>null},dA=Bg({history:vg(),routes:[{path:"/",name:"home",component:Xi},{path:"/thread/:threadId",name:"thread",component:Xi},{path:"/skills",name:"skills",component:Xi},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");Pm(uA).use(dA).mount("#app");
|