@duckmind/duckmind-darwin-x64 1.3.8 → 1.3.9

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.
Files changed (50) hide show
  1. package/.duckmind/plugins/.duckmind-managed-plugins.json +2 -2
  2. package/.duckmind/plugins/context-optimizing-plugin.js +309 -0
  3. package/.duckmind/web/assets/{dialog-connect-provider-jjqkH3fb.js → dialog-connect-provider-CRQUO9He.js} +2 -2
  4. package/.duckmind/web/assets/dialog-edit-project-CpiVZTJ-.js +1 -0
  5. package/.duckmind/web/assets/dialog-fork-CloFkX1M.js +1 -0
  6. package/.duckmind/web/assets/dialog-manage-models-Bq0UrM20.js +1 -0
  7. package/.duckmind/web/assets/{dialog-select-directory-CzrpEaT8.js → dialog-select-directory-Db0c-gQl.js} +3 -3
  8. package/.duckmind/web/assets/dialog-select-file-B-WcV9bA.js +1 -0
  9. package/.duckmind/web/assets/dialog-select-mcp-dA8UDgah.js +1 -0
  10. package/.duckmind/web/assets/dialog-select-model-unpaid-NZ41fVE_.js +2 -0
  11. package/.duckmind/web/assets/dialog-select-provider-CKvDgZkl.js +1 -0
  12. package/.duckmind/web/assets/dialog-select-server-BmCX76VX.js +1 -0
  13. package/.duckmind/web/assets/dialog-settings-BOysoQ60.js +1 -0
  14. package/.duckmind/web/assets/file-icon-By0OPIsC.js +1 -0
  15. package/.duckmind/web/assets/{ghostty-web-o_xRAlFy.js → ghostty-web-BOleg_ST.js} +1 -1
  16. package/.duckmind/web/assets/home-D8eKClgK.js +1 -0
  17. package/.duckmind/web/assets/index-C1_o3AOA.js +1 -0
  18. package/.duckmind/web/assets/index-CIniE1sM.js +2423 -0
  19. package/.duckmind/web/assets/index-ytVPOPlW.css +1 -0
  20. package/.duckmind/web/assets/list-Bd_lG005.js +1 -0
  21. package/.duckmind/web/assets/{provider-icon-CbXUEYMU.js → provider-icon-DzvEuHl8.js} +1 -1
  22. package/.duckmind/web/assets/select-CsoVU8kZ.js +1 -0
  23. package/.duckmind/web/assets/server-row-CfBZdm7h.js +1 -0
  24. package/.duckmind/web/assets/session-CuMpLG8c.js +56 -0
  25. package/.duckmind/web/assets/status-popover-body-BwKWyFvL.js +2 -0
  26. package/.duckmind/web/assets/switch-BZ-0S1HQ.js +1 -0
  27. package/.duckmind/web/assets/{worker-DXsJPwkg.js → worker-BDowWIry.js} +19 -19
  28. package/.duckmind/web/index.html +2 -2
  29. package/bin/duckmind +0 -0
  30. package/package.json +1 -1
  31. package/.duckmind/plugins/duckmind-websearch-cited.js +0 -1483
  32. package/.duckmind/web/assets/dialog-edit-project-DOemY3AL.js +0 -1
  33. package/.duckmind/web/assets/dialog-fork-BmnqME4F.js +0 -1
  34. package/.duckmind/web/assets/dialog-manage-models-D4NfKd0g.js +0 -1
  35. package/.duckmind/web/assets/dialog-select-file-Di34JDys.js +0 -1
  36. package/.duckmind/web/assets/dialog-select-mcp-CfzzoOQ0.js +0 -1
  37. package/.duckmind/web/assets/dialog-select-model-unpaid-BVinN3w5.js +0 -2
  38. package/.duckmind/web/assets/dialog-select-provider-DNa_XLNK.js +0 -1
  39. package/.duckmind/web/assets/dialog-select-server-CXhQWGJN.js +0 -1
  40. package/.duckmind/web/assets/dialog-settings-BZcMt_Zh.js +0 -1
  41. package/.duckmind/web/assets/file-icon-B_-1whMc.js +0 -1
  42. package/.duckmind/web/assets/home-XqeLA6yi.js +0 -1
  43. package/.duckmind/web/assets/index-D-WWa_X8.js +0 -2371
  44. package/.duckmind/web/assets/index-jvk-T241.css +0 -1
  45. package/.duckmind/web/assets/list-Dk_vU1zd.js +0 -1
  46. package/.duckmind/web/assets/select-iTRCZro5.js +0 -1
  47. package/.duckmind/web/assets/server-row-LxKRQxMm.js +0 -1
  48. package/.duckmind/web/assets/session-BmqyKO6_.js +0 -44
  49. package/.duckmind/web/assets/status-popover-body-D8K1NeBF.js +0 -2
  50. package/.duckmind/web/assets/switch-CiVaw2SH.js +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-select-provider-DNa_XLNK.js","assets/index-D-WWa_X8.js","assets/index-jvk-T241.css","assets/list-Dk_vU1zd.js","assets/provider-icon-CbXUEYMU.js"])))=>i.map(i=>d[i]);
2
- import{b as ve,s as he,w as me,x as fe,i as o,t as x,aB as re,c as ge,u as xe,bv as ye,f as be,aF as _e,q as we,g as _,ay as $e,n as F,o as ke,h as r,S as L,M as m,m as Y,ah as Z,I as Se,j as Ce,a5 as Ie,aV as De,bz as j,B as R,v as ze,bx as Pe,al as Ee,a7 as Ke}from"./index-D-WWa_X8.js";import{L as ee}from"./list-Dk_vU1zd.js";import{P as Le}from"./provider-icon-CbXUEYMU.js";var Te=x("<a>");function G(h){const T=ve(),[b,S]=he(h,["href","children","class"]);return(()=>{var n=Te();return n.$$click=O=>{b.href&&(O.preventDefault(),T.openLink(b.href))},me(n,fe({get href(){return b.href},get class(){return`text-text-strong underline ${b.class??""}`}},S),!1,!0),o(n,()=>b.children),n})()}re(["click"]);var Me=x('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),Fe=x('<form class="flex flex-col items-start gap-4">'),je=x('<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">'),te=x('<div class="text-14-regular text-text-base">'),Oe=x("<div>"),Ae=x('<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>'),Ve=x('<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">'),qe=x('<div class="flex flex-col gap-6"><form class="flex flex-col items-start gap-4">'),Be=x('<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">'),Ze=x('<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>'),H=x('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Re=x('<div class="flex flex-col gap-6 px-2.5 pb-3"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><div class="px-2.5 pb-10 flex flex-col gap-6"><div tabindex=0>');function Ge(h){const T=ge(),b=xe(),S=ye(),n=be(),O=_e(),J=()=>{Ke(()=>import("./dialog-select-provider-DNa_XLNK.js").then(e=>e.d),__vite__mapDeps([0,1,2,3,4])).then(e=>{T.show(()=>r(e.DialogSelectProvider,{}))})},C={value:!0},w={current:void 0};we(()=>{C.value=!1,w.current!==void 0&&(clearTimeout(w.current),w.current=void 0)});const $=_(()=>O.all().find(e=>e.id===h.provider)??b.data.provider.all.find(e=>e.id===h.provider)),A=_(()=>[{type:"api",label:n.t("provider.connect.method.apiKey")}]),[N]=$e(()=>h.provider,async()=>{const e=b.data.provider_auth[h.provider];if(e)return e;const t=await S.client.provider.auth();return C.value?(b.set("provider_auth",t.data??{}),t.data?.[h.provider]??A()):A()}),Q=_(()=>N.loading&&!b.data.provider_auth[h.provider]),D=_(()=>N.latest??b.data.provider_auth[h.provider]??A()),[d,ne]=F({methodIndex:void 0,authorization:void 0,state:"pending",error:void 0});function k(e){ne(Pe(t=>{if(e.type==="method.select"){t.methodIndex=e.index,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="method.reset"){t.methodIndex=void 0,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="auth.prompt"){t.state="prompt",t.error=void 0;return}if(e.type==="auth.pending"){t.state="pending",t.error=void 0;return}if(e.type==="auth.complete"){t.state="complete",t.authorization=e.authorization,t.error=void 0;return}t.state="error",t.error=e.error}))}const z=_(()=>d.methodIndex!==void 0?D().at(d.methodIndex):void 0),ie=e=>e?e.type==="api"?n.t("provider.connect.method.apiKey"):e.label??"":"";function M(e,t){if(e&&typeof e=="object"&&"data"in e){const i=e.data;if(typeof i?.message=="string"&&i.message)return i.message}if(e&&typeof e=="object"&&"error"in e){const i=M(e.error,"");if(i)return i}if(e&&typeof e=="object"&&"message"in e){const i=e.message;if(typeof i=="string"&&i)return i}return e instanceof Error&&e.message?e.message:typeof e=="string"&&e?e:t}async function V(e,t){w.current!==void 0&&(clearTimeout(w.current),w.current=void 0);const i=D()[e];if(k({type:"method.select",index:e}),i.type==="oauth"){if(i.prompts?.length&&!t){k({type:"auth.prompt"});return}k({type:"auth.pending"});const c=Date.now();await S.client.provider.oauth.authorize({providerID:h.provider,method:e,inputs:t},{throwOnError:!0}).then(a=>{if(!C.value)return;const u=1e3-(Date.now()-c);if(u>0){w.current!==void 0&&clearTimeout(w.current),w.current=setTimeout(()=>{w.current=void 0,C.value&&k({type:"auth.complete",authorization:a.data})},u);return}k({type:"auth.complete",authorization:a.data})}).catch(a=>{C.value&&k({type:"auth.error",error:M(a,n.t("common.requestFailed"))})})}}function oe(){const[e,t]=F({value:{},index:0}),i=_(()=>{const l=z();return l?.type!=="oauth"?[]:l.prompts??[]}),c=(l,p)=>{if(!l.when)return!0;const g=p[l.when.key];return g===void 0?!1:l.when.op==="eq"?g===l.when.value:g!==l.when.value},a=_(()=>{const l=i(),p=l.findIndex((g,K)=>K>=e.index&&c(g,e.value));if(p!==-1)return{index:p,prompt:l[p]}}),s=_(()=>{const l=a();return!l||l.prompt.type!=="text"?!1:(e.value[l.prompt.key]??"").trim().length>0});async function u(l,p){if(d.methodIndex===void 0)return;const g=i().findIndex((K,y)=>y>l&&c(K,p));if(g!==-1){t("index",g);return}await V(d.methodIndex,p)}async function v(l){l.preventDefault();const p=a();!p||p.prompt.type!=="text"||s()&&await u(p.index,e.value)}const f=()=>a(),P=_(()=>{const l=f()?.prompt;if(!(!l||l.type!=="text"))return l}),E=_(()=>{const l=f()?.prompt;if(!(!l||l.type!=="select"))return l});return(()=>{var l=Fe();return l.addEventListener("submit",v),o(l,r(L,{get children(){return[r(m,{get when(){return f()?.prompt.type==="text"},get children(){return[r(j,{type:"text",get label(){return P()?.message??""},get placeholder(){return P()?.placeholder},get value(){return Y(()=>!!P())()?e.value[P().key]??"":""},onChange:p=>{const g=P();g&&t("value",g.key,p)}}),r(R,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!s()},get children(){return n.t("common.continue")}})]}}),r(m,{get when(){return f()?.prompt.type==="select"},get children(){var p=Me(),g=p.firstChild,K=g.nextSibling;return o(g,()=>E()?.message),o(K,r(ee,{get items(){return E()?.options??[]},key:y=>y.value,get current(){return E()?.options.find(y=>y.value===e.value[E().key])},onSelect:y=>{if(!y)return;const I=E();if(!I)return;const B={...e.value,[I.key]:y.value};t("value",I.key,y.value),u(f().index,B)},children:y=>(()=>{var I=je(),B=I.firstChild,X=B.nextSibling,pe=X.nextSibling;return o(X,()=>y.label),o(pe,()=>y.hint),I})()})),p}})]}})),l})()}let U;function ae(e){e.key==="Enter"&&e.target instanceof HTMLInputElement||e.key!=="Escape"&&U?.onKeyDown(e)}let W=!1;ke(()=>{W||Q()||D().length===1&&(W=!0,V(0))});async function q(){await S.client.global.dispose(),T.close(),Ee({variant:"success",icon:"circle-check",title:n.t("provider.connect.toast.connected.title",{provider:$().name}),description:n.t("provider.connect.toast.connected.description",{provider:$().name})})}function le(){if(D().length===1){J();return}if(d.authorization){k({type:"method.reset"});return}if(d.methodIndex!==void 0){k({type:"method.reset"});return}J()}function se(){return[(()=>{var e=te();return o(e,()=>n.t("provider.connect.selectMethod",{provider:$().name})),e})(),(()=>{var e=Oe();return o(e,r(ee,{ref:t=>{U=t},items:D,key:t=>t?.label,onSelect:async(t,i)=>{t&&V(i)},children:t=>(()=>{var i=Ae(),c=i.firstChild,a=c.nextSibling;return o(a,()=>ie(t)),i})()})),e})()]}function ce(){const[e,t]=F({value:"",error:void 0});async function i(c){c.preventDefault();const a=c.currentTarget,u=new FormData(a).get("apiKey");if(!u?.trim()){t("error",n.t("provider.connect.apiKey.required"));return}t("error",void 0),await S.client.auth.set({providerID:h.provider,auth:{type:"api",key:u}}),await q()}return(()=>{var c=qe(),a=c.firstChild;return o(c,r(L,{get children(){return[r(m,{get when(){return $().id==="duckmind"},get children(){var s=Ve(),u=s.firstChild,v=u.nextSibling,f=v.nextSibling;return o(u,()=>n.t("provider.connect.duckmindZen.line1")),o(v,()=>n.t("provider.connect.duckmindZen.line2")),o(f,()=>n.t("provider.connect.duckmindZen.visit.prefix"),null),o(f,r(G,{href:"https://duckmind.ai/zen",tabIndex:-1,get children(){return n.t("provider.connect.duckmindZen.visit.link")}}),null),o(f,()=>n.t("provider.connect.duckmindZen.visit.suffix"),null),s}}),r(m,{when:!0,get children(){var s=te();return o(s,()=>n.t("provider.connect.apiKey.description",{provider:$().name})),s}})]}}),a),a.addEventListener("submit",i),o(a,r(j,{autofocus:!0,type:"text",get label(){return n.t("provider.connect.apiKey.label",{provider:$().name})},get placeholder(){return n.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return e.value},onChange:s=>t("value",s),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),o(a,r(R,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),c})()}function ue(){const[e,t]=F({value:"",error:void 0});async function i(c){c.preventDefault();const a=c.currentTarget,u=new FormData(a).get("code");if(!u?.trim()){t("error",n.t("provider.connect.oauth.code.required"));return}t("error",void 0);const v=await S.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex,code:u}).then(f=>f.error?{ok:!1,error:f.error}:{ok:!0}).catch(f=>({ok:!1,error:f}));if(v.ok){await q();return}t("error",M(v.error,n.t("provider.connect.oauth.code.invalid")))}return(()=>{var c=Be(),a=c.firstChild,s=a.nextSibling;return o(a,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),o(a,r(G,{get href(){return d.authorization.url},get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),o(a,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:$().name}),null),s.addEventListener("submit",i),o(s,r(j,{autofocus:!0,type:"text",get label(){return n.t("provider.connect.oauth.code.label",{method:z()?.label??""})},get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return e.value},onChange:u=>t("value",u),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),o(s,r(R,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),c})()}function de(){const e=_(()=>{const t=d.authorization?.instructions;return t?.includes(":")?t.split(":")[1]?.trim():t});return ze(()=>{(async()=>{const t=await S.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex}).then(i=>i.error?{ok:!1,error:i.error}:{ok:!0}).catch(i=>({ok:!1,error:i}));if(C.value){if(!t.ok){const i=M(t.error,n.t("common.requestFailed"));k({type:"auth.error",error:i});return}await q()}})()}),(()=>{var t=Ze(),i=t.firstChild,c=i.nextSibling,a=c.firstChild;return o(i,()=>n.t("provider.connect.oauth.auto.visit.prefix"),null),o(i,r(G,{get href(){return d.authorization.url},get children(){return n.t("provider.connect.oauth.auto.visit.link")}}),null),o(i,()=>n.t("provider.connect.oauth.auto.visit.suffix",{provider:$().name}),null),o(t,r(j,{get label(){return n.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return e()},readOnly:!0,copyable:!0}),c),o(c,r(Z,{}),a),o(a,()=>n.t("provider.connect.status.waiting")),t})()}return r(De,{get title(){return r(Ie,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:le,get"aria-label"(){return n.t("common.goBack")}})},get children(){var e=Re(),t=e.firstChild,i=t.firstChild,c=t.nextSibling,a=c.firstChild;return o(t,r(Le,{get id(){return h.provider},class:"size-5 shrink-0 icon-strong-base"}),i),o(i,r(L,{get children(){return[r(m,{get when(){return Y(()=>h.provider==="anthropic")()&&z()?.label?.toLowerCase().includes("max")},get children(){return n.t("provider.connect.title.anthropicProMax")}}),r(m,{when:!0,get children(){return n.t("provider.connect.title",{provider:$().name})}})]}})),a.$$keydown=ae,o(a,r(L,{get children(){return[r(m,{get when(){return Q()},get children(){var s=H(),u=s.firstChild,v=u.firstChild;return o(u,r(Z,{}),v),o(v,()=>n.t("provider.connect.status.inProgress")),s}}),r(m,{get when(){return d.methodIndex===void 0},get children(){return r(se,{})}}),r(m,{get when(){return d.state==="pending"},get children(){var s=H(),u=s.firstChild,v=u.firstChild;return o(u,r(Z,{}),v),o(v,()=>n.t("provider.connect.status.inProgress")),s}}),r(m,{get when(){return d.state==="prompt"},get children(){return r(oe,{})}}),r(m,{get when(){return d.state==="error"},get children(){var s=H(),u=s.firstChild,v=u.firstChild;return o(u,r(Se,{name:"circle-ban-sign",class:"text-icon-critical-base"}),v),o(v,()=>n.t("provider.connect.status.failed",{error:d.error??""})),s}}),r(m,{get when(){return z()?.type==="api"},get children(){return r(ce,{})}}),r(m,{get when(){return z()?.type==="oauth"},get children(){return r(L,{get children(){return[r(m,{get when(){return d.authorization?.method==="code"},get children(){return r(ue,{})}}),r(m,{get when(){return d.authorization?.method==="auto"},get children(){return r(de,{})}})]}})}})]}})),Ce(()=>a.autofocus=d.methodIndex===void 0?!0:void 0),e}})}re(["keydown"]);const Qe=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Ge},Symbol.toStringTag,{value:"Module"}));export{Ge as D,G as L,Qe as d};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-select-provider-CKvDgZkl.js","assets/index-CIniE1sM.js","assets/index-ytVPOPlW.css","assets/list-Bd_lG005.js","assets/provider-icon-DzvEuHl8.js"])))=>i.map(i=>d[i]);
2
+ import{b as ve,v as he,y as me,z as fe,i as o,t as x,aE as re,c as ge,u as xe,bz as ye,f as be,aI as _e,s as we,g as _,aB as $e,n as j,p as ke,h as r,S as L,M as m,m as X,ak as Z,I as Se,j as Ce,a8 as Ie,aY as De,bE as F,B as R,x as ze,bC as Ee,ao as Pe,aa as Ke}from"./index-CIniE1sM.js";import{L as ee}from"./list-Bd_lG005.js";import{P as Le}from"./provider-icon-DzvEuHl8.js";var Te=x("<a>");function G(h){const T=ve(),[b,S]=he(h,["href","children","class"]);return(()=>{var n=Te();return n.$$click=O=>{b.href&&(O.preventDefault(),T.openLink(b.href))},me(n,fe({get href(){return b.href},get class(){return`text-text-strong underline ${b.class??""}`}},S),!1,!0),o(n,()=>b.children),n})()}re(["click"]);var Me=x('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),je=x('<form class="flex flex-col items-start gap-4">'),Fe=x('<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">'),te=x('<div class="text-14-regular text-text-base">'),Oe=x("<div>"),Ae=x('<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>'),Be=x('<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">'),Ve=x('<div class="flex flex-col gap-6"><form class="flex flex-col items-start gap-4">'),qe=x('<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">'),Ze=x('<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>'),H=x('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Re=x('<div class="flex flex-col gap-6 px-2.5 pb-3"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><div class="px-2.5 pb-10 flex flex-col gap-6"><div tabindex=0>');function Ge(h){const T=ge(),b=xe(),S=ye(),n=be(),O=_e(),Y=()=>{Ke(()=>import("./dialog-select-provider-CKvDgZkl.js").then(e=>e.d),__vite__mapDeps([0,1,2,3,4])).then(e=>{T.show(()=>r(e.DialogSelectProvider,{}))})},C={value:!0},w={current:void 0};we(()=>{C.value=!1,w.current!==void 0&&(clearTimeout(w.current),w.current=void 0)});const $=_(()=>O.all().find(e=>e.id===h.provider)??b.data.provider.all.find(e=>e.id===h.provider)),A=_(()=>[{type:"api",label:n.t("provider.connect.method.apiKey")}]),[J]=$e(()=>h.provider,async()=>{const e=b.data.provider_auth[h.provider];if(e)return e;const t=await S.client.provider.auth();return C.value?(b.set("provider_auth",t.data??{}),t.data?.[h.provider]??A()):A()}),N=_(()=>J.loading&&!b.data.provider_auth[h.provider]),D=_(()=>J.latest??b.data.provider_auth[h.provider]??A()),[d,ne]=j({methodIndex:void 0,authorization:void 0,state:"pending",error:void 0});function k(e){ne(Ee(t=>{if(e.type==="method.select"){t.methodIndex=e.index,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="method.reset"){t.methodIndex=void 0,t.authorization=void 0,t.state=void 0,t.error=void 0;return}if(e.type==="auth.prompt"){t.state="prompt",t.error=void 0;return}if(e.type==="auth.pending"){t.state="pending",t.error=void 0;return}if(e.type==="auth.complete"){t.state="complete",t.authorization=e.authorization,t.error=void 0;return}t.state="error",t.error=e.error}))}const z=_(()=>d.methodIndex!==void 0?D().at(d.methodIndex):void 0),ie=e=>e?e.type==="api"?n.t("provider.connect.method.apiKey"):e.label??"":"";function M(e,t){if(e&&typeof e=="object"&&"data"in e){const i=e.data;if(typeof i?.message=="string"&&i.message)return i.message}if(e&&typeof e=="object"&&"error"in e){const i=M(e.error,"");if(i)return i}if(e&&typeof e=="object"&&"message"in e){const i=e.message;if(typeof i=="string"&&i)return i}return e instanceof Error&&e.message?e.message:typeof e=="string"&&e?e:t}async function B(e,t){w.current!==void 0&&(clearTimeout(w.current),w.current=void 0);const i=D()[e];if(k({type:"method.select",index:e}),i.type==="oauth"){if(i.prompts?.length&&!t){k({type:"auth.prompt"});return}k({type:"auth.pending"});const c=Date.now();await S.client.provider.oauth.authorize({providerID:h.provider,method:e,inputs:t},{throwOnError:!0}).then(a=>{if(!C.value)return;const u=1e3-(Date.now()-c);if(u>0){w.current!==void 0&&clearTimeout(w.current),w.current=setTimeout(()=>{w.current=void 0,C.value&&k({type:"auth.complete",authorization:a.data})},u);return}k({type:"auth.complete",authorization:a.data})}).catch(a=>{C.value&&k({type:"auth.error",error:M(a,n.t("common.requestFailed"))})})}}function oe(){const[e,t]=j({value:{},index:0}),i=_(()=>{const l=z();return l?.type!=="oauth"?[]:l.prompts??[]}),c=(l,p)=>{if(!l.when)return!0;const g=p[l.when.key];return g===void 0?!1:l.when.op==="eq"?g===l.when.value:g!==l.when.value},a=_(()=>{const l=i(),p=l.findIndex((g,K)=>K>=e.index&&c(g,e.value));if(p!==-1)return{index:p,prompt:l[p]}}),s=_(()=>{const l=a();return!l||l.prompt.type!=="text"?!1:(e.value[l.prompt.key]??"").trim().length>0});async function u(l,p){if(d.methodIndex===void 0)return;const g=i().findIndex((K,y)=>y>l&&c(K,p));if(g!==-1){t("index",g);return}await B(d.methodIndex,p)}async function v(l){l.preventDefault();const p=a();!p||p.prompt.type!=="text"||s()&&await u(p.index,e.value)}const f=()=>a(),E=_(()=>{const l=f()?.prompt;if(!(!l||l.type!=="text"))return l}),P=_(()=>{const l=f()?.prompt;if(!(!l||l.type!=="select"))return l});return(()=>{var l=je();return l.addEventListener("submit",v),o(l,r(L,{get children(){return[r(m,{get when(){return f()?.prompt.type==="text"},get children(){return[r(F,{type:"text",get label(){return E()?.message??""},get placeholder(){return E()?.placeholder},get value(){return X(()=>!!E())()?e.value[E().key]??"":""},onChange:p=>{const g=E();g&&t("value",g.key,p)}}),r(R,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!s()},get children(){return n.t("common.continue")}})]}}),r(m,{get when(){return f()?.prompt.type==="select"},get children(){var p=Me(),g=p.firstChild,K=g.nextSibling;return o(g,()=>P()?.message),o(K,r(ee,{get items(){return P()?.options??[]},key:y=>y.value,get current(){return P()?.options.find(y=>y.value===e.value[P().key])},onSelect:y=>{if(!y)return;const I=P();if(!I)return;const q={...e.value,[I.key]:y.value};t("value",I.key,y.value),u(f().index,q)},children:y=>(()=>{var I=Fe(),q=I.firstChild,W=q.nextSibling,pe=W.nextSibling;return o(W,()=>y.label),o(pe,()=>y.hint),I})()})),p}})]}})),l})()}let Q;function ae(e){e.key==="Enter"&&e.target instanceof HTMLInputElement||e.key!=="Escape"&&Q?.onKeyDown(e)}let U=!1;ke(()=>{U||N()||D().length===1&&(U=!0,B(0))});async function V(){await S.client.global.dispose(),T.close(),Pe({variant:"success",icon:"circle-check",title:n.t("provider.connect.toast.connected.title",{provider:$().name}),description:n.t("provider.connect.toast.connected.description",{provider:$().name})})}function le(){if(D().length===1){Y();return}if(d.authorization){k({type:"method.reset"});return}if(d.methodIndex!==void 0){k({type:"method.reset"});return}Y()}function se(){return[(()=>{var e=te();return o(e,()=>n.t("provider.connect.selectMethod",{provider:$().name})),e})(),(()=>{var e=Oe();return o(e,r(ee,{ref:t=>{Q=t},items:D,key:t=>t?.label,onSelect:async(t,i)=>{t&&B(i)},children:t=>(()=>{var i=Ae(),c=i.firstChild,a=c.nextSibling;return o(a,()=>ie(t)),i})()})),e})()]}function ce(){const[e,t]=j({value:"",error:void 0});async function i(c){c.preventDefault();const a=c.currentTarget,u=new FormData(a).get("apiKey");if(!u?.trim()){t("error",n.t("provider.connect.apiKey.required"));return}t("error",void 0),await S.client.auth.set({providerID:h.provider,auth:{type:"api",key:u}}),await V()}return(()=>{var c=Ve(),a=c.firstChild;return o(c,r(L,{get children(){return[r(m,{get when(){return $().id==="duckmind"},get children(){var s=Be(),u=s.firstChild,v=u.nextSibling,f=v.nextSibling;return o(u,()=>n.t("provider.connect.duckmindZen.line1")),o(v,()=>n.t("provider.connect.duckmindZen.line2")),o(f,()=>n.t("provider.connect.duckmindZen.visit.prefix"),null),o(f,r(G,{href:"https://duckmind.ai/zen",tabIndex:-1,get children(){return n.t("provider.connect.duckmindZen.visit.link")}}),null),o(f,()=>n.t("provider.connect.duckmindZen.visit.suffix"),null),s}}),r(m,{when:!0,get children(){var s=te();return o(s,()=>n.t("provider.connect.apiKey.description",{provider:$().name})),s}})]}}),a),a.addEventListener("submit",i),o(a,r(F,{autofocus:!0,type:"text",get label(){return n.t("provider.connect.apiKey.label",{provider:$().name})},get placeholder(){return n.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return e.value},onChange:s=>t("value",s),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),o(a,r(R,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),c})()}function ue(){const[e,t]=j({value:"",error:void 0});async function i(c){c.preventDefault();const a=c.currentTarget,u=new FormData(a).get("code");if(!u?.trim()){t("error",n.t("provider.connect.oauth.code.required"));return}t("error",void 0);const v=await S.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex,code:u}).then(f=>f.error?{ok:!1,error:f.error}:{ok:!0}).catch(f=>({ok:!1,error:f}));if(v.ok){await V();return}t("error",M(v.error,n.t("provider.connect.oauth.code.invalid")))}return(()=>{var c=qe(),a=c.firstChild,s=a.nextSibling;return o(a,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),o(a,r(G,{get href(){return d.authorization.url},get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),o(a,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:$().name}),null),s.addEventListener("submit",i),o(s,r(F,{autofocus:!0,type:"text",get label(){return n.t("provider.connect.oauth.code.label",{method:z()?.label??""})},get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return e.value},onChange:u=>t("value",u),get validationState(){return e.error?"invalid":void 0},get error(){return e.error}}),null),o(s,r(R,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),c})()}function de(){const e=_(()=>{const t=d.authorization?.instructions;return t?.includes(":")?t.split(":")[1]?.trim():t});return ze(()=>{(async()=>{const t=await S.client.provider.oauth.callback({providerID:h.provider,method:d.methodIndex}).then(i=>i.error?{ok:!1,error:i.error}:{ok:!0}).catch(i=>({ok:!1,error:i}));if(C.value){if(!t.ok){const i=M(t.error,n.t("common.requestFailed"));k({type:"auth.error",error:i});return}await V()}})()}),(()=>{var t=Ze(),i=t.firstChild,c=i.nextSibling,a=c.firstChild;return o(i,()=>n.t("provider.connect.oauth.auto.visit.prefix"),null),o(i,r(G,{get href(){return d.authorization.url},get children(){return n.t("provider.connect.oauth.auto.visit.link")}}),null),o(i,()=>n.t("provider.connect.oauth.auto.visit.suffix",{provider:$().name}),null),o(t,r(F,{get label(){return n.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return e()},readOnly:!0,copyable:!0}),c),o(c,r(Z,{}),a),o(a,()=>n.t("provider.connect.status.waiting")),t})()}return r(De,{get title(){return r(Ie,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:le,get"aria-label"(){return n.t("common.goBack")}})},get children(){var e=Re(),t=e.firstChild,i=t.firstChild,c=t.nextSibling,a=c.firstChild;return o(t,r(Le,{get id(){return h.provider},class:"size-5 shrink-0 icon-strong-base"}),i),o(i,r(L,{get children(){return[r(m,{get when(){return X(()=>h.provider==="anthropic")()&&z()?.label?.toLowerCase().includes("max")},get children(){return n.t("provider.connect.title.anthropicProMax")}}),r(m,{when:!0,get children(){return n.t("provider.connect.title",{provider:$().name})}})]}})),a.$$keydown=ae,o(a,r(L,{get children(){return[r(m,{get when(){return N()},get children(){var s=H(),u=s.firstChild,v=u.firstChild;return o(u,r(Z,{}),v),o(v,()=>n.t("provider.connect.status.inProgress")),s}}),r(m,{get when(){return d.methodIndex===void 0},get children(){return r(se,{})}}),r(m,{get when(){return d.state==="pending"},get children(){var s=H(),u=s.firstChild,v=u.firstChild;return o(u,r(Z,{}),v),o(v,()=>n.t("provider.connect.status.inProgress")),s}}),r(m,{get when(){return d.state==="prompt"},get children(){return r(oe,{})}}),r(m,{get when(){return d.state==="error"},get children(){var s=H(),u=s.firstChild,v=u.firstChild;return o(u,r(Se,{name:"circle-ban-sign",class:"text-icon-critical-base"}),v),o(v,()=>n.t("provider.connect.status.failed",{error:d.error??""})),s}}),r(m,{get when(){return z()?.type==="api"},get children(){return r(ce,{})}}),r(m,{get when(){return z()?.type==="oauth"},get children(){return r(L,{get children(){return[r(m,{get when(){return d.authorization?.method==="code"},get children(){return r(ue,{})}}),r(m,{get when(){return d.authorization?.method==="auto"},get children(){return r(de,{})}})]}})}})]}})),Ce(()=>a.autofocus=d.methodIndex===void 0?!0:void 0),e}})}re(["keydown"]);const Ne=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Ge},Symbol.toStringTag,{value:"Module"}));export{Ge as D,G as L,Ne as d};
@@ -0,0 +1 @@
1
+ import{c as te,bz as re,u as ae,f as oe,g as A,ag as ie,n as ne,b5 as le,h as l,i as o,bE as F,a2 as I,j as _,aG as j,cG as P,z as R,cH as G,I as K,aD as se,F as ce,k as M,B as T,m as de,aY as ue,t as p,aE as ge}from"./index-CIniE1sM.js";var ve=p('<img class="size-full object-cover">'),fe=p('<div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5">'),me=p('<form class="flex flex-col gap-6 p-6 pt-0"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-3 items-start"><div class=relative><div class="relative size-16 rounded-md transition-colors cursor-pointer"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div></div><input id=icon-upload type=file accept=image/* class=hidden><div class="flex flex-col gap-1.5 text-12-regular text-text-weak self-center"><span></span><span></span></div></div></div></div><div class="flex justify-end gap-2">'),pe=p('<div class="size-full flex items-center justify-center">'),be=p("<button type=button>");const he=["pink","mint","orange","purple","cyan","lime"];function je(s){const w=te(),B=re(),z=ae(),i=oe(),y=A(()=>ie(s.project.worktree)),k=A(()=>s.project.name||y()),[e,c]=ne({name:k(),color:s.project.icon?.color||"pink",iconUrl:s.project.icon?.override||"",startup:s.project.commands?.start??"",dragOver:!1,iconHover:!1});let L;function U(r){if(!r.type.startsWith("image/"))return;const a=new FileReader;a.onload=v=>{c("iconUrl",v.target?.result),c("iconHover",!1)},a.readAsDataURL(r)}function N(r){r.preventDefault(),c("dragOver",!1);const a=r.dataTransfer?.files[0];a&&U(a)}function Y(r){r.preventDefault(),c("dragOver",!0)}function V(){c("dragOver",!1)}function W(r){const v=r.target.files?.[0];v&&U(v)}function q(){c("iconUrl","")}const b=le(()=>({mutationFn:async()=>{const r=e.name.trim()===y()?"":e.name.trim(),a=e.startup.trim();if(s.project.id&&s.project.id!=="global"){await B.client.project.update({projectID:s.project.id,directory:s.project.worktree,name:r,icon:{color:e.color,override:e.iconUrl},commands:{start:a}}),z.project.icon(s.project.worktree,e.iconUrl||void 0),w.close();return}z.project.meta(s.project.worktree,{name:r,icon:{color:e.color,override:e.iconUrl||void 0},commands:{start:a||void 0}}),w.close()}}));function J(r){r.preventDefault(),!b.isPending&&b.mutate()}return l(ue,{get title(){return i.t("dialog.project.edit.title")},class:"w-full max-w-[480px] mx-auto",get children(){var r=me(),a=r.firstChild,v=a.firstChild,C=v.firstChild,Q=C.nextSibling,h=Q.firstChild,f=h.firstChild,x=f.nextSibling,$=x.nextSibling,S=h.nextSibling,X=S.nextSibling,D=X.firstChild,Z=D.nextSibling,E=a.nextSibling;return r.addEventListener("submit",J),o(a,l(F,{autofocus:!0,type:"text",get label(){return i.t("dialog.project.edit.name")},get placeholder(){return y()},get value(){return e.name},onChange:t=>c("name",t)}),v),o(C,()=>i.t("dialog.project.edit.icon")),h.addEventListener("mouseleave",()=>c("iconHover",!1)),h.addEventListener("mouseenter",()=>c("iconHover",!0)),f.$$click=()=>{e.iconUrl&&e.iconHover?q():L?.click()},f.addEventListener("dragleave",V),f.addEventListener("dragover",Y),f.addEventListener("drop",N),o(f,l(I,{get when(){return e.iconUrl},get fallback(){return(()=>{var t=pe();return o(t,l(P,R({get fallback(){return e.name||k()}},()=>G(e.color),{class:"size-full text-[32px]"}))),t})()},get children(){var t=ve();return _(d=>{var m=e.iconUrl,n=i.t("dialog.project.edit.icon.alt");return m!==d.e&&j(t,"src",d.e=m),n!==d.t&&j(t,"alt",d.t=n),d},{e:void 0,t:void 0}),t}})),o(x,l(K,{name:"cloud-upload",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),o($,l(K,{name:"trash",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),S.addEventListener("change",W),se(t=>{L=t},S),o(D,()=>i.t("dialog.project.edit.icon.hint")),o(Z,()=>i.t("dialog.project.edit.icon.recommended")),o(a,l(I,{get when(){return!e.iconUrl},get children(){var t=fe(),d=t.firstChild,m=d.nextSibling;return o(d,()=>i.t("dialog.project.edit.color")),o(m,l(ce,{each:he,children:n=>(()=>{var g=be();return g.$$click=()=>c("color",n),o(g,l(P,R({get fallback(){return e.name||k()}},()=>G(n),{class:"size-full rounded"}))),_(u=>{var H=i.t("dialog.project.edit.color.select",{color:n}),O=e.color===n,ee={"flex items-center justify-center size-10 p-0.5 rounded-lg overflow-hidden transition-colors cursor-default":!0,"bg-transparent border-2 border-icon-strong-base hover:bg-surface-base-hover":e.color===n,"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":e.color!==n};return H!==u.e&&j(g,"aria-label",u.e=H),O!==u.t&&j(g,"aria-pressed",u.t=O),u.a=M(g,ee,u.a),u},{e:void 0,t:void 0,a:void 0}),g})()})),t}}),null),o(a,l(F,{multiline:!0,get label(){return i.t("dialog.project.edit.worktree.startup")},get description(){return i.t("dialog.project.edit.worktree.startup.description")},get placeholder(){return i.t("dialog.project.edit.worktree.startup.placeholder")},get value(){return e.startup},onChange:t=>c("startup",t),spellcheck:!1,class:"max-h-14 w-full overflow-y-auto font-mono text-xs"}),null),o(E,l(T,{type:"button",variant:"ghost",size:"large",onClick:()=>w.close(),get children(){return i.t("common.cancel")}}),null),o(E,l(T,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return de(()=>!!b.isPending)()?i.t("common.saving"):i.t("common.save")}}),null),_(t=>{var d={"border-text-interactive-base bg-surface-info-base/20":e.dragOver,"border-border-base hover:border-border-strong":!e.dragOver,"overflow-hidden":!!e.iconUrl},m=!!(e.iconHover&&!e.iconUrl),n=!(e.iconHover&&!e.iconUrl),g=!!(e.iconHover&&e.iconUrl),u=!(e.iconHover&&e.iconUrl);return t.e=M(f,d,t.e),m!==t.t&&x.classList.toggle("opacity-100",t.t=m),n!==t.a&&x.classList.toggle("opacity-0",t.a=n),g!==t.o&&$.classList.toggle("opacity-100",t.o=g),u!==t.i&&$.classList.toggle("opacity-0",t.i=u),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r}})}ge(["click"]);export{je as DialogEditProject};
@@ -0,0 +1 @@
1
+ import{G as v,d as D,ab as S,aN as k,aU as _,c as $,f as w,g as P,h as d,i as u,aY as F,l as L,ao as p,t as b}from"./index-CIniE1sM.js";import{L as I}from"./list-Bd_lG005.js";import{e as N}from"./session-CuMpLG8c.js";import"./index-C1_o3AOA.js";import"./select-CsoVU8kZ.js";import"./provider-icon-DzvEuHl8.js";import"./file-icon-By0OPIsC.js";var T=b('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function q(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const j=()=>{const i=v(),g=D(),c=S(),l=k(),f=_(),h=$(),r=w(),x=P(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(n=>n.type==="text"&&!n.synthetic&&!n.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:q(new Date(s.time.created))})}return o.reverse()}),y=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=N(o,{directory:l.directory,attachmentName:r.t("common.attachment")}),m=L(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){p({title:r.t("common.requestFailed")});return}h.close(),f.set(s,void 0,{dir:m,id:e.data.id}),g(`/${m}/session/${e.data.id}`)}).catch(e=>{const n=e instanceof Error?e.message:String(e);p({title:r.t("common.requestFailed"),description:n})})};return d(F,{get title(){return r.t("command.session.fork")},get children(){return d(I,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:r.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return r.t("dialog.fork.empty")},key:t=>t.id,items:x,filterKeys:["text"],onSelect:y,children:t=>(()=>{var a=T(),o=a.firstChild,s=o.nextSibling;return u(o,()=>t.text),u(s,()=>t.time),a})()})}})};export{j as DialogFork};
@@ -0,0 +1 @@
1
+ import{aS as y,f as b,c as D,h as o,i as n,am as I,B as k,aY as $,t as g,aZ as C,aE as P}from"./index-CIniE1sM.js";import{L}from"./list-Bd_lG005.js";import{S as c}from"./switch-BZ-0S1HQ.js";import{a as S}from"./dialog-select-provider-CKvDgZkl.js";import"./provider-icon-DzvEuHl8.js";import"./dialog-connect-provider-CRQUO9He.js";var _=g("<span>"),B=g('<div class="w-full flex items-center justify-between gap-x-3"><span></span><div>');const j=()=>{const t=y(),a=b(),u=D(),v=()=>{u.show(()=>o(S,{}))},s=e=>C.indexOf(e),m=e=>t.model.list().filter(r=>r.provider.id===e),h=e=>m(e).every(r=>t.model.visible({modelID:r.id,providerID:r.provider.id})),f=(e,r)=>{m(e).forEach(i=>{t.model.setVisibility({modelID:i.id,providerID:i.provider.id},r)})};return o($,{get title(){return a.t("dialog.model.manage")},get description(){return a.t("dialog.model.manage.description")},get action(){return o(k,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:v,get children(){return a.t("command.provider.connect")}})},get children(){return o(L,{get search(){return{placeholder:a.t("dialog.model.search.placeholder"),autofocus:!0}},get emptyMessage(){return a.t("dialog.model.empty")},key:e=>`${e?.provider?.id}:${e?.id}`,get items(){return t.model.list()},filterKeys:["provider.name","name","id"],sortBy:(e,r)=>e.name.localeCompare(r.name),groupBy:e=>e.provider.id,groupHeader:e=>{const r=e.items[0].provider;return[(()=>{var i=_();return n(i,()=>r.name),i})(),o(I,{placement:"top",get value(){return a.t("dialog.model.manage.provider.toggle",{provider:r.name})},get children(){return o(c,{class:"-mr-1",get checked(){return h(r.id)},onChange:i=>f(r.id,i),hideLabel:!0,get children(){return r.name}})}})]},sortGroupsBy:(e,r)=>{const i=s(e.items[0].provider.id),l=s(r.items[0].provider.id),d=i>=0,p=l>=0;return d&&!p?-1:!d&&p?1:i-l},onSelect:e=>{if(!e)return;const r={modelID:e.id,providerID:e.provider.id};t.model.setVisibility(r,!t.model.visible(r))},children:e=>(()=>{var r=B(),i=r.firstChild,l=i.nextSibling;return n(i,()=>e.name),l.$$click=d=>d.stopPropagation(),n(l,o(c,{get checked(){return!!t.model.visible({modelID:e.id,providerID:e.provider.id})},onChange:d=>{t.model.setVisibility({modelID:e.id,providerID:e.provider.id},d)}})),r})()})}})};P(["click"]);export{j as DialogManageModels};
@@ -1,3 +1,3 @@
1
- import{u as V,bv as E,a as H,c as J,f as N,r as Q,g as A,ay as U,ad as j,h as z,i as P,aM as X,aV as Y,t as I}from"./index-D-WWa_X8.js";import{F as R}from"./file-icon-B_-1whMc.js";import{L as tt,f as et}from"./list-Dk_vU1zd.js";var rt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-strong whitespace-nowrap">~</span><span class="text-text-weak whitespace-nowrap">/'),nt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap"></span><span class="text-text-weak whitespace-nowrap">/');function K(r){return((r??"").split(/\r?\n/)[0]??"").replace(/[\u0000-\u001F\u007F]/g,"").trim()}function st(r){const t=r.replaceAll("\\","/");return t.startsWith("//")&&!t.startsWith("///")?"//"+t.slice(2).replace(/\/+/g,"/"):t.replace(/\/+/g,"/")}function v(r){const t=st(r);return/^[A-Za-z]:$/.test(t)?t+"/":t}function d(r){const t=v(r);return t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t)?t:t.replace(/\/+$/,"")}function ot(r,t){const o=d(r??""),c=d(t).replace(/^\/+/,"");return o?c?o.endsWith("/")?o+c:o+"/"+c:o:c}function L(r){const t=v(r);return t.startsWith("//")?"//":t.startsWith("/")?"/":/^[A-Za-z]:\//.test(t)?t.slice(0,3):""}function at(r){const t=d(r);if(t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t))return t;const o=t.lastIndexOf("/");return o<=0?"/":o===2&&/^[A-Za-z]:/.test(t)?t.slice(0,3):t.slice(0,o)}function it(r){const t=v(r.trim());return t?t.startsWith("~")?"tilde":L(t)?"absolute":"relative":"relative"}function G(r,t){const o=d(r);if(!t)return"";const c=d(t),x=o.toLowerCase(),u=c.toLowerCase();return x===u?"~":x.startsWith(u+"/")?"~"+o.slice(c.length):""}function Z(r,t,o){const c=d(r);return it(t)==="absolute"?c:G(c,o)||c}function B(r,t,o){const c=d(r),x=G(c,t),u=l=>l?l.endsWith("/")?l:l+"/":"",y=Array.from(new Set([c,u(c),x,u(x),j(c)].filter(Boolean))).join(`
2
- `);return{absolute:c,search:y,group:o}}function ct(r){const t=new Set;return r.filter(o=>t.has(o.absolute)?!1:(t.add(o.absolute),!0))}function lt(r){const t=new Map;let o=0;const c=y=>{const l=r.start();if(!l)return;const a=v(y);if(!a)return{directory:d(l),path:""};const m=r.home();if(a==="~")return{directory:d(m||l),path:""};if(a.startsWith("~/"))return{directory:d(m||l),path:a.slice(2)};const i=L(a);return i?{directory:d(i),path:a.slice(i.length)}:{directory:d(l),path:a}},x=async y=>{const l=d(y),a=t.get(l);if(a)return a;const m=r.sdk.client.file.list({directory:l,path:""}).then(i=>i.data??[]).catch(()=>[]).then(i=>i.filter(f=>f.type==="directory").map(f=>({name:f.name,absolute:d(v(f.absolute))})));return t.set(l,m),m},u=async(y,l,a)=>{const m=await x(y);return l?et.go(l,m,{key:"name",limit:a}).map(i=>i.obj.absolute):m.slice(0,a).map(i=>i.absolute)};return async y=>{const l=++o,a=()=>l===o,m=K(y),i=c(m);if(!i)return[];const f=v(m),C=f.startsWith("~")||!!L(f)||f.includes("/"),S=v(i.path),_=()=>r.sdk.client.find.files({directory:i.directory,query:S,type:"directory",limit:50}).then(h=>h.data??[]).catch(()=>[]);if(!C){const h=await _();return a()?h.map(F=>ot(i.directory,F)).slice(0,50):[]}const k=S.replace(/^\/+/,"").split("/"),D=k.slice(0,k.length-1).filter(h=>h&&h!=="."),e=k[k.length-1]??"",p=12,n=4;let s=[i.directory];for(const h of D){if(!a())return[];if(h===".."){s=s.map(at);continue}const F=(await Promise.all(s.map(T=>u(T,h,n)))).flat();if(!a())return[];if(s=Array.from(new Set(F)).slice(0,p),s.length===0)return[]}const w=(await Promise.all(s.map(h=>u(h,e,50)))).flat();if(!a())return[];const g=Array.from(new Set(w)),b=f.startsWith("~")?d(i.directory):"";if(!!f.endsWith("/")||!e)return(b?Array.from(new Set([b,...g])):g).slice(0,50);const W=e.toLowerCase(),M=g.filter(h=>j(h).toLowerCase()===W)[0];if(!M)return g.slice(0,50);const q=await u(M,"",30);if(!a())return[];const O=Array.from(new Set([...g,...q]));return(b?Array.from(new Set([b,...O])):O).slice(0,50)}}function ht(r){const t=V(),o=E(),c=H(),x=J(),u=N(),[y,l]=Q("");let a;const m=A(()=>!(t.data.path.home||t.data.path.directory)),[i]=U(()=>m()?!0:void 0,async()=>o.client.path.get().then(e=>e.data).catch(()=>{}),{initialValue:void 0}),f=A(()=>t.data.path.home||i()?.home||""),C=A(()=>t.data.path.home||t.data.path.directory||i()?.home||i()?.directory),S=lt({sdk:o,home:f,start:C}),_=A(()=>{const e=c.projects.list(),p=new Map;for(const n of e){let s=0;const w=[n.worktree,...n.sandboxes??[]];for(const g of w){const b=t.child(g,{bootstrap:!1})[0].session;for(const $ of b){if($.time.archived)continue;const W=$.time.updated??$.time.created;W>s&&(s=W)}}p.set(n.worktree,s)}return e.map((n,s)=>({project:n,at:p.get(n.worktree)??0,index:s})).sort((n,s)=>s.at-n.at||n.index-s.index).slice(0,5).map(({project:n})=>{const s=B(n.worktree,f(),"recent"),w=n.name||j(n.worktree);return{...s,search:`${s.search}
3
- ${w}`}})}),k=async e=>{const n=(await S(e)).map(s=>B(s,f(),"folders"));return ct([..._(),...n])};function D(e){r.onSelect(r.multiple?[e]:e),x.close()}return z(Y,{get title(){return r.title??u.t("command.project.open")},get children(){return z(tt,{get search(){return{placeholder:u.t("dialog.directory.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.directory.empty")},get loadingMessage(){return u.t("common.loading")},items:k,key:e=>e.absolute,filterKeys:["search"],groupBy:e=>e.group,sortGroupsBy:(e,p)=>e.category===p.category?0:e.category==="recent"?-1:1,groupHeader:e=>e.category==="recent"?u.t("home.recentProjects"):u.t("command.project.open"),ref:e=>a=e,onFilter:e=>l(K(e)),onKeyEvent:(e,p)=>{if(e.key!=="Tab"||e.shiftKey||!p)return;e.preventDefault(),e.stopPropagation();const n=Z(p.absolute,y(),f());a?.setFilter(n.endsWith("/")?n:n+"/")},onSelect:e=>{e&&D(e.absolute)},children:e=>{const p=Z(e.absolute,y(),f());return p==="~"?(()=>{var n=rt(),s=n.firstChild,w=s.firstChild;return P(s,z(R,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),w),n})():(()=>{var n=nt(),s=n.firstChild,w=s.firstChild,g=w.firstChild,b=g.nextSibling;return P(s,z(R,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),w),P(g,()=>X(p)),P(b,()=>j(p)),n})()}})}})}export{ht as DialogSelectDirectory};
1
+ import{u as E,bz as H,a as V,c as Y,f as J,w as N,g as z,aB as Q,ag as j,h as A,i as P,aP as U,aY as X,t as I}from"./index-CIniE1sM.js";import{F as O}from"./file-icon-By0OPIsC.js";import{L as tt,f as et}from"./list-Bd_lG005.js";var rt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-strong whitespace-nowrap">~</span><span class="text-text-weak whitespace-nowrap">/'),nt=I('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap"></span><span class="text-text-weak whitespace-nowrap">/');function K(r){return((r??"").split(/\r?\n/)[0]??"").replace(/[\u0000-\u001F\u007F]/g,"").trim()}function st(r){const t=r.replaceAll("\\","/");return t.startsWith("//")&&!t.startsWith("///")?"//"+t.slice(2).replace(/\/+/g,"/"):t.replace(/\/+/g,"/")}function v(r){const t=st(r);return/^[A-Za-z]:$/.test(t)?t+"/":t}function d(r){const t=v(r);return t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t)?t:t.replace(/\/+$/,"")}function ot(r,t){const o=d(r??""),c=d(t).replace(/^\/+/,"");return o?c?o.endsWith("/")?o+c:o+"/"+c:o:c}function L(r){const t=v(r);return t.startsWith("//")?"//":t.startsWith("/")?"/":/^[A-Za-z]:\//.test(t)?t.slice(0,3):""}function at(r){const t=d(r);if(t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t))return t;const o=t.lastIndexOf("/");return o<=0?"/":o===2&&/^[A-Za-z]:/.test(t)?t.slice(0,3):t.slice(0,o)}function it(r){const t=v(r.trim());return t?t.startsWith("~")?"tilde":L(t)?"absolute":"relative":"relative"}function G(r,t){const o=d(r);if(!t)return"";const c=d(t),x=o.toLowerCase(),u=c.toLowerCase();return x===u?"~":x.startsWith(u+"/")?"~"+o.slice(c.length):""}function R(r,t,o){const c=d(r);return it(t)==="absolute"?c:G(c,o)||c}function Z(r,t,o){const c=d(r),x=G(c,t),u=l=>l?l.endsWith("/")?l:l+"/":"",y=Array.from(new Set([c,u(c),x,u(x),j(c)].filter(Boolean))).join(`
2
+ `);return{absolute:c,search:y,group:o}}function ct(r){const t=new Set;return r.filter(o=>t.has(o.absolute)?!1:(t.add(o.absolute),!0))}function lt(r){const t=new Map;let o=0;const c=y=>{const l=r.start();if(!l)return;const a=v(y);if(!a)return{directory:d(l),path:""};const m=r.home();if(a==="~")return{directory:d(m||l),path:""};if(a.startsWith("~/"))return{directory:d(m||l),path:a.slice(2)};const i=L(a);return i?{directory:d(i),path:a.slice(i.length)}:{directory:d(l),path:a}},x=async y=>{const l=d(y),a=t.get(l);if(a)return a;const m=r.sdk.client.file.list({directory:l,path:""}).then(i=>i.data??[]).catch(()=>[]).then(i=>i.filter(f=>f.type==="directory").map(f=>({name:f.name,absolute:d(v(f.absolute))})));return t.set(l,m),m},u=async(y,l,a)=>{const m=await x(y);return l?et.go(l,m,{key:"name",limit:a}).map(i=>i.obj.absolute):m.slice(0,a).map(i=>i.absolute)};return async y=>{const l=++o,a=()=>l===o,m=K(y),i=c(m);if(!i)return[];const f=v(m),C=f.startsWith("~")||!!L(f)||f.includes("/"),S=v(i.path),_=()=>r.sdk.client.find.files({directory:i.directory,query:S,type:"directory",limit:50}).then(h=>h.data??[]).catch(()=>[]);if(!C){const h=await _();return a()?h.map(F=>ot(i.directory,F)).slice(0,50):[]}const k=S.replace(/^\/+/,"").split("/"),D=k.slice(0,k.length-1).filter(h=>h&&h!=="."),e=k[k.length-1]??"",p=12,n=4;let s=[i.directory];for(const h of D){if(!a())return[];if(h===".."){s=s.map(at);continue}const F=(await Promise.all(s.map(T=>u(T,h,n)))).flat();if(!a())return[];if(s=Array.from(new Set(F)).slice(0,p),s.length===0)return[]}const w=(await Promise.all(s.map(h=>u(h,e,50)))).flat();if(!a())return[];const g=Array.from(new Set(w)),b=f.startsWith("~")?d(i.directory):"";if(!!f.endsWith("/")||!e)return(b?Array.from(new Set([b,...g])):g).slice(0,50);const W=e.toLowerCase(),B=g.filter(h=>j(h).toLowerCase()===W)[0];if(!B)return g.slice(0,50);const q=await u(B,"",30);if(!a())return[];const M=Array.from(new Set([...g,...q]));return(b?Array.from(new Set([b,...M])):M).slice(0,50)}}function ht(r){const t=E(),o=H(),c=V(),x=Y(),u=J(),[y,l]=N("");let a;const m=z(()=>!(t.data.path.home||t.data.path.directory)),[i]=Q(()=>m()?!0:void 0,async()=>o.client.path.get().then(e=>e.data).catch(()=>{}),{initialValue:void 0}),f=z(()=>t.data.path.home||i()?.home||""),C=z(()=>t.data.path.home||t.data.path.directory||i()?.home||i()?.directory),S=lt({sdk:o,home:f,start:C}),_=z(()=>{const e=c.projects.list(),p=new Map;for(const n of e){let s=0;const w=[n.worktree,...n.sandboxes??[]];for(const g of w){const b=t.child(g,{bootstrap:!1})[0].session;for(const $ of b){if($.time.archived)continue;const W=$.time.updated??$.time.created;W>s&&(s=W)}}p.set(n.worktree,s)}return e.map((n,s)=>({project:n,at:p.get(n.worktree)??0,index:s})).sort((n,s)=>s.at-n.at||n.index-s.index).slice(0,5).map(({project:n})=>{const s=Z(n.worktree,f(),"recent"),w=n.name||j(n.worktree);return{...s,search:`${s.search}
3
+ ${w}`}})}),k=async e=>{const n=(await S(e)).map(s=>Z(s,f(),"folders"));return ct([..._(),...n])};function D(e){r.onSelect(r.multiple?[e]:e),x.close()}return A(X,{get title(){return r.title??u.t("command.project.open")},get children(){return A(tt,{get search(){return{placeholder:u.t("dialog.directory.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.directory.empty")},get loadingMessage(){return u.t("common.loading")},items:k,key:e=>e.absolute,filterKeys:["search"],groupBy:e=>e.group,sortGroupsBy:(e,p)=>e.category===p.category?0:e.category==="recent"?-1:1,groupHeader:e=>e.category==="recent"?u.t("home.recentProjects"):u.t("command.project.open"),ref:e=>a=e,onFilter:e=>l(K(e)),onKeyEvent:(e,p)=>{if(e.key!=="Tab"||e.shiftKey||!p)return;e.preventDefault(),e.stopPropagation();const n=R(p.absolute,y(),f());a?.setFilter(n.endsWith("/")?n:n+"/")},onSelect:e=>{e&&D(e.absolute)},children:e=>{const p=R(e.absolute,y(),f());return p==="~"?(()=>{var n=rt(),s=n.firstChild,w=s.firstChild;return P(s,A(O,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),w),n})():(()=>{var n=nt(),s=n.firstChild,w=s.firstChild,g=w.firstChild,b=g.nextSibling;return P(s,A(O,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),w),P(g,()=>U(p)),P(b,()=>j(p)),n})()}})}})}export{ht as DialogSelectDirectory};
@@ -0,0 +1 @@
1
+ import{ad as U,f as V,a as X,aK as Z,c as ee,d as te,bz as ne,u as se,w as re,g as b,s as ae,h as y,af as oe,S as ie,M as K,i as p,a2 as D,cE as ce,I as le,j as L,aP as de,ag as O,aY as ue,l as fe,t as _}from"./index-CIniE1sM.js";import{F as ge}from"./file-icon-By0OPIsC.js";import{u as he,c as pe,K as me}from"./session-CuMpLG8c.js";import{L as we}from"./list-Bd_lG005.js";import"./index-C1_o3AOA.js";import"./select-CsoVU8kZ.js";import"./provider-icon-DzvEuHl8.js";function ye(t,n){const i=new Date(t),r=new Date().getTime()-i.getTime(),c=Math.floor(r/1e3),u=Math.floor(c/60),a=Math.floor(u/60),f=Math.floor(a/24);return c<60?n("common.time.justNow"):u<60?n("common.time.minutesAgo.short",{count:u}):a<24?n("common.time.hoursAgo.short",{count:a}):n("common.time.daysAgo.short",{count:f})}var P=_('<span class="text-14-regular text-text-weak truncate">'),ve=_('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),be=_('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),xe=_('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),ke=_('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const T=5,$e=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],A=t=>{const n=new Set,i=[];for(const g of t)n.has(g.id)||(n.add(g.id),i.push(g));return i},N=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),C=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Se=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function _e(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(r=>!r.disabled&&!r.id.startsWith("suggested.")&&r.id!=="file.open")),i=b(()=>{const r=t.language.t("palette.group.commands");return n().map(c=>N(c,r))}),g=b(()=>{const r=n(),c=new Map($e.map((o,l)=>[o,l])),u=r.filter(o=>c.has(o.id)),a=u.length?u:r.slice(0,T),f=u.length?[...a].sort((o,l)=>(c.get(o.id)??0)-(c.get(l.id)??0)):a,v=t.language.t("palette.group.commands");return f.map(o=>N(o,v))});return{allowed:n,list:i,picks:g}}function Me(t){const n=pe({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:r=>r.startsWith("file://")?t.file.tab(r):r}),i=b(()=>{const r=n.openedTabs(),c=n.activeFileTab(),u=c?[c,...r.filter(o=>o!==c)]:r,a=new Set,f=t.language.t("palette.group.files"),v=[];for(const o of u){const l=t.file.pathFromTab(o);l&&(a.has(l)||(a.add(l),v.push(C(l,f))))}return v.slice(0,T)}),g=b(()=>{const r=t.language.t("palette.group.files");return t.file.tree.children("").filter(a=>a.type==="file").map(a=>a.path).sort((a,f)=>a.localeCompare(f)).slice(0,T).map(a=>C(a,r))});return{recent:i,root:g}}function De(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:g=>{if(!g.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const c=n.token,u=t.workspaces();return u.length===0?[]:(n.inflight=Promise.all(u.map(a=>{const f=t.label(a);return t.globalSDK.client.session.list({directory:a,roots:!0}).then(v=>(v.data??[]).filter(o=>!!o?.id).map(o=>({id:o.id,title:o.title??t.language.t("command.session.new"),description:f,directory:a,archived:o.time?.archived,updated:o.time?.updated}))).catch(()=>[])})).then(a=>{if(n.token!==c)return[];const f=new Set,v=t.language.t("command.category.session"),o=a.flat().filter(l=>{const k=`${l.directory}:${l.id}`;return f.has(k)?!1:(f.add(k),!0)}).map(l=>Se(l,v));return n.cached=o,o}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function Le(t){const n=U(),i=V(),g=X(),r=Z(),c=ee(),u=te(),a=ne(),f=se(),{params:v,tabs:o,view:l}=he(),k=()=>t.mode==="files",$={cleanup:void 0,committed:!1},[q,z]=re(!1),E=_e({filesOnly:k,command:n,language:i}),S=Me({file:r,tabs:o,language:i}),I=b(()=>oe(v.dir)??""),j=b(()=>{const e=I();if(e)return g.projects.list().find(s=>s.worktree===e||s.sandboxes?.includes(e))}),G=b(()=>{const e=I(),s=j();if(!s)return e?[e]:[];const d=[s.worktree,...s.sandboxes??[]];return e&&!d.includes(e)?[...d,e]:d}),R=b(()=>f.data.path.home),H=e=>{const s=j(),d=s&&e===s.worktree?i.t("workspace.type.local"):i.t("workspace.type.sandbox"),[m]=f.child(e,{bootstrap:!1}),h=R(),w=h?e.replace(h,"~"):e,x=m.vcs?.branch??O(e);return`${d} : ${x||w}`},{sessions:W}=De({workspaces:G,label:H,globalSDK:a,language:i}),Y=async e=>{const s=e.trim();if(z(s.length>0),!s&&k()){const x=r.tree.state("")?.loaded,F=x?Promise.resolve():r.tree.list(""),M=A([...S.recent(),...S.root()]);return x||M.length>0?M:(await F,A([...S.recent(),...S.root()]))}if(!s)return[...E.picks(),...S.recent()];if(k()){const x=await r.searchFiles(s),F=i.t("palette.group.files");return x.map(M=>C(M,F))}const[d,m]=await Promise.all([r.searchFiles(s),Promise.resolve(W(s))]),h=i.t("palette.group.files"),w=d.map(x=>C(x,h));return[...E.list(),...m,...w]},B=e=>{$.cleanup?.(),e&&e.type==="command"&&($.cleanup=e.option?.onHighlight?.())},J=e=>{const s=r.tab(e);o().open(s),r.load(e),l().reviewPanel.opened()||l().reviewPanel.open(),g.fileTree.setTab("all"),t.onOpenFile?.(e),o().setActive(s)},Q=e=>{if(e){if($.committed=!0,$.cleanup=void 0,c.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;u(`/${fe(e.directory)}/session/${e.sessionID}`);return}e.path&&J(e.path)}};return ae(()=>{$.committed||$.cleanup?.()}),y(ue,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return y(we,{get search(){return{placeholder:k()?i.t("session.header.searchFiles"):i.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return i.t("palette.empty")},get loadingMessage(){return i.t("common.loading")},items:Y,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return q()?e=>e.category:()=>""},onMove:B,onSelect:Q,children:e=>y(ie,{get fallback(){return(()=>{var s=ke(),d=s.firstChild,m=d.firstChild,h=m.firstChild,w=h.nextSibling;return p(d,y(ge,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),m),p(h,()=>de(e.path??"")),p(w,()=>O(e.path??"")),s})()},get children(){return[y(K,{get when(){return e.type==="command"},get children(){var s=ve(),d=s.firstChild,m=d.firstChild;return p(m,()=>e.title),p(d,y(D,{get when(){return e.description},get children(){var h=P();return p(h,()=>e.description),h}}),null),p(s,y(D,{get when(){return e.keybind},get children(){return y(me,{class:"rounded-[4px]",get children(){return ce(e.keybind??"",i.t)}})}}),null),s}}),y(K,{get when(){return e.type==="session"},get children(){var s=xe(),d=s.firstChild,m=d.firstChild,h=m.firstChild;return p(d,y(le,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),m),p(h,()=>e.title),p(m,y(D,{get when(){return e.description},get children(){var w=P();return p(w,()=>e.description),L(()=>w.classList.toggle("opacity-70",!!e.archived)),w}}),null),p(s,y(D,{get when(){return e.updated},get children(){var w=be();return p(w,()=>ye(new Date(e.updated).toISOString(),i.t)),w}}),null),L(()=>h.classList.toggle("opacity-70",!!e.archived)),s}})]}})})}})}export{Le as DialogSelectFile};
@@ -0,0 +1 @@
1
+ import{ab as P,aN as E,f as M,n as D,p as y,q as j,ao as q,g as h,b5 as F,h as u,aE as K,i as c,a2 as v,m as $,aY as B,t as m}from"./index-CIniE1sM.js";import{L as N}from"./list-Bd_lG005.js";import{S as O}from"./switch-BZ-0S1HQ.js";var T=m('<span class="text-11-regular text-text-weaker">'),Y=m('<span class="text-11-regular text-text-weak">'),z=m('<span class="text-11-regular text-text-weaker truncate">'),A=m('<div class="w-full flex items-center justify-between gap-x-3"><div class="flex flex-col gap-0.5 min-w-0"><div class="flex items-center gap-2"><span class=truncate></span></div></div><div>');const G={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},Q=()=>{const s=P(),d=E(),l=M(),[_,o]=D({done:!1,loading:!1});y(j(()=>s.data.mcp_ready,(e,t)=>{!e&&t&&o("done",!1)},{defer:!0})),y(()=>{if(!(_.done||_.loading)){if(s.data.mcp_ready){o("done",!0);return}o("loading",!0),d.client.mcp.status().then(e=>{s.set("mcp",e.data??{}),s.set("mcp_ready",!0),o("done",!0)}).catch(e=>{o("done",!0),q({variant:"error",title:l.t("common.requestFailed"),description:e instanceof Error?e.message:String(e)})}).finally(()=>{o("loading",!1)})}});const p=h(()=>Object.entries(s.data.mcp??{}).map(([e,t])=>({name:e,status:t.status})).sort((e,t)=>e.name.localeCompare(t.name))),n=F(()=>({mutationFn:async e=>{s.data.mcp[e]?.status==="connected"?await d.client.mcp.disconnect({name:e}):await d.client.mcp.connect({name:e});const i=await d.client.mcp.status();i.data&&s.set("mcp",i.data)}})),S=h(()=>p().filter(e=>e.status==="connected").length),k=h(()=>p().length);return u(B,{get title(){return l.t("dialog.mcp.title")},get description(){return l.t("dialog.mcp.description",{enabled:S(),total:k()})},get children(){return u(N,{get search(){return{placeholder:l.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return l.t("dialog.mcp.empty")},key:e=>e?.name??"",items:p,filterKeys:["name","status"],sortBy:(e,t)=>e.name.localeCompare(t.name),onSelect:e=>{!e||n.isPending||n.mutate(e.name)},children:e=>{const t=()=>s.data.mcp[e.name],i=()=>t()?.status,b=()=>{const r=i()?G[i()]:void 0;if(r)return l.t(r)},w=()=>{const r=t();return r?.status==="failed"?r.error:void 0},C=()=>i()==="connected";return(()=>{var r=A(),g=r.firstChild,f=g.firstChild,L=f.firstChild,x=g.nextSibling;return c(L,()=>e.name),c(f,u(v,{get when(){return b()},get children(){var a=T();return c(a,b),a}}),null),c(f,u(v,{get when(){return $(()=>!!n.isPending)()&&n.variables===e.name},get children(){var a=Y();return c(a,()=>l.t("common.loading.ellipsis")),a}}),null),c(g,u(v,{get when(){return w()},get children(){var a=z();return c(a,w),a}}),null),x.$$click=a=>a.stopPropagation(),c(x,u(O,{get checked(){return C()},get disabled(){return $(()=>!!n.isPending)()&&n.variables===e.name},onChange:()=>{n.isPending||n.mutate(e.name)}})),r})()}})}})};K(["click"]);export{Q as DialogSelectMcp};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-connect-provider-CRQUO9He.js","assets/index-CIniE1sM.js","assets/index-ytVPOPlW.css","assets/list-Bd_lG005.js","assets/provider-icon-DzvEuHl8.js","assets/dialog-select-provider-CKvDgZkl.js"])))=>i.map(i=>d[i]);
2
+ import{aS as P,c as E,aI as I,f as S,h as t,i as r,a2 as u,am as L,m as T,aZ as p,B as M,aY as O,t as c,aa as w,aE as A}from"./index-CIniE1sM.js";import{L as $}from"./list-Bd_lG005.js";import{T as m,P as B}from"./provider-icon-DzvEuHl8.js";import{M as R}from"./session-CuMpLG8c.js";import"./index-C1_o3AOA.js";import"./select-CsoVU8kZ.js";import"./file-icon-By0OPIsC.js";var K=c('<div class="flex flex-col gap-3 px-2.5"><div class="text-14-medium text-text-base px-2.5">'),V=c('<div class="px-1.5 pb-1.5"><div class="w-full rounded-sm border border-border-weak-base bg-surface-raised-base"><div class="w-full flex flex-col items-start gap-4 px-1.5 pt-4 pb-4"><div class="px-2 text-14-medium text-text-base"></div><div class=w-full>'),j=c('<div class="w-full flex items-center gap-x-2.5"><span>'),h=c('<div class="text-14-regular text-text-weak">'),G=c('<div class="w-full flex items-center gap-x-3"><span>');const H=k=>{const v=k.model??P().model,f=E(),b=I(),d=S(),y=l=>{w(()=>import("./dialog-connect-provider-CRQUO9He.js").then(s=>s.d),__vite__mapDeps([0,1,2,3,4])).then(s=>{f.show(()=>t(s.DialogConnectProvider,{provider:l}))})},D=()=>{w(()=>import("./dialog-select-provider-CKvDgZkl.js").then(l=>l.d),__vite__mapDeps([5,1,2,3,4,0])).then(l=>{f.show(()=>t(l.DialogSelectProvider,{}))})};let _;const C=l=>{l.key!=="Escape"&&_?.onKeyDown(l)};return t(O,{get title(){return d.t("dialog.model.select.title")},class:"overflow-y-auto [&_[data-slot=dialog-body]]:overflow-visible [&_[data-slot=dialog-body]]:flex-none",get children(){return[(()=>{var l=K(),s=l.firstChild;return l.$$keydown=C,r(s,()=>d.t("dialog.model.unpaid.freeModels.title")),r(l,t($,{class:"[&_[data-slot=list-scroll]]:overflow-visible",ref:e=>_=e,get items(){return v.list},get current(){return v.current()},key:e=>`${e.provider.id}:${e.id}`,itemWrapper:(e,o)=>t(L,{class:"w-full",placement:"right-start",gutter:12,get value(){return t(R,{model:e,get latest(){return e.latest},get free(){return T(()=>e.provider.id==="duckmind")()&&(!e.cost||e.cost.input===0)}})},children:o}),onSelect:e=>{v.set(e?{modelID:e.id,providerID:e.provider.id}:void 0,{recent:!0}),f.close()},children:e=>(()=>{var o=j(),g=o.firstChild;return r(g,()=>e.name),r(o,t(m,{get children(){return d.t("model.tag.free")}}),null),r(o,t(u,{get when(){return e.latest},get children(){return t(m,{get children(){return d.t("model.tag.latest")}})}}),null),o})()}),null),l})(),(()=>{var l=V(),s=l.firstChild,e=s.firstChild,o=e.firstChild,g=o.nextSibling;return r(o,()=>d.t("dialog.model.unpaid.addMore.title")),r(g,t($,{class:"w-full px-0",key:i=>i?.id,get items(){return b.popular},activeIcon:"plus-small",sortBy:(i,a)=>p.includes(i.id)&&p.includes(a.id)?p.indexOf(i.id)-p.indexOf(a.id):i.name.localeCompare(a.name),onSelect:i=>{i&&y(i.id)},children:i=>(()=>{var a=G(),x=a.firstChild;return r(a,t(B,{"data-slot":"list-item-extra-icon",get id(){return i.id}}),x),r(x,()=>i.name),r(a,t(u,{get when(){return i.id==="duckmind"},get children(){var n=h();return r(n,()=>d.t("dialog.provider.duckmind.tagline")),n}}),null),r(a,t(u,{get when(){return i.id==="duckmind"},get children(){return t(m,{get children(){return d.t("dialog.provider.tag.recommended")}})}}),null),r(a,t(u,{get when(){return i.id==="duckmind-go"},get children(){return[(()=>{var n=h();return r(n,()=>d.t("dialog.provider.duckmindGo.tagline")),n})(),t(m,{get children(){return d.t("dialog.provider.tag.recommended")}})]}}),null),r(a,t(u,{get when(){return i.id==="anthropic"},get children(){var n=h();return r(n,()=>d.t("dialog.provider.anthropic.note")),n}}),null),a})()}),null),r(g,t(M,{variant:"ghost",class:"w-full justify-start px-[11px] py-3.5 gap-4.5 text-14-medium",icon:"dot-grid",onClick:D,get children(){return d.t("dialog.provider.viewAll")}}),null),l})()]}})};A(["keydown"]);export{H as DialogSelectModelUnpaid};
@@ -0,0 +1 @@
1
+ import{c as X,u as le,bz as ne,f as ee,n as se,b5 as de,ao as A,h as o,i as a,bE as k,F as V,a8 as G,j as N,aG as W,B as T,m as ce,aY as re,t as q,C as j,bC as B,aI as ue,a2 as U,aZ as K}from"./index-CIniE1sM.js";import{L as ve}from"./list-Bd_lG005.js";import{P as te,T as H}from"./provider-icon-DzvEuHl8.js";import{L as me,D as pe}from"./dialog-connect-provider-CRQUO9He.js";const ge=/^[a-z0-9][a-z0-9-_]*$/,he="@ai-sdk/openai-compatible";function fe(n){const h=n.form.providerID.trim(),s=n.form.name.trim(),x=n.form.baseURL.trim(),r=n.form.apiKey.trim(),d=r.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),v=r&&!d?r:void 0,t=h?ge.test(h)?void 0:n.t("provider.custom.error.providerID.format"):n.t("provider.custom.error.providerID.required"),u=s?void 0:n.t("provider.custom.error.name.required"),g=x?/^https?:\/\//.test(x)?void 0:n.t("provider.custom.error.baseURL.format"):n.t("provider.custom.error.baseURL.required"),y=n.disabledProviders.includes(h),_=t?void 0:n.existingProviderIDs.has(h)&&!y?n.t("provider.custom.error.providerID.exists"):void 0,w=new Set,S=n.form.models.map(l=>{const p=l.id.trim(),f=p?w.has(p)?n.t("provider.custom.error.duplicate"):(()=>{w.add(p)})():n.t("provider.custom.error.required"),P=l.name.trim()?void 0:n.t("provider.custom.error.required");return{id:f,name:P}}),M=S.every(l=>!l.id&&!l.name),z=Object.fromEntries(n.form.models.map(l=>[l.id.trim(),{name:l.name.trim()}])),C=new Set,L=n.form.headers.map(l=>{const p=l.key.trim(),f=l.value.trim();if(!p&&!f)return{};const P=p?C.has(p.toLowerCase())?n.t("provider.custom.error.duplicate"):(()=>{C.add(p.toLowerCase())})():n.t("provider.custom.error.required"),E=f?void 0:n.t("provider.custom.error.required");return{key:P,value:E}}),e=L.every(l=>!l.key&&!l.value),i=Object.fromEntries(n.form.headers.map(l=>({key:l.key.trim(),value:l.value.trim()})).filter(l=>!!l.key&&!!l.value).map(l=>[l.key,l.value])),m={providerID:t??_,name:u,baseURL:g};return!t&&!_&&!u&&!g&&M&&e?{err:m,models:S,headers:L,result:{providerID:h,name:s,key:v,config:{npm:he,name:s,...d?{env:[d]}:{},options:{baseURL:x,...Object.keys(i).length?{headers:i}:{}},models:z}}}:{err:m,models:S,headers:L}}let be=0;const oe=()=>`row-${be++}`,Y=()=>({row:oe(),id:"",name:"",err:{}}),Z=()=>({row:oe(),key:"",value:"",err:{}});var xe=q('<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">'),J=q('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function ye(n){const h=X(),s=le(),x=ne(),r=ee(),[d,v]=se({providerID:"",name:"",baseURL:"",apiKey:"",models:[Y()],headers:[Z()],err:{}}),t=()=>{if(n.back==="close"){h.close();return}h.show(()=>o(ae,{}))},u=()=>{v("models",B(e=>{e.push(Y())}))},g=e=>{d.models.length<=1||v("models",B(i=>{i.splice(e,1)}))},y=()=>{v("headers",B(e=>{e.push(Z())}))},_=e=>{d.headers.length<=1||v("headers",B(i=>{i.splice(e,1)}))},w=(e,i)=>{v(e,i),e!=="apiKey"&&v("err",e,void 0)},S=(e,i,m)=>{j(()=>{v("models",e,i,m),v("models",e,"err",i,void 0)})},M=(e,i,m)=>{j(()=>{v("headers",e,i,m),v("headers",e,"err",i,void 0)})},z=()=>{const e=fe({form:d,t:r.t,disabledProviders:s.data.config.disabled_providers??[],existingProviderIDs:new Set(s.data.provider.all.map(i=>i.id))});return j(()=>{v("err",e.err),e.models.forEach((i,m)=>v("models",m,"err",i)),e.headers.forEach((i,m)=>v("headers",m,"err",i))}),e.result},C=de(()=>({mutationFn:async e=>{const m=(s.data.config.disabled_providers??[]).filter($=>$!==e.providerID);return e.key&&await x.client.auth.set({providerID:e.providerID,auth:{type:"api",key:e.key}}),await s.updateConfig({provider:{[e.providerID]:e.config},disabled_providers:m}),e},onSuccess:e=>{h.close(),A({variant:"success",icon:"circle-check",title:r.t("provider.connect.toast.connected.title",{provider:e.name}),description:r.t("provider.connect.toast.connected.description",{provider:e.name})})},onError:e=>{const i=e instanceof Error?e.message:String(e);A({title:r.t("common.requestFailed"),description:i})}})),L=e=>{if(e.preventDefault(),C.isPending)return;const i=z();i&&C.mutate(i)};return o(re,{get title(){return o(G,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:t,get"aria-label"(){return r.t("common.goBack")}})},transition:!0,get children(){var e=xe(),i=e.firstChild,m=i.firstChild,$=i.nextSibling,l=$.firstChild,p=l.nextSibling,f=p.nextSibling,P=f.firstChild,E=f.nextSibling,ie=E.firstChild;return a(i,o(te,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),m),a(m,()=>r.t("provider.custom.title")),$.addEventListener("submit",L),a(l,()=>r.t("provider.custom.description.prefix"),null),a(l,o(me,{href:"https://duckmind.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return r.t("provider.custom.description.link")}}),null),a(l,()=>r.t("provider.custom.description.suffix"),null),a(p,o(k,{autofocus:!0,get label(){return r.t("provider.custom.field.providerID.label")},get placeholder(){return r.t("provider.custom.field.providerID.placeholder")},get description(){return r.t("provider.custom.field.providerID.description")},get value(){return d.providerID},onChange:c=>w("providerID",c),get validationState(){return d.err.providerID?"invalid":void 0},get error(){return d.err.providerID}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.name.label")},get placeholder(){return r.t("provider.custom.field.name.placeholder")},get value(){return d.name},onChange:c=>w("name",c),get validationState(){return d.err.name?"invalid":void 0},get error(){return d.err.name}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.baseURL.label")},get placeholder(){return r.t("provider.custom.field.baseURL.placeholder")},get value(){return d.baseURL},onChange:c=>w("baseURL",c),get validationState(){return d.err.baseURL?"invalid":void 0},get error(){return d.err.baseURL}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.apiKey.label")},get placeholder(){return r.t("provider.custom.field.apiKey.placeholder")},get description(){return r.t("provider.custom.field.apiKey.description")},get value(){return d.apiKey},onChange:c=>w("apiKey",c)}),null),a(P,()=>r.t("provider.custom.models.label")),a(f,o(V,{get each(){return d.models},children:(c,D)=>(()=>{var b=J(),R=b.firstChild,F=R.nextSibling;return a(R,o(k,{get label(){return r.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.id.placeholder")},get value(){return c.id},onChange:I=>S(D(),"id",I),get validationState(){return c.err.id?"invalid":void 0},get error(){return c.err.id}})),a(F,o(k,{get label(){return r.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.name.placeholder")},get value(){return c.name},onChange:I=>S(D(),"name",I),get validationState(){return c.err.name?"invalid":void 0},get error(){return c.err.name}})),a(b,o(G,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>g(D()),get disabled(){return d.models.length<=1},get"aria-label"(){return r.t("provider.custom.models.remove")}}),null),N(()=>W(b,"data-row",c.row)),b})()}),null),a(f,o(T,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:u,class:"self-start",get children(){return r.t("provider.custom.models.add")}}),null),a(ie,()=>r.t("provider.custom.headers.label")),a(E,o(V,{get each(){return d.headers},children:(c,D)=>(()=>{var b=J(),R=b.firstChild,F=R.nextSibling;return a(R,o(k,{get label(){return r.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.key.placeholder")},get value(){return c.key},onChange:I=>M(D(),"key",I),get validationState(){return c.err.key?"invalid":void 0},get error(){return c.err.key}})),a(F,o(k,{get label(){return r.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.value.placeholder")},get value(){return c.value},onChange:I=>M(D(),"value",I),get validationState(){return c.err.value?"invalid":void 0},get error(){return c.err.value}})),a(b,o(G,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>_(D()),get disabled(){return d.headers.length<=1},get"aria-label"(){return r.t("provider.custom.headers.remove")}}),null),N(()=>W(b,"data-row",c.row)),b})()}),null),a(E,o(T,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:y,class:"self-start",get children(){return r.t("provider.custom.headers.add")}}),null),a($,o(T,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return C.isPending},get children(){return ce(()=>!!C.isPending)()?r.t("common.saving"):r.t("common.submit")}}),null),e}})}var Q=q('<div class="text-14-regular text-text-weak">'),ke=q('<div class="px-1.25 w-full flex items-center gap-x-3"><span>');const O="_custom",ae=()=>{const n=X(),h=ue(),s=ee(),x=()=>s.t("dialog.provider.group.popular"),r=()=>s.t("dialog.provider.group.other"),d=()=>s.t("settings.providers.tag.custom"),v=t=>{if(t==="anthropic")return s.t("dialog.provider.anthropic.note");if(t==="openai")return s.t("dialog.provider.openai.note");if(t.startsWith("github-copilot"))return s.t("dialog.provider.copilot.note");if(t==="duckmind-go")return s.t("dialog.provider.duckmindGo.tagline")};return o(re,{get title(){return s.t("command.provider.connect")},transition:!0,get children(){return o(ve,{get search(){return{placeholder:s.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return s.t("dialog.provider.empty")},activeIcon:"plus-small",key:t=>t?.id,items:()=>(s.locale(),[{id:O,name:d()},...h.all()]),filterKeys:["id","name"],groupBy:t=>K.includes(t.id)?x():r(),sortBy:(t,u)=>t.id===O?-1:u.id===O?1:K.includes(t.id)&&K.includes(u.id)?K.indexOf(t.id)-K.indexOf(u.id):t.name.localeCompare(u.name),sortGroupsBy:(t,u)=>{const g=x();return t.category===g&&u.category!==g?-1:u.category===g&&t.category!==g?1:0},onSelect:t=>{if(t){if(t.id===O){n.show(()=>o(ye,{back:"providers"}));return}n.show(()=>o(pe,{get provider(){return t.id}}))}},children:t=>(()=>{var u=ke(),g=u.firstChild;return a(u,o(te,{"data-slot":"list-item-extra-icon",get id(){return t.id}}),g),a(g,()=>t.name),a(u,o(U,{get when(){return t.id==="duckmind"},get children(){var y=Q();return a(y,()=>s.t("dialog.provider.duckmind.tagline")),y}}),null),a(u,o(U,{get when(){return t.id===O},get children(){return o(H,{get children(){return s.t("settings.providers.tag.custom")}})}}),null),a(u,o(U,{get when(){return t.id==="duckmind"},get children(){return o(H,{get children(){return s.t("dialog.provider.tag.recommended")}})}}),null),a(u,o(U,{get when(){return v(t.id)},children:y=>(()=>{var _=Q();return a(_,y),_})()}),null),a(u,o(U,{get when(){return t.id==="duckmind-go"},get children(){return o(H,{get children(){return s.t("dialog.provider.tag.recommended")}})}}),null),u})()})}})},Ie=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectProvider:ae},Symbol.toStringTag,{value:"Module"}));export{ye as D,ae as a,Ie as d};
@@ -0,0 +1 @@
1
+ import{d as me,c as he,e as fe,b as X,f as R,c8 as Z,n as pe,b5 as Y,c9 as z,ca as h,g as C,p as G,s as Se,i as S,h as a,a8 as J,m as w,a2 as $,I as we,al as p,B as O,aY as ye,aB as be,cb as ke,t as F,bE as N,ao as Ce}from"./index-CIniE1sM.js";import{L as xe}from"./list-Bd_lG005.js";import{S as _e,a as Pe}from"./server-row-CfBZdm7h.js";import"./index-C1_o3AOA.js";var De=F('<div class=px-5><div class="bg-surface-base rounded-md p-5 flex flex-col gap-3"><div class="flex-1 min-w-0 [&amp;_[data-slot=input-wrapper]]:relative"></div><div class="grid grid-cols-2 gap-2 min-w-0">'),$e=F('<div class="flex items-center gap-2 -ml-2"><span>'),Ie=F('<div class="flex flex-col gap-2"><div class="px-5 pb-5">'),Ee=F('<div class="flex items-center gap-3 min-w-0 flex-1 w-full group/item"><div class="flex flex-col h-full items-start w-5"></div><div class="flex items-center justify-center gap-4 pl-4">'),Ae=F('<span class="text-text-base bg-surface-base text-14-regular px-1.5 rounded-xs">');const K="duckmind";function Q(i,l){Ce({variant:"error",title:i.t("common.requestFailed"),description:l instanceof Error?l.message:String(l)})}function Fe(){const i=R(),l=X(),[o,u]=be(async()=>{try{const g=await l.getDefaultServer?.();return g||null}catch(g){return Q(i,g),null}},{initialValue:null}),s=C(()=>!!l.getDefaultServer&&!!l.setDefaultServer);return{defaultKey:o,canDefault:s,setDefault:async g=>{try{await l.setDefaultServer?.(g),u.mutate(g)}catch(x){Q(i,x)}}}}function Me(){const i=Z(),l=u=>{const s=z(u);if(!s)return!1;const m=s.replace(/^https?:\/\//,"").split("/")[0];return m?m.includes("localhost")||m.startsWith("127.0.0.1")?!0:m.includes(".")||m.includes(":"):!1};return{previewStatus:async(u,s,m,g)=>{if(g(void 0),!l(u))return;const x=z(u);if(!x)return;const y={url:x};s&&(y.username=s),m&&(y.password=m);const A=await i(y);g(A.healthy)}}}function Ne(i){const l=R(),o=u=>{if(u.stopPropagation(),u.key==="Escape"){u.preventDefault(),i.onBack();return}u.key!=="Enter"||u.isComposing||(u.preventDefault(),i.onSubmit())};return(()=>{var u=De(),s=u.firstChild,m=s.firstChild,g=m.nextSibling;return S(m,a(N,{type:"text",get label(){return l.t("dialog.server.add.url")},get placeholder(){return i.placeholder},get value(){return i.value},autofocus:!0,get validationState(){return i.error?"invalid":"valid"},get error(){return i.error},get disabled(){return i.busy},get onChange(){return i.onChange},onKeyDown:o})),S(s,a(N,{type:"text",get label(){return l.t("dialog.server.add.name")},get placeholder(){return l.t("dialog.server.add.namePlaceholder")},get value(){return i.name},get disabled(){return i.busy},get onChange(){return i.onNameChange},onKeyDown:o}),g),S(g,a(N,{type:"text",get label(){return l.t("dialog.server.add.username")},get placeholder(){return l.t("dialog.server.add.usernamePlaceholder")},get value(){return i.username},get disabled(){return i.busy},get onChange(){return i.onUsernameChange},onKeyDown:o}),null),S(g,a(N,{type:"password",get label(){return l.t("dialog.server.add.password")},get placeholder(){return l.t("dialog.server.add.passwordPlaceholder")},get value(){return i.password},get disabled(){return i.busy},get onChange(){return i.onPasswordChange},onKeyDown:o}),null),u})()}function Ke(){const i=me(),l=he(),o=fe(),u=X(),s=R(),{defaultKey:m,canDefault:g,setDefault:x}=Fe(),{previewStatus:y}=Me(),A=Z(),[r,d]=pe({status:{},addServer:{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0},editServer:{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0}}),M=()=>{d("addServer",{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0})},I=()=>{d("editServer",{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0})},_=Y(()=>({mutationFn:async e=>{const t=z(e);if(!t){M();return}const n={type:"http",http:{url:t}};if(r.addServer.name.trim()&&(n.displayName=r.addServer.name.trim()),r.addServer.password&&(n.http.password=r.addServer.password),r.addServer.password&&r.addServer.username&&(n.http.username=r.addServer.username),!(await A(n.http)).healthy){d("addServer",{error:s.t("dialog.server.add.error")});return}M(),await q(n,!0)}})),P=Y(()=>({mutationFn:async e=>{if(e.original.type!=="http")return;const t=z(e.value);if(!t){I();return}const n=r.editServer.name.trim()||void 0,v=r.editServer.username||void 0,c=r.editServer.password||void 0,b=e.original.displayName;if(t===e.original.http.url&&n===b&&v===e.original.http.username&&c===e.original.http.password){I();return}const k={type:"http",displayName:n,http:{url:t,username:v,password:c}};if(!(await A(k.http)).healthy){d("editServer",{error:s.t("dialog.server.add.error")});return}t===e.original.http.url?o.add(k):ee(e.original,k),I()}})),ee=(e,t)=>{const n=o.key,v=o.add(t);if(!v)return;const c=n===h.key(e)?h.key(v):n;c&&o.setActive(c),o.remove(h.key(e))},E=C(()=>{const e=o.current,t=o.list;return e?t.includes(e)?[e,...t.filter(n=>n!==e)]:[e,...t]:t}),H=C(()=>E().find(e=>h.key(e)===o.key)??E()[0]),re=C(()=>{const e=E();if(!e.length)return e;const t=H(),n=new Map(e.map((c,b)=>[c,b])),v=c=>c?.healthy===!0?0:c?.healthy===!1?2:1;return e.slice().sort((c,b)=>{if(c===t)return-1;if(b===t)return 1;const k=v(r.status[h.key(c)])-v(r.status[h.key(b)]);return k!==0?k:(n.get(c)??0)-(n.get(b)??0)})});async function T(){const e={};await Promise.all(E().map(async t=>{e[h.key(t)]=await A(t.http)})),d("status",ke(e))}G(()=>{E(),T();const e=setInterval(T,1e4);Se(()=>clearInterval(e))});async function q(e,t){if(!(!t&&r.status[h.key(e)]?.healthy===!1)){if(l.close(),t&&e.type==="http"){o.add(e),i("/");return}i("/"),queueMicrotask(()=>o.setActive(h.key(e)))}}const te=e=>{_.isPending||(d("addServer",{url:e,error:""}),y(e,r.addServer.username,r.addServer.password,t=>d("addServer",{status:t})))},ae=e=>{_.isPending||d("addServer",{name:e,error:""})},ne=e=>{_.isPending||(d("addServer",{username:e,error:""}),y(r.addServer.url,e,r.addServer.password,t=>d("addServer",{status:t})))},se=e=>{_.isPending||(d("addServer",{password:e,error:""}),y(r.addServer.url,r.addServer.username,e,t=>d("addServer",{status:t})))},ie=e=>{P.isPending||(d("editServer",{value:e,error:""}),y(e,r.editServer.username,r.editServer.password,t=>d("editServer",{status:t})))},de=e=>{P.isPending||d("editServer",{name:e,error:""})},le=e=>{P.isPending||(d("editServer",{username:e,error:""}),y(r.editServer.value,e,r.editServer.password,t=>d("editServer",{status:t})))},oe=e=>{P.isPending||(d("editServer",{password:e,error:""}),y(r.editServer.value,r.editServer.username,e,t=>d("editServer",{status:t})))},B=C(()=>r.editServer.id?"edit":r.addServer.showForm?"add":"list"),j=C(()=>{if(r.editServer.id)return E().find(e=>e.type==="http"&&e.http.url===r.editServer.id)}),V=()=>{M(),I()},ue=()=>{I(),d("addServer",{showForm:!0,url:"",name:"",username:K,password:"",error:"",status:void 0})},ce=e=>{M(),d("editServer",{id:e.http.url,value:e.http.url,name:e.displayName??"",username:e.http.username??"",password:e.http.password??"",error:"",status:r.status[h.key(e)]?.healthy})},W=()=>{if(B()==="add"){if(_.isPending)return;d("addServer",{error:""}),_.mutate(r.addServer.url);return}const e=j();e&&(P.isPending||(d("editServer",{error:""}),P.mutate({original:e,value:r.editServer.value})))},L=C(()=>B()!=="list"),f=C(()=>B()==="add"),U=C(()=>f()?_.isPending:P.isPending),ge=C(()=>L()?(()=>{var e=$e(),t=e.firstChild;return S(e,a(J,{icon:"arrow-left",variant:"ghost",onClick:V,get"aria-label"(){return s.t("common.goBack")}}),t),S(t,(()=>{var n=w(()=>!!f());return()=>n()?s.t("dialog.server.add.title"):s.t("dialog.server.edit.title")})()),e})():s.t("dialog.server.title"));G(()=>{r.editServer.id&&(j()||I())});async function ve(e){o.remove(e),await u.getDefaultServer?.()===e&&u.setDefaultServer?.(null)}return a(ye,{get title(){return ge()},get children(){var e=Ie(),t=e.firstChild;return S(e,a($,{get when(){return!L()},get fallback(){return a(Ne,{get value(){return w(()=>!!f())()?r.addServer.url:r.editServer.value},get name(){return w(()=>!!f())()?r.addServer.name:r.editServer.name},get username(){return w(()=>!!f())()?r.addServer.username:r.editServer.username},get password(){return w(()=>!!f())()?r.addServer.password:r.editServer.password},get placeholder(){return s.t("dialog.server.add.placeholder")},get busy(){return U()},get error(){return w(()=>!!f())()?r.addServer.error:r.editServer.error},get status(){return w(()=>!!f())()?r.addServer.status:r.editServer.status},get onChange(){return f()?te:ie},get onNameChange(){return f()?ae:de},get onUsernameChange(){return f()?ne:le},get onPasswordChange(){return f()?se:oe},onSubmit:W,onBack:V})},get children(){return a(xe,{get search(){return{placeholder:s.t("dialog.server.search.placeholder"),autofocus:!1}},noInitialSelection:!0,get emptyMessage(){return s.t("dialog.server.empty")},items:re,key:n=>n.http.url,onSelect:n=>{n&&q(n)},divider:!0,class:"px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]h-[300px] [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent",children:n=>{const v=h.key(n);return(()=>{var c=Ee(),b=c.firstChild,k=b.nextSibling;return S(b,a(_e,{get health(){return r.status[v]}})),S(c,a(Pe,{conn:n,get dimmed(){return r.status[v]?.healthy===!1},get status(){return r.status[v]},class:"flex items-center gap-3 min-w-0 flex-1",get badge(){return a($,{get when(){return m()===h.key(n)},get children(){var D=Ae();return S(D,()=>s.t("dialog.server.status.default")),D}})},showCredentials:!0}),k),S(k,a($,{get when(){return h.key(H())===v},get children(){return a(we,{name:"check",class:"h-6"})}}),null),S(k,a($,{get when(){return n.type==="http"},get children(){return a(p,{get children(){return[a(p.Trigger,{as:J,icon:"dot-grid",variant:"ghost",class:"shrink-0 size-8 hover:bg-surface-base-hover data-[expanded]:bg-surface-base-active",onClick:D=>D.stopPropagation(),onPointerDown:D=>D.stopPropagation()}),a(p.Portal,{get children(){return a(p.Content,{class:"mt-1",get children(){return[a(p.Item,{onSelect:()=>{n.type==="http"&&ce(n)},get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.edit")}})}}),a($,{get when(){return w(()=>!!g())()&&m()!==v},get children(){return a(p.Item,{onSelect:()=>x(v),get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.default")}})}})}}),a($,{get when(){return w(()=>!!g())()&&m()===v},get children(){return a(p.Item,{onSelect:()=>x(null),get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.defaultRemove")}})}})}}),a(p.Separator,{}),a(p.Item,{onSelect:()=>ve(h.key(n)),class:"text-text-on-critical-base hover:bg-surface-critical-weak",get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.delete")}})}})]}})}})]}})}}),null),c})()}})}}),t),S(t,a($,{get when(){return L()},get fallback(){return a(O,{variant:"secondary",icon:"plus-small",size:"large",onClick:ue,class:"py-1.5 pl-1.5 pr-3 flex items-center gap-1.5",get children(){return s.t("dialog.server.add.button")}})},get children(){return a(O,{variant:"primary",size:"large",onClick:W,get disabled(){return U()},class:"px-3 py-1.5",get children(){return w(()=>!!U())()?s.t("dialog.server.add.checking"):w(()=>!!f())()?s.t("dialog.server.add.button"):s.t("common.save")}})}})),e}})}export{Ke as DialogSelectServer};
@@ -0,0 +1 @@
1
+ import{i as n,t as g,bY as ke,f as Q,aT as Ce,b as ge,G as Se,bA as pe,x as fe,n as he,g as A,af as Pe,h as r,aB as Te,am as Ee,I as G,a2 as z,m as B,bE as te,cx as Ae,cy as ze,cz as De,bZ as Fe,z as ne,B as V,cA as Ke,cB as je,cC as Le,ao as N,cD as Oe,ad as Ie,s as Me,a8 as me,F as Y,aG as Ne,j as We,k as Ge,b_ as Be,E as Re,cE as Ue,aE as Ve,c as qe,bz as Ye,u as He,aI as Ze,aZ as re,cF as Je,aY as Qe}from"./index-CIniE1sM.js";import{S as U,T as j}from"./select-CsoVU8kZ.js";import{S as O}from"./switch-BZ-0S1HQ.js";import{L as Xe,D as et}from"./dialog-connect-provider-CRQUO9He.js";import{f as tt,u as rt}from"./list-Bd_lG005.js";import{P as ee,T as X}from"./provider-icon-DzvEuHl8.js";import{D as nt,a as st}from"./dialog-select-provider-CKvDgZkl.js";var it=g('<div class="bg-surface-base px-4 rounded-lg">');const I=t=>(()=>{var e=it();return n(e,()=>t.children),e})();var lt=g("<div data-action=settings-auto-accept-permissions>"),at=g("<div data-action=settings-feed-reasoning-summaries>"),ot=g("<div data-action=settings-feed-shell-tool-parts-expanded>"),ct=g("<div data-action=settings-feed-edit-tool-parts-expanded>"),dt=g('<div class="flex flex-col gap-1">'),de=g('<div class="w-full sm:w-[220px]">'),Z=g('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ut=g("<div data-action=settings-notifications-agent>"),gt=g("<div data-action=settings-notifications-permissions>"),pt=g("<div data-action=settings-notifications-errors>"),ft=g("<div data-action=settings-updates-startup>"),ht=g("<div data-action=settings-release-notes>"),mt=g('<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">'),vt=g("<div data-action=settings-wayland>"),xt=g("<span class=text-text-weak>"),bt=g('<div class="flex items-center gap-2"><span>'),_t=g('<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 ve=()=>{M.run+=1,M.cleanup&&M.cleanup(),clearTimeout(M.timeout),M.cleanup=void 0},ue=t=>{if(ve(),!t)return;const e=++M.run;M.timeout=setTimeout(()=>{Oe(t).then(a=>{if(M.run!==e){a?.();return}M.cleanup=a})},100)},$t=()=>{const t=ke(),e=Q(),a=Ce(),s=ge(),d=Se(),l=pe();fe(()=>{t.loadThemes()});const[y,b]=he({checking:!1}),m=A(()=>s.platform==="desktop"&&s.os==="linux"),k=A(()=>Pe(d.dir)),T=A(()=>{const c=k();return c?d.id?a.isAutoAccepting(d.id,c):a.isAutoAcceptingDirectory(c):!1}),D=c=>{const o=k();if(o){if(!d.id){if(a.isAutoAcceptingDirectory(o)===c)return;a.toggleAutoAcceptDirectory(o);return}if(c){a.enableAutoAccept(d.id,o);return}a.disableAutoAccept(d.id,o)}},W=()=>{s.checkUpdate&&(b("checking",!0),s.checkUpdate().then(c=>{if(!c.updateAvailable){N({variant:"success",icon:"circle-check",title:e.t("settings.updates.toast.latest.title"),description:e.t("settings.updates.toast.latest.description",{version:s.version??""})});return}const o=s.update&&s.restart?[{label:e.t("toast.update.action.installRestart"),onClick:async()=>{await s.update(),await s.restart()}},{label:e.t("toast.update.action.notYet"),onClick:"dismiss"}]:[{label:e.t("toast.update.action.notYet"),onClick:"dismiss"}];N({persistent:!0,icon:"download",title:e.t("toast.update.title"),description:e.t("toast.update.description",{version:c.version??""}),actions:o})}).catch(c=>{const o=c instanceof Error?c.message:String(c);N({title:e.t("common.requestFailed"),description:o})}).finally(()=>b("checking",!1)))},F=A(()=>t.ids().map(c=>({id:c,name:t.name(c)}))),p=A(()=>[{value:"system",label:e.t("theme.scheme.system")},{value:"light",label:e.t("theme.scheme.light")},{value:"dark",label:e.t("theme.scheme.dark")}]),u=A(()=>e.locales.map(c=>({value:c,label:e.label(c)}))),x={id:"none",label:"sound.option.none"},f=[x,...Le],P=()=>je(l.appearance.font()),K=()=>Ke(l.appearance.uiFont()),L=(c,o,i,$)=>({options:f,current:c()?f.find(v=>v.id===o())??x:x,value:v=>v.id,label:v=>e.t(v.label),onHighlight:v=>{v&&ue(v.id==="none"?void 0:v.id)},onSelect:v=>{if(v){if(v.id==="none"){i(!1),ve();return}i(!0),$(v.id),ue(v.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),C=()=>(()=>{var c=dt();return n(c,r(I,{get children(){return[r(S,{get title(){return e.t("settings.general.row.language.title")},get description(){return e.t("settings.general.row.language.description")},get children(){return r(U,{"data-action":"settings-language",get options(){return u()},get current(){return u().find(o=>o.value===e.locale())},value:o=>o.value,label:o=>o.label,onSelect:o=>o&&e.setLocale(o.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),r(S,{get title(){return e.t("command.permissions.autoaccept.enable")},get description(){return e.t("toast.permissions.autoaccept.on.description")},get children(){var o=lt();return n(o,r(O,{get checked(){return T()},get disabled(){return!k()},onChange:D})),o}}),r(S,{get title(){return e.t("settings.general.row.reasoningSummaries.title")},get description(){return e.t("settings.general.row.reasoningSummaries.description")},get children(){var o=at();return n(o,r(O,{get checked(){return l.general.showReasoningSummaries()},onChange:i=>l.general.setShowReasoningSummaries(i)})),o}}),r(S,{get title(){return e.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return e.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var o=ot();return n(o,r(O,{get checked(){return l.general.shellToolPartsExpanded()},onChange:i=>l.general.setShellToolPartsExpanded(i)})),o}}),r(S,{get title(){return e.t("settings.general.row.editToolPartsExpanded.title")},get description(){return e.t("settings.general.row.editToolPartsExpanded.description")},get children(){var o=ct();return n(o,r(O,{get checked(){return l.general.editToolPartsExpanded()},onChange:i=>l.general.setEditToolPartsExpanded(i)})),o}})]}})),c})(),E=()=>(()=>{var c=Z(),o=c.firstChild;return n(o,()=>e.t("settings.general.section.appearance")),n(c,r(I,{get children(){return[r(S,{get title(){return e.t("settings.general.row.colorScheme.title")},get description(){return e.t("settings.general.row.colorScheme.description")},get children(){return r(U,{"data-action":"settings-color-scheme",get options(){return p()},get current(){return p().find(i=>i.value===t.colorScheme())},value:i=>i.value,label:i=>i.label,onSelect:i=>i&&t.setColorScheme(i.value),onHighlight:i=>{if(i)return t.previewColorScheme(i.value),()=>t.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),r(S,{get title(){return e.t("settings.general.row.theme.title")},get description(){return[B(()=>e.t("settings.general.row.theme.description"))," ",r(Xe,{href:"https://duckmind.ai/docs/themes/",get children(){return e.t("common.learnMore")}})]},get children(){return r(U,{"data-action":"settings-theme",get options(){return F()},get current(){return F().find(i=>i.id===t.themeId())},value:i=>i.id,label:i=>i.name,onSelect:i=>{i&&t.setTheme(i.id)},onHighlight:i=>{if(i)return t.previewTheme(i.id),()=>t.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings"})}}),r(S,{get title(){return e.t("settings.general.row.uiFont.title")},get description(){return e.t("settings.general.row.uiFont.description")},get children(){var i=de();return n(i,r(te,{"data-action":"settings-ui-font",get label(){return e.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return K()},onChange:$=>l.appearance.setUIFont($),placeholder:Ae,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":ze(l.appearance.uiFont())}}})),i}}),r(S,{get title(){return e.t("settings.general.row.font.title")},get description(){return e.t("settings.general.row.font.description")},get children(){var i=de();return n(i,r(te,{"data-action":"settings-code-font",get label(){return e.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return P()},onChange:$=>l.appearance.setFont($),placeholder:De,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Fe(l.appearance.font())}}})),i}})]}}),null),c})(),h=()=>(()=>{var c=Z(),o=c.firstChild;return n(o,()=>e.t("settings.general.section.notifications")),n(c,r(I,{get children(){return[r(S,{get title(){return e.t("settings.general.notifications.agent.title")},get description(){return e.t("settings.general.notifications.agent.description")},get children(){var i=ut();return n(i,r(O,{get checked(){return l.notifications.agent()},onChange:$=>l.notifications.setAgent($)})),i}}),r(S,{get title(){return e.t("settings.general.notifications.permissions.title")},get description(){return e.t("settings.general.notifications.permissions.description")},get children(){var i=gt();return n(i,r(O,{get checked(){return l.notifications.permissions()},onChange:$=>l.notifications.setPermissions($)})),i}}),r(S,{get title(){return e.t("settings.general.notifications.errors.title")},get description(){return e.t("settings.general.notifications.errors.description")},get children(){var i=pt();return n(i,r(O,{get checked(){return l.notifications.errors()},onChange:$=>l.notifications.setErrors($)})),i}})]}}),null),c})(),w=()=>(()=>{var c=Z(),o=c.firstChild;return n(o,()=>e.t("settings.general.section.sounds")),n(c,r(I,{get children(){return[r(S,{get title(){return e.t("settings.general.sounds.agent.title")},get description(){return e.t("settings.general.sounds.agent.description")},get children(){return r(U,ne({"data-action":"settings-sounds-agent"},()=>L(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),i=>l.sounds.setAgentEnabled(i),i=>l.sounds.setAgent(i))))}}),r(S,{get title(){return e.t("settings.general.sounds.permissions.title")},get description(){return e.t("settings.general.sounds.permissions.description")},get children(){return r(U,ne({"data-action":"settings-sounds-permissions"},()=>L(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),i=>l.sounds.setPermissionsEnabled(i),i=>l.sounds.setPermissions(i))))}}),r(S,{get title(){return e.t("settings.general.sounds.errors.title")},get description(){return e.t("settings.general.sounds.errors.description")},get children(){return r(U,ne({"data-action":"settings-sounds-errors"},()=>L(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),i=>l.sounds.setErrorsEnabled(i),i=>l.sounds.setErrors(i))))}})]}}),null),c})(),_=()=>(()=>{var c=Z(),o=c.firstChild;return n(o,()=>e.t("settings.general.section.updates")),n(c,r(I,{get children(){return[r(S,{get title(){return e.t("settings.updates.row.startup.title")},get description(){return e.t("settings.updates.row.startup.description")},get children(){var i=ft();return n(i,r(O,{get checked(){return l.updates.startup()},get disabled(){return!s.checkUpdate},onChange:$=>l.updates.setStartup($)})),i}}),r(S,{get title(){return e.t("settings.general.row.releaseNotes.title")},get description(){return e.t("settings.general.row.releaseNotes.description")},get children(){var i=ht();return n(i,r(O,{get checked(){return l.general.releaseNotes()},onChange:$=>l.general.setReleaseNotes($)})),i}}),r(S,{get title(){return e.t("settings.updates.row.check.title")},get description(){return e.t("settings.updates.row.check.description")},get children(){return r(V,{size:"small",variant:"secondary",get disabled(){return y.checking||!s.checkUpdate},onClick:W,get children(){return B(()=>!!y.checking)()?e.t("settings.updates.action.checking"):e.t("settings.updates.action.checkNow")}})}})]}}),null),c})();return(()=>{var c=mt(),o=c.firstChild,i=o.firstChild,$=i.firstChild,v=o.nextSibling;return n($,()=>e.t("settings.tab.general")),n(v,r(C,{}),null),n(v,r(E,{}),null),n(v,r(h,{}),null),n(v,r(w,{}),null),n(v,r(_,{}),null),n(v,r(z,{get when(){return m()},children:ae=>{const[oe,be]=Te(()=>s.getDisplayBackend?.()),_e=()=>oe.state==="pending"?void 0:oe.latest,$e=H=>s.setDisplayBackend?.(H?"wayland":"auto").finally(()=>be.refetch());return(()=>{var H=Z(),ye=H.firstChild;return n(ye,()=>e.t("settings.general.section.display")),n(H,r(I,{get children(){return r(S,{get title(){return(()=>{var R=bt(),we=R.firstChild;return n(we,()=>e.t("settings.general.row.wayland.title")),n(R,r(Ee,{get value(){return e.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var ce=xt();return n(ce,r(G,{name:"help",size:"small"})),ce}}),null),R})()},get description(){return e.t("settings.general.row.wayland.description")},get children(){var R=vt();return n(R,r(O,{get checked(){return _e()==="wayland"},onChange:$e})),R}})}}),null),H})()}}),null),c})()},S=t=>(()=>{var e=_t(),a=e.firstChild,s=a.firstChild,d=s.nextSibling,l=a.nextSibling;return n(s,()=>t.title),n(d,()=>t.description),n(l,()=>t.children),e})();var yt=g('<span class="text-14-regular text-text-strong mt-1">"<!>"'),wt=g('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),kt=g('<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]">'),Ct=g('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),St=g('<div class="flex items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><span class="text-14-regular text-text-strong"></span><button type=button>');const se=typeof navigator=="object"&&/(Mac|iPod|iPhone|iPad)/.test(navigator.platform),q="command.palette",Pt="mod+shift+p",J=["General","Session","Navigation","Model and agent","Terminal","Prompt"],Tt={General:"settings.shortcuts.group.general",Session:"settings.shortcuts.group.session",Navigation:"settings.shortcuts.group.navigation","Model and agent":"settings.shortcuts.group.modelAndAgent",Terminal:"settings.shortcuts.group.terminal",Prompt:"settings.shortcuts.group.prompt"};function ie(t){return t===q?"General":t.startsWith("terminal.")?"Terminal":t.startsWith("model.")||t.startsWith("agent.")||t.startsWith("mcp.")?"Model and agent":t.startsWith("file.")||t.startsWith("fileTree.")?"Navigation":t.startsWith("prompt.")?"Prompt":t.startsWith("session.")||t.startsWith("message.")||t.startsWith("permissions.")||t.startsWith("steps.")||t.startsWith("review.")?"Session":"General"}function Et(t){return t==="Shift"||t==="Control"||t==="Alt"||t==="Meta"}function At(t){return t===","?"comma":t==="+"?"plus":t===" "?"space":t.toLowerCase()}function zt(t){if(Et(t.key))return;const e=[];(se?t.metaKey:t.ctrlKey)&&e.push("mod"),se&&t.ctrlKey&&e.push("ctrl"),!se&&t.metaKey&&e.push("meta"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift");const s=At(t.key);if(s)return e.push(s),e.join("+")}function le(t){if(!t)return[];const e=[];for(const a of Be(t)){const s=[];a.ctrl&&s.push("ctrl"),a.alt&&s.push("alt"),a.shift&&s.push("shift"),a.meta&&s.push("meta"),a.key&&s.push(a.key),s.length!==0&&e.push(s.join("+"))}return e}function Dt(t){return!t||typeof t!="object"||Array.isArray(t)?{}:t}function Ft(t,e,a){const s=new Map;s.set(q,{title:a,group:"General"});for(const d of t.catalog)d.id.startsWith("suggested.")||s.set(d.id,{title:d.title,group:ie(d.id)});for(const d of t.options)d.id.startsWith("suggested.")||s.set(d.id,{title:d.title,group:ie(d.id)});for(const[d,l]of Object.entries(e))typeof l=="string"&&(s.has(d)||s.set(d,{title:d,group:ie(d)}));return s}function Kt(t){const e=new Map;for(const a of J)e.set(a,[]);for(const[a,s]of t){const d=e.get(s.group);d&&d.push(a)}for(const a of J){const s=e.get(a);s&&s.sort((d,l)=>(t.get(d)?.title??"").localeCompare(t.get(l)?.title??""))}return e}function jt(t,e,a,s){const d=t.toLowerCase().trim();if(!d)return a;const l=new Map;for(const m of J)l.set(m,[]);const y=Array.from(e.entries()).map(([m,k])=>({id:m,title:k.title,group:k.group,keybind:s(m)})),b=tt.go(d,y,{keys:["title","keybind"],threshold:-1e4});for(const m of b){const k=l.get(m.obj.group);k&&k.push(m.obj.id)}return l}function Lt(t){fe(()=>{Re(document,"keydown",a=>{const s=t.active();if(!s)return;if(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation(),a.key==="Escape"){t.stop();return}if((a.key==="Backspace"||a.key==="Delete")&&!a.ctrlKey&&!a.metaKey&&!a.altKey&&!a.shiftKey){t.set(s,"none"),t.stop();return}const l=zt(a);if(!l)return;const y=new Map;for(const b of le(l))for(const m of t.used().get(b)??[])m.id!==s&&y.set(m.id,m.title);if(y.size>0){N({title:t.language.t("settings.shortcuts.conflict.title"),description:t.language.t("settings.shortcuts.conflict.description",{keybind:Ue(l,t.language.t),titles:[...y.values()].join(", ")})});return}t.set(s,l),t.stop()},{capture:!0})})}const Ot=()=>{const t=Ie(),e=Q(),a=pe(),[s,d]=he({active:null,filter:""}),l=()=>{s.active&&(d("active",null),t.keybinds(!0))},y=f=>{if(s.active===f){l();return}s.active&&l(),d("active",f),t.keybinds(!1)},b=A(()=>Dt(a.current.keybinds)),m=A(()=>Object.values(b()).some(f=>typeof f=="string")),k=()=>{l(),a.keybinds.resetAll(),N({title:e.t("settings.shortcuts.reset.toast.title"),description:e.t("settings.shortcuts.reset.toast.description")})},T=A(()=>(e.locale(),Ft(t,b(),e.t("command.palette")))),D=f=>T().get(f)?.title??"",W=A(()=>Kt(T())),F=A(()=>jt(s.filter,T(),W(),f=>t.keybind(f)||"")),p=A(()=>{for(const f of J)if((F().get(f)??[]).length>0)return!0;return!1}),u=A(()=>{const f=new Map,P=(C,E)=>{const h=f.get(C);if(!h){f.set(C,[E]);return}h.push(E)},K=a.keybinds.get(q)??Pt;for(const C of le(K))P(C,{id:q,title:D(q)});const L=C=>{const E=a.keybinds.get(C);if(typeof E=="string")return E;const h=t.options.find(_=>_.id===C);return h?.keybind?h.keybind:t.catalog.find(_=>_.id===C)?.keybind};for(const C of T().keys())if(C!==q)for(const E of le(L(C)))P(E,{id:C,title:D(C)});return f});return Lt({active:()=>s.active,stop:l,set:(f,P)=>a.keybinds.set(f,P),used:u,language:e}),Me(()=>{s.active&&t.keybinds(!0)}),(()=>{var f=kt(),P=f.firstChild,K=P.firstChild,L=K.firstChild,C=L.firstChild,E=L.nextSibling,h=P.nextSibling;return n(C,()=>e.t("settings.shortcuts.title")),n(L,r(V,{size:"small",variant:"secondary",onClick:k,get disabled(){return!m()},get children(){return e.t("settings.shortcuts.reset.button")}}),null),n(E,r(G,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),n(E,r(te,{variant:"ghost",type:"text",get value(){return s.filter},onChange:w=>d("filter",w),get placeholder(){return e.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),n(E,r(z,{get when(){return s.filter},get children(){return r(me,{icon:"circle-x",variant:"ghost",onClick:()=>d("filter","")})}}),null),n(h,r(Y,{each:J,children:w=>r(z,{get when(){return(F().get(w)??[]).length>0},get children(){var _=Ct(),c=_.firstChild;return n(c,()=>e.t(Tt[w])),n(_,r(I,{get children(){return r(Y,{get each(){return F().get(w)??[]},children:o=>(()=>{var i=St(),$=i.firstChild,v=$.nextSibling;return n($,()=>D(o)),v.$$click=()=>y(o),Ne(v,"data-keybind-id",o),n(v,r(z,{get when(){return s.active===o},get fallback(){return t.keybind(o)||e.t("settings.shortcuts.unassigned")},get children(){return e.t("settings.shortcuts.pressKeys")}})),We(ae=>Ge(v,{"h-8 px-3 rounded-md text-12-regular":!0,"bg-surface-base text-text-subtle hover:bg-surface-raised-base-hover active:bg-surface-raised-base-active":s.active!==o,"border border-border-weak-base bg-surface-inset-base text-text-weak":s.active===o},ae)),i})()})}}),null),_}})}),null),n(h,r(z,{get when(){return B(()=>!!s.filter)()&&!p()},get children(){var w=wt(),_=w.firstChild;return n(_,()=>e.t("settings.shortcuts.search.empty")),n(w,r(z,{get when(){return s.filter},get children(){var c=yt(),o=c.firstChild,i=o.nextSibling;return i.nextSibling,n(c,()=>s.filter,i),c}}),null),w}}),null),f})()};Ve(["click"]);var It=g('<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">'),Mt=g('<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 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">'),Nt=g('<div class="py-4 text-14-regular text-text-weak">'),Wt=g('<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">'),Gt=g('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Bt=g('<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">'),Rt=g('<span class="text-12-regular text-text-weak pl-8">');const Ut=[{match:t=>t==="duckmind",key:"dialog.provider.duckmind.note"},{match:t=>t==="duckmind-go",key:"dialog.provider.duckmindGo.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"}],Vt=()=>{const t=qe(),e=Q(),a=Ye(),s=He(),d=Ze(),l=A(()=>d.connected().filter(p=>p.id!=="duckmind"||Object.values(p.models).find(u=>u.cost?.input))),y=A(()=>{const p=new Set(l().map(x=>x.id)),u=d.popular().filter(x=>!p.has(x.id)).slice();return u.sort((x,f)=>re.indexOf(x.id)-re.indexOf(f.id)),u}),b=p=>{if(!("source"in p))return;const u=p.source;if(u==="env"||u==="api"||u==="config"||u==="custom")return u},m=p=>{const u=b(p);return u==="env"?e.t("settings.providers.tag.environment"):u==="api"?e.t("provider.connect.method.apiKey"):u==="config"?D(p.id)?e.t("settings.providers.tag.custom"):e.t("settings.providers.tag.config"):u==="custom"?e.t("settings.providers.tag.custom"):e.t("settings.providers.tag.other")},k=p=>b(p)!=="env",T=p=>Ut.find(u=>u.match(p))?.key,D=p=>{const u=s.data.config.provider?.[p];return!(!u||u.npm!=="@ai-sdk/openai-compatible"||!u.models||Object.keys(u.models).length===0)},W=async(p,u)=>{const x=s.data.config.disabled_providers??[],f=x.includes(p)?x:[...x,p];s.set("config","disabled_providers",f),await s.updateConfig({disabled_providers:f}).then(()=>{N({variant:"success",icon:"circle-check",title:e.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:e.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(P=>{s.set("config","disabled_providers",x);const K=P instanceof Error?P.message:String(P);N({title:e.t("common.requestFailed"),description:K})})},F=async(p,u)=>{if(D(p)){await a.client.auth.remove({providerID:p}).catch(()=>{}),await W(p,u);return}await a.client.auth.remove({providerID:p}).then(async()=>{await a.client.global.dispose(),N({variant:"success",icon:"circle-check",title:e.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:e.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(x=>{const f=x instanceof Error?x.message:String(x);N({title:e.t("common.requestFailed"),description:f})})};return(()=>{var p=Mt(),u=p.firstChild,x=u.firstChild,f=x.firstChild,P=u.nextSibling,K=P.firstChild,L=K.firstChild,C=K.nextSibling,E=C.firstChild;return n(f,()=>e.t("settings.providers.title")),n(L,()=>e.t("settings.providers.section.connected")),n(K,r(I,{get children(){return r(z,{get when(){return l().length>0},get fallback(){return(()=>{var h=Nt();return n(h,()=>e.t("settings.providers.connected.empty")),h})()},get children(){return r(Y,{get each(){return l()},children:h=>(()=>{var w=Wt(),_=w.firstChild,c=_.firstChild;return n(_,r(ee,{get id(){return h.id},class:"size-5 shrink-0 icon-strong-base"}),c),n(c,()=>h.name),n(_,r(X,{get children(){return m(h)}}),null),n(w,r(z,{get when(){return k(h)},get fallback(){return(()=>{var o=Gt();return n(o,()=>e.t("settings.providers.connected.environmentDescription")),o})()},get children(){return r(V,{size:"large",variant:"ghost",onClick:()=>void F(h.id,h.name),get children(){return e.t("common.disconnect")}})}}),null),w})()})}})}}),null),n(E,()=>e.t("settings.providers.section.popular")),n(C,r(I,{get children(){return[r(Y,{get each(){return y()},children:h=>(()=>{var w=Bt(),_=w.firstChild,c=_.firstChild,o=c.firstChild;return n(c,r(ee,{get id(){return h.id},class:"size-5 shrink-0 icon-strong-base"}),o),n(o,()=>h.name),n(c,r(z,{get when(){return h.id==="duckmind"},get children(){return r(X,{get children(){return e.t("dialog.provider.tag.recommended")}})}}),null),n(c,r(z,{get when(){return h.id==="duckmind-go"},get children(){return r(X,{get children(){return e.t("dialog.provider.tag.recommended")}})}}),null),n(_,r(z,{get when(){return T(h.id)},children:i=>(()=>{var $=Rt();return n($,()=>e.t(i())),$})()}),null),n(w,r(V,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>r(et,{get provider(){return h.id}}))},get children(){return e.t("common.connect")}}),null),w})()}),(()=>{var h=It(),w=h.firstChild,_=w.firstChild,c=_.firstChild,o=_.nextSibling;return n(_,r(ee,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),c),n(c,()=>e.t("provider.custom.title")),n(_,r(X,{get children(){return e.t("settings.providers.tag.custom")}}),null),n(o,()=>e.t("settings.providers.custom.description")),n(h,r(V,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>r(nt,{back:"close"}))},get children(){return e.t("common.connect")}}),null),h})()]}}),null),n(C,r(V,{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:()=>{t.show(()=>r(st,{}))},get children(){return e.t("dialog.provider.viewAll")}}),null),p})()};var xe=g('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),qt=g('<span class="text-14-regular text-text-strong mt-1">&quot;<!>&quot;'),Yt=g('<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]"><h2 class="text-16-medium text-text-strong"></h2><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]">'),Ht=g('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),Zt=g('<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 Jt=t=>(()=>{var e=xe(),a=e.firstChild;return n(a,()=>t.label),e})(),Qt=t=>(()=>{var e=xe(),a=e.firstChild;return n(a,()=>t.message),n(e,r(z,{get when(){return t.filter},get children(){var s=qt(),d=s.firstChild,l=d.nextSibling;return l.nextSibling,n(s,()=>t.filter,l),s}}),null),e})(),Xt=()=>{const t=Q(),e=Je(),a=rt({items:s=>e.list(),key:s=>`${s.provider.id}:${s.id}`,filterKeys:["provider.name","name","id"],sortBy:(s,d)=>s.name.localeCompare(d.name),groupBy:s=>s.provider.id,sortGroupsBy:(s,d)=>{const l=re.indexOf(s.category),y=re.indexOf(d.category),b=l>=0,m=y>=0;if(b&&!m)return-1;if(!b&&m)return 1;if(b&&m)return l-y;const k=s.items[0].provider.name,T=d.items[0].provider.name;return k.localeCompare(T)}});return(()=>{var s=Yt(),d=s.firstChild,l=d.firstChild,y=l.firstChild,b=y.nextSibling,m=d.nextSibling;return n(y,()=>t.t("settings.models.title")),n(b,r(G,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),n(b,r(te,{variant:"ghost",type:"text",get value(){return a.filter()},get onChange(){return a.onInput},get placeholder(){return t.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),n(b,r(z,{get when(){return a.filter()},get children(){return r(me,{icon:"circle-x",variant:"ghost",get onClick(){return a.clear}})}}),null),n(m,r(z,{get when(){return!a.grouped.loading},get fallback(){return r(Jt,{get label(){return`${t.t("common.loading")}${t.t("common.loading.ellipsis")}`}})},get children(){return r(z,{get when(){return a.flat().length>0},get fallback(){return r(Qt,{get message(){return t.t("dialog.model.empty")},get filter(){return a.filter()}})},get children(){return r(Y,{get each(){return a.grouped.latest},children:k=>(()=>{var T=Ht(),D=T.firstChild,W=D.firstChild;return n(D,r(ee,{get id(){return k.category},class:"size-5 shrink-0 icon-strong-base"}),W),n(W,()=>k.items[0].provider.name),n(T,r(I,{get children(){return r(Y,{get each(){return k.items},children:F=>{const p={providerID:F.provider.id,modelID:F.id};return(()=>{var u=Zt(),x=u.firstChild,f=x.firstChild,P=x.nextSibling;return n(f,()=>F.name),n(P,r(O,{get checked(){return e.visible(p)},onChange:K=>{e.setVisibility(p,K)},hideLabel:!0,get children(){return F.name}})),u})()}})}}),null),T})()})}})}})),s})()};var er=g('<div class="flex flex-col justify-between h-full w-full"><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 or=()=>{const t=Q(),e=ge();return r(Qe,{size:"x-large",transition:!0,get children(){return r(j,{orientation:"vertical",variant:"settings",defaultValue:"general",class:"h-full settings-dialog",get children(){return[r(j.List,{get children(){var a=er(),s=a.firstChild,d=s.firstChild,l=d.firstChild,y=l.firstChild,b=l.nextSibling,m=b.firstChild,k=s.nextSibling,T=k.firstChild,D=T.nextSibling;return D.firstChild,n(l,r(j.SectionTitle,{get children(){return t.t("settings.section.desktop")}}),y),n(y,r(j.Trigger,{value:"general",get children(){return[r(G,{name:"sliders"}),B(()=>t.t("settings.tab.general"))]}}),null),n(y,r(j.Trigger,{value:"shortcuts",get children(){return[r(G,{name:"keyboard"}),B(()=>t.t("settings.tab.shortcuts"))]}}),null),n(b,r(j.SectionTitle,{get children(){return t.t("settings.section.server")}}),m),n(m,r(j.Trigger,{value:"providers",get children(){return[r(G,{name:"providers"}),B(()=>t.t("settings.providers.title"))]}}),null),n(m,r(j.Trigger,{value:"models",get children(){return[r(G,{name:"models"}),B(()=>t.t("settings.models.title"))]}}),null),n(T,()=>t.t("app.name.desktop")),n(D,()=>e.version,null),a}}),r(j.Content,{value:"general",class:"no-scrollbar",get children(){return r($t,{})}}),r(j.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return r(Ot,{})}}),r(j.Content,{value:"providers",class:"no-scrollbar",get children(){return r(Vt,{})}}),r(j.Content,{value:"models",class:"no-scrollbar",get children(){return r(Xt,{})}})]}})}})};export{or as DialogSettings};
@@ -0,0 +1 @@
1
+ import{v as m,g,H as f,y as b,z as j,i as k,h as y,aG as d,j as p,a2 as v,t as c}from"./index-CIniE1sM.js";const F="/assets/sprite-Fb-TFjRY.svg";var h=c("<svg><defs><mask mask-type=alpha><use></svg>",!1,!0,!1),x=c("<svg><rect width=100% height=100% fill=currentColor></svg>",!1,!0,!1),C=c("<svg data-component=file-icon>"),T=c("<svg><use></svg>",!1,!0,!1);const N=o=>{const[e,i]=m(o,["node","class","classList","expanded","mono"]),a=g(()=>I(e.node.path,e.node.type,e.expanded||!1)),s=`file-icon-mono-${f()}`;return(()=>{var l=C();return b(l,j(i,{get classList(){return{...e.classList??{},[e.class??""]:!!e.class}}}),!0,!0),k(l,y(v,{get when(){return e.mono},get fallback(){return(()=>{var r=T();return p(()=>d(r,"href",`${F}#${a()}`)),r})()},get children(){return[(()=>{var r=h(),t=r.firstChild,u=t.firstChild;return d(t,"id",s),p(()=>d(u,"href",`${F}#${a()}`)),r})(),(()=>{var r=x();return d(r,"mask",`url(#${s})`),r})()]}})),l})()},n={fileNames:{"readme.md":"Readme","changelog.md":"Changelog","contributing.md":"Contributing","conduct.md":"Conduct",license:"Certificate",authors:"Authors",credits:"Credits",install:"Installation","package.json":"Nodejs","package-lock.json":"Nodejs","yarn.lock":"Yarn","pnpm-lock.yaml":"Pnpm","bun.lock":"Bun","bun.lockb":"Bun","bunfig.toml":"Bun",".nvmrc":"Nodejs",".node-version":"Nodejs",dockerfile:"Docker","docker-compose.yml":"Docker","docker-compose.yaml":"Docker",".dockerignore":"Docker","jest.config.js":"Jest","jest.config.ts":"Jest","jest.config.mjs":"Jest","vitest.config.js":"Vitest","vitest.config.ts":"Vitest","tailwind.config.js":"Tailwindcss","tailwind.config.ts":"Tailwindcss","turbo.json":"Turborepo","tsconfig.json":"Tsconfig","jsconfig.json":"Jsconfig",".eslintrc":"Eslint",".eslintrc.js":"Eslint",".eslintrc.json":"Eslint",".prettierrc":"Prettier",".prettierrc.js":"Prettier",".prettierrc.json":"Prettier","vite.config.js":"Vite","vite.config.ts":"Vite","webpack.config.js":"Webpack","rollup.config.js":"Rollup","astro.config.mjs":"AstroConfig","astro.config.js":"AstroConfig","next.config.js":"Next","next.config.mjs":"Next","nuxt.config.js":"Nuxt","nuxt.config.ts":"Nuxt","svelte.config.js":"Svelte","gatsby-config.js":"Gatsby","remix.config.js":"Remix","prisma.schema":"Prisma",".gitignore":"Git",".gitattributes":"Git",makefile:"Makefile",cmake:"Cmake","cargo.toml":"Rust","go.mod":"GoMod","go.sum":"GoMod","requirements.txt":"Python","pyproject.toml":"Python",pipfile:"Python","poetry.lock":"Poetry",gemfile:"Gemfile",rakefile:"Ruby","composer.json":"Php","build.gradle":"Gradle","pom.xml":"Maven","deno.json":"Deno","deno.jsonc":"Deno","vercel.json":"Vercel","netlify.toml":"Netlify",".env":"Tune",".env.local":"Tune",".env.development":"Tune",".env.production":"Tune",".env.example":"Tune",".editorconfig":"Editorconfig","robots.txt":"Robots","favicon.ico":"Favicon",browserlist:"Browserlist",".babelrc":"Babel","babel.config.js":"Babel","gulpfile.js":"Gulp","gruntfile.js":"Grunt","capacitor.config.json":"Capacitor","ionic.config.json":"Ionic","angular.json":"Angular",".storybook":"Storybook","storybook.config.js":"Storybook","cypress.config.js":"Cypress","playwright.config.js":"Playwright","puppeteer.config.js":"Puppeteer","wrangler.toml":"Wrangler","firebase.json":"Firebase",supabase:"Supabase",terraform:"Terraform",kubernetes:"Kubernetes",".gitpod.yml":"Gitpod",".devcontainer":"Vscode","travis.yml":"Travis","appveyor.yml":"Appveyor",".circleci":"Circleci","renovate.json":"Renovate","dependabot.yml":"Dependabot","lerna.json":"Lerna","nx.json":"Nx"},fileExtensions:{"spec.ts":"TestTs","test.ts":"TestTs","spec.tsx":"TestJsx","test.tsx":"TestJsx","spec.js":"TestJs","test.js":"TestJs","spec.jsx":"TestJsx","test.jsx":"TestJsx","js.map":"JavascriptMap","d.ts":"TypescriptDef",ts:"Typescript",tsx:"React_ts",js:"Javascript",jsx:"React",mjs:"Javascript",cjs:"Javascript",html:"Html",htm:"Html",css:"Css",scss:"Sass",sass:"Sass",less:"Less",styl:"Stylus",json:"Json",xml:"Xml",yml:"Yaml",yaml:"Yaml",toml:"Toml",hjson:"Hjson",md:"Markdown",mdx:"Mdx",tex:"Tex",py:"Python",pyx:"Python",pyw:"Python",rs:"Rust",go:"Go",java:"Java",kt:"Kotlin",scala:"Scala",php:"Php",rb:"Ruby",cs:"Csharp",vb:"Visualstudio",cpp:"Cpp",cc:"Cpp",cxx:"Cpp",c:"C",h:"H",hpp:"Hpp",swift:"Swift",m:"ObjectiveC",mm:"ObjectiveCpp",dart:"Dart",lua:"Lua",pl:"Perl",r:"R",jl:"Julia",hs:"Haskell",elm:"Elm",ml:"Ocaml",clj:"Clojure",cljs:"Clojure",erl:"Erlang",ex:"Elixir",exs:"Elixir",nim:"Nim",zig:"Zig",v:"Vlang",odin:"Odin",gleam:"Gleam",grain:"Grain",roc:"Rocket",fs:"Fsharp",sh:"Console",bash:"Console",zsh:"Console",fish:"Console",ps1:"Powershell",cfg:"Settings",ini:"Settings",conf:"Settings",properties:"Settings",svg:"Svg",png:"Image",jpg:"Image",jpeg:"Image",gif:"Image",webp:"Image",bmp:"Image",ico:"Favicon",mp4:"Video",mov:"Video",avi:"Video",webm:"Video",mp3:"Audio",wav:"Audio",flac:"Audio",zip:"Zip",tar:"Zip",gz:"Zip",rar:"Zip","7z":"Zip",pdf:"Pdf",doc:"Word",docx:"Word",ppt:"Powerpoint",pptx:"Powerpoint",xls:"Document",xlsx:"Document",sql:"Database",db:"Database",sqlite:"Database",env:"Tune",log:"Log",lock:"Lock",key:"Key",pem:"Certificate",crt:"Certificate",proto:"Proto",graphql:"Graphql",gql:"Graphql",wasm:"Webassembly",dockerfile:"Docker"},folderNames:{src:"FolderSrc",source:"FolderSrc",lib:"FolderLib",libs:"FolderLib",test:"FolderTest",tests:"FolderTest",testing:"FolderTest",spec:"FolderTest",specs:"FolderTest",__tests__:"FolderTest",e2e:"FolderTest",integration:"FolderTest",unit:"FolderTest",cypress:"FolderCypress",node_modules:"FolderNode",vendor:"FolderPackages",packages:"FolderPackages",deps:"FolderPackages",build:"FolderBuildkite",dist:"FolderDist",out:"FolderDist",output:"FolderDist",target:"FolderTarget",config:"FolderConfig",configs:"FolderConfig",configuration:"FolderConfig",settings:"FolderConfig",env:"FolderEnvironment",environments:"FolderEnvironment",docker:"FolderDocker",dockerfiles:"FolderDocker",containers:"FolderDocker",docs:"FolderDocs",doc:"FolderDocs",documentation:"FolderDocs",readme:"FolderDocs",public:"FolderPublic",static:"FolderPublic",assets:"FolderImages",images:"FolderImages",img:"FolderImages",icons:"FolderImages",media:"FolderImages",fonts:"FolderFont",styles:"FolderCss",stylesheets:"FolderCss",css:"FolderCss",sass:"FolderSass",scss:"FolderSass",less:"FolderLess",scripts:"FolderScripts",script:"FolderScripts",tools:"FolderTools",utils:"FolderUtils",utilities:"FolderUtils",helpers:"FolderHelper",components:"FolderComponents",component:"FolderComponents",views:"FolderViews",view:"FolderViews",layouts:"FolderLayout",layout:"FolderLayout",templates:"FolderTemplate",template:"FolderTemplate",hooks:"FolderHook",hook:"FolderHook",store:"FolderStore",stores:"FolderStore",state:"FolderNgrxStore",reducers:"FolderReduxReducer",reducer:"FolderReduxReducer",services:"FolderApi",service:"FolderApi",api:"FolderApi",apis:"FolderApi",routes:"FolderRoutes",route:"FolderRoutes",routing:"FolderRoutes",middleware:"FolderMiddleware",middlewares:"FolderMiddleware",controllers:"FolderController",controller:"FolderController",models:"FolderDatabase",model:"FolderDatabase",schemas:"FolderDatabase",schema:"FolderDatabase",migrations:"FolderDatabase",migration:"FolderDatabase",seeders:"FolderSeeders",seeder:"FolderSeeders",types:"FolderTypescript",typing:"FolderTypescript",typings:"FolderTypescript","@types":"FolderTypescript",interfaces:"FolderInterface",interface:"FolderInterface",android:"FolderAndroid",ios:"FolderIos",mobile:"FolderMobile",flutter:"FolderFlutter",kubernetes:"FolderKubernetes",k8s:"FolderKubernetes",terraform:"FolderTerraform",aws:"FolderAws",azure:"FolderAzurePipelines",firebase:"FolderFirebase",supabase:"FolderSupabase",vercel:"FolderVercel",netlify:"FolderNetlify",".github":"FolderGithub",".gitlab":"FolderGitlab",".circleci":"FolderCircleci",ci:"FolderCi",".ci":"FolderCi",workflows:"FolderGhWorkflows",".git":"FolderGit",".vscode":"FolderVscode",".idea":"FolderIntellij",".cursor":"FolderCursor",".devcontainer":"FolderContainer",".storybook":"FolderStorybook",i18n:"FolderI18n",locales:"FolderI18n",locale:"FolderI18n",lang:"FolderI18n",languages:"FolderI18n",temp:"FolderTemp",tmp:"FolderTemp",logs:"FolderLog",log:"FolderLog",backup:"FolderBackup",backups:"FolderBackup",examples:"FolderExamples",example:"FolderExamples",demo:"FolderExamples",demos:"FolderExamples",samples:"FolderExamples",sample:"FolderExamples",fixtures:"FolderTest",mocks:"FolderMock",mock:"FolderMock",data:"FolderDatabase",database:"FolderDatabase",db:"FolderDatabase",sql:"FolderDatabase",prisma:"FolderPrisma",drizzle:"FolderDrizzle",security:"FolderSecure",auth:"FolderSecure",authentication:"FolderSecure",authorization:"FolderSecure",keys:"FolderKeys",certs:"FolderKeys",certificates:"FolderKeys",content:"FolderContent",posts:"FolderContent",articles:"FolderContent",blog:"FolderContent",functions:"FolderFunctions",function:"FolderFunctions",lambda:"FolderFunctions",lambdas:"FolderFunctions",serverless:"FolderServerless",jobs:"FolderJob",job:"FolderJob",tasks:"FolderTasks",task:"FolderTasks",cron:"FolderTasks",queue:"FolderQueue",queues:"FolderQueue",desktop:"FolderDesktop",windows:"FolderWindows",macos:"FolderMacos",linux:"FolderLinux"},defaults:{file:"Document",folder:"Folder",folderOpen:"FolderOpen"}},w=o=>o.startsWith("Folder")?o.endsWith("_light")?o.replace("_light","Open_light"):o.endsWith("Open")?o:o+"Open":o,D=o=>o.split("\\").join("/").split("/").filter(Boolean).pop()??"",S=o=>{const e=o.toLowerCase();return[e,`.${e}`,`_${e}`,`__${e}__`]},P=o=>{const e=o.toLowerCase(),i=[];for(let s=0;s<e.length;s++)e[s]==="."&&i.push(s);const a=new Set;a.add(e);for(const s of i)s+1<e.length&&a.add(e.slice(s+1));return Array.from(a).sort((s,l)=>l.length-s.length)};function I(o,e,i){const s=D(o).toLowerCase();if(e==="directory"){for(const r of S(s)){const t=n.folderNames[r];if(t)return i?w(t):t}return i?n.defaults.folderOpen:n.defaults.folder}const l=n.fileNames[s];if(l)return l;for(const r of P(s)){const t=n.fileExtensions[r];if(t)return t}return n.defaults.file}export{N as F};