import{c as Oe,a as f,d as We,s as d,e as pe,f as P}from"../chunks/BLoZk-4Q.js";import"../chunks/DnbEMVOy.js";import{o as Mt}from"../chunks/C4C6gRQf.js";import{f as ye,P as Xe,R as a,T as t,U as l,t as j,K as e,Q as Ye,V as ze,W as B,X as k,Y as et}from"../chunks/CkWh75VR.js";import{l as Re,s as De,p as T,i as fe,b as Ze,a as Ge}from"../chunks/BIAtSU2q.js";import{I as Ve,s as Be,e as Fe,i as Ue,r as le,b as M,d as tt,t as Je,c as Pt,a as qe,f as Nt}from"../chunks/Bmr4jBBJ.js";import{b as ue,a as zt}from"../chunks/DppCjq5L.js";import{c as Ct,a as st,b as nt,i as jt,d as Kt}from"../chunks/Cxgk6Ihq.js";import{s as Lt}from"../chunks/CLAQm0y3.js";import{c as Tt}from"../chunks/KAGS2ztk.js";import{S as Et,s as St}from"../chunks/BYua9gIY.js";import{C as It}from"../chunks/DzYtD4Df.js";import{S as Ft}from"../chunks/BWaw-pIO.js";import{C as Ut}from"../chunks/SdiQyPyy.js";function qt(x,o){const r=Re(o,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z"}],["circle",{cx:"12",cy:"12",r:"10"}]];Ve(x,De({name:"compass"},()=>r,{get iconNode(){return N},children:(z,i)=>{var s=Oe(),g=ye(s);Be(g,o,"default",{}),f(z,s)},$$slots:{default:!0}}))}function ut(x,o){const r=Re(o,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}],["path",{d:"m2 2 20 20"}]];Ve(x,De({name:"eye-off"},()=>r,{get iconNode(){return N},children:(z,i)=>{var s=Oe(),g=ye(s);Be(g,o,"default",{}),f(z,s)},$$slots:{default:!0}}))}function pt(x,o){const r=Re(o,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}],["circle",{cx:"12",cy:"12",r:"3"}]];Ve(x,De({name:"eye"},()=>r,{get iconNode(){return N},children:(z,i)=>{var s=Oe(),g=ye(s);Be(g,o,"default",{}),f(z,s)},$$slots:{default:!0}}))}function ct(x,o){const r=Re(o,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];Ve(x,De({name:"loader"},()=>r,{get iconNode(){return N},children:(z,i)=>{var s=Oe(),g=ye(s);Be(g,o,"default",{}),f(z,s)},$$slots:{default:!0}}))}function Ot(x,o){const r=Re(o,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"}]];Ve(x,De({name:"moon"},()=>r,{get iconNode(){return N},children:(z,i)=>{var s=Oe(),g=ye(s);Be(g,o,"default",{}),f(z,s)},$$slots:{default:!0}}))}function Rt(x,o){const r=Re(o,["children","$$slots","$$events","$$legacy"]);/**
 * @license lucide-svelte v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N=[["circle",{cx:"12",cy:"12",r:"4"}],["path",{d:"M12 2v2"}],["path",{d:"M12 20v2"}],["path",{d:"m4.93 4.93 1.41 1.41"}],["path",{d:"m17.66 17.66 1.41 1.41"}],["path",{d:"M2 12h2"}],["path",{d:"M20 12h2"}],["path",{d:"m6.34 17.66-1.41 1.41"}],["path",{d:"m19.07 4.93-1.41 1.41"}]];Ve(x,De({name:"sun"},()=>r,{get iconNode(){return N},children:(z,i)=>{var s=Oe(),g=ye(s);Be(g,o,"default",{}),f(z,s)},$$slots:{default:!0}}))}var Dt=P("<option> </option>"),Vt=P("<option> </option>"),Bt=P('<button type="button" class="icon-toggle svelte-20i8nr"><!></button>'),At=P('<div class="card"><h3> </h3> <p class="card-desc svelte-20i8nr"> </p> <div class="form-grid-2 svelte-20i8nr"><div class="form-field svelte-20i8nr"><label for="llm-provider" class="svelte-20i8nr"> </label> <select id="llm-provider" class="svelte-20i8nr"></select></div> <div class="form-field svelte-20i8nr"><label for="llm-model" class="svelte-20i8nr"> </label> <select id="llm-model" class="svelte-20i8nr"></select></div></div> <div class="form-grid-2 svelte-20i8nr"><div class="form-field svelte-20i8nr"><label for="llm-api-key" class="svelte-20i8nr"> </label> <div class="input-with-icon svelte-20i8nr"><input id="llm-api-key" class="svelte-20i8nr"/> <!></div> <span class="field-hint svelte-20i8nr"> </span></div> <div class="form-field svelte-20i8nr"><label for="llm-base-url" class="svelte-20i8nr"> </label> <input id="llm-base-url" type="text" class="svelte-20i8nr"/> <span class="field-hint svelte-20i8nr"> </span></div></div> <div class="form-grid-2 svelte-20i8nr"><div class="form-field svelte-20i8nr"><label for="llm-max-tokens" class="svelte-20i8nr"> </label> <input id="llm-max-tokens" type="number" min="256" max="200000" step="256" class="svelte-20i8nr"/></div> <div class="form-field svelte-20i8nr"><label for="llm-temperature" class="svelte-20i8nr"> </label> <input id="llm-temperature" type="number" min="0" max="2" step="0.05" class="svelte-20i8nr"/></div></div></div>');function Ht(x,o){Xe(o,!0);const r=()=>Ze(Je,"$t",N),[N,z]=Ge();let i=T(o,"provider",15,""),s=T(o,"model",15,""),g=T(o,"apiKey",15,""),X=T(o,"baseUrl",15,""),U=T(o,"maxTokens",15,16384),K=T(o,"temperature",15,.3),te=T(o,"providerNames",19,()=>[]),Y=T(o,"modelsFor",3,v=>[]),me=T(o,"presets",19,()=>({})),q=T(o,"onProviderChange",3,()=>{}),O=ze(()=>{var v;return((v=me()[i()])==null?void 0:v.needs_key)!==!1}),u=B(!0);var R=At(),A=a(R),ae=a(A,!0);t(A);var H=l(A,2),ie=a(H,!0);t(H);var oe=l(H,2),_e=a(oe),be=a(_e),Ce=a(be,!0);t(be);var $e=l(be,2);Fe($e,21,te,Ue,(v,c)=>{var _=Dt(),F=a(_,!0);t(_);var E={};j(()=>{d(F,e(c)),E!==(E=e(c))&&(_.value=(_.__value=e(c))??"")}),f(v,_)}),t($e),t(_e);var he=l(_e,2),ke=a(he),je=a(ke,!0);t(ke);var xe=l(ke,2);Fe(xe,21,()=>Y()(i()),Ue,(v,c)=>{var _=Vt(),F=a(_,!0);t(_);var E={};j(()=>{d(F,e(c)),E!==(E=e(c))&&(_.value=(_.__value=e(c))??"")}),f(v,_)}),t(xe),t(he),t(oe);var Ke=l(oe,2),we=a(Ke),Le=a(we),D=a(Le,!0);t(Le);var S=l(Le,2),Q=a(S);le(Q);var m=l(Q,2);{var y=v=>{var c=Bt(),_=a(c);{var F=C=>{pt(C,{size:16})},E=C=>{ut(C,{size:16})};fe(_,C=>{e(u)?C(F):C(E,!1)})}t(c),pe("click",c,()=>k(u,!e(u))),f(v,c)};fe(m,v=>{e(O)&&v(y)})}t(S);var h=l(S,2),V=a(h,!0);t(h),t(we);var Z=l(we,2),G=a(Z),Me=a(G,!0);t(G);var W=l(G,2);le(W);var re=l(W,2),I=a(re,!0);t(re),t(Z),t(Ke);var w=l(Ke,2),Te=a(w),Pe=a(Te),ve=a(Pe,!0);t(Pe);var Ee=l(Pe,2);le(Ee),t(Te);var Se=l(Te,2),Ne=a(Se),p=a(Ne,!0);t(Ne);var n=l(Ne,2);le(n),t(Se),t(w),t(R),j((v,c,_,F,E,C,J,se,Ie,ge,b,$)=>{d(ae,v),d(ie,c),d(Ce,_),d(je,F),d(D,E),M(Q,"type",e(u)?"password":"text"),M(Q,"placeholder",C),Q.disabled=!e(O),d(V,J),d(Me,se),M(W,"placeholder",Ie),d(I,ge),d(ve,b),d(p,$)},[()=>r()("settings.default_llm"),()=>r()("settings.default_llm_desc"),()=>r()("settings.provider"),()=>r()("settings.model"),()=>r()("settings.api_key"),()=>r()("settings.api_key_placeholder"),()=>r()("settings.api_key_hint"),()=>r()("settings.base_url"),()=>r()("settings.base_url_placeholder"),()=>r()("settings.base_url_hint"),()=>r()("settings.max_tokens"),()=>r()("settings.temperature")]),pe("change",$e,function(...v){var c;(c=q())==null||c.apply(this,v)}),tt($e,i),tt(xe,s),ue(Q,g),ue(W,X),ue(Ee,U),ue(n,K),f(x,R),Ye(),z()}We(["change","click"]);var Qt=P("<option> </option>"),Wt=P("<option> </option>"),Xt=P('<button type="button" class="icon-toggle svelte-1at9dgm"><!></button>'),Yt=P('<div class="role-body svelte-1at9dgm"><div class="form-row svelte-1at9dgm"><div class="form-field svelte-1at9dgm"><label class="svelte-1at9dgm"> </label> <select class="svelte-1at9dgm"></select></div> <div class="form-field svelte-1at9dgm"><label class="svelte-1at9dgm"> </label> <select class="svelte-1at9dgm"></select></div></div> <div class="form-row svelte-1at9dgm"><div class="form-field svelte-1at9dgm"><label class="svelte-1at9dgm"> </label> <div class="input-with-icon svelte-1at9dgm"><input class="svelte-1at9dgm"/> <!></div></div> <div class="form-field svelte-1at9dgm"><label class="svelte-1at9dgm"> </label> <input type="text" class="svelte-1at9dgm"/></div></div> <div class="form-row svelte-1at9dgm"><div class="form-field svelte-1at9dgm"><label class="svelte-1at9dgm"> </label> <input type="number" min="256" max="200000" step="256" class="svelte-1at9dgm"/></div> <div class="form-field svelte-1at9dgm"><label class="svelte-1at9dgm"> </label> <input type="number" min="0" max="2" step="0.05" class="svelte-1at9dgm"/></div></div></div>'),Zt=P('<div class="role-default svelte-1at9dgm"> </div>'),Gt=P('<div class="role-card svelte-1at9dgm"><button type="button" class="role-header svelte-1at9dgm"><div class="role-icon svelte-1at9dgm"><!></div> <div class="role-info svelte-1at9dgm"><div class="role-name svelte-1at9dgm"> </div> <div class="role-desc svelte-1at9dgm"> </div></div> <div><div class="toggle-thumb svelte-1at9dgm"></div></div></button> <!></div>');function Jt(x,o){Xe(o,!0);const r=()=>Ze(Je,"$t",N),[N,z]=Ge();let i=T(o,"role",19,()=>({})),s=T(o,"override",31,()=>et({enabled:!1,provider:"",model:"",api_key:"",base_url:"",max_tokens:"",temperature:""})),g=T(o,"defaultProvider",3,""),X=T(o,"defaultModel",3,""),U=T(o,"providerNames",19,()=>[]),K=T(o,"modelsFor",3,D=>[]),te=T(o,"onProviderChange",3,()=>{});function Y(){s(s().enabled=!s().enabled,!0),s().enabled&&!s().provider&&(s(s().provider=g(),!0),s(s().model=X(),!0))}let me=ze(()=>i().icon),q=ze(()=>s().enabled&&s().provider!==g()),O=B(!0),u=ze(()=>`role-${i().id}-key`),R=ze(()=>`role-${i().id}-base-url`),A=ze(()=>`role-${i().id}-max-tokens`),ae=ze(()=>`role-${i().id}-temperature`);var H=Gt(),ie=a(H),oe=a(ie),_e=a(oe);Tt(_e,()=>e(me),(D,S)=>{S(D,{size:22})}),t(oe);var be=l(oe,2),Ce=a(be),$e=a(Ce,!0);t(Ce);var he=l(Ce,2),ke=a(he,!0);t(he),t(be);var je=l(be,2);let xe;t(ie);var Ke=l(ie,2);{var we=D=>{var S=Yt(),Q=a(S),m=a(Q),y=a(m),h=a(y,!0);t(y);var V=l(y,2);Fe(V,21,U,Ue,(b,$)=>{var L=Qt(),de=a(L,!0);t(L);var ne={};j(()=>{d(de,e($)),ne!==(ne=e($))&&(L.value=(L.__value=e($))??"")}),f(b,L)}),t(V),t(m);var Z=l(m,2),G=a(Z),Me=a(G,!0);t(G);var W=l(G,2);Fe(W,21,()=>K()(s().provider),Ue,(b,$)=>{var L=Wt(),de=a(L,!0);t(L);var ne={};j(()=>{d(de,e($)),ne!==(ne=e($))&&(L.value=(L.__value=e($))??"")}),f(b,L)}),t(W),t(Z),t(Q);var re=l(Q,2),I=a(re),w=a(I),Te=a(w,!0);t(w);var Pe=l(w,2),ve=a(Pe);le(ve);var Ee=l(ve,2);{var Se=b=>{var $=Xt(),L=a($);{var de=ce=>{pt(ce,{size:14})},ne=ce=>{ut(ce,{size:14})};fe(L,ce=>{e(O)?ce(de):ce(ne,!1)})}t($),pe("click",$,()=>k(O,!e(O))),f(b,$)};fe(Ee,b=>{s().api_key&&b(Se)})}t(Pe),t(I);var Ne=l(I,2),p=a(Ne),n=a(p,!0);t(p);var v=l(p,2);le(v),t(Ne),t(re);var c=l(re,2),_=a(c),F=a(_),E=a(F,!0);t(F);var C=l(F,2);le(C),t(_);var J=l(_,2),se=a(J),Ie=a(se,!0);t(se);var ge=l(se,2);le(ge),t(J),t(c),t(S),j((b,$,L,de,ne,ce,Ae,He,at,Qe)=>{M(y,"for",`role-${i().id}-provider`),d(h,b),M(V,"id",`role-${i().id}-provider`),M(G,"for",`role-${i().id}-model`),d(Me,$),M(W,"id",`role-${i().id}-model`),M(w,"for",e(u)),d(Te,L),M(ve,"id",e(u)),M(ve,"type",e(O)?"password":"text"),M(ve,"placeholder",de),M(p,"for",e(R)),d(n,ne),M(v,"id",e(R)),M(v,"placeholder",ce),M(F,"for",e(A)),d(E,Ae),M(C,"id",e(A)),M(C,"placeholder",He),M(se,"for",e(ae)),d(Ie,at),M(ge,"id",e(ae)),M(ge,"placeholder",Qe)},[()=>r()("settings.provider"),()=>r()("settings.model"),()=>r()("settings.api_key"),()=>e(q)?r()("settings.api_key_placeholder"):r()("settings.use_default"),()=>r()("settings.base_url"),()=>r()("settings.use_default"),()=>r()("settings.max_tokens"),()=>r()("settings.use_default"),()=>r()("settings.temperature"),()=>r()("settings.use_default")]),pe("change",V,function(...b){var $;($=te())==null||$.apply(this,b)}),tt(V,()=>s().provider,b=>s(s().provider=b,!0)),tt(W,()=>s().model,b=>s(s().model=b,!0)),ue(ve,()=>s().api_key,b=>s(s().api_key=b,!0)),ue(v,()=>s().base_url,b=>s(s().base_url=b,!0)),ue(C,()=>s().max_tokens,b=>s(s().max_tokens=b,!0)),ue(ge,()=>s().temperature,b=>s(s().temperature=b,!0)),f(D,S)},Le=D=>{var S=Zt(),Q=a(S);t(S),j(m=>d(Q,`${m??""}: ${g()??""} / ${X()??""}`),[()=>r()("settings.use_default")]),f(D,S)};fe(Ke,D=>{s().enabled?D(we):D(Le,!1)})}t(H),j((D,S)=>{Pt(oe,`color: ${i().color??""}`),d($e,D),d(ke,S),xe=qe(je,1,"role-toggle svelte-1at9dgm",null,xe,{on:s().enabled})},[()=>r()(i().labelKey),()=>r()(i().descKey)]),pe("click",ie,Y),f(x,H),Ye(),z()}We(["click","change"]);var ea=P('<div class="card"><h3> </h3> <div class="lang-tabs svelte-t046k4"><button><svg class="flag svelte-t046k4" viewBox="0 0 60 30" width="24" height="12"><clipPath id="gb"><rect width="60" height="30" rx="2"></rect></clipPath><g clip-path="url(#gb)"><rect width="60" height="30" fill="#012169"></rect><path d="M0,0 L60,30 M60,0 L0,30" stroke="#fff" stroke-width="6"></path><path d="M0,0 L60,30 M60,0 L0,30" stroke="#C8102E" stroke-width="4" clip-path="url(#gb)"></path><path d="M30,0V30M0,15H60" stroke="#fff" stroke-width="10"></path><path d="M30,0V30M0,15H60" stroke="#C8102E" stroke-width="6"></path></g></svg> English</button> <button><svg class="flag svelte-t046k4" viewBox="0 0 60 30" width="24" height="12"><clipPath id="ru"><rect width="60" height="30" rx="2"></rect></clipPath><g clip-path="url(#ru)"><rect width="60" height="10" fill="#fff"></rect><rect y="10" width="60" height="10" fill="#0039A6"></rect><rect y="20" width="60" height="10" fill="#D52B1E"></rect></g></svg> Русский</button></div></div>');function ta(x,o){Xe(o,!0);const r=()=>Ze(Je,"$t",N),[N,z]=Ge();let i=T(o,"lang",15,"en");var s=ea(),g=a(s),X=a(g,!0);t(g);var U=l(g,2),K=a(U);let te;var Y=l(K,2);let me;t(U),t(s),j(q=>{d(X,q),te=qe(K,1,"tab svelte-t046k4",null,te,{active:i()==="en"}),me=qe(Y,1,"tab svelte-t046k4",null,me,{active:i()==="ru"})},[()=>r()("settings.language")]),pe("click",K,()=>i("en")),pe("click",Y,()=>i("ru")),f(x,s),Ye(),z()}We(["click"]);var aa=P('<div class="card"><h3> </h3> <div class="theme-tabs svelte-1ddl4or"><button><!> </button> <button><!> </button></div></div>');function ra(x,o){Xe(o,!0);const r=()=>Ze(Je,"$t",N),[N,z]=Ge();let i=T(o,"theme",15,"dark");var s=aa(),g=a(s),X=a(g,!0);t(g);var U=l(g,2),K=a(U);let te;var Y=a(K);Ot(Y,{size:14});var me=l(Y);t(K);var q=l(K,2);let O;var u=a(q);Rt(u,{size:14});var R=l(u);t(q),t(U),t(s),j((A,ae,H)=>{d(X,A),te=qe(K,1,"tab svelte-1ddl4or",null,te,{active:i()==="dark"}),d(me,` ${ae??""}`),O=qe(q,1,"tab svelte-1ddl4or",null,O,{active:i()==="light"}),d(R,` ${H??""}`)},[()=>r()("settings.theme"),()=>r()("settings.theme_dark"),()=>r()("settings.theme_light")]),pe("click",K,()=>i("dark")),pe("click",q,()=>i("light")),f(x,s),Ye(),z()}We(["click"]);var sa=P('<div class="loading-text"><!> </div>'),la=P("<button> </button>"),ia=P('<div class="card"><h3> </h3> <div class="form-grid-2 svelte-1pfxm7k"><div class="form-field svelte-1pfxm7k"><label for="project-name" class="svelte-1pfxm7k"> </label> <input id="project-name" type="text" class="svelte-1pfxm7k"/></div> <div class="form-field svelte-1pfxm7k"><label for="project-desc" class="svelte-1pfxm7k"> </label> <input id="project-desc" type="text" class="svelte-1pfxm7k"/></div></div></div> <div class="card"><h3> </h3> <div class="form-grid-2 svelte-1pfxm7k"><div class="form-field svelte-1pfxm7k"><label for="ui-port" class="svelte-1pfxm7k"> </label> <input id="ui-port" type="number" min="1024" max="65535" class="svelte-1pfxm7k"/> <span class="field-hint svelte-1pfxm7k"> </span></div> <div class="form-field checkbox-field svelte-1pfxm7k"><label class="checkbox-label svelte-1pfxm7k"><input type="checkbox" class="svelte-1pfxm7k"/> <span> </span></label></div></div></div> <!> <!>',1),oa=P('<div class="card"><h3> </h3> <p class="card-desc svelte-1pfxm7k"> </p> <div class="roles-list svelte-1pfxm7k"></div></div>'),va=P("<!> ",1),da=P("<!> ",1),na=P('<span class="save-ok svelte-1pfxm7k"> </span>'),ca=P('<span class="save-err svelte-1pfxm7k"> </span>'),ua=P('<div class="settings-tabs-layout svelte-1pfxm7k"><nav class="settings-tabs-nav svelte-1pfxm7k"></nav> <div class="settings-tabs-content svelte-1pfxm7k"><!> <div class="save-row svelte-1pfxm7k"><button class="btn btn-primary"><!></button> <!> <!></div></div></div>'),pa=P('<div class="page-with-tabs"><div class="main-header"><h2><!> </h2> <p> </p></div> <!></div>');function ma(x,o){Xe(o,!0);const r=()=>Ze(Je,"$t",N),[N,z]=Ge();let i=B(null),s=B(et({})),g=B(!1),X=B(!1),U=B(""),K=B("general");const te={anthropic:["claude-sonnet-4-6","claude-opus-4-6","claude-sonnet-4-5-20250929","claude-opus-4-5-20251120","claude-haiku-4-5-20251001"],openai:["gpt-5.2","gpt-5","gpt-5-mini","gpt-5-nano","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","o3","o4-mini","gpt-4o"],groq:["openai/gpt-oss-120b","openai/gpt-oss-20b","llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","meta-llama/llama-4-maverick-17b-128e-instruct","qwen/qwen3-32b","moonshotai/kimi-k2-instruct-0905","deepseek-r1-distill-llama-70b"],ollama:["llama3.3","llama4:scout","qwen3","qwen3-coder","deepseek-v3","deepseek-r1","mistral","codellama","phi4","gemma3"]},Y=[{id:"architect",icon:qt,labelKey:"settings.role_architect",descKey:"settings.role_architect_desc",color:"var(--ac)"},{id:"coder",icon:It,labelKey:"settings.role_coder",descKey:"settings.role_coder_desc",color:"var(--gn-bright)"},{id:"reviewer",icon:Ft,labelKey:"settings.role_reviewer",descKey:"settings.role_reviewer_desc",color:"var(--yl)"}];let me=ze(()=>[{id:"general",label:r()("settings.tab_general")},{id:"llm",label:r()("settings.tab_llm")},{id:"roles",label:r()("settings.tab_roles")}]),q=B(""),O=B(""),u=B(et({provider:"",model:"",api_key:"",base_url:"",max_tokens:16384,temperature:.3})),R=et({architect:{enabled:!1,provider:"",model:"",api_key:"",base_url:"",max_tokens:"",temperature:""},coder:{enabled:!1,provider:"",model:"",api_key:"",base_url:"",max_tokens:"",temperature:""},reviewer:{enabled:!1,provider:"",model:"",api_key:"",base_url:"",max_tokens:"",temperature:""}}),A=B("en"),ae=B("dark"),H=B(4700),ie=B(!0);const oe=Object.keys(te);Mt(async()=>{var m,y,h,V,Z,G,Me,W,re;try{k(i,await Ct("config",()=>st.getConfig()),!0),k(s,e(i)._provider_presets||{},!0),k(q,e(i).project_name||"",!0),k(O,e(i).project_description||"",!0),k(u,{provider:((m=e(i).llm)==null?void 0:m.provider)||"anthropic",model:((y=e(i).llm)==null?void 0:y.model)||"",api_key:((h=e(i).llm)==null?void 0:h.api_key)||"",base_url:((V=e(i).llm)==null?void 0:V.base_url)||"",max_tokens:((Z=e(i).llm)==null?void 0:Z.max_tokens)||16384,temperature:((G=e(i).llm)==null?void 0:G.temperature)??.3},!0),k(A,e(i).lang||"en",!0),k(ae,e(i).theme||"dark",!0),k(H,((Me=e(i).ui)==null?void 0:Me.port)||4700,!0),k(ie,((W=e(i).ui)==null?void 0:W.auto_open_browser)??!0,!0);for(const I of Y){const w=(re=e(i).roles)==null?void 0:re[I.id];R[I.id]=w!=null&&w.provider&&(w!=null&&w.model)?{enabled:!0,provider:w.provider,model:w.model,api_key:w.api_key||"",base_url:w.base_url||"",max_tokens:w.max_tokens??"",temperature:w.temperature??""}:{enabled:!1,provider:e(u).provider,model:"",api_key:"",base_url:"",max_tokens:"",temperature:""}}}catch(I){k(U,I.message,!0),nt(I.message,"settings")}});function _e(m){return te[m]||[]}function be(){e(u).model=_e(e(u).provider)[0]||""}function Ce(m){R[m].model=_e(R[m].provider)[0]||""}async function $e(){k(g,!0),k(X,!1),k(U,"");try{const m={llm:{provider:e(u).provider,model:e(u).model,api_key:e(u).api_key,base_url:e(u).base_url||null,max_tokens:Number(e(u).max_tokens)||16384,temperature:Number(e(u).temperature)??.3},ui:{port:Number(e(H))||4700,auto_open_browser:e(ie)},lang:e(A),theme:e(ae),project_name:e(q),project_description:e(O),roles:{}};for(const y of Y){const h=R[y.id];h.enabled&&h.provider&&h.model?m.roles[y.id]={provider:h.provider,model:h.model,api_key:h.api_key||null,base_url:h.base_url||null,max_tokens:h.max_tokens!==""?Number(h.max_tokens):null,temperature:h.temperature!==""?Number(h.temperature):null}:m.roles[y.id]=null}await st.saveConfig(m),Nt(e(A)),St(e(ae)),jt("config","status"),Lt.set(await st.getStatus()),Kt("Settings saved"),k(X,!0),setTimeout(()=>k(X,!1),3e3)}catch(m){k(U,m.message,!0),nt(m.message,"settings")}k(g,!1)}var he=pa(),ke=a(he),je=a(ke),xe=a(je);Et(xe,{size:24});var Ke=l(xe);t(je);var we=l(je,2),Le=a(we,!0);t(we),t(ke);var D=l(ke,2);{var S=m=>{var y=sa(),h=a(y);ct(h,{size:14,class:"spin"});var V=l(h);t(y),j(Z=>d(V,` ${Z??""}`),[()=>r()("app.loading")]),f(m,y)},Q=m=>{var y=ua(),h=a(y);Fe(h,21,()=>e(me),Ue,(p,n)=>{var v=la();let c;var _=a(v,!0);t(v),j(()=>{c=qe(v,1,"tab-item svelte-1pfxm7k",null,c,{active:e(K)===e(n).id}),d(_,e(n).label)}),pe("click",v,()=>k(K,e(n).id,!0)),f(p,v)}),t(h);var V=l(h,2),Z=a(V);{var G=p=>{var n=ia(),v=ye(n),c=a(v),_=a(c,!0);t(c);var F=l(c,2),E=a(F),C=a(E),J=a(C,!0);t(C);var se=l(C,2);le(se),t(E);var Ie=l(E,2),ge=a(Ie),b=a(ge,!0);t(ge);var $=l(ge,2);le($),t(Ie),t(F),t(v);var L=l(v,2),de=a(L),ne=a(de,!0);t(de);var ce=l(de,2),Ae=a(ce),He=a(Ae),at=a(He,!0);t(He);var Qe=l(He,2);le(Qe);var lt=l(Qe,2),mt=a(lt,!0);t(lt),t(Ae);var it=l(Ae,2),ot=a(it),rt=a(ot);le(rt);var vt=l(rt,2),_t=a(vt,!0);t(vt),t(ot),t(it),t(ce),t(L);var dt=l(L,2);ta(dt,{get lang(){return e(A)},set lang(ee){k(A,ee,!0)}});var gt=l(dt,2);ra(gt,{get theme(){return e(ae)},set theme(ee){k(ae,ee,!0)}}),j((ee,ft,bt,ht,kt,xt,yt,$t,wt)=>{d(_,ee),d(J,ft),M(se,"placeholder",bt),d(b,ht),M($,"placeholder",kt),d(ne,xt),d(at,yt),d(mt,$t),d(_t,wt)},[()=>r()("settings.project_title"),()=>r()("settings.project_name"),()=>r()("settings.project_name_placeholder"),()=>r()("settings.project_description"),()=>r()("settings.project_description_placeholder"),()=>r()("settings.ui_title"),()=>r()("settings.ui_port"),()=>r()("settings.ui_port_hint"),()=>r()("settings.auto_open_browser")]),ue(se,()=>e(q),ee=>k(q,ee)),ue($,()=>e(O),ee=>k(O,ee)),ue(Qe,()=>e(H),ee=>k(H,ee)),zt(rt,()=>e(ie),ee=>k(ie,ee)),f(p,n)},Me=p=>{Ht(p,{get providerNames(){return oe},modelsFor:_e,get presets(){return e(s)},onProviderChange:be,get provider(){return e(u).provider},set provider(n){e(u).provider=n},get model(){return e(u).model},set model(n){e(u).model=n},get apiKey(){return e(u).api_key},set apiKey(n){e(u).api_key=n},get baseUrl(){return e(u).base_url},set baseUrl(n){e(u).base_url=n},get maxTokens(){return e(u).max_tokens},set maxTokens(n){e(u).max_tokens=n},get temperature(){return e(u).temperature},set temperature(n){e(u).temperature=n}})},W=p=>{var n=oa(),v=a(n),c=a(v,!0);t(v);var _=l(v,2),F=a(_,!0);t(_);var E=l(_,2);Fe(E,21,()=>Y,Ue,(C,J)=>{Jt(C,{get role(){return e(J)},get defaultProvider(){return e(u).provider},get defaultModel(){return e(u).model},get providerNames(){return oe},modelsFor:_e,onProviderChange:()=>Ce(e(J).id),get override(){return R[e(J).id]},set override(se){R[e(J).id]=se}})}),t(E),t(n),j((C,J)=>{d(c,C),d(F,J)},[()=>r()("settings.roles_title"),()=>r()("settings.roles_desc")]),f(p,n)};fe(Z,p=>{e(K)==="general"?p(G):e(K)==="llm"?p(Me,1):e(K)==="roles"&&p(W,2)})}var re=l(Z,2),I=a(re),w=a(I);{var Te=p=>{var n=va(),v=ye(n);ct(v,{size:14,class:"spin"});var c=l(v);j(_=>d(c,` ${_??""}`),[()=>r()("settings.saving")]),f(p,n)},Pe=p=>{var n=da(),v=ye(n);Ut(v,{size:14});var c=l(v);j(_=>d(c,` ${_??""}`),[()=>r()("settings.save")]),f(p,n)};fe(w,p=>{e(g)?p(Te):p(Pe,!1)})}t(I);var ve=l(I,2);{var Ee=p=>{var n=na(),v=a(n,!0);t(n),j(c=>d(v,c),[()=>r()("settings.saved")]),f(p,n)};fe(ve,p=>{e(X)&&p(Ee)})}var Se=l(ve,2);{var Ne=p=>{var n=ca(),v=a(n);t(n),j(c=>d(v,`${c??""}: ${e(U)??""}`),[()=>r()("settings.error")]),f(p,n)};fe(Se,p=>{e(U)&&p(Ne)})}t(re),t(V),t(y),j(()=>I.disabled=e(g)),pe("click",I,$e),f(m,y)};fe(D,m=>{e(i)?m(Q,!1):m(S)})}t(he),j((m,y)=>{d(Ke,` ${m??""}`),d(Le,y)},[()=>r()("settings.title"),()=>r()("settings.subtitle")]),f(x,he),Ye(),z()}We(["click"]);function Ca(x){ma(x,{})}export{Ca as component};
