@ai-accounts/vue-styled 0.2.2 → 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-accounts-vue-styled.cjs.js +1 -1
- package/dist/ai-accounts-vue-styled.js +1384 -209
- package/dist/components/AccountEditForm.vue.d.ts +20 -0
- package/dist/components/AccountEditForm.vue.d.ts.map +1 -0
- package/dist/components/AccountWizard.vue.d.ts +21 -23
- package/dist/components/AccountWizard.vue.d.ts.map +1 -1
- package/dist/components/BackendPicker.vue.d.ts +13 -0
- package/dist/components/BackendPicker.vue.d.ts.map +1 -0
- package/dist/components/LoginStream.vue.d.ts +10 -0
- package/dist/components/LoginStream.vue.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),N=require("@ai-accounts/vue-headless"),A={class:"aia-wizard"},D={class:"aia-wizard__header"},F={key:0,class:"aia-wizard__kinds"},I=["onClick"],T={key:1,class:"aia-wizard__status"},K={class:"aia-label"},x={key:3,class:"aia-wizard__status"},L={key:4,class:"aia-wizard__success"},P={key:5,class:"aia-wizard__error"},U={key:0,class:"aia-wizard__hint"},M=e.defineComponent({__name:"AccountWizard",props:{client:{},kinds:{}},emits:["done","cancel"],setup(c,{emit:p}){const l=c,k=p,t=N.useAccountWizard({client:l.client}),r=e.ref(""),s=l.kinds??[{id:"claude",display:"Claude"},{id:"opencode",display:"OpenCode"},{id:"gemini",display:"Gemini"},{id:"codex",display:"Codex"}];t.start();async function b(u){await t.pickKind(u)}async function f(){await t.submitCredential("api_key",{api_key:r.value}),t.state.value==="done"&&t.backend.value&&k("done",t.backend.value.id)}function g(){t.reset(),t.start()}return(u,a)=>{var y;return e.openBlock(),e.createElementBlock("section",A,[e.createElementVNode("header",D,[e.renderSlot(u.$slots,"header",{},()=>[a[1]||(a[1]=e.createElementVNode("h2",null,"Connect an AI backend",-1))],!0)]),e.unref(t).state.value==="picking_kind"?(e.openBlock(),e.createElementBlock("div",F,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),d=>(e.openBlock(),e.createElementBlock("button",{key:d.id,class:"aia-btn aia-btn--kind",type:"button",onClick:E=>b(d.id)},e.toDisplayString(d.display),9,I))),128))])):e.unref(t).state.value==="detecting"?(e.openBlock(),e.createElementBlock("div",T," Detecting "+e.toDisplayString(e.unref(t).kind.value)+" CLI… ",1)):e.unref(t).state.value==="entering_credential"?(e.openBlock(),e.createElementBlock("form",{key:2,class:"aia-wizard__form",onSubmit:e.withModifiers(f,["prevent"])},[e.createElementVNode("label",K,[a[2]||(a[2]=e.createTextVNode(" API key ",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=d=>r.value=d),type:"password",class:"aia-input",autocomplete:"off",required:""},null,512),[[e.vModelText,r.value]])]),a[3]||(a[3]=e.createElementVNode("button",{type:"submit",class:"aia-btn aia-btn--primary"},"Connect",-1))],32)):e.unref(t).state.value==="validating"?(e.openBlock(),e.createElementBlock("div",x," Validating credential… ")):e.unref(t).state.value==="done"?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(u.$slots,"success",{},()=>[a[4]||(a[4]=e.createElementVNode("p",null,"✓ Connected successfully",-1))],!0)])):e.unref(t).state.value==="error"?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("p",null,e.toDisplayString(e.unref(t).error.value),1),(y=e.unref(t).error.value)!=null&&y.includes("OAuth")?(e.openBlock(),e.createElementBlock("p",U,[...a[5]||(a[5]=[e.createTextVNode(" Try the full ",-1),e.createElementVNode("code",null,"<OnboardingFlow>",-1),e.createTextVNode(" component instead — it supports browser login. ",-1)])])):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"aia-btn",type:"button",onClick:g},"Try again")])):e.createCommentVNode("",!0)])}}}),S=(c,p)=>{const l=c.__vccOpts||c;for(const[k,t]of p)l[k]=t;return l},W=S(M,[["__scopeId","data-v-50cd8832"]]),R={class:"aia-onboarding"},q={class:"aia-onboarding__header"},G={key:0,class:"aia-onboarding__welcome"},j={key:1,class:"aia-onboarding__status"},H={key:2,class:"aia-onboarding__kind-grid"},Y=["disabled","onClick"],J={class:"aia-kind-card__name"},Q={key:0,class:"aia-kind-card__badge"},X={key:1,class:"aia-kind-card__badge aia-kind-card__badge--missing"},Z={key:3,class:"aia-onboarding__login"},ee={class:"aia-onboarding__tabs"},te={class:"aia-label"},ne={key:1,class:"aia-onboarding__oauth-start"},ae={key:4,class:"aia-onboarding__oauth-challenge"},oe=["href"],ie={class:"aia-code-display"},le={key:5,class:"aia-onboarding__status"},se={key:6,class:"aia-onboarding__success"},re={key:7,class:"aia-onboarding__error"},de=e.defineComponent({__name:"OnboardingFlow",props:{client:{},kinds:{},supportedFlowsByKind:{}},emits:["done","cancel"],setup(c,{emit:p}){const l=c,k=p,t=N.useOnboarding({client:l.client}),r=e.ref(""),s=e.ref("api_key"),b=[{id:"claude",display:"Claude"},{id:"opencode",display:"OpenCode"},{id:"gemini",display:"Gemini"},{id:"codex",display:"Codex"}],f={claude:["api_key"],opencode:["api_key"],gemini:["api_key","oauth_device"],codex:["api_key","oauth_device"]},g=e.computed(()=>l.kinds??b),u=e.computed(()=>l.supportedFlowsByKind??f),a=e.computed(()=>{const o=t.selectedKind.value;return o?u.value[o]??["api_key"]:["api_key"]});async function y(){await t.start(),t.state.value!=="error"&&await t.detect()}async function d(o){await t.pickKind(o);const n=a.value;s.value=n[0]??"api_key"}async function E(){await t.submitApiKey(r.value)}async function $(){await t.submitOauthDevice()}e.watch(()=>t.state.value,o=>{o==="done"&&t.createdBackendId.value&&k("done",t.createdBackendId.value)},{immediate:!1});function z(){t.reset()}function O(){var n;const o=(n=t.oauthChallenge.value)==null?void 0:n.user_code;o&&typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(o)}function m(o){var n,_;return(_=(n=t.kinds.value)==null?void 0:n.find(v=>v.id===o))==null?void 0:_.detection}return(o,n)=>{var _,v,B;return e.openBlock(),e.createElementBlock("section",R,[e.createElementVNode("header",q,[e.renderSlot(o.$slots,"header",{},()=>[n[4]||(n[4]=e.createElementVNode("h2",null,"Set up an AI backend",-1))],!0)]),e.unref(t).state.value==="idle"?(e.openBlock(),e.createElementBlock("div",G,[n[5]||(n[5]=e.createElementVNode("p",null,"Connect one of the supported AI CLIs to get started.",-1)),e.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:y}," Get started ")])):e.unref(t).state.value==="started"||e.unref(t).state.value==="detecting"?(e.openBlock(),e.createElementBlock("div",j," Detecting installed CLIs… ")):e.unref(t).state.value==="picking_kind"?(e.openBlock(),e.createElementBlock("div",H,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,i=>{var C,h,V,w;return e.openBlock(),e.createElementBlock("button",{key:i.id,type:"button",class:e.normalizeClass(["aia-kind-card",{"aia-kind-card--installed":(C=m(i.id))==null?void 0:C.installed,"aia-kind-card--missing":m(i.id)&&!((h=m(i.id))!=null&&h.installed)}]),disabled:!((V=m(i.id))!=null&&V.installed),onClick:pe=>d(i.id)},[e.createElementVNode("span",J,e.toDisplayString(i.display),1),(w=m(i.id))!=null&&w.installed?(e.openBlock(),e.createElementBlock("span",Q," Installed ")):(e.openBlock(),e.createElementBlock("span",X," Not installed "))],10,Y)}),128))])):e.unref(t).state.value==="entering_credential"?(e.openBlock(),e.createElementBlock("div",Z,[e.createElementVNode("div",ee,[a.value.includes("api_key")?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["aia-tab",{"aia-tab--active":s.value==="api_key"}]),onClick:n[0]||(n[0]=i=>s.value="api_key")}," API key ",2)):e.createCommentVNode("",!0),a.value.includes("oauth_device")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["aia-tab",{"aia-tab--active":s.value==="oauth_device"}]),onClick:n[1]||(n[1]=i=>s.value="oauth_device")}," Login with browser ",2)):e.createCommentVNode("",!0)]),s.value==="api_key"?(e.openBlock(),e.createElementBlock("form",{key:0,class:"aia-onboarding__form",onSubmit:e.withModifiers(E,["prevent"])},[e.createElementVNode("label",te,[n[6]||(n[6]=e.createTextVNode(" API key ",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[2]||(n[2]=i=>r.value=i),type:"password",class:"aia-input",autocomplete:"off",required:""},null,512),[[e.vModelText,r.value]])]),n[7]||(n[7]=e.createElementVNode("button",{type:"submit",class:"aia-btn aia-btn--primary"},"Connect",-1))],32)):s.value==="oauth_device"?(e.openBlock(),e.createElementBlock("div",ne,[n[8]||(n[8]=e.createElementVNode("p",null,"You'll be shown a verification URL and code. Open it in your browser to sign in.",-1)),e.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:$}," Start browser login ")])):e.createCommentVNode("",!0)])):e.unref(t).state.value==="oauth_challenge"||e.unref(t).state.value==="oauth_polling"?(e.openBlock(),e.createElementBlock("div",ae,[n[9]||(n[9]=e.createElementVNode("p",null,"Open this URL in your browser and enter the code:",-1)),e.createElementVNode("a",{href:(_=e.unref(t).oauthChallenge.value)==null?void 0:_.verification_uri,target:"_blank",rel:"noopener noreferrer",class:"aia-onboarding__oauth-uri"},e.toDisplayString((v=e.unref(t).oauthChallenge.value)==null?void 0:v.verification_uri),9,oe),e.createElementVNode("div",ie,[e.createElementVNode("code",null,e.toDisplayString((B=e.unref(t).oauthChallenge.value)==null?void 0:B.user_code),1),e.createElementVNode("button",{type:"button",class:"aia-copy-btn",onClick:O},"Copy")]),n[10]||(n[10]=e.createElementVNode("p",{class:"aia-onboarding__hint"},"Waiting for you to complete sign-in…",-1)),e.createElementVNode("button",{type:"button",class:"aia-btn",onClick:n[3]||(n[3]=(...i)=>e.unref(t).cancelOAuth&&e.unref(t).cancelOAuth(...i))},"Cancel")])):e.unref(t).state.value==="validating"?(e.openBlock(),e.createElementBlock("div",le," Validating credential… ")):e.unref(t).state.value==="done"?(e.openBlock(),e.createElementBlock("div",se,[e.renderSlot(o.$slots,"success",{},()=>[n[11]||(n[11]=e.createElementVNode("p",null,"✓ Connected successfully",-1))],!0)])):e.unref(t).state.value==="error"?(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("p",null,e.toDisplayString(e.unref(t).error.value),1),e.createElementVNode("button",{type:"button",class:"aia-btn",onClick:z},"Try again")])):e.createCommentVNode("",!0)])}}}),ce=S(de,[["__scopeId","data-v-8c20d7e7"]]),ue="0.2.0";exports.AccountWizard=W;exports.OnboardingFlow=ce;exports.version=ue;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),O=require("@ai-accounts/vue-headless"),De={class:"aia-login-stream"},We={key:0,class:"aia-url-prompt"},Ie=["href"],Pe={key:0,class:"aia-code"},Ae=["type"],$e={key:2,class:"aia-stdout"},Le={key:3,class:"aia-error"},Te=e.defineComponent({__name:"LoginStream",props:{session:{},showStdout:{type:Boolean,default:!0}},setup(r){const N=r,n=e.ref("");async function f(){const a=n.value;n.value="",await N.session.respond(a)}return(a,c)=>(e.openBlock(),e.createElementBlock("div",De,[r.session.urlPrompt.value?(e.openBlock(),e.createElementBlock("div",We,[c[3]||(c[3]=e.createElementVNode("p",{class:"aia-label"},"Open this URL to authenticate:",-1)),e.createElementVNode("a",{href:r.session.urlPrompt.value.url,target:"_blank",rel:"noopener"},e.toDisplayString(r.session.urlPrompt.value.url),9,Ie),r.session.urlPrompt.value.user_code?(e.openBlock(),e.createElementBlock("p",Pe,[c[2]||(c[2]=e.createTextVNode(" Code: ",-1)),e.createElementVNode("code",null,e.toDisplayString(r.session.urlPrompt.value.user_code),1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),r.session.textPrompt.value?(e.openBlock(),e.createElementBlock("form",{key:1,class:"aia-text-prompt",onSubmit:e.withModifiers(f,["prevent"])},[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(r.session.textPrompt.value.prompt)+" ",1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d),type:r.session.textPrompt.value.hidden?"password":"text",autocomplete:"off"},null,8,Ae),[[e.vModelDynamic,n.value]])]),c[4]||(c[4]=e.createElementVNode("button",{type:"submit"},"Continue",-1))],32)):e.createCommentVNode("",!0),r.showStdout&&r.session.stdoutLines.value.length>0?(e.openBlock(),e.createElementBlock("pre",$e,e.toDisplayString(r.session.stdoutLines.value.join("")),1)):e.createCommentVNode("",!0),r.session.status.value==="failed"?(e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("strong",null,e.toDisplayString(r.session.errorCode.value),1),e.createElementVNode("p",null,e.toDisplayString(r.session.errorMessage.value),1)])):e.createCommentVNode("",!0),r.session.status.value==="running"?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",class:"aia-cancel",onClick:c[1]||(c[1]=d=>r.session.cancel())}," Cancel ")):e.createCommentVNode("",!0)]))}}),G=(r,N)=>{const n=r.__vccOpts||r;for(const[f,a]of N)n[f]=a;return n},ke=G(Te,[["__scopeId","data-v-133adf55"]]),Oe={class:"aia-backend-picker"},Fe=["onClick"],Ke=["src","alt"],Me={class:"aia-backend-info"},Ue={key:0,class:"aia-installed"},Re={key:1,class:"aia-not-installed"},He=e.defineComponent({__name:"BackendPicker",props:{installStatus:{}},emits:["pick"],setup(r,{emit:N}){const n=r,f=N,a=O.useBackendRegistry();function c(d){return n.installStatus?n.installStatus[d]:void 0}return e.onMounted(async()=>{a.loaded.value||await a.load()}),(d,b)=>(e.openBlock(),e.createElementBlock("ul",Oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).backends.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u.kind},[e.createElementVNode("button",{type:"button",onClick:i=>f("pick",u.kind)},[u.icon_url?(e.openBlock(),e.createElementBlock("img",{key:0,src:u.icon_url,alt:u.display_name},null,8,Ke)):e.createCommentVNode("",!0),e.createElementVNode("div",Me,[e.createElementVNode("strong",null,e.toDisplayString(u.display_name),1),c(u.kind)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c(u.kind).installed?(e.openBlock(),e.createElementBlock("span",Ue," installed"+e.toDisplayString(c(u.kind).version?" v"+c(u.kind).version:""),1)):(e.openBlock(),e.createElementBlock("span",Re,"not detected"))],64)):e.createCommentVNode("",!0)])],8,Fe)]))),128))]))}}),ye=G(He,[["__scopeId","data-v-2500895f"]]),qe={class:"wizard-container","data-tour":"account-wizard"},Ge={class:"wizard-header"},Ye={key:0,class:"wizard-step"},je={class:"step-body"},Xe={class:"step-actions"},Je={key:1,class:"wizard-steps"},Qe=["onClick"],Ze={class:"step-number"},et={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3",width:"12",height:"12"},tt={class:"step-label"},ot={key:2,class:"wizard-step"},nt={class:"step-body"},at={class:"step-question"},lt={class:"radio-group"},st={class:"radio-card-content"},it={class:"radio-card-title"},ct={class:"radio-card-desc"},rt={class:"radio-card-content"},dt={class:"radio-card-title"},ut={class:"radio-card-desc"},pt={key:0,class:"account-fields"},mt={class:"form-group"},vt={for:"wiz-name"},kt=["placeholder"],yt={class:"form-group"},gt={for:"wiz-email"},Et=["placeholder"],_t={class:"step-actions"},ft=["disabled"],bt={key:3,class:"wizard-step"},ht={class:"step-body"},Nt={class:"status-icon"},Vt={key:0,class:"spinner-sm"},Bt={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},Ct={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},wt={class:"status-info"},St={class:"status-title"},xt={key:0,class:"status-detail"},zt={key:1,class:"status-detail"},Dt={key:1,class:"spinner-sm"},Wt={key:0,class:"error-text"},It={key:1,class:"install-success-text"},Pt={key:2,class:"install-stderr"},At={key:3,class:"config-dir-section"},$t={class:"config-dir-label"},Lt={class:"config-dir-path"},Tt=["disabled"],Ot={key:1,class:"dir-created-badge"},Ft={key:0,class:"error-text"},Kt={class:"config-path-edit"},Mt={key:1,class:"form-group compact"},Ut=["placeholder"],Rt={key:4,class:"api-key-info"},Ht={class:"api-key-label"},qt={class:"step-actions"},Gt={key:4,class:"wizard-step"},Yt={class:"step-body"},jt={key:0,class:"login-status login-connecting"},Xt={key:2,class:"login-status login-completed"},Jt={class:"login-status login-error"},Qt={class:"step-actions"},Zt={key:5,class:"wizard-step"},eo={class:"step-body"},to={key:0,class:"cliproxy-install-block"},oo=["disabled"],no={key:0,class:"spinner-sm"},ao={key:0},lo={key:0,class:"install-success-text"},so={key:1},io={key:0,class:"install-stderr"},co={key:1,class:"proxy-step-body"},ro={key:1,class:"proxy-running"},uo={key:2,class:"proxy-device-auth"},po=["href"],mo={key:1,class:"proxy-code"},vo={class:"callback-paste"},ko={class:"callback-label"},yo={key:0,class:"error-text"},go={key:3,class:"proxy-success"},Eo={key:4,class:"proxy-skipped"},_o={key:5,class:"proxy-error"},fo={class:"error-text"},bo={key:2,class:"proxy-loading"},ho={class:"step-actions"},No={key:6,class:"wizard-step"},Vo={class:"step-body"},Bo={class:"review-card"},Co={class:"review-row"},wo={class:"review-label"},So={class:"review-value"},xo={key:0,class:"review-row"},zo={class:"review-label"},Do={class:"review-value"},Wo={key:1,class:"review-row"},Io={class:"review-label"},Po={class:"review-value"},Ao={key:2,class:"review-row"},$o={class:"review-label"},Lo={class:"review-value"},To={key:0,class:"form-group"},Oo={for:"wiz-plan"},Fo={value:""},Ko=["value"],Mo={class:"form-group checkbox"},Uo={key:1,class:"error-text"},Ro={class:"step-actions"},Ho=["disabled"],qo={key:0,class:"spinner-sm"},Go={key:7,class:"wizard-step"},Yo={class:"step-body done-body"},jo={class:"done-actions"},Xo=e.defineComponent({__name:"AccountWizard",props:{initialBackendKind:{},backendName:{},allowSkip:{type:Boolean}},emits:["close","saved","skip","addAnother","done"],setup(r,{emit:N}){const n=(o,t)=>({"accountWizard.addAccount":"Add Account","accountWizard.stepSubscription":"Subscription","accountWizard.stepCliSetup":"CLI Setup","accountWizard.stepLogin":"Login","accountWizard.stepPlanSave":"Plan & Save","accountWizard.stepDone":"Done","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.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.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"})[o]??o,f=r,a=N,{client:c,emit:d}=O.useAiAccounts(),b=O.useBackendRegistry(),u=O.useLoginSession(),i=e.ref(f.initialBackendKind??""),k=e.computed(()=>i.value?b.get(i.value):void 0),E=e.computed(()=>{var o;return f.backendName||((o=k.value)==null?void 0:o.display_name)||i.value||"Backend"}),p=e.ref("subscription"),S=["claude","codex","gemini"],F=e.computed(()=>S.includes(i.value??"")),I=e.computed(()=>{const o=["subscription","cli","login"];return F.value&&o.push("proxy"),o.push("plan"),o}),P=e.computed(()=>I.value.indexOf(p.value)),ae=e.computed(()=>({subscription:n("accountWizard.stepSubscription"),cli:n("accountWizard.stepCliSetup"),login:n("accountWizard.stepLogin"),proxy:"API Proxy",plan:n("accountWizard.stepPlanSave"),done:n("accountWizard.stepDone")}));function V(){const o=I.value,t=o.indexOf(p.value);t>=0&&t<o.length-1?p.value=o[t+1]:p.value===o[o.length-1]&&(p.value="done")}function m(){const o=I.value,t=o.indexOf(p.value);t>0&&(p.value=o[t-1])}const l=e.ref(""),v=e.ref(""),B=e.ref(""),Y=e.computed(()=>l.value==="no"?!0:l.value==="yes"?v.value.trim().length>0:!1);function y(){if(l.value==="no"){ze();return}V()}const g=e.ref(""),D=e.ref(!1);function K(o){return o.toLowerCase().replace(/\s+/g,"").replace(/[^a-z0-9]/g,"")}function j(){if(D.value)return;const o=v.value.trim();if(!o){g.value="";return}const t=K(o),s={claude:".claude",codex:".codex",gemini:".gemini",opencode:".opencode"},w=i.value||"",ne=s[w]||(w?`.${w}`:".backend");g.value=`~/${ne}-${t}`}const A=e.computed(()=>{const o=v.value.trim();if(!o)return"";const t={claude:"ANTHROPIC",codex:"OPENAI",gemini:"GOOGLE",opencode:"OPENCODE"},s=i.value||"",w=t[s]||(s?s.toUpperCase():"BACKEND"),ne=K(o).replace(/-/g,"_").toUpperCase();return`${w}_API_KEY_${ne}`}),$=e.ref(!1),X=e.ref(""),le=e.ref(!1),J=e.ref(!1),ce=e.ref(!1),Q=e.ref(!1),se=e.ref(""),L=e.ref("");async function re(){if(i.value){le.value=!0;try{const o=b.get(i.value);$.value=!!o,X.value=""}catch(o){console.warn("[AccountWizard] CLI check failed:",o)}finally{le.value=!1}}}const C=e.ref(null);async function ge(){if(i.value){J.value=!0,L.value="",C.value=null;try{const o=await c.installBackendCli(i.value);C.value=o,o.success?($.value=!0,X.value=""):L.value=o.stderr||o.stdout||"Installation failed"}catch(o){L.value=o instanceof Error?o.message:String(o),C.value={kind:i.value,success:!1,display:"install failed",stdout:"",stderr:L.value,exit_code:-1,binary_path:null}}finally{J.value=!1}}}async function Ee(){g.value&&(Q.value=!0)}e.onMounted(async()=>{b.loaded.value||await b.load(),re(),d({type:"wizard.opened",backendKind:i.value}),Ne()}),e.watch(g,()=>{Q.value=!1,se.value=""});const x=e.ref("");e.watch(p,async o=>{o==="login"&&u.status.value==="idle"&&await de()},{immediate:!0});async function de(){const o=k.value;if(o)try{if(!x.value){const s=await c.createBackend({kind:o.kind,display_name:v.value.trim()||o.display_name,config:ue()});x.value=s.id}const t=_e(o);d({type:"wizard.step",backendKind:o.kind,step:"login.start"}),await u.start(x.value,t,fe(o))}catch(t){console.warn("[AccountWizard] login failed:",t)}}function _e(o){const t=o.login_flows.map(s=>s.kind);return t.includes("cli_browser")?"cli_browser":t.includes("oauth_device")?"oauth_device":"api_key"}function fe(o){return{}}function ue(){return{email:B.value.trim()||void 0,config_path:g.value.trim()||void 0,api_key_env:A.value||void 0}}e.watch(()=>u.status.value,o=>{o==="complete"&&p.value==="login"&&V()}),e.onUnmounted(()=>{u.status.value==="running"&&u.cancel().catch(()=>{})});const T=e.computed(()=>{switch(u.status.value){case"running":return u.urlPrompt.value||u.stdoutLines.value.length>0?"streaming":"connecting";case"complete":return"completed";case"failed":case"cancelled":return"error";default:return"idle"}}),be=e.computed(()=>u.errorMessage.value||"");function he(){u.status.value==="running"&&u.cancel().catch(()=>{})}const pe=e.computed(()=>{var o;return((o=k.value)==null?void 0:o.plan_options)??[]}),Z=e.ref(""),ee=e.ref(!1),M=e.ref(!1),te=e.ref(""),_=e.ref("idle"),h=e.ref(""),U=e.ref(""),oe=e.ref(""),R=e.ref(""),W=e.ref(""),H=e.ref(!1),q=e.ref(!1),z=e.ref(null),me=e.ref(!1);async function Ne(){try{const o=await c.cliproxyStatus();H.value=o.installed}catch(o){console.warn("[AccountWizard] cliproxy status check failed:",o),H.value=!1}finally{me.value=!0}}async function Ve(){q.value=!0,z.value=null;try{const o=await c.cliproxyInstall();z.value=o,o.success&&(H.value=!0)}catch(o){z.value={success:!1,display:"install failed",stdout:"",stderr:o instanceof Error?o.message:String(o),binary_path:null}}finally{q.value=!1}}function ve(){_.value="idle",h.value="",U.value="",oe.value="",R.value="",W.value=""}async function Be(){var o;if(i.value){_.value="running",h.value=`Registering ${E.value} account with API proxy…`,W.value="";try{const t=await c.cliproxyLoginBegin(i.value,((o=g.value)==null?void 0:o.trim())||void 0);h.value=t.message,t.status==="imported"?_.value="success":t.status==="started"&&t.oauth_url?(_.value="device_auth",U.value=t.oauth_url,oe.value=t.device_code??"",t.device_code?h.value=`Open the URL and enter code ${t.device_code}`:h.value="Complete OAuth in the browser; paste the callback URL below if it fails to redirect"):t.status==="skipped"?_.value="skipped":_.value="error"}catch(t){_.value="error",h.value=t instanceof Error?t.message:String(t)}}}async function Ce(){if(R.value.trim()){W.value="";try{const o=await c.cliproxyCallbackForward(R.value.trim());o.status==="completed"?(_.value="success",h.value="API proxy login completed"):W.value=o.message}catch(o){W.value=o instanceof Error?o.message:String(o)}}}async function we(){M.value=!0,te.value="";try{const o=k.value;if(!o)throw new Error("No backend metadata available");const t={...ue(),plan:Z.value||void 0,is_default:ee.value};if(x.value)await c.updateBackend(x.value,{display_name:v.value.trim()||o.display_name,config:t});else{const s=await c.createBackend({kind:o.kind,display_name:v.value.trim()||o.display_name,config:t});x.value=s.id}p.value="done",a("saved"),d({type:"wizard.account.created",backendKind:o.kind,accountId:x.value}),d({type:"wizard.step",backendKind:o.kind,step:"done"})}catch(o){te.value=o instanceof Error?o.message:"Failed to save account"}finally{M.value=!1}}function Se(){l.value="",v.value="",B.value="",g.value="",D.value=!1,Z.value="",ee.value=!1,he(),x.value="",Q.value=!1,p.value="subscription",a("addAnother"),i.value&&d({type:"wizard.step",backendKind:i.value,step:"add-another"})}function ie(){i.value&&d({type:"wizard.closed",backendKind:i.value,reason:"cancel"}),a("close")}function xe(){i.value&&d({type:"wizard.closed",backendKind:i.value,reason:"done"}),a("done",{accountId:x.value})}function ze(){i.value&&d({type:"wizard.closed",backendKind:i.value,reason:"skip"}),a("skip")}return(o,t)=>(e.openBlock(),e.createElementBlock("div",qe,[e.createElementVNode("div",Ge,[e.createElementVNode("h3",null,e.toDisplayString(n("accountWizard.addAccount")),1),e.createElementVNode("button",{class:"wizard-close",onClick:ie},"×")]),i.value?p.value!=="done"?(e.openBlock(),e.createElementBlock("div",Je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,(s,w)=>(e.openBlock(),e.createElementBlock("div",{key:s,class:e.normalizeClass(["step-indicator",{active:p.value===s,completed:P.value>w,clickable:w<P.value}]),onClick:ne=>w<P.value?p.value=s:void 0},[e.createElementVNode("span",Ze,[P.value>w?(e.openBlock(),e.createElementBlock("svg",et,[...t[11]||(t[11]=[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(w+1),1)],64))]),e.createElementVNode("span",tt,e.toDisplayString(ae.value[s]),1)],10,Qe))),128))])):e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ye,[e.createElementVNode("div",je,[t[10]||(t[10]=e.createElementVNode("p",{class:"step-question"},"Select a backend to connect:",-1)),e.createVNode(ye,{onPick:t[0]||(t[0]=s=>{i.value=s,re()})})]),e.createElementVNode("div",Xe,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:ie},e.toDisplayString(n("common.cancel")),1)])])),i.value&&p.value==="subscription"?(e.openBlock(),e.createElementBlock("div",ot,[e.createElementVNode("div",nt,[e.createElementVNode("p",at,"Do you already have a "+e.toDisplayString(E.value)+" account?",1),e.createElementVNode("div",lt,[e.createElementVNode("label",{class:e.normalizeClass(["radio-card",{selected:l.value==="yes"}])},[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":t[1]||(t[1]=s=>l.value=s),value:"yes"},null,512),[[e.vModelRadio,l.value]]),e.createElementVNode("div",st,[e.createElementVNode("span",it,e.toDisplayString(n("accountWizard.yesHaveAccount")),1),e.createElementVNode("span",ct,e.toDisplayString(n("accountWizard.yesHaveAccountDesc")),1)])],2),e.createElementVNode("label",{class:e.normalizeClass(["radio-card",{selected:l.value==="no"}])},[e.withDirectives(e.createElementVNode("input",{type:"radio","onUpdate:modelValue":t[2]||(t[2]=s=>l.value=s),value:"no"},null,512),[[e.vModelRadio,l.value]]),e.createElementVNode("div",rt,[e.createElementVNode("span",dt,e.toDisplayString(n("accountWizard.noSkip")),1),e.createElementVNode("span",ut,e.toDisplayString(n("accountWizard.noSkipDesc")),1)])],2)]),e.createVNode(e.Transition,{name:"slide-down"},{default:e.withCtx(()=>[l.value==="yes"?(e.openBlock(),e.createElementBlock("div",pt,[e.createElementVNode("div",mt,[e.createElementVNode("label",vt,[e.createTextVNode(e.toDisplayString(n("accountWizard.accountName"))+" ",1),t[12]||(t[12]=e.createElementVNode("span",{class:"required"},"*",-1))]),e.withDirectives(e.createElementVNode("input",{id:"wiz-name","onUpdate:modelValue":t[3]||(t[3]=s=>v.value=s),type:"text",placeholder:n("accountWizard.accountNamePlaceholder"),autofocus:"",onInput:j},null,40,kt),[[e.vModelText,v.value]])]),e.createElementVNode("div",yt,[e.createElementVNode("label",gt,e.toDisplayString(n("accountWizard.email")),1),e.withDirectives(e.createElementVNode("input",{id:"wiz-email","onUpdate:modelValue":t[4]||(t[4]=s=>B.value=s),type:"email",placeholder:n("accountWizard.emailPlaceholder")},null,8,Et),[[e.vModelText,B.value]]),e.createElementVNode("small",null,e.toDisplayString(n("accountWizard.emailHelp")),1)])])):e.createCommentVNode("",!0)]),_:1})]),e.createElementVNode("div",_t,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:ie},e.toDisplayString(n("common.cancel")),1),e.createElementVNode("button",{class:e.normalizeClass(["btn",l.value==="no"?"btn-outline":"btn-primary"]),disabled:!Y.value,onClick:y},[e.createTextVNode(e.toDisplayString(l.value==="no"?n("accountWizard.noSkip"):n("accountWizard.continueBtn"))+" ",1),t[13]||(t[13]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))],10,ft)])])):e.createCommentVNode("",!0),i.value&&p.value==="cli"?(e.openBlock(),e.createElementBlock("div",bt,[e.createElementVNode("div",ht,[e.createElementVNode("div",{class:e.normalizeClass(["status-card",$.value?"status-ok":"status-warn"])},[e.createElementVNode("div",Nt,[le.value?(e.openBlock(),e.createElementBlock("div",Vt)):$.value?(e.openBlock(),e.createElementBlock("svg",Bt,[...t[14]||(t[14]=[e.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},null,-1),e.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"},null,-1)])])):(e.openBlock(),e.createElementBlock("svg",Ct,[...t[15]||(t[15]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),e.createElementVNode("line",{x1:"12",y1:"8",x2:"12",y2:"12"},null,-1),e.createElementVNode("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"},null,-1)])]))]),e.createElementVNode("div",wt,[e.createElementVNode("span",St,e.toDisplayString(E.value)+" CLI",1),$.value?(e.openBlock(),e.createElementBlock("span",xt,e.toDisplayString(n("accountWizard.cliInstalled"))+e.toDisplayString(X.value?` (${X.value})`:""),1)):(e.openBlock(),e.createElementBlock("span",zt,e.toDisplayString(n("accountWizard.cliNotInstalled")),1))]),!$.value&&!J.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-primary btn-sm",onClick:ge},e.toDisplayString(n("accountWizard.installCli")),1)):e.createCommentVNode("",!0),J.value?(e.openBlock(),e.createElementBlock("div",Dt)):e.createCommentVNode("",!0)],2),L.value?(e.openBlock(),e.createElementBlock("div",Wt,e.toDisplayString(L.value),1)):e.createCommentVNode("",!0),C.value&&C.value.success?(e.openBlock(),e.createElementBlock("div",It," Installed"+e.toDisplayString(C.value.binary_path?` at ${C.value.binary_path}`:""),1)):e.createCommentVNode("",!0),C.value&&!C.value.success&&C.value.stderr?(e.openBlock(),e.createElementBlock("pre",Pt,e.toDisplayString(C.value.stderr),1)):e.createCommentVNode("",!0),g.value?(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("div",$t,e.toDisplayString(n("accountWizard.configPath")),1),e.createElementVNode("div",Lt,[e.createElementVNode("code",null,e.toDisplayString(g.value),1),Q.value?(e.openBlock(),e.createElementBlock("span",Ot,[t[16]||(t[16]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"12",height:"12"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),e.createTextVNode(" "+e.toDisplayString(n("accountWizard.configCreated")),1)])):(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-outline btn-sm",disabled:ce.value,onClick:Ee},e.toDisplayString(ce.value?n("accountWizard.creating"):n("accountWizard.createDir")),9,Tt))]),se.value?(e.openBlock(),e.createElementBlock("div",Ft,e.toDisplayString(se.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Kt,[D.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn-link-sm",onClick:t[5]||(t[5]=s=>D.value=!0)},e.toDisplayString(n("accountWizard.customizePath")),1)),D.value?(e.openBlock(),e.createElementBlock("div",Mt,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[6]||(t[6]=s=>g.value=s),type:"text",placeholder:`e.g., ~/.${i.value}-personal`},null,8,Ut),[[e.vModelText,g.value]])])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("div",Rt,[e.createElementVNode("span",Ht,e.toDisplayString(n("accountWizard.apiKeyEnv")),1),e.createElementVNode("code",null,e.toDisplayString(A.value),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",qt,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:m},[t[17]||(t[17]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),e.createTextVNode(" "+e.toDisplayString(n("common.back")),1)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:V},[e.createTextVNode(e.toDisplayString(n("accountWizard.continueBtn"))+" ",1),t[18]||(t[18]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):e.createCommentVNode("",!0),i.value&&p.value==="login"?(e.openBlock(),e.createElementBlock("div",Gt,[e.createElementVNode("div",Yt,[T.value==="idle"||T.value==="connecting"?(e.openBlock(),e.createElementBlock("div",jt,[t[19]||(t[19]=e.createElementVNode("div",{class:"spinner-sm"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(n("accountWizard.startingLogin")),1)])):T.value==="streaming"?(e.openBlock(),e.createBlock(ke,{key:1,session:e.unref(u)},null,8,["session"])):T.value==="completed"?(e.openBlock(),e.createElementBlock("div",Xt,[t[20]||(t[20]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),e.createElementVNode("span",null,e.toDisplayString(n("accountWizard.loginCompleted")),1)])):T.value==="error"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",Jt,[t[21]||(t[21]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"16",height:"16"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"15"})],-1)),e.createElementVNode("span",null,e.toDisplayString(be.value),1)]),e.createElementVNode("button",{class:"btn btn-secondary",style:{"margin-top":"12px"},onClick:de},e.toDisplayString(n("accountWizard.tryAgain")),1)],64)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Qt,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:m},[t[22]||(t[22]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),e.createTextVNode(" "+e.toDisplayString(n("common.back")),1)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:V},[e.createTextVNode(e.toDisplayString(T.value==="idle"?n("common.skip"):n("accountWizard.continueBtn"))+" ",1),t[23]||(t[23]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):e.createCommentVNode("",!0),i.value&&p.value==="proxy"?(e.openBlock(),e.createElementBlock("div",Zt,[e.createElementVNode("div",eo,[me.value&&!H.value?(e.openBlock(),e.createElementBlock("div",to,[t[25]||(t[25]=e.createElementVNode("p",{class:"step-description"}," CLIProxyAPI is not installed. Install it to expose this account through an OpenAI-compatible endpoint for other tools. ",-1)),e.createElementVNode("button",{class:"btn btn-primary",disabled:q.value,onClick:Ve},[q.value?(e.openBlock(),e.createElementBlock("div",no)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(q.value?"Installing cliproxyapi…":"Install CLIProxyAPI"),1)],8,oo),z.value?(e.openBlock(),e.createElementBlock("div",ao,[z.value.success?(e.openBlock(),e.createElementBlock("p",lo," Installed"+e.toDisplayString(z.value.binary_path?` at ${z.value.binary_path}`:""),1)):(e.openBlock(),e.createElementBlock("div",so,[t[24]||(t[24]=e.createElementVNode("p",{class:"error-text"},"Install failed",-1)),z.value.stderr?(e.openBlock(),e.createElementBlock("pre",io,e.toDisplayString(z.value.stderr),1)):e.createCommentVNode("",!0)]))])):e.createCommentVNode("",!0)])):H.value?(e.openBlock(),e.createElementBlock("div",co,[t[31]||(t[31]=e.createElementVNode("h4",{class:"proxy-heading"},"Register with API proxy",-1)),t[32]||(t[32]=e.createElementVNode("p",{class:"step-description"}," Optional: register this account with CLIProxyAPI so other tools can reach it through an OpenAI-compatible endpoint. ",-1)),_.value==="idle"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"btn btn-primary",onClick:Be}," Start proxy registration ")):e.createCommentVNode("",!0),_.value==="running"?(e.openBlock(),e.createElementBlock("div",ro,[t[26]||(t[26]=e.createElementVNode("div",{class:"spinner-sm"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(h.value),1)])):e.createCommentVNode("",!0),_.value==="device_auth"?(e.openBlock(),e.createElementBlock("div",uo,[e.createElementVNode("p",null,e.toDisplayString(h.value),1),U.value?(e.openBlock(),e.createElementBlock("a",{key:0,href:U.value,target:"_blank",rel:"noopener",class:"proxy-oauth-link"},e.toDisplayString(U.value),9,po)):e.createCommentVNode("",!0),oe.value?(e.openBlock(),e.createElementBlock("p",mo,[t[27]||(t[27]=e.createTextVNode(" Code: ",-1)),e.createElementVNode("code",null,e.toDisplayString(oe.value),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",vo,[e.createElementVNode("label",ko,[t[28]||(t[28]=e.createTextVNode(" If the redirect to localhost fails, paste the callback URL: ",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[7]||(t[7]=s=>R.value=s),type:"url",placeholder:"http://localhost:8085/callback?code=..."},null,512),[[e.vModelText,R.value]])]),e.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:Ce}," Submit callback "),W.value?(e.openBlock(),e.createElementBlock("p",yo,e.toDisplayString(W.value),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),_.value==="success"?(e.openBlock(),e.createElementBlock("div",go,[t[29]||(t[29]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"20",height:"20"},[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"})],-1)),e.createElementVNode("strong",null,e.toDisplayString(h.value||"Registered successfully"),1)])):e.createCommentVNode("",!0),_.value==="skipped"?(e.openBlock(),e.createElementBlock("div",Eo,[e.createElementVNode("p",null,e.toDisplayString(h.value),1),e.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:ve},"Retry")])):e.createCommentVNode("",!0),_.value==="error"?(e.openBlock(),e.createElementBlock("div",_o,[e.createElementVNode("p",fo,[t[30]||(t[30]=e.createElementVNode("strong",null,"Error:",-1)),e.createTextVNode(" "+e.toDisplayString(h.value),1)]),e.createElementVNode("button",{class:"btn btn-outline btn-sm",onClick:ve},"Retry")])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",bo,[...t[33]||(t[33]=[e.createElementVNode("div",{class:"spinner-sm"},null,-1),e.createElementVNode("span",null,"Checking CLIProxyAPI status…",-1)])]))]),e.createElementVNode("div",ho,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:m},[t[34]||(t[34]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),e.createTextVNode(" "+e.toDisplayString(n("common.back")),1)]),e.createElementVNode("button",{class:"btn btn-primary",onClick:V},[e.createTextVNode(e.toDisplayString(_.value==="success"?n("accountWizard.continueBtn"):n("common.skip"))+" ",1),t[35]||(t[35]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"9 18 15 12 9 6"})],-1))])])])):e.createCommentVNode("",!0),i.value&&p.value==="plan"?(e.openBlock(),e.createElementBlock("div",No,[e.createElementVNode("div",Vo,[e.createElementVNode("div",Bo,[e.createElementVNode("div",Co,[e.createElementVNode("span",wo,e.toDisplayString(n("accountWizard.accountName")),1),e.createElementVNode("span",So,e.toDisplayString(v.value),1)]),B.value?(e.openBlock(),e.createElementBlock("div",xo,[e.createElementVNode("span",zo,e.toDisplayString(n("accountWizard.email")),1),e.createElementVNode("span",Do,e.toDisplayString(B.value),1)])):e.createCommentVNode("",!0),g.value?(e.openBlock(),e.createElementBlock("div",Wo,[e.createElementVNode("span",Io,e.toDisplayString(n("accountWizard.configPath")),1),e.createElementVNode("code",Po,e.toDisplayString(g.value),1)])):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("div",Ao,[e.createElementVNode("span",$o,e.toDisplayString(n("accountWizard.apiKeyEnv")),1),e.createElementVNode("code",Lo,e.toDisplayString(A.value),1)])):e.createCommentVNode("",!0)]),pe.value.length>0?(e.openBlock(),e.createElementBlock("div",To,[e.createElementVNode("label",Oo,e.toDisplayString(n("accountWizard.plan")),1),e.withDirectives(e.createElementVNode("select",{id:"wiz-plan","onUpdate:modelValue":t[8]||(t[8]=s=>Z.value=s)},[e.createElementVNode("option",Fo,e.toDisplayString(n("accountWizard.selectPlan")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(pe.value,s=>(e.openBlock(),e.createElementBlock("option",{key:s.id,value:s.id},e.toDisplayString(s.label),9,Ko))),128))],512),[[e.vModelSelect,Z.value]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Mo,[e.createElementVNode("label",null,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":t[9]||(t[9]=s=>ee.value=s)},null,512),[[e.vModelCheckbox,ee.value]]),e.createTextVNode(" "+e.toDisplayString(n("accountWizard.setDefault")),1)])]),te.value?(e.openBlock(),e.createElementBlock("div",Uo,e.toDisplayString(te.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ro,[e.createElementVNode("button",{class:"btn btn-secondary",onClick:m},[t[36]||(t[36]=e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[e.createElementVNode("polyline",{points:"15 18 9 12 15 6"})],-1)),e.createTextVNode(" "+e.toDisplayString(n("common.back")),1)]),e.createElementVNode("button",{class:"btn btn-primary",disabled:M.value,onClick:we},[M.value?(e.openBlock(),e.createElementBlock("div",qo)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(M.value?n("accountWizard.saving"):n("accountWizard.saveAccount")),1)],8,Ho)])])):e.createCommentVNode("",!0),i.value&&p.value==="done"?(e.openBlock(),e.createElementBlock("div",Go,[e.createElementVNode("div",Yo,[t[37]||(t[37]=e.createElementVNode("div",{class:"done-icon"},[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"40",height:"40"},[e.createElementVNode("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.createElementVNode("polyline",{points:"22 4 12 14.01 9 11.01"})])],-1)),e.createElementVNode("h4",null,e.toDisplayString(n("accountWizard.accountCreated")),1),e.createElementVNode("p",null,e.toDisplayString(v.value)+" has been added to "+e.toDisplayString(E.value)+".",1),e.createElementVNode("div",jo,[e.createElementVNode("button",{class:"btn btn-outline",onClick:Se},e.toDisplayString(n("accountWizard.addAnother")),1),e.createElementVNode("button",{class:"btn btn-primary",onClick:xe},e.toDisplayString(n("accountWizard.doneNextBackend")),1)])])])):e.createCommentVNode("",!0)]))}}),Jo=G(Xo,[["__scopeId","data-v-69b009aa"]]),Qo={class:"aia-onboarding"},Zo={class:"aia-onboarding__header"},en={key:0,class:"aia-onboarding__welcome"},tn={key:1,class:"aia-onboarding__status"},on={key:2,class:"aia-onboarding__kind-grid"},nn=["disabled","onClick"],an={class:"aia-kind-card__name"},ln={key:0,class:"aia-kind-card__badge"},sn={key:1,class:"aia-kind-card__badge aia-kind-card__badge--missing"},cn={key:3,class:"aia-onboarding__login"},rn={class:"aia-onboarding__tabs"},dn={class:"aia-label"},un={key:1,class:"aia-onboarding__oauth-start"},pn={key:4,class:"aia-onboarding__oauth-challenge"},mn=["href"],vn={class:"aia-code-display"},kn={key:5,class:"aia-onboarding__status"},yn={key:6,class:"aia-onboarding__success"},gn={key:7,class:"aia-onboarding__error"},En=e.defineComponent({__name:"OnboardingFlow",props:{client:{},kinds:{},supportedFlowsByKind:{}},emits:["done","cancel"],setup(r,{emit:N}){const n=r,f=N,a=O.useOnboarding({client:n.client}),c=e.ref(""),d=e.ref("api_key"),b=[{id:"claude",display:"Claude"},{id:"opencode",display:"OpenCode"},{id:"gemini",display:"Gemini"},{id:"codex",display:"Codex"}],u={claude:["api_key"],opencode:["api_key"],gemini:["api_key","oauth_device"],codex:["api_key","oauth_device"]},i=e.computed(()=>n.kinds??b),k=e.computed(()=>n.supportedFlowsByKind??u),E=e.computed(()=>{const m=a.selectedKind.value;return m?k.value[m]??["api_key"]:["api_key"]});async function p(){await a.start(),a.state.value!=="error"&&await a.detect()}async function S(m){await a.pickKind(m);const l=E.value;d.value=l[0]??"api_key"}async function F(){await a.submitApiKey(c.value)}async function I(){await a.submitOauthDevice()}e.watch(()=>a.state.value,m=>{m==="done"&&a.createdBackendId.value&&f("done",a.createdBackendId.value)},{immediate:!1});function P(){a.reset()}function ae(){var l;const m=(l=a.oauthChallenge.value)==null?void 0:l.user_code;m&&typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(m)}function V(m){var l,v;return(v=(l=a.kinds.value)==null?void 0:l.find(B=>B.id===m))==null?void 0:v.detection}return(m,l)=>{var v,B,Y;return e.openBlock(),e.createElementBlock("section",Qo,[e.createElementVNode("header",Zo,[e.renderSlot(m.$slots,"header",{},()=>[l[4]||(l[4]=e.createElementVNode("h2",null,"Set up an AI backend",-1))],!0)]),e.unref(a).state.value==="idle"?(e.openBlock(),e.createElementBlock("div",en,[l[5]||(l[5]=e.createElementVNode("p",null,"Connect one of the supported AI CLIs to get started.",-1)),e.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:p}," Get started ")])):e.unref(a).state.value==="started"||e.unref(a).state.value==="detecting"?(e.openBlock(),e.createElementBlock("div",tn," Detecting installed CLIs… ")):e.unref(a).state.value==="picking_kind"?(e.openBlock(),e.createElementBlock("div",on,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,y=>{var g,D,K,j;return e.openBlock(),e.createElementBlock("button",{key:y.id,type:"button",class:e.normalizeClass(["aia-kind-card",{"aia-kind-card--installed":(g=V(y.id))==null?void 0:g.installed,"aia-kind-card--missing":V(y.id)&&!((D=V(y.id))!=null&&D.installed)}]),disabled:!((K=V(y.id))!=null&&K.installed),onClick:A=>S(y.id)},[e.createElementVNode("span",an,e.toDisplayString(y.display),1),(j=V(y.id))!=null&&j.installed?(e.openBlock(),e.createElementBlock("span",ln," Installed ")):(e.openBlock(),e.createElementBlock("span",sn," Not installed "))],10,nn)}),128))])):e.unref(a).state.value==="entering_credential"?(e.openBlock(),e.createElementBlock("div",cn,[e.createElementVNode("div",rn,[E.value.includes("api_key")?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["aia-tab",{"aia-tab--active":d.value==="api_key"}]),onClick:l[0]||(l[0]=y=>d.value="api_key")}," API key ",2)):e.createCommentVNode("",!0),E.value.includes("oauth_device")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["aia-tab",{"aia-tab--active":d.value==="oauth_device"}]),onClick:l[1]||(l[1]=y=>d.value="oauth_device")}," Login with browser ",2)):e.createCommentVNode("",!0)]),d.value==="api_key"?(e.openBlock(),e.createElementBlock("form",{key:0,class:"aia-onboarding__form",onSubmit:e.withModifiers(F,["prevent"])},[e.createElementVNode("label",dn,[l[6]||(l[6]=e.createTextVNode(" API key ",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l[2]||(l[2]=y=>c.value=y),type:"password",class:"aia-input",autocomplete:"off",required:""},null,512),[[e.vModelText,c.value]])]),l[7]||(l[7]=e.createElementVNode("button",{type:"submit",class:"aia-btn aia-btn--primary"},"Connect",-1))],32)):d.value==="oauth_device"?(e.openBlock(),e.createElementBlock("div",un,[l[8]||(l[8]=e.createElementVNode("p",null,"You'll be shown a verification URL and code. Open it in your browser to sign in.",-1)),e.createElementVNode("button",{type:"button",class:"aia-btn aia-btn--primary",onClick:I}," Start browser login ")])):e.createCommentVNode("",!0)])):e.unref(a).state.value==="oauth_challenge"||e.unref(a).state.value==="oauth_polling"?(e.openBlock(),e.createElementBlock("div",pn,[l[9]||(l[9]=e.createElementVNode("p",null,"Open this URL in your browser and enter the code:",-1)),e.createElementVNode("a",{href:(v=e.unref(a).oauthChallenge.value)==null?void 0:v.verification_uri,target:"_blank",rel:"noopener noreferrer",class:"aia-onboarding__oauth-uri"},e.toDisplayString((B=e.unref(a).oauthChallenge.value)==null?void 0:B.verification_uri),9,mn),e.createElementVNode("div",vn,[e.createElementVNode("code",null,e.toDisplayString((Y=e.unref(a).oauthChallenge.value)==null?void 0:Y.user_code),1),e.createElementVNode("button",{type:"button",class:"aia-copy-btn",onClick:ae},"Copy")]),l[10]||(l[10]=e.createElementVNode("p",{class:"aia-onboarding__hint"},"Waiting for you to complete sign-in…",-1)),e.createElementVNode("button",{type:"button",class:"aia-btn",onClick:l[3]||(l[3]=(...y)=>e.unref(a).cancelOAuth&&e.unref(a).cancelOAuth(...y))},"Cancel")])):e.unref(a).state.value==="validating"?(e.openBlock(),e.createElementBlock("div",kn," Validating credential… ")):e.unref(a).state.value==="done"?(e.openBlock(),e.createElementBlock("div",yn,[e.renderSlot(m.$slots,"success",{},()=>[l[11]||(l[11]=e.createElementVNode("p",null,"✓ Connected successfully",-1))],!0)])):e.unref(a).state.value==="error"?(e.openBlock(),e.createElementBlock("div",gn,[e.createElementVNode("p",null,e.toDisplayString(e.unref(a).error.value),1),e.createElementVNode("button",{type:"button",class:"aia-btn",onClick:P},"Try again")])):e.createCommentVNode("",!0)])}}}),_n=G(En,[["__scopeId","data-v-8c20d7e7"]]),fn=["value","type","onInput"],bn={class:"aia-actions"},hn=["disabled"],Nn={key:0,class:"aia-error"},Vn=e.defineComponent({__name:"AccountEditForm",props:{account:{},metadata:{}},emits:["saved","cancel"],setup(r,{emit:N}){const n=r,f=N,{client:a}=O.useAiAccounts(),c=e.reactive({display_name:n.account.display_name,config:{...n.account.config}}),d=e.ref(!1),b=e.ref(null),u=e.computed(()=>{var k;return((k=n.metadata.config_schema)==null?void 0:k.properties)??{}});async function i(){d.value=!0,b.value=null;try{const k=await a.updateBackend(n.account.id,{display_name:c.display_name,config:c.config});f("saved",k)}catch(k){b.value=k instanceof Error?k.message:String(k)}finally{d.value=!1}}return(k,E)=>(e.openBlock(),e.createElementBlock("form",{class:"aia-account-edit",onSubmit:e.withModifiers(i,["prevent"])},[e.createElementVNode("label",null,[E[2]||(E[2]=e.createTextVNode(" Display name ",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":E[0]||(E[0]=p=>c.display_name=p),type:"text",required:""},null,512),[[e.vModelText,c.display_name]])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(p,S)=>(e.openBlock(),e.createElementBlock("div",{key:S,class:"aia-field"},[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(S)+" ",1),e.createElementVNode("input",{value:c.config[S]??"",type:String(S).toLowerCase().includes("secret")||String(S).toLowerCase().includes("key")?"password":"text",onInput:F=>c.config[S]=F.target.value},null,40,fn)])]))),128)),e.createElementVNode("div",bn,[e.createElementVNode("button",{type:"submit",disabled:d.value},e.toDisplayString(d.value?"Saving…":"Save"),9,hn),e.createElementVNode("button",{type:"button",onClick:E[1]||(E[1]=p=>f("cancel"))},"Cancel")]),b.value?(e.openBlock(),e.createElementBlock("p",Nn,e.toDisplayString(b.value),1)):e.createCommentVNode("",!0)],32))}}),Bn=G(Vn,[["__scopeId","data-v-56b7b8c3"]]),Cn="0.2.0";exports.AccountEditForm=Bn;exports.AccountWizard=Jo;exports.BackendPicker=ye;exports.LoginStream=ke;exports.OnboardingFlow=_n;exports.version=Cn;
|