@ai-accounts/vue-styled 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Td=Object.defineProperty;var bd=(n,e,a)=>e in n?Td(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a;var ge=(n,e,a)=>bd(n,typeof e!="symbol"?e+"":e,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),et=require("@ai-accounts/vue-headless");function M_(n,e,a){if(!n)return n;let r;try{r=new URL(n)}catch{return n}if(a==="google")r.searchParams.set("prompt","select_account consent");else if(a==="claude")r.searchParams.set("prompt","login");else return n;return e&&r.searchParams.set("login_hint",e),r.toString()}const fd={class:"aia-login-stream","data-tour":"wiz-login-stream"},Rd={key:0,class:"aia-preparing"},Cd={key:1,class:"aia-url-section"},Nd=["href"],hd={class:"aia-url-actions"},vd=["aria-pressed"],Od={key:0,class:"aia-incognito-hint"},yd={key:1,class:"aia-device-code"},Ad={class:"aia-device-code__value"},Id={key:2,class:"aia-verifying","data-tour":"wiz-login-paste"},Dd={class:"aia-text-section__label"},Md={key:0,class:"aia-text-section__queued"},Ld={class:"aia-text-section__row"},xd=["disabled"],kd=["disabled"],wd={key:2,class:"aia-menu-section"},Pd={class:"aia-menu-section__title"},Bd={class:"aia-menu-options"},Ud=["onClick"],Fd={class:"aia-menu-option__num"},Gd={class:"aia-menu-option__body"},Yd={class:"aia-menu-option__label"},Vd={key:0,class:"aia-menu-option__desc"},qd={class:"aia-text-section__label"},zd={class:"aia-text-section__row"},Hd=["type","placeholder","disabled"],$d=["disabled"],Wd={key:4,class:"aia-submit-error"},Kd={key:5,class:"aia-verifying"},Qd={class:"aia-verifying__row"},Xd={class:"aia-verifying__text"},Zd={key:0,class:"aia-verifying__elapsed"},Jd={key:0,class:"aia-verifying__warning"},jd={key:6,class:"aia-terminal"},eu={class:"aia-terminal__output"},tu={key:7,class:"aia-error-card"},nu=t.defineComponent({__name:"LoginStream",props:{session:{},showStdout:{type:Boolean,default:!1},backendKind:{default:""},email:{default:""}},setup(n){const e=n,a=t.ref(""),r=t.ref(""),i=t.ref("idle");let s=null;const o=t.ref(null),l=t.ref(!1),d=t.computed(()=>(i.value==="sent"||l.value)&&e.session.status.value==="running"),_=t.computed(()=>{var k;return!!((k=e.session.urlPrompt.value)!=null&&k.user_code)}),c=t.ref(0);let u=null,m=0;t.watch(d,k=>{k?(m=Date.now(),c.value=0,u&&clearInterval(u),u=setInterval(()=>{c.value=Math.floor((Date.now()-m)/1e3)},1e3)):(u&&(clearInterval(u),u=null),c.value=0)}),t.onUnmounted(()=>{u&&clearInterval(u)});const p=t.computed(()=>d.value&&c.value>=15);async function E(){try{await e.session.cancel()}catch{}i.value="idle",l.value=!1,o.value=null}async function T(){const k=a.value.trim();if(k){o.value=null,a.value="",i.value="sent",l.value=!0;try{await e.session.respond(k)}catch(M){const I=M instanceof Error?M.message:String(M);o.value=`Could not submit your response: ${I}. The login session may have ended; cancel and start again.`,l.value=!1,i.value="idle"}}}t.watch(()=>e.session.status.value,k=>{k!=="running"&&(l.value=!1,i.value="idle")});async function f(){const k=r.value.trim();if(k){r.value="",i.value="sent";try{await e.session.writeEager(k)}catch{s=k,i.value="queued"}}}t.watch(()=>e.session.textPrompt.value,async k=>{if(k&&s){const M=s;s=null,i.value="sent",await e.session.respond(M)}});async function O(k){o.value=null;try{await e.session.respond(String(k))}catch(M){const I=M instanceof Error?M.message:String(M);o.value=`Could not submit your selection: ${I}. The login session may have ended; cancel and start again.`}}const N=t.computed(()=>{var I;const k=(I=e.session.urlPrompt.value)==null?void 0:I.url;if(!k)return"";const M=e.backendKind==="antigravity"||e.backendKind==="codex"?"google":e.backendKind==="claude"?"claude":"none";return M==="none"?k:M_(k,e.email??"",M)});let b="";t.watch(()=>N.value,k=>{k&&k!==b&&(b=k,window.open(k,"_blank","noopener"))},{immediate:!0});const S=t.ref(!1),v=t.ref(!1);let A=null;async function B(){var M;const k=N.value;if(k)try{(M=navigator==null?void 0:navigator.clipboard)!=null&&M.writeText&&await navigator.clipboard.writeText(k),S.value=!0,v.value=!0,A&&clearTimeout(A),A=setTimeout(()=>{S.value=!1},2500)}catch{v.value=!0}}function x(){v.value=!1}return(k,M)=>(t.openBlock(),t.createElementBlock("div",fd,[!n.session.urlPrompt.value&&!n.session.menuPrompt.value&&!n.session.textPrompt.value&&n.session.status.value==="running"&&!d.value?(t.openBlock(),t.createElementBlock("div",Rd,[...M[3]||(M[3]=[t.createElementVNode("span",{class:"aia-preparing__spinner"},null,-1),t.createElementVNode("div",{class:"aia-preparing__text"},[t.createElementVNode("strong",null,"Preparing sign-in…"),t.createElementVNode("span",null,"Launching the CLI and waiting for the OAuth link. This usually takes a few seconds.")],-1)])])):t.createCommentVNode("",!0),n.session.urlPrompt.value?(t.openBlock(),t.createElementBlock("div",Cd,[M[12]||(M[12]=t.createStaticVNode('<div class="aia-url-badge" data-v-76f71aff><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16" data-v-76f71aff><path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" data-v-76f71aff></path><polyline points="15 3 21 3 21 9" data-v-76f71aff></polyline><line x1="10" y1="14" x2="21" y2="3" data-v-76f71aff></line></svg><span data-v-76f71aff>A browser window should have opened. If not, click the link below:</span></div>',1)),t.createElementVNode("a",{href:N.value,target:"_blank",rel:"noopener",class:"aia-url-link","data-tour":"wiz-login-url"},t.toDisplayString(N.value),9,Nd),t.createElementVNode("div",hd,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["aia-copy-incognito-btn",{"aia-copy-incognito-btn--copied":S.value}]),"aria-pressed":v.value,onClick:B},[M[4]||(M[4]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})],-1)),t.createElementVNode("span",null,t.toDisplayString(S.value?"Copied!":"Copy for Incognito"),1)],10,vd)]),v.value?(t.openBlock(),t.createElementBlock("div",Od,[t.createElementVNode("button",{type:"button",class:"aia-incognito-hint__close","aria-label":"Dismiss",onClick:x},"×"),M[5]||(M[5]=t.createElementVNode("strong",{class:"aia-incognito-hint__title"},"Open in an incognito window",-1)),M[6]||(M[6]=t.createElementVNode("p",{class:"aia-incognito-hint__body"},[t.createTextVNode(" Press "),t.createElementVNode("kbd",null,"⌘"),t.createElementVNode("kbd",null,"⇧"),t.createElementVNode("kbd",null,"N"),t.createTextVNode(" (Mac) or "),t.createElementVNode("kbd",null,"Ctrl"),t.createElementVNode("kbd",null,"Shift"),t.createElementVNode("kbd",null,"N"),t.createTextVNode(" (Windows / Linux) to open an incognito window, then paste the URL. ")],-1))])):t.createCommentVNode("",!0),n.session.urlPrompt.value.user_code?(t.openBlock(),t.createElementBlock("div",yd,[M[7]||(M[7]=t.createElementVNode("span",{class:"aia-device-code__label"},"Enter this code in the browser:",-1)),t.createElementVNode("code",Ad,t.toDisplayString(n.session.urlPrompt.value.user_code),1),M[8]||(M[8]=t.createElementVNode("p",{class:"aia-device-code__hint"}," The CLI is polling for your sign-in. Once you confirm in the browser, this wizard advances automatically — no need to paste anything back here. ",-1))])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createElementBlock("div",Id,[...M[9]||(M[9]=[t.createElementVNode("span",{class:"aia-verifying__spinner"},null,-1),t.createElementVNode("span",{class:"aia-verifying__text"},"Verifying authorization code…",-1)])])):t.createCommentVNode("",!0),!_.value&&!n.session.textPrompt.value&&i.value!=="sent"?(t.openBlock(),t.createElementBlock("form",{key:3,class:"aia-text-section aia-text-section--eager","data-tour":"wiz-login-paste",onSubmit:t.withModifiers(f,["prevent"])},[t.createElementVNode("label",Dd,[M[10]||(M[10]=t.createTextVNode(" After signing in, paste the authorization code here: ",-1)),i.value==="queued"?(t.openBlock(),t.createElementBlock("span",Md,"(queued — waiting for CLI prompt)")):t.createCommentVNode("",!0)]),t.createElementVNode("div",Ld,[M[11]||(M[11]=t.createElementVNode("span",{class:"aia-text-section__prompt"},">",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":M[0]||(M[0]=I=>r.value=I),class:"aia-text-section__input",type:"text",placeholder:"Paste code from browser…",autocomplete:"off",autofocus:"",disabled:i.value==="queued"},null,8,xd),[[t.vModelText,r.value]]),t.createElementVNode("button",{type:"submit",class:"aia-text-section__btn",disabled:!r.value.trim()||i.value==="queued"},t.toDisplayString(i.value==="queued"?"Waiting…":"Send"),9,kd)])],32)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.session.menuPrompt.value?(t.openBlock(),t.createElementBlock("div",wd,[t.createElementVNode("p",Pd,t.toDisplayString(n.session.menuPrompt.value.prompt),1),t.createElementVNode("div",Bd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.session.menuPrompt.value.options,I=>(t.openBlock(),t.createElementBlock("button",{key:I.number,type:"button",class:"aia-menu-option",onClick:H=>O(I.number)},[t.createElementVNode("span",Fd,t.toDisplayString(I.number),1),t.createElementVNode("div",Gd,[t.createElementVNode("span",Yd,t.toDisplayString(I.label),1),I.description?(t.openBlock(),t.createElementBlock("span",Vd,t.toDisplayString(I.description),1)):t.createCommentVNode("",!0)]),M[13]||(M[13]=t.createElementVNode("svg",{class:"aia-menu-option__arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))],8,Ud))),128))])])):t.createCommentVNode("",!0),n.session.textPrompt.value?(t.openBlock(),t.createElementBlock("form",{key:3,class:"aia-text-section","data-tour":"wiz-login-paste",onSubmit:t.withModifiers(T,["prevent"])},[t.createElementVNode("label",qd,t.toDisplayString(n.session.textPrompt.value.prompt),1),t.createElementVNode("div",zd,[M[14]||(M[14]=t.createElementVNode("span",{class:"aia-text-section__prompt"},">",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":M[1]||(M[1]=I=>a.value=I),class:"aia-text-section__input",type:n.session.textPrompt.value.hidden?"password":"text",placeholder:n.session.textPrompt.value.hidden?"••••••••":"Type here…",autocomplete:"off",autofocus:"",disabled:l.value},null,8,Hd),[[t.vModelDynamic,a.value]]),t.createElementVNode("button",{type:"submit",class:"aia-text-section__btn",disabled:l.value||!a.value.trim()},t.toDisplayString(l.value?"Sending…":"Send"),9,$d)])],32)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("div",Wd,[M[15]||(M[15]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),t.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),t.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),t.createElementVNode("p",null,t.toDisplayString(o.value),1)])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createElementBlock("div",Kd,[t.createElementVNode("div",Qd,[M[17]||(M[17]=t.createElementVNode("span",{class:"aia-verifying__spinner"},null,-1)),t.createElementVNode("span",Xd,[M[16]||(M[16]=t.createTextVNode(" Verifying… ",-1)),c.value>0?(t.openBlock(),t.createElementBlock("span",Zd," ("+t.toDisplayString(c.value)+"s) ",1)):t.createCommentVNode("",!0)]),t.createElementVNode("button",{type:"button",class:"aia-verifying__cancel",onClick:E}," Cancel ")]),p.value?(t.openBlock(),t.createElementBlock("p",Jd," This is taking longer than usual. Check the terminal output below for clues, or click Cancel and try again. ")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(n.showStdout||d.value)&&n.session.stdoutLines.value.length>0?(t.openBlock(),t.createElementBlock("div",jd,[t.createElementVNode("div",eu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.session.stdoutLines.value,(I,H)=>(t.openBlock(),t.createElementBlock("div",{key:H,class:"aia-terminal__line"},t.toDisplayString(I),1))),128))])])):t.createCommentVNode("",!0),n.session.status.value==="failed"?(t.openBlock(),t.createElementBlock("div",tu,[M[18]||(M[18]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),t.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),t.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(n.session.errorCode.value),1),t.createElementVNode("p",null,t.toDisplayString(n.session.errorMessage.value),1)])])):t.createCommentVNode("",!0),n.session.status.value==="running"?(t.openBlock(),t.createElementBlock("button",{key:8,type:"button",class:"aia-cancel-btn",onClick:M[2]||(M[2]=I=>n.session.cancel())}," Cancel ")):t.createCommentVNode("",!0)]))}}),he=(n,e)=>{const a=n.__vccOpts||n;for(const[r,i]of e)a[r]=i;return a},no=he(nu,[["__scopeId","data-v-76f71aff"]]),au={class:"aia-backend-picker"},ru=["onClick"],iu=["src","alt"],ou={class:"aia-backend-info"},su={key:0,class:"aia-installed"},lu={key:1,class:"aia-not-installed"},cu=t.defineComponent({__name:"BackendPicker",props:{installStatus:{}},emits:["pick"],setup(n,{emit:e}){const a=n,r=e,i=et.useBackendRegistry();function s(o){return a.installStatus?a.installStatus[o]:void 0}return t.onMounted(async()=>{i.loaded.value||await i.load()}),(o,l)=>(t.openBlock(),t.createElementBlock("ul",au,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i).backends.value,d=>(t.openBlock(),t.createElementBlock("li",{key:d.kind},[t.createElementVNode("button",{type:"button",onClick:_=>r("pick",d.kind)},[d.icon_url?(t.openBlock(),t.createElementBlock("img",{key:0,src:d.icon_url,alt:d.display_name},null,8,iu)):t.createCommentVNode("",!0),t.createElementVNode("div",ou,[t.createElementVNode("strong",null,t.toDisplayString(d.display_name),1),s(d.kind)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[s(d.kind).installed?(t.openBlock(),t.createElementBlock("span",su," installed"+t.toDisplayString(s(d.kind).version?" v"+s(d.kind).version:""),1)):(t.openBlock(),t.createElementBlock("span",lu,"not detected"))],64)):t.createCommentVNode("",!0)])],8,ru)]))),128))]))}}),L_=he(cu,[["__scopeId","data-v-2500895f"]]),_u={class:"wizard-container","data-tour":"account-wizard"},du={class:"wizard-header"},uu={key:0,class:"wizard-step"},pu={class:"step-body"},mu={class:"step-actions"},Eu={key:0,class:"wizard-warning",role:"alert"},gu={class:"wizard-steps"},Su={class:"step-number"},Tu={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3",width:"12",height:"12"},bu={class:"step-label"},fu={key:2,class:"wizard-step","data-tour":"wiz-subscription"},Ru={class:"step-body"},Cu={class:"step-question"},Nu={class:"radio-group","data-tour":"wiz-sub-yesno"},hu={class:"radio-card-content"},vu={class:"radio-card-title"},Ou={class:"radio-card-desc"},yu={class:"radio-card-content"},Au={class:"radio-card-title"},Iu={class:"radio-card-desc"},Du={key:0,class:"account-fields"},Mu={class:"form-group"},Lu={for:"wiz-name"},xu=["placeholder"],ku={class:"account-name-hint"},wu={class:"form-group"},Pu={for:"wiz-email"},Bu=["placeholder"],Uu={class:"step-actions"},Fu=["disabled"],Gu={key:3,class:"wizard-step","data-tour":"wiz-cli"},Yu={class:"step-body"},Vu={key:0,class:"status-card status-ok","data-tour":"wiz-cli-status"},qu={class:"status-info"},zu={class:"status-title"},Hu={class:"status-detail"},$u={class:"status-icon"},Wu={key:0,class:"spinner-sm"},Ku={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},Qu={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},Xu={class:"status-info"},Zu={class:"status-title"},Ju={key:0,class:"status-detail"},ju={key:1,class:"status-detail"},ep={key:1,class:"spinner-sm"},tp={key:2,class:"error-text"},np={key:3,class:"install-success-text"},ap={key:4,class:"install-stderr"},rp={key:5,class:"config-advanced"},ip={class:"config-dir-section"},op={class:"config-dir-label"},sp={class:"form-group compact"},lp=["placeholder"],cp={key:0,class:"error-text"},_p={class:"step-actions"},dp={key:4,class:"wizard-step","data-tour":"wiz-login"},up={class:"step-body"},pp={key:0,class:"login-method-picker"},mp={class:"login-method-picker__hint"},Ep={class:"login-method-picker__options"},gp=["onClick"],Sp={class:"login-method-picker__title"},Tp={key:0,class:"login-method-picker__desc"},bp={key:1,class:"login-flow-switcher"},fp={class:"login-flow-switcher__options"},Rp=["disabled","title","onClick"],Cp={key:2,class:"login-status login-error"},Np={key:3,class:"login-status login-connecting"},hp={key:5,class:"login-status login-completed"},vp={class:"login-status login-error"},Op={class:"step-actions"},yp={key:5,class:"wizard-step","data-tour":"wiz-proxy"},Ap={class:"step-body"},Ip={key:0,class:"cliproxy-install-block"},Dp=["disabled"],Mp={key:0,class:"spinner-sm"},Lp={key:0},xp={key:0,class:"install-success-text"},kp={key:1},wp={key:0,class:"install-stderr"},Pp={key:1,class:"proxy-step-body"},Bp={key:1,class:"login-status login-started"},Up={key:2,class:"proxy-device-auth"},Fp={class:"proxy-url-badge"},Gp={key:0},Yp={key:1},Vp=["href"],qp={key:1,class:"proxy-device-code-card"},zp={class:"proxy-device-code-value"},Hp={key:2,class:"proxy-waiting","data-tour":"wiz-proxy-callback"},$p={key:3,class:"proxy-callback-section","data-tour":"wiz-proxy-callback"},Wp={class:"proxy-callback-row"},Kp=["disabled"],Qp={key:0,class:"error-text"},Xp={key:3,class:"login-status login-completed"},Zp={key:4,class:"proxy-skipped"},Jp={key:5,class:"proxy-error"},jp={class:"error-text"},em={key:2,class:"proxy-loading"},tm={class:"step-actions"},nm={key:6,class:"wizard-step","data-tour":"wiz-plan"},am={class:"step-body"},rm={class:"review-card","data-tour":"wiz-plan-review"},im={class:"review-row"},om={class:"review-label"},sm={class:"review-value"},lm={key:0,class:"review-row"},cm={class:"review-label"},_m={class:"review-value"},dm={key:1,class:"review-row"},um={class:"review-label"},pm={class:"review-value"},mm={key:0,class:"form-group"},Em={for:"wiz-plan"},gm={value:""},Sm=["value"],Tm={class:"form-group checkbox","data-tour":"wiz-plan-default"},bm={key:1,class:"error-text"},fm={class:"step-actions"},Rm=["disabled"],Cm={key:0,class:"spinner-sm"},Nm={key:7,class:"wizard-step","data-tour":"wiz-done"},hm={class:"step-body done-body"},vm={class:"done-actions"},Om=t.defineComponent({__name:"AccountWizard",props:{initialBackendKind:{},backendName:{},allowSkip:{type:Boolean},translate:{type:Function}},emits:["close","saved","skip","addAnother","done"],setup(n,{emit:e}){const a=(h,C)=>({"accountWizard.addAccount":"Add Account","accountWizard.stepSubscription":"Subscription","accountWizard.stepCliSetup":"CLI Setup","accountWizard.stepLogin":"Login","accountWizard.stepPlanSave":"Plan & Save","accountWizard.stepDone":"Done","accountWizard.phaseSetup":"Setup","accountWizard.phaseLogin":"Login","accountWizard.phaseFinish":"Finish","accountWizard.yesHaveAccount":"Yes, I have an account","accountWizard.yesHaveAccountDesc":"I already have a subscription for this backend","accountWizard.noSkip":"Skip for now","accountWizard.noSkipDesc":"I will set this up later","accountWizard.accountName":"Account name","accountWizard.accountNamePlaceholder":"e.g., Personal, Work","accountWizard.accountNameHint":"(optional — leave blank to use the default config directory)","accountWizard.copyForIncognito":"Copy for Incognito","accountWizard.copiedLabel":"Copied!","accountWizard.incognitoHint":"Press ⌘⇧N (Mac) or Ctrl+Shift+N (Windows/Linux) to open an incognito window, then paste the URL.","accountWizard.email":"Email","accountWizard.emailPlaceholder":"name@example.com","accountWizard.emailHelp":"Optional — used to tag the account","accountWizard.cliInstalled":"CLI detected","accountWizard.cliNotInstalled":"CLI not detected","accountWizard.noCliRequired":"No CLI required","accountWizard.installCli":"Install CLI","accountWizard.configPath":"Config path","accountWizard.createDir":"Create","accountWizard.creating":"Creating...","accountWizard.configCreated":"Created","accountWizard.customizePath":"Customize path","accountWizard.apiKeyEnv":"API key env var","accountWizard.startingLogin":"Starting login session...","accountWizard.loginCompleted":"Login completed","accountWizard.tryAgain":"Try again","accountWizard.connectionLost":"Connection lost","accountWizard.send":"Send","accountWizard.waitingForResponse":"Waiting for response...","accountWizard.plan":"Plan","accountWizard.selectPlan":"Select a plan","accountWizard.setDefault":"Set as default account","accountWizard.saving":"Saving...","accountWizard.saveAccount":"Save account","accountWizard.accountCreated":"Account created!","accountWizard.addAnother":"Add another","accountWizard.doneNextBackend":"Done","accountWizard.continueBtn":"Continue","common.cancel":"Cancel","common.back":"Back","common.skip":"Skip","accountWizard.tour.sub.yesno.title":"Do you have an account?","accountWizard.tour.sub.yesno.message":"Pick whether you already have an account on this backend.","accountWizard.tour.sub.name.title":"Name this account","accountWizard.tour.sub.name.message":'Type a label so you can tell accounts apart later (e.g. "Personal", "Work"). Optional — leave blank to use a default.',"accountWizard.tour.sub.email.title":"Account email","accountWizard.tour.sub.email.message":"Type the email tied to the account. We pass it as a login_hint on the sign-in page.","accountWizard.tour.sub.next.title":"Continue to CLI check","accountWizard.tour.sub.next.message":"Click Continue — we verify the CLI is installed and move to step 2.","accountWizard.tour.cli.status.title":"CLI install check","accountWizard.tour.cli.status.message":`Confirm the CLI is installed. If it isn't, the "Install" button will fetch it for you.`,"accountWizard.tour.cli.next.title":"Launch the CLI","accountWizard.tour.cli.next.message":"Click Continue — we launch the CLI behind the scenes and move to step 3 (Sign in).","accountWizard.tour.login.booting.title":"Starting the CLI — pick your account type","accountWizard.tour.login.booting.message":'The CLI is booting in the background. While it starts, decide which login type fits your account: Pro / Max / Team subscription → pick "subscription". API usage billing (sk-ant-… / sk-… key) → pick "API key". 3rd-party platform (Bedrock / Foundry / Vertex AI) → pick "3rd-party". A menu appears in a moment with these options.',"accountWizard.tour.login.pickMethod.title":"Pick how you sign in","accountWizard.tour.login.pickMethod.message":"Click the option that matches your account: option 1 = subscription (Pro / Max / Team), option 2 = API key billing, option 3 = 3rd-party platform. The browser will open right after.","accountWizard.tour.login.authorize.title":"Authorize in your browser","accountWizard.tour.login.authorize.message":"A browser tab has opened. Sign in with the email from step 1 and click Authorize. If the tab didn't open, click this URL.","accountWizard.tour.login.paste.title":"Paste the authorization code","accountWizard.tour.login.paste.message":"Copy the code from the redirect page and paste it here, then click Send. We verify it for ~5–10 s.","accountWizard.tour.proxy.install.title":"Install CLIProxyAPI","accountWizard.tour.proxy.install.message":"Click Install to set up CLIProxyAPI. It lets other tools reach this account through an OpenAI-compatible endpoint. Or click Skip below if you don't need it.","accountWizard.tour.proxy.start.title":"Register with the proxy","accountWizard.tour.proxy.start.message":"Click Start proxy registration to begin — a browser tab opens for the proxy OAuth. Don't need the proxy? Click Skip below to jump to step 5.","accountWizard.tour.proxy.callback.title":"Paste the callback URL","accountWizard.tour.proxy.callback.message":`Copy the full localhost callback URL from your browser's address bar and paste it here, then click Submit. The redirect page may show "connection refused" — that's expected.`,"accountWizard.tour.proxy.continue.title":"Proxy registered","accountWizard.tour.proxy.continue.message":"Registration succeeded. Click Continue below to move to step 5.","accountWizard.tour.plan.review.title":"Review","accountWizard.tour.plan.review.message":"Check the values you entered. If anything looks wrong, click Back to fix it.","accountWizard.tour.plan.pick.title":"Pick a plan","accountWizard.tour.plan.pick.message":"Pro, Max, or API. The CLI told us which subscription it found in step 3 — override here if needed.","accountWizard.tour.plan.default.title":"Make it the default? (optional)","accountWizard.tour.plan.default.message":"Tick to mark this account as the backend's default.","accountWizard.tour.plan.save.title":"Save the account","accountWizard.tour.plan.save.message":`Click Save to persist the account and move to the Done screen. Tip: tick "Set as default" above first if this should be the backend's default account.`,"accountWizard.tour.done.add.title":"Add another account?","accountWizard.tour.done.add.message":"Click here to add another account on the same backend (e.g. a second Claude account).","accountWizard.tour.done.nextBackend.title":"Move to the next backend","accountWizard.tour.done.nextBackend.message":"Click here to advance the tour to the next backend (Codex / Antigravity / OpenCode)."})[h]??h,r=n,i=(h,C)=>r.translate?r.translate(h,C):a(h),s=e,{client:o,emit:l}=et.useAiAccounts(),d=et.useBackendRegistry(),_=et.useLoginSession(),c=t.ref(r.initialBackendKind??""),u=t.computed(()=>c.value?d.get(c.value):void 0),m=t.computed(()=>{var h;return r.backendName||((h=u.value)==null?void 0:h.display_name)||c.value||"Backend"}),p=t.inject("setTourTarget",()=>{}),E=t.inject("setTourGuide",()=>{}),T=t.inject("setTourTitle",()=>{}),f=t.ref("subscription"),O=["claude","codex","antigravity","kimi"],N=t.computed(()=>O.includes(c.value??"")),b=t.computed(()=>{const h=["subscription","cli","login"];return N.value&&h.push("proxy"),h.push("plan"),h}),S={subscription:"setup",cli:"setup",login:"login",proxy:"login",plan:"finish",done:"finish"},v=["setup","login","finish"],A=t.computed(()=>({setup:i("accountWizard.phaseSetup"),login:i("accountWizard.phaseLogin"),finish:i("accountWizard.phaseFinish")})),B=t.computed(()=>S[f.value]),x=t.computed(()=>v.indexOf(B.value));function k(){const h=b.value,C=h.indexOf(f.value);C>=0&&C<h.length-1?f.value=h[C+1]:f.value===h[h.length-1]&&(f.value="done")}function M(){const h=b.value,C=h.indexOf(f.value);C>0&&(f.value=h[C-1])}const I=t.ref(""),H=t.ref(""),Z=t.ref(""),me=t.computed(()=>I.value!=="");function re(){if(I.value==="no"){F();return}k()}const y=t.ref(""),P=t.ref(!1);function Y(h){return h.toLowerCase().replace(/\s+/g,"").replace(/[^a-z0-9]/g,"")}const Q={claude:".claude",codex:".codex",antigravity:".antigravity",opencode:".opencode",openrouter:".openrouter",openai_compat:".openai_compat",kimi:".kimi",goose:".config/goose"};function ae(h){const C=h||"";return`~/${Q[C]||(C?`.${C}`:".backend")}`}function $(){if(P.value)return;const h=H.value.trim();if(!h){y.value=ae(c.value);return}const C=Y(h),L=Q[c.value||""]||(c.value?`.${c.value}`:".backend");y.value=`~/${L}-${C}`}function Se(h){const C=H.value.trim();return C||h&&h.trim()||"default"}t.computed(()=>{const h=H.value.trim();if(!h)return"";const C={claude:"ANTHROPIC",codex:"OPENAI",antigravity:"GOOGLE",opencode:"OPENCODE",openrouter:"OPENROUTER",openai_compat:"OPENAI",kimi:"KIMI",deepseek:"DEEPSEEK"},L=c.value||"",ne=C[L]||(L?L.toUpperCase():"BACKEND"),Me=Y(h).replace(/-/g,"_").toUpperCase();return`${ne}_API_KEY_${Me}`});const te=["openrouter","openai_compat","antigravity","kimi","deepseek"],le=t.computed(()=>te.includes(c.value??"")),V=t.ref(!1),de=t.ref(""),ee=t.ref(!1),K=t.ref(!1),ce=t.ref(""),ue=t.ref("");async function Te(){if(c.value){ee.value=!0;try{const h=d.get(c.value);V.value=!!h,de.value=""}catch(h){console.warn("[AccountWizard] CLI check failed:",h)}finally{ee.value=!1}}}const pe=t.ref(null);async function be(){if(c.value){K.value=!0,ue.value="",pe.value=null;try{const h=await o.installBackendCli(c.value);pe.value=h,h.success?(V.value=!0,de.value=""):ue.value=h.stderr||h.stdout||"Installation failed"}catch(h){ue.value=h instanceof Error?h.message:String(h),pe.value={kind:c.value,success:!1,display:"install failed",stdout:"",stderr:ue.value,exit_code:-1,binary_path:null}}finally{K.value=!1}}}const Oe=t.ref(0),fe=t.computed(()=>typeof navigator>"u"?!1:/Mac|iPhone|iPad|iPod/i.test(navigator.platform||"")),Ze=t.computed(()=>c.value==="claude"&&fe.value&&Oe.value>=1);async function He(){try{const h=await o.listBackends();Oe.value=(h.items||[]).filter(C=>C.kind==="claude").length}catch{Oe.value=0}}t.onMounted(async()=>{d.loaded.value||await d.load(),Te(),$(),l({type:"wizard.opened",backendKind:c.value}),xt(),He(),t.nextTick().then(()=>{W.value||(j.value?ht(j.value):(p(`[data-tour="wiz-${f.value}"]`),E(null),T(null)))})}),t.watch(c,()=>{P.value||$()}),t.watch(y,()=>{ce.value=""});const G=t.ref("");t.watch(f,async h=>{if(f.value==="login"&&_.status.value==="idle"){const C=u.value;if(C&&C.login_flows.length>1&&ie.value===null)return;await J()}},{immediate:!0});const xe=t.ref(null),ie=t.ref(null);async function J(){const h=u.value;if(!h){xe.value="Cannot start login: backend metadata is not loaded yet. Refresh the page and try again.";return}xe.value=null;try{if(!G.value){const L=await o.createBackend({kind:h.kind,display_name:Se(h.display_name),config:U()});G.value=L.id}const C=ie.value??$e(h);l({type:"wizard.step",backendKind:h.kind,step:"login.start"}),await _.start(G.value,C,w(h))}catch(C){const L=C instanceof Error?C.message:String(C);console.warn("[AccountWizard] login failed:",C),xe.value=`Could not start the login flow: ${L}. Check that the sidecar is running on :20001 and that the ${h.kind} backend metadata is reachable.`}}function $e(h){const C=h.login_flows.map(L=>L.kind);return C.includes("cli_browser")?"cli_browser":C.includes("oauth_device")?"oauth_device":"api_key"}const ke=t.computed(()=>ie.value??(u.value?$e(u.value):"cli_browser")),Ge=t.computed(()=>{var h;return(((h=u.value)==null?void 0:h.login_flows.length)??0)>1});async function ye(h){if(!(ie.value!==null&&h===ke.value)){try{await _.cancel()}catch{}_.reset(),ie.value=h,z.value=!1,await J()}}function w(h){return{}}function U(){return{email:Z.value.trim()||void 0,config_path:y.value.trim()||void 0}}const z=t.ref(!1),W=t.ref(!1);t.watch(f,()=>{z.value=!1}),t.watch(()=>_.status.value,h=>{if(h==="running"){f.value==="login"&&(z.value=!0);return}h==="complete"&&f.value==="login"&&z.value&&(z.value=!1,k())}),t.onBeforeUnmount(()=>{W.value=!0}),t.onUnmounted(()=>{E(null),p(null),T(null),_.status.value==="running"&&_.cancel().catch(()=>{}),Ye()});const oe=t.computed(()=>{switch(_.status.value){case"running":return _.urlPrompt.value||_.textPrompt.value||_.menuPrompt.value||_.stdoutLines.value.length>0?"streaming":"connecting";case"complete":return"completed";case"failed":case"cancelled":return"error";default:return"idle"}}),Ae=t.computed(()=>_.errorMessage.value||"");function lt(){_.status.value==="running"&&_.cancel().catch(()=>{})}const We=t.computed(()=>{var h;return((h=u.value)==null?void 0:h.plan_options)??[]}),Ke=t.ref(""),Ie=t.ref(!1),Pe=t.ref(!1),nt=t.ref(""),ct={subscription:[{selector:'[data-tour="wiz-sub-yesno"]',titleKey:"accountWizard.tour.sub.yesno.title",messageKey:"accountWizard.tour.sub.yesno.message",done:()=>I.value!==""},{selector:"#wiz-name",titleKey:"accountWizard.tour.sub.name.title",messageKey:"accountWizard.tour.sub.name.message",done:()=>I.value==="no"||H.value.trim().length>0},{selector:"#wiz-email",titleKey:"accountWizard.tour.sub.email.title",messageKey:"accountWizard.tour.sub.email.message",done:()=>I.value==="no"||/.+@.+/.test(Z.value)},{selector:'[data-tour="wiz-sub-next"]',titleKey:"accountWizard.tour.sub.next.title",messageKey:"accountWizard.tour.sub.next.message"}],cli:[{selector:'[data-tour="wiz-cli-status"]',titleKey:"accountWizard.tour.cli.status.title",messageKey:"accountWizard.tour.cli.status.message",done:()=>V.value},{selector:'[data-tour="wiz-cli-next"]',titleKey:"accountWizard.tour.cli.next.title",messageKey:"accountWizard.tour.cli.next.message"}],login:[{selector:'[data-tour="wiz-login-stream"]',titleKey:"accountWizard.tour.login.booting.title",messageKey:"accountWizard.tour.login.booting.message",done:()=>!!_.menuPrompt.value||!!_.urlPrompt.value},{selector:'[data-tour="wiz-login-stream"]',titleKey:"accountWizard.tour.login.pickMethod.title",messageKey:"accountWizard.tour.login.pickMethod.message",done:()=>!!_.urlPrompt.value},{selector:'[data-tour="wiz-login-url"]',titleKey:"accountWizard.tour.login.authorize.title",messageKey:"accountWizard.tour.login.authorize.message",done:()=>!!_.textPrompt.value||Xe.value},{selector:'[data-tour="wiz-login-paste"]',titleKey:"accountWizard.tour.login.paste.title",messageKey:"accountWizard.tour.login.paste.message"}],proxy:[{selector:'[data-tour="wiz-proxy-install"]',titleKey:"accountWizard.tour.proxy.install.title",messageKey:"accountWizard.tour.proxy.install.message",done:()=>qe.value&&dt.value},{selector:'[data-tour="wiz-proxy-start"]',titleKey:"accountWizard.tour.proxy.start.title",messageKey:"accountWizard.tour.proxy.start.message",done:()=>Ee.value!=="idle"},{selector:'[data-tour="wiz-proxy-callback"]',titleKey:"accountWizard.tour.proxy.callback.title",messageKey:"accountWizard.tour.proxy.callback.message",done:()=>Ee.value==="success"||Ee.value==="skipped"||Ee.value==="error"},{selector:'[data-tour="wiz-proxy-skip"]',titleKey:"accountWizard.tour.proxy.continue.title",messageKey:"accountWizard.tour.proxy.continue.message",done:()=>!1}],plan:[{selector:"#wiz-plan",titleKey:"accountWizard.tour.plan.pick.title",messageKey:"accountWizard.tour.plan.pick.message",done:()=>We.value.length===0||Ke.value!==""},{selector:'[data-tour="wiz-plan-save"]',titleKey:"accountWizard.tour.plan.save.title",messageKey:"accountWizard.tour.plan.save.message"}],done:[{selector:'[data-tour="wiz-done-add"]',titleKey:"accountWizard.tour.done.add.title",messageKey:"accountWizard.tour.done.add.message"},{selector:'[data-tour="wiz-done-next-backend"]',titleKey:"accountWizard.tour.done.nextBackend.title",messageKey:"accountWizard.tour.done.nextBackend.message"}]},Qe=t.ref(0),j=t.computed(()=>{var L,ne;const h=ct[f.value]??[];let C=Qe.value;for(;C<h.length-1&&((ne=(L=h[C])==null?void 0:L.done)==null?void 0:ne.call(L))===!0;)C++;return h[C]??null}),Xe=t.ref(!1);let Je=!1;function at(){typeof document>"u"||(document.visibilityState==="hidden"?Je=!0:document.visibilityState==="visible"&&Je&&(f.value==="login"&&_.urlPrompt.value&&(Xe.value=!0),Je=!1))}typeof document<"u"&&document.addEventListener("visibilitychange",at),t.onUnmounted(()=>{typeof document<"u"&&document.removeEventListener("visibilitychange",at)}),t.watch(()=>{var h,C;return((C=(h=j.value)==null?void 0:h.done)==null?void 0:C.call(h))??!1},h=>{var L,ne;if(!h)return;const C=ct[f.value]??[];for(;Qe.value<C.length-1&&((ne=(L=C[Qe.value])==null?void 0:L.done)==null?void 0:ne.call(L))===!0;)Qe.value++});const Tt=t.ref(!1);t.watch(f,()=>{Tt.value=!0},{flush:"sync"});async function ht(h){if(W.value)return;if(!h){p(`[data-tour="wiz-${f.value}"]`),E(null),T(null);return}const C=h;let L=null;for(let ne=0;ne<20;ne++){if(W.value||j.value!==C)return;if(L=typeof document<"u"?document.querySelector(h.selector):null,L&&L.getBoundingClientRect().width>0)break;await new Promise(Me=>setTimeout(Me,50))}W.value||j.value!==C||(p(L?h.selector:`[data-tour="wiz-${f.value}"]`),E(i(h.messageKey)),T(h.titleKey?i(h.titleKey):null))}t.watch(j,h=>{Tt.value||ht(h)});async function Re(h){const C=`[data-tour="wiz-${h}"]`;for(let L=0;L<60;L++){if(W.value||typeof document<"u"&&document.querySelector(C))return;await new Promise(ne=>setTimeout(ne,50))}}t.watch(f,async h=>{var L,ne;if(W.value||(Tt.value=!0,p('[data-tour="account-wizard"]'),E(null),T(null),Qe.value=0,Xe.value=!1,await Re(h),W.value||f.value!==h)||(await t.nextTick(),W.value||f.value!==h))return;Tt.value=!1;const C=ct[h]??[];for(;Qe.value<C.length-1&&((ne=(L=C[Qe.value])==null?void 0:L.done)==null?void 0:ne.call(L))===!0;)Qe.value++;ht(j.value)});const Ee=t.ref("idle"),we=t.ref(""),mt=t.ref(""),rt=t.ref(""),_t=t.ref(""),it=t.ref(""),Et=t.ref(null);let De=null;function Ye(){De!==null&&(clearInterval(De),De=null)}function Lt(){if(Ye(),!Et.value)return;const h=Et.value;De=setInterval(async()=>{try{const C=await o.cliproxyLoginStatus(h);C.state==="completed"?(Ee.value="success",we.value=C.message||"API proxy login completed",Ye()):(C.state==="failed"||C.state==="timeout")&&(Ee.value="error",we.value=C.message,Ye())}catch(C){console.warn("[AccountWizard] cliproxy login status poll failed:",C)}},2e3)}const dt=t.ref(!1),ut=t.ref(!1),Ve=t.ref(null),qe=t.ref(!1);async function xt(){try{const h=await o.cliproxyStatus();dt.value=h.installed}catch(h){console.warn("[AccountWizard] cliproxy status check failed:",h),dt.value=!1}finally{qe.value=!0}}async function kt(){ut.value=!0,Ve.value=null;try{const h=await o.cliproxyInstall();Ve.value=h,h.success&&(dt.value=!0)}catch(h){Ve.value={success:!1,display:"install failed",stdout:"",stderr:h instanceof Error?h.message:String(h),binary_path:null}}finally{ut.value=!1}}function vt(){Ye(),Ee.value="idle",we.value="",mt.value="",rt.value="",_t.value="",it.value="",Et.value=null}async function wt(){var h;if(c.value){Ee.value="running",we.value=`Registering ${m.value} account with API proxy…`,it.value="";try{const C=await o.cliproxyLoginBegin(c.value,((h=y.value)==null?void 0:h.trim())||void 0);we.value=C.message,C.status==="imported"?Ee.value="success":C.status==="started"&&C.oauth_url?(Ee.value="device_auth",mt.value=C.oauth_url,rt.value=C.device_code??"",Et.value=C.session_id??null,window.open(C.oauth_url,"_blank","noopener"),C.device_code?we.value=`Open the URL and enter code ${C.device_code}. We'll detect completion automatically.`:we.value="Complete OAuth in the browser; paste the callback URL below if it fails to redirect",Et.value&&Lt()):C.status==="skipped"?Ee.value="skipped":Ee.value="error"}catch(C){Ee.value="error",we.value=C instanceof Error?C.message:String(C)}}}async function Pt(){if(_t.value.trim()){it.value="";try{const h=await o.cliproxyCallbackForward(_t.value.trim());h.status==="completed"?(Ee.value="success",we.value="API proxy login completed"):it.value=h.message}catch(h){it.value=h instanceof Error?h.message:String(h)}}}async function Bt(){Pe.value=!0,nt.value="";try{const h=u.value;if(!h)throw new Error("No backend metadata available");const C={...U(),plan:Ke.value||void 0,is_default:Ie.value};if(G.value)await o.updateBackend(G.value,{display_name:Se(h.display_name),config:C});else{const L=await o.createBackend({kind:h.kind,display_name:Se(h.display_name),config:C});G.value=L.id}f.value="done",s("saved"),l({type:"wizard.account.created",backendKind:h.kind,accountId:G.value}),l({type:"wizard.step",backendKind:h.kind,step:"done"})}catch(h){nt.value=h instanceof Error?h.message:"Failed to save account"}finally{Pe.value=!1}}function q(){I.value="",H.value="",Z.value="",y.value="",P.value=!1,Ke.value="",Ie.value=!1,lt(),_.reset(),vt(),G.value="",ce.value="",z.value=!1,f.value="subscription",$(),s("addAnother"),c.value&&l({type:"wizard.step",backendKind:c.value,step:"add-another"})}function g(){c.value&&l({type:"wizard.closed",backendKind:c.value,reason:"cancel"}),s("close")}function D(){c.value&&l({type:"wizard.closed",backendKind:c.value,reason:"done"}),s("done",{accountId:G.value})}function F(){c.value&&l({type:"wizard.closed",backendKind:c.value,reason:"skip"}),s("skip")}return(h,C)=>(t.openBlock(),t.createElementBlock("div",_u,[t.createElementVNode("div",du,[t.createElementVNode("h3",null,t.toDisplayString(i("accountWizard.addAccount")),1),t.createElementVNode("button",{class:"wizard-close",onClick:g},"×")]),c.value?f.value!=="done"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[Ze.value?(t.openBlock(),t.createElementBlock("div",Eu,[C[12]||(C[12]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"18",height:"18","aria-hidden":"true"},[t.createElementVNode("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"}),t.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),t.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})],-1)),t.createElementVNode("div",null,[C[11]||(C[11]=t.createElementVNode("strong",null,"macOS Keychain limitation:",-1)),t.createTextVNode(" Claude CLI on macOS stores its credential in a single shared Keychain entry, so logging in here will replace your existing Claude credential ("+t.toDisplayString(Oe.value)+" account"+t.toDisplayString(Oe.value===1?"":"s")+' registered). The previous account row will appear "ready" but actually point at this new login. ',1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",gu,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(v,(L,ne)=>t.createElementVNode("div",{key:L,class:t.normalizeClass(["step-indicator",{active:B.value===L,completed:x.value>ne}])},[t.createElementVNode("span",Su,[x.value>ne?(t.openBlock(),t.createElementBlock("svg",Tu,[...C[13]||(C[13]=[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(ne+1),1)],64))]),t.createElementVNode("span",bu,t.toDisplayString(A.value[L]),1)],2)),64))])],64)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",uu,[t.createElementVNode("div",pu,[C[10]||(C[10]=t.createElementVNode("p",{class:"step-question"},"Select a backend to connect:",-1)),t.createVNode(L_,{onPick:C[0]||(C[0]=L=>{c.value=L,Te()})})]),t.createElementVNode("div",mu,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:g},t.toDisplayString(i("common.cancel")),1)])])),c.value&&f.value==="subscription"?(t.openBlock(),t.createElementBlock("div",fu,[t.createElementVNode("div",Ru,[t.createElementVNode("p",Cu,"Do you already have a "+t.toDisplayString(m.value)+" account?",1),t.createElementVNode("div",Nu,[t.createElementVNode("label",{class:t.normalizeClass(["radio-card",{selected:I.value==="yes"}])},[t.withDirectives(t.createElementVNode("input",{type:"radio","onUpdate:modelValue":C[1]||(C[1]=L=>I.value=L),value:"yes"},null,512),[[t.vModelRadio,I.value]]),t.createElementVNode("div",hu,[t.createElementVNode("span",vu,t.toDisplayString(i("accountWizard.yesHaveAccount")),1),t.createElementVNode("span",Ou,t.toDisplayString(i("accountWizard.yesHaveAccountDesc")),1)])],2),t.createElementVNode("label",{class:t.normalizeClass(["radio-card",{selected:I.value==="no"}])},[t.withDirectives(t.createElementVNode("input",{type:"radio","onUpdate:modelValue":C[2]||(C[2]=L=>I.value=L),value:"no"},null,512),[[t.vModelRadio,I.value]]),t.createElementVNode("div",yu,[t.createElementVNode("span",Au,t.toDisplayString(i("accountWizard.noSkip")),1),t.createElementVNode("span",Iu,t.toDisplayString(i("accountWizard.noSkipDesc")),1)])],2)]),t.createVNode(t.Transition,{name:"slide-down"},{default:t.withCtx(()=>[I.value==="yes"?(t.openBlock(),t.createElementBlock("div",Du,[t.createElementVNode("div",Mu,[t.createElementVNode("label",Lu,[t.createTextVNode(t.toDisplayString(i("accountWizard.accountName"))+" ",1),C[14]||(C[14]=t.createElementVNode("span",{class:"optional"},"(optional)",-1))]),t.withDirectives(t.createElementVNode("input",{id:"wiz-name","onUpdate:modelValue":C[3]||(C[3]=L=>H.value=L),type:"text",placeholder:i("accountWizard.accountNamePlaceholder"),autofocus:"",onInput:$},null,40,xu),[[t.vModelText,H.value]]),t.createElementVNode("small",ku,t.toDisplayString(i("accountWizard.accountNameHint")),1)]),t.createElementVNode("div",wu,[t.createElementVNode("label",Pu,t.toDisplayString(i("accountWizard.email")),1),t.withDirectives(t.createElementVNode("input",{id:"wiz-email","onUpdate:modelValue":C[4]||(C[4]=L=>Z.value=L),type:"email",placeholder:i("accountWizard.emailPlaceholder")},null,8,Bu),[[t.vModelText,Z.value]]),t.createElementVNode("small",null,t.toDisplayString(i("accountWizard.emailHelp")),1)])])):t.createCommentVNode("",!0)]),_:1})]),t.createElementVNode("div",Uu,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:g},t.toDisplayString(i("common.cancel")),1),t.createElementVNode("button",{class:t.normalizeClass(["btn",I.value==="no"?"btn-outline":"btn-primary"]),disabled:!me.value,"data-tour":"wiz-sub-next",onClick:re},[t.createTextVNode(t.toDisplayString(I.value==="no"?i("accountWizard.noSkip"):i("accountWizard.continueBtn"))+" ",1),C[15]||(C[15]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))],10,Fu)])])):t.createCommentVNode("",!0),c.value&&f.value==="cli"?(t.openBlock(),t.createElementBlock("div",Gu,[t.createElementVNode("div",Yu,[le.value?(t.openBlock(),t.createElementBlock("div",Vu,[C[16]||(C[16]=t.createElementVNode("div",{class:"status-icon"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},[t.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),t.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"})])],-1)),t.createElementVNode("div",qu,[t.createElementVNode("span",zu,t.toDisplayString(m.value),1),t.createElementVNode("span",Hu,t.toDisplayString(i("accountWizard.noCliRequired")),1)])])):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["status-card",V.value?"status-ok":"status-warn"]),"data-tour":"wiz-cli-status"},[t.createElementVNode("div",$u,[ee.value?(t.openBlock(),t.createElementBlock("div",Wu)):V.value?(t.openBlock(),t.createElementBlock("svg",Ku,[...C[17]||(C[17]=[t.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},null,-1),t.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",Qu,[...C[18]||(C[18]=[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),t.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"12"},null,-1),t.createElementVNode("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"},null,-1)])]))]),t.createElementVNode("div",Xu,[t.createElementVNode("span",Zu,t.toDisplayString(m.value)+" CLI",1),V.value?(t.openBlock(),t.createElementBlock("span",Ju,t.toDisplayString(i("accountWizard.cliInstalled"))+t.toDisplayString(de.value?` (${de.value})`:""),1)):(t.openBlock(),t.createElementBlock("span",ju,t.toDisplayString(i("accountWizard.cliNotInstalled")),1))]),!V.value&&!K.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"btn btn-primary btn-sm",onClick:be},t.toDisplayString(i("accountWizard.installCli")),1)):t.createCommentVNode("",!0),K.value?(t.openBlock(),t.createElementBlock("div",ep)):t.createCommentVNode("",!0)],2)),ue.value?(t.openBlock(),t.createElementBlock("div",tp,t.toDisplayString(ue.value),1)):t.createCommentVNode("",!0),pe.value&&pe.value.success?(t.openBlock(),t.createElementBlock("div",np," Installed"+t.toDisplayString(pe.value.binary_path?` at ${pe.value.binary_path}`:""),1)):t.createCommentVNode("",!0),pe.value&&!pe.value.success&&pe.value.stderr?(t.openBlock(),t.createElementBlock("pre",ap,t.toDisplayString(pe.value.stderr),1)):t.createCommentVNode("",!0),y.value?(t.openBlock(),t.createElementBlock("details",rp,[t.createElementVNode("summary",null,t.toDisplayString(i("accountWizard.customizePath")),1),t.createElementVNode("div",ip,[t.createElementVNode("div",op,t.toDisplayString(i("accountWizard.configPath")),1),t.createElementVNode("div",sp,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":C[5]||(C[5]=L=>y.value=L),type:"text",placeholder:`e.g., ~/.${c.value}-personal`,onInput:C[6]||(C[6]=L=>P.value=!0)},null,40,lp),[[t.vModelText,y.value]])]),ce.value?(t.openBlock(),t.createElementBlock("div",cp,t.toDisplayString(ce.value),1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),t.createElementVNode("div",_p,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[19]||(C[19]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-cli-next",onClick:k},[t.createTextVNode(t.toDisplayString(i("accountWizard.continueBtn"))+" ",1),C[20]||(C[20]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):t.createCommentVNode("",!0),c.value&&f.value==="login"?(t.openBlock(),t.createElementBlock("div",dp,[t.createElementVNode("div",up,[Ge.value&&u.value&&ie.value===null&&oe.value==="idle"?(t.openBlock(),t.createElementBlock("div",pp,[C[21]||(C[21]=t.createElementVNode("h4",{class:"login-method-picker__heading"},"Choose a login method",-1)),t.createElementVNode("p",mp," Pick how you want to authenticate "+t.toDisplayString(m.value)+". You can switch later if your first choice doesn't work. ",1),t.createElementVNode("div",Ep,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value.login_flows,L=>(t.openBlock(),t.createElementBlock("button",{key:L.kind,type:"button",class:"login-method-picker__btn",onClick:ne=>ye(L.kind)},[t.createElementVNode("strong",Sp,t.toDisplayString(L.display_name),1),L.description?(t.openBlock(),t.createElementBlock("span",Tp,t.toDisplayString(L.description),1)):t.createCommentVNode("",!0)],8,gp))),128))])])):t.createCommentVNode("",!0),Ge.value&&u.value&&(ie.value!==null||oe.value!=="idle")?(t.openBlock(),t.createElementBlock("div",bp,[C[22]||(C[22]=t.createElementVNode("span",{class:"login-flow-switcher__label"},"Login method:",-1)),t.createElementVNode("div",fp,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value.login_flows,L=>(t.openBlock(),t.createElementBlock("button",{key:L.kind,type:"button",class:t.normalizeClass(["login-flow-switcher__btn",{"login-flow-switcher__btn--active":ke.value===L.kind}]),disabled:oe.value==="completed",title:L.description,onClick:ne=>ye(L.kind)},t.toDisplayString(L.display_name),11,Rp))),128))])])):t.createCommentVNode("",!0),xe.value?(t.openBlock(),t.createElementBlock("div",Cp,[C[23]||(C[23]=t.createElementVNode("strong",null,"Login could not start.",-1)),t.createElementVNode("p",null,t.toDisplayString(xe.value),1),t.createElementVNode("button",{class:"btn btn-secondary",onClick:J}," Retry ")])):(oe.value==="idle"||oe.value==="connecting")&&!(Ge.value&&ie.value===null)?(t.openBlock(),t.createElementBlock("div",Np,[C[24]||(C[24]=t.createElementVNode("div",{class:"spinner-sm"},null,-1)),t.createElementVNode("span",null,t.toDisplayString(i("accountWizard.startingLogin")),1)])):oe.value==="streaming"?(t.openBlock(),t.createBlock(no,{key:4,session:t.unref(_),"backend-kind":c.value,email:Z.value},null,8,["session","backend-kind","email"])):oe.value==="completed"?(t.openBlock(),t.createElementBlock("div",hp,[C[25]||(C[25]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),t.createElementVNode("span",null,t.toDisplayString(i("accountWizard.loginCompleted")),1)])):oe.value==="error"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[t.createElementVNode("div",vp,[C[26]||(C[26]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),t.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),t.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),t.createElementVNode("span",null,t.toDisplayString(Ae.value),1)]),t.createElementVNode("button",{class:"btn btn-secondary",style:{"margin-top":"12px"},onClick:J},t.toDisplayString(i("accountWizard.tryAgain")),1)],64)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Op,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[27]||(C[27]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary",onClick:k},[t.createTextVNode(t.toDisplayString(oe.value==="idle"?i("common.skip"):i("accountWizard.continueBtn"))+" ",1),C[28]||(C[28]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):t.createCommentVNode("",!0),c.value&&f.value==="proxy"?(t.openBlock(),t.createElementBlock("div",yp,[t.createElementVNode("div",Ap,[qe.value&&!dt.value?(t.openBlock(),t.createElementBlock("div",Ip,[C[30]||(C[30]=t.createElementVNode("p",{class:"step-description"}," CLIProxyAPI is not installed. Install it to expose this account through an OpenAI-compatible endpoint for other tools. ",-1)),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-proxy-install",disabled:ut.value,onClick:kt},[ut.value?(t.openBlock(),t.createElementBlock("div",Mp)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(ut.value?"Installing cliproxyapi…":"Install CLIProxyAPI"),1)],8,Dp),Ve.value?(t.openBlock(),t.createElementBlock("div",Lp,[Ve.value.success?(t.openBlock(),t.createElementBlock("p",xp," Installed"+t.toDisplayString(Ve.value.binary_path?` at ${Ve.value.binary_path}`:""),1)):(t.openBlock(),t.createElementBlock("div",kp,[C[29]||(C[29]=t.createElementVNode("p",{class:"error-text"},"Install failed",-1)),Ve.value.stderr?(t.openBlock(),t.createElementBlock("pre",wp,t.toDisplayString(Ve.value.stderr),1)):t.createCommentVNode("",!0)]))])):t.createCommentVNode("",!0)])):dt.value?(t.openBlock(),t.createElementBlock("div",Pp,[C[39]||(C[39]=t.createElementVNode("h4",{class:"proxy-heading"},"Register with API proxy",-1)),C[40]||(C[40]=t.createElementVNode("p",{class:"step-description"}," Optional: register this account with CLIProxyAPI so other tools can reach it through an OpenAI-compatible endpoint. ",-1)),Ee.value==="idle"?(t.openBlock(),t.createElementBlock("button",{key:0,class:"btn btn-primary","data-tour":"wiz-proxy-start",onClick:wt}," Start proxy registration ")):t.createCommentVNode("",!0),Ee.value==="running"?(t.openBlock(),t.createElementBlock("div",Bp,[C[31]||(C[31]=t.createElementVNode("div",{class:"spinner-sm"},null,-1)),t.createElementVNode("span",null,t.toDisplayString(we.value),1)])):t.createCommentVNode("",!0),Ee.value==="device_auth"?(t.openBlock(),t.createElementBlock("div",Up,[t.createElementVNode("div",Fp,[C[33]||(C[33]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),t.createElementVNode("polyline",{points:"15 3 21 3 21 9"}),t.createElementVNode("line",{x1:"10",y1:"14",x2:"21",y2:"3"})],-1)),rt.value?(t.openBlock(),t.createElementBlock("span",Gp," Open the URL below, sign in, and enter the device code. We'll detect completion automatically. ")):(t.openBlock(),t.createElementBlock("span",Yp,[...C[32]||(C[32]=[t.createTextVNode(" A browser window should have opened. Sign in, then the page will redirect to ",-1),t.createElementVNode("code",null,"localhost",-1),t.createTextVNode(" — that redirect will fail (this is normal). Copy the full URL from the browser address bar and paste it below. ",-1)])]))]),mt.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:mt.value,target:"_blank",rel:"noopener",class:"proxy-oauth-link"},t.toDisplayString(mt.value),9,Vp)):t.createCommentVNode("",!0),rt.value?(t.openBlock(),t.createElementBlock("div",qp,[C[34]||(C[34]=t.createElementVNode("span",{class:"proxy-device-code-label"},"Your device code:",-1)),t.createElementVNode("code",zp,t.toDisplayString(rt.value),1)])):t.createCommentVNode("",!0),rt.value?(t.openBlock(),t.createElementBlock("div",Hp,[...C[35]||(C[35]=[t.createElementVNode("div",{class:"spinner-sm"},null,-1),t.createElementVNode("span",null,"Waiting for you to enter the code…",-1)])])):(t.openBlock(),t.createElementBlock("div",$p,[C[36]||(C[36]=t.createElementVNode("p",{class:"proxy-callback-hint"},"If the redirect to localhost fails, paste the callback URL:",-1)),t.createElementVNode("div",Wp,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":C[7]||(C[7]=L=>_t.value=L),class:"proxy-callback-input",type:"url",placeholder:"http://localhost:54545/callback?code=..."},null,512),[[t.vModelText,_t.value]]),t.createElementVNode("button",{class:"btn btn-primary btn-sm",onClick:Pt,disabled:!_t.value.trim()}," Submit ",8,Kp)]),it.value?(t.openBlock(),t.createElementBlock("p",Qp,t.toDisplayString(it.value),1)):t.createCommentVNode("",!0)]))])):t.createCommentVNode("",!0),Ee.value==="success"?(t.openBlock(),t.createElementBlock("div",Xp,[C[37]||(C[37]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),t.createElementVNode("span",null,t.toDisplayString(we.value||"Registered successfully"),1)])):t.createCommentVNode("",!0),Ee.value==="skipped"?(t.openBlock(),t.createElementBlock("div",Zp,[t.createElementVNode("p",null,t.toDisplayString(we.value),1),t.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:vt},"Retry")])):t.createCommentVNode("",!0),Ee.value==="error"?(t.openBlock(),t.createElementBlock("div",Jp,[t.createElementVNode("p",jp,[C[38]||(C[38]=t.createElementVNode("strong",null,"Error:",-1)),t.createTextVNode(" "+t.toDisplayString(we.value),1)]),t.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:vt},"Retry")])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",em,[...C[41]||(C[41]=[t.createElementVNode("div",{class:"spinner-sm"},null,-1),t.createElementVNode("span",null,"Checking CLIProxyAPI status…",-1)])]))]),t.createElementVNode("div",tm,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[42]||(C[42]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-proxy-skip",onClick:k},[t.createTextVNode(t.toDisplayString(Ee.value==="success"?i("accountWizard.continueBtn"):i("common.skip"))+" ",1),C[43]||(C[43]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):t.createCommentVNode("",!0),c.value&&f.value==="plan"?(t.openBlock(),t.createElementBlock("div",nm,[t.createElementVNode("div",am,[t.createElementVNode("div",rm,[t.createElementVNode("div",im,[t.createElementVNode("span",om,t.toDisplayString(i("accountWizard.accountName")),1),t.createElementVNode("span",sm,t.toDisplayString(H.value),1)]),Z.value?(t.openBlock(),t.createElementBlock("div",lm,[t.createElementVNode("span",cm,t.toDisplayString(i("accountWizard.email")),1),t.createElementVNode("span",_m,t.toDisplayString(Z.value),1)])):t.createCommentVNode("",!0),y.value?(t.openBlock(),t.createElementBlock("div",dm,[t.createElementVNode("span",um,t.toDisplayString(i("accountWizard.configPath")),1),t.createElementVNode("code",pm,t.toDisplayString(y.value),1)])):t.createCommentVNode("",!0)]),We.value.length>0?(t.openBlock(),t.createElementBlock("div",mm,[t.createElementVNode("label",Em,t.toDisplayString(i("accountWizard.plan")),1),t.withDirectives(t.createElementVNode("select",{id:"wiz-plan","onUpdate:modelValue":C[8]||(C[8]=L=>Ke.value=L)},[t.createElementVNode("option",gm,t.toDisplayString(i("accountWizard.selectPlan")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(We.value,L=>(t.openBlock(),t.createElementBlock("option",{key:L.id,value:L.id},t.toDisplayString(L.label),9,Sm))),128))],512),[[t.vModelSelect,Ke.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Tm,[t.createElementVNode("label",null,[t.withDirectives(t.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":C[9]||(C[9]=L=>Ie.value=L)},null,512),[[t.vModelCheckbox,Ie.value]]),t.createTextVNode(" "+t.toDisplayString(i("accountWizard.setDefault")),1)])]),nt.value?(t.openBlock(),t.createElementBlock("div",bm,t.toDisplayString(nt.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",fm,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[44]||(C[44]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-plan-save",disabled:Pe.value,onClick:Bt},[Pe.value?(t.openBlock(),t.createElementBlock("div",Cm)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(Pe.value?i("accountWizard.saving"):i("accountWizard.saveAccount")),1)],8,Rm)])])):t.createCommentVNode("",!0),c.value&&f.value==="done"?(t.openBlock(),t.createElementBlock("div",Nm,[t.createElementVNode("div",hm,[C[45]||(C[45]=t.createElementVNode("div",{class:"done-icon"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"40",height:"40"},[t.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),t.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"})])],-1)),t.createElementVNode("h4",null,t.toDisplayString(i("accountWizard.accountCreated")),1),t.createElementVNode("p",null,t.toDisplayString(H.value)+" has been added to "+t.toDisplayString(m.value)+".",1),t.createElementVNode("div",vm,[t.createElementVNode("button",{class:"btn btn-outline","data-tour":"wiz-done-add",onClick:q},t.toDisplayString(i("accountWizard.addAnother")),1),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-done-next-backend",onClick:D},t.toDisplayString(i("accountWizard.doneNextBackend")),1)])])])):t.createCommentVNode("",!0)]))}}),ym=he(Om,[["__scopeId","data-v-19d6fb06"]]),Am={class:"aia-onboarding"},Im={class:"aia-onboarding__header"},Dm={key:0,class:"aia-onboarding__welcome"},Mm={key:1,class:"aia-onboarding__status"},Lm={key:2,class:"aia-onboarding__kind-grid"},xm=["disabled","onClick"],km={class:"aia-kind-card__name"},wm={key:0,class:"aia-kind-card__badge"},Pm={key:1,class:"aia-kind-card__badge aia-kind-card__badge--missing"},Bm={key:3,class:"aia-onboarding__login"},Um={class:"aia-onboarding__tabs"},Fm={class:"aia-label"},Gm={key:1,class:"aia-onboarding__oauth-start"},Ym={key:4,class:"aia-onboarding__oauth-challenge"},Vm=["href"],qm={class:"aia-code-display"},zm={key:5,class:"aia-onboarding__status"},Hm={key:6,class:"aia-onboarding__success"},$m={key:7,class:"aia-onboarding__error"},Wm=t.defineComponent({__name:"OnboardingFlow",props:{client:{},kinds:{},supportedFlowsByKind:{}},emits:["done","cancel"],setup(n,{emit:e}){const a=n,r=e,i=et.useOnboarding({client:a.client}),s=t.ref(""),o=t.ref("api_key"),l=[{id:"claude",display:"Claude"},{id:"opencode",display:"OpenCode"},{id:"antigravity",display:"Antigravity"},{id:"codex",display:"Codex"},{id:"deepseek",display:"DeepSeek"},{id:"goose",display:"Goose"},{id:"aider",display:"Aider"},{id:"crush",display:"Crush"}],d={claude:["api_key"],opencode:["api_key"],antigravity:["api_key","oauth_device"],codex:["api_key","oauth_device"],deepseek:["api_key"],goose:["api_key"],aider:["api_key"],crush:["api_key"]},_=t.computed(()=>a.kinds??l),c=t.computed(()=>a.supportedFlowsByKind??d),u=t.computed(()=>{const b=i.selectedKind.value;return b?c.value[b]??["api_key"]:["api_key"]});async function m(){await i.start(),i.state.value!=="error"&&await i.detect()}async function p(b){await i.pickKind(b);const S=u.value;o.value=S[0]??"api_key"}async function E(){await i.submitApiKey(s.value)}async function T(){await i.submitOauthDevice()}t.watch(()=>i.state.value,b=>{b==="done"&&i.createdBackendId.value&&r("done",i.createdBackendId.value)},{immediate:!1});function f(){i.reset()}function O(){var S;const b=(S=i.oauthChallenge.value)==null?void 0:S.user_code;b&&typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(b)}function N(b){var S,v;return(v=(S=i.kinds.value)==null?void 0:S.find(A=>A.id===b))==null?void 0:v.detection}return(b,S)=>{var v,A,B;return t.openBlock(),t.createElementBlock("section",Am,[t.createElementVNode("header",Im,[t.renderSlot(b.$slots,"header",{},()=>[S[4]||(S[4]=t.createElementVNode("h2",null,"Set up an AI backend",-1))],!0)]),t.unref(i).state.value==="idle"?(t.openBlock(),t.createElementBlock("div",Dm,[S[5]||(S[5]=t.createElementVNode("p",null,"Connect one of the supported AI CLIs to get started.",-1)),t.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:m}," Get started ")])):t.unref(i).state.value==="started"||t.unref(i).state.value==="detecting"?(t.openBlock(),t.createElementBlock("div",Mm," Detecting installed CLIs… ")):t.unref(i).state.value==="picking_kind"?(t.openBlock(),t.createElementBlock("div",Lm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,x=>{var k,M,I,H;return t.openBlock(),t.createElementBlock("button",{key:x.id,type:"button",class:t.normalizeClass(["aia-kind-card",{"aia-kind-card--installed":(k=N(x.id))==null?void 0:k.installed,"aia-kind-card--missing":N(x.id)&&!((M=N(x.id))!=null&&M.installed)}]),disabled:!((I=N(x.id))!=null&&I.installed),onClick:Z=>p(x.id)},[t.createElementVNode("span",km,t.toDisplayString(x.display),1),(H=N(x.id))!=null&&H.installed?(t.openBlock(),t.createElementBlock("span",wm," Installed ")):(t.openBlock(),t.createElementBlock("span",Pm," Not installed "))],10,xm)}),128))])):t.unref(i).state.value==="entering_credential"?(t.openBlock(),t.createElementBlock("div",Bm,[t.createElementVNode("div",Um,[u.value.includes("api_key")?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["aia-tab",{"aia-tab--active":o.value==="api_key"}]),onClick:S[0]||(S[0]=x=>o.value="api_key")}," API key ",2)):t.createCommentVNode("",!0),u.value.includes("oauth_device")?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["aia-tab",{"aia-tab--active":o.value==="oauth_device"}]),onClick:S[1]||(S[1]=x=>o.value="oauth_device")}," Login with browser ",2)):t.createCommentVNode("",!0)]),o.value==="api_key"?(t.openBlock(),t.createElementBlock("form",{key:0,class:"aia-onboarding__form",onSubmit:t.withModifiers(E,["prevent"])},[t.createElementVNode("label",Fm,[S[6]||(S[6]=t.createTextVNode(" API key ",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":S[2]||(S[2]=x=>s.value=x),type:"password",class:"aia-input",autocomplete:"off",required:""},null,512),[[t.vModelText,s.value]])]),S[7]||(S[7]=t.createElementVNode("button",{type:"submit",class:"aia-btn aia-btn--primary"},"Connect",-1))],32)):o.value==="oauth_device"?(t.openBlock(),t.createElementBlock("div",Gm,[S[8]||(S[8]=t.createElementVNode("p",null,"You'll be shown a verification URL and code. Open it in your browser to sign in.",-1)),t.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:T}," Start browser login ")])):t.createCommentVNode("",!0)])):t.unref(i).state.value==="oauth_challenge"||t.unref(i).state.value==="oauth_polling"?(t.openBlock(),t.createElementBlock("div",Ym,[S[9]||(S[9]=t.createElementVNode("p",null,"Open this URL in your browser and enter the code:",-1)),t.createElementVNode("a",{href:(v=t.unref(i).oauthChallenge.value)==null?void 0:v.verification_uri,target:"_blank",rel:"noopener noreferrer",class:"aia-onboarding__oauth-uri"},t.toDisplayString((A=t.unref(i).oauthChallenge.value)==null?void 0:A.verification_uri),9,Vm),t.createElementVNode("div",qm,[t.createElementVNode("code",null,t.toDisplayString((B=t.unref(i).oauthChallenge.value)==null?void 0:B.user_code),1),t.createElementVNode("button",{type:"button",class:"aia-copy-btn",onClick:O},"Copy")]),S[10]||(S[10]=t.createElementVNode("p",{class:"aia-onboarding__hint"},"Waiting for you to complete sign-in…",-1)),t.createElementVNode("button",{type:"button",class:"aia-btn",onClick:S[3]||(S[3]=(...x)=>t.unref(i).cancelOAuth&&t.unref(i).cancelOAuth(...x))},"Cancel")])):t.unref(i).state.value==="validating"?(t.openBlock(),t.createElementBlock("div",zm," Validating credential… ")):t.unref(i).state.value==="done"?(t.openBlock(),t.createElementBlock("div",Hm,[t.renderSlot(b.$slots,"success",{},()=>[S[11]||(S[11]=t.createElementVNode("p",null,"✓ Connected successfully",-1))],!0)])):t.unref(i).state.value==="error"?(t.openBlock(),t.createElementBlock("div",$m,[t.createElementVNode("p",null,t.toDisplayString(t.unref(i).error.value),1),t.createElementVNode("button",{type:"button",class:"aia-btn",onClick:f},"Try again")])):t.createCommentVNode("",!0)])}}}),Km=he(Wm,[["__scopeId","data-v-43800d8a"]]),Qm=["value","type","onInput"],Xm={class:"aia-actions"},Zm=["disabled"],Jm={key:0,class:"aia-error"},jm=t.defineComponent({__name:"AccountEditForm",props:{account:{},metadata:{}},emits:["saved","cancel"],setup(n,{emit:e}){const a=n,r=e,{client:i}=et.useAiAccounts(),s=t.reactive({display_name:a.account.display_name,config:{...a.account.config}}),o=t.ref(!1),l=t.ref(null),d=t.computed(()=>{var c;return((c=a.metadata.config_schema)==null?void 0:c.properties)??{}});async function _(){o.value=!0,l.value=null;try{const c=await i.updateBackend(a.account.id,{display_name:s.display_name,config:s.config});r("saved",c)}catch(c){l.value=c instanceof Error?c.message:String(c)}finally{o.value=!1}}return(c,u)=>(t.openBlock(),t.createElementBlock("form",{class:"aia-account-edit",onSubmit:t.withModifiers(_,["prevent"])},[t.createElementVNode("label",null,[u[2]||(u[2]=t.createTextVNode(" Display name ",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=m=>s.display_name=m),type:"text",required:""},null,512),[[t.vModelText,s.display_name]])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(m,p)=>(t.openBlock(),t.createElementBlock("div",{key:p,class:"aia-field"},[t.createElementVNode("label",null,[t.createTextVNode(t.toDisplayString(p)+" ",1),t.createElementVNode("input",{value:s.config[p]??"",type:String(p).toLowerCase().includes("secret")||String(p).toLowerCase().includes("key")?"password":"text",onInput:E=>s.config[p]=E.target.value},null,40,Qm)])]))),128)),t.createElementVNode("div",Xm,[t.createElementVNode("button",{type:"submit",disabled:o.value},t.toDisplayString(o.value?"Saving…":"Save"),9,Zm),t.createElementVNode("button",{type:"button",onClick:u[1]||(u[1]=m=>r("cancel"))},"Cancel")]),l.value?(t.openBlock(),t.createElementBlock("p",Jm,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)],32))}}),eE=he(jm,[["__scopeId","data-v-56b7b8c3"]]),tE={class:"aia-reauth"},nE=["disabled","title"],aE={key:1,class:"aia-reauth__flows"},rE=["onClick"],iE={class:"aia-reauth__panel"},oE={class:"aia-reauth__head"},sE={key:0,class:"aia-reauth__ok"},lE=t.defineComponent({__name:"AccountReauth",props:{account:{}},emits:["reauthed"],setup(n,{emit:e}){const a=n,r=e,i=et.useBackendRegistry(),s=et.useLoginSession(),o=t.ref(!1),l=t.ref(!1),d=t.ref(!1),_=t.computed(()=>{var E;return((E=i.get(a.account.kind))==null?void 0:E.login_flows)??[]}),c=t.computed(()=>a.account.display_name||a.account.id);async function u(){var E;d.value=!0;try{i.loaded.value||await i.load()}finally{d.value=!1}_.value.length>1?l.value=!0:await m(((E=_.value[0])==null?void 0:E.kind)??"cli_browser")}async function m(E){l.value=!1,s.reset(),o.value=!0,await s.start(a.account.id,E,{})}function p(){s.status.value==="running"&&s.cancel(),s.reset(),o.value=!1,l.value=!1}return t.watch(()=>s.status.value,E=>{E==="complete"&&r("reauthed",a.account.id)}),(E,T)=>(t.openBlock(),t.createElementBlock("div",tE,[!o.value&&!l.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"aia-reauth__btn",disabled:d.value,title:`Re-authenticate ${c.value}`,onClick:u},[T[1]||(T[1]=t.createElementVNode("span",{class:"aia-reauth__icon","aria-hidden":"true"},"↻",-1)),t.createTextVNode(" "+t.toDisplayString(d.value?"Loading…":"Re-auth"),1)],8,nE)):l.value?(t.openBlock(),t.createElementBlock("div",aE,[T[2]||(T[2]=t.createElementVNode("span",{class:"aia-reauth__flows-label"},"Sign in via:",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,f=>(t.openBlock(),t.createElementBlock("button",{key:f.kind,type:"button",class:"aia-reauth__flow",onClick:O=>m(f.kind)},t.toDisplayString(f.display_name||f.kind),9,rE))),128)),t.createElementVNode("button",{type:"button",class:"aia-reauth__flow aia-reauth__flow--ghost",onClick:T[0]||(T[0]=f=>l.value=!1)}," Cancel ")])):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("div",{key:2,class:"aia-reauth__overlay",onClick:t.withModifiers(p,["self"])},[t.createElementVNode("div",iE,[t.createElementVNode("header",oE,[t.createElementVNode("strong",null,"Re-authenticate "+t.toDisplayString(c.value),1),t.createElementVNode("button",{type:"button",class:"aia-reauth__close","aria-label":"Close",onClick:p},"×")]),t.unref(s).status.value==="complete"?(t.openBlock(),t.createElementBlock("div",sE,[T[3]||(T[3]=t.createElementVNode("span",null,"✓ Re-authenticated.",-1)),t.createElementVNode("button",{type:"button",class:"aia-reauth__flow",onClick:p},"Done")])):(t.openBlock(),t.createBlock(no,{key:1,session:t.unref(s),"backend-kind":n.account.kind},null,8,["session","backend-kind"]))])])):t.createCommentVNode("",!0)]))}}),cE=he(lE,[["__scopeId","data-v-ebacc071"]]),_E={class:"aia-chat-message__role"},dE={class:"aia-chat-message__content"},uE={key:0,class:"aia-chat-message__meta"},pE={key:0},mE={key:1},EE={key:2},gE=t.defineComponent({__name:"ChatMessage",props:{role:{},content:{},model:{},tokensIn:{},tokensOut:{},streaming:{type:Boolean}},setup(n){return(e,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["aia-chat-message",[`aia-chat-message--${n.role}`,{"aia-chat-message--streaming":n.streaming}]])},[t.createElementVNode("div",_E,t.toDisplayString(n.role),1),t.createElementVNode("div",dE,t.toDisplayString(n.content),1),n.tokensIn||n.tokensOut?(t.openBlock(),t.createElementBlock("div",uE,[n.tokensIn?(t.openBlock(),t.createElementBlock("span",pE,t.toDisplayString(n.tokensIn)+" in",1)):t.createCommentVNode("",!0),n.tokensOut?(t.openBlock(),t.createElementBlock("span",mE,t.toDisplayString(n.tokensOut)+" out",1)):t.createCommentVNode("",!0),n.model?(t.openBlock(),t.createElementBlock("span",EE,t.toDisplayString(n.model),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2))}}),Xi=he(gE,[["__scopeId","data-v-52897838"]]),SE={class:"aia-chat-panel"},TE={class:"aia-chat-panel__messages"},bE={class:"aia-chat-panel__input"},fE=["disabled"],RE=["disabled"],CE=t.defineComponent({__name:"ChatPanel",props:{messages:{},streamingText:{},isStreaming:{type:Boolean},disabled:{type:Boolean}},emits:["send"],setup(n,{emit:e}){const a=n,r=e,i=t.ref(""),s=t.ref(null);function o(){const d=i.value.trim();!d||a.disabled||a.isStreaming||(r("send",d),i.value="")}function l(d){d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o())}return t.watch(()=>a.messages.length,()=>t.nextTick(()=>{var d;return(d=s.value)==null?void 0:d.scrollIntoView({behavior:"smooth"})})),(d,_)=>(t.openBlock(),t.createElementBlock("div",SE,[t.createElementVNode("div",TE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.messages,c=>(t.openBlock(),t.createBlock(Xi,{key:c.id,role:c.role,content:c.content,model:c.model||void 0,"tokens-in":c.tokens_in||void 0,"tokens-out":c.tokens_out||void 0},null,8,["role","content","model","tokens-in","tokens-out"]))),128)),n.isStreaming&&n.streamingText?(t.openBlock(),t.createBlock(Xi,{key:0,role:"assistant",content:n.streamingText,streaming:!0},null,8,["content"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"messagesEnd",ref:s},null,512)]),t.createElementVNode("div",bE,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":_[0]||(_[0]=c=>i.value=c),class:"aia-chat-panel__textarea",placeholder:"Type a message...",rows:"2",disabled:n.disabled||n.isStreaming,onKeydown:l},null,40,fE),[[t.vModelText,i.value]]),t.createElementVNode("button",{class:"aia-chat-panel__send",disabled:!i.value.trim()||n.disabled||n.isStreaming,onClick:o},"Send",8,RE)])]))}}),NE=he(CE,[["__scopeId","data-v-2904376c"]]);function ao(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ct=ao();function x_(n){Ct=n}var bt={exec:()=>null};function se(n,e=""){let a=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ue.caret,"$1"),a=a.replace(i,o),r},getRegex:()=>new RegExp(a,e)};return r}var hE=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ue={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},vE=/^(?:[ \t]*(?:\n|$))+/,OE=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yE=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Kt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,AE=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ro=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,k_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,w_=se(k_).replace(/bull/g,ro).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),IE=se(k_).replace(/bull/g,ro).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),io=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,DE=/^[^\n]+/,oo=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ME=se(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",oo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),LE=se(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ro).getRegex(),sn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",so=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,xE=se("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",so).replace("tag",sn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),P_=se(io).replace("hr",Kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sn).getRegex(),kE=se(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",P_).getRegex(),lo={blockquote:kE,code:OE,def:ME,fences:yE,heading:AE,hr:Kt,html:xE,lheading:w_,list:LE,newline:vE,paragraph:P_,table:bt,text:DE},Io=se("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sn).getRegex(),wE={...lo,lheading:IE,table:Io,paragraph:se(io).replace("hr",Kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Io).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sn).getRegex()},PE={...lo,html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",so).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:se(io).replace("hr",Kt).replace("heading",` *#{1,6} *[^
1
+ "use strict";var Td=Object.defineProperty;var bd=(n,e,a)=>e in n?Td(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a;var ge=(n,e,a)=>bd(n,typeof e!="symbol"?e+"":e,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),et=require("@ai-accounts/vue-headless");function M_(n,e,a){if(!n)return n;let r;try{r=new URL(n)}catch{return n}if(a==="google")r.searchParams.set("prompt","select_account consent");else if(a==="claude")r.searchParams.set("prompt","login");else return n;return e&&r.searchParams.set("login_hint",e),r.toString()}const fd={class:"aia-login-stream","data-tour":"wiz-login-stream"},Rd={key:0,class:"aia-preparing"},Cd={key:1,class:"aia-url-section"},Nd=["href"],hd={class:"aia-url-actions"},vd=["aria-pressed"],Od={key:0,class:"aia-incognito-hint"},yd={key:1,class:"aia-device-code"},Ad={class:"aia-device-code__value"},Id={key:2,class:"aia-verifying","data-tour":"wiz-login-paste"},Dd={class:"aia-text-section__label"},Md={key:0,class:"aia-text-section__queued"},Ld={class:"aia-text-section__row"},xd=["disabled"],kd=["disabled"],wd={key:2,class:"aia-menu-section"},Pd={class:"aia-menu-section__title"},Bd={class:"aia-menu-options"},Ud=["onClick"],Fd={class:"aia-menu-option__num"},Gd={class:"aia-menu-option__body"},Yd={class:"aia-menu-option__label"},Vd={key:0,class:"aia-menu-option__desc"},qd={class:"aia-text-section__label"},zd={class:"aia-text-section__row"},Hd=["type","placeholder","disabled"],$d=["disabled"],Wd={key:4,class:"aia-submit-error"},Kd={key:5,class:"aia-verifying"},Qd={class:"aia-verifying__row"},Xd={class:"aia-verifying__text"},Zd={key:0,class:"aia-verifying__elapsed"},Jd={key:0,class:"aia-verifying__warning"},jd={key:6,class:"aia-terminal"},eu={class:"aia-terminal__output"},tu={key:7,class:"aia-error-card"},nu=t.defineComponent({__name:"LoginStream",props:{session:{},showStdout:{type:Boolean,default:!1},backendKind:{default:""},email:{default:""}},setup(n){const e=n,a=t.ref(""),r=t.ref(""),i=t.ref("idle");let s=null;const o=t.ref(null),l=t.ref(!1),d=t.computed(()=>(i.value==="sent"||l.value)&&e.session.status.value==="running"),_=t.computed(()=>{var k;return!!((k=e.session.urlPrompt.value)!=null&&k.user_code)}),c=t.ref(0);let u=null,m=0;t.watch(d,k=>{k?(m=Date.now(),c.value=0,u&&clearInterval(u),u=setInterval(()=>{c.value=Math.floor((Date.now()-m)/1e3)},1e3)):(u&&(clearInterval(u),u=null),c.value=0)}),t.onUnmounted(()=>{u&&clearInterval(u)});const p=t.computed(()=>d.value&&c.value>=15);async function E(){try{await e.session.cancel()}catch{}i.value="idle",l.value=!1,o.value=null}async function T(){const k=a.value.trim();if(k){o.value=null,a.value="",i.value="sent",l.value=!0;try{await e.session.respond(k)}catch(M){const I=M instanceof Error?M.message:String(M);o.value=`Could not submit your response: ${I}. The login session may have ended; cancel and start again.`,l.value=!1,i.value="idle"}}}t.watch(()=>e.session.status.value,k=>{k!=="running"&&(l.value=!1,i.value="idle")});async function f(){const k=r.value.trim();if(k){r.value="",i.value="sent";try{await e.session.writeEager(k)}catch{s=k,i.value="queued"}}}t.watch(()=>e.session.textPrompt.value,async k=>{if(k&&s){const M=s;s=null,i.value="sent",await e.session.respond(M)}});async function O(k){o.value=null;try{await e.session.respond(String(k))}catch(M){const I=M instanceof Error?M.message:String(M);o.value=`Could not submit your selection: ${I}. The login session may have ended; cancel and start again.`}}const N=t.computed(()=>{var I;const k=(I=e.session.urlPrompt.value)==null?void 0:I.url;if(!k)return"";const M=e.backendKind==="antigravity"||e.backendKind==="codex"?"google":e.backendKind==="claude"?"claude":"none";return M==="none"?k:M_(k,e.email??"",M)});let b="";t.watch(()=>N.value,k=>{k&&k!==b&&(b=k,window.open(k,"_blank","noopener"))},{immediate:!0});const S=t.ref(!1),v=t.ref(!1);let A=null;async function B(){var M;const k=N.value;if(k)try{(M=navigator==null?void 0:navigator.clipboard)!=null&&M.writeText&&await navigator.clipboard.writeText(k),S.value=!0,v.value=!0,A&&clearTimeout(A),A=setTimeout(()=>{S.value=!1},2500)}catch{v.value=!0}}function x(){v.value=!1}return(k,M)=>(t.openBlock(),t.createElementBlock("div",fd,[!n.session.urlPrompt.value&&!n.session.menuPrompt.value&&!n.session.textPrompt.value&&n.session.status.value==="running"&&!d.value?(t.openBlock(),t.createElementBlock("div",Rd,[...M[3]||(M[3]=[t.createElementVNode("span",{class:"aia-preparing__spinner"},null,-1),t.createElementVNode("div",{class:"aia-preparing__text"},[t.createElementVNode("strong",null,"Preparing sign-in…"),t.createElementVNode("span",null,"Launching the CLI and waiting for the OAuth link. This usually takes a few seconds.")],-1)])])):t.createCommentVNode("",!0),n.session.urlPrompt.value?(t.openBlock(),t.createElementBlock("div",Cd,[M[12]||(M[12]=t.createStaticVNode('<div class="aia-url-badge" data-v-76f71aff><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="16" height="16" data-v-76f71aff><path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" data-v-76f71aff></path><polyline points="15 3 21 3 21 9" data-v-76f71aff></polyline><line x1="10" y1="14" x2="21" y2="3" data-v-76f71aff></line></svg><span data-v-76f71aff>A browser window should have opened. If not, click the link below:</span></div>',1)),t.createElementVNode("a",{href:N.value,target:"_blank",rel:"noopener",class:"aia-url-link","data-tour":"wiz-login-url"},t.toDisplayString(N.value),9,Nd),t.createElementVNode("div",hd,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["aia-copy-incognito-btn",{"aia-copy-incognito-btn--copied":S.value}]),"aria-pressed":v.value,onClick:B},[M[4]||(M[4]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.createElementVNode("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})],-1)),t.createElementVNode("span",null,t.toDisplayString(S.value?"Copied!":"Copy for Incognito"),1)],10,vd)]),v.value?(t.openBlock(),t.createElementBlock("div",Od,[t.createElementVNode("button",{type:"button",class:"aia-incognito-hint__close","aria-label":"Dismiss",onClick:x},"×"),M[5]||(M[5]=t.createElementVNode("strong",{class:"aia-incognito-hint__title"},"Open in an incognito window",-1)),M[6]||(M[6]=t.createElementVNode("p",{class:"aia-incognito-hint__body"},[t.createTextVNode(" Press "),t.createElementVNode("kbd",null,"⌘"),t.createElementVNode("kbd",null,"⇧"),t.createElementVNode("kbd",null,"N"),t.createTextVNode(" (Mac) or "),t.createElementVNode("kbd",null,"Ctrl"),t.createElementVNode("kbd",null,"Shift"),t.createElementVNode("kbd",null,"N"),t.createTextVNode(" (Windows / Linux) to open an incognito window, then paste the URL. ")],-1))])):t.createCommentVNode("",!0),n.session.urlPrompt.value.user_code?(t.openBlock(),t.createElementBlock("div",yd,[M[7]||(M[7]=t.createElementVNode("span",{class:"aia-device-code__label"},"Enter this code in the browser:",-1)),t.createElementVNode("code",Ad,t.toDisplayString(n.session.urlPrompt.value.user_code),1),M[8]||(M[8]=t.createElementVNode("p",{class:"aia-device-code__hint"}," The CLI is polling for your sign-in. Once you confirm in the browser, this wizard advances automatically — no need to paste anything back here. ",-1))])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createElementBlock("div",Id,[...M[9]||(M[9]=[t.createElementVNode("span",{class:"aia-verifying__spinner"},null,-1),t.createElementVNode("span",{class:"aia-verifying__text"},"Verifying authorization code…",-1)])])):t.createCommentVNode("",!0),!_.value&&!n.session.textPrompt.value&&i.value!=="sent"?(t.openBlock(),t.createElementBlock("form",{key:3,class:"aia-text-section aia-text-section--eager","data-tour":"wiz-login-paste",onSubmit:t.withModifiers(f,["prevent"])},[t.createElementVNode("label",Dd,[M[10]||(M[10]=t.createTextVNode(" After signing in, paste the authorization code here: ",-1)),i.value==="queued"?(t.openBlock(),t.createElementBlock("span",Md,"(queued — waiting for CLI prompt)")):t.createCommentVNode("",!0)]),t.createElementVNode("div",Ld,[M[11]||(M[11]=t.createElementVNode("span",{class:"aia-text-section__prompt"},">",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":M[0]||(M[0]=I=>r.value=I),class:"aia-text-section__input",type:"text",placeholder:"Paste code from browser…",autocomplete:"off",autofocus:"",disabled:i.value==="queued"},null,8,xd),[[t.vModelText,r.value]]),t.createElementVNode("button",{type:"submit",class:"aia-text-section__btn",disabled:!r.value.trim()||i.value==="queued"},t.toDisplayString(i.value==="queued"?"Waiting…":"Send"),9,kd)])],32)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.session.menuPrompt.value?(t.openBlock(),t.createElementBlock("div",wd,[t.createElementVNode("p",Pd,t.toDisplayString(n.session.menuPrompt.value.prompt),1),t.createElementVNode("div",Bd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.session.menuPrompt.value.options,I=>(t.openBlock(),t.createElementBlock("button",{key:I.number,type:"button",class:"aia-menu-option",onClick:H=>O(I.number)},[t.createElementVNode("span",Fd,t.toDisplayString(I.number),1),t.createElementVNode("div",Gd,[t.createElementVNode("span",Yd,t.toDisplayString(I.label),1),I.description?(t.openBlock(),t.createElementBlock("span",Vd,t.toDisplayString(I.description),1)):t.createCommentVNode("",!0)]),M[13]||(M[13]=t.createElementVNode("svg",{class:"aia-menu-option__arrow",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))],8,Ud))),128))])])):t.createCommentVNode("",!0),n.session.textPrompt.value?(t.openBlock(),t.createElementBlock("form",{key:3,class:"aia-text-section","data-tour":"wiz-login-paste",onSubmit:t.withModifiers(T,["prevent"])},[t.createElementVNode("label",qd,t.toDisplayString(n.session.textPrompt.value.prompt),1),t.createElementVNode("div",zd,[M[14]||(M[14]=t.createElementVNode("span",{class:"aia-text-section__prompt"},">",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":M[1]||(M[1]=I=>a.value=I),class:"aia-text-section__input",type:n.session.textPrompt.value.hidden?"password":"text",placeholder:n.session.textPrompt.value.hidden?"••••••••":"Type here…",autocomplete:"off",autofocus:"",disabled:l.value},null,8,Hd),[[t.vModelDynamic,a.value]]),t.createElementVNode("button",{type:"submit",class:"aia-text-section__btn",disabled:l.value||!a.value.trim()},t.toDisplayString(l.value?"Sending…":"Send"),9,$d)])],32)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("div",Wd,[M[15]||(M[15]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),t.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),t.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),t.createElementVNode("p",null,t.toDisplayString(o.value),1)])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createElementBlock("div",Kd,[t.createElementVNode("div",Qd,[M[17]||(M[17]=t.createElementVNode("span",{class:"aia-verifying__spinner"},null,-1)),t.createElementVNode("span",Xd,[M[16]||(M[16]=t.createTextVNode(" Verifying… ",-1)),c.value>0?(t.openBlock(),t.createElementBlock("span",Zd," ("+t.toDisplayString(c.value)+"s) ",1)):t.createCommentVNode("",!0)]),t.createElementVNode("button",{type:"button",class:"aia-verifying__cancel",onClick:E}," Cancel ")]),p.value?(t.openBlock(),t.createElementBlock("p",Jd," This is taking longer than usual. Check the terminal output below for clues, or click Cancel and try again. ")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(n.showStdout||d.value)&&n.session.stdoutLines.value.length>0?(t.openBlock(),t.createElementBlock("div",jd,[t.createElementVNode("div",eu,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.session.stdoutLines.value,(I,H)=>(t.openBlock(),t.createElementBlock("div",{key:H,class:"aia-terminal__line"},t.toDisplayString(I),1))),128))])])):t.createCommentVNode("",!0),n.session.status.value==="failed"?(t.openBlock(),t.createElementBlock("div",tu,[M[18]||(M[18]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),t.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),t.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),t.createElementVNode("div",null,[t.createElementVNode("strong",null,t.toDisplayString(n.session.errorCode.value),1),t.createElementVNode("p",null,t.toDisplayString(n.session.errorMessage.value),1)])])):t.createCommentVNode("",!0),n.session.status.value==="running"?(t.openBlock(),t.createElementBlock("button",{key:8,type:"button",class:"aia-cancel-btn",onClick:M[2]||(M[2]=I=>n.session.cancel())}," Cancel ")):t.createCommentVNode("",!0)]))}}),he=(n,e)=>{const a=n.__vccOpts||n;for(const[r,i]of e)a[r]=i;return a},no=he(nu,[["__scopeId","data-v-76f71aff"]]),au={class:"aia-backend-picker"},ru=["onClick"],iu=["src","alt"],ou={class:"aia-backend-info"},su={key:0,class:"aia-installed"},lu={key:1,class:"aia-not-installed"},cu=t.defineComponent({__name:"BackendPicker",props:{installStatus:{}},emits:["pick"],setup(n,{emit:e}){const a=n,r=e,i=et.useBackendRegistry();function s(o){return a.installStatus?a.installStatus[o]:void 0}return t.onMounted(async()=>{i.loaded.value||await i.load()}),(o,l)=>(t.openBlock(),t.createElementBlock("ul",au,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(i).backends.value,d=>(t.openBlock(),t.createElementBlock("li",{key:d.kind},[t.createElementVNode("button",{type:"button",onClick:_=>r("pick",d.kind)},[d.icon_url?(t.openBlock(),t.createElementBlock("img",{key:0,src:d.icon_url,alt:d.display_name},null,8,iu)):t.createCommentVNode("",!0),t.createElementVNode("div",ou,[t.createElementVNode("strong",null,t.toDisplayString(d.display_name),1),s(d.kind)?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[s(d.kind).installed?(t.openBlock(),t.createElementBlock("span",su," installed"+t.toDisplayString(s(d.kind).version?" v"+s(d.kind).version:""),1)):(t.openBlock(),t.createElementBlock("span",lu,"not detected"))],64)):t.createCommentVNode("",!0)])],8,ru)]))),128))]))}}),L_=he(cu,[["__scopeId","data-v-2500895f"]]),_u={class:"wizard-container","data-tour":"account-wizard"},du={class:"wizard-header"},uu={key:0,class:"wizard-step"},pu={class:"step-body"},mu={class:"step-actions"},Eu={key:0,class:"wizard-warning",role:"alert"},gu={class:"wizard-steps"},Su={class:"step-number"},Tu={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3",width:"12",height:"12"},bu={class:"step-label"},fu={key:2,class:"wizard-step","data-tour":"wiz-subscription"},Ru={class:"step-body"},Cu={class:"step-question"},Nu={class:"radio-group","data-tour":"wiz-sub-yesno"},hu={class:"radio-card-content"},vu={class:"radio-card-title"},Ou={class:"radio-card-desc"},yu={class:"radio-card-content"},Au={class:"radio-card-title"},Iu={class:"radio-card-desc"},Du={key:0,class:"account-fields"},Mu={class:"form-group"},Lu={for:"wiz-name"},xu=["placeholder"],ku={class:"account-name-hint"},wu={class:"form-group"},Pu={for:"wiz-email"},Bu=["placeholder"],Uu={class:"step-actions"},Fu=["disabled"],Gu={key:3,class:"wizard-step","data-tour":"wiz-cli"},Yu={class:"step-body"},Vu={key:0,class:"status-card status-ok","data-tour":"wiz-cli-status"},qu={class:"status-info"},zu={class:"status-title"},Hu={class:"status-detail"},$u={class:"status-icon"},Wu={key:0,class:"spinner-sm"},Ku={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},Qu={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},Xu={class:"status-info"},Zu={class:"status-title"},Ju={key:0,class:"status-detail"},ju={key:1,class:"status-detail"},ep={key:1,class:"spinner-sm"},tp={key:2,class:"error-text"},np={key:3,class:"install-success-text"},ap={key:4,class:"install-stderr"},rp={key:5,class:"config-advanced"},ip={class:"config-dir-section"},op={class:"config-dir-label"},sp={class:"form-group compact"},lp=["placeholder"],cp={key:0,class:"error-text"},_p={class:"step-actions"},dp={key:4,class:"wizard-step","data-tour":"wiz-login"},up={class:"step-body"},pp={key:0,class:"login-method-picker"},mp={class:"login-method-picker__hint"},Ep={class:"login-method-picker__options"},gp=["onClick"],Sp={class:"login-method-picker__title"},Tp={key:0,class:"login-method-picker__desc"},bp={key:1,class:"login-flow-switcher"},fp={class:"login-flow-switcher__options"},Rp=["disabled","title","onClick"],Cp={key:2,class:"login-status login-error"},Np={key:3,class:"login-status login-connecting"},hp={key:5,class:"login-status login-completed"},vp={class:"login-status login-error"},Op={class:"step-actions"},yp={key:5,class:"wizard-step","data-tour":"wiz-proxy"},Ap={class:"step-body"},Ip={key:0,class:"cliproxy-install-block"},Dp=["disabled"],Mp={key:0,class:"spinner-sm"},Lp={key:0},xp={key:0,class:"install-success-text"},kp={key:1},wp={key:0,class:"install-stderr"},Pp={key:1,class:"proxy-step-body"},Bp={key:1,class:"login-status login-started"},Up={key:2,class:"proxy-device-auth"},Fp={class:"proxy-url-badge"},Gp={key:0},Yp={key:1},Vp=["href"],qp={key:1,class:"proxy-device-code-card"},zp={class:"proxy-device-code-value"},Hp={key:2,class:"proxy-waiting","data-tour":"wiz-proxy-callback"},$p={key:3,class:"proxy-callback-section","data-tour":"wiz-proxy-callback"},Wp={class:"proxy-callback-row"},Kp=["disabled"],Qp={key:0,class:"error-text"},Xp={key:3,class:"login-status login-completed"},Zp={key:4,class:"proxy-skipped"},Jp={key:5,class:"proxy-error"},jp={class:"error-text"},em={key:2,class:"proxy-loading"},tm={class:"step-actions"},nm={key:6,class:"wizard-step","data-tour":"wiz-plan"},am={class:"step-body"},rm={class:"review-card","data-tour":"wiz-plan-review"},im={class:"review-row"},om={class:"review-label"},sm={class:"review-value"},lm={key:0,class:"review-row"},cm={class:"review-label"},_m={class:"review-value"},dm={key:1,class:"review-row"},um={class:"review-label"},pm={class:"review-value"},mm={key:0,class:"form-group"},Em={for:"wiz-plan"},gm={value:""},Sm=["value"],Tm={class:"form-group checkbox","data-tour":"wiz-plan-default"},bm={key:1,class:"error-text"},fm={class:"step-actions"},Rm=["disabled"],Cm={key:0,class:"spinner-sm"},Nm={key:7,class:"wizard-step","data-tour":"wiz-done"},hm={class:"step-body done-body"},vm={class:"done-actions"},Om=t.defineComponent({__name:"AccountWizard",props:{initialBackendKind:{},backendName:{},allowSkip:{type:Boolean},translate:{type:Function}},emits:["close","saved","skip","addAnother","done"],setup(n,{emit:e}){const a=(h,C)=>({"accountWizard.addAccount":"Add Account","accountWizard.stepSubscription":"Subscription","accountWizard.stepCliSetup":"CLI Setup","accountWizard.stepLogin":"Login","accountWizard.stepPlanSave":"Plan & Save","accountWizard.stepDone":"Done","accountWizard.phaseSetup":"Setup","accountWizard.phaseLogin":"Login","accountWizard.phaseFinish":"Finish","accountWizard.yesHaveAccount":"Yes, I have an account","accountWizard.yesHaveAccountDesc":"I already have a subscription for this backend","accountWizard.noSkip":"Skip for now","accountWizard.noSkipDesc":"I will set this up later","accountWizard.accountName":"Account name","accountWizard.accountNamePlaceholder":"e.g., Personal, Work","accountWizard.accountNameHint":"(optional — leave blank to use the default config directory)","accountWizard.copyForIncognito":"Copy for Incognito","accountWizard.copiedLabel":"Copied!","accountWizard.incognitoHint":"Press ⌘⇧N (Mac) or Ctrl+Shift+N (Windows/Linux) to open an incognito window, then paste the URL.","accountWizard.email":"Email","accountWizard.emailPlaceholder":"name@example.com","accountWizard.emailHelp":"Optional — used to tag the account","accountWizard.cliInstalled":"CLI detected","accountWizard.cliNotInstalled":"CLI not detected","accountWizard.noCliRequired":"No CLI required","accountWizard.installCli":"Install CLI","accountWizard.configPath":"Config path","accountWizard.createDir":"Create","accountWizard.creating":"Creating...","accountWizard.configCreated":"Created","accountWizard.customizePath":"Customize path","accountWizard.apiKeyEnv":"API key env var","accountWizard.startingLogin":"Starting login session...","accountWizard.loginCompleted":"Login completed","accountWizard.tryAgain":"Try again","accountWizard.connectionLost":"Connection lost","accountWizard.send":"Send","accountWizard.waitingForResponse":"Waiting for response...","accountWizard.plan":"Plan","accountWizard.selectPlan":"Select a plan","accountWizard.setDefault":"Set as default account","accountWizard.saving":"Saving...","accountWizard.saveAccount":"Save account","accountWizard.accountCreated":"Account created!","accountWizard.addAnother":"Add another","accountWizard.doneNextBackend":"Done","accountWizard.continueBtn":"Continue","common.cancel":"Cancel","common.back":"Back","common.skip":"Skip","accountWizard.tour.sub.yesno.title":"Do you have an account?","accountWizard.tour.sub.yesno.message":"Pick whether you already have an account on this backend.","accountWizard.tour.sub.name.title":"Name this account","accountWizard.tour.sub.name.message":'Type a label so you can tell accounts apart later (e.g. "Personal", "Work"). Optional — leave blank to use a default.',"accountWizard.tour.sub.email.title":"Account email","accountWizard.tour.sub.email.message":"Type the email tied to the account. We pass it as a login_hint on the sign-in page.","accountWizard.tour.sub.next.title":"Continue to CLI check","accountWizard.tour.sub.next.message":"Click Continue — we verify the CLI is installed and move to step 2.","accountWizard.tour.cli.status.title":"CLI install check","accountWizard.tour.cli.status.message":`Confirm the CLI is installed. If it isn't, the "Install" button will fetch it for you.`,"accountWizard.tour.cli.next.title":"Launch the CLI","accountWizard.tour.cli.next.message":"Click Continue — we launch the CLI behind the scenes and move to step 3 (Sign in).","accountWizard.tour.login.booting.title":"Starting the CLI — pick your account type","accountWizard.tour.login.booting.message":'The CLI is booting in the background. While it starts, decide which login type fits your account: Pro / Max / Team subscription → pick "subscription". API usage billing (sk-ant-… / sk-… key) → pick "API key". 3rd-party platform (Bedrock / Foundry / Vertex AI) → pick "3rd-party". A menu appears in a moment with these options.',"accountWizard.tour.login.pickMethod.title":"Pick how you sign in","accountWizard.tour.login.pickMethod.message":"Click the option that matches your account: option 1 = subscription (Pro / Max / Team), option 2 = API key billing, option 3 = 3rd-party platform. The browser will open right after.","accountWizard.tour.login.authorize.title":"Authorize in your browser","accountWizard.tour.login.authorize.message":"A browser tab has opened. Sign in with the email from step 1 and click Authorize. If the tab didn't open, click this URL.","accountWizard.tour.login.paste.title":"Paste the authorization code","accountWizard.tour.login.paste.message":"Copy the code from the redirect page and paste it here, then click Send. We verify it for ~5–10 s.","accountWizard.tour.proxy.install.title":"Install CLIProxyAPI","accountWizard.tour.proxy.install.message":"Click Install to set up CLIProxyAPI. It lets other tools reach this account through an OpenAI-compatible endpoint. Or click Skip below if you don't need it.","accountWizard.tour.proxy.start.title":"Register with the proxy","accountWizard.tour.proxy.start.message":"Click Start proxy registration to begin — a browser tab opens for the proxy OAuth. Don't need the proxy? Click Skip below to jump to step 5.","accountWizard.tour.proxy.callback.title":"Paste the callback URL","accountWizard.tour.proxy.callback.message":`Copy the full localhost callback URL from your browser's address bar and paste it here, then click Submit. The redirect page may show "connection refused" — that's expected.`,"accountWizard.tour.proxy.continue.title":"Proxy registered","accountWizard.tour.proxy.continue.message":"Registration succeeded. Click Continue below to move to step 5.","accountWizard.tour.plan.review.title":"Review","accountWizard.tour.plan.review.message":"Check the values you entered. If anything looks wrong, click Back to fix it.","accountWizard.tour.plan.pick.title":"Pick a plan","accountWizard.tour.plan.pick.message":"Pro, Max, or API. The CLI told us which subscription it found in step 3 — override here if needed.","accountWizard.tour.plan.default.title":"Make it the default? (optional)","accountWizard.tour.plan.default.message":"Tick to mark this account as the backend's default.","accountWizard.tour.plan.save.title":"Save the account","accountWizard.tour.plan.save.message":`Click Save to persist the account and move to the Done screen. Tip: tick "Set as default" above first if this should be the backend's default account.`,"accountWizard.tour.done.add.title":"Add another account?","accountWizard.tour.done.add.message":"Click here to add another account on the same backend (e.g. a second Claude account).","accountWizard.tour.done.nextBackend.title":"Move to the next backend","accountWizard.tour.done.nextBackend.message":"Click here to advance the tour to the next backend (Codex / Antigravity / OpenCode)."})[h]??h,r=n,i=(h,C)=>r.translate?r.translate(h,C):a(h),s=e,{client:o,emit:l}=et.useAiAccounts(),d=et.useBackendRegistry(),_=et.useLoginSession(),c=t.ref(r.initialBackendKind??""),u=t.computed(()=>c.value?d.get(c.value):void 0),m=t.computed(()=>{var h;return r.backendName||((h=u.value)==null?void 0:h.display_name)||c.value||"Backend"}),p=t.inject("setTourTarget",()=>{}),E=t.inject("setTourGuide",()=>{}),T=t.inject("setTourTitle",()=>{}),f=t.ref("subscription"),O=["claude","codex","antigravity","kimi"],N=t.computed(()=>O.includes(c.value??"")),b=t.computed(()=>{const h=["subscription","cli","login"];return N.value&&h.push("proxy"),h.push("plan"),h}),S={subscription:"setup",cli:"setup",login:"login",proxy:"login",plan:"finish",done:"finish"},v=["setup","login","finish"],A=t.computed(()=>({setup:i("accountWizard.phaseSetup"),login:i("accountWizard.phaseLogin"),finish:i("accountWizard.phaseFinish")})),B=t.computed(()=>S[f.value]),x=t.computed(()=>v.indexOf(B.value));function k(){const h=b.value,C=h.indexOf(f.value);C>=0&&C<h.length-1?f.value=h[C+1]:f.value===h[h.length-1]&&(f.value="done")}function M(){const h=b.value,C=h.indexOf(f.value);C>0&&(f.value=h[C-1])}const I=t.ref(""),H=t.ref(""),Z=t.ref(""),me=t.computed(()=>I.value!=="");function re(){if(I.value==="no"){F();return}k()}const y=t.ref(""),P=t.ref(!1);function Y(h){return h.toLowerCase().replace(/\s+/g,"").replace(/[^a-z0-9]/g,"")}const Q={claude:".claude",claude_custom:".custom-claude",codex:".codex",antigravity:".antigravity",opencode:".opencode",openrouter:".openrouter",openai_compat:".openai_compat",kimi:".kimi",goose:".config/goose"};function ae(h){const C=h||"";return`~/${Q[C]||(C?`.${C}`:".backend")}`}function $(){if(P.value)return;const h=H.value.trim();if(!h){y.value=ae(c.value);return}const C=Y(h),L=Q[c.value||""]||(c.value?`.${c.value}`:".backend");y.value=`~/${L}-${C}`}function Se(h){const C=H.value.trim();return C||h&&h.trim()||"default"}t.computed(()=>{const h=H.value.trim();if(!h)return"";const C={claude:"ANTHROPIC",codex:"OPENAI",antigravity:"GOOGLE",opencode:"OPENCODE",openrouter:"OPENROUTER",openai_compat:"OPENAI",kimi:"KIMI",deepseek:"DEEPSEEK"},L=c.value||"",ne=C[L]||(L?L.toUpperCase():"BACKEND"),Me=Y(h).replace(/-/g,"_").toUpperCase();return`${ne}_API_KEY_${Me}`});const te=["openrouter","openai_compat","antigravity","kimi","deepseek","claude_custom"],le=t.computed(()=>te.includes(c.value??"")),V=t.ref(!1),de=t.ref(""),ee=t.ref(!1),K=t.ref(!1),ce=t.ref(""),ue=t.ref("");async function Te(){if(c.value){ee.value=!0;try{const h=d.get(c.value);V.value=!!h,de.value=""}catch(h){console.warn("[AccountWizard] CLI check failed:",h)}finally{ee.value=!1}}}const pe=t.ref(null);async function be(){if(c.value){K.value=!0,ue.value="",pe.value=null;try{const h=await o.installBackendCli(c.value);pe.value=h,h.success?(V.value=!0,de.value=""):ue.value=h.stderr||h.stdout||"Installation failed"}catch(h){ue.value=h instanceof Error?h.message:String(h),pe.value={kind:c.value,success:!1,display:"install failed",stdout:"",stderr:ue.value,exit_code:-1,binary_path:null}}finally{K.value=!1}}}const Oe=t.ref(0),fe=t.computed(()=>typeof navigator>"u"?!1:/Mac|iPhone|iPad|iPod/i.test(navigator.platform||"")),Ze=t.computed(()=>c.value==="claude"&&fe.value&&Oe.value>=1);async function He(){try{const h=await o.listBackends();Oe.value=(h.items||[]).filter(C=>C.kind==="claude").length}catch{Oe.value=0}}t.onMounted(async()=>{d.loaded.value||await d.load(),Te(),$(),l({type:"wizard.opened",backendKind:c.value}),xt(),He(),t.nextTick().then(()=>{W.value||(j.value?ht(j.value):(p(`[data-tour="wiz-${f.value}"]`),E(null),T(null)))})}),t.watch(c,()=>{P.value||$()}),t.watch(y,()=>{ce.value=""});const G=t.ref("");t.watch(f,async h=>{if(f.value==="login"&&_.status.value==="idle"){const C=u.value;if(C&&C.login_flows.length>1&&ie.value===null)return;await J()}},{immediate:!0});const xe=t.ref(null),ie=t.ref(null);async function J(){const h=u.value;if(!h){xe.value="Cannot start login: backend metadata is not loaded yet. Refresh the page and try again.";return}xe.value=null;try{if(!G.value){const L=await o.createBackend({kind:h.kind,display_name:Se(h.display_name),config:U()});G.value=L.id}const C=ie.value??$e(h);l({type:"wizard.step",backendKind:h.kind,step:"login.start"}),await _.start(G.value,C,w(h))}catch(C){const L=C instanceof Error?C.message:String(C);console.warn("[AccountWizard] login failed:",C),xe.value=`Could not start the login flow: ${L}. Check that the sidecar is running on :20001 and that the ${h.kind} backend metadata is reachable.`}}function $e(h){const C=h.login_flows.map(L=>L.kind);return C.includes("cli_browser")?"cli_browser":C.includes("oauth_device")?"oauth_device":"api_key"}const ke=t.computed(()=>ie.value??(u.value?$e(u.value):"cli_browser")),Ge=t.computed(()=>{var h;return(((h=u.value)==null?void 0:h.login_flows.length)??0)>1});async function ye(h){if(!(ie.value!==null&&h===ke.value)){try{await _.cancel()}catch{}_.reset(),ie.value=h,z.value=!1,await J()}}function w(h){return{}}function U(){return{email:Z.value.trim()||void 0,config_path:y.value.trim()||void 0}}const z=t.ref(!1),W=t.ref(!1);t.watch(f,()=>{z.value=!1}),t.watch(()=>_.status.value,h=>{if(h==="running"){f.value==="login"&&(z.value=!0);return}h==="complete"&&f.value==="login"&&z.value&&(z.value=!1,k())}),t.onBeforeUnmount(()=>{W.value=!0}),t.onUnmounted(()=>{E(null),p(null),T(null),_.status.value==="running"&&_.cancel().catch(()=>{}),Ye()});const oe=t.computed(()=>{switch(_.status.value){case"running":return _.urlPrompt.value||_.textPrompt.value||_.menuPrompt.value||_.stdoutLines.value.length>0?"streaming":"connecting";case"complete":return"completed";case"failed":case"cancelled":return"error";default:return"idle"}}),Ae=t.computed(()=>_.errorMessage.value||"");function lt(){_.status.value==="running"&&_.cancel().catch(()=>{})}const We=t.computed(()=>{var h;return((h=u.value)==null?void 0:h.plan_options)??[]}),Ke=t.ref(""),Ie=t.ref(!1),Pe=t.ref(!1),nt=t.ref(""),ct={subscription:[{selector:'[data-tour="wiz-sub-yesno"]',titleKey:"accountWizard.tour.sub.yesno.title",messageKey:"accountWizard.tour.sub.yesno.message",done:()=>I.value!==""},{selector:"#wiz-name",titleKey:"accountWizard.tour.sub.name.title",messageKey:"accountWizard.tour.sub.name.message",done:()=>I.value==="no"||H.value.trim().length>0},{selector:"#wiz-email",titleKey:"accountWizard.tour.sub.email.title",messageKey:"accountWizard.tour.sub.email.message",done:()=>I.value==="no"||/.+@.+/.test(Z.value)},{selector:'[data-tour="wiz-sub-next"]',titleKey:"accountWizard.tour.sub.next.title",messageKey:"accountWizard.tour.sub.next.message"}],cli:[{selector:'[data-tour="wiz-cli-status"]',titleKey:"accountWizard.tour.cli.status.title",messageKey:"accountWizard.tour.cli.status.message",done:()=>V.value},{selector:'[data-tour="wiz-cli-next"]',titleKey:"accountWizard.tour.cli.next.title",messageKey:"accountWizard.tour.cli.next.message"}],login:[{selector:'[data-tour="wiz-login-stream"]',titleKey:"accountWizard.tour.login.booting.title",messageKey:"accountWizard.tour.login.booting.message",done:()=>!!_.menuPrompt.value||!!_.urlPrompt.value},{selector:'[data-tour="wiz-login-stream"]',titleKey:"accountWizard.tour.login.pickMethod.title",messageKey:"accountWizard.tour.login.pickMethod.message",done:()=>!!_.urlPrompt.value},{selector:'[data-tour="wiz-login-url"]',titleKey:"accountWizard.tour.login.authorize.title",messageKey:"accountWizard.tour.login.authorize.message",done:()=>!!_.textPrompt.value||Xe.value},{selector:'[data-tour="wiz-login-paste"]',titleKey:"accountWizard.tour.login.paste.title",messageKey:"accountWizard.tour.login.paste.message"}],proxy:[{selector:'[data-tour="wiz-proxy-install"]',titleKey:"accountWizard.tour.proxy.install.title",messageKey:"accountWizard.tour.proxy.install.message",done:()=>qe.value&&dt.value},{selector:'[data-tour="wiz-proxy-start"]',titleKey:"accountWizard.tour.proxy.start.title",messageKey:"accountWizard.tour.proxy.start.message",done:()=>Ee.value!=="idle"},{selector:'[data-tour="wiz-proxy-callback"]',titleKey:"accountWizard.tour.proxy.callback.title",messageKey:"accountWizard.tour.proxy.callback.message",done:()=>Ee.value==="success"||Ee.value==="skipped"||Ee.value==="error"},{selector:'[data-tour="wiz-proxy-skip"]',titleKey:"accountWizard.tour.proxy.continue.title",messageKey:"accountWizard.tour.proxy.continue.message",done:()=>!1}],plan:[{selector:"#wiz-plan",titleKey:"accountWizard.tour.plan.pick.title",messageKey:"accountWizard.tour.plan.pick.message",done:()=>We.value.length===0||Ke.value!==""},{selector:'[data-tour="wiz-plan-save"]',titleKey:"accountWizard.tour.plan.save.title",messageKey:"accountWizard.tour.plan.save.message"}],done:[{selector:'[data-tour="wiz-done-add"]',titleKey:"accountWizard.tour.done.add.title",messageKey:"accountWizard.tour.done.add.message"},{selector:'[data-tour="wiz-done-next-backend"]',titleKey:"accountWizard.tour.done.nextBackend.title",messageKey:"accountWizard.tour.done.nextBackend.message"}]},Qe=t.ref(0),j=t.computed(()=>{var L,ne;const h=ct[f.value]??[];let C=Qe.value;for(;C<h.length-1&&((ne=(L=h[C])==null?void 0:L.done)==null?void 0:ne.call(L))===!0;)C++;return h[C]??null}),Xe=t.ref(!1);let Je=!1;function at(){typeof document>"u"||(document.visibilityState==="hidden"?Je=!0:document.visibilityState==="visible"&&Je&&(f.value==="login"&&_.urlPrompt.value&&(Xe.value=!0),Je=!1))}typeof document<"u"&&document.addEventListener("visibilitychange",at),t.onUnmounted(()=>{typeof document<"u"&&document.removeEventListener("visibilitychange",at)}),t.watch(()=>{var h,C;return((C=(h=j.value)==null?void 0:h.done)==null?void 0:C.call(h))??!1},h=>{var L,ne;if(!h)return;const C=ct[f.value]??[];for(;Qe.value<C.length-1&&((ne=(L=C[Qe.value])==null?void 0:L.done)==null?void 0:ne.call(L))===!0;)Qe.value++});const Tt=t.ref(!1);t.watch(f,()=>{Tt.value=!0},{flush:"sync"});async function ht(h){if(W.value)return;if(!h){p(`[data-tour="wiz-${f.value}"]`),E(null),T(null);return}const C=h;let L=null;for(let ne=0;ne<20;ne++){if(W.value||j.value!==C)return;if(L=typeof document<"u"?document.querySelector(h.selector):null,L&&L.getBoundingClientRect().width>0)break;await new Promise(Me=>setTimeout(Me,50))}W.value||j.value!==C||(p(L?h.selector:`[data-tour="wiz-${f.value}"]`),E(i(h.messageKey)),T(h.titleKey?i(h.titleKey):null))}t.watch(j,h=>{Tt.value||ht(h)});async function Re(h){const C=`[data-tour="wiz-${h}"]`;for(let L=0;L<60;L++){if(W.value||typeof document<"u"&&document.querySelector(C))return;await new Promise(ne=>setTimeout(ne,50))}}t.watch(f,async h=>{var L,ne;if(W.value||(Tt.value=!0,p('[data-tour="account-wizard"]'),E(null),T(null),Qe.value=0,Xe.value=!1,await Re(h),W.value||f.value!==h)||(await t.nextTick(),W.value||f.value!==h))return;Tt.value=!1;const C=ct[h]??[];for(;Qe.value<C.length-1&&((ne=(L=C[Qe.value])==null?void 0:L.done)==null?void 0:ne.call(L))===!0;)Qe.value++;ht(j.value)});const Ee=t.ref("idle"),we=t.ref(""),mt=t.ref(""),rt=t.ref(""),_t=t.ref(""),it=t.ref(""),Et=t.ref(null);let De=null;function Ye(){De!==null&&(clearInterval(De),De=null)}function Lt(){if(Ye(),!Et.value)return;const h=Et.value;De=setInterval(async()=>{try{const C=await o.cliproxyLoginStatus(h);C.state==="completed"?(Ee.value="success",we.value=C.message||"API proxy login completed",Ye()):(C.state==="failed"||C.state==="timeout")&&(Ee.value="error",we.value=C.message,Ye())}catch(C){console.warn("[AccountWizard] cliproxy login status poll failed:",C)}},2e3)}const dt=t.ref(!1),ut=t.ref(!1),Ve=t.ref(null),qe=t.ref(!1);async function xt(){try{const h=await o.cliproxyStatus();dt.value=h.installed}catch(h){console.warn("[AccountWizard] cliproxy status check failed:",h),dt.value=!1}finally{qe.value=!0}}async function kt(){ut.value=!0,Ve.value=null;try{const h=await o.cliproxyInstall();Ve.value=h,h.success&&(dt.value=!0)}catch(h){Ve.value={success:!1,display:"install failed",stdout:"",stderr:h instanceof Error?h.message:String(h),binary_path:null}}finally{ut.value=!1}}function vt(){Ye(),Ee.value="idle",we.value="",mt.value="",rt.value="",_t.value="",it.value="",Et.value=null}async function wt(){var h;if(c.value){Ee.value="running",we.value=`Registering ${m.value} account with API proxy…`,it.value="";try{const C=await o.cliproxyLoginBegin(c.value,((h=y.value)==null?void 0:h.trim())||void 0);we.value=C.message,C.status==="imported"?Ee.value="success":C.status==="started"&&C.oauth_url?(Ee.value="device_auth",mt.value=C.oauth_url,rt.value=C.device_code??"",Et.value=C.session_id??null,window.open(C.oauth_url,"_blank","noopener"),C.device_code?we.value=`Open the URL and enter code ${C.device_code}. We'll detect completion automatically.`:we.value="Complete OAuth in the browser; paste the callback URL below if it fails to redirect",Et.value&&Lt()):C.status==="skipped"?Ee.value="skipped":Ee.value="error"}catch(C){Ee.value="error",we.value=C instanceof Error?C.message:String(C)}}}async function Pt(){if(_t.value.trim()){it.value="";try{const h=await o.cliproxyCallbackForward(_t.value.trim());h.status==="completed"?(Ee.value="success",we.value="API proxy login completed"):it.value=h.message}catch(h){it.value=h instanceof Error?h.message:String(h)}}}async function Bt(){Pe.value=!0,nt.value="";try{const h=u.value;if(!h)throw new Error("No backend metadata available");const C={...U(),plan:Ke.value||void 0,is_default:Ie.value};if(G.value)await o.updateBackend(G.value,{display_name:Se(h.display_name),config:C});else{const L=await o.createBackend({kind:h.kind,display_name:Se(h.display_name),config:C});G.value=L.id}f.value="done",s("saved"),l({type:"wizard.account.created",backendKind:h.kind,accountId:G.value}),l({type:"wizard.step",backendKind:h.kind,step:"done"})}catch(h){nt.value=h instanceof Error?h.message:"Failed to save account"}finally{Pe.value=!1}}function q(){I.value="",H.value="",Z.value="",y.value="",P.value=!1,Ke.value="",Ie.value=!1,lt(),_.reset(),vt(),G.value="",ce.value="",z.value=!1,f.value="subscription",$(),s("addAnother"),c.value&&l({type:"wizard.step",backendKind:c.value,step:"add-another"})}function g(){c.value&&l({type:"wizard.closed",backendKind:c.value,reason:"cancel"}),s("close")}function D(){c.value&&l({type:"wizard.closed",backendKind:c.value,reason:"done"}),s("done",{accountId:G.value})}function F(){c.value&&l({type:"wizard.closed",backendKind:c.value,reason:"skip"}),s("skip")}return(h,C)=>(t.openBlock(),t.createElementBlock("div",_u,[t.createElementVNode("div",du,[t.createElementVNode("h3",null,t.toDisplayString(i("accountWizard.addAccount")),1),t.createElementVNode("button",{class:"wizard-close",onClick:g},"×")]),c.value?f.value!=="done"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[Ze.value?(t.openBlock(),t.createElementBlock("div",Eu,[C[12]||(C[12]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"18",height:"18","aria-hidden":"true"},[t.createElementVNode("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"}),t.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),t.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})],-1)),t.createElementVNode("div",null,[C[11]||(C[11]=t.createElementVNode("strong",null,"macOS Keychain limitation:",-1)),t.createTextVNode(" Claude CLI on macOS stores its credential in a single shared Keychain entry, so logging in here will replace your existing Claude credential ("+t.toDisplayString(Oe.value)+" account"+t.toDisplayString(Oe.value===1?"":"s")+' registered). The previous account row will appear "ready" but actually point at this new login. ',1)])])):t.createCommentVNode("",!0),t.createElementVNode("div",gu,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(v,(L,ne)=>t.createElementVNode("div",{key:L,class:t.normalizeClass(["step-indicator",{active:B.value===L,completed:x.value>ne}])},[t.createElementVNode("span",Su,[x.value>ne?(t.openBlock(),t.createElementBlock("svg",Tu,[...C[13]||(C[13]=[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(ne+1),1)],64))]),t.createElementVNode("span",bu,t.toDisplayString(A.value[L]),1)],2)),64))])],64)):t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",uu,[t.createElementVNode("div",pu,[C[10]||(C[10]=t.createElementVNode("p",{class:"step-question"},"Select a backend to connect:",-1)),t.createVNode(L_,{onPick:C[0]||(C[0]=L=>{c.value=L,Te()})})]),t.createElementVNode("div",mu,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:g},t.toDisplayString(i("common.cancel")),1)])])),c.value&&f.value==="subscription"?(t.openBlock(),t.createElementBlock("div",fu,[t.createElementVNode("div",Ru,[t.createElementVNode("p",Cu,"Do you already have a "+t.toDisplayString(m.value)+" account?",1),t.createElementVNode("div",Nu,[t.createElementVNode("label",{class:t.normalizeClass(["radio-card",{selected:I.value==="yes"}])},[t.withDirectives(t.createElementVNode("input",{type:"radio","onUpdate:modelValue":C[1]||(C[1]=L=>I.value=L),value:"yes"},null,512),[[t.vModelRadio,I.value]]),t.createElementVNode("div",hu,[t.createElementVNode("span",vu,t.toDisplayString(i("accountWizard.yesHaveAccount")),1),t.createElementVNode("span",Ou,t.toDisplayString(i("accountWizard.yesHaveAccountDesc")),1)])],2),t.createElementVNode("label",{class:t.normalizeClass(["radio-card",{selected:I.value==="no"}])},[t.withDirectives(t.createElementVNode("input",{type:"radio","onUpdate:modelValue":C[2]||(C[2]=L=>I.value=L),value:"no"},null,512),[[t.vModelRadio,I.value]]),t.createElementVNode("div",yu,[t.createElementVNode("span",Au,t.toDisplayString(i("accountWizard.noSkip")),1),t.createElementVNode("span",Iu,t.toDisplayString(i("accountWizard.noSkipDesc")),1)])],2)]),t.createVNode(t.Transition,{name:"slide-down"},{default:t.withCtx(()=>[I.value==="yes"?(t.openBlock(),t.createElementBlock("div",Du,[t.createElementVNode("div",Mu,[t.createElementVNode("label",Lu,[t.createTextVNode(t.toDisplayString(i("accountWizard.accountName"))+" ",1),C[14]||(C[14]=t.createElementVNode("span",{class:"optional"},"(optional)",-1))]),t.withDirectives(t.createElementVNode("input",{id:"wiz-name","onUpdate:modelValue":C[3]||(C[3]=L=>H.value=L),type:"text",placeholder:i("accountWizard.accountNamePlaceholder"),autofocus:"",onInput:$},null,40,xu),[[t.vModelText,H.value]]),t.createElementVNode("small",ku,t.toDisplayString(i("accountWizard.accountNameHint")),1)]),t.createElementVNode("div",wu,[t.createElementVNode("label",Pu,t.toDisplayString(i("accountWizard.email")),1),t.withDirectives(t.createElementVNode("input",{id:"wiz-email","onUpdate:modelValue":C[4]||(C[4]=L=>Z.value=L),type:"email",placeholder:i("accountWizard.emailPlaceholder")},null,8,Bu),[[t.vModelText,Z.value]]),t.createElementVNode("small",null,t.toDisplayString(i("accountWizard.emailHelp")),1)])])):t.createCommentVNode("",!0)]),_:1})]),t.createElementVNode("div",Uu,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:g},t.toDisplayString(i("common.cancel")),1),t.createElementVNode("button",{class:t.normalizeClass(["btn",I.value==="no"?"btn-outline":"btn-primary"]),disabled:!me.value,"data-tour":"wiz-sub-next",onClick:re},[t.createTextVNode(t.toDisplayString(I.value==="no"?i("accountWizard.noSkip"):i("accountWizard.continueBtn"))+" ",1),C[15]||(C[15]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))],10,Fu)])])):t.createCommentVNode("",!0),c.value&&f.value==="cli"?(t.openBlock(),t.createElementBlock("div",Gu,[t.createElementVNode("div",Yu,[le.value?(t.openBlock(),t.createElementBlock("div",Vu,[C[16]||(C[16]=t.createElementVNode("div",{class:"status-icon"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},[t.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),t.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"})])],-1)),t.createElementVNode("div",qu,[t.createElementVNode("span",zu,t.toDisplayString(m.value),1),t.createElementVNode("span",Hu,t.toDisplayString(i("accountWizard.noCliRequired")),1)])])):(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["status-card",V.value?"status-ok":"status-warn"]),"data-tour":"wiz-cli-status"},[t.createElementVNode("div",$u,[ee.value?(t.openBlock(),t.createElementBlock("div",Wu)):V.value?(t.openBlock(),t.createElementBlock("svg",Ku,[...C[17]||(C[17]=[t.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},null,-1),t.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",Qu,[...C[18]||(C[18]=[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),t.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"12"},null,-1),t.createElementVNode("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"},null,-1)])]))]),t.createElementVNode("div",Xu,[t.createElementVNode("span",Zu,t.toDisplayString(m.value)+" CLI",1),V.value?(t.openBlock(),t.createElementBlock("span",Ju,t.toDisplayString(i("accountWizard.cliInstalled"))+t.toDisplayString(de.value?` (${de.value})`:""),1)):(t.openBlock(),t.createElementBlock("span",ju,t.toDisplayString(i("accountWizard.cliNotInstalled")),1))]),!V.value&&!K.value?(t.openBlock(),t.createElementBlock("button",{key:0,class:"btn btn-primary btn-sm",onClick:be},t.toDisplayString(i("accountWizard.installCli")),1)):t.createCommentVNode("",!0),K.value?(t.openBlock(),t.createElementBlock("div",ep)):t.createCommentVNode("",!0)],2)),ue.value?(t.openBlock(),t.createElementBlock("div",tp,t.toDisplayString(ue.value),1)):t.createCommentVNode("",!0),pe.value&&pe.value.success?(t.openBlock(),t.createElementBlock("div",np," Installed"+t.toDisplayString(pe.value.binary_path?` at ${pe.value.binary_path}`:""),1)):t.createCommentVNode("",!0),pe.value&&!pe.value.success&&pe.value.stderr?(t.openBlock(),t.createElementBlock("pre",ap,t.toDisplayString(pe.value.stderr),1)):t.createCommentVNode("",!0),y.value?(t.openBlock(),t.createElementBlock("details",rp,[t.createElementVNode("summary",null,t.toDisplayString(i("accountWizard.customizePath")),1),t.createElementVNode("div",ip,[t.createElementVNode("div",op,t.toDisplayString(i("accountWizard.configPath")),1),t.createElementVNode("div",sp,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":C[5]||(C[5]=L=>y.value=L),type:"text",placeholder:`e.g., ~/.${c.value}-personal`,onInput:C[6]||(C[6]=L=>P.value=!0)},null,40,lp),[[t.vModelText,y.value]])]),ce.value?(t.openBlock(),t.createElementBlock("div",cp,t.toDisplayString(ce.value),1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),t.createElementVNode("div",_p,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[19]||(C[19]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-cli-next",onClick:k},[t.createTextVNode(t.toDisplayString(i("accountWizard.continueBtn"))+" ",1),C[20]||(C[20]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):t.createCommentVNode("",!0),c.value&&f.value==="login"?(t.openBlock(),t.createElementBlock("div",dp,[t.createElementVNode("div",up,[Ge.value&&u.value&&ie.value===null&&oe.value==="idle"?(t.openBlock(),t.createElementBlock("div",pp,[C[21]||(C[21]=t.createElementVNode("h4",{class:"login-method-picker__heading"},"Choose a login method",-1)),t.createElementVNode("p",mp," Pick how you want to authenticate "+t.toDisplayString(m.value)+". You can switch later if your first choice doesn't work. ",1),t.createElementVNode("div",Ep,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value.login_flows,L=>(t.openBlock(),t.createElementBlock("button",{key:L.kind,type:"button",class:"login-method-picker__btn",onClick:ne=>ye(L.kind)},[t.createElementVNode("strong",Sp,t.toDisplayString(L.display_name),1),L.description?(t.openBlock(),t.createElementBlock("span",Tp,t.toDisplayString(L.description),1)):t.createCommentVNode("",!0)],8,gp))),128))])])):t.createCommentVNode("",!0),Ge.value&&u.value&&(ie.value!==null||oe.value!=="idle")?(t.openBlock(),t.createElementBlock("div",bp,[C[22]||(C[22]=t.createElementVNode("span",{class:"login-flow-switcher__label"},"Login method:",-1)),t.createElementVNode("div",fp,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(u.value.login_flows,L=>(t.openBlock(),t.createElementBlock("button",{key:L.kind,type:"button",class:t.normalizeClass(["login-flow-switcher__btn",{"login-flow-switcher__btn--active":ke.value===L.kind}]),disabled:oe.value==="completed",title:L.description,onClick:ne=>ye(L.kind)},t.toDisplayString(L.display_name),11,Rp))),128))])])):t.createCommentVNode("",!0),xe.value?(t.openBlock(),t.createElementBlock("div",Cp,[C[23]||(C[23]=t.createElementVNode("strong",null,"Login could not start.",-1)),t.createElementVNode("p",null,t.toDisplayString(xe.value),1),t.createElementVNode("button",{class:"btn btn-secondary",onClick:J}," Retry ")])):(oe.value==="idle"||oe.value==="connecting")&&!(Ge.value&&ie.value===null)?(t.openBlock(),t.createElementBlock("div",Np,[C[24]||(C[24]=t.createElementVNode("div",{class:"spinner-sm"},null,-1)),t.createElementVNode("span",null,t.toDisplayString(i("accountWizard.startingLogin")),1)])):oe.value==="streaming"?(t.openBlock(),t.createBlock(no,{key:4,session:t.unref(_),"backend-kind":c.value,email:Z.value},null,8,["session","backend-kind","email"])):oe.value==="completed"?(t.openBlock(),t.createElementBlock("div",hp,[C[25]||(C[25]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),t.createElementVNode("span",null,t.toDisplayString(i("accountWizard.loginCompleted")),1)])):oe.value==="error"?(t.openBlock(),t.createElementBlock(t.Fragment,{key:6},[t.createElementVNode("div",vp,[C[26]||(C[26]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),t.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),t.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),t.createElementVNode("span",null,t.toDisplayString(Ae.value),1)]),t.createElementVNode("button",{class:"btn btn-secondary",style:{"margin-top":"12px"},onClick:J},t.toDisplayString(i("accountWizard.tryAgain")),1)],64)):t.createCommentVNode("",!0)]),t.createElementVNode("div",Op,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[27]||(C[27]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary",onClick:k},[t.createTextVNode(t.toDisplayString(oe.value==="idle"?i("common.skip"):i("accountWizard.continueBtn"))+" ",1),C[28]||(C[28]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):t.createCommentVNode("",!0),c.value&&f.value==="proxy"?(t.openBlock(),t.createElementBlock("div",yp,[t.createElementVNode("div",Ap,[qe.value&&!dt.value?(t.openBlock(),t.createElementBlock("div",Ip,[C[30]||(C[30]=t.createElementVNode("p",{class:"step-description"}," CLIProxyAPI is not installed. Install it to expose this account through an OpenAI-compatible endpoint for other tools. ",-1)),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-proxy-install",disabled:ut.value,onClick:kt},[ut.value?(t.openBlock(),t.createElementBlock("div",Mp)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(ut.value?"Installing cliproxyapi…":"Install CLIProxyAPI"),1)],8,Dp),Ve.value?(t.openBlock(),t.createElementBlock("div",Lp,[Ve.value.success?(t.openBlock(),t.createElementBlock("p",xp," Installed"+t.toDisplayString(Ve.value.binary_path?` at ${Ve.value.binary_path}`:""),1)):(t.openBlock(),t.createElementBlock("div",kp,[C[29]||(C[29]=t.createElementVNode("p",{class:"error-text"},"Install failed",-1)),Ve.value.stderr?(t.openBlock(),t.createElementBlock("pre",wp,t.toDisplayString(Ve.value.stderr),1)):t.createCommentVNode("",!0)]))])):t.createCommentVNode("",!0)])):dt.value?(t.openBlock(),t.createElementBlock("div",Pp,[C[39]||(C[39]=t.createElementVNode("h4",{class:"proxy-heading"},"Register with API proxy",-1)),C[40]||(C[40]=t.createElementVNode("p",{class:"step-description"}," Optional: register this account with CLIProxyAPI so other tools can reach it through an OpenAI-compatible endpoint. ",-1)),Ee.value==="idle"?(t.openBlock(),t.createElementBlock("button",{key:0,class:"btn btn-primary","data-tour":"wiz-proxy-start",onClick:wt}," Start proxy registration ")):t.createCommentVNode("",!0),Ee.value==="running"?(t.openBlock(),t.createElementBlock("div",Bp,[C[31]||(C[31]=t.createElementVNode("div",{class:"spinner-sm"},null,-1)),t.createElementVNode("span",null,t.toDisplayString(we.value),1)])):t.createCommentVNode("",!0),Ee.value==="device_auth"?(t.openBlock(),t.createElementBlock("div",Up,[t.createElementVNode("div",Fp,[C[33]||(C[33]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),t.createElementVNode("polyline",{points:"15 3 21 3 21 9"}),t.createElementVNode("line",{x1:"10",y1:"14",x2:"21",y2:"3"})],-1)),rt.value?(t.openBlock(),t.createElementBlock("span",Gp," Open the URL below, sign in, and enter the device code. We'll detect completion automatically. ")):(t.openBlock(),t.createElementBlock("span",Yp,[...C[32]||(C[32]=[t.createTextVNode(" A browser window should have opened. Sign in, then the page will redirect to ",-1),t.createElementVNode("code",null,"localhost",-1),t.createTextVNode(" — that redirect will fail (this is normal). Copy the full URL from the browser address bar and paste it below. ",-1)])]))]),mt.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:mt.value,target:"_blank",rel:"noopener",class:"proxy-oauth-link"},t.toDisplayString(mt.value),9,Vp)):t.createCommentVNode("",!0),rt.value?(t.openBlock(),t.createElementBlock("div",qp,[C[34]||(C[34]=t.createElementVNode("span",{class:"proxy-device-code-label"},"Your device code:",-1)),t.createElementVNode("code",zp,t.toDisplayString(rt.value),1)])):t.createCommentVNode("",!0),rt.value?(t.openBlock(),t.createElementBlock("div",Hp,[...C[35]||(C[35]=[t.createElementVNode("div",{class:"spinner-sm"},null,-1),t.createElementVNode("span",null,"Waiting for you to enter the code…",-1)])])):(t.openBlock(),t.createElementBlock("div",$p,[C[36]||(C[36]=t.createElementVNode("p",{class:"proxy-callback-hint"},"If the redirect to localhost fails, paste the callback URL:",-1)),t.createElementVNode("div",Wp,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":C[7]||(C[7]=L=>_t.value=L),class:"proxy-callback-input",type:"url",placeholder:"http://localhost:54545/callback?code=..."},null,512),[[t.vModelText,_t.value]]),t.createElementVNode("button",{class:"btn btn-primary btn-sm",onClick:Pt,disabled:!_t.value.trim()}," Submit ",8,Kp)]),it.value?(t.openBlock(),t.createElementBlock("p",Qp,t.toDisplayString(it.value),1)):t.createCommentVNode("",!0)]))])):t.createCommentVNode("",!0),Ee.value==="success"?(t.openBlock(),t.createElementBlock("div",Xp,[C[37]||(C[37]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),t.createElementVNode("span",null,t.toDisplayString(we.value||"Registered successfully"),1)])):t.createCommentVNode("",!0),Ee.value==="skipped"?(t.openBlock(),t.createElementBlock("div",Zp,[t.createElementVNode("p",null,t.toDisplayString(we.value),1),t.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:vt},"Retry")])):t.createCommentVNode("",!0),Ee.value==="error"?(t.openBlock(),t.createElementBlock("div",Jp,[t.createElementVNode("p",jp,[C[38]||(C[38]=t.createElementVNode("strong",null,"Error:",-1)),t.createTextVNode(" "+t.toDisplayString(we.value),1)]),t.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:vt},"Retry")])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",em,[...C[41]||(C[41]=[t.createElementVNode("div",{class:"spinner-sm"},null,-1),t.createElementVNode("span",null,"Checking CLIProxyAPI status…",-1)])]))]),t.createElementVNode("div",tm,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[42]||(C[42]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-proxy-skip",onClick:k},[t.createTextVNode(t.toDisplayString(Ee.value==="success"?i("accountWizard.continueBtn"):i("common.skip"))+" ",1),C[43]||(C[43]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):t.createCommentVNode("",!0),c.value&&f.value==="plan"?(t.openBlock(),t.createElementBlock("div",nm,[t.createElementVNode("div",am,[t.createElementVNode("div",rm,[t.createElementVNode("div",im,[t.createElementVNode("span",om,t.toDisplayString(i("accountWizard.accountName")),1),t.createElementVNode("span",sm,t.toDisplayString(H.value),1)]),Z.value?(t.openBlock(),t.createElementBlock("div",lm,[t.createElementVNode("span",cm,t.toDisplayString(i("accountWizard.email")),1),t.createElementVNode("span",_m,t.toDisplayString(Z.value),1)])):t.createCommentVNode("",!0),y.value?(t.openBlock(),t.createElementBlock("div",dm,[t.createElementVNode("span",um,t.toDisplayString(i("accountWizard.configPath")),1),t.createElementVNode("code",pm,t.toDisplayString(y.value),1)])):t.createCommentVNode("",!0)]),We.value.length>0?(t.openBlock(),t.createElementBlock("div",mm,[t.createElementVNode("label",Em,t.toDisplayString(i("accountWizard.plan")),1),t.withDirectives(t.createElementVNode("select",{id:"wiz-plan","onUpdate:modelValue":C[8]||(C[8]=L=>Ke.value=L)},[t.createElementVNode("option",gm,t.toDisplayString(i("accountWizard.selectPlan")),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(We.value,L=>(t.openBlock(),t.createElementBlock("option",{key:L.id,value:L.id},t.toDisplayString(L.label),9,Sm))),128))],512),[[t.vModelSelect,Ke.value]])])):t.createCommentVNode("",!0),t.createElementVNode("div",Tm,[t.createElementVNode("label",null,[t.withDirectives(t.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":C[9]||(C[9]=L=>Ie.value=L)},null,512),[[t.vModelCheckbox,Ie.value]]),t.createTextVNode(" "+t.toDisplayString(i("accountWizard.setDefault")),1)])]),nt.value?(t.openBlock(),t.createElementBlock("div",bm,t.toDisplayString(nt.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",fm,[t.createElementVNode("button",{class:"btn btn-secondary",onClick:M},[C[44]||(C[44]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[t.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),t.createTextVNode(" "+t.toDisplayString(i("common.back")),1)]),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-plan-save",disabled:Pe.value,onClick:Bt},[Pe.value?(t.openBlock(),t.createElementBlock("div",Cm)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(Pe.value?i("accountWizard.saving"):i("accountWizard.saveAccount")),1)],8,Rm)])])):t.createCommentVNode("",!0),c.value&&f.value==="done"?(t.openBlock(),t.createElementBlock("div",Nm,[t.createElementVNode("div",hm,[C[45]||(C[45]=t.createElementVNode("div",{class:"done-icon"},[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"40",height:"40"},[t.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),t.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"})])],-1)),t.createElementVNode("h4",null,t.toDisplayString(i("accountWizard.accountCreated")),1),t.createElementVNode("p",null,t.toDisplayString(H.value)+" has been added to "+t.toDisplayString(m.value)+".",1),t.createElementVNode("div",vm,[t.createElementVNode("button",{class:"btn btn-outline","data-tour":"wiz-done-add",onClick:q},t.toDisplayString(i("accountWizard.addAnother")),1),t.createElementVNode("button",{class:"btn btn-primary","data-tour":"wiz-done-next-backend",onClick:D},t.toDisplayString(i("accountWizard.doneNextBackend")),1)])])])):t.createCommentVNode("",!0)]))}}),ym=he(Om,[["__scopeId","data-v-469f5272"]]),Am={class:"aia-onboarding"},Im={class:"aia-onboarding__header"},Dm={key:0,class:"aia-onboarding__welcome"},Mm={key:1,class:"aia-onboarding__status"},Lm={key:2,class:"aia-onboarding__kind-grid"},xm=["disabled","onClick"],km={class:"aia-kind-card__name"},wm={key:0,class:"aia-kind-card__badge"},Pm={key:1,class:"aia-kind-card__badge aia-kind-card__badge--missing"},Bm={key:3,class:"aia-onboarding__login"},Um={class:"aia-onboarding__tabs"},Fm={class:"aia-label"},Gm={key:1,class:"aia-onboarding__oauth-start"},Ym={key:4,class:"aia-onboarding__oauth-challenge"},Vm=["href"],qm={class:"aia-code-display"},zm={key:5,class:"aia-onboarding__status"},Hm={key:6,class:"aia-onboarding__success"},$m={key:7,class:"aia-onboarding__error"},Wm=t.defineComponent({__name:"OnboardingFlow",props:{client:{},kinds:{},supportedFlowsByKind:{}},emits:["done","cancel"],setup(n,{emit:e}){const a=n,r=e,i=et.useOnboarding({client:a.client}),s=t.ref(""),o=t.ref("api_key"),l=[{id:"claude",display:"Claude"},{id:"opencode",display:"OpenCode"},{id:"antigravity",display:"Antigravity"},{id:"codex",display:"Codex"},{id:"deepseek",display:"DeepSeek"},{id:"goose",display:"Goose"},{id:"aider",display:"Aider"},{id:"crush",display:"Crush"}],d={claude:["api_key"],opencode:["api_key"],antigravity:["api_key","oauth_device"],codex:["api_key","oauth_device"],deepseek:["api_key"],goose:["api_key"],aider:["api_key"],crush:["api_key"]},_=t.computed(()=>a.kinds??l),c=t.computed(()=>a.supportedFlowsByKind??d),u=t.computed(()=>{const b=i.selectedKind.value;return b?c.value[b]??["api_key"]:["api_key"]});async function m(){await i.start(),i.state.value!=="error"&&await i.detect()}async function p(b){await i.pickKind(b);const S=u.value;o.value=S[0]??"api_key"}async function E(){await i.submitApiKey(s.value)}async function T(){await i.submitOauthDevice()}t.watch(()=>i.state.value,b=>{b==="done"&&i.createdBackendId.value&&r("done",i.createdBackendId.value)},{immediate:!1});function f(){i.reset()}function O(){var S;const b=(S=i.oauthChallenge.value)==null?void 0:S.user_code;b&&typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(b)}function N(b){var S,v;return(v=(S=i.kinds.value)==null?void 0:S.find(A=>A.id===b))==null?void 0:v.detection}return(b,S)=>{var v,A,B;return t.openBlock(),t.createElementBlock("section",Am,[t.createElementVNode("header",Im,[t.renderSlot(b.$slots,"header",{},()=>[S[4]||(S[4]=t.createElementVNode("h2",null,"Set up an AI backend",-1))],!0)]),t.unref(i).state.value==="idle"?(t.openBlock(),t.createElementBlock("div",Dm,[S[5]||(S[5]=t.createElementVNode("p",null,"Connect one of the supported AI CLIs to get started.",-1)),t.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:m}," Get started ")])):t.unref(i).state.value==="started"||t.unref(i).state.value==="detecting"?(t.openBlock(),t.createElementBlock("div",Mm," Detecting installed CLIs… ")):t.unref(i).state.value==="picking_kind"?(t.openBlock(),t.createElementBlock("div",Lm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,x=>{var k,M,I,H;return t.openBlock(),t.createElementBlock("button",{key:x.id,type:"button",class:t.normalizeClass(["aia-kind-card",{"aia-kind-card--installed":(k=N(x.id))==null?void 0:k.installed,"aia-kind-card--missing":N(x.id)&&!((M=N(x.id))!=null&&M.installed)}]),disabled:!((I=N(x.id))!=null&&I.installed),onClick:Z=>p(x.id)},[t.createElementVNode("span",km,t.toDisplayString(x.display),1),(H=N(x.id))!=null&&H.installed?(t.openBlock(),t.createElementBlock("span",wm," Installed ")):(t.openBlock(),t.createElementBlock("span",Pm," Not installed "))],10,xm)}),128))])):t.unref(i).state.value==="entering_credential"?(t.openBlock(),t.createElementBlock("div",Bm,[t.createElementVNode("div",Um,[u.value.includes("api_key")?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(["aia-tab",{"aia-tab--active":o.value==="api_key"}]),onClick:S[0]||(S[0]=x=>o.value="api_key")}," API key ",2)):t.createCommentVNode("",!0),u.value.includes("oauth_device")?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["aia-tab",{"aia-tab--active":o.value==="oauth_device"}]),onClick:S[1]||(S[1]=x=>o.value="oauth_device")}," Login with browser ",2)):t.createCommentVNode("",!0)]),o.value==="api_key"?(t.openBlock(),t.createElementBlock("form",{key:0,class:"aia-onboarding__form",onSubmit:t.withModifiers(E,["prevent"])},[t.createElementVNode("label",Fm,[S[6]||(S[6]=t.createTextVNode(" API key ",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":S[2]||(S[2]=x=>s.value=x),type:"password",class:"aia-input",autocomplete:"off",required:""},null,512),[[t.vModelText,s.value]])]),S[7]||(S[7]=t.createElementVNode("button",{type:"submit",class:"aia-btn aia-btn--primary"},"Connect",-1))],32)):o.value==="oauth_device"?(t.openBlock(),t.createElementBlock("div",Gm,[S[8]||(S[8]=t.createElementVNode("p",null,"You'll be shown a verification URL and code. Open it in your browser to sign in.",-1)),t.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:T}," Start browser login ")])):t.createCommentVNode("",!0)])):t.unref(i).state.value==="oauth_challenge"||t.unref(i).state.value==="oauth_polling"?(t.openBlock(),t.createElementBlock("div",Ym,[S[9]||(S[9]=t.createElementVNode("p",null,"Open this URL in your browser and enter the code:",-1)),t.createElementVNode("a",{href:(v=t.unref(i).oauthChallenge.value)==null?void 0:v.verification_uri,target:"_blank",rel:"noopener noreferrer",class:"aia-onboarding__oauth-uri"},t.toDisplayString((A=t.unref(i).oauthChallenge.value)==null?void 0:A.verification_uri),9,Vm),t.createElementVNode("div",qm,[t.createElementVNode("code",null,t.toDisplayString((B=t.unref(i).oauthChallenge.value)==null?void 0:B.user_code),1),t.createElementVNode("button",{type:"button",class:"aia-copy-btn",onClick:O},"Copy")]),S[10]||(S[10]=t.createElementVNode("p",{class:"aia-onboarding__hint"},"Waiting for you to complete sign-in…",-1)),t.createElementVNode("button",{type:"button",class:"aia-btn",onClick:S[3]||(S[3]=(...x)=>t.unref(i).cancelOAuth&&t.unref(i).cancelOAuth(...x))},"Cancel")])):t.unref(i).state.value==="validating"?(t.openBlock(),t.createElementBlock("div",zm," Validating credential… ")):t.unref(i).state.value==="done"?(t.openBlock(),t.createElementBlock("div",Hm,[t.renderSlot(b.$slots,"success",{},()=>[S[11]||(S[11]=t.createElementVNode("p",null,"✓ Connected successfully",-1))],!0)])):t.unref(i).state.value==="error"?(t.openBlock(),t.createElementBlock("div",$m,[t.createElementVNode("p",null,t.toDisplayString(t.unref(i).error.value),1),t.createElementVNode("button",{type:"button",class:"aia-btn",onClick:f},"Try again")])):t.createCommentVNode("",!0)])}}}),Km=he(Wm,[["__scopeId","data-v-43800d8a"]]),Qm=["value","type","onInput"],Xm={class:"aia-actions"},Zm=["disabled"],Jm={key:0,class:"aia-error"},jm=t.defineComponent({__name:"AccountEditForm",props:{account:{},metadata:{}},emits:["saved","cancel"],setup(n,{emit:e}){const a=n,r=e,{client:i}=et.useAiAccounts(),s=t.reactive({display_name:a.account.display_name,config:{...a.account.config}}),o=t.ref(!1),l=t.ref(null),d=t.computed(()=>{var c;return((c=a.metadata.config_schema)==null?void 0:c.properties)??{}});async function _(){o.value=!0,l.value=null;try{const c=await i.updateBackend(a.account.id,{display_name:s.display_name,config:s.config});r("saved",c)}catch(c){l.value=c instanceof Error?c.message:String(c)}finally{o.value=!1}}return(c,u)=>(t.openBlock(),t.createElementBlock("form",{class:"aia-account-edit",onSubmit:t.withModifiers(_,["prevent"])},[t.createElementVNode("label",null,[u[2]||(u[2]=t.createTextVNode(" Display name ",-1)),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=m=>s.display_name=m),type:"text",required:""},null,512),[[t.vModelText,s.display_name]])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(m,p)=>(t.openBlock(),t.createElementBlock("div",{key:p,class:"aia-field"},[t.createElementVNode("label",null,[t.createTextVNode(t.toDisplayString(p)+" ",1),t.createElementVNode("input",{value:s.config[p]??"",type:String(p).toLowerCase().includes("secret")||String(p).toLowerCase().includes("key")?"password":"text",onInput:E=>s.config[p]=E.target.value},null,40,Qm)])]))),128)),t.createElementVNode("div",Xm,[t.createElementVNode("button",{type:"submit",disabled:o.value},t.toDisplayString(o.value?"Saving…":"Save"),9,Zm),t.createElementVNode("button",{type:"button",onClick:u[1]||(u[1]=m=>r("cancel"))},"Cancel")]),l.value?(t.openBlock(),t.createElementBlock("p",Jm,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0)],32))}}),eE=he(jm,[["__scopeId","data-v-56b7b8c3"]]),tE={class:"aia-reauth"},nE=["disabled","title"],aE={key:1,class:"aia-reauth__flows"},rE=["onClick"],iE={class:"aia-reauth__panel"},oE={class:"aia-reauth__head"},sE={key:0,class:"aia-reauth__ok"},lE=t.defineComponent({__name:"AccountReauth",props:{account:{}},emits:["reauthed"],setup(n,{emit:e}){const a=n,r=e,i=et.useBackendRegistry(),s=et.useLoginSession(),o=t.ref(!1),l=t.ref(!1),d=t.ref(!1),_=t.computed(()=>{var E;return((E=i.get(a.account.kind))==null?void 0:E.login_flows)??[]}),c=t.computed(()=>a.account.display_name||a.account.id);async function u(){var E;d.value=!0;try{i.loaded.value||await i.load()}finally{d.value=!1}_.value.length>1?l.value=!0:await m(((E=_.value[0])==null?void 0:E.kind)??"cli_browser")}async function m(E){l.value=!1,s.reset(),o.value=!0,await s.start(a.account.id,E,{})}function p(){s.status.value==="running"&&s.cancel(),s.reset(),o.value=!1,l.value=!1}return t.watch(()=>s.status.value,E=>{E==="complete"&&r("reauthed",a.account.id)}),(E,T)=>(t.openBlock(),t.createElementBlock("div",tE,[!o.value&&!l.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"aia-reauth__btn",disabled:d.value,title:`Re-authenticate ${c.value}`,onClick:u},[T[1]||(T[1]=t.createElementVNode("span",{class:"aia-reauth__icon","aria-hidden":"true"},"↻",-1)),t.createTextVNode(" "+t.toDisplayString(d.value?"Loading…":"Re-auth"),1)],8,nE)):l.value?(t.openBlock(),t.createElementBlock("div",aE,[T[2]||(T[2]=t.createElementVNode("span",{class:"aia-reauth__flows-label"},"Sign in via:",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,f=>(t.openBlock(),t.createElementBlock("button",{key:f.kind,type:"button",class:"aia-reauth__flow",onClick:O=>m(f.kind)},t.toDisplayString(f.display_name||f.kind),9,rE))),128)),t.createElementVNode("button",{type:"button",class:"aia-reauth__flow aia-reauth__flow--ghost",onClick:T[0]||(T[0]=f=>l.value=!1)}," Cancel ")])):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("div",{key:2,class:"aia-reauth__overlay",onClick:t.withModifiers(p,["self"])},[t.createElementVNode("div",iE,[t.createElementVNode("header",oE,[t.createElementVNode("strong",null,"Re-authenticate "+t.toDisplayString(c.value),1),t.createElementVNode("button",{type:"button",class:"aia-reauth__close","aria-label":"Close",onClick:p},"×")]),t.unref(s).status.value==="complete"?(t.openBlock(),t.createElementBlock("div",sE,[T[3]||(T[3]=t.createElementVNode("span",null,"✓ Re-authenticated.",-1)),t.createElementVNode("button",{type:"button",class:"aia-reauth__flow",onClick:p},"Done")])):(t.openBlock(),t.createBlock(no,{key:1,session:t.unref(s),"backend-kind":n.account.kind},null,8,["session","backend-kind"]))])])):t.createCommentVNode("",!0)]))}}),cE=he(lE,[["__scopeId","data-v-ebacc071"]]),_E={class:"aia-chat-message__role"},dE={class:"aia-chat-message__content"},uE={key:0,class:"aia-chat-message__meta"},pE={key:0},mE={key:1},EE={key:2},gE=t.defineComponent({__name:"ChatMessage",props:{role:{},content:{},model:{},tokensIn:{},tokensOut:{},streaming:{type:Boolean}},setup(n){return(e,a)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["aia-chat-message",[`aia-chat-message--${n.role}`,{"aia-chat-message--streaming":n.streaming}]])},[t.createElementVNode("div",_E,t.toDisplayString(n.role),1),t.createElementVNode("div",dE,t.toDisplayString(n.content),1),n.tokensIn||n.tokensOut?(t.openBlock(),t.createElementBlock("div",uE,[n.tokensIn?(t.openBlock(),t.createElementBlock("span",pE,t.toDisplayString(n.tokensIn)+" in",1)):t.createCommentVNode("",!0),n.tokensOut?(t.openBlock(),t.createElementBlock("span",mE,t.toDisplayString(n.tokensOut)+" out",1)):t.createCommentVNode("",!0),n.model?(t.openBlock(),t.createElementBlock("span",EE,t.toDisplayString(n.model),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],2))}}),Xi=he(gE,[["__scopeId","data-v-52897838"]]),SE={class:"aia-chat-panel"},TE={class:"aia-chat-panel__messages"},bE={class:"aia-chat-panel__input"},fE=["disabled"],RE=["disabled"],CE=t.defineComponent({__name:"ChatPanel",props:{messages:{},streamingText:{},isStreaming:{type:Boolean},disabled:{type:Boolean}},emits:["send"],setup(n,{emit:e}){const a=n,r=e,i=t.ref(""),s=t.ref(null);function o(){const d=i.value.trim();!d||a.disabled||a.isStreaming||(r("send",d),i.value="")}function l(d){d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),o())}return t.watch(()=>a.messages.length,()=>t.nextTick(()=>{var d;return(d=s.value)==null?void 0:d.scrollIntoView({behavior:"smooth"})})),(d,_)=>(t.openBlock(),t.createElementBlock("div",SE,[t.createElementVNode("div",TE,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.messages,c=>(t.openBlock(),t.createBlock(Xi,{key:c.id,role:c.role,content:c.content,model:c.model||void 0,"tokens-in":c.tokens_in||void 0,"tokens-out":c.tokens_out||void 0},null,8,["role","content","model","tokens-in","tokens-out"]))),128)),n.isStreaming&&n.streamingText?(t.openBlock(),t.createBlock(Xi,{key:0,role:"assistant",content:n.streamingText,streaming:!0},null,8,["content"])):t.createCommentVNode("",!0),t.createElementVNode("div",{ref_key:"messagesEnd",ref:s},null,512)]),t.createElementVNode("div",bE,[t.withDirectives(t.createElementVNode("textarea",{"onUpdate:modelValue":_[0]||(_[0]=c=>i.value=c),class:"aia-chat-panel__textarea",placeholder:"Type a message...",rows:"2",disabled:n.disabled||n.isStreaming,onKeydown:l},null,40,fE),[[t.vModelText,i.value]]),t.createElementVNode("button",{class:"aia-chat-panel__send",disabled:!i.value.trim()||n.disabled||n.isStreaming,onClick:o},"Send",8,RE)])]))}}),NE=he(CE,[["__scopeId","data-v-2904376c"]]);function ao(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ct=ao();function x_(n){Ct=n}var bt={exec:()=>null};function se(n,e=""){let a=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ue.caret,"$1"),a=a.replace(i,o),r},getRegex:()=>new RegExp(a,e)};return r}var hE=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ue={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},vE=/^(?:[ \t]*(?:\n|$))+/,OE=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yE=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Kt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,AE=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ro=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,k_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,w_=se(k_).replace(/bull/g,ro).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),IE=se(k_).replace(/bull/g,ro).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),io=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,DE=/^[^\n]+/,oo=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ME=se(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",oo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),LE=se(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ro).getRegex(),sn="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",so=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,xE=se("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",so).replace("tag",sn).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),P_=se(io).replace("hr",Kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sn).getRegex(),kE=se(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",P_).getRegex(),lo={blockquote:kE,code:OE,def:ME,fences:yE,heading:AE,hr:Kt,html:xE,lheading:w_,list:LE,newline:vE,paragraph:P_,table:bt,text:DE},Io=se("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sn).getRegex(),wE={...lo,lheading:IE,table:Io,paragraph:se(io).replace("hr",Kt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Io).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",sn).getRegex()},PE={...lo,html:se(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",so).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:bt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:se(io).replace("hr",Kt).replace("heading",` *#{1,6} *[^
2
2
  ]`).replace("lheading",w_).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},BE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,UE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,B_=/^( {2,}|\\)\n(?!\s*$)/,FE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Mt=/[\p{P}\p{S}]/u,ln=/[\s\p{P}\p{S}]/u,co=/[^\s\p{P}\p{S}]/u,GE=se(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ln).getRegex(),U_=/(?!~)[\p{P}\p{S}]/u,YE=/(?!~)[\s\p{P}\p{S}]/u,VE=/(?:[^\s\p{P}\p{S}]|~)/u,qE=se(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",hE?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),F_=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,zE=se(F_,"u").replace(/punct/g,Mt).getRegex(),HE=se(F_,"u").replace(/punct/g,U_).getRegex(),G_="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",$E=se(G_,"gu").replace(/notPunctSpace/g,co).replace(/punctSpace/g,ln).replace(/punct/g,Mt).getRegex(),WE=se(G_,"gu").replace(/notPunctSpace/g,VE).replace(/punctSpace/g,YE).replace(/punct/g,U_).getRegex(),KE=se("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,co).replace(/punctSpace/g,ln).replace(/punct/g,Mt).getRegex(),QE=se(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Mt).getRegex(),XE="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ZE=se(XE,"gu").replace(/notPunctSpace/g,co).replace(/punctSpace/g,ln).replace(/punct/g,Mt).getRegex(),JE=se(/\\(punct)/,"gu").replace(/punct/g,Mt).getRegex(),jE=se(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),eg=se(so).replace("(?:-->|$)","-->").getRegex(),tg=se("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",eg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),nn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ng=se(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",nn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Y_=se(/^!?\[(label)\]\[(ref)\]/).replace("label",nn).replace("ref",oo).getRegex(),V_=se(/^!?\[(ref)\](?:\[\])?/).replace("ref",oo).getRegex(),ag=se("reflink|nolink(?!\\()","g").replace("reflink",Y_).replace("nolink",V_).getRegex(),Do=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_o={_backpedal:bt,anyPunctuation:JE,autolink:jE,blockSkip:qE,br:B_,code:UE,del:bt,delLDelim:bt,delRDelim:bt,emStrongLDelim:zE,emStrongRDelimAst:$E,emStrongRDelimUnd:KE,escape:BE,link:ng,nolink:V_,punctuation:GE,reflink:Y_,reflinkSearch:ag,tag:tg,text:FE,url:bt},rg={..._o,link:se(/^!?\[(label)\]\((.*?)\)/).replace("label",nn).getRegex(),reflink:se(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",nn).getRegex()},Zi={..._o,emStrongRDelimAst:WE,emStrongLDelim:HE,delLDelim:QE,delRDelim:ZE,url:se(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Do).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:se(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Do).getRegex()},ig={...Zi,br:se(B_).replace("{2,}","*").getRegex(),text:se(Zi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Zt={normal:lo,gfm:wE,pedantic:PE},Ut={normal:_o,gfm:Zi,breaks:ig,pedantic:rg},og={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Mo=n=>og[n];function pt(n,e){if(e){if(Ue.escapeTest.test(n))return n.replace(Ue.escapeReplace,Mo)}else if(Ue.escapeTestNoEncode.test(n))return n.replace(Ue.escapeReplaceNoEncode,Mo);return n}function Lo(n){try{n=encodeURI(n).replace(Ue.percentDecode,"%")}catch{return null}return n}function xo(n,e){var s;let a=n.replace(Ue.findPipe,(o,l,d)=>{let _=!1,c=l;for(;--c>=0&&d[c]==="\\";)_=!_;return _?"|":" |"}),r=a.split(Ue.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Ue.slashPipe,"|");return r}function gt(n,e,a){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function ko(n){let e=n.split(`
3
3
  `),a=e.length-1;for(;a>=0&&!e[a].trim();)a--;return e.length-a<=2?n:e.slice(0,a+1).join(`
4
4
  `)}function sg(n,e){if(n.indexOf(e[1])===-1)return-1;let a=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])a++;else if(n[r]===e[1]&&(a--,a<0))return r;return a>0?-2:-1}function lg(n,e=0){let a=e,r="";for(let i of n)if(i===" "){let s=4-a%4;r+=" ".repeat(s),a+=s}else r+=i,a++;return r}function wo(n,e,a,r,i){let s=e.href,o=e.title||null,l=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:n[0].charAt(0)==="!"?"image":"link",raw:a,href:s,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,d}function cg(n,e,a){let r=n.match(a.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
@@ -76,4 +76,4 @@ ${u.content}`).join(`
76
76
 
77
77
  ---
78
78
 
79
- `)}function d(){!e.allMessages||e.allMessages.length===0||i(l(e.allMessages))}function _(){if(!e.allMessages||e.allMessages.length===0)return;const c=l(e.allMessages),u=new Blob([c],{type:"text/plain;charset=utf-8"}),m=URL.createObjectURL(u),p=document.createElement("a");p.href=m,p.download=`conversation-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.txt`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(m)}return(c,u)=>(t.openBlock(),t.createElementBlock("div",lR,[t.createElementVNode("button",{class:"action-btn action-copy",title:a.value==="success"?"Copied!":a.value==="error"?"Copy failed":"Copy message",onClick:t.withModifiers(s,["stop"])},[n.iconButtons?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[a.value==="success"?(t.openBlock(),t.createElementBlock("svg",_R,[...u[0]||(u[0]=[t.createElementVNode("path",{d:"M20 6L9 17l-5-5"},null,-1)])])):a.value==="error"?(t.openBlock(),t.createElementBlock("svg",dR,[...u[1]||(u[1]=[t.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",uR,[...u[2]||(u[2]=[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"},null,-1)])]))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[a.value==="idle"?(t.openBlock(),t.createElementBlock("span",pR,"Copy")):a.value==="success"?(t.openBlock(),t.createElementBlock("span",mR,"Copied")):(t.openBlock(),t.createElementBlock("span",ER,"Failed"))],64))],8,cR),n.allMessages?(t.openBlock(),t.createElementBlock("button",{key:0,class:"action-btn action-copy-all",title:"Copy conversation",onClick:t.withModifiers(d,["stop"])},[n.iconButtons?(t.openBlock(),t.createElementBlock("svg",gR,[...u[3]||(u[3]=[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"},null,-1),t.createElementVNode("line",{x1:"14",y1:"14",x2:"18",y2:"14"},null,-1),t.createElementVNode("line",{x1:"14",y1:"17",x2:"18",y2:"17"},null,-1)])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode("Copy All")],64))])):t.createCommentVNode("",!0),n.allMessages?(t.openBlock(),t.createElementBlock("button",{key:1,class:"action-btn action-export",title:"Export conversation",onClick:t.withModifiers(_,["stop"])},[n.iconButtons?(t.openBlock(),t.createElementBlock("svg",SR,[...u[4]||(u[4]=[t.createElementVNode("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"},null,-1),t.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1),t.createElementVNode("line",{x1:"12",y1:"15",x2:"12",y2:"3"},null,-1)])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode("Export")],64))])):t.createCommentVNode("",!0)]))}}),So=he(TR,[["__scopeId","data-v-519341e8"]]),bR={claude:"Claude",codex:"Codex",antigravity:"Antigravity",opencode:"OpenCode",deepseek:"DeepSeek",goose:"Goose",aider:"Aider",crush:"Crush",openai_compat:"OpenAI-compatible",openrouter:"OpenRouter",kimi:"Kimi"};function To(n){return!n||n==="auto"?"":bR[n]??n.charAt(0).toUpperCase()+n.slice(1)}const fR={opus:"Opus",sonnet:"Sonnet",haiku:"Haiku",codex:"Codex",zen:"Zen"};function RR(n){return n?fR[n]??n:""}const CR={class:"aia-bubble__avatar"},NR={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},hR=["d"],vR={class:"aia-bubble__body"},OR={class:"aia-bubble__header"},yR={class:"aia-bubble__role"},AR={key:0,class:"aia-bubble__model"},IR={key:1,class:"aia-bubble__time"},DR=["innerHTML"],MR=t.defineComponent({__name:"ChatBubble",props:{role:{},content:{},backend:{},model:{},timestamp:{},streaming:{type:Boolean,default:!1},showActions:{type:Boolean,default:!1},allMessages:{},avatarPaths:{},assistantName:{},skipTransition:{type:Boolean,default:!1}},setup(n){const e={code({text:_,lang:c}){let u;return c&&zi.getLanguage(c)?u=zi.highlight(_,{language:c}).value:u=zi.highlightAuto(_).value,`<pre><code${c?` class="language-${c}"`:""}>${u}</code></pre>`}};_e.use({renderer:e});const a=n,r=t.computed(()=>sR.sanitize(_e.parse(a.content||""))),i=t.computed(()=>{if(!a.timestamp)return"";const _=new Date(a.timestamp);return Number.isNaN(_.getTime())?"":_.toLocaleTimeString()});function s(_){var m;const c=_.target.closest(".aia-copy-btn");if(!c)return;const u=(m=c.closest(".aia-code-block"))==null?void 0:m.querySelector("code");u&&navigator.clipboard.writeText(u.textContent||"")}const o=t.computed(()=>{var c;if(a.role==="user")return"You";const _=(c=a.assistantName)==null?void 0:c.trim();return _||(a.role==="assistant"?To(a.backend)||"Assistant":a.role)}),l=t.computed(()=>a.role==="user"?"U":a.role==="tool"?"T":a.role==="system"?"S":(o.value.charAt(0)||"A").toUpperCase()),d=t.computed(()=>a.role==="assistant"?RR(a.model):"");return(_,c)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["aia-bubble",[`aia-bubble--${n.role}`,{"aia-bubble--streaming":n.streaming,"aia-bubble--fade-in":!n.skipTransition}]])},[t.createElementVNode("div",CR,[n.avatarPaths&&n.avatarPaths.length>0?(t.openBlock(),t.createElementBlock("svg",NR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.avatarPaths,(u,m)=>(t.openBlock(),t.createElementBlock("path",{key:m,d:u},null,8,hR))),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(l.value),1)],64))]),t.createElementVNode("div",vR,[t.createElementVNode("div",OR,[t.createElementVNode("span",yR,t.toDisplayString(o.value),1),d.value?(t.openBlock(),t.createElementBlock("span",AR,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createElementBlock("span",IR,t.toDisplayString(i.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:"aia-bubble__content",onClick:s,innerHTML:r.value},null,8,DR)]),n.showActions?(t.openBlock(),t.createBlock(So,t.mergeProps({key:0,content:n.content},n.allMessages!==void 0?{allMessages:n.allMessages}:{}),null,16,["content"])):t.createCommentVNode("",!0)],2))}}),Wt=he(MR,[["__scopeId","data-v-fe84dfc8"]]),LR={class:"aia-controls"},xR={class:"aia-controls__group"},kR=["value"],wR=["value"],PR={class:"aia-controls__group"},BR=["disabled","value"],UR={value:""},FR=["value"],GR={class:"aia-controls__group"},YR=["disabled","value"],VR={value:""},qR=["value"],zR={class:"aia-controls__group aia-controls__group--mode"},HR={class:"aia-controls__modes"},$R=["onClick"],WR=t.defineComponent({__name:"ChatControls",props:{chatMode:{},selectedBackend:{},selectedAccount:{},selectedModel:{},backends:{}},emits:["update:chatMode","update:selectedBackend","update:selectedAccount","update:selectedModel"],setup(n,{emit:e}){const a=n,r=e,i=[{value:"single",label:"Single"},{value:"all",label:"All"},{value:"compound",label:"Compound"}],s=t.computed(()=>!a.selectedBackend),o=t.computed(()=>a.backends.find(_=>_.kind===a.selectedBackend)),l=t.computed(()=>{var _;return((_=o.value)==null?void 0:_.accounts)??[]}),d=t.computed(()=>{var _;return((_=o.value)==null?void 0:_.models)??[]});return(_,c)=>(t.openBlock(),t.createElementBlock("div",LR,[t.createElementVNode("div",xR,[c[4]||(c[4]=t.createElementVNode("label",{class:"aia-controls__label"},"Backend",-1)),t.createElementVNode("select",{class:"aia-controls__select",value:n.selectedBackend??"",onChange:c[0]||(c[0]=u=>r("update:selectedBackend",u.target.value||null))},[c[3]||(c[3]=t.createElementVNode("option",{value:""},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.backends,u=>(t.openBlock(),t.createElementBlock("option",{key:u.kind,value:u.kind},t.toDisplayString(u.displayName),9,wR))),128))],40,kR)]),t.createElementVNode("div",PR,[c[5]||(c[5]=t.createElementVNode("label",{class:"aia-controls__label"},"Account",-1)),t.createElementVNode("select",{class:"aia-controls__select",disabled:s.value,value:n.selectedAccount??"",onChange:c[1]||(c[1]=u=>r("update:selectedAccount",u.target.value||null))},[t.createElementVNode("option",UR,t.toDisplayString(s.value?"--":"Default"),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,u=>(t.openBlock(),t.createElementBlock("option",{key:u.id,value:u.id},t.toDisplayString(u.label),9,FR))),128))],40,BR)]),t.createElementVNode("div",GR,[c[6]||(c[6]=t.createElementVNode("label",{class:"aia-controls__label"},"Model",-1)),t.createElementVNode("select",{class:"aia-controls__select",disabled:s.value,value:n.selectedModel??"",onChange:c[2]||(c[2]=u=>r("update:selectedModel",u.target.value||null))},[t.createElementVNode("option",VR,t.toDisplayString(s.value?"--":"Default"),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,u=>(t.openBlock(),t.createElementBlock("option",{key:u,value:u},t.toDisplayString(u),9,qR))),128))],40,YR)]),t.createElementVNode("div",zR,[c[7]||(c[7]=t.createElementVNode("label",{class:"aia-controls__label"},"Mode",-1)),t.createElementVNode("div",HR,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,u=>t.createElementVNode("button",{key:u.value,class:t.normalizeClass(["aia-controls__mode-btn",{"aia-controls__mode-btn--active":n.chatMode===u.value}]),onClick:m=>r("update:chatMode",u.value)},t.toDisplayString(u.label),11,$R)),64))])])]))}}),id=he(WR,[["__scopeId","data-v-a9f4b1df"]]),KR={class:"aia-input"},QR=["placeholder","disabled"],XR=["disabled"],ZR=t.defineComponent({__name:"ChatInput",props:{placeholder:{default:"Type a message..."},disabled:{type:Boolean},isStreaming:{type:Boolean}},emits:["send"],setup(n,{emit:e}){const a=n,r=e,i=t.ref(""),s=t.ref(null);function o(){const _=i.value.trim();!_||a.disabled||a.isStreaming||(r("send",_),i.value="",t.nextTick(d))}function l(_){_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),o())}function d(){const _=s.value;_&&(_.style.height="auto",_.style.height=Math.min(_.scrollHeight,120)+"px")}return t.watch(i,()=>t.nextTick(d)),(_,c)=>(t.openBlock(),t.createElementBlock("div",KR,[t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:s,"onUpdate:modelValue":c[0]||(c[0]=u=>i.value=u),class:"aia-input__textarea",placeholder:n.placeholder,rows:"1",disabled:n.disabled||n.isStreaming,onKeydown:l,onInput:d},null,40,QR),[[t.vModelText,i.value]]),t.createElementVNode("button",{class:"aia-input__send",disabled:!i.value.trim()||n.disabled||n.isStreaming,onClick:o},t.toDisplayString(n.isStreaming?"...":"Send"),9,XR)]))}}),od=he(ZR,[["__scopeId","data-v-51976e76"]]),JR={class:"aia-responses"},jR={class:"aia-responses__summary-count"},eC=["open"],tC={class:"aia-resp__header"},nC={key:0,class:"aia-resp__account"},aC=["innerHTML"],rC={key:1,class:"aia-resp__error",role:"alert"},iC={key:0,class:"aia-resp__error-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"16",height:"16","aria-hidden":"true"},oC={key:1,class:"aia-resp__error-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"16",height:"16","aria-hidden":"true"},sC={class:"aia-resp__error-text"},lC={class:"aia-resp__error-title"},cC={key:0,class:"aia-resp__error-hint"},_C={class:"aia-resp__error-detail"},dC=t.defineComponent({__name:"AllModeResponses",props:{responses:{},collapsible:{type:Boolean,default:!1},summaryHeader:{type:Boolean,default:!1},waitingPlaceholder:{default:null}},setup(n){const e=n,a={claude:{bg:"rgba(139,92,246,0.15)",fg:"#a78bfa",label:"Claude"},codex:{bg:"rgba(16,185,129,0.15)",fg:"#34d399",label:"Codex"},antigravity:{bg:"rgba(96,165,250,0.15)",fg:"#60a5fa",label:"Antigravity"},opencode:{bg:"rgba(251,191,36,0.15)",fg:"#fbbf24",label:"OpenCode"},deepseek:{bg:"rgba(59,130,246,0.15)",fg:"#3b82f6",label:"DeepSeek"},goose:{bg:"rgba(249,115,22,0.15)",fg:"#f97316",label:"Goose"},aider:{bg:"rgba(20,184,166,0.15)",fg:"#14b8a6",label:"Aider"},crush:{bg:"rgba(239,68,68,0.15)",fg:"#ef4444",label:"Crush"},openai_compat:{bg:"rgba(34,211,238,0.15)",fg:"#22d3ee",label:"OpenAI-compatible"},openrouter:{bg:"rgba(129,140,248,0.15)",fg:"#818cf8",label:"OpenRouter"},kimi:{bg:"rgba(232,121,249,0.15)",fg:"#e879f9",label:"Kimi"}};function r(m){return m?a[m]??{bg:"rgba(161,161,170,0.15)",fg:"#a1a1aa",label:m}:{bg:"rgba(161,161,170,0.15)",fg:"#a1a1aa",label:"Backend"}}function i(m){switch(m){case"streaming":return{text:"Streaming",cls:"aia-resp__badge--streaming"};case"complete":return{text:"Done",cls:"aia-resp__badge--complete"};case"error":return{text:"Error",cls:"aia-resp__badge--error"};case"timeout":return{text:"Timeout",cls:"aia-resp__badge--timeout"};default:return{text:m,cls:""}}}function s(m){const p=m||"";if(/^no models available/i.test(p))return{title:"No models available",hint:"CLIProxyAPI advertises zero models for this backend. Make sure cliproxyapi is running and this backend’s account is registered."};if(/^could not enumerate models/i.test(p))return{title:"Could not list models",hint:"Failed to fetch the model list for this backend."};if(/^no account available/i.test(p))return{title:"No account available",hint:"No ready account is registered for this backend kind."};const E=p.match(/'([^']+)' (?:model )?is not supported when using (\w+) with a ([^']+?) account/i);return E?{title:`${E[1]} not available`,hint:`Your ${E[2]} account is authenticated via ${E[3]}, which doesn't expose this model. Switch to an API-key login or pick a different model.`}:/^Proxy error/i.test(p)?{title:"Upstream proxy error",hint:null}:/timed?\s*out/i.test(p)?{title:"Backend timed out",hint:null}:{title:"Backend error",hint:null}}const o=t.computed(()=>Array.from(e.responses.entries()));function l(m){return _e.parse(m||"")}const d=t.ref(!1),_=t.computed(()=>{const m=o.value.length,p=o.value.filter(([,T])=>T.status==="complete").length;return m-p>0?`${p}/${m} backends responded`:`${m} backend responses`});t.watch(()=>e.summaryHeader,m=>{m||(d.value=!1)});function c(m){return(m.status==="error"||m.status==="timeout")&&!m.content?!1:(e.waitingPlaceholder&&m.status==="streaming"&&!m.content,!0)}function u(m){return!m.content&&e.waitingPlaceholder&&m.status==="streaming"?`<em class="aia-resp__waiting">${e.waitingPlaceholder}</em>`:l(m.content)}return(m,p)=>(t.openBlock(),t.createElementBlock("div",JR,[n.summaryHeader&&o.value.length>0?(t.openBlock(),t.createElementBlock("button",{key:0,class:"aia-responses__summary",onClick:p[0]||(p[0]=E=>d.value=!d.value)},[(t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(["aia-responses__summary-chevron",{"is-open":d.value}]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14","aria-hidden":"true"},[...p[1]||(p[1]=[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"},null,-1)])],2)),p[2]||(p[2]=t.createElementVNode("span",{class:"aia-responses__summary-label"},"Individual Responses",-1)),t.createElementVNode("span",jR,t.toDisplayString(_.value),1)])):t.createCommentVNode("",!0),!n.summaryHeader||d.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(o.value,([E,T])=>(t.openBlock(),t.createElementBlock("div",{key:E,class:t.normalizeClass(["aia-resp",{"aia-resp--error":T.status==="error","aia-resp--timeout":T.status==="timeout"}]),style:t.normalizeStyle({"--resp-bg":r(T.backendKind).bg,"--resp-fg":r(T.backendKind).fg})},[t.createElementVNode("details",{open:!n.collapsible||void 0},[t.createElementVNode("summary",tC,[t.createElementVNode("span",{class:"aia-resp__name",style:t.normalizeStyle({color:r(T.backendKind).fg})},t.toDisplayString(r(T.backendKind).label),5),T.accountLabel?(t.openBlock(),t.createElementBlock("span",nC,t.toDisplayString(T.accountLabel),1)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["aia-resp__badge",i(T.status).cls])},t.toDisplayString(i(T.status).text),3)]),c(T)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"aia-resp__body",innerHTML:u(T)},null,8,aC)):t.createCommentVNode("",!0),T.error?(t.openBlock(),t.createElementBlock("div",rC,[T.status==="timeout"?(t.openBlock(),t.createElementBlock("svg",iC,[...p[3]||(p[3]=[t.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1),t.createElementVNode("polyline",{points:"12 7 12 12 15 14"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",oC,[...p[4]||(p[4]=[t.createElementVNode("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"},null,-1),t.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"},null,-1),t.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"},null,-1)])])),t.createElementVNode("div",sC,[t.createElementVNode("strong",lC,t.toDisplayString(s(T.error).title),1),s(T.error).hint?(t.openBlock(),t.createElementBlock("p",cC,t.toDisplayString(s(T.error).hint),1)):t.createCommentVNode("",!0),t.createElementVNode("code",_C,t.toDisplayString(T.error),1)])])):t.createCommentVNode("",!0)],8,eC)],6))),128)):t.createCommentVNode("",!0)]))}}),bo=he(dC,[["__scopeId","data-v-364ac9d5"]]),uC={class:"aia-synth__header"},pC={key:0,class:"aia-synth__sparkle","aria-hidden":"true"},mC={key:1,class:"aia-synth__via"},EC={key:0,class:"aia-synth__sources"},gC={key:1,class:"aia-synth__placeholder"},SC=["innerHTML"],TC={key:3,class:"aia-synth__error"},bC=t.defineComponent({__name:"CompoundSynthesis",props:{state:{},sparkleIcon:{type:Boolean,default:!1},loadingPlaceholders:{type:Boolean,default:!1}},setup(n){const e=n,a=t.computed(()=>_e.parse(e.state.content||"")),r=t.computed(()=>e.state.status==="streaming"),i=t.computed(()=>!!(e.state.content&&e.state.content.length>0)),s=t.computed(()=>e.loadingPlaceholders&&!i.value&&(e.state.status==="streaming"||e.state.status==="waiting")),o=t.computed(()=>e.state.status==="streaming"?"Generating synthesis...":"Waiting for backend responses...");function l(d){switch(d){case"waiting":return{text:"Waiting...",cls:"aia-synth__badge--waiting"};case"streaming":return{text:"Synthesizing",cls:"aia-synth__badge--streaming"};case"complete":return{text:"Complete",cls:"aia-synth__badge--complete"};case"error":return{text:"Error",cls:"aia-synth__badge--error"};default:return{text:d,cls:""}}}return(d,_)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["aia-synth",{"aia-synth--streaming":r.value}])},[t.createElementVNode("div",uC,[n.sparkleIcon?(t.openBlock(),t.createElementBlock("span",pC,"✨")):t.createCommentVNode("",!0),_[0]||(_[0]=t.createElementVNode("span",{class:"aia-synth__label"},"Compound Synthesis",-1)),n.state.primaryBackend?(t.openBlock(),t.createElementBlock("span",mC,"via "+t.toDisplayString(n.state.primaryBackend),1)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["aia-synth__badge",l(n.state.status).cls])},t.toDisplayString(l(n.state.status).text),3)]),n.state.backendsCollected.length?(t.openBlock(),t.createElementBlock("div",EC," Sources: "+t.toDisplayString(n.state.backendsCollected.join(", ")),1)):t.createCommentVNode("",!0),s.value?(t.openBlock(),t.createElementBlock("div",gC,t.toDisplayString(o.value),1)):(t.openBlock(),t.createElementBlock("div",{key:2,class:"aia-synth__content",innerHTML:a.value},null,8,SC)),n.state.error?(t.openBlock(),t.createElementBlock("div",TC,t.toDisplayString(n.state.error),1)):t.createCommentVNode("",!0)],2))}}),fo=he(bC,[["__scopeId","data-v-93a21588"]]),fC={class:"finalization-banner"},RC={class:"banner-content"},CC={class:"banner-title"},NC={class:"banner-description"},hC=["disabled"],vC=t.defineComponent({__name:"FinalizationBanner",props:{title:{},buttonLabel:{},entityLabel:{},entityName:{},isFinalizing:{type:Boolean,default:!1}},emits:["finalize"],setup(n,{emit:e}){const a=e;return(r,i)=>(t.openBlock(),t.createElementBlock("div",fC,[t.createElementVNode("div",RC,[t.createElementVNode("h3",CC,t.toDisplayString(n.title),1),t.createElementVNode("p",NC," Your "+t.toDisplayString(n.entityLabel)+t.toDisplayString(n.entityName?": "+n.entityName:"")+" is ready. Click the button to finalize. ",1)]),t.createElementVNode("button",{class:"banner-button",disabled:n.isFinalizing,onClick:i[0]||(i[0]=s=>a("finalize"))},t.toDisplayString(n.isFinalizing?"Creating...":n.buttonLabel),9,hC)]))}}),sd=he(vC,[["__scopeId","data-v-bde99def"]]),OC={key:0,class:"process-group-badge-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},yC={key:1,class:"process-group-badge-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},AC={key:2,class:"process-group-badge-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},IC={class:"process-group-label"},DC={key:0,class:"process-group-time"},MC={class:"process-group-chevron"},LC={key:0,class:"process-group-body"},xC=t.defineComponent({__name:"ProcessGroup",props:{id:{},type:{},label:{},timestamp:{},isExpanded:{type:Boolean,default:!0},autoCollapseMs:{default:0},iconBadges:{type:Boolean,default:!1}},emits:["toggle"],setup(n,{emit:e}){const a=n,r=e,i={tool_call:"Tool",reasoning:"Thinking",code_execution:"Code"},s={tool_call:"var(--aia-cyan, #22d3ee)",reasoning:"var(--aia-violet, #a78bfa)",code_execution:"var(--aia-amber, #fbbf24)"};function o(p){if(!p)return"";const E=new Date(p);return Number.isNaN(E.getTime())?"":E.toLocaleTimeString()}const l=t.ref(!1);let d=null;function _(){d!==null&&(clearTimeout(d),d=null)}function c(){_(),a.autoCollapseMs>0&&!l.value&&a.isExpanded&&(d=setTimeout(()=>{a.isExpanded&&r("toggle")},a.autoCollapseMs))}function u(){l.value=!0,_()}function m(){l.value=!1,c()}return t.onMounted(()=>{c()}),t.onUnmounted(()=>{_()}),t.watch(()=>a.isExpanded,p=>{p?c():_()}),(p,E)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["process-group",[`process-group--${n.type}`]]),onMouseenter:u,onMouseleave:m},[t.createElementVNode("div",{class:"process-group-header",onClick:E[0]||(E[0]=T=>r("toggle"))},[t.createElementVNode("span",{class:t.normalizeClass(["process-group-badge",[`process-group-badge--${n.type}`,{"process-group-badge--with-icon":n.iconBadges}]]),style:t.normalizeStyle({background:s[n.type]})},[n.iconBadges&&n.type==="tool_call"?(t.openBlock(),t.createElementBlock("svg",OC,[...E[1]||(E[1]=[t.createElementVNode("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"},null,-1)])])):n.iconBadges&&n.type==="reasoning"?(t.openBlock(),t.createElementBlock("svg",yC,[...E[2]||(E[2]=[t.createElementVNode("path",{d:"M12 2a8 8 0 018 8c0 3-2 5.5-4 7l-1 4H9l-1-4c-2-1.5-4-4-4-7a8 8 0 018-8z"},null,-1),t.createElementVNode("path",{d:"M9 21h6M10 17h4"},null,-1)])])):n.iconBadges&&n.type==="code_execution"?(t.openBlock(),t.createElementBlock("svg",AC,[...E[3]||(E[3]=[t.createElementVNode("polyline",{points:"4 17 10 11 4 5"},null,-1),t.createElementVNode("line",{x1:"12",y1:"19",x2:"20",y2:"19"},null,-1)])])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(i[n.type]),1)],6),t.createElementVNode("span",IC,t.toDisplayString(n.label),1),n.timestamp&&o(n.timestamp)?(t.openBlock(),t.createElementBlock("span",DC,t.toDisplayString(o(n.timestamp)),1)):t.createCommentVNode("",!0),t.createElementVNode("span",MC,t.toDisplayString(n.isExpanded?"▼":"▶"),1)]),n.isExpanded?(t.openBlock(),t.createElementBlock("div",LC,[t.renderSlot(p.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)],34))}}),Ro=he(xC,[["__scopeId","data-v-c351adfa"]]),kC={class:"aia-smart-panel"},wC={ref:"scroll.containerRef",class:"aia-smart-panel__messages"},PC={key:0,class:"aia-smart-panel__welcome"},BC={class:"aia-smart-panel__welcome-icon"},UC={class:"aia-smart-panel__welcome-title"},FC={class:"aia-smart-panel__welcome-sub"},GC={key:4,class:"process-groups"},YC={key:2,class:"aia-smart-panel__error"},VC=t.defineComponent({__name:"AiChatPanel",props:{density:{default:"minimal"},defaultBackend:{},defaultModel:{},placeholder:{default:"Type a message..."},welcomeTitle:{default:"AI Chat"},welcomeSubtitle:{default:"Send a message to get started"},readOnly:{type:Boolean},entityLabel:{},bannerTitle:{},bannerButtonLabel:{},configParser:{},showProcessGroups:{type:Boolean,default:void 0},showActions:{type:Boolean,default:void 0}},emits:["finalize"],setup(n,{emit:e}){const a=n,r=t.computed(()=>a.showProcessGroups??a.density==="detailed"),i=t.computed(()=>a.showActions??a.density==="detailed"),s=e,o=et.useSmartChat(),l=et.useSmartScroll(),{client:d}=et.useAiAccounts(),_=t.computed(()=>(To(o.selectedBackend.value)||"Assistant").charAt(0).toUpperCase()),c=t.ref([]),u=t.ref({}),m=t.computed(()=>Array.from(new Set(c.value.map(N=>N.kind))).map(N=>{const b=c.value.filter(S=>S.kind===N);return{kind:N,displayName:N,accounts:b.map(S=>({id:S.id,label:S.display_name||S.id})),models:u.value[N]??[]}}));async function p(N){if(!u.value[N.kind])try{const{items:b}=await d.listModels(N.id);u.value={...u.value,[N.kind]:b.map(S=>S.id)}}catch{}}async function E(){if(await Promise.all(c.value.filter(N=>N.status==="ready").map(p)),!o.selectedModel.value){for(const N of m.value)if(N.models.length>0){o.selectedModel.value=N.models[0],o.selectedBackend.value||(o.selectedBackend.value=N.kind);break}}}t.watchEffect(()=>{o.setConfigParser(a.configParser??null)}),t.onMounted(async()=>{try{const N=await d.listBackends();c.value=N.items??[],await E()}catch{}}),t.watch(()=>[o.selectedBackend.value,o.selectedAccount.value],([N,b],[S,v])=>{o.sessionId.value&&(N!==S||b!==v)&&o.resetSession()});function T(N,b=null){if(b){const v=c.value.find(A=>A.id===b);if(v)return v}const S=N?c.value.filter(v=>v.kind===N):c.value;return S.find(v=>v.status==="ready")??S[0]??null}async function f(N){if(!o.sessionId.value){if(c.value.length===0)try{const B=await d.listBackends();c.value=B.items??[],await E()}catch{o.error.value="Unable to load backends from sidecar";return}const b=o.selectedBackend.value??a.defaultBackend??null,S=o.selectedAccount.value,v=T(b,S);if(!v){o.error.value="No backend available — add an account first";return}let A=o.selectedModel.value??a.defaultModel??"";if(!A){await p(v);const B=u.value[v.kind]??[];B.length>0&&(A=B[0],o.selectedModel.value=A)}if(!A){o.error.value=`No models available for ${v.kind}`;return}try{await o.createSession(v.id,A)}catch(B){o.error.value=B instanceof Error?B.message:String(B);return}}await o.send(N)}async function O(){const N=await o.finalize();s("finalize",N)}return(N,b)=>(t.openBlock(),t.createElementBlock("div",kC,[n.density==="detailed"?(t.openBlock(),t.createBlock(id,{key:0,"chat-mode":t.unref(o).chatMode.value,"selected-backend":t.unref(o).selectedBackend.value,"selected-account":t.unref(o).selectedAccount.value,"selected-model":t.unref(o).selectedModel.value,backends:m.value,"onUpdate:chatMode":t.unref(o).setMode,"onUpdate:selectedBackend":t.unref(o).selectBackend,"onUpdate:selectedAccount":b[0]||(b[0]=S=>t.unref(o).selectedAccount.value=S),"onUpdate:selectedModel":b[1]||(b[1]=S=>t.unref(o).selectedModel.value=S)},null,8,["chat-mode","selected-backend","selected-account","selected-model","backends","onUpdate:chatMode","onUpdate:selectedBackend"])):t.createCommentVNode("",!0),t.createElementVNode("div",wC,[t.unref(o).messages.value.length===0&&!t.unref(o).isStreaming.value?(t.openBlock(),t.createElementBlock("div",PC,[t.createElementVNode("div",BC,t.toDisplayString(_.value),1),t.createElementVNode("h3",UC,t.toDisplayString(n.welcomeTitle),1),t.createElementVNode("p",FC,t.toDisplayString(n.welcomeSubtitle),1)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o).messages.value,S=>(t.openBlock(),t.createBlock(Wt,{key:S.id,role:S.role,content:S.content,timestamp:S.created_at,backend:t.unref(o).selectedBackend.value,model:S.model??t.unref(o).selectedModel.value,"show-actions":i.value,"all-messages":t.unref(o).messages.value},null,8,["role","content","timestamp","backend","model","show-actions","all-messages"]))),128)),t.unref(o).isStreaming.value&&t.unref(o).chatMode.value==="single"&&t.unref(o).streamingContent.value?(t.openBlock(),t.createBlock(Wt,{key:1,role:"assistant",content:t.unref(o).streamingContent.value,backend:t.unref(o).selectedBackend.value,model:t.unref(o).selectedModel.value,streaming:!0},null,8,["content","backend","model"])):t.createCommentVNode("",!0),t.unref(o).backendResponses.value.size>0?(t.openBlock(),t.createBlock(bo,{key:2,responses:t.unref(o).backendResponses.value,collapsible:t.unref(o).chatMode.value==="compound"},null,8,["responses","collapsible"])):t.createCommentVNode("",!0),t.unref(o).synthesisState.value?(t.openBlock(),t.createBlock(fo,{key:3,state:t.unref(o).synthesisState.value},null,8,["state"])):t.createCommentVNode("",!0),r.value&&t.unref(o).processGroups.groups.value.size>0?(t.openBlock(),t.createElementBlock("div",GC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o).processGroups.groups.value,([S,v])=>(t.openBlock(),t.createBlock(Ro,{key:S,id:v.id,type:v.type,label:v.label,timestamp:v.timestamp,"is-expanded":v.isExpanded,onToggle:A=>t.unref(o).processGroups.toggleGroup(S)},{default:t.withCtx(()=>[t.createElementVNode("pre",null,t.toDisplayString(v.content),1)]),_:2},1032,["id","type","label","timestamp","is-expanded","onToggle"]))),128))])):t.createCommentVNode("",!0),N.$slots.finalization?t.renderSlot(N.$slots,"finalization",{key:5,state:{canFinalize:t.unref(o).canFinalize,isFinalizing:t.unref(o).isFinalizing}},void 0,!0):t.unref(o).canFinalize.value&&n.entityLabel?(t.openBlock(),t.createBlock(sd,{key:6,title:n.bannerTitle??"Ready to finalize","button-label":n.bannerButtonLabel??"Finalize","entity-label":n.entityLabel,"is-finalizing":t.unref(o).isFinalizing.value,onFinalize:O},null,8,["title","button-label","entity-label","is-finalizing"])):t.createCommentVNode("",!0),b[3]||(b[3]=t.createElementVNode("div",{class:"aia-smart-panel__anchor"},null,-1))],512),t.unref(l).showScrollButton.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"aia-smart-panel__scroll-btn",onClick:b[2]||(b[2]=(...S)=>t.unref(l).scrollToBottom&&t.unref(l).scrollToBottom(...S))}," ↓ ")):t.createCommentVNode("",!0),t.unref(o).error.value?(t.openBlock(),t.createElementBlock("div",YC,t.toDisplayString(t.unref(o).error.value),1)):t.createCommentVNode("",!0),n.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(od,{key:3,placeholder:n.placeholder,"is-streaming":t.unref(o).isStreaming.value,onSend:f},null,8,["placeholder","is-streaming"]))]))}}),qC=he(VC,[["__scopeId","data-v-4cb169c3"]]),zC={class:"aia-chat-selector"},HC={class:"aia-chat-selector__group"},$C=["value","disabled"],WC=["value"],KC={class:"aia-chat-selector__group"},QC=["value","disabled"],XC=["value"],ZC={class:"aia-chat-selector__group"},JC=["value","disabled"],jC=["value"],eN={key:0,class:"aia-chat-selector__group aia-chat-selector__mode-group"},tN=["value","checked","onChange"],nN=t.defineComponent({__name:"AiChatSelector",props:{backend:{},accountId:{},model:{},chatMode:{}},emits:["update:backend","update:accountId","update:model","update:chatMode"],setup(n,{emit:e}){const a=n,r=e,i=[{value:"single",label:"Single"},{value:"all",label:"All"},{value:"compound",label:"Compound"}],{client:s}=et.useAiAccounts(),o=t.ref([]),l=t.ref({}),d=t.ref(!0),_=t.computed(()=>{const b=new Map;for(const S of o.value)b.has(S.kind)||b.set(S.kind,{kind:S.kind,label:c(S)});return Array.from(b.values())});function c(b){return{claude:"Claude",codex:"Codex",antigravity:"Antigravity",opencode:"OpenCode",deepseek:"DeepSeek",goose:"Goose",aider:"Aider",crush:"Crush",openai_compat:"OpenAI-compatible",openrouter:"OpenRouter",kimi:"Kimi"}[b.kind]??b.kind}const u=t.computed(()=>a.backend==="auto"?[]:o.value.filter(b=>b.kind===a.backend)),m=t.computed(()=>u.value.map(b=>({id:b.id,label:b.display_name||b.id}))),p=t.computed(()=>l.value[a.backend]??[]),E=t.computed(()=>a.backend==="auto");async function T(b){if(l.value[b])return;const S=o.value.find(v=>v.kind===b);if(S)try{const{items:v}=await s.listModels(S.id);l.value={...l.value,[b]:v.map(A=>A.id)}}catch{}}t.onMounted(async()=>{try{const b=await s.listBackends();o.value=b.items??[],a.backend&&a.backend!=="auto"&&await T(a.backend)}catch{}finally{d.value=!1}}),t.watch(()=>a.backend,b=>{r("update:accountId",null),r("update:model",null),b&&b!=="auto"&&T(b)});function f(b){const S=b.target.value;r("update:backend",S),S!=="auto"&&a.chatMode&&a.chatMode!=="single"&&r("update:chatMode","single")}function O(b){const S=b.target.value;r("update:accountId",S||null)}function N(b){const S=b.target.value;r("update:model",S||null)}return(b,S)=>(t.openBlock(),t.createElementBlock("div",zC,[t.createElementVNode("div",HC,[S[1]||(S[1]=t.createElementVNode("label",{class:"aia-chat-selector__label"},"Backend:",-1)),t.createElementVNode("select",{class:"aia-chat-selector__select aia-chat-selector__select--backend",value:n.backend,disabled:d.value,onChange:f},[S[0]||(S[0]=t.createElementVNode("option",{value:"auto"},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,v=>(t.openBlock(),t.createElementBlock("option",{key:v.kind,value:v.kind},t.toDisplayString(v.label),9,WC))),128))],40,$C)]),t.createElementVNode("div",KC,[S[3]||(S[3]=t.createElementVNode("label",{class:"aia-chat-selector__label"},"Account:",-1)),t.createElementVNode("select",{class:"aia-chat-selector__select aia-chat-selector__select--account",value:n.accountId||"",disabled:E.value||m.value.length===0,onChange:O},[S[2]||(S[2]=t.createElementVNode("option",{value:""},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,v=>(t.openBlock(),t.createElementBlock("option",{key:v.id,value:v.id},t.toDisplayString(v.label),9,XC))),128))],40,QC)]),t.createElementVNode("div",ZC,[S[5]||(S[5]=t.createElementVNode("label",{class:"aia-chat-selector__label"},"Model:",-1)),t.createElementVNode("select",{class:"aia-chat-selector__select aia-chat-selector__select--model",value:n.model||"",disabled:E.value||p.value.length===0,onChange:N},[S[4]||(S[4]=t.createElementVNode("option",{value:""},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,v=>(t.openBlock(),t.createElementBlock("option",{key:v,value:v},t.toDisplayString(v),9,jC))),128))],40,JC)]),n.chatMode?(t.openBlock(),t.createElementBlock("div",eN,[S[6]||(S[6]=t.createElementVNode("span",{class:"aia-chat-selector__mode-separator","aria-hidden":"true"},null,-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,v=>t.createElementVNode("label",{key:v.value,class:t.normalizeClass(["aia-chat-selector__mode-radio",{"aia-chat-selector__mode-radio--active":n.chatMode===v.value}])},[t.createElementVNode("input",{type:"radio",name:"aia-chat-selector-mode",value:v.value,checked:n.chatMode===v.value,onChange:A=>r("update:chatMode",v.value)},null,40,tN),t.createTextVNode(" "+t.toDisplayString(v.label),1)],2)),64))])):t.createCommentVNode("",!0),t.renderSlot(b.$slots,"trailing",{},void 0,!0)]))}}),ld=he(nN,[["__scopeId","data-v-849c31dc"]]),aN={class:"chat-panel"},rN={key:1,class:"cli-runner-toggle"},iN=["aria-pressed","title"],oN={class:"cli-runner-toggle__label"},sN={key:0,class:"chat-welcome"},lN={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},cN=["d"],_N={class:"process-group-content"},dN={key:4,class:"processing-indicator"},uN={key:2,class:"convert-banner"},pN={class:"banner-icon"},mN={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},EN=["d"],gN={class:"banner-content"},SN=["disabled"],TN={key:3,class:"input-area"},bN={class:"input-wrapper"},fN=["value","placeholder","disabled"],RN=["disabled"],CN=32,NN=t.defineComponent({__name:"AiChatPanelManaged",props:{messages:{default:()=>[]},isProcessing:{type:Boolean,default:!1},streamingContent:{default:""},inputMessage:{default:""},conversationId:{default:null},canFinalize:{type:Boolean,default:!1},isFinalizing:{type:Boolean,default:!1},assistantIconPaths:{default:()=>[]},inputPlaceholder:{default:"Type a message..."},entityLabel:{default:""},bannerTitle:{default:""},bannerButtonLabel:{default:""},detectedEntityName:{default:""},showBackendSelector:{type:Boolean,default:!1},selectedBackend:{default:"auto"},selectedAccountId:{default:null},selectedModel:{default:null},readOnly:{type:Boolean,default:!1},useSmartScroll:{type:Boolean,default:!1},processGroups:{},chatMode:{default:"single"},backendResponses:{},synthesisState:{default:null},isAllModeActive:{type:Boolean,default:!1},useCliRunner:{type:Boolean,default:!1},hideCliRunnerToggle:{type:Boolean,default:!1}},emits:["update:inputMessage","send","keydown","finalize","update:selectedBackend","update:selectedAccountId","update:selectedModel","update:chatMode","update:useCliRunner"],setup(n,{emit:e}){const a=n,r=e,i=t.ref(null),s=t.computed(()=>To(a.selectedBackend)||"Assistant"),o=t.computed(()=>a.messages??[]),l=t.computed(()=>a.inputMessage??""),d=t.computed(()=>a.assistantIconPaths??[]),_=t.computed(()=>o.value.map(N=>{const b={role:N.role,content:N.content};return N.timestamp&&(b.timestamp=N.timestamp),b})),c=t.ref(!0);function u(){const N=i.value;return N?N.scrollHeight-N.scrollTop-N.clientHeight<=CN:!0}function m(){a.useSmartScroll&&(c.value=u())}function p(){t.nextTick(()=>{if(i.value){if(a.useSmartScroll&&!c.value)return;i.value.scrollTop=i.value.scrollHeight}})}function E(){c.value=!0,t.nextTick(()=>{i.value&&i.value.scrollTo({top:i.value.scrollHeight,behavior:"instant"})})}const T=t.computed(()=>a.useSmartScroll&&!c.value);t.watch(()=>o.value.length,p),t.watch(()=>a.streamingContent,p),t.watch(()=>a.isProcessing,N=>{N&&p()}),t.watch(()=>{if(!a.backendResponses)return 0;let N=0;for(const b of a.backendResponses.values())N+=b.content.length;return N},p),t.watch(()=>{var N,b;return((b=(N=a.synthesisState)==null?void 0:N.content)==null?void 0:b.length)??0},p);function f(N){const b=N.target;r("update:inputMessage",b.value),b.style.height="auto",b.style.height=Math.min(b.scrollHeight,120)+"px"}const O=t.computed(()=>a.processGroups?Array.from(a.processGroups.entries()):[]);return(N,b)=>(t.openBlock(),t.createElementBlock("div",aN,[n.showBackendSelector?(t.openBlock(),t.createBlock(ld,{key:0,backend:n.selectedBackend??"auto","account-id":n.selectedAccountId??null,model:n.selectedModel??null,"chat-mode":n.chatMode??"single","onUpdate:backend":b[0]||(b[0]=S=>r("update:selectedBackend",S)),"onUpdate:accountId":b[1]||(b[1]=S=>r("update:selectedAccountId",S)),"onUpdate:model":b[2]||(b[2]=S=>r("update:selectedModel",S)),"onUpdate:chatMode":b[3]||(b[3]=S=>r("update:chatMode",S))},{trailing:t.withCtx(()=>[t.renderSlot(N.$slots,"selector-trailing",{},void 0,!0)]),_:3},8,["backend","account-id","model","chat-mode"])):t.createCommentVNode("",!0),t.renderSlot(N.$slots,"header-extra",{},void 0,!0),n.hideCliRunnerToggle?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",rN,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cli-runner-toggle__btn",{"cli-runner-toggle__btn--active":n.useCliRunner}]),"aria-pressed":n.useCliRunner?"true":"false",title:n.useCliRunner?"CLI runner mode — agent uses tools (filesystem, shell, edits) in the project worktree":"CLIProxy mode — pure token chat, no tool use",onClick:b[4]||(b[4]=S=>r("update:useCliRunner",!n.useCliRunner))},[b[9]||(b[9]=t.createElementVNode("span",{class:"cli-runner-toggle__dot"},null,-1)),t.createElementVNode("span",oN,t.toDisplayString(n.useCliRunner?"CLI runner":"CLIProxy"),1)],10,iN)])),t.createElementVNode("div",{class:"chat-container",ref_key:"chatContainer",ref:i,onScroll:m},[t.renderSlot(N.$slots,"welcome",{},()=>[o.value.length===0&&!n.isProcessing?(t.openBlock(),t.createElementBlock("div",sN,[t.createElementVNode("div",{class:t.normalizeClass(["welcome-icon",{connecting:!n.conversationId}])},[(t.openBlock(),t.createElementBlock("svg",lN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(S,v)=>(t.openBlock(),t.createElementBlock("path",{key:v,d:S},null,8,cN))),128))]))],2),t.createElementVNode("h2",null,t.toDisplayString(n.conversationId?"Ready to chat":`Connecting to ${s.value}...`),1),t.createElementVNode("p",null,t.toDisplayString(s.value)+" will guide you through designing your "+t.toDisplayString(n.entityLabel),1)])):t.createCommentVNode("",!0)],!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,(S,v)=>(t.openBlock(),t.createElementBlock("div",{key:v,class:t.normalizeClass(["message-wrapper",S.role])},[t.createVNode(Wt,{role:S.role,content:S.content,timestamp:S.timestamp??null,backend:S.backend??null,model:S.model??null,"avatar-paths":d.value,"skip-transition":o.value.length>10&&v<o.value.length-5},null,8,["role","content","timestamp","backend","model","avatar-paths","skip-transition"]),!n.isProcessing||v<o.value.length-1?(t.openBlock(),t.createBlock(So,{key:0,content:S.content,"all-messages":v===o.value.length-1?_.value:[]},null,8,["content","all-messages"])):t.createCommentVNode("",!0)],2))),128)),n.isProcessing&&(n.chatMode==="single"||!n.chatMode)&&n.streamingContent?(t.openBlock(),t.createBlock(Wt,{key:0,role:"assistant",content:n.streamingContent??"",backend:n.selectedBackend??null,model:n.selectedModel??null,"avatar-paths":d.value,streaming:!0},null,8,["content","backend","model","avatar-paths"])):t.createCommentVNode("",!0),(n.chatMode==="all"||n.chatMode==="compound")&&n.backendResponses&&n.backendResponses.size>0?(t.openBlock(),t.createBlock(bo,{key:1,responses:n.backendResponses,collapsible:n.chatMode==="compound"},null,8,["responses","collapsible"])):t.createCommentVNode("",!0),n.synthesisState&&n.synthesisState.status!=="waiting"?(t.openBlock(),t.createBlock(fo,{key:2,state:n.synthesisState},null,8,["state"])):t.createCommentVNode("",!0),O.value.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:3},t.renderList(O.value,([S,v])=>(t.openBlock(),t.createBlock(Ro,{key:S,id:S,type:v.type,label:v.label,timestamp:v.timestamp??"","auto-collapse-ms":v.type==="tool_call"?4e3:2e3},{default:t.withCtx(()=>[t.createElementVNode("pre",_N,t.toDisplayString(v.content),1)]),_:2},1032,["id","type","label","timestamp","auto-collapse-ms"]))),128)):t.createCommentVNode("",!0),n.isProcessing&&!n.streamingContent?(t.openBlock(),t.createElementBlock("div",dN,[b[10]||(b[10]=t.createElementVNode("div",{class:"dots"},[t.createElementVNode("span"),t.createElementVNode("span"),t.createElementVNode("span")],-1)),t.createElementVNode("span",null,t.toDisplayString(s.value)+" is thinking...",1)])):t.createCommentVNode("",!0),T.value?(t.openBlock(),t.createElementBlock("button",{key:5,class:"scroll-to-bottom-btn",onClick:E,title:"Scroll to bottom"},[...b[11]||(b[11]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])])):t.createCommentVNode("",!0)],544),n.canFinalize?(t.openBlock(),t.createElementBlock("div",uN,[t.createElementVNode("div",pN,[(t.openBlock(),t.createElementBlock("svg",mN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(S,v)=>(t.openBlock(),t.createElementBlock("path",{key:v,d:S},null,8,EN))),128)),b[12]||(b[12]=t.createElementVNode("path",{d:"M20 6L9 17l-5-5","stroke-width":"2.5"},null,-1))]))]),t.createElementVNode("div",gN,[t.createElementVNode("h3",null,t.toDisplayString(n.bannerTitle),1),t.createElementVNode("p",null,t.toDisplayString(s.value)+" has designed your "+t.toDisplayString(n.entityLabel)+t.toDisplayString(n.detectedEntityName?": "+n.detectedEntityName:"")+". Click the button to finalize. ",1)]),t.createElementVNode("button",{class:"btn btn-primary btn-convert",disabled:n.isFinalizing,onClick:b[5]||(b[5]=S=>r("finalize"))},[b[13]||(b[13]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M20 6L9 17l-5-5"})],-1)),t.createTextVNode(" "+t.toDisplayString(n.isFinalizing?"Creating...":n.bannerButtonLabel),1)],8,SN)])):t.createCommentVNode("",!0),n.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",TN,[t.createElementVNode("div",bN,[t.createElementVNode("textarea",{value:l.value,onInput:b[6]||(b[6]=S=>f(S)),placeholder:n.inputPlaceholder,disabled:n.isProcessing,onKeydown:b[7]||(b[7]=S=>r("keydown",S)),rows:"1"},null,40,fN),t.createElementVNode("button",{class:"btn-send",disabled:!l.value.trim()||n.isProcessing,onClick:b[8]||(b[8]=S=>r("send"))},[...b[14]||(b[14]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})],-1)])],8,RN)])]))]))}}),hN=he(NN,[["__scopeId","data-v-7d947b88"]]),vN={class:"aia-chat-mode-selector",role:"radiogroup","aria-label":"Chat mode"},ON=["aria-checked","title","onClick"],yN=t.defineComponent({__name:"ChatModeSelector",props:{mode:{}},emits:["update:mode"],setup(n,{emit:e}){const a=e,r=[{value:"single",label:"Single",description:"Send to one backend"},{value:"all",label:"All",description:"Send to all backends simultaneously"},{value:"compound",label:"Compound",description:"All backends + AI synthesis"}];return(i,s)=>(t.openBlock(),t.createElementBlock("div",vN,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,o=>t.createElementVNode("button",{key:o.value,type:"button",role:"radio","aria-checked":n.mode===o.value,class:t.normalizeClass(["aia-chat-mode-selector__btn",{"aia-chat-mode-selector__btn--active":n.mode===o.value}]),title:o.description,onClick:l=>a("update:mode",o.value)},t.toDisplayString(o.label),11,ON)),64))]))}}),AN=he(yN,[["__scopeId","data-v-c2599533"]]),IN="0.4.1";exports.AccountEditForm=eE;exports.AccountReauth=cE;exports.AccountWizard=ym;exports.AiChatPanel=qC;exports.AiChatPanelManaged=hN;exports.AiChatSelector=ld;exports.AllModeResponses=bo;exports.BackendPicker=L_;exports.ChatBubble=Wt;exports.ChatControls=id;exports.ChatInput=od;exports.ChatMessage=Xi;exports.ChatModeSelector=AN;exports.ChatPanel=NE;exports.CompoundSynthesis=fo;exports.FinalizationBanner=sd;exports.LoginStream=no;exports.MessageActions=So;exports.OnboardingFlow=Km;exports.ProcessGroup=Ro;exports.forceFreshAccountPrompt=M_;exports.version=IN;
79
+ `)}function d(){!e.allMessages||e.allMessages.length===0||i(l(e.allMessages))}function _(){if(!e.allMessages||e.allMessages.length===0)return;const c=l(e.allMessages),u=new Blob([c],{type:"text/plain;charset=utf-8"}),m=URL.createObjectURL(u),p=document.createElement("a");p.href=m,p.download=`conversation-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.txt`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(m)}return(c,u)=>(t.openBlock(),t.createElementBlock("div",lR,[t.createElementVNode("button",{class:"action-btn action-copy",title:a.value==="success"?"Copied!":a.value==="error"?"Copy failed":"Copy message",onClick:t.withModifiers(s,["stop"])},[n.iconButtons?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[a.value==="success"?(t.openBlock(),t.createElementBlock("svg",_R,[...u[0]||(u[0]=[t.createElementVNode("path",{d:"M20 6L9 17l-5-5"},null,-1)])])):a.value==="error"?(t.openBlock(),t.createElementBlock("svg",dR,[...u[1]||(u[1]=[t.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",uR,[...u[2]||(u[2]=[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"},null,-1)])]))],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[a.value==="idle"?(t.openBlock(),t.createElementBlock("span",pR,"Copy")):a.value==="success"?(t.openBlock(),t.createElementBlock("span",mR,"Copied")):(t.openBlock(),t.createElementBlock("span",ER,"Failed"))],64))],8,cR),n.allMessages?(t.openBlock(),t.createElementBlock("button",{key:0,class:"action-btn action-copy-all",title:"Copy conversation",onClick:t.withModifiers(d,["stop"])},[n.iconButtons?(t.openBlock(),t.createElementBlock("svg",gR,[...u[3]||(u[3]=[t.createElementVNode("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),t.createElementVNode("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"},null,-1),t.createElementVNode("line",{x1:"14",y1:"14",x2:"18",y2:"14"},null,-1),t.createElementVNode("line",{x1:"14",y1:"17",x2:"18",y2:"17"},null,-1)])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode("Copy All")],64))])):t.createCommentVNode("",!0),n.allMessages?(t.openBlock(),t.createElementBlock("button",{key:1,class:"action-btn action-export",title:"Export conversation",onClick:t.withModifiers(_,["stop"])},[n.iconButtons?(t.openBlock(),t.createElementBlock("svg",SR,[...u[4]||(u[4]=[t.createElementVNode("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"},null,-1),t.createElementVNode("polyline",{points:"7 10 12 15 17 10"},null,-1),t.createElementVNode("line",{x1:"12",y1:"15",x2:"12",y2:"3"},null,-1)])])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode("Export")],64))])):t.createCommentVNode("",!0)]))}}),So=he(TR,[["__scopeId","data-v-519341e8"]]),bR={claude:"Claude",claude_custom:"Claude (self-hosted)",codex:"Codex",antigravity:"Antigravity",opencode:"OpenCode",deepseek:"DeepSeek",goose:"Goose",aider:"Aider",crush:"Crush",openai_compat:"OpenAI-compatible",openrouter:"OpenRouter",kimi:"Kimi"};function To(n){return!n||n==="auto"?"":bR[n]??n.charAt(0).toUpperCase()+n.slice(1)}const fR={opus:"Opus",sonnet:"Sonnet",haiku:"Haiku",codex:"Codex",zen:"Zen"};function RR(n){return n?fR[n]??n:""}const CR={class:"aia-bubble__avatar"},NR={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},hR=["d"],vR={class:"aia-bubble__body"},OR={class:"aia-bubble__header"},yR={class:"aia-bubble__role"},AR={key:0,class:"aia-bubble__model"},IR={key:1,class:"aia-bubble__time"},DR=["innerHTML"],MR=t.defineComponent({__name:"ChatBubble",props:{role:{},content:{},backend:{},model:{},timestamp:{},streaming:{type:Boolean,default:!1},showActions:{type:Boolean,default:!1},allMessages:{},avatarPaths:{},assistantName:{},skipTransition:{type:Boolean,default:!1}},setup(n){const e={code({text:_,lang:c}){let u;return c&&zi.getLanguage(c)?u=zi.highlight(_,{language:c}).value:u=zi.highlightAuto(_).value,`<pre><code${c?` class="language-${c}"`:""}>${u}</code></pre>`}};_e.use({renderer:e});const a=n,r=t.computed(()=>sR.sanitize(_e.parse(a.content||""))),i=t.computed(()=>{if(!a.timestamp)return"";const _=new Date(a.timestamp);return Number.isNaN(_.getTime())?"":_.toLocaleTimeString()});function s(_){var m;const c=_.target.closest(".aia-copy-btn");if(!c)return;const u=(m=c.closest(".aia-code-block"))==null?void 0:m.querySelector("code");u&&navigator.clipboard.writeText(u.textContent||"")}const o=t.computed(()=>{var c;if(a.role==="user")return"You";const _=(c=a.assistantName)==null?void 0:c.trim();return _||(a.role==="assistant"?To(a.backend)||"Assistant":a.role)}),l=t.computed(()=>a.role==="user"?"U":a.role==="tool"?"T":a.role==="system"?"S":(o.value.charAt(0)||"A").toUpperCase()),d=t.computed(()=>a.role==="assistant"?RR(a.model):"");return(_,c)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["aia-bubble",[`aia-bubble--${n.role}`,{"aia-bubble--streaming":n.streaming,"aia-bubble--fade-in":!n.skipTransition}]])},[t.createElementVNode("div",CR,[n.avatarPaths&&n.avatarPaths.length>0?(t.openBlock(),t.createElementBlock("svg",NR,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.avatarPaths,(u,m)=>(t.openBlock(),t.createElementBlock("path",{key:m,d:u},null,8,hR))),128))])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(l.value),1)],64))]),t.createElementVNode("div",vR,[t.createElementVNode("div",OR,[t.createElementVNode("span",yR,t.toDisplayString(o.value),1),d.value?(t.openBlock(),t.createElementBlock("span",AR,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0),i.value?(t.openBlock(),t.createElementBlock("span",IR,t.toDisplayString(i.value),1)):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:"aia-bubble__content",onClick:s,innerHTML:r.value},null,8,DR)]),n.showActions?(t.openBlock(),t.createBlock(So,t.mergeProps({key:0,content:n.content},n.allMessages!==void 0?{allMessages:n.allMessages}:{}),null,16,["content"])):t.createCommentVNode("",!0)],2))}}),Wt=he(MR,[["__scopeId","data-v-fe84dfc8"]]),LR={class:"aia-controls"},xR={class:"aia-controls__group"},kR=["value"],wR=["value"],PR={class:"aia-controls__group"},BR=["disabled","value"],UR={value:""},FR=["value"],GR={class:"aia-controls__group"},YR=["disabled","value"],VR={value:""},qR=["value"],zR={class:"aia-controls__group aia-controls__group--mode"},HR={class:"aia-controls__modes"},$R=["onClick"],WR=t.defineComponent({__name:"ChatControls",props:{chatMode:{},selectedBackend:{},selectedAccount:{},selectedModel:{},backends:{}},emits:["update:chatMode","update:selectedBackend","update:selectedAccount","update:selectedModel"],setup(n,{emit:e}){const a=n,r=e,i=[{value:"single",label:"Single"},{value:"all",label:"All"},{value:"compound",label:"Compound"}],s=t.computed(()=>!a.selectedBackend),o=t.computed(()=>a.backends.find(_=>_.kind===a.selectedBackend)),l=t.computed(()=>{var _;return((_=o.value)==null?void 0:_.accounts)??[]}),d=t.computed(()=>{var _;return((_=o.value)==null?void 0:_.models)??[]});return(_,c)=>(t.openBlock(),t.createElementBlock("div",LR,[t.createElementVNode("div",xR,[c[4]||(c[4]=t.createElementVNode("label",{class:"aia-controls__label"},"Backend",-1)),t.createElementVNode("select",{class:"aia-controls__select",value:n.selectedBackend??"",onChange:c[0]||(c[0]=u=>r("update:selectedBackend",u.target.value||null))},[c[3]||(c[3]=t.createElementVNode("option",{value:""},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.backends,u=>(t.openBlock(),t.createElementBlock("option",{key:u.kind,value:u.kind},t.toDisplayString(u.displayName),9,wR))),128))],40,kR)]),t.createElementVNode("div",PR,[c[5]||(c[5]=t.createElementVNode("label",{class:"aia-controls__label"},"Account",-1)),t.createElementVNode("select",{class:"aia-controls__select",disabled:s.value,value:n.selectedAccount??"",onChange:c[1]||(c[1]=u=>r("update:selectedAccount",u.target.value||null))},[t.createElementVNode("option",UR,t.toDisplayString(s.value?"--":"Default"),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,u=>(t.openBlock(),t.createElementBlock("option",{key:u.id,value:u.id},t.toDisplayString(u.label),9,FR))),128))],40,BR)]),t.createElementVNode("div",GR,[c[6]||(c[6]=t.createElementVNode("label",{class:"aia-controls__label"},"Model",-1)),t.createElementVNode("select",{class:"aia-controls__select",disabled:s.value,value:n.selectedModel??"",onChange:c[2]||(c[2]=u=>r("update:selectedModel",u.target.value||null))},[t.createElementVNode("option",VR,t.toDisplayString(s.value?"--":"Default"),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,u=>(t.openBlock(),t.createElementBlock("option",{key:u,value:u},t.toDisplayString(u),9,qR))),128))],40,YR)]),t.createElementVNode("div",zR,[c[7]||(c[7]=t.createElementVNode("label",{class:"aia-controls__label"},"Mode",-1)),t.createElementVNode("div",HR,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,u=>t.createElementVNode("button",{key:u.value,class:t.normalizeClass(["aia-controls__mode-btn",{"aia-controls__mode-btn--active":n.chatMode===u.value}]),onClick:m=>r("update:chatMode",u.value)},t.toDisplayString(u.label),11,$R)),64))])])]))}}),id=he(WR,[["__scopeId","data-v-a9f4b1df"]]),KR={class:"aia-input"},QR=["placeholder","disabled"],XR=["disabled"],ZR=t.defineComponent({__name:"ChatInput",props:{placeholder:{default:"Type a message..."},disabled:{type:Boolean},isStreaming:{type:Boolean}},emits:["send"],setup(n,{emit:e}){const a=n,r=e,i=t.ref(""),s=t.ref(null);function o(){const _=i.value.trim();!_||a.disabled||a.isStreaming||(r("send",_),i.value="",t.nextTick(d))}function l(_){_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),o())}function d(){const _=s.value;_&&(_.style.height="auto",_.style.height=Math.min(_.scrollHeight,120)+"px")}return t.watch(i,()=>t.nextTick(d)),(_,c)=>(t.openBlock(),t.createElementBlock("div",KR,[t.withDirectives(t.createElementVNode("textarea",{ref_key:"textareaRef",ref:s,"onUpdate:modelValue":c[0]||(c[0]=u=>i.value=u),class:"aia-input__textarea",placeholder:n.placeholder,rows:"1",disabled:n.disabled||n.isStreaming,onKeydown:l,onInput:d},null,40,QR),[[t.vModelText,i.value]]),t.createElementVNode("button",{class:"aia-input__send",disabled:!i.value.trim()||n.disabled||n.isStreaming,onClick:o},t.toDisplayString(n.isStreaming?"...":"Send"),9,XR)]))}}),od=he(ZR,[["__scopeId","data-v-51976e76"]]),JR={class:"aia-responses"},jR={class:"aia-responses__summary-count"},eC=["open"],tC={class:"aia-resp__header"},nC={key:0,class:"aia-resp__account"},aC=["innerHTML"],rC={key:1,class:"aia-resp__error",role:"alert"},iC={key:0,class:"aia-resp__error-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"16",height:"16","aria-hidden":"true"},oC={key:1,class:"aia-resp__error-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"16",height:"16","aria-hidden":"true"},sC={class:"aia-resp__error-text"},lC={class:"aia-resp__error-title"},cC={key:0,class:"aia-resp__error-hint"},_C={class:"aia-resp__error-detail"},dC=t.defineComponent({__name:"AllModeResponses",props:{responses:{},collapsible:{type:Boolean,default:!1},summaryHeader:{type:Boolean,default:!1},waitingPlaceholder:{default:null}},setup(n){const e=n,a={claude:{bg:"rgba(139,92,246,0.15)",fg:"#a78bfa",label:"Claude"},claude_custom:{bg:"rgba(192,132,252,0.15)",fg:"#c084fc",label:"Claude (self-hosted)"},codex:{bg:"rgba(16,185,129,0.15)",fg:"#34d399",label:"Codex"},antigravity:{bg:"rgba(96,165,250,0.15)",fg:"#60a5fa",label:"Antigravity"},opencode:{bg:"rgba(251,191,36,0.15)",fg:"#fbbf24",label:"OpenCode"},deepseek:{bg:"rgba(59,130,246,0.15)",fg:"#3b82f6",label:"DeepSeek"},goose:{bg:"rgba(249,115,22,0.15)",fg:"#f97316",label:"Goose"},aider:{bg:"rgba(20,184,166,0.15)",fg:"#14b8a6",label:"Aider"},crush:{bg:"rgba(239,68,68,0.15)",fg:"#ef4444",label:"Crush"},openai_compat:{bg:"rgba(34,211,238,0.15)",fg:"#22d3ee",label:"OpenAI-compatible"},openrouter:{bg:"rgba(129,140,248,0.15)",fg:"#818cf8",label:"OpenRouter"},kimi:{bg:"rgba(232,121,249,0.15)",fg:"#e879f9",label:"Kimi"}};function r(m){return m?a[m]??{bg:"rgba(161,161,170,0.15)",fg:"#a1a1aa",label:m}:{bg:"rgba(161,161,170,0.15)",fg:"#a1a1aa",label:"Backend"}}function i(m){switch(m){case"streaming":return{text:"Streaming",cls:"aia-resp__badge--streaming"};case"complete":return{text:"Done",cls:"aia-resp__badge--complete"};case"error":return{text:"Error",cls:"aia-resp__badge--error"};case"timeout":return{text:"Timeout",cls:"aia-resp__badge--timeout"};default:return{text:m,cls:""}}}function s(m){const p=m||"";if(/^no models available/i.test(p))return{title:"No models available",hint:"CLIProxyAPI advertises zero models for this backend. Make sure cliproxyapi is running and this backend’s account is registered."};if(/^could not enumerate models/i.test(p))return{title:"Could not list models",hint:"Failed to fetch the model list for this backend."};if(/^no account available/i.test(p))return{title:"No account available",hint:"No ready account is registered for this backend kind."};const E=p.match(/'([^']+)' (?:model )?is not supported when using (\w+) with a ([^']+?) account/i);return E?{title:`${E[1]} not available`,hint:`Your ${E[2]} account is authenticated via ${E[3]}, which doesn't expose this model. Switch to an API-key login or pick a different model.`}:/^Proxy error/i.test(p)?{title:"Upstream proxy error",hint:null}:/timed?\s*out/i.test(p)?{title:"Backend timed out",hint:null}:{title:"Backend error",hint:null}}const o=t.computed(()=>Array.from(e.responses.entries()));function l(m){return _e.parse(m||"")}const d=t.ref(!1),_=t.computed(()=>{const m=o.value.length,p=o.value.filter(([,T])=>T.status==="complete").length;return m-p>0?`${p}/${m} backends responded`:`${m} backend responses`});t.watch(()=>e.summaryHeader,m=>{m||(d.value=!1)});function c(m){return(m.status==="error"||m.status==="timeout")&&!m.content?!1:(e.waitingPlaceholder&&m.status==="streaming"&&!m.content,!0)}function u(m){return!m.content&&e.waitingPlaceholder&&m.status==="streaming"?`<em class="aia-resp__waiting">${e.waitingPlaceholder}</em>`:l(m.content)}return(m,p)=>(t.openBlock(),t.createElementBlock("div",JR,[n.summaryHeader&&o.value.length>0?(t.openBlock(),t.createElementBlock("button",{key:0,class:"aia-responses__summary",onClick:p[0]||(p[0]=E=>d.value=!d.value)},[(t.openBlock(),t.createElementBlock("svg",{class:t.normalizeClass(["aia-responses__summary-chevron",{"is-open":d.value}]),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14","aria-hidden":"true"},[...p[1]||(p[1]=[t.createElementVNode("polyline",{points:"9 18 15 12 9 6"},null,-1)])],2)),p[2]||(p[2]=t.createElementVNode("span",{class:"aia-responses__summary-label"},"Individual Responses",-1)),t.createElementVNode("span",jR,t.toDisplayString(_.value),1)])):t.createCommentVNode("",!0),!n.summaryHeader||d.value?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(o.value,([E,T])=>(t.openBlock(),t.createElementBlock("div",{key:E,class:t.normalizeClass(["aia-resp",{"aia-resp--error":T.status==="error","aia-resp--timeout":T.status==="timeout"}]),style:t.normalizeStyle({"--resp-bg":r(T.backendKind).bg,"--resp-fg":r(T.backendKind).fg})},[t.createElementVNode("details",{open:!n.collapsible||void 0},[t.createElementVNode("summary",tC,[t.createElementVNode("span",{class:"aia-resp__name",style:t.normalizeStyle({color:r(T.backendKind).fg})},t.toDisplayString(r(T.backendKind).label),5),T.accountLabel?(t.openBlock(),t.createElementBlock("span",nC,t.toDisplayString(T.accountLabel),1)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["aia-resp__badge",i(T.status).cls])},t.toDisplayString(i(T.status).text),3)]),c(T)?(t.openBlock(),t.createElementBlock("div",{key:0,class:"aia-resp__body",innerHTML:u(T)},null,8,aC)):t.createCommentVNode("",!0),T.error?(t.openBlock(),t.createElementBlock("div",rC,[T.status==="timeout"?(t.openBlock(),t.createElementBlock("svg",iC,[...p[3]||(p[3]=[t.createElementVNode("circle",{cx:"12",cy:"12",r:"9"},null,-1),t.createElementVNode("polyline",{points:"12 7 12 12 15 14"},null,-1)])])):(t.openBlock(),t.createElementBlock("svg",oC,[...p[4]||(p[4]=[t.createElementVNode("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"},null,-1),t.createElementVNode("line",{x1:"12",y1:"9",x2:"12",y2:"13"},null,-1),t.createElementVNode("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"},null,-1)])])),t.createElementVNode("div",sC,[t.createElementVNode("strong",lC,t.toDisplayString(s(T.error).title),1),s(T.error).hint?(t.openBlock(),t.createElementBlock("p",cC,t.toDisplayString(s(T.error).hint),1)):t.createCommentVNode("",!0),t.createElementVNode("code",_C,t.toDisplayString(T.error),1)])])):t.createCommentVNode("",!0)],8,eC)],6))),128)):t.createCommentVNode("",!0)]))}}),bo=he(dC,[["__scopeId","data-v-579cd1f6"]]),uC={class:"aia-synth__header"},pC={key:0,class:"aia-synth__sparkle","aria-hidden":"true"},mC={key:1,class:"aia-synth__via"},EC={key:0,class:"aia-synth__sources"},gC={key:1,class:"aia-synth__placeholder"},SC=["innerHTML"],TC={key:3,class:"aia-synth__error"},bC=t.defineComponent({__name:"CompoundSynthesis",props:{state:{},sparkleIcon:{type:Boolean,default:!1},loadingPlaceholders:{type:Boolean,default:!1}},setup(n){const e=n,a=t.computed(()=>_e.parse(e.state.content||"")),r=t.computed(()=>e.state.status==="streaming"),i=t.computed(()=>!!(e.state.content&&e.state.content.length>0)),s=t.computed(()=>e.loadingPlaceholders&&!i.value&&(e.state.status==="streaming"||e.state.status==="waiting")),o=t.computed(()=>e.state.status==="streaming"?"Generating synthesis...":"Waiting for backend responses...");function l(d){switch(d){case"waiting":return{text:"Waiting...",cls:"aia-synth__badge--waiting"};case"streaming":return{text:"Synthesizing",cls:"aia-synth__badge--streaming"};case"complete":return{text:"Complete",cls:"aia-synth__badge--complete"};case"error":return{text:"Error",cls:"aia-synth__badge--error"};default:return{text:d,cls:""}}}return(d,_)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["aia-synth",{"aia-synth--streaming":r.value}])},[t.createElementVNode("div",uC,[n.sparkleIcon?(t.openBlock(),t.createElementBlock("span",pC,"✨")):t.createCommentVNode("",!0),_[0]||(_[0]=t.createElementVNode("span",{class:"aia-synth__label"},"Compound Synthesis",-1)),n.state.primaryBackend?(t.openBlock(),t.createElementBlock("span",mC,"via "+t.toDisplayString(n.state.primaryBackend),1)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["aia-synth__badge",l(n.state.status).cls])},t.toDisplayString(l(n.state.status).text),3)]),n.state.backendsCollected.length?(t.openBlock(),t.createElementBlock("div",EC," Sources: "+t.toDisplayString(n.state.backendsCollected.join(", ")),1)):t.createCommentVNode("",!0),s.value?(t.openBlock(),t.createElementBlock("div",gC,t.toDisplayString(o.value),1)):(t.openBlock(),t.createElementBlock("div",{key:2,class:"aia-synth__content",innerHTML:a.value},null,8,SC)),n.state.error?(t.openBlock(),t.createElementBlock("div",TC,t.toDisplayString(n.state.error),1)):t.createCommentVNode("",!0)],2))}}),fo=he(bC,[["__scopeId","data-v-93a21588"]]),fC={class:"finalization-banner"},RC={class:"banner-content"},CC={class:"banner-title"},NC={class:"banner-description"},hC=["disabled"],vC=t.defineComponent({__name:"FinalizationBanner",props:{title:{},buttonLabel:{},entityLabel:{},entityName:{},isFinalizing:{type:Boolean,default:!1}},emits:["finalize"],setup(n,{emit:e}){const a=e;return(r,i)=>(t.openBlock(),t.createElementBlock("div",fC,[t.createElementVNode("div",RC,[t.createElementVNode("h3",CC,t.toDisplayString(n.title),1),t.createElementVNode("p",NC," Your "+t.toDisplayString(n.entityLabel)+t.toDisplayString(n.entityName?": "+n.entityName:"")+" is ready. Click the button to finalize. ",1)]),t.createElementVNode("button",{class:"banner-button",disabled:n.isFinalizing,onClick:i[0]||(i[0]=s=>a("finalize"))},t.toDisplayString(n.isFinalizing?"Creating...":n.buttonLabel),9,hC)]))}}),sd=he(vC,[["__scopeId","data-v-bde99def"]]),OC={key:0,class:"process-group-badge-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},yC={key:1,class:"process-group-badge-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},AC={key:2,class:"process-group-badge-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true"},IC={class:"process-group-label"},DC={key:0,class:"process-group-time"},MC={class:"process-group-chevron"},LC={key:0,class:"process-group-body"},xC=t.defineComponent({__name:"ProcessGroup",props:{id:{},type:{},label:{},timestamp:{},isExpanded:{type:Boolean,default:!0},autoCollapseMs:{default:0},iconBadges:{type:Boolean,default:!1}},emits:["toggle"],setup(n,{emit:e}){const a=n,r=e,i={tool_call:"Tool",reasoning:"Thinking",code_execution:"Code"},s={tool_call:"var(--aia-cyan, #22d3ee)",reasoning:"var(--aia-violet, #a78bfa)",code_execution:"var(--aia-amber, #fbbf24)"};function o(p){if(!p)return"";const E=new Date(p);return Number.isNaN(E.getTime())?"":E.toLocaleTimeString()}const l=t.ref(!1);let d=null;function _(){d!==null&&(clearTimeout(d),d=null)}function c(){_(),a.autoCollapseMs>0&&!l.value&&a.isExpanded&&(d=setTimeout(()=>{a.isExpanded&&r("toggle")},a.autoCollapseMs))}function u(){l.value=!0,_()}function m(){l.value=!1,c()}return t.onMounted(()=>{c()}),t.onUnmounted(()=>{_()}),t.watch(()=>a.isExpanded,p=>{p?c():_()}),(p,E)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["process-group",[`process-group--${n.type}`]]),onMouseenter:u,onMouseleave:m},[t.createElementVNode("div",{class:"process-group-header",onClick:E[0]||(E[0]=T=>r("toggle"))},[t.createElementVNode("span",{class:t.normalizeClass(["process-group-badge",[`process-group-badge--${n.type}`,{"process-group-badge--with-icon":n.iconBadges}]]),style:t.normalizeStyle({background:s[n.type]})},[n.iconBadges&&n.type==="tool_call"?(t.openBlock(),t.createElementBlock("svg",OC,[...E[1]||(E[1]=[t.createElementVNode("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"},null,-1)])])):n.iconBadges&&n.type==="reasoning"?(t.openBlock(),t.createElementBlock("svg",yC,[...E[2]||(E[2]=[t.createElementVNode("path",{d:"M12 2a8 8 0 018 8c0 3-2 5.5-4 7l-1 4H9l-1-4c-2-1.5-4-4-4-7a8 8 0 018-8z"},null,-1),t.createElementVNode("path",{d:"M9 21h6M10 17h4"},null,-1)])])):n.iconBadges&&n.type==="code_execution"?(t.openBlock(),t.createElementBlock("svg",AC,[...E[3]||(E[3]=[t.createElementVNode("polyline",{points:"4 17 10 11 4 5"},null,-1),t.createElementVNode("line",{x1:"12",y1:"19",x2:"20",y2:"19"},null,-1)])])):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(i[n.type]),1)],6),t.createElementVNode("span",IC,t.toDisplayString(n.label),1),n.timestamp&&o(n.timestamp)?(t.openBlock(),t.createElementBlock("span",DC,t.toDisplayString(o(n.timestamp)),1)):t.createCommentVNode("",!0),t.createElementVNode("span",MC,t.toDisplayString(n.isExpanded?"▼":"▶"),1)]),n.isExpanded?(t.openBlock(),t.createElementBlock("div",LC,[t.renderSlot(p.$slots,"default",{},void 0,!0)])):t.createCommentVNode("",!0)],34))}}),Ro=he(xC,[["__scopeId","data-v-c351adfa"]]),kC={class:"aia-smart-panel"},wC={ref:"scroll.containerRef",class:"aia-smart-panel__messages"},PC={key:0,class:"aia-smart-panel__welcome"},BC={class:"aia-smart-panel__welcome-icon"},UC={class:"aia-smart-panel__welcome-title"},FC={class:"aia-smart-panel__welcome-sub"},GC={key:4,class:"process-groups"},YC={key:2,class:"aia-smart-panel__error"},VC=t.defineComponent({__name:"AiChatPanel",props:{density:{default:"minimal"},defaultBackend:{},defaultModel:{},placeholder:{default:"Type a message..."},welcomeTitle:{default:"AI Chat"},welcomeSubtitle:{default:"Send a message to get started"},readOnly:{type:Boolean},entityLabel:{},bannerTitle:{},bannerButtonLabel:{},configParser:{},showProcessGroups:{type:Boolean,default:void 0},showActions:{type:Boolean,default:void 0}},emits:["finalize"],setup(n,{emit:e}){const a=n,r=t.computed(()=>a.showProcessGroups??a.density==="detailed"),i=t.computed(()=>a.showActions??a.density==="detailed"),s=e,o=et.useSmartChat(),l=et.useSmartScroll(),{client:d}=et.useAiAccounts(),_=t.computed(()=>(To(o.selectedBackend.value)||"Assistant").charAt(0).toUpperCase()),c=t.ref([]),u=t.ref({}),m=t.computed(()=>Array.from(new Set(c.value.map(N=>N.kind))).map(N=>{const b=c.value.filter(S=>S.kind===N);return{kind:N,displayName:N,accounts:b.map(S=>({id:S.id,label:S.display_name||S.id})),models:u.value[N]??[]}}));async function p(N){if(!u.value[N.kind])try{const{items:b}=await d.listModels(N.id);u.value={...u.value,[N.kind]:b.map(S=>S.id)}}catch{}}async function E(){if(await Promise.all(c.value.filter(N=>N.status==="ready").map(p)),!o.selectedModel.value){for(const N of m.value)if(N.models.length>0){o.selectedModel.value=N.models[0],o.selectedBackend.value||(o.selectedBackend.value=N.kind);break}}}t.watchEffect(()=>{o.setConfigParser(a.configParser??null)}),t.onMounted(async()=>{try{const N=await d.listBackends();c.value=N.items??[],await E()}catch{}}),t.watch(()=>[o.selectedBackend.value,o.selectedAccount.value],([N,b],[S,v])=>{o.sessionId.value&&(N!==S||b!==v)&&o.resetSession()});function T(N,b=null){if(b){const v=c.value.find(A=>A.id===b);if(v)return v}const S=N?c.value.filter(v=>v.kind===N):c.value;return S.find(v=>v.status==="ready")??S[0]??null}async function f(N){if(!o.sessionId.value){if(c.value.length===0)try{const B=await d.listBackends();c.value=B.items??[],await E()}catch{o.error.value="Unable to load backends from sidecar";return}const b=o.selectedBackend.value??a.defaultBackend??null,S=o.selectedAccount.value,v=T(b,S);if(!v){o.error.value="No backend available — add an account first";return}let A=o.selectedModel.value??a.defaultModel??"";if(!A){await p(v);const B=u.value[v.kind]??[];B.length>0&&(A=B[0],o.selectedModel.value=A)}if(!A){o.error.value=`No models available for ${v.kind}`;return}try{await o.createSession(v.id,A)}catch(B){o.error.value=B instanceof Error?B.message:String(B);return}}await o.send(N)}async function O(){const N=await o.finalize();s("finalize",N)}return(N,b)=>(t.openBlock(),t.createElementBlock("div",kC,[n.density==="detailed"?(t.openBlock(),t.createBlock(id,{key:0,"chat-mode":t.unref(o).chatMode.value,"selected-backend":t.unref(o).selectedBackend.value,"selected-account":t.unref(o).selectedAccount.value,"selected-model":t.unref(o).selectedModel.value,backends:m.value,"onUpdate:chatMode":t.unref(o).setMode,"onUpdate:selectedBackend":t.unref(o).selectBackend,"onUpdate:selectedAccount":b[0]||(b[0]=S=>t.unref(o).selectedAccount.value=S),"onUpdate:selectedModel":b[1]||(b[1]=S=>t.unref(o).selectedModel.value=S)},null,8,["chat-mode","selected-backend","selected-account","selected-model","backends","onUpdate:chatMode","onUpdate:selectedBackend"])):t.createCommentVNode("",!0),t.createElementVNode("div",wC,[t.unref(o).messages.value.length===0&&!t.unref(o).isStreaming.value?(t.openBlock(),t.createElementBlock("div",PC,[t.createElementVNode("div",BC,t.toDisplayString(_.value),1),t.createElementVNode("h3",UC,t.toDisplayString(n.welcomeTitle),1),t.createElementVNode("p",FC,t.toDisplayString(n.welcomeSubtitle),1)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o).messages.value,S=>(t.openBlock(),t.createBlock(Wt,{key:S.id,role:S.role,content:S.content,timestamp:S.created_at,backend:t.unref(o).selectedBackend.value,model:S.model??t.unref(o).selectedModel.value,"show-actions":i.value,"all-messages":t.unref(o).messages.value},null,8,["role","content","timestamp","backend","model","show-actions","all-messages"]))),128)),t.unref(o).isStreaming.value&&t.unref(o).chatMode.value==="single"&&t.unref(o).streamingContent.value?(t.openBlock(),t.createBlock(Wt,{key:1,role:"assistant",content:t.unref(o).streamingContent.value,backend:t.unref(o).selectedBackend.value,model:t.unref(o).selectedModel.value,streaming:!0},null,8,["content","backend","model"])):t.createCommentVNode("",!0),t.unref(o).backendResponses.value.size>0?(t.openBlock(),t.createBlock(bo,{key:2,responses:t.unref(o).backendResponses.value,collapsible:t.unref(o).chatMode.value==="compound"},null,8,["responses","collapsible"])):t.createCommentVNode("",!0),t.unref(o).synthesisState.value?(t.openBlock(),t.createBlock(fo,{key:3,state:t.unref(o).synthesisState.value},null,8,["state"])):t.createCommentVNode("",!0),r.value&&t.unref(o).processGroups.groups.value.size>0?(t.openBlock(),t.createElementBlock("div",GC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(o).processGroups.groups.value,([S,v])=>(t.openBlock(),t.createBlock(Ro,{key:S,id:v.id,type:v.type,label:v.label,timestamp:v.timestamp,"is-expanded":v.isExpanded,onToggle:A=>t.unref(o).processGroups.toggleGroup(S)},{default:t.withCtx(()=>[t.createElementVNode("pre",null,t.toDisplayString(v.content),1)]),_:2},1032,["id","type","label","timestamp","is-expanded","onToggle"]))),128))])):t.createCommentVNode("",!0),N.$slots.finalization?t.renderSlot(N.$slots,"finalization",{key:5,state:{canFinalize:t.unref(o).canFinalize,isFinalizing:t.unref(o).isFinalizing}},void 0,!0):t.unref(o).canFinalize.value&&n.entityLabel?(t.openBlock(),t.createBlock(sd,{key:6,title:n.bannerTitle??"Ready to finalize","button-label":n.bannerButtonLabel??"Finalize","entity-label":n.entityLabel,"is-finalizing":t.unref(o).isFinalizing.value,onFinalize:O},null,8,["title","button-label","entity-label","is-finalizing"])):t.createCommentVNode("",!0),b[3]||(b[3]=t.createElementVNode("div",{class:"aia-smart-panel__anchor"},null,-1))],512),t.unref(l).showScrollButton.value?(t.openBlock(),t.createElementBlock("button",{key:1,class:"aia-smart-panel__scroll-btn",onClick:b[2]||(b[2]=(...S)=>t.unref(l).scrollToBottom&&t.unref(l).scrollToBottom(...S))}," ↓ ")):t.createCommentVNode("",!0),t.unref(o).error.value?(t.openBlock(),t.createElementBlock("div",YC,t.toDisplayString(t.unref(o).error.value),1)):t.createCommentVNode("",!0),n.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(od,{key:3,placeholder:n.placeholder,"is-streaming":t.unref(o).isStreaming.value,onSend:f},null,8,["placeholder","is-streaming"]))]))}}),qC=he(VC,[["__scopeId","data-v-4cb169c3"]]),zC={class:"aia-chat-selector"},HC={class:"aia-chat-selector__group"},$C=["value","disabled"],WC=["value"],KC={class:"aia-chat-selector__group"},QC=["value","disabled"],XC=["value"],ZC={class:"aia-chat-selector__group"},JC=["value","disabled"],jC=["value"],eN={key:0,class:"aia-chat-selector__group aia-chat-selector__mode-group"},tN=["value","checked","onChange"],nN=t.defineComponent({__name:"AiChatSelector",props:{backend:{},accountId:{},model:{},chatMode:{}},emits:["update:backend","update:accountId","update:model","update:chatMode"],setup(n,{emit:e}){const a=n,r=e,i=[{value:"single",label:"Single"},{value:"all",label:"All"},{value:"compound",label:"Compound"}],{client:s}=et.useAiAccounts(),o=t.ref([]),l=t.ref({}),d=t.ref(!0),_=t.computed(()=>{const b=new Map;for(const S of o.value)b.has(S.kind)||b.set(S.kind,{kind:S.kind,label:c(S)});return Array.from(b.values())});function c(b){return{claude:"Claude",claude_custom:"Claude (self-hosted)",codex:"Codex",antigravity:"Antigravity",opencode:"OpenCode",deepseek:"DeepSeek",goose:"Goose",aider:"Aider",crush:"Crush",openai_compat:"OpenAI-compatible",openrouter:"OpenRouter",kimi:"Kimi"}[b.kind]??b.kind}const u=t.computed(()=>a.backend==="auto"?[]:o.value.filter(b=>b.kind===a.backend)),m=t.computed(()=>u.value.map(b=>({id:b.id,label:b.display_name||b.id}))),p=t.computed(()=>l.value[a.backend]??[]),E=t.computed(()=>a.backend==="auto");async function T(b){if(l.value[b])return;const S=o.value.find(v=>v.kind===b);if(S)try{const{items:v}=await s.listModels(S.id);l.value={...l.value,[b]:v.map(A=>A.id)}}catch{}}t.onMounted(async()=>{try{const b=await s.listBackends();o.value=b.items??[],a.backend&&a.backend!=="auto"&&await T(a.backend)}catch{}finally{d.value=!1}}),t.watch(()=>a.backend,b=>{r("update:accountId",null),r("update:model",null),b&&b!=="auto"&&T(b)});function f(b){const S=b.target.value;r("update:backend",S),S!=="auto"&&a.chatMode&&a.chatMode!=="single"&&r("update:chatMode","single")}function O(b){const S=b.target.value;r("update:accountId",S||null)}function N(b){const S=b.target.value;r("update:model",S||null)}return(b,S)=>(t.openBlock(),t.createElementBlock("div",zC,[t.createElementVNode("div",HC,[S[1]||(S[1]=t.createElementVNode("label",{class:"aia-chat-selector__label"},"Backend:",-1)),t.createElementVNode("select",{class:"aia-chat-selector__select aia-chat-selector__select--backend",value:n.backend,disabled:d.value,onChange:f},[S[0]||(S[0]=t.createElementVNode("option",{value:"auto"},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,v=>(t.openBlock(),t.createElementBlock("option",{key:v.kind,value:v.kind},t.toDisplayString(v.label),9,WC))),128))],40,$C)]),t.createElementVNode("div",KC,[S[3]||(S[3]=t.createElementVNode("label",{class:"aia-chat-selector__label"},"Account:",-1)),t.createElementVNode("select",{class:"aia-chat-selector__select aia-chat-selector__select--account",value:n.accountId||"",disabled:E.value||m.value.length===0,onChange:O},[S[2]||(S[2]=t.createElementVNode("option",{value:""},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(m.value,v=>(t.openBlock(),t.createElementBlock("option",{key:v.id,value:v.id},t.toDisplayString(v.label),9,XC))),128))],40,QC)]),t.createElementVNode("div",ZC,[S[5]||(S[5]=t.createElementVNode("label",{class:"aia-chat-selector__label"},"Model:",-1)),t.createElementVNode("select",{class:"aia-chat-selector__select aia-chat-selector__select--model",value:n.model||"",disabled:E.value||p.value.length===0,onChange:N},[S[4]||(S[4]=t.createElementVNode("option",{value:""},"Auto",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(p.value,v=>(t.openBlock(),t.createElementBlock("option",{key:v,value:v},t.toDisplayString(v),9,jC))),128))],40,JC)]),n.chatMode?(t.openBlock(),t.createElementBlock("div",eN,[S[6]||(S[6]=t.createElementVNode("span",{class:"aia-chat-selector__mode-separator","aria-hidden":"true"},null,-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(i,v=>t.createElementVNode("label",{key:v.value,class:t.normalizeClass(["aia-chat-selector__mode-radio",{"aia-chat-selector__mode-radio--active":n.chatMode===v.value}])},[t.createElementVNode("input",{type:"radio",name:"aia-chat-selector-mode",value:v.value,checked:n.chatMode===v.value,onChange:A=>r("update:chatMode",v.value)},null,40,tN),t.createTextVNode(" "+t.toDisplayString(v.label),1)],2)),64))])):t.createCommentVNode("",!0),t.renderSlot(b.$slots,"trailing",{},void 0,!0)]))}}),ld=he(nN,[["__scopeId","data-v-3ed1dc93"]]),aN={class:"chat-panel"},rN={key:1,class:"cli-runner-toggle"},iN=["aria-pressed","title"],oN={class:"cli-runner-toggle__label"},sN={key:0,class:"chat-welcome"},lN={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5"},cN=["d"],_N={class:"process-group-content"},dN={key:4,class:"processing-indicator"},uN={key:2,class:"convert-banner"},pN={class:"banner-icon"},mN={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},EN=["d"],gN={class:"banner-content"},SN=["disabled"],TN={key:3,class:"input-area"},bN={class:"input-wrapper"},fN=["value","placeholder","disabled"],RN=["disabled"],CN=32,NN=t.defineComponent({__name:"AiChatPanelManaged",props:{messages:{default:()=>[]},isProcessing:{type:Boolean,default:!1},streamingContent:{default:""},inputMessage:{default:""},conversationId:{default:null},canFinalize:{type:Boolean,default:!1},isFinalizing:{type:Boolean,default:!1},assistantIconPaths:{default:()=>[]},inputPlaceholder:{default:"Type a message..."},entityLabel:{default:""},bannerTitle:{default:""},bannerButtonLabel:{default:""},detectedEntityName:{default:""},showBackendSelector:{type:Boolean,default:!1},selectedBackend:{default:"auto"},selectedAccountId:{default:null},selectedModel:{default:null},readOnly:{type:Boolean,default:!1},useSmartScroll:{type:Boolean,default:!1},processGroups:{},chatMode:{default:"single"},backendResponses:{},synthesisState:{default:null},isAllModeActive:{type:Boolean,default:!1},useCliRunner:{type:Boolean,default:!1},hideCliRunnerToggle:{type:Boolean,default:!1}},emits:["update:inputMessage","send","keydown","finalize","update:selectedBackend","update:selectedAccountId","update:selectedModel","update:chatMode","update:useCliRunner"],setup(n,{emit:e}){const a=n,r=e,i=t.ref(null),s=t.computed(()=>To(a.selectedBackend)||"Assistant"),o=t.computed(()=>a.messages??[]),l=t.computed(()=>a.inputMessage??""),d=t.computed(()=>a.assistantIconPaths??[]),_=t.computed(()=>o.value.map(N=>{const b={role:N.role,content:N.content};return N.timestamp&&(b.timestamp=N.timestamp),b})),c=t.ref(!0);function u(){const N=i.value;return N?N.scrollHeight-N.scrollTop-N.clientHeight<=CN:!0}function m(){a.useSmartScroll&&(c.value=u())}function p(){t.nextTick(()=>{if(i.value){if(a.useSmartScroll&&!c.value)return;i.value.scrollTop=i.value.scrollHeight}})}function E(){c.value=!0,t.nextTick(()=>{i.value&&i.value.scrollTo({top:i.value.scrollHeight,behavior:"instant"})})}const T=t.computed(()=>a.useSmartScroll&&!c.value);t.watch(()=>o.value.length,p),t.watch(()=>a.streamingContent,p),t.watch(()=>a.isProcessing,N=>{N&&p()}),t.watch(()=>{if(!a.backendResponses)return 0;let N=0;for(const b of a.backendResponses.values())N+=b.content.length;return N},p),t.watch(()=>{var N,b;return((b=(N=a.synthesisState)==null?void 0:N.content)==null?void 0:b.length)??0},p);function f(N){const b=N.target;r("update:inputMessage",b.value),b.style.height="auto",b.style.height=Math.min(b.scrollHeight,120)+"px"}const O=t.computed(()=>a.processGroups?Array.from(a.processGroups.entries()):[]);return(N,b)=>(t.openBlock(),t.createElementBlock("div",aN,[n.showBackendSelector?(t.openBlock(),t.createBlock(ld,{key:0,backend:n.selectedBackend??"auto","account-id":n.selectedAccountId??null,model:n.selectedModel??null,"chat-mode":n.chatMode??"single","onUpdate:backend":b[0]||(b[0]=S=>r("update:selectedBackend",S)),"onUpdate:accountId":b[1]||(b[1]=S=>r("update:selectedAccountId",S)),"onUpdate:model":b[2]||(b[2]=S=>r("update:selectedModel",S)),"onUpdate:chatMode":b[3]||(b[3]=S=>r("update:chatMode",S))},{trailing:t.withCtx(()=>[t.renderSlot(N.$slots,"selector-trailing",{},void 0,!0)]),_:3},8,["backend","account-id","model","chat-mode"])):t.createCommentVNode("",!0),t.renderSlot(N.$slots,"header-extra",{},void 0,!0),n.hideCliRunnerToggle?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",rN,[t.createElementVNode("button",{type:"button",class:t.normalizeClass(["cli-runner-toggle__btn",{"cli-runner-toggle__btn--active":n.useCliRunner}]),"aria-pressed":n.useCliRunner?"true":"false",title:n.useCliRunner?"CLI runner mode — agent uses tools (filesystem, shell, edits) in the project worktree":"CLIProxy mode — pure token chat, no tool use",onClick:b[4]||(b[4]=S=>r("update:useCliRunner",!n.useCliRunner))},[b[9]||(b[9]=t.createElementVNode("span",{class:"cli-runner-toggle__dot"},null,-1)),t.createElementVNode("span",oN,t.toDisplayString(n.useCliRunner?"CLI runner":"CLIProxy"),1)],10,iN)])),t.createElementVNode("div",{class:"chat-container",ref_key:"chatContainer",ref:i,onScroll:m},[t.renderSlot(N.$slots,"welcome",{},()=>[o.value.length===0&&!n.isProcessing?(t.openBlock(),t.createElementBlock("div",sN,[t.createElementVNode("div",{class:t.normalizeClass(["welcome-icon",{connecting:!n.conversationId}])},[(t.openBlock(),t.createElementBlock("svg",lN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(S,v)=>(t.openBlock(),t.createElementBlock("path",{key:v,d:S},null,8,cN))),128))]))],2),t.createElementVNode("h2",null,t.toDisplayString(n.conversationId?"Ready to chat":`Connecting to ${s.value}...`),1),t.createElementVNode("p",null,t.toDisplayString(s.value)+" will guide you through designing your "+t.toDisplayString(n.entityLabel),1)])):t.createCommentVNode("",!0)],!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,(S,v)=>(t.openBlock(),t.createElementBlock("div",{key:v,class:t.normalizeClass(["message-wrapper",S.role])},[t.createVNode(Wt,{role:S.role,content:S.content,timestamp:S.timestamp??null,backend:S.backend??null,model:S.model??null,"avatar-paths":d.value,"skip-transition":o.value.length>10&&v<o.value.length-5},null,8,["role","content","timestamp","backend","model","avatar-paths","skip-transition"]),!n.isProcessing||v<o.value.length-1?(t.openBlock(),t.createBlock(So,{key:0,content:S.content,"all-messages":v===o.value.length-1?_.value:[]},null,8,["content","all-messages"])):t.createCommentVNode("",!0)],2))),128)),n.isProcessing&&(n.chatMode==="single"||!n.chatMode)&&n.streamingContent?(t.openBlock(),t.createBlock(Wt,{key:0,role:"assistant",content:n.streamingContent??"",backend:n.selectedBackend??null,model:n.selectedModel??null,"avatar-paths":d.value,streaming:!0},null,8,["content","backend","model","avatar-paths"])):t.createCommentVNode("",!0),(n.chatMode==="all"||n.chatMode==="compound")&&n.backendResponses&&n.backendResponses.size>0?(t.openBlock(),t.createBlock(bo,{key:1,responses:n.backendResponses,collapsible:n.chatMode==="compound"},null,8,["responses","collapsible"])):t.createCommentVNode("",!0),n.synthesisState&&n.synthesisState.status!=="waiting"?(t.openBlock(),t.createBlock(fo,{key:2,state:n.synthesisState},null,8,["state"])):t.createCommentVNode("",!0),O.value.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:3},t.renderList(O.value,([S,v])=>(t.openBlock(),t.createBlock(Ro,{key:S,id:S,type:v.type,label:v.label,timestamp:v.timestamp??"","auto-collapse-ms":v.type==="tool_call"?4e3:2e3},{default:t.withCtx(()=>[t.createElementVNode("pre",_N,t.toDisplayString(v.content),1)]),_:2},1032,["id","type","label","timestamp","auto-collapse-ms"]))),128)):t.createCommentVNode("",!0),n.isProcessing&&!n.streamingContent?(t.openBlock(),t.createElementBlock("div",dN,[b[10]||(b[10]=t.createElementVNode("div",{class:"dots"},[t.createElementVNode("span"),t.createElementVNode("span"),t.createElementVNode("span")],-1)),t.createElementVNode("span",null,t.toDisplayString(s.value)+" is thinking...",1)])):t.createCommentVNode("",!0),T.value?(t.openBlock(),t.createElementBlock("button",{key:5,class:"scroll-to-bottom-btn",onClick:E,title:"Scroll to bottom"},[...b[11]||(b[11]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("polyline",{points:"6 9 12 15 18 9"})],-1)])])):t.createCommentVNode("",!0)],544),n.canFinalize?(t.openBlock(),t.createElementBlock("div",uN,[t.createElementVNode("div",pN,[(t.openBlock(),t.createElementBlock("svg",mN,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(S,v)=>(t.openBlock(),t.createElementBlock("path",{key:v,d:S},null,8,EN))),128)),b[12]||(b[12]=t.createElementVNode("path",{d:"M20 6L9 17l-5-5","stroke-width":"2.5"},null,-1))]))]),t.createElementVNode("div",gN,[t.createElementVNode("h3",null,t.toDisplayString(n.bannerTitle),1),t.createElementVNode("p",null,t.toDisplayString(s.value)+" has designed your "+t.toDisplayString(n.entityLabel)+t.toDisplayString(n.detectedEntityName?": "+n.detectedEntityName:"")+". Click the button to finalize. ",1)]),t.createElementVNode("button",{class:"btn btn-primary btn-convert",disabled:n.isFinalizing,onClick:b[5]||(b[5]=S=>r("finalize"))},[b[13]||(b[13]=t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M20 6L9 17l-5-5"})],-1)),t.createTextVNode(" "+t.toDisplayString(n.isFinalizing?"Creating...":n.bannerButtonLabel),1)],8,SN)])):t.createCommentVNode("",!0),n.readOnly?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",TN,[t.createElementVNode("div",bN,[t.createElementVNode("textarea",{value:l.value,onInput:b[6]||(b[6]=S=>f(S)),placeholder:n.inputPlaceholder,disabled:n.isProcessing,onKeydown:b[7]||(b[7]=S=>r("keydown",S)),rows:"1"},null,40,fN),t.createElementVNode("button",{class:"btn-send",disabled:!l.value.trim()||n.isProcessing,onClick:b[8]||(b[8]=S=>r("send"))},[...b[14]||(b[14]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})],-1)])],8,RN)])]))]))}}),hN=he(NN,[["__scopeId","data-v-7d947b88"]]),vN={class:"aia-chat-mode-selector",role:"radiogroup","aria-label":"Chat mode"},ON=["aria-checked","title","onClick"],yN=t.defineComponent({__name:"ChatModeSelector",props:{mode:{}},emits:["update:mode"],setup(n,{emit:e}){const a=e,r=[{value:"single",label:"Single",description:"Send to one backend"},{value:"all",label:"All",description:"Send to all backends simultaneously"},{value:"compound",label:"Compound",description:"All backends + AI synthesis"}];return(i,s)=>(t.openBlock(),t.createElementBlock("div",vN,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(r,o=>t.createElementVNode("button",{key:o.value,type:"button",role:"radio","aria-checked":n.mode===o.value,class:t.normalizeClass(["aia-chat-mode-selector__btn",{"aia-chat-mode-selector__btn--active":n.mode===o.value}]),title:o.description,onClick:l=>a("update:mode",o.value)},t.toDisplayString(o.label),11,ON)),64))]))}}),AN=he(yN,[["__scopeId","data-v-c2599533"]]),IN="0.4.2";exports.AccountEditForm=eE;exports.AccountReauth=cE;exports.AccountWizard=ym;exports.AiChatPanel=qC;exports.AiChatPanelManaged=hN;exports.AiChatSelector=ld;exports.AllModeResponses=bo;exports.BackendPicker=L_;exports.ChatBubble=Wt;exports.ChatControls=id;exports.ChatInput=od;exports.ChatMessage=Xi;exports.ChatModeSelector=AN;exports.ChatPanel=NE;exports.CompoundSynthesis=fo;exports.FinalizationBanner=sd;exports.LoginStream=no;exports.MessageActions=So;exports.OnboardingFlow=Km;exports.ProcessGroup=Ro;exports.forceFreshAccountPrompt=M_;exports.version=IN;