codexapp 0.1.51 → 0.1.52
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/README.md +17 -0
- package/dist/assets/index-B6t8lUoD.css +1 -0
- package/dist/assets/index-CGldz3Gt.js +1428 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +521 -118
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/index-8tP34EwU.js +0 -1429
- package/dist/assets/index-B8I4NE8D.css +0 -1
|
@@ -0,0 +1,1428 @@
|
|
|
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.31
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/function Za(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Et={},as=[],Hn=()=>{},Zu=()=>!1,oi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ii=e=>e.startsWith("onUpdate:"),Dt=Object.assign,el=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Rh=Object.prototype.hasOwnProperty,mt=(e,t)=>Rh.call(e,t),Fe=Array.isArray,ls=e=>oo(e)==="[object Map]",ed=e=>oo(e)==="[object Set]",Wl=e=>oo(e)==="[object Date]",Ve=e=>typeof e=="function",Pt=e=>typeof e=="string",An=e=>typeof e=="symbol",gt=e=>e!==null&&typeof e=="object",td=e=>(gt(e)||Ve(e))&&Ve(e.then)&&Ve(e.catch),nd=Object.prototype.toString,oo=e=>nd.call(e),Ph=e=>oo(e).slice(8,-1),rd=e=>oo(e)==="[object Object]",tl=e=>Pt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ds=Za(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ai=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},xh=/-\w/g,an=ai(e=>e.replace(xh,t=>t.slice(1).toUpperCase())),Mh=/\B([A-Z])/g,Mr=ai(e=>e.replace(Mh,"-$1").toLowerCase()),li=ai(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ui=ai(e=>e?`on${li(e)}`:""),jn=(e,t)=>!Object.is(e,t),xo=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},sd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},nl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Oh=e=>{const t=Pt(e)?Number(e):NaN;return isNaN(t)?e:t};let Vl;const ci=()=>Vl||(Vl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Jr(e){if(Fe(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Pt(r)?Lh(r):Jr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Pt(e)||gt(e))return e}const $h=/;(?![^(]*\))/g,Nh=/:([^]+)/,Dh=/\/\*[^]*?\*\//g;function Lh(e){const t={};return e.replace(Dh,"").split($h).forEach(n=>{if(n){const r=n.split(Nh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function nt(e){let t="";if(Pt(e))t=e;else if(Fe(e))for(let n=0;n<e.length;n++){const r=nt(e[n]);r&&(t+=r+" ")}else if(gt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const jh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Uh=Za(jh);function od(e){return!!e||e===""}function Fh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=rl(e[r],t[r]);return n}function rl(e,t){if(e===t)return!0;let n=Wl(e),r=Wl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=An(e),r=An(t),n||r)return e===t;if(n=Fe(e),r=Fe(t),n||r)return n&&r?Fh(e,t):!1;if(n=gt(e),r=gt(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,o=Object.keys(t).length;if(s!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),l=t.hasOwnProperty(i);if(a&&!l||!a&&l||!rl(e[i],t[i]))return!1}}return String(e)===String(t)}const id=e=>!!(e&&e.__v_isRef===!0),ce=e=>Pt(e)?e:e==null?"":Fe(e)||gt(e)&&(e.toString===nd||!Ve(e.toString))?id(e)?ce(e.value):JSON.stringify(e,ad,2):String(e),ad=(e,t)=>id(t)?ad(e,t.value):ls(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[Fi(r,o)+" =>"]=s,n),{})}:ed(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Fi(n))}:An(t)?Fi(t):gt(t)&&!Fe(t)&&!rd(t)?String(t):t,Fi=(e,t="")=>{var n;return An(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
6
|
+
* @vue/reactivity v3.5.31
|
|
7
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
|
+
* @license MIT
|
|
9
|
+
**/let fn;class Bh{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=fn,!t&&fn&&(this.index=(fn.scopes||(fn.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=fn;try{return fn=this,t()}finally{fn=n}}}on(){++this._on===1&&(this.prevScope=fn,fn=this)}off(){this._on>0&&--this._on===0&&(fn=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 Hh(){return fn}let Ct;const Bi=new WeakSet;class ld{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,fn&&fn.active&&fn.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||ud(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,zl(this),dd(this);const t=Ct,n=In;Ct=this,In=!0;try{return this.fn()}finally{fd(this),Ct=t,In=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)il(t);this.deps=this.depsTail=void 0,zl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Bi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ba(this)&&this.run()}get dirty(){return ba(this)}}let cd=0,Ls,js;function ud(e,t=!1){if(e.flags|=8,t){e.next=js,js=e;return}e.next=Ls,Ls=e}function sl(){cd++}function ol(){if(--cd>0)return;if(js){let t=js;for(js=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Ls;){let t=Ls;for(Ls=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 dd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function fd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),il(r),Wh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function ba(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(hd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function hd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===zs)||(e.globalVersion=zs,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!ba(e))))return;e.flags|=2;const t=e.dep,n=Ct,r=In;Ct=e,In=!0;try{dd(e);const s=e.fn(e._value);(t.version===0||jn(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ct=n,In=r,fd(e),e.flags&=-3}}function il(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)il(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 In=!0;const pd=[];function or(){pd.push(In),In=!1}function ir(){const e=pd.pop();In=e===void 0?!0:e}function zl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ct;Ct=void 0;try{t()}finally{Ct=n}}}let zs=0;class Vh{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class al{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Ct||!In||Ct===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ct)n=this.activeLink=new Vh(Ct,this),Ct.deps?(n.prevDep=Ct.depsTail,Ct.depsTail.nextDep=n,Ct.depsTail=n):Ct.deps=Ct.depsTail=n,md(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=Ct.depsTail,n.nextDep=void 0,Ct.depsTail.nextDep=n,Ct.depsTail=n,Ct.deps===n&&(Ct.deps=r)}return n}trigger(t){this.version++,zs++,this.notify(t)}notify(t){sl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ol()}}}function md(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)md(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const _a=new WeakMap,Gr=Symbol(""),ka=Symbol(""),Gs=Symbol("");function Xt(e,t,n){if(In&&Ct){let r=_a.get(e);r||_a.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new al),s.map=r,s.key=n),s.track()}}function er(e,t,n,r,s,o){const i=_a.get(e);if(!i){zs++;return}const a=l=>{l&&l.trigger()};if(sl(),t==="clear")i.forEach(a);else{const l=Fe(e),d=l&&tl(n);if(l&&n==="length"){const c=Number(r);i.forEach((h,v)=>{(v==="length"||v===Gs||!An(v)&&v>=c)&&a(h)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),d&&a(i.get(Gs)),t){case"add":l?d&&a(i.get("length")):(a(i.get(Gr)),ls(e)&&a(i.get(ka)));break;case"delete":l||(a(i.get(Gr)),ls(e)&&a(i.get(ka)));break;case"set":ls(e)&&a(i.get(Gr));break}}ol()}function ns(e){const t=dt(e);return t===e?t:(Xt(t,"iterate",Gs),wn(e)?t:t.map(Rn))}function ui(e){return Xt(e=dt(e),"iterate",Gs),e}function Dn(e,t){return ar(e)?gs(qr(e)?Rn(t):t):Rn(t)}const zh={__proto__:null,[Symbol.iterator](){return Hi(this,Symbol.iterator,e=>Dn(this,e))},concat(...e){return ns(this).concat(...e.map(t=>Fe(t)?ns(t):t))},entries(){return Hi(this,"entries",e=>(e[1]=Dn(this,e[1]),e))},every(e,t){return Jn(this,"every",e,t,void 0,arguments)},filter(e,t){return Jn(this,"filter",e,t,n=>n.map(r=>Dn(this,r)),arguments)},find(e,t){return Jn(this,"find",e,t,n=>Dn(this,n),arguments)},findIndex(e,t){return Jn(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Jn(this,"findLast",e,t,n=>Dn(this,n),arguments)},findLastIndex(e,t){return Jn(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Jn(this,"forEach",e,t,void 0,arguments)},includes(...e){return Wi(this,"includes",e)},indexOf(...e){return Wi(this,"indexOf",e)},join(e){return ns(this).join(e)},lastIndexOf(...e){return Wi(this,"lastIndexOf",e)},map(e,t){return Jn(this,"map",e,t,void 0,arguments)},pop(){return Rs(this,"pop")},push(...e){return Rs(this,"push",e)},reduce(e,...t){return Gl(this,"reduce",e,t)},reduceRight(e,...t){return Gl(this,"reduceRight",e,t)},shift(){return Rs(this,"shift")},some(e,t){return Jn(this,"some",e,t,void 0,arguments)},splice(...e){return Rs(this,"splice",e)},toReversed(){return ns(this).toReversed()},toSorted(e){return ns(this).toSorted(e)},toSpliced(...e){return ns(this).toSpliced(...e)},unshift(...e){return Rs(this,"unshift",e)},values(){return Hi(this,"values",e=>Dn(this,e))}};function Hi(e,t,n){const r=ui(e),s=r[t]();return r!==e&&!wn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const Gh=Array.prototype;function Jn(e,t,n,r,s,o){const i=ui(e),a=i!==e&&!wn(e),l=i[t];if(l!==Gh[t]){const h=l.apply(e,o);return a?Rn(h):h}let d=n;i!==e&&(a?d=function(h,v){return n.call(this,Dn(e,h),v,e)}:n.length>2&&(d=function(h,v){return n.call(this,h,v,e)}));const c=l.call(i,d,r);return a&&s?s(c):c}function Gl(e,t,n,r){const s=ui(e),o=s!==e&&!wn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(d,c,h){return a&&(a=!1,d=Dn(e,d)),n.call(this,d,Dn(e,c),h,e)}):n.length>3&&(i=function(d,c,h){return n.call(this,d,c,h,e)}));const l=s[t](i,...r);return a?Dn(e,l):l}function Wi(e,t,n){const r=dt(e);Xt(r,"iterate",Gs);const s=r[t](...n);return(s===-1||s===!1)&&ul(n[0])?(n[0]=dt(n[0]),r[t](...n)):s}function Rs(e,t,n=[]){or(),sl();const r=dt(e)[t].apply(e,n);return ol(),ir(),r}const qh=Za("__proto__,__v_isRef,__isVue"),gd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(An));function Kh(e){An(e)||(e=String(e));const t=dt(this);return Xt(t,"has",e),t.hasOwnProperty(e)}class vd{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?sp:_d:o?bd:wd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Fe(t);if(!s){let l;if(i&&(l=zh[n]))return l;if(n==="hasOwnProperty")return Kh}const a=Reflect.get(t,n,en(t)?t:r);if((An(n)?gd.has(n):qh(n))||(s||Xt(t,"get",n),o))return a;if(en(a)){const l=i&&tl(n)?a:a.value;return s&>(l)?Sa(l):l}return gt(a)?s?Sa(a):di(a):a}}class yd extends vd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Fe(t)&&tl(n);if(!this._isShallow){const d=ar(o);if(!wn(r)&&!ar(r)&&(o=dt(o),r=dt(r)),!i&&en(o)&&!en(r))return d||(o.value=r),!0}const a=i?Number(n)<t.length:mt(t,n),l=Reflect.set(t,n,r,en(t)?t:s);return t===dt(s)&&(a?jn(r,o)&&er(t,"set",n,r):er(t,"add",n,r)),l}deleteProperty(t,n){const r=mt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&er(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!An(n)||!gd.has(n))&&Xt(t,"has",n),r}ownKeys(t){return Xt(t,"iterate",Fe(t)?"length":Gr),Reflect.ownKeys(t)}}class Jh extends vd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Yh=new yd,Xh=new Jh,Qh=new yd(!0);const Ta=e=>e,ko=e=>Reflect.getPrototypeOf(e);function Zh(e,t,n){return function(...r){const s=this.__v_raw,o=dt(s),i=ls(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,d=s[e](...r),c=n?Ta:t?gs:Rn;return!t&&Xt(o,"iterate",l?ka:Gr),Dt(Object.create(d),{next(){const{value:h,done:v}=d.next();return v?{value:h,done:v}:{value:a?[c(h[0]),c(h[1])]:c(h),done:v}}})}}function To(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function ep(e,t){const n={get(s){const o=this.__v_raw,i=dt(o),a=dt(s);e||(jn(s,a)&&Xt(i,"get",s),Xt(i,"get",a));const{has:l}=ko(i),d=t?Ta:e?gs:Rn;if(l.call(i,s))return d(o.get(s));if(l.call(i,a))return d(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&Xt(dt(s),"iterate",Gr),s.size},has(s){const o=this.__v_raw,i=dt(o),a=dt(s);return e||(jn(s,a)&&Xt(i,"has",s),Xt(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=dt(a),d=t?Ta:e?gs:Rn;return!e&&Xt(l,"iterate",Gr),a.forEach((c,h)=>s.call(o,d(c),d(h),i))}};return Dt(n,e?{add:To("add"),set:To("set"),delete:To("delete"),clear:To("clear")}:{add(s){const o=dt(this),i=ko(o),a=dt(s),l=!t&&!wn(s)&&!ar(s)?a:s;return i.has.call(o,l)||jn(s,l)&&i.has.call(o,s)||jn(a,l)&&i.has.call(o,a)||(o.add(l),er(o,"add",l,l)),this},set(s,o){!t&&!wn(o)&&!ar(o)&&(o=dt(o));const i=dt(this),{has:a,get:l}=ko(i);let d=a.call(i,s);d||(s=dt(s),d=a.call(i,s));const c=l.call(i,s);return i.set(s,o),d?jn(o,c)&&er(i,"set",s,o):er(i,"add",s,o),this},delete(s){const o=dt(this),{has:i,get:a}=ko(o);let l=i.call(o,s);l||(s=dt(s),l=i.call(o,s)),a&&a.call(o,s);const d=o.delete(s);return l&&er(o,"delete",s,void 0),d},clear(){const s=dt(this),o=s.size!==0,i=s.clear();return o&&er(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Zh(s,e,t)}),n}function ll(e,t){const n=ep(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(mt(n,s)&&s in r?n:r,s,o)}const tp={get:ll(!1,!1)},np={get:ll(!1,!0)},rp={get:ll(!0,!1)};const wd=new WeakMap,bd=new WeakMap,_d=new WeakMap,sp=new WeakMap;function op(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ip(e){return e.__v_skip||!Object.isExtensible(e)?0:op(Ph(e))}function di(e){return ar(e)?e:cl(e,!1,Yh,tp,wd)}function kd(e){return cl(e,!1,Qh,np,bd)}function Sa(e){return cl(e,!0,Xh,rp,_d)}function cl(e,t,n,r,s){if(!gt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=ip(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function qr(e){return ar(e)?qr(e.__v_raw):!!(e&&e.__v_isReactive)}function ar(e){return!!(e&&e.__v_isReadonly)}function wn(e){return!!(e&&e.__v_isShallow)}function ul(e){return e?!!e.__v_raw:!1}function dt(e){const t=e&&e.__v_raw;return t?dt(t):e}function ap(e){return!mt(e,"__v_skip")&&Object.isExtensible(e)&&sd(e,"__v_skip",!0),e}const Rn=e=>gt(e)?di(e):e,gs=e=>gt(e)?Sa(e):e;function en(e){return e?e.__v_isRef===!0:!1}function j(e){return Td(e,!1)}function lp(e){return Td(e,!0)}function Td(e,t){return en(e)?e:new cp(e,t)}class cp{constructor(t,n){this.dep=new al,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:dt(t),this._value=n?t:Rn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||wn(t)||ar(t);t=r?t:dt(t),jn(t,n)&&(this._rawValue=t,this._value=r?t:Rn(t),this.dep.trigger())}}function be(e){return en(e)?e.value:e}const up={get:(e,t,n)=>t==="__v_raw"?e:be(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return en(s)&&!en(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Sd(e){return qr(e)?e:new Proxy(e,up)}class dp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new al(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=zs-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ct!==this)return ud(this,!0),!0}get value(){const t=this.dep.track();return hd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function fp(e,t,n=!1){let r,s;return Ve(e)?r=e:(r=e.get,s=e.set),new dp(r,s,n)}const So={},Bo=new WeakMap;let Fr;function hp(e,t=!1,n=Fr){if(n){let r=Bo.get(n);r||Bo.set(n,r=[]),r.push(e)}}function pp(e,t,n=Et){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,d=F=>s?F:wn(F)||s===!1||s===0?tr(F,1):tr(F);let c,h,v,E,D=!1,O=!1;if(en(e)?(h=()=>e.value,D=wn(e)):qr(e)?(h=()=>d(e),D=!0):Fe(e)?(O=!0,D=e.some(F=>qr(F)||wn(F)),h=()=>e.map(F=>{if(en(F))return F.value;if(qr(F))return d(F);if(Ve(F))return l?l(F,2):F()})):Ve(e)?t?h=l?()=>l(e,2):e:h=()=>{if(v){or();try{v()}finally{ir()}}const F=Fr;Fr=c;try{return l?l(e,3,[E]):e(E)}finally{Fr=F}}:h=Hn,t&&s){const F=h,re=s===!0?1/0:s;h=()=>tr(F(),re)}const z=Hh(),R=()=>{c.stop(),z&&z.active&&el(z.effects,c)};if(o&&t){const F=t;t=(...re)=>{F(...re),R()}}let x=O?new Array(e.length).fill(So):So;const H=F=>{if(!(!(c.flags&1)||!c.dirty&&!F))if(t){const re=c.run();if(s||D||(O?re.some((se,ve)=>jn(se,x[ve])):jn(re,x))){v&&v();const se=Fr;Fr=c;try{const ve=[re,x===So?void 0:O&&x[0]===So?[]:x,E];x=re,l?l(t,3,ve):t(...ve)}finally{Fr=se}}}else c.run()};return a&&a(H),c=new ld(h),c.scheduler=i?()=>i(H,!1):H,E=F=>hp(F,!1,c),v=c.onStop=()=>{const F=Bo.get(c);if(F){if(l)l(F,4);else for(const re of F)re();Bo.delete(c)}},t?r?H(!0):x=c.run():i?i(H.bind(null,!0),!0):c.run(),R.pause=c.pause.bind(c),R.resume=c.resume.bind(c),R.stop=R,R}function tr(e,t=1/0,n){if(t<=0||!gt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,en(e))tr(e.value,t,n);else if(Fe(e))for(let r=0;r<e.length;r++)tr(e[r],t,n);else if(ed(e)||ls(e))e.forEach(r=>{tr(r,t,n)});else if(rd(e)){for(const r in e)tr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&tr(e[r],t,n)}return e}/**
|
|
10
|
+
* @vue/runtime-core v3.5.31
|
|
11
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
+
* @license MIT
|
|
13
|
+
**/function io(e,t,n,r){try{return r?e(...r):e()}catch(s){fi(s,t,n)}}function Pn(e,t,n,r){if(Ve(e)){const s=io(e,t,n,r);return s&&td(s)&&s.catch(o=>{fi(o,t,n)}),s}if(Fe(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Pn(e[o],t,n,r));return s}}function fi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Et;if(t){let a=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let h=0;h<c.length;h++)if(c[h](e,l,d)===!1)return}a=a.parent}if(o){or(),io(o,null,10,[e,l,d]),ir();return}}mp(e,n,s,r,i)}function mp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const sn=[];let $n=-1;const cs=[];let Tr=null,ss=0;const Id=Promise.resolve();let Ho=null;function Vt(e){const t=Ho||Id;return e?t.then(this?e.bind(this):e):t}function gp(e){let t=$n+1,n=sn.length;for(;t<n;){const r=t+n>>>1,s=sn[r],o=qs(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function dl(e){if(!(e.flags&1)){const t=qs(e),n=sn[sn.length-1];!n||!(e.flags&2)&&t>=qs(n)?sn.push(e):sn.splice(gp(t),0,e),e.flags|=1,Ed()}}function Ed(){Ho||(Ho=Id.then(Ad))}function vp(e){Fe(e)?cs.push(...e):Tr&&e.id===-1?Tr.splice(ss+1,0,e):e.flags&1||(cs.push(e),e.flags|=1),Ed()}function ql(e,t,n=$n+1){for(;n<sn.length;n++){const r=sn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;sn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Cd(e){if(cs.length){const t=[...new Set(cs)].sort((n,r)=>qs(n)-qs(r));if(cs.length=0,Tr){Tr.push(...t);return}for(Tr=t,ss=0;ss<Tr.length;ss++){const n=Tr[ss];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Tr=null,ss=0}}const qs=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ad(e){try{for($n=0;$n<sn.length;$n++){const t=sn[$n];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),io(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;$n<sn.length;$n++){const t=sn[$n];t&&(t.flags&=-2)}$n=-1,sn.length=0,Cd(),Ho=null,(sn.length||cs.length)&&Ad()}}let zt=null,Rd=null;function Wo(e){const t=zt;return zt=e,Rd=e&&e.type.__scopeId||null,t}function _t(e,t=zt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Ko(-1);const o=Wo(t);let i;try{i=e(...s)}finally{Wo(o),r._d&&Ko(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function lr(e,t){if(zt===null)return e;const n=vi(zt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Et]=t[s];o&&(Ve(o)&&(o={mounted:o,updated:o}),o.deep&&tr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Nr(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const a=s[i];o&&(a.oldValue=o[i].value);let l=a.dir[r];l&&(or(),Pn(l,n,8,[e.el,a,e,t]),ir())}}function Mo(e,t){if(Zt){let n=Zt.provides;const r=Zt.parent&&Zt.parent.provides;r===n&&(n=Zt.provides=Object.create(r)),n[e]=t}}function En(e,t,n=!1){const r=vl();if(r||ds){let s=ds?ds._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&&Ve(t)?t.call(r&&r.proxy):t}}const yp=Symbol.for("v-scx"),wp=()=>En(yp);function bp(e,t){return fl(e,null,t)}function ut(e,t,n){return fl(e,t,n)}function fl(e,t,n=Et){const{immediate:r,deep:s,flush:o,once:i}=n,a=Dt({},n),l=t&&r||!t&&o!=="post";let d;if(Qs){if(o==="sync"){const E=wp();d=E.__watcherHandles||(E.__watcherHandles=[])}else if(!l){const E=()=>{};return E.stop=Hn,E.resume=Hn,E.pause=Hn,E}}const c=Zt;a.call=(E,D,O)=>Pn(E,c,D,O);let h=!1;o==="post"?a.scheduler=E=>{Yt(E,c&&c.suspense)}:o!=="sync"&&(h=!0,a.scheduler=(E,D)=>{D?E():dl(E)}),a.augmentJob=E=>{t&&(E.flags|=4),h&&(E.flags|=2,c&&(E.id=c.uid,E.i=c))};const v=pp(e,t,a);return Qs&&(d?d.push(v):l&&v()),v}function _p(e,t,n){const r=this.proxy,s=Pt(e)?e.includes(".")?Pd(r,e):()=>r[e]:e.bind(r,r);let o;Ve(t)?o=t:(o=t.handler,n=t);const i=lo(this),a=fl(s,o.bind(r),n);return i(),a}function Pd(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 xd=Symbol("_vte"),Md=e=>e.__isTeleport,Us=e=>e&&(e.disabled||e.disabled===""),kp=e=>e&&(e.defer||e.defer===""),Kl=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Jl=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ia=(e,t)=>{const n=e&&e.to;return Pt(n)?t?t(n):null:n},Od={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,d){const{mc:c,pc:h,pbc:v,o:{insert:E,querySelector:D,createText:O,createComment:z}}=d,R=Us(t.props);let{shapeFlag:x,children:H,dynamicChildren:F}=t;if(e==null){const re=t.el=O(""),se=t.anchor=O("");E(re,n,r),E(se,n,r);const ve=(ie,oe)=>{x&16&&c(H,ie,oe,s,o,i,a,l)},Ee=()=>{const ie=t.target=Ia(t.props,D),oe=Ea(ie,t,O,E);ie&&(i!=="svg"&&Kl(ie)?i="svg":i!=="mathml"&&Jl(ie)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ie),R||(ve(ie,oe),Oo(t,!1)))};R&&(ve(n,se),Oo(t,!0)),kp(t.props)||o&&o.pendingBranch?(t.el.__isMounted=!1,Yt(()=>{t.el.__isMounted===!1&&(Ee(),delete t.el.__isMounted)},o)):Ee()}else{t.el=e.el,t.targetStart=e.targetStart;const re=t.anchor=e.anchor,se=t.target=e.target,ve=t.targetAnchor=e.targetAnchor;if(e.el.__isMounted===!1){Yt(()=>{Od.process(e,t,n,r,s,o,i,a,l,d)},o);return}const Ee=Us(e.props),ie=Ee?n:se,oe=Ee?re:ve;if(i==="svg"||Kl(se)?i="svg":(i==="mathml"||Jl(se))&&(i="mathml"),F?(v(e.dynamicChildren,F,ie,s,o,i,a),ml(e,t,!0)):l||h(e,t,ie,oe,s,o,i,a,!1),R)Ee?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Io(t,n,re,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ye=t.target=Ia(t.props,D);ye&&Io(t,ye,null,d,0)}else Ee&&Io(t,se,ve,d,1);Oo(t,R)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:d,targetAnchor:c,target:h,props:v}=e;if(h&&(s(d),s(c)),o&&s(l),i&16){const E=o||!Us(v);for(let D=0;D<a.length;D++){const O=a[D];r(O,t,n,E,!!O.dynamicChildren)}}},move:Io,hydrate:Tp};function Io(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:l,children:d,props:c}=e,h=o===2;if(h&&r(i,t,n),(!h||Us(c))&&l&16)for(let v=0;v<d.length;v++)s(d[v],t,n,2);h&&r(a,t,n)}function Tp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:d,createText:c}},h){function v(z,R){let x=R;for(;x;){if(x&&x.nodeType===8){if(x.data==="teleport start anchor")t.targetStart=x;else if(x.data==="teleport anchor"){t.targetAnchor=x,z._lpa=t.targetAnchor&&i(t.targetAnchor);break}}x=i(x)}}function E(z,R){R.anchor=h(i(z),R,a(z),n,r,s,o)}const D=t.target=Ia(t.props,l),O=Us(t.props);if(D){const z=D._lpa||D.firstChild;t.shapeFlag&16&&(O?(E(e,t),v(D,z),t.targetAnchor||Ea(D,t,c,d,a(e)===D?e:null)):(t.anchor=i(e),v(D,z),t.targetAnchor||Ea(D,t,c,d),h(z&&i(z),t,D,n,r,s,o))),Oo(t,O)}else O&&t.shapeFlag&16&&(E(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Vo=Od;function Oo(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 Ea(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[xd]=i,e&&(r(o,e,s),r(i,e,s)),i}const Nn=Symbol("_leaveCb"),Ps=Symbol("_enterCb");function Sp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return zn(()=>{e.isMounted=!0}),hr(()=>{e.isUnmounting=!0}),e}const vn=[Function,Array],$d={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:vn,onEnter:vn,onAfterEnter:vn,onEnterCancelled:vn,onBeforeLeave:vn,onLeave:vn,onAfterLeave:vn,onLeaveCancelled:vn,onBeforeAppear:vn,onAppear:vn,onAfterAppear:vn,onAppearCancelled:vn},Nd=e=>{const t=e.subTree;return t.component?Nd(t.component):t},Ip={name:"BaseTransition",props:$d,setup(e,{slots:t}){const n=vl(),r=Sp();return()=>{const s=t.default&&jd(t.default(),!0);if(!s||!s.length)return;const o=Dd(s),i=dt(e),{mode:a}=i;if(r.isLeaving)return Vi(o);const l=Yl(o);if(!l)return Vi(o);let d=Ca(l,i,r,n,h=>d=h);l.type!==Qt&&Ks(l,d);let c=n.subTree&&Yl(n.subTree);if(c&&c.type!==Qt&&!Hr(c,l)&&Nd(n).type!==Qt){let h=Ca(c,i,r,n);if(Ks(c,h),a==="out-in"&&l.type!==Qt)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,c=void 0},Vi(o);a==="in-out"&&l.type!==Qt?h.delayLeave=(v,E,D)=>{const O=Ld(r,c);O[String(c.key)]=c,v[Nn]=()=>{E(),v[Nn]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{D(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function Dd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Qt){t=n;break}}return t}const Ep=Ip;function Ld(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 Ca(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:h,onBeforeLeave:v,onLeave:E,onAfterLeave:D,onLeaveCancelled:O,onBeforeAppear:z,onAppear:R,onAfterAppear:x,onAppearCancelled:H}=t,F=String(e.key),re=Ld(n,e),se=(ie,oe)=>{ie&&Pn(ie,r,9,oe)},ve=(ie,oe)=>{const ye=oe[1];se(ie,oe),Fe(ie)?ie.every(X=>X.length<=1)&&ye():ie.length<=1&&ye()},Ee={mode:i,persisted:a,beforeEnter(ie){let oe=l;if(!n.isMounted)if(o)oe=z||l;else return;ie[Nn]&&ie[Nn](!0);const ye=re[F];ye&&Hr(e,ye)&&ye.el[Nn]&&ye.el[Nn](),se(oe,[ie])},enter(ie){if(re[F]===e)return;let oe=d,ye=c,X=h;if(!n.isMounted)if(o)oe=R||d,ye=x||c,X=H||h;else return;let ke=!1;ie[Ps]=je=>{ke||(ke=!0,je?se(X,[ie]):se(ye,[ie]),Ee.delayedLeave&&Ee.delayedLeave(),ie[Ps]=void 0)};const Oe=ie[Ps].bind(null,!1);oe?ve(oe,[ie,Oe]):Oe()},leave(ie,oe){const ye=String(e.key);if(ie[Ps]&&ie[Ps](!0),n.isUnmounting)return oe();se(v,[ie]);let X=!1;ie[Nn]=Oe=>{X||(X=!0,oe(),Oe?se(O,[ie]):se(D,[ie]),ie[Nn]=void 0,re[ye]===e&&delete re[ye])};const ke=ie[Nn].bind(null,!1);re[ye]=e,E?ve(E,[ie,ke]):ke()},clone(ie){const oe=Ca(ie,t,n,r,s);return s&&s(oe),oe}};return Ee}function Vi(e){if(hi(e))return e=xr(e),e.children=null,e}function Yl(e){if(!hi(e))return Md(e.type)&&e.children?Dd(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&&Ve(n.default))return n.default()}}function Ks(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ks(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function jd(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===Ue?(i.patchFlag&128&&s++,r=r.concat(jd(i.children,t,a))):(t||i.type!==Qt)&&r.push(a!=null?xr(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Lt(e,t){return Ve(e)?Dt({name:e.name},t,{setup:e}):e}function Ud(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Xl(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const zo=new WeakMap;function Fs(e,t,n,r,s=!1){if(Fe(e)){e.forEach((O,z)=>Fs(O,t&&(Fe(t)?t[z]:t),n,r,s));return}if(us(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Fs(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?vi(r.component):r.el,i=s?null:o,{i:a,r:l}=e,d=t&&t.r,c=a.refs===Et?a.refs={}:a.refs,h=a.setupState,v=dt(h),E=h===Et?Zu:O=>Xl(c,O)?!1:mt(v,O),D=(O,z)=>!(z&&Xl(c,z));if(d!=null&&d!==l){if(Ql(t),Pt(d))c[d]=null,E(d)&&(h[d]=null);else if(en(d)){const O=t;D(d,O.k)&&(d.value=null),O.k&&(c[O.k]=null)}}if(Ve(l))io(l,a,12,[i,c]);else{const O=Pt(l),z=en(l);if(O||z){const R=()=>{if(e.f){const x=O?E(l)?h[l]:c[l]:D()||!e.k?l.value:c[e.k];if(s)Fe(x)&&el(x,o);else if(Fe(x))x.includes(o)||x.push(o);else if(O)c[l]=[o],E(l)&&(h[l]=c[l]);else{const H=[o];D(l,e.k)&&(l.value=H),e.k&&(c[e.k]=H)}}else O?(c[l]=i,E(l)&&(h[l]=i)):z&&(D(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const x=()=>{R(),zo.delete(e)};x.id=-1,zo.set(e,x),Yt(x,n)}else Ql(e),R()}}}function Ql(e){const t=zo.get(e);t&&(t.flags|=8,zo.delete(e))}ci().requestIdleCallback;ci().cancelIdleCallback;const us=e=>!!e.type.__asyncLoader,hi=e=>e.type.__isKeepAlive;function Cp(e,t){Fd(e,"a",t)}function Ap(e,t){Fd(e,"da",t)}function Fd(e,t,n=Zt){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(pi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)hi(s.parent.vnode)&&Rp(r,t,n,s),s=s.parent}}function Rp(e,t,n,r){const s=pi(t,e,r,!0);ao(()=>{el(r[t],s)},n)}function pi(e,t,n=Zt,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{or();const a=lo(n),l=Pn(t,n,e,i);return a(),ir(),l});return r?s.unshift(o):s.push(o),o}}const fr=e=>(t,n=Zt)=>{(!Qs||e==="sp")&&pi(e,(...r)=>t(...r),n)},Pp=fr("bm"),zn=fr("m"),xp=fr("bu"),Mp=fr("u"),hr=fr("bum"),ao=fr("um"),Op=fr("sp"),$p=fr("rtg"),Np=fr("rtc");function Dp(e,t=Zt){pi("ec",e,t)}const Lp="components",Bd=Symbol.for("v-ndc");function Go(e){return Pt(e)?jp(Lp,e,!1)||e:e||Bd}function jp(e,t,n=!0,r=!1){const s=zt||Zt;if(s){const o=s.type;{const a=km(o,!1);if(a&&(a===t||a===an(t)||a===li(an(t))))return o}const i=Zl(s[e]||o[e],t)||Zl(s.appContext[e],t);return!i&&r?o:i}}function Zl(e,t){return e&&(e[t]||e[an(t)]||e[li(an(t))])}function It(e,t,n,r){let s;const o=n,i=Fe(e);if(i||Pt(e)){const a=i&&qr(e);let l=!1,d=!1;a&&(l=!wn(e),d=ar(e),e=ui(e)),s=new Array(e.length);for(let c=0,h=e.length;c<h;c++)s[c]=t(l?d?gs(Rn(e[c])):Rn(e[c]):e[c],c,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(gt(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,o));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,d=a.length;l<d;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function Bn(e,t,n={},r,s){if(zt.ce||zt.parent&&us(zt.parent)&&zt.parent.ce){const d=Object.keys(n).length>0;return t!=="default"&&(n.name=t),b(),ft(Ue,null,[xe("slot",n,r)],d?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),b();const i=o&&Hd(o(n)),a=n.key||i&&i.key,l=ft(Ue,{key:(a&&!An(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Hd(e){return e.some(t=>Ys(t)?!(t.type===Qt||t.type===Ue&&!Hd(t.children)):!0)?e:null}const Aa=e=>e?cf(e)?vi(e):Aa(e.parent):null,Bs=Dt(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=>Vd(e),$forceUpdate:e=>e.f||(e.f=()=>{dl(e.update)}),$nextTick:e=>e.n||(e.n=Vt.bind(e.proxy)),$watch:e=>_p.bind(e)}),zi=(e,t)=>e!==Et&&!e.__isScriptSetup&&mt(e,t),Up={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:a,appContext:l}=e;if(t[0]!=="$"){const v=i[t];if(v!==void 0)switch(v){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(zi(r,t))return i[t]=1,r[t];if(s!==Et&&mt(s,t))return i[t]=2,s[t];if(mt(o,t))return i[t]=3,o[t];if(n!==Et&&mt(n,t))return i[t]=4,n[t];Ra&&(i[t]=0)}}const d=Bs[t];let c,h;if(d)return t==="$attrs"&&Xt(e.attrs,"get",""),d(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==Et&&mt(n,t))return i[t]=4,n[t];if(h=l.config.globalProperties,mt(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return zi(s,t)?(s[t]=n,!0):r!==Et&&mt(r,t)?(r[t]=n,!0):mt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:o,type:i}},a){let l;return!!(n[a]||e!==Et&&a[0]!=="$"&&mt(e,a)||zi(t,a)||mt(o,a)||mt(r,a)||mt(Bs,a)||mt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:mt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Fp(){return Bp().slots}function Bp(e){const t=vl();return t.setupContext||(t.setupContext=df(t))}function ec(e){return Fe(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ra=!0;function Hp(e){const t=Vd(e),n=e.proxy,r=e.ctx;Ra=!1,t.beforeCreate&&tc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:d,created:c,beforeMount:h,mounted:v,beforeUpdate:E,updated:D,activated:O,deactivated:z,beforeDestroy:R,beforeUnmount:x,destroyed:H,unmounted:F,render:re,renderTracked:se,renderTriggered:ve,errorCaptured:Ee,serverPrefetch:ie,expose:oe,inheritAttrs:ye,components:X,directives:ke,filters:Oe}=t;if(d&&Wp(d,r,null),i)for(const Me in i){const Re=i[Me];Ve(Re)&&(r[Me]=Re.bind(n))}if(s){const Me=s.call(n,n);gt(Me)&&(e.data=di(Me))}if(Ra=!0,o)for(const Me in o){const Re=o[Me],Ke=Ve(Re)?Re.bind(n,n):Ve(Re.get)?Re.get.bind(n,n):Hn,Xe=!Ve(Re)&&Ve(Re.set)?Re.set.bind(n):Hn,$e=fe({get:Ke,set:Xe});Object.defineProperty(r,Me,{enumerable:!0,configurable:!0,get:()=>$e.value,set:Je=>$e.value=Je})}if(a)for(const Me in a)Wd(a[Me],r,n,Me);if(l){const Me=Ve(l)?l.call(n):l;Reflect.ownKeys(Me).forEach(Re=>{Mo(Re,Me[Re])})}c&&tc(c,e,"c");function Pe(Me,Re){Fe(Re)?Re.forEach(Ke=>Me(Ke.bind(n))):Re&&Me(Re.bind(n))}if(Pe(Pp,h),Pe(zn,v),Pe(xp,E),Pe(Mp,D),Pe(Cp,O),Pe(Ap,z),Pe(Dp,Ee),Pe(Np,se),Pe($p,ve),Pe(hr,x),Pe(ao,F),Pe(Op,ie),Fe(oe))if(oe.length){const Me=e.exposed||(e.exposed={});oe.forEach(Re=>{Object.defineProperty(Me,Re,{get:()=>n[Re],set:Ke=>n[Re]=Ke,enumerable:!0})})}else e.exposed||(e.exposed={});re&&e.render===Hn&&(e.render=re),ye!=null&&(e.inheritAttrs=ye),X&&(e.components=X),ke&&(e.directives=ke),ie&&Ud(e)}function Wp(e,t,n=Hn){Fe(e)&&(e=Pa(e));for(const r in e){const s=e[r];let o;gt(s)?"default"in s?o=En(s.from||r,s.default,!0):o=En(s.from||r):o=En(s),en(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function tc(e,t,n){Pn(Fe(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Wd(e,t,n,r){let s=r.includes(".")?Pd(n,r):()=>n[r];if(Pt(e)){const o=t[e];Ve(o)&&ut(s,o)}else if(Ve(e))ut(s,e.bind(n));else if(gt(e))if(Fe(e))e.forEach(o=>Wd(o,t,n,r));else{const o=Ve(e.handler)?e.handler.bind(n):t[e.handler];Ve(o)&&ut(s,o,e)}}function Vd(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(d=>qo(l,d,i,!0)),qo(l,t,i)),gt(t)&&o.set(t,l),l}function qo(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&qo(e,o,n,!0),s&&s.forEach(i=>qo(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=Vp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Vp={data:nc,props:rc,emits:rc,methods:Ns,computed:Ns,beforeCreate:nn,created:nn,beforeMount:nn,mounted:nn,beforeUpdate:nn,updated:nn,beforeDestroy:nn,beforeUnmount:nn,destroyed:nn,unmounted:nn,activated:nn,deactivated:nn,errorCaptured:nn,serverPrefetch:nn,components:Ns,directives:Ns,watch:Gp,provide:nc,inject:zp};function nc(e,t){return t?e?function(){return Dt(Ve(e)?e.call(this,this):e,Ve(t)?t.call(this,this):t)}:t:e}function zp(e,t){return Ns(Pa(e),Pa(t))}function Pa(e){if(Fe(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function nn(e,t){return e?[...new Set([].concat(e,t))]:t}function Ns(e,t){return e?Dt(Object.create(null),e,t):t}function rc(e,t){return e?Fe(e)&&Fe(t)?[...new Set([...e,...t])]:Dt(Object.create(null),ec(e),ec(t??{})):t}function Gp(e,t){if(!e)return t;if(!t)return e;const n=Dt(Object.create(null),e);for(const r in t)n[r]=nn(e[r],t[r]);return n}function zd(){return{app:null,config:{isNativeTag:Zu,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 qp=0;function Kp(e,t){return function(r,s=null){Ve(r)||(r=Dt({},r)),s!=null&&!gt(s)&&(s=null);const o=zd(),i=new WeakSet,a=[];let l=!1;const d=o.app={_uid:qp++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Sm,get config(){return o.config},set config(c){},use(c,...h){return i.has(c)||(c&&Ve(c.install)?(i.add(c),c.install(d,...h)):Ve(c)&&(i.add(c),c(d,...h))),d},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),d},component(c,h){return h?(o.components[c]=h,d):o.components[c]},directive(c,h){return h?(o.directives[c]=h,d):o.directives[c]},mount(c,h,v){if(!l){const E=d._ceVNode||xe(r,s);return E.appContext=o,v===!0?v="svg":v===!1&&(v=void 0),e(E,c,v),l=!0,d._container=c,c.__vue_app__=d,vi(E.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Pn(a,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,h){return o.provides[c]=h,d},runWithContext(c){const h=ds;ds=d;try{return c()}finally{ds=h}}};return d}}let ds=null;const Jp=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${an(t)}Modifiers`]||e[`${Mr(t)}Modifiers`];function Yp(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Et;let s=n;const o=t.startsWith("update:"),i=o&&Jp(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Pt(c)?c.trim():c)),i.number&&(s=n.map(nl)));let a,l=r[a=Ui(t)]||r[a=Ui(an(t))];!l&&o&&(l=r[a=Ui(Mr(t))]),l&&Pn(l,e,6,s);const d=r[a+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Pn(d,e,6,s)}}const Xp=new WeakMap;function Gd(e,t,n=!1){const r=n?Xp:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!Ve(e)){const l=d=>{const c=Gd(d,t,!0);c&&(a=!0,Dt(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(gt(e)&&r.set(e,null),null):(Fe(o)?o.forEach(l=>i[l]=null):Dt(i,o),gt(e)&&r.set(e,i),i)}function mi(e,t){return!e||!oi(t)?!1:(t=t.slice(2).replace(/Once$/,""),mt(e,t[0].toLowerCase()+t.slice(1))||mt(e,Mr(t))||mt(e,t))}function sc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:d,renderCache:c,props:h,data:v,setupState:E,ctx:D,inheritAttrs:O}=e,z=Wo(e);let R,x;try{if(n.shapeFlag&4){const F=s||r,re=F;R=Ln(d.call(re,F,c,h,E,v,D)),x=a}else{const F=t;R=Ln(F.length>1?F(h,{attrs:a,slots:i,emit:l}):F(h,null)),x=t.props?a:Qp(a)}}catch(F){Hs.length=0,fi(F,e,1),R=xe(Qt)}let H=R;if(x&&O!==!1){const F=Object.keys(x),{shapeFlag:re}=H;F.length&&re&7&&(o&&F.some(ii)&&(x=Zp(x,o)),H=xr(H,x,!1,!0))}return n.dirs&&(H=xr(H,null,!1,!0),H.dirs=H.dirs?H.dirs.concat(n.dirs):n.dirs),n.transition&&Ks(H,n.transition),R=H,Wo(z),R}const Qp=e=>{let t;for(const n in e)(n==="class"||n==="style"||oi(n))&&((t||(t={}))[n]=e[n]);return t},Zp=(e,t)=>{const n={};for(const r in e)(!ii(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function em(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,d=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?oc(r,i,d):!!i;if(l&8){const c=t.dynamicProps;for(let h=0;h<c.length;h++){const v=c[h];if(qd(i,r,v)&&!mi(d,v))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?oc(r,i,d):!0:!!i;return!1}function oc(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(qd(t,e,o)&&!mi(n,o))return!0}return!1}function qd(e,t,n){const r=e[n],s=t[n];return n==="style"&>(r)&>(s)?!rl(r,s):r!==s}function tm({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Kd={},Jd=()=>Object.create(Kd),Yd=e=>Object.getPrototypeOf(e)===Kd;function nm(e,t,n,r=!1){const s={},o=Jd();e.propsDefaults=Object.create(null),Xd(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:kd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function rm(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=dt(s),[l]=e.propsOptions;let d=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let h=0;h<c.length;h++){let v=c[h];if(mi(e.emitsOptions,v))continue;const E=t[v];if(l)if(mt(o,v))E!==o[v]&&(o[v]=E,d=!0);else{const D=an(v);s[D]=xa(l,a,D,E,e,!1)}else E!==o[v]&&(o[v]=E,d=!0)}}}else{Xd(e,t,s,o)&&(d=!0);let c;for(const h in a)(!t||!mt(t,h)&&((c=Mr(h))===h||!mt(t,c)))&&(l?n&&(n[h]!==void 0||n[c]!==void 0)&&(s[h]=xa(l,a,h,void 0,e,!0)):delete s[h]);if(o!==a)for(const h in o)(!t||!mt(t,h))&&(delete o[h],d=!0)}d&&er(e.attrs,"set","")}function Xd(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Ds(l))continue;const d=t[l];let c;s&&mt(s,c=an(l))?!o||!o.includes(c)?n[c]=d:(a||(a={}))[c]=d:mi(e.emitsOptions,l)||(!(l in r)||d!==r[l])&&(r[l]=d,i=!0)}if(o){const l=dt(n),d=a||Et;for(let c=0;c<o.length;c++){const h=o[c];n[h]=xa(s,l,h,d[h],e,!mt(d,h))}}return i}function xa(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=mt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Ve(l)){const{propsDefaults:d}=s;if(n in d)r=d[n];else{const c=lo(s);r=d[n]=l.call(null,t),c()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===Mr(n))&&(r=!0))}return r}const sm=new WeakMap;function Qd(e,t,n=!1){const r=n?sm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!Ve(e)){const c=h=>{l=!0;const[v,E]=Qd(h,t,!0);Dt(i,v),E&&a.push(...E)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return gt(e)&&r.set(e,as),as;if(Fe(o))for(let c=0;c<o.length;c++){const h=an(o[c]);ic(h)&&(i[h]=Et)}else if(o)for(const c in o){const h=an(c);if(ic(h)){const v=o[c],E=i[h]=Fe(v)||Ve(v)?{type:v}:Dt({},v),D=E.type;let O=!1,z=!0;if(Fe(D))for(let R=0;R<D.length;++R){const x=D[R],H=Ve(x)&&x.name;if(H==="Boolean"){O=!0;break}else H==="String"&&(z=!1)}else O=Ve(D)&&D.name==="Boolean";E[0]=O,E[1]=z,(O||mt(E,"default"))&&a.push(h)}}const d=[i,a];return gt(e)&&r.set(e,d),d}function ic(e){return e[0]!=="$"&&!Ds(e)}const hl=e=>e==="_"||e==="_ctx"||e==="$stable",pl=e=>Fe(e)?e.map(Ln):[Ln(e)],om=(e,t,n)=>{if(t._n)return t;const r=_t((...s)=>pl(t(...s)),n);return r._c=!1,r},Zd=(e,t,n)=>{const r=e._ctx;for(const s in e){if(hl(s))continue;const o=e[s];if(Ve(o))t[s]=om(s,o,r);else if(o!=null){const i=pl(o);t[s]=()=>i}}},ef=(e,t)=>{const n=pl(t);e.slots.default=()=>n},tf=(e,t,n)=>{for(const r in t)(n||!hl(r))&&(e[r]=t[r])},im=(e,t,n)=>{const r=e.slots=Jd();if(e.vnode.shapeFlag&32){const s=t._;s?(tf(r,t,n),n&&sd(r,"_",s,!0)):Zd(t,r)}else t&&ef(e,t)},am=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Et;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:tf(s,t,n):(o=!t.$stable,Zd(t,s)),i=t}else t&&(ef(e,t),i={default:1});if(o)for(const a in s)!hl(a)&&i[a]==null&&delete s[a]},Yt=fm;function lm(e){return cm(e)}function cm(e,t){const n=ci();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:d,setElementText:c,parentNode:h,nextSibling:v,setScopeId:E=Hn,insertStaticContent:D}=e,O=(y,_,M,Y=null,G=null,$=null,W=void 0,B=null,Z=!!_.dynamicChildren)=>{if(y===_)return;y&&!Hr(y,_)&&(Y=J(y),Je(y,G,$,!0),y=null),_.patchFlag===-2&&(Z=!1,_.dynamicChildren=null);const{type:q,ref:we,shapeFlag:de}=_;switch(q){case gi:z(y,_,M,Y);break;case Qt:R(y,_,M,Y);break;case qi:y==null&&x(_,M,Y,W);break;case Ue:X(y,_,M,Y,G,$,W,B,Z);break;default:de&1?re(y,_,M,Y,G,$,W,B,Z):de&6?ke(y,_,M,Y,G,$,W,B,Z):(de&64||de&128)&&q.process(y,_,M,Y,G,$,W,B,Z,Ce)}we!=null&&G?Fs(we,y&&y.ref,$,_||y,!_):we==null&&y&&y.ref!=null&&Fs(y.ref,null,$,y,!0)},z=(y,_,M,Y)=>{if(y==null)r(_.el=a(_.children),M,Y);else{const G=_.el=y.el;_.children!==y.children&&d(G,_.children)}},R=(y,_,M,Y)=>{y==null?r(_.el=l(_.children||""),M,Y):_.el=y.el},x=(y,_,M,Y)=>{[y.el,y.anchor]=D(y.children,_,M,Y,y.el,y.anchor)},H=({el:y,anchor:_},M,Y)=>{let G;for(;y&&y!==_;)G=v(y),r(y,M,Y),y=G;r(_,M,Y)},F=({el:y,anchor:_})=>{let M;for(;y&&y!==_;)M=v(y),s(y),y=M;s(_)},re=(y,_,M,Y,G,$,W,B,Z)=>{if(_.type==="svg"?W="svg":_.type==="math"&&(W="mathml"),y==null)se(_,M,Y,G,$,W,B,Z);else{const q=y.el&&y.el._isVueCE?y.el:null;try{q&&q._beginPatch(),ie(y,_,G,$,W,B,Z)}finally{q&&q._endPatch()}}},se=(y,_,M,Y,G,$,W,B)=>{let Z,q;const{props:we,shapeFlag:de,transition:ge,dirs:Ae}=y;if(Z=y.el=i(y.type,$,we&&we.is,we),de&8?c(Z,y.children):de&16&&Ee(y.children,Z,null,Y,G,Gi(y,$),W,B),Ae&&Nr(y,null,Y,"created"),ve(Z,y,y.scopeId,W,Y),we){for(const We in we)We!=="value"&&!Ds(We)&&o(Z,We,null,we[We],$,Y);"value"in we&&o(Z,"value",null,we.value,$),(q=we.onVnodeBeforeMount)&&On(q,Y,y)}Ae&&Nr(y,null,Y,"beforeMount");const Be=um(G,ge);Be&&ge.beforeEnter(Z),r(Z,_,M),((q=we&&we.onVnodeMounted)||Be||Ae)&&Yt(()=>{try{q&&On(q,Y,y),Be&&ge.enter(Z),Ae&&Nr(y,null,Y,"mounted")}finally{}},G)},ve=(y,_,M,Y,G)=>{if(M&&E(y,M),Y)for(let $=0;$<Y.length;$++)E(y,Y[$]);if(G){let $=G.subTree;if(_===$||sf($.type)&&($.ssContent===_||$.ssFallback===_)){const W=G.vnode;ve(y,W,W.scopeId,W.slotScopeIds,G.parent)}}},Ee=(y,_,M,Y,G,$,W,B,Z=0)=>{for(let q=Z;q<y.length;q++){const we=y[q]=B?Zn(y[q]):Ln(y[q]);O(null,we,_,M,Y,G,$,W,B)}},ie=(y,_,M,Y,G,$,W)=>{const B=_.el=y.el;let{patchFlag:Z,dynamicChildren:q,dirs:we}=_;Z|=y.patchFlag&16;const de=y.props||Et,ge=_.props||Et;let Ae;if(M&&Dr(M,!1),(Ae=ge.onVnodeBeforeUpdate)&&On(Ae,M,_,y),we&&Nr(_,y,M,"beforeUpdate"),M&&Dr(M,!0),(de.innerHTML&&ge.innerHTML==null||de.textContent&&ge.textContent==null)&&c(B,""),q?oe(y.dynamicChildren,q,B,M,Y,Gi(_,G),$):W||Re(y,_,B,null,M,Y,Gi(_,G),$,!1),Z>0){if(Z&16)ye(B,de,ge,M,G);else if(Z&2&&de.class!==ge.class&&o(B,"class",null,ge.class,G),Z&4&&o(B,"style",de.style,ge.style,G),Z&8){const Be=_.dynamicProps;for(let We=0;We<Be.length;We++){const ze=Be[We],Ze=de[ze],at=ge[ze];(at!==Ze||ze==="value")&&o(B,ze,Ze,at,G,M)}}Z&1&&y.children!==_.children&&c(B,_.children)}else!W&&q==null&&ye(B,de,ge,M,G);((Ae=ge.onVnodeUpdated)||we)&&Yt(()=>{Ae&&On(Ae,M,_,y),we&&Nr(_,y,M,"updated")},Y)},oe=(y,_,M,Y,G,$,W)=>{for(let B=0;B<_.length;B++){const Z=y[B],q=_[B],we=Z.el&&(Z.type===Ue||!Hr(Z,q)||Z.shapeFlag&198)?h(Z.el):M;O(Z,q,we,null,Y,G,$,W,!0)}},ye=(y,_,M,Y,G)=>{if(_!==M){if(_!==Et)for(const $ in _)!Ds($)&&!($ in M)&&o(y,$,_[$],null,G,Y);for(const $ in M){if(Ds($))continue;const W=M[$],B=_[$];W!==B&&$!=="value"&&o(y,$,B,W,G,Y)}"value"in M&&o(y,"value",_.value,M.value,G)}},X=(y,_,M,Y,G,$,W,B,Z)=>{const q=_.el=y?y.el:a(""),we=_.anchor=y?y.anchor:a("");let{patchFlag:de,dynamicChildren:ge,slotScopeIds:Ae}=_;Ae&&(B=B?B.concat(Ae):Ae),y==null?(r(q,M,Y),r(we,M,Y),Ee(_.children||[],M,we,G,$,W,B,Z)):de>0&&de&64&&ge&&y.dynamicChildren&&y.dynamicChildren.length===ge.length?(oe(y.dynamicChildren,ge,M,G,$,W,B),(_.key!=null||G&&_===G.subTree)&&ml(y,_,!0)):Re(y,_,M,we,G,$,W,B,Z)},ke=(y,_,M,Y,G,$,W,B,Z)=>{_.slotScopeIds=B,y==null?_.shapeFlag&512?G.ctx.activate(_,M,Y,W,Z):Oe(_,M,Y,G,$,W,Z):je(y,_,Z)},Oe=(y,_,M,Y,G,$,W)=>{const B=y.component=ym(y,Y,G);if(hi(y)&&(B.ctx.renderer=Ce),wm(B,!1,W),B.asyncDep){if(G&&G.registerDep(B,Pe,W),!y.el){const Z=B.subTree=xe(Qt);R(null,Z,_,M),y.placeholder=Z.el}}else Pe(B,y,_,M,G,$,W)},je=(y,_,M)=>{const Y=_.component=y.component;if(em(y,_,M))if(Y.asyncDep&&!Y.asyncResolved){Me(Y,_,M);return}else Y.next=_,Y.update();else _.el=y.el,Y.vnode=_},Pe=(y,_,M,Y,G,$,W)=>{const B=()=>{if(y.isMounted){let{next:de,bu:ge,u:Ae,parent:Be,vnode:We}=y;{const vt=nf(y);if(vt){de&&(de.el=We.el,Me(y,de,W)),vt.asyncDep.then(()=>{Yt(()=>{y.isUnmounted||q()},G)});return}}let ze=de,Ze;Dr(y,!1),de?(de.el=We.el,Me(y,de,W)):de=We,ge&&xo(ge),(Ze=de.props&&de.props.onVnodeBeforeUpdate)&&On(Ze,Be,de,We),Dr(y,!0);const at=sc(y),ht=y.subTree;y.subTree=at,O(ht,at,h(ht.el),J(ht),y,G,$),de.el=at.el,ze===null&&tm(y,at.el),Ae&&Yt(Ae,G),(Ze=de.props&&de.props.onVnodeUpdated)&&Yt(()=>On(Ze,Be,de,We),G)}else{let de;const{el:ge,props:Ae}=_,{bm:Be,m:We,parent:ze,root:Ze,type:at}=y,ht=us(_);Dr(y,!1),Be&&xo(Be),!ht&&(de=Ae&&Ae.onVnodeBeforeMount)&&On(de,ze,_),Dr(y,!0);{Ze.ce&&Ze.ce._hasShadowRoot()&&Ze.ce._injectChildStyle(at,y.parent?y.parent.type:void 0);const vt=y.subTree=sc(y);O(null,vt,M,Y,y,G,$),_.el=vt.el}if(We&&Yt(We,G),!ht&&(de=Ae&&Ae.onVnodeMounted)){const vt=_;Yt(()=>On(de,ze,vt),G)}(_.shapeFlag&256||ze&&us(ze.vnode)&&ze.vnode.shapeFlag&256)&&y.a&&Yt(y.a,G),y.isMounted=!0,_=M=Y=null}};y.scope.on();const Z=y.effect=new ld(B);y.scope.off();const q=y.update=Z.run.bind(Z),we=y.job=Z.runIfDirty.bind(Z);we.i=y,we.id=y.uid,Z.scheduler=()=>dl(we),Dr(y,!0),q()},Me=(y,_,M)=>{_.component=y;const Y=y.vnode.props;y.vnode=_,y.next=null,rm(y,_.props,Y,M),am(y,_.children,M),or(),ql(y),ir()},Re=(y,_,M,Y,G,$,W,B,Z=!1)=>{const q=y&&y.children,we=y?y.shapeFlag:0,de=_.children,{patchFlag:ge,shapeFlag:Ae}=_;if(ge>0){if(ge&128){Xe(q,de,M,Y,G,$,W,B,Z);return}else if(ge&256){Ke(q,de,M,Y,G,$,W,B,Z);return}}Ae&8?(we&16&&Ye(q,G,$),de!==q&&c(M,de)):we&16?Ae&16?Xe(q,de,M,Y,G,$,W,B,Z):Ye(q,G,$,!0):(we&8&&c(M,""),Ae&16&&Ee(de,M,Y,G,$,W,B,Z))},Ke=(y,_,M,Y,G,$,W,B,Z)=>{y=y||as,_=_||as;const q=y.length,we=_.length,de=Math.min(q,we);let ge;for(ge=0;ge<de;ge++){const Ae=_[ge]=Z?Zn(_[ge]):Ln(_[ge]);O(y[ge],Ae,M,null,G,$,W,B,Z)}q>we?Ye(y,G,$,!0,!1,de):Ee(_,M,Y,G,$,W,B,Z,de)},Xe=(y,_,M,Y,G,$,W,B,Z)=>{let q=0;const we=_.length;let de=y.length-1,ge=we-1;for(;q<=de&&q<=ge;){const Ae=y[q],Be=_[q]=Z?Zn(_[q]):Ln(_[q]);if(Hr(Ae,Be))O(Ae,Be,M,null,G,$,W,B,Z);else break;q++}for(;q<=de&&q<=ge;){const Ae=y[de],Be=_[ge]=Z?Zn(_[ge]):Ln(_[ge]);if(Hr(Ae,Be))O(Ae,Be,M,null,G,$,W,B,Z);else break;de--,ge--}if(q>de){if(q<=ge){const Ae=ge+1,Be=Ae<we?_[Ae].el:Y;for(;q<=ge;)O(null,_[q]=Z?Zn(_[q]):Ln(_[q]),M,Be,G,$,W,B,Z),q++}}else if(q>ge)for(;q<=de;)Je(y[q],G,$,!0),q++;else{const Ae=q,Be=q,We=new Map;for(q=Be;q<=ge;q++){const yt=_[q]=Z?Zn(_[q]):Ln(_[q]);yt.key!=null&&We.set(yt.key,q)}let ze,Ze=0;const at=ge-Be+1;let ht=!1,vt=0;const Mt=new Array(at);for(q=0;q<at;q++)Mt[q]=0;for(q=Ae;q<=de;q++){const yt=y[q];if(Ze>=at){Je(yt,G,$,!0);continue}let lt;if(yt.key!=null)lt=We.get(yt.key);else for(ze=Be;ze<=ge;ze++)if(Mt[ze-Be]===0&&Hr(yt,_[ze])){lt=ze;break}lt===void 0?Je(yt,G,$,!0):(Mt[lt-Be]=q+1,lt>=vt?vt=lt:ht=!0,O(yt,_[lt],M,null,G,$,W,B,Z),Ze++)}const Ot=ht?dm(Mt):as;for(ze=Ot.length-1,q=at-1;q>=0;q--){const yt=Be+q,lt=_[yt],Rt=_[yt+1],jt=yt+1<we?Rt.el||rf(Rt):Y;Mt[q]===0?O(null,lt,M,jt,G,$,W,B,Z):ht&&(ze<0||q!==Ot[ze]?$e(lt,M,jt,2):ze--)}}},$e=(y,_,M,Y,G=null)=>{const{el:$,type:W,transition:B,children:Z,shapeFlag:q}=y;if(q&6){$e(y.component.subTree,_,M,Y);return}if(q&128){y.suspense.move(_,M,Y);return}if(q&64){W.move(y,_,M,Ce);return}if(W===Ue){r($,_,M);for(let de=0;de<Z.length;de++)$e(Z[de],_,M,Y);r(y.anchor,_,M);return}if(W===qi){H(y,_,M);return}if(Y!==2&&q&1&&B)if(Y===0)B.beforeEnter($),r($,_,M),Yt(()=>B.enter($),G);else{const{leave:de,delayLeave:ge,afterLeave:Ae}=B,Be=()=>{y.ctx.isUnmounted?s($):r($,_,M)},We=()=>{$._isLeaving&&$[Nn](!0),de($,()=>{Be(),Ae&&Ae()})};ge?ge($,Be,We):We()}else r($,_,M)},Je=(y,_,M,Y=!1,G=!1)=>{const{type:$,props:W,ref:B,children:Z,dynamicChildren:q,shapeFlag:we,patchFlag:de,dirs:ge,cacheIndex:Ae,memo:Be}=y;if(de===-2&&(G=!1),B!=null&&(or(),Fs(B,null,M,y,!0),ir()),Ae!=null&&(_.renderCache[Ae]=void 0),we&256){_.ctx.deactivate(y);return}const We=we&1&&ge,ze=!us(y);let Ze;if(ze&&(Ze=W&&W.onVnodeBeforeUnmount)&&On(Ze,_,y),we&6)Qe(y.component,M,Y);else{if(we&128){y.suspense.unmount(M,Y);return}We&&Nr(y,null,_,"beforeUnmount"),we&64?y.type.remove(y,_,M,Ce,Y):q&&!q.hasOnce&&($!==Ue||de>0&&de&64)?Ye(q,_,M,!1,!0):($===Ue&&de&384||!G&&we&16)&&Ye(Z,_,M),Y&&st(y)}const at=Be!=null&&Ae==null;(ze&&(Ze=W&&W.onVnodeUnmounted)||We||at)&&Yt(()=>{Ze&&On(Ze,_,y),We&&Nr(y,null,_,"unmounted"),at&&(y.el=null)},M)},st=y=>{const{type:_,el:M,anchor:Y,transition:G}=y;if(_===Ue){ot(M,Y);return}if(_===qi){F(y);return}const $=()=>{s(M),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(y.shapeFlag&1&&G&&!G.persisted){const{leave:W,delayLeave:B}=G,Z=()=>W(M,$);B?B(y.el,$,Z):Z()}else $()},ot=(y,_)=>{let M;for(;y!==_;)M=v(y),s(y),y=M;s(_)},Qe=(y,_,M)=>{const{bum:Y,scope:G,job:$,subTree:W,um:B,m:Z,a:q}=y;ac(Z),ac(q),Y&&xo(Y),G.stop(),$&&($.flags|=8,Je(W,y,_,M)),B&&Yt(B,_),Yt(()=>{y.isUnmounted=!0},_)},Ye=(y,_,M,Y=!1,G=!1,$=0)=>{for(let W=$;W<y.length;W++)Je(y[W],_,M,Y,G)},J=y=>{if(y.shapeFlag&6)return J(y.component.subTree);if(y.shapeFlag&128)return y.suspense.next();const _=v(y.anchor||y.el),M=_&&_[xd];return M?v(M):_};let he=!1;const pe=(y,_,M)=>{let Y;y==null?_._vnode&&(Je(_._vnode,null,null,!0),Y=_._vnode.component):O(_._vnode||null,y,_,null,null,null,M),_._vnode=y,he||(he=!0,ql(Y),Cd(),he=!1)},Ce={p:O,um:Je,m:$e,r:st,mt:Oe,mc:Ee,pc:Re,pbc:oe,n:J,o:e};return{render:pe,hydrate:void 0,createApp:Kp(pe)}}function Gi({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 Dr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function um(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ml(e,t,n=!1){const r=e.children,s=t.children;if(Fe(r)&&Fe(s))for(let o=0;o<r.length;o++){const i=r[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=Zn(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&ml(i,a)),a.type===gi&&(a.patchFlag===-1&&(a=s[o]=Zn(a)),a.el=i.el),a.type===Qt&&!a.el&&(a.el=i.el)}}function dm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const d=e[r];if(d!==0){if(s=n[n.length-1],e[s]<d){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<d?o=a+1:i=a;d<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function nf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:nf(t)}function ac(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function rf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?rf(t.subTree):null}const sf=e=>e.__isSuspense;function fm(e,t){t&&t.pendingBranch?Fe(e)?t.effects.push(...e):t.effects.push(e):vp(e)}const Ue=Symbol.for("v-fgt"),gi=Symbol.for("v-txt"),Qt=Symbol.for("v-cmt"),qi=Symbol.for("v-stc"),Hs=[];let pn=null;function b(e=!1){Hs.push(pn=e?null:[])}function hm(){Hs.pop(),pn=Hs[Hs.length-1]||null}let Js=1;function Ko(e,t=!1){Js+=e,e<0&&pn&&t&&(pn.hasOnce=!0)}function of(e){return e.dynamicChildren=Js>0?pn||as:null,hm(),Js>0&&pn&&pn.push(e),e}function I(e,t,n,r,s,o){return of(m(e,t,n,r,s,o,!0))}function ft(e,t,n,r,s){return of(xe(e,t,n,r,s,!0))}function Ys(e){return e?e.__v_isVNode===!0:!1}function Hr(e,t){return e.type===t.type&&e.key===t.key}const af=({key:e})=>e??null,$o=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Pt(e)||en(e)||Ve(e)?{i:zt,r:e,k:t,f:!!n}:e:null);function m(e,t=null,n=null,r=0,s=null,o=e===Ue?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&af(t),ref:t&&$o(t),scopeId:Rd,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:zt};return a?(gl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Pt(n)?8:16),Js>0&&!i&&pn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&pn.push(l),l}const xe=pm;function pm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Bd)&&(e=Qt),Ys(e)){const a=xr(e,t,!0);return n&&gl(a,n),Js>0&&!o&&pn&&(a.shapeFlag&6?pn[pn.indexOf(e)]=a:pn.push(a)),a.patchFlag=-2,a}if(Tm(e)&&(e=e.__vccOpts),t){t=mm(t);let{class:a,style:l}=t;a&&!Pt(a)&&(t.class=nt(a)),gt(l)&&(ul(l)&&!Fe(l)&&(l=Dt({},l)),t.style=Jr(l))}const i=Pt(e)?1:sf(e)?128:Md(e)?64:gt(e)?4:Ve(e)?2:0;return m(e,t,n,r,s,i,o,!0)}function mm(e){return e?ul(e)||Yd(e)?Dt({},e):e:null}function xr(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,d=t?lf(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&af(d),ref:t&&t.ref?n&&o?Fe(o)?o.concat($o(t)):[o,$o(t)]:$o(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ue?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&xr(e.ssContent),ssFallback:e.ssFallback&&xr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ks(c,l.clone(c)),c}function Xs(e=" ",t=0){return xe(gi,null,e,t)}function le(e="",t=!1){return t?(b(),ft(Qt,null,e)):xe(Qt,null,e)}function Ln(e){return e==null||typeof e=="boolean"?xe(Qt):Fe(e)?xe(Ue,null,e.slice()):Ys(e)?Zn(e):xe(gi,null,String(e))}function Zn(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:xr(e)}function gl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Fe(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),gl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Yd(t)?t._ctx=zt:s===3&&zt&&(zt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ve(t)?(t={default:t,_ctx:zt},n=32):(t=String(t),r&64?(n=16,t=[Xs(t)]):n=8);e.children=t,e.shapeFlag|=n}function lf(...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=nt([t.class,r.class]));else if(s==="style")t.style=Jr([t.style,r.style]);else if(oi(s)){const o=t[s],i=r[s];i&&o!==i&&!(Fe(o)&&o.includes(i))?t[s]=o?[].concat(o,i):i:i==null&&o==null&&!ii(s)&&(t[s]=i)}else s!==""&&(t[s]=r[s])}return t}function On(e,t,n,r=null){Pn(e,t,7,[n,r])}const gm=zd();let vm=0;function ym(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||gm,o={uid:vm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Bh(!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:Qd(r,s),emitsOptions:Gd(r,s),emit:null,emitted:null,propsDefaults:Et,inheritAttrs:r.inheritAttrs,ctx:Et,data:Et,props:Et,attrs:Et,slots:Et,refs:Et,setupState:Et,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=Yp.bind(null,o),e.ce&&e.ce(o),o}let Zt=null;const vl=()=>Zt||zt;let Jo,Ma;{const e=ci(),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)}};Jo=t("__VUE_INSTANCE_SETTERS__",n=>Zt=n),Ma=t("__VUE_SSR_SETTERS__",n=>Qs=n)}const lo=e=>{const t=Zt;return Jo(e),e.scope.on(),()=>{e.scope.off(),Jo(t)}},lc=()=>{Zt&&Zt.scope.off(),Jo(null)};function cf(e){return e.vnode.shapeFlag&4}let Qs=!1;function wm(e,t=!1,n=!1){t&&Ma(t);const{props:r,children:s}=e.vnode,o=cf(e);nm(e,r,o,t),im(e,s,n||t);const i=o?bm(e,t):void 0;return t&&Ma(!1),i}function bm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Up);const{setup:r}=n;if(r){or();const s=e.setupContext=r.length>1?df(e):null,o=lo(e),i=io(r,e,0,[e.props,s]),a=td(i);if(ir(),o(),(a||e.sp)&&!us(e)&&Ud(e),a){if(i.then(lc,lc),t)return i.then(l=>{cc(e,l)}).catch(l=>{fi(l,e,0)});e.asyncDep=i}else cc(e,i)}else uf(e)}function cc(e,t,n){Ve(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:gt(t)&&(e.setupState=Sd(t)),uf(e)}function uf(e,t,n){const r=e.type;e.render||(e.render=r.render||Hn);{const s=lo(e);or();try{Hp(e)}finally{ir(),s()}}}const _m={get(e,t){return Xt(e,"get",""),e[t]}};function df(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,_m),slots:e.slots,emit:e.emit,expose:t}}function vi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Sd(ap(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Bs)return Bs[n](e)},has(t,n){return n in t||n in Bs}})):e.proxy}function km(e,t=!0){return Ve(e)?e.displayName||e.name:e.name||t&&e.__name}function Tm(e){return Ve(e)&&"__vccOpts"in e}const fe=(e,t)=>fp(e,t,Qs);function yl(e,t,n){try{Ko(-1);const r=arguments.length;return r===2?gt(t)&&!Fe(t)?Ys(t)?xe(e,null,[t]):xe(e,t):xe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ys(n)&&(n=[n]),xe(e,t,n))}finally{Ko(1)}}const Sm="3.5.31";/**
|
|
14
|
+
* @vue/runtime-dom v3.5.31
|
|
15
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
16
|
+
* @license MIT
|
|
17
|
+
**/let Oa;const uc=typeof window<"u"&&window.trustedTypes;if(uc)try{Oa=uc.createPolicy("vue",{createHTML:e=>e})}catch{}const ff=Oa?e=>Oa.createHTML(e):e=>e,Im="http://www.w3.org/2000/svg",Em="http://www.w3.org/1998/Math/MathML",Qn=typeof document<"u"?document:null,dc=Qn&&Qn.createElement("template"),Cm={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"?Qn.createElementNS(Im,e):t==="mathml"?Qn.createElementNS(Em,e):n?Qn.createElement(e,{is:n}):Qn.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Qn.createTextNode(e),createComment:e=>Qn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Qn.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{dc.innerHTML=ff(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=dc.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},wr="transition",xs="animation",Zs=Symbol("_vtc"),hf={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},Am=Dt({},$d,hf),Rm=e=>(e.displayName="Transition",e.props=Am,e),pf=Rm((e,{slots:t})=>yl(Ep,Pm(e),t)),Lr=(e,t=[])=>{Fe(e)?e.forEach(n=>n(...t)):e&&e(...t)},fc=e=>e?Fe(e)?e.some(t=>t.length>1):e.length>1:!1;function Pm(e){const t={};for(const X in e)X in hf||(t[X]=e[X]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:d=i,appearToClass:c=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:v=`${n}-leave-active`,leaveToClass:E=`${n}-leave-to`}=e,D=xm(s),O=D&&D[0],z=D&&D[1],{onBeforeEnter:R,onEnter:x,onEnterCancelled:H,onLeave:F,onLeaveCancelled:re,onBeforeAppear:se=R,onAppear:ve=x,onAppearCancelled:Ee=H}=t,ie=(X,ke,Oe,je)=>{X._enterCancelled=je,jr(X,ke?c:a),jr(X,ke?d:i),Oe&&Oe()},oe=(X,ke)=>{X._isLeaving=!1,jr(X,h),jr(X,E),jr(X,v),ke&&ke()},ye=X=>(ke,Oe)=>{const je=X?ve:x,Pe=()=>ie(ke,X,Oe);Lr(je,[ke,Pe]),hc(()=>{jr(ke,X?l:o),Yn(ke,X?c:a),fc(je)||pc(ke,r,O,Pe)})};return Dt(t,{onBeforeEnter(X){Lr(R,[X]),Yn(X,o),Yn(X,i)},onBeforeAppear(X){Lr(se,[X]),Yn(X,l),Yn(X,d)},onEnter:ye(!1),onAppear:ye(!0),onLeave(X,ke){X._isLeaving=!0;const Oe=()=>oe(X,ke);Yn(X,h),X._enterCancelled?(Yn(X,v),vc(X)):(vc(X),Yn(X,v)),hc(()=>{X._isLeaving&&(jr(X,h),Yn(X,E),fc(F)||pc(X,r,z,Oe))}),Lr(F,[X,Oe])},onEnterCancelled(X){ie(X,!1,void 0,!0),Lr(H,[X])},onAppearCancelled(X){ie(X,!0,void 0,!0),Lr(Ee,[X])},onLeaveCancelled(X){oe(X),Lr(re,[X])}})}function xm(e){if(e==null)return null;if(gt(e))return[Ki(e.enter),Ki(e.leave)];{const t=Ki(e);return[t,t]}}function Ki(e){return Oh(e)}function Yn(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Zs]||(e[Zs]=new Set)).add(t)}function jr(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 hc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Mm=0;function pc(e,t,n,r){const s=e._endId=++Mm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Om(e,t);if(!i)return r();const d=i+"end";let c=0;const h=()=>{e.removeEventListener(d,v),o()},v=E=>{E.target===e&&++c>=l&&h()};setTimeout(()=>{c<l&&h()},a+1),e.addEventListener(d,v)}function Om(e,t){const n=window.getComputedStyle(e),r=D=>(n[D]||"").split(", "),s=r(`${wr}Delay`),o=r(`${wr}Duration`),i=mc(s,o),a=r(`${xs}Delay`),l=r(`${xs}Duration`),d=mc(a,l);let c=null,h=0,v=0;t===wr?i>0&&(c=wr,h=i,v=o.length):t===xs?d>0&&(c=xs,h=d,v=l.length):(h=Math.max(i,d),c=h>0?i>d?wr:xs:null,v=c?c===wr?o.length:l.length:0);const E=c===wr&&/\b(?:transform|all)(?:,|$)/.test(r(`${wr}Property`).toString());return{type:c,timeout:h,propCount:v,hasTransform:E}}function mc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>gc(n)+gc(e[r])))}function gc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function vc(e){return(e?e.ownerDocument:document).body.offsetHeight}function $m(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 yc=Symbol("_vod"),Nm=Symbol("_vsh"),Dm=Symbol(""),Lm=/(?:^|;)\s*display\s*:/;function jm(e,t,n){const r=e.style,s=Pt(n);let o=!1;if(n&&!s){if(t)if(Pt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&No(r,a,"")}else for(const i in t)n[i]==null&&No(r,i,"");for(const i in n)i==="display"&&(o=!0),No(r,i,n[i])}else if(s){if(t!==n){const i=r[Dm];i&&(n+=";"+i),r.cssText=n,o=Lm.test(n)}}else t&&e.removeAttribute("style");yc in e&&(e[yc]=o?r.display:"",e[Nm]&&(r.display="none"))}const wc=/\s*!important$/;function No(e,t,n){if(Fe(n))n.forEach(r=>No(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Um(e,t);wc.test(n)?e.setProperty(Mr(r),n.replace(wc,""),"important"):e[r]=n}}const bc=["Webkit","Moz","ms"],Ji={};function Um(e,t){const n=Ji[t];if(n)return n;let r=an(t);if(r!=="filter"&&r in e)return Ji[t]=r;r=li(r);for(let s=0;s<bc.length;s++){const o=bc[s]+r;if(o in e)return Ji[t]=o}return t}const _c="http://www.w3.org/1999/xlink";function kc(e,t,n,r,s,o=Uh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(_c,t.slice(6,t.length)):e.setAttributeNS(_c,t,n):n==null||o&&!od(n)?e.removeAttribute(t):e.setAttribute(t,o?"":An(n)?String(n):n)}function Tc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?ff(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const a=o==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=od(n):n==null&&a==="string"?(n="",i=!0):a==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function os(e,t,n,r){e.addEventListener(t,n,r)}function Fm(e,t,n,r){e.removeEventListener(t,n,r)}const Sc=Symbol("_vei");function Bm(e,t,n,r,s=null){const o=e[Sc]||(e[Sc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=Hm(t);if(r){const d=o[t]=zm(r,s);os(e,a,d,l)}else i&&(Fm(e,a,i,l),o[t]=void 0)}}const Ic=/(?:Once|Passive|Capture)$/;function Hm(e){let t;if(Ic.test(e)){t={};let r;for(;r=e.match(Ic);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Mr(e.slice(2)),t]}let Yi=0;const Wm=Promise.resolve(),Vm=()=>Yi||(Wm.then(()=>Yi=0),Yi=Date.now());function zm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Pn(Gm(r,n.value),t,5,[r])};return n.value=e,n.attached=Vm(),n}function Gm(e,t){if(Fe(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 Ec=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,qm=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?$m(e,r,i):t==="style"?jm(e,n,r):oi(t)?ii(t)||Bm(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Km(e,t,r,i))?(Tc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&kc(e,t,r,i,o,t!=="value")):e._isVueCE&&(Jm(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Pt(r)))?Tc(e,an(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),kc(e,t,r,i))};function Km(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ec(t)&&Ve(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 Ec(t)&&Pt(n)?!1:t in e}function Jm(e,t){const n=e._def.props;if(!n)return!1;const r=an(t);return Array.isArray(n)?n.some(s=>an(s)===r):Object.keys(n).some(s=>an(s)===r)}const Cc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Fe(t)?n=>xo(t,n):t};function Ym(e){e.target.composing=!0}function Ac(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Xi=Symbol("_assign");function Rc(e,t,n){return t&&(e=e.trim()),n&&(e=nl(e)),e}const cr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Xi]=Cc(s);const o=r||s.props&&s.props.type==="number";os(e,t?"change":"input",i=>{i.target.composing||e[Xi](Rc(e.value,n,o))}),(n||o)&&os(e,"change",()=>{e.value=Rc(e.value,n,o)}),t||(os(e,"compositionstart",Ym),os(e,"compositionend",Ac),os(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[Xi]=Cc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?nl(e.value):e.value,l=t??"";if(a===l)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},Xm=["ctrl","shift","alt","meta"],Qm={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)=>Xm.some(n=>e[`${n}Key`]&&!t.includes(n))},it=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...o)=>{for(let i=0;i<t.length;i++){const a=Qm[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},Zm={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},on=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Mr(s.key);if(t.some(i=>i===o||Zm[i]===o))return e(s)}))},eg=Dt({patchProp:qm},Cm);let Pc;function tg(){return Pc||(Pc=lm(eg))}const ng=((...e)=>{const t=tg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=sg(r);if(!s)return;const o=t._component;!Ve(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,rg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function rg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function sg(e){return Pt(e)?document.querySelector(e):e}/*!
|
|
18
|
+
* vue-router v4.6.4
|
|
19
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/const is=typeof document<"u";function mf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function og(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&mf(e.default)}const pt=Object.assign;function Qi(e,t){const n={};for(const r in t){const s=t[r];n[r]=xn(s)?s.map(e):e(s)}return n}const Ws=()=>{},xn=Array.isArray;function xc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const gf=/#/g,ig=/&/g,ag=/\//g,lg=/=/g,cg=/\?/g,vf=/\+/g,ug=/%5B/g,dg=/%5D/g,yf=/%5E/g,fg=/%60/g,wf=/%7B/g,hg=/%7C/g,bf=/%7D/g,pg=/%20/g;function wl(e){return e==null?"":encodeURI(""+e).replace(hg,"|").replace(ug,"[").replace(dg,"]")}function mg(e){return wl(e).replace(wf,"{").replace(bf,"}").replace(yf,"^")}function $a(e){return wl(e).replace(vf,"%2B").replace(pg,"+").replace(gf,"%23").replace(ig,"%26").replace(fg,"`").replace(wf,"{").replace(bf,"}").replace(yf,"^")}function gg(e){return $a(e).replace(lg,"%3D")}function vg(e){return wl(e).replace(gf,"%23").replace(cg,"%3F")}function yg(e){return vg(e).replace(ag,"%2F")}function eo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const wg=/\/$/,bg=e=>e.replace(wg,"");function Zi(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),o=t.slice(l,a>0?a:t.length),s=e(o.slice(1))),a>=0&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Sg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:eo(i)}}function _g(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Mc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function kg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&vs(t.matched[r],n.matched[s])&&_f(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function vs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function _f(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Tg(e[n],t[n]))return!1;return!0}function Tg(e,t){return xn(e)?Oc(e,t):xn(t)?Oc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Oc(e,t){return xn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Sg(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const br={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Na=(function(e){return e.pop="pop",e.push="push",e})({}),ea=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Ig(e){if(!e)if(is){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),bg(e)}const Eg=/^[^#]+#/;function Cg(e,t){return e.replace(Eg,"#")+t}function Ag(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 yi=()=>({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=Ag(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 $c(e,t){return(history.state?history.state.position-t:-1)+e}const Da=new Map;function Pg(e,t){Da.set(e,t)}function xg(e){const t=Da.get(e);return Da.delete(e),t}function Mg(e){return typeof e=="string"||e&&typeof e=="object"}function kf(e){return typeof e=="string"||typeof e=="symbol"}let xt=(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 Tf=Symbol("");xt.MATCHER_NOT_FOUND+"",xt.NAVIGATION_GUARD_REDIRECT+"",xt.NAVIGATION_ABORTED+"",xt.NAVIGATION_CANCELLED+"",xt.NAVIGATION_DUPLICATED+"";function ys(e,t){return pt(new Error,{type:e,[Tf]:!0},t)}function Xn(e,t){return e instanceof Error&&Tf in e&&(t==null||!!(e.type&t))}const Og=["params","query","hash"];function $g(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Og)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Ng(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(vf," "),o=s.indexOf("="),i=eo(o<0?s:s.slice(0,o)),a=o<0?null:eo(s.slice(o+1));if(i in t){let l=t[i];xn(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Nc(e){let t="";for(let n in e){const r=e[n];if(n=gg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(xn(r)?r.map(s=>s&&$a(s)):[r&&$a(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Dg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=xn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Lg=Symbol(""),Dc=Symbol(""),wi=Symbol(""),bl=Symbol(""),La=Symbol("");function Ms(){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 Sr(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const d=v=>{v===!1?l(ys(xt.NAVIGATION_ABORTED,{from:n,to:t})):v instanceof Error?l(v):Mg(v)?l(ys(xt.NAVIGATION_GUARD_REDIRECT,{from:t,to:v})):(i&&r.enterCallbacks[s]===i&&typeof v=="function"&&i.push(v),a())},c=o(()=>e.call(r&&r.instances[s],t,n,d));let h=Promise.resolve(c);e.length<3&&(h=h.then(d)),h.catch(v=>l(v))})}function ta(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const a in i.components){let l=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(mf(l)){const d=(l.__vccOpts||l)[t];d&&o.push(Sr(d,n,r,i,a,s))}else{let d=l();o.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const h=og(c)?c.default:c;i.mods[a]=c,i.components[a]=h;const v=(h.__vccOpts||h)[t];return v&&Sr(v,n,r,i,a,s)()}))}}return o}function jg(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const a=t.matched[i];a&&(e.matched.find(d=>vs(d,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(d=>vs(d,l))||s.push(l))}return[n,r,s]}/*!
|
|
22
|
+
* vue-router v4.6.4
|
|
23
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/let Ug=()=>location.protocol+"//"+location.host;function Sf(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,a=s.slice(i);return a[0]!=="/"&&(a="/"+a),Mc(a,"")}return Mc(n,e)+r+s}function Fg(e,t,n,r){let s=[],o=[],i=null;const a=({state:v})=>{const E=Sf(e,location),D=n.value,O=t.value;let z=0;if(v){if(n.value=E,t.value=v,i&&i===D){i=null;return}z=O?v.position-O.position:0}else r(E);s.forEach(R=>{R(n.value,D,{delta:z,type:Na.pop,direction:z?z>0?ea.forward:ea.back:ea.unknown})})};function l(){i=n.value}function d(v){s.push(v);const E=()=>{const D=s.indexOf(v);D>-1&&s.splice(D,1)};return o.push(E),E}function c(){if(document.visibilityState==="hidden"){const{history:v}=window;if(!v.state)return;v.replaceState(pt({},v.state,{scroll:yi()}),"")}}function h(){for(const v of o)v();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:h}}function Lc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?yi():null}}function Bg(e){const{history:t,location:n}=window,r={value:Sf(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(l,d,c){const h=e.indexOf("#"),v=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Ug()+e+l;try{t[c?"replaceState":"pushState"](d,"",v),s.value=d}catch(E){console.error(E),n[c?"replace":"assign"](v)}}function i(l,d){o(l,pt({},t.state,Lc(s.value.back,l,s.value.forward,!0),d,{position:s.value.position}),!0),r.value=l}function a(l,d){const c=pt({},s.value,t.state,{forward:l,scroll:yi()});o(c.current,c,!0),o(l,pt({},Lc(r.value,l,null),{position:c.position+1},d),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function Hg(e){e=Ig(e);const t=Bg(e),n=Fg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=pt({location:"",base:e,go:r,createHref:Cg.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 Wg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Hg(e)}let Vr=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Nt=(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})(Nt||{});const Vg={type:Vr.Static,value:""},zg=/[a-zA-Z0-9_]/;function Gg(e){if(!e)return[[]];if(e==="/")return[[Vg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(E){throw new Error(`ERR (${n})/"${d}": ${E}`)}let n=Nt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,d="",c="";function h(){d&&(n===Nt.Static?o.push({type:Vr.Static,value:d}):n===Nt.Param||n===Nt.ParamRegExp||n===Nt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Vr.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function v(){d+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Nt.ParamRegExp){r=n,n=Nt.EscapeNext;continue}switch(n){case Nt.Static:l==="/"?(d&&h(),i()):l===":"?(h(),n=Nt.Param):v();break;case Nt.EscapeNext:v(),n=r;break;case Nt.Param:l==="("?n=Nt.ParamRegExp:zg.test(l)?v():(h(),n=Nt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Nt.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=Nt.ParamRegExpEnd:c+=l;break;case Nt.ParamRegExpEnd:h(),n=Nt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===Nt.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),h(),i(),s}const jc="[^/]+?",qg={sensitive:!1,strict:!1,start:!0,end:!0};var rn=(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})(rn||{});const Kg=/[.+*?^${}()[\]/\\]/g;function Jg(e,t){const n=pt({},qg,t),r=[];let s=n.start?"^":"";const o=[];for(const d of e){const c=d.length?[]:[rn.Root];n.strict&&!d.length&&(s+="/");for(let h=0;h<d.length;h++){const v=d[h];let E=rn.Segment+(n.sensitive?rn.BonusCaseSensitive:0);if(v.type===Vr.Static)h||(s+="/"),s+=v.value.replace(Kg,"\\$&"),E+=rn.Static;else if(v.type===Vr.Param){const{value:D,repeatable:O,optional:z,regexp:R}=v;o.push({name:D,repeatable:O,optional:z});const x=R||jc;if(x!==jc){E+=rn.BonusCustomRegExp;try{`${x}`}catch(F){throw new Error(`Invalid custom RegExp for param "${D}" (${x}): `+F.message)}}let H=O?`((?:${x})(?:/(?:${x}))*)`:`(${x})`;h||(H=z&&d.length<2?`(?:/${H})`:"/"+H),z&&(H+="?"),s+=H,E+=rn.Dynamic,z&&(E+=rn.BonusOptional),O&&(E+=rn.BonusRepeatable),x===".*"&&(E+=rn.BonusWildcard)}c.push(E)}r.push(c)}if(n.strict&&n.end){const d=r.length-1;r[d][r[d].length-1]+=rn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(d){const c=d.match(i),h={};if(!c)return null;for(let v=1;v<c.length;v++){const E=c[v]||"",D=o[v-1];h[D.name]=E&&D.repeatable?E.split("/"):E}return h}function l(d){let c="",h=!1;for(const v of e){(!h||!c.endsWith("/"))&&(c+="/"),h=!1;for(const E of v)if(E.type===Vr.Static)c+=E.value;else if(E.type===Vr.Param){const{value:D,repeatable:O,optional:z}=E,R=D in d?d[D]:"";if(xn(R)&&!O)throw new Error(`Provided param "${D}" is an array but it is not repeatable (* or + modifiers)`);const x=xn(R)?R.join("/"):R;if(!x)if(z)v.length<2&&(c.endsWith("/")?c=c.slice(0,-1):h=!0);else throw new Error(`Missing required param "${D}"`);c+=x}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function Yg(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]===rn.Static+rn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===rn.Static+rn.Segment?1:-1:0}function If(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=Yg(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(Uc(r))return 1;if(Uc(s))return-1}return s.length-r.length}function Uc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Xg={strict:!1,end:!0,sensitive:!1};function Qg(e,t,n){const r=Jg(Gg(e.path),n),s=pt(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function Zg(e,t){const n=[],r=new Map;t=xc(Xg,t);function s(h){return r.get(h)}function o(h,v,E){const D=!E,O=Bc(h);O.aliasOf=E&&E.record;const z=xc(t,h),R=[O];if("alias"in h){const F=typeof h.alias=="string"?[h.alias]:h.alias;for(const re of F)R.push(Bc(pt({},O,{components:E?E.record.components:O.components,path:re,aliasOf:E?E.record:O})))}let x,H;for(const F of R){const{path:re}=F;if(v&&re[0]!=="/"){const se=v.record.path,ve=se[se.length-1]==="/"?"":"/";F.path=v.record.path+(re&&ve+re)}if(x=Qg(F,v,z),E?E.alias.push(x):(H=H||x,H!==x&&H.alias.push(x),D&&h.name&&!Hc(x)&&i(h.name)),Ef(x)&&l(x),O.children){const se=O.children;for(let ve=0;ve<se.length;ve++)o(se[ve],x,E&&E.children[ve])}E=E||x}return H?()=>{i(H)}:Ws}function i(h){if(kf(h)){const v=r.get(h);v&&(r.delete(h),n.splice(n.indexOf(v),1),v.children.forEach(i),v.alias.forEach(i))}else{const v=n.indexOf(h);v>-1&&(n.splice(v,1),h.record.name&&r.delete(h.record.name),h.children.forEach(i),h.alias.forEach(i))}}function a(){return n}function l(h){const v=nv(h,n);n.splice(v,0,h),h.record.name&&!Hc(h)&&r.set(h.record.name,h)}function d(h,v){let E,D={},O,z;if("name"in h&&h.name){if(E=r.get(h.name),!E)throw ys(xt.MATCHER_NOT_FOUND,{location:h});z=E.record.name,D=pt(Fc(v.params,E.keys.filter(H=>!H.optional).concat(E.parent?E.parent.keys.filter(H=>H.optional):[]).map(H=>H.name)),h.params&&Fc(h.params,E.keys.map(H=>H.name))),O=E.stringify(D)}else if(h.path!=null)O=h.path,E=n.find(H=>H.re.test(O)),E&&(D=E.parse(O),z=E.record.name);else{if(E=v.name?r.get(v.name):n.find(H=>H.re.test(v.path)),!E)throw ys(xt.MATCHER_NOT_FOUND,{location:h,currentLocation:v});z=E.record.name,D=pt({},v.params,h.params),O=E.stringify(D)}const R=[];let x=E;for(;x;)R.unshift(x.record),x=x.parent;return{name:z,path:O,params:D,matched:R,meta:tv(R)}}e.forEach(h=>o(h));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:d,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function Fc(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:ev(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 ev(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 Hc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function tv(e){return e.reduce((t,n)=>pt(t,n.meta),{})}function nv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;If(e,t[o])<0?r=o:n=o+1}const s=rv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function rv(e){let t=e;for(;t=t.parent;)if(Ef(t)&&If(e,t)===0)return t}function Ef({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wc(e){const t=En(wi),n=En(bl),r=fe(()=>{const l=be(e.to);return t.resolve(l)}),s=fe(()=>{const{matched:l}=r.value,{length:d}=l,c=l[d-1],h=n.matched;if(!c||!h.length)return-1;const v=h.findIndex(vs.bind(null,c));if(v>-1)return v;const E=Vc(l[d-2]);return d>1&&Vc(c)===E&&h[h.length-1].path!==E?h.findIndex(vs.bind(null,l[d-2])):v}),o=fe(()=>s.value>-1&&lv(n.params,r.value.params)),i=fe(()=>s.value>-1&&s.value===n.matched.length-1&&_f(n.params,r.value.params));function a(l={}){if(av(l)){const d=t[be(e.replace)?"replace":"push"](be(e.to)).catch(Ws);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:r,href:fe(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function sv(e){return e.length===1?e[0]:e}const ov=Lt({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:Wc,setup(e,{slots:t}){const n=di(Wc(e)),{options:r}=En(wi),s=fe(()=>({[zc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[zc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&sv(t.default(n));return e.custom?o:yl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),iv=ov;function av(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 lv(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(!xn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function Vc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const zc=(e,t,n)=>e??t??n,cv=Lt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=En(La),s=fe(()=>e.route||r.value),o=En(Dc,0),i=fe(()=>{let d=be(o);const{matched:c}=s.value;let h;for(;(h=c[d])&&!h.components;)d++;return d}),a=fe(()=>s.value.matched[i.value]);Mo(Dc,fe(()=>i.value+1)),Mo(Lg,a),Mo(La,s);const l=j();return ut(()=>[l.value,a.value,e.name],([d,c,h],[v,E,D])=>{c&&(c.instances[h]=d,E&&E!==c&&d&&d===v&&(c.leaveGuards.size||(c.leaveGuards=E.leaveGuards),c.updateGuards.size||(c.updateGuards=E.updateGuards))),d&&c&&(!E||!vs(c,E)||!v)&&(c.enterCallbacks[h]||[]).forEach(O=>O(d))},{flush:"post"}),()=>{const d=s.value,c=e.name,h=a.value,v=h&&h.components[c];if(!v)return Gc(n.default,{Component:v,route:d});const E=h.props[c],D=E?E===!0?d.params:typeof E=="function"?E(d):E:null,z=yl(v,pt({},D,t,{onVnodeUnmounted:R=>{R.component.isUnmounted&&(h.instances[c]=null)},ref:l}));return Gc(n.default,{Component:z,route:d})||z}}});function Gc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const uv=cv;function dv(e){const t=Zg(e.routes,e),n=e.parseQuery||Ng,r=e.stringifyQuery||Nc,s=e.history,o=Ms(),i=Ms(),a=Ms(),l=lp(br);let d=br;is&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Qi.bind(null,J=>""+J),h=Qi.bind(null,yg),v=Qi.bind(null,eo);function E(J,he){let pe,Ce;return kf(J)?(pe=t.getRecordMatcher(J),Ce=he):Ce=J,t.addRoute(Ce,pe)}function D(J){const he=t.getRecordMatcher(J);he&&t.removeRoute(he)}function O(){return t.getRoutes().map(J=>J.record)}function z(J){return!!t.getRecordMatcher(J)}function R(J,he){if(he=pt({},he||l.value),typeof J=="string"){const M=Zi(n,J,he.path),Y=t.resolve({path:M.path},he),G=s.createHref(M.fullPath);return pt(M,Y,{params:v(Y.params),hash:eo(M.hash),redirectedFrom:void 0,href:G})}let pe;if(J.path!=null)pe=pt({},J,{path:Zi(n,J.path,he.path).path});else{const M=pt({},J.params);for(const Y in M)M[Y]==null&&delete M[Y];pe=pt({},J,{params:h(M)}),he.params=h(he.params)}const Ce=t.resolve(pe,he),Ie=J.hash||"";Ce.params=c(v(Ce.params));const y=_g(r,pt({},J,{hash:mg(Ie),path:Ce.path})),_=s.createHref(y);return pt({fullPath:y,hash:Ie,query:r===Nc?Dg(J.query):J.query||{}},Ce,{redirectedFrom:void 0,href:_})}function x(J){return typeof J=="string"?Zi(n,J,l.value.path):pt({},J)}function H(J,he){if(d!==J)return ys(xt.NAVIGATION_CANCELLED,{from:he,to:J})}function F(J){return ve(J)}function re(J){return F(pt(x(J),{replace:!0}))}function se(J,he){const pe=J.matched[J.matched.length-1];if(pe&&pe.redirect){const{redirect:Ce}=pe;let Ie=typeof Ce=="function"?Ce(J,he):Ce;return typeof Ie=="string"&&(Ie=Ie.includes("?")||Ie.includes("#")?Ie=x(Ie):{path:Ie},Ie.params={}),pt({query:J.query,hash:J.hash,params:Ie.path!=null?{}:J.params},Ie)}}function ve(J,he){const pe=d=R(J),Ce=l.value,Ie=J.state,y=J.force,_=J.replace===!0,M=se(pe,Ce);if(M)return ve(pt(x(M),{state:typeof M=="object"?pt({},Ie,M.state):Ie,force:y,replace:_}),he||pe);const Y=pe;Y.redirectedFrom=he;let G;return!y&&kg(r,Ce,pe)&&(G=ys(xt.NAVIGATION_DUPLICATED,{to:Y,from:Ce}),$e(Ce,Ce,!0,!1)),(G?Promise.resolve(G):oe(Y,Ce)).catch($=>Xn($)?Xn($,xt.NAVIGATION_GUARD_REDIRECT)?$:Xe($):Re($,Y,Ce)).then($=>{if($){if(Xn($,xt.NAVIGATION_GUARD_REDIRECT))return ve(pt({replace:_},x($.to),{state:typeof $.to=="object"?pt({},Ie,$.to.state):Ie,force:y}),he||Y)}else $=X(Y,Ce,!0,_,Ie);return ye(Y,Ce,$),$})}function Ee(J,he){const pe=H(J,he);return pe?Promise.reject(pe):Promise.resolve()}function ie(J){const he=ot.values().next().value;return he&&typeof he.runWithContext=="function"?he.runWithContext(J):J()}function oe(J,he){let pe;const[Ce,Ie,y]=jg(J,he);pe=ta(Ce.reverse(),"beforeRouteLeave",J,he);for(const M of Ce)M.leaveGuards.forEach(Y=>{pe.push(Sr(Y,J,he))});const _=Ee.bind(null,J,he);return pe.push(_),Ye(pe).then(()=>{pe=[];for(const M of o.list())pe.push(Sr(M,J,he));return pe.push(_),Ye(pe)}).then(()=>{pe=ta(Ie,"beforeRouteUpdate",J,he);for(const M of Ie)M.updateGuards.forEach(Y=>{pe.push(Sr(Y,J,he))});return pe.push(_),Ye(pe)}).then(()=>{pe=[];for(const M of y)if(M.beforeEnter)if(xn(M.beforeEnter))for(const Y of M.beforeEnter)pe.push(Sr(Y,J,he));else pe.push(Sr(M.beforeEnter,J,he));return pe.push(_),Ye(pe)}).then(()=>(J.matched.forEach(M=>M.enterCallbacks={}),pe=ta(y,"beforeRouteEnter",J,he,ie),pe.push(_),Ye(pe))).then(()=>{pe=[];for(const M of i.list())pe.push(Sr(M,J,he));return pe.push(_),Ye(pe)}).catch(M=>Xn(M,xt.NAVIGATION_CANCELLED)?M:Promise.reject(M))}function ye(J,he,pe){a.list().forEach(Ce=>ie(()=>Ce(J,he,pe)))}function X(J,he,pe,Ce,Ie){const y=H(J,he);if(y)return y;const _=he===br,M=is?history.state:{};pe&&(Ce||_?s.replace(J.fullPath,pt({scroll:_&&M&&M.scroll},Ie)):s.push(J.fullPath,Ie)),l.value=J,$e(J,he,pe,_),Xe()}let ke;function Oe(){ke||(ke=s.listen((J,he,pe)=>{if(!Qe.listening)return;const Ce=R(J),Ie=se(Ce,Qe.currentRoute.value);if(Ie){ve(pt(Ie,{replace:!0,force:!0}),Ce).catch(Ws);return}d=Ce;const y=l.value;is&&Pg($c(y.fullPath,pe.delta),yi()),oe(Ce,y).catch(_=>Xn(_,xt.NAVIGATION_ABORTED|xt.NAVIGATION_CANCELLED)?_:Xn(_,xt.NAVIGATION_GUARD_REDIRECT)?(ve(pt(x(_.to),{force:!0}),Ce).then(M=>{Xn(M,xt.NAVIGATION_ABORTED|xt.NAVIGATION_DUPLICATED)&&!pe.delta&&pe.type===Na.pop&&s.go(-1,!1)}).catch(Ws),Promise.reject()):(pe.delta&&s.go(-pe.delta,!1),Re(_,Ce,y))).then(_=>{_=_||X(Ce,y,!1),_&&(pe.delta&&!Xn(_,xt.NAVIGATION_CANCELLED)?s.go(-pe.delta,!1):pe.type===Na.pop&&Xn(_,xt.NAVIGATION_ABORTED|xt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ye(Ce,y,_)}).catch(Ws)}))}let je=Ms(),Pe=Ms(),Me;function Re(J,he,pe){Xe(J);const Ce=Pe.list();return Ce.length?Ce.forEach(Ie=>Ie(J,he,pe)):console.error(J),Promise.reject(J)}function Ke(){return Me&&l.value!==br?Promise.resolve():new Promise((J,he)=>{je.add([J,he])})}function Xe(J){return Me||(Me=!J,Oe(),je.list().forEach(([he,pe])=>J?pe(J):he()),je.reset()),J}function $e(J,he,pe,Ce){const{scrollBehavior:Ie}=e;if(!is||!Ie)return Promise.resolve();const y=!pe&&xg($c(J.fullPath,0))||(Ce||!pe)&&history.state&&history.state.scroll||null;return Vt().then(()=>Ie(J,he,y)).then(_=>_&&Rg(_)).catch(_=>Re(_,J,he))}const Je=J=>s.go(J);let st;const ot=new Set,Qe={currentRoute:l,listening:!0,addRoute:E,removeRoute:D,clearRoutes:t.clearRoutes,hasRoute:z,getRoutes:O,resolve:R,options:e,push:F,replace:re,go:Je,back:()=>Je(-1),forward:()=>Je(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Pe.add,isReady:Ke,install(J){J.component("RouterLink",iv),J.component("RouterView",uv),J.config.globalProperties.$router=Qe,Object.defineProperty(J.config.globalProperties,"$route",{enumerable:!0,get:()=>be(l)}),is&&!st&&l.value===br&&(st=!0,F(s.location).catch(Ce=>{}));const he={};for(const Ce in br)Object.defineProperty(he,Ce,{get:()=>l.value[Ce],enumerable:!0});J.provide(wi,Qe),J.provide(bl,kd(he)),J.provide(La,l);const pe=J.unmount;ot.add(J),J.unmount=function(){ot.delete(J),ot.size<1&&(d=br,ke&&ke(),ke=null,l.value=br,st=!1,Me=!1),pe()}}};function Ye(J){return J.reduce((he,pe)=>he.then(()=>ie(pe)),Promise.resolve())}return Qe}function fv(){return En(wi)}function hv(e){return En(bl)}const qc=768;function Cf(){const e=j(typeof window<"u"?window.innerWidth<qc:!1);let t=null;function n(r){e.value=r.matches}return zn(()=>{t=window.matchMedia(`(max-width: ${qc-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),ao(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const pv={key:0,class:"desktop-sidebar"},mv={class:"desktop-main"},Kc="codex-web-local.sidebar-width.v1",gv=260,vv=620,Jc=320,Yc="100dvh",yv=Lt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Cf();function r(D){return Math.min(vv,Math.max(gv,D))}function s(){if(typeof window>"u")return Jc;const D=window.localStorage.getItem(Kc),O=Number(D);return Number.isFinite(O)?r(O):Jc}const o=j(s()),i=j(Yc);function a(){var O;if(typeof window>"u")return Yc;const D=((O=window.visualViewport)==null?void 0:O.height)??window.innerHeight;return`${Math.max(Math.round(D),0)}px`}let l=0;function d(){i.value=a()}function c(){l||(l=window.requestAnimationFrame(()=>{l=0,d()}))}const h=fe(()=>{const D={"--layout-height":i.value};return n.value||t.isSidebarCollapsed?{...D,"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{...D,"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"}});function v(D){typeof window>"u"||window.localStorage.setItem(Kc,String(D))}function E(D){D.preventDefault();const O=D.clientX,z=o.value,R=H=>{const F=H.clientX-O;o.value=r(z+F)},x=()=>{v(o.value),window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",x)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",x)}return zn(()=>{var D,O;d(),window.addEventListener("resize",c),(D=window.visualViewport)==null||D.addEventListener("resize",c),(O=window.visualViewport)==null||O.addEventListener("scroll",c)}),ao(()=>{var D,O;l&&(cancelAnimationFrame(l),l=0),window.removeEventListener("resize",c),(D=window.visualViewport)==null||D.removeEventListener("resize",c),(O=window.visualViewport)==null||O.removeEventListener("scroll",c)}),(D,O)=>(b(),I("div",{class:nt(["desktop-layout",{"is-mobile":be(n)}]),style:Jr(h.value)},[be(n)?(b(),ft(Vo,{key:0,to:"body"},[xe(pf,{name:"drawer"},{default:_t(()=>[e.isSidebarCollapsed?le("",!0):(b(),I("div",{key:0,class:"mobile-drawer-backdrop",onClick:O[1]||(O[1]=z=>D.$emit("close-sidebar"))},[m("aside",{class:"mobile-drawer",onClick:O[0]||(O[0]=it(()=>{},["stop"]))},[Bn(D.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):le("",!0),be(n)?le("",!0):(b(),I(Ue,{key:1},[e.isSidebarCollapsed?le("",!0):(b(),I("aside",pv,[Bn(D.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?le("",!0):(b(),I("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:E},null,32))],64)),m("section",mv,[Bn(D.$slots,"content",{},void 0)])],6))}}),tt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},wv=tt(yv,[["__scopeId","data-v-d24ef967"]]),bv={},_v={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function kv(e,t){return b(),I("svg",_v,[...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 bi=tt(bv,[["render",kv]]),Tv={},Sv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Iv(e,t){return b(),I("svg",Sv,[...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 Af=tt(Tv,[["render",Iv]]),Ev={},Cv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Av(e,t){return b(),I("svg",Cv,[...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 Os=tt(Ev,[["render",Av]]),Rv={},Pv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function xv(e,t){return b(),I("svg",Pv,[...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 Yo=tt(Rv,[["render",xv]]),Mv={},Ov={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $v(e,t){return b(),I("svg",Ov,[...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 _l=tt(Mv,[["render",$v]]),Nv={},Dv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Lv(e,t){return b(),I("svg",Dv,[...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 jv=tt(Nv,[["render",Lv]]),Uv={},Fv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Bv(e,t){return b(),I("svg",Fv,[...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 Do=tt(Uv,[["render",Bv]]),Hv={},Wv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Vv(e,t){return b(),I("svg",Wv,[...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 na=tt(Hv,[["render",Vv]]),zv={key:0,class:"sidebar-menu-row-left"},Gv={class:"sidebar-menu-row-main"},qv={key:1,class:"sidebar-menu-row-right"},Kv={key:0,class:"sidebar-menu-row-right-default"},Jv={key:1,class:"sidebar-menu-row-right-hover"},Yv=Lt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Fp(),r=fe(()=>!!n.left),s=fe(()=>!!n.right),o=fe(()=>!!n["right-hover"]),i=fe(()=>s.value||o.value);return(a,l)=>(b(),ft(Go(t.as),lf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},a.$attrs),{default:_t(()=>[r.value?(b(),I("span",zv,[Bn(a.$slots,"left",{},void 0,!0)])):le("",!0),m("span",Gv,[Bn(a.$slots,"default",{},void 0,!0)]),i.value?(b(),I("span",qv,[s.value?(b(),I("span",Kv,[Bn(a.$slots,"right",{},void 0,!0)])):le("",!0),o.value?(b(),I("span",Jv,[Bn(a.$slots,"right-hover",{},void 0,!0)])):le("",!0)])):le("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Ur=tt(Yv,[["__scopeId","data-v-daeca4df"]]),Xv={class:"thread-tree-root"},Qv={key:0,class:"pinned-section"},Zv={class:"thread-list"},ey={class:"thread-left-stack"},ty=["data-state"],ny=["onClick"],ry=["onClick"],sy={class:"thread-row-title-wrap"},oy={class:"thread-row-title"},iy={class:"thread-row-time"},ay=["onClick"],ly=["onClick"],cy=["onClick"],uy=["onClick"],dy=["aria-expanded"],fy=["data-active"],hy={key:0},py=["data-active"],my={key:0},gy={key:1,class:"thread-tree-no-results"},vy={key:2,class:"thread-tree-loading"},yy={key:3,class:"thread-list thread-list-global"},wy={class:"thread-left-stack"},by=["data-state"],_y=["onClick"],ky=["onClick"],Ty={class:"thread-row-title-wrap"},Sy={class:"thread-row-title"},Iy={class:"thread-row-time"},Ey=["onClick"],Cy=["onClick"],Ay=["onClick"],Ry=["onClick"],Py=["data-project-name","data-expanded","data-dragging"],xy={class:"project-icon-stack"},My={class:"project-icon-folder"},Oy={class:"project-icon-chevron"},$y=["data-dragging-handle","onMousedown"],Ny={class:"project-title"},Dy={class:"project-hover-controls"},Ly=["onClick"],jy=["onClick"],Uy=["onClick"],Fy=["onClick"],By=["onInput"],Hy=["aria-label","title","onClick"],Wy={key:0,class:"thread-list"},Vy={class:"thread-left-stack"},zy=["data-state"],Gy=["onClick"],qy=["onClick"],Ky={class:"thread-row-title-wrap"},Jy={class:"thread-row-title"},Yy={class:"thread-row-time"},Xy=["onClick"],Qy=["onClick"],Zy=["onClick"],ew=["onClick"],tw=["onClick"],nw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},rw=["onKeydown"],sw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},ow={class:"rename-thread-subtitle"},iw=4,Xc=6,Qc="codex-web-local.thread-view-mode.v1",Zc="codex-web-local.collapsed-projects.v1",aw=Lt({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-project-files","rename-project","rename-thread","remove-project","reorder-project","export-thread"],setup(e,{emit:t}){const n=e,r=t,s=j({}),o=j({}),i=j([]),a=j(""),l=j(""),d=j("actions"),c=j(""),h=j(!1),v=j(""),E=j(""),D=j(null),O=j(!1),z=j(""),R=j(""),x=j(null),H=j(null),F=j(null);let re=null,se=null;const ve=j(""),Ee=j({}),ie=new Map,oe=new Map,ye=new Map,X=new WeakMap,ke=j(null),Oe=j(!1),je=j(Re()),Pe=typeof window<"u"?new ResizeObserver(T=>{for(const P of T){const L=P.target,Q=X.get(L);Q&&De(Q,L)}}):null;function Me(){if(typeof window>"u")return{};try{const T=window.localStorage.getItem(Zc);if(!T)return{};const P=JSON.parse(T);return!P||typeof P!="object"||Array.isArray(P)?{}:P}catch{return{}}}function Re(){return typeof window>"u"?"project":window.localStorage.getItem(Qc)==="chronological"?"chronological":"project"}o.value=Me(),ut(o,T=>{typeof window>"u"||window.localStorage.setItem(Zc,JSON.stringify(T))},{deep:!0}),ut(je,T=>{typeof window>"u"||window.localStorage.setItem(Qc,T)});const Ke=fe(()=>n.searchQuery.trim().toLowerCase()),Xe=fe(()=>Ke.value.length>0),$e=fe(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function Je(T){if(!Xe.value)return!0;if($e.value)return $e.value.has(T.id);const P=Ke.value;return T.title.toLowerCase().includes(P)||T.preview.toLowerCase().includes(P)}const st=fe(()=>Xe.value?n.groups.map(T=>({...T,threads:T.threads.filter(Je)})).filter(T=>T.threads.length>0):n.groups),ot=fe(()=>je.value==="chronological"),Qe=fe(()=>{const T=st.value,P=[];for(const L of T)for(const Q of L.threads)_(Q.id)||P.push(Q);return P.sort((L,Q)=>{const Ne=new Date(L.updatedAtIso||L.createdAtIso).getTime();return new Date(Q.updatedAtIso||Q.createdAtIso).getTime()-Ne})}),Ye=fe(()=>{const T=new Map;for(const P of n.groups)for(const L of P.threads)T.set(L.id,L);return T}),J=fe(()=>i.value.map(T=>Ye.value.get(T)??null).filter(T=>T!==null).filter(Je)),he=fe(()=>{const T=F.value;if(!T||T.dropTargetIndexFull===null||n.groups.length===0)return null;const P=Math.max(0,Math.min(T.dropTargetIndexFull,n.groups.length)),L=P>T.fromIndex?P-1:P,Q=Math.max(0,Math.min(L,n.groups.length-1));return Q===T.fromIndex?null:Q}),pe=fe(()=>{const P=(Xe.value?st.value:n.groups).map(Wt=>Wt.projectName),L=F.value,Q=he.value;if(!L||Q===null)return P;const Ne=[...P],[At]=Ne.splice(L.fromIndex,1);return At?(Ne.splice(Q,0,At),Ne):P}),Ce=fe(()=>{const T={};let P=0;for(const L of pe.value)T[L]=P,P+=Tt(L);return T}),Ie=fe(()=>{let T=0;for(const P of pe.value)T+=Tt(P);return{height:`${Math.max(0,T)}px`}});function y(T){const P=new Date(T).getTime();if(Number.isNaN(P))return"n/a";const L=Math.abs(Date.now()-P);if(L<6e4)return"now";const Q=Math.floor(L/6e4);if(Q<60)return`${Q}m`;const Ne=Math.floor(Q/60);return Ne<24?`${Ne}h`:`${Math.floor(Ne/24)}d`}function _(T){return i.value.includes(T)}function M(T){if(_(T)){i.value=i.value.filter(P=>P!==T);return}i.value=[T,...i.value]}function Y(T){r("select",T)}function G(T){r("export-thread",T),q()}function $(T){return`start new thread ${Ze(T)}`}function W(T){r("start-new-thread",T)}function B(T){l.value===T&&q()}function Z(T){return l.value===T}function q(){l.value=""}function we(T){if(l.value===T){q();return}l.value=T}function de(T,P){v.value=T,E.value=P,h.value=!0,q(),Vt(()=>{var L,Q;(L=D.value)==null||L.focus(),(Q=D.value)==null||Q.select()})}function ge(){h.value=!1,v.value="",E.value=""}function Ae(){const T=v.value,P=E.value.trim();!T||!P||(r("rename-thread",{threadId:T,title:P}),ge())}function Be(T,P){z.value=T,R.value=P,O.value=!0,q()}function We(){O.value=!1,z.value="",R.value=""}function ze(){const T=z.value;T&&(i.value=i.value.filter(P=>P!==T),r("archive",T),We())}function Ze(T){return n.projectDisplayNameById[T]??T}function at(T){return a.value===T}function ht(){a.value="",d.value="actions",c.value=""}function vt(){Oe.value=!Oe.value}function Mt(T){je.value=T,Oe.value=!1}function Ot(T){if(a.value===T){ht();return}a.value=T,d.value="actions",c.value=Ze(T)}function yt(T){a.value=T,d.value="rename",c.value=Ze(T)}function lt(T){r("rename-project",{projectName:T,displayName:c.value})}function Rt(T){r("remove-project",T),ht()}function jt(T){r("browse-project-files",T),ht()}function Bt(T,P){if(!T.altKey||T.key!=="ArrowUp"&&T.key!=="ArrowDown")return;const L=n.groups.findIndex(At=>At.projectName===P);if(L<0)return;const Q=T.key==="ArrowUp"?-1:1,Ne=Math.max(0,Math.min(L+Q,n.groups.length-1));Ne!==L&&(T.preventDefault(),r("reorder-project",{projectName:P,toIndex:Ne}))}function bn(T){return s.value[T]===!0}function kt(T){return o.value[T]===!0}function ct(T){s.value={...s.value,[T]:!bn(T)}}function Ht(T){if(ve.value===T){ve.value="";return}o.value={...o.value,[T]:!kt(T)}}function Tt(T){const P=Ee.value[T]??0,L=F.value,Ne=((L==null?void 0:L.projectName)===T?L.groupHeight:null)??P,At=kt(T)?0:Xc;return Math.max(0,Ne+At)}function rt(T,P){const L=P instanceof HTMLElement?P:P&&"$el"in P&&P.$el instanceof HTMLElement?P.$el:null;if(L){oe.set(T,L);return}oe.delete(T)}function Ut(T,P){const L=P instanceof HTMLElement?P:P&&"$el"in P&&P.$el instanceof HTMLElement?P.$el:null;if(L){ye.set(T,L);return}ye.delete(T)}function Gt(T){const P=a.value;if(!P)return!1;const L=oe.get(P);if(!L)return!1;if((typeof T.composedPath=="function"?T.composedPath():[]).includes(L))return!0;const Ne=T.target;return Ne instanceof Node?L.contains(Ne):!1}function hn(T){const P=l.value;if(!P)return!1;const L=ye.get(P);if(!L)return!1;if((typeof T.composedPath=="function"?T.composedPath():[]).includes(L))return!0;const Ne=T.target;return Ne instanceof Node?L.contains(Ne):!1}function qt(T){if(Oe.value){const P=ke.value,L=typeof T.composedPath=="function"?T.composedPath():[];!!P&&(L.includes(P)||T.target instanceof Node&&P.contains(T.target))||(Oe.value=!1)}a.value&&(Gt(T)||ht(),l.value&&(hn(T)||q()))}function cn(T){a.value&&!Gt(T)&&ht(),l.value&&!hn(T)&&q()}function _n(){Oe.value&&(Oe.value=!1),a.value&&ht(),l.value&&q()}function kn(){window.addEventListener("pointerdown",qt,{capture:!0}),window.addEventListener("focusin",cn,{capture:!0}),window.addEventListener("blur",_n)}function Kt(){window.removeEventListener("pointerdown",qt,{capture:!0}),window.removeEventListener("focusin",cn,{capture:!0}),window.removeEventListener("blur",_n)}function De(T,P){const L=P.getBoundingClientRect().height;if(!Number.isFinite(L)||L<=0)return;const Q=Ee.value[T];Q!==void 0&&Math.abs(Q-L)<.5||(Ee.value={...Ee.value,[T]:L})}function g(T,P){const L=ie.get(T);L&&L!==P&&Pe&&Pe.unobserve(L);const Q=P instanceof HTMLElement?P:P&&"$el"in P&&P.$el instanceof HTMLElement?P.$el:null;if(Q){ie.set(T,Q),X.set(Q,T),De(T,Q),Pe==null||Pe.observe(Q);return}L&&(Pe==null||Pe.unobserve(L)),ie.delete(T)}function S(T,P){if(T.button!==0||H.value||F.value)return;const L=n.groups.findIndex(Wt=>Wt.projectName===P),Q=ie.get(P);if(L<0||!Q)return;const Ne=Q.getBoundingClientRect(),At=kt(P)?0:Xc;H.value={projectName:P,fromIndex:L,startClientX:T.clientX,startClientY:T.clientY,pointerOffsetY:T.clientY-Ne.top,groupLeft:Ne.left,groupWidth:Ne.width,groupHeight:Ne.height,groupOuterHeight:Ne.height+At},T.preventDefault(),C()}function C(){window.addEventListener("mousemove",ae),window.addEventListener("mouseup",ue),window.addEventListener("keydown",Se)}function K(){window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",ue),window.removeEventListener("keydown",Se)}function ae(T){re={clientX:T.clientX,clientY:T.clientY},Ge()}function ue(T){et({clientX:T.clientX,clientY:T.clientY});const P=F.value;if(P&&he.value!==null){const L=n.groups.findIndex(Q=>Q.projectName===P.projectName);if(L>=0){const Q=he.value;Q!==L&&r("reorder-project",{projectName:P.projectName,toIndex:Q})}}_e()}function Se(T){T.key==="Escape"&&(!H.value&&!F.value||(T.preventDefault(),_e()))}function _e(){se!==null&&(window.cancelAnimationFrame(se),se=null),re=null,H.value=null,F.value=null,ve.value="",K()}function Ge(){se===null&&(se=window.requestAnimationFrame(()=>{if(se=null,!re)return;const T=re;re=null,et(T)}))}function et(T){const P=H.value;if(!F.value&&P){const L=T.clientX-P.startClientX,Q=T.clientY-P.startClientY;if(Math.hypot(L,Q)<iw)return;ht(),ve.value=P.projectName,F.value={projectName:P.projectName,fromIndex:P.fromIndex,pointerOffsetY:P.pointerOffsetY,groupLeft:P.groupLeft,groupWidth:P.groupWidth,groupHeight:P.groupHeight,groupOuterHeight:P.groupOuterHeight,ghostTop:T.clientY-P.pointerOffsetY,dropTargetIndexFull:null}}F.value&&wt(T)}function wt(T){const P=F.value;if(!P)return;if(P.ghostTop=T.clientY-P.pointerOffsetY,!$t(T)){P.dropTargetIndexFull=null;return}const L=T.clientY,Q=x.value;if(!Q){P.dropTargetIndexFull=null;return}const Ne=Q.getBoundingClientRect(),At=new Map(n.groups.map((mn,gr)=>[mn.projectName,gr])),Wt=n.groups.map(mn=>mn.projectName).filter(mn=>mn!==P.projectName);let Xr=0,mr=n.groups.length;for(const mn of Wt){const gr=At.get(mn);if(gr===void 0)continue;const qn=Tt(mn),Qr=Ne.top+Xr+qn/2;if(L<Qr){mr=gr;break}Xr+=qn}P.dropTargetIndexFull=mr}function $t(T){const P=x.value;if(!P)return!1;const L=P.getBoundingClientRect(),Q=T.clientX>=L.left&&T.clientX<=L.right,Ne=T.clientY>=L.top-32&&T.clientY<=L.bottom+32;return Q&&Ne}function un(T){var P;return((P=F.value)==null?void 0:P.projectName)===T}function Gn(T){const P=F.value,L=Ce.value[T]??0,Q=a.value===T;return!P||P.projectName!==T?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Q?"40":"1",transform:`translate3d(0, ${L}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${P.groupLeft}px`,width:`${P.groupWidth}px`,height:`${P.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${P.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Mn(T){return T.threads.filter(P=>!_(P.id))}function pr(T){if(Xe.value)return Mn(T);if(kt(T.projectName))return[];const P=Mn(T);return bn(T.projectName)?P:P.slice(0,10)}function N(T){return Xe.value?!1:!kt(T.projectName)&&Mn(T).length>10}function V(T){return Mn(T).length>0}function ne(T){return T.inProgress?"working":T.unread?"unread":"idle"}ut(()=>n.groups.map(T=>T.projectName),T=>{var Ne,At;const P=((Ne=F.value)==null?void 0:Ne.projectName)??((At=H.value)==null?void 0:At.projectName)??"";P&&!n.groups.some(Wt=>Wt.projectName===P)&&_e();const L=new Set(T),Q=Object.fromEntries(Object.entries(Ee.value).filter(([Wt])=>L.has(Wt)));Object.keys(Q).length!==Object.keys(Ee.value).length&&(Ee.value=Q)});const Le=fe(()=>Oe.value||a.value!=="");return ut(Le,T=>{if(T){kn();return}Kt()}),hr(()=>{for(const T of ie.values())Pe==null||Pe.unobserve(T);ie.clear(),oe.clear(),Kt(),_e()}),(T,P)=>(b(),I("section",Xv,[J.value.length>0?(b(),I("section",Qv,[m("ul",Zv,[(b(!0),I(Ue,null,It(J.value,L=>(b(),I("li",{key:L.id,class:"thread-row-item"},[xe(Ur,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":_(L.id),onMouseleave:Q=>B(L.id)},{left:_t(()=>[m("span",ey,[L.inProgress||L.unread?(b(),I("span",{key:0,class:"thread-status-indicator","data-state":ne(L)},null,8,ty)):le("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>M(L.id)},[xe(na,{class:"thread-icon"})],8,ny)])]),right:_t(()=>[m("span",iy,ce(y(L.createdAtIso||L.updatedAtIso)),1)]),"right-hover":_t(()=>[m("div",{ref_for:!0,ref:Q=>Ut(L.id,Q),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:it(Q=>we(L.id),["stop"])},[xe(Os,{class:"thread-icon"})],8,ay),Z(L.id)?(b(),I("div",{key:0,class:"thread-menu-panel",onClick:P[0]||(P[0]=it(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:Q=>G(L.id)}," Export chat ",8,ly),m("button",{class:"thread-menu-item",type:"button",onClick:Q=>de(L.id,L.title)}," Rename thread ",8,cy),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Q=>Be(L.id,L.title)}," Delete thread ",8,uy)])):le("",!0)],512)]),default:_t(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Q=>Y(L.id)},[m("span",sy,[m("span",oy,ce(L.title),1),L.hasWorktree?(b(),ft(Do,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):le("",!0)])],8,ry)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])])):le("",!0),xe(Ur,{as:"header",class:"thread-tree-header-row"},{right:_t(()=>[m("div",{ref_key:"organizeMenuWrapRef",ref:ke,class:"organize-menu-wrap"},[m("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Oe.value,"aria-label":"Organize threads",title:"Organize threads",onClick:vt},[xe(Os,{class:"thread-icon"})],8,dy),Oe.value?(b(),I("div",{key:0,class:"organize-menu-panel",onClick:P[3]||(P[3]=it(()=>{},["stop"]))},[P[11]||(P[11]=m("p",{class:"organize-menu-title"},"Organize",-1)),m("button",{class:"organize-menu-item","data-active":je.value==="project",type:"button",onClick:P[1]||(P[1]=L=>Mt("project"))},[P[9]||(P[9]=m("span",null,"By project",-1)),je.value==="project"?(b(),I("span",hy,"✓")):le("",!0)],8,fy),m("button",{class:"organize-menu-item","data-active":je.value==="chronological",type:"button",onClick:P[2]||(P[2]=L=>Mt("chronological"))},[P[10]||(P[10]=m("span",null,"Chronological list",-1)),je.value==="chronological"?(b(),I("span",my,"✓")):le("",!0)],8,py)])):le("",!0)],512)]),default:_t(()=>[P[12]||(P[12]=m("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),Xe.value&&st.value.length===0?(b(),I("p",gy,"No matching threads")):e.isLoading&&e.groups.length===0?(b(),I("p",vy,"Loading threads...")):ot.value?(b(),I("ul",yy,[(b(!0),I(Ue,null,It(Qe.value,L=>(b(),I("li",{key:L.id,class:"thread-row-item"},[xe(Ur,{class:"thread-row","data-active":L.id===e.selectedThreadId,"data-pinned":_(L.id),onMouseleave:Q=>B(L.id)},{left:_t(()=>[m("span",wy,[L.inProgress||L.unread?(b(),I("span",{key:0,class:"thread-status-indicator","data-state":ne(L)},null,8,by)):le("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Q=>M(L.id)},[xe(na,{class:"thread-icon"})],8,_y)])]),right:_t(()=>[m("span",Iy,ce(y(L.createdAtIso||L.updatedAtIso)),1)]),"right-hover":_t(()=>[m("div",{ref_for:!0,ref:Q=>Ut(L.id,Q),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:it(Q=>we(L.id),["stop"])},[xe(Os,{class:"thread-icon"})],8,Ey),Z(L.id)?(b(),I("div",{key:0,class:"thread-menu-panel",onClick:P[4]||(P[4]=it(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:Q=>G(L.id)}," Export chat ",8,Cy),m("button",{class:"thread-menu-item",type:"button",onClick:Q=>de(L.id,L.title)}," Rename thread ",8,Ay),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Q=>Be(L.id,L.title)}," Delete thread ",8,Ry)])):le("",!0)],512)]),default:_t(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Q=>Y(L.id)},[m("span",Ty,[m("span",Sy,ce(L.title),1),L.hasWorktree?(b(),ft(Do,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):le("",!0)])],8,ky)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(b(),I("div",{key:4,ref_key:"groupsContainerRef",ref:x,class:"thread-tree-groups",style:Jr(Ie.value)},[(b(!0),I(Ue,null,It(st.value,L=>(b(),I("article",{key:L.projectName,ref_for:!0,ref:Q=>g(L.projectName,Q),class:"project-group","data-project-name":L.projectName,"data-expanded":!kt(L.projectName),"data-dragging":un(L.projectName),style:Jr(Gn(L.projectName))},[xe(Ur,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Q=>Ht(L.projectName),onKeydown:[Q=>Bt(Q,L.projectName),on(it(Q=>Ht(L.projectName),["prevent"]),["enter"]),on(it(Q=>Ht(L.projectName),["prevent"]),["space"])]},{left:_t(()=>[m("span",xy,[m("span",My,[kt(L.projectName)?(b(),ft(_l,{key:0,class:"thread-icon"})):(b(),ft(jv,{key:1,class:"thread-icon"}))]),m("span",Oy,[kt(L.projectName)?(b(),ft(Af,{key:0,class:"thread-icon"})):(b(),ft(bi,{key:1,class:"thread-icon"}))])])]),right:_t(()=>[m("div",Dy,[m("div",{ref_for:!0,ref:Q=>rt(L.projectName,Q),class:"project-menu-wrap"},[m("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:it(Q=>Ot(L.projectName),["stop"])},[xe(Os,{class:"thread-icon"})],8,Ly),at(L.projectName)?(b(),I("div",{key:0,class:"project-menu-panel",onClick:P[6]||(P[6]=it(()=>{},["stop"]))},[d.value==="actions"?(b(),I(Ue,{key:0},[m("button",{class:"project-menu-item",type:"button",onClick:Q=>jt(L.projectName)}," Browse files ",8,jy),m("button",{class:"project-menu-item",type:"button",onClick:Q=>yt(L.projectName)}," Edit name ",8,Uy),m("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Q=>Rt(L.projectName)}," Remove ",8,Fy)],64)):(b(),I(Ue,{key:1},[P[13]||(P[13]=m("label",{class:"project-menu-label"},"Project name",-1)),lr(m("input",{"onUpdate:modelValue":P[5]||(P[5]=Q=>c.value=Q),class:"project-menu-input",type:"text",onInput:Q=>lt(L.projectName)},null,40,By),[[cr,c.value]])],64))])):le("",!0)],512),m("button",{class:"thread-start-button",type:"button","aria-label":$(L.projectName),title:$(L.projectName),onClick:it(Q=>W(L.projectName),["stop"])},[xe(Yo,{class:"thread-icon"})],8,Hy)])]),default:_t(()=>[m("span",{class:"project-main-button","data-dragging-handle":un(L.projectName),onMousedown:it(Q=>S(Q,L.projectName),["left"])},[m("span",Ny,ce(Ze(L.projectName)),1)],40,$y)]),_:2},1032,["onClick","onKeydown"]),V(L)?(b(),I("ul",Wy,[(b(!0),I(Ue,null,It(pr(L),Q=>(b(),I("li",{key:Q.id,class:"thread-row-item"},[xe(Ur,{class:"thread-row","data-active":Q.id===e.selectedThreadId,"data-pinned":_(Q.id),onMouseleave:Ne=>B(Q.id)},{left:_t(()=>[m("span",Vy,[Q.inProgress||Q.unread?(b(),I("span",{key:0,class:"thread-status-indicator","data-state":ne(Q)},null,8,zy)):le("",!0),m("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Ne=>M(Q.id)},[xe(na,{class:"thread-icon"})],8,Gy)])]),right:_t(()=>[m("span",Yy,ce(y(Q.createdAtIso||Q.updatedAtIso)),1)]),"right-hover":_t(()=>[m("div",{ref_for:!0,ref:Ne=>Ut(Q.id,Ne),class:"thread-menu-wrap"},[m("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:it(Ne=>we(Q.id),["stop"])},[xe(Os,{class:"thread-icon"})],8,Xy),Z(Q.id)?(b(),I("div",{key:0,class:"thread-menu-panel",onClick:P[7]||(P[7]=it(()=>{},["stop"]))},[m("button",{class:"thread-menu-item",type:"button",onClick:Ne=>G(Q.id)}," Export chat ",8,Qy),m("button",{class:"thread-menu-item",type:"button",onClick:Ne=>de(Q.id,Q.title)}," Rename thread ",8,Zy),m("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:Ne=>Be(Q.id,Q.title)}," Delete thread ",8,ew)])):le("",!0)],512)]),default:_t(()=>[m("button",{class:"thread-main-button",type:"button",onClick:Ne=>Y(Q.id)},[m("span",Ky,[m("span",Jy,ce(Q.title),1),Q.hasWorktree?(b(),ft(Do,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):le("",!0)])],8,qy)]),_:2},1032,["data-active","data-pinned","onMouseleave"])]))),128))])):(b(),ft(Ur,{key:1,as:"p",class:"project-empty-row"},{left:_t(()=>[...P[14]||(P[14]=[m("span",{class:"project-empty-spacer"},null,-1)])]),default:_t(()=>[P[15]||(P[15]=m("span",{class:"project-empty"},"No threads",-1))]),_:1})),N(L)?(b(),ft(Ur,{key:2,class:"thread-show-more-row"},{left:_t(()=>[...P[16]||(P[16]=[m("span",{class:"thread-show-more-spacer"},null,-1)])]),default:_t(()=>[m("button",{class:"thread-show-more-button",type:"button",onClick:Q=>ct(L.projectName)},ce(bn(L.projectName)?"Show less":"Show more"),9,tw)]),_:2},1024)):le("",!0)],12,Py))),128))],4)),(b(),ft(Vo,{to:"body"},[h.value?(b(),I("div",{key:0,class:"rename-thread-overlay",onClick:it(ge,["self"])},[m("div",nw,[P[17]||(P[17]=m("h3",{class:"rename-thread-title"},"Rename thread",-1)),P[18]||(P[18]=m("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),lr(m("input",{ref_key:"renameThreadInputRef",ref:D,"onUpdate:modelValue":P[8]||(P[8]=L=>E.value=L),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[on(it(Ae,["prevent"]),["enter"]),on(it(ge,["prevent"]),["esc"])]},null,40,rw),[[cr,E.value]]),m("div",{class:"rename-thread-actions"},[m("button",{class:"rename-thread-button",type:"button",onClick:ge},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Ae},"Save")])])])):le("",!0)])),(b(),ft(Vo,{to:"body"},[O.value?(b(),I("div",{key:0,class:"rename-thread-overlay",onClick:it(We,["self"])},[m("div",sw,[P[19]||(P[19]=m("h3",{class:"rename-thread-title"},"Delete thread?",-1)),m("p",ow,' This will archive the thread "'+ce(R.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:We},"Cancel"),m("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:ze},"Delete")])])])):le("",!0)]))]))}}),lw=tt(aw,[["__scopeId","data-v-e2f8a8e1"]]),cw={class:"content-header"},uw={class:"content-leading"},dw={class:"content-title"},fw={class:"content-actions"},hw=Lt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(b(),I("header",cw,[m("div",uw,[Bn(t.$slots,"leading",{},void 0)]),m("h1",dw,ce(e.title),1),m("div",fw,[Bn(t.$slots,"actions",{},void 0)])]))}}),pw=tt(hw,[["__scopeId","data-v-66ee223c"]]),mw={},gw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vw(e,t){return b(),I("svg",gw,[...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 kl=tt(mw,[["render",vw]]),yw={},ww={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bw(e,t){return b(),I("svg",ww,[...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 _w=tt(yw,[["render",bw]]),kw={},Tw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Sw(e,t){return b(),I("svg",Tw,[...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 Iw=tt(kw,[["render",Sw]]),Ew={class:"conversation-root"},Cw={key:0,class:"conversation-loading"},Aw={key:1,class:"conversation-empty"},Rw={class:"message-row"},Pw={class:"message-stack"},xw={class:"request-card"},Mw={class:"request-title"},Ow={class:"request-meta"},$w={key:0,class:"request-reason"},Nw={key:1,class:"request-actions"},Dw=["onClick"],Lw=["onClick"],jw=["onClick"],Uw=["onClick"],Fw={key:2,class:"request-actions"},Bw=["onClick"],Hw=["onClick"],Ww=["onClick"],Vw=["onClick"],zw={key:3,class:"request-user-input"},Gw={class:"request-question-title"},qw={key:0,class:"request-question-text"},Kw=["value","onChange"],Jw=["value"],Yw=["value","onInput"],Xw=["onClick"],Qw={key:4,class:"request-actions"},Zw=["onClick"],eb=["onClick"],tb={key:5,class:"request-actions"},nb=["onClick"],rb=["onClick"],sb=["data-role","data-message-type"],ob={key:0,class:"message-row","data-role":"system"},ib={class:"message-stack","data-role":"system"},ab=["onClick"],lb={class:"cmd-label"},cb={class:"cmd-status"},ub={class:"cmd-output-inner"},db={class:"cmd-output"},fb=["data-role","data-message-type"],hb=["data-role"],pb=["data-role"],mb=["data-role"],gb=["onClick"],vb=["src"],yb={key:1,class:"message-file-attachments"},wb={class:"message-file-link-wrap"},bb=["href","title"],_b=["href","title"],kb=["data-role"],Tb={key:0,class:"worked-separator-wrap","aria-live":"polite"},Sb=["onClick"],Ib={class:"worked-separator-text"},Eb={key:0,class:"worked-details"},Cb=["onClick"],Ab={class:"cmd-label"},Rb={class:"cmd-status"},Pb={class:"cmd-output-inner"},xb={class:"cmd-output"},Mb={key:1,class:"message-text-flow"},Ob={key:0,class:"message-text"},$b={key:0},Nb={key:1,class:"message-bold-text"},Db={key:2,class:"message-file-link-wrap"},Lb=["href","title"],jb=["href","title"],Ub=["href","title"],Fb={key:4,class:"message-inline-code"},Bb={key:1,class:"message-text"},Hb=["onClick"],Wb=["src","alt","onError"],Vb={key:0,class:"message-actions"},zb=["onClick"],Gb=["onClick"],qb={key:0,class:"conversation-item conversation-item-overlay"},Kb={class:"message-row"},Jb={class:"message-stack"},Yb={class:"live-overlay-inline","aria-live":"polite"},Xb={class:"live-overlay-label"},Qb={key:1,class:"live-overlay-error"},Zb=["src"],e_=16,t_=Lt({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{},isTurnInProgress:{type:Boolean},isRollingBack:{type:Boolean}},emits:["updateScrollState","respondServerRequest","rollback"],setup(e,{emit:t}){const n=j(new Set),r=j(new Set),s=j(new Set),o=j({});function i(g){return g.messageType==="commandExecution"&&!!g.commandExecution}function a(g){var S;return((S=g.commandExecution)==null?void 0:S.status)==="inProgress"||r.value.has(g.id)?!0:n.value.has(g.id)}function l(g){return r.value.has(g.id)}function d(g){var C;if(((C=g.commandExecution)==null?void 0:C.status)==="inProgress")return;const S=new Set(n.value);S.has(g.id)?S.delete(g.id):S.add(g.id),n.value=S}function c(g){const S=new Set(s.value);S.has(g.id)?S.delete(g.id):S.add(g.id),s.value=S}function h(g){return s.value.has(g.id)}function v(g){const S=g.commandExecution;if(!S)return"";switch(S.status){case"inProgress":return"⟳ Running";case"completed":return S.exitCode===0?"✓ Completed":`✗ Exit ${S.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function E(g){var C,K;const S=(C=g.commandExecution)==null?void 0:C.status;return S==="inProgress"?"cmd-status-running":S==="completed"&&((K=g.commandExecution)==null?void 0:K.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function D(g){const S=new Set(r.value);S.add(g),r.value=S,setTimeout(()=>{const C=new Set(r.value);C.delete(g),r.value=C},1e3)}function O(g,S){const C=[];for(let K=S-1;K>=0;K--){const ae=g[K];if(ae.messageType==="commandExecution")C.unshift(ae);else if(ae.role==="user"||ae.messageType==="worked")break}return C}const z=e,R=t,x=j(null),H=j(null),F=j(null),re=j(""),se=j({}),ve=j({}),Ee=j(null);let ie=0,oe=0,ye=0,X=!0;const ke=new WeakSet,Oe=j(new Set);function je(g){if(!g||g.endsWith("/")||g.endsWith("\\"))return!1;if(g.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(g))return!1;const S=g.startsWith("/"),C=/^[A-Za-z]:[\\/]/u.test(g),K=g.startsWith("./")||g.startsWith("../")||g.startsWith("~/"),ae=g.includes("/")||g.includes("\\");return S||C||K||ae}function Pe(g){return g.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||g}function Me(g){return g.replace(/\\/gu,"/")}function Re(g){if(!g.startsWith("file://"))return g;let S=g.replace(/^file:\/\//u,"");try{S=decodeURIComponent(S)}catch{}return/^\/[A-Za-z]:\//u.test(S)&&(S=S.slice(1)),S}function Ke(g){const S=Me(g),C=S.match(/^\/Users\/([^/]+)/u);if(C)return`/Users/${C[1]}`;const K=S.match(/^\/home\/([^/]+)/u);return K?`/home/${K[1]}`:""}function Xe(g){const S=Me(g);if(!S)return S;let C="",K=S;const ae=K.match(/^([A-Za-z]:)(\/.*)?$/u);ae?(C=`${ae[1]}/`,K=(ae[2]??"").replace(/^\/+/u,"")):K.startsWith("/")&&(C="/",K=K.slice(1));const ue=K.split("/").filter(Boolean),Se=[];for(const Ge of ue)if(Ge!=="."){if(Ge===".."){Se.length>0&&Se.pop();continue}Se.push(Ge)}const _e=Se.join("/");return C?`${C}${_e}`.replace(/\/+$/u,"")||C:_e||S}function $e(g,S){const C=Me(Re(g.trim()));if(!C)return"";if(C.startsWith("/")||/^[A-Za-z]:\//u.test(C))return Xe(C);if(C.startsWith("~/")){const ue=Ke(S);if(ue)return Xe(`${ue}/${C.slice(2)}`)}const ae=Me(S.trim());return Xe(ae?`${ae.replace(/\/+$/u,"")}/${C}`:C)}function Je(g){if(!g)return null;let S=g.trim();S=st(S).core.trim();let K=null;const ae=S.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(ae)S=ae[1],K=Number(ae[2]);else{const ue=S.match(/^(.*):(\d+)(?::\d+)?$/u);ue&&(S=ue[1],K=Number(ue[2]))}return S=Re(S),je(S)?{path:S,line:K}:null}function st(g){let S=g,C="",K="";for(;/^['"`“‘]/u.test(S);)C+=S[0],S=S.slice(1);for(;/['"`”’]$/u.test(S);)K=S.slice(-1)+K,S=S.slice(0,-1);return{core:S,leading:C,trailing:K}}function ot(g){const S=g.trim(),C=Qe(S,0);if(!C||C.end!==S.length)return null;const K=C.label.trim(),ae=C.target.trim(),ue=st(K).core.trim()||K,Se=st(ae).core.trim();return Se?{label:ue,target:Se}:null}function Qe(g,S){if(g[S]!=="[")return null;const C=g.indexOf("](",S+1);if(C<0)return null;const K=g.slice(S+1,C);if(!K||K.includes(`
|
|
26
|
+
`))return null;let ae=C+2,ue=1;for(;ae<g.length;){const Se=g[ae];if(Se===`
|
|
27
|
+
`)return null;if(Se==="(")ue+=1;else if(Se===")"&&(ue-=1,ue===0)){const _e=g.slice(C+2,ae);return _e.trim()?{label:K,target:_e,end:ae+1}:null}ae+=1}return null}function Ye(g){const S=[],C=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let K=0;for(const ae of g.matchAll(C)){if(typeof ae.index!="number")continue;const ue=ae.index,Se=ue+ae[0].length;ue>K&&S.push({kind:"text",value:g.slice(K,ue)});let _e=ae[0],Ge="";for(;/[.,;:]$/u.test(_e);)Ge=_e.slice(-1)+Ge,_e=_e.slice(0,-1);const et=st(_e);_e=et.core;const wt=et.leading,$t=et.trailing+Ge;if(wt&&S.push({kind:"text",value:wt}),_e.startsWith("**")&&_e.endsWith("**")&&_e.length>4)S.push({kind:"bold",value:_e.slice(2,-2)}),$t&&S.push({kind:"text",value:$t});else if(/^https?:\/\//u.test(_e))S.push({kind:"url",value:_e,href:_e}),$t&&S.push({kind:"text",value:$t});else{const un=Je(_e);un?(S.push({kind:"file",value:_e,path:un.path,displayPath:_e,downloadName:Pe(un.path)}),$t&&S.push({kind:"text",value:$t})):S.push({kind:"text",value:ae[0]})}K=Se}return K<g.length&&S.push({kind:"text",value:g.slice(K)}),J(S)}function J(g){const S=[];let C=!1,K="";const ae=ue=>{ue&&S.push({kind:"text",value:ue})};for(const ue of g){if(ue.kind!=="text"){C&&(ae(`**${K}`),C=!1,K=""),S.push(ue);continue}let Se=ue.value;for(;Se.length>0;){const _e=Se.indexOf("**");if(_e<0){C?K+=Se:ae(Se);break}const Ge=Se.slice(0,_e);C?K+=Ge:ae(Ge),Se=Se.slice(_e+2),C?(K.length>0?S.push({kind:"bold",value:K}):ae("****"),K="",C=!1):C=!0}}return C&&ae(`**${K}`),S}function he(g){const S=[];let C=0;for(;C<g.length;){const K=g.indexOf("[",C);if(K<0)break;const ae=Qe(g,K);if(!ae){C=K+1;continue}K>C&&S.push(...Ye(g.slice(C,K)));const ue=st(ae.label.trim()).core.trim()||ae.label.trim(),Se=st(ae.target.trim()).core.trim();if(/^https?:\/\//u.test(Se))S.push({kind:"url",value:ue||Se,href:Se});else{const _e=Je(Se);_e?S.push({kind:"file",value:Se,path:_e.path,displayPath:ue||Se,downloadName:Pe(_e.path)}):S.push({kind:"text",value:g.slice(K,ae.end)})}C=ae.end}return C<g.length&&S.push(...Ye(g.slice(C))),S}function pe(g){if(!g.includes("`"))return he(g);const S=[];let C=0,K=0;for(;C<g.length;){if(g[C]!=="`"){C+=1;continue}let ae=1;for(;C+ae<g.length&&g[C+ae]==="`";)ae+=1;const ue="`".repeat(ae);let Se=C+ae,_e=-1;for(;Se<g.length;){const et=g.indexOf(ue,Se);if(et<0)break;const wt=et>0&&g[et-1]==="`",$t=et+ae<g.length&&g[et+ae]==="`",un=g.slice(C+ae,et).includes(`
|
|
28
|
+
`);if(!wt&&!$t&&!un){_e=et;break}Se=et+1}if(_e<0){C+=ae;continue}C>K&&S.push(...he(g.slice(K,C)));const Ge=g.slice(C+ae,_e);if(Ge.length>0){const et=ot(Ge);if(et)if(/^https?:\/\//u.test(et.target))S.push({kind:"url",value:et.label||et.target,href:et.target});else{const wt=Je(et.target);wt?S.push({kind:"file",value:et.target,path:wt.path,displayPath:et.label||et.target,downloadName:Pe(wt.path)}):S.push({kind:"code",value:Ge})}else{const wt=Je(Ge);if(wt){const $t=wt.line?`${wt.path}:${String(wt.line)}`:wt.path;S.push({kind:"file",value:Ge,path:wt.path,displayPath:$t,downloadName:Pe(wt.path)})}else S.push({kind:"code",value:Ge})}}else S.push({kind:"text",value:`${ue}${ue}`});C=_e+ae,K=C}return K<g.length&&S.push(...he(g.slice(K))),S}function Ce(g){const S=g.trim();if(!S)return"";if(S.startsWith("data:")||S.startsWith("blob:")||S.startsWith("http://")||S.startsWith("https://")||S.startsWith("/codex-local-image?"))return S;if(S.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(S)}`;const C=S.startsWith("/"),K=/^[A-Za-z]:[\\/]/u.test(S);return C||K?`/codex-local-image?path=${encodeURIComponent(S)}`:S}function Ie(g){const S=g.trim();if(!S)return"#";const C=Se=>Se.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Se),K=Je(S),ae=(K==null?void 0:K.path)??S,ue=$e(ae,z.cwd);if(C(ue)){const Se=ue.startsWith("/")?ue:`/${ue}`;return`/codex-local-browse${encodeURI(Se)}`}return"#"}function y(g){return _(g)!=="#"}function _(g){const S=g.trim();if(!S)return"#";const C=Je(S),K=(C==null?void 0:C.path)??S,ae=$e(K,z.cwd);if(!(_e=>_e.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(_e))(ae))return"#";const Se=ae.startsWith("/")?ae:`/${ae}`;return`/codex-local-edit${encodeURI(Se)}`}function M(g){if(!g.includes(")return[{kind:"text",value:g}];const S=[],C=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let K=0;for(const ae of g.matchAll(C)){const[ue,Se,_e]=ae;if(typeof ae.index!="number")continue;const Ge=ae.index,et=Ge+ue.length,wt=Ce(_e.trim());wt&&(Ge>K&&S.push({kind:"text",value:g.slice(K,Ge)}),S.push({kind:"image",url:wt,alt:Se.trim(),markdown:ue}),K=et)}return K<g.length&&S.push({kind:"text",value:g.slice(K)}),S.length>0?S:[{kind:"text",value:g}]}function Y(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)?g:null}function G(g){const S=new Date(g);return Number.isNaN(S.getTime())?g:S.toLocaleTimeString()}function $(g){const S=Y(g.params),C=S==null?void 0:S.reason;return typeof C=="string"?C.trim():""}function W(g,S){return`${String(g)}:${S}`}function B(g){const S=Y(g.params),C=Array.isArray(S==null?void 0:S.questions)?S.questions:[],K=[];for(const ae of C){const ue=Y(ae);if(!ue)continue;const Se=typeof ue.id=="string"?ue.id:"";if(!Se)continue;const _e=Array.isArray(ue.options)?ue.options.map(Ge=>Y(Ge)).map(Ge=>Ge==null?void 0:Ge.label).filter(Ge=>typeof Ge=="string"&&Ge.length>0):[];K.push({id:Se,header:typeof ue.header=="string"?ue.header:"",question:typeof ue.question=="string"?ue.question:"",isOther:ue.isOther===!0,options:_e})}return K}function Z(g,S,C){const K=W(g,S),ae=se.value[K];return typeof ae=="string"&&ae.length>0?ae:C}function q(g,S){const C=W(g,S);return ve.value[C]??""}function we(g,S,C){const K=C.target;if(!(K instanceof HTMLSelectElement))return;const ae=W(g,S);se.value={...se.value,[ae]:K.value}}function de(g,S,C){const K=C.target;if(!(K instanceof HTMLInputElement))return;const ae=W(g,S);ve.value={...ve.value,[ae]:K.value}}function ge(g,S){R("respondServerRequest",{id:g,result:{decision:S}})}function Ae(g){const S=B(g),C={};for(const K of S){const ae=Z(g.id,K.id,K.options[0]||""),ue=q(g.id,K.id).trim(),Se=[ae,ue].map(_e=>_e.trim()).filter(_e=>_e.length>0);C[K.id]={answers:Se}}R("respondServerRequest",{id:g.id,result:{answers:C}})}function Be(g){R("respondServerRequest",{id:g,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function We(g){R("respondServerRequest",{id:g,result:{success:!0,contentItems:[]}})}function ze(g){R("respondServerRequest",{id:g,result:{}})}function Ze(g){R("respondServerRequest",{id:g,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function at(g){return!(g.role!=="user"&&g.role!=="assistant"||typeof g.turnIndex!="number"||z.isTurnInProgress||z.isRollingBack)}function ht(g){return g.role!=="user"&&g.role!=="assistant"?!1:g.text.trim().length>0}function vt(g){return ht(g)||at(g)}async function Mt(g){if(!ht(g))return;const S=g.text.trim();try{await navigator.clipboard.writeText(S)}catch{const C=document.createElement("textarea");C.value=S,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 Ot(g){if(!at(g))return;const S=g.role==="user"?g.text.trim():"";R("rollback",{turnIndex:g.turnIndex,prependText:S.length>0?S:void 0})}function yt(){const g=x.value,S=H.value;!g||!S||(g.scrollTop=g.scrollHeight,S.scrollIntoView({block:"end"}))}function lt(g){return g.scrollHeight-(g.scrollTop+g.clientHeight)<=e_}function Rt(g){const S=Math.max(g.scrollHeight-g.clientHeight,0),C=S>0?Math.min(Math.max(g.scrollTop/S,0),1):1;return{scrollTop:g.scrollTop,isAtBottom:lt(g),scrollRatio:C}}function jt(){return Ee.value??z.scrollState}function Bt(g){const S=Rt(g);Ee.value=S,z.activeThreadId&&R("updateScrollState",{threadId:z.activeThreadId,state:S})}function bn(){const g=x.value;if(!g)return;const S=jt();if(!S||S.isAtBottom){kt();return}const C=Math.max(g.scrollHeight-g.clientHeight,0),K=S.scrollTop;g.scrollTop=Math.min(Math.max(K,0),C),Bt(g)}function kt(){const g=x.value;g&&(yt(),Bt(g))}function ct(){const g=jt();return!g||g.isAtBottom===!0}function Ht(){if(!ct()){ye=0,oe=0;return}if(kt(),ye-=1,ye<=0){oe=0;return}oe=requestAnimationFrame(Ht)}function Tt(g=6){ct()&&(oe&&(cancelAnimationFrame(oe),oe=0),ye=Math.max(g,1),oe=requestAnimationFrame(Ht))}function rt(){Tt(3)}function Ut(){if(!ct())return;const g=x.value;if(!g)return;const S=g.querySelectorAll("img.message-image-preview");for(const C of S)C.complete||ke.has(C)||(ke.add(C),C.addEventListener("load",rt,{once:!0}),C.addEventListener("error",rt,{once:!0}))}async function Gt(g={}){const S=g.restoreSavedState??X;await Vt(),ie&&cancelAnimationFrame(ie),ie=requestAnimationFrame(()=>{ie=0;const C=x.value;S?(bn(),X=!1):ct()?kt():C&&Bt(C),Ut(),Tt()})}ut(()=>z.messages,async g=>{if(!z.isLoading){for(const S of g){if(S.messageType!=="commandExecution"||!S.commandExecution)continue;const C=o.value[S.id],K=S.commandExecution.status;C==="inProgress"&&K!=="inProgress"&&D(S.id),o.value[S.id]=K}await Gt()}}),ut(()=>z.liveOverlay,async g=>{if(!g){await Gt();return}await Gt()},{deep:!0}),ut(()=>z.isLoading,async g=>{g||await Gt({restoreSavedState:!0})}),ut(()=>z.activeThreadId,async()=>{X=!0,Ee.value=null,re.value="",Oe.value=new Set,await Gt({restoreSavedState:!0})},{flush:"post"});function hn(){const g=x.value;!g||z.isLoading||Bt(g)}function qt(g){re.value=Ce(g)}function cn(g,S){return`${g}:${String(S)}`}function _n(g,S){const C=new Set(Oe.value);C.add(cn(g,S)),Oe.value=C}function kn(g,S){return Oe.value.has(cn(g,S))}function Kt(){re.value=""}function De(){const g=F.value;g&&(g.scrollTop=g.scrollHeight)}return ut(()=>{var g;return(g=z.liveOverlay)==null?void 0:g.reasoningText},async g=>{g&&(await Vt(),De())}),hr(()=>{ie&&cancelAnimationFrame(ie),oe&&cancelAnimationFrame(oe)}),(g,S)=>(b(),I("section",Ew,[e.isLoading?(b(),I("p",Cw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(b(),I("p",Aw," No messages in this thread yet. ")):(b(),I("ul",{key:2,ref_key:"conversationListRef",ref:x,class:"conversation-list",onScroll:hn},[(b(!0),I(Ue,null,It(e.pendingRequests,C=>(b(),I("li",{key:`server-request:${C.id}`,class:"conversation-item conversation-item-request"},[m("div",Rw,[m("div",Pw,[m("article",xw,[m("p",Mw,ce(C.method),1),m("p",Ow,"Request #"+ce(C.id)+" · "+ce(G(C.receivedAtIso)),1),$(C)?(b(),I("p",$w,ce($(C)),1)):le("",!0),C.method==="item/commandExecution/requestApproval"?(b(),I("section",Nw,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>ge(C.id,"accept")},"Accept",8,Dw),m("button",{type:"button",class:"request-button",onClick:K=>ge(C.id,"acceptForSession")},"Accept for Session",8,Lw),m("button",{type:"button",class:"request-button",onClick:K=>ge(C.id,"decline")},"Decline",8,jw),m("button",{type:"button",class:"request-button",onClick:K=>ge(C.id,"cancel")},"Cancel",8,Uw)])):C.method==="item/fileChange/requestApproval"?(b(),I("section",Fw,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>ge(C.id,"accept")},"Accept",8,Bw),m("button",{type:"button",class:"request-button",onClick:K=>ge(C.id,"acceptForSession")},"Accept for Session",8,Hw),m("button",{type:"button",class:"request-button",onClick:K=>ge(C.id,"decline")},"Decline",8,Ww),m("button",{type:"button",class:"request-button",onClick:K=>ge(C.id,"cancel")},"Cancel",8,Vw)])):C.method==="item/tool/requestUserInput"?(b(),I("section",zw,[(b(!0),I(Ue,null,It(B(C),K=>(b(),I("div",{key:`${C.id}:${K.id}`,class:"request-question"},[m("p",Gw,ce(K.header||K.question),1),K.header&&K.question?(b(),I("p",qw,ce(K.question),1)):le("",!0),m("select",{class:"request-select",value:Z(C.id,K.id,K.options[0]||""),onChange:ae=>we(C.id,K.id,ae)},[(b(!0),I(Ue,null,It(K.options,ae=>(b(),I("option",{key:`${C.id}:${K.id}:${ae}`,value:ae},ce(ae),9,Jw))),128))],40,Kw),K.isOther?(b(),I("input",{key:1,class:"request-input",type:"text",value:q(C.id,K.id),placeholder:"Other answer",onInput:ae=>de(C.id,K.id,ae)},null,40,Yw)):le("",!0)]))),128)),m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>Ae(C)}," Submit Answers ",8,Xw)])):C.method==="item/tool/call"?(b(),I("section",Qw,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>Be(C.id)},"Fail Tool Call",8,Zw),m("button",{type:"button",class:"request-button",onClick:K=>We(C.id)},"Success (Empty)",8,eb)])):(b(),I("section",tb,[m("button",{type:"button",class:"request-button request-button-primary",onClick:K=>ze(C.id)},"Return Empty Result",8,nb),m("button",{type:"button",class:"request-button",onClick:K=>Ze(C.id)},"Reject Request",8,rb)]))])])])]))),128)),(b(!0),I(Ue,null,It(e.messages,C=>{var K,ae;return b(),I("li",{key:C.id,class:nt(["conversation-item",{"conversation-item-actionable":vt(C)}]),"data-role":C.role,"data-message-type":C.messageType||""},[i(C)?(b(),I("div",ob,[m("div",ib,[m("button",{type:"button",class:nt(["cmd-row",[E(C),{"cmd-expanded":a(C)}]]),onClick:ue=>d(C)},[m("span",{class:nt(["cmd-chevron",{"cmd-chevron-open":a(C)}])},"▶",2),m("code",lb,ce(((K=C.commandExecution)==null?void 0:K.command)||"(command)"),1),m("span",cb,ce(v(C)),1)],10,ab),m("div",{class:nt(["cmd-output-wrap",{"cmd-output-visible":a(C),"cmd-output-collapsing":l(C)}])},[m("div",ub,[m("pre",db,ce(((ae=C.commandExecution)==null?void 0:ae.aggregatedOutput)||"(no output)"),1)])],2)])])):(b(),I("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?(b(),I("ul",{key:0,class:"message-image-list","data-role":C.role},[(b(!0),I(Ue,null,It(C.images,ue=>(b(),I("li",{key:ue,class:"message-image-item"},[m("button",{class:"message-image-button",type:"button",onClick:Se=>qt(ue)},[m("img",{class:"message-image-preview",src:Ce(ue),alt:"Message image preview",loading:"lazy"},null,8,vb)],8,gb)]))),128))],8,mb)):le("",!0),C.fileAttachments&&C.fileAttachments.length>0?(b(),I("div",yb,[(b(!0),I(Ue,null,It(C.fileAttachments,ue=>(b(),I("span",{key:ue.path,class:"message-file-chip"},[S[1]||(S[1]=m("span",{class:"message-file-chip-icon"},"📄",-1)),m("span",wb,[m("a",{class:"message-file-link message-file-chip-name",href:Ie(ue.path),target:"_blank",rel:"noopener noreferrer",title:ue.path},ce(ue.path),9,bb),y(ue.path)?(b(),I("a",{key:0,class:"message-file-edit-link",href:_(ue.path),target:"_blank",rel:"noopener noreferrer",title:`Edit ${ue.path}`,"aria-label":"Edit file"}," Edit ",8,_b)):le("",!0)])]))),128))])):le("",!0),C.text.length>0?(b(),I("article",{key:2,class:"message-card","data-role":C.role},[C.messageType==="worked"?(b(),I("div",Tb,[m("button",{type:"button",class:"worked-separator",onClick:ue=>c(C)},[S[2]||(S[2]=m("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),m("span",{class:nt(["worked-chevron",{"worked-chevron-open":h(C)}])},"▶",2),m("p",Ib,ce(C.text),1),S[3]||(S[3]=m("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,Sb),h(C)?(b(),I("div",Eb,[(b(!0),I(Ue,null,It(O(e.messages,e.messages.indexOf(C)),ue=>{var Se,_e;return b(),I("div",{key:`worked-cmd-${ue.id}`,class:"worked-cmd-item"},[m("button",{type:"button",class:nt(["cmd-row",[E(ue),{"cmd-expanded":a(ue)}]]),onClick:Ge=>d(ue)},[m("span",{class:nt(["cmd-chevron",{"cmd-chevron-open":a(ue)}])},"▶",2),m("code",Ab,ce(((Se=ue.commandExecution)==null?void 0:Se.command)||"(command)"),1),m("span",Rb,ce(v(ue)),1)],10,Cb),m("div",{class:nt(["cmd-output-wrap",{"cmd-output-visible":a(ue),"cmd-output-collapsing":l(ue)}])},[m("div",Pb,[m("pre",xb,ce(((_e=ue.commandExecution)==null?void 0:_e.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):le("",!0)])):(b(),I("div",Mb,[(b(!0),I(Ue,null,It(M(C.text),(ue,Se)=>(b(),I(Ue,{key:`block-${Se}`},[ue.kind==="text"?(b(),I("p",Ob,[(b(!0),I(Ue,null,It(pe(ue.value),(_e,Ge)=>(b(),I(Ue,{key:`seg-${Se}-${Ge}`},[_e.kind==="text"?(b(),I("span",$b,ce(_e.value),1)):_e.kind==="bold"?(b(),I("strong",Nb,ce(_e.value),1)):_e.kind==="file"?(b(),I("span",Db,[m("a",{class:"message-file-link",href:Ie(_e.path),target:"_blank",rel:"noopener noreferrer",title:_e.path},ce(_e.displayPath),9,Lb),y(_e.path)?(b(),I("a",{key:0,class:"message-file-edit-link",href:_(_e.path),target:"_blank",rel:"noopener noreferrer",title:`Edit ${_e.path}`,"aria-label":"Edit file"}," Edit ",8,jb)):le("",!0)])):_e.kind==="url"?(b(),I("a",{key:3,class:"message-file-link",href:_e.href,target:"_blank",rel:"noopener noreferrer",title:_e.href},ce(_e.value),9,Ub)):(b(),I("code",Fb,ce(_e.value),1))],64))),128))])):kn(C.id,Se)?(b(),I("p",Bb,ce(ue.markdown),1)):(b(),I("button",{key:2,class:"message-image-button",type:"button",onClick:_e=>qt(ue.url)},[m("img",{class:"message-image-preview message-markdown-image",src:ue.url,alt:ue.alt||"Embedded message image",loading:"lazy",onError:_e=>_n(C.id,Se)},null,40,Wb)],8,Hb))],64))),128))]))],8,kb)):le("",!0)],8,pb),vt(C)?(b(),I("div",Vb,[ht(C)?(b(),I("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:ue=>Mt(C)},[xe(Iw,{class:"message-action-icon"}),S[4]||(S[4]=m("span",{class:"message-action-label"},"Copy",-1))],8,zb)):le("",!0),at(C)?(b(),I("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:ue=>Ot(C)},[xe(_w,{class:"message-action-icon"}),S[5]||(S[5]=m("span",{class:"message-action-label"},"Rollback",-1))],8,Gb)):le("",!0)])):le("",!0)],8,hb)],8,fb))],10,sb)}),128)),e.liveOverlay?(b(),I("li",qb,[m("div",Kb,[m("div",Jb,[m("article",Yb,[m("p",Xb,ce(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(b(),I("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:F},ce(e.liveOverlay.reasoningText),513)):le("",!0),e.liveOverlay.errorText?(b(),I("p",Qb,ce(e.liveOverlay.errorText),1)):le("",!0)])])])])):le("",!0),m("li",{ref_key:"bottomAnchorRef",ref:H,class:"conversation-bottom-anchor"},null,512)],544)),re.value.length>0?(b(),I("div",{key:3,class:"image-modal-backdrop",onClick:Kt},[m("div",{class:"image-modal-content",onClick:S[0]||(S[0]=it(()=>{},["stop"]))},[m("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Kt},[xe(kl,{class:"icon-svg"})]),m("img",{class:"image-modal-image",src:re.value,alt:"Expanded message image"},null,8,Zb)])])):le("",!0)]))}}),n_=tt(t_,[["__scopeId","data-v-36077d40"]]),eu=.0025,ra=3,tu=2,r_=256;function s_(e){var ye;const t=j("idle"),n=j(typeof navigator<"u"&&!!((ye=navigator.mediaDevices)!=null&&ye.getUserMedia)),r=j(0),s=j(null);let o=null,i=null,a=[],l=null,d=null,c=null,h=null,v=[],E=!1,D=!1,O=null;function z(){O&&(O.abort(),O=null),t.value==="transcribing"&&(t.value="idle")}function R(){const X=s.value;if(!X||typeof window>"u")return;const ke=X.getContext("2d");if(!ke)return;const Oe=Math.max(1,Math.floor(X.clientWidth)),je=Math.max(1,Math.floor(X.clientHeight||36)),Pe=window.devicePixelRatio||1,Me=Math.max(1,Math.floor(Oe*Pe)),Re=Math.max(1,Math.floor(je*Pe));(X.width!==Me||X.height!==Re)&&(X.width=Me,X.height=Re),ke.setTransform(Pe,0,0,Pe,0,0),ke.clearRect(0,0,Oe,je);const Ke=Math.max(12,Math.floor(Oe/(ra+tu))),Xe=v.slice(-Ke),$e=Math.max(0,Ke-Xe.length),Je=je/2,st=getComputedStyle(X).color||"#000000";for(let ot=0;ot<Ke;ot+=1){const Qe=Xe[ot-$e]??0,J=Math.max(.08,Math.min(1,Qe*18))*Je,he=ot*(ra+tu);ke.globalAlpha=Qe<=eu?.35:1,ke.fillStyle=st,ke.fillRect(he,Je-J,ra,J*2)}ke.globalAlpha=1}function x(){v=[],r.value=0,R()}function H(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),h=null}function F(X){if(typeof window>"u")return;const ke=window.webkitAudioContext,Oe=window.AudioContext??ke;Oe&&(H(),x(),l=new Oe,d=l.createMediaStreamSource(X),c=l.createScriptProcessor(2048,1,1),h=performance.now(),c.onaudioprocess=je=>{const Pe=je.inputBuffer.getChannelData(0);let Me=0;for(let Re=0;Re<Pe.length;Re+=1){const Ke=Math.abs(Pe[Re]??0);Me+=Ke<eu?0:Ke}v.push(Me/Pe.length),v.length>r_&&v.shift(),h!==null&&(r.value=Math.max(0,performance.now()-h)),R()},d.connect(c),c.connect(l.destination),R())}async function re(){var X;if(t.value==="transcribing"&&z(),!(t.value!=="idle"||!n.value||E)){E=!0,D=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=ke=>{ke.data.size>0&&a.push(ke.data)},o.onstop=()=>{var je;const ke=a,Oe=(o==null?void 0:o.mimeType)||((je=ke[0])==null?void 0:je.type)||"audio/webm";ie(),Ee(ke,Oe)},F(i),o.start(250),t.value="recording",D&&se()}catch(ke){ie(),t.value="idle",(X=e.onError)==null||X.call(e,ke)}finally{E=!1}}}function se(){if(E&&t.value==="idle"){D=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function ve(){D=!1,z(),ie(),t.value="idle"}async function Ee(X,ke){var Pe,Me,Re,Ke,Xe;if(X.length===0){(Pe=e.onEmpty)==null||Pe.call(e),t.value="idle";return}const Oe=new Blob(X,{type:ke});t.value="transcribing";let je=null;try{const $e=ke.split(/[/;]/)[1]??"webm",Je=new FormData;Je.append("file",Oe,`codex.${$e}`);const st=((Me=e.getLanguage)==null?void 0:Me.call(e).trim())??"";st&&st.toLowerCase()!=="auto"&&Je.append("language",st),je=new AbortController,O=je;const ot=await fetch("/codex-api/transcribe",{method:"POST",body:Je,signal:je.signal}),Qe=await ot.text();let Ye=null;try{Ye=Qe.trim()?JSON.parse(Qe):null}catch{Ye=null}if(!ot.ok){const he=(Re=Ye==null?void 0:Ye.error)==null?void 0:Re.trim(),pe=Qe.trim();throw new Error(he||pe||`Transcription failed: ${ot.status}`)}const J=((Ye==null?void 0:Ye.text)??"").trim();J.length>0?e.onTranscript(J):(Ke=e.onEmpty)==null||Ke.call(e)}catch($e){if($e instanceof DOMException&&$e.name==="AbortError")return;(Xe=e.onError)==null||Xe.call(e,$e)}finally{je&&O===je&&(O=null),t.value==="transcribing"&&(t.value="idle")}}function ie(){H(),x(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(X=>X.stop()),i=null),a=[]}hr(()=>{ve()});function oe(){if(t.value==="recording"){se();return}(t.value==="idle"||t.value==="transcribing")&&re()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:re,stopRecording:se,toggleRecording:oe,cancel:ve}}function nu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class sr 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=nu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=nu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function ks(e,t,n){return e instanceof sr?e:e instanceof Error?new sr(e.message||t,{code:"unknown_error",method:n}):new sr(t,{code:"unknown_error",method:n})}function Rf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function o_(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 sr(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 sr(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 sr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function ru(e){const t=Rf(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 i_(e){if(typeof window>"u")return()=>{};let t=null,n=!1;const r=()=>{if(typeof EventSource>"u"||n)return;const s=new EventSource("/codex-api/events");s.onmessage=o=>{try{const i=JSON.parse(o.data),a=ru(i);a&&e(a)}catch{}},t=()=>s.close()};if(typeof WebSocket<"u"){const s=window.location.protocol==="https:"?"wss:":"ws:",o=new WebSocket(`${s}//${window.location.host}/codex-api/ws`);let i=!1,a=window.setTimeout(()=>{i||n||(o.close(),r())},2500);o.onopen=()=>{i=!0,a!==null&&(window.clearTimeout(a),a=null)},o.onmessage=l=>{try{const d=JSON.parse(String(l.data)),c=ru(d);c&&e(c)}catch{}},o.onerror=()=>{!i&&!n&&r()},o.onclose=()=>{a!==null&&(window.clearTimeout(a),a=null),!i&&!n&&r()},t=()=>o.close()}else r();return()=>{n=!0,t==null||t()}}async function a_(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 sr(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 sr(Tl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function l_(){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 sr(Tl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Rf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function su(e){return new Date(e*1e3).toISOString()}function c_(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function u_(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const d_=/^##\s+(.+?):\s+(.+?)\s*$/,f_=/^#\s*files mentioned by the user\s*:?\s*$/i;function h_(e){var s,o;const t=e.split(`
|
|
29
|
+
`).findIndex(i=>f_.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
30
|
+
`).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(d_);if(!l)break;const d=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&r.push({label:d,path:c})}return r}function p_(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 m_(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[a,l]of t.entries())l.type==="text"&&typeof l.text=="string"&&l.text.length>0&&n.push(l.text),l.type==="image"&&typeof l.url=="string"&&l.url.trim().length>0&&r.push(l.url.trim()),l.type!=="text"&&l.type!=="image"&&s.push({id:`${e}:user-content:${a}`,role:"user",text:"",messageType:`userContent.${l.type}`,rawPayload:u_(l),isUnhandled:!0});const o=n.join(`
|
|
31
|
+
`),i=h_(o);return{text:p_(o),images:r,fileAttachments:i,rawBlocks:s}}function g_(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=m_(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=v_(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 v_(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function y_(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function w_(e){const t=y_(e);return t.length>0?t:"Untitled thread"}function Pf(e){return(e==null?void 0:e.status)==="inProgress"}function b_(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 Pf(r)}function __(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:w_(e),projectName:c_(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:su(e.createdAt),updatedAtIso:su(e.updatedAt),preview:e.preview,unread:!1,inProgress:b_(e)}}function k_(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((s,o)=>new Date(o.updatedAtIso).getTime()-new Date(s.updatedAtIso).getTime())})).sort((n,r)=>{var i,a;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((a=r.threads[0])==null?void 0:a.updatedAtIso)??0).getTime()-s})}function T_(e){const t=e.data.map(__);return k_(t)}function xf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const s=t[r],o=Array.isArray(s.items)?s.items:[];for(const i of o)for(const a of g_(i))n.push({...a,turnIndex:r})}return n}function S_(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Pf(t.at(-1))}async function tn(e,t){try{return await o_(e,t)}catch(n){throw ks(n,`RPC ${e} failed`,e)}}function I_(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function E_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function C_(){const e=await tn("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return T_(e)}async function A_(e){const t=await tn("thread/read",{threadId:e,includeTurns:!0});return{messages:xf(t),inProgress:S_(t)}}async function R_(){try{return await C_()}catch(e){throw ks(e,"Failed to load thread groups","thread/list")}}async function P_(e){try{return await A_(e)}catch(t){throw ks(t,`Failed to load thread ${e}`,"thread/read")}}function x_(e){return i_(e)}async function M_(e,t){await a_({id:e,...t})}async function O_(){return l_()}async function sa(e){await tn("thread/resume",{threadId:e})}async function $_(e){await tn("thread/archive",{threadId:e})}async function N_(e,t){await tn("thread/name/set",{threadId:e,name:t})}async function ou(e,t){const n=await tn("thread/rollback",{threadId:e,numTurns:t});return xf(n)}function D_(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 iu(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 tn("thread/start",n),s=D_(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw ks(n,"Failed to start a new thread","thread/start")}}function L_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
32
|
+
`;for(const r of t)n+=`
|
|
33
|
+
## ${r.label}: ${r.path}
|
|
34
|
+
`;return`${n}
|
|
35
|
+
## My request for Codex:
|
|
36
|
+
|
|
37
|
+
${e}
|
|
38
|
+
`}async function oa(e,t,n=[],r,s,o,i=[]){try{const l=[{type:"text",text:L_(t,i)}];for(const h of n){const v=h.trim();v&&l.push({type:"image",url:v,image_url:v})}if(o)for(const h of o)l.push({type:"skill",name:h.name,path:h.path});const d=i.map(h=>({label:h.label,path:h.path,fsPath:h.fsPath})),c={threadId:e,input:l};d.length>0&&(c.attachments=d),typeof r=="string"&&r.length>0&&(c.model=r),typeof s=="string"&&s.length>0&&(c.effort=s),await tn("turn/start",c)}catch(a){throw ks(a,`Failed to start turn for thread ${e}`,"turn/start")}}async function j_(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 tn("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw ks(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function U_(e){await tn("setDefaultModel",{model:e})}async function F_(e){const t=e==="fast"?"fast":"standard";await tn("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function B_(){const e=await tn("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 H_(){const e=await tn("config/read",{}),t=e.config.model??"",n=I_(e.config.model_reasoning_effort),r=E_(e.config.service_tier);return{model:t,reasoningEffort:n,speedMode:r}}async function W_(){return await tn("account/rateLimits/read")}function V_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const a of o)typeof a=="string"&&a.length>0&&!i.includes(a)&&i.push(a);return i},r=t.labels,s={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,i]of Object.entries(r))typeof o=="string"&&o.length>0&&typeof i=="string"&&(s[o]=i);return{order:n(t.order),labels:s,active:n(t.active)}}async function ja(){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 V_(n.data)}async function z_(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 G_(e,t){const n=await fetch("/codex-api/worktree/auto-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to auto-commit worktree changes");return r.data}async function q_(e,t){const n=await fetch("/codex-api/worktree/rollback-to-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to rollback worktree to message commit");return r.data}async function au(){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 K_(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 lu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const a=co(r,"Failed to open project root");throw new Error(a)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return typeof o.path=="string"?o.path.trim():""}async function J_(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=co(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 Y_(e,t,n=20){const r=e.trim();if(!r)return[];const s=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),o=await s.json();if(!s.ok){const d=co(o,"Failed to search files");throw new Error(d)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const d of a){if(!d||typeof d!="object"||Array.isArray(d))continue;const h=d.path,v=typeof h=="string"?h.trim():"";v&&l.push({path:v})}return l}async function X_(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}}async function Q_(e){const t=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e})}),n=await t.json();if(!t.ok){const r=co(n,"Failed to connect Telegram bot");throw new Error(r)}}async function Z_(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const s=co(t,"Failed to load Telegram status");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,lastError:typeof r.lastError=="string"?r.lastError:""}}function co(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 ek(){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 ia(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 tk(e,t){var n;try{return((n=(await tn("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function nk(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await tn("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 cu(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 rk={},sk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ok(e,t){return b(),I("svg",sk,[...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 ik=tt(rk,[["render",ok]]),ak={},lk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ck(e,t){return b(),I("svg",lk,[...t[0]||(t[0]=[m("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const uk=tt(ak,[["render",ck]]),dk={},fk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function hk(e,t){return b(),I("svg",fk,[...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 pk=tt(dk,[["render",hk]]),mk={},gk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vk(e,t){return b(),I("svg",gk,[...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 uu=tt(mk,[["render",vk]]),yk=["disabled"],wk={class:"composer-dropdown-value"},bk={class:"composer-dropdown-menu"},_k={key:0,class:"composer-dropdown-search-wrap"},kk=["placeholder","onKeydown"],Tk={class:"composer-dropdown-options",role:"listbox"},Sk=["onClick"],Ik={key:0,class:"composer-dropdown-empty"},Ek={key:1,class:"composer-dropdown-add-wrap"},Ck=["placeholder","onKeydown"],Ak=Lt({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},showAddAction:{type:Boolean},addActionLabel:{},defaultAddValue:{},addPlaceholder:{}},emits:["update:modelValue","add"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(null),a=j(!1),l=j(""),d=j(!1),c=j(""),h=fe(()=>{var ye;const oe=n.options.find(X=>X.value===n.modelValue);return oe?oe.label:((ye=n.placeholder)==null?void 0:ye.trim())||""}),v=fe(()=>n.openDirection??"down"),E=fe(()=>n.enableSearch===!0),D=fe(()=>n.showAddAction===!0),O=fe(()=>{var oe;return((oe=n.searchPlaceholder)==null?void 0:oe.trim())||"Quick search projects"}),z=fe(()=>{var oe;return((oe=n.addActionLabel)==null?void 0:oe.trim())||"Add new project"}),R=fe(()=>{var oe;return((oe=n.addPlaceholder)==null?void 0:oe.trim())||"Project name or absolute path"}),x=fe(()=>{const oe=l.value.trim().toLowerCase();return oe?n.options.filter(ye=>ye.label.toLowerCase().includes(oe)||ye.value.toLowerCase().includes(oe)):n.options});function H(){n.disabled||(a.value=!a.value)}function F(oe){r("update:modelValue",oe),a.value=!1,l.value=""}function re(){var oe;d.value=!0,c.value=((oe=n.defaultAddValue)==null?void 0:oe.trim())||"",Vt(()=>{var ye;return(ye=i.value)==null?void 0:ye.focus()})}function se(){if(l.value.length>0){l.value="";return}a.value=!1}function ve(){const oe=c.value.trim();oe&&(r("add",oe),d.value=!1,c.value="",a.value=!1,l.value="")}function Ee(){d.value=!1,c.value="",a.value=!1,l.value=""}function ie(oe){if(!a.value)return;const ye=s.value;if(!ye)return;const X=oe.target;X instanceof Node&&(ye.contains(X)||(a.value=!1,l.value="",d.value=!1,c.value=""))}return ut(a,oe=>{if(!oe){d.value=!1,c.value="";return}E.value&&Vt(()=>{var ye;return(ye=o.value)==null?void 0:ye.focus()})}),zn(()=>{window.addEventListener("pointerdown",ie)}),hr(()=>{window.removeEventListener("pointerdown",ie)}),(oe,ye)=>(b(),I("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[m("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:H},[e.selectedPrefixIcon?(b(),ft(Go(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):le("",!0),m("span",wk,ce(h.value),1),xe(bi,{class:"composer-dropdown-chevron"})],8,yk),a.value?(b(),I("div",{key:0,class:nt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":v.value==="up","composer-dropdown-menu-wrap-down":v.value==="down"}])},[m("div",bk,[E.value?(b(),I("div",_k,[lr(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":ye[0]||(ye[0]=X=>l.value=X),class:"composer-dropdown-search-input",type:"text",placeholder:O.value,onKeydown:on(it(se,["prevent"]),["esc"])},null,40,kk),[[cr,l.value]])])):le("",!0),m("ul",Tk,[(b(!0),I(Ue,null,It(x.value,X=>(b(),I("li",{key:X.value},[m("button",{class:nt(["composer-dropdown-option",{"is-selected":X.value===e.modelValue}]),type:"button",onClick:ke=>F(X.value)},ce(X.label),11,Sk)]))),128)),x.value.length===0?(b(),I("li",Ik," No matching projects ")):le("",!0)]),D.value?(b(),I("div",Ek,[d.value?(b(),I(Ue,{key:0},[lr(m("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":ye[1]||(ye[1]=X=>c.value=X),class:"composer-dropdown-add-input",type:"text",placeholder:R.value,onKeydown:[on(it(ve,["prevent"]),["enter"]),on(it(Ee,["prevent"]),["esc"])]},null,40,Ck),[[cr,c.value]]),m("div",{class:"composer-dropdown-add-actions"},[m("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ve},"Open"),m("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Ee},"Cancel")])],64)):(b(),I("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:re},ce(z.value),1))])):le("",!0)])],2)):le("",!0)],512))}}),Xo=tt(Ak,[["__scopeId","data-v-47426238"]]),Rk=["disabled"],Pk={class:"search-dropdown-value"},xk={class:"search-dropdown-search-wrap"},Mk=["placeholder","onKeydown"],Ok={key:0,class:"search-dropdown-list",role:"listbox"},$k=["onClick","onPointerenter"],Nk={class:"search-dropdown-option-check"},Dk={class:"search-dropdown-option-label"},Lk={key:0,class:"search-dropdown-option-desc"},jk={key:1,class:"search-dropdown-empty"},Uk=Lt({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(null),a=j(!1),l=j(""),d=j(0),c=fe(()=>n.openDirection??"down"),h=fe(()=>new Set(n.selectedValues)),v=fe(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const F=n.options.find(re=>re.value===n.selectedValues[0]);return(F==null?void 0:F.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),E=fe(()=>{const F=l.value.toLowerCase().trim();return F?n.options.filter(re=>{var se;return re.label.toLowerCase().includes(F)||(((se=re.description)==null?void 0:se.toLowerCase().includes(F))??!1)}):n.options});function D(){const F=o.value,re=s.value;if(!F||!re||window.innerWidth>=640)return;const se=re.getBoundingClientRect();c.value==="up"?(F.style.setProperty("bottom",`${window.innerHeight-se.top+8}px`,"important"),F.style.setProperty("top","auto","important")):(F.style.setProperty("top",`${se.bottom+8}px`,"important"),F.style.setProperty("bottom","auto","important"))}function O(){n.disabled||(a.value=!a.value,a.value&&(l.value="",d.value=0,Vt(()=>{var F;Vt(()=>{D()}),(F=i.value)==null||F.focus()})))}function z(F){r("toggle",F.value,!h.value.has(F.value))}function R(F){E.value.length!==0&&(d.value=(d.value+F+E.value.length)%E.value.length)}function x(){const F=E.value[d.value];F&&z(F)}function H(F){if(!a.value)return;const re=s.value;if(!re)return;const se=F.target;se instanceof Node&&(re.contains(se)||(a.value=!1))}return ut(l,()=>{d.value=0}),zn(()=>window.addEventListener("pointerdown",H)),hr(()=>window.removeEventListener("pointerdown",H)),(F,re)=>(b(),I("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[m("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:O},[m("span",Pk,ce(v.value),1),xe(bi,{class:"search-dropdown-chevron"})],8,Rk),a.value?(b(),I("div",{key:0,ref_key:"menuRef",ref:o,class:nt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":c.value==="up","search-dropdown-menu-wrap-down":c.value==="down"}])},[m("div",xk,[lr(m("input",{ref_key:"searchRef",ref:i,"onUpdate:modelValue":re[0]||(re[0]=se=>l.value=se),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[re[1]||(re[1]=on(it(se=>a.value=!1,["prevent"]),["escape"])),on(it(x,["prevent"]),["enter"]),re[2]||(re[2]=on(it(se=>R(1),["prevent"]),["arrow-down"])),re[3]||(re[3]=on(it(se=>R(-1),["prevent"]),["arrow-up"]))]},null,40,Mk),[[cr,l.value]])]),E.value.length>0?(b(),I("ul",Ok,[(b(!0),I(Ue,null,It(E.value,(se,ve)=>(b(),I("li",{key:se.value},[m("button",{class:nt(["search-dropdown-option",{"is-selected":h.value.has(se.value),"is-highlighted":ve===d.value}]),type:"button",onClick:Ee=>z(se),onPointerenter:Ee=>d.value=ve},[m("span",Nk,ce(h.value.has(se.value)?"✓":""),1),m("span",Dk,ce(se.label),1),se.description?(b(),I("span",Lk,ce(se.description),1)):le("",!0)],42,$k)]))),128))])):(b(),I("div",jk,"No results"))],2)):le("",!0)],512))}}),Fk=tt(Uk,[["__scopeId","data-v-22b6d035"]]),Bk={class:"skill-picker-header"},Hk=["onKeydown"],Wk={key:0,class:"skill-picker-list",role:"listbox"},Vk=["onClick","onPointerenter"],zk={class:"skill-picker-name"},Gk={key:0,class:"skill-picker-desc"},qk={key:1,class:"skill-picker-empty"},Kk=Lt({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(""),a=j(0),l=fe(()=>{const v=i.value.toLowerCase().trim();return v?n.skills.filter(E=>E.name.toLowerCase().includes(v)||E.description.toLowerCase().includes(v)):n.skills}),d=fe(()=>{const v={};return n.anchorBottom!=null&&(v.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(v.left=`${n.anchorLeft}px`),v});function c(v){l.value.length!==0&&(a.value=(a.value+v+l.value.length)%l.value.length)}function h(){const v=l.value[a.value];v&&r("select",v)}return ut(()=>n.visible,v=>{v&&(i.value="",a.value=0,Vt(()=>{var E;return(E=o.value)==null?void 0:E.focus()}))}),ut(i,()=>{a.value=0}),(v,E)=>e.visible?(b(),I("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:Jr(d.value)},[m("div",Bk,[lr(m("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":E[0]||(E[0]=D=>i.value=D),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[E[1]||(E[1]=on(it(D=>v.$emit("close"),["prevent"]),["escape"])),on(it(h,["prevent"]),["enter"]),E[2]||(E[2]=on(it(D=>c(1),["prevent"]),["arrow-down"])),E[3]||(E[3]=on(it(D=>c(-1),["prevent"]),["arrow-up"]))]},null,40,Hk),[[cr,i.value]])]),l.value.length>0?(b(),I("ul",Wk,[(b(!0),I(Ue,null,It(l.value,(D,O)=>(b(),I("li",{key:D.path},[m("button",{class:nt(["skill-picker-item",{"is-highlighted":O===a.value}]),type:"button",onClick:z=>v.$emit("select",D),onPointerenter:z=>a.value=O},[m("span",zk,ce(D.name),1),D.description?(b(),I("span",Gk,ce(D.description),1)):le("",!0)],42,Vk)]))),128))])):(b(),I("div",qk,"No skills found"))],4)):le("",!0)}}),Jk=tt(Kk,[["__scopeId","data-v-ff3fb7dc"]]),Yk={key:0,class:"thread-composer-dictation-error"},Xk={key:0,class:"thread-composer-attachments"},Qk=["src","alt"],Zk=["aria-label","disabled","onClick"],e0={key:1,class:"thread-composer-folder-chips"},t0=["title"],n0={class:"thread-composer-folder-chip-meta"},r0=["aria-label","disabled","onClick"],s0={key:2,class:"thread-composer-file-chips"},o0=["title"],i0=["aria-label","disabled","onClick"],a0={key:3,class:"thread-composer-skill-chips"},l0={class:"thread-composer-skill-chip-name"},c0=["aria-label","onClick"],u0={class:"thread-composer-input-wrap"},d0={key:0,class:"thread-composer-file-mentions"},f0=["onMousedown"],h0={key:1,class:"thread-composer-file-mention-icon-markdown"},p0={class:"thread-composer-file-mention-text"},m0={class:"thread-composer-file-mention-name"},g0={key:0,class:"thread-composer-file-mention-dir"},v0={key:1,class:"thread-composer-file-mention-empty"},y0=["placeholder","disabled"],w0=["disabled"],b0={key:0,class:"thread-composer-attach-menu"},_0=["disabled"],k0=["disabled"],T0=["disabled"],S0=["aria-checked","aria-label","disabled"],I0={class:"thread-composer-attach-setting-copy"},E0={class:"thread-composer-attach-setting-description"},C0={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},A0={key:1,class:"thread-composer-dictation-timer"},R0=["aria-label","title","disabled"],P0=["disabled"],x0=["aria-label","title","disabled"],M0=["disabled"],O0=["disabled"],$0=["disabled"],N0="codex-web-local.thread-draft.v1.",D0=Lt({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},prependDraftRequest:{},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=j(""),i=j([]),a=j([]),l=j([]),d=j([]),c=j(""),{state:h,isSupported:v,recordingDurationMs:E,waveformCanvasRef:D,startRecording:O,stopRecording:z,toggleRecording:R,cancel:x}=s_({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:N=>{if(o.value=o.value?`${o.value}
|
|
39
|
+
${N}`:N,c.value="",r.dictationAutoSend!==!1){const V=r.isTurnInProgress?G.value:"steer";we(V,{rollbackLatestUserTurn:V==="steer"&&Ke}),Ke=!1;return}Vt(()=>{var V;return(V=ve.value)==null?void 0:V.focus()})},onEmpty:()=>{c.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:N=>{if(N instanceof DOMException&&N.name==="NotAllowedError"){c.value="Microphone access was denied.";return}c.value=N instanceof Error?N.message:"Dictation failed."}}),H=j(null),F=j(null),re=j(null),se=j(null),ve=j(null),Ee=j(!1),ie=j(!1),oe=j(null),ye=j(""),X=j([]),ke=j(!1),Oe=j(0),je=j(0);let Pe=0,Me=null,Re=!1,Ke=!1;const Xe=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let $e="";const Je=[{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"}];function st(N){return N.trim().replace(/^gpt/i,"GPT")}const ot=fe(()=>r.models.map(N=>({value:N,label:st(N)}))),Qe=fe(()=>r.skills??[]),Ye=fe(()=>a.value.map(N=>N.path)),J=fe(()=>(r.skills??[]).map(N=>({value:N.path,label:N.name,description:N.description}))),he=fe(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId?!1:o.value.trim().length>0||i.value.length>0||l.value.length>0),pe=fe(()=>o.value.trim().length>0||i.value.length>0||a.value.length>0||l.value.length>0||d.value.length>0),Ce=fe(()=>{const N=new Set;for(const V of d.value)for(const ne of V.filePaths)N.add(ne);return l.value.filter(V=>!N.has(V.fsPath))}),Ie=fe(()=>r.disabled||!r.activeThreadId),y=fe(()=>r.selectedModel.trim()==="gpt-5.4"),_=fe(()=>r.selectedSpeedMode==="fast"&&y.value),M=fe(()=>Ie.value||r.isUpdatingSpeedMode===!0),Y=fe(()=>r.isUpdatingSpeedMode?"Saving speed setting...":r.selectedSpeedMode==="fast"?"About 1.5x faster, with credits used at 2x":"Default speed with normal credit usage"),G=fe(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),$=fe(()=>h.value==="recording"),W=fe(()=>h.value==="recording"?"Stop dictation":r.dictationClickToToggle?"Click to dictate":"Hold to dictate"),B=fe(()=>h.value==="idle"?c.value.trim():""),Z=fe(()=>{const N=Math.max(0,Math.floor(E.value/1e3)),V=Math.floor(N/60),ne=N%60;return`${V}:${String(ne).padStart(2,"0")}`}),q=fe(()=>r.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message");function we(N="steer",V){var Le;const ne=o.value.trim();if(he.value){if(s("submit",{text:ne,imageUrls:i.value.map(T=>T.url),fileAttachments:[...l.value],skills:a.value.map(T=>({name:T.name,path:T.path})),mode:N,rollbackLatestUserTurn:(V==null?void 0:V.rollbackLatestUserTurn)===!0}),ze(r.activeThreadId),ge(),Xe){(Le=ve.value)==null||Le.blur();return}Vt(()=>{var T;return(T=ve.value)==null?void 0:T.focus()})}}function de(N){je.value+=1,o.value=N.text,i.value=N.imageUrls.map((V,ne)=>({id:`queued-${Date.now()}-${ne}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${ne+1}`,url:V})),a.value=N.skills.map(V=>(r.skills??[]).find(ne=>ne.path===V.path)??{name:V.name,description:"",path:V.path}),l.value=N.fileAttachments.map(V=>({...V})),d.value=[],c.value="",Ee.value=!1,ie.value=!1,C()}function ge(){de({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Ae(N){return`${N0}${N}`}function Be(N){if(typeof window>"u")return null;const V=N.trim();if(!V)return null;try{const ne=window.localStorage.getItem(Ae(V));if(!ne)return null;const Le=JSON.parse(ne);return typeof Le=="string"?{text:Le,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Le.text=="string"?Le.text:"",imageUrls:Array.isArray(Le.imageUrls)?Le.imageUrls.filter(T=>typeof T=="string"):[],fileAttachments:Array.isArray(Le.fileAttachments)?Le.fileAttachments.filter(T=>!!T&&typeof T.label=="string"&&typeof T.path=="string"&&typeof T.fsPath=="string"):[],skills:Array.isArray(Le.skills)?Le.skills.filter(T=>!!T&&typeof T.name=="string"&&typeof T.path=="string"):[]}}catch{return null}}function We(N,V){if(typeof window>"u")return;const ne=N.trim();if(ne)try{if(V.text.trim().length>0||V.imageUrls.length>0||V.fileAttachments.length>0||V.skills.length>0){window.localStorage.setItem(Ae(ne),JSON.stringify(V));return}window.localStorage.removeItem(Ae(ne))}catch{}}function ze(N){We(N,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Ze(){return{text:o.value,imageUrls:i.value.map(N=>N.url),fileAttachments:l.value.map(N=>({...N})),skills:a.value.map(N=>({name:N.name,path:N.path}))}}function at(){s("interrupt")}function ht(N){s("update:selected-model",N)}function vt(N){s("update:selected-reasoning-effort",N)}function Mt(){M.value||s("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function Ot(){r.dictationClickToToggle&&(c.value&&(c.value=""),h.value==="idle"&&(Ke=r.isTurnInProgress===!0&&r.inProgressSubmitMode==="steer"),R())}function yt(N){if(r.dictationClickToToggle||(N.preventDefault(),Re))return;Re=!0;const V=N.currentTarget;if(V)try{V.setPointerCapture(N.pointerId)}catch{}c.value&&(c.value=""),Ke=r.isTurnInProgress===!0&&r.inProgressSubmitMode==="steer",window.addEventListener("pointerup",lt),window.addEventListener("pointercancel",lt),window.addEventListener("blur",lt),O()}function lt(){r.dictationClickToToggle||Re&&(Re=!1,window.removeEventListener("pointerup",lt),window.removeEventListener("pointercancel",lt),window.removeEventListener("blur",lt),z())}function Rt(){Ie.value||(Ee.value=!Ee.value)}function jt(){var N;(N=F.value)==null||N.click()}function Bt(){var N;(N=re.value)==null||N.click()}function bn(){var N;(N=se.value)==null||N.click()}function kt(N){i.value=i.value.filter(V=>V.id!==N)}function ct(N){a.value=a.value.filter(V=>V.path!==N)}function Ht(N){l.value=l.value.filter(V=>V.fsPath!==N)}function Tt(N){const V=d.value.find(Le=>Le.id===N);if(!V)return;const ne=new Set(V.filePaths);l.value=l.value.filter(Le=>!ne.has(Le.fsPath)),d.value=d.value.filter(Le=>Le.id!==N)}function rt(N){return N.total<=0?0:Math.round(N.processed/N.total*100)}function Ut(N,V){const ne=N.replace(/\\/g,"/");if(l.value.some(P=>P.fsPath===ne))return;const Le=ne.split("/").filter(Boolean),T=(V==null?void 0:V.trim())||Le[Le.length-1]||ne;l.value=[...l.value,{label:T,path:ne,fsPath:ne}]}function Gt(N){return N.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(N.name)}function hn(N){if(!N||N.length===0)return;const V=je.value;for(const ne of Array.from(N))if(Gt(ne)){const Le=new FileReader;Le.onload=()=>{V===je.value&&typeof Le.result=="string"&&i.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:ne.name,url:Le.result})},Le.readAsDataURL(ne)}else cu(ne).then(Le=>{V===je.value&&Le&&Ut(Le)}).catch(()=>{})}async function qt(N){if(!N||N.length===0)return;const V=je.value,ne=Array.from(N),T=(ne[0].webkitRelativePath||ne[0].name).split("/").filter(Boolean)[0]||"Folder",P=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:P,name:T,total:ne.length,processed:0,filePaths:[],isUploading:!0}];const L=Q=>{V===je.value&&(d.value=d.value.map(Ne=>Ne.id===P?Q(Ne):Ne))};for(const Q of ne)try{const Ne=await cu(Q);if(V!==je.value)return;if(Ne){const At=Q.webkitRelativePath||Q.name;Ut(Ne,At),L(Wt=>({...Wt,processed:Wt.processed+1,filePaths:[...Wt.filePaths,Ne]}));continue}L(At=>({...At,processed:At.processed+1}))}catch{L(Ne=>({...Ne,processed:Ne.processed+1}))}L(Q=>({...Q,isUploading:!1}))}function cn(N){N&&(N.value="")}function _n(N){const V=N.target;hn((V==null?void 0:V.files)??null),cn(V),Ee.value=!1}function kn(N){const V=N.target;hn((V==null?void 0:V.files)??null),cn(V),Ee.value=!1}function Kt(N){const V=N.target;qt((V==null?void 0:V.files)??null),cn(V),Ee.value=!1}function De(){c.value&&(c.value="");const V=o.value.startsWith("/");V!==ie.value&&(ie.value=V),K()}function g(N){if(ke.value){if(N.key==="Escape"){N.preventDefault(),C();return}if(N.key==="ArrowDown"){N.preventDefault(),X.value.length>0&&(Oe.value=(Oe.value+1)%X.value.length);return}if(N.key==="ArrowUp"){if(N.preventDefault(),X.value.length>0){const ne=X.value.length;Oe.value=(Oe.value+ne-1)%ne}return}if(N.key==="Enter"||N.key==="Tab"){N.preventDefault();const ne=X.value[Oe.value];ne?ue(ne):C();return}}if(r.sendWithEnter!==!1?N.key==="Enter"&&!N.shiftKey:N.key==="Enter"&&(N.metaKey||N.ctrlKey)){N.preventDefault(),we(r.isTurnInProgress?G.value:"steer");return}if(ie.value){if(N.key==="Escape"){N.preventDefault(),S();return}if(N.key==="ArrowDown"||N.key==="ArrowUp"){N.preventDefault();return}}}function S(){var N;ie.value=!1,(N=ve.value)==null||N.focus()}function C(){ke.value=!1,oe.value=null,ye.value="",X.value=[],Oe.value=0}function K(){const N=ve.value;if(!N){C();return}const V=N.selectionStart??o.value.length,Le=o.value.slice(0,V).match(/(^|\s)(@[^\s@]*)$/);if(!Le){C();return}const T=Le[2]??"",P=T.length,L=V-P;oe.value=L,ye.value=T.slice(1),ke.value=!0,ae()}async function ae(){if(!ke.value)return;const N=(r.cwd??"").trim();if(!N){X.value=[];return}Me&&clearTimeout(Me);const V=++Pe;Me=setTimeout(async()=>{try{const ne=await Y_(N,ye.value,20);if(!ke.value||V!==Pe)return;X.value=ne,Oe.value=0}catch{if(!ke.value||V!==Pe)return;X.value=[]}},120)}function ue(N){const V=ve.value,ne=oe.value;if(ne!==null&&V){const Le=V.selectionStart??o.value.length;o.value=`${o.value.slice(0,ne)}${o.value.slice(Le)}`.trimEnd()}Ut(N.path),C(),Vt(()=>V==null?void 0:V.focus())}function Se(N){x(),de(N),Vt(()=>{var V;return(V=ve.value)==null?void 0:V.focus()})}function _e(N){const V=N.lastIndexOf("/");return V<0?N:N.slice(V+1)}function Ge(N){const V=N.lastIndexOf("/");return V<=0?"":N.slice(0,V)}function et(N){const V=_e(N),ne=V.lastIndexOf(".");return ne<=0?"":V.slice(ne+1).toLowerCase()}function wt(N){const V=et(N);return V==="ts"?"TS":V==="tsx"?"TSX":V==="js"?"JS":V==="jsx"?"JSX":V==="json"?"{}":""}function $t(N){const V=et(N);return V.startsWith("ts")?"ts":V.startsWith("js")?"js":V==="json"?"json":"default"}function un(N){const V=et(N);return V==="md"||V==="mdx"}function Gn(N){var V;a.value.some(ne=>ne.path===N.path)||(a.value=[...a.value,N]),o.value=o.value.startsWith("/")?"":o.value,ie.value=!1,(V=ve.value)==null||V.focus()}function Mn(N,V){if(V){const ne=(r.skills??[]).find(Le=>Le.path===N);ne&&!a.value.some(Le=>Le.path===N)&&(a.value=[...a.value,ne])}else a.value=a.value.filter(ne=>ne.path!==N)}function pr(N){if(!Ee.value)return;const V=H.value;if(!V)return;const ne=N.target;!ne||V.contains(ne)||(Ee.value=!1)}return zn(()=>{document.addEventListener("click",pr)}),t({hydrateDraft:Se,hasUnsavedDraft:()=>pe.value}),hr(()=>{document.removeEventListener("click",pr),window.removeEventListener("pointerup",lt),window.removeEventListener("pointercancel",lt),window.removeEventListener("blur",lt),Me&&clearTimeout(Me)}),ut(()=>r.activeThreadId,N=>{x(),$e&&We($e,Ze()),ge();const V=Be(N);V&&(de(V),De()),$e=N.trim()},{immediate:!0}),ut([o,i,l,a],()=>{$e&&We($e,Ze())},{deep:!0}),ut(()=>r.cwd,()=>{ke.value&&ae()}),ut(()=>{var N;return(N=r.prependDraftRequest)==null?void 0:N.id},()=>{var V,ne;const N=((ne=(V=r.prependDraftRequest)==null?void 0:V.text)==null?void 0:ne.trim())??"";N&&(o.value=o.value?`${N}
|
|
40
|
+
${o.value}`:N,De(),Vt(()=>{var Le;return(Le=ve.value)==null?void 0:Le.focus()}))}),(N,V)=>(b(),I("form",{class:"thread-composer",onSubmit:V[2]||(V[2]=it(ne=>we("steer"),["prevent"]))},[B.value?(b(),I("p",Yk,ce(B.value),1)):le("",!0),m("div",{class:nt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[i.value.length>0?(b(),I("div",Xk,[(b(!0),I(Ue,null,It(i.value,ne=>(b(),I("div",{key:ne.id,class:"thread-composer-attachment"},[m("img",{class:"thread-composer-attachment-image",src:ne.url,alt:ne.name||"Selected image"},null,8,Qk),m("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${ne.name||"image"}`,disabled:Ie.value,onClick:Le=>kt(ne.id)}," x ",8,Zk)]))),128))])):le("",!0),d.value.length>0?(b(),I("div",e0,[(b(!0),I(Ue,null,It(d.value,ne=>(b(),I("span",{key:ne.id,class:"thread-composer-folder-chip"},[xe(_l,{class:"thread-composer-folder-chip-icon"}),m("span",{class:"thread-composer-folder-chip-name",title:ne.name},ce(ne.name),9,t0),m("span",n0,[ne.isUploading?(b(),I(Ue,{key:0},[Xs(ce(rt(ne))+"% uploading ("+ce(ne.processed)+"/"+ce(ne.total)+") ",1)],64)):(b(),I(Ue,{key:1},[Xs(ce(ne.filePaths.length)+" file"+ce(ne.filePaths.length===1?"":"s"),1)],64))]),m("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${ne.name}`,disabled:Ie.value,onClick:Le=>Tt(ne.id)},"×",8,r0)]))),128))])):le("",!0),Ce.value.length>0?(b(),I("div",s0,[(b(!0),I(Ue,null,It(Ce.value,ne=>(b(),I("span",{key:ne.fsPath,class:"thread-composer-file-chip"},[xe(Yo,{class:"thread-composer-file-chip-icon"}),m("span",{class:"thread-composer-file-chip-name",title:ne.fsPath},ce(ne.label),9,o0),m("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${ne.label}`,disabled:Ie.value,onClick:Le=>Ht(ne.fsPath)},"×",8,i0)]))),128))])):le("",!0),a.value.length>0?(b(),I("div",a0,[(b(!0),I(Ue,null,It(a.value,ne=>(b(),I("span",{key:ne.path,class:"thread-composer-skill-chip"},[m("span",l0,ce(ne.name),1),m("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${ne.name}`,onClick:Le=>ct(ne.path)},"×",8,c0)]))),128))])):le("",!0),m("div",u0,[ke.value?(b(),I("div",d0,[X.value.length>0?(b(!0),I(Ue,{key:0},It(X.value,(ne,Le)=>(b(),I("button",{key:ne.path,class:nt(["thread-composer-file-mention-row",{"is-active":Le===Oe.value}]),type:"button",onMousedown:it(T=>ue(ne),["prevent"])},[wt(ne.path)?(b(),I("span",{key:0,class:nt(["thread-composer-file-mention-icon-badge",`is-${$t(ne.path)}`])},ce(wt(ne.path)),3)):un(ne.path)?(b(),I("span",h0,"↓")):(b(),ft(Yo,{key:2,class:"thread-composer-file-mention-icon-file"})),m("span",p0,[m("span",m0,ce(_e(ne.path)),1),Ge(ne.path)?(b(),I("span",g0,ce(Ge(ne.path)),1)):le("",!0)])],42,f0))),128)):(b(),I("div",v0,"No matching files"))])):le("",!0),lr(m("textarea",{ref_key:"inputRef",ref:ve,"onUpdate:modelValue":V[0]||(V[0]=ne=>o.value=ne),class:"thread-composer-input",placeholder:q.value,disabled:Ie.value,onInput:De,onKeydown:g},null,40,y0),[[cr,o.value]]),xe(Jk,{skills:Qe.value,visible:ie.value,"anchor-bottom":44,"anchor-left":0,onSelect:Gn,onClose:S},null,8,["skills","visible"])]),m("div",{class:nt(["thread-composer-controls",{"thread-composer-controls--recording":$.value}])},[m("div",{ref_key:"attachMenuRootRef",ref:H,class:"thread-composer-attach"},[m("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Ie.value,onClick:Rt}," + ",8,w0),Ee.value?(b(),I("div",b0,[m("button",{class:"thread-composer-attach-item",type:"button",disabled:Ie.value,onClick:jt}," Add photos & files ",8,_0),m("button",{class:"thread-composer-attach-item",type:"button",disabled:Ie.value,onClick:bn}," Add folder ",8,k0),m("button",{class:"thread-composer-attach-item",type:"button",disabled:Ie.value,onClick:Bt}," Take photo ",8,T0),V[4]||(V[4]=m("div",{class:"thread-composer-attach-separator"},null,-1)),y.value?(b(),I("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`Fast mode ${e.selectedSpeedMode==="fast"?"enabled":"disabled"}`,disabled:M.value,onClick:Mt},[m("span",I0,[V[3]||(V[3]=m("span",{class:"thread-composer-attach-setting-label"},"Fast mode",-1)),m("span",E0,ce(Y.value),1)]),m("span",{class:nt(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":M.value}])},null,2)],8,S0)):le("",!0)])):le("",!0)],512),$.value?le("",!0):(b(),I(Ue,{key:0},[xe(Xo,{class:"thread-composer-control","model-value":e.selectedModel,options:ot.value,"selected-prefix-icon":_.value?uk:null,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":ht},null,8,["model-value","options","selected-prefix-icon","disabled"]),xe(Fk,{class:"thread-composer-control",options:J.value,"selected-values":Ye.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:Mn},null,8,["options","selected-values","disabled"]),xe(Xo,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Je,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":vt},null,8,["model-value","disabled"])],64)),m("div",{class:nt(["thread-composer-actions",{"thread-composer-actions--recording":$.value}])},[be(h)==="recording"?(b(),I("div",C0,[m("canvas",{ref_key:"dictationWaveformCanvasRef",ref:D,class:"thread-composer-dictation-waveform"},null,512)])):le("",!0),be(h)==="recording"?(b(),I("span",A0,ce(Z.value),1)):le("",!0),be(v)?(b(),I("button",{key:2,class:nt(["thread-composer-mic",{"thread-composer-mic--active":be(h)==="recording"}]),type:"button","aria-label":W.value,title:W.value,disabled:Ie.value,onClick:Ot,onPointerdown:yt,onPointerup:lt,onPointercancel:lt},[be(h)==="recording"?(b(),ft(uu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(b(),ft(pk,{key:1,class:"thread-composer-mic-icon"}))],42,R0)):le("",!0),e.isTurnInProgress?(b(),I("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:at},[xe(uu,{class:"thread-composer-stop-icon"})],8,P0)):(b(),I("button",{key:4,class:nt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&G.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&G.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${G.value}`:"Send",disabled:!he.value,onClick:V[1]||(V[1]=ne=>we(e.isTurnInProgress?G.value:"steer"))},[xe(ik,{class:"thread-composer-submit-icon"})],10,x0))],2)],2)],2),m("input",{ref_key:"photoLibraryInputRef",ref:F,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ie.value,onChange:_n},null,40,M0),m("input",{ref_key:"cameraCaptureInputRef",ref:re,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ie.value,onChange:kn},null,40,O0),m("input",{ref_key:"folderPickerInputRef",ref:se,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ie.value,onChange:Kt},null,40,$0)],32))}}),du=tt(D0,[["__scopeId","data-v-46a31155"]]),L0={key:0,class:"queued-messages"},j0={class:"queued-messages-inner"},U0={class:"queued-row-text"},F0={class:"queued-row-actions"},B0=["onClick"],H0=["onClick"],W0=["onClick"],V0=Lt({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){function t(n){var l,d,c;const r=n.text.trim();if(r)return r;const s=[],o=((l=n.imageUrls)==null?void 0:l.length)??0,i=((d=n.fileAttachments)==null?void 0:d.length)??0,a=((c=n.skills)==null?void 0:c.length)??0;return o>0&&s.push(`${o} image${o===1?"":"s"}`),i>0&&s.push(`${i} file${i===1?"":"s"}`),a>0&&s.push(`${a} skill${a===1?"":"s"}`),s.join(", ")||"(empty queued message)"}return(n,r)=>e.messages.length>0?(b(),I("div",L0,[m("div",j0,[(b(!0),I(Ue,null,It(e.messages,s=>(b(),I("div",{key:s.id,class:"queued-row"},[r[1]||(r[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",U0,ce(t(s)),1),m("div",F0,[m("button",{class:"queued-row-edit",type:"button",title:"Edit queued message",onClick:o=>n.$emit("edit",s.id)},"Edit",8,B0),m("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:o=>n.$emit("steer",s.id)},"Steer",8,H0),m("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:o=>n.$emit("delete",s.id)},[...r[0]||(r[0]=[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,W0)])]))),128))])])):le("",!0)}}),z0=tt(V0,[["__scopeId","data-v-1394d0f8"]]),G0={key:0,class:"rate-limit-status","aria-live":"polite"},q0=["title"],K0={class:"rate-limit-card-header"},J0={class:"rate-limit-card-title"},Y0={key:0,class:"rate-limit-card-plan"},X0={class:"rate-limit-card-metrics"},Q0={key:0,class:"rate-limit-card-footer"},Z0=Lt({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(R){var x,H;return((x=R.limitId)==null?void 0:x.trim())||((H=R.limitName)==null?void 0:H.trim())||"__default__"}function n(R){var x,H;return((x=R.limitName)==null?void 0:x.trim())||((H=R.limitId)==null?void 0:H.trim())||"Rate limits"}function r(R){const x=R.trim();return x?x.replace(/[_-]+/g," ").replace(/\b\w/g,H=>H.toUpperCase()):""}function s(R){return!R||R<=0?"Window":R%1440===0?`${R/1440}d`:R%60===0?`${R/60}h`:R<60?`${R}m`:`${Math.round(R/60*10)/10}h`}function o(R){const x=Math.max(0,Math.min(100,100-R));return`${Math.round(x)}% left`}function i(R){return`${Math.round(R)}%`}function a(R,x){return{key:x,label:`${s(R.windowDurationMins)} ${o(R.usedPercent)}`}}function l(R){const x=[];return R.primary&&x.push(a(R.primary,"primary")),R.secondary&&x.push(a(R.secondary,"secondary")),x}function d(R){if(!R)return"";const x=new Date(R*1e3),H=x.getMonth()+1,F=String(x.getDate()).padStart(2,"0"),re=String(x.getHours()).padStart(2,"0"),se=String(x.getMinutes()).padStart(2,"0");return`${H}.${F} ${re}:${se}`}function c(R){if(!(R!=null&&R.resetsAt))return"";const x=R.resetsAt*1e3-Date.now();if(x<=0)return"Resetting now";const H=Math.round(x/6e4);if(H<60)return`Resets in ${H}m`;const F=Math.round(H/60);return F<24?`Resets in ${F}h`:`Resets in ${Math.round(F/24)}d`}function h(R){return[R.primary,R.secondary].filter(x=>x!==null)}function v(R){const x=h(R);return x.length===0?null:[...x].sort((H,F)=>{const re=H.windowDurationMins??Number.MAX_SAFE_INTEGER,se=F.windowDurationMins??Number.MAX_SAFE_INTEGER;return re!==se?re-se:(H.resetsAt??Number.MAX_SAFE_INTEGER)-(F.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function E(R){const x=h(R);if(x.length===0)return"";const H=[...x].sort((re,se)=>{const ve=re.windowDurationMins??-1,Ee=se.windowDurationMins??-1;return ve!==Ee?Ee-ve:(se.resetsAt??-1)-(re.resetsAt??-1)})[0],F=d(H.resetsAt);return F||""}function D(R){const x=R.credits;return x?x.unlimited?"Unlimited credits":x.balance?`Credits ${x.balance}`:x.hasCredits?"Credits available":"":""}function O(R){return[c(v(R)),E(R),D(R)].filter(x=>x.length>0)}function z(R){const x=[n(R)];for(const H of l(R))x.push(H.label);for(const H of h(R))x.push(`${s(H.windowDurationMins)} used ${i(H.usedPercent)}`);for(const H of O(R))x.push(H);return x.join(`
|
|
41
|
+
`)}return(R,x)=>e.snapshots.length>0?(b(),I("aside",G0,[(b(!0),I(Ue,null,It(e.snapshots,H=>(b(),I("div",{key:t(H),class:"rate-limit-card",title:z(H)},[m("div",K0,[m("span",J0,ce(n(H)),1),H.planType?(b(),I("span",Y0,ce(r(H.planType)),1)):le("",!0)]),m("div",X0,[(b(!0),I(Ue,null,It(l(H),F=>(b(),I("span",{key:F.key,class:"rate-limit-card-metric"},ce(F.label),1))),128))]),O(H).length>0?(b(),I("div",Q0,ce(O(H).join(" | ")),1)):le("",!0)],8,q0))),128))])):le("",!0)}}),eT=tt(Z0,[["__scopeId","data-v-df88906b"]]),tT={class:"runtime-dropdown-trigger-label"},nT={key:0,class:"runtime-dropdown-menu-wrap"},rT={class:"runtime-dropdown-menu"},sT=["onClick"],oT={class:"runtime-dropdown-option-label"},iT={key:0,class:"runtime-dropdown-option-check"},aT=Lt({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(!1),i=[{value:"local",label:"Local project",icon:_l},{value:"worktree",label:"New worktree",icon:Do}],a=fe(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function d(c){if(!o.value)return;const h=s.value;if(!h)return;const v=c.target;v instanceof Node&&(h.contains(v)||(o.value=!1))}return zn(()=>{window.addEventListener("pointerdown",d)}),hr(()=>{window.removeEventListener("pointerdown",d)}),(c,h)=>(b(),I("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[m("button",{class:"runtime-dropdown-trigger",type:"button",onClick:h[0]||(h[0]=v=>o.value=!o.value)},[(b(),ft(Go(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),m("span",tT,ce(a.value.label),1),xe(bi,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(b(),I("div",nT,[m("div",rT,[h[1]||(h[1]=m("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(b(),I(Ue,null,It(i,v=>m("button",{key:v.value,class:nt(["runtime-dropdown-option",{"is-selected":e.modelValue===v.value}]),type:"button",onClick:E=>l(v.value)},[(b(),ft(Go(v.icon),{class:"runtime-dropdown-option-icon"})),m("span",oT,ce(v.label),1),e.modelValue===v.value?(b(),I("span",iT,"✓")):le("",!0)],10,sT)),64))])])):le("",!0)],512))}}),lT=tt(aT,[["__scopeId","data-v-9c9b71e5"]]),cT={},uT={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function dT(e,t){return b(),I("svg",uT,[...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 Ua=tt(cT,[["render",dT]]),fT={class:"skill-card-top"},hT=["src","alt"],pT={key:1,class:"skill-card-avatar-fallback"},mT={class:"skill-card-info"},gT={class:"skill-card-header"},vT={class:"skill-card-name"},yT={key:0,class:"skill-card-badge-disabled"},wT={key:1,class:"skill-card-badge"},bT={class:"skill-card-owner"},_T={key:0,class:"skill-card-desc"},kT={key:1,class:"skill-card-date"},TT=Lt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=fe(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),a=Date.now()-s;return a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<2592e6?`${Math.floor(a/864e5)}d ago`:o.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function r(s){const o=s.target;o.style.display="none"}return(s,o)=>(b(),I("button",{class:nt(["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",fT,[e.skill.avatarUrl?(b(),I("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,hT)):(b(),I("div",pT,ce(e.skill.owner.charAt(0)),1)),m("div",mT,[m("div",gT,[m("span",vT,ce(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(b(),I("span",yT,"Disabled")):e.skill.installed?(b(),I("span",wT,"Installed")):le("",!0)]),m("span",bT,ce(e.skill.owner),1)])]),e.skill.description?(b(),I("p",_T,ce(e.skill.description),1)):le("",!0),n.value?(b(),I("span",kT,ce(n.value),1)):le("",!0)],2))}}),fu=tt(TT,[["__scopeId","data-v-2a1e8196"]]),ST={class:"sdm-panel"},IT={class:"sdm-header"},ET={class:"sdm-title-area"},CT=["src","alt"],AT={class:"sdm-title-col"},RT={class:"sdm-title-row"},PT={class:"sdm-title"},xT={key:0,class:"sdm-badge-disabled"},MT={class:"sdm-owner"},OT={class:"sdm-body"},$T={key:0,class:"sdm-desc"},NT={key:1,class:"sdm-readme-loading"},DT=["innerHTML"],LT=["href"],jT={class:"sdm-footer"},UT={class:"sdm-footer-actions"},FT=["disabled"],BT=["disabled"],HT=["disabled"],WT=Lt({__name:"SkillDetailModal",props:{skill:{},visible:{type:Boolean},isInstalling:{type:Boolean},isUninstalling:{type:Boolean}},emits:["close","install","uninstall","toggle-enabled"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(""),i=j(""),a=j(!1),l=fe(()=>s.value??n.skill.enabled??!0),d=fe(()=>n.isInstalling===!0||n.isUninstalling===!0),c=fe(()=>o.value||n.skill.description),h=fe(()=>{const R=i.value;if(!R)return"";const x=R.replace(/^---[\s\S]*?---\s*/,"");return v(x)});function v(R){return R.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 E(){if(!(!n.skill.owner||!n.skill.name)){a.value=!0,o.value="",i.value="";try{const R=new URLSearchParams({owner:n.skill.owner,name:n.skill.name});n.skill.installed&&R.set("installed","true"),n.skill.path&&R.set("path",n.skill.path);const x=await fetch(`/codex-api/skills-hub/readme?${R}`);if(!x.ok)return;const H=await x.json();i.value=H.content??"",o.value=H.description??""}catch{}finally{a.value=!1}}}ut(()=>n.visible,R=>{R&&(s.value=null,o.value="",i.value="",E())});function D(){r("install",n.skill)}function O(){r("uninstall",n.skill)}function z(){const R=!l.value;s.value=R,r("toggle-enabled",n.skill,R)}return(R,x)=>(b(),ft(Vo,{to:"body"},[e.visible?(b(),I("div",{key:0,class:"sdm-overlay",onClick:x[1]||(x[1]=it(H=>R.$emit("close"),["self"]))},[m("div",ST,[m("div",IT,[m("div",ET,[e.skill.avatarUrl?(b(),I("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,CT)):le("",!0),m("div",AT,[m("div",RT,[m("h3",PT,ce(e.skill.displayName||e.skill.name),1),e.skill.installed&&!l.value?(b(),I("span",xT,"Disabled")):le("",!0)]),m("span",MT,ce(e.skill.owner),1)])]),m("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:x[0]||(x[0]=H=>R.$emit("close"))},[xe(kl,{class:"sdm-close-icon"})])]),m("div",OT,[c.value?(b(),I("p",$T,ce(c.value),1)):le("",!0),a.value?(b(),I("div",NT,"Loading skill contents...")):i.value?(b(),I("div",{key:2,class:"sdm-readme",innerHTML:h.value},null,8,DT)):le("",!0),m("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,LT)]),m("div",jT,[m("div",UT,[e.skill.installed?(b(),I("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:d.value,onClick:O},ce(n.isUninstalling?"Uninstalling...":"Uninstall"),9,FT)):(b(),I("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:d.value,onClick:D},ce(n.isInstalling?"Installing...":"Install"),9,BT)),e.skill.installed?(b(),I("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:d.value,onClick:z},ce(l.value?"Disable":"Enable"),9,HT)):le("",!0)])])])])):le("",!0)]))}}),VT=tt(WT,[["__scopeId","data-v-6cd77ee0"]]),zT=()=>{};var hu={};/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2017 Google LLC
|
|
44
|
+
*
|
|
45
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
46
|
+
* you may not use this file except in compliance with the License.
|
|
47
|
+
* You may obtain a copy of the License at
|
|
48
|
+
*
|
|
49
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
50
|
+
*
|
|
51
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
52
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
53
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
54
|
+
* See the License for the specific language governing permissions and
|
|
55
|
+
* limitations under the License.
|
|
56
|
+
*/const Mf=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},GT=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const o=e[n++];t[r++]=String.fromCharCode((s&31)<<6|o&63)}else if(s>239&&s<365){const o=e[n++],i=e[n++],a=e[n++],l=((s&7)<<18|(o&63)<<12|(i&63)<<6|a&63)-65536;t[r++]=String.fromCharCode(55296+(l>>10)),t[r++]=String.fromCharCode(56320+(l&1023))}else{const o=e[n++],i=e[n++];t[r++]=String.fromCharCode((s&15)<<12|(o&63)<<6|i&63)}}return t.join("")},Of={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<e.length;s+=3){const o=e[s],i=s+1<e.length,a=i?e[s+1]:0,l=s+2<e.length,d=l?e[s+2]:0,c=o>>2,h=(o&3)<<4|a>>4;let v=(a&15)<<2|d>>6,E=d&63;l||(E=64,i||(v=64)),r.push(n[c],n[h],n[v],n[E])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Mf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):GT(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<e.length;){const o=n[e.charAt(s++)],a=s<e.length?n[e.charAt(s)]:0;++s;const d=s<e.length?n[e.charAt(s)]:64;++s;const h=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||d==null||h==null)throw new qT;const v=o<<2|a>>4;if(r.push(v),d!==64){const E=a<<4&240|d>>2;if(r.push(E),h!==64){const D=d<<6&192|h;r.push(D)}}}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 qT extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const KT=function(e){const t=Mf(e);return Of.encodeByteArray(t,!0)},$f=function(e){return KT(e).replace(/\./g,"")},Nf=function(e){try{return Of.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
|
|
57
|
+
* @license
|
|
58
|
+
* Copyright 2022 Google LLC
|
|
59
|
+
*
|
|
60
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
61
|
+
* you may not use this file except in compliance with the License.
|
|
62
|
+
* You may obtain a copy of the License at
|
|
63
|
+
*
|
|
64
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
65
|
+
*
|
|
66
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
67
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
68
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
69
|
+
* See the License for the specific language governing permissions and
|
|
70
|
+
* limitations under the License.
|
|
71
|
+
*/function JT(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
|
|
72
|
+
* @license
|
|
73
|
+
* Copyright 2022 Google LLC
|
|
74
|
+
*
|
|
75
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
76
|
+
* you may not use this file except in compliance with the License.
|
|
77
|
+
* You may obtain a copy of the License at
|
|
78
|
+
*
|
|
79
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
80
|
+
*
|
|
81
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
82
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
83
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
84
|
+
* See the License for the specific language governing permissions and
|
|
85
|
+
* limitations under the License.
|
|
86
|
+
*/const YT=()=>JT().__FIREBASE_DEFAULTS__,XT=()=>{if(typeof process>"u"||typeof hu>"u")return;const e=hu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},QT=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Nf(e[1]);return t&&JSON.parse(t)},Sl=()=>{try{return zT()||YT()||XT()||QT()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},ZT=e=>{var t,n;return(n=(t=Sl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},Df=()=>{var e;return(e=Sl())==null?void 0:e.config},Lf=e=>{var t;return(t=Sl())==null?void 0:t[`_${e}`]};/**
|
|
87
|
+
* @license
|
|
88
|
+
* Copyright 2017 Google LLC
|
|
89
|
+
*
|
|
90
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
91
|
+
* you may not use this file except in compliance with the License.
|
|
92
|
+
* You may obtain a copy of the License at
|
|
93
|
+
*
|
|
94
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
95
|
+
*
|
|
96
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
97
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
98
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
99
|
+
* See the License for the specific language governing permissions and
|
|
100
|
+
* limitations under the License.
|
|
101
|
+
*/class eS{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,r))}}}/**
|
|
102
|
+
* @license
|
|
103
|
+
* Copyright 2017 Google LLC
|
|
104
|
+
*
|
|
105
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
* you may not use this file except in compliance with the License.
|
|
107
|
+
* You may obtain a copy of the License at
|
|
108
|
+
*
|
|
109
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
*
|
|
111
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
* See the License for the specific language governing permissions and
|
|
115
|
+
* limitations under the License.
|
|
116
|
+
*/function ln(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function tS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ln())}function nS(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function rS(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function sS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function oS(){const e=ln();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function iS(){try{return typeof indexedDB=="object"}catch{return!1}}function aS(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var o;t(((o=s.error)==null?void 0:o.message)||"")}}catch(n){t(n)}})}/**
|
|
117
|
+
* @license
|
|
118
|
+
* Copyright 2017 Google LLC
|
|
119
|
+
*
|
|
120
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
121
|
+
* you may not use this file except in compliance with the License.
|
|
122
|
+
* You may obtain a copy of the License at
|
|
123
|
+
*
|
|
124
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
125
|
+
*
|
|
126
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
127
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
128
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
129
|
+
* See the License for the specific language governing permissions and
|
|
130
|
+
* limitations under the License.
|
|
131
|
+
*/const lS="FirebaseError";class Or extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=lS,Object.setPrototypeOf(this,Or.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,uo.prototype.create)}}class uo{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?cS(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Or(s,a,r)}}function cS(e,t){return e.replace(uS,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const uS=/\{\$([^}]+)}/g;function dS(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function ws(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const o=e[s],i=t[s];if(pu(o)&&pu(i)){if(!ws(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function pu(e){return e!==null&&typeof e=="object"}/**
|
|
132
|
+
* @license
|
|
133
|
+
* Copyright 2017 Google LLC
|
|
134
|
+
*
|
|
135
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
136
|
+
* you may not use this file except in compliance with the License.
|
|
137
|
+
* You may obtain a copy of the License at
|
|
138
|
+
*
|
|
139
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
140
|
+
*
|
|
141
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
142
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
143
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
144
|
+
* See the License for the specific language governing permissions and
|
|
145
|
+
* limitations under the License.
|
|
146
|
+
*/function fo(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 fS(e,t){const n=new hS(e,t);return n.subscribe.bind(n)}class hS{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.");pS(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=aa),s.error===void 0&&(s.error=aa),s.complete===void 0&&(s.complete=aa);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 pS(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 aa(){}/**
|
|
147
|
+
* @license
|
|
148
|
+
* Copyright 2021 Google LLC
|
|
149
|
+
*
|
|
150
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
151
|
+
* you may not use this file except in compliance with the License.
|
|
152
|
+
* You may obtain a copy of the License at
|
|
153
|
+
*
|
|
154
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
155
|
+
*
|
|
156
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
157
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
158
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
159
|
+
* See the License for the specific language governing permissions and
|
|
160
|
+
* limitations under the License.
|
|
161
|
+
*/function Ts(e){return e&&e._delegate?e._delegate:e}/**
|
|
162
|
+
* @license
|
|
163
|
+
* Copyright 2025 Google LLC
|
|
164
|
+
*
|
|
165
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
166
|
+
* you may not use this file except in compliance with the License.
|
|
167
|
+
* You may obtain a copy of the License at
|
|
168
|
+
*
|
|
169
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
170
|
+
*
|
|
171
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
172
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
173
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
174
|
+
* See the License for the specific language governing permissions and
|
|
175
|
+
* limitations under the License.
|
|
176
|
+
*/function Il(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function mS(e){return(await fetch(e,{credentials:"include"})).ok}class bs{constructor(t,n,r){this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
|
|
177
|
+
* @license
|
|
178
|
+
* Copyright 2019 Google LLC
|
|
179
|
+
*
|
|
180
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
* you may not use this file except in compliance with the License.
|
|
182
|
+
* You may obtain a copy of the License at
|
|
183
|
+
*
|
|
184
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
*
|
|
186
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
* See the License for the specific language governing permissions and
|
|
190
|
+
* limitations under the License.
|
|
191
|
+
*/const Br="[DEFAULT]";/**
|
|
192
|
+
* @license
|
|
193
|
+
* Copyright 2019 Google LLC
|
|
194
|
+
*
|
|
195
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
* you may not use this file except in compliance with the License.
|
|
197
|
+
* You may obtain a copy of the License at
|
|
198
|
+
*
|
|
199
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
*
|
|
201
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
* See the License for the specific language governing permissions and
|
|
205
|
+
* limitations under the License.
|
|
206
|
+
*/class gS{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 eS;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(yS(t))try{this.getOrInitializeService({instanceIdentifier:Br})}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=Br){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=Br){return this.instances.has(t)}getOptions(t=Br){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,r=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[o,i]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(o);r===a&&i.resolve(s)}return s}onInit(t,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(t),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&t(o,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:vS(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=Br){return this.component?this.component.multipleInstances?t:Br:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function vS(e){return e===Br?void 0:e}function yS(e){return e.instantiationMode==="EAGER"}/**
|
|
207
|
+
* @license
|
|
208
|
+
* Copyright 2019 Google LLC
|
|
209
|
+
*
|
|
210
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
211
|
+
* you may not use this file except in compliance with the License.
|
|
212
|
+
* You may obtain a copy of the License at
|
|
213
|
+
*
|
|
214
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
215
|
+
*
|
|
216
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
217
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
218
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
|
+
* See the License for the specific language governing permissions and
|
|
220
|
+
* limitations under the License.
|
|
221
|
+
*/class wS{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 gS(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
|
222
|
+
* @license
|
|
223
|
+
* Copyright 2017 Google LLC
|
|
224
|
+
*
|
|
225
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
226
|
+
* you may not use this file except in compliance with the License.
|
|
227
|
+
* You may obtain a copy of the License at
|
|
228
|
+
*
|
|
229
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
230
|
+
*
|
|
231
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
232
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
233
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
234
|
+
* See the License for the specific language governing permissions and
|
|
235
|
+
* limitations under the License.
|
|
236
|
+
*/var St;(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"})(St||(St={}));const bS={debug:St.DEBUG,verbose:St.VERBOSE,info:St.INFO,warn:St.WARN,error:St.ERROR,silent:St.SILENT},_S=St.INFO,kS={[St.DEBUG]:"log",[St.VERBOSE]:"log",[St.INFO]:"info",[St.WARN]:"warn",[St.ERROR]:"error"},TS=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=kS[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 jf{constructor(t){this.name=t,this._logLevel=_S,this._logHandler=TS,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in St))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?bS[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,St.DEBUG,...t),this._logHandler(this,St.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,St.VERBOSE,...t),this._logHandler(this,St.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,St.INFO,...t),this._logHandler(this,St.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,St.WARN,...t),this._logHandler(this,St.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,St.ERROR,...t),this._logHandler(this,St.ERROR,...t)}}const SS=(e,t)=>t.some(n=>e instanceof n);let mu,gu;function IS(){return mu||(mu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ES(){return gu||(gu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Uf=new WeakMap,Fa=new WeakMap,Ff=new WeakMap,la=new WeakMap,El=new WeakMap;function CS(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(Rr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&Uf.set(n,e)}).catch(()=>{}),El.set(t,e),t}function AS(e){if(Fa.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)});Fa.set(e,t)}let Ba={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return Fa.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Ff.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Rr(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 RS(e){Ba=e(Ba)}function PS(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(ca(this),t,...n);return Ff.set(r,t.sort?t.sort():[t]),Rr(r)}:ES().includes(e)?function(...t){return e.apply(ca(this),t),Rr(Uf.get(this))}:function(...t){return Rr(e.apply(ca(this),t))}}function xS(e){return typeof e=="function"?PS(e):(e instanceof IDBTransaction&&AS(e),SS(e,IS())?new Proxy(e,Ba):e)}function Rr(e){if(e instanceof IDBRequest)return CS(e);if(la.has(e))return la.get(e);const t=xS(e);return t!==e&&(la.set(e,t),El.set(t,e)),t}const ca=e=>El.get(e);function MS(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=Rr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(Rr(i.result),l.oldVersion,l.newVersion,Rr(i.transaction),l)}),n&&i.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),s&&l.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const OS=["get","getKey","getAll","getAllKeys","count"],$S=["put","add","delete","clear"],ua=new Map;function vu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(ua.get(t))return ua.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=$S.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||OS.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),s&&l.done]))[0]};return ua.set(t,o),o}RS(e=>({...e,get:(t,n,r)=>vu(t,n)||e.get(t,n,r),has:(t,n)=>!!vu(t,n)||e.has(t,n)}));/**
|
|
237
|
+
* @license
|
|
238
|
+
* Copyright 2019 Google LLC
|
|
239
|
+
*
|
|
240
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
241
|
+
* you may not use this file except in compliance with the License.
|
|
242
|
+
* You may obtain a copy of the License at
|
|
243
|
+
*
|
|
244
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
245
|
+
*
|
|
246
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
247
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
248
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
249
|
+
* See the License for the specific language governing permissions and
|
|
250
|
+
* limitations under the License.
|
|
251
|
+
*/class NS{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(DS(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function DS(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const Ha="@firebase/app",yu="0.14.10";/**
|
|
252
|
+
* @license
|
|
253
|
+
* Copyright 2019 Google LLC
|
|
254
|
+
*
|
|
255
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
256
|
+
* you may not use this file except in compliance with the License.
|
|
257
|
+
* You may obtain a copy of the License at
|
|
258
|
+
*
|
|
259
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
260
|
+
*
|
|
261
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
262
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
263
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
264
|
+
* See the License for the specific language governing permissions and
|
|
265
|
+
* limitations under the License.
|
|
266
|
+
*/const ur=new jf("@firebase/app"),LS="@firebase/app-compat",jS="@firebase/analytics-compat",US="@firebase/analytics",FS="@firebase/app-check-compat",BS="@firebase/app-check",HS="@firebase/auth",WS="@firebase/auth-compat",VS="@firebase/database",zS="@firebase/data-connect",GS="@firebase/database-compat",qS="@firebase/functions",KS="@firebase/functions-compat",JS="@firebase/installations",YS="@firebase/installations-compat",XS="@firebase/messaging",QS="@firebase/messaging-compat",ZS="@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";/**
|
|
267
|
+
* @license
|
|
268
|
+
* Copyright 2019 Google LLC
|
|
269
|
+
*
|
|
270
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
271
|
+
* you may not use this file except in compliance with the License.
|
|
272
|
+
* You may obtain a copy of the License at
|
|
273
|
+
*
|
|
274
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
275
|
+
*
|
|
276
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
277
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
278
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
279
|
+
* See the License for the specific language governing permissions and
|
|
280
|
+
* limitations under the License.
|
|
281
|
+
*/const Wa="[DEFAULT]",uI={[Ha]:"fire-core",[LS]:"fire-core-compat",[US]:"fire-analytics",[jS]:"fire-analytics-compat",[BS]:"fire-app-check",[FS]:"fire-app-check-compat",[HS]:"fire-auth",[WS]:"fire-auth-compat",[VS]:"fire-rtdb",[zS]:"fire-data-connect",[GS]:"fire-rtdb-compat",[qS]:"fire-fn",[KS]:"fire-fn-compat",[JS]:"fire-iid",[YS]:"fire-iid-compat",[XS]:"fire-fcm",[QS]:"fire-fcm-compat",[ZS]:"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"};/**
|
|
282
|
+
* @license
|
|
283
|
+
* Copyright 2019 Google LLC
|
|
284
|
+
*
|
|
285
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
286
|
+
* you may not use this file except in compliance with the License.
|
|
287
|
+
* You may obtain a copy of the License at
|
|
288
|
+
*
|
|
289
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
290
|
+
*
|
|
291
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
292
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
293
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
294
|
+
* See the License for the specific language governing permissions and
|
|
295
|
+
* limitations under the License.
|
|
296
|
+
*/const to=new Map,dI=new Map,Va=new Map;function wu(e,t){try{e.container.addComponent(t)}catch(n){ur.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function no(e){const t=e.name;if(Va.has(t))return ur.debug(`There were multiple attempts to register component ${t}.`),!1;Va.set(t,e);for(const n of to.values())wu(n,e);for(const n of dI.values())wu(n,e);return!0}function Bf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Un(e){return e==null?!1:e.settings!==void 0}/**
|
|
297
|
+
* @license
|
|
298
|
+
* Copyright 2019 Google LLC
|
|
299
|
+
*
|
|
300
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
301
|
+
* you may not use this file except in compliance with the License.
|
|
302
|
+
* You may obtain a copy of the License at
|
|
303
|
+
*
|
|
304
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
305
|
+
*
|
|
306
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
307
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
308
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
309
|
+
* See the License for the specific language governing permissions and
|
|
310
|
+
* limitations under the License.
|
|
311
|
+
*/const 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."},Pr=new uo("app","Firebase",fI);/**
|
|
312
|
+
* @license
|
|
313
|
+
* Copyright 2019 Google LLC
|
|
314
|
+
*
|
|
315
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
316
|
+
* you may not use this file except in compliance with the License.
|
|
317
|
+
* You may obtain a copy of the License at
|
|
318
|
+
*
|
|
319
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
320
|
+
*
|
|
321
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
322
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
323
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
324
|
+
* See the License for the specific language governing permissions and
|
|
325
|
+
* limitations under the License.
|
|
326
|
+
*/class 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 bs("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 Pr.create("app-deleted",{appName:this._name})}}/**
|
|
327
|
+
* @license
|
|
328
|
+
* Copyright 2019 Google LLC
|
|
329
|
+
*
|
|
330
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
331
|
+
* you may not use this file except in compliance with the License.
|
|
332
|
+
* You may obtain a copy of the License at
|
|
333
|
+
*
|
|
334
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
335
|
+
*
|
|
336
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
337
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
338
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
339
|
+
* See the License for the specific language governing permissions and
|
|
340
|
+
* limitations under the License.
|
|
341
|
+
*/const ho=cI;function Hf(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:Wa,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw Pr.create("bad-app-name",{appName:String(s)});if(n||(n=Df()),!n)throw Pr.create("no-options");const o=to.get(s);if(o){if(ws(n,o.options)&&ws(r,o.config))return o;throw Pr.create("duplicate-app",{appName:s})}const i=new wS(s);for(const l of Va.values())i.addComponent(l);const a=new hI(n,r,i);return to.set(s,a),a}function Wf(e=Wa){const t=to.get(e);if(!t&&e===Wa&&Df())return Hf();if(!t)throw Pr.create("no-app",{appName:e});return t}function pI(){return Array.from(to.values())}function fs(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 "/")`),ur.warn(i.join(" "));return}no(new bs(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
|
|
342
|
+
* @license
|
|
343
|
+
* Copyright 2021 Google LLC
|
|
344
|
+
*
|
|
345
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
346
|
+
* you may not use this file except in compliance with the License.
|
|
347
|
+
* You may obtain a copy of the License at
|
|
348
|
+
*
|
|
349
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
350
|
+
*
|
|
351
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
352
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
353
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
354
|
+
* See the License for the specific language governing permissions and
|
|
355
|
+
* limitations under the License.
|
|
356
|
+
*/const mI="firebase-heartbeat-database",gI=1,ro="firebase-heartbeat-store";let da=null;function Vf(){return da||(da=MS(mI,gI,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(ro)}catch(n){console.warn(n)}}}}).catch(e=>{throw Pr.create("idb-open",{originalErrorMessage:e.message})})),da}async function vI(e){try{const n=(await Vf()).transaction(ro),r=await n.objectStore(ro).get(zf(e));return await n.done,r}catch(t){if(t instanceof Or)ur.warn(t.message);else{const n=Pr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});ur.warn(n.message)}}}async function bu(e,t){try{const r=(await Vf()).transaction(ro,"readwrite");await r.objectStore(ro).put(t,zf(e)),await r.done}catch(n){if(n instanceof Or)ur.warn(n.message);else{const r=Pr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});ur.warn(r.message)}}}function zf(e){return`${e.name}!${e.options.appId}`}/**
|
|
357
|
+
* @license
|
|
358
|
+
* Copyright 2021 Google LLC
|
|
359
|
+
*
|
|
360
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
361
|
+
* you may not use this file except in compliance with the License.
|
|
362
|
+
* You may obtain a copy of the License at
|
|
363
|
+
*
|
|
364
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
365
|
+
*
|
|
366
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
367
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
368
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
369
|
+
* See the License for the specific language governing permissions and
|
|
370
|
+
* limitations under the License.
|
|
371
|
+
*/const 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=_u();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){ur.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=_u(),{heartbeatsToSend:r,unsentEntries:s}=_I(this._heartbeatsCache.heartbeats),o=$f(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 ur.warn(n),""}}}function _u(){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),ku(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),ku(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 iS()?aS().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 bu(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 bu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function ku(e){return $f(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}/**
|
|
372
|
+
* @license
|
|
373
|
+
* Copyright 2019 Google LLC
|
|
374
|
+
*
|
|
375
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
376
|
+
* you may not use this file except in compliance with the License.
|
|
377
|
+
* You may obtain a copy of the License at
|
|
378
|
+
*
|
|
379
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
380
|
+
*
|
|
381
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
382
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
383
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
384
|
+
* See the License for the specific language governing permissions and
|
|
385
|
+
* limitations under the License.
|
|
386
|
+
*/function SI(e){no(new bs("platform-logger",t=>new NS(t),"PRIVATE")),no(new bs("heartbeat",t=>new bI(t),"PRIVATE")),fs(Ha,yu,e),fs(Ha,yu,"esm2020"),fs("fire-js","")}SI("");var II="firebase",EI="12.11.0";/**
|
|
387
|
+
* @license
|
|
388
|
+
* Copyright 2020 Google LLC
|
|
389
|
+
*
|
|
390
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
391
|
+
* you may not use this file except in compliance with the License.
|
|
392
|
+
* You may obtain a copy of the License at
|
|
393
|
+
*
|
|
394
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
395
|
+
*
|
|
396
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
397
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
398
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
399
|
+
* See the License for the specific language governing permissions and
|
|
400
|
+
* limitations under the License.
|
|
401
|
+
*/fs(II,EI,"app");function Gf(){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=Gf,qf=new uo("auth","Firebase",Gf());/**
|
|
402
|
+
* @license
|
|
403
|
+
* Copyright 2020 Google LLC
|
|
404
|
+
*
|
|
405
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
406
|
+
* you may not use this file except in compliance with the License.
|
|
407
|
+
* You may obtain a copy of the License at
|
|
408
|
+
*
|
|
409
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
410
|
+
*
|
|
411
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
412
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
413
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
414
|
+
* See the License for the specific language governing permissions and
|
|
415
|
+
* limitations under the License.
|
|
416
|
+
*/const Qo=new jf("@firebase/auth");function AI(e,...t){Qo.logLevel<=St.WARN&&Qo.warn(`Auth (${ho}): ${e}`,...t)}function Lo(e,...t){Qo.logLevel<=St.ERROR&&Qo.error(`Auth (${ho}): ${e}`,...t)}/**
|
|
417
|
+
* @license
|
|
418
|
+
* Copyright 2020 Google LLC
|
|
419
|
+
*
|
|
420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
421
|
+
* you may not use this file except in compliance with the License.
|
|
422
|
+
* You may obtain a copy of the License at
|
|
423
|
+
*
|
|
424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
425
|
+
*
|
|
426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
429
|
+
* See the License for the specific language governing permissions and
|
|
430
|
+
* limitations under the License.
|
|
431
|
+
*/function Vn(e,...t){throw Al(e,...t)}function Cn(e,...t){return Al(e,...t)}function Cl(e,t,n){const r={...CI(),[t]:n};return new uo("auth","Firebase",r).create(t,{appName:e.name})}function Kr(e){return Cl(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&&Vn(e,"argument-error"),Cl(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 qf.create(e,...t)}function He(e,t,...n){if(!e)throw Al(t,...n)}function nr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Lo(t),new Error(t)}function dr(e,t){e||nr(t)}/**
|
|
432
|
+
* @license
|
|
433
|
+
* Copyright 2020 Google LLC
|
|
434
|
+
*
|
|
435
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
436
|
+
* you may not use this file except in compliance with the License.
|
|
437
|
+
* You may obtain a copy of the License at
|
|
438
|
+
*
|
|
439
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
440
|
+
*
|
|
441
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
442
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
443
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
444
|
+
* See the License for the specific language governing permissions and
|
|
445
|
+
* limitations under the License.
|
|
446
|
+
*/function za(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function PI(){return Tu()==="http:"||Tu()==="https:"}function Tu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
|
|
447
|
+
* @license
|
|
448
|
+
* Copyright 2020 Google LLC
|
|
449
|
+
*
|
|
450
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
451
|
+
* you may not use this file except in compliance with the License.
|
|
452
|
+
* You may obtain a copy of the License at
|
|
453
|
+
*
|
|
454
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
455
|
+
*
|
|
456
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
457
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
458
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
459
|
+
* See the License for the specific language governing permissions and
|
|
460
|
+
* limitations under the License.
|
|
461
|
+
*/function xI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(PI()||rS()||"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}/**
|
|
462
|
+
* @license
|
|
463
|
+
* Copyright 2020 Google LLC
|
|
464
|
+
*
|
|
465
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
466
|
+
* you may not use this file except in compliance with the License.
|
|
467
|
+
* You may obtain a copy of the License at
|
|
468
|
+
*
|
|
469
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
470
|
+
*
|
|
471
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
472
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
473
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
|
+
* See the License for the specific language governing permissions and
|
|
475
|
+
* limitations under the License.
|
|
476
|
+
*/class po{constructor(t,n){this.shortDelay=t,this.longDelay=n,dr(n>t,"Short delay should be less than long delay!"),this.isMobile=tS()||sS()}get(){return xI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
477
|
+
* @license
|
|
478
|
+
* Copyright 2020 Google LLC
|
|
479
|
+
*
|
|
480
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
481
|
+
* you may not use this file except in compliance with the License.
|
|
482
|
+
* You may obtain a copy of the License at
|
|
483
|
+
*
|
|
484
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
485
|
+
*
|
|
486
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
487
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
488
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
489
|
+
* See the License for the specific language governing permissions and
|
|
490
|
+
* limitations under the License.
|
|
491
|
+
*/function Rl(e,t){dr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
|
|
492
|
+
* @license
|
|
493
|
+
* Copyright 2020 Google LLC
|
|
494
|
+
*
|
|
495
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
496
|
+
* you may not use this file except in compliance with the License.
|
|
497
|
+
* You may obtain a copy of the License at
|
|
498
|
+
*
|
|
499
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
500
|
+
*
|
|
501
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
502
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
503
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
504
|
+
* See the License for the specific language governing permissions and
|
|
505
|
+
* limitations under the License.
|
|
506
|
+
*/class Kf{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;nr("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;nr("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;nr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
507
|
+
* @license
|
|
508
|
+
* Copyright 2020 Google LLC
|
|
509
|
+
*
|
|
510
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
511
|
+
* you may not use this file except in compliance with the License.
|
|
512
|
+
* You may obtain a copy of the License at
|
|
513
|
+
*
|
|
514
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
515
|
+
*
|
|
516
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
517
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
518
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
519
|
+
* See the License for the specific language governing permissions and
|
|
520
|
+
* limitations under the License.
|
|
521
|
+
*/const 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"};/**
|
|
522
|
+
* @license
|
|
523
|
+
* Copyright 2020 Google LLC
|
|
524
|
+
*
|
|
525
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
526
|
+
* you may not use this file except in compliance with the License.
|
|
527
|
+
* You may obtain a copy of the License at
|
|
528
|
+
*
|
|
529
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
530
|
+
*
|
|
531
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
532
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
533
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
534
|
+
* See the License for the specific language governing permissions and
|
|
535
|
+
* limitations under the License.
|
|
536
|
+
*/const $I=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],NI=new po(3e4,6e4);function Pl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Ss(e,t,n,r,s={}){return Jf(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=fo({key:e.config.apiKey,...i}).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);const d={method:t,headers:l,...o};return nS()||(d.referrerPolicy="no-referrer"),e.emulatorConfig&&Il(e.emulatorConfig.host)&&(d.credentials="include"),Kf.fetch()(await Yf(e,e.config.apiHost,n,a),d)})}async function Jf(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 Eo(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const a=o.ok?i.errorMessage:i.error.message,[l,d]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Eo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw Eo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw Eo(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Cl(e,c,d);Vn(e,c)}}catch(s){if(s instanceof Or)throw s;Vn(e,"network-request-failed",{message:String(s)})}}async function DI(e,t,n,r,s={}){const o=await Ss(e,t,n,r,s);return"mfaPendingCredential"in o&&Vn(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function Yf(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Rl(e.config,s):`${e.config.apiScheme}://${s}`;return $I.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(Cn(this.auth,"network-request-failed")),NI.get())})}}function Eo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Cn(e,t,r);return s.customData._tokenResponse=n,s}/**
|
|
537
|
+
* @license
|
|
538
|
+
* Copyright 2020 Google LLC
|
|
539
|
+
*
|
|
540
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
541
|
+
* you may not use this file except in compliance with the License.
|
|
542
|
+
* You may obtain a copy of the License at
|
|
543
|
+
*
|
|
544
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
545
|
+
*
|
|
546
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
547
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
548
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
549
|
+
* See the License for the specific language governing permissions and
|
|
550
|
+
* limitations under the License.
|
|
551
|
+
*/async function jI(e,t){return Ss(e,"POST","/v1/accounts:delete",t)}async function Zo(e,t){return Ss(e,"POST","/v1/accounts:lookup",t)}/**
|
|
552
|
+
* @license
|
|
553
|
+
* Copyright 2020 Google LLC
|
|
554
|
+
*
|
|
555
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
556
|
+
* you may not use this file except in compliance with the License.
|
|
557
|
+
* You may obtain a copy of the License at
|
|
558
|
+
*
|
|
559
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
560
|
+
*
|
|
561
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
562
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
563
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
564
|
+
* See the License for the specific language governing permissions and
|
|
565
|
+
* limitations under the License.
|
|
566
|
+
*/function Vs(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function UI(e,t=!1){const n=Ts(e),r=await n.getIdToken(t),s=xl(r);He(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:Vs(fa(s.auth_time)),issuedAtTime:Vs(fa(s.iat)),expirationTime:Vs(fa(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function fa(e){return Number(e)*1e3}function xl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Lo("JWT malformed, contained fewer than 3 sections"),null;try{const s=Nf(n);return s?JSON.parse(s):(Lo("Failed to decode base64 JWT payload"),null)}catch(s){return Lo("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Su(e){const t=xl(e);return He(t,"internal-error"),He(typeof t.exp<"u","internal-error"),He(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
|
|
567
|
+
* @license
|
|
568
|
+
* Copyright 2020 Google LLC
|
|
569
|
+
*
|
|
570
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
571
|
+
* you may not use this file except in compliance with the License.
|
|
572
|
+
* You may obtain a copy of the License at
|
|
573
|
+
*
|
|
574
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
575
|
+
*
|
|
576
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
577
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
578
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
579
|
+
* See the License for the specific language governing permissions and
|
|
580
|
+
* limitations under the License.
|
|
581
|
+
*/async function so(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Or&&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"}/**
|
|
582
|
+
* @license
|
|
583
|
+
* Copyright 2020 Google LLC
|
|
584
|
+
*
|
|
585
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
586
|
+
* you may not use this file except in compliance with the License.
|
|
587
|
+
* You may obtain a copy of the License at
|
|
588
|
+
*
|
|
589
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
590
|
+
*
|
|
591
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
592
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
593
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
594
|
+
* See the License for the specific language governing permissions and
|
|
595
|
+
* limitations under the License.
|
|
596
|
+
*/class BI{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){if(t){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(t=!1){if(!this.isRunning)return;const n=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){(t==null?void 0:t.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
597
|
+
* @license
|
|
598
|
+
* Copyright 2020 Google LLC
|
|
599
|
+
*
|
|
600
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
601
|
+
* you may not use this file except in compliance with the License.
|
|
602
|
+
* You may obtain a copy of the License at
|
|
603
|
+
*
|
|
604
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
605
|
+
*
|
|
606
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
607
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
608
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
609
|
+
* See the License for the specific language governing permissions and
|
|
610
|
+
* limitations under the License.
|
|
611
|
+
*/class Ga{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Vs(this.lastLoginAt),this.creationTime=Vs(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
612
|
+
* @license
|
|
613
|
+
* Copyright 2019 Google LLC
|
|
614
|
+
*
|
|
615
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
616
|
+
* you may not use this file except in compliance with the License.
|
|
617
|
+
* You may obtain a copy of the License at
|
|
618
|
+
*
|
|
619
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
620
|
+
*
|
|
621
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
622
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
623
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
624
|
+
* See the License for the specific language governing permissions and
|
|
625
|
+
* limitations under the License.
|
|
626
|
+
*/async function ei(e){var h;const t=e.auth,n=await e.getIdToken(),r=await so(e,Zo(t,{idToken:n}));He(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?Xf(s.providerUserInfo):[],i=WI(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),d=a?l:!1,c={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Ga(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,c)}async function HI(e){const t=Ts(e);await ei(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function WI(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function Xf(e){return e.map(({providerId:t,...n})=>({providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
|
|
627
|
+
* @license
|
|
628
|
+
* Copyright 2020 Google LLC
|
|
629
|
+
*
|
|
630
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
631
|
+
* you may not use this file except in compliance with the License.
|
|
632
|
+
* You may obtain a copy of the License at
|
|
633
|
+
*
|
|
634
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
635
|
+
*
|
|
636
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
637
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
638
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
639
|
+
* See the License for the specific language governing permissions and
|
|
640
|
+
* limitations under the License.
|
|
641
|
+
*/async function VI(e,t){const n=await Jf(e,{},async()=>{const r=fo({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await Yf(e,s,"/v1/token",`key=${o}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return e.emulatorConfig&&Il(e.emulatorConfig.host)&&(l.credentials="include"),Kf.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function zI(e,t){return Ss(e,"POST","/v2/accounts:revokeToken",Pl(e,t))}/**
|
|
642
|
+
* @license
|
|
643
|
+
* Copyright 2020 Google LLC
|
|
644
|
+
*
|
|
645
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
646
|
+
* you may not use this file except in compliance with the License.
|
|
647
|
+
* You may obtain a copy of the License at
|
|
648
|
+
*
|
|
649
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
650
|
+
*
|
|
651
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
652
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
653
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
654
|
+
* See the License for the specific language governing permissions and
|
|
655
|
+
* limitations under the License.
|
|
656
|
+
*/class hs{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){He(t.idToken,"internal-error"),He(typeof t.idToken<"u","internal-error"),He(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Su(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){He(t.length!==0,"internal-error");const n=Su(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(He(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(t,n){const{accessToken:r,refreshToken:s,expiresIn:o}=await VI(t,n);this.updateTokensAndExpiration(r,s,Number(o))}updateTokensAndExpiration(t,n,r){this.refreshToken=n||null,this.accessToken=t||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(t,n){const{refreshToken:r,accessToken:s,expirationTime:o}=n,i=new hs;return r&&(He(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(He(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(He(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 hs,this.toJSON())}_performRefresh(){return nr("not implemented")}}/**
|
|
657
|
+
* @license
|
|
658
|
+
* Copyright 2020 Google LLC
|
|
659
|
+
*
|
|
660
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
661
|
+
* you may not use this file except in compliance with the License.
|
|
662
|
+
* You may obtain a copy of the License at
|
|
663
|
+
*
|
|
664
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
665
|
+
*
|
|
666
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
667
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
668
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
669
|
+
* See the License for the specific language governing permissions and
|
|
670
|
+
* limitations under the License.
|
|
671
|
+
*/function _r(e,t){He(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class Sn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new BI(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 Ga(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await so(this,this.stsTokenManager.getToken(this.auth,t));return He(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return UI(this,t)}reload(){return HI(this)}_assign(t){this!==t&&(He(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 Sn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){He(!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 ei(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Un(this.auth.app))return Promise.reject(Kr(this.auth));const t=await this.getIdToken();return await so(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,a=n.tenantId??void 0,l=n._redirectEventId??void 0,d=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:h,emailVerified:v,isAnonymous:E,providerData:D,stsTokenManager:O}=n;He(h&&O,t,"internal-error");const z=hs.fromJSON(this.name,O);He(typeof h=="string",t,"internal-error"),_r(r,t.name),_r(s,t.name),He(typeof v=="boolean",t,"internal-error"),He(typeof E=="boolean",t,"internal-error"),_r(o,t.name),_r(i,t.name),_r(a,t.name),_r(l,t.name),_r(d,t.name),_r(c,t.name);const R=new Sn({uid:h,auth:t,email:s,emailVerified:v,displayName:r,isAnonymous:E,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:z,createdAt:d,lastLoginAt:c});return D&&Array.isArray(D)&&(R.providerData=D.map(x=>({...x}))),l&&(R._redirectEventId=l),R}static async _fromIdTokenResponse(t,n,r=!1){const s=new hs;s.updateFromServerResponse(n);const o=new Sn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await ei(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];He(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?Xf(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new hs;a.updateFromIdToken(r);const l=new Sn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Ga(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,d),l}}/**
|
|
672
|
+
* @license
|
|
673
|
+
* Copyright 2020 Google LLC
|
|
674
|
+
*
|
|
675
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
676
|
+
* you may not use this file except in compliance with the License.
|
|
677
|
+
* You may obtain a copy of the License at
|
|
678
|
+
*
|
|
679
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
680
|
+
*
|
|
681
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
682
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
683
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
684
|
+
* See the License for the specific language governing permissions and
|
|
685
|
+
* limitations under the License.
|
|
686
|
+
*/const Iu=new Map;function rr(e){dr(e instanceof Function,"Expected a class definition");let t=Iu.get(e);return t?(dr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Iu.set(e,t),t)}/**
|
|
687
|
+
* @license
|
|
688
|
+
* Copyright 2019 Google LLC
|
|
689
|
+
*
|
|
690
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
691
|
+
* you may not use this file except in compliance with the License.
|
|
692
|
+
* You may obtain a copy of the License at
|
|
693
|
+
*
|
|
694
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
695
|
+
*
|
|
696
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
697
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
698
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
699
|
+
* See the License for the specific language governing permissions and
|
|
700
|
+
* limitations under the License.
|
|
701
|
+
*/class Qf{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){}}Qf.type="NONE";const Eu=Qf;/**
|
|
702
|
+
* @license
|
|
703
|
+
* Copyright 2019 Google LLC
|
|
704
|
+
*
|
|
705
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
706
|
+
* you may not use this file except in compliance with the License.
|
|
707
|
+
* You may obtain a copy of the License at
|
|
708
|
+
*
|
|
709
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
710
|
+
*
|
|
711
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
712
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
713
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
714
|
+
* See the License for the specific language governing permissions and
|
|
715
|
+
* limitations under the License.
|
|
716
|
+
*/function jo(e,t,n){return`firebase:${e}:${t}:${n}`}class ps{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=jo(this.userKey,s.apiKey,o),this.fullPersistenceKey=jo("persistence",s.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){const n=await Zo(this.auth,{idToken:t}).catch(()=>{});return n?Sn._fromGetAccountInfoResponse(this.auth,n,t):null}return Sn._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 ps(rr(Eu),t,r);const s=(await Promise.all(n.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let o=s[0]||rr(Eu);const i=jo(r,t.config.apiKey,t.name);let a=null;for(const d of n)try{const c=await d._get(i);if(c){let h;if(typeof c=="string"){const v=await Zo(t,{idToken:c}).catch(()=>{});if(!v)break;h=await Sn._fromGetAccountInfoResponse(t,v,c)}else h=Sn._fromJSON(t,c);d!==o&&(a=h),o=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new ps(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async d=>{if(d!==o)try{await d._remove(i)}catch{}})),new ps(o,t,r))}}/**
|
|
717
|
+
* @license
|
|
718
|
+
* Copyright 2020 Google LLC
|
|
719
|
+
*
|
|
720
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
721
|
+
* you may not use this file except in compliance with the License.
|
|
722
|
+
* You may obtain a copy of the License at
|
|
723
|
+
*
|
|
724
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
725
|
+
*
|
|
726
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
727
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
728
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
729
|
+
* See the License for the specific language governing permissions and
|
|
730
|
+
* limitations under the License.
|
|
731
|
+
*/function Cu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(nh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Zf(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(sh(t))return"Blackberry";if(oh(t))return"Webos";if(eh(t))return"Safari";if((t.includes("chrome/")||th(t))&&!t.includes("edge/"))return"Chrome";if(rh(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 Zf(e=ln()){return/firefox\//i.test(e)}function eh(e=ln()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function th(e=ln()){return/crios\//i.test(e)}function nh(e=ln()){return/iemobile/i.test(e)}function rh(e=ln()){return/android/i.test(e)}function sh(e=ln()){return/blackberry/i.test(e)}function oh(e=ln()){return/webos/i.test(e)}function Ml(e=ln()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function GI(e=ln()){var t;return Ml(e)&&!!((t=window.navigator)!=null&&t.standalone)}function qI(){return oS()&&document.documentMode===10}function ih(e=ln()){return Ml(e)||rh(e)||oh(e)||sh(e)||/windows phone/i.test(e)||nh(e)}/**
|
|
732
|
+
* @license
|
|
733
|
+
* Copyright 2020 Google LLC
|
|
734
|
+
*
|
|
735
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
736
|
+
* you may not use this file except in compliance with the License.
|
|
737
|
+
* You may obtain a copy of the License at
|
|
738
|
+
*
|
|
739
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
740
|
+
*
|
|
741
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
742
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
743
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
744
|
+
* See the License for the specific language governing permissions and
|
|
745
|
+
* limitations under the License.
|
|
746
|
+
*/function ah(e,t=[]){let n;switch(e){case"Browser":n=Cu(ln());break;case"Worker":n=`${Cu(ln())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${ho}/${r}`}/**
|
|
747
|
+
* @license
|
|
748
|
+
* Copyright 2022 Google LLC
|
|
749
|
+
*
|
|
750
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
751
|
+
* you may not use this file except in compliance with the License.
|
|
752
|
+
* You may obtain a copy of the License at
|
|
753
|
+
*
|
|
754
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
755
|
+
*
|
|
756
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
757
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
758
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
759
|
+
* See the License for the specific language governing permissions and
|
|
760
|
+
* limitations under the License.
|
|
761
|
+
*/class KI{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,n){const r=o=>new Promise((i,a)=>{try{const l=t(o);i(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const n=[];try{for(const r of this.queue)await r(t),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
|
|
762
|
+
* @license
|
|
763
|
+
* Copyright 2023 Google LLC
|
|
764
|
+
*
|
|
765
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
766
|
+
* you may not use this file except in compliance with the License.
|
|
767
|
+
* You may obtain a copy of the License at
|
|
768
|
+
*
|
|
769
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
770
|
+
*
|
|
771
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
772
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
773
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
774
|
+
* See the License for the specific language governing permissions and
|
|
775
|
+
* limitations under the License.
|
|
776
|
+
*/async function JI(e,t={}){return Ss(e,"GET","/v2/passwordPolicy",Pl(e,t))}/**
|
|
777
|
+
* @license
|
|
778
|
+
* Copyright 2023 Google LLC
|
|
779
|
+
*
|
|
780
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
781
|
+
* you may not use this file except in compliance with the License.
|
|
782
|
+
* You may obtain a copy of the License at
|
|
783
|
+
*
|
|
784
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
785
|
+
*
|
|
786
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
787
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
788
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
789
|
+
* See the License for the specific language governing permissions and
|
|
790
|
+
* limitations under the License.
|
|
791
|
+
*/const 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))}}/**
|
|
792
|
+
* @license
|
|
793
|
+
* Copyright 2020 Google LLC
|
|
794
|
+
*
|
|
795
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
796
|
+
* you may not use this file except in compliance with the License.
|
|
797
|
+
* You may obtain a copy of the License at
|
|
798
|
+
*
|
|
799
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
800
|
+
*
|
|
801
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
802
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
803
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
804
|
+
* See the License for the specific language governing permissions and
|
|
805
|
+
* limitations under the License.
|
|
806
|
+
*/class 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 Au(this),this.idTokenSubscription=new Au(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=qf,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=rr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await ps.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 Zo(this,{idToken:t}),r=await Sn._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(Un(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=(o=this.redirectUser)==null?void 0:o._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(t);(!i||i===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return He(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 ei(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(Un(this.app))return Promise.reject(Kr(this));const n=t?Ts(t):null;return n&&He(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&&He(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 Un(this.app)?Promise.reject(Kr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Un(this.app)?Promise.reject(Kr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(rr(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 uo("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 zI(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&&rr(t)||this._popupRedirectResolver;He(n,this,"argument-error"),this.redirectPersistenceManager=await ps.create(this,[rr(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===t?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,n,r,s){if(this._deleted)return()=>{};const o=typeof n=="function"?n:n.next.bind(n);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(He(a,this,"internal-error"),a.then(()=>{i||o(this.currentUser)}),typeof n=="function"){const l=t.addObserver(n,r,s);return()=>{i=!0,l()}}else{const l=t.addObserver(n);return()=>{i=!0,l()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return He(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=ah(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(Un(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 _i(e){return Ts(e)}class Au{constructor(t){this.auth=t,this.observer=null,this.addObserver=fS(n=>this.observer=n)}get next(){return He(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
807
|
+
* @license
|
|
808
|
+
* Copyright 2020 Google LLC
|
|
809
|
+
*
|
|
810
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
811
|
+
* you may not use this file except in compliance with the License.
|
|
812
|
+
* You may obtain a copy of the License at
|
|
813
|
+
*
|
|
814
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
815
|
+
*
|
|
816
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
817
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
818
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
819
|
+
* See the License for the specific language governing permissions and
|
|
820
|
+
* limitations under the License.
|
|
821
|
+
*/let Ol={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function ZI(e){Ol=e}function eE(e){return Ol.loadJS(e)}function tE(){return Ol.gapiScript}function nE(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
|
|
822
|
+
* @license
|
|
823
|
+
* Copyright 2020 Google LLC
|
|
824
|
+
*
|
|
825
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
826
|
+
* you may not use this file except in compliance with the License.
|
|
827
|
+
* You may obtain a copy of the License at
|
|
828
|
+
*
|
|
829
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
830
|
+
*
|
|
831
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
832
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
833
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
834
|
+
* See the License for the specific language governing permissions and
|
|
835
|
+
* limitations under the License.
|
|
836
|
+
*/function rE(e,t){const n=Bf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(ws(o,t??{}))return s;Vn(s,"already-initialized")}return n.initialize({options:t})}function sE(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(rr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function oE(e,t,n){const r=_i(e);He(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=lh(t),{host:i,port:a}=iE(t),l=a===null?"":`:${a}`,d={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){He(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),He(ws(d,r.config.emulator)&&ws(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,Il(i)?mS(`${o}//${i}${l}`):aE()}function lh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function iE(e){const t=lh(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:Ru(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Ru(i)}}}function Ru(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function aE(){function e(){const t=document.createElement("p"),n=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",e):e())}/**
|
|
837
|
+
* @license
|
|
838
|
+
* Copyright 2020 Google LLC
|
|
839
|
+
*
|
|
840
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
841
|
+
* you may not use this file except in compliance with the License.
|
|
842
|
+
* You may obtain a copy of the License at
|
|
843
|
+
*
|
|
844
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
845
|
+
*
|
|
846
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
847
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
848
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
849
|
+
* See the License for the specific language governing permissions and
|
|
850
|
+
* limitations under the License.
|
|
851
|
+
*/class ch{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return nr("not implemented")}_getIdTokenResponse(t){return nr("not implemented")}_linkToIdToken(t,n){return nr("not implemented")}_getReauthenticationResolver(t){return nr("not implemented")}}/**
|
|
852
|
+
* @license
|
|
853
|
+
* Copyright 2020 Google LLC
|
|
854
|
+
*
|
|
855
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
856
|
+
* you may not use this file except in compliance with the License.
|
|
857
|
+
* You may obtain a copy of the License at
|
|
858
|
+
*
|
|
859
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
860
|
+
*
|
|
861
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
862
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
863
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
864
|
+
* See the License for the specific language governing permissions and
|
|
865
|
+
* limitations under the License.
|
|
866
|
+
*/async function ms(e,t){return DI(e,"POST","/v1/accounts:signInWithIdp",Pl(e,t))}/**
|
|
867
|
+
* @license
|
|
868
|
+
* Copyright 2020 Google LLC
|
|
869
|
+
*
|
|
870
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
871
|
+
* you may not use this file except in compliance with the License.
|
|
872
|
+
* You may obtain a copy of the License at
|
|
873
|
+
*
|
|
874
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
875
|
+
*
|
|
876
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
877
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
878
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
879
|
+
* See the License for the specific language governing permissions and
|
|
880
|
+
* limitations under the License.
|
|
881
|
+
*/const lE="http://localhost";class Yr extends ch{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Yr(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):Vn("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const n=typeof t=="string"?JSON.parse(t):t,{providerId:r,signInMethod:s,...o}=n;if(!r||!s)return null;const i=new Yr(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 ms(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,ms(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,ms(t,n)}buildRequest(){const t={requestUri:lE,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=fo(n)}return t}}/**
|
|
882
|
+
* @license
|
|
883
|
+
* Copyright 2020 Google LLC
|
|
884
|
+
*
|
|
885
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
886
|
+
* you may not use this file except in compliance with the License.
|
|
887
|
+
* You may obtain a copy of the License at
|
|
888
|
+
*
|
|
889
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
890
|
+
*
|
|
891
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
892
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
893
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
894
|
+
* See the License for the specific language governing permissions and
|
|
895
|
+
* limitations under the License.
|
|
896
|
+
*/class $l{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}/**
|
|
897
|
+
* @license
|
|
898
|
+
* Copyright 2019 Google LLC
|
|
899
|
+
*
|
|
900
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
901
|
+
* you may not use this file except in compliance with the License.
|
|
902
|
+
* You may obtain a copy of the License at
|
|
903
|
+
*
|
|
904
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
905
|
+
*
|
|
906
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
907
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
908
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
909
|
+
* See the License for the specific language governing permissions and
|
|
910
|
+
* limitations under the License.
|
|
911
|
+
*/class mo extends $l{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
|
|
912
|
+
* @license
|
|
913
|
+
* Copyright 2020 Google LLC
|
|
914
|
+
*
|
|
915
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
916
|
+
* you may not use this file except in compliance with the License.
|
|
917
|
+
* You may obtain a copy of the License at
|
|
918
|
+
*
|
|
919
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
920
|
+
*
|
|
921
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
922
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
923
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
924
|
+
* See the License for the specific language governing permissions and
|
|
925
|
+
* limitations under the License.
|
|
926
|
+
*/class Er extends mo{constructor(){super("facebook.com")}static credential(t){return Yr._fromParams({providerId:Er.PROVIDER_ID,signInMethod:Er.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Er.credentialFromTaggedObject(t)}static credentialFromError(t){return Er.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Er.credential(t.oauthAccessToken)}catch{return null}}}Er.FACEBOOK_SIGN_IN_METHOD="facebook.com";Er.PROVIDER_ID="facebook.com";/**
|
|
927
|
+
* @license
|
|
928
|
+
* Copyright 2020 Google LLC
|
|
929
|
+
*
|
|
930
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
931
|
+
* you may not use this file except in compliance with the License.
|
|
932
|
+
* You may obtain a copy of the License at
|
|
933
|
+
*
|
|
934
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
935
|
+
*
|
|
936
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
937
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
938
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
939
|
+
* See the License for the specific language governing permissions and
|
|
940
|
+
* limitations under the License.
|
|
941
|
+
*/class Cr extends mo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Yr._fromParams({providerId:Cr.PROVIDER_ID,signInMethod:Cr.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return Cr.credentialFromTaggedObject(t)}static credentialFromError(t){return Cr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return Cr.credential(n,r)}catch{return null}}}Cr.GOOGLE_SIGN_IN_METHOD="google.com";Cr.PROVIDER_ID="google.com";/**
|
|
942
|
+
* @license
|
|
943
|
+
* Copyright 2020 Google LLC
|
|
944
|
+
*
|
|
945
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
946
|
+
* you may not use this file except in compliance with the License.
|
|
947
|
+
* You may obtain a copy of the License at
|
|
948
|
+
*
|
|
949
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
950
|
+
*
|
|
951
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
952
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
953
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
954
|
+
* See the License for the specific language governing permissions and
|
|
955
|
+
* limitations under the License.
|
|
956
|
+
*/class Fn extends mo{constructor(){super("github.com")}static credential(t){return Yr._fromParams({providerId:Fn.PROVIDER_ID,signInMethod:Fn.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Fn.credentialFromTaggedObject(t)}static credentialFromError(t){return Fn.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Fn.credential(t.oauthAccessToken)}catch{return null}}}Fn.GITHUB_SIGN_IN_METHOD="github.com";Fn.PROVIDER_ID="github.com";/**
|
|
957
|
+
* @license
|
|
958
|
+
* Copyright 2020 Google LLC
|
|
959
|
+
*
|
|
960
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
961
|
+
* you may not use this file except in compliance with the License.
|
|
962
|
+
* You may obtain a copy of the License at
|
|
963
|
+
*
|
|
964
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
965
|
+
*
|
|
966
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
967
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
968
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
969
|
+
* See the License for the specific language governing permissions and
|
|
970
|
+
* limitations under the License.
|
|
971
|
+
*/class Ar extends mo{constructor(){super("twitter.com")}static credential(t,n){return Yr._fromParams({providerId:Ar.PROVIDER_ID,signInMethod:Ar.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return Ar.credentialFromTaggedObject(t)}static credentialFromError(t){return Ar.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return Ar.credential(n,r)}catch{return null}}}Ar.TWITTER_SIGN_IN_METHOD="twitter.com";Ar.PROVIDER_ID="twitter.com";/**
|
|
972
|
+
* @license
|
|
973
|
+
* Copyright 2020 Google LLC
|
|
974
|
+
*
|
|
975
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
976
|
+
* you may not use this file except in compliance with the License.
|
|
977
|
+
* You may obtain a copy of the License at
|
|
978
|
+
*
|
|
979
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
980
|
+
*
|
|
981
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
982
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
983
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
984
|
+
* See the License for the specific language governing permissions and
|
|
985
|
+
* limitations under the License.
|
|
986
|
+
*/class _s{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 Sn._fromIdTokenResponse(t,r,s),i=Pu(r);return new _s({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Pu(r);return new _s({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Pu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
|
|
987
|
+
* @license
|
|
988
|
+
* Copyright 2020 Google LLC
|
|
989
|
+
*
|
|
990
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
991
|
+
* you may not use this file except in compliance with the License.
|
|
992
|
+
* You may obtain a copy of the License at
|
|
993
|
+
*
|
|
994
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
995
|
+
*
|
|
996
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
997
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
998
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
999
|
+
* See the License for the specific language governing permissions and
|
|
1000
|
+
* limitations under the License.
|
|
1001
|
+
*/class ti extends Or{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,ti.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 ti(t,n,r,s)}}function uh(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?ti._fromErrorAndOperation(e,o,t,r):o})}async function cE(e,t,n=!1){const r=await so(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return _s._forOperation(e,"link",r)}/**
|
|
1002
|
+
* @license
|
|
1003
|
+
* Copyright 2019 Google LLC
|
|
1004
|
+
*
|
|
1005
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1006
|
+
* you may not use this file except in compliance with the License.
|
|
1007
|
+
* You may obtain a copy of the License at
|
|
1008
|
+
*
|
|
1009
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1010
|
+
*
|
|
1011
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1012
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1013
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1014
|
+
* See the License for the specific language governing permissions and
|
|
1015
|
+
* limitations under the License.
|
|
1016
|
+
*/async function uE(e,t,n=!1){const{auth:r}=e;if(Un(r.app))return Promise.reject(Kr(r));const s="reauthenticate";try{const o=await so(e,uh(r,s,t,e),n);He(o.idToken,r,"internal-error");const i=xl(o.idToken);He(i,r,"internal-error");const{sub:a}=i;return He(e.uid===a,r,"user-mismatch"),_s._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Vn(r,"user-mismatch"),o}}/**
|
|
1017
|
+
* @license
|
|
1018
|
+
* Copyright 2020 Google LLC
|
|
1019
|
+
*
|
|
1020
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1021
|
+
* you may not use this file except in compliance with the License.
|
|
1022
|
+
* You may obtain a copy of the License at
|
|
1023
|
+
*
|
|
1024
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1025
|
+
*
|
|
1026
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1027
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1028
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1029
|
+
* See the License for the specific language governing permissions and
|
|
1030
|
+
* limitations under the License.
|
|
1031
|
+
*/async function dE(e,t,n=!1){if(Un(e.app))return Promise.reject(Kr(e));const r="signIn",s=await uh(e,r,t),o=await _s._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function fE(e,t,n,r){return Ts(e).onIdTokenChanged(t,n,r)}function hE(e,t,n){return Ts(e).beforeAuthStateChanged(t,n)}const ni="__sak";/**
|
|
1032
|
+
* @license
|
|
1033
|
+
* Copyright 2019 Google LLC
|
|
1034
|
+
*
|
|
1035
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1036
|
+
* you may not use this file except in compliance with the License.
|
|
1037
|
+
* You may obtain a copy of the License at
|
|
1038
|
+
*
|
|
1039
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1040
|
+
*
|
|
1041
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1042
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1043
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1044
|
+
* See the License for the specific language governing permissions and
|
|
1045
|
+
* limitations under the License.
|
|
1046
|
+
*/class dh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(ni,"1"),this.storage.removeItem(ni),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,n){return this.storage.setItem(t,JSON.stringify(n)),Promise.resolve()}_get(t){const n=this.storage.getItem(t);return Promise.resolve(n?JSON.parse(n):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
|
1047
|
+
* @license
|
|
1048
|
+
* Copyright 2020 Google LLC
|
|
1049
|
+
*
|
|
1050
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1051
|
+
* you may not use this file except in compliance with the License.
|
|
1052
|
+
* You may obtain a copy of the License at
|
|
1053
|
+
*
|
|
1054
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1055
|
+
*
|
|
1056
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1057
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1058
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
|
+
* See the License for the specific language governing permissions and
|
|
1060
|
+
* limitations under the License.
|
|
1061
|
+
*/const pE=1e3,mE=10;class fh extends dh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ih(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&t(n,s,r)}}onStorageEvent(t,n=!1){if(!t.key){this.forAllChangedKeys((i,a,l)=>{this.notifyListeners(i,l)});return}const r=t.key;n?this.detachListener():this.stopPolling();const s=()=>{const i=this.storage.getItem(r);!n&&this.localCache[r]===i||this.notifyListeners(r,i)},o=this.storage.getItem(r);qI()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,mE):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)})},pE)}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]}}fh.type="LOCAL";const gE=fh;/**
|
|
1062
|
+
* @license
|
|
1063
|
+
* Copyright 2020 Google LLC
|
|
1064
|
+
*
|
|
1065
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1066
|
+
* you may not use this file except in compliance with the License.
|
|
1067
|
+
* You may obtain a copy of the License at
|
|
1068
|
+
*
|
|
1069
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1070
|
+
*
|
|
1071
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1072
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1073
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1074
|
+
* See the License for the specific language governing permissions and
|
|
1075
|
+
* limitations under the License.
|
|
1076
|
+
*/class hh extends dh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}hh.type="SESSION";const ph=hh;/**
|
|
1077
|
+
* @license
|
|
1078
|
+
* Copyright 2019 Google LLC
|
|
1079
|
+
*
|
|
1080
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1081
|
+
* you may not use this file except in compliance with the License.
|
|
1082
|
+
* You may obtain a copy of the License at
|
|
1083
|
+
*
|
|
1084
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1085
|
+
*
|
|
1086
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1087
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1088
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1089
|
+
* See the License for the specific language governing permissions and
|
|
1090
|
+
* limitations under the License.
|
|
1091
|
+
*/function vE(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
|
1092
|
+
* @license
|
|
1093
|
+
* Copyright 2019 Google LLC
|
|
1094
|
+
*
|
|
1095
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1096
|
+
* you may not use this file except in compliance with the License.
|
|
1097
|
+
* You may obtain a copy of the License at
|
|
1098
|
+
*
|
|
1099
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1100
|
+
*
|
|
1101
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1102
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1104
|
+
* See the License for the specific language governing permissions and
|
|
1105
|
+
* limitations under the License.
|
|
1106
|
+
*/class ki{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 ki(t);return this.receivers.push(r),r}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const n=t,{eventId:r,eventType:s,data:o}=n.data,i=this.handlersMap[s];if(!(i!=null&&i.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(i).map(async d=>d(n.origin,o)),l=await vE(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(t,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(n)}_unsubscribe(t,n){this.handlersMap[t]&&n&&this.handlersMap[t].delete(n),(!n||this.handlersMap[t].size===0)&&delete this.handlersMap[t],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}ki.receivers=[];/**
|
|
1107
|
+
* @license
|
|
1108
|
+
* Copyright 2020 Google LLC
|
|
1109
|
+
*
|
|
1110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1111
|
+
* you may not use this file except in compliance with the License.
|
|
1112
|
+
* You may obtain a copy of the License at
|
|
1113
|
+
*
|
|
1114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1115
|
+
*
|
|
1116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1119
|
+
* See the License for the specific language governing permissions and
|
|
1120
|
+
* limitations under the License.
|
|
1121
|
+
*/function Nl(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
|
|
1122
|
+
* @license
|
|
1123
|
+
* Copyright 2019 Google LLC
|
|
1124
|
+
*
|
|
1125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1126
|
+
* you may not use this file except in compliance with the License.
|
|
1127
|
+
* You may obtain a copy of the License at
|
|
1128
|
+
*
|
|
1129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1130
|
+
*
|
|
1131
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1132
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1134
|
+
* See the License for the specific language governing permissions and
|
|
1135
|
+
* limitations under the License.
|
|
1136
|
+
*/class yE{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let o,i;return new Promise((a,l)=>{const d=Nl("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(h){const v=h;if(v.data.eventId===d)switch(v.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(v.data.response);break;default:clearTimeout(c),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:d,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
|
|
1137
|
+
* @license
|
|
1138
|
+
* Copyright 2020 Google LLC
|
|
1139
|
+
*
|
|
1140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1141
|
+
* you may not use this file except in compliance with the License.
|
|
1142
|
+
* You may obtain a copy of the License at
|
|
1143
|
+
*
|
|
1144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1145
|
+
*
|
|
1146
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1147
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1149
|
+
* See the License for the specific language governing permissions and
|
|
1150
|
+
* limitations under the License.
|
|
1151
|
+
*/function Wn(){return window}function wE(e){Wn().location.href=e}/**
|
|
1152
|
+
* @license
|
|
1153
|
+
* Copyright 2020 Google LLC.
|
|
1154
|
+
*
|
|
1155
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1156
|
+
* you may not use this file except in compliance with the License.
|
|
1157
|
+
* You may obtain a copy of the License at
|
|
1158
|
+
*
|
|
1159
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1160
|
+
*
|
|
1161
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1162
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1163
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1164
|
+
* See the License for the specific language governing permissions and
|
|
1165
|
+
* limitations under the License.
|
|
1166
|
+
*/function mh(){return typeof Wn().WorkerGlobalScope<"u"&&typeof Wn().importScripts=="function"}async function bE(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function _E(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function kE(){return mh()?self:null}/**
|
|
1167
|
+
* @license
|
|
1168
|
+
* Copyright 2019 Google LLC
|
|
1169
|
+
*
|
|
1170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1171
|
+
* you may not use this file except in compliance with the License.
|
|
1172
|
+
* You may obtain a copy of the License at
|
|
1173
|
+
*
|
|
1174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1175
|
+
*
|
|
1176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1179
|
+
* See the License for the specific language governing permissions and
|
|
1180
|
+
* limitations under the License.
|
|
1181
|
+
*/const gh="firebaseLocalStorageDb",TE=1,ri="firebaseLocalStorage",vh="fbase_key";class go{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 Ti(e,t){return e.transaction([ri],t?"readwrite":"readonly").objectStore(ri)}function SE(){const e=indexedDB.deleteDatabase(gh);return new go(e).toPromise()}function qa(){const e=indexedDB.open(gh,TE);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(ri,{keyPath:vh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(ri)?t(r):(r.close(),await SE(),t(await qa()))})})}async function xu(e,t,n){const r=Ti(e,!0).put({[vh]:t,value:n});return new go(r).toPromise()}async function IE(e,t){const n=Ti(e,!1).get(t),r=await new go(n).toPromise();return r===void 0?null:r.value}function Mu(e,t){const n=Ti(e,!0).delete(t);return new go(n).toPromise()}const EE=800,CE=3;class yh{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 qa(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>CE)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return mh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ki._getInstance(kE()),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 bE(),!this.activeServiceWorker)return;this.sender=new yE(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||_E()!==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 qa();return await xu(t,ni,"1"),await Mu(t,ni),!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=>xu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>IE(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Mu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Ti(s,!1).getAll();return new go(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(),EE)}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()}}yh.type="LOCAL";const AE=yh;new po(3e4,6e4);/**
|
|
1182
|
+
* @license
|
|
1183
|
+
* Copyright 2021 Google LLC
|
|
1184
|
+
*
|
|
1185
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1186
|
+
* you may not use this file except in compliance with the License.
|
|
1187
|
+
* You may obtain a copy of the License at
|
|
1188
|
+
*
|
|
1189
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1190
|
+
*
|
|
1191
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1192
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1193
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1194
|
+
* See the License for the specific language governing permissions and
|
|
1195
|
+
* limitations under the License.
|
|
1196
|
+
*/function wh(e,t){return t?rr(t):(He(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
|
|
1197
|
+
* @license
|
|
1198
|
+
* Copyright 2019 Google LLC
|
|
1199
|
+
*
|
|
1200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1201
|
+
* you may not use this file except in compliance with the License.
|
|
1202
|
+
* You may obtain a copy of the License at
|
|
1203
|
+
*
|
|
1204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1205
|
+
*
|
|
1206
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1209
|
+
* See the License for the specific language governing permissions and
|
|
1210
|
+
* limitations under the License.
|
|
1211
|
+
*/class Dl extends ch{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return ms(t,this._buildIdpRequest())}_linkToIdToken(t,n){return ms(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return ms(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 RE(e){return dE(e.auth,new Dl(e),e.bypassAuthState)}function PE(e){const{auth:t,user:n}=e;return He(n,t,"internal-error"),uE(n,new Dl(e),e.bypassAuthState)}async function xE(e){const{auth:t,user:n}=e;return He(n,t,"internal-error"),cE(n,new Dl(e),e.bypassAuthState)}/**
|
|
1212
|
+
* @license
|
|
1213
|
+
* Copyright 2020 Google LLC
|
|
1214
|
+
*
|
|
1215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1216
|
+
* you may not use this file except in compliance with the License.
|
|
1217
|
+
* You may obtain a copy of the License at
|
|
1218
|
+
*
|
|
1219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1220
|
+
*
|
|
1221
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1224
|
+
* See the License for the specific language governing permissions and
|
|
1225
|
+
* limitations under the License.
|
|
1226
|
+
*/class bh{constructor(t,n,r,s,o=!1){this.auth=t,this.resolver=r,this.user=s,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(t,n)=>{this.pendingPromise={resolve:t,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(t){const{urlResponse:n,sessionId:r,postBody:s,tenantId:o,error:i,type:a}=t;if(i){this.reject(i);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:o||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(d){this.reject(d)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return RE;case"linkViaPopup":case"linkViaRedirect":return xE;case"reauthViaPopup":case"reauthViaRedirect":return PE;default:Vn(this.auth,"internal-error")}}resolve(t){dr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){dr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
|
|
1227
|
+
* @license
|
|
1228
|
+
* Copyright 2020 Google LLC
|
|
1229
|
+
*
|
|
1230
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1231
|
+
* you may not use this file except in compliance with the License.
|
|
1232
|
+
* You may obtain a copy of the License at
|
|
1233
|
+
*
|
|
1234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1235
|
+
*
|
|
1236
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1237
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1238
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1239
|
+
* See the License for the specific language governing permissions and
|
|
1240
|
+
* limitations under the License.
|
|
1241
|
+
*/const ME=new po(2e3,1e4);async function OE(e,t,n){if(Un(e.app))return Promise.reject(Cn(e,"operation-not-supported-in-this-environment"));const r=_i(e);RI(e,t,$l);const s=wh(r,n);return new zr(r,"signInViaPopup",t,s).executeNotNull()}class zr extends bh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,zr.currentPopupAction&&zr.currentPopupAction.cancel(),zr.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return He(t,this.auth,"internal-error"),t}async onExecution(){dr(this.filter.length===1,"Popup operations only handle one event");const t=Nl();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(Cn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Cn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,zr.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(Cn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,ME.get())};t()}}zr.currentPopupAction=null;/**
|
|
1242
|
+
* @license
|
|
1243
|
+
* Copyright 2020 Google LLC
|
|
1244
|
+
*
|
|
1245
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1246
|
+
* you may not use this file except in compliance with the License.
|
|
1247
|
+
* You may obtain a copy of the License at
|
|
1248
|
+
*
|
|
1249
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1250
|
+
*
|
|
1251
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1252
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1253
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1254
|
+
* See the License for the specific language governing permissions and
|
|
1255
|
+
* limitations under the License.
|
|
1256
|
+
*/const $E="pendingRedirect",Uo=new Map;class NE extends bh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=Uo.get(this.auth._key());if(!t){try{const r=await DE(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}Uo.set(this.auth._key(),t)}return this.bypassAuthState||Uo.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 DE(e,t){const n=UE(t),r=jE(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function LE(e,t){Uo.set(e._key(),t)}function jE(e){return rr(e._redirectPersistence)}function UE(e){return jo($E,e.config.apiKey,e.name)}async function FE(e,t,n=!1){if(Un(e.app))return Promise.reject(Kr(e));const r=_i(e),s=wh(r,t),i=await new NE(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
|
|
1257
|
+
* @license
|
|
1258
|
+
* Copyright 2020 Google LLC
|
|
1259
|
+
*
|
|
1260
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1261
|
+
* you may not use this file except in compliance with the License.
|
|
1262
|
+
* You may obtain a copy of the License at
|
|
1263
|
+
*
|
|
1264
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1265
|
+
*
|
|
1266
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1267
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1268
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1269
|
+
* See the License for the specific language governing permissions and
|
|
1270
|
+
* limitations under the License.
|
|
1271
|
+
*/const BE=600*1e3;class HE{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||!WE(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!_h(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Cn(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>=BE&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ou(t))}saveEventToCache(t){this.cachedEventUids.add(Ou(t)),this.lastProcessedEventTime=Date.now()}}function Ou(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function _h({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function WE(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return _h(e);default:return!1}}/**
|
|
1272
|
+
* @license
|
|
1273
|
+
* Copyright 2020 Google LLC
|
|
1274
|
+
*
|
|
1275
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1276
|
+
* you may not use this file except in compliance with the License.
|
|
1277
|
+
* You may obtain a copy of the License at
|
|
1278
|
+
*
|
|
1279
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1280
|
+
*
|
|
1281
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1282
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1283
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1284
|
+
* See the License for the specific language governing permissions and
|
|
1285
|
+
* limitations under the License.
|
|
1286
|
+
*/async function VE(e,t={}){return Ss(e,"GET","/v1/projects",t)}/**
|
|
1287
|
+
* @license
|
|
1288
|
+
* Copyright 2020 Google LLC
|
|
1289
|
+
*
|
|
1290
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1291
|
+
* you may not use this file except in compliance with the License.
|
|
1292
|
+
* You may obtain a copy of the License at
|
|
1293
|
+
*
|
|
1294
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1295
|
+
*
|
|
1296
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1297
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1298
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1299
|
+
* See the License for the specific language governing permissions and
|
|
1300
|
+
* limitations under the License.
|
|
1301
|
+
*/const zE=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,GE=/^https?/;async function qE(e){if(e.config.emulator)return;const{authorizedDomains:t}=await VE(e);for(const n of t)try{if(KE(n))return}catch{}Vn(e,"unauthorized-domain")}function KE(e){const t=za(),{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(!GE.test(n))return!1;if(zE.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
1302
|
+
* @license
|
|
1303
|
+
* Copyright 2020 Google LLC.
|
|
1304
|
+
*
|
|
1305
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1306
|
+
* you may not use this file except in compliance with the License.
|
|
1307
|
+
* You may obtain a copy of the License at
|
|
1308
|
+
*
|
|
1309
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1310
|
+
*
|
|
1311
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1312
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1313
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1314
|
+
* See the License for the specific language governing permissions and
|
|
1315
|
+
* limitations under the License.
|
|
1316
|
+
*/const JE=new po(3e4,6e4);function $u(){const e=Wn().___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 YE(e){return new Promise((t,n)=>{var s,o,i;function r(){$u(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{$u(),n(Cn(e,"network-request-failed"))},timeout:JE.get()})}if((o=(s=Wn().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Wn().gapi)!=null&&i.load)r();else{const a=nE("iframefcb");return Wn()[a]=()=>{gapi.load?r():n(Cn(e,"network-request-failed"))},eE(`${tE()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw Fo=null,t})}let Fo=null;function XE(e){return Fo=Fo||YE(e),Fo}/**
|
|
1317
|
+
* @license
|
|
1318
|
+
* Copyright 2020 Google LLC.
|
|
1319
|
+
*
|
|
1320
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1321
|
+
* you may not use this file except in compliance with the License.
|
|
1322
|
+
* You may obtain a copy of the License at
|
|
1323
|
+
*
|
|
1324
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1325
|
+
*
|
|
1326
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1327
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1328
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1329
|
+
* See the License for the specific language governing permissions and
|
|
1330
|
+
* limitations under the License.
|
|
1331
|
+
*/const QE=new po(5e3,15e3),ZE="__/auth/iframe",eC="emulator/auth/iframe",tC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},nC=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function rC(e){const t=e.config;He(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Rl(t,eC):`https://${e.config.authDomain}/${ZE}`,r={apiKey:t.apiKey,appName:e.name,v:ho},s=nC.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${fo(r).slice(1)}`}async function sC(e){const t=await XE(e),n=Wn().gapi;return He(n,e,"internal-error"),t.open({where:document.body,url:rC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:tC,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=Cn(e,"network-request-failed"),a=Wn().setTimeout(()=>{o(i)},QE.get());function l(){Wn().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
|
|
1332
|
+
* @license
|
|
1333
|
+
* Copyright 2020 Google LLC.
|
|
1334
|
+
*
|
|
1335
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1336
|
+
* you may not use this file except in compliance with the License.
|
|
1337
|
+
* You may obtain a copy of the License at
|
|
1338
|
+
*
|
|
1339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1340
|
+
*
|
|
1341
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1344
|
+
* See the License for the specific language governing permissions and
|
|
1345
|
+
* limitations under the License.
|
|
1346
|
+
*/const oC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},iC=500,aC=600,lC="_blank",cC="http://localhost";class Nu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function uC(e,t,n,r=iC,s=aC){const o=Math.max((window.screen.availHeight-s)/2,0).toString(),i=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...oC,width:r.toString(),height:s.toString(),top:o,left:i},d=ln().toLowerCase();n&&(a=th(d)?lC:n),Zf(d)&&(t=t||cC,l.scrollbars="yes");const c=Object.entries(l).reduce((v,[E,D])=>`${v}${E}=${D},`,"");if(GI(d)&&a!=="_self")return dC(t||"",a),new Nu(null);const h=window.open(t||"",a,c);He(h,e,"popup-blocked");try{h.focus()}catch{}return new Nu(h)}function dC(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
|
|
1347
|
+
* @license
|
|
1348
|
+
* Copyright 2021 Google LLC
|
|
1349
|
+
*
|
|
1350
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1351
|
+
* you may not use this file except in compliance with the License.
|
|
1352
|
+
* You may obtain a copy of the License at
|
|
1353
|
+
*
|
|
1354
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1355
|
+
*
|
|
1356
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1357
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1358
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1359
|
+
* See the License for the specific language governing permissions and
|
|
1360
|
+
* limitations under the License.
|
|
1361
|
+
*/const fC="__/auth/handler",hC="emulator/auth/handler",pC=encodeURIComponent("fac");async function Du(e,t,n,r,s,o){He(e.config.authDomain,e,"auth-domain-config-required"),He(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:ho,eventId:s};if(t instanceof $l){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",dS(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,h]of Object.entries({}))i[c]=h}if(t instanceof mo){const c=t.getScopes().filter(h=>h!=="");c.length>0&&(i.scopes=c.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await e._getAppCheckToken(),d=l?`#${pC}=${encodeURIComponent(l)}`:"";return`${mC(e)}?${fo(a).slice(1)}${d}`}function mC({config:e}){return e.emulator?Rl(e,hC):`https://${e.authDomain}/${fC}`}/**
|
|
1362
|
+
* @license
|
|
1363
|
+
* Copyright 2020 Google LLC
|
|
1364
|
+
*
|
|
1365
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1366
|
+
* you may not use this file except in compliance with the License.
|
|
1367
|
+
* You may obtain a copy of the License at
|
|
1368
|
+
*
|
|
1369
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1370
|
+
*
|
|
1371
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1372
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1373
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1374
|
+
* See the License for the specific language governing permissions and
|
|
1375
|
+
* limitations under the License.
|
|
1376
|
+
*/const ha="webStorageSupport";class gC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ph,this._completeRedirectFn=FE,this._overrideRedirectResult=LE}async _openPopup(t,n,r,s){var i;dr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Du(t,n,r,za(),s);return uC(t,o,Nl())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Du(t,n,r,za(),s);return wE(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):(dr(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 sC(t),r=new HE(t);return n.register("authEvent",s=>(He(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(ha,{type:ha},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[ha];o!==void 0&&n(!!o),Vn(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=qE(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return ih()||eh()||Ml()}}const vC=gC;var Lu="@firebase/auth",ju="1.12.2";/**
|
|
1377
|
+
* @license
|
|
1378
|
+
* Copyright 2020 Google LLC
|
|
1379
|
+
*
|
|
1380
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1381
|
+
* you may not use this file except in compliance with the License.
|
|
1382
|
+
* You may obtain a copy of the License at
|
|
1383
|
+
*
|
|
1384
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1385
|
+
*
|
|
1386
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1387
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1388
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1389
|
+
* See the License for the specific language governing permissions and
|
|
1390
|
+
* limitations under the License.
|
|
1391
|
+
*/class yC{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(){He(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1392
|
+
* @license
|
|
1393
|
+
* Copyright 2020 Google LLC
|
|
1394
|
+
*
|
|
1395
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1396
|
+
* you may not use this file except in compliance with the License.
|
|
1397
|
+
* You may obtain a copy of the License at
|
|
1398
|
+
*
|
|
1399
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1400
|
+
*
|
|
1401
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1402
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1403
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1404
|
+
* See the License for the specific language governing permissions and
|
|
1405
|
+
* limitations under the License.
|
|
1406
|
+
*/function wC(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 bC(e){no(new bs("auth",(t,{options:n})=>{const r=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),o=t.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=r.options;He(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:i,authDomain:a,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ah(e)},d=new QI(r,s,o,l);return sE(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),no(new bs("auth-internal",t=>{const n=_i(t.getProvider("auth").getImmediate());return(r=>new yC(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),fs(Lu,ju,wC(e)),fs(Lu,ju,"esm2020")}/**
|
|
1407
|
+
* @license
|
|
1408
|
+
* Copyright 2021 Google LLC
|
|
1409
|
+
*
|
|
1410
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1411
|
+
* you may not use this file except in compliance with the License.
|
|
1412
|
+
* You may obtain a copy of the License at
|
|
1413
|
+
*
|
|
1414
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1415
|
+
*
|
|
1416
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1417
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1418
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1419
|
+
* See the License for the specific language governing permissions and
|
|
1420
|
+
* limitations under the License.
|
|
1421
|
+
*/const _C=300,kC=Lf("authIdTokenMaxAge")||_C;let Uu=null;const TC=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>kC)return;const s=n==null?void 0:n.token;Uu!==s&&(Uu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function SC(e=Wf()){const t=Bf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=rE(e,{popupRedirectResolver:vC,persistence:[AE,gE,ph]}),r=Lf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=TC(o.toString());hE(n,i,()=>i(n.currentUser)),fE(n,a=>i(a))}}const s=ZT("auth");return s&&oE(n,`http://${s}`),n}function IC(){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=Cn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",IC().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="});bC("Browser");const EC={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 CC(e){const t=j(null),n=j(""),r=j(""),s=j(""),o=j({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=fe(()=>s.value==="pull"),a=fe(()=>s.value==="push"),l=fe(()=>s.value!=="");async function d(){try{const O=await fetch("/codex-api/skills-sync/status");if(!O.ok)return;const z=await O.json();z.data&&(o.value=z.data)}catch{}}async function c(){try{const O=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),z=await O.json();if(!O.ok||!z.data)throw new Error("Failed to start GitHub login");t.value=z.data;const R=30,x=Math.max((z.data.interval??5)*1e3,3e3);let H=!1;for(let F=0;F<R;F++){await new Promise(ve=>setTimeout(ve,x));const re=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:z.data.device_code})}),se=await re.json();if(!re.ok)throw new Error(se.error||"Failed to complete GitHub login");if(se.ok){H=!0;break}if(!se.pending)throw new Error(se.error||"Failed to complete GitHub login")}if(!H)throw new Error("GitHub login timed out. Please retry.");t.value=null,await d(),e.showToast("GitHub login successful")}catch(O){e.showToast(O instanceof Error?O.message:"Failed GitHub login","error")}}async function h(){try{const O=pI().length>0?Wf():Hf(EC),z=SC(O),R=new Fn;R.addScope("repo");const x=await OE(z,R),H=Fn.credentialFromResult(x),F=(H==null?void 0:H.accessToken)??"";if(!F)throw new Error("GitHub access token missing from Firebase login");const re=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:F})}),se=await re.json();if(!re.ok||!se.ok)throw new Error(se.error||"Failed to login with GitHub token");await d(),e.showToast("GitHub login successful")}catch(O){const z=O instanceof Error?O.message:"Failed Firebase GitHub login";e.showToast(z,"error")}}async function v(){r.value="",n.value="pull-started",s.value="pull";try{const O=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),z=await O.json();if(!O.ok||!z.ok)throw new Error(z.error||"Failed to pull synced skills");await e.onPulled(),n.value="pull-success",e.showToast(o.value.loggedIn?"Pulled skills from private sync repo":"Pulled skills from upstream repo")}catch(O){const z=O instanceof Error?O.message:"Failed to pull sync";r.value=z,n.value="pull-failed",e.showToast(z,"error")}finally{s.value=""}}async function E(){r.value="",n.value="push-started",s.value="push";try{const O=await fetch("/codex-api/skills-sync/push",{method:"POST"}),z=await O.json();if(!O.ok||!z.ok)throw new Error(z.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(O){const z=O instanceof Error?O.message:"Failed to push sync";r.value=z,n.value="push-failed",e.showToast(z,"error")}finally{s.value=""}}async function D(){try{const O=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),z=await O.json();if(!O.ok||!z.ok)throw new Error(z.error||"Failed to logout GitHub");await d(),e.showToast("Logged out from GitHub")}catch(O){e.showToast(O instanceof Error?O.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:d,logoutGithub:D,pullSkillsSync:v,pushSkillsSync:E,startGithubFirebaseLogin:h,startGithubLogin:c,syncActionError:r,syncActionStatus:n,syncStatus:o}}const AC={class:"skills-hub"},RC={class:"skills-sync-panel"},PC={class:"skills-sync-header"},xC={key:0,class:"skills-sync-badge"},MC={key:1,class:"skills-sync-badge"},OC={key:2,class:"skills-sync-badge"},$C={class:"skills-sync-meta"},NC={key:0,class:"skills-sync-error"},DC={key:1,class:"skills-sync-meta"},LC={key:2,class:"skills-sync-error"},jC={key:3,class:"skills-sync-device"},UC=["href"],FC={class:"skills-sync-actions"},BC=["disabled"],HC=["disabled"],WC=["disabled"],VC={key:1,class:"skills-hub-section"},zC={class:"skills-hub-section-title"},GC={key:0,class:"skills-hub-grid"},qC={class:"skills-hub-toolbar"},KC={class:"skills-hub-search-wrap"},JC={key:0,class:"skills-hub-count"},YC={class:"skills-hub-section"},XC={key:0,class:"skills-hub-loading"},QC={key:1,class:"skills-hub-error"},ZC={key:0,class:"skills-hub-grid"},eA={key:1,class:"skills-hub-empty"},Co="codex-web-local.skills-hub.cache.v1",tA=Lt({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=j(null),s=j(""),o=j("date"),i=j([]),a=j([]),l=j(0),d=j(!1),c=j(""),h=j(!0),v=j(!1),E=j(n),D=j(null),O=j(""),z=j(!1),R=j(!1);let x=null,H=null;const F=t,re=fe(()=>o.value==="date"?"Newest":"A-Z"),se=fe(()=>{var $;return(($=D.value)==null?void 0:$.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ve=fe(()=>`${E.value.owner}/${E.value.name}`),Ee=fe(()=>z.value&&O.value===ve.value),ie=fe(()=>R.value&&O.value===ve.value),oe=fe(()=>{const $=s.value.toLowerCase().trim();return $?a.value.filter(W=>W.name.toLowerCase().includes($)||W.owner.toLowerCase().includes($)||(W.displayName??"").toLowerCase().includes($)):a.value});function ye($,W="success"){D.value={text:$,type:W},H&&clearTimeout(H),H=setTimeout(()=>{D.value=null},3e3)}function X(){o.value=o.value==="date"?"name":"date",Re(s.value)}function ke($){return`${o.value}::${$.trim().toLowerCase()}`}function Oe($){var W;if(typeof window>"u")return null;try{const B=window.localStorage.getItem(Co);return B?((W=JSON.parse(B).byKey)==null?void 0:W[$])??null:null}catch{return null}}function je($,W){if(!(typeof window>"u"))try{const B=window.localStorage.getItem(Co),q=(B?JSON.parse(B):{}).byKey??{};q[$]=W,window.localStorage.setItem(Co,JSON.stringify({byKey:q}))}catch{}}function Pe(){if(!(typeof window>"u"))try{window.localStorage.removeItem(Co)}catch{}}function Me($){const W=$.installed??[];a.value=W;const B=new Set(W.map(Z=>Z.name));i.value=$.data.map(Z=>{if(Z.installed||B.has(Z.name)){const q=W.find(we=>we.name===Z.name);return{...Z,installed:!0,path:(q==null?void 0:q.path)??Z.path,enabled:(q==null?void 0:q.enabled)??Z.enabled}}return Z}).filter(Z=>!Z.installed),l.value=$.total}async function Re($){const W=ke($),B=Oe(W);B&&Me(B),d.value=!B,c.value="";try{const Z=new URLSearchParams;$.trim()&&Z.set("q",$.trim()),Z.set("limit","100"),Z.set("sort",o.value);const q=await fetch(`/codex-api/skills-hub?${Z}`);if(!q.ok)throw new Error(`HTTP ${q.status}`);const we=await q.json();Me(we),je(W,we)}catch(Z){c.value=Z instanceof Error?Z.message:"Failed to load skills"}finally{d.value=!1}}function Ke(){x&&clearTimeout(x),x=setTimeout(()=>Re(s.value),300)}function Xe($){E.value=$,v.value=!0}async function $e($){O.value=`${$.owner}/${$.name}`,z.value=!0;try{const B=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:$.owner,name:$.name})})).json();if(!B.ok)throw new Error(B.error||"Install failed");const Z={...$,installed:!0,path:B.path,enabled:!0};a.value=[...a.value,Z],i.value=i.value.filter(q=>q.name!==$.name),E.value=Z,ye(`${$.displayName||$.name} skill installed`),v.value=!1,Pe(),F("skills-changed")}catch(W){ye(W instanceof Error?W.message:"Failed to install skill","error")}finally{z.value=!1}}async function Je($){O.value=`${$.owner}/${$.name}`,R.value=!0;try{const B=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$.name,path:$.path})})).json();if(!B.ok)throw new Error(B.error||"Uninstall failed");a.value=a.value.filter(Z=>Z.name!==$.name),$.owner!=="local"&&(i.value=[...i.value,{...$,installed:!1,path:void 0,enabled:void 0}]),ye(`${$.displayName||$.name} skill uninstalled`),v.value=!1,Pe(),F("skills-changed")}catch(W){ye(W instanceof Error?W.message:"Failed to uninstall skill","error")}finally{R.value=!1}}async function st($,W){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:$.path,enabled:W}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),ye(`${$.displayName||$.name} skill ${W?"enabled":"disabled"}`),await Re(s.value)}catch(B){ye(B instanceof Error?B.message:"Failed to update skill","error")}}const{deviceLogin:ot,isPullInFlight:Qe,isPushInFlight:Ye,isSyncActionInFlight:J,loadSyncStatus:he,logoutGithub:pe,pullSkillsSync:Ce,pushSkillsSync:Ie,startGithubFirebaseLogin:y,startGithubLogin:_,syncActionError:M,syncActionStatus:Y,syncStatus:G}=CC({showToast:ye,onPulled:async()=>{await Re(s.value),F("skills-changed")}});return zn(()=>{Re(""),he()}),($,W)=>(b(),I("div",AC,[W[11]||(W[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",RC,[m("div",PC,[W[8]||(W[8]=m("strong",null,"Skills Sync (GitHub)",-1)),be(G).configured?(b(),I("span",xC,"Connected: "+ce(be(G).repoOwner)+"/"+ce(be(G).repoName),1)):be(G).loggedIn?(b(),I("span",MC,"Logged in as "+ce(be(G).githubUsername),1)):(b(),I("span",OC,"Not connected"))]),m("div",$C,[m("span",null,"Startup: "+ce(be(G).startup.mode),1),m("span",null,"Branch: "+ce(be(G).startup.branch),1),m("span",null,"Action: "+ce(be(G).startup.lastAction),1)]),be(G).startup.lastError?(b(),I("div",NC,ce(be(G).startup.lastError),1)):le("",!0),be(Y)?(b(),I("div",DC,[m("span",null,"Manual sync: "+ce(be(Y)),1)])):le("",!0),be(M)?(b(),I("div",LC,ce(be(M)),1)):le("",!0),be(ot)?(b(),I("div",jC,[m("span",null,[W[9]||(W[9]=Xs("Open ",-1)),m("a",{href:be(ot).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,UC),W[10]||(W[10]=Xs(" and enter code:",-1))]),m("code",null,ce(be(ot).user_code),1)])):le("",!0),m("div",FC,[be(G).loggedIn?le("",!0):(b(),I("button",{key:0,class:"skills-hub-sort",type:"button",onClick:W[0]||(W[0]=(...B)=>be(y)&&be(y)(...B))},"Login with GitHub")),be(G).loggedIn?le("",!0):(b(),I("button",{key:1,class:"skills-hub-sort",type:"button",onClick:W[1]||(W[1]=(...B)=>be(_)&&be(_)(...B))},"Device Login")),be(G).loggedIn?(b(),I("button",{key:2,class:"skills-hub-sort",type:"button",onClick:W[2]||(W[2]=(...B)=>be(pe)&&be(pe)(...B)),disabled:be(J)},"Logout GitHub",8,BC)):le("",!0),m("button",{class:"skills-hub-sort",type:"button",onClick:W[3]||(W[3]=(...B)=>be(Ce)&&be(Ce)(...B)),disabled:be(J)},ce(be(Qe)?"Pulling...":"Pull"),9,HC),be(G).loggedIn?(b(),I("button",{key:3,class:"skills-hub-sort",type:"button",onClick:W[4]||(W[4]=(...B)=>be(Ie)&&be(Ie)(...B)),disabled:!be(G).configured||be(J)},ce(be(Ye)?"Pushing...":"Push"),9,WC)):le("",!0)])]),D.value?(b(),I("div",{key:0,class:nt(["skills-hub-toast",se.value])},ce(D.value.text),3)):le("",!0),oe.value.length>0?(b(),I("div",VC,[m("button",{class:"skills-hub-section-toggle",type:"button",onClick:W[5]||(W[5]=B=>h.value=!h.value)},[m("span",zC,"Installed ("+ce(oe.value.length)+")",1),xe(Af,{class:nt(["skills-hub-section-chevron",{"is-open":h.value}])},null,8,["class"])]),h.value?(b(),I("div",GC,[(b(!0),I(Ue,null,It(oe.value,B=>(b(),ft(fu,{key:B.name,skill:B,onSelect:Z=>Xe(Z)},null,8,["skill","onSelect"]))),128))])):le("",!0)])):le("",!0),m("div",qC,[m("div",KC,[xe(Ua,{class:"skills-hub-search-icon"}),lr(m("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":W[6]||(W[6]=B=>s.value=B),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:Ke},null,544),[[cr,s.value]]),l.value>0?(b(),I("span",JC,ce(l.value)+" skills",1)):le("",!0)]),m("button",{class:"skills-hub-sort",type:"button",onClick:X},ce(re.value),1)]),m("div",YC,[d.value?(b(),I("div",XC,"Loading skills...")):c.value?(b(),I("div",QC,ce(c.value),1)):(b(),I(Ue,{key:2},[i.value.length>0?(b(),I("div",ZC,[(b(!0),I(Ue,null,It(i.value,B=>(b(),ft(fu,{key:B.url,skill:B,onSelect:Z=>Xe(Z)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(b(),I("div",eA,'No skills found for "'+ce(s.value)+'"',1)):le("",!0)],64))]),xe(VT,{skill:E.value,visible:v.value,"is-installing":Ee.value,"is-uninstalling":ie.value,onClose:W[7]||(W[7]=B=>v.value=!1),onInstall:$e,onUninstall:Je,onToggleEnabled:st},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),nA=tt(tA,[["__scopeId","data-v-2f6920be"]]),rA={},sA={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 oA(e,t){return b(),I("svg",sA,[...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 iA=tt(rA,[["render",oA]]),aA={},lA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function cA(e,t){return b(),I("svg",lA,[...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 uA=tt(aA,[["render",cA]]),dA={class:"sidebar-thread-controls"},fA=["aria-label","title"],hA=Lt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(b(),I("div",dA,[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?(b(),ft(uA,{key:0,class:"sidebar-thread-controls-icon"})):(b(),ft(iA,{key:1,class:"sidebar-thread-controls-icon"}))],8,fA),Bn(t.$slots,"default",{},void 0),e.showNewThreadButton?(b(),I("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"))},[xe(Yo,{class:"sidebar-thread-controls-icon"})])):le("",!0)]))}}),Fu=tt(hA,[["__scopeId","data-v-46a10052"]]),pA={},mA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function gA(e,t){return b(),I("svg",mA,[...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 vA=tt(pA,[["render",gA]]);function Ir(e){return e.flatMap(t=>t.threads)}const kh="codex-web-local.thread-read-state.v1",Th="codex-web-local.thread-scroll-state.v1",Ka="codex-web-local.selected-thread-id.v1",Ja="codex-web-local.selected-model-id.v1",Sh="codex-web-local.project-order.v1",Ih="codex-web-local.project-display-name.v1",pa=220,yA=500,Bu=["none","minimal","low","medium","high","xhigh"],$s="__global__",yn="gpt-5.2-codex",wA="Auto-commit from Codex worktree chat turn";function bA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(kh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Hu(e){typeof window>"u"||window.localStorage.setItem(kh,JSON.stringify(e))}function Ya(e,t,n){return Math.min(Math.max(e,t),n)}function _A(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=Ya(t.scrollRatio,0,1)),n}function kA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Th);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=_A(s);o&&(n[r]=o)}return n}catch{return{}}}function Wu(e){typeof window>"u"||window.localStorage.setItem(Th,JSON.stringify(e))}function TA(){return typeof window>"u"?"":window.localStorage.getItem(Ka)??""}function SA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Ka);return}window.localStorage.setItem(Ka,e)}}function IA(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(Ja))==null?void 0:e.trim())??""}function ma(e){if(typeof window>"u")return;const t=e.trim();if(!t){window.localStorage.removeItem(Ja);return}window.localStorage.setItem(Ja,t)}function EA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Sh);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 rs(e){typeof window>"u"||window.localStorage.setItem(Sh,JSON.stringify(e))}function CA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ih);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 ga(e){typeof window>"u"||window.localStorage.setItem(Ih,JSON.stringify(e))}function Ao(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 Wr(e,n)?e:n}function va(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??null).filter(s=>s!==null&&s.threads.length>0);for(const s of e)t.includes(s.projectName)||r.push(s);return r}function Wr(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 AA(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 RA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function Ro(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 Xa(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Wr(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&RA(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function si(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 PA(e,t,n={}){const r=new Map(e.map(c=>[c.id,c])),s=new Map(t.map(c=>[c.id,c])),o=t.map(c=>{const h=r.get(c.id);return h&&Xa(h,c)?h:c});if(n.preserveMissing!==!0)return si(e,o)?e:o;const i=e.map(c=>{const h=s.get(c.id);return!h||Xa(c,h)?c:h}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),d=[...i,...l];return si(e,d)?e:d}function Qa(e){return e.replace(/\s+/gu," ").trim()}function xA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>Qa(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=Qa(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Vu(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Xa(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Eh="worked";function kr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function MA(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const i=s>0||o.length===0?s:0;return o.push(`${i}s`),o.join(" ")}function OA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function $A(e,t){if(!e&&!t)return!0;if(!e||!t||e.label!==t.label||e.details.length!==t.details.length)return!1;for(let n=0;n<e.details.length;n+=1)if(e.details[n]!==t.details[n])return!1;return!0}function NA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${MA(e.durationMs)}`,messageType:Eh}}function DA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function LA(e,t){const n=NA(t),r=e.filter(i=>i.messageType!==Eh),s=DA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Ft(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function jA(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 UA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function FA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Jt(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Po(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>{const o=n.get(s.projectName),i=new Map((o==null?void 0:o.threads.map(l=>[l.id,l]))??[]),a=s.threads.map(l=>{const d=i.get(l.id);return d&&jA(d,l)?d:l});return o&&o.projectName===s.projectName&&UA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return FA(e,r)?e:r}function BA(e,t,n){const r=new Set(Ir(t).map(a=>a.id)),s=Ir(e).filter(a=>n[a.id]===!0&&!r.has(a.id));if(s.length===0)return t;const o=new Map(t.map(a=>[a.projectName,a])),i=t.map(a=>({projectName:a.projectName,threads:[...a.threads]}));for(const a of s){if(o.get(a.projectName)){const d=i.findIndex(c=>c.projectName===a.projectName);d>=0&&(i[d]={projectName:i[d].projectName,threads:[a,...i[d].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function HA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function ya(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function WA(e){const t=e.split(`
|
|
1422
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function VA(){const e=j([]),t=j([]),n=j(TA()),r=j({}),s=j({}),o=j({}),i=j({}),a=j({}),l=j({}),d=j({}),c=j({}),h=j([]),v=j(IA()),E=j("medium"),D=j("standard"),O=j(bA()),z=j(kA()),R=j(EA()),x=j(CA()),H=j({}),F=j({}),re=j({}),se=j({}),ve=j({}),Ee=j({}),ie=j({}),oe=j({}),ye=j({}),X=j({}),ke=j([]),Oe=j([]),je=j(!1),Pe=j(!1),Me=j(!1),Re=j(!1),Ke=j(!1),Xe=j(!1),$e=j(""),Je=j(!1),st=j(!1);let ot=null,Qe=null,Ye=null,J=null,he=!1;const pe=new Set;let Ce=!1,Ie=!1;const y=new Map,_=new Set,M=j(!0),Y=fe(()=>Ir(e.value)),G=fe(()=>Y.value.find(u=>u.id===n.value)??null),$=fe(()=>z.value[n.value]??null),W=fe(()=>{const u=[],p=n.value;return p&&Array.isArray(oe.value[p])&&u.push(...oe.value[p]),Array.isArray(oe.value[$s])&&u.push(...oe.value[$s]),u.sort((w,A)=>w.receivedAtIso.localeCompare(A.receivedAtIso))}),B=fe(()=>{var ee;const u=n.value;if(!u)return null;const p=ve.value[u],w=(o.value[u]??"").trim(),A=(((ee=Ee.value[u])==null?void 0:ee.message)??"").trim();return!p&&!w&&!A?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:w,errorText:A}}),Z=fe(()=>{const u=n.value;if(!u)return[];const p=r.value[u]??[],w=s.value[u]??[],A=i.value[u]??[],ee=[...p,...A,...w],f=se.value[u];return f?LA(ee,f):ee});function q(u){n.value!==u&&(n.value=u,SA(u),Ie=!1)}function we(u){v.value=u.trim(),ma(v.value)}function de(u){M.value=u}async function ge(){v.value=yn,ma(v.value),h.value.includes(yn)||(h.value=[...h.value,yn]);try{await U_(yn)}catch{}}function Ae(u,p){ye.value={...ye.value,[u]:p}}function Be(u){ye.value[u]&&(ye.value=Ft(ye.value,u))}async function We(u,p){if(!M.value)return;const w=p.trim();if(!w)return;const A=Y.value.find(f=>f.id===u);if(!(A!=null&&A.hasWorktree))return;const ee=A.cwd.trim();ee&&(await G_(ee,w),he=!0)}async function ze(u,p){var U;if(!M.value)return;const w=Y.value.find(te=>te.id===u);if(!(w!=null&&w.hasWorktree))return;const A=w.cwd.trim();if(!A)return;const f=(r.value[u]??[]).find(te=>te.role==="user"&&te.turnIndex===p),k=((U=f==null?void 0:f.text)==null?void 0:U.trim())??"";if(k){try{await q_(A,k)}catch(te){if((te instanceof Error?te.message:"").includes("No matching commit found"))return;throw te}he=!0}}async function Ze(u){if(_.has(u))return;const p=ye.value[u];if(!(!p||p.fallbackRetried)){_.add(u),Ae(u,{...p,fallbackRetried:!0});try{await ge();try{const w=await ou(u,1);hn(u,w),qt(u,[]),Kt(u),i.value[u]&&(i.value=Ft(i.value,u))}catch{}rt(u,null),$e.value="",kt(u,null),Tt(u,{label:"Thinking",details:vt(yn,p.effort)}),ct(u,!0),re.value[u]!==!0&&await sa(u),await oa(u,p.text,p.imageUrls,yn,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments),re.value={...re.value,[u]:!0},yt(),pe.add(u),he=!0,await Kn()}catch(w){const A=w instanceof Error?w.message:"Unknown application error";rt(u,A),$e.value=A,ct(u,!1),Tt(u,null)}finally{_.delete(u)}}}function at(u){u&&!Bu.includes(u)||(E.value=u)}async function ht(u){const p=u==="fast"?"fast":"standard";if(Ke.value||D.value===p)return;const w=D.value;D.value=p,Ke.value=!0,$e.value="";try{await F_(p)}catch(A){D.value=w,$e.value=A instanceof Error?A.message:"Failed to update Fast mode"}finally{Ke.value=!1}}function vt(u,p){const w=u.trim()||"default",A=p||"default",ee=D.value==="fast"?"Fast":"Standard";return[`Model: ${w}`,`Thinking: ${A}`,`Speed: ${ee}`]}async function Mt(){try{const[u,p]=await Promise.all([B_(),H_()]);h.value=u,v.value.length>0&&u.includes(v.value)||(p.model&&u.includes(p.model)?v.value=p.model:u.length>0?v.value=u[0]:v.value="",ma(v.value)),p.reasoningEffort&&Bu.includes(p.reasoningEffort)&&(E.value=p.reasoningEffort),D.value=p.speedMode}catch{}}async function Ot(){if(J){await J;return}J=(async()=>{try{Oe.value=ue(await W_())}catch{}finally{J=null}})(),await J}function yt(){if(typeof window>"u"){Ot();return}Ye!==null&&window.clearTimeout(Ye),Ye=window.setTimeout(()=>{Ye=null,Ot()},yA)}function lt(u){const p=X.value;return Object.keys(p).length===0?u:u.map(w=>({projectName:w.projectName,threads:w.threads.map(A=>{const ee=p[A.id];return ee?{...A,title:ee}:A})}))}function Rt(){const p=lt(t.value).map(w=>({projectName:w.projectName,threads:w.threads.map(A=>{const ee=a.value[A.id]===!0,f=n.value===A.id,k=O.value[A.id],U=c.value[A.id]===!0,te=!f&&!ee&&(U||k!==A.updatedAtIso);return{...A,inProgress:ee,unread:te}})}));e.value=Po(e.value,p)}function jt(u,p,w){const A=new Date().toISOString(),ee=p.trim(),f=HA(ee),k={id:u,title:WA(w),projectName:f,cwd:ee,hasWorktree:ee.includes("/.codex/worktrees/")||ee.includes("/.git/worktrees/"),createdAtIso:A,updatedAtIso:A,preview:w,unread:!1,inProgress:!1},U=t.value.findIndex(Te=>Te.projectName===f);if(U>=0){const me=t.value[U].threads.filter(gn=>gn.id!==u),bt={projectName:f,threads:[k,...me]},dn=[...t.value];dn.splice(U,1,bt),t.value=dn}else t.value=[{projectName:f,threads:[k]},...t.value];const te=Ao(R.value,t.value);Wr(R.value,te)||(R.value=te,rs(R.value)),Rt()}function Bt(u){const p=new Set(u.map(f=>f.id)),w=Jt(O.value,p);w!==O.value&&(O.value=w,Hu(w));const A=Jt(z.value,p);A!==z.value&&(z.value=A,Wu(A)),F.value=Jt(F.value,p),H.value=Jt(H.value,p),re.value=Jt(re.value,p),r.value=Jt(r.value,p),s.value=Jt(s.value,p),o.value=Jt(o.value,p),i.value=Jt(i.value,p),se.value=Jt(se.value,p),ve.value=Jt(ve.value,p),Ee.value=Jt(Ee.value,p),ie.value=Jt(ie.value,p),c.value=Jt(c.value,p),a.value=Jt(a.value,p);const ee={};for(const[f,k]of Object.entries(oe.value))(f===$s||p.has(f))&&(ee[f]=k);oe.value=ee}function bn(u){const p=Ir(t.value).find(w=>w.id===u);p&&(O.value={...O.value,[u]:p.updatedAtIso},Hu(O.value),c.value[u]&&(c.value=Ft(c.value,u)),Rt())}function kt(u,p){if(!u)return;const w=se.value[u];if(p){if(OA(w,p))return;se.value={...se.value,[u]:p}}else w&&(se.value=Ft(se.value,u))}function ct(u,p){!u||a.value[u]===!0===p||(p?a.value={...a.value,[u]:!0}:a.value=Ft(a.value,u),Rt())}function Ht(u){u&&u!==n.value&&c.value[u]!==!0&&(c.value={...c.value,[u]:!0},Rt())}function Tt(u,p){if(!u)return;const w=ve.value[u];if(!p){w&&(ve.value=Ft(ve.value,u));return}const A=Gn(p.label)||"Thinking",ee=p.details.map(U=>Gn(U)).filter(U=>U.length>0&&U!==A),f=Array.from(new Set([...(w==null?void 0:w.details)??[],...ee])).slice(-3),k={label:A,details:f};$A(w,k)||(ve.value={...ve.value,[u]:k})}function rt(u,p){if(!u)return;const w=Ee.value[u],A=p?Qa(p):"";if(!A){w&&(Ee.value=Ft(Ee.value,u));return}(w==null?void 0:w.message)!==A&&(Ee.value={...Ee.value,[u]:{message:A}})}function Ut(u){const p=Ir(t.value).find(w=>w.id===u);return(p==null?void 0:p.updatedAtIso)??""}function Gt(u,p){if(!u)return;const w={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(w.scrollRatio=Ya(p.scrollRatio,0,1));const A=z.value[u];A&&A.scrollTop===w.scrollTop&&A.isAtBottom===w.isAtBottom&&A.scrollRatio===w.scrollRatio||(z.value={...z.value,[u]:w},Wu(z.value))}function hn(u,p){const w=r.value[u]??[];si(w,p)||(r.value={...r.value,[u]:p})}function qt(u,p){const w=s.value[u]??[];si(w,p)||(s.value={...s.value,[u]:p})}function cn(u,p){const w=s.value[u]??[],A=Vu(w,p);qt(u,A)}function _n(u,p){if(!u)return;const w=p.trim(),A=o.value[u]??"";if(w.length===0){if(!A)return;o.value=Ft(o.value,u);return}A!==w&&(o.value={...o.value,[u]:w})}function kn(u,p){if(!u)return;const w=o.value[u]??"";_n(u,`${w}${p}`)}function Kt(u){u&&u in o.value&&(o.value=Ft(o.value,u))}function De(u){return u!==null&&typeof u=="object"&&!Array.isArray(u)?u:null}function g(u){return typeof u=="string"?u:""}function S(u){return typeof u=="number"&&Number.isFinite(u)?u:null}function C(u){var p,w;return((p=u.limitId)==null?void 0:p.trim())||((w=u.limitName)==null?void 0:w.trim())||"__default__"}function K(u){const p=De(u);return p?{usedPercent:Ya(S(p.usedPercent)??0,0,100),windowDurationMins:S(p.windowDurationMins),resetsAt:S(p.resetsAt)}:null}function ae(u){const p=De(u);if(!p)return null;const w=De(p.credits);return{limitId:g(p.limitId)||null,limitName:g(p.limitName)||null,primary:K(p.primary),secondary:K(p.secondary),credits:w?{hasCredits:w.hasCredits===!0,unlimited:w.unlimited===!0,balance:g(w.balance)||null}:null,planType:g(p.planType)||null}}function ue(u){const p=De(u);if(!p)return[];const w=[],A=new Set,ee=k=>{if(!k)return;const U=C(k);A.has(U)||(A.add(U),w.push(k))};ee(ae(p.rateLimits));const f=De(p.rateLimitsByLimitId);if(f)for(const k of Object.values(f))ee(ae(k));return w}function Se(u){const p=De(u.params);if(!p)return"";const w=g(p.threadId);if(w)return w;const A=g(p.thread_id);if(A)return A;const ee=g(p.conversationId);if(ee)return ee;const f=g(p.conversation_id);if(f)return f;const k=De(p.thread),U=g(k==null?void 0:k.id);if(U)return U;const te=De(p.turn),Te=g(te==null?void 0:te.threadId);if(Te)return Te;const me=g(te==null?void 0:te.thread_id);return me||""}function _e(u){if(u.method!=="turn/completed")return"";const p=De(u.params),w=De(p==null?void 0:p.turn);if(!w||w.status!=="failed")return"";const A=De(w.error);return g(A==null?void 0:A.message)}function Ge(u){var w;if(u.method!=="error")return"";const p=De(u.params);return g(p==null?void 0:p.message)||g((w=De(p==null?void 0:p.error))==null?void 0:w.message)}function et(u){const p=De(u);if(!p)return null;const w=p.id,A=g(p.method),ee=p.params;if(typeof w!="number"||!Number.isInteger(w)||!A)return null;const f=De(ee),k=g(f==null?void 0:f.threadId)||$s,U=g(f==null?void 0:f.turnId),te=g(f==null?void 0:f.itemId),Te=g(p.receivedAtIso)||new Date().toISOString();return{id:w,method:A,threadId:k,turnId:U,itemId:te,receivedAtIso:Te,params:ee??null}}function wt(u){const p=u.threadId||$s,w=oe.value[p]??[],A=w.findIndex(f=>f.id===u.id),ee=[...w];A>=0?ee.splice(A,1,u):ee.push(u),oe.value={...oe.value,[p]:ee.sort((f,k)=>f.receivedAtIso.localeCompare(k.receivedAtIso))}}function $t(u){const p={};for(const[w,A]of Object.entries(oe.value)){const ee=A.filter(f=>f.id!==u);ee.length>0&&(p[w]=ee)}oe.value=p}function un(u){if(u.method==="server/request"){const p=et(u.params);return p&&wt(p),!0}if(u.method==="server/request/resolved"){const p=De(u.params),w=p==null?void 0:p.id;return typeof w=="number"&&Number.isInteger(w)&&$t(w),!0}return!1}function Gn(u){return u.replace(/\s+/gu," ").trim()}function Mn(u){const p=Se(u);if(!p)return null;if(u.method==="turn/started")return{threadId:p,activity:{label:"Thinking",details:[]}};if(u.method==="item/started"){const w=De(u.params),A=De(w==null?void 0:w.item),ee=g(A==null?void 0:A.type).toLowerCase();if(ee==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(ee==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(ee==="commandexecution"){const f=g(A==null?void 0:A.command);return{threadId:p,activity:{label:"Running command",details:f?[f]:[]}}}}return u.method==="item/commandExecution/outputDelta"?{threadId:p,activity:{label:"Running command",details:[]}}:u.method==="item/reasoning/summaryTextDelta"||u.method==="item/reasoning/summaryPartAdded"?{threadId:p,activity:{label:"Thinking",details:[]}}:u.method==="item/agentMessage/delta"?{threadId:p,activity:{label:"Writing response",details:[]}}:null}function pr(u){if(u.method!=="turn/started")return null;const p=De(u.params);if(!p)return null;const w=Se(u);if(!w)return null;const A=De(p.turn),ee=g(A==null?void 0:A.id)||g(p.turnId)||`${w}:unknown`;if(!ee)return null;const f=kr(g(A==null?void 0:A.startedAt))??kr(g(p.startedAt))??kr(u.atIso)??Date.now();return{threadId:w,turnId:ee,startedAtMs:f}}function N(u){if(u.method!=="turn/completed")return null;const p=De(u.params);if(!p)return null;const w=Se(u);if(!w)return null;const A=De(p.turn),ee=g(A==null?void 0:A.id)||g(p.turnId)||`${w}:unknown`;if(!ee)return null;const f=kr(g(A==null?void 0:A.completedAt))??kr(g(p.completedAt))??kr(u.atIso)??Date.now(),k=kr(g(A==null?void 0:A.startedAt))??kr(g(p.startedAt))??void 0;return{threadId:w,turnId:ee,completedAtMs:f,startedAtMs:k}}function V(u){return`${u}:live-reasoning`}function ne(u){const p=De(u.params);if(!p)return"";if(u.method==="item/started"){const w=De(p.item);return!w||w.type!=="reasoning"?"":g(w.id)}return""}function Le(u){const p=De(u.params);if(!p)return null;if(u.method==="item/reasoning/summaryTextDelta"){const w=g(p.itemId),A=g(p.delta);return!w||!A?null:{messageId:V(w),delta:A}}return null}function T(u){const p=De(u.params);if(!p)return"";if(u.method==="item/reasoning/summaryPartAdded"){const w=g(p.itemId);return w?V(w):""}return""}function P(u){const p=De(u.params);if(!p)return"";if(u.method==="item/completed"){const w=De(p.item);return!w||w.type!=="reasoning"?"":V(g(w.id))}return""}function L(u){const p=De(u.params);if(!p)return"";if(u.method==="item/started"){const w=De(p.item);return!w||w.type!=="agentMessage"?"":g(w.id)}return""}function Q(u){const p=De(u.params);if(!p)return null;if(u.method==="item/agentMessage/delta"){const w=g(p.itemId),A=g(p.delta);return!w||!A?null:{messageId:w,delta:A}}return null}function Ne(u){const p=De(u.params);if(!p)return null;if(u.method==="item/completed"){const w=De(p.item);if(!w||w.type!=="agentMessage")return null;const A=g(w.id),ee=g(w.text);return!A||!ee?null:{id:A,role:"assistant",text:ee,messageType:"agentMessage.live"}}return null}function At(u){if(u.method!=="item/started")return null;const p=De(u.params),w=De(p==null?void 0:p.item);if(!w||w.type!=="commandExecution")return null;const A=g(w.id),ee=g(w.command);if(!A)return null;const f=typeof w.cwd=="string"?w.cwd:null;return{id:A,role:"system",text:ee,messageType:"commandExecution",commandExecution:{command:ee,cwd:f,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Wt(u){if(u.method!=="item/commandExecution/outputDelta")return null;const p=De(u.params);if(!p)return null;const w=g(p.itemId),A=g(p.delta);return!w||!A?null:{itemId:w,delta:A}}function Xr(u){if(u.method!=="item/completed")return null;const p=De(u.params),w=De(p==null?void 0:p.item);if(!w||w.type!=="commandExecution")return null;const A=g(w.id),ee=g(w.command);if(!A)return null;const f=typeof w.cwd=="string"?w.cwd:null,k=g(w.status),U=k==="failed"?"failed":k==="declined"?"declined":k==="interrupted"?"interrupted":"completed",te=typeof w.aggregatedOutput=="string"?w.aggregatedOutput:"",Te=typeof w.exitCode=="number"?w.exitCode:null;return{id:A,role:"system",text:ee,messageType:"commandExecution",commandExecution:{command:ee,cwd:f,status:U,aggregatedOutput:te,exitCode:Te}}}function mr(u,p){const w=i.value[u]??[],A=Vu(w,p);A!==w&&(i.value={...i.value,[u]:A})}function mn(u,p){const w=i.value[u];if(!w||w.length===0)return;const A=new Set(p.map(f=>f.id)),ee=w.filter(f=>!A.has(f.id));ee.length!==w.length&&(ee.length===0?i.value=Ft(i.value,u):i.value={...i.value,[u]:ee})}function gr(u){if(u.method==="item/agentMessage/delta")return!0;const p=De(u.params);if(!p)return!1;if(u.method==="item/completed"){const w=De(p.item);return(w==null?void 0:w.type)==="agentMessage"}return!1}function qn(u){var jl,Ul,Fl,Bl,Hl;if(un(u))return;if(u.method==="account/rateLimits/updated"&&yt(),u.method==="thread/name/updated"){const qe=De(u.params),Tn=g(qe==null?void 0:qe.threadId),yr=g(qe==null?void 0:qe.threadName);Tn&&yr&&(X.value={...X.value,[Tn]:yr},Rt(),ia(Tn,yr))}const p=Mn(u);p&&Tt(p.threadId,p.activity);const w=pr(u);w&&(y.set(w.turnId,w),ie.value={...ie.value,[w.threadId]:w.turnId},kt(w.threadId,null),rt(w.threadId,null),ct(w.threadId,!0),c.value[w.threadId]&&(c.value=Ft(c.value,w.threadId)));const A=N(u),ee=_e(u),k=!!((A==null?void 0:A.threadId)??Se(u))&&!!ee&&v.value!==yn&&Ro(new Error(ee));if(A){const qe=ye.value[A.threadId],Tn=y.get(A.turnId);Tn&&y.delete(A.turnId);const yr=S((jl=De(u.params))==null?void 0:jl.durationMs)??S((Fl=De((Ul=De(u.params))==null?void 0:Ul.turn))==null?void 0:Fl.durationMs)??(typeof A.startedAtMs=="number"?A.completedAtMs-A.startedAtMs:null)??(Tn?A.completedAtMs-Tn.startedAtMs:null),Ch=typeof yr=="number"?Math.max(0,yr):0;if(kt(A.threadId,{turnId:A.turnId,durationMs:Ch}),ie.value[A.threadId]&&(ie.value=Ft(ie.value,A.threadId)),ct(A.threadId,!1),Tt(A.threadId,null),Ht(A.threadId),k||(Be(A.threadId),_o(A.threadId)),!ee&&!k){const Ah=((Bl=qe==null?void 0:qe.text)==null?void 0:Bl.trim())||wA;We(A.threadId,Ah).catch(()=>{})}}if(ee){const qe=(A==null?void 0:A.threadId)||Se(u);qe&&rt(qe,ee),$e.value=ee,qe&&k&&Ze(qe)}else A&&rt(A.threadId,null);const U=Ge(u);if(U){const qe=Se(u);qe&&rt(qe,U),$e.value=U,v.value!==yn&&Ro(new Error(U))&&(qe?Ze(qe):ge())}const te=Se(u);if(!te||te!==n.value)return;L(u);const Te=Q(u);if(Te){const qe=(s.value[te]??[]).find(yr=>yr.id===Te.messageId),Tn=`${(qe==null?void 0:qe.text)??""}${Te.delta}`;cn(te,{id:Te.messageId,role:"assistant",text:Tn,messageType:"agentMessage.live"})}const me=Ne(u);me&&cn(te,me),ne(u);const bt=Le(u);if(bt&&kn(te,bt.delta),T(u)){const qe=o.value[te]??"";qe.trim().length>0&&!qe.endsWith(`
|
|
1423
|
+
|
|
1424
|
+
`)&&_n(te,`${qe}
|
|
1425
|
+
|
|
1426
|
+
`)}P(u);const gn=At(u);gn&&(mr(te,gn),Tt(te,{label:"Running command",details:[((Hl=gn.commandExecution)==null?void 0:Hl.command)??""]}));const ji=Wt(u);if(ji){const qe=(i.value[te]??[]).find(Tn=>Tn.id===ji.itemId);qe!=null&&qe.commandExecution&&mr(te,{...qe,commandExecution:{...qe.commandExecution,aggregatedOutput:`${qe.commandExecution.aggregatedOutput}${ji.delta}`}})}const Ll=Xr(u);if(Ll&&mr(te,Ll),gr(u)&&(Ie&&n.value&&Gt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Kt(te)),u.method==="turn/completed"){Ie=!1,Kt(te),i.value[te]&&(i.value=Ft(i.value,te));const qe=Se(u);qe&&(ct(qe,!1),Tt(qe,null),Ht(qe),k||(Be(qe),_o(qe)))}}function Qr(u){const p=Se(u);p&&pe.add(p);const w=u.method;(w.startsWith("thread/")||w.startsWith("turn/")||w.startsWith("item/"))&&(he=!0),!(Qe!==null||typeof window>"u")&&(Qe=window.setTimeout(()=>{Qe=null,Kn()},pa))}async function Si(u){if(!Ce){Ce=!0;try{const p=await ja(),w=[];for(const A of p.order){const ee=ya(A);w.includes(ee)||w.push(ee)}if(w.length>0){const A=Ao(w,u);Wr(R.value,A)||(R.value=A,rs(R.value))}if(Object.keys(p.labels).length>0){const A={...x.value};let ee=!1;for(const[f,k]of Object.entries(p.labels)){const U=ya(f);A[U]!==k&&(A[U]=k,ee=!0)}ee&&(x.value=A,ga(A))}}catch{}}}async function Is(){if(!(Object.keys(X.value).length>0))try{const u=await ek();Object.keys(u.titles).length>0&&(X.value=u.titles)}catch{}}async function vo(u,p,w){if(X.value[u])return;const A=p.trim();if(!A)return;const ee=A.length>300?A.slice(0,300):A;try{const f=await tk(ee,w);if(!f||X.value[u])return;X.value={...X.value,[u]:f},Rt(),ia(u,f)}catch{}}async function vr(){var u;st.value||(je.value=!0);try{const[p]=await Promise.all([R_(),Is()]);await Si(p);const w=Ao(R.value,p);Wr(R.value,w)||(R.value=w,rs(R.value));const A=va(p,R.value),ee=BA(t.value,A,a.value);t.value=Po(t.value,ee),a.value=Jt(a.value,new Set(Ir(t.value).map(U=>U.id))),Rt(),st.value=!0;const f=Ir(e.value);Bt(f),f.some(U=>U.id===n.value)||q(((u=f[0])==null?void 0:u.id)??"")}finally{je.value=!1}}async function Zr(u,p={}){if(!u)return;const w=F.value[u]===!0,A=p.silent!==!0&&!w;A&&(Pe.value=!0);try{re.value[u]!==!0&&(await sa(u),re.value={...re.value,[u]:!0});const{messages:ee,inProgress:f}=await P_(u),k=r.value[u]??[],U=PA(k,ee,{preserveMissing:p.silent===!0});hn(u,U);const te=s.value[u]??[],Te=xA(te,ee);qt(u,Te),mn(u,ee),F.value={...F.value,[u]:!0};const me=Ut(u);me&&(H.value={...H.value,[u]:me}),ct(u,f),bn(u)}finally{A&&(Pe.value=!1)}}async function Es(){try{const u=t.value.flatMap(p=>p.threads.map(w=>w.cwd)).filter(Boolean);ke.value=await nk(u.length>0?[...new Set(u)]:void 0)}catch{}}async function yo(){$e.value="";try{await vr(),await Promise.all([Mt(),Ot(),Es()]),await Zr(n.value)}catch(u){$e.value=u instanceof Error?u.message:"Unknown application error"}}async function wo(u){q(u);try{await Zr(u)}catch(p){$e.value=p instanceof Error?p.message:"Unknown application error"}}async function Ii(u){try{await $_(u),await vr(),n.value===u&&await Zr(n.value)}catch(p){$e.value=p instanceof Error?p.message:"Unknown application error"}}async function Ei(u,p){const w=p.trim();if(!(!u||!w))try{await N_(u,w),X.value={...X.value,[u]:w},Rt(),ia(u,w)}catch(A){$e.value=A instanceof Error?A.message:"Unknown application error"}}async function bo(u,p=[],w=[],A="steer",ee=[],f){if(Ke.value)return;const k=n.value,U=u.trim();if(!k||!U&&p.length===0&&ee.length===0)return;const te=a.value[k]===!0;if(te&&A==="queue"){const Te=l.value[k]??[],me=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,bt=[...Te],dn=typeof f=="number"?Math.max(0,Math.min(f,bt.length)):bt.length;bt.splice(dn,0,{id:me,text:U,imageUrls:p,skills:w,fileAttachments:ee}),l.value={...l.value,[k]:bt};return}if(te){Ie=!0,es(k,U,p,w,ee).catch(Te=>{const me=Te instanceof Error?Te.message:"Unknown application error";rt(k,me),$e.value=me});return}$e.value="",Ie=!0,kt(k,null),Tt(k,{label:"Thinking",details:vt(v.value,E.value)}),rt(k,null),ct(k,!0);try{await es(k,U,p,w,ee)}catch(Te){Ie=!1,ct(k,!1),Tt(k,null);const me=Te instanceof Error?Te.message:"Unknown application error";throw rt(k,me),$e.value=me,Te}}async function Ci(u,p,w=[],A=[],ee=[]){if(Ke.value)return"";const f=u.trim(),k=p.trim(),U=v.value.trim();if(!f&&w.length===0&&ee.length===0)return"";Me.value=!0,$e.value="";let te="";try{try{te=await iu(k||void 0,U||void 0)}catch(dn){if(U&&U!==yn&&Ro(dn))await ge(),te=await iu(k||void 0,yn);else throw dn}if(!te)return"";jt(te,k,f||"[Image]"),re.value={...re.value,[te]:!0},q(te),Ie=!0,kt(te,null),Tt(te,{label:"Thinking",details:vt(v.value,E.value)}),rt(te,null),ct(te,!0);const Te=te,me=k||null,bt=f;return es(te,f,w,A,ee).catch(dn=>{Ie=!1,ct(te,!1),Tt(te,null);const gn=dn instanceof Error?dn.message:"Unknown application error";rt(te,gn),$e.value=gn}).finally(()=>{Me.value=!1}),vo(Te,bt,me),te}catch(Te){Ie=!1,te&&(ct(te,!1),Tt(te,null));const me=Te instanceof Error?Te.message:"Unknown application error";throw te&&rt(te,me),$e.value=me,Me.value=!1,Te}}async function es(u,p,w=[],A=[],ee=[]){const f=v.value.trim(),k=E.value,U=p.trim(),te=A.map(me=>({name:me.name,path:me.path})),Te=ee.map(me=>({...me}));Ae(u,{text:U,imageUrls:[...w],skills:te,fileAttachments:Te,effort:k,fallbackRetried:!1});try{re.value[u]!==!0&&await sa(u);try{await oa(u,p,w,f||void 0,k||void 0,A.length>0?A:void 0,ee)}catch(me){if(f&&f!==yn&&Ro(me))await ge(),Ae(u,{text:U,imageUrls:[...w],skills:te,fileAttachments:Te,effort:k,fallbackRetried:!0}),await oa(u,p,w,yn,k||void 0,A.length>0?A:void 0,ee);else throw me}re.value={...re.value,[u]:!0},pe.add(u),he=!0,await Kn()}catch(me){throw me}}async function _o(u){if(d.value[u]===!0)return;const p=l.value[u];if(!p||p.length===0)return;d.value={...d.value,[u]:!0};const[w,...A]=p;l.value=A.length>0?{...l.value,[u]:A}:Ft(l.value,u),Me.value=!0,$e.value="",Ie=!0,kt(u,null),Tt(u,{label:"Thinking",details:vt(v.value,E.value)}),rt(u,null),ct(u,!0);try{await es(u,w.text,w.imageUrls,w.skills,w.fileAttachments)}catch{ct(u,!1),Tt(u,null)}finally{d.value=Ft(d.value,u),Me.value=!1}}async function ts(){const u=n.value;if(!u||a.value[u]!==!0)return;const p=ie.value[u];Re.value=!0,$e.value="";try{await j_(u,p),ct(u,!1),Tt(u,null),rt(u,null),ie.value[u]&&(ie.value=Ft(ie.value,u)),pe.add(u),he=!0,await Kn()}catch(w){const A=w instanceof Error?w.message:"Failed to interrupt active turn";rt(u,A),$e.value=A}finally{Re.value=!1}}async function Ai(u){const p=n.value;if(!p||Xe.value)return;const A=(r.value[p]??[]).reduce((f,k)=>typeof k.turnIndex=="number"&&k.turnIndex>f?k.turnIndex:f,-1);if(A<0||u>A)return;const ee=A-u+1;if(!(ee<1)){Xe.value=!0,$e.value="";try{await ze(p,u);const f=await ou(p,ee);hn(p,f),qt(p,[]),Kt(p),i.value[p]&&(i.value=Ft(i.value,p)),kt(p,null),Tt(p,null),rt(p,null),he=!0,await Kn()}catch(f){$e.value=f instanceof Error?f.message:"Failed to rollback thread"}finally{Xe.value=!1}}}function Ri(u,p){u.length===0||(x.value[u]??"")===p||(x.value={...x.value,[u]:p},ga(x.value))}function Pi(u){var ee;if(u.length===0)return;const p=R.value.filter(f=>f!==u);if(Wr(R.value,p)||(R.value=p,rs(R.value)),t.value=t.value.filter(f=>f.projectName!==u),x.value[u]!==void 0){const f={...x.value};delete f[u],x.value=f,ga(f)}Rt();const w=Ir(e.value);Bt(w),w.some(f=>f.id===n.value)||q(((ee=w[0])==null?void 0:ee.id)??""),Cs()}function xi(u,p){if(u.length===0||t.value.length===0)return;const w=t.value.map(te=>te.projectName),A=w.indexOf(u);if(A===-1)return;const ee=Math.max(0,Math.min(p,w.length-1)),f=AA(w,A,ee);if(f===w)return;const k=Ao(f,t.value);R.value=k,rs(R.value);const U=va(t.value,R.value);t.value=Po(t.value,U),Rt(),Cs()}function Mi(u){const p=u.trim();if(!p)return;const w=[p,...R.value.filter(ee=>ee!==p)];if(Wr(R.value,w))return;R.value=w,rs(R.value);const A=va(t.value,R.value);t.value=Po(t.value,A),Rt(),Cs()}async function Cs(){var u,p;try{const w=await ja(),A=new Map;for(const k of w.order){const U=ya(k);A.has(U)||A.set(U,k)}for(const k of t.value){const U=((p=(u=k.threads[0])==null?void 0:u.cwd)==null?void 0:p.trim())??"";U&&A.set(k.projectName,U)}const ee=[];for(const k of R.value){const U=A.get(k);U&&!ee.includes(U)&&ee.push(U)}for(const k of w.order)ee.includes(k)||ee.push(k);const f=w.active.filter(k=>ee.includes(k));f.length===0&&ee.length>0&&f.push(ee[0]),await K_({order:ee,labels:w.labels,active:f})}catch{}}async function Kn(){if(Je.value){typeof window<"u"&&Qe===null&&(Qe=window.setTimeout(()=>{Qe=null,Kn()},pa));return}Je.value=!0;const u=he,p=new Set(pe);he=!1,pe.clear();try{u&&await vr();const w=n.value;if(!w)return;const A=p.has(w),ee=a.value[w]===!0,f=Ut(w),k=H.value[w]??"",U=f.length>0&&f!==k;(A||ee||U||u)&&await Zr(w,{silent:!0})}catch{}finally{Je.value=!1,(he||pe.size>0)&&typeof window<"u"&&Qe===null&&(Qe=window.setTimeout(()=>{Qe=null,Kn()},pa))}}function Oi(){typeof window>"u"||ot||($i(),ot=x_(u=>{qn(u),Qr(u)}))}async function $i(){try{const u=await O_();for(const p of u){const w=et(p);w&&wt(w)}}catch{}}async function Ni(u){try{await M_(u.id,{result:u.result,error:u.error}),$t(u.id)}catch(p){$e.value=p instanceof Error?p.message:"Failed to reply to server request"}}function Di(){ot&&(ot(),ot=null),he=!1,pe.clear(),y.clear(),Qe!==null&&typeof window<"u"&&(window.clearTimeout(Qe),Qe=null),Ye!==null&&typeof window<"u"&&(window.clearTimeout(Ye),Ye=null),Ie=!1,r.value={},s.value={},o.value={},i.value={},ve.value={},se.value={},Ee.value={},ie.value={},l.value={},d.value={}}const As=fe(()=>{const u=n.value;return u?l.value[u]??[]:[]});function $r(u){const p=n.value;if(!p)return;const w=l.value[p];if(!w)return;const A=w.filter(ee=>ee.id!==u);l.value=A.length>0?{...l.value,[p]:A}:Ft(l.value,p)}function Li(u){const p=n.value;if(!p)return;const w=l.value[p];if(!w)return;const A=w.find(ee=>ee.id===u);A&&($r(u),bo(A.text,A.imageUrls,A.skills,"steer",A.fileAttachments))}return{projectGroups:e,projectDisplayNameById:x,selectedThread:G,selectedThreadScrollState:$,selectedThreadServerRequests:W,selectedLiveOverlay:B,selectedThreadId:n,availableModelIds:h,selectedModelId:v,selectedReasoningEffort:E,selectedSpeedMode:D,installedSkills:ke,accountRateLimitSnapshots:Oe,messages:Z,isLoadingThreads:je,isLoadingMessages:Pe,isSendingMessage:Me,isInterruptingTurn:Re,isUpdatingSpeedMode:Ke,error:$e,refreshAll:yo,refreshSkills:Es,selectThread:wo,setThreadScrollState:Gt,archiveThreadById:Ii,renameThreadById:Ei,sendMessageToSelectedThread:bo,sendMessageToNewThread:Ci,interruptSelectedThreadTurn:ts,rollbackSelectedThread:Ai,isRollingBack:Xe,selectedThreadQueuedMessages:As,removeQueuedMessage:$r,steerQueuedMessage:Li,setSelectedModelId:we,setWorktreeGitAutomationEnabled:de,setSelectedReasoningEffort:at,updateSelectedSpeedMode:ht,respondToPendingServerRequest:Ni,renameProject:Ri,removeProject:Pi,reorderProject:xi,pinProjectToTop:Mi,startPolling:Oi,stopPolling:Di}}const zA={class:"sidebar-root"},GA={class:"sidebar-scrollable"},qA=["aria-pressed"],KA={key:1,class:"sidebar-search-bar"},JA={key:0,class:"sidebar-settings-area"},YA={key:0,class:"sidebar-settings-panel"},XA=["title"],QA=["title"],ZA={class:"sidebar-settings-value"},e1=["title"],t1={class:"sidebar-settings-value"},n1=["title"],r1=["title"],s1=["title"],o1=["title"],i1={class:"sidebar-settings-rate-limits"},a1={class:"sidebar-settings-value"},l1={class:"content-root"},c1={class:"content-body"},u1={key:1,class:"content-grid"},d1={class:"new-thread-empty"},f1={class:"worktree-init-status-title"},h1={class:"worktree-init-status-message"},p1={key:2,class:"content-grid"},m1={class:"content-thread"},g1={class:"composer-with-queue"},v1={class:"build-badge","aria-label":"Worktree name and version"},zu="codex-web-local.sidebar-collapsed.v1",Gu="codex-web-local.send-with-enter.v1",qu="codex-web-local.in-progress-send-mode.v1",Ku="codex-web-local.dark-mode.v1",Ju="codex-web-local.dictation-click-to-toggle.v1",Yu="codex-web-local.dictation-auto-send.v1",Xu="codex-web-local.dictation-language.v1",Qu="codex-web-local.worktree-git-automation.v1",y1=Lt({__name:"App",setup(e){const t="cb98",n="0.1.52",r={sendWithEnter:"When enabled, press Enter to send. When disabled, use Command+Enter to send.",inProgressSendMode:"If a turn is still running, choose whether a new prompt should steer the current turn or be queued.",appearance:"Switch between system theme, light mode, and dark mode.",dictationClickToToggle:"Use click-to-start and click-to-stop dictation instead of hold-to-talk.",dictationAutoSend:"Automatically send transcribed dictation when recording stops.",worktreeRollback:"When enabled, each message creates a Git commit. On rollback, it runs Git reset to the commit for that message.",dictationLanguage:"Choose transcription language or keep auto-detect."},s={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:o,projectDisplayNameById:i,selectedThread:a,selectedThreadScrollState:l,selectedThreadServerRequests:d,selectedLiveOverlay:c,selectedThreadId:h,availableModelIds:v,selectedModelId:E,selectedReasoningEffort:D,selectedSpeedMode:O,installedSkills:z,accountRateLimitSnapshots:R,messages:x,isLoadingThreads:H,isLoadingMessages:F,isInterruptingTurn:re,isUpdatingSpeedMode:se,refreshAll:ve,refreshSkills:Ee,selectThread:ie,setThreadScrollState:oe,archiveThreadById:ye,renameThreadById:X,sendMessageToSelectedThread:ke,sendMessageToNewThread:Oe,interruptSelectedThreadTurn:je,rollbackSelectedThread:Pe,isRollingBack:Me,selectedThreadQueuedMessages:Re,removeQueuedMessage:Ke,steerQueuedMessage:Xe,setSelectedModelId:$e,setWorktreeGitAutomationEnabled:Je,setSelectedReasoningEffort:st,updateSelectedSpeedMode:ot,respondToPendingServerRequest:Qe,renameProject:Ye,removeProject:J,reorderProject:he,pinProjectToTop:pe,startPolling:Ce,stopPolling:Ie}=VA(),y=hv(),_=fv(),{isMobile:M}=Cf(),Y=j(null),G=j(null),$=j(!1),W=j(!1),B=j(""),Z=j("local"),q=j({order:[],labels:{}}),we=j({phase:"idle",title:"",message:""}),de=j(Li()),ge=j(""),Ae=j(!1),Be=j(null),We=j(null);let ze=null;const Ze=j("New Project (1)"),at=j(""),ht=j(!1),vt=j(ts(Gu,!0)),Mt=j(Ri()),Ot=j(Ai()),yt=j(ts(Ju,!1)),lt=j(null);let Rt=0;const jt=j(ts(Yu,!0)),Bt=j(Ni()),bn=fe(()=>Di()),kt=j(ts(Qu,!0)),ct=j({configured:!1,active:!1,mappedChats:0,mappedThreads:0,lastError:""}),Ht=fe(()=>{const f=y.params.threadId;return typeof f=="string"?f:""}),Tt=fe(()=>{const f=new Set;for(const k of o.value)for(const U of k.threads)f.add(U.id);return f}),rt=fe(()=>y.name==="home"),Ut=fe(()=>y.name==="skills"),Gt=fe(()=>{var f;return Ut.value?"Skills":rt.value?"New thread":((f=a.value)==null?void 0:f.title)??"Choose a thread"}),hn=typeof window<"u"?window.location.host:"Codex";bp(()=>{typeof document<"u"&&(document.title=`${Gt.value} — ${hn}`)});const qt=fe(()=>x.value.filter(f=>{const k=p(f.messageType,f.role);return k==="worked"?!0:!(k==="turnActivity.live"||k==="turnError.live"||k==="agentReasoning.live")})),cn=fe(()=>{let f=-1;for(const k of x.value)k.role==="user"&&typeof k.turnIndex=="number"&&k.turnIndex>f&&(f=k.turnIndex);return f}),_n=fe(()=>c.value),kn=fe(()=>rt.value?"__new-thread__":h.value),Kt=fe(()=>{var f,k;return rt.value?B.value.trim():((k=(f=a.value)==null?void 0:f.cwd)==null?void 0:k.trim())??""}),De=fe(()=>{var f;return!rt.value&&((f=a.value)==null?void 0:f.inProgress)===!0}),g=fe(()=>{var te,Te;const f=[],k=new Set;for(const me of q.value.order){const bt=me.trim();!bt||k.has(bt)||(k.add(bt),f.push({value:bt,label:q.value.labels[bt]||vr(bt)}))}for(const me of o.value){const bt=((Te=(te=me.threads[0])==null?void 0:te.cwd)==null?void 0:Te.trim())??"";!bt||k.has(bt)||(k.add(bt),f.push({value:bt,label:i.value[me.projectName]??me.projectName}))}const U=B.value.trim();return U&&!k.has(U)&&f.unshift({value:U,label:vr(U)}),f}),S=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,C=fe(()=>{if(!ct.value.configured)return"Not configured";const f=ct.value.active?"Online":"Configured (offline)",k=`${ct.value.mappedChats} chat(s), ${ct.value.mappedThreads} thread(s)`,U=ct.value.lastError?`, error: ${ct.value.lastError}`:"";return`${f}, ${k}${U}`});zn(()=>{window.addEventListener("keydown",L),$r(),S==null||S.addEventListener("change",$r),w(),mr(),Si(),Is(),qn(),ae()}),ao(()=>{window.removeEventListener("keydown",L),S==null||S.removeEventListener("change",$r),ze&&(clearTimeout(ze),ze=null),Ie()}),ut(ge,f=>{const k=f.trim();if(ze&&(clearTimeout(ze),ze=null),!k){We.value=null;return}ze=setTimeout(()=>{X_(k,1e3).then(U=>{ge.value.trim()===k&&(We.value=U.threadIds)}).catch(()=>{ge.value.trim()===k&&(We.value=null)})},220)});function K(){Ee()}async function ae(){try{ct.value=await Z_()}catch(f){const k=f instanceof Error?f.message:"Failed to load Telegram status";ct.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,lastError:k}}}function ue(){Ae.value=!Ae.value,Ae.value?Vt(()=>{var f;return(f=Be.value)==null?void 0:f.focus()}):ge.value=""}function Se(){var f;ge.value="",(f=Be.value)==null||f.focus()}function _e(f){f.key==="Escape"&&(Ae.value=!1,ge.value="")}function Ge(f){f&&(y.name==="thread"&&Ht.value===f||(_.push({name:"thread",params:{threadId:f}}),M.value&&P(!0)))}async function et(f){f&&(h.value!==f&&(await ie(f),await _.push({name:"thread",params:{threadId:f}})),await Vt(),bo())}function wt(f){ye(f)}function $t(f){var te,Te;const k=o.value.find(me=>me.projectName===f),U=((Te=(te=k==null?void 0:k.threads[0])==null?void 0:te.cwd)==null?void 0:Te.trim())??"";U&&(B.value=U),M.value&&P(!0),!rt.value&&_.push({name:"home"})}function un(f){var te,Te;const k=o.value.find(me=>me.projectName===f),U=((Te=(te=k==null?void 0:k.threads[0])==null?void 0:te.cwd)==null?void 0:Te.trim())??"";!U||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(U)}`,"_blank","noopener,noreferrer")}function Gn(){var k,U;const f=((U=(k=a.value)==null?void 0:k.cwd)==null?void 0:U.trim())??"";f&&(B.value=f),M.value&&P(!0),!rt.value&&_.push({name:"home"})}function Mn(f){Ye(f.projectName,f.displayName)}function pr(f){X(f.threadId,f.title)}function N(){if(typeof window>"u")return;const f=window.prompt("Telegram bot token");!f||!f.trim()||Q_(f.trim()).then(()=>{window.alert("Telegram bot configured. Open the bot DM and send /start."),ae()}).catch(k=>{const U=k instanceof Error?k.message:"Failed to connect Telegram bot";window.alert(U),ae()})}function V(f){J(f)}function ne(f){he(f.projectName,f.toIndex)}function Le(f){oe(f.threadId,f.state)}function T(f){Qe(f)}function P(f){de.value!==f&&(de.value=f,u(f))}function L(f){f.defaultPrevented||!f.ctrlKey&&!f.metaKey||f.shiftKey||f.altKey||f.key.toLowerCase()==="b"&&(f.preventDefault(),P(!de.value))}function Q(f){const k=f.text,U=G.value,te=f.mode==="queue"&&U&&U.threadId===h.value?U.queueIndex:void 0;if(G.value=null,rt.value){ee(k,f.imageUrls,f.skills,f.fileAttachments);return}if(f.rollbackLatestUserTurn===!0){At(f);return}ke(k,f.imageUrls,f.skills,f.mode,f.fileAttachments,te)}function Ne(f){const k=Re.value.findIndex(me=>me.id===f),U=k>=0?Re.value[k]:void 0,te=Y.value;if(!U||!te||te.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;G.value=h.value?{threadId:h.value,queueIndex:k}:null;const Te={text:U.text,imageUrls:[...U.imageUrls],fileAttachments:U.fileAttachments.map(me=>({...me})),skills:U.skills.map(me=>({...me}))};te.hydrateDraft(Te),Ke(f)}async function At(f){De.value&&await je();const k=cn.value;k>=0&&await Pe(k),await ke(f.text,f.imageUrls,f.skills,"steer",f.fileAttachments)}function Wt(f){B.value=f.trim()}async function Xr(f){const k=f.trim();if(!k)return;const U=gr(k),te=await mn(),Te=U?k:Zr(te,k);if(Te)try{const me=await lu(Te,{createIfMissing:!U,label:U?"":k});me&&(B.value=me,pe(vr(me)),Is(),qn())}catch{}}async function mr(){var k;if(typeof window>"u")return;const f=((k=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:k.trim())??"";if(f)try{const U=await lu(f,{createIfMissing:!1,label:""});if(!U)return;B.value=U,pe(vr(U)),await _.replace({name:"home"}),await Is();const te=new URL(window.location.href);te.searchParams.delete("openProjectPath"),window.history.replaceState({},"",te.toString())}catch{}}async function mn(){const f=Qr();if(f)return f;try{const k=await au();if(k)return at.value=k,k}catch{}return""}function gr(f){return f?f.startsWith("~/")||f.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(f):!1}async function qn(){const f=Qr();if(!f){Ze.value="New Project (1)";return}try{const k=await J_(f);Ze.value=k.name||"New Project (1)"}catch{Ze.value="New Project (1)"}}function Qr(){var U,te;const f=B.value.trim();if(f)return vo(f);const k=((te=(U=g.value[0])==null?void 0:U.value)==null?void 0:te.trim())??"";return k?vo(k):at.value.trim()}async function Si(){try{at.value=await au()}catch{at.value=""}}async function Is(){try{const f=await ja();q.value={order:[...f.order],labels:{...f.labels}}}catch{q.value={order:[],labels:{}}}}function vo(f){const k=f.trim().replace(/\/+$/,"");if(!k)return"";const U=k.lastIndexOf("/");return U<=0?"":k.slice(0,U)}function vr(f){const k=f.trim().replace(/\/+$/,"");if(!k)return"";const U=k.lastIndexOf("/");return U<0?k:k.slice(U+1)}function Zr(f,k){const U=f.trim().replace(/\/+$/,""),te=k.trim().replace(/^\/+/,"");return!U||!te?"":`${U}/${te}`}function Es(f){$e(f)}function yo(f){st(f)}function wo(f){ot(f)}function Ii(){je()}function Ei(f){var U;const k=((U=f.prependText)==null?void 0:U.trim())??"";k.length>0&&(Rt+=1,lt.value={id:Rt,text:k}),Pe(f.turnIndex)}function bo(){if(rt.value||Ut.value||typeof document>"u"||!a.value||qt.value.length===0)return;const f=Ci(),k=es(),U=new Blob([f],{type:"text/markdown;charset=utf-8"}),te=URL.createObjectURL(U),Te=document.createElement("a");Te.href=te,Te.download=k,document.body.appendChild(Te),Te.click(),document.body.removeChild(Te),window.setTimeout(()=>URL.revokeObjectURL(te),0)}function Ci(){var U,te,Te;const f=[],k=((te=(U=a.value)==null?void 0:U.title)==null?void 0:te.trim())||"Untitled thread";f.push(`# ${_o(k)}`),f.push(""),f.push(`- Exported: ${new Date().toISOString()}`),f.push(`- Thread ID: ${((Te=a.value)==null?void 0:Te.id)??""}`),f.push(""),f.push("---"),f.push("");for(const me of qt.value){const bt=me.role?me.role.toUpperCase():"MESSAGE";f.push(`## ${bt}`),f.push("");const dn=me.text.trim();if(dn&&(f.push(dn),f.push("")),me.commandExecution&&(f.push("```text"),f.push(`command: ${me.commandExecution.command}`),f.push(`status: ${me.commandExecution.status}`),me.commandExecution.cwd&&f.push(`cwd: ${me.commandExecution.cwd}`),me.commandExecution.exitCode!==null&&f.push(`exitCode: ${me.commandExecution.exitCode}`),f.push(me.commandExecution.aggregatedOutput||"(no output)"),f.push("```"),f.push("")),me.fileAttachments&&me.fileAttachments.length>0){f.push("Attachments:");for(const gn of me.fileAttachments)f.push(`- ${gn.path}`);f.push("")}if(me.images&&me.images.length>0){f.push("Images:");for(const gn of me.images)f.push(`- ${gn}`);f.push("")}}return`${f.join(`
|
|
1427
|
+
`).trimEnd()}
|
|
1428
|
+
`}function es(){var Te,me;const U=(((me=(Te=a.value)==null?void 0:Te.title)==null?void 0:me.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",te=new Date().toISOString().replace(/[:.]/g,"-");return`${U}-${te}.md`}function _o(f){return f.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function ts(f,k){if(typeof window>"u")return k;const U=window.localStorage.getItem(f);return U===null?k:U==="1"}function Ai(){if(typeof window>"u")return"system";const f=window.localStorage.getItem(Ku);return f==="light"||f==="dark"?f:"system"}function Ri(){return typeof window>"u"?"steer":window.localStorage.getItem(qu)==="queue"?"queue":"steer"}function Pi(){vt.value=!vt.value,window.localStorage.setItem(Gu,vt.value?"1":"0")}function xi(){Mt.value=Mt.value==="steer"?"queue":"steer",window.localStorage.setItem(qu,Mt.value)}function Mi(){const f=["system","light","dark"],k=f.indexOf(Ot.value);Ot.value=f[(k+1)%f.length],window.localStorage.setItem(Ku,Ot.value),$r()}function Cs(){yt.value=!yt.value,window.localStorage.setItem(Ju,yt.value?"1":"0")}function Kn(){jt.value=!jt.value,window.localStorage.setItem(Yu,jt.value?"1":"0")}function Oi(){kt.value=!kt.value,window.localStorage.setItem(Qu,kt.value?"1":"0")}function $i(f){const U=As(f.trim())||"auto";Bt.value=U,window.localStorage.setItem(Xu,U)}function Ni(){var U;if(typeof window>"u")return"auto";const f=((U=window.localStorage.getItem(Xu))==null?void 0:U.trim())||"auto";return As(f)||"auto"}function Di(){const f=[{value:"auto",label:"Auto-detect"}],k=new Set(["auto"]);function U(Te){const me=s[Te]||Te;return`${me.charAt(0).toUpperCase()+me.slice(1)} (${Te})`}for(const Te of typeof navigator<"u"?navigator.languages??[]:[]){const me=As(Te);!me||k.has(me)||(k.add(me),f.push({value:me,label:`Preferred: ${U(me)}`}))}for(const Te of Object.keys(s))k.has(Te)||(k.add(Te),f.push({value:Te,label:U(Te)}));const te=Bt.value.trim();return te&&!k.has(te)&&f.push({value:te,label:U(te)}),f}function As(f){const k=f.trim().toLowerCase();if(!k||k==="auto")return"";if(k in s)return k;const U=k.split("-")[0]??k;return U in s?U:""}function $r(){const f=document.documentElement;if(Ot.value==="dark")f.classList.add("dark");else if(Ot.value==="light")f.classList.remove("dark");else{const k=window.matchMedia("(prefers-color-scheme: dark)").matches;f.classList.toggle("dark",k)}}function Li(){return typeof window>"u"?!1:window.localStorage.getItem(zu)==="1"}function u(f){typeof window>"u"||window.localStorage.setItem(zu,f?"1":"0")}function p(f,k){const U=(f??"").trim();return U.length>0?U:k.trim()||"message"}async function w(){await ve(),W.value=!0,await A(),Ce()}async function A(){if(!$.value){$.value=!0;try{if(y.name==="home"||y.name==="skills"){h.value!==""&&await ie("");return}if(y.name==="thread"){const f=Ht.value;if(!f)return;if(!Tt.value.has(f)){await _.replace({name:"home"});return}h.value!==f&&await ie(f);return}}finally{$.value=!1}}}ut(()=>[y.name,Ht.value,H.value,Tt.value.has(Ht.value),h.value],async()=>{W.value&&await A()}),ut(()=>h.value,async f=>{if(W.value&&!$.value&&!(rt.value||Ut.value)){if(!f){y.name!=="home"&&await _.replace({name:"home"});return}y.name==="thread"&&Ht.value===f||await _.replace({name:"thread",params:{threadId:f}})}}),ut(()=>g.value,f=>{if(f.length===0){B.value="";return}f.some(U=>U.value===B.value)||(B.value=f[0].value),qn()},{immediate:!0}),ut(()=>B.value,()=>{we.value={phase:"idle",title:"",message:""},qn()}),ut(()=>Z.value,f=>{f==="local"&&(we.value={phase:"idle",title:"",message:""})}),ut(()=>y.name,f=>{f!=="home"&&(we.value={phase:"idle",title:"",message:""})}),ut(()=>h.value,()=>{we.value={phase:"idle",title:"",message:""}}),ut(()=>kt.value,f=>{Je(f)},{immediate:!0}),ut(M,f=>{f&&!de.value&&P(!0)});async function ee(f,k=[],U=[],te=[]){try{we.value={phase:"idle",title:"",message:""};let Te=B.value;if(Z.value==="worktree"){we.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const bt=await z_(B.value);Te=bt.cwd,B.value=bt.cwd,we.value={phase:"idle",title:"",message:""}}catch{we.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const me=await Oe(f,Te,k,U,te);if(!me)return;await _.replace({name:"thread",params:{threadId:me}})}catch{}}return(f,k)=>(b(),I(Ue,null,[xe(wv,{"is-sidebar-collapsed":de.value,onCloseSidebar:k[6]||(k[6]=U=>P(!0))},{sidebar:_t(()=>[m("section",zA,[m("div",GA,[de.value?le("",!0):(b(),ft(Fu,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":de.value,"show-new-thread-button":!0,onToggleSidebar:k[0]||(k[0]=U=>P(!de.value)),onStartNewThread:Gn},{default:_t(()=>[m("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Ae.value,"aria-label":"Search threads",title:"Search threads",onClick:ue},[xe(Ua,{class:"sidebar-search-toggle-icon"})],8,qA)]),_:1},8,["is-sidebar-collapsed"])),!de.value&&Ae.value?(b(),I("div",KA,[xe(Ua,{class:"sidebar-search-bar-icon"}),lr(m("input",{ref_key:"sidebarSearchInputRef",ref:Be,"onUpdate:modelValue":k[1]||(k[1]=U=>ge.value=U),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:_e},null,544),[[cr,ge.value]]),ge.value.length>0?(b(),I("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Se},[xe(kl,{class:"sidebar-search-clear-icon"})])):le("",!0)])):le("",!0),de.value?le("",!0):(b(),I("button",{key:2,class:nt(["sidebar-skills-link",{"is-active":Ut.value}]),type:"button",onClick:k[2]||(k[2]=U=>{be(_).push({name:"skills"}),be(M)&&P(!0)})}," Skills Hub ",2)),de.value?le("",!0):(b(),ft(lw,{key:3,groups:be(o),"project-display-name-by-id":be(i),"selected-thread-id":be(h),"is-loading":be(H),"search-query":ge.value,"search-matched-thread-ids":We.value,onSelect:Ge,onArchive:wt,onStartNewThread:$t,onRenameProject:Mn,onBrowseProjectFiles:un,onRenameThread:pr,onRemoveProject:V,onReorderProject:ne,onExportThread:et},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),de.value?le("",!0):(b(),I("div",JA,[xe(pf,{name:"settings-panel"},{default:_t(()=>[ht.value?(b(),I("div",YA,[m("button",{class:"sidebar-settings-row",type:"button",title:r.sendWithEnter,onClick:Pi},[k[7]||(k[7]=m("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),m("span",{class:nt(["sidebar-settings-toggle",{"is-on":!vt.value}])},null,2)],8,XA),m("button",{class:"sidebar-settings-row",type:"button",title:r.inProgressSendMode,onClick:xi},[k[8]||(k[8]=m("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),m("span",ZA,ce(Mt.value==="steer"?"Steer":"Queue"),1)],8,QA),m("button",{class:"sidebar-settings-row",type:"button",title:r.appearance,onClick:Mi},[k[9]||(k[9]=m("span",{class:"sidebar-settings-label"},"Appearance",-1)),m("span",t1,ce(Ot.value==="system"?"System":Ot.value==="dark"?"Dark":"Light"),1)],8,e1),m("button",{class:"sidebar-settings-row",type:"button",title:r.dictationClickToToggle,onClick:Cs},[k[10]||(k[10]=m("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),m("span",{class:nt(["sidebar-settings-toggle",{"is-on":yt.value}])},null,2)],8,n1),m("button",{class:"sidebar-settings-row",type:"button",title:r.dictationAutoSend,onClick:Kn},[k[11]||(k[11]=m("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),m("span",{class:nt(["sidebar-settings-toggle",{"is-on":jt.value}])},null,2)],8,r1),m("button",{class:"sidebar-settings-row",type:"button",title:r.worktreeRollback,onClick:Oi},[k[12]||(k[12]=m("span",{class:"sidebar-settings-label"},"Worktree rollback",-1)),m("span",{class:nt(["sidebar-settings-toggle",{"is-on":kt.value}])},null,2)],8,s1),m("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:r.dictationLanguage},[k[13]||(k[13]=m("span",{class:"sidebar-settings-label"},"Dictation language",-1)),xe(Xo,{class:"sidebar-settings-language-dropdown","model-value":Bt.value,options:bn.value,placeholder:"Auto-detect","open-direction":"up","enable-search":!0,"search-placeholder":"Search language...","onUpdate:modelValue":$i},null,8,["model-value","options"])],8,o1),m("div",i1,[xe(eT,{snapshots:be(R)},null,8,["snapshots"])]),m("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:N},[k[14]||(k[14]=m("span",{class:"sidebar-settings-label"},"Telegram",-1)),m("span",a1,ce(C.value),1)])])):le("",!0)]),_:1}),m("button",{class:"sidebar-settings-button",type:"button",onClick:k[3]||(k[3]=U=>ht.value=!ht.value)},[xe(vA,{class:"sidebar-settings-icon"}),k[15]||(k[15]=m("span",null,"Settings",-1))])]))])]),content:_t(()=>[m("section",l1,[xe(pw,{title:Gt.value},{leading:_t(()=>[de.value||be(M)?(b(),ft(Fu,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":de.value,"show-new-thread-button":!0,onToggleSidebar:k[4]||(k[4]=U=>P(!de.value)),onStartNewThread:Gn},null,8,["is-sidebar-collapsed"])):le("",!0)]),_:1},8,["title"]),m("section",c1,[Ut.value?(b(),ft(nA,{key:0,onSkillsChanged:K})):rt.value?(b(),I("div",u1,[m("div",d1,[k[16]||(k[16]=m("p",{class:"new-thread-hero"},"Let's build",-1)),xe(Xo,{class:"new-thread-folder-dropdown","model-value":B.value,options:g.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":Ze.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":Wt,onAdd:Xr},null,8,["model-value","options","default-add-value"]),xe(lT,{class:"new-thread-runtime-dropdown",modelValue:Z.value,"onUpdate:modelValue":k[5]||(k[5]=U=>Z.value=U)},null,8,["modelValue"]),we.value.phase!=="idle"?(b(),I("div",{key:0,class:nt(["worktree-init-status",{"is-running":we.value.phase==="running","is-error":we.value.phase==="error"}])},[m("strong",f1,ce(we.value.title),1),m("span",h1,ce(we.value.message),1)],2)):le("",!0)]),xe(du,{"active-thread-id":kn.value,cwd:Kt.value,models:be(v),"selected-model":be(E),"selected-reasoning-effort":be(D),"selected-speed-mode":be(O),"is-updating-speed-mode":be(se),skills:be(z),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":vt.value,"in-progress-submit-mode":Mt.value,"dictation-click-to-toggle":yt.value,"dictation-auto-send":jt.value,"prepend-draft-request":lt.value,"dictation-language":Bt.value,onSubmit:Q,"onUpdate:selectedModel":Es,"onUpdate:selectedReasoningEffort":yo,"onUpdate:selectedSpeedMode":wo},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])):(b(),I("div",p1,[m("div",m1,[xe(n_,{messages:qt.value,"is-loading":be(F),"active-thread-id":kn.value,cwd:Kt.value,"scroll-state":be(l),"live-overlay":_n.value,"pending-requests":be(d),"is-turn-in-progress":De.value,"is-rolling-back":be(Me),onUpdateScrollState:Le,onRespondServerRequest:T,onRollback:Ei},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),m("div",g1,[xe(z0,{messages:be(Re),onEdit:Ne,onSteer:be(Xe),onDelete:be(Ke)},null,8,["messages","onSteer","onDelete"]),xe(du,{ref_key:"threadComposerRef",ref:Y,"active-thread-id":kn.value,cwd:Kt.value,models:be(v),"selected-model":be(E),"selected-reasoning-effort":be(D),"selected-speed-mode":be(O),"is-updating-speed-mode":be(se),skills:be(z),"is-turn-in-progress":De.value,"is-interrupting-turn":be(re),"has-queue-above":be(Re).length>0,"send-with-enter":vt.value,"in-progress-submit-mode":Mt.value,"dictation-click-to-toggle":yt.value,"dictation-auto-send":jt.value,"prepend-draft-request":lt.value,"dictation-language":Bt.value,onSubmit:Q,"onUpdate:selectedModel":Es,"onUpdate:selectedReasoningEffort":yo,"onUpdate:selectedSpeedMode":wo,onInterrupt:Ii},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),m("div",v1," WT "+ce(be(t))+" · v"+ce(be(n)),1)],64))}}),w1=tt(y1,[["__scopeId","data-v-f07d5fa6"]]),wa={render:()=>null},b1=dv({history:Wg(),routes:[{path:"/",name:"home",component:wa},{path:"/thread/:threadId",name:"thread",component:wa},{path:"/skills",name:"skills",component:wa},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");ng(w1).use(b1).mount("#app");
|