midsomar 0.1.3 → 0.1.4
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/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c6 as et,bI as tt,bJ as rt,bc as nt,b6 as t,bL as S,aR as Te,bV as Ue,ch as je,cg as Ve,b_ as se,aL as ne,c2 as ot,bG as ke,au as e,N as be,aa as Q,u as he,aH as ve,bF as re,o as pe,B as ae,ba as xe,b as Ae,am as _e,by as ue,ck as Ie,j as it,f as lt,a2 as U,I as De,h as at,d as st,bQ as Ze,M as T,a5 as ie,ca as ct,c4 as dt,c9 as Le,bl as ut,aD as A,aI as vt,ax as pt,a3 as me,aq as ge,a8 as $e,bw as de,L as Ce,aQ as gt,aN as ze,bm as fe,ab as Se,a as Ee,bo as mt}from"./index-BfNxi3ev.js";var ft=S("<a>");function le(l){const B=et(),[h,u]=tt(l,["href","children","class"]);return(()=>{var s=ft();return s.$$click=$=>{h.href&&($.preventDefault(),B.openLink(h.href))},rt(s,nt({get href(){return h.href},get class(){return`text-text-strong underline ${h.class??""}`}},u),!1,!0),t(s,()=>h.children),s})()}Te(["click"]);const ht=/^[a-z0-9][a-z0-9-_]*$/,xt="@ai-sdk/openai-compatible";function bt(l){const B=l.form.providerID.trim(),h=l.form.name.trim(),u=l.form.baseURL.trim(),s=l.form.apiKey.trim(),$=s.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),n=s&&!$?s:void 0,j=B?ht.test(B)?void 0:l.t("provider.custom.error.providerID.format"):l.t("provider.custom.error.providerID.required"),c=h?void 0:l.t("provider.custom.error.name.required"),D=u?/^https?:\/\//.test(u)?void 0:l.t("provider.custom.error.baseURL.format"):l.t("provider.custom.error.baseURL.required"),M=l.disabledProviders.includes(B),E=j?void 0:l.existingProviderIDs.has(B)&&!M?l.t("provider.custom.error.providerID.exists"):void 0,C=new Set,K=l.form.models.map(m=>{const F=m.id.trim(),q=F?C.has(F)?l.t("provider.custom.error.duplicate"):(()=>{C.add(F)})():l.t("provider.custom.error.required"),P=m.name.trim()?void 0:l.t("provider.custom.error.required");return{id:q,name:P}}),R=K.every(m=>!m.id&&!m.name),X=Object.fromEntries(l.form.models.map(m=>[m.id.trim(),{name:m.name.trim()}])),w=new Set,i=l.form.headers.map(m=>{const F=m.key.trim(),q=m.value.trim();if(!F&&!q)return{};const P=F?w.has(F.toLowerCase())?l.t("provider.custom.error.duplicate"):(()=>{w.add(F.toLowerCase())})():l.t("provider.custom.error.required"),J=q?void 0:l.t("provider.custom.error.required");return{key:P,value:J}}),v=i.every(m=>!m.key&&!m.value),f=Object.fromEntries(l.form.headers.map(m=>({key:m.key.trim(),value:m.value.trim()})).filter(m=>!!m.key&&!!m.value).map(m=>[m.key,m.value])),V={providerID:j??E,name:c,baseURL:D};return!j&&!E&&!c&&!D&&R&&v?{err:V,models:K,headers:i,result:{providerID:B,name:h,key:n,config:{npm:xt,name:h,...$?{env:[$]}:{},options:{baseURL:u,...Object.keys(f).length?{headers:f}:{}},models:X}}}:{err:V,models:K,headers:i}}let yt=0;const He=()=>`row-${yt++}`,Ke=()=>({row:He(),id:"",name:"",err:{}}),Re=()=>({row:He(),key:"",value:"",err:{}});var _t=S('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-6"><p class="text-14-regular text-text-base"></p><div class="flex flex-col gap-4"></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak"></label></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak">'),qe=S('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function Wt(l){const B=se();return e(Ae,{class:"h-full",get title(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",get onClick(){return l.onBack},get"aria-label"(){return B.t("common.goBack")}})},transition:!0,get children(){return e(Ge,{})}})}function Ge(l={}){const B=Ue(),h=je(),u=Ve(),s=se(),[$,n]=ne({providerID:"",name:"",baseURL:"",apiKey:"",models:[Ke()],headers:[Re()],err:{}}),j=()=>{n("models",ue(i=>{i.push(Ke())}))},c=i=>{$.models.length<=1||n("models",ue(v=>{v.splice(i,1)}))},D=()=>{n("headers",ue(i=>{i.push(Re())}))},M=i=>{$.headers.length<=1||n("headers",ue(v=>{v.splice(i,1)}))},E=(i,v)=>{n(i,v),i!=="apiKey"&&n("err",i,void 0)},C=(i,v,f)=>{_e(()=>{n("models",i,v,f),n("models",i,"err",v,void 0)})},K=(i,v,f)=>{_e(()=>{n("headers",i,v,f),n("headers",i,"err",v,void 0)})},R=()=>{const i=bt({form:$,t:s.t,disabledProviders:h().data.config.disabled_providers??[],existingProviderIDs:new Set(h().data.provider.all.keys())});return _e(()=>{n("err",i.err),i.models.forEach((v,f)=>n("models",f,"err",v)),i.headers.forEach((v,f)=>n("headers",f,"err",v))}),i.result},X=ot(()=>({mutationFn:async i=>{if(await u().protocol!=="v1")throw new Error("Custom providers are unavailable on this server");const f=(h().data.config.disabled_providers??[]).filter(V=>V!==i.providerID);return i.key&&await u().client.auth.set({providerID:i.providerID,auth:{type:"api",key:i.key}}),await h().updateConfig({provider:{[i.providerID]:i.config},disabled_providers:f}),i},onSuccess:i=>{B.close(),ke({variant:"success",icon:"circle-check",title:s.t("provider.connect.toast.connected.title",{provider:i.name}),description:s.t("provider.connect.toast.connected.description",{provider:i.name})})},onError:i=>{const v=i instanceof Error?i.message:String(i);ke({title:s.t("common.requestFailed"),description:v})}})),w=i=>{if(i.preventDefault(),X.isPending)return;const v=R();v&&X.mutate(v)};return(()=>{var i=_t(),v=i.firstChild,f=v.firstChild,V=v.nextSibling,I=V.firstChild,m=I.nextSibling,F=m.nextSibling,q=F.firstChild,P=F.nextSibling,J=P.firstChild;return t(v,e(be,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),f),t(f,()=>s.t("provider.custom.title")),V.addEventListener("submit",w),t(I,()=>s.t("provider.custom.description.prefix"),null),t(I,e(le,{href:"https://opencode.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return s.t("provider.custom.description.link")}}),null),t(I,()=>s.t("provider.custom.description.suffix"),null),t(m,e(Q,{get autofocus(){return l.autofocus??!0},get label(){return s.t("provider.custom.field.providerID.label")},get placeholder(){return s.t("provider.custom.field.providerID.placeholder")},get description(){return s.t("provider.custom.field.providerID.description")},get value(){return $.providerID},onChange:p=>E("providerID",p),get validationState(){return $.err.providerID?"invalid":void 0},get error(){return $.err.providerID}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.name.label")},get placeholder(){return s.t("provider.custom.field.name.placeholder")},get value(){return $.name},onChange:p=>E("name",p),get validationState(){return $.err.name?"invalid":void 0},get error(){return $.err.name}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.baseURL.label")},get placeholder(){return s.t("provider.custom.field.baseURL.placeholder")},get value(){return $.baseURL},onChange:p=>E("baseURL",p),get validationState(){return $.err.baseURL?"invalid":void 0},get error(){return $.err.baseURL}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.apiKey.label")},get placeholder(){return s.t("provider.custom.field.apiKey.placeholder")},get description(){return s.t("provider.custom.field.apiKey.description")},get value(){return $.apiKey},onChange:p=>E("apiKey",p)}),null),t(q,()=>s.t("provider.custom.models.label")),t(F,e(pe,{get each(){return $.models},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.id.placeholder")},get value(){return p.id},onChange:te=>C(G(),"id",te),get validationState(){return p.err.id?"invalid":void 0},get error(){return p.err.id}})),t(Y,e(Q,{get label(){return s.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.name.placeholder")},get value(){return p.name},onChange:te=>C(G(),"name",te),get validationState(){return p.err.name?"invalid":void 0},get error(){return p.err.name}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>c(G()),get disabled(){return $.models.length<=1},get"aria-label"(){return s.t("provider.custom.models.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(F,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:j,class:"self-start",get children(){return s.t("provider.custom.models.add")}}),null),t(J,()=>s.t("provider.custom.headers.label")),t(P,e(pe,{get each(){return $.headers},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.key.placeholder")},get value(){return p.key},onChange:te=>K(G(),"key",te),get validationState(){return p.err.key?"invalid":void 0},get error(){return p.err.key}})),t(Y,e(Q,{get label(){return s.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.value.placeholder")},get value(){return p.value},onChange:te=>K(G(),"value",te),get validationState(){return p.err.value?"invalid":void 0},get error(){return p.err.value}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>M(G()),get disabled(){return $.headers.length<=1},get"aria-label"(){return s.t("provider.custom.headers.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(P,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:D,class:"self-start",get children(){return s.t("provider.custom.headers.add")}}),null),t(V,e(ae,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return X.isPending},get children(){return xe(()=>!!X.isPending)()?s.t("common.saving"):s.t("common.submit")}}),null),i})()}var $t=S('<button type=button class="flex size-5 items-center justify-center rounded-sm text-v2-icon-icon-muted hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none">'),wt=S('<div tabindex=-1 class="flex min-h-0 flex-1 flex-col outline-none">'),Be=S('<div class="text-14-regular text-text-weak">'),kt=S('<div class="px-1.25 w-full flex items-center gap-x-3"><span>'),Ct=S('<div class="flex h-24 items-center justify-center text-[13px] font-[440] text-v2-text-text-muted">'),St=S('<div class="flex min-h-0 flex-1 flex-col gap-4"><div class="shrink-0 px-1 pt-px"></div><div class="relative min-h-0 flex-1"><div class="flex size-full min-h-0 flex-col gap-4 overflow-y-auto pb-8 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"></div><div class="pointer-events-none absolute inset-x-0 bottom-0 h-10"style="background:linear-gradient(to bottom, transparent, var(--v2-background-bg-layer-01))">'),It=S('<section class="flex flex-col"><div class="px-3 pb-2 text-[13px] font-[440] leading-none tracking-[-0.04px] text-v2-text-text-muted">'),Dt=S('<span class="min-w-0 truncate font-[440] text-v2-text-text-muted">'),Me=S('<span class="flex h-4 shrink-0 items-center rounded-xs border-[0.5px] border-v2-border-border-base bg-v2-background-bg-layer-03 px-1 text-[11px] font-[530] leading-none tracking-[0.05px] text-v2-text-text-muted">'),Lt=S('<button type=button class="flex min-h-9 w-full items-center gap-2 rounded-md px-3 py-2.5 text-left text-[13px] leading-none tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus:bg-v2-overlay-simple-overlay-hover focus:outline-none"><span class="min-w-0 truncate font-[530] text-v2-text-text-base">'),Pt=S('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),zt=S('<form class="flex flex-col items-start gap-4">'),Et=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span></span><span class="text-14-regular text-text-weak">'),Kt=S('<div class="flex flex-col gap-2"><div class="px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"></div><div class="flex flex-col">'),Rt=S('<button type=button class="group flex h-9 w-full items-center gap-2 rounded-md px-3 text-left text-[13px] leading-5 tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none"><span class="flex h-2 w-4 shrink-0 items-center justify-center rounded-[1px] bg-v2-background-bg-base shadow-[var(--v2-elevation-button-neutral)]"><span class="hidden h-0.5 w-2.5 bg-v2-icon-icon-base group-hover:block group-focus-visible:block"></span></span><span class="font-[530] text-v2-text-text-base">'),qt=S('<span class="font-[440] text-v2-text-text-muted">'),Fe=S('<div class="text-14-regular text-text-base">'),Bt=S("<div>"),Mt=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span>'),Ft=S('<div class="flex flex-col gap-5"><div></div><div></div><div>'),Ot=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Oe=S('<div role=alert class="-mt-4 text-xs text-v2-state-fg-danger">'),Tt=S('<div class="flex flex-col gap-4"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base">'),Ut=S('<div class="flex flex-col gap-6"><form class="flex flex-col items-start gap-4">'),jt=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><div></div><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Vt=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><form class="flex flex-col items-start gap-4">'),At=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base flex items-center gap-4"><span>'),we=S('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Zt=S("<div><div><div></div></div><div><div>");const ee="_custom";function Ne(l={}){const[B,h]=ne({selected:void 0}),u=()=>h("selected",void 0);return{selected:()=>B.selected,select:s=>h("selected",s),back:l.onBack??u}}const Ht=l=>{const B=Ne(),h=l.controller??B,u=se(),$=Ie().general.newLayoutDesigns,n=h.back,j={current:n};let c;const D=()=>c?.focus({preventScroll:!0}),M=C=>{j.current=n,h.select(C)};function E(){return e(ie,{get children(){return[e(T,{get when(){return h.selected()===ee},get children(){return e(Ge,{get autofocus(){return!$()}})}}),e(T,{get when(){return xe(()=>!!(h.selected()&&h.selected()!==ee))()?h.selected():void 0},children:C=>e(Qt,{get provider(){return C()},get directory(){return l.directory},onBack:n,setBack:K=>j.current=K})}),e(T,{when:!0,get children(){return e(Gt,{get directory(){return l.directory},onSelect:M,get onPrepare(){return $()?D:void 0}})}})]}})}return e(U,{get when(){return $()},get fallback(){return e(Ae,{class:"h-full",transition:!0,get title(){return e(U,{get when(){return h.selected()},get fallback(){return u.t("command.provider.connect")},get children(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:()=>j.current(),get"aria-label"(){return u.t("common.goBack")}})}})},get children(){return e(E,{})}})},get children(){return e(it,{containerClass:"!h-[min(calc(100vh_-_16px),512px)] !w-[min(calc(100vw_-_16px),640px)]",class:"[font-family:var(--v2-font-family-sans)] [&_[data-slot=dialog-header]]:!px-5 [&_[data-slot=dialog-header-title]]:!text-[15px] [&_[data-slot=dialog-header-title]]:!tracking-[-0.13px]",get children(){return[e(lt,{get closeLabel(){return u.t("common.close")},get children(){return e(U,{get when(){return h.selected()},get fallback(){return e(at,{get children(){return u.t("command.provider.connect")}})},get children(){var C=$t();return C.$$click=()=>j.current(),t(C,e(De,{name:"arrow-left",size:"small"})),ve(()=>re(C,"aria-label",u.t("common.goBack"))),C}})}}),e(st,{class:"min-h-0 flex-1 overflow-hidden px-2 pb-2",get children(){var C=wt(),K=c;return typeof K=="function"?Ze(K,C):c=C,t(C,e(E,{})),C}})]}})}})};function Gt(l){if(Ie().general.newLayoutDesigns())return e(Nt,{get directory(){return l.directory},get onSelect(){return l.onSelect},get onPrepare(){return l.onPrepare}});const h=Le(()=>l.directory?.()),u=se(),s=()=>u.t("dialog.provider.group.popular"),$=()=>u.t("dialog.provider.group.other"),n=()=>u.t("settings.providers.tag.custom"),j=c=>{if(c==="anthropic")return u.t("dialog.provider.anthropic.note");if(c==="openai")return u.t("dialog.provider.openai.note");if(c.startsWith("github-copilot"))return u.t("dialog.provider.copilot.note");if(c==="opencode-go")return u.t("dialog.provider.opencodeGo.tagline")};return e(Ce,{class:"px-3",get search(){return{placeholder:u.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.provider.empty")},activeIcon:"plus-small",key:c=>c?.id,items:()=>(u.locale(),[{id:ee,name:n()},...h.all().values()]),filterKeys:["id","name"],groupBy:c=>de.includes(c.id)?s():$(),sortBy:(c,D)=>c.id===ee?-1:D.id===ee?1:de.includes(c.id)&&de.includes(D.id)?de.indexOf(c.id)-de.indexOf(D.id):c.name.localeCompare(D.name),sortGroupsBy:(c,D)=>{const M=s();return c.category===M&&D.category!==M?-1:D.category===M&&c.category!==M?1:0},onSelect:c=>{c&&l.onSelect(c.id)},children:c=>(()=>{var D=kt(),M=D.firstChild;return t(D,e(be,{"data-slot":"list-item-extra-icon",get id(){return c.id}}),M),t(M,()=>c.name),t(D,e(U,{get when(){return c.id==="opencode"},get children(){var E=Be();return t(E,()=>u.t("dialog.provider.opencode.tagline")),E}}),null),t(D,e(U,{get when(){return c.id===ee},get children(){return e($e,{get children(){return u.t("settings.providers.tag.custom")}})}}),null),t(D,e(U,{get when(){return c.id==="opencode"},get children(){return e($e,{get children(){return u.t("dialog.provider.tag.recommended")}})}}),null),t(D,e(U,{get when(){return j(c.id)},children:E=>(()=>{var C=Be();return t(C,E),C})()}),null),t(D,e(U,{get when(){return c.id==="opencode-go"},get children(){return e($e,{get children(){return u.t("dialog.provider.tag.recommended")}})}}),null),D})()})}function Nt(l){const B=Le(()=>l.directory?.()),h=se(),[u,s]=ne({filter:"",active:void 0,connecting:void 0}),$=["opencode","opencode-go","anthropic","openai","google","openrouter","vercel"],n=()=>({id:ee,name:h.t("dialog.provider.custom.label")}),j=A(()=>{h.locale();const w=u.filter.trim().toLowerCase(),i=[n(),...B.all().values()];return w?i.filter(v=>`${v.id} ${v.name}`.toLowerCase().includes(w)):i}),c=A(()=>j().filter(w=>$.includes(w.id)).sort((w,i)=>$.indexOf(w.id)-$.indexOf(i.id))),D=A(()=>j().filter(w=>!$.includes(w.id)).sort((w,i)=>w.id===ee?-1:i.id===ee?1:w.name.localeCompare(i.name))),M=A(()=>[...c(),...D()]);let E,C;fe(()=>C?.focus({preventScroll:!0}));const K=w=>{l.onPrepare?.(),l.onSelect(w)},R=(w,i)=>{const v=M();if(v.length===0)return;const f=v.findIndex(I=>I.id===u.active),V=f<0?i>0?0:v.length-1:(f+i+v.length)%v.length;s("active",v[V].id),E?.querySelector(`[data-provider-id="${CSS.escape(v[V].id)}"]`)?.focus({preventScroll:!0}),w.preventDefault()},X=w=>{if(w.key==="ArrowDown")return R(w,1);if(w.key==="ArrowUp")return R(w,-1);w.key!=="Enter"||!u.active||(K(u.active),w.preventDefault())};return(()=>{var w=St(),i=w.firstChild,v=i.nextSibling,f=v.firstChild;f.nextSibling,w.$$keydown=X;var V=E;return typeof V=="function"?Ze(V,w):E=w,t(i,e(Se,{ref(I){var m=C;typeof m=="function"?m(I):C=I},type:"search",class:"!w-full [font-family:var(--v2-font-family-sans)]",get leadingIcon(){return e(De,{name:"magnifying-glass",size:"small"})},get placeholder(){return h.t("dialog.provider.search.placeholder")},get value(){return u.filter},onInput:I=>{s({filter:I.currentTarget.value,active:void 0})}})),t(f,e(pe,{get each(){return[{title:h.t("dialog.provider.group.popular"),items:c},{title:h.t("dialog.provider.group.other"),items:D}]},children:I=>e(U,{get when(){return I.items().length>0},get children(){var m=It(),F=m.firstChild;return t(F,()=>I.title),t(m,e(pe,{get each(){return I.items()},children:q=>(()=>{var P=Lt(),J=P.firstChild;return P.$$click=()=>K(q.id),P.addEventListener("mouseenter",()=>s("active",q.id)),t(P,e(be,{get id(){return q.id},class:"size-4 shrink-0 text-v2-icon-icon-base"}),J),t(J,()=>q.name),t(P,e(U,{get when(){return q.id==="opencode"||q.id==="opencode-go"},get children(){return[(()=>{var p=Dt();return t(p,()=>h.t(q.id==="opencode"?"dialog.provider.opencode.tagline":"dialog.provider.opencodeGo.tagline")),p})(),(()=>{var p=Me();return t(p,()=>h.t("dialog.provider.tag.recommended")),p})()]}}),null),t(P,e(U,{get when(){return q.id===ee},get children(){var p=Me();return t(p,()=>h.t("settings.providers.tag.custom")),p}}),null),t(P,e(U,{get when(){return u.connecting===q.id},get children(){return e(me,{class:"ml-auto size-4 shrink-0 text-v2-icon-icon-muted"})}}),null),ve(p=>{var G=q.id,Z=u.active===q.id,W=u.connecting!==void 0,Y=u.connecting===q.id;return G!==p.e&&re(P,"data-provider-id",p.e=G),Z!==p.t&&P.classList.toggle("bg-v2-overlay-simple-overlay-hover",p.t=Z),W!==p.a&&(P.disabled=p.a=W),Y!==p.o&&re(P,"aria-busy",p.o=Y),p},{e:void 0,t:void 0,a:void 0,o:void 0}),P})()}),null),m}})}),null),t(f,e(U,{get when(){return M().length===0},get children(){var I=Ct();return t(I,()=>h.t("dialog.provider.empty")),I}}),null),w})()}function Qt(l){const B=Ue(),h=je(),u=Ve(),s=ct(),$=dt(),n=se(),c=Ie().general.newLayoutDesigns,D=Le(()=>l.directory?.()),M=()=>l.directory?.()??gt($.dir),E=()=>{const r=M();return r?{directory:r}:void 0},C={value:!0},K={current:void 0};ut(()=>{C.value=!1,K.current!==void 0&&(clearTimeout(K.current),K.current=void 0)});const R=A(()=>D.all().get(l.provider)??h().data.provider.all.get(l.provider)),X=A(()=>[{type:"key",label:n.t("provider.connect.method.apiKey")}]),[w]=vt(()=>({provider:l.provider,directory:M()}),r=>u().api.integration.get({integrationID:r.provider,location:r.directory?{directory:r.directory}:void 0}).then(o=>o.data)),i=A(()=>w.loading),v=A(()=>{const r=w.latest?.methods.filter(o=>o.type==="key"||o.type==="oauth");return r?.length?r:X()}),[f,V]=ne({methodIndex:void 0,authorization:void 0,promptInputs:void 0,state:"pending",error:void 0});function I(r){V(ue(o=>{if(r.type==="method.select"){o.methodIndex=r.index,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="method.reset"){o.methodIndex=void 0,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="auth.prompt"){o.state="prompt",o.error=void 0;return}if(r.type==="auth.inputs"){o.promptInputs=r.inputs,o.state=void 0,o.error=void 0;return}if(r.type==="auth.pending"){o.state="pending",o.error=void 0;return}if(r.type==="auth.complete"){o.state="complete",o.authorization=r.authorization,o.error=void 0;return}o.state="error",o.error=r.error}))}const m=A(()=>f.methodIndex!==void 0?v().at(f.methodIndex):void 0),F=r=>r?r.type==="key"?n.t("provider.connect.method.apiKey"):r.label??"":"",q=r=>{const o=F(r),a=r?.label?.match(/\s+\((browser|headless)\)$/i),y=a?.[1];return{label:a?o.slice(0,-a[0].length):o,hint:y?y[0].toUpperCase()+y.slice(1):r?.type==="key"?"Browser":void 0}};function P(r,o){if(r&&typeof r=="object"&&"data"in r){const a=r.data;if(typeof a?.message=="string"&&a.message)return a.message}if(r&&typeof r=="object"&&"error"in r){const a=P(r.error,"");if(a)return a}if(r&&typeof r=="object"&&"message"in r){const a=r.message;if(typeof a=="string"&&a)return a}return r instanceof Error&&r.message?r.message:typeof r=="string"&&r?r:o}async function J(r,o){K.current!==void 0&&(clearTimeout(K.current),K.current=void 0);const a=v()[r];if(I({type:"method.select",index:r}),a.type==="oauth"){if(a.prompts?.length&&!o){I({type:"auth.prompt"});return}I({type:"auth.pending"}),await u().api.integration.oauth.connect({integrationID:l.provider,methodID:a.id,inputs:o??{},location:E()}).then(y=>{C.value&&I({type:"auth.complete",authorization:y.data})}).catch(y=>{C.value&&I({type:"auth.error",error:P(y,n.t("common.requestFailed"))})})}}function p(){const[r,o]=ne({value:{},index:0}),a=A(()=>{const _=m();return _?.type==="oauth"?_.prompts??[]:[]}),y=(_,O)=>{if(!_.when)return!0;const H=O[_.when.key];return H===void 0?!1:_.when.op==="eq"?H===_.when.value:H!==_.when.value},z=A(()=>{const _=a(),O=_.findIndex((H,ce)=>ce>=r.index&&y(H,r.value));if(O!==-1)return{index:O,prompt:_[O]}}),d=A(()=>{const _=z();return!_||_.prompt.type!=="text"?!1:(r.value[_.prompt.key]??"").trim().length>0});async function g(_,O){if(f.methodIndex===void 0)return;const H=a().findIndex((ce,N)=>N>_&&y(ce,O));if(H!==-1){o("index",H);return}await J(f.methodIndex,O)}async function x(_){_.preventDefault();const O=z();!O||O.prompt.type!=="text"||d()&&await g(O.index,r.value)}const b=()=>z(),k=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="text"))return _}),L=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="select"))return _});return(()=>{var _=zt();return _.addEventListener("submit",x),t(_,e(ie,{get children(){return[e(T,{get when(){return b()?.prompt.type==="text"},get children(){return[e(Q,{type:"text",get label(){return k()?.message??""},get placeholder(){return k()?.placeholder},get value(){return xe(()=>!!k())()?r.value[k().key]??"":""},onChange:O=>{const H=k();H&&o("value",H.key,O)}}),e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!d()},get children(){return n.t("common.continue")}})]}}),e(T,{get when(){return b()?.prompt.type==="select"},get children(){var O=Pt(),H=O.firstChild,ce=H.nextSibling;return t(H,()=>L()?.message),t(ce,e(Ce,{class:"px-3",get items(){return L()?.options??[]},key:N=>N.value,get current(){return L()?.options.find(N=>N.value===r.value[L().key])},onSelect:N=>{if(!N)return;const oe=L();if(!oe)return;const ye={...r.value,[oe.key]:N.value};o("value",oe.key,N.value),g(b().index,ye)},children:N=>(()=>{var oe=Et(),ye=oe.firstChild,Pe=ye.nextSibling,Ye=Pe.nextSibling;return t(Pe,()=>N.label),t(Ye,()=>N.hint),oe})()})),O}})]}})),_})()}let G;function Z(r){r.key==="Enter"&&r.target instanceof HTMLInputElement||r.key!=="Escape"&&G?.onKeyDown(r)}let W=!1;pt(()=>{W||i()||v().length===1&&(W=!0,J(0))});async function Y(){const r=M();await s.refetchQueries(h().queryOptions.providers(r?mt(r):null)).catch(()=>{}),B.close(),ke({variant:"success",icon:"circle-check",title:n.t("provider.connect.toast.connected.title",{provider:R().name}),description:n.t("provider.connect.toast.connected.description",{provider:R().name})})}function te(){if(v().length>1&&f.methodIndex!==void 0){I({type:"method.reset"});return}l.onBack()}l.setBack(te);function Qe(){return c()?(()=>{var r=Kt(),o=r.firstChild,a=o.nextSibling;return t(o,()=>n.t("provider.connect.selectMethod",{provider:R().name})),t(a,e(pe,{get each(){return v()},children:(y,z)=>{const d=()=>q(y);return(()=>{var g=Rt(),x=g.firstChild,b=x.nextSibling;return g.$$click=()=>void J(z()),t(b,()=>d().label),t(g,e(U,{get when(){return d().hint},children:k=>(()=>{var L=qt();return t(L,k),L})()}),null),g})()}})),r})():[(()=>{var r=Fe();return t(r,()=>n.t("provider.connect.selectMethod",{provider:R().name})),r})(),(()=>{var r=Bt();return t(r,e(Ce,{class:"px-3",ref:o=>{G=o},items:v,key:o=>o?.label??o?.type,onSelect:async(o,a)=>{o&&J(a)},children:o=>(()=>{var a=Mt(),y=a.firstChild,z=y.nextSibling;return t(z,()=>F(o)),a})()})),r})()]}function Je(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("apiKey");if(!b?.trim()){y("error",n.t("provider.connect.apiKey.required"));return}y("error",void 0),await u().api.integration.connect.key({integrationID:l.provider,location:E(),key:b}),await Y()}return c()?(()=>{var d=Ot(),g=d.firstChild,x=g.firstChild;return t(d,e(U,{get when(){return R().id==="opencode"},get fallback(){return n.t("provider.connect.apiKey.description",{provider:R().name})},get children(){var b=Ft(),k=b.firstChild,L=k.nextSibling,_=L.nextSibling;return t(k,()=>n.t("provider.connect.opencodeZen.line1")),t(L,()=>n.t("provider.connect.opencodeZen.line2")),t(_,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(_,e(le,{href:"https://",class:"text-v2-text-text-base focus-visible:rounded-xs focus-visible:outline-2 focus-visible:outline-v2-border-border-focus",get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(_,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),b}}),g),g.addEventListener("submit",z),t(x,()=>n.t("provider.connect.apiKey.label",{provider:R().name}),null),t(x,e(Se,{ref(b){var k=r;typeof k=="function"?k(b):r=b},class:"!w-full",name:"apiKey","data-input":"provider-api-key",get placeholder(){return n.t("provider.connect.apiKey.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:b=>y("value",b.currentTarget.value)}),null),t(g,e(U,{get when(){return a.error},children:b=>(()=>{var k=Oe();return re(k,"id",o),t(k,b),k})()}),null),t(g,e(Ee,{type:"submit",variant:"contrast","data-action":"provider-connect-submit",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Ut(),g=d.firstChild;return t(d,e(ie,{get children(){return[e(T,{get when(){return R().id==="opencode"},get children(){var x=Tt(),b=x.firstChild,k=b.nextSibling,L=k.nextSibling;return t(b,()=>n.t("provider.connect.opencodeZen.line1")),t(k,()=>n.t("provider.connect.opencodeZen.line2")),t(L,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(L,e(le,{href:"https://",tabIndex:-1,get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(L,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),x}}),e(T,{when:!0,get children(){var x=Fe();return t(x,()=>n.t("provider.connect.apiKey.description",{provider:R().name})),x}})]}}),g),g.addEventListener("submit",z),t(g,e(Q,{get autofocus(){return!c()},ref(x){var b=r;typeof b=="function"?b(x):r=x},type:"text",get label(){return n.t("provider.connect.apiKey.label",{provider:R().name})},get placeholder(){return n.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return a.value},onChange:x=>y("value",x),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(g,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function We(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("code");if(!b?.trim()){y("error",n.t("provider.connect.oauth.code.required"));return}y("error",void 0);const k=await u().api.integration.oauth.complete({integrationID:l.provider,attemptID:f.authorization.attemptID,location:E(),code:b}).then(()=>({ok:!0})).catch(L=>({ok:!1,error:L}));if(k.ok){await Y();return}y("error",P(k.error,n.t("provider.connect.oauth.code.invalid")))}return c()?(()=>{var d=jt(),g=d.firstChild,x=g.nextSibling,b=x.firstChild;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},class:"text-v2-text-text-base",get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(b,()=>n.t("provider.connect.oauth.code.label",{method:m()?.label??""}),null),t(b,e(Se,{ref(k){var L=r;typeof L=="function"?L(k):r=k},class:"!w-full",name:"code",get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:k=>y("value",k.currentTarget.value)}),null),t(x,e(U,{get when(){return a.error},children:k=>(()=>{var L=Oe();return re(L,"id",o),t(L,k),L})()}),null),t(x,e(Ee,{type:"submit",variant:"contrast",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Vt(),g=d.firstChild,x=g.nextSibling;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(x,e(Q,{get autofocus(){return!c()},ref(b){var k=r;typeof k=="function"?k(b):r=b},type:"text",get label(){return n.t("provider.connect.oauth.code.label",{method:m()?.label??""})},get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return a.value},onChange:b=>y("value",b),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(x,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function Xe(){const r=A(()=>{const o=f.authorization?.instructions;return o?.includes(":")?o.split(":").pop()?.trim():o});return fe(()=>{const o=async()=>{const a=f.authorization;if(!a||!C.value)return;const y=await u().api.integration.oauth.status({integrationID:l.provider,attemptID:a.attemptID,location:E()}).then(z=>({ok:!0,status:z.data})).catch(z=>({ok:!1,error:z}));if(C.value){if(!y.ok){I({type:"auth.error",error:P(y.error,n.t("common.requestFailed"))});return}if(y.status.status==="complete"){await Y();return}if(y.status.status==="failed"){I({type:"auth.error",error:y.status.message});return}if(y.status.status==="expired"){I({type:"auth.error",error:n.t("common.requestFailed")});return}K.current=setTimeout(o,1e3)}};o()}),(()=>{var o=At(),a=o.firstChild,y=a.nextSibling,z=y.firstChild;return t(a,()=>n.t("provider.connect.oauth.auto.visit.prefix"),null),t(a,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.auto.visit.link")}}),null),t(a,()=>n.t("provider.connect.oauth.auto.visit.suffix",{provider:R().name}),null),t(o,e(Q,{get label(){return n.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return r()},readOnly:!0,copyable:!0}),y),t(y,e(me,{}),z),t(z,()=>n.t("provider.connect.status.waiting")),o})()}return(()=>{var r=Zt(),o=r.firstChild,a=o.firstChild,y=o.nextSibling,z=y.firstChild;return t(o,e(be,{get id(){return l.provider},get class(){return c()?"mt-0.5 size-4 shrink-0 text-v2-icon-icon-base":"size-5 shrink-0 icon-strong-base"}}),a),t(a,e(ie,{get children(){return[e(T,{get when(){return xe(()=>l.provider==="anthropic")()&&m()?.label?.toLowerCase().includes("max")},get children(){return n.t("provider.connect.title.anthropicProMax")}}),e(T,{when:!0,get children(){return n.t("provider.connect.title",{provider:R().name})}})]}})),z.$$keydown=Z,t(z,e(ie,{get children(){return[e(T,{get when(){return i()},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.methodIndex===void 0},get children(){return e(Qe,{})}}),e(T,{get when(){return f.state==="pending"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.state==="prompt"},get children(){return e(p,{})}}),e(T,{get when(){return f.state==="error"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(De,{name:"circle-ban-sign",class:"text-icon-critical-base"}),x),t(x,()=>n.t("provider.connect.status.failed",{error:f.error??""})),d}}),e(T,{get when(){return m()?.type==="key"},get children(){return e(Je,{})}}),e(T,{get when(){return m()?.type==="oauth"},get children(){return e(ie,{get children(){return[e(T,{get when(){return f.authorization?.mode==="code"},get children(){return e(We,{})}}),e(T,{get when(){return f.authorization?.mode==="auto"},get children(){return e(Xe,{})}})]}})}})]}})),ve(d=>{var g=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-3",x=c()?"flex h-10 shrink-0 items-start gap-2 px-3":"flex items-center gap-4 px-2.5",b=c()?"text-[15px] font-[530] leading-5 tracking-[-0.13px] text-v2-text-text-base":"text-16-medium text-text-strong",k=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-10",L=c()?void 0:0,_=!c()&&f.methodIndex===void 0?!0:void 0;return g!==d.e&&ge(r,d.e=g),x!==d.t&&ge(o,d.t=x),b!==d.a&&ge(a,d.a=b),k!==d.o&&ge(y,d.o=k),L!==d.i&&re(z,"tabindex",d.i=L),_!==d.n&&(z.autofocus=d.n=_),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),r})()}Te(["click","keydown"]);const Xt=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Ht,useProviderConnectController:Ne},Symbol.toStringTag,{value:"Module"}));export{Ht as D,le as L,Wt as a,Xt as d,Ne as u};
|
|
1
|
+
import{c6 as et,bI as tt,bJ as rt,bc as nt,b6 as t,bL as S,aR as Te,bV as Ue,ch as je,cg as Ve,b_ as se,aL as ne,c2 as ot,bG as ke,au as e,N as be,aa as Q,u as he,aH as ve,bF as re,o as pe,B as ae,ba as xe,b as Ae,am as _e,by as ue,ck as Ie,j as it,f as lt,a2 as U,I as De,h as at,d as st,bQ as Ze,M as T,a5 as ie,ca as ct,c4 as dt,c9 as Le,bl as ut,aD as A,aI as vt,ax as pt,a3 as me,aq as ge,a8 as $e,bw as de,L as Ce,aQ as gt,aN as ze,bm as fe,ab as Se,a as Ee,bo as mt}from"./index-BfNxi3ev.js";var ft=S("<a>");function le(l){const B=et(),[h,u]=tt(l,["href","children","class"]);return(()=>{var s=ft();return s.$$click=$=>{h.href&&($.preventDefault(),B.openLink(h.href))},rt(s,nt({get href(){return h.href},get class(){return`text-text-strong underline ${h.class??""}`}},u),!1,!0),t(s,()=>h.children),s})()}Te(["click"]);const ht=/^[a-z0-9][a-z0-9-_]*$/,xt="@ai-sdk/openai-compatible";function bt(l){const B=l.form.providerID.trim(),h=l.form.name.trim(),u=l.form.baseURL.trim(),s=l.form.apiKey.trim(),$=s.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),n=s&&!$?s:void 0,j=B?ht.test(B)?void 0:l.t("provider.custom.error.providerID.format"):l.t("provider.custom.error.providerID.required"),c=h?void 0:l.t("provider.custom.error.name.required"),D=u?/^https?:\/\//.test(u)?void 0:l.t("provider.custom.error.baseURL.format"):l.t("provider.custom.error.baseURL.required"),M=l.disabledProviders.includes(B),E=j?void 0:l.existingProviderIDs.has(B)&&!M?l.t("provider.custom.error.providerID.exists"):void 0,C=new Set,K=l.form.models.map(m=>{const F=m.id.trim(),q=F?C.has(F)?l.t("provider.custom.error.duplicate"):(()=>{C.add(F)})():l.t("provider.custom.error.required"),P=m.name.trim()?void 0:l.t("provider.custom.error.required");return{id:q,name:P}}),R=K.every(m=>!m.id&&!m.name),X=Object.fromEntries(l.form.models.map(m=>[m.id.trim(),{name:m.name.trim()}])),w=new Set,i=l.form.headers.map(m=>{const F=m.key.trim(),q=m.value.trim();if(!F&&!q)return{};const P=F?w.has(F.toLowerCase())?l.t("provider.custom.error.duplicate"):(()=>{w.add(F.toLowerCase())})():l.t("provider.custom.error.required"),J=q?void 0:l.t("provider.custom.error.required");return{key:P,value:J}}),v=i.every(m=>!m.key&&!m.value),f=Object.fromEntries(l.form.headers.map(m=>({key:m.key.trim(),value:m.value.trim()})).filter(m=>!!m.key&&!!m.value).map(m=>[m.key,m.value])),V={providerID:j??E,name:c,baseURL:D};return!j&&!E&&!c&&!D&&R&&v?{err:V,models:K,headers:i,result:{providerID:B,name:h,key:n,config:{npm:xt,name:h,...$?{env:[$]}:{},options:{baseURL:u,...Object.keys(f).length?{headers:f}:{}},models:X}}}:{err:V,models:K,headers:i}}let yt=0;const He=()=>`row-${yt++}`,Ke=()=>({row:He(),id:"",name:"",err:{}}),Re=()=>({row:He(),key:"",value:"",err:{}});var _t=S('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-6"><p class="text-14-regular text-text-base"></p><div class="flex flex-col gap-4"></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak"></label></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak">'),qe=S('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function Wt(l){const B=se();return e(Ae,{class:"h-full",get title(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",get onClick(){return l.onBack},get"aria-label"(){return B.t("common.goBack")}})},transition:!0,get children(){return e(Ge,{})}})}function Ge(l={}){const B=Ue(),h=je(),u=Ve(),s=se(),[$,n]=ne({providerID:"",name:"",baseURL:"",apiKey:"",models:[Ke()],headers:[Re()],err:{}}),j=()=>{n("models",ue(i=>{i.push(Ke())}))},c=i=>{$.models.length<=1||n("models",ue(v=>{v.splice(i,1)}))},D=()=>{n("headers",ue(i=>{i.push(Re())}))},M=i=>{$.headers.length<=1||n("headers",ue(v=>{v.splice(i,1)}))},E=(i,v)=>{n(i,v),i!=="apiKey"&&n("err",i,void 0)},C=(i,v,f)=>{_e(()=>{n("models",i,v,f),n("models",i,"err",v,void 0)})},K=(i,v,f)=>{_e(()=>{n("headers",i,v,f),n("headers",i,"err",v,void 0)})},R=()=>{const i=bt({form:$,t:s.t,disabledProviders:h().data.config.disabled_providers??[],existingProviderIDs:new Set(h().data.provider.all.keys())});return _e(()=>{n("err",i.err),i.models.forEach((v,f)=>n("models",f,"err",v)),i.headers.forEach((v,f)=>n("headers",f,"err",v))}),i.result},X=ot(()=>({mutationFn:async i=>{if(await u().protocol!=="v1")throw new Error("Custom providers are unavailable on this server");const f=(h().data.config.disabled_providers??[]).filter(V=>V!==i.providerID);return i.key&&await u().client.auth.set({providerID:i.providerID,auth:{type:"api",key:i.key}}),await h().updateConfig({provider:{[i.providerID]:i.config},disabled_providers:f}),i},onSuccess:i=>{B.close(),ke({variant:"success",icon:"circle-check",title:s.t("provider.connect.toast.connected.title",{provider:i.name}),description:s.t("provider.connect.toast.connected.description",{provider:i.name})})},onError:i=>{const v=i instanceof Error?i.message:String(i);ke({title:s.t("common.requestFailed"),description:v})}})),w=i=>{if(i.preventDefault(),X.isPending)return;const v=R();v&&X.mutate(v)};return(()=>{var i=_t(),v=i.firstChild,f=v.firstChild,V=v.nextSibling,I=V.firstChild,m=I.nextSibling,F=m.nextSibling,q=F.firstChild,P=F.nextSibling,J=P.firstChild;return t(v,e(be,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),f),t(f,()=>s.t("provider.custom.title")),V.addEventListener("submit",w),t(I,()=>s.t("provider.custom.description.prefix"),null),t(I,e(le,{href:"https://opencode.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return s.t("provider.custom.description.link")}}),null),t(I,()=>s.t("provider.custom.description.suffix"),null),t(m,e(Q,{get autofocus(){return l.autofocus??!0},get label(){return s.t("provider.custom.field.providerID.label")},get placeholder(){return s.t("provider.custom.field.providerID.placeholder")},get description(){return s.t("provider.custom.field.providerID.description")},get value(){return $.providerID},onChange:p=>E("providerID",p),get validationState(){return $.err.providerID?"invalid":void 0},get error(){return $.err.providerID}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.name.label")},get placeholder(){return s.t("provider.custom.field.name.placeholder")},get value(){return $.name},onChange:p=>E("name",p),get validationState(){return $.err.name?"invalid":void 0},get error(){return $.err.name}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.baseURL.label")},get placeholder(){return s.t("provider.custom.field.baseURL.placeholder")},get value(){return $.baseURL},onChange:p=>E("baseURL",p),get validationState(){return $.err.baseURL?"invalid":void 0},get error(){return $.err.baseURL}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.apiKey.label")},get placeholder(){return s.t("provider.custom.field.apiKey.placeholder")},get description(){return s.t("provider.custom.field.apiKey.description")},get value(){return $.apiKey},onChange:p=>E("apiKey",p)}),null),t(q,()=>s.t("provider.custom.models.label")),t(F,e(pe,{get each(){return $.models},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.id.placeholder")},get value(){return p.id},onChange:te=>C(G(),"id",te),get validationState(){return p.err.id?"invalid":void 0},get error(){return p.err.id}})),t(Y,e(Q,{get label(){return s.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.name.placeholder")},get value(){return p.name},onChange:te=>C(G(),"name",te),get validationState(){return p.err.name?"invalid":void 0},get error(){return p.err.name}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>c(G()),get disabled(){return $.models.length<=1},get"aria-label"(){return s.t("provider.custom.models.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(F,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:j,class:"self-start",get children(){return s.t("provider.custom.models.add")}}),null),t(J,()=>s.t("provider.custom.headers.label")),t(P,e(pe,{get each(){return $.headers},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.key.placeholder")},get value(){return p.key},onChange:te=>K(G(),"key",te),get validationState(){return p.err.key?"invalid":void 0},get error(){return p.err.key}})),t(Y,e(Q,{get label(){return s.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.value.placeholder")},get value(){return p.value},onChange:te=>K(G(),"value",te),get validationState(){return p.err.value?"invalid":void 0},get error(){return p.err.value}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>M(G()),get disabled(){return $.headers.length<=1},get"aria-label"(){return s.t("provider.custom.headers.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(P,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:D,class:"self-start",get children(){return s.t("provider.custom.headers.add")}}),null),t(V,e(ae,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return X.isPending},get children(){return xe(()=>!!X.isPending)()?s.t("common.saving"):s.t("common.submit")}}),null),i})()}var $t=S('<button type=button class="flex size-5 items-center justify-center rounded-sm text-v2-icon-icon-muted hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none">'),wt=S('<div tabindex=-1 class="flex min-h-0 flex-1 flex-col outline-none">'),Be=S('<div class="text-14-regular text-text-weak">'),kt=S('<div class="px-1.25 w-full flex items-center gap-x-3"><span>'),Ct=S('<div class="flex h-24 items-center justify-center text-[13px] font-[440] text-v2-text-text-muted">'),St=S('<div class="flex min-h-0 flex-1 flex-col gap-4"><div class="shrink-0 px-1 pt-px"></div><div class="relative min-h-0 flex-1"><div class="flex size-full min-h-0 flex-col gap-4 overflow-y-auto pb-8 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"></div><div class="pointer-events-none absolute inset-x-0 bottom-0 h-10"style="background:linear-gradient(to bottom, transparent, var(--v2-background-bg-layer-01))">'),It=S('<section class="flex flex-col"><div class="px-3 pb-2 text-[13px] font-[440] leading-none tracking-[-0.04px] text-v2-text-text-muted">'),Dt=S('<span class="min-w-0 truncate font-[440] text-v2-text-text-muted">'),Me=S('<span class="flex h-4 shrink-0 items-center rounded-xs border-[0.5px] border-v2-border-border-base bg-v2-background-bg-layer-03 px-1 text-[11px] font-[530] leading-none tracking-[0.05px] text-v2-text-text-muted">'),Lt=S('<button type=button class="flex min-h-9 w-full items-center gap-2 rounded-md px-3 py-2.5 text-left text-[13px] leading-none tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus:bg-v2-overlay-simple-overlay-hover focus:outline-none"><span class="min-w-0 truncate font-[530] text-v2-text-text-base">'),Pt=S('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),zt=S('<form class="flex flex-col items-start gap-4">'),Et=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span></span><span class="text-14-regular text-text-weak">'),Kt=S('<div class="flex flex-col gap-2"><div class="px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"></div><div class="flex flex-col">'),Rt=S('<button type=button class="group flex h-9 w-full items-center gap-2 rounded-md px-3 text-left text-[13px] leading-5 tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none"><span class="flex h-2 w-4 shrink-0 items-center justify-center rounded-[1px] bg-v2-background-bg-base shadow-[var(--v2-elevation-button-neutral)]"><span class="hidden h-0.5 w-2.5 bg-v2-icon-icon-base group-hover:block group-focus-visible:block"></span></span><span class="font-[530] text-v2-text-text-base">'),qt=S('<span class="font-[440] text-v2-text-text-muted">'),Fe=S('<div class="text-14-regular text-text-base">'),Bt=S("<div>"),Mt=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span>'),Ft=S('<div class="flex flex-col gap-5"><div></div><div></div><div>'),Ot=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Oe=S('<div role=alert class="-mt-4 text-xs text-v2-state-fg-danger">'),Tt=S('<div class="flex flex-col gap-4"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base">'),Ut=S('<div class="flex flex-col gap-6"><form class="flex flex-col items-start gap-4">'),jt=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><div></div><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Vt=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><form class="flex flex-col items-start gap-4">'),At=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base flex items-center gap-4"><span>'),we=S('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Zt=S("<div><div><div></div></div><div><div>");const ee="_custom";function Ne(l={}){const[B,h]=ne({selected:void 0}),u=()=>h("selected",void 0);return{selected:()=>B.selected,select:s=>h("selected",s),back:l.onBack??u}}const Ht=l=>{const B=Ne(),h=l.controller??B,u=se(),$=Ie().general.newLayoutDesigns,n=h.back,j={current:n};let c;const D=()=>c?.focus({preventScroll:!0}),M=C=>{j.current=n,h.select(C)};function E(){return e(ie,{get children(){return[e(T,{get when(){return h.selected()===ee},get children(){return e(Ge,{get autofocus(){return!$()}})}}),e(T,{get when(){return xe(()=>!!(h.selected()&&h.selected()!==ee))()?h.selected():void 0},children:C=>e(Qt,{get provider(){return C()},get directory(){return l.directory},onBack:n,setBack:K=>j.current=K})}),e(T,{when:!0,get children(){return e(Gt,{get directory(){return l.directory},onSelect:M,get onPrepare(){return $()?D:void 0}})}})]}})}return e(U,{get when(){return $()},get fallback(){return e(Ae,{class:"h-full",transition:!0,get title(){return e(U,{get when(){return h.selected()},get fallback(){return u.t("command.provider.connect")},get children(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:()=>j.current(),get"aria-label"(){return u.t("common.goBack")}})}})},get children(){return e(E,{})}})},get children(){return e(it,{containerClass:"!h-[min(calc(100vh_-_16px),512px)] !w-[min(calc(100vw_-_16px),640px)]",class:"[font-family:var(--v2-font-family-sans)] [&_[data-slot=dialog-header]]:!px-5 [&_[data-slot=dialog-header-title]]:!text-[15px] [&_[data-slot=dialog-header-title]]:!tracking-[-0.13px]",get children(){return[e(lt,{get closeLabel(){return u.t("common.close")},get children(){return e(U,{get when(){return h.selected()},get fallback(){return e(at,{get children(){return u.t("command.provider.connect")}})},get children(){var C=$t();return C.$$click=()=>j.current(),t(C,e(De,{name:"arrow-left",size:"small"})),ve(()=>re(C,"aria-label",u.t("common.goBack"))),C}})}}),e(st,{class:"min-h-0 flex-1 overflow-hidden px-2 pb-2",get children(){var C=wt(),K=c;return typeof K=="function"?Ze(K,C):c=C,t(C,e(E,{})),C}})]}})}})};function Gt(l){if(Ie().general.newLayoutDesigns())return e(Nt,{get directory(){return l.directory},get onSelect(){return l.onSelect},get onPrepare(){return l.onPrepare}});const h=Le(()=>l.directory?.()),u=se(),s=()=>u.t("dialog.provider.group.popular"),$=()=>u.t("dialog.provider.group.other"),n=()=>u.t("settings.providers.tag.custom"),j=c=>{if(c==="anthropic")return u.t("dialog.provider.anthropic.note");if(c==="openai")return u.t("dialog.provider.openai.note");if(c.startsWith("github-copilot"))return u.t("dialog.provider.copilot.note");if(c==="opencode-go")return""};return e(Ce,{class:"px-3",get search(){return{placeholder:u.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.provider.empty")},activeIcon:"plus-small",key:c=>c?.id,items:()=>(u.locale(),[{id:ee,name:n()},...h.all().values()]),filterKeys:["id","name"],groupBy:c=>de.includes(c.id)?s():$(),sortBy:(c,D)=>c.id===ee?-1:D.id===ee?1:de.includes(c.id)&&de.includes(D.id)?de.indexOf(c.id)-de.indexOf(D.id):c.name.localeCompare(D.name),sortGroupsBy:(c,D)=>{const M=s();return c.category===M&&D.category!==M?-1:D.category===M&&c.category!==M?1:0},onSelect:c=>{c&&l.onSelect(c.id)},children:c=>(()=>{var D=kt(),M=D.firstChild;return t(D,e(be,{"data-slot":"list-item-extra-icon",get id(){return c.id}}),M),t(M,()=>c.name),t(D,e(U,{get when(){return c.id==="opencode"},get children(){var E=Be();return t(E,()=>u.t("dialog.provider.opencode.tagline")),E}}),null),t(D,e(U,{get when(){return c.id===ee},get children(){return e($e,{get children(){return u.t("settings.providers.tag.custom")}})}}),null),t(D,e(U,{get when(){return c.id==="opencode"},get children(){return e($e,{get children(){return u.t("dialog.provider.tag.recommended")}})}}),null),t(D,e(U,{get when(){return j(c.id)},children:E=>(()=>{var C=Be();return t(C,E),C})()}),null)const K=w=>{l.onPrepare?.(),l.onSelect(w)},R=(w,i)=>{const v=M();if(v.length===0)return;const f=v.findIndex(I=>I.id===u.active),V=f<0?i>0?0:v.length-1:(f+i+v.length)%v.length;s("active",v[V].id),E?.querySelector(`[data-provider-id="${CSS.escape(v[V].id)}"]`)?.focus({preventScroll:!0}),w.preventDefault()},X=w=>{if(w.key==="ArrowDown")return R(w,1);if(w.key==="ArrowUp")return R(w,-1);w.key!=="Enter"||!u.active||(K(u.active),w.preventDefault())};return(()=>{var w=St(),i=w.firstChild,v=i.nextSibling,f=v.firstChild;f.nextSibling,w.$$keydown=X;var V=E;return typeof V=="function"?Ze(V,w):E=w,t(i,e(Se,{ref(I){var m=C;typeof m=="function"?m(I):C=I},type:"search",class:"!w-full [font-family:var(--v2-font-family-sans)]",get leadingIcon(){return e(De,{name:"magnifying-glass",size:"small"})},get placeholder(){return h.t("dialog.provider.search.placeholder")},get value(){return u.filter},onInput:I=>{s({filter:I.currentTarget.value,active:void 0})}})),t(f,e(pe,{get each(){return[{title:h.t("dialog.provider.group.popular"),items:c},{title:h.t("dialog.provider.group.other"),items:D}]},children:I=>e(U,{get when(){return I.items().length>0},get children(){var m=It(),F=m.firstChild;return t(F,()=>I.title),t(m,e(pe,{get each(){return I.items()},children:q=>(()=>{var P=Lt(),J=P.firstChild;return P.$$click=()=>K(q.id),P.addEventListener("mouseenter",()=>s("active",q.id)),t(P,e(be,{get id(){return q.id},class:"size-4 shrink-0 text-v2-icon-icon-base"}),J),t(J,()=>q.name),t(P,e(U,{get when(){return q.id==="opencode"},get children(){return[(()=>{var p=Dt();return t(p,()=>h.t(q.id==="opencode"?"dialog.provider.opencode.tagline":"dialog.provider.opencodeGo.tagline")),p})(),(()=>{var p=Me();return t(p,()=>h.t("dialog.provider.tag.recommended")),p})()]}}),null),t(P,e(U,{get when(){return q.id===ee},get children(){var p=Me();return t(p,()=>h.t("settings.providers.tag.custom")),p}}),null),t(P,e(U,{get when(){return u.connecting===q.id},get children(){return e(me,{class:"ml-auto size-4 shrink-0 text-v2-icon-icon-muted"})}}),null),ve(p=>{var G=q.id,Z=u.active===q.id,W=u.connecting!==void 0,Y=u.connecting===q.id;return G!==p.e&&re(P,"data-provider-id",p.e=G),Z!==p.t&&P.classList.toggle("bg-v2-overlay-simple-overlay-hover",p.t=Z),W!==p.a&&(P.disabled=p.a=W),Y!==p.o&&re(P,"aria-busy",p.o=Y),p},{e:void 0,t:void 0,a:void 0,o:void 0}),P})()}),null),m}})}),null),t(f,e(U,{get when(){return M().length===0},get children(){var I=Ct();return t(I,()=>h.t("dialog.provider.empty")),I}}),null),w})()}function Qt(l){const B=Ue(),h=je(),u=Ve(),s=ct(),$=dt(),n=se(),c=Ie().general.newLayoutDesigns,D=Le(()=>l.directory?.()),M=()=>l.directory?.()??gt($.dir),E=()=>{const r=M();return r?{directory:r}:void 0},C={value:!0},K={current:void 0};ut(()=>{C.value=!1,K.current!==void 0&&(clearTimeout(K.current),K.current=void 0)});const R=A(()=>D.all().get(l.provider)??h().data.provider.all.get(l.provider)),X=A(()=>[{type:"key",label:n.t("provider.connect.method.apiKey")}]),[w]=vt(()=>({provider:l.provider,directory:M()}),r=>u().api.integration.get({integrationID:r.provider,location:r.directory?{directory:r.directory}:void 0}).then(o=>o.data)),i=A(()=>w.loading),v=A(()=>{const r=w.latest?.methods.filter(o=>o.type==="key"||o.type==="oauth");return r?.length?r:X()}),[f,V]=ne({methodIndex:void 0,authorization:void 0,promptInputs:void 0,state:"pending",error:void 0});function I(r){V(ue(o=>{if(r.type==="method.select"){o.methodIndex=r.index,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="method.reset"){o.methodIndex=void 0,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="auth.prompt"){o.state="prompt",o.error=void 0;return}if(r.type==="auth.inputs"){o.promptInputs=r.inputs,o.state=void 0,o.error=void 0;return}if(r.type==="auth.pending"){o.state="pending",o.error=void 0;return}if(r.type==="auth.complete"){o.state="complete",o.authorization=r.authorization,o.error=void 0;return}o.state="error",o.error=r.error}))}const m=A(()=>f.methodIndex!==void 0?v().at(f.methodIndex):void 0),F=r=>r?r.type==="key"?n.t("provider.connect.method.apiKey"):r.label??"":"",q=r=>{const o=F(r),a=r?.label?.match(/\s+\((browser|headless)\)$/i),y=a?.[1];return{label:a?o.slice(0,-a[0].length):o,hint:y?y[0].toUpperCase()+y.slice(1):r?.type==="key"?"Browser":void 0}};function P(r,o){if(r&&typeof r=="object"&&"data"in r){const a=r.data;if(typeof a?.message=="string"&&a.message)return a.message}if(r&&typeof r=="object"&&"error"in r){const a=P(r.error,"");if(a)return a}if(r&&typeof r=="object"&&"message"in r){const a=r.message;if(typeof a=="string"&&a)return a}return r instanceof Error&&r.message?r.message:typeof r=="string"&&r?r:o}async function J(r,o){K.current!==void 0&&(clearTimeout(K.current),K.current=void 0);const a=v()[r];if(I({type:"method.select",index:r}),a.type==="oauth"){if(a.prompts?.length&&!o){I({type:"auth.prompt"});return}I({type:"auth.pending"}),await u().api.integration.oauth.connect({integrationID:l.provider,methodID:a.id,inputs:o??{},location:E()}).then(y=>{C.value&&I({type:"auth.complete",authorization:y.data})}).catch(y=>{C.value&&I({type:"auth.error",error:P(y,n.t("common.requestFailed"))})})}}function p(){const[r,o]=ne({value:{},index:0}),a=A(()=>{const _=m();return _?.type==="oauth"?_.prompts??[]:[]}),y=(_,O)=>{if(!_.when)return!0;const H=O[_.when.key];return H===void 0?!1:_.when.op==="eq"?H===_.when.value:H!==_.when.value},z=A(()=>{const _=a(),O=_.findIndex((H,ce)=>ce>=r.index&&y(H,r.value));if(O!==-1)return{index:O,prompt:_[O]}}),d=A(()=>{const _=z();return!_||_.prompt.type!=="text"?!1:(r.value[_.prompt.key]??"").trim().length>0});async function g(_,O){if(f.methodIndex===void 0)return;const H=a().findIndex((ce,N)=>N>_&&y(ce,O));if(H!==-1){o("index",H);return}await J(f.methodIndex,O)}async function x(_){_.preventDefault();const O=z();!O||O.prompt.type!=="text"||d()&&await g(O.index,r.value)}const b=()=>z(),k=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="text"))return _}),L=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="select"))return _});return(()=>{var _=zt();return _.addEventListener("submit",x),t(_,e(ie,{get children(){return[e(T,{get when(){return b()?.prompt.type==="text"},get children(){return[e(Q,{type:"text",get label(){return k()?.message??""},get placeholder(){return k()?.placeholder},get value(){return xe(()=>!!k())()?r.value[k().key]??"":""},onChange:O=>{const H=k();H&&o("value",H.key,O)}}),e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!d()},get children(){return n.t("common.continue")}})]}}),e(T,{get when(){return b()?.prompt.type==="select"},get children(){var O=Pt(),H=O.firstChild,ce=H.nextSibling;return t(H,()=>L()?.message),t(ce,e(Ce,{class:"px-3",get items(){return L()?.options??[]},key:N=>N.value,get current(){return L()?.options.find(N=>N.value===r.value[L().key])},onSelect:N=>{if(!N)return;const oe=L();if(!oe)return;const ye={...r.value,[oe.key]:N.value};o("value",oe.key,N.value),g(b().index,ye)},children:N=>(()=>{var oe=Et(),ye=oe.firstChild,Pe=ye.nextSibling,Ye=Pe.nextSibling;return t(Pe,()=>N.label),t(Ye,()=>N.hint),oe})()})),O}})]}})),_})()}let G;function Z(r){r.key==="Enter"&&r.target instanceof HTMLInputElement||r.key!=="Escape"&&G?.onKeyDown(r)}let W=!1;pt(()=>{W||i()||v().length===1&&(W=!0,J(0))});async function Y(){const r=M();await s.refetchQueries(h().queryOptions.providers(r?mt(r):null)).catch(()=>{}),B.close(),ke({variant:"success",icon:"circle-check",title:n.t("provider.connect.toast.connected.title",{provider:R().name}),description:n.t("provider.connect.toast.connected.description",{provider:R().name})})}function te(){if(v().length>1&&f.methodIndex!==void 0){I({type:"method.reset"});return}l.onBack()}l.setBack(te);function Qe(){return c()?(()=>{var r=Kt(),o=r.firstChild,a=o.nextSibling;return t(o,()=>n.t("provider.connect.selectMethod",{provider:R().name})),t(a,e(pe,{get each(){return v()},children:(y,z)=>{const d=()=>q(y);return(()=>{var g=Rt(),x=g.firstChild,b=x.nextSibling;return g.$$click=()=>void J(z()),t(b,()=>d().label),t(g,e(U,{get when(){return d().hint},children:k=>(()=>{var L=qt();return t(L,k),L})()}),null),g})()}})),r})():[(()=>{var r=Fe();return t(r,()=>n.t("provider.connect.selectMethod",{provider:R().name})),r})(),(()=>{var r=Bt();return t(r,e(Ce,{class:"px-3",ref:o=>{G=o},items:v,key:o=>o?.label??o?.type,onSelect:async(o,a)=>{o&&J(a)},children:o=>(()=>{var a=Mt(),y=a.firstChild,z=y.nextSibling;return t(z,()=>F(o)),a})()})),r})()]}function Je(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("apiKey");if(!b?.trim()){y("error",n.t("provider.connect.apiKey.required"));return}y("error",void 0),await u().api.integration.connect.key({integrationID:l.provider,location:E(),key:b}),await Y()}return c()?(()=>{var d=Ot(),g=d.firstChild,x=g.firstChild;return t(d,e(U,{get when(){return R().id==="opencode"},get fallback(){return n.t("provider.connect.apiKey.description",{provider:R().name})},get children(){var b=Ft(),k=b.firstChild,L=k.nextSibling,_=L.nextSibling;return t(k,()=>n.t("provider.connect.opencodeZen.line1")),t(L,()=>n.t("provider.connect.opencodeZen.line2")),t(_,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(_,e(le,{href:"https://",class:"text-v2-text-text-base focus-visible:rounded-xs focus-visible:outline-2 focus-visible:outline-v2-border-border-focus",get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(_,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),b}}),g),g.addEventListener("submit",z),t(x,()=>n.t("provider.connect.apiKey.label",{provider:R().name}),null),t(x,e(Se,{ref(b){var k=r;typeof k=="function"?k(b):r=b},class:"!w-full",name:"apiKey","data-input":"provider-api-key",get placeholder(){return n.t("provider.connect.apiKey.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:b=>y("value",b.currentTarget.value)}),null),t(g,e(U,{get when(){return a.error},children:b=>(()=>{var k=Oe();return re(k,"id",o),t(k,b),k})()}),null),t(g,e(Ee,{type:"submit",variant:"contrast","data-action":"provider-connect-submit",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Ut(),g=d.firstChild;return t(d,e(ie,{get children(){return[e(T,{get when(){return R().id==="opencode"},get children(){var x=Tt(),b=x.firstChild,k=b.nextSibling,L=k.nextSibling;return t(b,()=>n.t("provider.connect.opencodeZen.line1")),t(k,()=>n.t("provider.connect.opencodeZen.line2")),t(L,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(L,e(le,{href:"https://",tabIndex:-1,get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(L,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),x}}),e(T,{when:!0,get children(){var x=Fe();return t(x,()=>n.t("provider.connect.apiKey.description",{provider:R().name})),x}})]}}),g),g.addEventListener("submit",z),t(g,e(Q,{get autofocus(){return!c()},ref(x){var b=r;typeof b=="function"?b(x):r=x},type:"text",get label(){return n.t("provider.connect.apiKey.label",{provider:R().name})},get placeholder(){return n.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return a.value},onChange:x=>y("value",x),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(g,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function We(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("code");if(!b?.trim()){y("error",n.t("provider.connect.oauth.code.required"));return}y("error",void 0);const k=await u().api.integration.oauth.complete({integrationID:l.provider,attemptID:f.authorization.attemptID,location:E(),code:b}).then(()=>({ok:!0})).catch(L=>({ok:!1,error:L}));if(k.ok){await Y();return}y("error",P(k.error,n.t("provider.connect.oauth.code.invalid")))}return c()?(()=>{var d=jt(),g=d.firstChild,x=g.nextSibling,b=x.firstChild;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},class:"text-v2-text-text-base",get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(b,()=>n.t("provider.connect.oauth.code.label",{method:m()?.label??""}),null),t(b,e(Se,{ref(k){var L=r;typeof L=="function"?L(k):r=k},class:"!w-full",name:"code",get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:k=>y("value",k.currentTarget.value)}),null),t(x,e(U,{get when(){return a.error},children:k=>(()=>{var L=Oe();return re(L,"id",o),t(L,k),L})()}),null),t(x,e(Ee,{type:"submit",variant:"contrast",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Vt(),g=d.firstChild,x=g.nextSibling;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(x,e(Q,{get autofocus(){return!c()},ref(b){var k=r;typeof k=="function"?k(b):r=b},type:"text",get label(){return n.t("provider.connect.oauth.code.label",{method:m()?.label??""})},get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return a.value},onChange:b=>y("value",b),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(x,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function Xe(){const r=A(()=>{const o=f.authorization?.instructions;return o?.includes(":")?o.split(":").pop()?.trim():o});return fe(()=>{const o=async()=>{const a=f.authorization;if(!a||!C.value)return;const y=await u().api.integration.oauth.status({integrationID:l.provider,attemptID:a.attemptID,location:E()}).then(z=>({ok:!0,status:z.data})).catch(z=>({ok:!1,error:z}));if(C.value){if(!y.ok){I({type:"auth.error",error:P(y.error,n.t("common.requestFailed"))});return}if(y.status.status==="complete"){await Y();return}if(y.status.status==="failed"){I({type:"auth.error",error:y.status.message});return}if(y.status.status==="expired"){I({type:"auth.error",error:n.t("common.requestFailed")});return}K.current=setTimeout(o,1e3)}};o()}),(()=>{var o=At(),a=o.firstChild,y=a.nextSibling,z=y.firstChild;return t(a,()=>n.t("provider.connect.oauth.auto.visit.prefix"),null),t(a,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.auto.visit.link")}}),null),t(a,()=>n.t("provider.connect.oauth.auto.visit.suffix",{provider:R().name}),null),t(o,e(Q,{get label(){return n.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return r()},readOnly:!0,copyable:!0}),y),t(y,e(me,{}),z),t(z,()=>n.t("provider.connect.status.waiting")),o})()}return(()=>{var r=Zt(),o=r.firstChild,a=o.firstChild,y=o.nextSibling,z=y.firstChild;return t(o,e(be,{get id(){return l.provider},get class(){return c()?"mt-0.5 size-4 shrink-0 text-v2-icon-icon-base":"size-5 shrink-0 icon-strong-base"}}),a),t(a,e(ie,{get children(){return[e(T,{get when(){return xe(()=>l.provider==="anthropic")()&&m()?.label?.toLowerCase().includes("max")},get children(){return n.t("provider.connect.title.anthropicProMax")}}),e(T,{when:!0,get children(){return n.t("provider.connect.title",{provider:R().name})}})]}})),z.$$keydown=Z,t(z,e(ie,{get children(){return[e(T,{get when(){return i()},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.methodIndex===void 0},get children(){return e(Qe,{})}}),e(T,{get when(){return f.state==="pending"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.state==="prompt"},get children(){return e(p,{})}}),e(T,{get when(){return f.state==="error"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(De,{name:"circle-ban-sign",class:"text-icon-critical-base"}),x),t(x,()=>n.t("provider.connect.status.failed",{error:f.error??""})),d}}),e(T,{get when(){return m()?.type==="key"},get children(){return e(Je,{})}}),e(T,{get when(){return m()?.type==="oauth"},get children(){return e(ie,{get children(){return[e(T,{get when(){return f.authorization?.mode==="code"},get children(){return e(We,{})}}),e(T,{get when(){return f.authorization?.mode==="auto"},get children(){return e(Xe,{})}})]}})}})]}})),ve(d=>{var g=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-3",x=c()?"flex h-10 shrink-0 items-start gap-2 px-3":"flex items-center gap-4 px-2.5",b=c()?"text-[15px] font-[530] leading-5 tracking-[-0.13px] text-v2-text-text-base":"text-16-medium text-text-strong",k=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-10",L=c()?void 0:0,_=!c()&&f.methodIndex===void 0?!0:void 0;return g!==d.e&&ge(r,d.e=g),x!==d.t&&ge(o,d.t=x),b!==d.a&&ge(a,d.a=b),k!==d.o&&ge(y,d.o=k),L!==d.i&&re(z,"tabindex",d.i=L),_!==d.n&&(z.autofocus=d.n=_),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),r})()}Te(["click","keydown"]);const Xt=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Ht,useProviderConnectController:Ne},Symbol.toStringTag,{value:"Module"}));export{Ht as D,le as L,Wt as a,Xt as d,Ne as u};
|
|
2
2
|
//# sourceMappingURL=dialog-connect-provider-DLnpNUTc.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-wflYMX4p.js","assets/index-BfNxi3ev.js","assets/index-S3QimprQ.css","assets/row-DA4cIOhp.js","assets/LROKH5N7-D8CK0ENS.js","assets/row-DVVVLbFk.css","assets/settings-keybinds-BOa6QxJ6.js","assets/list-FiQEDby0.js","assets/dialog-connect-provider-DLnpNUTc.js","assets/index-Bd5IF--R.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{co as Oe,b_ as J,c5 as Ve,c6 as _e,bV as pe,c4 as je,ck as he,aD as z,aQ as Me,ch as $e,cg as ye,aI as ce,bm as Re,b6 as r,au as e,a2 as w,bL as d,af as Ze,a9 as Ke,B as q,T as K,ba as W,aa as se,bB as Ge,bC as qe,be as Ue,bf as Qe,bM as He,bN as We,bc as ge,ac as Xe,I as j,bD as Ye,bg as Je,bO as et,S as tt,bv as rt,bZ as me,l as G,Y as xe,V as te,Z as be,o as Y,$ as nt,a0 as st,y as it,Q as lt,cf as at,c9 as ot,bw as le,N as ie,a8 as re,bG as ne,c1 as ct,bX as gt,u as dt,ce as ut,W as pt,X as ht,aK as mt,a7 as C,bK as vt,b as ft}from"./index-BfNxi3ev.js";import{S as $}from"./switch-CVS6td1r.js";import{u as xt,a as E,S as bt}from"./settings-keybinds-BOa6QxJ6.js";import{L as wt,u as _t,a as $t,D as yt}from"./dialog-connect-provider-DLnpNUTc.js";import"./LROKH5N7-D8CK0ENS.js";import"./list-FiQEDby0.js";var St=d("<div data-action=settings-new-layout-designs>"),de=d('<div class="flex flex-col gap-1">'),Ct=d('<span class="flex items-center gap-2">'),kt=d("<div data-action=settings-auto-accept-permissions>"),Pt=d("<div data-action=settings-feed-reasoning-summaries>"),Tt=d("<div data-action=settings-feed-shell-tool-parts-expanded>"),Dt=d("<div data-action=settings-feed-edit-tool-parts-expanded>"),Ft=d("<div data-action=settings-show-file-tree>"),It=d("<div data-action=settings-show-navigation>"),zt=d("<div data-action=settings-show-search>"),Et=d("<div data-action=settings-show-status>"),At=d("<div data-action=settings-show-custom-agents>"),H=d('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ue=d('<div class="w-full sm:w-[220px]">'),Nt=d("<div data-action=settings-notifications-agent>"),Lt=d("<div data-action=settings-notifications-permissions>"),Bt=d("<div data-action=settings-notifications-errors>"),Ot=d("<div data-action=settings-release-notes>"),Vt=d("<div data-action=settings-pinch-zoom>"),jt=d("<div data-action=settings-wayland>"),Mt=d("<span class=text-text-weak>"),Rt=d('<div class="flex items-center gap-2"><span>'),Zt=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong"></h2></div></div><div class="flex flex-col gap-8 w-full">'),Kt=d('<div class="flex flex-wrap items-center gap-4 py-3 border-b border-border-weak-base last:border-none sm:flex-nowrap"><div class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div><div class="flex w-full justify-end sm:w-auto sm:shrink-0">');let M={cleanup:void 0,timeout:void 0,run:0};const Se=()=>{M.run+=1,M.cleanup&&M.cleanup(),clearTimeout(M.timeout),M.cleanup=void 0},we=i=>{if(Se(),!i)return;const t=++M.run;M.timeout=setTimeout(()=>{rt(i).then(a=>{if(M.run!==t){a?.();return}M.cleanup=a})},100)},Gt=()=>{const i=Oe(),t=J(),a=Ve(),c=_e(),v=pe(),m=je(),l=he(),_=xt(),y=z(()=>c.platform==="desktop"&&c.os==="linux"),k=z(()=>Me(m.dir)),P=z(()=>{const o=k();return o?m.id?a.isAutoAccepting(m.id,o):a.isAutoAcceptingDirectory(o):!1}),T=o=>{const s=k();if(s){if(!m.id){if(a.isAutoAcceptingDirectory(s)===o)return;a.toggleAutoAcceptDirectory(s);return}if(o){a.enableAutoAccept(m.id,s);return}a.disableAutoAccept(m.id,s)}},A=z(()=>c.platform==="desktop"),N=z(()=>i.ids().map(o=>({id:o,name:i.name(o)}))),F=$e(),L=ye(),[O]=ce(async()=>{const o=L();return await o.protocol==="v1"?(await o.client.pty.shells()).data??[]:[]},{initialValue:[]}),[U,{refetch:h}]=ce(()=>!!(y()&&c.getDisplayBackend),()=>Promise.resolve(c.getDisplayBackend?.()??null).catch(()=>null),{initialValue:null}),[u,{mutate:b}]=ce(()=>!!(A()&&c.getPinchZoomEnabled),()=>Promise.resolve(c.getPinchZoomEnabled?.()??!1).catch(()=>!1),{initialValue:!1});Re(()=>{i.loadThemes()});const B={id:"auto",value:"",label:t.t("settings.general.row.shell.autoDefault")},R=z(()=>F().data.config.shell??""),Z=z(()=>{const o=O.latest,s=F().data.config.shell,n=new Map;for(const g of o)n.set(g.name,(n.get(g.name)||0)+1);const p=[B,...o.map(g=>{const ve=(n.get(g.name)||0)>1,fe=ve?g.path:g.name,Be=g.acceptable?fe:`${fe} (${t.t("settings.general.row.shell.terminalOnly")})`;return{id:g.path,value:ve?g.path:g.name,label:Be}})];return s&&!p.some(g=>g.value===s)&&p.push({id:s,value:s,label:s}),p}),ae=o=>{const s=c.setDisplayBackend?.(o?"wayland":"auto");s&&s.finally(()=>{h()})},X=o=>{b(o);const s=c.setPinchZoomEnabled?.(o);s&&s.catch(()=>b(!o))},ee=z(()=>[{value:"system",label:t.t("theme.scheme.system")},{value:"light",label:t.t("theme.scheme.light")},{value:"dark",label:t.t("theme.scheme.dark")}]),x=z(()=>t.locales.map(o=>({value:o,label:t.label(o)}))),D={id:"none",label:"sound.option.none"},S=[D,...tt],I=()=>Je(l.appearance.font()),V=()=>Ye(l.appearance.uiFont()),oe=()=>et(l.appearance.terminalFont()),Q=(o,s,n,p)=>({options:S,current:o()?S.find(g=>g.id===s())??D:D,value:g=>g.id,label:g=>t.t(g.label),onHighlight:g=>{g&&we(g.id==="none"?void 0:g.id)},onSelect:g=>{if(g){if(g.id==="none"){n(!1),Se();return}n(!0),p(g.id),we(g.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),Te=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return(()=>{var s=Ct();return r(s,()=>t.t("settings.general.row.newInterface.title"),null),r(s,e(Ke,{variant:"accent",get children(){return t.t("settings.general.row.newInterface.badge")}}),null),s})()},get description(){return t.t("settings.general.row.newInterface.description")},get children(){var s=St();return r(s,e($,{get checked(){return l.general.newLayoutDesigns()},onChange:n=>{l.general.setNewLayoutDesigns(n),n&&Ze(()=>import("./index-wflYMX4p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(p=>{v.show(()=>e(p.DialogSettings,{}))})}})),s}})}})),o})(),De=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return t.t("settings.general.row.newInterfaceNotice.title")},get description(){return t.t("settings.general.row.newInterfaceNotice.description")},get children(){return e(q,{size:"small",variant:"ghost",get onClick(){return l.general.dismissNewInterfaceNotice},get children(){return t.t("settings.general.row.newInterfaceNotice.dismiss")}})}})}})),o})(),Fe=()=>(()=>{var o=de();return r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.language.title")},get description(){return t.t("settings.general.row.language.description")},get children(){return e(K,{"data-action":"settings-language",get options(){return x()},get current(){return x().find(s=>s.value===t.locale())},value:s=>s.value,label:s=>s.label,onSelect:s=>s&&t.setLocale(s.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("command.permissions.autoaccept.enable")},get description(){return t.t("toast.permissions.autoaccept.on.description")},get children(){var s=kt();return r(s,e($,{get checked(){return P()},get disabled(){return!k()},onChange:T})),s}}),e(f,{get title(){return t.t("settings.general.row.shell.title")},get description(){return t.t("settings.general.row.shell.description")},get children(){return e(K,{"data-action":"settings-shell",get options(){return Z()},get current(){return Z().find(s=>s.value===R())??B},value:s=>s.id,label:s=>s.label,onSelect:s=>{s&&s.value!==R()&&F().updateConfig({shell:s.value})},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"180px"}})}}),e(f,{get title(){return t.t("settings.general.row.reasoningSummaries.title")},get description(){return t.t("settings.general.row.reasoningSummaries.description")},get children(){var s=Pt();return r(s,e($,{get checked(){return l.general.showReasoningSummaries()},onChange:n=>l.general.setShowReasoningSummaries(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return t.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var s=Tt();return r(s,e($,{get checked(){return l.general.shellToolPartsExpanded()},onChange:n=>l.general.setShellToolPartsExpanded(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.editToolPartsExpanded.title")},get description(){return t.t("settings.general.row.editToolPartsExpanded.description")},get children(){var s=Dt();return r(s,e($,{get checked(){return l.general.editToolPartsExpanded()},onChange:n=>l.general.setEditToolPartsExpanded(n)})),s}})]}})),o})(),Ie=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.advanced")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.showFileTree.title")},get description(){return t.t("settings.general.row.showFileTree.description")},get children(){var n=Ft();return r(n,e($,{get checked(){return l.general.showFileTree()},onChange:p=>l.general.setShowFileTree(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showNavigation.title")},get description(){return t.t("settings.general.row.showNavigation.description")},get children(){var n=It();return r(n,e($,{get checked(){return l.general.showNavigation()},onChange:p=>l.general.setShowNavigation(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showSearch.title")},get description(){return t.t("settings.general.row.showSearch.description")},get children(){var n=zt();return r(n,e($,{get checked(){return l.general.showSearch()},onChange:p=>l.general.setShowSearch(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showStatus.title")},get description(){return t.t("settings.general.row.showStatus.description")},get children(){var n=Et();return r(n,e($,{get checked(){return l.general.showStatus()},onChange:p=>l.general.setShowStatus(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showCustomAgents.title")},get description(){return t.t("settings.general.row.showCustomAgents.description")},get children(){var n=At();return r(n,e($,{get checked(){return l.general.showCustomAgents()},onChange:p=>l.general.setShowCustomAgents(p)})),n}})]}}),null),o})(),ze=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.appearance")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.colorScheme.title")},get description(){return t.t("settings.general.row.colorScheme.description")},get children(){return e(K,{"data-action":"settings-color-scheme",get options(){return ee()},get current(){return ee().find(n=>n.value===i.colorScheme())},value:n=>n.value,label:n=>n.label,onSelect:n=>n&&i.setColorScheme(n.value),variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),e(f,{get title(){return t.t("settings.general.row.theme.title")},get description(){return[W(()=>t.t("settings.general.row.theme.description"))," ",e(wt,{href:"https://opencode.ai/docs/themes/",get children(){return t.t("common.learnMore")}})]},get children(){return e(K,{"data-action":"settings-theme",get options(){return N()},get current(){return N().find(n=>n.id===i.themeId())},value:n=>n.id,label:n=>n.name,onSelect:n=>{n&&i.setTheme(n.id)},variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("settings.general.row.uiFont.title")},get description(){return t.t("settings.general.row.uiFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-ui-font",get label(){return t.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return V()},onChange:p=>l.appearance.setUIFont(p),placeholder:Ge,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":qe(l.appearance.uiFont())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.font.title")},get description(){return t.t("settings.general.row.font.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-code-font",get label(){return t.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return I()},onChange:p=>l.appearance.setFont(p),placeholder:Ue,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Qe(l.appearance.font())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.terminalFont.title")},get description(){return t.t("settings.general.row.terminalFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-terminal-font",get label(){return t.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return oe()},onChange:p=>l.appearance.setTerminalFont(p),placeholder:He,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":We(l.appearance.terminalFont())}}})),n}})]}}),null),o})(),Ee=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.notifications")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.notifications.agent.title")},get description(){return t.t("settings.general.notifications.agent.description")},get children(){var n=Nt();return r(n,e($,{get checked(){return l.notifications.agent()},onChange:p=>l.notifications.setAgent(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.permissions.title")},get description(){return t.t("settings.general.notifications.permissions.description")},get children(){var n=Lt();return r(n,e($,{get checked(){return l.notifications.permissions()},onChange:p=>l.notifications.setPermissions(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.errors.title")},get description(){return t.t("settings.general.notifications.errors.description")},get children(){var n=Bt();return r(n,e($,{get checked(){return l.notifications.errors()},onChange:p=>l.notifications.setErrors(p)})),n}})]}}),null),o})(),Ae=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.sounds")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.sounds.agent.title")},get description(){return t.t("settings.general.sounds.agent.description")},get children(){return e(K,ge({"data-action":"settings-sounds-agent"},()=>Q(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),n=>l.sounds.setAgentEnabled(n),n=>l.sounds.setAgent(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.permissions.title")},get description(){return t.t("settings.general.sounds.permissions.description")},get children(){return e(K,ge({"data-action":"settings-sounds-permissions"},()=>Q(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),n=>l.sounds.setPermissionsEnabled(n),n=>l.sounds.setPermissions(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.errors.title")},get description(){return t.t("settings.general.sounds.errors.description")},get children(){return e(K,ge({"data-action":"settings-sounds-errors"},()=>Q(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),n=>l.sounds.setErrorsEnabled(n),n=>l.sounds.setErrors(n))))}})]}}),null),o})(),Ne=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.updates")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.releaseNotes.title")},get description(){return t.t("settings.general.row.releaseNotes.description")},get children(){var n=Ot();return r(n,e($,{get checked(){return l.general.releaseNotes()},onChange:p=>l.general.setReleaseNotes(p)})),n}}),e(f,{get title(){return t.t("settings.updates.row.check.title")},get description(){return t.t("settings.updates.row.check.description")},get children(){return e(q,{size:"small",variant:"secondary",get disabled(){return!_.action().run},get onClick(){return _.run},get children(){return t.t(_.action().label)}})}})]}}),null),o})(),Le=()=>e(w,{get when(){return A()},get children(){var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.display")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.pinchZoom.title")},get description(){return t.t("settings.general.row.pinchZoom.description")},get children(){var n=Vt();return r(n,e($,{get checked(){return u.latest},onChange:X})),n}}),e(w,{get when(){return y()},get children(){return e(f,{get title(){return(()=>{var n=Rt(),p=n.firstChild;return r(p,()=>t.t("settings.general.row.wayland.title")),r(n,e(Xe,{get value(){return t.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var g=Mt();return r(g,e(j,{name:"help",size:"small"})),g}}),null),n})()},get description(){return t.t("settings.general.row.wayland.description")},get children(){var n=jt();return r(n,e($,{get checked(){return U.latest==="wayland"},onChange:ae})),n}})}})]}}),null),o}});return(()=>{var o=Zt(),s=o.firstChild,n=s.firstChild,p=n.firstChild,g=s.nextSibling;return r(p,()=>t.t("settings.tab.general")),r(g,e(w,{get when(){return l.general.layoutTransitionAvailable()},get children(){return e(Te,{})}}),null),r(g,e(w,{get when(){return l.general.newInterfaceNoticeVisible()},get children(){return e(De,{})}}),null),r(g,e(Fe,{}),null),r(g,e(ze,{}),null),r(g,e(Ee,{}),null),r(g,e(Ae,{}),null),r(g,e(Ne,{}),null),r(g,e(Le,{}),null),r(g,e(w,{get when(){return A()},get children(){return e(Ie,{})}}),null),o})()},f=i=>(()=>{var t=Kt(),a=t.firstChild,c=a.firstChild,v=c.nextSibling,m=a.nextSibling;return r(c,()=>i.title),r(v,()=>i.description),r(m,()=>i.children),t})();function Ce(i){const t=me(),a=he();return e(w,{get when(){return a.general.newLayoutDesigns()},get fallback(){return i.children},get children(){return e(w,{get when(){return t.settings.server.selected()},children:c=>e(qt,{get server(){return c()},get children(){return i.children}})})}})}function qt(i){const t=me(),a=()=>t.ensureServerCtx(i.server);return e(lt,{get client(){return a().queryClient},get children(){return e(nt,{server:()=>i.server,get children(){return e(st,{get children(){return e(it,{get children(){return i.children}})}})}})}})}function ke(){const i=me(),t=he(),a=z(()=>t.general.newLayoutDesigns()?i.settings.server.selected():void 0);return e(w,{get when(){return a()},children:c=>e(G,{gutter:4,placement:"bottom-end",get children(){return[e(G.Trigger,{as:q,variant:"secondary",size:"large",class:"h-8 max-w-[260px] gap-2 px-2 py-1.5 data-[expanded]:bg-surface-base-active",get children(){return[e(xe,{get health(){return i.servers.health[te.key(c())]}}),e(be,{get conn(){return c()},get status(){return i.servers.health[te.key(c())]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"hidden"}),e(j,{name:"chevron-down",size:"small",class:"text-icon-weak shrink-0"})]}}),e(G.Portal,{get children(){return e(G.Content,{class:"w-[320px] mt-1 [&_[data-slot=dropdown-menu-radio-item]]:pl-2 [&_[data-slot=dropdown-menu-radio-item]]:pr-2",get children(){return e(G.RadioGroup,{get value(){return i.settings.server.key},onChange:v=>{typeof v=="string"&&i.settings.server.set(te.Key.make(v))},get children(){return e(Y,{get each(){return i.servers.list()},children:v=>{const m=te.key(v),l=()=>i.servers.health[m]?.healthy===!1;return e(G.RadioItem,{value:m,get disabled(){return l()},get children(){return[e(xe,{get health(){return i.servers.health[m]}}),e(be,{conn:v,get dimmed(){return l()},get status(){return i.servers.health[m]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"text-12-regular text-text-weak truncate"}),e(G.ItemIndicator,{get children(){return e(j,{name:"check-small",size:"small",class:"text-icon-weak"})}})]}})}})}})}})}})]}})})}var Ut=d('<div class="flex items-center justify-between gap-4 min-h-16 border-b border-border-weak-base last:border-none flex-wrap py-3"data-component=custom-provider-section><div class="flex flex-col min-w-0"><div class="flex flex-wrap items-center gap-x-3 gap-y-1"><span class="text-14-medium text-text-strong"></span></div><span class="text-12-regular text-text-weak pl-8">'),Qt=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex items-center justify-between gap-4 pt-6 pb-8 max-w-[720px]"><h2 class="text-16-medium text-text-strong"></h2></div></div><div class="flex flex-col gap-8 max-w-[720px]"><div class="flex flex-col gap-1"data-component=connected-providers-section><h3 class="text-14-medium text-text-strong pb-2"></h3></div><div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Ht=d('<div class="py-4 text-14-regular text-text-weak">'),Wt=d('<div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex items-center gap-3 min-w-0"><span class="text-14-medium text-text-strong truncate">'),Xt=d('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Yt=d('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex flex-col min-w-0"><div class="flex items-center gap-x-3"><span class="text-14-medium text-text-strong">'),Jt=d('<span class="text-12-regular text-text-weak pl-8">');const er=[{match:i=>i==="opencode",key:"dialog.provider.opencode.note"},{match:i=>i==="opencode-go",key:"dialog.provider.opencodeGo.tagline"},{match:i=>i==="anthropic",key:"dialog.provider.anthropic.note"},{match:i=>i.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:i=>i==="openai",key:"dialog.provider.openai.note"},{match:i=>i==="google",key:"dialog.provider.google.note"},{match:i=>i==="openrouter",key:"dialog.provider.openrouter.note"},{match:i=>i==="vercel",key:"dialog.provider.vercel.note"}],tr=i=>e(Ce,{get children(){return e(rr,{get onBack(){return i.onBack}})}}),rr=i=>{const t=pe(),a=J(),c=ye(),v=at(),m=$e(),l=ot(()=>{}),_=_t({onBack:i.onBack}),y=h=>{_.select(h),t.show(()=>e(yt,{controller:_}))},k=z(()=>l.connected().filter(h=>h.id!=="opencode"||Object.values(h.models).find(u=>u.cost?.input))),P=z(()=>{const h=new Set(k().map(b=>b.id)),u=l.popular().filter(b=>!h.has(b.id)).slice();return u.sort((b,B)=>le.indexOf(b.id)-le.indexOf(B.id)),u}),T=h=>{if(!("source"in h))return;const u=h.source;if(u==="env"||u==="api"||u==="config"||u==="custom")return u},A=h=>{const u=T(h);return u==="env"?a.t("settings.providers.tag.environment"):u==="api"?a.t("provider.connect.method.apiKey"):u==="config"?L(h.id)?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.config"):u==="custom"?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.other")},N=h=>T(h)!=="env"&&(v()==="v1"||!L(h.id)),F=h=>er.find(u=>u.match(h))?.key,L=h=>{const u=m().data.config.provider?.[h];return!(!u||u.npm!=="@ai-sdk/openai-compatible"||!u.models||Object.keys(u.models).length===0)},O=async(h,u)=>{if(v()!=="v1")return;const b=m().data.config.disabled_providers??[],B=b.includes(h)?b:[...b,h];m().set("config","disabled_providers",B),await m().updateConfig({disabled_providers:B}).then(()=>{ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(R=>{m().set("config","disabled_providers",b);const Z=R instanceof Error?R.message:String(R);ne({title:a.t("common.requestFailed"),description:Z})})},U=async(h,u)=>{if(L(h)){await c().client.auth.remove({providerID:h}).catch(()=>{}),await O(h,u);return}await c().client.auth.remove({providerID:h}).then(async()=>{await c().client.global.dispose(),ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(b=>{const B=b instanceof Error?b.message:String(b);ne({title:a.t("common.requestFailed"),description:B})})};return(()=>{var h=Qt(),u=h.firstChild,b=u.firstChild,B=b.firstChild,R=u.nextSibling,Z=R.firstChild,ae=Z.firstChild,X=Z.nextSibling,ee=X.firstChild;return r(B,()=>a.t("settings.providers.title")),r(b,e(ke,{}),null),r(ae,()=>a.t("settings.providers.section.connected")),r(Z,e(E,{get children(){return e(w,{get when(){return k().length>0},get fallback(){return(()=>{var x=Ht();return r(x,()=>a.t("settings.providers.connected.empty")),x})()},get children(){return e(Y,{get each(){return k()},children:x=>(()=>{var D=Wt(),S=D.firstChild,I=S.firstChild;return r(S,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>x.name),r(S,e(re,{get children(){return A(x)}}),null),r(D,e(w,{get when(){return N(x)},get fallback(){return(()=>{var V=Xt();return r(V,()=>a.t("settings.providers.connected.environmentDescription")),V})()},get children(){return e(q,{size:"large",variant:"ghost",onClick:()=>void U(x.id,x.name),get children(){return a.t("common.disconnect")}})}}),null),D})()})}})}}),null),r(ee,()=>a.t("settings.providers.section.popular")),r(X,e(E,{get children(){return[e(Y,{get each(){return P()},children:x=>(()=>{var D=Yt(),S=D.firstChild,I=S.firstChild,V=I.firstChild;return r(I,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),V),r(V,()=>x.name),r(I,e(w,{get when(){return x.id==="opencode"},get children(){return e(re,{get children(){return a.t("dialog.provider.tag.recommended")}})}}),null),r(I,e(w,{get when(){return x.id==="opencode-go"},get children(){return e(re,{get children(){return a.t("dialog.provider.tag.recommended")}})}}),null),r(S,e(w,{get when(){return F(x.id)},children:oe=>(()=>{var Q=Jt();return r(Q,()=>a.t(oe())),Q})()}),null),r(D,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>y(x.id),get children(){return a.t("common.connect")}}),null),D})()}),e(w,{get when(){return v()==="v1"},get children(){var x=Ut(),D=x.firstChild,S=D.firstChild,I=S.firstChild,V=S.nextSibling;return r(S,e(ie,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>a.t("provider.custom.title")),r(S,e(re,{get children(){return a.t("settings.providers.tag.custom")}}),null),r(V,()=>a.t("settings.providers.custom.description")),r(x,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>e($t,{get onBack(){return t.close}}))},get children(){return a.t("common.connect")}}),null),x}})]}}),null),r(X,e(q,{variant:"ghost",class:"px-0 py-0 mt-5 text-14-medium text-text-interactive-base text-left justify-start hover:bg-transparent active:bg-transparent",onClick:()=>y(),get children(){return a.t("dialog.provider.viewAll")}}),null),h})()};var Pe=d('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),nr=d('<span class="text-14-regular text-text-strong mt-1">"<!>"'),sr=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-4 pt-6 pb-6 max-w-[720px]"><div class="flex items-center justify-between gap-4"><h2 class="text-16-medium text-text-strong"></h2></div><div class="flex items-center gap-2 px-3 h-9 rounded-lg bg-surface-base"></div></div></div><div class="flex flex-col gap-8 max-w-[720px]">'),ir=d('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),lr=d('<div class="flex flex-wrap items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><div class=min-w-0><span class="text-14-regular text-text-strong truncate block"></span></div><div class=flex-shrink-0>');const ar=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.label),t})(),or=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.message),r(t,e(w,{get when(){return i.filter},get children(){var c=nr(),v=c.firstChild,m=v.nextSibling;return m.nextSibling,r(c,()=>i.filter,m),c}}),null),t})(),cr=()=>e(Ce,{get children(){return e(gr,{})}}),gr=()=>{const i=J(),t=ct(),a=gt({items:c=>t.list(),key:c=>`${c.provider.id}:${c.id}`,filterKeys:["provider.name","name","id"],sortBy:(c,v)=>c.name.localeCompare(v.name),groupBy:c=>c.provider.id,sortGroupsBy:(c,v)=>{const m=le.indexOf(c.category),l=le.indexOf(v.category),_=m>=0,y=l>=0;if(_&&!y)return-1;if(!_&&y)return 1;if(_&&y)return m-l;const k=c.items[0].provider.name,P=v.items[0].provider.name;return k.localeCompare(P)}});return(()=>{var c=sr(),v=c.firstChild,m=v.firstChild,l=m.firstChild,_=l.firstChild,y=l.nextSibling,k=v.nextSibling;return r(_,()=>i.t("settings.models.title")),r(l,e(ke,{}),null),r(y,e(j,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),r(y,e(se,{variant:"ghost",type:"text",get value(){return a.filter()},get onChange(){return a.onInput},get placeholder(){return i.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),r(y,e(w,{get when(){return a.filter()},get children(){return e(dt,{icon:"circle-x",variant:"ghost",get onClick(){return a.clear}})}}),null),r(k,e(w,{get when(){return!a.grouped.loading},get fallback(){return e(ar,{get label(){return`${i.t("common.loading")}${i.t("common.loading.ellipsis")}`}})},get children(){return e(w,{get when(){return a.flat().length>0},get fallback(){return e(or,{get message(){return i.t("dialog.model.empty")},get filter(){return a.filter()}})},get children(){return e(Y,{get each(){return a.grouped.latest},children:P=>(()=>{var T=ir(),A=T.firstChild,N=A.firstChild;return r(A,e(ie,{get id(){return P.category},class:"size-5 shrink-0 icon-strong-base"}),N),r(N,()=>P.items[0].provider.name),r(T,e(E,{get children(){return e(Y,{get each(){return P.items},children:F=>{const L={providerID:F.provider.id,modelID:F.id};return(()=>{var O=lr(),U=O.firstChild,h=U.firstChild,u=U.nextSibling;return r(h,()=>F.name),r(u,e($,{get checked(){return t.visible(L)},onChange:b=>{t.setVisibility(L,b)},hideLabel:!0,get children(){return F.name}})),O})()}})}}),null),T})()})}})}})),c})()};var dr=d('<div class="flex flex-1 min-h-0 flex-col gap-4 pt-6"><div class="text-16-medium text-text-strong">'),ur=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="flex flex-col flex-1 min-h-0 max-w-[720px]">'),pr=d('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong">');const hr=()=>{const i=J(),t=ut();return(()=>{var a=ur(),c=a.firstChild;return r(c,e(w,{get when(){return t.isFormMode()},get fallback(){return[(()=>{var v=pr(),m=v.firstChild,l=m.firstChild;return r(l,()=>i.t("status.popover.tab.servers")),v})(),e(ht,{controller:t})]},get children(){var v=dr(),m=v.firstChild;return r(m,()=>t.formTitle()),r(v,e(pt,{controller:t}),null),v}})),a})()};var mr=d('<div class="flex flex-col justify-between h-full w-full gap-4"><div class="flex flex-col gap-3 w-full pt-3"><div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div></div></div><div class="flex flex-col gap-1 pl-1 py-1 text-12-medium text-text-weak"><span></span><span class=text-11-regular>v');const vr=i=>{const t=J(),a=_e(),c=pe(),[v,m]=mt(i.defaultValue??"general"),l=()=>{c.show(()=>e(vr,{defaultValue:"providers"}))};return e(ft,{size:"x-large",transition:!0,get children(){return e(C,{orientation:"vertical",variant:"settings",get value(){return v()},onChange:_=>void vt(()=>m(_)),class:"h-full settings-dialog",get children(){return[e(C.List,{get children(){var _=mr(),y=_.firstChild,k=y.firstChild,P=k.firstChild,T=P.firstChild,A=P.nextSibling,N=A.firstChild,F=y.nextSibling,L=F.firstChild,O=L.nextSibling;return O.firstChild,r(P,e(C.SectionTitle,{get children(){return t.t("settings.section.desktop")}}),T),r(T,e(C.Trigger,{value:"general",get children(){return[e(j,{name:"sliders"}),W(()=>t.t("settings.tab.general"))]}}),null),r(T,e(C.Trigger,{value:"shortcuts",get children(){return[e(j,{name:"keyboard"}),W(()=>t.t("settings.tab.shortcuts"))]}}),null),r(T,e(C.Trigger,{value:"servers",get children(){return[e(j,{name:"server"}),W(()=>t.t("status.popover.tab.servers"))]}}),null),r(A,e(C.SectionTitle,{get children(){return t.t("settings.section.server")}}),N),r(N,e(C.Trigger,{value:"providers",get children(){return[e(j,{name:"providers"}),W(()=>t.t("settings.providers.title"))]}}),null),r(N,e(C.Trigger,{value:"models",get children(){return[e(j,{name:"models"}),W(()=>t.t("settings.models.title"))]}}),null),r(L,()=>t.t("app.name.desktop")),r(O,()=>a.version,null),_}}),e(C.Content,{value:"general",class:"no-scrollbar",get children(){return e(Gt,{})}}),e(C.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return e(bt,{})}}),e(C.Content,{value:"servers",class:"no-scrollbar",get children(){return e(hr,{})}}),e(C.Content,{value:"providers",class:"no-scrollbar",get children(){return e(tr,{onBack:l})}}),e(C.Content,{value:"models",class:"no-scrollbar",get children(){return e(cr,{})}})]}})}})};export{vr as DialogSettings};
|
|
2
|
+
import{co as Oe,b_ as J,c5 as Ve,c6 as _e,bV as pe,c4 as je,ck as he,aD as z,aQ as Me,ch as $e,cg as ye,aI as ce,bm as Re,b6 as r,au as e,a2 as w,bL as d,af as Ze,a9 as Ke,B as q,T as K,ba as W,aa as se,bB as Ge,bC as qe,be as Ue,bf as Qe,bM as He,bN as We,bc as ge,ac as Xe,I as j,bD as Ye,bg as Je,bO as et,S as tt,bv as rt,bZ as me,l as G,Y as xe,V as te,Z as be,o as Y,$ as nt,a0 as st,y as it,Q as lt,cf as at,c9 as ot,bw as le,N as ie,a8 as re,bG as ne,c1 as ct,bX as gt,u as dt,ce as ut,W as pt,X as ht,aK as mt,a7 as C,bK as vt,b as ft}from"./index-BfNxi3ev.js";import{S as $}from"./switch-CVS6td1r.js";import{u as xt,a as E,S as bt}from"./settings-keybinds-BOa6QxJ6.js";import{L as wt,u as _t,a as $t,D as yt}from"./dialog-connect-provider-DLnpNUTc.js";import"./LROKH5N7-D8CK0ENS.js";import"./list-FiQEDby0.js";var St=d("<div data-action=settings-new-layout-designs>"),de=d('<div class="flex flex-col gap-1">'),Ct=d('<span class="flex items-center gap-2">'),kt=d("<div data-action=settings-auto-accept-permissions>"),Pt=d("<div data-action=settings-feed-reasoning-summaries>"),Tt=d("<div data-action=settings-feed-shell-tool-parts-expanded>"),Dt=d("<div data-action=settings-feed-edit-tool-parts-expanded>"),Ft=d("<div data-action=settings-show-file-tree>"),It=d("<div data-action=settings-show-navigation>"),zt=d("<div data-action=settings-show-search>"),Et=d("<div data-action=settings-show-status>"),At=d("<div data-action=settings-show-custom-agents>"),H=d('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ue=d('<div class="w-full sm:w-[220px]">'),Nt=d("<div data-action=settings-notifications-agent>"),Lt=d("<div data-action=settings-notifications-permissions>"),Bt=d("<div data-action=settings-notifications-errors>"),Ot=d("<div data-action=settings-release-notes>"),Vt=d("<div data-action=settings-pinch-zoom>"),jt=d("<div data-action=settings-wayland>"),Mt=d("<span class=text-text-weak>"),Rt=d('<div class="flex items-center gap-2"><span>'),Zt=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong"></h2></div></div><div class="flex flex-col gap-8 w-full">'),Kt=d('<div class="flex flex-wrap items-center gap-4 py-3 border-b border-border-weak-base last:border-none sm:flex-nowrap"><div class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div><div class="flex w-full justify-end sm:w-auto sm:shrink-0">');let M={cleanup:void 0,timeout:void 0,run:0};const Se=()=>{M.run+=1,M.cleanup&&M.cleanup(),clearTimeout(M.timeout),M.cleanup=void 0},we=i=>{if(Se(),!i)return;const t=++M.run;M.timeout=setTimeout(()=>{rt(i).then(a=>{if(M.run!==t){a?.();return}M.cleanup=a})},100)},Gt=()=>{const i=Oe(),t=J(),a=Ve(),c=_e(),v=pe(),m=je(),l=he(),_=xt(),y=z(()=>c.platform==="desktop"&&c.os==="linux"),k=z(()=>Me(m.dir)),P=z(()=>{const o=k();return o?m.id?a.isAutoAccepting(m.id,o):a.isAutoAcceptingDirectory(o):!1}),T=o=>{const s=k();if(s){if(!m.id){if(a.isAutoAcceptingDirectory(s)===o)return;a.toggleAutoAcceptDirectory(s);return}if(o){a.enableAutoAccept(m.id,s);return}a.disableAutoAccept(m.id,s)}},A=z(()=>c.platform==="desktop"),N=z(()=>i.ids().map(o=>({id:o,name:i.name(o)}))),F=$e(),L=ye(),[O]=ce(async()=>{const o=L();return await o.protocol==="v1"?(await o.client.pty.shells()).data??[]:[]},{initialValue:[]}),[U,{refetch:h}]=ce(()=>!!(y()&&c.getDisplayBackend),()=>Promise.resolve(c.getDisplayBackend?.()??null).catch(()=>null),{initialValue:null}),[u,{mutate:b}]=ce(()=>!!(A()&&c.getPinchZoomEnabled),()=>Promise.resolve(c.getPinchZoomEnabled?.()??!1).catch(()=>!1),{initialValue:!1});Re(()=>{i.loadThemes()});const B={id:"auto",value:"",label:t.t("settings.general.row.shell.autoDefault")},R=z(()=>F().data.config.shell??""),Z=z(()=>{const o=O.latest,s=F().data.config.shell,n=new Map;for(const g of o)n.set(g.name,(n.get(g.name)||0)+1);const p=[B,...o.map(g=>{const ve=(n.get(g.name)||0)>1,fe=ve?g.path:g.name,Be=g.acceptable?fe:`${fe} (${t.t("settings.general.row.shell.terminalOnly")})`;return{id:g.path,value:ve?g.path:g.name,label:Be}})];return s&&!p.some(g=>g.value===s)&&p.push({id:s,value:s,label:s}),p}),ae=o=>{const s=c.setDisplayBackend?.(o?"wayland":"auto");s&&s.finally(()=>{h()})},X=o=>{b(o);const s=c.setPinchZoomEnabled?.(o);s&&s.catch(()=>b(!o))},ee=z(()=>[{value:"system",label:t.t("theme.scheme.system")},{value:"light",label:t.t("theme.scheme.light")},{value:"dark",label:t.t("theme.scheme.dark")}]),x=z(()=>t.locales.map(o=>({value:o,label:t.label(o)}))),D={id:"none",label:"sound.option.none"},S=[D,...tt],I=()=>Je(l.appearance.font()),V=()=>Ye(l.appearance.uiFont()),oe=()=>et(l.appearance.terminalFont()),Q=(o,s,n,p)=>({options:S,current:o()?S.find(g=>g.id===s())??D:D,value:g=>g.id,label:g=>t.t(g.label),onHighlight:g=>{g&&we(g.id==="none"?void 0:g.id)},onSelect:g=>{if(g){if(g.id==="none"){n(!1),Se();return}n(!0),p(g.id),we(g.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),Te=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return(()=>{var s=Ct();return r(s,()=>t.t("settings.general.row.newInterface.title"),null),r(s,e(Ke,{variant:"accent",get children(){return t.t("settings.general.row.newInterface.badge")}}),null),s})()},get description(){return t.t("settings.general.row.newInterface.description")},get children(){var s=St();return r(s,e($,{get checked(){return l.general.newLayoutDesigns()},onChange:n=>{l.general.setNewLayoutDesigns(n),n&&Ze(()=>import("./index-wflYMX4p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(p=>{v.show(()=>e(p.DialogSettings,{}))})}})),s}})}})),o})(),De=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return t.t("settings.general.row.newInterfaceNotice.title")},get description(){return t.t("settings.general.row.newInterfaceNotice.description")},get children(){return e(q,{size:"small",variant:"ghost",get onClick(){return l.general.dismissNewInterfaceNotice},get children(){return t.t("settings.general.row.newInterfaceNotice.dismiss")}})}})}})),o})(),Fe=()=>(()=>{var o=de();return r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.language.title")},get description(){return t.t("settings.general.row.language.description")},get children(){return e(K,{"data-action":"settings-language",get options(){return x()},get current(){return x().find(s=>s.value===t.locale())},value:s=>s.value,label:s=>s.label,onSelect:s=>s&&t.setLocale(s.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("command.permissions.autoaccept.enable")},get description(){return t.t("toast.permissions.autoaccept.on.description")},get children(){var s=kt();return r(s,e($,{get checked(){return P()},get disabled(){return!k()},onChange:T})),s}}),e(f,{get title(){return t.t("settings.general.row.shell.title")},get description(){return t.t("settings.general.row.shell.description")},get children(){return e(K,{"data-action":"settings-shell",get options(){return Z()},get current(){return Z().find(s=>s.value===R())??B},value:s=>s.id,label:s=>s.label,onSelect:s=>{s&&s.value!==R()&&F().updateConfig({shell:s.value})},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"180px"}})}}),e(f,{get title(){return t.t("settings.general.row.reasoningSummaries.title")},get description(){return t.t("settings.general.row.reasoningSummaries.description")},get children(){var s=Pt();return r(s,e($,{get checked(){return l.general.showReasoningSummaries()},onChange:n=>l.general.setShowReasoningSummaries(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return t.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var s=Tt();return r(s,e($,{get checked(){return l.general.shellToolPartsExpanded()},onChange:n=>l.general.setShellToolPartsExpanded(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.editToolPartsExpanded.title")},get description(){return t.t("settings.general.row.editToolPartsExpanded.description")},get children(){var s=Dt();return r(s,e($,{get checked(){return l.general.editToolPartsExpanded()},onChange:n=>l.general.setEditToolPartsExpanded(n)})),s}})]}})),o})(),Ie=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.advanced")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.showFileTree.title")},get description(){return t.t("settings.general.row.showFileTree.description")},get children(){var n=Ft();return r(n,e($,{get checked(){return l.general.showFileTree()},onChange:p=>l.general.setShowFileTree(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showNavigation.title")},get description(){return t.t("settings.general.row.showNavigation.description")},get children(){var n=It();return r(n,e($,{get checked(){return l.general.showNavigation()},onChange:p=>l.general.setShowNavigation(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showSearch.title")},get description(){return t.t("settings.general.row.showSearch.description")},get children(){var n=zt();return r(n,e($,{get checked(){return l.general.showSearch()},onChange:p=>l.general.setShowSearch(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showStatus.title")},get description(){return t.t("settings.general.row.showStatus.description")},get children(){var n=Et();return r(n,e($,{get checked(){return l.general.showStatus()},onChange:p=>l.general.setShowStatus(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showCustomAgents.title")},get description(){return t.t("settings.general.row.showCustomAgents.description")},get children(){var n=At();return r(n,e($,{get checked(){return l.general.showCustomAgents()},onChange:p=>l.general.setShowCustomAgents(p)})),n}})]}}),null),o})(),ze=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.appearance")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.colorScheme.title")},get description(){return t.t("settings.general.row.colorScheme.description")},get children(){return e(K,{"data-action":"settings-color-scheme",get options(){return ee()},get current(){return ee().find(n=>n.value===i.colorScheme())},value:n=>n.value,label:n=>n.label,onSelect:n=>n&&i.setColorScheme(n.value),variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),e(f,{get title(){return t.t("settings.general.row.theme.title")},get description(){return[W(()=>t.t("settings.general.row.theme.description"))," ",e(wt,{href:"https://opencode.ai/docs/themes/",get children(){return t.t("common.learnMore")}})]},get children(){return e(K,{"data-action":"settings-theme",get options(){return N()},get current(){return N().find(n=>n.id===i.themeId())},value:n=>n.id,label:n=>n.name,onSelect:n=>{n&&i.setTheme(n.id)},variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("settings.general.row.uiFont.title")},get description(){return t.t("settings.general.row.uiFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-ui-font",get label(){return t.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return V()},onChange:p=>l.appearance.setUIFont(p),placeholder:Ge,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":qe(l.appearance.uiFont())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.font.title")},get description(){return t.t("settings.general.row.font.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-code-font",get label(){return t.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return I()},onChange:p=>l.appearance.setFont(p),placeholder:Ue,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Qe(l.appearance.font())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.terminalFont.title")},get description(){return t.t("settings.general.row.terminalFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-terminal-font",get label(){return t.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return oe()},onChange:p=>l.appearance.setTerminalFont(p),placeholder:He,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":We(l.appearance.terminalFont())}}})),n}})]}}),null),o})(),Ee=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.notifications")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.notifications.agent.title")},get description(){return t.t("settings.general.notifications.agent.description")},get children(){var n=Nt();return r(n,e($,{get checked(){return l.notifications.agent()},onChange:p=>l.notifications.setAgent(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.permissions.title")},get description(){return t.t("settings.general.notifications.permissions.description")},get children(){var n=Lt();return r(n,e($,{get checked(){return l.notifications.permissions()},onChange:p=>l.notifications.setPermissions(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.errors.title")},get description(){return t.t("settings.general.notifications.errors.description")},get children(){var n=Bt();return r(n,e($,{get checked(){return l.notifications.errors()},onChange:p=>l.notifications.setErrors(p)})),n}})]}}),null),o})(),Ae=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.sounds")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.sounds.agent.title")},get description(){return t.t("settings.general.sounds.agent.description")},get children(){return e(K,ge({"data-action":"settings-sounds-agent"},()=>Q(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),n=>l.sounds.setAgentEnabled(n),n=>l.sounds.setAgent(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.permissions.title")},get description(){return t.t("settings.general.sounds.permissions.description")},get children(){return e(K,ge({"data-action":"settings-sounds-permissions"},()=>Q(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),n=>l.sounds.setPermissionsEnabled(n),n=>l.sounds.setPermissions(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.errors.title")},get description(){return t.t("settings.general.sounds.errors.description")},get children(){return e(K,ge({"data-action":"settings-sounds-errors"},()=>Q(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),n=>l.sounds.setErrorsEnabled(n),n=>l.sounds.setErrors(n))))}})]}}),null),o})(),Ne=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.updates")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.releaseNotes.title")},get description(){return t.t("settings.general.row.releaseNotes.description")},get children(){var n=Ot();return r(n,e($,{get checked(){return l.general.releaseNotes()},onChange:p=>l.general.setReleaseNotes(p)})),n}}),e(f,{get title(){return t.t("settings.updates.row.check.title")},get description(){return t.t("settings.updates.row.check.description")},get children(){return e(q,{size:"small",variant:"secondary",get disabled(){return!_.action().run},get onClick(){return _.run},get children(){return t.t(_.action().label)}})}})]}}),null),o})(),Le=()=>e(w,{get when(){return A()},get children(){var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.display")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.pinchZoom.title")},get description(){return t.t("settings.general.row.pinchZoom.description")},get children(){var n=Vt();return r(n,e($,{get checked(){return u.latest},onChange:X})),n}}),e(w,{get when(){return y()},get children(){return e(f,{get title(){return(()=>{var n=Rt(),p=n.firstChild;return r(p,()=>t.t("settings.general.row.wayland.title")),r(n,e(Xe,{get value(){return t.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var g=Mt();return r(g,e(j,{name:"help",size:"small"})),g}}),null),n})()},get description(){return t.t("settings.general.row.wayland.description")},get children(){var n=jt();return r(n,e($,{get checked(){return U.latest==="wayland"},onChange:ae})),n}})}})]}}),null),o}});return(()=>{var o=Zt(),s=o.firstChild,n=s.firstChild,p=n.firstChild,g=s.nextSibling;return r(p,()=>t.t("settings.tab.general")),r(g,e(w,{get when(){return l.general.layoutTransitionAvailable()},get children(){return e(Te,{})}}),null),r(g,e(w,{get when(){return l.general.newInterfaceNoticeVisible()},get children(){return e(De,{})}}),null),r(g,e(Fe,{}),null),r(g,e(ze,{}),null),r(g,e(Ee,{}),null),r(g,e(Ae,{}),null),r(g,e(Ne,{}),null),r(g,e(Le,{}),null),r(g,e(w,{get when(){return A()},get children(){return e(Ie,{})}}),null),o})()},f=i=>(()=>{var t=Kt(),a=t.firstChild,c=a.firstChild,v=c.nextSibling,m=a.nextSibling;return r(c,()=>i.title),r(v,()=>i.description),r(m,()=>i.children),t})();function Ce(i){const t=me(),a=he();return e(w,{get when(){return a.general.newLayoutDesigns()},get fallback(){return i.children},get children(){return e(w,{get when(){return t.settings.server.selected()},children:c=>e(qt,{get server(){return c()},get children(){return i.children}})})}})}function qt(i){const t=me(),a=()=>t.ensureServerCtx(i.server);return e(lt,{get client(){return a().queryClient},get children(){return e(nt,{server:()=>i.server,get children(){return e(st,{get children(){return e(it,{get children(){return i.children}})}})}})}})}function ke(){const i=me(),t=he(),a=z(()=>t.general.newLayoutDesigns()?i.settings.server.selected():void 0);return e(w,{get when(){return a()},children:c=>e(G,{gutter:4,placement:"bottom-end",get children(){return[e(G.Trigger,{as:q,variant:"secondary",size:"large",class:"h-8 max-w-[260px] gap-2 px-2 py-1.5 data-[expanded]:bg-surface-base-active",get children(){return[e(xe,{get health(){return i.servers.health[te.key(c())]}}),e(be,{get conn(){return c()},get status(){return i.servers.health[te.key(c())]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"hidden"}),e(j,{name:"chevron-down",size:"small",class:"text-icon-weak shrink-0"})]}}),e(G.Portal,{get children(){return e(G.Content,{class:"w-[320px] mt-1 [&_[data-slot=dropdown-menu-radio-item]]:pl-2 [&_[data-slot=dropdown-menu-radio-item]]:pr-2",get children(){return e(G.RadioGroup,{get value(){return i.settings.server.key},onChange:v=>{typeof v=="string"&&i.settings.server.set(te.Key.make(v))},get children(){return e(Y,{get each(){return i.servers.list()},children:v=>{const m=te.key(v),l=()=>i.servers.health[m]?.healthy===!1;return e(G.RadioItem,{value:m,get disabled(){return l()},get children(){return[e(xe,{get health(){return i.servers.health[m]}}),e(be,{conn:v,get dimmed(){return l()},get status(){return i.servers.health[m]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"text-12-regular text-text-weak truncate"}),e(G.ItemIndicator,{get children(){return e(j,{name:"check-small",size:"small",class:"text-icon-weak"})}})]}})}})}})}})}})]}})})}var Ut=d('<div class="flex items-center justify-between gap-4 min-h-16 border-b border-border-weak-base last:border-none flex-wrap py-3"data-component=custom-provider-section><div class="flex flex-col min-w-0"><div class="flex flex-wrap items-center gap-x-3 gap-y-1"><span class="text-14-medium text-text-strong"></span></div><span class="text-12-regular text-text-weak pl-8">'),Qt=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex items-center justify-between gap-4 pt-6 pb-8 max-w-[720px]"><h2 class="text-16-medium text-text-strong"></h2></div></div><div class="flex flex-col gap-8 max-w-[720px]"><div class="flex flex-col gap-1"data-component=connected-providers-section><h3 class="text-14-medium text-text-strong pb-2"></h3></div><div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Ht=d('<div class="py-4 text-14-regular text-text-weak">'),Wt=d('<div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex items-center gap-3 min-w-0"><span class="text-14-medium text-text-strong truncate">'),Xt=d('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Yt=d('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex flex-col min-w-0"><div class="flex items-center gap-x-3"><span class="text-14-medium text-text-strong">'),Jt=d('<span class="text-12-regular text-text-weak pl-8">');const er=[{match:i=>i==="opencode",key:"dialog.provider.opencode.note"},,{match:i=>i==="anthropic",key:"dialog.provider.anthropic.note"},{match:i=>i.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:i=>i==="openai",key:"dialog.provider.openai.note"},{match:i=>i==="google",key:"dialog.provider.google.note"},{match:i=>i==="openrouter",key:"dialog.provider.openrouter.note"},{match:i=>i==="vercel",key:"dialog.provider.vercel.note"}],tr=i=>e(Ce,{get children(){return e(rr,{get onBack(){return i.onBack}})}}),rr=i=>{const t=pe(),a=J(),c=ye(),v=at(),m=$e(),l=ot(()=>{}),_=_t({onBack:i.onBack}),y=h=>{_.select(h),t.show(()=>e(yt,{controller:_}))},k=z(()=>l.connected().filter(h=>h.id!=="opencode"||Object.values(h.models).find(u=>u.cost?.input))),P=z(()=>{const h=new Set(k().map(b=>b.id)),u=l.popular().filter(b=>!h.has(b.id)).slice();return u.sort((b,B)=>le.indexOf(b.id)-le.indexOf(B.id)),u}),T=h=>{if(!("source"in h))return;const u=h.source;if(u==="env"||u==="api"||u==="config"||u==="custom")return u},A=h=>{const u=T(h);return u==="env"?a.t("settings.providers.tag.environment"):u==="api"?a.t("provider.connect.method.apiKey"):u==="config"?L(h.id)?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.config"):u==="custom"?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.other")},N=h=>T(h)!=="env"&&(v()==="v1"||!L(h.id)),F=h=>er.find(u=>u.match(h))?.key,L=h=>{const u=m().data.config.provider?.[h];return!(!u||u.npm!=="@ai-sdk/openai-compatible"||!u.models||Object.keys(u.models).length===0)},O=async(h,u)=>{if(v()!=="v1")return;const b=m().data.config.disabled_providers??[],B=b.includes(h)?b:[...b,h];m().set("config","disabled_providers",B),await m().updateConfig({disabled_providers:B}).then(()=>{ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(R=>{m().set("config","disabled_providers",b);const Z=R instanceof Error?R.message:String(R);ne({title:a.t("common.requestFailed"),description:Z})})},U=async(h,u)=>{if(L(h)){await c().client.auth.remove({providerID:h}).catch(()=>{}),await O(h,u);return}await c().client.auth.remove({providerID:h}).then(async()=>{await c().client.global.dispose(),ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(b=>{const B=b instanceof Error?b.message:String(b);ne({title:a.t("common.requestFailed"),description:B})})};return(()=>{var h=Qt(),u=h.firstChild,b=u.firstChild,B=b.firstChild,R=u.nextSibling,Z=R.firstChild,ae=Z.firstChild,X=Z.nextSibling,ee=X.firstChild;return r(B,()=>a.t("settings.providers.title")),r(b,e(ke,{}),null),r(ae,()=>a.t("settings.providers.section.connected")),r(Z,e(E,{get children(){return e(w,{get when(){return k().length>0},get fallback(){return(()=>{var x=Ht();return r(x,()=>a.t("settings.providers.connected.empty")),x})()},get children(){return e(Y,{get each(){return k()},children:x=>(()=>{var D=Wt(),S=D.firstChild,I=S.firstChild;return r(S,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>x.name),r(S,e(re,{get children(){return A(x)}}),null),r(D,e(w,{get when(){return N(x)},get fallback(){return(()=>{var V=Xt();return r(V,()=>a.t("settings.providers.connected.environmentDescription")),V})()},get children(){return e(q,{size:"large",variant:"ghost",onClick:()=>void U(x.id,x.name),get children(){return a.t("common.disconnect")}})}}),null),D})()})}})}}),null),r(ee,()=>a.t("settings.providers.section.popular")),r(X,e(E,{get children(){return[e(Y,{get each(){return P()},children:x=>(()=>{var D=Yt(),S=D.firstChild,I=S.firstChild,V=I.firstChild;return r(I,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),V),r(V,()=>x.name),r(I,e(w,{get when(){return x.id==="opencode"},get children(){return e(re,{get children(){return a.t("dialog.provider.tag.recommended")}})}}),null)),null),r(S,e(w,{get when(){return F(x.id)},children:oe=>(()=>{var Q=Jt();return r(Q,()=>a.t(oe())),Q})()}),null),r(D,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>y(x.id),get children(){return a.t("common.connect")}}),null),D})()}),e(w,{get when(){return v()==="v1"},get children(){var x=Ut(),D=x.firstChild,S=D.firstChild,I=S.firstChild,V=S.nextSibling;return r(S,e(ie,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>a.t("provider.custom.title")),r(S,e(re,{get children(){return a.t("settings.providers.tag.custom")}}),null),r(V,()=>a.t("settings.providers.custom.description")),r(x,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>e($t,{get onBack(){return t.close}}))},get children(){return a.t("common.connect")}}),null),x}})]}}),null),r(X,e(q,{variant:"ghost",class:"px-0 py-0 mt-5 text-14-medium text-text-interactive-base text-left justify-start hover:bg-transparent active:bg-transparent",onClick:()=>y(),get children(){return a.t("dialog.provider.viewAll")}}),null),h})()};var Pe=d('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),nr=d('<span class="text-14-regular text-text-strong mt-1">"<!>"'),sr=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-4 pt-6 pb-6 max-w-[720px]"><div class="flex items-center justify-between gap-4"><h2 class="text-16-medium text-text-strong"></h2></div><div class="flex items-center gap-2 px-3 h-9 rounded-lg bg-surface-base"></div></div></div><div class="flex flex-col gap-8 max-w-[720px]">'),ir=d('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),lr=d('<div class="flex flex-wrap items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><div class=min-w-0><span class="text-14-regular text-text-strong truncate block"></span></div><div class=flex-shrink-0>');const ar=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.label),t})(),or=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.message),r(t,e(w,{get when(){return i.filter},get children(){var c=nr(),v=c.firstChild,m=v.nextSibling;return m.nextSibling,r(c,()=>i.filter,m),c}}),null),t})(),cr=()=>e(Ce,{get children(){return e(gr,{})}}),gr=()=>{const i=J(),t=ct(),a=gt({items:c=>t.list(),key:c=>`${c.provider.id}:${c.id}`,filterKeys:["provider.name","name","id"],sortBy:(c,v)=>c.name.localeCompare(v.name),groupBy:c=>c.provider.id,sortGroupsBy:(c,v)=>{const m=le.indexOf(c.category),l=le.indexOf(v.category),_=m>=0,y=l>=0;if(_&&!y)return-1;if(!_&&y)return 1;if(_&&y)return m-l;const k=c.items[0].provider.name,P=v.items[0].provider.name;return k.localeCompare(P)}});return(()=>{var c=sr(),v=c.firstChild,m=v.firstChild,l=m.firstChild,_=l.firstChild,y=l.nextSibling,k=v.nextSibling;return r(_,()=>i.t("settings.models.title")),r(l,e(ke,{}),null),r(y,e(j,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),r(y,e(se,{variant:"ghost",type:"text",get value(){return a.filter()},get onChange(){return a.onInput},get placeholder(){return i.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),r(y,e(w,{get when(){return a.filter()},get children(){return e(dt,{icon:"circle-x",variant:"ghost",get onClick(){return a.clear}})}}),null),r(k,e(w,{get when(){return!a.grouped.loading},get fallback(){return e(ar,{get label(){return`${i.t("common.loading")}${i.t("common.loading.ellipsis")}`}})},get children(){return e(w,{get when(){return a.flat().length>0},get fallback(){return e(or,{get message(){return i.t("dialog.model.empty")},get filter(){return a.filter()}})},get children(){return e(Y,{get each(){return a.grouped.latest},children:P=>(()=>{var T=ir(),A=T.firstChild,N=A.firstChild;return r(A,e(ie,{get id(){return P.category},class:"size-5 shrink-0 icon-strong-base"}),N),r(N,()=>P.items[0].provider.name),r(T,e(E,{get children(){return e(Y,{get each(){return P.items},children:F=>{const L={providerID:F.provider.id,modelID:F.id};return(()=>{var O=lr(),U=O.firstChild,h=U.firstChild,u=U.nextSibling;return r(h,()=>F.name),r(u,e($,{get checked(){return t.visible(L)},onChange:b=>{t.setVisibility(L,b)},hideLabel:!0,get children(){return F.name}})),O})()}})}}),null),T})()})}})}})),c})()};var dr=d('<div class="flex flex-1 min-h-0 flex-col gap-4 pt-6"><div class="text-16-medium text-text-strong">'),ur=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="flex flex-col flex-1 min-h-0 max-w-[720px]">'),pr=d('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong">');const hr=()=>{const i=J(),t=ut();return(()=>{var a=ur(),c=a.firstChild;return r(c,e(w,{get when(){return t.isFormMode()},get fallback(){return[(()=>{var v=pr(),m=v.firstChild,l=m.firstChild;return r(l,()=>i.t("status.popover.tab.servers")),v})(),e(ht,{controller:t})]},get children(){var v=dr(),m=v.firstChild;return r(m,()=>t.formTitle()),r(v,e(pt,{controller:t}),null),v}})),a})()};var mr=d('<div class="flex flex-col justify-between h-full w-full gap-4"><div class="flex flex-col gap-3 w-full pt-3"><div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div></div></div><div class="flex flex-col gap-1 pl-1 py-1 text-12-medium text-text-weak"><span></span><span class=text-11-regular>v');const vr=i=>{const t=J(),a=_e(),c=pe(),[v,m]=mt(i.defaultValue??"general"),l=()=>{c.show(()=>e(vr,{defaultValue:"providers"}))};return e(ft,{size:"x-large",transition:!0,get children(){return e(C,{orientation:"vertical",variant:"settings",get value(){return v()},onChange:_=>void vt(()=>m(_)),class:"h-full settings-dialog",get children(){return[e(C.List,{get children(){var _=mr(),y=_.firstChild,k=y.firstChild,P=k.firstChild,T=P.firstChild,A=P.nextSibling,N=A.firstChild,F=y.nextSibling,L=F.firstChild,O=L.nextSibling;return O.firstChild,r(P,e(C.SectionTitle,{get children(){return t.t("settings.section.desktop")}}),T),r(T,e(C.Trigger,{value:"general",get children(){return[e(j,{name:"sliders"}),W(()=>t.t("settings.tab.general"))]}}),null),r(T,e(C.Trigger,{value:"shortcuts",get children(){return[e(j,{name:"keyboard"}),W(()=>t.t("settings.tab.shortcuts"))]}}),null),r(T,e(C.Trigger,{value:"servers",get children(){return[e(j,{name:"server"}),W(()=>t.t("status.popover.tab.servers"))]}}),null),r(A,e(C.SectionTitle,{get children(){return t.t("settings.section.server")}}),N),r(N,e(C.Trigger,{value:"providers",get children(){return[e(j,{name:"providers"}),W(()=>t.t("settings.providers.title"))]}}),null),r(N,e(C.Trigger,{value:"models",get children(){return[e(j,{name:"models"}),W(()=>t.t("settings.models.title"))]}}),null),r(L,()=>t.t("app.name.desktop")),r(O,()=>a.version,null),_}}),e(C.Content,{value:"general",class:"no-scrollbar",get children(){return e(Gt,{})}}),e(C.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return e(bt,{})}}),e(C.Content,{value:"servers",class:"no-scrollbar",get children(){return e(hr,{})}}),e(C.Content,{value:"providers",class:"no-scrollbar",get children(){return e(tr,{onBack:l})}}),e(C.Content,{value:"models",class:"no-scrollbar",get children(){return e(cr,{})}})]}})}})};export{vr as DialogSettings};
|
|
3
3
|
//# sourceMappingURL=dialog-settings-C0ClHN8Q.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-settings-C0ClHN8Q.js","assets/index-BfNxi3ev.js","assets/index-S3QimprQ.css","assets/switch-CVS6td1r.js","assets/LROKH5N7-D8CK0ENS.js","assets/settings-keybinds-BOa6QxJ6.js","assets/list-FiQEDby0.js","assets/dialog-connect-provider-DLnpNUTc.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{bI as Q,au as e,bc as Z,a6 as pe,b6 as i,bJ as ze,a2 as m,aH as ve,bF as qe,ap as it,bL as d,aR as we,a9 as ne,a as M,co as at,b_ as U,c5 as lt,c6 as ce,bV as ee,ck as ot,ch as $e,cg as We,aC as ct,aD as R,aI as Ie,bm as dt,af as gt,U as X,ba as T,ab as se,bB as ut,bC as vt,be as ht,bf as pt,bM as mt,bN as ft,bD as bt,bg as wt,bO as $t,S as _t,bv as yt,cf as St,c9 as Ct,bw as he,o as J,N as ue,bG as le,c1 as kt,bX as Dt,v as _e,t as ye,R as K,aY as Se,c2 as Ze,ax as xt,c as oe,f as It,h as Tt,k as Pt,d as Te,aj as Lt,e as Pe,cq as Ce,aL as Ue,bH as Et,x as E,V as Ke,Y as Ge,ce as At,bE as Le,_ as Rt,g as Ee,b$ as Ot,cn as Ft,aK as Vt,I as ae,bK as Mt}from"./index-BfNxi3ev.js";import{S as k,a as A}from"./row-DA4cIOhp.js";import{u as Bt,S as Nt}from"./settings-keybinds-BOa6QxJ6.js";import{L as jt,u as zt,a as qt,D as Wt}from"./dialog-connect-provider-DLnpNUTc.js";import{S as z}from"./list-FiQEDby0.js";import"./LROKH5N7-D8CK0ENS.js";var Zt=d('<span class="inline-flex items-center gap-2"data-slot=tabs-v2-trigger-content>'),Ut=d("<div data-slot=tabs-v2-trigger-wrapper>"),Kt=d('<span data-slot=tabs-v2-subtext class="ml-2 text-xs text-text-weak">'),Gt=d('<div role=button tabindex=0 aria-label="Close tab"data-slot=tabs-v2-close-button><svg width=14 height=14 viewBox="0 0 14 14"fill=none xmlns=http://www.w3.org/2000/svg><path d="M10.8889 3.11108L3.11108 10.8889"stroke=currentColor stroke-linejoin=round></path><path d="M3.11108 3.11108L10.8889 10.8889"stroke=currentColor stroke-linejoin=round>'),Ht=d("<div data-slot=tabs-v2-section-title>");function Yt(t){const[n,r]=Q(t,["class","classList","variant","orientation"]);return e(pe,Z(r,{get orientation(){return n.orientation},"data-component":"tabs-v2",get"data-variant"(){return n.variant||"normal"},get"data-orientation"(){return n.orientation||"horizontal"},get classList(){return{...n.classList,[n.class??""]:!!n.class}}}))}function Jt(t){const[n,r]=Q(t,["class","classList"]);return e(pe.List,Z(r,{"data-slot":"tabs-v2-list",get classList(){return{...n.classList,[n.class??""]:!!n.class}}}))}function Qt(t){const[n,r]=Q(t,["class","classList","children","onMiddleClick","subtext"]);return(()=>{var s=Ut();return s.addEventListener("auxclick",a=>{a.button===1&&n.onMiddleClick&&(a.preventDefault(),n.onMiddleClick())}),s.$$mousedown=a=>{a.button===1&&n.onMiddleClick&&a.preventDefault()},i(s,e(pe.Trigger,Z(r,{"data-slot":"tabs-v2-trigger",get"data-value"(){return t.value},get children(){var a=Zt();return i(a,()=>n.children,null),i(a,e(m,{get when(){return n.subtext},children:v=>(()=>{var l=Kt();return i(l,v),l})()}),null),a}}))),ve(a=>{var v=t.value,l={...n.classList,[n.class??""]:!!n.class};return v!==a.e&&qe(s,"data-value",a.e=v),a.t=it(s,l,a.t),a},{e:void 0,t:void 0}),s})()}function Xt(t){const[n,r]=Q(t,["class","classList","onClick"]);return(()=>{var s=Gt();return ze(s,Z(r,{get classList(){return{[n.class??""]:!!n.class,...n.classList}},onClick:a=>{a.preventDefault(),a.stopPropagation(),typeof n.onClick=="function"&&n.onClick(a)},onMouseDown:a=>{a.preventDefault(),a.stopPropagation()}}),!1,!0),s})()}function er(t){const[n,r]=Q(t,["class","classList","children"]);return e(pe.Content,Z(r,{"data-slot":"tabs-v2-content",get classList(){return{...n.classList,[n.class??""]:!!n.class}},get children(){return n.children}}))}const tr=t=>(()=>{var n=Ht();return i(n,()=>t.children),n})(),N=Object.assign(Yt,{List:Jt,Trigger:Qt,CloseButton:Xt,Content:er,SectionTitle:tr});we(["mousedown"]);var rr=d("<div data-action=settings-new-layout-designs>"),nr=d("<div class=settings-v2-section><div class=settings-v2-interface-feature>"),sr=d('<span class="flex items-center gap-2">'),ir=d("<div class=settings-v2-section>");function ar(t){return(()=>{var n=nr(),r=n.firstChild;return i(r,e(z,{get children(){return e(k,{get title(){return(()=>{var s=sr();return i(s,()=>t.title,null),i(s,e(ne,{variant:"accent",get children(){return t.badge}}),null),s})()},get description(){return t.description},get children(){var s=rr();return i(s,e(A,{get checked(){return t.checked},get onChange(){return t.onChange}})),s}})}})),n})()}function lr(t){return(()=>{var n=ir();return i(n,e(z,{get children(){return e(k,{get title(){return t.title},get description(){return t.description},get children(){return e(M,{size:"small",variant:"ghost-muted",get onClick(){return t.onDismiss},get children(){return t.dismiss}})}})}})),n})()}var or=d("<div data-action=settings-auto-accept-permissions>"),cr=d("<div data-action=settings-feed-reasoning-summaries>"),dr=d("<div data-action=settings-feed-shell-tool-parts-expanded>"),gr=d("<div data-action=settings-feed-edit-tool-parts-expanded>"),ur=d("<div data-action=settings-mobile-titlebar-bottom>"),vr=d("<div class=settings-v2-section>"),hr=d("<div data-action=settings-show-file-tree>"),pr=d("<div data-action=settings-show-search>"),mr=d("<div data-action=settings-show-status>"),fr=d("<div data-action=settings-show-custom-agents>"),te=d("<div class=settings-v2-section><h3 class=settings-v2-section-title>"),me=d('<div class="w-full sm:w-[220px]">'),br=d("<div data-action=settings-notifications-agent>"),wr=d("<div data-action=settings-notifications-permissions>"),$r=d("<div data-action=settings-notifications-errors>"),_r=d("<div data-action=settings-release-notes>"),yr=d("<div data-action=settings-pinch-zoom>"),Sr=d("<div class=settings-v2-tab-header><h2 class=settings-v2-tab-title>"),Cr=d("<div class=settings-v2-tab-body>");let G={cleanup:void 0,timeout:void 0,run:0};const He=()=>{G.run+=1,G.cleanup&&G.cleanup(),clearTimeout(G.timeout),G.cleanup=void 0},Ae=t=>{if(He(),!t)return;const n=++G.run;G.timeout=setTimeout(()=>{yt(t).then(r=>{if(G.run!==n){r?.();return}G.cleanup=r})},100)},kr=t=>{const n=at(),r=U(),s=lt(),a=ce(),v=ee(),l=ot(),g=$e(),f=We(),y=ct("(max-width: 767px)"),$=Bt(),p=R(()=>{if(t.sessionID)return g().session.lineage.peek(t.sessionID)?.session.directory}),b=R(()=>{const c=p();return!c||!t.sessionID?!1:s.isAutoAccepting(t.sessionID,c)}),S=c=>{const u=p();if(!(!u||!t.sessionID)){if(c){s.enableAutoAccept(t.sessionID,u);return}s.disableAutoAccept(t.sessionID,u)}},P=R(()=>a.platform==="desktop"),L=R(()=>n.ids().map(c=>({id:c,name:n.name(c)}))),[O]=Ie(async()=>{const c=f();return await c.protocol==="v1"?(await c.client.pty.shells()).data??[]:[]},{initialValue:[]}),[F,{mutate:w}]=Ie(()=>!!(P()&&a.getPinchZoomEnabled),()=>Promise.resolve(a.getPinchZoomEnabled?.()??!1).catch(()=>!1),{initialValue:!1});dt(()=>{n.loadThemes()});const h={id:"auto",value:"",label:r.t("settings.general.row.shell.autoDefault")},C=R(()=>g().data.config.shell??""),_=R(()=>{const c=O.latest,u=g().data.config.shell,o=new Map;for(const x of c)o.set(x.name,(o.get(x.name)||0)+1);const D=[h,...c.map(x=>{const De=(o.get(x.name)||0)>1,xe=De?x.path:x.name,st=x.acceptable?xe:`${xe} (${r.t("settings.general.row.shell.terminalOnly")})`;return{id:x.path,value:De?x.path:x.name,label:st}})];return u&&!D.some(x=>x.value===u)&&D.push({id:u,value:u,label:u}),D}),V=c=>{w(c);const u=a.setPinchZoomEnabled?.(c);u&&u.catch(()=>w(!c))},q=R(()=>[{value:"system",label:r.t("theme.scheme.system")},{value:"light",label:r.t("theme.scheme.light")},{value:"dark",label:r.t("theme.scheme.dark")}]),I=R(()=>r.locales.map(c=>({value:c,label:r.label(c)}))),B={id:"none",label:"sound.option.none"},W=[B,..._t],j=()=>wt(l.appearance.font()),H=()=>bt(l.appearance.uiFont()),Y=()=>$t(l.appearance.terminalFont()),ie=(c,u,o,D)=>({options:W,current:c()?W.find(x=>x.id===u())??B:B,value:x=>x.id,label:x=>r.t(x.label),onHighlight:x=>{x&&Ae(x.id==="none"?void 0:x.id)},onSelect:x=>{if(x){if(x.id==="none"){o(!1),He();return}o(!0),D(x.id),Ae(x.id)}}}),de=()=>e(ar,{get title(){return r.t("settings.general.row.newInterface.title")},get badge(){return r.t("settings.general.row.newInterface.badge")},get description(){return r.t("settings.general.row.newInterface.description")},get checked(){return l.general.newLayoutDesigns()},onChange:c=>{l.general.setNewLayoutDesigns(c),!c&>(()=>import("./dialog-settings-C0ClHN8Q.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(u=>{v.show(()=>e(u.DialogSettings,{}))})}}),Ye=()=>e(lr,{get title(){return r.t("settings.general.row.newInterfaceNotice.title")},get description(){return r.t("settings.general.row.newInterfaceNotice.description")},get dismiss(){return r.t("settings.general.row.newInterfaceNotice.dismiss")},get onDismiss(){return l.general.dismissNewInterfaceNotice}}),Je=()=>(()=>{var c=vr();return i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.language.title")},get description(){return r.t("settings.general.row.language.description")},get children(){return e(X,{appearance:"inline","data-action":"settings-language",get options(){return I()},placement:"bottom-end",gutter:6,get current(){return I().find(u=>u.value===r.locale())},value:u=>u.value,label:u=>u.label,onSelect:u=>u&&r.setLocale(u.value)})}}),e(k,{get title(){return r.t("command.permissions.autoaccept.enable")},get description(){return r.t("toast.permissions.autoaccept.on.description")},get children(){var u=or();return i(u,e(A,{get checked(){return b()},get disabled(){return!p()},onChange:S})),u}}),e(k,{get title(){return r.t("settings.general.row.shell.title")},get description(){return r.t("settings.general.row.shell.description")},get children(){return e(X,{appearance:"inline","data-action":"settings-shell",get options(){return _()},get current(){return _().find(u=>u.value===C())??h},placement:"bottom-end",gutter:6,value:u=>u.id,label:u=>u.label,onSelect:u=>{u&&u.value!==C()&&g().updateConfig({shell:u.value})}})}}),e(k,{get title(){return r.t("settings.general.row.reasoningSummaries.title")},get description(){return r.t("settings.general.row.reasoningSummaries.description")},get children(){var u=cr();return i(u,e(A,{get checked(){return l.general.showReasoningSummaries()},onChange:o=>l.general.setShowReasoningSummaries(o)})),u}}),e(k,{get title(){return r.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return r.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var u=dr();return i(u,e(A,{get checked(){return l.general.shellToolPartsExpanded()},onChange:o=>l.general.setShellToolPartsExpanded(o)})),u}}),e(k,{get title(){return r.t("settings.general.row.editToolPartsExpanded.title")},get description(){return r.t("settings.general.row.editToolPartsExpanded.description")},get children(){var u=gr();return i(u,e(A,{get checked(){return l.general.editToolPartsExpanded()},onChange:o=>l.general.setEditToolPartsExpanded(o)})),u}}),e(m,{get when(){return T(()=>!!y())()&&!0},get children(){return e(k,{get title(){return r.t("settings.general.row.mobileTitlebarBottom.title")},get description(){return r.t("settings.general.row.mobileTitlebarBottom.description")},get children(){var u=ur();return i(u,e(A,{get checked(){return l.general.mobileTitlebarPosition()==="bottom"},onChange:o=>l.general.setMobileTitlebarPosition(o?"bottom":"top")})),u}})}})]}})),c})(),Qe=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.advanced")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.showFileTree.title")},get description(){return r.t("settings.general.row.showFileTree.description")},get children(){var o=hr();return i(o,e(A,{get checked(){return l.general.showFileTree()},onChange:D=>l.general.setShowFileTree(D)})),o}}),e(k,{get title(){return r.t("settings.general.row.showSearch.title")},get description(){return r.t("settings.general.row.showSearch.description")},get children(){var o=pr();return i(o,e(A,{get checked(){return l.general.showSearch()},onChange:D=>l.general.setShowSearch(D)})),o}}),e(k,{get title(){return r.t("settings.general.row.showStatus.title")},get description(){return r.t("settings.general.row.showStatus.description")},get children(){var o=mr();return i(o,e(A,{get checked(){return l.general.showStatus()},onChange:D=>l.general.setShowStatus(D)})),o}}),e(k,{get title(){return r.t("settings.general.row.showCustomAgents.title")},get description(){return r.t("settings.general.row.showCustomAgents.description")},get children(){var o=fr();return i(o,e(A,{get checked(){return l.general.showCustomAgents()},onChange:D=>l.general.setShowCustomAgents(D)})),o}})]}}),null),c})(),Xe=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.appearance")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.colorScheme.title")},get description(){return r.t("settings.general.row.colorScheme.description")},get children(){return e(X,{appearance:"inline","data-action":"settings-color-scheme",get options(){return q()},get current(){return q().find(o=>o.value===n.colorScheme())},placement:"bottom-end",gutter:6,value:o=>o.value,label:o=>o.label,onSelect:o=>o&&n.setColorScheme(o.value)})}}),e(k,{get title(){return r.t("settings.general.row.theme.title")},get description(){return[T(()=>r.t("settings.general.row.theme.description"))," ",e(jt,{class:"settings-v2-link",href:"https://opencode.ai/docs/themes/",get children(){return r.t("common.learnMore")}})]},get children(){return e(X,{appearance:"inline","data-action":"settings-theme",get options(){return L()},get current(){return L().find(o=>o.id===n.themeId())},placement:"bottom-end",gutter:6,value:o=>o.id,label:o=>o.name,onSelect:o=>{o&&n.setTheme(o.id)}})}}),e(k,{get title(){return r.t("settings.general.row.uiFont.title")},get description(){return r.t("settings.general.row.uiFont.description")},get children(){var o=me();return i(o,e(se,{"data-action":"settings-ui-font",type:"text",appearance:"base",get value(){return H()},onInput:D=>l.appearance.setUIFont(D.currentTarget.value),placeholder:ut,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return r.t("settings.general.row.uiFont.title")},get style(){return{"font-family":vt(l.appearance.uiFont())}}})),o}}),e(k,{get title(){return r.t("settings.general.row.font.title")},get description(){return r.t("settings.general.row.font.description")},get children(){var o=me();return i(o,e(se,{"data-action":"settings-code-font",type:"text",appearance:"base",get value(){return j()},onInput:D=>l.appearance.setFont(D.currentTarget.value),placeholder:ht,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return r.t("settings.general.row.font.title")},get style(){return{"font-family":pt(l.appearance.font())}}})),o}}),e(k,{get title(){return r.t("settings.general.row.terminalFont.title")},get description(){return r.t("settings.general.row.terminalFont.description")},get children(){var o=me();return i(o,e(se,{"data-action":"settings-terminal-font",type:"text",appearance:"base",get value(){return Y()},onInput:D=>l.appearance.setTerminalFont(D.currentTarget.value),placeholder:mt,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return r.t("settings.general.row.terminalFont.title")},get style(){return{"font-family":ft(l.appearance.terminalFont())}}})),o}})]}}),null),c})(),et=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.notifications")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.notifications.agent.title")},get description(){return r.t("settings.general.notifications.agent.description")},get children(){var o=br();return i(o,e(A,{get checked(){return l.notifications.agent()},onChange:D=>l.notifications.setAgent(D)})),o}}),e(k,{get title(){return r.t("settings.general.notifications.permissions.title")},get description(){return r.t("settings.general.notifications.permissions.description")},get children(){var o=wr();return i(o,e(A,{get checked(){return l.notifications.permissions()},onChange:D=>l.notifications.setPermissions(D)})),o}}),e(k,{get title(){return r.t("settings.general.notifications.errors.title")},get description(){return r.t("settings.general.notifications.errors.description")},get children(){var o=$r();return i(o,e(A,{get checked(){return l.notifications.errors()},onChange:D=>l.notifications.setErrors(D)})),o}})]}}),null),c})(),tt=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.sounds")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.sounds.agent.title")},get description(){return r.t("settings.general.sounds.agent.description")},get children(){return e(X,Z({appearance:"inline","data-action":"settings-sounds-agent"},()=>ie(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),o=>l.sounds.setAgentEnabled(o),o=>l.sounds.setAgent(o)),{placement:"bottom-end",gutter:6}))}}),e(k,{get title(){return r.t("settings.general.sounds.permissions.title")},get description(){return r.t("settings.general.sounds.permissions.description")},get children(){return e(X,Z({appearance:"inline","data-action":"settings-sounds-permissions"},()=>ie(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),o=>l.sounds.setPermissionsEnabled(o),o=>l.sounds.setPermissions(o)),{placement:"bottom-end",gutter:6}))}}),e(k,{get title(){return r.t("settings.general.sounds.errors.title")},get description(){return r.t("settings.general.sounds.errors.description")},get children(){return e(X,Z({appearance:"inline","data-action":"settings-sounds-errors"},()=>ie(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),o=>l.sounds.setErrorsEnabled(o),o=>l.sounds.setErrors(o)),{placement:"bottom-end",gutter:6}))}})]}}),null),c})(),rt=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.updates")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.releaseNotes.title")},get description(){return r.t("settings.general.row.releaseNotes.description")},get children(){var o=_r();return i(o,e(A,{get checked(){return l.general.releaseNotes()},onChange:D=>l.general.setReleaseNotes(D)})),o}}),e(k,{get title(){return r.t("settings.updates.row.check.title")},get description(){return r.t("settings.updates.row.check.description")},get children(){return e(M,{size:"normal",variant:"neutral",get disabled(){return!$.action().run},get onClick(){return $.run},get children(){return r.t($.action().label)}})}})]}}),null),c})(),nt=()=>e(m,{get when(){return P()},get children(){var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.display")),i(c,e(z,{get children(){return e(k,{get title(){return r.t("settings.general.row.pinchZoom.title")},get description(){return r.t("settings.general.row.pinchZoom.description")},get children(){var o=yr();return i(o,e(A,{get checked(){return F.latest},onChange:V})),o}})}}),null),c}});return[(()=>{var c=Sr(),u=c.firstChild;return i(u,()=>r.t("settings.tab.general")),c})(),(()=>{var c=Cr();return i(c,e(m,{get when(){return l.general.layoutTransitionAvailable()},get children(){return e(de,{})}}),null),i(c,e(m,{get when(){return l.general.newInterfaceNoticeVisible()},get children(){return e(Ye,{})}}),null),i(c,e(Je,{}),null),i(c,e(Xe,{}),null),i(c,e(et,{}),null),i(c,e(tt,{}),null),i(c,e(m,{get when(){return P()},get children(){return e(rt,{})}}),null),i(c,e(nt,{}),null),i(c,e(Qe,{}),null),c})()]};var Dr=d("<div class=settings-v2-tab-header><h2 class=settings-v2-tab-title>"),xr=d("<div class=settings-v2-provider-row data-component=custom-provider-section><div class=settings-v2-provider-lead><div class=settings-v2-provider-copy><div class=settings-v2-provider-main><span class=settings-v2-provider-name></span></div><p class=settings-v2-provider-description>"),Ir=d('<div class="settings-v2-tab-body settings-v2-providers"><div class=settings-v2-section data-component=connected-providers-section><h3 class=settings-v2-section-title></h3></div><div class=settings-v2-section><h3 class=settings-v2-section-title></h3><button type=button class=settings-v2-providers-view-all>'),Tr=d("<div class=settings-v2-provider-empty>"),Pr=d('<div class="settings-v2-provider-row group"><div class=settings-v2-provider-lead><div class=settings-v2-provider-main><span class="settings-v2-provider-name truncate">'),Lr=d("<span class=settings-v2-provider-env-hint>"),Er=d("<div class=settings-v2-provider-row><div class=settings-v2-provider-lead><div class=settings-v2-provider-copy><div class=settings-v2-provider-main><span class=settings-v2-provider-name>"),Ar=d("<p class=settings-v2-provider-description>");const Rr=[{match:t=>t==="opencode",key:"dialog.provider.opencode.note"},{match:t=>t==="opencode-go",key:"dialog.provider.opencodeGo.tagline"},{match:t=>t==="anthropic",key:"dialog.provider.anthropic.note"},{match:t=>t.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:t=>t==="openai",key:"dialog.provider.openai.note"},{match:t=>t==="google",key:"dialog.provider.google.note"},{match:t=>t==="openrouter",key:"dialog.provider.openrouter.note"},{match:t=>t==="vercel",key:"dialog.provider.vercel.note"}],re=16,Or=t=>{const n=ee(),r=U(),s=We(),a=St(),v=$e(),l=Ct(t.directory),g=zt({onBack:t.onBack}),f=w=>{g.select(w),n.show(()=>e(Wt,{get directory(){return t.directory},controller:g}))},y=R(()=>l.connected().filter(w=>w.id!=="opencode"||Object.values(w.models).find(h=>h.cost?.input))),$=R(()=>{const w=new Set(y().map(C=>C.id)),h=l.popular().filter(C=>!w.has(C.id)).slice();return h.sort((C,_)=>he.indexOf(C.id)-he.indexOf(_.id)),h}),p=w=>{if(!("source"in w))return;const h=w.source;if(h==="env"||h==="api"||h==="config"||h==="custom")return h},b=w=>{const h=p(w);return h==="env"?r.t("settings.providers.tag.environment"):h==="api"?r.t("provider.connect.method.apiKey"):h==="config"?L(w.id)?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.config"):h==="custom"?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.other")},S=w=>p(w)!=="env"&&(a()==="v1"||!L(w.id)),P=w=>Rr.find(h=>h.match(w))?.key,L=w=>{const h=v().data.config.provider?.[w];return!(!h||h.npm!=="@ai-sdk/openai-compatible"||!h.models||Object.keys(h.models).length===0)},O=async(w,h)=>{if(a()!=="v1")return;const C=v().data.config.disabled_providers??[],_=C.includes(w)?C:[...C,w];v().set("config","disabled_providers",_),await v().updateConfig({disabled_providers:_}).then(()=>{le({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(V=>{v().set("config","disabled_providers",C);const q=V instanceof Error?V.message:String(V);le({title:r.t("common.requestFailed"),description:q})})},F=async(w,h)=>{if(L(w)){await s().client.auth.remove({providerID:w}).catch(()=>{}),await O(w,h);return}await s().client.auth.remove({providerID:w}).then(async()=>{await s().client.global.dispose(),le({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(C=>{const _=C instanceof Error?C.message:String(C);le({title:r.t("common.requestFailed"),description:_})})};return[(()=>{var w=Dr(),h=w.firstChild;return i(h,()=>r.t("settings.providers.title")),w})(),(()=>{var w=Ir(),h=w.firstChild,C=h.firstChild,_=h.nextSibling,V=_.firstChild,q=V.nextSibling;return i(C,()=>r.t("settings.providers.section.connected")),i(h,e(z,{get children(){return e(m,{get when(){return y().length>0},get fallback(){return(()=>{var I=Tr();return i(I,()=>r.t("settings.providers.connected.empty")),I})()},get children(){return e(J,{get each(){return y()},children:I=>(()=>{var B=Pr(),W=B.firstChild,j=W.firstChild,H=j.firstChild;return i(W,e(ue,{get id(){return I.id},width:re,height:re,class:"settings-v2-provider-icon shrink-0"}),j),i(H,()=>I.name),i(j,e(ne,{get children(){return b(I)}}),null),i(B,e(m,{get when(){return S(I)},get fallback(){return(()=>{var Y=Lr();return i(Y,()=>r.t("settings.providers.connected.environmentDescription")),Y})()},get children(){return e(M,{size:"normal",variant:"ghost-muted",onClick:()=>void F(I.id,I.name),get children(){return r.t("common.disconnect")}})}}),null),B})()})}})}}),null),i(V,()=>r.t("settings.providers.section.popular")),i(_,e(z,{get children(){return[e(J,{get each(){return $()},children:I=>(()=>{var B=Er(),W=B.firstChild,j=W.firstChild,H=j.firstChild,Y=H.firstChild;return i(W,e(ue,{get id(){return I.id},width:re,height:re,class:"settings-v2-provider-icon shrink-0"}),j),i(Y,()=>I.name),i(H,e(m,{get when(){return I.id==="opencode"||I.id==="opencode-go"},get children(){return e(ne,{get children(){return r.t("dialog.provider.tag.recommended")}})}}),null),i(j,e(m,{get when(){return P(I.id)},children:ie=>(()=>{var de=Ar();return i(de,()=>r.t(ie())),de})()}),null),i(B,e(M,{size:"normal",variant:"neutral",icon:"plus",onClick:()=>f(I.id),get children(){return r.t("common.connect")}}),null),B})()}),e(m,{get when(){return a()==="v1"},get children(){var I=xr(),B=I.firstChild,W=B.firstChild,j=W.firstChild,H=j.firstChild,Y=j.nextSibling;return i(B,e(ue,{id:"synthetic",width:re,height:re,class:"settings-v2-provider-icon shrink-0"}),W),i(H,()=>r.t("provider.custom.title")),i(j,e(ne,{get children(){return r.t("settings.providers.tag.custom")}}),null),i(Y,()=>r.t("settings.providers.custom.description")),i(I,e(M,{size:"normal",variant:"neutral",icon:"plus",onClick:()=>{n.show(()=>e(qt,{get onBack(){return n.close}}))},get children(){return r.t("common.connect")}}),null),I}})]}}),q),q.$$click=()=>f(),i(q,()=>r.t("dialog.provider.viewAll")),w})()]};we(["click"]);var Fr=d('<div class="settings-v2-tab-header settings-v2-tab-header--stacked"><h2 class=settings-v2-tab-title></h2><div class=settings-v2-tab-search>'),Vr=d('<div class="settings-v2-tab-body settings-v2-models">'),Mr=d("<div class=settings-v2-models-status>"),Br=d("<span class=settings-v2-models-status-filter>"<!>""),Nr=d("<div class=settings-v2-models-status><span>"),jr=d("<div class=settings-v2-section data-component=settings-models-provider><div class=settings-v2-models-group-header><h3 class=settings-v2-section-title>"),zr=d("<div>");const Re=16,qr=()=>{const t=U(),n=kt(),r=Dt({items:s=>n.list(),key:s=>`${s.provider.id}:${s.id}`,filterKeys:["provider.name","name","id"],sortBy:(s,a)=>s.name.localeCompare(a.name),groupBy:s=>s.provider.id,sortGroupsBy:(s,a)=>{const v=he.indexOf(s.category),l=he.indexOf(a.category),g=v>=0,f=l>=0;if(g&&!f)return-1;if(!g&&f)return 1;if(g&&f)return v-l;const y=s.items[0].provider.name,$=a.items[0].provider.name;return y.localeCompare($)}});return[(()=>{var s=Fr(),a=s.firstChild,v=a.nextSibling;return i(a,()=>t.t("settings.models.title")),i(v,e(se,{type:"search",appearance:"base",get value(){return r.filter()},onInput:l=>r.onInput(l.currentTarget.value),get placeholder(){return t.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return t.t("dialog.model.search.placeholder")}}),null),i(v,e(m,{get when(){return r.filter()},get children(){return e(_e,{type:"button",variant:"ghost-muted",size:"small",class:"settings-v2-tab-search-clear",get icon(){return e(ye,{name:"close",size:"large",class:"text-v2-icon-icon-muted"})},onClick:()=>r.clear()})}}),null),s})(),(()=>{var s=Vr();return i(s,e(m,{get when(){return!r.grouped.loading},get fallback(){return(()=>{var a=Mr();return i(a,()=>t.t("common.loading"),null),i(a,()=>t.t("common.loading.ellipsis"),null),a})()},get children(){return e(m,{get when(){return r.flat().length>0},get fallback(){return(()=>{var a=Nr(),v=a.firstChild;return i(v,()=>t.t("dialog.model.empty")),i(a,e(m,{get when(){return r.filter()},get children(){var l=Br(),g=l.firstChild,f=g.nextSibling;return f.nextSibling,i(l,()=>r.filter(),f),l}}),null),a})()},get children(){return e(J,{get each(){return r.grouped.latest},children:a=>(()=>{var v=jr(),l=v.firstChild,g=l.firstChild;return i(l,e(ue,{get id(){return a.category},width:Re,height:Re,class:"settings-v2-models-provider-icon shrink-0"}),g),i(g,()=>a.items[0].provider.name),i(v,e(z,{get children(){return e(J,{get each(){return a.items},children:f=>{const y={providerID:f.provider.id,modelID:f.id};return e(k,{get title(){return f.name},description:"",get children(){var $=zr();return i($,e(A,{get checked(){return n.visible(y)},onChange:p=>{n.setVisibility(y,p)},hideLabel:!0,get children(){return f.name}})),$}})}})}}),null),v})()})}})}})),s})()]};var Wr=d('<svg><circle cx=8 cy=8 r=6 data-slot=loader-v2-background stroke-width=2></circle><circle cx=8 cy=8 r=6 data-slot=loader-v2-progress pathLength=100 stroke-width=2 stroke-dasharray="33 67">');function ge(t){const[n,r]=Q(t,["class","classList","width","height"]);return(()=>{var s=Wr();return ze(s,Z(r,{get class(){return n.class},get classList(){return n.classList},get width(){return n.width??16},get height(){return n.height??16},viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-component":"loader-v2",get"aria-hidden"(){return r["aria-hidden"]??"true"}}),!0,!0),s})()}var Zr=d("<div data-slot=radio-v2-items>"),Ur=d("<div data-slot=radio-v2-item-control-stack>"),Kr=d("<div data-slot=radio-v2-item-text><span data-slot=radio-v2-item-label-text>"),Gr=d("<span data-slot=radio-v2-item-description>");function Oe(t){const[n,r]=Q(t,["class","classList","children","label","description","hideLabel"]);return e(K,Z(r,{"data-component":"radio-v2",get classList(){return{...n.classList,[n.class??""]:!!n.class}},get children(){return[e(m,{get when(){return n.label},children:s=>e(K.Label,{"data-slot":"radio-v2-label",get classList(){return{"sr-only":n.hideLabel}},get children(){return s()}})}),e(m,{get when(){return n.description},children:s=>e(K.Description,{"data-slot":"radio-v2-description",get children(){return s()}})}),(()=>{var s=Zr();return i(s,()=>n.children),s})(),e(K.ErrorMessage,{"data-slot":"radio-v2-error"})]}}))}function Fe(t){const[n,r]=Q(t,["class","classList","label","description","hideLabel"]);return e(K.Item,Z(r,{"data-slot":"radio-v2-item",get classList(){return{...n.classList,[n.class??""]:!!n.class}},get children(){return[e(K.ItemInput,{"data-slot":"radio-v2-item-input"}),(()=>{var s=Ur();return i(s,e(K.ItemControl,{"data-slot":"radio-v2-item-control",get children(){return e(K.ItemIndicator,{"data-slot":"radio-v2-item-indicator"})}})),s})(),e(K.ItemLabel,{"data-slot":"radio-v2-item-label",get classList(){return{"sr-only":n.hideLabel}},get children(){var s=Kr(),a=s.firstChild;return i(a,()=>n.label),i(s,e(m,{get when(){return n.description},children:v=>(()=>{var l=Gr();return i(l,v),l})()}),null),s}})]}}))}function Ve(t){return/^docker-desktop(?:-data)?$/i.test(t)}const Hr=t=>t.kind==="failed"||t.kind==="stopped";function Yr(t){if(t){if(!t.resolvedPath)return"Install midsomar";if(t.matchesDesktop===!1)return"Update midsomar"}}function ke(t,n){const r=t?.installed.find(a=>a.name===n),s=t?.distroProbes[n];return!s||!r||r.version===1?!1:s.canExecute&&s.hasBash&&s.hasCurl}function Jr(t){const n=t.state,r=(n?.installed??[]).filter(b=>!Ve(b.name)),s=(n?.online??[]).filter(b=>!Ve(b.name)),a=new Set((n?.servers??[]).map(b=>b.config.distro)),v=r.filter(b=>!a.has(b.name)),l=Qr(t.selectedDistro,r,v),g=l?n?.opencodeChecks[l]??null:null,f=sn(r,s),y=an(f,t.catalogSearch),$=ln(t.catalogTarget,y);return{busy:!!n?.job||t.adding||t.probingAddable,runtimeState:Xr(n),visibleInstalledDistros:r,visibleOnlineDistros:s,addableInstalledDistros:v,selectedDistro:l,opencodeCheck:g,wslReady:!!n?.runtime?.available&&!n?.pendingRestart,distroStatuses:Object.fromEntries(v.flatMap(b=>{const S=en({state:n,name:b.name,probingAddable:t.probingAddable});return S?[[b.name,S]]:[]})),primaryButton:tn({state:n,selectedDistro:l,opencodeCheck:g,adding:t.adding,probingAddable:t.probingAddable}),installableDistros:f,filteredInstallableDistros:y,catalogTarget:$,installingCatalogDistro:n?.job?.kind==="install-distro"}}function Qr(t,n,r){if(t&&r.some(a=>a.name===t&&a.version!==1))return t;const s=n.find(a=>a.isDefault);return s&&s.version!==1&&r.some(a=>a.name===s.name)?s.name:r.find(a=>a.version!==1)?.name??null}function Xr(t){return t?t.pendingRestart?"pendingRestart":t.runtime?t.runtime.available?"ready":"unavailable":"checking":"loading"}function en(t){const n=t.state?.installed.find(v=>v.name===t.name);if(n?.version===1)return{label:{key:"wsl.onboarding.distroStatus.unsupported"},tone:"muted"};const r=t.state?.job,s=t.state?.distroProbes[t.name];if(!s)return t.probingAddable||r?.kind==="probe-addable"&&r.distros.includes(t.name)?Me():void 0;if(!s.canExecute)return n?{label:{key:"wsl.onboarding.openDistroOnce",params:{distro:t.name}},tone:"warning"}:{label:{key:"wsl.onboarding.distroNotInstalled",params:{distro:t.name}},tone:"warning"};if(!s.hasBash||!s.hasCurl)return{label:{key:"wsl.onboarding.distroStatus.missingTools"},tone:"warning"};const a=t.state?.opencodeChecks[t.name];return a?a.matchesDesktop===!1?{label:{key:"wsl.onboarding.updateOpencode"},tone:"warning"}:a.resolvedPath?a.error?{label:{key:"wsl.onboarding.installOpencode"},tone:"warning"}:{label:{key:"wsl.onboarding.distroStatus.ready"},tone:"success"}:{label:{key:"wsl.onboarding.distroStatus.opencodeMissing"},tone:"warning"}:t.probingAddable||r?.kind==="probe-addable"&&r.distros.includes(t.name)?Me():void 0}function Me(){return{label:{key:"wsl.onboarding.distroStatus.checking"},tone:"muted"}}function tn(t){const n=!!t.selectedDistro&&ke(t.state,t.selectedDistro),r=t.probingAddable&&!nn(t.state,t.selectedDistro),s=r||n&&(!t.opencodeCheck||!!t.selectedDistro&&t.state?.job?.kind==="probe-addable"&&t.state.job.distros.includes(t.selectedDistro)),a=t.state?.job?.kind==="install-opencode"&&t.state.job.distro===t.selectedDistro;if(!n||s)return{variant:"contrast",label:r?{key:"wsl.onboarding.distroStatus.checking"}:{key:"wsl.server.add"},disabled:!0,action:null,loading:r,width:null};if(!rn(t.opencodeCheck)){const v=!!t.opencodeCheck?.resolvedPath&&t.opencodeCheck.matchesDesktop===!1;return{variant:"neutral",label:a?{key:"wsl.onboarding.updatingOpencode"}:v?{key:"wsl.onboarding.updateOpencode"}:{key:"wsl.onboarding.installOpencode"},disabled:!!t.state?.job||t.adding,action:"install-opencode",loading:a,width:v?"138px":"129px"}}return{variant:"contrast",label:t.adding?{key:"wsl.onboarding.adding"}:{key:"wsl.server.add"},disabled:t.adding||!!t.state?.job,action:"add",loading:t.adding,width:null}}function rn(t){return!!t?.resolvedPath&&t.matchesDesktop!==!1&&!t.error}function nn(t,n){return!n||t?.installed.find(s=>s.name===n)?.version===1||!t?.distroProbes[n]?!1:ke(t,n)?!!t.opencodeChecks[n]:!0}function sn(t,n){const r=new Set(t.map(a=>a.name)),s=n.some(a=>/^Ubuntu-\d/.test(a.name));return n.filter(a=>!r.has(a.name)).filter(a=>a.name!=="Ubuntu"||!s)}function an(t,n){const r=n.trim();return r?Se.go(r,t,{keys:["label","name"]}).map(s=>s.obj):t}function ln(t,n){return t&&n.some(r=>r.name===t)?t:n[0]?.name??null}function on(t){const n=t.state;if(!n?.runtime?.available||n.pendingRestart||t.view!=="main"||t.adding||n.job)return;const r=t.selectedDistro?[...t.addableInstalledDistros.filter(a=>a.name===t.selectedDistro),...t.addableInstalledDistros.filter(a=>a.name!==t.selectedDistro)]:t.addableInstalledDistros,s=r.flatMap(a=>a.version===1?[]:n.distroProbes[a.name]?ke(n,a.name)&&!n.opencodeChecks[a.name]?[`opencode:${a.name}`]:[]:[`distro:${a.name}`]);if(s.length)return{key:s.join("|"),distros:r.filter(a=>a.version!==1).map(a=>a.name)}}function cn(t){if(!(!t.state||t.busy||t.state.pendingRestart)){if(!t.state.runtime)return{key:"runtime",action:"probeRuntime"};if(t.state.runtime.available&&!(t.state.installed.length||t.state.online.length))return{key:"distros",action:"refreshDistros"}}}function dn(t){const n=cn({state:t.state,busy:t.busy});if(n)return{kind:"auto",key:`auto:${n.key}`,plan:n};const r=on(t);if(r)return{kind:"addable",key:`addable:${r.key}`,plan:r}}function gn(){let t;return{accepts(n){return n!==t},settle(n,r){r&&(t=n)},reset(){t=void 0}}}async function un(t){await t.api.probeAddable(t.plan.distros)}function vn(t){const n=gn(),r=Ze(()=>({mutationFn:async s=>{if(s.kind==="addable"){await un({plan:s.plan,api:t.api});return}s.plan.action==="probeRuntime"&&await t.api.probeRuntime(),s.plan.action==="refreshDistros"&&await t.api.refreshDistros()},onError:t.onError,onSettled:(s,a,v)=>{v&&n.settle(v.key,a)}}));return xt(()=>{if(r.isPending)return;const s=dn({state:t.state(),view:t.view(),adding:t.adding(),busy:t.busy(),selectedDistro:t.selectedDistro(),addableInstalledDistros:t.addableInstalledDistros()});!s||!n.accepts(s.key)||r.mutate(s)}),{probingAddable:()=>r.isPending&&r.variables?.kind==="addable",resetProbeFailure:()=>n.reset()}}var hn=d("<div class=settings-v2-wsl-section-header><span class=settings-v2-wsl-section-title>"),pn=d("<div class=settings-v2-wsl-distro-list>"),mn=d('<button type=button class=settings-v2-wsl-catalog-card><span class=settings-v2-wsl-catalog-icon aria-hidden=true><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M13.5564 10.4443V13.5554H4.22309C3.24087 13.5554 2.44531 13.5554 2.44531 13.5554V10.4443M11.112 5.99989L8.00087 9.111L4.88976 5.99989M8.00087 9.111L8.00087 2.44434"stroke=currentColor></path></svg></span><span class=settings-v2-wsl-catalog-copy><span class=settings-v2-wsl-catalog-title></span><span class=settings-v2-wsl-catalog-description></span></span><span class=settings-v2-wsl-catalog-chevron aria-hidden=true><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M6 12L10 8L6 4"stroke=currentColor>'),fe=d("<div class=settings-v2-wsl-loading>"),fn=d("<div class=settings-v2-wsl-catalog-list>"),Be=d("<span class=settings-v2-wsl-distro-label>"),bn=d("<div class=settings-v2-wsl-distro-list><div class=settings-v2-wsl-distro-empty>"),wn=d("<span class=settings-v2-wsl-distro-status>"),$n=d("<p class=settings-v2-wsl-unavailable-error>"),_n=d('<div class=settings-v2-wsl-not-installed-content><div class=settings-v2-wsl-not-installed-message><svg class=settings-v2-wsl-not-installed-icon width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg aria-hidden=true><g clip-path=url(#settings-v2-wsl-warning-clip)><path fill-rule=evenodd clip-rule=evenodd d="M12 -0.00244141L23.6926 20.2498H0.308594L12 -0.00244141ZM12.7954 6.32932C12.5844 6.11834 12.2982 5.99982 11.9999 5.99982C11.7015 5.99982 11.4154 6.11834 11.2044 6.32932C10.9934 6.5403 10.8749 6.82645 10.8749 7.12482V11.6248C10.8749 11.9232 10.9934 12.2093 11.2044 12.4203C11.4154 12.6313 11.7015 12.7498 11.9999 12.7498C12.2982 12.7498 12.5844 12.6313 12.7954 12.4203C13.0064 12.2093 13.1249 11.9232 13.1249 11.6248V7.12482C13.1249 6.82645 13.0064 6.5403 12.7954 6.32932ZM13.0605 17.5605C12.7792 17.8418 12.3977 17.9998 11.9999 17.9998C11.6021 17.9998 11.2205 17.8418 10.9392 17.5605C10.6579 17.2792 10.4999 16.8976 10.4999 16.4998C10.4999 16.102 10.6579 15.7205 10.9392 15.4392C11.2205 15.1579 11.6021 14.9998 11.9999 14.9998C12.3977 14.9998 12.7792 15.1579 13.0605 15.4392C13.3418 15.7205 13.4999 16.102 13.4999 16.4998C13.4999 16.8976 13.3418 17.2792 13.0605 17.5605Z"fill=#DBDBDB></path></g><defs><clipPath id=settings-v2-wsl-warning-clip><rect width=24 height=24 fill=white></rect></clipPath></defs></svg><h2 class=settings-v2-wsl-not-installed-title></h2><p class=settings-v2-wsl-not-installed-description>');function yn(t){return t?/WSL is not installed|not been installed|wsl(?:\.exe)? --install/i.test(t):!0}function Ne(t,n){return n.params?t.t(n.key,n.params):t.t(n.key)}function Sn(t={}){const n=U(),r=Cn(t),s=r.model,a=()=>s().primaryButton,v=()=>{const l=a().width;if(l)return{width:l}};return e(m,{get when(){return T(()=>!r.wslServers.isPending)()&&!r.wslServers.isError},get fallback(){return e(oe,{fit:!0,class:"settings-v2-wsl-dialog",get children(){return e(m,{get when(){return!r.wslServers.isError},get fallback(){return(()=>{var l=fe();return i(l,()=>r.loadError()),l})()},get children(){var l=fe();return i(l,e(ge,{})),l}})}})},get children(){return e(m,{get when(){return s().runtimeState==="ready"},get fallback(){return e(m,{get when(){return s().runtimeState==="checking"||s().runtimeState==="loading"},get fallback(){return e(kn,{get state(){return s().runtimeState},get error(){return r.runtimeError()},get installable(){return yn(r.runtimeError())},get busy(){return s().busy},get onInstall(){return r.installWsl}})},get children(){return e(oe,{fit:!0,class:"settings-v2-wsl-dialog",get children(){var l=fe();return i(l,e(ge,{})),l}})}})},get children(){return e(oe,{fit:!0,class:"settings-v2-wsl-dialog",get children(){return[e(It,{hideClose:!0,get children(){return e(Tt,{get children(){return T(()=>r.view()==="main")()?n.t("wsl.server.add"):n.t("wsl.onboarding.installDistro")}})}}),e(Pt,{}),e(m,{get when(){return r.view()==="main"},get fallback(){return[e(Te,{class:"settings-v2-wsl-dialog-body settings-v2-wsl-catalog-picker",get children(){return[e(se,{class:"settings-v2-wsl-catalog-search",appearance:"large",get placeholder(){return n.t("wsl.onboarding.searchDistros")},get value(){return r.catalogSearch()},get disabled(){return s().busy},onInput:l=>r.setCatalogSearch(l.currentTarget.value)}),(()=>{var l=fn();return i(l,e(Oe,{hideLabel:!0,class:"settings-v2-wsl-distro-group",get label(){return n.t("wsl.onboarding.installDistro")},get value(){return s().catalogTarget??void 0},get onChange(){return r.setCatalogTarget},get disabled(){return s().busy},get children(){return e(J,{get each(){return s().filteredInstallableDistros},children:g=>e(Fe,{class:"settings-v2-wsl-distro-row settings-v2-wsl-catalog-row",get value(){return g.name},get disabled(){return s().busy},get label(){return(()=>{var f=Be();return i(f,()=>g.label),f})()}})})}})),l})()]}}),e(Pe,{get children(){return[e(M,{variant:"neutral",get disabled(){return s().busy},get onClick(){return r.closeCatalog},get children(){return n.t("common.cancel")}}),e(M,{get variant(){return s().installingCatalogDistro?"loading":"contrast"},get disabled(){return T(()=>!s().installingCatalogDistro)()&&(s().busy||!s().catalogTarget)},style:{width:"99px"},get onClick(){return r.installCatalogDistro},get children(){return e(m,{get when(){return s().installingCatalogDistro},get fallback(){return n.t("wsl.onboarding.installDistro")},get children(){return e(ge,{})}})}})]}})]},get children(){return[e(Te,{class:"settings-v2-wsl-dialog-body",get children(){return[(()=>{var l=hn(),g=l.firstChild;return i(g,()=>n.t("wsl.onboarding.installedDistros")),i(l,e(M,{variant:"ghost-muted",size:"small",get disabled(){return s().busy},get onClick(){return r.refreshDistros},get children(){return n.t("wsl.onboarding.checkAgain")}}),null),l})(),e(m,{get when(){return s().addableInstalledDistros.length>0},get fallback(){return(()=>{var l=bn(),g=l.firstChild;return i(g,(()=>{var f=T(()=>!!s().visibleInstalledDistros.length);return()=>f()?n.t("wsl.onboarding.allDistrosAdded"):n.t("wsl.onboarding.noDistros")})()),l})()},get children(){var l=pn();return i(l,e(Oe,{hideLabel:!0,class:"settings-v2-wsl-distro-group",get label(){return n.t("wsl.onboarding.installedDistros")},get value(){return s().selectedDistro??void 0},get onChange(){return r.setSelectedDistro},get disabled(){return s().busy},get children(){return e(J,{get each(){return s().addableInstalledDistros},children:g=>{const f=()=>s().distroStatuses[g.name]??null;return e(Fe,{get class(){return`settings-v2-wsl-distro-row${g.version===1?" settings-v2-wsl-distro-row--unsupported":""}`},get value(){return g.name},get disabled(){return g.version===1||s().busy},get label(){return(()=>{var y=Be();return i(y,()=>g.name),y})()},get description(){return e(m,{get when(){return f()},children:y=>(()=>{var $=wn();return i($,()=>Ne(n,y().label)),ve(()=>qe($,"data-tone",y().tone)),$})()})}})}})}})),l}}),e(m,{get when(){return s().installableDistros.length>0},get children(){var l=mn(),g=l.firstChild,f=g.nextSibling,y=f.firstChild,$=y.nextSibling;return Lt(l,"click",r.openCatalog,!0),i(y,()=>n.t("wsl.onboarding.needAnotherDistro")),i($,()=>n.t("wsl.onboarding.needAnotherDistroHint")),ve(()=>l.disabled=s().busy),l}})]}}),e(Pe,{get children(){return[e(M,{variant:"neutral",get disabled(){return r.adding()},get onClick(){return r.close},get children(){return n.t("common.cancel")}}),e(M,{get variant(){return T(()=>!!a().loading)()?"loading":a().variant},get disabled(){return T(()=>!a().loading)()&&a().disabled},get style(){return v()},get onClick(){return r.runPrimary},get children(){return e(m,{get when(){return a().loading},get fallback(){return Ne(n,a().label)},get children(){return e(ge,{})}})}})]}})]}})]}})}})}})}function Cn(t){const n=U(),r=ce(),s=ee(),a=Ce(),v=r.wslServers,[l,g]=Ue({view:"main",selectedDistro:null,catalogSearch:"",catalogTarget:null,adding:!1}),f=()=>a.data,y=_=>Jr({state:f(),view:l.view,selectedDistro:l.selectedDistro,catalogSearch:l.catalogSearch,catalogTarget:l.catalogTarget,adding:l.adding,probingAddable:_}),$=R(()=>y(!1)),p=vn({state:f,api:v,view:()=>l.view,adding:()=>l.adding,busy:()=>$().busy,selectedDistro:()=>$().selectedDistro,addableInstalledDistros:()=>$().addableInstalledDistros,onError:_=>be(n,_)}),b=R(()=>y(p.probingAddable())),S=()=>{const _=b().installableDistros[0];g({view:"catalog",catalogSearch:"",catalogTarget:_?.name??null})},P=async _=>{try{await _()}catch(V){be(n,V)}},L=()=>{P(async()=>{p.resetProbeFailure(),await v.refreshDistros()})},O=_=>{P(async()=>{p.resetProbeFailure(),await v.installDistro(_),g("view","main")})},F=()=>{if(b().installingCatalogDistro)return;const _=b().catalogTarget;_&&O(_)},w=()=>{p.resetProbeFailure(),g({view:"main",catalogSearch:"",catalogTarget:null})},h=async()=>{const _=b().primaryButton;if(_.loading)return;const V=b().selectedDistro,q=_.action;if(!(!V||!q)){if(q==="install-opencode"){await P(()=>v.installOpencode(V));return}g("adding",!0);try{await v.addServer(V),t.onAdded?await t.onAdded(V):s.close()}catch(I){be(n,I)}finally{g("adding",!1)}}};return{wslServers:a,model:b,loadError:()=>{const _=a.error;return _?_ instanceof Error?_.message:String(_):n.t("wsl.onboarding.loadFailed")},runtimeError:()=>f()?.runtime?.error??null,view:()=>l.view,catalogSearch:()=>l.catalogSearch,adding:()=>l.adding,setCatalogSearch:_=>g("catalogSearch",_),setCatalogTarget:_=>g("catalogTarget",_),setSelectedDistro:_=>g("selectedDistro",_),openCatalog:S,closeCatalog:w,refreshDistros:L,installCatalogDistro:F,installWsl:()=>void P(()=>v.installWsl()),runPrimary:()=>void h(),close:()=>s.close()}}function kn(t){const n=U(),r=ee(),s=()=>t.state==="pendingRestart"?n.t("wsl.onboarding.restartRequired"):t.installable?n.t("wsl.onboarding.wslNotInstalled.title"):n.t("wsl.onboarding.wslUnavailable.title"),a=()=>t.state==="pendingRestart"?n.t("wsl.onboarding.windowsRestartRequired"):t.installable?n.t("wsl.onboarding.wslNotInstalled.description"):n.t("wsl.onboarding.wslUnavailable.description");return e(oe,{fit:!0,class:"settings-v2-wsl-not-installed-dialog",get children(){var v=_n(),l=v.firstChild,g=l.firstChild,f=g.nextSibling,y=f.nextSibling;return i(f,s),i(y,a),i(l,e(m,{get when(){return T(()=>!t.installable)()&&t.error},get children(){var $=$n();return i($,()=>t.error),$}}),null),i(v,e(m,{get when(){return T(()=>t.state==="unavailable")()&&t.installable},get children(){return e(M,{variant:"neutral",get disabled(){return t.busy},get onClick(){return t.onInstall},get children(){return n.t("wsl.onboarding.installWsl")}})}}),null),i(v,e(m,{get when(){return t.state!=="unavailable"},get children(){return e(M,{variant:"neutral",onClick:()=>r.close(),get children(){return n.t("common.close")}})}}),null),v}})}function be(t,n){console.error("WSL servers request failed",n instanceof Error?n.stack??n.message:String(n)),Et({variant:"error",title:t.t("common.requestFailed"),description:n instanceof Error?n.message:String(n)})}we(["click"]);var Dn=d('<div class=settings-v2-servers-row><div class=settings-v2-servers-lead><div class=settings-v2-servers-copy><span class="flex min-w-0 items-center gap-1"><span class=settings-v2-servers-name></span><span class="shrink-0 rounded-[3px] border border-v2-border-border-base px-1 py-0.5 text-[9px] leading-none text-v2-text-text-muted"></span></span><span class=settings-v2-servers-meta></span></div></div><div class=settings-v2-servers-actions>');function je(t){return t.type==="sidecar"&&t.variant==="wsl"}function xn(t){const n=ce(),r=ee(),s=U(),a=()=>{r.push(()=>e(Sn,{}))};return e(m,{get when(){return n.wslServers},get fallback(){return e(M,{variant:"ghost-muted",icon:"plus",get onClick(){return t.onAddServer},get children(){return s.t("dialog.server.add.button")}})},get children(){return e(E,{gutter:4,modal:!1,placement:"bottom-end",get children(){return[e(E.Trigger,{as:M,variant:"ghost-muted",icon:"plus",get children(){return s.t("dialog.server.add.button")}}),e(E.Portal,{get children(){return e(E.Content,{get children(){return[e(E.Item,{get onSelect(){return t.onAddServer},get children(){return s.t("dialog.server.add.button")}}),e(E.Item,{onSelect:a,get children(){return s.t("wsl.server.add")}})]}})}})]}})}})}function In(t){const n=Ce();return R(()=>{const r=n.data?.servers??[],s=t().trim();return s?Se.go(s,r,{keys:[a=>a.config.distro,a=>a.config.id]}).map(a=>a.obj):r})}function Tn(t){const n=ce(),r=U(),s=Ce(),a=n.wslServers,v=Ze(()=>({mutationFn:g=>g(),onError:g=>le({variant:"error",title:r.t("common.requestFailed"),description:g instanceof Error?g.message:String(g)})})),l=g=>{v.mutate(()=>t.controller.handleRemove(g))};return e(m,{when:a,get children(){return e(J,{get each(){return t.servers()},children:g=>{const f=Ke.Key.make(g.config.id),y=()=>s.data?.opencodeChecks[g.config.distro],$=()=>Yr(y()),p=()=>s.data?.job?.kind==="install-opencode"&&s.data.job.distro===g.config.distro;return(()=>{var b=Dn(),S=b.firstChild,P=S.firstChild,L=P.firstChild,O=L.firstChild,F=O.nextSibling,w=L.nextSibling,h=S.nextSibling;return i(S,e(Ge,{get health(){return t.controller.status()[f]}}),P),i(O,()=>g.config.distro),i(F,()=>r.t("wsl.server.label")),i(w,e(m,{get when(){return y()?.version},children:C=>`v${C()}`})),i(h,e(m,{get when(){return T(()=>!!t.controller.canDefault())()&&t.controller.defaultKey()===f},get children(){return e(ne,{get children(){return r.t("dialog.server.status.default")}})}}),null),i(h,e(m,{get when(){return $()},children:C=>e(M,{size:"small",get disabled(){return p()||v.isPending},onClick:()=>a&&v.mutate(()=>a.installOpencode(g.config.distro)),get children(){return T(()=>!!p())()?r.t("wsl.server.updating"):C()}})}),null),i(h,e(E,{gutter:4,modal:!1,placement:"bottom-end",get children(){return[e(E.Trigger,{as:_e,variant:"ghost-muted",size:"small",get icon(){return e(ye,{name:"outline-dots"})},get"aria-label"(){return r.t("common.moreOptions")}}),e(E.Portal,{get children(){return e(E.Content,{get children(){return e(E.Group,{get children(){return[e(E.GroupLabel,{get children(){return r.t("wsl.server.menu.label")}}),e(m,{get when(){return Hr(g.runtime)},get children(){return e(E.Item,{onSelect:()=>a&&v.mutate(()=>a.startServer(f)),get children(){return r.t("wsl.server.retryStart")}})}}),e(m,{get when(){return T(()=>!!t.controller.canDefault())()&&t.controller.defaultKey()!==f},get children(){return e(E.Item,{onSelect:()=>t.controller.setDefault(f),get children(){return r.t("dialog.server.menu.default")}})}}),e(m,{get when(){return T(()=>!!t.controller.canDefault())()&&t.controller.defaultKey()===f},get children(){return e(E.Item,{onSelect:()=>t.controller.setDefault(null),get children(){return r.t("dialog.server.menu.defaultRemove")}})}}),e(E.Separator,{}),e(E.Item,{onSelect:()=>l(f),get children(){return r.t("dialog.server.menu.delete")}})]}})}})}})]}}),null),b})()}})}})}var Pn=d("<div class=settings-v2-tab-search>"),Ln=d('<div class="settings-v2-tab-header settings-v2-servers-header"><div class=settings-v2-tab-header-row><h2 class=settings-v2-tab-title>'),En=d('<div class="settings-v2-tab-body settings-v2-servers">'),An=d("<span class=settings-v2-servers-status-filter>"<!>""),Rn=d("<div class=settings-v2-servers-status><span>"),On=d("<div class=settings-v2-servers-row><div class=settings-v2-servers-lead><div class=settings-v2-servers-copy><span class=settings-v2-servers-name></span><span class=settings-v2-servers-meta></span></div></div><div class=settings-v2-servers-actions>");const Fn=()=>{const t=ee(),n=U(),r=At(),[s,a]=Ue({filter:""}),v=In(()=>s.filter),l=R(()=>r.sortedItems().filter($=>!je($)).length+v().length>1),g=R(()=>{const $=r.sortedItems().filter(b=>!je(b)),p=s.filter.trim();return p?Se.go(p,$,{keys:[b=>Le(b),b=>b.http.url]}).map(b=>b.obj):$}),f=()=>{t.push(()=>e(Ee,{mode:"add"}))},y=$=>{t.push(()=>e(Ee,{mode:"edit",server:$}))};return[(()=>{var $=Ln(),p=$.firstChild,b=p.firstChild;return i(b,()=>n.t("status.popover.tab.servers")),i(p,e(xn,{onAddServer:f}),null),i($,e(m,{get when(){return l()},get children(){var S=Pn();return i(S,e(se,{type:"search",appearance:"base",get value(){return s.filter},onInput:P=>a("filter",P.currentTarget.value),get placeholder(){return n.t("dialog.server.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return n.t("dialog.server.search.placeholder")}}),null),i(S,e(m,{get when(){return s.filter},get children(){return e(_e,{type:"button",variant:"ghost-muted",size:"small",class:"settings-v2-tab-search-clear",get icon(){return e(ye,{name:"close",size:"large",class:"text-v2-icon-icon-muted"})},onClick:()=>a("filter","")})}}),null),S}}),null),ve(()=>$.classList.toggle("settings-v2-tab-header--stacked",!!l())),$})(),(()=>{var $=En();return i($,e(m,{get when(){return g().length>0||v().length>0},get fallback(){return(()=>{var p=Rn(),b=p.firstChild;return i(b,(()=>{var S=T(()=>!!s.filter);return()=>S()?n.t("palette.empty"):n.t("dialog.server.empty")})()),i(p,e(m,{get when(){return s.filter},get children(){var S=An(),P=S.firstChild,L=P.nextSibling;return L.nextSibling,i(S,()=>s.filter,L),S}}),null),p})()},get children(){return e(z,{get children(){return[e(Tn,{controller:r,servers:v}),e(J,{get each(){return g()},children:p=>{const b=Ke.key(p),S=()=>r.status()[b],P=()=>r.defaultKey()===b;return(()=>{var L=On(),O=L.firstChild,F=O.firstChild,w=F.firstChild,h=w.nextSibling,C=O.nextSibling;return i(O,e(Ge,{get health(){return S()}}),F),i(w,()=>Le(p)),i(h,e(m,{get when(){return S()?.version},get children(){return["v",T(()=>S()?.version)]}}),null),i(h,e(m,{get when(){return T(()=>!!S()?.version)()&&p.type==="http"},children:" • "}),null),i(h,e(m,{get when(){return T(()=>p.type==="http")()&&p.http.username},get fallback(){return e(m,{get when(){return p.type==="http"},get children(){return n.t("server.row.noUsername")}})},get children(){return p.http.username}}),null),i(C,e(m,{get when(){return T(()=>!!r.canDefault())()&&P()},get children(){return e(ne,{get children(){return n.t("dialog.server.status.default")}})}}),null),i(C,e(Rt,{server:p,controller:r,onEdit:y}),null),L})()}})]}})}})),$})()]};var Vn=d('<div class="flex flex-col justify-between h-full w-full"><div class="flex flex-col gap-3 w-full"><div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div></div></div><div class=settings-v2-nav-footer><span></span><span>v');const Mn=t=>{const n=U(),r=ce(),s=ee(),a=Ot(),v=Ft(),l=$e(),[g,f]=Vt(t.defaultValue??"general"),y=R(()=>{const p=a.route();if(p.type==="dir-new-sesssion")return p.dir;if(p.type==="draft"){const b=v.store.find(S=>S.type==="draft"&&S.draftID===p.draftID);return b?.type==="draft"?b.directory:void 0}if(p.type==="session")return l().session.get(p.sessionId)?.directory}),$=()=>{s.show(()=>e(Mn,{get sessionID(){return t.sessionID},defaultValue:"providers"}))};return e(oe,{size:"x-large",variant:"settings",class:"settings-v2-dialog",get children(){return e(N,{orientation:"vertical",variant:"settings",get value(){return g()},onChange:p=>void Mt(()=>f(p)),class:"settings-v2",get children(){return[e(N.List,{get children(){var p=Vn(),b=p.firstChild,S=b.firstChild,P=S.firstChild,L=P.firstChild,O=P.nextSibling,F=O.firstChild,w=b.nextSibling,h=w.firstChild,C=h.nextSibling;return C.firstChild,i(P,e(N.SectionTitle,{get children(){return n.t("settings.section.desktop")}}),L),i(L,e(N.Trigger,{value:"general",get children(){return[e(ae,{name:"sliders"}),T(()=>n.t("settings.tab.general"))]}}),null),i(L,e(N.Trigger,{value:"shortcuts",get children(){return[e(ae,{name:"keyboard"}),T(()=>n.t("settings.tab.shortcuts"))]}}),null),i(O,e(N.SectionTitle,{get children(){return n.t("settings.section.server")}}),F),i(F,e(N.Trigger,{value:"servers",get children(){return[e(ae,{name:"server"}),T(()=>n.t("status.popover.tab.servers"))]}}),null),i(F,e(N.Trigger,{value:"providers",get children(){return[e(ae,{name:"providers"}),T(()=>n.t("settings.providers.title"))]}}),null),i(F,e(N.Trigger,{value:"models",get children(){return[e(ae,{name:"models"}),T(()=>n.t("settings.models.title"))]}}),null),i(h,()=>n.t("app.name.desktop")),i(C,()=>r.version,null),p}}),e(N.Content,{value:"general",class:"settings-v2-panel",get children(){return e(kr,{get sessionID(){return t.sessionID}})}}),e(N.Content,{value:"shortcuts",class:"settings-v2-panel",get children(){return e(Nt,{v2:!0})}}),e(N.Content,{value:"servers",class:"settings-v2-panel",get children(){return e(Fn,{})}}),e(N.Content,{value:"providers",class:"settings-v2-panel",get children(){return e(Or,{directory:y,onBack:$})}}),e(N.Content,{value:"models",class:"settings-v2-panel",get children(){return e(qr,{})}})]}})}})};export{Mn as DialogSettings};
|
|
2
|
+
import{bI as Q,au as e,bc as Z,a6 as pe,b6 as i,bJ as ze,a2 as m,aH as ve,bF as qe,ap as it,bL as d,aR as we,a9 as ne,a as M,co as at,b_ as U,c5 as lt,c6 as ce,bV as ee,ck as ot,ch as $e,cg as We,aC as ct,aD as R,aI as Ie,bm as dt,af as gt,U as X,ba as T,ab as se,bB as ut,bC as vt,be as ht,bf as pt,bM as mt,bN as ft,bD as bt,bg as wt,bO as $t,S as _t,bv as yt,cf as St,c9 as Ct,bw as he,o as J,N as ue,bG as le,c1 as kt,bX as Dt,v as _e,t as ye,R as K,aY as Se,c2 as Ze,ax as xt,c as oe,f as It,h as Tt,k as Pt,d as Te,aj as Lt,e as Pe,cq as Ce,aL as Ue,bH as Et,x as E,V as Ke,Y as Ge,ce as At,bE as Le,_ as Rt,g as Ee,b$ as Ot,cn as Ft,aK as Vt,I as ae,bK as Mt}from"./index-BfNxi3ev.js";import{S as k,a as A}from"./row-DA4cIOhp.js";import{u as Bt,S as Nt}from"./settings-keybinds-BOa6QxJ6.js";import{L as jt,u as zt,a as qt,D as Wt}from"./dialog-connect-provider-DLnpNUTc.js";import{S as z}from"./list-FiQEDby0.js";import"./LROKH5N7-D8CK0ENS.js";var Zt=d('<span class="inline-flex items-center gap-2"data-slot=tabs-v2-trigger-content>'),Ut=d("<div data-slot=tabs-v2-trigger-wrapper>"),Kt=d('<span data-slot=tabs-v2-subtext class="ml-2 text-xs text-text-weak">'),Gt=d('<div role=button tabindex=0 aria-label="Close tab"data-slot=tabs-v2-close-button><svg width=14 height=14 viewBox="0 0 14 14"fill=none xmlns=http://www.w3.org/2000/svg><path d="M10.8889 3.11108L3.11108 10.8889"stroke=currentColor stroke-linejoin=round></path><path d="M3.11108 3.11108L10.8889 10.8889"stroke=currentColor stroke-linejoin=round>'),Ht=d("<div data-slot=tabs-v2-section-title>");function Yt(t){const[n,r]=Q(t,["class","classList","variant","orientation"]);return e(pe,Z(r,{get orientation(){return n.orientation},"data-component":"tabs-v2",get"data-variant"(){return n.variant||"normal"},get"data-orientation"(){return n.orientation||"horizontal"},get classList(){return{...n.classList,[n.class??""]:!!n.class}}}))}function Jt(t){const[n,r]=Q(t,["class","classList"]);return e(pe.List,Z(r,{"data-slot":"tabs-v2-list",get classList(){return{...n.classList,[n.class??""]:!!n.class}}}))}function Qt(t){const[n,r]=Q(t,["class","classList","children","onMiddleClick","subtext"]);return(()=>{var s=Ut();return s.addEventListener("auxclick",a=>{a.button===1&&n.onMiddleClick&&(a.preventDefault(),n.onMiddleClick())}),s.$$mousedown=a=>{a.button===1&&n.onMiddleClick&&a.preventDefault()},i(s,e(pe.Trigger,Z(r,{"data-slot":"tabs-v2-trigger",get"data-value"(){return t.value},get children(){var a=Zt();return i(a,()=>n.children,null),i(a,e(m,{get when(){return n.subtext},children:v=>(()=>{var l=Kt();return i(l,v),l})()}),null),a}}))),ve(a=>{var v=t.value,l={...n.classList,[n.class??""]:!!n.class};return v!==a.e&&qe(s,"data-value",a.e=v),a.t=it(s,l,a.t),a},{e:void 0,t:void 0}),s})()}function Xt(t){const[n,r]=Q(t,["class","classList","onClick"]);return(()=>{var s=Gt();return ze(s,Z(r,{get classList(){return{[n.class??""]:!!n.class,...n.classList}},onClick:a=>{a.preventDefault(),a.stopPropagation(),typeof n.onClick=="function"&&n.onClick(a)},onMouseDown:a=>{a.preventDefault(),a.stopPropagation()}}),!1,!0),s})()}function er(t){const[n,r]=Q(t,["class","classList","children"]);return e(pe.Content,Z(r,{"data-slot":"tabs-v2-content",get classList(){return{...n.classList,[n.class??""]:!!n.class}},get children(){return n.children}}))}const tr=t=>(()=>{var n=Ht();return i(n,()=>t.children),n})(),N=Object.assign(Yt,{List:Jt,Trigger:Qt,CloseButton:Xt,Content:er,SectionTitle:tr});we(["mousedown"]);var rr=d("<div data-action=settings-new-layout-designs>"),nr=d("<div class=settings-v2-section><div class=settings-v2-interface-feature>"),sr=d('<span class="flex items-center gap-2">'),ir=d("<div class=settings-v2-section>");function ar(t){return(()=>{var n=nr(),r=n.firstChild;return i(r,e(z,{get children(){return e(k,{get title(){return(()=>{var s=sr();return i(s,()=>t.title,null),i(s,e(ne,{variant:"accent",get children(){return t.badge}}),null),s})()},get description(){return t.description},get children(){var s=rr();return i(s,e(A,{get checked(){return t.checked},get onChange(){return t.onChange}})),s}})}})),n})()}function lr(t){return(()=>{var n=ir();return i(n,e(z,{get children(){return e(k,{get title(){return t.title},get description(){return t.description},get children(){return e(M,{size:"small",variant:"ghost-muted",get onClick(){return t.onDismiss},get children(){return t.dismiss}})}})}})),n})()}var or=d("<div data-action=settings-auto-accept-permissions>"),cr=d("<div data-action=settings-feed-reasoning-summaries>"),dr=d("<div data-action=settings-feed-shell-tool-parts-expanded>"),gr=d("<div data-action=settings-feed-edit-tool-parts-expanded>"),ur=d("<div data-action=settings-mobile-titlebar-bottom>"),vr=d("<div class=settings-v2-section>"),hr=d("<div data-action=settings-show-file-tree>"),pr=d("<div data-action=settings-show-search>"),mr=d("<div data-action=settings-show-status>"),fr=d("<div data-action=settings-show-custom-agents>"),te=d("<div class=settings-v2-section><h3 class=settings-v2-section-title>"),me=d('<div class="w-full sm:w-[220px]">'),br=d("<div data-action=settings-notifications-agent>"),wr=d("<div data-action=settings-notifications-permissions>"),$r=d("<div data-action=settings-notifications-errors>"),_r=d("<div data-action=settings-release-notes>"),yr=d("<div data-action=settings-pinch-zoom>"),Sr=d("<div class=settings-v2-tab-header><h2 class=settings-v2-tab-title>"),Cr=d("<div class=settings-v2-tab-body>");let G={cleanup:void 0,timeout:void 0,run:0};const He=()=>{G.run+=1,G.cleanup&&G.cleanup(),clearTimeout(G.timeout),G.cleanup=void 0},Ae=t=>{if(He(),!t)return;const n=++G.run;G.timeout=setTimeout(()=>{yt(t).then(r=>{if(G.run!==n){r?.();return}G.cleanup=r})},100)},kr=t=>{const n=at(),r=U(),s=lt(),a=ce(),v=ee(),l=ot(),g=$e(),f=We(),y=ct("(max-width: 767px)"),$=Bt(),p=R(()=>{if(t.sessionID)return g().session.lineage.peek(t.sessionID)?.session.directory}),b=R(()=>{const c=p();return!c||!t.sessionID?!1:s.isAutoAccepting(t.sessionID,c)}),S=c=>{const u=p();if(!(!u||!t.sessionID)){if(c){s.enableAutoAccept(t.sessionID,u);return}s.disableAutoAccept(t.sessionID,u)}},P=R(()=>a.platform==="desktop"),L=R(()=>n.ids().map(c=>({id:c,name:n.name(c)}))),[O]=Ie(async()=>{const c=f();return await c.protocol==="v1"?(await c.client.pty.shells()).data??[]:[]},{initialValue:[]}),[F,{mutate:w}]=Ie(()=>!!(P()&&a.getPinchZoomEnabled),()=>Promise.resolve(a.getPinchZoomEnabled?.()??!1).catch(()=>!1),{initialValue:!1});dt(()=>{n.loadThemes()});const h={id:"auto",value:"",label:r.t("settings.general.row.shell.autoDefault")},C=R(()=>g().data.config.shell??""),_=R(()=>{const c=O.latest,u=g().data.config.shell,o=new Map;for(const x of c)o.set(x.name,(o.get(x.name)||0)+1);const D=[h,...c.map(x=>{const De=(o.get(x.name)||0)>1,xe=De?x.path:x.name,st=x.acceptable?xe:`${xe} (${r.t("settings.general.row.shell.terminalOnly")})`;return{id:x.path,value:De?x.path:x.name,label:st}})];return u&&!D.some(x=>x.value===u)&&D.push({id:u,value:u,label:u}),D}),V=c=>{w(c);const u=a.setPinchZoomEnabled?.(c);u&&u.catch(()=>w(!c))},q=R(()=>[{value:"system",label:r.t("theme.scheme.system")},{value:"light",label:r.t("theme.scheme.light")},{value:"dark",label:r.t("theme.scheme.dark")}]),I=R(()=>r.locales.map(c=>({value:c,label:r.label(c)}))),B={id:"none",label:"sound.option.none"},W=[B,..._t],j=()=>wt(l.appearance.font()),H=()=>bt(l.appearance.uiFont()),Y=()=>$t(l.appearance.terminalFont()),ie=(c,u,o,D)=>({options:W,current:c()?W.find(x=>x.id===u())??B:B,value:x=>x.id,label:x=>r.t(x.label),onHighlight:x=>{x&&Ae(x.id==="none"?void 0:x.id)},onSelect:x=>{if(x){if(x.id==="none"){o(!1),He();return}o(!0),D(x.id),Ae(x.id)}}}),de=()=>e(ar,{get title(){return r.t("settings.general.row.newInterface.title")},get badge(){return r.t("settings.general.row.newInterface.badge")},get description(){return r.t("settings.general.row.newInterface.description")},get checked(){return l.general.newLayoutDesigns()},onChange:c=>{l.general.setNewLayoutDesigns(c),!c&>(()=>import("./dialog-settings-C0ClHN8Q.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])).then(u=>{v.show(()=>e(u.DialogSettings,{}))})}}),Ye=()=>e(lr,{get title(){return r.t("settings.general.row.newInterfaceNotice.title")},get description(){return r.t("settings.general.row.newInterfaceNotice.description")},get dismiss(){return r.t("settings.general.row.newInterfaceNotice.dismiss")},get onDismiss(){return l.general.dismissNewInterfaceNotice}}),Je=()=>(()=>{var c=vr();return i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.language.title")},get description(){return r.t("settings.general.row.language.description")},get children(){return e(X,{appearance:"inline","data-action":"settings-language",get options(){return I()},placement:"bottom-end",gutter:6,get current(){return I().find(u=>u.value===r.locale())},value:u=>u.value,label:u=>u.label,onSelect:u=>u&&r.setLocale(u.value)})}}),e(k,{get title(){return r.t("command.permissions.autoaccept.enable")},get description(){return r.t("toast.permissions.autoaccept.on.description")},get children(){var u=or();return i(u,e(A,{get checked(){return b()},get disabled(){return!p()},onChange:S})),u}}),e(k,{get title(){return r.t("settings.general.row.shell.title")},get description(){return r.t("settings.general.row.shell.description")},get children(){return e(X,{appearance:"inline","data-action":"settings-shell",get options(){return _()},get current(){return _().find(u=>u.value===C())??h},placement:"bottom-end",gutter:6,value:u=>u.id,label:u=>u.label,onSelect:u=>{u&&u.value!==C()&&g().updateConfig({shell:u.value})}})}}),e(k,{get title(){return r.t("settings.general.row.reasoningSummaries.title")},get description(){return r.t("settings.general.row.reasoningSummaries.description")},get children(){var u=cr();return i(u,e(A,{get checked(){return l.general.showReasoningSummaries()},onChange:o=>l.general.setShowReasoningSummaries(o)})),u}}),e(k,{get title(){return r.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return r.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var u=dr();return i(u,e(A,{get checked(){return l.general.shellToolPartsExpanded()},onChange:o=>l.general.setShellToolPartsExpanded(o)})),u}}),e(k,{get title(){return r.t("settings.general.row.editToolPartsExpanded.title")},get description(){return r.t("settings.general.row.editToolPartsExpanded.description")},get children(){var u=gr();return i(u,e(A,{get checked(){return l.general.editToolPartsExpanded()},onChange:o=>l.general.setEditToolPartsExpanded(o)})),u}}),e(m,{get when(){return T(()=>!!y())()&&!0},get children(){return e(k,{get title(){return r.t("settings.general.row.mobileTitlebarBottom.title")},get description(){return r.t("settings.general.row.mobileTitlebarBottom.description")},get children(){var u=ur();return i(u,e(A,{get checked(){return l.general.mobileTitlebarPosition()==="bottom"},onChange:o=>l.general.setMobileTitlebarPosition(o?"bottom":"top")})),u}})}})]}})),c})(),Qe=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.advanced")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.showFileTree.title")},get description(){return r.t("settings.general.row.showFileTree.description")},get children(){var o=hr();return i(o,e(A,{get checked(){return l.general.showFileTree()},onChange:D=>l.general.setShowFileTree(D)})),o}}),e(k,{get title(){return r.t("settings.general.row.showSearch.title")},get description(){return r.t("settings.general.row.showSearch.description")},get children(){var o=pr();return i(o,e(A,{get checked(){return l.general.showSearch()},onChange:D=>l.general.setShowSearch(D)})),o}}),e(k,{get title(){return r.t("settings.general.row.showStatus.title")},get description(){return r.t("settings.general.row.showStatus.description")},get children(){var o=mr();return i(o,e(A,{get checked(){return l.general.showStatus()},onChange:D=>l.general.setShowStatus(D)})),o}}),e(k,{get title(){return r.t("settings.general.row.showCustomAgents.title")},get description(){return r.t("settings.general.row.showCustomAgents.description")},get children(){var o=fr();return i(o,e(A,{get checked(){return l.general.showCustomAgents()},onChange:D=>l.general.setShowCustomAgents(D)})),o}})]}}),null),c})(),Xe=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.appearance")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.colorScheme.title")},get description(){return r.t("settings.general.row.colorScheme.description")},get children(){return e(X,{appearance:"inline","data-action":"settings-color-scheme",get options(){return q()},get current(){return q().find(o=>o.value===n.colorScheme())},placement:"bottom-end",gutter:6,value:o=>o.value,label:o=>o.label,onSelect:o=>o&&n.setColorScheme(o.value)})}}),e(k,{get title(){return r.t("settings.general.row.theme.title")},get description(){return[T(()=>r.t("settings.general.row.theme.description"))," ",e(jt,{class:"settings-v2-link",href:"https://opencode.ai/docs/themes/",get children(){return r.t("common.learnMore")}})]},get children(){return e(X,{appearance:"inline","data-action":"settings-theme",get options(){return L()},get current(){return L().find(o=>o.id===n.themeId())},placement:"bottom-end",gutter:6,value:o=>o.id,label:o=>o.name,onSelect:o=>{o&&n.setTheme(o.id)}})}}),e(k,{get title(){return r.t("settings.general.row.uiFont.title")},get description(){return r.t("settings.general.row.uiFont.description")},get children(){var o=me();return i(o,e(se,{"data-action":"settings-ui-font",type:"text",appearance:"base",get value(){return H()},onInput:D=>l.appearance.setUIFont(D.currentTarget.value),placeholder:ut,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return r.t("settings.general.row.uiFont.title")},get style(){return{"font-family":vt(l.appearance.uiFont())}}})),o}}),e(k,{get title(){return r.t("settings.general.row.font.title")},get description(){return r.t("settings.general.row.font.description")},get children(){var o=me();return i(o,e(se,{"data-action":"settings-code-font",type:"text",appearance:"base",get value(){return j()},onInput:D=>l.appearance.setFont(D.currentTarget.value),placeholder:ht,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return r.t("settings.general.row.font.title")},get style(){return{"font-family":pt(l.appearance.font())}}})),o}}),e(k,{get title(){return r.t("settings.general.row.terminalFont.title")},get description(){return r.t("settings.general.row.terminalFont.description")},get children(){var o=me();return i(o,e(se,{"data-action":"settings-terminal-font",type:"text",appearance:"base",get value(){return Y()},onInput:D=>l.appearance.setTerminalFont(D.currentTarget.value),placeholder:mt,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return r.t("settings.general.row.terminalFont.title")},get style(){return{"font-family":ft(l.appearance.terminalFont())}}})),o}})]}}),null),c})(),et=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.notifications")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.notifications.agent.title")},get description(){return r.t("settings.general.notifications.agent.description")},get children(){var o=br();return i(o,e(A,{get checked(){return l.notifications.agent()},onChange:D=>l.notifications.setAgent(D)})),o}}),e(k,{get title(){return r.t("settings.general.notifications.permissions.title")},get description(){return r.t("settings.general.notifications.permissions.description")},get children(){var o=wr();return i(o,e(A,{get checked(){return l.notifications.permissions()},onChange:D=>l.notifications.setPermissions(D)})),o}}),e(k,{get title(){return r.t("settings.general.notifications.errors.title")},get description(){return r.t("settings.general.notifications.errors.description")},get children(){var o=$r();return i(o,e(A,{get checked(){return l.notifications.errors()},onChange:D=>l.notifications.setErrors(D)})),o}})]}}),null),c})(),tt=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.sounds")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.sounds.agent.title")},get description(){return r.t("settings.general.sounds.agent.description")},get children(){return e(X,Z({appearance:"inline","data-action":"settings-sounds-agent"},()=>ie(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),o=>l.sounds.setAgentEnabled(o),o=>l.sounds.setAgent(o)),{placement:"bottom-end",gutter:6}))}}),e(k,{get title(){return r.t("settings.general.sounds.permissions.title")},get description(){return r.t("settings.general.sounds.permissions.description")},get children(){return e(X,Z({appearance:"inline","data-action":"settings-sounds-permissions"},()=>ie(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),o=>l.sounds.setPermissionsEnabled(o),o=>l.sounds.setPermissions(o)),{placement:"bottom-end",gutter:6}))}}),e(k,{get title(){return r.t("settings.general.sounds.errors.title")},get description(){return r.t("settings.general.sounds.errors.description")},get children(){return e(X,Z({appearance:"inline","data-action":"settings-sounds-errors"},()=>ie(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),o=>l.sounds.setErrorsEnabled(o),o=>l.sounds.setErrors(o)),{placement:"bottom-end",gutter:6}))}})]}}),null),c})(),rt=()=>(()=>{var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.updates")),i(c,e(z,{get children(){return[e(k,{get title(){return r.t("settings.general.row.releaseNotes.title")},get description(){return r.t("settings.general.row.releaseNotes.description")},get children(){var o=_r();return i(o,e(A,{get checked(){return l.general.releaseNotes()},onChange:D=>l.general.setReleaseNotes(D)})),o}}),e(k,{get title(){return r.t("settings.updates.row.check.title")},get description(){return r.t("settings.updates.row.check.description")},get children(){return e(M,{size:"normal",variant:"neutral",get disabled(){return!$.action().run},get onClick(){return $.run},get children(){return r.t($.action().label)}})}})]}}),null),c})(),nt=()=>e(m,{get when(){return P()},get children(){var c=te(),u=c.firstChild;return i(u,()=>r.t("settings.general.section.display")),i(c,e(z,{get children(){return e(k,{get title(){return r.t("settings.general.row.pinchZoom.title")},get description(){return r.t("settings.general.row.pinchZoom.description")},get children(){var o=yr();return i(o,e(A,{get checked(){return F.latest},onChange:V})),o}})}}),null),c}});return[(()=>{var c=Sr(),u=c.firstChild;return i(u,()=>r.t("settings.tab.general")),c})(),(()=>{var c=Cr();return i(c,e(m,{get when(){return l.general.layoutTransitionAvailable()},get children(){return e(de,{})}}),null),i(c,e(m,{get when(){return l.general.newInterfaceNoticeVisible()},get children(){return e(Ye,{})}}),null),i(c,e(Je,{}),null),i(c,e(Xe,{}),null),i(c,e(et,{}),null),i(c,e(tt,{}),null),i(c,e(m,{get when(){return P()},get children(){return e(rt,{})}}),null),i(c,e(nt,{}),null),i(c,e(Qe,{}),null),c})()]};var Dr=d("<div class=settings-v2-tab-header><h2 class=settings-v2-tab-title>"),xr=d("<div class=settings-v2-provider-row data-component=custom-provider-section><div class=settings-v2-provider-lead><div class=settings-v2-provider-copy><div class=settings-v2-provider-main><span class=settings-v2-provider-name></span></div><p class=settings-v2-provider-description>"),Ir=d('<div class="settings-v2-tab-body settings-v2-providers"><div class=settings-v2-section data-component=connected-providers-section><h3 class=settings-v2-section-title></h3></div><div class=settings-v2-section><h3 class=settings-v2-section-title></h3><button type=button class=settings-v2-providers-view-all>'),Tr=d("<div class=settings-v2-provider-empty>"),Pr=d('<div class="settings-v2-provider-row group"><div class=settings-v2-provider-lead><div class=settings-v2-provider-main><span class="settings-v2-provider-name truncate">'),Lr=d("<span class=settings-v2-provider-env-hint>"),Er=d("<div class=settings-v2-provider-row><div class=settings-v2-provider-lead><div class=settings-v2-provider-copy><div class=settings-v2-provider-main><span class=settings-v2-provider-name>"),Ar=d("<p class=settings-v2-provider-description>");const Rr=[{match:t=>t==="opencode",key:"dialog.provider.opencode.note"},{match:t=>t==="anthropic",key:"dialog.provider.anthropic.note"},{match:t=>t.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:t=>t==="openai",key:"dialog.provider.openai.note"},{match:t=>t==="google",key:"dialog.provider.google.note"},{match:t=>t==="openrouter",key:"dialog.provider.openrouter.note"},{match:t=>t==="vercel",key:"dialog.provider.vercel.note"}],re=16,Or=t=>{const n=ee(),r=U(),s=We(),a=St(),v=$e(),l=Ct(t.directory),g=zt({onBack:t.onBack}),f=w=>{g.select(w),n.show(()=>e(Wt,{get directory(){return t.directory},controller:g}))},y=R(()=>l.connected().filter(w=>w.id!=="opencode"||Object.values(w.models).find(h=>h.cost?.input))),$=R(()=>{const w=new Set(y().map(C=>C.id)),h=l.popular().filter(C=>!w.has(C.id)).slice();return h.sort((C,_)=>he.indexOf(C.id)-he.indexOf(_.id)),h}),p=w=>{if(!("source"in w))return;const h=w.source;if(h==="env"||h==="api"||h==="config"||h==="custom")return h},b=w=>{const h=p(w);return h==="env"?r.t("settings.providers.tag.environment"):h==="api"?r.t("provider.connect.method.apiKey"):h==="config"?L(w.id)?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.config"):h==="custom"?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.other")},S=w=>p(w)!=="env"&&(a()==="v1"||!L(w.id)),P=w=>Rr.find(h=>h.match(w))?.key,L=w=>{const h=v().data.config.provider?.[w];return!(!h||h.npm!=="@ai-sdk/openai-compatible"||!h.models||Object.keys(h.models).length===0)},O=async(w,h)=>{if(a()!=="v1")return;const C=v().data.config.disabled_providers??[],_=C.includes(w)?C:[...C,w];v().set("config","disabled_providers",_),await v().updateConfig({disabled_providers:_}).then(()=>{le({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(V=>{v().set("config","disabled_providers",C);const q=V instanceof Error?V.message:String(V);le({title:r.t("common.requestFailed"),description:q})})},F=async(w,h)=>{if(L(w)){await s().client.auth.remove({providerID:w}).catch(()=>{}),await O(w,h);return}await s().client.auth.remove({providerID:w}).then(async()=>{await s().client.global.dispose(),le({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(C=>{const _=C instanceof Error?C.message:String(C);le({title:r.t("common.requestFailed"),description:_})})};return[(()=>{var w=Dr(),h=w.firstChild;return i(h,()=>r.t("settings.providers.title")),w})(),(()=>{var w=Ir(),h=w.firstChild,C=h.firstChild,_=h.nextSibling,V=_.firstChild,q=V.nextSibling;return i(C,()=>r.t("settings.providers.section.connected")),i(h,e(z,{get children(){return e(m,{get when(){return y().length>0},get fallback(){return(()=>{var I=Tr();return i(I,()=>r.t("settings.providers.connected.empty")),I})()},get children(){return e(J,{get each(){return y()},children:I=>(()=>{var B=Pr(),W=B.firstChild,j=W.firstChild,H=j.firstChild;return i(W,e(ue,{get id(){return I.id},width:re,height:re,class:"settings-v2-provider-icon shrink-0"}),j),i(H,()=>I.name),i(j,e(ne,{get children(){return b(I)}}),null),i(B,e(m,{get when(){return S(I)},get fallback(){return(()=>{var Y=Lr();return i(Y,()=>r.t("settings.providers.connected.environmentDescription")),Y})()},get children(){return e(M,{size:"normal",variant:"ghost-muted",onClick:()=>void F(I.id,I.name),get children(){return r.t("common.disconnect")}})}}),null),B})()})}})}}),null),i(V,()=>r.t("settings.providers.section.popular")),i(_,e(z,{get children(){return[e(J,{get each(){return $()},children:I=>(()=>{var B=Er(),W=B.firstChild,j=W.firstChild,H=j.firstChild,Y=H.firstChild;return i(W,e(ue,{get id(){return I.id},width:re,height:re,class:"settings-v2-provider-icon shrink-0"}),j),i(Y,()=>I.name),i(H,e(m,{get when(){return I.id==="opencode"},get children(){return e(ne,{get children(){return r.t("dialog.provider.tag.recommended")}})}}),null),i(j,e(m,{get when(){return P(I.id)},children:ie=>(()=>{var de=Ar();return i(de,()=>r.t(ie())),de})()}),null),i(B,e(M,{size:"normal",variant:"neutral",icon:"plus",onClick:()=>f(I.id),get children(){return r.t("common.connect")}}),null),B})()}),e(m,{get when(){return a()==="v1"},get children(){var I=xr(),B=I.firstChild,W=B.firstChild,j=W.firstChild,H=j.firstChild,Y=j.nextSibling;return i(B,e(ue,{id:"synthetic",width:re,height:re,class:"settings-v2-provider-icon shrink-0"}),W),i(H,()=>r.t("provider.custom.title")),i(j,e(ne,{get children(){return r.t("settings.providers.tag.custom")}}),null),i(Y,()=>r.t("settings.providers.custom.description")),i(I,e(M,{size:"normal",variant:"neutral",icon:"plus",onClick:()=>{n.show(()=>e(qt,{get onBack(){return n.close}}))},get children(){return r.t("common.connect")}}),null),I}})]}}),q),q.$$click=()=>f(),i(q,()=>r.t("dialog.provider.viewAll")),w})()]};we(["click"]);var Fr=d('<div class="settings-v2-tab-header settings-v2-tab-header--stacked"><h2 class=settings-v2-tab-title></h2><div class=settings-v2-tab-search>'),Vr=d('<div class="settings-v2-tab-body settings-v2-models">'),Mr=d("<div class=settings-v2-models-status>"),Br=d("<span class=settings-v2-models-status-filter>"<!>""),Nr=d("<div class=settings-v2-models-status><span>"),jr=d("<div class=settings-v2-section data-component=settings-models-provider><div class=settings-v2-models-group-header><h3 class=settings-v2-section-title>"),zr=d("<div>");const Re=16,qr=()=>{const t=U(),n=kt(),r=Dt({items:s=>n.list(),key:s=>`${s.provider.id}:${s.id}`,filterKeys:["provider.name","name","id"],sortBy:(s,a)=>s.name.localeCompare(a.name),groupBy:s=>s.provider.id,sortGroupsBy:(s,a)=>{const v=he.indexOf(s.category),l=he.indexOf(a.category),g=v>=0,f=l>=0;if(g&&!f)return-1;if(!g&&f)return 1;if(g&&f)return v-l;const y=s.items[0].provider.name,$=a.items[0].provider.name;return y.localeCompare($)}});return[(()=>{var s=Fr(),a=s.firstChild,v=a.nextSibling;return i(a,()=>t.t("settings.models.title")),i(v,e(se,{type:"search",appearance:"base",get value(){return r.filter()},onInput:l=>r.onInput(l.currentTarget.value),get placeholder(){return t.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return t.t("dialog.model.search.placeholder")}}),null),i(v,e(m,{get when(){return r.filter()},get children(){return e(_e,{type:"button",variant:"ghost-muted",size:"small",class:"settings-v2-tab-search-clear",get icon(){return e(ye,{name:"close",size:"large",class:"text-v2-icon-icon-muted"})},onClick:()=>r.clear()})}}),null),s})(),(()=>{var s=Vr();return i(s,e(m,{get when(){return!r.grouped.loading},get fallback(){return(()=>{var a=Mr();return i(a,()=>t.t("common.loading"),null),i(a,()=>t.t("common.loading.ellipsis"),null),a})()},get children(){return e(m,{get when(){return r.flat().length>0},get fallback(){return(()=>{var a=Nr(),v=a.firstChild;return i(v,()=>t.t("dialog.model.empty")),i(a,e(m,{get when(){return r.filter()},get children(){var l=Br(),g=l.firstChild,f=g.nextSibling;return f.nextSibling,i(l,()=>r.filter(),f),l}}),null),a})()},get children(){return e(J,{get each(){return r.grouped.latest},children:a=>(()=>{var v=jr(),l=v.firstChild,g=l.firstChild;return i(l,e(ue,{get id(){return a.category},width:Re,height:Re,class:"settings-v2-models-provider-icon shrink-0"}),g),i(g,()=>a.items[0].provider.name),i(v,e(z,{get children(){return e(J,{get each(){return a.items},children:f=>{const y={providerID:f.provider.id,modelID:f.id};return e(k,{get title(){return f.name},description:"",get children(){var $=zr();return i($,e(A,{get checked(){return n.visible(y)},onChange:p=>{n.setVisibility(y,p)},hideLabel:!0,get children(){return f.name}})),$}})}})}}),null),v})()})}})}})),s})()]};var Wr=d('<svg><circle cx=8 cy=8 r=6 data-slot=loader-v2-background stroke-width=2></circle><circle cx=8 cy=8 r=6 data-slot=loader-v2-progress pathLength=100 stroke-width=2 stroke-dasharray="33 67">');function ge(t){const[n,r]=Q(t,["class","classList","width","height"]);return(()=>{var s=Wr();return ze(s,Z(r,{get class(){return n.class},get classList(){return n.classList},get width(){return n.width??16},get height(){return n.height??16},viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-component":"loader-v2",get"aria-hidden"(){return r["aria-hidden"]??"true"}}),!0,!0),s})()}var Zr=d("<div data-slot=radio-v2-items>"),Ur=d("<div data-slot=radio-v2-item-control-stack>"),Kr=d("<div data-slot=radio-v2-item-text><span data-slot=radio-v2-item-label-text>"),Gr=d("<span data-slot=radio-v2-item-description>");function Oe(t){const[n,r]=Q(t,["class","classList","children","label","description","hideLabel"]);return e(K,Z(r,{"data-component":"radio-v2",get classList(){return{...n.classList,[n.class??""]:!!n.class}},get children(){return[e(m,{get when(){return n.label},children:s=>e(K.Label,{"data-slot":"radio-v2-label",get classList(){return{"sr-only":n.hideLabel}},get children(){return s()}})}),e(m,{get when(){return n.description},children:s=>e(K.Description,{"data-slot":"radio-v2-description",get children(){return s()}})}),(()=>{var s=Zr();return i(s,()=>n.children),s})(),e(K.ErrorMessage,{"data-slot":"radio-v2-error"})]}}))}function Fe(t){const[n,r]=Q(t,["class","classList","label","description","hideLabel"]);return e(K.Item,Z(r,{"data-slot":"radio-v2-item",get classList(){return{...n.classList,[n.class??""]:!!n.class}},get children(){return[e(K.ItemInput,{"data-slot":"radio-v2-item-input"}),(()=>{var s=Ur();return i(s,e(K.ItemControl,{"data-slot":"radio-v2-item-control",get children(){return e(K.ItemIndicator,{"data-slot":"radio-v2-item-indicator"})}})),s})(),e(K.ItemLabel,{"data-slot":"radio-v2-item-label",get classList(){return{"sr-only":n.hideLabel}},get children(){var s=Kr(),a=s.firstChild;return i(a,()=>n.label),i(s,e(m,{get when(){return n.description},children:v=>(()=>{var l=Gr();return i(l,v),l})()}),null),s}})]}}))}function Ve(t){return/^docker-desktop(?:-data)?$/i.test(t)}const Hr=t=>t.kind==="failed"||t.kind==="stopped";function Yr(t){if(t){if(!t.resolvedPath)return"Install midsomar";if(t.matchesDesktop===!1)return"Update midsomar"}}function ke(t,n){const r=t?.installed.find(a=>a.name===n),s=t?.distroProbes[n];return!s||!r||r.version===1?!1:s.canExecute&&s.hasBash&&s.hasCurl}function Jr(t){const n=t.state,r=(n?.installed??[]).filter(b=>!Ve(b.name)),s=(n?.online??[]).filter(b=>!Ve(b.name)),a=new Set((n?.servers??[]).map(b=>b.config.distro)),v=r.filter(b=>!a.has(b.name)),l=Qr(t.selectedDistro,r,v),g=l?n?.opencodeChecks[l]??null:null,f=sn(r,s),y=an(f,t.catalogSearch),$=ln(t.catalogTarget,y);return{busy:!!n?.job||t.adding||t.probingAddable,runtimeState:Xr(n),visibleInstalledDistros:r,visibleOnlineDistros:s,addableInstalledDistros:v,selectedDistro:l,opencodeCheck:g,wslReady:!!n?.runtime?.available&&!n?.pendingRestart,distroStatuses:Object.fromEntries(v.flatMap(b=>{const S=en({state:n,name:b.name,probingAddable:t.probingAddable});return S?[[b.name,S]]:[]})),primaryButton:tn({state:n,selectedDistro:l,opencodeCheck:g,adding:t.adding,probingAddable:t.probingAddable}),installableDistros:f,filteredInstallableDistros:y,catalogTarget:$,installingCatalogDistro:n?.job?.kind==="install-distro"}}function Qr(t,n,r){if(t&&r.some(a=>a.name===t&&a.version!==1))return t;const s=n.find(a=>a.isDefault);return s&&s.version!==1&&r.some(a=>a.name===s.name)?s.name:r.find(a=>a.version!==1)?.name??null}function Xr(t){return t?t.pendingRestart?"pendingRestart":t.runtime?t.runtime.available?"ready":"unavailable":"checking":"loading"}function en(t){const n=t.state?.installed.find(v=>v.name===t.name);if(n?.version===1)return{label:{key:"wsl.onboarding.distroStatus.unsupported"},tone:"muted"};const r=t.state?.job,s=t.state?.distroProbes[t.name];if(!s)return t.probingAddable||r?.kind==="probe-addable"&&r.distros.includes(t.name)?Me():void 0;if(!s.canExecute)return n?{label:{key:"wsl.onboarding.openDistroOnce",params:{distro:t.name}},tone:"warning"}:{label:{key:"wsl.onboarding.distroNotInstalled",params:{distro:t.name}},tone:"warning"};if(!s.hasBash||!s.hasCurl)return{label:{key:"wsl.onboarding.distroStatus.missingTools"},tone:"warning"};const a=t.state?.opencodeChecks[t.name];return a?a.matchesDesktop===!1?{label:{key:"wsl.onboarding.updateOpencode"},tone:"warning"}:a.resolvedPath?a.error?{label:{key:"wsl.onboarding.installOpencode"},tone:"warning"}:{label:{key:"wsl.onboarding.distroStatus.ready"},tone:"success"}:{label:{key:"wsl.onboarding.distroStatus.opencodeMissing"},tone:"warning"}:t.probingAddable||r?.kind==="probe-addable"&&r.distros.includes(t.name)?Me():void 0}function Me(){return{label:{key:"wsl.onboarding.distroStatus.checking"},tone:"muted"}}function tn(t){const n=!!t.selectedDistro&&ke(t.state,t.selectedDistro),r=t.probingAddable&&!nn(t.state,t.selectedDistro),s=r||n&&(!t.opencodeCheck||!!t.selectedDistro&&t.state?.job?.kind==="probe-addable"&&t.state.job.distros.includes(t.selectedDistro)),a=t.state?.job?.kind==="install-opencode"&&t.state.job.distro===t.selectedDistro;if(!n||s)return{variant:"contrast",label:r?{key:"wsl.onboarding.distroStatus.checking"}:{key:"wsl.server.add"},disabled:!0,action:null,loading:r,width:null};if(!rn(t.opencodeCheck)){const v=!!t.opencodeCheck?.resolvedPath&&t.opencodeCheck.matchesDesktop===!1;return{variant:"neutral",label:a?{key:"wsl.onboarding.updatingOpencode"}:v?{key:"wsl.onboarding.updateOpencode"}:{key:"wsl.onboarding.installOpencode"},disabled:!!t.state?.job||t.adding,action:"install-opencode",loading:a,width:v?"138px":"129px"}}return{variant:"contrast",label:t.adding?{key:"wsl.onboarding.adding"}:{key:"wsl.server.add"},disabled:t.adding||!!t.state?.job,action:"add",loading:t.adding,width:null}}function rn(t){return!!t?.resolvedPath&&t.matchesDesktop!==!1&&!t.error}function nn(t,n){return!n||t?.installed.find(s=>s.name===n)?.version===1||!t?.distroProbes[n]?!1:ke(t,n)?!!t.opencodeChecks[n]:!0}function sn(t,n){const r=new Set(t.map(a=>a.name)),s=n.some(a=>/^Ubuntu-\d/.test(a.name));return n.filter(a=>!r.has(a.name)).filter(a=>a.name!=="Ubuntu"||!s)}function an(t,n){const r=n.trim();return r?Se.go(r,t,{keys:["label","name"]}).map(s=>s.obj):t}function ln(t,n){return t&&n.some(r=>r.name===t)?t:n[0]?.name??null}function on(t){const n=t.state;if(!n?.runtime?.available||n.pendingRestart||t.view!=="main"||t.adding||n.job)return;const r=t.selectedDistro?[...t.addableInstalledDistros.filter(a=>a.name===t.selectedDistro),...t.addableInstalledDistros.filter(a=>a.name!==t.selectedDistro)]:t.addableInstalledDistros,s=r.flatMap(a=>a.version===1?[]:n.distroProbes[a.name]?ke(n,a.name)&&!n.opencodeChecks[a.name]?[`opencode:${a.name}`]:[]:[`distro:${a.name}`]);if(s.length)return{key:s.join("|"),distros:r.filter(a=>a.version!==1).map(a=>a.name)}}function cn(t){if(!(!t.state||t.busy||t.state.pendingRestart)){if(!t.state.runtime)return{key:"runtime",action:"probeRuntime"};if(t.state.runtime.available&&!(t.state.installed.length||t.state.online.length))return{key:"distros",action:"refreshDistros"}}}function dn(t){const n=cn({state:t.state,busy:t.busy});if(n)return{kind:"auto",key:`auto:${n.key}`,plan:n};const r=on(t);if(r)return{kind:"addable",key:`addable:${r.key}`,plan:r}}function gn(){let t;return{accepts(n){return n!==t},settle(n,r){r&&(t=n)},reset(){t=void 0}}}async function un(t){await t.api.probeAddable(t.plan.distros)}function vn(t){const n=gn(),r=Ze(()=>({mutationFn:async s=>{if(s.kind==="addable"){await un({plan:s.plan,api:t.api});return}s.plan.action==="probeRuntime"&&await t.api.probeRuntime(),s.plan.action==="refreshDistros"&&await t.api.refreshDistros()},onError:t.onError,onSettled:(s,a,v)=>{v&&n.settle(v.key,a)}}));return xt(()=>{if(r.isPending)return;const s=dn({state:t.state(),view:t.view(),adding:t.adding(),busy:t.busy(),selectedDistro:t.selectedDistro(),addableInstalledDistros:t.addableInstalledDistros()});!s||!n.accepts(s.key)||r.mutate(s)}),{probingAddable:()=>r.isPending&&r.variables?.kind==="addable",resetProbeFailure:()=>n.reset()}}var hn=d("<div class=settings-v2-wsl-section-header><span class=settings-v2-wsl-section-title>"),pn=d("<div class=settings-v2-wsl-distro-list>"),mn=d('<button type=button class=settings-v2-wsl-catalog-card><span class=settings-v2-wsl-catalog-icon aria-hidden=true><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M13.5564 10.4443V13.5554H4.22309C3.24087 13.5554 2.44531 13.5554 2.44531 13.5554V10.4443M11.112 5.99989L8.00087 9.111L4.88976 5.99989M8.00087 9.111L8.00087 2.44434"stroke=currentColor></path></svg></span><span class=settings-v2-wsl-catalog-copy><span class=settings-v2-wsl-catalog-title></span><span class=settings-v2-wsl-catalog-description></span></span><span class=settings-v2-wsl-catalog-chevron aria-hidden=true><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M6 12L10 8L6 4"stroke=currentColor>'),fe=d("<div class=settings-v2-wsl-loading>"),fn=d("<div class=settings-v2-wsl-catalog-list>"),Be=d("<span class=settings-v2-wsl-distro-label>"),bn=d("<div class=settings-v2-wsl-distro-list><div class=settings-v2-wsl-distro-empty>"),wn=d("<span class=settings-v2-wsl-distro-status>"),$n=d("<p class=settings-v2-wsl-unavailable-error>"),_n=d('<div class=settings-v2-wsl-not-installed-content><div class=settings-v2-wsl-not-installed-message><svg class=settings-v2-wsl-not-installed-icon width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg aria-hidden=true><g clip-path=url(#settings-v2-wsl-warning-clip)><path fill-rule=evenodd clip-rule=evenodd d="M12 -0.00244141L23.6926 20.2498H0.308594L12 -0.00244141ZM12.7954 6.32932C12.5844 6.11834 12.2982 5.99982 11.9999 5.99982C11.7015 5.99982 11.4154 6.11834 11.2044 6.32932C10.9934 6.5403 10.8749 6.82645 10.8749 7.12482V11.6248C10.8749 11.9232 10.9934 12.2093 11.2044 12.4203C11.4154 12.6313 11.7015 12.7498 11.9999 12.7498C12.2982 12.7498 12.5844 12.6313 12.7954 12.4203C13.0064 12.2093 13.1249 11.9232 13.1249 11.6248V7.12482C13.1249 6.82645 13.0064 6.5403 12.7954 6.32932ZM13.0605 17.5605C12.7792 17.8418 12.3977 17.9998 11.9999 17.9998C11.6021 17.9998 11.2205 17.8418 10.9392 17.5605C10.6579 17.2792 10.4999 16.8976 10.4999 16.4998C10.4999 16.102 10.6579 15.7205 10.9392 15.4392C11.2205 15.1579 11.6021 14.9998 11.9999 14.9998C12.3977 14.9998 12.7792 15.1579 13.0605 15.4392C13.3418 15.7205 13.4999 16.102 13.4999 16.4998C13.4999 16.8976 13.3418 17.2792 13.0605 17.5605Z"fill=#DBDBDB></path></g><defs><clipPath id=settings-v2-wsl-warning-clip><rect width=24 height=24 fill=white></rect></clipPath></defs></svg><h2 class=settings-v2-wsl-not-installed-title></h2><p class=settings-v2-wsl-not-installed-description>');function yn(t){return t?/WSL is not installed|not been installed|wsl(?:\.exe)? --install/i.test(t):!0}function Ne(t,n){return n.params?t.t(n.key,n.params):t.t(n.key)}function Sn(t={}){const n=U(),r=Cn(t),s=r.model,a=()=>s().primaryButton,v=()=>{const l=a().width;if(l)return{width:l}};return e(m,{get when(){return T(()=>!r.wslServers.isPending)()&&!r.wslServers.isError},get fallback(){return e(oe,{fit:!0,class:"settings-v2-wsl-dialog",get children(){return e(m,{get when(){return!r.wslServers.isError},get fallback(){return(()=>{var l=fe();return i(l,()=>r.loadError()),l})()},get children(){var l=fe();return i(l,e(ge,{})),l}})}})},get children(){return e(m,{get when(){return s().runtimeState==="ready"},get fallback(){return e(m,{get when(){return s().runtimeState==="checking"||s().runtimeState==="loading"},get fallback(){return e(kn,{get state(){return s().runtimeState},get error(){return r.runtimeError()},get installable(){return yn(r.runtimeError())},get busy(){return s().busy},get onInstall(){return r.installWsl}})},get children(){return e(oe,{fit:!0,class:"settings-v2-wsl-dialog",get children(){var l=fe();return i(l,e(ge,{})),l}})}})},get children(){return e(oe,{fit:!0,class:"settings-v2-wsl-dialog",get children(){return[e(It,{hideClose:!0,get children(){return e(Tt,{get children(){return T(()=>r.view()==="main")()?n.t("wsl.server.add"):n.t("wsl.onboarding.installDistro")}})}}),e(Pt,{}),e(m,{get when(){return r.view()==="main"},get fallback(){return[e(Te,{class:"settings-v2-wsl-dialog-body settings-v2-wsl-catalog-picker",get children(){return[e(se,{class:"settings-v2-wsl-catalog-search",appearance:"large",get placeholder(){return n.t("wsl.onboarding.searchDistros")},get value(){return r.catalogSearch()},get disabled(){return s().busy},onInput:l=>r.setCatalogSearch(l.currentTarget.value)}),(()=>{var l=fn();return i(l,e(Oe,{hideLabel:!0,class:"settings-v2-wsl-distro-group",get label(){return n.t("wsl.onboarding.installDistro")},get value(){return s().catalogTarget??void 0},get onChange(){return r.setCatalogTarget},get disabled(){return s().busy},get children(){return e(J,{get each(){return s().filteredInstallableDistros},children:g=>e(Fe,{class:"settings-v2-wsl-distro-row settings-v2-wsl-catalog-row",get value(){return g.name},get disabled(){return s().busy},get label(){return(()=>{var f=Be();return i(f,()=>g.label),f})()}})})}})),l})()]}}),e(Pe,{get children(){return[e(M,{variant:"neutral",get disabled(){return s().busy},get onClick(){return r.closeCatalog},get children(){return n.t("common.cancel")}}),e(M,{get variant(){return s().installingCatalogDistro?"loading":"contrast"},get disabled(){return T(()=>!s().installingCatalogDistro)()&&(s().busy||!s().catalogTarget)},style:{width:"99px"},get onClick(){return r.installCatalogDistro},get children(){return e(m,{get when(){return s().installingCatalogDistro},get fallback(){return n.t("wsl.onboarding.installDistro")},get children(){return e(ge,{})}})}})]}})]},get children(){return[e(Te,{class:"settings-v2-wsl-dialog-body",get children(){return[(()=>{var l=hn(),g=l.firstChild;return i(g,()=>n.t("wsl.onboarding.installedDistros")),i(l,e(M,{variant:"ghost-muted",size:"small",get disabled(){return s().busy},get onClick(){return r.refreshDistros},get children(){return n.t("wsl.onboarding.checkAgain")}}),null),l})(),e(m,{get when(){return s().addableInstalledDistros.length>0},get fallback(){return(()=>{var l=bn(),g=l.firstChild;return i(g,(()=>{var f=T(()=>!!s().visibleInstalledDistros.length);return()=>f()?n.t("wsl.onboarding.allDistrosAdded"):n.t("wsl.onboarding.noDistros")})()),l})()},get children(){var l=pn();return i(l,e(Oe,{hideLabel:!0,class:"settings-v2-wsl-distro-group",get label(){return n.t("wsl.onboarding.installedDistros")},get value(){return s().selectedDistro??void 0},get onChange(){return r.setSelectedDistro},get disabled(){return s().busy},get children(){return e(J,{get each(){return s().addableInstalledDistros},children:g=>{const f=()=>s().distroStatuses[g.name]??null;return e(Fe,{get class(){return`settings-v2-wsl-distro-row${g.version===1?" settings-v2-wsl-distro-row--unsupported":""}`},get value(){return g.name},get disabled(){return g.version===1||s().busy},get label(){return(()=>{var y=Be();return i(y,()=>g.name),y})()},get description(){return e(m,{get when(){return f()},children:y=>(()=>{var $=wn();return i($,()=>Ne(n,y().label)),ve(()=>qe($,"data-tone",y().tone)),$})()})}})}})}})),l}}),e(m,{get when(){return s().installableDistros.length>0},get children(){var l=mn(),g=l.firstChild,f=g.nextSibling,y=f.firstChild,$=y.nextSibling;return Lt(l,"click",r.openCatalog,!0),i(y,()=>n.t("wsl.onboarding.needAnotherDistro")),i($,()=>n.t("wsl.onboarding.needAnotherDistroHint")),ve(()=>l.disabled=s().busy),l}})]}}),e(Pe,{get children(){return[e(M,{variant:"neutral",get disabled(){return r.adding()},get onClick(){return r.close},get children(){return n.t("common.cancel")}}),e(M,{get variant(){return T(()=>!!a().loading)()?"loading":a().variant},get disabled(){return T(()=>!a().loading)()&&a().disabled},get style(){return v()},get onClick(){return r.runPrimary},get children(){return e(m,{get when(){return a().loading},get fallback(){return Ne(n,a().label)},get children(){return e(ge,{})}})}})]}})]}})]}})}})}})}function Cn(t){const n=U(),r=ce(),s=ee(),a=Ce(),v=r.wslServers,[l,g]=Ue({view:"main",selectedDistro:null,catalogSearch:"",catalogTarget:null,adding:!1}),f=()=>a.data,y=_=>Jr({state:f(),view:l.view,selectedDistro:l.selectedDistro,catalogSearch:l.catalogSearch,catalogTarget:l.catalogTarget,adding:l.adding,probingAddable:_}),$=R(()=>y(!1)),p=vn({state:f,api:v,view:()=>l.view,adding:()=>l.adding,busy:()=>$().busy,selectedDistro:()=>$().selectedDistro,addableInstalledDistros:()=>$().addableInstalledDistros,onError:_=>be(n,_)}),b=R(()=>y(p.probingAddable())),S=()=>{const _=b().installableDistros[0];g({view:"catalog",catalogSearch:"",catalogTarget:_?.name??null})},P=async _=>{try{await _()}catch(V){be(n,V)}},L=()=>{P(async()=>{p.resetProbeFailure(),await v.refreshDistros()})},O=_=>{P(async()=>{p.resetProbeFailure(),await v.installDistro(_),g("view","main")})},F=()=>{if(b().installingCatalogDistro)return;const _=b().catalogTarget;_&&O(_)},w=()=>{p.resetProbeFailure(),g({view:"main",catalogSearch:"",catalogTarget:null})},h=async()=>{const _=b().primaryButton;if(_.loading)return;const V=b().selectedDistro,q=_.action;if(!(!V||!q)){if(q==="install-opencode"){await P(()=>v.installOpencode(V));return}g("adding",!0);try{await v.addServer(V),t.onAdded?await t.onAdded(V):s.close()}catch(I){be(n,I)}finally{g("adding",!1)}}};return{wslServers:a,model:b,loadError:()=>{const _=a.error;return _?_ instanceof Error?_.message:String(_):n.t("wsl.onboarding.loadFailed")},runtimeError:()=>f()?.runtime?.error??null,view:()=>l.view,catalogSearch:()=>l.catalogSearch,adding:()=>l.adding,setCatalogSearch:_=>g("catalogSearch",_),setCatalogTarget:_=>g("catalogTarget",_),setSelectedDistro:_=>g("selectedDistro",_),openCatalog:S,closeCatalog:w,refreshDistros:L,installCatalogDistro:F,installWsl:()=>void P(()=>v.installWsl()),runPrimary:()=>void h(),close:()=>s.close()}}function kn(t){const n=U(),r=ee(),s=()=>t.state==="pendingRestart"?n.t("wsl.onboarding.restartRequired"):t.installable?n.t("wsl.onboarding.wslNotInstalled.title"):n.t("wsl.onboarding.wslUnavailable.title"),a=()=>t.state==="pendingRestart"?n.t("wsl.onboarding.windowsRestartRequired"):t.installable?n.t("wsl.onboarding.wslNotInstalled.description"):n.t("wsl.onboarding.wslUnavailable.description");return e(oe,{fit:!0,class:"settings-v2-wsl-not-installed-dialog",get children(){var v=_n(),l=v.firstChild,g=l.firstChild,f=g.nextSibling,y=f.nextSibling;return i(f,s),i(y,a),i(l,e(m,{get when(){return T(()=>!t.installable)()&&t.error},get children(){var $=$n();return i($,()=>t.error),$}}),null),i(v,e(m,{get when(){return T(()=>t.state==="unavailable")()&&t.installable},get children(){return e(M,{variant:"neutral",get disabled(){return t.busy},get onClick(){return t.onInstall},get children(){return n.t("wsl.onboarding.installWsl")}})}}),null),i(v,e(m,{get when(){return t.state!=="unavailable"},get children(){return e(M,{variant:"neutral",onClick:()=>r.close(),get children(){return n.t("common.close")}})}}),null),v}})}function be(t,n){console.error("WSL servers request failed",n instanceof Error?n.stack??n.message:String(n)),Et({variant:"error",title:t.t("common.requestFailed"),description:n instanceof Error?n.message:String(n)})}we(["click"]);var Dn=d('<div class=settings-v2-servers-row><div class=settings-v2-servers-lead><div class=settings-v2-servers-copy><span class="flex min-w-0 items-center gap-1"><span class=settings-v2-servers-name></span><span class="shrink-0 rounded-[3px] border border-v2-border-border-base px-1 py-0.5 text-[9px] leading-none text-v2-text-text-muted"></span></span><span class=settings-v2-servers-meta></span></div></div><div class=settings-v2-servers-actions>');function je(t){return t.type==="sidecar"&&t.variant==="wsl"}function xn(t){const n=ce(),r=ee(),s=U(),a=()=>{r.push(()=>e(Sn,{}))};return e(m,{get when(){return n.wslServers},get fallback(){return e(M,{variant:"ghost-muted",icon:"plus",get onClick(){return t.onAddServer},get children(){return s.t("dialog.server.add.button")}})},get children(){return e(E,{gutter:4,modal:!1,placement:"bottom-end",get children(){return[e(E.Trigger,{as:M,variant:"ghost-muted",icon:"plus",get children(){return s.t("dialog.server.add.button")}}),e(E.Portal,{get children(){return e(E.Content,{get children(){return[e(E.Item,{get onSelect(){return t.onAddServer},get children(){return s.t("dialog.server.add.button")}}),e(E.Item,{onSelect:a,get children(){return s.t("wsl.server.add")}})]}})}})]}})}})}function In(t){const n=Ce();return R(()=>{const r=n.data?.servers??[],s=t().trim();return s?Se.go(s,r,{keys:[a=>a.config.distro,a=>a.config.id]}).map(a=>a.obj):r})}function Tn(t){const n=ce(),r=U(),s=Ce(),a=n.wslServers,v=Ze(()=>({mutationFn:g=>g(),onError:g=>le({variant:"error",title:r.t("common.requestFailed"),description:g instanceof Error?g.message:String(g)})})),l=g=>{v.mutate(()=>t.controller.handleRemove(g))};return e(m,{when:a,get children(){return e(J,{get each(){return t.servers()},children:g=>{const f=Ke.Key.make(g.config.id),y=()=>s.data?.opencodeChecks[g.config.distro],$=()=>Yr(y()),p=()=>s.data?.job?.kind==="install-opencode"&&s.data.job.distro===g.config.distro;return(()=>{var b=Dn(),S=b.firstChild,P=S.firstChild,L=P.firstChild,O=L.firstChild,F=O.nextSibling,w=L.nextSibling,h=S.nextSibling;return i(S,e(Ge,{get health(){return t.controller.status()[f]}}),P),i(O,()=>g.config.distro),i(F,()=>r.t("wsl.server.label")),i(w,e(m,{get when(){return y()?.version},children:C=>`v${C()}`})),i(h,e(m,{get when(){return T(()=>!!t.controller.canDefault())()&&t.controller.defaultKey()===f},get children(){return e(ne,{get children(){return r.t("dialog.server.status.default")}})}}),null),i(h,e(m,{get when(){return $()},children:C=>e(M,{size:"small",get disabled(){return p()||v.isPending},onClick:()=>a&&v.mutate(()=>a.installOpencode(g.config.distro)),get children(){return T(()=>!!p())()?r.t("wsl.server.updating"):C()}})}),null),i(h,e(E,{gutter:4,modal:!1,placement:"bottom-end",get children(){return[e(E.Trigger,{as:_e,variant:"ghost-muted",size:"small",get icon(){return e(ye,{name:"outline-dots"})},get"aria-label"(){return r.t("common.moreOptions")}}),e(E.Portal,{get children(){return e(E.Content,{get children(){return e(E.Group,{get children(){return[e(E.GroupLabel,{get children(){return r.t("wsl.server.menu.label")}}),e(m,{get when(){return Hr(g.runtime)},get children(){return e(E.Item,{onSelect:()=>a&&v.mutate(()=>a.startServer(f)),get children(){return r.t("wsl.server.retryStart")}})}}),e(m,{get when(){return T(()=>!!t.controller.canDefault())()&&t.controller.defaultKey()!==f},get children(){return e(E.Item,{onSelect:()=>t.controller.setDefault(f),get children(){return r.t("dialog.server.menu.default")}})}}),e(m,{get when(){return T(()=>!!t.controller.canDefault())()&&t.controller.defaultKey()===f},get children(){return e(E.Item,{onSelect:()=>t.controller.setDefault(null),get children(){return r.t("dialog.server.menu.defaultRemove")}})}}),e(E.Separator,{}),e(E.Item,{onSelect:()=>l(f),get children(){return r.t("dialog.server.menu.delete")}})]}})}})}})]}}),null),b})()}})}})}var Pn=d("<div class=settings-v2-tab-search>"),Ln=d('<div class="settings-v2-tab-header settings-v2-servers-header"><div class=settings-v2-tab-header-row><h2 class=settings-v2-tab-title>'),En=d('<div class="settings-v2-tab-body settings-v2-servers">'),An=d("<span class=settings-v2-servers-status-filter>"<!>""),Rn=d("<div class=settings-v2-servers-status><span>"),On=d("<div class=settings-v2-servers-row><div class=settings-v2-servers-lead><div class=settings-v2-servers-copy><span class=settings-v2-servers-name></span><span class=settings-v2-servers-meta></span></div></div><div class=settings-v2-servers-actions>");const Fn=()=>{const t=ee(),n=U(),r=At(),[s,a]=Ue({filter:""}),v=In(()=>s.filter),l=R(()=>r.sortedItems().filter($=>!je($)).length+v().length>1),g=R(()=>{const $=r.sortedItems().filter(b=>!je(b)),p=s.filter.trim();return p?Se.go(p,$,{keys:[b=>Le(b),b=>b.http.url]}).map(b=>b.obj):$}),f=()=>{t.push(()=>e(Ee,{mode:"add"}))},y=$=>{t.push(()=>e(Ee,{mode:"edit",server:$}))};return[(()=>{var $=Ln(),p=$.firstChild,b=p.firstChild;return i(b,()=>n.t("status.popover.tab.servers")),i(p,e(xn,{onAddServer:f}),null),i($,e(m,{get when(){return l()},get children(){var S=Pn();return i(S,e(se,{type:"search",appearance:"base",get value(){return s.filter},onInput:P=>a("filter",P.currentTarget.value),get placeholder(){return n.t("dialog.server.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get"aria-label"(){return n.t("dialog.server.search.placeholder")}}),null),i(S,e(m,{get when(){return s.filter},get children(){return e(_e,{type:"button",variant:"ghost-muted",size:"small",class:"settings-v2-tab-search-clear",get icon(){return e(ye,{name:"close",size:"large",class:"text-v2-icon-icon-muted"})},onClick:()=>a("filter","")})}}),null),S}}),null),ve(()=>$.classList.toggle("settings-v2-tab-header--stacked",!!l())),$})(),(()=>{var $=En();return i($,e(m,{get when(){return g().length>0||v().length>0},get fallback(){return(()=>{var p=Rn(),b=p.firstChild;return i(b,(()=>{var S=T(()=>!!s.filter);return()=>S()?n.t("palette.empty"):n.t("dialog.server.empty")})()),i(p,e(m,{get when(){return s.filter},get children(){var S=An(),P=S.firstChild,L=P.nextSibling;return L.nextSibling,i(S,()=>s.filter,L),S}}),null),p})()},get children(){return e(z,{get children(){return[e(Tn,{controller:r,servers:v}),e(J,{get each(){return g()},children:p=>{const b=Ke.key(p),S=()=>r.status()[b],P=()=>r.defaultKey()===b;return(()=>{var L=On(),O=L.firstChild,F=O.firstChild,w=F.firstChild,h=w.nextSibling,C=O.nextSibling;return i(O,e(Ge,{get health(){return S()}}),F),i(w,()=>Le(p)),i(h,e(m,{get when(){return S()?.version},get children(){return["v",T(()=>S()?.version)]}}),null),i(h,e(m,{get when(){return T(()=>!!S()?.version)()&&p.type==="http"},children:" • "}),null),i(h,e(m,{get when(){return T(()=>p.type==="http")()&&p.http.username},get fallback(){return e(m,{get when(){return p.type==="http"},get children(){return n.t("server.row.noUsername")}})},get children(){return p.http.username}}),null),i(C,e(m,{get when(){return T(()=>!!r.canDefault())()&&P()},get children(){return e(ne,{get children(){return n.t("dialog.server.status.default")}})}}),null),i(C,e(Rt,{server:p,controller:r,onEdit:y}),null),L})()}})]}})}})),$})()]};var Vn=d('<div class="flex flex-col justify-between h-full w-full"><div class="flex flex-col gap-3 w-full"><div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div></div></div><div class=settings-v2-nav-footer><span></span><span>v');const Mn=t=>{const n=U(),r=ce(),s=ee(),a=Ot(),v=Ft(),l=$e(),[g,f]=Vt(t.defaultValue??"general"),y=R(()=>{const p=a.route();if(p.type==="dir-new-sesssion")return p.dir;if(p.type==="draft"){const b=v.store.find(S=>S.type==="draft"&&S.draftID===p.draftID);return b?.type==="draft"?b.directory:void 0}if(p.type==="session")return l().session.get(p.sessionId)?.directory}),$=()=>{s.show(()=>e(Mn,{get sessionID(){return t.sessionID},defaultValue:"providers"}))};return e(oe,{size:"x-large",variant:"settings",class:"settings-v2-dialog",get children(){return e(N,{orientation:"vertical",variant:"settings",get value(){return g()},onChange:p=>void Mt(()=>f(p)),class:"settings-v2",get children(){return[e(N.List,{get children(){var p=Vn(),b=p.firstChild,S=b.firstChild,P=S.firstChild,L=P.firstChild,O=P.nextSibling,F=O.firstChild,w=b.nextSibling,h=w.firstChild,C=h.nextSibling;return C.firstChild,i(P,e(N.SectionTitle,{get children(){return n.t("settings.section.desktop")}}),L),i(L,e(N.Trigger,{value:"general",get children(){return[e(ae,{name:"sliders"}),T(()=>n.t("settings.tab.general"))]}}),null),i(L,e(N.Trigger,{value:"shortcuts",get children(){return[e(ae,{name:"keyboard"}),T(()=>n.t("settings.tab.shortcuts"))]}}),null),i(O,e(N.SectionTitle,{get children(){return n.t("settings.section.server")}}),F),i(F,e(N.Trigger,{value:"servers",get children(){return[e(ae,{name:"server"}),T(()=>n.t("status.popover.tab.servers"))]}}),null),i(F,e(N.Trigger,{value:"providers",get children(){return[e(ae,{name:"providers"}),T(()=>n.t("settings.providers.title"))]}}),null),i(F,e(N.Trigger,{value:"models",get children(){return[e(ae,{name:"models"}),T(()=>n.t("settings.models.title"))]}}),null),i(h,()=>n.t("app.name.desktop")),i(C,()=>r.version,null),p}}),e(N.Content,{value:"general",class:"settings-v2-panel",get children(){return e(kr,{get sessionID(){return t.sessionID}})}}),e(N.Content,{value:"shortcuts",class:"settings-v2-panel",get children(){return e(Nt,{v2:!0})}}),e(N.Content,{value:"servers",class:"settings-v2-panel",get children(){return e(Fn,{})}}),e(N.Content,{value:"providers",class:"settings-v2-panel",get children(){return e(Or,{directory:y,onBack:$})}}),e(N.Content,{value:"models",class:"settings-v2-panel",get children(){return e(qr,{})}})]}})}})};export{Mn as DialogSettings};
|
|
3
3
|
//# sourceMappingURL=index-wflYMX4p.js.map
|