@kilocode/cli-darwin-arm64 7.7.4 → 7.7.6

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 (36) hide show
  1. package/bin/console/assets/{AgentsRoute-BqS5ZQSV.js → AgentsRoute-DiyQVU7b.js} +1 -1
  2. package/bin/console/assets/{CliNotificationsRoute-BBTTlsQB.js → CliNotificationsRoute-CPgbdaoK.js} +1 -1
  3. package/bin/console/assets/{CliUiRoute--HMby-V3.js → CliUiRoute-DHrO2LIB.js} +1 -1
  4. package/bin/console/assets/{ConfigLayout-exPrXrs0.js → ConfigLayout-OMB5ZnC4.js} +1 -1
  5. package/bin/console/assets/{ConfigPage-DS5Gh4d6.js → ConfigPage-fC1SUHN9.js} +1 -1
  6. package/bin/console/assets/{ConfirmDialog-DKtlaK4x.js → ConfirmDialog-Dw1TQzR8.js} +1 -1
  7. package/bin/console/assets/{ConsoleUiRoute-bvQ5AOcf.js → ConsoleUiRoute-DkVHnr4H.js} +1 -1
  8. package/bin/console/assets/{CustomSelect-BEJnwQk9.js → CustomSelect-CmMA48JB.js} +1 -1
  9. package/bin/console/assets/{FormattersRoute-DeUdZHED.js → FormattersRoute-DCNVjvRI.js} +1 -1
  10. package/bin/console/assets/{GhosttyTerminal-CHtyg0Jp.js → GhosttyTerminal-CTbd0S4x.js} +1 -1
  11. package/bin/console/assets/{IndexingRoute-BvvWs-9j.js → IndexingRoute-BN8nXyIX.js} +1 -1
  12. package/bin/console/assets/{KeybindsRoute-On0d6-iV.js → KeybindsRoute-DScOQWag.js} +1 -1
  13. package/bin/console/assets/{LoginRoute-BpUD1zCP.js → LoginRoute-1iBkjgbb.js} +1 -1
  14. package/bin/console/assets/{McpRoute-CbpzmGR2.js → McpRoute-CV79QLXw.js} +1 -1
  15. package/bin/console/assets/{ModelsRoute-UWwwW5f4.js → ModelsRoute-DUiNxWcp.js} +1 -1
  16. package/bin/console/assets/{OverviewRoute-pVJbZcSB.js → OverviewRoute-CIlEEPvW.js} +1 -1
  17. package/bin/console/assets/{PermissionsRoute-BDzTY97m.js → PermissionsRoute-BCxGpg_1.js} +1 -1
  18. package/bin/console/assets/{ProfileRoute-BlrN7fIR.js → ProfileRoute-Dw29CvtG.js} +1 -1
  19. package/bin/console/assets/{ProjectConsoleRoute-BVMHqGQT.js → ProjectConsoleRoute-CLlQ-PGV.js} +2 -2
  20. package/bin/console/assets/{ProvidersRoute-DQi_ywsR.js → ProvidersRoute-BW-V-jN3.js} +1 -1
  21. package/bin/console/assets/{ServersRoute-DjdM4bZA.js → ServersRoute-eQ7HE-su.js} +1 -1
  22. package/bin/console/assets/{SourcesRoute-B1aqFwnt.js → SourcesRoute-CM6oiRe5.js} +1 -1
  23. package/bin/console/assets/{ToolsRoute-NiU3Kgc-.js → ToolsRoute-4Zggew2v.js} +1 -1
  24. package/bin/console/assets/{button-1_tdOPlo.js → button-ZvkAWXQM.js} +1 -1
  25. package/bin/console/assets/{config-D-w9rt1b.js → config-BVVcC0Y1.js} +1 -1
  26. package/bin/console/assets/{console-CN8x7GgQ.js → console-JCVpLOdJ.js} +1 -1
  27. package/bin/console/assets/{file-C4LB07af.js → file-y5xMoiQQ.js} +1 -1
  28. package/bin/console/assets/{index-BVTco8nF.js → index-x2HgICqP.js} +6 -6
  29. package/bin/console/assets/{models-_6tiNptn.js → models-Rv8gyojT.js} +1 -1
  30. package/bin/console/assets/{profile-CSnKmbwa.js → profile-CjZNBlVZ.js} +1 -1
  31. package/bin/console/assets/{session-review-2FyNBzv4.js → session-review-BSr1Uyjk.js} +1 -1
  32. package/bin/console/assets/{tag-BzRV52sM.js → tag-DRpP2l65.js} +1 -1
  33. package/bin/console/assets/{ui-U-lxpacQ.js → ui-DYkEFqlY.js} +1 -1
  34. package/bin/console/index.html +1 -1
  35. package/bin/kilo +2 -2
  36. package/package.json +1 -1
@@ -1 +1 @@
1
- import{d as P,c as _,b as ce,e as ue,f as n,h as ge,ac as ve,i as d,C as O,m as he,S,g as h,F as W,s as j,t as v,v as me}from"./index-BVTco8nF.js";import{B as G}from"./button-1_tdOPlo.js";import{C as N}from"./CustomSelect-BEJnwQk9.js";import{u as be}from"./config-D-w9rt1b.js";import{b as X,S as x,a as pe}from"./ConfigPage-DS5Gh4d6.js";/* empty css */import"./tag-BzRV52sM.js";const fe=/^\.?[A-Za-z0-9][A-Za-z0-9_+-]*$/;function ye(e){return fe.test(e.trim())}function $e(e){if(!e)return;const t=new Set;for(const l of e){const s=l.trim().toLowerCase();s&&t.add(s.startsWith(".")?s:`.${s}`)}return t.size>0?[...t].sort():void 0}function xe(e){const t=e.split(",").map(l=>l.trim()).filter(Boolean);return t.length>0?$e(t):void 0}function C(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ke(e){return structuredClone(e??{})}function _e(e,t,l,s,g){return e!==t||!l&&s!==g}function z(e,t){const l={...e??{}};for(const[s,g]of Object.entries(t??{})){if(C(g)&&C(l[s])){l[s]={...l[s],...g};continue}l[s]=g}return l}function H(e){if(typeof e=="string")return e.trim()||void 0;if(Array.isArray(e))return e.length>0?e:void 0;if(!C(e))return e??void 0;const t=Object.entries(e).flatMap(([l,s])=>{const g=H(s);return g===void 0?[]:[[l,g]]});if(t.length!==0)return Object.fromEntries(t)}function J(e){return H(e)??{}}function Se(e,t){return{provider:e||void 0,model:e==="kilo"&&t||void 0,dimension:void 0}}function Y(e,t,l){if(!C(e))return[];const s=C(t)?t:{};return Object.entries(e).flatMap(([g,y])=>{const m=[...l,g];return g in s?C(y)&&C(s[g])?Y(y,s[g],m):[]:[m]})}function Be(e,t){return Y(e,t,["indexing"])}function Ae(e){const t=[];e.fileExtensions?.some(s=>!ye(s))&&t.push("File extensions must contain only a name with an optional leading dot."),e.dimension!==void 0&&e.dimension!==null&&(!Number.isInteger(e.dimension)||e.dimension<=0)&&t.push("Vector dimension must be a positive integer."),e.searchMinScore!==void 0&&(e.searchMinScore<0||e.searchMinScore>1)&&t.push("Search minimum score must be between 0 and 1.");const l=[["Search maximum results",e.searchMaxResults],["Embedding batch size",e.embeddingBatchSize],["Scanner maximum retries",e.scannerMaxBatchRetries]];for(const[s,g]of l)g!==void 0&&(!Number.isInteger(g)||g<=0)&&t.push(`${s} must be a positive integer.`);return t}var Ce=v('<div class="ui-field agent-builder-field"><div class=agent-builder-field-head><div><span></span></div></div><div class=agent-builder-control>'),Ee=v("<small>"),Me=v("<div class=agent-builder-field-actions>"),we=v("<button class=ui-toggle type=button><span><strong></strong><small></small></span><span class=indexing-toggle-tags>"),Ie=v("<header class=ui-card-header><div><h2>Indexing</h2><p>Build and maintain an embedding index used by semantic search."),q=v('<div class="ui-form agent-builder-form">'),Ke=v("<header class=ui-card-header><div><h2>Embeddings</h2><p>Select the provider and model used to turn code into searchable vectors."),Pe=v("<input type=number min=1 step=1 placeholder=Auto-detect>"),Te=v("<div class=indexing-note>Kilo embeddings use the account currently signed in to this Kilo server. Model dimensions are supplied by the catalog."),Oe=v("<header class=ui-card-header><div><h2>Vector Store</h2><p>Choose where indexed embeddings and metadata are stored."),qe=v("<input placeholder=http://localhost:6333>"),je=v('<input type=password placeholder="Optional API key">'),Le=v("<header class=ui-card-header><div><h2>Search and Scanning</h2><p>Tune result filtering, batching, and retries."),Re=v('<input placeholder=".php, .js, .css">'),Fe=v("<input type=number min=0 max=1 step=0.05 placeholder=0.4>"),Ne=v("<input type=number min=1 step=1 placeholder=50>"),ze=v("<input type=number min=1 step=1 placeholder=60>"),De=v("<input type=number min=1 step=1 placeholder=3>"),Ue=v("<footer class=indexing-errors>"),Qe=v('<div class="builder indexing-builder"><section class="builder-form agent-builder-stack">'),Ve=v('<input placeholder="Provider default">'),We=v("<input>"),Ge=v('<input placeholder="Default Kilo state directory">'),Je=v("<span>");const Ze=[{value:"",label:"Automatic"},{value:"kilo",label:"Kilo"},{value:"openai",label:"OpenAI"},{value:"ollama",label:"Ollama (local)"},{value:"openai-compatible",label:"OpenAI-compatible"},{value:"gemini",label:"Gemini"},{value:"mistral",label:"Mistral"},{value:"vercel-ai-gateway",label:"Vercel AI Gateway"},{value:"bedrock",label:"AWS Bedrock"},{value:"openrouter",label:"OpenRouter"},{value:"voyage",label:"Voyage"}],Xe=[{value:"lancedb",label:"LanceDB (default)"},{value:"qdrant",label:"Qdrant"}],He={kilo:[],openai:[{key:"apiKey",label:"API key",placeholder:"sk-...",secret:!0}],ollama:[{key:"baseUrl",label:"Base URL",placeholder:"http://localhost:11434"}],"openai-compatible":[{key:"baseUrl",label:"Base URL",placeholder:"https://api.example.com/v1"},{key:"apiKey",label:"API key",placeholder:"sk-...",secret:!0}],gemini:[{key:"apiKey",label:"API key",placeholder:"AI...",secret:!0}],mistral:[{key:"apiKey",label:"API key",placeholder:"...",secret:!0}],"vercel-ai-gateway":[{key:"apiKey",label:"API key",placeholder:"...",secret:!0}],bedrock:[{key:"region",label:"AWS region",placeholder:"us-east-1"},{key:"profile",label:"AWS profile",placeholder:"default"}],openrouter:[{key:"apiKey",label:"API key",placeholder:"sk-or-...",secret:!0},{key:"specificProvider",label:"Specific provider",placeholder:"Optional routing provider"}],voyage:[{key:"apiKey",label:"API key",placeholder:"pa-...",secret:!0}]};function Z(e,t){const l=e[t];return!l||typeof l!="object"?{}:l}function p(e){return(()=>{var t=Ce(),l=t.firstChild,s=l.firstChild,g=s.firstChild,y=l.nextSibling;return d(g,()=>e.label),d(s,n(S,{get when(){return e.description},children:m=>(()=>{var $=Ee();return d($,m),$})()}),null),d(l,n(S,{get when(){return e.actions},children:m=>(()=>{var $=Me();return d($,m),$})()}),null),d(y,()=>e.children),t})()}function Ye(e){return(()=>{var t=we(),l=t.firstChild,s=l.firstChild,g=s.nextSibling,y=l.nextSibling;return me(t,"click",e.onChange,!0),d(s,()=>e.label),d(g,()=>e.description),d(y,n(x,{get source(){return e.source},get inherited(){return e.inherited},get overridden(){return e.overridden}}),null),d(y,n(X,{get tone(){return e.checked?"success":"neutral"},get children(){return e.checked?"On":"Off"}}),null),h(m=>{var $=!!e.checked,I=e.checked,E=e.disabled;return $!==m.e&&t.classList.toggle("selected",m.e=$),I!==m.t&&j(t,"aria-pressed",m.t=I),E!==m.a&&(t.disabled=m.a=E),m},{e:void 0,t:void 0,a:void 0}),t})()}function or(){const e=be(),[t,l]=P({}),[s,g]=P(""),[y,m]=P(!1),[$,I]=P(""),E=()=>e.query()?.scope??"global",[ee,re]=P(E()),B=()=>E()==="project",L=_(()=>e.data()?.overlay.global.indexing??{}),R=_(()=>{const i=e.data()?.overlay;return i?(B()?i.project.indexing:i.global.indexing)??{}:{}}),b=_(()=>B()?z(L(),t()):t()),M=_(()=>b().provider),D=_(()=>b().vectorStore??"lancedb"),[T]=ce(e.query,ve),te=_(()=>{const i=T()?.models??[];return i.length===0?[{value:"",label:"No Kilo embedding models available",disabled:!0}]:i.map(o=>({value:o.id,label:`${o.name} (${o.note?`${o.note}, `:""}${o.dimension}d)`}))}),ne=_(()=>{const i=T();if(!i)return"";const o=b().model??i.defaultModel;return i.aliases[o]??o}),F=_(()=>Ae(J(t()))),ie=_(()=>Object.keys(R()).length>0);ue(()=>{const i=E(),o=R(),a=JSON.stringify(o);if(!_e(ee(),i,y(),s(),a))return;re(i),g(a),l(ke(o));const r=B()?z(L(),o).fileExtensions:o.fileExtensions;I(r?.join(", ")??""),m(!1)});function u(i){return e.data()?.overlay.fields[`indexing.${i}`]}function f(i){l(o=>z(o,i)),m(!0)}function le(i,o){f({[i]:o||void 0})}function K(i,o){f({[i]:o?Number(o):void 0})}function ae(i,o,a){f({[i]:{...Z(t(),i),[o]:a||void 0}})}function oe(i){f(Se(i,T()?.defaultModel))}function de(){const i=J(t()),o=Be(R(),i);e.patch({indexing:i},o.length?o:void 0),l(i),g(JSON.stringify(i)),m(!1)}function se(){e.unset([["indexing"]]),l({}),g("{}"),m(!1)}return n(pe,{title:"Code Indexing",get description(){return B()?"Configure semantic code search for this project. Unchanged values inherit from global settings.":"Configure semantic code search defaults for every project."},get actions(){return[n(S,{get when(){return ie()},get children(){return n(G,{variant:"secondary",get disabled(){return!!e.saving()},onClick:se,get children(){return B()?"Use global settings":"Clear settings"}})}}),n(G,{variant:"primary",get disabled(){return!!e.saving()||!y()||F().length>0},onClick:de,children:"Save"})]},get children(){var i=Qe(),o=i.firstChild;return d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[(()=>{var a=Ie();return a.firstChild,d(a,n(X,{get children(){return B()?"Project":"Global"}}),null),a})(),(()=>{var a=q();return d(a,n(Ye,{label:"Enable indexing",get description(){return he(()=>!!(B()&&t().enabled===void 0))()?`Inherited from global settings (${L().enabled?"on":"off"}).`:"Scan source files and keep their semantic index up to date."},get checked(){return b().enabled??!1},get disabled(){return!!e.saving()},get source(){return u("enabled")?.source},get inherited(){return u("enabled")?.inherited},get overridden(){return u("enabled")?.overridden},onChange:()=>f({enabled:!(b().enabled??!1)})})),a})()]}}),null),d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[Ke(),(()=>{var a=q();return d(a,n(p,{label:"Provider",description:"Automatic uses Kilo when signed in, otherwise the provider runtime default.",get actions(){return n(x,{get source(){return u("provider")?.source},get inherited(){return u("provider")?.inherited},get overridden(){return u("provider")?.overridden}})},get children(){return n(N,{class:"indexing-select",label:"Embedding provider",get value(){return M()??""},options:Ze,get disabled(){return!!e.saving()},onSelect:oe})}}),null),d(a,n(p,{label:"Model",get description(){return M()==="kilo"?"Select a Kilo-hosted embedding model.":"Leave empty to use the provider's default embedding model."},get actions(){return n(x,{get source(){return u("model")?.source},get inherited(){return u("model")?.inherited},get overridden(){return u("model")?.overridden}})},get children(){return n(S,{get when(){return M()==="kilo"},get fallback(){return(()=>{var r=Ve();return r.$$input=c=>le("model",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().model??""),r})()},get children(){return n(N,{class:"indexing-select",label:"Kilo embedding model",get value(){return ne()},get options(){return te()},get disabled(){return!!e.saving()||!T()?.models.length},onSelect:r=>f({model:r,dimension:void 0})})}})}}),null),d(a,n(p,{label:"Vector dimension",description:"Leave empty to derive the dimension from known model metadata.",get actions(){return n(x,{get source(){return u("dimension")?.source},get inherited(){return u("dimension")?.inherited},get overridden(){return u("dimension")?.overridden}})},get children(){var r=Pe();return r.$$input=c=>K("dimension",c.currentTarget.value),h(()=>r.disabled=!!e.saving()||M()==="kilo"),h(()=>r.value=b().dimension??""),r}}),null),d(a,n(S,{get when(){return M()==="kilo"},get children(){return Te()}}),null),d(a,n(S,{get when(){return M()},keyed:!0,children:r=>n(W,{get each(){return He[r]},children:c=>{const w=()=>u(`${r}.${c.key}`);return n(p,{get label(){return c.label},description:"Provider-specific connection setting.",get actions(){return n(x,{get source(){return w()?.source},get inherited(){return w()?.inherited},get overridden(){return w()?.overridden}})},get children(){var A=We();return A.$$input=k=>ae(r,c.key,k.currentTarget.value),j(A,"spellcheck",!1),h(k=>{var U=c.secret?"password":"text",Q=c.placeholder,V=!!e.saving();return U!==k.e&&j(A,"type",k.e=U),Q!==k.t&&j(A,"placeholder",k.t=Q),V!==k.a&&(A.disabled=k.a=V),k},{e:void 0,t:void 0,a:void 0}),h(()=>A.value=Z(b(),r)[c.key]??""),A}})}})}),null),a})()]}}),null),d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[Oe(),(()=>{var a=q();return d(a,n(p,{label:"Backend",description:"LanceDB stores vectors locally by default. Qdrant connects to an external service.",get actions(){return n(x,{get source(){return u("vectorStore")?.source},get inherited(){return u("vectorStore")?.inherited},get overridden(){return u("vectorStore")?.overridden}})},get children(){return n(N,{class:"indexing-select",label:"Vector store",get value(){return D()},options:Xe,get disabled(){return!!e.saving()},onSelect:r=>f({vectorStore:r})})}}),null),d(a,n(S,{get when(){return D()==="qdrant"},get fallback(){return n(p,{label:"LanceDB directory",description:"Optional directory for local LanceDB storage.",get actions(){return n(x,{get source(){return u("lancedb.directory")?.source},get inherited(){return u("lancedb.directory")?.inherited},get overridden(){return u("lancedb.directory")?.overridden}})},get children(){var r=Ge();return r.$$input=c=>f({lancedb:{...t().lancedb,directory:c.currentTarget.value||void 0}}),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().lancedb?.directory??""),r}})},get children(){return[n(p,{label:"Qdrant URL",description:"Server URL for the Qdrant instance.",get actions(){return n(x,{get source(){return u("qdrant.url")?.source},get inherited(){return u("qdrant.url")?.inherited},get overridden(){return u("qdrant.url")?.overridden}})},get children(){var r=qe();return r.$$input=c=>f({qdrant:{...t().qdrant,url:c.currentTarget.value||void 0}}),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().qdrant?.url??""),r}}),n(p,{label:"Qdrant API key",description:"Optional API key for authenticated Qdrant instances.",get actions(){return n(x,{get source(){return u("qdrant.apiKey")?.source},get inherited(){return u("qdrant.apiKey")?.inherited},get overridden(){return u("qdrant.apiKey")?.overridden}})},get children(){var r=je();return r.$$input=c=>f({qdrant:{...t().qdrant,apiKey:c.currentTarget.value||void 0}}),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().qdrant?.apiKey??""),r}})]}}),null),a})()]}}),null),d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[Le(),(()=>{var a=q();return d(a,n(p,{label:"File extensions",description:"Comma-separated allowlist. Leave empty to use the built-in defaults.",get actions(){return n(x,{get source(){return u("fileExtensions")?.source},get inherited(){return u("fileExtensions")?.inherited},get overridden(){return u("fileExtensions")?.overridden}})},get children(){var r=Re();return r.$$input=c=>{const w=c.currentTarget.value;I(w),f({fileExtensions:xe(w)})},h(()=>r.disabled=!!e.saving()),h(()=>r.value=$()),r}}),null),d(a,n(p,{label:"Minimum search score",description:"Similarity threshold from 0 to 1. Default is model-specific or 0.4.",get children(){var r=Fe();return r.$$input=c=>K("searchMinScore",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().searchMinScore??""),r}}),null),d(a,n(p,{label:"Maximum search results",description:"Maximum number of semantic matches returned per search.",get children(){var r=Ne();return r.$$input=c=>K("searchMaxResults",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().searchMaxResults??""),r}}),null),d(a,n(p,{label:"Embedding batch size",description:"Number of code segments sent in each embedding batch.",get children(){var r=ze();return r.$$input=c=>K("embeddingBatchSize",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().embeddingBatchSize??""),r}}),null),d(a,n(p,{label:"Scanner retry limit",description:"Maximum retry attempts for a failed embedding batch.",get children(){var r=De();return r.$$input=c=>K("scannerMaxBatchRetries",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().scannerMaxBatchRetries??""),r}}),null),a})(),n(S,{get when(){return F().length>0},get children(){var a=Ue();return d(a,n(W,{get each(){return F()},children:r=>(()=>{var c=Je();return d(c,r),c})()})),a}})]}}),null),i}})}ge(["click","input"]);export{or as IndexingRoute};
1
+ import{d as P,c as _,b as ce,e as ue,f as n,h as ge,ac as ve,i as d,C as O,m as he,S,g as h,F as W,s as j,t as v,v as me}from"./index-x2HgICqP.js";import{B as G}from"./button-ZvkAWXQM.js";import{C as N}from"./CustomSelect-CmMA48JB.js";import{u as be}from"./config-BVVcC0Y1.js";import{b as X,S as x,a as pe}from"./ConfigPage-fC1SUHN9.js";/* empty css */import"./tag-DRpP2l65.js";const fe=/^\.?[A-Za-z0-9][A-Za-z0-9_+-]*$/;function ye(e){return fe.test(e.trim())}function $e(e){if(!e)return;const t=new Set;for(const l of e){const s=l.trim().toLowerCase();s&&t.add(s.startsWith(".")?s:`.${s}`)}return t.size>0?[...t].sort():void 0}function xe(e){const t=e.split(",").map(l=>l.trim()).filter(Boolean);return t.length>0?$e(t):void 0}function C(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ke(e){return structuredClone(e??{})}function _e(e,t,l,s,g){return e!==t||!l&&s!==g}function z(e,t){const l={...e??{}};for(const[s,g]of Object.entries(t??{})){if(C(g)&&C(l[s])){l[s]={...l[s],...g};continue}l[s]=g}return l}function H(e){if(typeof e=="string")return e.trim()||void 0;if(Array.isArray(e))return e.length>0?e:void 0;if(!C(e))return e??void 0;const t=Object.entries(e).flatMap(([l,s])=>{const g=H(s);return g===void 0?[]:[[l,g]]});if(t.length!==0)return Object.fromEntries(t)}function J(e){return H(e)??{}}function Se(e,t){return{provider:e||void 0,model:e==="kilo"&&t||void 0,dimension:void 0}}function Y(e,t,l){if(!C(e))return[];const s=C(t)?t:{};return Object.entries(e).flatMap(([g,y])=>{const m=[...l,g];return g in s?C(y)&&C(s[g])?Y(y,s[g],m):[]:[m]})}function Be(e,t){return Y(e,t,["indexing"])}function Ae(e){const t=[];e.fileExtensions?.some(s=>!ye(s))&&t.push("File extensions must contain only a name with an optional leading dot."),e.dimension!==void 0&&e.dimension!==null&&(!Number.isInteger(e.dimension)||e.dimension<=0)&&t.push("Vector dimension must be a positive integer."),e.searchMinScore!==void 0&&(e.searchMinScore<0||e.searchMinScore>1)&&t.push("Search minimum score must be between 0 and 1.");const l=[["Search maximum results",e.searchMaxResults],["Embedding batch size",e.embeddingBatchSize],["Scanner maximum retries",e.scannerMaxBatchRetries]];for(const[s,g]of l)g!==void 0&&(!Number.isInteger(g)||g<=0)&&t.push(`${s} must be a positive integer.`);return t}var Ce=v('<div class="ui-field agent-builder-field"><div class=agent-builder-field-head><div><span></span></div></div><div class=agent-builder-control>'),Ee=v("<small>"),Me=v("<div class=agent-builder-field-actions>"),we=v("<button class=ui-toggle type=button><span><strong></strong><small></small></span><span class=indexing-toggle-tags>"),Ie=v("<header class=ui-card-header><div><h2>Indexing</h2><p>Build and maintain an embedding index used by semantic search."),q=v('<div class="ui-form agent-builder-form">'),Ke=v("<header class=ui-card-header><div><h2>Embeddings</h2><p>Select the provider and model used to turn code into searchable vectors."),Pe=v("<input type=number min=1 step=1 placeholder=Auto-detect>"),Te=v("<div class=indexing-note>Kilo embeddings use the account currently signed in to this Kilo server. Model dimensions are supplied by the catalog."),Oe=v("<header class=ui-card-header><div><h2>Vector Store</h2><p>Choose where indexed embeddings and metadata are stored."),qe=v("<input placeholder=http://localhost:6333>"),je=v('<input type=password placeholder="Optional API key">'),Le=v("<header class=ui-card-header><div><h2>Search and Scanning</h2><p>Tune result filtering, batching, and retries."),Re=v('<input placeholder=".php, .js, .css">'),Fe=v("<input type=number min=0 max=1 step=0.05 placeholder=0.4>"),Ne=v("<input type=number min=1 step=1 placeholder=50>"),ze=v("<input type=number min=1 step=1 placeholder=60>"),De=v("<input type=number min=1 step=1 placeholder=3>"),Ue=v("<footer class=indexing-errors>"),Qe=v('<div class="builder indexing-builder"><section class="builder-form agent-builder-stack">'),Ve=v('<input placeholder="Provider default">'),We=v("<input>"),Ge=v('<input placeholder="Default Kilo state directory">'),Je=v("<span>");const Ze=[{value:"",label:"Automatic"},{value:"kilo",label:"Kilo"},{value:"openai",label:"OpenAI"},{value:"ollama",label:"Ollama (local)"},{value:"openai-compatible",label:"OpenAI-compatible"},{value:"gemini",label:"Gemini"},{value:"mistral",label:"Mistral"},{value:"vercel-ai-gateway",label:"Vercel AI Gateway"},{value:"bedrock",label:"AWS Bedrock"},{value:"openrouter",label:"OpenRouter"},{value:"voyage",label:"Voyage"}],Xe=[{value:"lancedb",label:"LanceDB (default)"},{value:"qdrant",label:"Qdrant"}],He={kilo:[],openai:[{key:"apiKey",label:"API key",placeholder:"sk-...",secret:!0}],ollama:[{key:"baseUrl",label:"Base URL",placeholder:"http://localhost:11434"}],"openai-compatible":[{key:"baseUrl",label:"Base URL",placeholder:"https://api.example.com/v1"},{key:"apiKey",label:"API key",placeholder:"sk-...",secret:!0}],gemini:[{key:"apiKey",label:"API key",placeholder:"AI...",secret:!0}],mistral:[{key:"apiKey",label:"API key",placeholder:"...",secret:!0}],"vercel-ai-gateway":[{key:"apiKey",label:"API key",placeholder:"...",secret:!0}],bedrock:[{key:"region",label:"AWS region",placeholder:"us-east-1"},{key:"profile",label:"AWS profile",placeholder:"default"}],openrouter:[{key:"apiKey",label:"API key",placeholder:"sk-or-...",secret:!0},{key:"specificProvider",label:"Specific provider",placeholder:"Optional routing provider"}],voyage:[{key:"apiKey",label:"API key",placeholder:"pa-...",secret:!0}]};function Z(e,t){const l=e[t];return!l||typeof l!="object"?{}:l}function p(e){return(()=>{var t=Ce(),l=t.firstChild,s=l.firstChild,g=s.firstChild,y=l.nextSibling;return d(g,()=>e.label),d(s,n(S,{get when(){return e.description},children:m=>(()=>{var $=Ee();return d($,m),$})()}),null),d(l,n(S,{get when(){return e.actions},children:m=>(()=>{var $=Me();return d($,m),$})()}),null),d(y,()=>e.children),t})()}function Ye(e){return(()=>{var t=we(),l=t.firstChild,s=l.firstChild,g=s.nextSibling,y=l.nextSibling;return me(t,"click",e.onChange,!0),d(s,()=>e.label),d(g,()=>e.description),d(y,n(x,{get source(){return e.source},get inherited(){return e.inherited},get overridden(){return e.overridden}}),null),d(y,n(X,{get tone(){return e.checked?"success":"neutral"},get children(){return e.checked?"On":"Off"}}),null),h(m=>{var $=!!e.checked,I=e.checked,E=e.disabled;return $!==m.e&&t.classList.toggle("selected",m.e=$),I!==m.t&&j(t,"aria-pressed",m.t=I),E!==m.a&&(t.disabled=m.a=E),m},{e:void 0,t:void 0,a:void 0}),t})()}function or(){const e=be(),[t,l]=P({}),[s,g]=P(""),[y,m]=P(!1),[$,I]=P(""),E=()=>e.query()?.scope??"global",[ee,re]=P(E()),B=()=>E()==="project",L=_(()=>e.data()?.overlay.global.indexing??{}),R=_(()=>{const i=e.data()?.overlay;return i?(B()?i.project.indexing:i.global.indexing)??{}:{}}),b=_(()=>B()?z(L(),t()):t()),M=_(()=>b().provider),D=_(()=>b().vectorStore??"lancedb"),[T]=ce(e.query,ve),te=_(()=>{const i=T()?.models??[];return i.length===0?[{value:"",label:"No Kilo embedding models available",disabled:!0}]:i.map(o=>({value:o.id,label:`${o.name} (${o.note?`${o.note}, `:""}${o.dimension}d)`}))}),ne=_(()=>{const i=T();if(!i)return"";const o=b().model??i.defaultModel;return i.aliases[o]??o}),F=_(()=>Ae(J(t()))),ie=_(()=>Object.keys(R()).length>0);ue(()=>{const i=E(),o=R(),a=JSON.stringify(o);if(!_e(ee(),i,y(),s(),a))return;re(i),g(a),l(ke(o));const r=B()?z(L(),o).fileExtensions:o.fileExtensions;I(r?.join(", ")??""),m(!1)});function u(i){return e.data()?.overlay.fields[`indexing.${i}`]}function f(i){l(o=>z(o,i)),m(!0)}function le(i,o){f({[i]:o||void 0})}function K(i,o){f({[i]:o?Number(o):void 0})}function ae(i,o,a){f({[i]:{...Z(t(),i),[o]:a||void 0}})}function oe(i){f(Se(i,T()?.defaultModel))}function de(){const i=J(t()),o=Be(R(),i);e.patch({indexing:i},o.length?o:void 0),l(i),g(JSON.stringify(i)),m(!1)}function se(){e.unset([["indexing"]]),l({}),g("{}"),m(!1)}return n(pe,{title:"Code Indexing",get description(){return B()?"Configure semantic code search for this project. Unchanged values inherit from global settings.":"Configure semantic code search defaults for every project."},get actions(){return[n(S,{get when(){return ie()},get children(){return n(G,{variant:"secondary",get disabled(){return!!e.saving()},onClick:se,get children(){return B()?"Use global settings":"Clear settings"}})}}),n(G,{variant:"primary",get disabled(){return!!e.saving()||!y()||F().length>0},onClick:de,children:"Save"})]},get children(){var i=Qe(),o=i.firstChild;return d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[(()=>{var a=Ie();return a.firstChild,d(a,n(X,{get children(){return B()?"Project":"Global"}}),null),a})(),(()=>{var a=q();return d(a,n(Ye,{label:"Enable indexing",get description(){return he(()=>!!(B()&&t().enabled===void 0))()?`Inherited from global settings (${L().enabled?"on":"off"}).`:"Scan source files and keep their semantic index up to date."},get checked(){return b().enabled??!1},get disabled(){return!!e.saving()},get source(){return u("enabled")?.source},get inherited(){return u("enabled")?.inherited},get overridden(){return u("enabled")?.overridden},onChange:()=>f({enabled:!(b().enabled??!1)})})),a})()]}}),null),d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[Ke(),(()=>{var a=q();return d(a,n(p,{label:"Provider",description:"Automatic uses Kilo when signed in, otherwise the provider runtime default.",get actions(){return n(x,{get source(){return u("provider")?.source},get inherited(){return u("provider")?.inherited},get overridden(){return u("provider")?.overridden}})},get children(){return n(N,{class:"indexing-select",label:"Embedding provider",get value(){return M()??""},options:Ze,get disabled(){return!!e.saving()},onSelect:oe})}}),null),d(a,n(p,{label:"Model",get description(){return M()==="kilo"?"Select a Kilo-hosted embedding model.":"Leave empty to use the provider's default embedding model."},get actions(){return n(x,{get source(){return u("model")?.source},get inherited(){return u("model")?.inherited},get overridden(){return u("model")?.overridden}})},get children(){return n(S,{get when(){return M()==="kilo"},get fallback(){return(()=>{var r=Ve();return r.$$input=c=>le("model",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().model??""),r})()},get children(){return n(N,{class:"indexing-select",label:"Kilo embedding model",get value(){return ne()},get options(){return te()},get disabled(){return!!e.saving()||!T()?.models.length},onSelect:r=>f({model:r,dimension:void 0})})}})}}),null),d(a,n(p,{label:"Vector dimension",description:"Leave empty to derive the dimension from known model metadata.",get actions(){return n(x,{get source(){return u("dimension")?.source},get inherited(){return u("dimension")?.inherited},get overridden(){return u("dimension")?.overridden}})},get children(){var r=Pe();return r.$$input=c=>K("dimension",c.currentTarget.value),h(()=>r.disabled=!!e.saving()||M()==="kilo"),h(()=>r.value=b().dimension??""),r}}),null),d(a,n(S,{get when(){return M()==="kilo"},get children(){return Te()}}),null),d(a,n(S,{get when(){return M()},keyed:!0,children:r=>n(W,{get each(){return He[r]},children:c=>{const w=()=>u(`${r}.${c.key}`);return n(p,{get label(){return c.label},description:"Provider-specific connection setting.",get actions(){return n(x,{get source(){return w()?.source},get inherited(){return w()?.inherited},get overridden(){return w()?.overridden}})},get children(){var A=We();return A.$$input=k=>ae(r,c.key,k.currentTarget.value),j(A,"spellcheck",!1),h(k=>{var U=c.secret?"password":"text",Q=c.placeholder,V=!!e.saving();return U!==k.e&&j(A,"type",k.e=U),Q!==k.t&&j(A,"placeholder",k.t=Q),V!==k.a&&(A.disabled=k.a=V),k},{e:void 0,t:void 0,a:void 0}),h(()=>A.value=Z(b(),r)[c.key]??""),A}})}})}),null),a})()]}}),null),d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[Oe(),(()=>{var a=q();return d(a,n(p,{label:"Backend",description:"LanceDB stores vectors locally by default. Qdrant connects to an external service.",get actions(){return n(x,{get source(){return u("vectorStore")?.source},get inherited(){return u("vectorStore")?.inherited},get overridden(){return u("vectorStore")?.overridden}})},get children(){return n(N,{class:"indexing-select",label:"Vector store",get value(){return D()},options:Xe,get disabled(){return!!e.saving()},onSelect:r=>f({vectorStore:r})})}}),null),d(a,n(S,{get when(){return D()==="qdrant"},get fallback(){return n(p,{label:"LanceDB directory",description:"Optional directory for local LanceDB storage.",get actions(){return n(x,{get source(){return u("lancedb.directory")?.source},get inherited(){return u("lancedb.directory")?.inherited},get overridden(){return u("lancedb.directory")?.overridden}})},get children(){var r=Ge();return r.$$input=c=>f({lancedb:{...t().lancedb,directory:c.currentTarget.value||void 0}}),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().lancedb?.directory??""),r}})},get children(){return[n(p,{label:"Qdrant URL",description:"Server URL for the Qdrant instance.",get actions(){return n(x,{get source(){return u("qdrant.url")?.source},get inherited(){return u("qdrant.url")?.inherited},get overridden(){return u("qdrant.url")?.overridden}})},get children(){var r=qe();return r.$$input=c=>f({qdrant:{...t().qdrant,url:c.currentTarget.value||void 0}}),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().qdrant?.url??""),r}}),n(p,{label:"Qdrant API key",description:"Optional API key for authenticated Qdrant instances.",get actions(){return n(x,{get source(){return u("qdrant.apiKey")?.source},get inherited(){return u("qdrant.apiKey")?.inherited},get overridden(){return u("qdrant.apiKey")?.overridden}})},get children(){var r=je();return r.$$input=c=>f({qdrant:{...t().qdrant,apiKey:c.currentTarget.value||void 0}}),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().qdrant?.apiKey??""),r}})]}}),null),a})()]}}),null),d(o,n(O,{class:"ui-card agent-builder-card",padding:0,get children(){return[Le(),(()=>{var a=q();return d(a,n(p,{label:"File extensions",description:"Comma-separated allowlist. Leave empty to use the built-in defaults.",get actions(){return n(x,{get source(){return u("fileExtensions")?.source},get inherited(){return u("fileExtensions")?.inherited},get overridden(){return u("fileExtensions")?.overridden}})},get children(){var r=Re();return r.$$input=c=>{const w=c.currentTarget.value;I(w),f({fileExtensions:xe(w)})},h(()=>r.disabled=!!e.saving()),h(()=>r.value=$()),r}}),null),d(a,n(p,{label:"Minimum search score",description:"Similarity threshold from 0 to 1. Default is model-specific or 0.4.",get children(){var r=Fe();return r.$$input=c=>K("searchMinScore",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().searchMinScore??""),r}}),null),d(a,n(p,{label:"Maximum search results",description:"Maximum number of semantic matches returned per search.",get children(){var r=Ne();return r.$$input=c=>K("searchMaxResults",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().searchMaxResults??""),r}}),null),d(a,n(p,{label:"Embedding batch size",description:"Number of code segments sent in each embedding batch.",get children(){var r=ze();return r.$$input=c=>K("embeddingBatchSize",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().embeddingBatchSize??""),r}}),null),d(a,n(p,{label:"Scanner retry limit",description:"Maximum retry attempts for a failed embedding batch.",get children(){var r=De();return r.$$input=c=>K("scannerMaxBatchRetries",c.currentTarget.value),h(()=>r.disabled=!!e.saving()),h(()=>r.value=b().scannerMaxBatchRetries??""),r}}),null),a})(),n(S,{get when(){return F().length>0},get children(){var a=Ue();return d(a,n(W,{get each(){return F()},children:r=>(()=>{var c=Je();return d(c,r),c})()})),a}})]}}),null),i}})}ge(["click","input"]);export{or as IndexingRoute};
@@ -1 +1 @@
1
- import{d as x,c as b,e as G,y as L,o as H,ab as J,f as a,h as O,w as Q,i,S as I,F as R,X as W,g as j,s as q,v as Y,m as Z,t as u}from"./index-BVTco8nF.js";import{B as w}from"./button-1_tdOPlo.js";import{d as ee,e as D,c as ne,S as te,b as re,a as ie}from"./ConfigPage-DS5Gh4d6.js";import{u as ae}from"./config-D-w9rt1b.js";import"./tag-BzRV52sM.js";const se=new Set(["alt","control","meta","shift"]);function M(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function P(e){return M(e)==="none"?[]:J(e).map(M)}function le(e){const t=e.toLowerCase();return t===" "?"space":t==="arrowleft"?"left":t==="arrowright"?"right":t==="arrowup"?"up":t==="arrowdown"?"down":t==="escape"?"escape":t==="enter"?"return":t==="pageup"?"pageup":t==="pagedown"?"pagedown":t==="backspace"?"backspace":t==="delete"?"delete":t==="home"?"home":t==="end"?"end":t==="tab"?"tab":t==="dead"||t==="unidentified"?"":t}function de(e){const t=le(e.key);return!t||se.has(t)?"":[e.ctrlKey&&"ctrl",e.altKey&&"alt",e.metaKey&&"super",e.shiftKey&&"shift",t].filter(Boolean).join("+")}function oe(){const e=ae(),t=()=>e.data(),[o,c]=x("closed"),[h,s]=x(""),[d,l]=x(!1),[m,B]=x(""),[f,y]=x(""),g=b(()=>t()?.keybinds.keybinds??[]),T=b(()=>new Set(g().map(n=>n.id)));function k(n){return t()?.tui.keybinds?.[n.id]??n.default}function $(n,r){const p=new Set(P(r));return p.size?g().filter(K=>K.id!==n.id&&P(k(K)).some(V=>p.has(V))).map(K=>K.id):[]}const S=b(()=>g().map(n=>{const r=k(n);return{item:n,binding:r,source:r===n.default?"default":e.query()?.scope??"project",conflicts:r===n.default?[]:$(n,r)}})),E=b(()=>{const n=h().trim().toLowerCase();return n?S().filter(r=>`${r.item.label} ${r.item.id} ${r.item.group} ${r.item.description} ${r.binding} ${r.item.default}`.toLowerCase().includes(n)):S()}),U=b(()=>Array.from(E().reduce((n,r)=>{const p=n.get(r.item.group)??[];return p.push(r),n.set(r.item.group,p),n},new Map),([n,r])=>({name:n,rows:r}))),C=b(()=>g().find(n=>n.id===m())),_=b(()=>{const n=C();return n?L(f())===n.default?[]:$(n,f()):[]}),v=b(()=>C()?.default===L(f()));G(()=>{if(!d())return;const n=r=>{r.preventDefault(),r.stopImmediatePropagation();const p=de(r);p&&(y(p),l(!1))};window.addEventListener("keydown",n,!0),H(()=>window.removeEventListener("keydown",n,!0))});function A(n){B(n.id),y(k(n)),l(!1),c("edit")}function F(){l(!1),c("closed")}function X(){const n=C();n&&y(n.default)}function z(){y("none")}function N(){const n=L(m()),r=L(f());if(!t()||!n||!r){e.fail("Enter a TUI keybind name and binding before saving.");return}if(!T().has(n)){e.fail(`Unknown TUI keybind: ${n}`);return}e.tui({keybinds:{[n]:r}}),F()}return{ctx:e,mode:o,close:F,open:A,search:h,setSearch:s,capture:d,setCapture:l,keybinds:g,rows:S,visible:E,groups:U,selected:C,binding:f,setBinding:y,conflicts:_,defaulted:v,reset:X,none:z,save:N}}var ce=u("<div class=keybinds>"),ue=u("<span class=config-title-count>Keybinds"),fe=u("<p class=empty>No keybinds match this filter."),ge=u("<section class=keybind-group><div class=keybind-rows>"),pe=u("<span class=keybind-subtitle><span class=keybind-id></span><span class=keybind-description>"),be=u("<div class=keybind-meta><span class=keybind-binding>"),he=u("<div class=drawer-scrim>"),me=u('<p class="keybind-warning wide">Duplicate binding with: '),ye=u('<aside class="provider-drawer keybind-drawer"aria-label="Keybind configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form keybind-form"><section class="keybind-command-card wide"><span></span><p></p><code></code></section><label class="required-field wide keybind-binding-field">Binding<div class=keybind-input-row><input placeholder=ctrl+x,shift+return,none></div></label><p class="keybind-help wide">Press Capture, then type a shortcut. Enter comma-separated bindings manually to define alternatives.</p><div class="keybind-default-card wide"><span>Default binding</span><code></code></div></div><footer class="drawer-footer keybind-footer">');function we(){const e=oe();return a(ie,{get title(){return(()=>{var t=ue();return t.firstChild,i(t,a(D,{get children(){return e.keybinds().length}}),null),t})()},description:"Review and override every terminal UI keybind command exposed by the CLI. Use none to disable a binding.",get children(){return[a(Q,{label:"Filter keybinds",get value(){return e.search()},placeholder:"Filter by command, group, binding, or description...",get onValue(){return e.setSearch}}),(()=>{var t=ce();return i(t,a(I,{get when(){return e.groups().length},get fallback(){return fe()},get children(){return a(R,{get each(){return e.groups()},children:o=>(()=>{var c=ge(),h=c.firstChild;return i(c,a(ee,{get trailing(){return a(D,{get children(){return o.rows.length}})},get children(){return o.name}}),h),i(h,a(R,{get each(){return o.rows},children:s=>a(ne,{get title(){return s.item.label},get subtitle(){return(()=>{var d=pe(),l=d.firstChild,m=l.nextSibling;return i(l,()=>s.item.id),i(m,()=>s.item.description),d})()},get status(){return(()=>{var d=be(),l=d.firstChild;return i(l,()=>s.binding),i(d,a(te,{get source(){return s.source}}),null),i(d,a(I,{get when(){return s.conflicts.length},get children(){return a(re,{tone:"warning",children:"Conflict"})}}),null),j(()=>q(l,"data-empty",s.binding==="none"||void 0)),d})()},get actions(){return a(W,{icon:"edit",variant:"ghost",get"aria-label"(){return`Edit ${s.item.label}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.open(s.item)})}})})),c})()})}})),t})(),a(I,{get when(){return Z(()=>e.mode()==="edit")()&&e.selected()},children:t=>[(()=>{var o=he();return Y(o,"click",e.close,!0),o})(),(()=>{var o=ye(),c=o.firstChild,h=c.firstChild,s=h.firstChild,d=s.nextSibling,l=c.nextSibling,m=l.firstChild,B=m.firstChild,f=B.nextSibling,y=f.nextSibling,g=m.nextSibling,T=g.firstChild,k=T.nextSibling,$=k.firstChild,S=g.nextSibling,E=S.nextSibling,U=E.firstChild,C=U.nextSibling,_=l.nextSibling;return i(s,()=>t().label),i(d,()=>t().id),i(c,a(w,{variant:"ghost","aria-label":"Close keybind overlay",get onClick(){return e.close},children:"X"}),null),i(B,()=>t().group),i(f,()=>t().description),i(y,()=>t().id),$.$$input=v=>e.setBinding(v.currentTarget.value),q($,"spellcheck",!1),i(k,a(w,{get variant(){return e.capture()?"primary":"secondary"},get"aria-pressed"(){return e.capture()},onClick:()=>e.setCapture(!e.capture()),get children(){return e.capture()?"Listening...":"Capture"}}),null),i(C,()=>t().default),i(l,a(I,{get when(){return e.conflicts().length},get children(){var v=me();return v.firstChild,i(v,()=>e.conflicts().join(", "),null),v}}),null),i(_,a(w,{variant:"ghost",get onClick(){return e.close},children:"Cancel"}),null),i(_,a(w,{variant:"secondary",get disabled(){return!!e.ctx.saving()},get onClick(){return e.none},children:"Set none"}),null),i(_,a(w,{variant:"secondary",get disabled(){return!!e.ctx.saving()||e.defaulted()},get onClick(){return e.reset},children:"Use default"}),null),i(_,a(w,{variant:"primary",get disabled(){return!!e.ctx.saving()||!e.binding()},get onClick(){return e.save},children:"Save keybind"}),null),j(()=>$.value=e.binding()),o})()]})]}})}O(["click","input"]);export{we as KeybindsRoute};
1
+ import{d as x,c as b,e as G,y as L,o as H,ab as J,f as a,h as O,w as Q,i,S as I,F as R,X as W,g as j,s as q,v as Y,m as Z,t as u}from"./index-x2HgICqP.js";import{B as w}from"./button-ZvkAWXQM.js";import{d as ee,e as D,c as ne,S as te,b as re,a as ie}from"./ConfigPage-fC1SUHN9.js";import{u as ae}from"./config-BVVcC0Y1.js";import"./tag-DRpP2l65.js";const se=new Set(["alt","control","meta","shift"]);function M(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function P(e){return M(e)==="none"?[]:J(e).map(M)}function le(e){const t=e.toLowerCase();return t===" "?"space":t==="arrowleft"?"left":t==="arrowright"?"right":t==="arrowup"?"up":t==="arrowdown"?"down":t==="escape"?"escape":t==="enter"?"return":t==="pageup"?"pageup":t==="pagedown"?"pagedown":t==="backspace"?"backspace":t==="delete"?"delete":t==="home"?"home":t==="end"?"end":t==="tab"?"tab":t==="dead"||t==="unidentified"?"":t}function de(e){const t=le(e.key);return!t||se.has(t)?"":[e.ctrlKey&&"ctrl",e.altKey&&"alt",e.metaKey&&"super",e.shiftKey&&"shift",t].filter(Boolean).join("+")}function oe(){const e=ae(),t=()=>e.data(),[o,c]=x("closed"),[h,s]=x(""),[d,l]=x(!1),[m,B]=x(""),[f,y]=x(""),g=b(()=>t()?.keybinds.keybinds??[]),T=b(()=>new Set(g().map(n=>n.id)));function k(n){return t()?.tui.keybinds?.[n.id]??n.default}function $(n,r){const p=new Set(P(r));return p.size?g().filter(K=>K.id!==n.id&&P(k(K)).some(V=>p.has(V))).map(K=>K.id):[]}const S=b(()=>g().map(n=>{const r=k(n);return{item:n,binding:r,source:r===n.default?"default":e.query()?.scope??"project",conflicts:r===n.default?[]:$(n,r)}})),E=b(()=>{const n=h().trim().toLowerCase();return n?S().filter(r=>`${r.item.label} ${r.item.id} ${r.item.group} ${r.item.description} ${r.binding} ${r.item.default}`.toLowerCase().includes(n)):S()}),U=b(()=>Array.from(E().reduce((n,r)=>{const p=n.get(r.item.group)??[];return p.push(r),n.set(r.item.group,p),n},new Map),([n,r])=>({name:n,rows:r}))),C=b(()=>g().find(n=>n.id===m())),_=b(()=>{const n=C();return n?L(f())===n.default?[]:$(n,f()):[]}),v=b(()=>C()?.default===L(f()));G(()=>{if(!d())return;const n=r=>{r.preventDefault(),r.stopImmediatePropagation();const p=de(r);p&&(y(p),l(!1))};window.addEventListener("keydown",n,!0),H(()=>window.removeEventListener("keydown",n,!0))});function A(n){B(n.id),y(k(n)),l(!1),c("edit")}function F(){l(!1),c("closed")}function X(){const n=C();n&&y(n.default)}function z(){y("none")}function N(){const n=L(m()),r=L(f());if(!t()||!n||!r){e.fail("Enter a TUI keybind name and binding before saving.");return}if(!T().has(n)){e.fail(`Unknown TUI keybind: ${n}`);return}e.tui({keybinds:{[n]:r}}),F()}return{ctx:e,mode:o,close:F,open:A,search:h,setSearch:s,capture:d,setCapture:l,keybinds:g,rows:S,visible:E,groups:U,selected:C,binding:f,setBinding:y,conflicts:_,defaulted:v,reset:X,none:z,save:N}}var ce=u("<div class=keybinds>"),ue=u("<span class=config-title-count>Keybinds"),fe=u("<p class=empty>No keybinds match this filter."),ge=u("<section class=keybind-group><div class=keybind-rows>"),pe=u("<span class=keybind-subtitle><span class=keybind-id></span><span class=keybind-description>"),be=u("<div class=keybind-meta><span class=keybind-binding>"),he=u("<div class=drawer-scrim>"),me=u('<p class="keybind-warning wide">Duplicate binding with: '),ye=u('<aside class="provider-drawer keybind-drawer"aria-label="Keybind configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form keybind-form"><section class="keybind-command-card wide"><span></span><p></p><code></code></section><label class="required-field wide keybind-binding-field">Binding<div class=keybind-input-row><input placeholder=ctrl+x,shift+return,none></div></label><p class="keybind-help wide">Press Capture, then type a shortcut. Enter comma-separated bindings manually to define alternatives.</p><div class="keybind-default-card wide"><span>Default binding</span><code></code></div></div><footer class="drawer-footer keybind-footer">');function we(){const e=oe();return a(ie,{get title(){return(()=>{var t=ue();return t.firstChild,i(t,a(D,{get children(){return e.keybinds().length}}),null),t})()},description:"Review and override every terminal UI keybind command exposed by the CLI. Use none to disable a binding.",get children(){return[a(Q,{label:"Filter keybinds",get value(){return e.search()},placeholder:"Filter by command, group, binding, or description...",get onValue(){return e.setSearch}}),(()=>{var t=ce();return i(t,a(I,{get when(){return e.groups().length},get fallback(){return fe()},get children(){return a(R,{get each(){return e.groups()},children:o=>(()=>{var c=ge(),h=c.firstChild;return i(c,a(ee,{get trailing(){return a(D,{get children(){return o.rows.length}})},get children(){return o.name}}),h),i(h,a(R,{get each(){return o.rows},children:s=>a(ne,{get title(){return s.item.label},get subtitle(){return(()=>{var d=pe(),l=d.firstChild,m=l.nextSibling;return i(l,()=>s.item.id),i(m,()=>s.item.description),d})()},get status(){return(()=>{var d=be(),l=d.firstChild;return i(l,()=>s.binding),i(d,a(te,{get source(){return s.source}}),null),i(d,a(I,{get when(){return s.conflicts.length},get children(){return a(re,{tone:"warning",children:"Conflict"})}}),null),j(()=>q(l,"data-empty",s.binding==="none"||void 0)),d})()},get actions(){return a(W,{icon:"edit",variant:"ghost",get"aria-label"(){return`Edit ${s.item.label}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.open(s.item)})}})})),c})()})}})),t})(),a(I,{get when(){return Z(()=>e.mode()==="edit")()&&e.selected()},children:t=>[(()=>{var o=he();return Y(o,"click",e.close,!0),o})(),(()=>{var o=ye(),c=o.firstChild,h=c.firstChild,s=h.firstChild,d=s.nextSibling,l=c.nextSibling,m=l.firstChild,B=m.firstChild,f=B.nextSibling,y=f.nextSibling,g=m.nextSibling,T=g.firstChild,k=T.nextSibling,$=k.firstChild,S=g.nextSibling,E=S.nextSibling,U=E.firstChild,C=U.nextSibling,_=l.nextSibling;return i(s,()=>t().label),i(d,()=>t().id),i(c,a(w,{variant:"ghost","aria-label":"Close keybind overlay",get onClick(){return e.close},children:"X"}),null),i(B,()=>t().group),i(f,()=>t().description),i(y,()=>t().id),$.$$input=v=>e.setBinding(v.currentTarget.value),q($,"spellcheck",!1),i(k,a(w,{get variant(){return e.capture()?"primary":"secondary"},get"aria-pressed"(){return e.capture()},onClick:()=>e.setCapture(!e.capture()),get children(){return e.capture()?"Listening...":"Capture"}}),null),i(C,()=>t().default),i(l,a(I,{get when(){return e.conflicts().length},get children(){var v=me();return v.firstChild,i(v,()=>e.conflicts().join(", "),null),v}}),null),i(_,a(w,{variant:"ghost",get onClick(){return e.close},children:"Cancel"}),null),i(_,a(w,{variant:"secondary",get disabled(){return!!e.ctx.saving()},get onClick(){return e.none},children:"Set none"}),null),i(_,a(w,{variant:"secondary",get disabled(){return!!e.ctx.saving()||e.defaulted()},get onClick(){return e.reset},children:"Use default"}),null),i(_,a(w,{variant:"primary",get disabled(){return!!e.ctx.saving()||!e.binding()},get onClick(){return e.save},children:"Save keybind"}),null),j(()=>$.value=e.binding()),o})()]})]}})}O(["click","input"]);export{we as KeybindsRoute};
@@ -1 +1 @@
1
- import{u as re,a as ne,c as ie,d,e as L,o as U,i as s,f as r,t as o,h as se,L as le,m as D,S as _,C as N,g as O,s as j,p as oe,M as g,q as ae,r as ce,l as ue,j as W}from"./index-BVTco8nF.js";import{B as f}from"./button-1_tdOPlo.js";import{u as pe,g as de,e as F,p as ge,s as fe}from"./profile-CSnKmbwa.js";var he=o("<strong>Kilo server not found"),ve=o("<p>Start a local Kilo server or pass a server URL with ?server=."),me=o("<a class=profile-link-button>Back to Profile"),$e=o("<div class=profile-login-state><span class=profile-spinner aria-hidden=true></span><strong>Starting login...</strong><p>Preparing a secure browser authorization request."),_e=o("<div class=profile-login-flow><div class=profile-login-step><span>Step 1</span><strong>Open this URL</strong><div class=profile-login-url><span></span></div></div><div class=profile-login-waiting><span class=profile-spinner aria-hidden=true></span><span>Waiting for authorization (<!>)"),we=o('<div class="profile-login-state success"><strong>Login successful</strong><p>Redirecting back to your profile.'),be=o('<div class="profile-login-state error"><strong>Login failed</strong><p></p><div class=profile-login-actions><a class=profile-link-button>Back to Profile'),Ce=o("<div class=profile-login-state><strong>Login cancelled</strong><p>No credentials were saved."),ye=o("<section class=route-empty><div class=profile-login-page><header class=profile-login-header><p class=eyebrow>Kilo Login</p><h1>Login to Kilo</h1><p>Authorize this Kilo Console through the same device auth flow used by the editor clients."),Se=o("<div class=profile-login-step><span>Step 2</span><strong>Enter this code</strong><button type=button class=profile-login-code><small>");function xe(h){const w=Math.floor(h/60),u=h%60;return`${w}:${u.toString().padStart(2,"0")}`}function Ke(){const h=re(),w=ne(),u=ie(()=>new URLSearchParams(h.search)),a=pe(u),[n,c]=d({status:"idle"}),[G,A]=d(900),[v,b]=d(0),[K,C]=d(),[y,q]=d(""),H=()=>fe(u().get("return")),R=()=>ge(u(),"/profile");function S(){K()?.abort(),C(void 0)}function J(){window.setTimeout(()=>w(H(),{replace:!0}),650)}function x(e=a.query()){if(!e)return;S();const l=new AbortController,t=v()+1;b(t),C(l),c({status:"initiating"}),ae(e).then(i=>v()!==t?!1:(c({status:"pending",code:de(i.instructions),url:i.url,expiresIn:900}),ce(e,l.signal).then(()=>!0))).then(i=>{!i||v()!==t||(c({status:"success"}),ue(e).then(()=>F(!1)).catch(()=>F(!1)).finally(J))}).catch(i=>{v()===t&&c({status:"error",error:W(i)})}).finally(()=>{K()===l&&C(void 0)})}function Q(){S(),b(e=>e+1),c({status:"cancelled"})}function M(e,l){l&&navigator.clipboard.writeText(l).then(()=>{q(e),window.setTimeout(()=>{y()===e&&q("")},1400)}).catch(t=>c({status:"error",error:W(t)}))}function V(){const e=n().url;e&&window.open(e,"_blank","noopener,noreferrer")}return L(()=>{const e=a.query();!e||n().status!=="idle"||x(e)}),L(()=>{const e=n();if(e.status!=="pending")return;A(e.expiresIn??900);const l=window.setInterval(()=>A(t=>Math.max(0,t-1)),1e3);U(()=>window.clearInterval(l))}),L(()=>{n().status==="success"&&a.remember()}),U(()=>{S(),b(e=>e+1)}),(()=>{var e=ye(),l=e.firstChild;return l.firstChild,s(l,r(_,{get when(){return D(()=>!a.query())()&&a.discoverable()},get children(){return r(le,{variant:"fullscreen"})}}),null),s(l,r(_,{get when(){return D(()=>!a.query())()&&!a.discoverable()},get children(){return r(N,{class:"profile-login-card",variant:"warning",get children(){return[he(),ve(),(()=>{var t=me();return O(()=>j(t,"href",R())),t})()]}})}}),null),s(l,r(_,{get when(){return a.query()},get children(){return r(N,{class:"profile-login-card",get children(){return r(oe,{get children(){return[r(g,{get when(){return n().status==="idle"||n().status==="initiating"},get children(){return $e()}}),r(g,{get when(){return n().status==="pending"},get children(){var t=_e(),i=t.firstChild,m=i.firstChild,$=m.nextSibling,p=$.nextSibling,X=p.firstChild,P=i.nextSibling,Y=P.firstChild,B=Y.nextSibling,Z=B.firstChild,E=Z.nextSibling;return E.nextSibling,s(X,()=>n().url),s(p,r(f,{variant:"secondary",type:"button",onClick:()=>M("url",n().url),get children(){return y()==="url"?"Copied":"Copy"}}),null),s(i,r(f,{variant:"primary",type:"button",onClick:V,children:"Open Browser"}),null),s(t,r(_,{get when(){return n().code},children:I=>(()=>{var T=Se(),ee=T.firstChild,te=ee.nextSibling,k=te.nextSibling,z=k.firstChild;return k.$$click=()=>M("code",I()),s(k,I,z),s(z,()=>y()==="code"?"Copied":"Click to copy"),T})()}),P),s(B,()=>xe(G()),E),s(t,r(f,{variant:"ghost",type:"button",onClick:Q,children:"Cancel"}),null),t}}),r(g,{get when(){return n().status==="success"},get children(){return we()}}),r(g,{get when(){return n().status==="error"},get children(){var t=be(),i=t.firstChild,m=i.nextSibling,$=m.nextSibling,p=$.firstChild;return s(m,()=>n().error),s($,r(f,{variant:"primary",type:"button",onClick:()=>x(),children:"Try Again"}),p),O(()=>j(p,"href",R())),t}}),r(g,{get when(){return n().status==="cancelled"},get children(){var t=Ce(),i=t.firstChild;return i.nextSibling,s(t,r(f,{variant:"primary",type:"button",onClick:()=>x(),children:"Start Again"}),null),t}})]}})}})}}),null),e})()}se(["click"]);export{Ke as LoginRoute};
1
+ import{u as re,a as ne,c as ie,d,e as L,o as U,i as s,f as r,t as o,h as se,L as le,m as D,S as _,C as N,g as O,s as j,p as oe,M as g,q as ae,r as ce,l as ue,j as W}from"./index-x2HgICqP.js";import{B as f}from"./button-ZvkAWXQM.js";import{u as pe,g as de,e as F,p as ge,s as fe}from"./profile-CjZNBlVZ.js";var he=o("<strong>Kilo server not found"),ve=o("<p>Start a local Kilo server or pass a server URL with ?server=."),me=o("<a class=profile-link-button>Back to Profile"),$e=o("<div class=profile-login-state><span class=profile-spinner aria-hidden=true></span><strong>Starting login...</strong><p>Preparing a secure browser authorization request."),_e=o("<div class=profile-login-flow><div class=profile-login-step><span>Step 1</span><strong>Open this URL</strong><div class=profile-login-url><span></span></div></div><div class=profile-login-waiting><span class=profile-spinner aria-hidden=true></span><span>Waiting for authorization (<!>)"),we=o('<div class="profile-login-state success"><strong>Login successful</strong><p>Redirecting back to your profile.'),be=o('<div class="profile-login-state error"><strong>Login failed</strong><p></p><div class=profile-login-actions><a class=profile-link-button>Back to Profile'),Ce=o("<div class=profile-login-state><strong>Login cancelled</strong><p>No credentials were saved."),ye=o("<section class=route-empty><div class=profile-login-page><header class=profile-login-header><p class=eyebrow>Kilo Login</p><h1>Login to Kilo</h1><p>Authorize this Kilo Console through the same device auth flow used by the editor clients."),Se=o("<div class=profile-login-step><span>Step 2</span><strong>Enter this code</strong><button type=button class=profile-login-code><small>");function xe(h){const w=Math.floor(h/60),u=h%60;return`${w}:${u.toString().padStart(2,"0")}`}function Ke(){const h=re(),w=ne(),u=ie(()=>new URLSearchParams(h.search)),a=pe(u),[n,c]=d({status:"idle"}),[G,A]=d(900),[v,b]=d(0),[K,C]=d(),[y,q]=d(""),H=()=>fe(u().get("return")),R=()=>ge(u(),"/profile");function S(){K()?.abort(),C(void 0)}function J(){window.setTimeout(()=>w(H(),{replace:!0}),650)}function x(e=a.query()){if(!e)return;S();const l=new AbortController,t=v()+1;b(t),C(l),c({status:"initiating"}),ae(e).then(i=>v()!==t?!1:(c({status:"pending",code:de(i.instructions),url:i.url,expiresIn:900}),ce(e,l.signal).then(()=>!0))).then(i=>{!i||v()!==t||(c({status:"success"}),ue(e).then(()=>F(!1)).catch(()=>F(!1)).finally(J))}).catch(i=>{v()===t&&c({status:"error",error:W(i)})}).finally(()=>{K()===l&&C(void 0)})}function Q(){S(),b(e=>e+1),c({status:"cancelled"})}function M(e,l){l&&navigator.clipboard.writeText(l).then(()=>{q(e),window.setTimeout(()=>{y()===e&&q("")},1400)}).catch(t=>c({status:"error",error:W(t)}))}function V(){const e=n().url;e&&window.open(e,"_blank","noopener,noreferrer")}return L(()=>{const e=a.query();!e||n().status!=="idle"||x(e)}),L(()=>{const e=n();if(e.status!=="pending")return;A(e.expiresIn??900);const l=window.setInterval(()=>A(t=>Math.max(0,t-1)),1e3);U(()=>window.clearInterval(l))}),L(()=>{n().status==="success"&&a.remember()}),U(()=>{S(),b(e=>e+1)}),(()=>{var e=ye(),l=e.firstChild;return l.firstChild,s(l,r(_,{get when(){return D(()=>!a.query())()&&a.discoverable()},get children(){return r(le,{variant:"fullscreen"})}}),null),s(l,r(_,{get when(){return D(()=>!a.query())()&&!a.discoverable()},get children(){return r(N,{class:"profile-login-card",variant:"warning",get children(){return[he(),ve(),(()=>{var t=me();return O(()=>j(t,"href",R())),t})()]}})}}),null),s(l,r(_,{get when(){return a.query()},get children(){return r(N,{class:"profile-login-card",get children(){return r(oe,{get children(){return[r(g,{get when(){return n().status==="idle"||n().status==="initiating"},get children(){return $e()}}),r(g,{get when(){return n().status==="pending"},get children(){var t=_e(),i=t.firstChild,m=i.firstChild,$=m.nextSibling,p=$.nextSibling,X=p.firstChild,P=i.nextSibling,Y=P.firstChild,B=Y.nextSibling,Z=B.firstChild,E=Z.nextSibling;return E.nextSibling,s(X,()=>n().url),s(p,r(f,{variant:"secondary",type:"button",onClick:()=>M("url",n().url),get children(){return y()==="url"?"Copied":"Copy"}}),null),s(i,r(f,{variant:"primary",type:"button",onClick:V,children:"Open Browser"}),null),s(t,r(_,{get when(){return n().code},children:I=>(()=>{var T=Se(),ee=T.firstChild,te=ee.nextSibling,k=te.nextSibling,z=k.firstChild;return k.$$click=()=>M("code",I()),s(k,I,z),s(z,()=>y()==="code"?"Copied":"Click to copy"),T})()}),P),s(B,()=>xe(G()),E),s(t,r(f,{variant:"ghost",type:"button",onClick:Q,children:"Cancel"}),null),t}}),r(g,{get when(){return n().status==="success"},get children(){return we()}}),r(g,{get when(){return n().status==="error"},get children(){var t=be(),i=t.firstChild,m=i.nextSibling,$=m.nextSibling,p=$.firstChild;return s(m,()=>n().error),s($,r(f,{variant:"primary",type:"button",onClick:()=>x(),children:"Try Again"}),p),O(()=>j(p,"href",R())),t}}),r(g,{get when(){return n().status==="cancelled"},get children(){var t=Ce(),i=t.firstChild;return i.nextSibling,s(t,r(f,{variant:"primary",type:"button",onClick:()=>x(),children:"Start Again"}),null),t}})]}})}})}}),null),e})()}se(["click"]);export{Ke as LoginRoute};
@@ -1,4 +1,4 @@
1
- import{d as R,b as Ln,c as z,b8 as Mn,b9 as Pn,ba as Bn,y as re,aa as jn,j as ct,Y as Kn,f as S,h as Dn,w as us,i as $,S as D,F as ve,m as Be,X as hs,g as x,v as It,C as qn,s as ie,t as I}from"./index-BVTco8nF.js";import{B as V}from"./button-1_tdOPlo.js";import{a as Rn,S as Un,b as Xe,f as Fn,e as Vn}from"./ConfigPage-DS5Gh4d6.js";import{C as Jn}from"./ConfirmDialog-DKtlaK4x.js";import{C as ze}from"./CustomSelect-BEJnwQk9.js";import{u as xn}from"./config-D-w9rt1b.js";import"./tag-BzRV52sM.js";const Yt=Symbol.for("yaml.alias"),Rt=Symbol.for("yaml.document"),fe=Symbol.for("yaml.map"),Os=Symbol.for("yaml.pair"),se=Symbol.for("yaml.scalar"),Ee=Symbol.for("yaml.seq"),W=Symbol.for("yaml.node.type"),ye=s=>!!s&&typeof s=="object"&&s[W]===Yt,ft=s=>!!s&&typeof s=="object"&&s[W]===Rt,Ve=s=>!!s&&typeof s=="object"&&s[W]===fe,j=s=>!!s&&typeof s=="object"&&s[W]===Os,E=s=>!!s&&typeof s=="object"&&s[W]===se,Je=s=>!!s&&typeof s=="object"&&s[W]===Ee;function P(s){if(s&&typeof s=="object")switch(s[W]){case fe:case Ee:return!0}return!1}function B(s){if(s&&typeof s=="object")switch(s[W]){case Yt:case fe:case se:case Ee:return!0}return!1}const As=s=>(E(s)||P(s))&&!!s.anchor,he=Symbol("break visit"),Yn=Symbol("skip children"),qe=Symbol("remove node");function Le(s,e){const t=Gn(e);ft(s)?Ne(null,s.contents,t,Object.freeze([s]))===qe&&(s.contents=null):Ne(null,s,t,Object.freeze([]))}Le.BREAK=he;Le.SKIP=Yn;Le.REMOVE=qe;function Ne(s,e,t,n){const i=Hn(s,e,t,n);if(B(i)||j(i))return Qn(s,n,i),Ne(s,i,t,n);if(typeof i!="symbol"){if(P(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const l=Ne(r,e.items[r],t,n);if(typeof l=="number")r=l-1;else{if(l===he)return he;l===qe&&(e.items.splice(r,1),r-=1)}}}else if(j(e)){n=Object.freeze(n.concat(e));const r=Ne("key",e.key,t,n);if(r===he)return he;r===qe&&(e.key=null);const l=Ne("value",e.value,t,n);if(l===he)return he;l===qe&&(e.value=null)}}return i}function Gn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Hn(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(Ve(e))return t.Map?.(s,e,n);if(Je(e))return t.Seq?.(s,e,n);if(j(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(ye(e))return t.Alias?.(s,e,n)}function Qn(s,e,t){const n=e[e.length-1];if(P(n))n.items[s]=t;else if(j(n))s==="key"?n.key=t:n.value=t;else if(ft(n))n.contents=t;else{const i=ye(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Wn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Xn=s=>s.replace(/[!,[\]{}]/g,e=>Wn[e]);class U{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},U.defaultYaml,e),this.tags=Object.assign({},U.defaultTags,t)}clone(){const e=new U(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new U(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:U.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},U.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:U.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},U.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,l]=n;return this.tags[r]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const l=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,l),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const l=e.slice(2,-1);return l==="!"||l==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),l)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(l){return t(String(l)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Xn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&B(e.contents)){const r={};Le(e.contents,(l,o)=>{B(o)&&o.tag&&(r[o.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,l]of n)r==="!!"&&l==="tag:yaml.org,2002:"||(!e||i.some(o=>o.startsWith(l)))&&t.push(`%TAG ${r} ${l}`);return t.join(`
1
+ import{d as R,b as Ln,c as z,b8 as Mn,b9 as Pn,ba as Bn,y as re,aa as jn,j as ct,Y as Kn,f as S,h as Dn,w as us,i as $,S as D,F as ve,m as Be,X as hs,g as x,v as It,C as qn,s as ie,t as I}from"./index-x2HgICqP.js";import{B as V}from"./button-ZvkAWXQM.js";import{a as Rn,S as Un,b as Xe,f as Fn,e as Vn}from"./ConfigPage-fC1SUHN9.js";import{C as Jn}from"./ConfirmDialog-Dw1TQzR8.js";import{C as ze}from"./CustomSelect-CmMA48JB.js";import{u as xn}from"./config-BVVcC0Y1.js";import"./tag-DRpP2l65.js";const Yt=Symbol.for("yaml.alias"),Rt=Symbol.for("yaml.document"),fe=Symbol.for("yaml.map"),Os=Symbol.for("yaml.pair"),se=Symbol.for("yaml.scalar"),Ee=Symbol.for("yaml.seq"),W=Symbol.for("yaml.node.type"),ye=s=>!!s&&typeof s=="object"&&s[W]===Yt,ft=s=>!!s&&typeof s=="object"&&s[W]===Rt,Ve=s=>!!s&&typeof s=="object"&&s[W]===fe,j=s=>!!s&&typeof s=="object"&&s[W]===Os,E=s=>!!s&&typeof s=="object"&&s[W]===se,Je=s=>!!s&&typeof s=="object"&&s[W]===Ee;function P(s){if(s&&typeof s=="object")switch(s[W]){case fe:case Ee:return!0}return!1}function B(s){if(s&&typeof s=="object")switch(s[W]){case Yt:case fe:case se:case Ee:return!0}return!1}const As=s=>(E(s)||P(s))&&!!s.anchor,he=Symbol("break visit"),Yn=Symbol("skip children"),qe=Symbol("remove node");function Le(s,e){const t=Gn(e);ft(s)?Ne(null,s.contents,t,Object.freeze([s]))===qe&&(s.contents=null):Ne(null,s,t,Object.freeze([]))}Le.BREAK=he;Le.SKIP=Yn;Le.REMOVE=qe;function Ne(s,e,t,n){const i=Hn(s,e,t,n);if(B(i)||j(i))return Qn(s,n,i),Ne(s,i,t,n);if(typeof i!="symbol"){if(P(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const l=Ne(r,e.items[r],t,n);if(typeof l=="number")r=l-1;else{if(l===he)return he;l===qe&&(e.items.splice(r,1),r-=1)}}}else if(j(e)){n=Object.freeze(n.concat(e));const r=Ne("key",e.key,t,n);if(r===he)return he;r===qe&&(e.key=null);const l=Ne("value",e.value,t,n);if(l===he)return he;l===qe&&(e.value=null)}}return i}function Gn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Hn(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(Ve(e))return t.Map?.(s,e,n);if(Je(e))return t.Seq?.(s,e,n);if(j(e))return t.Pair?.(s,e,n);if(E(e))return t.Scalar?.(s,e,n);if(ye(e))return t.Alias?.(s,e,n)}function Qn(s,e,t){const n=e[e.length-1];if(P(n))n.items[s]=t;else if(j(n))s==="key"?n.key=t:n.value=t;else if(ft(n))n.contents=t;else{const i=ye(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Wn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Xn=s=>s.replace(/[!,[\]{}]/g,e=>Wn[e]);class U{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},U.defaultYaml,e),this.tags=Object.assign({},U.defaultTags,t)}clone(){const e=new U(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new U(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:U.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},U.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:U.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},U.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,l]=n;return this.tags[r]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const l=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,l),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const l=e.slice(2,-1);return l==="!"||l==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),l)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(l){return t(String(l)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Xn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&B(e.contents)){const r={};Le(e.contents,(l,o)=>{B(o)&&o.tag&&(r[o.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,l]of n)r==="!!"&&l==="tag:yaml.org,2002:"||(!e||i.some(o=>o.startsWith(l)))&&t.push(`%TAG ${r} ${l}`);return t.join(`
2
2
  `)}}U.defaultYaml={explicit:!1,version:"1.2"};U.defaultTags={"!!":"tag:yaml.org,2002:"};function _s(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Ts(s){const e=new Set;return Le(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Is(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function zn(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=Ts(s));const l=Is(e,i);return i.add(l),l},setAnchors:()=>{for(const r of t){const l=n.get(r);if(typeof l=="object"&&l.anchor&&(E(l.node)||P(l.node)))l.node.anchor=l.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=r,o}}},sourceObjects:n}}function Ce(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const l=n[i],o=Ce(s,n,String(i),l);o===void 0?delete n[i]:o!==l&&(n[i]=o)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),l=Ce(s,n,i,r);l===void 0?n.delete(i):l!==r&&n.set(i,l)}else if(n instanceof Set)for(const i of Array.from(n)){const r=Ce(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const l=Ce(s,n,i,r);l===void 0?delete n[i]:l!==r&&(n[i]=l)}return s.call(e,t,n)}function Q(s,e,t){if(Array.isArray(s))return s.map((n,i)=>Q(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!As(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}class Gt{constructor(e){Object.defineProperty(this,W,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!ft(e))throw new TypeError("A document argument is required");const l={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},o=Q(this,"",l);if(typeof i=="function")for(const{count:a,res:c}of l.anchors.values())i(c,a);return typeof r=="function"?Ce(r,{"":o},"",o):o}}class Ht extends Gt{constructor(e){super(Yt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Le(e,{Node:(r,l)=>{(ye(l)||As(l))&&n.push(l)}}),t&&(t.aliasResolveCache=n));let i;for(const r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,l=this.resolve(i,t);if(!l){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}let o=n.get(l);if(o||(Q(l,null,t),o=n.get(l)),o?.res===void 0){const a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=it(i,l,n)),o.count*o.aliasCount>r)){const a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return o.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(_s(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function it(s,e,t){if(ye(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(P(e)){let n=0;for(const i of e.items){const r=it(s,i,t);r>n&&(n=r)}return n}else if(j(e)){const n=it(s,e.key,t),i=it(s,e.value,t);return Math.max(n,i)}return 1}const Es=s=>!s||typeof s!="function"&&typeof s!="object";class _ extends Gt{constructor(e){super(se),this.value=e}toJSON(e,t){return t?.keep?this.value:Q(this.value,e,t)}toString(){return String(this.value)}}_.BLOCK_FOLDED="BLOCK_FOLDED";_.BLOCK_LITERAL="BLOCK_LITERAL";_.PLAIN="PLAIN";_.QUOTE_DOUBLE="QUOTE_DOUBLE";_.QUOTE_SINGLE="QUOTE_SINGLE";const Zn="tag:yaml.org,2002:";function ei(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function Ue(s,e,t){if(ft(s)&&(s=s.contents),B(s))return s;if(j(s)){const f=t.schema[fe].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:l,sourceObjects:o}=t;let a;if(n&&s&&typeof s=="object"){if(a=o.get(s),a)return a.anchor??(a.anchor=i(s)),new Ht(a.anchor);a={anchor:null,node:null},o.set(s,a)}e?.startsWith("!!")&&(e=Zn+e.slice(2));let c=ei(s,e,l.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const f=new _(s);return a&&(a.node=f),f}c=s instanceof Map?l[fe]:Symbol.iterator in Object(s)?l[Ee]:l[fe]}r&&(r(c),delete t.onTagObj);const d=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new _(s);return e?d.tag=e:c.default||(d.tag=c.tag),a&&(a.node=d),d}function ot(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const l=[];l[r]=n,n=l}else n=new Map([[r,n]])}return Ue(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const Ke=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class Ls extends Gt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>B(n)||j(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Ke(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(P(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,ot(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(P(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&E(r)?r.value:r:P(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;const n=t.value;return n==null||e&&E(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return P(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(P(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,ot(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const ti=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function le(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const de=(s,e,t)=>s.endsWith(`
3
3
  `)?le(t,e):t.includes(`
4
4
  `)?`
@@ -1 +1 @@
1
- import{f as r,h as Z,i as l,F as E,S as _,m as D,X as J,Y as Q,g as C,C as W,s as w,v as ee,w as te,Z as le,t as c}from"./index-BVTco8nF.js";import{B}from"./button-1_tdOPlo.js";import{a as X,S as K,b as R}from"./ConfigPage-DS5Gh4d6.js";import{u as Y}from"./models-_6tiNptn.js";/* empty css */import"./tag-BzRV52sM.js";import"./config-D-w9rt1b.js";var re=c("<div class=model-stat><span></span><strong>"),j=c("<small>"),ae=c("<details class=models-select><summary></summary><div class=models-select-menu role=listbox>"),ne=c("<button class=models-select-option type=button role=option>"),ie=c('<div class="resolved-grid model-defaults model-default-fields">'),se=c("<header class=ui-card-header><div><h2>Model visibility</h2><p>Control which Kilo Gateway models appear in model lists."),oe=c("<div class=ui-form><button class=ui-toggle type=button><span><strong>Hide prompt-training models</strong><small>Hide Kilo Gateway models whose providers may use your prompts for training.</small></span><span class=tags>"),de=c("<div class=drawer-scrim>"),ue=c('<aside class=provider-drawer><header class=drawer-header><div><h2></h2><span>Favorites are listed first, then models are sorted alphabetically.</span></div></header><div class="provider-picker model-picker"></div><footer class=drawer-footer>'),ce=c('<article class="resolved-card default-model-card"><header class=default-model-header><span></span><div class="tags default-model-actions"></div></header><div class=default-model-value>'),q=c("<strong>"),ve=c("<span class=default-model-id>"),ge=c("<p class=empty>No models match this filter."),me=c('<button class="provider-option model-option"type=button><span class=model-star aria-hidden=true></span><div><strong></strong><span></span></div><div class=tags>'),he=c('<div class=models-privacy-filter-group><span>Privacy</span><button class=models-privacy-filter type=button aria-label="Hide Kilo Gateway models whose providers may use prompts for training">Hide prompt-training models'),pe=c('<section class=models-filter-card><div class="models-filter-row models-filter-primary"><label class="models-filter-field models-search-field"><span>Search</span><input placeholder="Search by name or ID..."></label><button class=models-favorite-filter type=button><span class=model-star aria-hidden=true></span>Favorites</button></div><div class="models-filter-row models-filter-secondary"><div class=models-context-filter><span>Context max</span><div class=context-range><span class=context-track aria-hidden=true></span><span class=context-fill aria-hidden=true></span><button class=context-max aria-label="Maximum context"aria-valuemin=0 role=slider type=button></button></div><strong class="models-context-value mono"></strong></div><div class=models-capabilities-filter><span>Capabilities</span><div class=models-capabilities-list>'),fe=c('<div class="models explore-models">'),be=c("<span class=config-title-count>Explore models"),$e=c("<button class=models-capability-toggle type=button>"),_e=c("<p class=empty>No models match the current filters."),xe=c('<div class="tags model-capabilities">'),ye=c('<article class="model explore-model-card"><div class=model-main><div class=model-title><button class=model-star type=button></button><div><strong></strong><span></span></div></div><div class="tags model-tags"></div></div><div class=model-info-grid>'),we=c("<p class=model-description>");function G(e){return e===0?"$0.00":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function O(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}K`:String(e)}function Ce(e){const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleDateString(void 0,{year:"numeric",month:"short"})}function Se(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ke(e){const s=e.options?.description;return typeof s=="string"&&s.trim()?s:null}function U(e){const s=[];return e.capabilities.toolcall&&s.push("toolcall"),e.capabilities.attachment&&s.push("attachment"),e.capabilities.temperature&&s.push("temperature"),e.capabilities.input.image&&s.push("vision"),(e.capabilities.input.audio||e.capabilities.output.audio)&&s.push("audio"),s}function N(e){return e>=1e6?5e4:e>=1e5?1e4:1e3}const Le=[{key:"model",label:"Default model"},{key:"small_model",label:"Small model"}];function Me(e,s){return s<=0?0:Math.max(0,Math.min(100,e/s*100))}function Fe(e,s){const m=N(s);return Math.max(0,Math.min(s,Math.round(e/m)*m))}function Re(e,s,m){const i=s.getBoundingClientRect(),t=(e.clientX-i.left)/i.width;return Fe(t*m,m)}function F(e){return(()=>{var s=re(),m=s.firstChild,i=m.nextSibling;return l(m,()=>e.label),l(i,()=>e.value,null),l(i,r(_,{get when(){return e.sub},children:t=>(()=>{var n=j();return l(n,t),n})()}),null),C(()=>i.classList.toggle("mono",!!e.mono)),s})()}const Ee=[{key:"toolcall",label:"toolcall"},{key:"attachment",label:"attachment"},{key:"temperature",label:"temperature"},{key:"input:image",label:"vision"},{key:"input:audio",label:"audio"}];function P(e){const s=()=>e.options.find(t=>t.value===e.value)?.label??e.value;function m(t,n){e.onSelect(t),n.currentTarget.closest("details")?.removeAttribute("open")}function i(t){t.currentTarget.open&&t.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(n=>{n!==t.currentTarget&&n.removeAttribute("open")})}return(()=>{var t=ae(),n=t.firstChild,h=n.nextSibling;return t.addEventListener("toggle",i),l(n,s),l(h,r(E,{get each(){return e.options},children:u=>(()=>{var a=ne();return a.$$click=o=>m(u.value,o),l(a,()=>u.label),C(o=>{var g=u.value===e.value,f=u.value===e.value;return g!==o.e&&a.classList.toggle("selected",o.e=g),f!==o.t&&w(a,"aria-selected",o.t=f),o},{e:void 0,t:void 0}),a})()})),C(u=>{var a=e.label,o=e.label;return a!==u.e&&w(n,"aria-label",u.e=a),o!==u.t&&w(h,"aria-label",u.t=o),u},{e:void 0,t:void 0}),t})()}function Ke(){return r(Ae,{})}function Ae(){const e=Y(),s=()=>e.snap()?.overlay.fields.hide_prompt_training_models,m=()=>s()?.value===!0;return r(_,{get when(){return e.snap()},get children(){return r(X,{title:"Model defaults",description:"The models Kilo uses when an agent or command doesn't pin its own.",get children(){return[(()=>{var i=ie();return l(i,r(E,{each:Le,children:t=>{const n=()=>e.snap()?.overlay.fields[t.key],h=()=>e.item(n()?.value);return(()=>{var u=ce(),a=u.firstChild,o=a.firstChild,g=o.nextSibling,f=a.nextSibling;return l(o,()=>t.label),l(g,r(K,{get source(){return n()?.source},get inherited(){return n()?.inherited},get overridden(){return n()?.overridden}}),null),l(g,r(_,{get when(){return D(()=>e.ctx.query()?.scope==="project")()&&n()?.overridden},get children(){return r(B,{variant:"secondary",get disabled(){return!!e.ctx.saving()},onClick:()=>e.ctx.unset([[t.key]]),children:"Revert"})}}),null),l(g,r(J,{icon:"edit",variant:"ghost",get"aria-label"(){return`Edit ${t.label}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.edit(t.key)}),null),l(f,r(_,{get when(){return h()},get fallback(){return(()=>{var b=q();return l(b,()=>Q(n()?.value)),b})()},children:b=>[(()=>{var v=q();return l(v,()=>`${b().provider.name} / ${b().model.name}`),v})(),(()=>{var v=ve();return l(v,()=>b().id),v})()]})),C(()=>u.classList.toggle("inherited",!!n()?.inherited)),u})()}})),i})(),r(W,{class:"ui-card",padding:0,get children(){return[(()=>{var i=se();return i.firstChild,l(i,r(_,{get when(){return D(()=>e.ctx.query()?.scope==="project")()&&s()?.overridden},get children(){return r(B,{variant:"secondary",get disabled(){return!!e.ctx.saving()},onClick:()=>e.ctx.unset([["hide_prompt_training_models"]]),children:"Revert"})}}),null),i})(),(()=>{var i=oe(),t=i.firstChild,n=t.firstChild,h=n.firstChild;h.nextSibling;var u=n.nextSibling;return t.$$click=()=>e.ctx.save({hide_prompt_training_models:!m()}),l(n,r(_,{get when(){return s()?.reason},children:a=>(()=>{var o=j();return l(o,a),o})()}),null),l(u,r(K,{get source(){return s()?.source},get inherited(){return s()?.inherited},get overridden(){return s()?.overridden}}),null),l(u,r(R,{get tone(){return m()?"success":"neutral"},get children(){return m()?"On":"Off"}}),null),C(a=>{var o=!!m(),g=m(),f=!!e.ctx.saving()||s()?.editable===!1;return o!==a.e&&t.classList.toggle("selected",a.e=o),g!==a.t&&w(t,"aria-pressed",a.t=g),f!==a.a&&(t.disabled=a.a=f),a},{e:void 0,t:void 0,a:void 0}),i})()]}}),r(_,{get when(){return e.mode()!=="closed"},get children(){return[(()=>{var i=de();return ee(i,"click",e.close,!0),i})(),(()=>{var i=ue(),t=i.firstChild,n=t.firstChild,h=n.firstChild,u=t.nextSibling,a=u.nextSibling;return l(h,()=>`Choose ${e.label()}`),l(t,r(B,{variant:"ghost","aria-label":"Close model selector",get onClick(){return e.close},children:"X"}),null),l(i,r(te,{class:"drawer-search",hideLabel:!1,label:"Filter models",get value(){return e.picker()},variant:"drawer",placeholder:"Search by name, provider, or ID",get onValue(){return e.setPicker}}),u),l(u,r(_,{get when(){return e.options().length},get fallback(){return ge()},get children(){return r(E,{get each(){return e.options()},children:o=>(()=>{var g=me(),f=g.firstChild,b=f.nextSibling,v=b.firstChild,p=v.nextSibling,x=b.nextSibling;return g.$$click=()=>e.select(o),l(v,()=>o.model.name),l(p,()=>o.id),l(x,r(R,{get children(){return o.provider.name}}),null),l(x,r(R,{get children(){return o.model.isFree?"free":"paid"}}),null),C($=>{var L=e.choice()===o.id,A=!!e.fav(o);return L!==$.e&&g.classList.toggle("selected",$.e=L),A!==$.t&&f.classList.toggle("active",$.t=A),$},{e:void 0,t:void 0}),g})()})}})),l(a,r(B,{variant:"ghost",get onClick(){return e.close},children:"Cancel"}),null),l(a,r(B,{variant:"primary",get disabled(){return!!e.ctx.saving()||!e.choice()},get onClick(){return e.save},children:"Save"}),null),C(()=>w(i,"aria-label",`${e.label()} selector`)),i})()]}})]}})}})}function qe(){const e=Y();function s(i,t){const n=t.currentTarget.closest(".context-range");if(!(n instanceof HTMLElement))return;t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId);const h=a=>{const o=Re(a,n,e.max());e.setMax(o)},u=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",u)};h(t),window.addEventListener("pointermove",h),window.addEventListener("pointerup",u,{once:!0})}function m(i,t){const n=t.key==="ArrowLeft"?-N(e.max()):t.key==="ArrowRight"?N(e.max()):0;n!==0&&(t.preventDefault(),e.setMax(e.top()+n))}return r(_,{get when(){return e.snap()},get children(){return r(X,{get title(){return(()=>{var i=be();return i.firstChild,l(i,r(R,{get children(){return e.models().length}}),null),i})()},description:"All models exposed by configured providers. Set defaults under Models > Defaults.",get children(){return[(()=>{var i=pe(),t=i.firstChild,n=t.firstChild,h=n.firstChild,u=h.nextSibling,a=n.nextSibling,o=a.firstChild,g=t.nextSibling,f=g.firstChild,b=f.firstChild,v=b.nextSibling,p=v.firstChild,x=p.nextSibling,$=x.nextSibling,L=v.nextSibling,A=f.nextSibling,z=A.firstChild,V=z.nextSibling;return u.$$input=d=>e.setSearch(d.currentTarget.value),l(t,r(P,{label:"Provider",get value(){return e.filter()},get options(){return[{value:"all",label:"All providers"},...e.providers().map(d=>({value:d.id,label:d.name}))]},get onSelect(){return e.setFilter}}),a),l(t,r(P,{label:"Cost",get value(){return e.price()},options:[{value:"all",label:"Any cost"},{value:"free",label:"Free"},{value:"paid",label:"Paid"}],get onSelect(){return e.setPrice}}),a),l(t,r(P,{label:"Reasoning",get value(){return e.reason()},options:[{value:"all",label:"Reasoning · any"},{value:"reasoning",label:"Reasoning · yes"},{value:"standard",label:"Reasoning · no"}],get onSelect(){return e.setReason}}),a),a.$$click=()=>e.setStarred(!e.starred()),$.$$pointerdown=d=>s("max",d),$.$$keydown=d=>m("max",d),l(L,()=>O(e.top())),l(g,r(_,{get when(){return e.gateway()},get children(){var d=he(),k=d.firstChild,y=k.nextSibling;return y.$$click=()=>e.setPrivacy(!e.privacy()),C(S=>{var M=!!e.privacy(),T=e.privacy();return M!==S.e&&y.classList.toggle("selected",S.e=M),T!==S.t&&w(y,"aria-pressed",S.t=T),S},{e:void 0,t:void 0}),d}}),A),l(V,r(E,{each:Ee,children:d=>(()=>{var k=$e();return k.$$click=()=>e.toggle(d.key),l(k,()=>d.label),C(y=>{var S=!!e.caps().includes(d.key),M=e.caps().includes(d.key);return S!==y.e&&k.classList.toggle("selected",y.e=S),M!==y.t&&w(k,"aria-pressed",y.t=M),y},{e:void 0,t:void 0}),k})()})),C(d=>{var k=!!e.starred(),y=e.starred(),S=!!e.starred(),M=`--context-min: 0%; --context-max: ${Me(e.top(),e.max())}%;`,T=e.max(),H=e.top(),I=e.max()===0;return k!==d.e&&a.classList.toggle("selected",d.e=k),y!==d.t&&w(a,"aria-pressed",d.t=y),S!==d.a&&o.classList.toggle("active",d.a=S),d.o=le(v,M,d.o),T!==d.i&&w($,"aria-valuemax",d.i=T),H!==d.n&&w($,"aria-valuenow",d.n=H),I!==d.s&&($.disabled=d.s=I),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),C(()=>u.value=e.search()),i})(),(()=>{var i=fe();return l(i,r(_,{get when(){return e.models().length},get fallback(){return _e()},get children(){return r(E,{get each(){return e.models()},children:t=>(()=>{var n=ye(),h=n.firstChild,u=h.firstChild,a=u.firstChild,o=a.nextSibling,g=o.firstChild,f=g.nextSibling,b=u.nextSibling,v=h.nextSibling;return a.$$click=()=>e.favorite(t),l(g,()=>t.model.name),l(f,()=>t.id),l(b,r(R,{tone:"brand",get children(){return t.provider.id}}),null),l(b,r(R,{get tone(){return t.model.isFree?"success":"neutral"},get children(){return t.model.isFree?"free":"paid"}}),null),l(n,r(_,{get when(){return ke(t.model)},children:p=>(()=>{var x=we();return l(x,p),x})()}),v),l(v,r(F,{label:"Family",get value(){return D(()=>!!t.model.family)()?Se(t.model.family):"Unknown"}}),null),l(v,r(F,{label:"Released",get value(){return D(()=>!!t.model.release_date)()?Ce(t.model.release_date):"Unknown"}}),null),l(v,r(F,{label:"Context",get value(){return O(t.model.limit.context)},mono:!0}),null),l(v,r(F,{label:"Input",get value(){return G(t.model.cost.input)},sub:"/ 1M tok",mono:!0}),null),l(v,r(F,{label:"Output",get value(){return G(t.model.cost.output)},sub:"/ 1M tok",mono:!0}),null),l(v,r(F,{label:"Reasoning",get value(){return t.model.capabilities.reasoning?"Yes":"No"}}),null),l(v,r(F,{label:"Temperature",get value(){return t.model.capabilities.temperature?"Yes":"No"}}),null),l(n,r(_,{get when(){return U(t.model).length},get children(){var p=xe();return l(p,r(E,{get each(){return U(t.model)},children:x=>r(R,{children:x})})),p}}),null),C(p=>{var x=e.fav(t)?"Remove favorite":"Add favorite",$=e.fav(t),L=!!e.fav(t);return x!==p.e&&w(a,"aria-label",p.e=x),$!==p.t&&w(a,"aria-pressed",p.t=$),L!==p.a&&a.classList.toggle("active",p.a=L),p},{e:void 0,t:void 0,a:void 0}),n})()})}})),i})()]}})}})}Z(["click","input","keydown","pointerdown"]);export{qe as ModelsAvailableRoute,Ae as ModelsDefaultRoute,Ke as ModelsRoute};
1
+ import{f as r,h as Z,i as l,F as E,S as _,m as D,X as J,Y as Q,g as C,C as W,s as w,v as ee,w as te,Z as le,t as c}from"./index-x2HgICqP.js";import{B}from"./button-ZvkAWXQM.js";import{a as X,S as K,b as R}from"./ConfigPage-fC1SUHN9.js";import{u as Y}from"./models-Rv8gyojT.js";/* empty css */import"./tag-DRpP2l65.js";import"./config-BVVcC0Y1.js";var re=c("<div class=model-stat><span></span><strong>"),j=c("<small>"),ae=c("<details class=models-select><summary></summary><div class=models-select-menu role=listbox>"),ne=c("<button class=models-select-option type=button role=option>"),ie=c('<div class="resolved-grid model-defaults model-default-fields">'),se=c("<header class=ui-card-header><div><h2>Model visibility</h2><p>Control which Kilo Gateway models appear in model lists."),oe=c("<div class=ui-form><button class=ui-toggle type=button><span><strong>Hide prompt-training models</strong><small>Hide Kilo Gateway models whose providers may use your prompts for training.</small></span><span class=tags>"),de=c("<div class=drawer-scrim>"),ue=c('<aside class=provider-drawer><header class=drawer-header><div><h2></h2><span>Favorites are listed first, then models are sorted alphabetically.</span></div></header><div class="provider-picker model-picker"></div><footer class=drawer-footer>'),ce=c('<article class="resolved-card default-model-card"><header class=default-model-header><span></span><div class="tags default-model-actions"></div></header><div class=default-model-value>'),q=c("<strong>"),ve=c("<span class=default-model-id>"),ge=c("<p class=empty>No models match this filter."),me=c('<button class="provider-option model-option"type=button><span class=model-star aria-hidden=true></span><div><strong></strong><span></span></div><div class=tags>'),he=c('<div class=models-privacy-filter-group><span>Privacy</span><button class=models-privacy-filter type=button aria-label="Hide Kilo Gateway models whose providers may use prompts for training">Hide prompt-training models'),pe=c('<section class=models-filter-card><div class="models-filter-row models-filter-primary"><label class="models-filter-field models-search-field"><span>Search</span><input placeholder="Search by name or ID..."></label><button class=models-favorite-filter type=button><span class=model-star aria-hidden=true></span>Favorites</button></div><div class="models-filter-row models-filter-secondary"><div class=models-context-filter><span>Context max</span><div class=context-range><span class=context-track aria-hidden=true></span><span class=context-fill aria-hidden=true></span><button class=context-max aria-label="Maximum context"aria-valuemin=0 role=slider type=button></button></div><strong class="models-context-value mono"></strong></div><div class=models-capabilities-filter><span>Capabilities</span><div class=models-capabilities-list>'),fe=c('<div class="models explore-models">'),be=c("<span class=config-title-count>Explore models"),$e=c("<button class=models-capability-toggle type=button>"),_e=c("<p class=empty>No models match the current filters."),xe=c('<div class="tags model-capabilities">'),ye=c('<article class="model explore-model-card"><div class=model-main><div class=model-title><button class=model-star type=button></button><div><strong></strong><span></span></div></div><div class="tags model-tags"></div></div><div class=model-info-grid>'),we=c("<p class=model-description>");function G(e){return e===0?"$0.00":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function O(e){return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}K`:String(e)}function Ce(e){const s=new Date(e);return isNaN(s.getTime())?e:s.toLocaleDateString(void 0,{year:"numeric",month:"short"})}function Se(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ke(e){const s=e.options?.description;return typeof s=="string"&&s.trim()?s:null}function U(e){const s=[];return e.capabilities.toolcall&&s.push("toolcall"),e.capabilities.attachment&&s.push("attachment"),e.capabilities.temperature&&s.push("temperature"),e.capabilities.input.image&&s.push("vision"),(e.capabilities.input.audio||e.capabilities.output.audio)&&s.push("audio"),s}function N(e){return e>=1e6?5e4:e>=1e5?1e4:1e3}const Le=[{key:"model",label:"Default model"},{key:"small_model",label:"Small model"}];function Me(e,s){return s<=0?0:Math.max(0,Math.min(100,e/s*100))}function Fe(e,s){const m=N(s);return Math.max(0,Math.min(s,Math.round(e/m)*m))}function Re(e,s,m){const i=s.getBoundingClientRect(),t=(e.clientX-i.left)/i.width;return Fe(t*m,m)}function F(e){return(()=>{var s=re(),m=s.firstChild,i=m.nextSibling;return l(m,()=>e.label),l(i,()=>e.value,null),l(i,r(_,{get when(){return e.sub},children:t=>(()=>{var n=j();return l(n,t),n})()}),null),C(()=>i.classList.toggle("mono",!!e.mono)),s})()}const Ee=[{key:"toolcall",label:"toolcall"},{key:"attachment",label:"attachment"},{key:"temperature",label:"temperature"},{key:"input:image",label:"vision"},{key:"input:audio",label:"audio"}];function P(e){const s=()=>e.options.find(t=>t.value===e.value)?.label??e.value;function m(t,n){e.onSelect(t),n.currentTarget.closest("details")?.removeAttribute("open")}function i(t){t.currentTarget.open&&t.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(n=>{n!==t.currentTarget&&n.removeAttribute("open")})}return(()=>{var t=ae(),n=t.firstChild,h=n.nextSibling;return t.addEventListener("toggle",i),l(n,s),l(h,r(E,{get each(){return e.options},children:u=>(()=>{var a=ne();return a.$$click=o=>m(u.value,o),l(a,()=>u.label),C(o=>{var g=u.value===e.value,f=u.value===e.value;return g!==o.e&&a.classList.toggle("selected",o.e=g),f!==o.t&&w(a,"aria-selected",o.t=f),o},{e:void 0,t:void 0}),a})()})),C(u=>{var a=e.label,o=e.label;return a!==u.e&&w(n,"aria-label",u.e=a),o!==u.t&&w(h,"aria-label",u.t=o),u},{e:void 0,t:void 0}),t})()}function Ke(){return r(Ae,{})}function Ae(){const e=Y(),s=()=>e.snap()?.overlay.fields.hide_prompt_training_models,m=()=>s()?.value===!0;return r(_,{get when(){return e.snap()},get children(){return r(X,{title:"Model defaults",description:"The models Kilo uses when an agent or command doesn't pin its own.",get children(){return[(()=>{var i=ie();return l(i,r(E,{each:Le,children:t=>{const n=()=>e.snap()?.overlay.fields[t.key],h=()=>e.item(n()?.value);return(()=>{var u=ce(),a=u.firstChild,o=a.firstChild,g=o.nextSibling,f=a.nextSibling;return l(o,()=>t.label),l(g,r(K,{get source(){return n()?.source},get inherited(){return n()?.inherited},get overridden(){return n()?.overridden}}),null),l(g,r(_,{get when(){return D(()=>e.ctx.query()?.scope==="project")()&&n()?.overridden},get children(){return r(B,{variant:"secondary",get disabled(){return!!e.ctx.saving()},onClick:()=>e.ctx.unset([[t.key]]),children:"Revert"})}}),null),l(g,r(J,{icon:"edit",variant:"ghost",get"aria-label"(){return`Edit ${t.label}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.edit(t.key)}),null),l(f,r(_,{get when(){return h()},get fallback(){return(()=>{var b=q();return l(b,()=>Q(n()?.value)),b})()},children:b=>[(()=>{var v=q();return l(v,()=>`${b().provider.name} / ${b().model.name}`),v})(),(()=>{var v=ve();return l(v,()=>b().id),v})()]})),C(()=>u.classList.toggle("inherited",!!n()?.inherited)),u})()}})),i})(),r(W,{class:"ui-card",padding:0,get children(){return[(()=>{var i=se();return i.firstChild,l(i,r(_,{get when(){return D(()=>e.ctx.query()?.scope==="project")()&&s()?.overridden},get children(){return r(B,{variant:"secondary",get disabled(){return!!e.ctx.saving()},onClick:()=>e.ctx.unset([["hide_prompt_training_models"]]),children:"Revert"})}}),null),i})(),(()=>{var i=oe(),t=i.firstChild,n=t.firstChild,h=n.firstChild;h.nextSibling;var u=n.nextSibling;return t.$$click=()=>e.ctx.save({hide_prompt_training_models:!m()}),l(n,r(_,{get when(){return s()?.reason},children:a=>(()=>{var o=j();return l(o,a),o})()}),null),l(u,r(K,{get source(){return s()?.source},get inherited(){return s()?.inherited},get overridden(){return s()?.overridden}}),null),l(u,r(R,{get tone(){return m()?"success":"neutral"},get children(){return m()?"On":"Off"}}),null),C(a=>{var o=!!m(),g=m(),f=!!e.ctx.saving()||s()?.editable===!1;return o!==a.e&&t.classList.toggle("selected",a.e=o),g!==a.t&&w(t,"aria-pressed",a.t=g),f!==a.a&&(t.disabled=a.a=f),a},{e:void 0,t:void 0,a:void 0}),i})()]}}),r(_,{get when(){return e.mode()!=="closed"},get children(){return[(()=>{var i=de();return ee(i,"click",e.close,!0),i})(),(()=>{var i=ue(),t=i.firstChild,n=t.firstChild,h=n.firstChild,u=t.nextSibling,a=u.nextSibling;return l(h,()=>`Choose ${e.label()}`),l(t,r(B,{variant:"ghost","aria-label":"Close model selector",get onClick(){return e.close},children:"X"}),null),l(i,r(te,{class:"drawer-search",hideLabel:!1,label:"Filter models",get value(){return e.picker()},variant:"drawer",placeholder:"Search by name, provider, or ID",get onValue(){return e.setPicker}}),u),l(u,r(_,{get when(){return e.options().length},get fallback(){return ge()},get children(){return r(E,{get each(){return e.options()},children:o=>(()=>{var g=me(),f=g.firstChild,b=f.nextSibling,v=b.firstChild,p=v.nextSibling,x=b.nextSibling;return g.$$click=()=>e.select(o),l(v,()=>o.model.name),l(p,()=>o.id),l(x,r(R,{get children(){return o.provider.name}}),null),l(x,r(R,{get children(){return o.model.isFree?"free":"paid"}}),null),C($=>{var L=e.choice()===o.id,A=!!e.fav(o);return L!==$.e&&g.classList.toggle("selected",$.e=L),A!==$.t&&f.classList.toggle("active",$.t=A),$},{e:void 0,t:void 0}),g})()})}})),l(a,r(B,{variant:"ghost",get onClick(){return e.close},children:"Cancel"}),null),l(a,r(B,{variant:"primary",get disabled(){return!!e.ctx.saving()||!e.choice()},get onClick(){return e.save},children:"Save"}),null),C(()=>w(i,"aria-label",`${e.label()} selector`)),i})()]}})]}})}})}function qe(){const e=Y();function s(i,t){const n=t.currentTarget.closest(".context-range");if(!(n instanceof HTMLElement))return;t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId);const h=a=>{const o=Re(a,n,e.max());e.setMax(o)},u=()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",u)};h(t),window.addEventListener("pointermove",h),window.addEventListener("pointerup",u,{once:!0})}function m(i,t){const n=t.key==="ArrowLeft"?-N(e.max()):t.key==="ArrowRight"?N(e.max()):0;n!==0&&(t.preventDefault(),e.setMax(e.top()+n))}return r(_,{get when(){return e.snap()},get children(){return r(X,{get title(){return(()=>{var i=be();return i.firstChild,l(i,r(R,{get children(){return e.models().length}}),null),i})()},description:"All models exposed by configured providers. Set defaults under Models > Defaults.",get children(){return[(()=>{var i=pe(),t=i.firstChild,n=t.firstChild,h=n.firstChild,u=h.nextSibling,a=n.nextSibling,o=a.firstChild,g=t.nextSibling,f=g.firstChild,b=f.firstChild,v=b.nextSibling,p=v.firstChild,x=p.nextSibling,$=x.nextSibling,L=v.nextSibling,A=f.nextSibling,z=A.firstChild,V=z.nextSibling;return u.$$input=d=>e.setSearch(d.currentTarget.value),l(t,r(P,{label:"Provider",get value(){return e.filter()},get options(){return[{value:"all",label:"All providers"},...e.providers().map(d=>({value:d.id,label:d.name}))]},get onSelect(){return e.setFilter}}),a),l(t,r(P,{label:"Cost",get value(){return e.price()},options:[{value:"all",label:"Any cost"},{value:"free",label:"Free"},{value:"paid",label:"Paid"}],get onSelect(){return e.setPrice}}),a),l(t,r(P,{label:"Reasoning",get value(){return e.reason()},options:[{value:"all",label:"Reasoning · any"},{value:"reasoning",label:"Reasoning · yes"},{value:"standard",label:"Reasoning · no"}],get onSelect(){return e.setReason}}),a),a.$$click=()=>e.setStarred(!e.starred()),$.$$pointerdown=d=>s("max",d),$.$$keydown=d=>m("max",d),l(L,()=>O(e.top())),l(g,r(_,{get when(){return e.gateway()},get children(){var d=he(),k=d.firstChild,y=k.nextSibling;return y.$$click=()=>e.setPrivacy(!e.privacy()),C(S=>{var M=!!e.privacy(),T=e.privacy();return M!==S.e&&y.classList.toggle("selected",S.e=M),T!==S.t&&w(y,"aria-pressed",S.t=T),S},{e:void 0,t:void 0}),d}}),A),l(V,r(E,{each:Ee,children:d=>(()=>{var k=$e();return k.$$click=()=>e.toggle(d.key),l(k,()=>d.label),C(y=>{var S=!!e.caps().includes(d.key),M=e.caps().includes(d.key);return S!==y.e&&k.classList.toggle("selected",y.e=S),M!==y.t&&w(k,"aria-pressed",y.t=M),y},{e:void 0,t:void 0}),k})()})),C(d=>{var k=!!e.starred(),y=e.starred(),S=!!e.starred(),M=`--context-min: 0%; --context-max: ${Me(e.top(),e.max())}%;`,T=e.max(),H=e.top(),I=e.max()===0;return k!==d.e&&a.classList.toggle("selected",d.e=k),y!==d.t&&w(a,"aria-pressed",d.t=y),S!==d.a&&o.classList.toggle("active",d.a=S),d.o=le(v,M,d.o),T!==d.i&&w($,"aria-valuemax",d.i=T),H!==d.n&&w($,"aria-valuenow",d.n=H),I!==d.s&&($.disabled=d.s=I),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),C(()=>u.value=e.search()),i})(),(()=>{var i=fe();return l(i,r(_,{get when(){return e.models().length},get fallback(){return _e()},get children(){return r(E,{get each(){return e.models()},children:t=>(()=>{var n=ye(),h=n.firstChild,u=h.firstChild,a=u.firstChild,o=a.nextSibling,g=o.firstChild,f=g.nextSibling,b=u.nextSibling,v=h.nextSibling;return a.$$click=()=>e.favorite(t),l(g,()=>t.model.name),l(f,()=>t.id),l(b,r(R,{tone:"brand",get children(){return t.provider.id}}),null),l(b,r(R,{get tone(){return t.model.isFree?"success":"neutral"},get children(){return t.model.isFree?"free":"paid"}}),null),l(n,r(_,{get when(){return ke(t.model)},children:p=>(()=>{var x=we();return l(x,p),x})()}),v),l(v,r(F,{label:"Family",get value(){return D(()=>!!t.model.family)()?Se(t.model.family):"Unknown"}}),null),l(v,r(F,{label:"Released",get value(){return D(()=>!!t.model.release_date)()?Ce(t.model.release_date):"Unknown"}}),null),l(v,r(F,{label:"Context",get value(){return O(t.model.limit.context)},mono:!0}),null),l(v,r(F,{label:"Input",get value(){return G(t.model.cost.input)},sub:"/ 1M tok",mono:!0}),null),l(v,r(F,{label:"Output",get value(){return G(t.model.cost.output)},sub:"/ 1M tok",mono:!0}),null),l(v,r(F,{label:"Reasoning",get value(){return t.model.capabilities.reasoning?"Yes":"No"}}),null),l(v,r(F,{label:"Temperature",get value(){return t.model.capabilities.temperature?"Yes":"No"}}),null),l(n,r(_,{get when(){return U(t.model).length},get children(){var p=xe();return l(p,r(E,{get each(){return U(t.model)},children:x=>r(R,{children:x})})),p}}),null),C(p=>{var x=e.fav(t)?"Remove favorite":"Add favorite",$=e.fav(t),L=!!e.fav(t);return x!==p.e&&w(a,"aria-label",p.e=x),$!==p.t&&w(a,"aria-pressed",p.t=$),L!==p.a&&a.classList.toggle("active",p.a=L),p},{e:void 0,t:void 0,a:void 0}),n})()})}})),i})()]}})}})}Z(["click","input","keydown","pointerdown"]);export{qe as ModelsAvailableRoute,Ae as ModelsDefaultRoute,Ke as ModelsRoute};
@@ -1 +1 @@
1
- import{V as B,f as a,S as b,i as r,g as S,s as p,F as y,C as P,Y as $,$ as w,t as n,U as D}from"./index-BVTco8nF.js";import{a as E,g as L,B as O,f as k}from"./ConfigPage-DS5Gh4d6.js";import{u as F}from"./config-D-w9rt1b.js";import"./tag-BzRV52sM.js";var G=n('<section class=server-strip aria-label="Server status"><div class=server-strip-info><span>Server</span><strong class=mono></strong><span class=server-strip-separator aria-hidden=true></span><span>Version</span><strong class=mono></strong></div><span class=server-strip-state>'),z=n('<section class=metrics aria-label="Configuration metrics">'),I=n("<div class=title><div><h2>Diagnostics</h2><p>Where the dashboard is talking to."),M=n("<dl class=facts>"),N=n("<section class=overview-details>"),T=n("<em>effective"),W=n("<div class=overview-banner>"),Y=n("<span class=overview-heading>Overview"),H=n("<span>"),J=n("<strong>"),K=n("<div><dt></dt><dd>");function Q(f){return f.split(/[\\/]/).filter(Boolean).at(-1)??"Project"}function te(){const f=F(),C=B();return a(b,{get when(){return f.data()},children:i=>a(b,{get when(){return f.query()},children:v=>{const m=()=>i().effective,g=()=>v().scope==="project",_=()=>{if(!g())return"Global";const e=v().dir;return e?D(Q(e)):D(decodeURIComponent(C.project??"Project"))},U=()=>g()?`Effective configuration for ${_()}. Values inherited from global are marked.`:"Effective global configuration. Applies to all projects unless overridden.",A=()=>i().health.healthy?"healthy":"unhealthy",R=()=>[{label:"Default model",value:$(m().model),mono:!0},{label:"Small model",value:$(m().small_model),mono:!0},{label:"Default agent",value:$(m().default_agent),mono:!0},{label:"Providers",value:String(i().providers.all.length)},{label:"Agents",value:String(w(m().agent))},{label:"MCP servers",value:String(w(m().mcp))}],V=()=>[{term:"Scope",value:g()?`Project / ${_()}`:"Global"},{term:"Server URL",value:v().url,mono:!0},{term:"Server version",value:i().health.version,mono:!0},{term:"Config directory",value:v().dir||"Server default",mono:!!v().dir},{term:"Active project",value:g()?_():"None",mono:g()},{term:"Default model",value:$(m().model),mono:!0}];return a(E,{get title(){return(()=>{var e=Y();return e.firstChild,r(e,a(k,{get status(){return A()}}),null),e})()},get description(){return U()},get children(){return[(()=>{var e=G(),s=e.firstChild,t=s.firstChild,l=t.nextSibling,d=l.nextSibling,o=d.nextSibling,u=o.nextSibling,h=s.nextSibling;return r(l,()=>v().url),r(u,()=>i().health.version),r(h,a(L,{get tone(){return i().health.healthy?"success":"critical"}}),null),r(h,()=>i().health.healthy?"Online":"Unavailable",null),S(c=>{var j=v().url,x=i().health.version;return j!==c.e&&p(l,"title",c.e=j),x!==c.t&&p(u,"title",c.t=x),c},{e:void 0,t:void 0}),e})(),(()=>{var e=z();return r(e,a(y,{get each(){return R()},children:s=>a(P,{class:"metric",padding:12,get children(){return[(()=>{var t=H();return r(t,()=>s.label),t})(),(()=>{var t=J();return r(t,()=>s.value),S(l=>{var d=!!s.mono,o=s.value;return d!==l.e&&t.classList.toggle("mono",l.e=d),o!==l.t&&p(t,"title",l.t=o),l},{e:void 0,t:void 0}),t})()]}})})),e})(),(()=>{var e=N();return r(e,a(P,{class:"panel",padding:0,get children(){return[I(),(()=>{var s=M();return r(s,a(y,{get each(){return V()},children:t=>(()=>{var l=K(),d=l.firstChild,o=d.nextSibling;return r(d,()=>t.term),r(o,()=>t.value),S(u=>{var h=!!t.mono,c=t.value;return h!==u.e&&o.classList.toggle("mono",u.e=h),c!==u.t&&p(o,"title",u.t=c),u},{e:void 0,t:void 0}),l})()})),s})()]}})),e})(),a(b,{get when(){return g()},get children(){var e=W();return r(e,a(O,{tone:"info",get children(){return["Values shown here are ",T()," for this project. Use the section pages to see where each value comes from."]}})),e}})]}})}})})}export{te as OverviewRoute};
1
+ import{V as B,f as a,S as b,i as r,g as S,s as p,F as y,C as P,Y as $,$ as w,t as n,U as D}from"./index-x2HgICqP.js";import{a as E,g as L,B as O,f as k}from"./ConfigPage-fC1SUHN9.js";import{u as F}from"./config-BVVcC0Y1.js";import"./tag-DRpP2l65.js";var G=n('<section class=server-strip aria-label="Server status"><div class=server-strip-info><span>Server</span><strong class=mono></strong><span class=server-strip-separator aria-hidden=true></span><span>Version</span><strong class=mono></strong></div><span class=server-strip-state>'),z=n('<section class=metrics aria-label="Configuration metrics">'),I=n("<div class=title><div><h2>Diagnostics</h2><p>Where the dashboard is talking to."),M=n("<dl class=facts>"),N=n("<section class=overview-details>"),T=n("<em>effective"),W=n("<div class=overview-banner>"),Y=n("<span class=overview-heading>Overview"),H=n("<span>"),J=n("<strong>"),K=n("<div><dt></dt><dd>");function Q(f){return f.split(/[\\/]/).filter(Boolean).at(-1)??"Project"}function te(){const f=F(),C=B();return a(b,{get when(){return f.data()},children:i=>a(b,{get when(){return f.query()},children:v=>{const m=()=>i().effective,g=()=>v().scope==="project",_=()=>{if(!g())return"Global";const e=v().dir;return e?D(Q(e)):D(decodeURIComponent(C.project??"Project"))},U=()=>g()?`Effective configuration for ${_()}. Values inherited from global are marked.`:"Effective global configuration. Applies to all projects unless overridden.",A=()=>i().health.healthy?"healthy":"unhealthy",R=()=>[{label:"Default model",value:$(m().model),mono:!0},{label:"Small model",value:$(m().small_model),mono:!0},{label:"Default agent",value:$(m().default_agent),mono:!0},{label:"Providers",value:String(i().providers.all.length)},{label:"Agents",value:String(w(m().agent))},{label:"MCP servers",value:String(w(m().mcp))}],V=()=>[{term:"Scope",value:g()?`Project / ${_()}`:"Global"},{term:"Server URL",value:v().url,mono:!0},{term:"Server version",value:i().health.version,mono:!0},{term:"Config directory",value:v().dir||"Server default",mono:!!v().dir},{term:"Active project",value:g()?_():"None",mono:g()},{term:"Default model",value:$(m().model),mono:!0}];return a(E,{get title(){return(()=>{var e=Y();return e.firstChild,r(e,a(k,{get status(){return A()}}),null),e})()},get description(){return U()},get children(){return[(()=>{var e=G(),s=e.firstChild,t=s.firstChild,l=t.nextSibling,d=l.nextSibling,o=d.nextSibling,u=o.nextSibling,h=s.nextSibling;return r(l,()=>v().url),r(u,()=>i().health.version),r(h,a(L,{get tone(){return i().health.healthy?"success":"critical"}}),null),r(h,()=>i().health.healthy?"Online":"Unavailable",null),S(c=>{var j=v().url,x=i().health.version;return j!==c.e&&p(l,"title",c.e=j),x!==c.t&&p(u,"title",c.t=x),c},{e:void 0,t:void 0}),e})(),(()=>{var e=z();return r(e,a(y,{get each(){return R()},children:s=>a(P,{class:"metric",padding:12,get children(){return[(()=>{var t=H();return r(t,()=>s.label),t})(),(()=>{var t=J();return r(t,()=>s.value),S(l=>{var d=!!s.mono,o=s.value;return d!==l.e&&t.classList.toggle("mono",l.e=d),o!==l.t&&p(t,"title",l.t=o),l},{e:void 0,t:void 0}),t})()]}})})),e})(),(()=>{var e=N();return r(e,a(P,{class:"panel",padding:0,get children(){return[I(),(()=>{var s=M();return r(s,a(y,{get each(){return V()},children:t=>(()=>{var l=K(),d=l.firstChild,o=d.nextSibling;return r(d,()=>t.term),r(o,()=>t.value),S(u=>{var h=!!t.mono,c=t.value;return h!==u.e&&o.classList.toggle("mono",u.e=h),c!==u.t&&p(o,"title",u.t=c),u},{e:void 0,t:void 0}),l})()})),s})()]}})),e})(),a(b,{get when(){return g()},get children(){var e=W();return r(e,a(O,{tone:"info",get children(){return["Values shown here are ",T()," for this project. Use the section pages to see where each value comes from."]}})),e}})]}})}})})}export{te as OverviewRoute};
@@ -1 +1 @@
1
- import{d as A,c as y,y as Z,i as s,f as n,g as P,t as m,h as ee,s as _,F as w,S as B,X as G,E as te,v as re}from"./index-BVTco8nF.js";import{B as D}from"./button-1_tdOPlo.js";import{b as ne,S as L,e as M,c as R,d as I,a as ie}from"./ConfigPage-DS5Gh4d6.js";import{u as se}from"./config-D-w9rt1b.js";const N=[{value:"ask",label:"Ask"},{value:"allow",label:"Allow"},{value:"deny",label:"Deny"}],C=[{id:"external_directory",title:"External Directory",description:"Access files outside the project directory.",noun:"path",placeholder:"e.g. ~/Downloads/**"},{id:"bash",title:"Bash",description:"Run shell commands.",noun:"command",placeholder:"e.g. git status or npm *"},{id:"read",title:"Read",description:"Read files by matching file paths.",noun:"path",placeholder:"e.g. **/*.env"},{id:"edit",title:"Edit",description:"Modify files, including writes, patches, and multi-edits.",noun:"path",placeholder:"e.g. src/**/*.ts"}],X=[{id:"glob",title:"Glob",description:"Match files using glob patterns."},{id:"grep",title:"Grep",description:"Search file contents using regular expressions."},{id:"list",title:"List",description:"List files within a directory."},{id:"task",title:"Task",description:"Launch sub-agents."},{id:"skill",title:"Skill",description:"Load a skill by name."},{id:"lsp",title:"LSP",description:"Run language server queries."},{id:"todowrite",title:"Todo Write",description:"Update the todo list."},{id:"question",title:"Question",description:"Ask the user a question."},{id:"webfetch",title:"Web Fetch",description:"Fetch content from a URL."},{id:"websearch",title:"Web Search",description:"Search the web."},{id:"doom_loop",title:"Doom Loop",description:"Detect repeated tool calls with identical input."},{id:"agent_manager",title:"Agent Manager",description:"Manage Agent Manager operations."}],le=[...C,...X],ae=new Set(C.map(e=>e.id)),oe=new Set(le.map(e=>e.id));function q(e,r="ask"){return e==="ask"||e==="allow"||e==="deny"?e:r}function T(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function z(e){return T(e.effective.permission)}function F(e,r){return e.overlay.collections.permission?.find(i=>i.key===r)}function K(e,r){return typeof e.effective.permission=="string"?e.effective.permission:z(e)[r]}function Q(e){return q(e.effective.permission)}function ce(e,r){return e?r==="*"&&typeof e.value=="string"?e.path:[...e.path,r]:["permission",r]}function S(e,r,i,o){if(!(i!=="ask"&&i!=="allow"&&i!=="deny"))return{tool:e,pattern:r,action:i,source:o?.source??"default",inherited:o?.inherited??!1,overridden:o?.overridden??!1,path:o?ce(o,r):["permission",e,r]}}function de(e){const r=e.value;if(r&&typeof r=="object"&&!Array.isArray(r))return Object.entries(r).flatMap(([o,t])=>S(e.key,o,t,e)??[]);const i=S(e.key,"*",r,e);return i?[i]:[]}function ue(e,r,i){const o=T(r);if(Object.keys(o).length)return Object.entries(o).flatMap(([l,c])=>S(e,l,c,i)??[]);const t=S(e,"*",r,i);return t?[t]:[]}function ge(e,r){const i=F(e,r.id),o=K(e,r.id),t=T(o),l=Q(e);return{...r,action:q(typeof o=="string"?o:t["*"],l),source:i?.source??"default",inherited:i?.inherited??!1,overridden:i?.overridden??!1}}function fe(e,r){const i=F(e,r.id),o=K(e,r.id),t=T(o),l=Q(e);return{...r,action:q(typeof o=="string"?o:t["*"],l),source:i?.source??"default",inherited:i?.inherited??!1,overridden:i?.overridden??!1,rules:Object.entries(t).filter(([c])=>c!=="*").flatMap(([c,a])=>S(r.id,c,a,i)??[])}}function he(){const e=se(),r=()=>e.data(),[i,o]=A("closed"),[t,l]=A("external_directory"),[c,a]=A(""),[d,u]=A("ask"),p=y(()=>(r()?.overlay.collections.permission??[]).flatMap(de)),v=y(()=>{const g=r();return g?C.map(f=>fe(g,f)):[]}),k=y(()=>{const g=r();return g?X.map(f=>ge(g,f)):[]}),h=y(()=>{const g=r();return g?Object.entries(z(g)).filter(([f])=>!oe.has(f)).flatMap(([f,b])=>ue(f,b,F(g,f))).sort((f,b)=>f.tool.localeCompare(b.tool)||f.pattern.localeCompare(b.pattern)):[]}),$=y(()=>C.find(g=>g.id===t())??C[0]);function x(g){l(g),a(""),u("ask"),o("rule")}function W(){o("closed")}function J(){const g=r(),f=Z(c());if(!g||!f){e.fail(`Enter a ${$().noun} pattern before saving.`);return}const b={[t()]:{[f]:d()}};e.save({permission:b}),W()}function V(g,f){const b=ae.has(g)?{[g]:{"*":f}}:{[g]:f};e.save({permission:b})}function Y(g){e.unset([g.path])}return{ctx:e,mode:i,kind:t,pattern:c,setPattern:a,action:d,setAction:u,rules:p,groups:v,settings:k,other:h,selected:$,open:x,close:W,add:J,setDefault:V,remove:Y}}var E=m("<div class=permission-row-meta>"),pe=m('<details class="models-select permission-select"><summary></summary><div class=models-select-menu role=listbox>'),ve=m("<button class=models-select-option type=button role=option>"),me=m("<section class=permission-group><div class=permission-rules>"),be=m("<div class=permissions><section class=permission-group><div class=permission-rules>"),$e=m("<div class=drawer-scrim>"),_e=m('<aside class="provider-drawer permission-drawer"aria-label="Permission rule configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form permission-form"><label class="required-field wide"><input></label><label class="required-field wide">Method</label></div><footer class=drawer-footer>'),ye=m("<span class=config-title-count>Permissions"),we=m("<section class=permission-group><header class=permission-group-header><div class=permission-group-copy><h2></h2><span></span><p></p></div><div class=permission-section-actions></div></header><div class=permission-rules>"),Ce=m("<p class=permission-empty>No specific <!> rules."),Se=m("<span class=permission-pattern>"),ke=m("<span class=permission-subtitle><span></span><span class=permission-pattern>");function H(e){return e==="allow"?"success":e==="deny"?"critical":"warning"}function U(e){return N.find(r=>r.value===e)?.label??e}function O(e){return(()=>{var r=E();return s(r,n(ne,{get tone(){return H(e.rule.action)},get children(){return U(e.rule.action)}}),null),s(r,n(L,{get source(){return e.rule.source},get inherited(){return e.rule.inherited},get overridden(){return e.rule.overridden}}),null),r})()}function j(e){const r=()=>U(e.value);function i(t,l){e.disabled||(e.onSelect(t),l.currentTarget.closest("details")?.removeAttribute("open"))}function o(t){if(e.disabled){t.currentTarget.removeAttribute("open");return}t.currentTarget.open&&t.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(l=>{l!==t.currentTarget&&l.removeAttribute("open")})}return(()=>{var t=pe(),l=t.firstChild,c=l.nextSibling;return t.addEventListener("toggle",o),s(l,r),s(c,n(w,{each:N,children:a=>(()=>{var d=ve();return d.$$click=u=>i(a.value,u),s(d,()=>a.label),P(u=>{var p=a.value===e.value,v=a.value===e.value;return p!==u.e&&d.classList.toggle("selected",u.e=p),v!==u.t&&_(d,"aria-selected",u.t=v),u},{e:void 0,t:void 0}),d})()})),P(a=>{var d=!!e.disabled,u=e.label,p=e.disabled,v=e.label;return d!==a.e&&t.classList.toggle("disabled",a.e=d),u!==a.t&&_(l,"aria-label",a.t=u),p!==a.a&&_(l,"aria-disabled",a.a=p),v!==a.o&&_(c,"aria-label",a.o=v),a},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}function xe(){const e=he();return n(ie,{get title(){return(()=>{var r=ye();return r.firstChild,s(r,n(M,{get children(){return e.groups().length+e.settings().length}}),null),r})()},description:"Control what tools agents can use by default and add pattern-specific allow, ask, or deny rules.",get children(){return[(()=>{var r=be(),i=r.firstChild,o=i.firstChild;return s(r,n(w,{get each(){return e.groups()},children:t=>(()=>{var l=we(),c=l.firstChild,a=c.firstChild,d=a.firstChild,u=d.nextSibling,p=u.nextSibling,v=a.nextSibling,k=c.nextSibling;return s(d,()=>t.title),s(u,()=>t.id),s(p,()=>t.description),s(v,n(M,{get children(){return t.rules.length}}),null),s(v,n(D,{icon:"plus",variant:"primary",get disabled(){return!!e.ctx.saving()},onClick:()=>e.open(t.id),children:"Add rule"}),null),s(l,n(R,{title:"Default method",get subtitle(){return`Used for ${t.noun}s that do not match a specific rule.`},get status(){return(()=>{var h=E();return s(h,n(L,{get source(){return t.source},get inherited(){return t.inherited},get overridden(){return t.overridden}})),h})()},get actions(){return n(j,{get label(){return`Default method for ${t.title}`},get value(){return t.action},get disabled(){return!!e.ctx.saving()},onSelect:h=>e.setDefault(t.id,h)})}}),k),s(k,n(B,{get when(){return t.rules.length},get fallback(){return(()=>{var h=Ce(),$=h.firstChild,x=$.nextSibling;return x.nextSibling,s(h,()=>t.noun,x),h})()},get children(){return n(w,{get each(){return t.rules},children:h=>n(R,{get title(){return(()=>{var $=Se();return s($,()=>h.pattern),$})()},get subtitle(){return`${t.title} ${t.noun} rule`},get status(){return n(O,{rule:h})},get actions(){return n(G,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${t.title} rule ${h.pattern}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.remove(h)})}})})}})),l})()}),i),s(i,n(I,{get trailing(){return n(M,{get children(){return e.settings().length}})},description:"Default methods for additional built-in tool permissions.",children:"Tool Defaults"}),o),s(o,n(w,{get each(){return e.settings()},children:t=>n(R,{get title(){return t.title},get subtitle(){return`${t.id} · ${t.description}`},get status(){return(()=>{var l=E();return s(l,n(L,{get source(){return t.source},get inherited(){return t.inherited},get overridden(){return t.overridden}})),l})()},get actions(){return n(j,{get label(){return`Default method for ${t.title}`},get value(){return t.action},get disabled(){return!!e.ctx.saving()},onSelect:l=>e.setDefault(t.id,l)})}})})),s(r,n(B,{get when(){return e.other().length},get children(){var t=me(),l=t.firstChild;return s(t,n(I,{get trailing(){return n(M,{get children(){return e.other().length}})},description:"Additional tool permission rules from config.",children:"Other Permissions"}),l),s(l,n(w,{get each(){return e.other()},children:c=>n(R,{get title(){return te(c.tool)},get subtitle(){return(()=>{var a=ke(),d=a.firstChild,u=d.nextSibling;return s(d,()=>c.tool),s(u,()=>c.pattern),a})()},get status(){return n(O,{rule:c})},get actions(){return n(G,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${c.tool} rule ${c.pattern}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.remove(c)})}})})),t}}),null),r})(),n(B,{get when(){return e.mode()==="rule"},get children(){return[(()=>{var r=$e();return re(r,"click",e.close,!0),r})(),(()=>{var r=_e(),i=r.firstChild,o=i.firstChild,t=o.firstChild,l=t.nextSibling,c=i.nextSibling,a=c.firstChild,d=a.firstChild,u=a.nextSibling;u.firstChild;var p=c.nextSibling;return s(t,()=>`Add ${e.selected().title} Rule`),s(l,()=>`${e.selected().id} · ${e.selected().description}`),s(i,n(D,{variant:"ghost","aria-label":"Close permission rule overlay",get onClick(){return e.close},children:"X"}),null),s(a,()=>e.selected().noun==="command"?"Command pattern":"Path pattern",d),d.$$input=v=>e.setPattern(v.currentTarget.value),_(d,"spellcheck",!1),s(u,n(j,{label:"Rule method",get value(){return e.action()},get disabled(){return!!e.ctx.saving()},get onSelect(){return e.setAction}}),null),s(p,n(D,{variant:"ghost",get onClick(){return e.close},children:"Cancel"}),null),s(p,n(D,{variant:"primary",get disabled(){return!!e.ctx.saving()},get onClick(){return e.add},children:"Save Rule"}),null),P(()=>_(d,"placeholder",e.selected().placeholder)),P(()=>d.value=e.pattern()),r})()]}})]}})}ee(["click","input"]);const je=Object.freeze(Object.defineProperty({__proto__:null,ActionSelect:j,PermissionsRoute:xe,RuleMeta:O,label:U,tone:H},Symbol.toStringTag,{value:"Module"}));export{j as A,je as P,X as a,le as d,U as l,C as r,H as t};
1
+ import{d as A,c as y,y as Z,i as s,f as n,g as P,t as m,h as ee,s as _,F as w,S as B,X as G,E as te,v as re}from"./index-x2HgICqP.js";import{B as D}from"./button-ZvkAWXQM.js";import{b as ne,S as L,e as M,c as R,d as I,a as ie}from"./ConfigPage-fC1SUHN9.js";import{u as se}from"./config-BVVcC0Y1.js";const N=[{value:"ask",label:"Ask"},{value:"allow",label:"Allow"},{value:"deny",label:"Deny"}],C=[{id:"external_directory",title:"External Directory",description:"Access files outside the project directory.",noun:"path",placeholder:"e.g. ~/Downloads/**"},{id:"bash",title:"Bash",description:"Run shell commands.",noun:"command",placeholder:"e.g. git status or npm *"},{id:"read",title:"Read",description:"Read files by matching file paths.",noun:"path",placeholder:"e.g. **/*.env"},{id:"edit",title:"Edit",description:"Modify files, including writes, patches, and multi-edits.",noun:"path",placeholder:"e.g. src/**/*.ts"}],X=[{id:"glob",title:"Glob",description:"Match files using glob patterns."},{id:"grep",title:"Grep",description:"Search file contents using regular expressions."},{id:"list",title:"List",description:"List files within a directory."},{id:"task",title:"Task",description:"Launch sub-agents."},{id:"skill",title:"Skill",description:"Load a skill by name."},{id:"lsp",title:"LSP",description:"Run language server queries."},{id:"todowrite",title:"Todo Write",description:"Update the todo list."},{id:"question",title:"Question",description:"Ask the user a question."},{id:"webfetch",title:"Web Fetch",description:"Fetch content from a URL."},{id:"websearch",title:"Web Search",description:"Search the web."},{id:"doom_loop",title:"Doom Loop",description:"Detect repeated tool calls with identical input."},{id:"agent_manager",title:"Agent Manager",description:"Manage Agent Manager operations."}],le=[...C,...X],ae=new Set(C.map(e=>e.id)),oe=new Set(le.map(e=>e.id));function q(e,r="ask"){return e==="ask"||e==="allow"||e==="deny"?e:r}function T(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function z(e){return T(e.effective.permission)}function F(e,r){return e.overlay.collections.permission?.find(i=>i.key===r)}function K(e,r){return typeof e.effective.permission=="string"?e.effective.permission:z(e)[r]}function Q(e){return q(e.effective.permission)}function ce(e,r){return e?r==="*"&&typeof e.value=="string"?e.path:[...e.path,r]:["permission",r]}function S(e,r,i,o){if(!(i!=="ask"&&i!=="allow"&&i!=="deny"))return{tool:e,pattern:r,action:i,source:o?.source??"default",inherited:o?.inherited??!1,overridden:o?.overridden??!1,path:o?ce(o,r):["permission",e,r]}}function de(e){const r=e.value;if(r&&typeof r=="object"&&!Array.isArray(r))return Object.entries(r).flatMap(([o,t])=>S(e.key,o,t,e)??[]);const i=S(e.key,"*",r,e);return i?[i]:[]}function ue(e,r,i){const o=T(r);if(Object.keys(o).length)return Object.entries(o).flatMap(([l,c])=>S(e,l,c,i)??[]);const t=S(e,"*",r,i);return t?[t]:[]}function ge(e,r){const i=F(e,r.id),o=K(e,r.id),t=T(o),l=Q(e);return{...r,action:q(typeof o=="string"?o:t["*"],l),source:i?.source??"default",inherited:i?.inherited??!1,overridden:i?.overridden??!1}}function fe(e,r){const i=F(e,r.id),o=K(e,r.id),t=T(o),l=Q(e);return{...r,action:q(typeof o=="string"?o:t["*"],l),source:i?.source??"default",inherited:i?.inherited??!1,overridden:i?.overridden??!1,rules:Object.entries(t).filter(([c])=>c!=="*").flatMap(([c,a])=>S(r.id,c,a,i)??[])}}function he(){const e=se(),r=()=>e.data(),[i,o]=A("closed"),[t,l]=A("external_directory"),[c,a]=A(""),[d,u]=A("ask"),p=y(()=>(r()?.overlay.collections.permission??[]).flatMap(de)),v=y(()=>{const g=r();return g?C.map(f=>fe(g,f)):[]}),k=y(()=>{const g=r();return g?X.map(f=>ge(g,f)):[]}),h=y(()=>{const g=r();return g?Object.entries(z(g)).filter(([f])=>!oe.has(f)).flatMap(([f,b])=>ue(f,b,F(g,f))).sort((f,b)=>f.tool.localeCompare(b.tool)||f.pattern.localeCompare(b.pattern)):[]}),$=y(()=>C.find(g=>g.id===t())??C[0]);function x(g){l(g),a(""),u("ask"),o("rule")}function W(){o("closed")}function J(){const g=r(),f=Z(c());if(!g||!f){e.fail(`Enter a ${$().noun} pattern before saving.`);return}const b={[t()]:{[f]:d()}};e.save({permission:b}),W()}function V(g,f){const b=ae.has(g)?{[g]:{"*":f}}:{[g]:f};e.save({permission:b})}function Y(g){e.unset([g.path])}return{ctx:e,mode:i,kind:t,pattern:c,setPattern:a,action:d,setAction:u,rules:p,groups:v,settings:k,other:h,selected:$,open:x,close:W,add:J,setDefault:V,remove:Y}}var E=m("<div class=permission-row-meta>"),pe=m('<details class="models-select permission-select"><summary></summary><div class=models-select-menu role=listbox>'),ve=m("<button class=models-select-option type=button role=option>"),me=m("<section class=permission-group><div class=permission-rules>"),be=m("<div class=permissions><section class=permission-group><div class=permission-rules>"),$e=m("<div class=drawer-scrim>"),_e=m('<aside class="provider-drawer permission-drawer"aria-label="Permission rule configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form permission-form"><label class="required-field wide"><input></label><label class="required-field wide">Method</label></div><footer class=drawer-footer>'),ye=m("<span class=config-title-count>Permissions"),we=m("<section class=permission-group><header class=permission-group-header><div class=permission-group-copy><h2></h2><span></span><p></p></div><div class=permission-section-actions></div></header><div class=permission-rules>"),Ce=m("<p class=permission-empty>No specific <!> rules."),Se=m("<span class=permission-pattern>"),ke=m("<span class=permission-subtitle><span></span><span class=permission-pattern>");function H(e){return e==="allow"?"success":e==="deny"?"critical":"warning"}function U(e){return N.find(r=>r.value===e)?.label??e}function O(e){return(()=>{var r=E();return s(r,n(ne,{get tone(){return H(e.rule.action)},get children(){return U(e.rule.action)}}),null),s(r,n(L,{get source(){return e.rule.source},get inherited(){return e.rule.inherited},get overridden(){return e.rule.overridden}}),null),r})()}function j(e){const r=()=>U(e.value);function i(t,l){e.disabled||(e.onSelect(t),l.currentTarget.closest("details")?.removeAttribute("open"))}function o(t){if(e.disabled){t.currentTarget.removeAttribute("open");return}t.currentTarget.open&&t.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(l=>{l!==t.currentTarget&&l.removeAttribute("open")})}return(()=>{var t=pe(),l=t.firstChild,c=l.nextSibling;return t.addEventListener("toggle",o),s(l,r),s(c,n(w,{each:N,children:a=>(()=>{var d=ve();return d.$$click=u=>i(a.value,u),s(d,()=>a.label),P(u=>{var p=a.value===e.value,v=a.value===e.value;return p!==u.e&&d.classList.toggle("selected",u.e=p),v!==u.t&&_(d,"aria-selected",u.t=v),u},{e:void 0,t:void 0}),d})()})),P(a=>{var d=!!e.disabled,u=e.label,p=e.disabled,v=e.label;return d!==a.e&&t.classList.toggle("disabled",a.e=d),u!==a.t&&_(l,"aria-label",a.t=u),p!==a.a&&_(l,"aria-disabled",a.a=p),v!==a.o&&_(c,"aria-label",a.o=v),a},{e:void 0,t:void 0,a:void 0,o:void 0}),t})()}function xe(){const e=he();return n(ie,{get title(){return(()=>{var r=ye();return r.firstChild,s(r,n(M,{get children(){return e.groups().length+e.settings().length}}),null),r})()},description:"Control what tools agents can use by default and add pattern-specific allow, ask, or deny rules.",get children(){return[(()=>{var r=be(),i=r.firstChild,o=i.firstChild;return s(r,n(w,{get each(){return e.groups()},children:t=>(()=>{var l=we(),c=l.firstChild,a=c.firstChild,d=a.firstChild,u=d.nextSibling,p=u.nextSibling,v=a.nextSibling,k=c.nextSibling;return s(d,()=>t.title),s(u,()=>t.id),s(p,()=>t.description),s(v,n(M,{get children(){return t.rules.length}}),null),s(v,n(D,{icon:"plus",variant:"primary",get disabled(){return!!e.ctx.saving()},onClick:()=>e.open(t.id),children:"Add rule"}),null),s(l,n(R,{title:"Default method",get subtitle(){return`Used for ${t.noun}s that do not match a specific rule.`},get status(){return(()=>{var h=E();return s(h,n(L,{get source(){return t.source},get inherited(){return t.inherited},get overridden(){return t.overridden}})),h})()},get actions(){return n(j,{get label(){return`Default method for ${t.title}`},get value(){return t.action},get disabled(){return!!e.ctx.saving()},onSelect:h=>e.setDefault(t.id,h)})}}),k),s(k,n(B,{get when(){return t.rules.length},get fallback(){return(()=>{var h=Ce(),$=h.firstChild,x=$.nextSibling;return x.nextSibling,s(h,()=>t.noun,x),h})()},get children(){return n(w,{get each(){return t.rules},children:h=>n(R,{get title(){return(()=>{var $=Se();return s($,()=>h.pattern),$})()},get subtitle(){return`${t.title} ${t.noun} rule`},get status(){return n(O,{rule:h})},get actions(){return n(G,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${t.title} rule ${h.pattern}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.remove(h)})}})})}})),l})()}),i),s(i,n(I,{get trailing(){return n(M,{get children(){return e.settings().length}})},description:"Default methods for additional built-in tool permissions.",children:"Tool Defaults"}),o),s(o,n(w,{get each(){return e.settings()},children:t=>n(R,{get title(){return t.title},get subtitle(){return`${t.id} · ${t.description}`},get status(){return(()=>{var l=E();return s(l,n(L,{get source(){return t.source},get inherited(){return t.inherited},get overridden(){return t.overridden}})),l})()},get actions(){return n(j,{get label(){return`Default method for ${t.title}`},get value(){return t.action},get disabled(){return!!e.ctx.saving()},onSelect:l=>e.setDefault(t.id,l)})}})})),s(r,n(B,{get when(){return e.other().length},get children(){var t=me(),l=t.firstChild;return s(t,n(I,{get trailing(){return n(M,{get children(){return e.other().length}})},description:"Additional tool permission rules from config.",children:"Other Permissions"}),l),s(l,n(w,{get each(){return e.other()},children:c=>n(R,{get title(){return te(c.tool)},get subtitle(){return(()=>{var a=ke(),d=a.firstChild,u=d.nextSibling;return s(d,()=>c.tool),s(u,()=>c.pattern),a})()},get status(){return n(O,{rule:c})},get actions(){return n(G,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${c.tool} rule ${c.pattern}`},get disabled(){return!!e.ctx.saving()},onClick:()=>e.remove(c)})}})})),t}}),null),r})(),n(B,{get when(){return e.mode()==="rule"},get children(){return[(()=>{var r=$e();return re(r,"click",e.close,!0),r})(),(()=>{var r=_e(),i=r.firstChild,o=i.firstChild,t=o.firstChild,l=t.nextSibling,c=i.nextSibling,a=c.firstChild,d=a.firstChild,u=a.nextSibling;u.firstChild;var p=c.nextSibling;return s(t,()=>`Add ${e.selected().title} Rule`),s(l,()=>`${e.selected().id} · ${e.selected().description}`),s(i,n(D,{variant:"ghost","aria-label":"Close permission rule overlay",get onClick(){return e.close},children:"X"}),null),s(a,()=>e.selected().noun==="command"?"Command pattern":"Path pattern",d),d.$$input=v=>e.setPattern(v.currentTarget.value),_(d,"spellcheck",!1),s(u,n(j,{label:"Rule method",get value(){return e.action()},get disabled(){return!!e.ctx.saving()},get onSelect(){return e.setAction}}),null),s(p,n(D,{variant:"ghost",get onClick(){return e.close},children:"Cancel"}),null),s(p,n(D,{variant:"primary",get disabled(){return!!e.ctx.saving()},get onClick(){return e.add},children:"Save Rule"}),null),P(()=>_(d,"placeholder",e.selected().placeholder)),P(()=>d.value=e.pattern()),r})()]}})]}})}ee(["click","input"]);const je=Object.freeze(Object.defineProperty({__proto__:null,ActionSelect:j,PermissionsRoute:xe,RuleMeta:O,label:U,tone:H},Symbol.toStringTag,{value:"Module"}));export{j as A,je as P,X as a,le as d,U as l,C as r,H as t};
@@ -1 +1 @@
1
- import{u as ue,a as ge,c as w,b as pe,d as Q,e as T,i as e,f as n,g as K,t as a,h as fe,A as V,I as B,s as R,S as _,L as W,m as O,C as y,j as U,F as he,l as ve,k as $e,n as _e}from"./index-BVTco8nF.js";import{B as X}from"./button-1_tdOPlo.js";import{u as me,a as be,c as we,b as M,d as Ce,i as Z,m as ye,e as D,p as ee,f as Se,w as xe}from"./profile-CSnKmbwa.js";var ke=a("<span>Overview"),Ke=a('<aside class=config-sidebar aria-label="Profile sections"><div class=config-sidebar-title><span>Profile</span><span class=config-sidebar-scope><span></span></span></div><nav class=config-options><a class="config-top-option config-top-option-external"target=_blank rel=noreferrer><span>Usage</span></a><a class="config-top-option config-top-option-external"target=_blank rel=noreferrer><span>Buy Credits'),Oe=a("<header class=profile-header><div><p class=eyebrow>Kilo Account</p><h1>Your Profile</h1><p>Manage your Kilo identity, account context, credits, and billing shortcuts.</p></div><div class=profile-actions><a class=profile-primary-link data-component=button data-size=default data-variant=primary target=_blank rel=noreferrer>Open Dashboard"),ze=a("<span class=profile-connect-mark aria-hidden=true>KG"),qe=a("<div class=profile-connect-copy><p class=eyebrow>Kilo Account</p><h1>Connect your Kilo account</h1><p>Sign in to view your credits, organizations, and account details in Kilo Console."),Ae=a("<strong>Kilo server not found"),Le=a("<span>Start Kilo Console from a running Kilo server or pass a server URL with ?server=."),Pe=a("<strong>Profile request failed"),re=a("<span>"),Ie=a("<strong>Account update failed"),Be=a('<section class="config-shell profile-shell"><section class=content><div class=profile-page>'),Re=a("<div class=profile-account-head><span class=profile-avatar aria-hidden=true></span><div class=profile-account-text><strong></strong><span>"),Ue=a("<div class=profile-meta-row><span>Active account</span><strong>"),Ee=a("<div class=profile-card-actions>"),Me=a("<span class=profile-card-label>Remaining Credits"),De=a("<strong>"),Ye=a("<p>Credits shown for <!>. Switch accounts below to see organization balances when available."),Fe=a("<header class=profile-card-head><div><span class=profile-card-label>Organizations</span><h2>Your Accounts</h2></div><span class=profile-pill>"),Ge=a("<div class=profile-org-list><button type=button class=profile-org-row><span class=profile-org-icon aria-hidden=true>KG</span><span class=profile-org-body><strong>Personal Account</strong><span>Your personal Kilo credits and settings</span></span><span class=profile-org-state>"),Ne=a("<div class=profile-grid>"),je=a("<button type=button class=profile-org-row><span class=profile-org-icon aria-hidden=true></span><span class=profile-org-body><strong></strong><span></span></span><span class=profile-org-state>");async function He(c){if(xe())return{kind:"disconnected"};try{const m=await ve(c);return D(!1),{kind:"connected",data:m}}catch(m){if(M(m))return D(!0),{kind:"disconnected"};throw m}}function ne(c){if(c?.currentOrgId)return c.profile.organizations?.find(m=>m.id===c.currentOrgId)}function E(c){return ne(c)?.name??"Personal Account"}function Je(c){return c.role==="owner"?"Owner":c.role==="admin"?"Admin":c.role==="billing_manager"?"Billing":"Member"}function We(){const c=ue(),m=ge(),A=w(()=>new URLSearchParams(c.search)),g=me(A),[p,L]=pe(g.query,He),[P,z]=Q(),[Y,S]=Q(""),h=w(()=>{const i=p();if(i?.kind==="connected")return i.data}),I=w(()=>h()?.profile.organizations??[]),F=w(()=>ne(h())),q=w(()=>p()?.kind==="disconnected"),te=w(()=>h()?E(h()):p.loading?"Loading...":"Not connected"),ae=()=>ee(A(),"/kilo/login"),G=()=>ee(A(),"/profile"),le=w(()=>be(h()?.currentOrgId)),ie=w(()=>we(h()?.currentOrgId));T(()=>{h()&&g.remember()}),T(()=>{const i=p.error;!i||M(i)||g.recover()});function se(){S(""),L.refetch()}function N(i){const C=g.query();if(!C)return;const f=i??Se;(h()?.currentOrgId??null)!==i&&(z(f),S(""),_e(C,i).then(()=>L.refetch()).catch(u=>S(U(u))).finally(()=>z(void 0)))}function oe(){const i=g.query();i&&(z("logout"),S(""),$e(i).then(()=>{D(!0),L.mutate({kind:"disconnected"}),m(G(),{replace:!0})}).catch(C=>S(U(C))).finally(()=>z(void 0)))}return(()=>{var i=Be(),C=i.firstChild,f=C.firstChild;return e(i,n(_,{get when(){return!q()},get children(){var t=Ke(),u=t.firstChild,r=u.firstChild,l=r.nextSibling,d=l.firstChild,v=u.nextSibling,$=v.firstChild;$.firstChild;var s=$.nextSibling;return s.firstChild,e(d,te),e(v,n(V,{class:"config-top-option active",get href(){return G()},"aria-current":"page",get children(){return ke()}}),$),e($,n(B,{name:"square-arrow-top-right",size:"small"}),null),e(s,n(B,{name:"square-arrow-top-right",size:"small"}),null),K(o=>{var b=le(),x=ie();return b!==o.e&&R($,"href",o.e=b),x!==o.t&&R(s,"href",o.t=x),o},{e:void 0,t:void 0}),t}}),C),e(f,n(_,{get when(){return!q()},get children(){var t=Oe(),u=t.firstChild,r=u.nextSibling,l=r.firstChild;return l.firstChild,e(r,n(X,{variant:"secondary",type:"button",onClick:se,get disabled(){return p.loading||!g.query()},children:"Refresh"}),l),e(l,n(B,{name:"square-arrow-top-right",size:"small"}),null),K(()=>R(l,"href",Ce())),t}}),null),e(f,n(_,{get when(){return O(()=>!g.query())()&&g.discoverable()},get children(){return n(W,{variant:"fullscreen"})}}),null),e(f,n(_,{get when(){return O(()=>!!p.loading)()&&!p()},get children(){return n(W,{variant:"fullscreen"})}}),null),e(f,n(_,{get when(){return q()},get children(){return n(y,{class:"profile-connect-card",get children(){return[ze(),qe(),n(V,{class:"profile-primary-link","data-component":"button","data-size":"default","data-variant":"primary",get href(){return ae()},children:"Connect"})]}})}}),null),e(f,n(_,{get when(){return O(()=>!g.query())()&&!g.discoverable()},get children(){return n(y,{class:"profile-banner",variant:"warning",get children(){return[Ae(),Le()]}})}}),null),e(f,n(_,{get when(){return O(()=>!!p.error)()&&!M(p.error)},get children(){return n(y,{class:"profile-banner",variant:"error",get children(){return[Pe(),(()=>{var t=re();return e(t,()=>U(p.error)),t})()]}})}}),null),e(f,n(_,{get when(){return Y()},get children(){return n(y,{class:"profile-banner",variant:"error",get children(){return[Ie(),(()=>{var t=re();return e(t,Y),t})()]}})}}),null),e(f,n(_,{get when(){return h()},children:t=>(()=>{var u=Ne();return e(u,n(y,{class:"profile-card profile-account-card",get children(){return[(()=>{var r=Re(),l=r.firstChild,d=l.nextSibling,v=d.firstChild,$=v.nextSibling;return e(l,()=>Z(t().profile.name,t().profile.email)),e(v,()=>t().profile.name||t().profile.email),e($,()=>t().profile.email),r})(),(()=>{var r=Ue(),l=r.firstChild,d=l.nextSibling;return e(d,()=>E(t())),r})(),(()=>{var r=Ee();return e(r,n(X,{variant:"ghost",type:"button",onClick:oe,get disabled(){return!!P()},children:"Log Out"})),r})()]}}),null),e(u,n(y,{class:"profile-card profile-balance-card",get children(){return[Me(),(()=>{var r=De();return e(r,()=>ye(t().balance?.balance)),r})(),(()=>{var r=Ye(),l=r.firstChild,d=l.nextSibling;return d.nextSibling,e(r,()=>E(t()),d),r})()]}}),null),e(u,n(y,{class:"profile-card profile-wide-card",get children(){return[(()=>{var r=Fe(),l=r.firstChild,d=l.nextSibling;return e(d,(()=>{var v=O(()=>I().length===1);return()=>v()?"1 org":`${I().length} orgs`})()),r})(),(()=>{var r=Ge(),l=r.firstChild,d=l.firstChild,v=d.nextSibling,$=v.nextSibling;return l.$$click=()=>N(null),e($,()=>t().currentOrgId?"Use":"Current"),e(r,n(he,{get each(){return I()},children:s=>(()=>{var o=je(),b=o.firstChild,x=b.nextSibling,j=x.firstChild,ce=j.nextSibling,de=x.nextSibling;return o.$$click=()=>N(s.id),e(b,()=>Z(s.name,s.name)),e(j,()=>s.name),e(ce,()=>Je(s)),e(de,()=>F()?.id===s.id?"Current":"Use"),K(k=>{var H=F()?.id===s.id,J=!!P();return H!==k.e&&o.classList.toggle("active",k.e=H),J!==k.t&&(o.disabled=k.t=J),k},{e:void 0,t:void 0}),o})()}),null),K(s=>{var o=!t().currentOrgId,b=!!P();return o!==s.e&&l.classList.toggle("active",s.e=o),b!==s.t&&(l.disabled=s.t=b),s},{e:void 0,t:void 0}),r})()]}}),null),u})()}),null),K(()=>i.classList.toggle("disconnected",!!q())),i})()}fe(["click"]);export{We as ProfileRoute};
1
+ import{u as ue,a as ge,c as w,b as pe,d as Q,e as T,i as e,f as n,g as K,t as a,h as fe,A as V,I as B,s as R,S as _,L as W,m as O,C as y,j as U,F as he,l as ve,k as $e,n as _e}from"./index-x2HgICqP.js";import{B as X}from"./button-ZvkAWXQM.js";import{u as me,a as be,c as we,b as M,d as Ce,i as Z,m as ye,e as D,p as ee,f as Se,w as xe}from"./profile-CjZNBlVZ.js";var ke=a("<span>Overview"),Ke=a('<aside class=config-sidebar aria-label="Profile sections"><div class=config-sidebar-title><span>Profile</span><span class=config-sidebar-scope><span></span></span></div><nav class=config-options><a class="config-top-option config-top-option-external"target=_blank rel=noreferrer><span>Usage</span></a><a class="config-top-option config-top-option-external"target=_blank rel=noreferrer><span>Buy Credits'),Oe=a("<header class=profile-header><div><p class=eyebrow>Kilo Account</p><h1>Your Profile</h1><p>Manage your Kilo identity, account context, credits, and billing shortcuts.</p></div><div class=profile-actions><a class=profile-primary-link data-component=button data-size=default data-variant=primary target=_blank rel=noreferrer>Open Dashboard"),ze=a("<span class=profile-connect-mark aria-hidden=true>KG"),qe=a("<div class=profile-connect-copy><p class=eyebrow>Kilo Account</p><h1>Connect your Kilo account</h1><p>Sign in to view your credits, organizations, and account details in Kilo Console."),Ae=a("<strong>Kilo server not found"),Le=a("<span>Start Kilo Console from a running Kilo server or pass a server URL with ?server=."),Pe=a("<strong>Profile request failed"),re=a("<span>"),Ie=a("<strong>Account update failed"),Be=a('<section class="config-shell profile-shell"><section class=content><div class=profile-page>'),Re=a("<div class=profile-account-head><span class=profile-avatar aria-hidden=true></span><div class=profile-account-text><strong></strong><span>"),Ue=a("<div class=profile-meta-row><span>Active account</span><strong>"),Ee=a("<div class=profile-card-actions>"),Me=a("<span class=profile-card-label>Remaining Credits"),De=a("<strong>"),Ye=a("<p>Credits shown for <!>. Switch accounts below to see organization balances when available."),Fe=a("<header class=profile-card-head><div><span class=profile-card-label>Organizations</span><h2>Your Accounts</h2></div><span class=profile-pill>"),Ge=a("<div class=profile-org-list><button type=button class=profile-org-row><span class=profile-org-icon aria-hidden=true>KG</span><span class=profile-org-body><strong>Personal Account</strong><span>Your personal Kilo credits and settings</span></span><span class=profile-org-state>"),Ne=a("<div class=profile-grid>"),je=a("<button type=button class=profile-org-row><span class=profile-org-icon aria-hidden=true></span><span class=profile-org-body><strong></strong><span></span></span><span class=profile-org-state>");async function He(c){if(xe())return{kind:"disconnected"};try{const m=await ve(c);return D(!1),{kind:"connected",data:m}}catch(m){if(M(m))return D(!0),{kind:"disconnected"};throw m}}function ne(c){if(c?.currentOrgId)return c.profile.organizations?.find(m=>m.id===c.currentOrgId)}function E(c){return ne(c)?.name??"Personal Account"}function Je(c){return c.role==="owner"?"Owner":c.role==="admin"?"Admin":c.role==="billing_manager"?"Billing":"Member"}function We(){const c=ue(),m=ge(),A=w(()=>new URLSearchParams(c.search)),g=me(A),[p,L]=pe(g.query,He),[P,z]=Q(),[Y,S]=Q(""),h=w(()=>{const i=p();if(i?.kind==="connected")return i.data}),I=w(()=>h()?.profile.organizations??[]),F=w(()=>ne(h())),q=w(()=>p()?.kind==="disconnected"),te=w(()=>h()?E(h()):p.loading?"Loading...":"Not connected"),ae=()=>ee(A(),"/kilo/login"),G=()=>ee(A(),"/profile"),le=w(()=>be(h()?.currentOrgId)),ie=w(()=>we(h()?.currentOrgId));T(()=>{h()&&g.remember()}),T(()=>{const i=p.error;!i||M(i)||g.recover()});function se(){S(""),L.refetch()}function N(i){const C=g.query();if(!C)return;const f=i??Se;(h()?.currentOrgId??null)!==i&&(z(f),S(""),_e(C,i).then(()=>L.refetch()).catch(u=>S(U(u))).finally(()=>z(void 0)))}function oe(){const i=g.query();i&&(z("logout"),S(""),$e(i).then(()=>{D(!0),L.mutate({kind:"disconnected"}),m(G(),{replace:!0})}).catch(C=>S(U(C))).finally(()=>z(void 0)))}return(()=>{var i=Be(),C=i.firstChild,f=C.firstChild;return e(i,n(_,{get when(){return!q()},get children(){var t=Ke(),u=t.firstChild,r=u.firstChild,l=r.nextSibling,d=l.firstChild,v=u.nextSibling,$=v.firstChild;$.firstChild;var s=$.nextSibling;return s.firstChild,e(d,te),e(v,n(V,{class:"config-top-option active",get href(){return G()},"aria-current":"page",get children(){return ke()}}),$),e($,n(B,{name:"square-arrow-top-right",size:"small"}),null),e(s,n(B,{name:"square-arrow-top-right",size:"small"}),null),K(o=>{var b=le(),x=ie();return b!==o.e&&R($,"href",o.e=b),x!==o.t&&R(s,"href",o.t=x),o},{e:void 0,t:void 0}),t}}),C),e(f,n(_,{get when(){return!q()},get children(){var t=Oe(),u=t.firstChild,r=u.nextSibling,l=r.firstChild;return l.firstChild,e(r,n(X,{variant:"secondary",type:"button",onClick:se,get disabled(){return p.loading||!g.query()},children:"Refresh"}),l),e(l,n(B,{name:"square-arrow-top-right",size:"small"}),null),K(()=>R(l,"href",Ce())),t}}),null),e(f,n(_,{get when(){return O(()=>!g.query())()&&g.discoverable()},get children(){return n(W,{variant:"fullscreen"})}}),null),e(f,n(_,{get when(){return O(()=>!!p.loading)()&&!p()},get children(){return n(W,{variant:"fullscreen"})}}),null),e(f,n(_,{get when(){return q()},get children(){return n(y,{class:"profile-connect-card",get children(){return[ze(),qe(),n(V,{class:"profile-primary-link","data-component":"button","data-size":"default","data-variant":"primary",get href(){return ae()},children:"Connect"})]}})}}),null),e(f,n(_,{get when(){return O(()=>!g.query())()&&!g.discoverable()},get children(){return n(y,{class:"profile-banner",variant:"warning",get children(){return[Ae(),Le()]}})}}),null),e(f,n(_,{get when(){return O(()=>!!p.error)()&&!M(p.error)},get children(){return n(y,{class:"profile-banner",variant:"error",get children(){return[Pe(),(()=>{var t=re();return e(t,()=>U(p.error)),t})()]}})}}),null),e(f,n(_,{get when(){return Y()},get children(){return n(y,{class:"profile-banner",variant:"error",get children(){return[Ie(),(()=>{var t=re();return e(t,Y),t})()]}})}}),null),e(f,n(_,{get when(){return h()},children:t=>(()=>{var u=Ne();return e(u,n(y,{class:"profile-card profile-account-card",get children(){return[(()=>{var r=Re(),l=r.firstChild,d=l.nextSibling,v=d.firstChild,$=v.nextSibling;return e(l,()=>Z(t().profile.name,t().profile.email)),e(v,()=>t().profile.name||t().profile.email),e($,()=>t().profile.email),r})(),(()=>{var r=Ue(),l=r.firstChild,d=l.nextSibling;return e(d,()=>E(t())),r})(),(()=>{var r=Ee();return e(r,n(X,{variant:"ghost",type:"button",onClick:oe,get disabled(){return!!P()},children:"Log Out"})),r})()]}}),null),e(u,n(y,{class:"profile-card profile-balance-card",get children(){return[Me(),(()=>{var r=De();return e(r,()=>ye(t().balance?.balance)),r})(),(()=>{var r=Ye(),l=r.firstChild,d=l.nextSibling;return d.nextSibling,e(r,()=>E(t()),d),r})()]}}),null),e(u,n(y,{class:"profile-card profile-wide-card",get children(){return[(()=>{var r=Fe(),l=r.firstChild,d=l.nextSibling;return e(d,(()=>{var v=O(()=>I().length===1);return()=>v()?"1 org":`${I().length} orgs`})()),r})(),(()=>{var r=Ge(),l=r.firstChild,d=l.firstChild,v=d.nextSibling,$=v.nextSibling;return l.$$click=()=>N(null),e($,()=>t().currentOrgId?"Use":"Current"),e(r,n(he,{get each(){return I()},children:s=>(()=>{var o=je(),b=o.firstChild,x=b.nextSibling,j=x.firstChild,ce=j.nextSibling,de=x.nextSibling;return o.$$click=()=>N(s.id),e(b,()=>Z(s.name,s.name)),e(j,()=>s.name),e(ce,()=>Je(s)),e(de,()=>F()?.id===s.id?"Current":"Use"),K(k=>{var H=F()?.id===s.id,J=!!P();return H!==k.e&&o.classList.toggle("active",k.e=H),J!==k.t&&(o.disabled=k.t=J),k},{e:void 0,t:void 0}),o})()}),null),K(s=>{var o=!t().currentOrgId,b=!!P();return o!==s.e&&l.classList.toggle("active",s.e=o),b!==s.t&&(l.disabled=s.t=b),s},{e:void 0,t:void 0}),r})()]}}),null),u})()}),null),K(()=>i.classList.toggle("disconnected",!!q())),i})()}fe(["click"]);export{We as ProfileRoute};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GhosttyTerminal-CHtyg0Jp.js","assets/index-BVTco8nF.js","assets/index-ClHKVxCL.css","assets/session-review-2FyNBzv4.js","assets/file-C4LB07af.js","assets/console-CN8x7GgQ.js","assets/config-D-w9rt1b.js"])))=>i.map(i=>d[i]);
2
- import{G as Ge,f as s,H as Ye,K as At,t as m,ao as _r,h as Bt,z as Sr,s as j,i as a,S as D,g as J,u as xr,V as Ir,c as $,d as k,b as It,e as A,a1 as Lr,o as Ke,a2 as Dr,m as we,U as Nt,ap as Lt,a5 as Ot,aq as Ze,a0 as Je,j as X,y as Tr,ar as Pr,as as Er,at as zr,a9 as Rr,a8 as Dt,au as Wr,a6 as Mr,a7 as Ur,I as Xe,A as Tt,F as He,L as Pt,C as Fr,av as Et,Z as Ar,aw as Br,ax as Nr,ay as Or,az as qr,ah as zt,aA as Kr,aB as Xr,aC as Hr,aD as Vr}from"./index-BVTco8nF.js";import{T as Gr}from"./tag-BzRV52sM.js";import{B as Re}from"./button-1_tdOPlo.js";import{D as Yr,b as Zr,M as Rt,a as Jr,n as Wt,c as Qr,S as en}from"./console-CN8x7GgQ.js";import{C as tn}from"./ConfirmDialog-DKtlaK4x.js";/* empty css */import"./config-D-w9rt1b.js";function rn(i){const[n,d]=Ge(i,["variant","class","classList","children"]),h=()=>n.variant==="destructive"?"critical":n.variant==="default"?"brand":"neutral";return s(Gr,Ye(d,{get"data-variant"(){return n.variant??"default"},get tone(){return h()},get class(){return n.class},get classList(){return n.classList},get children(){return n.children}}))}var nn=m("<div>");function on(i){const[n,d]=Ge(i,["direction","edge","size","min","max","onResize","onCollapse","onCollapseChange","collapseThreshold","class","classList"]),h=g=>{if(g.detail>1)return;g.preventDefault();const w=n.edge??(n.direction==="vertical"?"start":"end"),b=n.direction==="horizontal"?g.clientX:g.clientY,q=n.direction==="horizontal"&&g.currentTarget instanceof Element&&getComputedStyle(g.currentTarget).direction==="rtl",T=n.size,R=n.min,B=n.max,O=n.collapseThreshold??0,H=n.onResize,Q=n.onCollapse,I=n.onCollapseChange;let N=T,V=!1;const We=n.direction==="horizontal"?"col-resize":"row-resize";document.body.style.userSelect="none",document.body.style.overflow="hidden",document.body.style.cursor=We;const ue=$e=>{const ee=n.direction==="horizontal"?$e.clientX:$e.clientY,je=n.direction==="vertical"?w==="end"?ee-b:b-ee:w==="start"!==q?b-ee:ee-b;N=T+je;const P=O>0&&N<O;P!==V&&(V=P,I?.(V)),H(Math.min(B,Math.max(R,N)))},ye=()=>{if(document.body.style.userSelect="",document.body.style.overflow="",document.body.style.cursor="",document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",ye),V){Q?.();return}I?.(!1)};document.addEventListener("mousemove",ue),document.addEventListener("mouseup",ye)};return(()=>{var g=nn();return At(g,Ye(d,{"data-component":"resize-handle",get"data-direction"(){return n.direction},get"data-edge"(){return n.edge??(n.direction==="vertical"?"start":"end")},get classList(){return{...n.classList,[n.class??""]:!!n.class}},onMouseDown:h}),!1,!1),g})()}const sn=_r({name:"FileComponent",init:i=>i.component}),an=sn.provider;var ln=m("<input>");function cn(i){const[n,d]=Ge(i,["class","classList"]);return(()=>{var h=ln();return At(h,Ye(d,{"data-component":"input","data-slot":"input",get classList(){return{...n.classList,[n.class??""]:!!n.class}}}),!1,!1),h})()}var dn=m('<div class=confirm-scrim><section class="confirm-dialog prompt-dialog"role=dialog aria-modal=true><form class=prompt-form><div class=prompt-body><div class=prompt-copy><h2></h2></div><label class=prompt-field><span></span></label></div><footer class=confirm-actions>'),un=m("<p>");function fn(i){const n=Sr(),d=`${n}-title`,h=`${n}-message`,g=`${n}-input`;return s(D,{get when(){return i.open},get children(){var w=dn(),b=w.firstChild,q=b.firstChild,T=q.firstChild,R=T.firstChild,B=R.firstChild,O=R.nextSibling,H=O.firstChild,Q=T.nextSibling;return w.$$keydown=I=>I.key==="Escape"&&i.onCancel(),j(b,"aria-labelledby",d),q.addEventListener("submit",I=>{I.preventDefault(),i.onConfirm()}),j(B,"id",d),a(B,()=>i.title),a(R,s(D,{get when(){return i.message},children:I=>(()=>{var N=un();return j(N,"id",h),a(N,I),N})()}),null),j(O,"for",g),a(H,()=>i.label),a(O,s(cn,{id:g,get value(){return i.value},get placeholder(){return i.placeholder},get disabled(){return i.busy},autofocus:!0,onInput:I=>i.onInput(I.currentTarget.value)}),null),a(Q,s(Re,{type:"button",variant:"ghost",get disabled(){return i.busy},get onClick(){return i.onCancel},get children(){return i.cancel??"Cancel"}}),null),a(Q,s(Re,{type:"submit",variant:"primary",get disabled(){return i.busy},get children(){return i.confirm??"Confirm"}}),null),J(()=>j(b,"aria-describedby",i.message?h:void 0)),w}})}Bt(["keydown"]);function gn(i){let n,d,h;async function g(){const w=d;if(w){d=void 0,n=w;try{await w.run(),h=w.key}catch(b){i(b)}n=void 0,d&&g()}}return{push(w,b=!1){!b&&w.key===h&&!n||!b&&w.key===n?.key&&!d||(d=w,n||g())}}}var vn=m("<span>Project Settings"),pn=m("<small>Project configuration"),mn=m("<strong>Project console failed"),hn=m("<span>"),wn=m("<div class=project-terminal-empty><strong>No terminal session selected</strong><span>Use + next to a worktree to start Kilo CLI."),bn=m("<div class=project-info-actions>"),yn=m('<section class=project-console><aside class=project-console-sidebar aria-label="Project console sections"><div class=project-console-title><span class=project-console-heading><span>Project</span></span><span class=project-console-scope><span class=project-console-name></span></span><small></small></div><div class=project-console-scroll><section class=project-sidebar-group><div class="project-panel-heading project-panel-heading-row"><span>Worktrees</span><button type=button class=project-heading-action title="Create worktree"aria-label="Create worktree">+</button></div><nav class=project-contexts aria-label=Worktrees></nav></section></div><div class=project-sidebar-bottom></div></aside><main class=project-console-main></main><aside class=project-console-info aria-label="Project details"><div class="project-info-card project-info-context"><div class=project-info-context-head><span class=project-panel-heading>Context</span></div><strong class=project-info-title></strong><code class=project-info-path></code></div><div class=project-info-review>'),$n=m("<button type=button class=project-inline-action>"),jn=m('<button type=button class="project-inline-action danger">'),kn=m("<div class=project-terminal-list>"),Cn=m("<div class=project-worktree-block><div class=project-context-row><button type=button class=project-context><span></span><small></small></button><div class=project-row-actions><button type=button class=project-inline-action>+"),_n=m("<div class=project-terminal-item><button type=button class=project-terminal-row><span class=project-console-dot aria-hidden=true></span><span></span></button><button type=button class=project-terminal-close>x"),Sn=m("<div class=project-terminal-frame>"),xn=m("<span class=project-terminal-loading>Starting terminal..."),In=m('<div class="project-review-state project-review-state-error">'),Ln=m("<div class=project-review-state><span>Loading changes…"),Dn=m("<div class=project-review-state>Loading changes..."),Tn=m("<span>Changes"),Pn=m("<div class=project-review-empty>No changes detected.");const En=Ze(()=>Je(()=>import("./GhosttyTerminal-CHtyg0Jp.js"),__vite__mapDeps([0,1,2])).then(i=>({default:i.GhosttyTerminal}))),zn=Ze(()=>Je(()=>import("./session-review-2FyNBzv4.js"),__vite__mapDeps([3,1,2,4,5,6])).then(i=>({default:i.SessionReview}))),Rn=Ze(()=>Je(()=>import("./file-C4LB07af.js").then(i=>i.i),__vite__mapDeps([4,1,2])).then(i=>({default:i.File}))),Wn=new Set(["3017","3018"]);function be(i){return i.get("server")?!1:Wn.has(window.location.port)}function Mn(i){const n=i.get("server");if(n)return n;const d=be(i)?Ot():"";return d||(be(i)?"":window.location.origin)}function qt(i){return i.split(/[\\/]/).filter(Boolean).at(-1)??"Project"}function Mt(i){return Nt(qt(i))}function Ve(i){return typeof i=="object"&&i!==null}function Ut(i,n){if(!Ve(i))return;const d=i[n];if(Ve(d))return d}function Un(i){const n=i.payload,d="properties"in n?n.properties:"data"in n?n.data:void 0;if(!Ve(d))return;const h=d.sessionID;if(typeof h=="string")return h;const g=Ut(d,"info");if(typeof g?.sessionID=="string")return g.sessionID;if(typeof g?.id=="string")return g.id;const w=Ut(d,"part");if(typeof w?.sessionID=="string")return w.sessionID}function Qe(i){const n=i.payload;return n.type?n.type!=="sync"?n.type:typeof n.name=="string"?n.name:typeof n.syncEvent?.type=="string"?n.syncEvent.type:"":""}function Fn(i){return Qe(i).startsWith("message.")}function An(i){const n=Qe(i);return!!(n.startsWith("pty.")||n.startsWith("session.")||n.startsWith("permission.")||n.startsWith("question.")||n.startsWith("message.")||n==="global.config.updated")}function Ft(i,n){return`${i}
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GhosttyTerminal-CTbd0S4x.js","assets/index-x2HgICqP.js","assets/index-ClHKVxCL.css","assets/session-review-BSr1Uyjk.js","assets/file-y5xMoiQQ.js","assets/console-JCVpLOdJ.js","assets/config-BVVcC0Y1.js"])))=>i.map(i=>d[i]);
2
+ import{G as Ge,f as s,H as Ye,K as At,t as m,ao as _r,h as Bt,z as Sr,s as j,i as a,S as D,g as J,u as xr,V as Ir,c as $,d as k,b as It,e as A,a1 as Lr,o as Ke,a2 as Dr,m as we,U as Nt,ap as Lt,a5 as Ot,aq as Ze,a0 as Je,j as X,y as Tr,ar as Pr,as as Er,at as zr,a9 as Rr,a8 as Dt,au as Wr,a6 as Mr,a7 as Ur,I as Xe,A as Tt,F as He,L as Pt,C as Fr,av as Et,Z as Ar,aw as Br,ax as Nr,ay as Or,az as qr,ah as zt,aA as Kr,aB as Xr,aC as Hr,aD as Vr}from"./index-x2HgICqP.js";import{T as Gr}from"./tag-DRpP2l65.js";import{B as Re}from"./button-ZvkAWXQM.js";import{D as Yr,b as Zr,M as Rt,a as Jr,n as Wt,c as Qr,S as en}from"./console-JCVpLOdJ.js";import{C as tn}from"./ConfirmDialog-Dw1TQzR8.js";/* empty css */import"./config-BVVcC0Y1.js";function rn(i){const[n,d]=Ge(i,["variant","class","classList","children"]),h=()=>n.variant==="destructive"?"critical":n.variant==="default"?"brand":"neutral";return s(Gr,Ye(d,{get"data-variant"(){return n.variant??"default"},get tone(){return h()},get class(){return n.class},get classList(){return n.classList},get children(){return n.children}}))}var nn=m("<div>");function on(i){const[n,d]=Ge(i,["direction","edge","size","min","max","onResize","onCollapse","onCollapseChange","collapseThreshold","class","classList"]),h=g=>{if(g.detail>1)return;g.preventDefault();const w=n.edge??(n.direction==="vertical"?"start":"end"),b=n.direction==="horizontal"?g.clientX:g.clientY,q=n.direction==="horizontal"&&g.currentTarget instanceof Element&&getComputedStyle(g.currentTarget).direction==="rtl",T=n.size,R=n.min,B=n.max,O=n.collapseThreshold??0,H=n.onResize,Q=n.onCollapse,I=n.onCollapseChange;let N=T,V=!1;const We=n.direction==="horizontal"?"col-resize":"row-resize";document.body.style.userSelect="none",document.body.style.overflow="hidden",document.body.style.cursor=We;const ue=$e=>{const ee=n.direction==="horizontal"?$e.clientX:$e.clientY,je=n.direction==="vertical"?w==="end"?ee-b:b-ee:w==="start"!==q?b-ee:ee-b;N=T+je;const P=O>0&&N<O;P!==V&&(V=P,I?.(V)),H(Math.min(B,Math.max(R,N)))},ye=()=>{if(document.body.style.userSelect="",document.body.style.overflow="",document.body.style.cursor="",document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",ye),V){Q?.();return}I?.(!1)};document.addEventListener("mousemove",ue),document.addEventListener("mouseup",ye)};return(()=>{var g=nn();return At(g,Ye(d,{"data-component":"resize-handle",get"data-direction"(){return n.direction},get"data-edge"(){return n.edge??(n.direction==="vertical"?"start":"end")},get classList(){return{...n.classList,[n.class??""]:!!n.class}},onMouseDown:h}),!1,!1),g})()}const sn=_r({name:"FileComponent",init:i=>i.component}),an=sn.provider;var ln=m("<input>");function cn(i){const[n,d]=Ge(i,["class","classList"]);return(()=>{var h=ln();return At(h,Ye(d,{"data-component":"input","data-slot":"input",get classList(){return{...n.classList,[n.class??""]:!!n.class}}}),!1,!1),h})()}var dn=m('<div class=confirm-scrim><section class="confirm-dialog prompt-dialog"role=dialog aria-modal=true><form class=prompt-form><div class=prompt-body><div class=prompt-copy><h2></h2></div><label class=prompt-field><span></span></label></div><footer class=confirm-actions>'),un=m("<p>");function fn(i){const n=Sr(),d=`${n}-title`,h=`${n}-message`,g=`${n}-input`;return s(D,{get when(){return i.open},get children(){var w=dn(),b=w.firstChild,q=b.firstChild,T=q.firstChild,R=T.firstChild,B=R.firstChild,O=R.nextSibling,H=O.firstChild,Q=T.nextSibling;return w.$$keydown=I=>I.key==="Escape"&&i.onCancel(),j(b,"aria-labelledby",d),q.addEventListener("submit",I=>{I.preventDefault(),i.onConfirm()}),j(B,"id",d),a(B,()=>i.title),a(R,s(D,{get when(){return i.message},children:I=>(()=>{var N=un();return j(N,"id",h),a(N,I),N})()}),null),j(O,"for",g),a(H,()=>i.label),a(O,s(cn,{id:g,get value(){return i.value},get placeholder(){return i.placeholder},get disabled(){return i.busy},autofocus:!0,onInput:I=>i.onInput(I.currentTarget.value)}),null),a(Q,s(Re,{type:"button",variant:"ghost",get disabled(){return i.busy},get onClick(){return i.onCancel},get children(){return i.cancel??"Cancel"}}),null),a(Q,s(Re,{type:"submit",variant:"primary",get disabled(){return i.busy},get children(){return i.confirm??"Confirm"}}),null),J(()=>j(b,"aria-describedby",i.message?h:void 0)),w}})}Bt(["keydown"]);function gn(i){let n,d,h;async function g(){const w=d;if(w){d=void 0,n=w;try{await w.run(),h=w.key}catch(b){i(b)}n=void 0,d&&g()}}return{push(w,b=!1){!b&&w.key===h&&!n||!b&&w.key===n?.key&&!d||(d=w,n||g())}}}var vn=m("<span>Project Settings"),pn=m("<small>Project configuration"),mn=m("<strong>Project console failed"),hn=m("<span>"),wn=m("<div class=project-terminal-empty><strong>No terminal session selected</strong><span>Use + next to a worktree to start Kilo CLI."),bn=m("<div class=project-info-actions>"),yn=m('<section class=project-console><aside class=project-console-sidebar aria-label="Project console sections"><div class=project-console-title><span class=project-console-heading><span>Project</span></span><span class=project-console-scope><span class=project-console-name></span></span><small></small></div><div class=project-console-scroll><section class=project-sidebar-group><div class="project-panel-heading project-panel-heading-row"><span>Worktrees</span><button type=button class=project-heading-action title="Create worktree"aria-label="Create worktree">+</button></div><nav class=project-contexts aria-label=Worktrees></nav></section></div><div class=project-sidebar-bottom></div></aside><main class=project-console-main></main><aside class=project-console-info aria-label="Project details"><div class="project-info-card project-info-context"><div class=project-info-context-head><span class=project-panel-heading>Context</span></div><strong class=project-info-title></strong><code class=project-info-path></code></div><div class=project-info-review>'),$n=m("<button type=button class=project-inline-action>"),jn=m('<button type=button class="project-inline-action danger">'),kn=m("<div class=project-terminal-list>"),Cn=m("<div class=project-worktree-block><div class=project-context-row><button type=button class=project-context><span></span><small></small></button><div class=project-row-actions><button type=button class=project-inline-action>+"),_n=m("<div class=project-terminal-item><button type=button class=project-terminal-row><span class=project-console-dot aria-hidden=true></span><span></span></button><button type=button class=project-terminal-close>x"),Sn=m("<div class=project-terminal-frame>"),xn=m("<span class=project-terminal-loading>Starting terminal..."),In=m('<div class="project-review-state project-review-state-error">'),Ln=m("<div class=project-review-state><span>Loading changes…"),Dn=m("<div class=project-review-state>Loading changes..."),Tn=m("<span>Changes"),Pn=m("<div class=project-review-empty>No changes detected.");const En=Ze(()=>Je(()=>import("./GhosttyTerminal-CTbd0S4x.js"),__vite__mapDeps([0,1,2])).then(i=>({default:i.GhosttyTerminal}))),zn=Ze(()=>Je(()=>import("./session-review-BSr1Uyjk.js"),__vite__mapDeps([3,1,2,4,5,6])).then(i=>({default:i.SessionReview}))),Rn=Ze(()=>Je(()=>import("./file-y5xMoiQQ.js").then(i=>i.i),__vite__mapDeps([4,1,2])).then(i=>({default:i.File}))),Wn=new Set(["3017","3018"]);function be(i){return i.get("server")?!1:Wn.has(window.location.port)}function Mn(i){const n=i.get("server");if(n)return n;const d=be(i)?Ot():"";return d||(be(i)?"":window.location.origin)}function qt(i){return i.split(/[\\/]/).filter(Boolean).at(-1)??"Project"}function Mt(i){return Nt(qt(i))}function Ve(i){return typeof i=="object"&&i!==null}function Ut(i,n){if(!Ve(i))return;const d=i[n];if(Ve(d))return d}function Un(i){const n=i.payload,d="properties"in n?n.properties:"data"in n?n.data:void 0;if(!Ve(d))return;const h=d.sessionID;if(typeof h=="string")return h;const g=Ut(d,"info");if(typeof g?.sessionID=="string")return g.sessionID;if(typeof g?.id=="string")return g.id;const w=Ut(d,"part");if(typeof w?.sessionID=="string")return w.sessionID}function Qe(i){const n=i.payload;return n.type?n.type!=="sync"?n.type:typeof n.name=="string"?n.name:typeof n.syncEvent?.type=="string"?n.syncEvent.type:"":""}function Fn(i){return Qe(i).startsWith("message.")}function An(i){const n=Qe(i);return!!(n.startsWith("pty.")||n.startsWith("session.")||n.startsWith("permission.")||n.startsWith("question.")||n.startsWith("message.")||n==="global.config.updated")}function Ft(i,n){return`${i}
3
3
  ${n.directory}
4
4
  ${n.id}`}function Vn(){const i=xr(),n=Ir(),d=crypto.randomUUID(),h=$(()=>new URLSearchParams(i.search)),g=()=>Mn(h()),[w,b]=k(g()),[q,T]=k(window.localStorage.getItem(`kilo.console.${n.project}.dir`)??""),[R,B]=k(window.localStorage.getItem(`kilo.console.${n.project}.pty`)??""),[O,H]=k([]),[Q,I]=k([]),[N,V]=k({}),[We,ue]=k(Yr),[ye,$e]=k(window.innerWidth),[ee,je]=k(Zr),[P,te]=k(),[Me,re]=k(),[et,tt]=k(new Set),[Kt,Ue]=k(new Set),[Xt,rt]=k(0),[ne,ie]=k(),[fe,ke]=k(),ge={timer:void 0},y={timer:void 0,pending:!1,expected:void 0};let nt;const Ce=new Set,W=()=>n.project??"",C=$(()=>{const e=Tr(w())||g();if(!(!e||!W()))return{url:e,dir:"",project:W()}}),[v,{refetch:ve}]=It(C,Pr),it=$(()=>Math.min(We(),Ae())),_e=$(()=>{const e=v();return e?[{id:"local",dir:e.project.worktree,label:"Local",kind:"local",managed:!1},...e.worktrees.map(t=>({id:t.directory,dir:t.directory,label:Mt(t.directory),kind:"worktree",managed:t.managed}))]:[]}),Se=$(()=>{const e=new Map,t=Kt();for(const r of O())t.has(r.id)||r.status==="running"&&e.set(r.id,r);for(const r of v()?.terminals??[])t.has(r.id)||r.status==="running"&&e.set(r.id,r);return Array.from(e.values())}),Ht=$(()=>{const e=new Map;for(const t of Se()){const r=e.get(t.directory)??[];r.push(t),e.set(t.directory,r)}return e}),E=$(()=>_e().find(e=>e.dir===q())??_e()[0]),oe=$(()=>Se().find(e=>e.id===R())),Fe=$(()=>{const e=v(),t=E(),r=C();if(!(!e||!t||!r))return{url:r.url,dir:t.dir,scope:"project"}}),Vt=$(()=>{const e=Fe();if(e)return{input:e,dir:e.dir}}),[pe]=It(Vt,e=>Er(e.input,e.dir)),Gt=$(()=>{const e=N();return(pe()??[]).filter(t=>typeof t.file=="string").map(t=>e[t.file]??t)}),xe=$(()=>{const e=oe(),t=C();if(!(!e||!t))return Ft(t.url,e)}),ot=$(()=>{const e=new Map,t=C();if(!t)return e;for(const r of Se())e.set(Ft(t.url,r),r);return e}),Yt=$(()=>Array.from(ot().keys())),st=$(()=>{const e=h().toString();return`/projects/${encodeURIComponent(W())}/settings${e?`?${e}`:""}`});function se(){const e=C(),t=v();if(!(!e||!t))return{url:e.url,dir:t.project.worktree,scope:"project"}}function Ie(e){return`kilo.console.${W()}.worktree.${encodeURIComponent(e)}.label`}function M(e){return Xt(),window.localStorage.getItem(Ie(e.dir))?.trim()||e.label}function Zt(){const e=E();return e?M(e):"Project"}function Le(e){return e?.sessionID??e?.session?.id}function at(){return Le(oe())}function De(e){return e.session?.title||e.title||`Terminal ${e.id.slice(-4)}`}function Te(e){if(e.attention)return"attention";if(e.sessionStatus&&e.sessionStatus.type!=="idle")return"busy";const t=Le(e);return t&&et().has(t)?"unread":"idle"}function lt(e){const t=Le(e);if(!t||!et().has(t))return;tt(u=>{const f=new Set(u);return f.delete(t),f});const r=v()?.project.id;r&&t&&Br(r,t)}function Jt(e){if(e===at())return;tt(r=>r.has(e)?r:new Set([...r,e]));const t=v()?.project.id;t&&Nr(t,e)}function Qt(){ge.timer||(ge.timer=window.setTimeout(()=>{ge.timer=void 0,ve()},150))}function me(e){return Ht().get(e)??[]}function ae(e,t){if(window.localStorage.setItem(`kilo.console.${W()}.dir`,e),t){window.localStorage.setItem(`kilo.console.${W()}.pty`,t);return}window.localStorage.removeItem(`kilo.console.${W()}.pty`)}function er(e){T(e.dir);const t=me(e.dir)[0];B(t?.id??""),ae(e.dir,t?.id)}function tr(e){T(e.directory),B(e.id),lt(e),ae(e.directory,e.id)}function rr(e){const t=Fe();t&&(N()[e]||Ce.has(e)||(Ce.add(e),Kr(t,t.dir,e).then(r=>{r&&r.file&&V(u=>({...u,[r.file]:r}))}).catch(r=>console.warn("Worktree diff file:",r)).finally(()=>Ce.delete(e))))}function nr(e){I(e);for(const t of e)rr(t)}function ir(e){je(e);const t=C();t&&zt({url:t.url,dir:"",scope:"global"},{console:{diff_style:e}}).catch(r=>console.warn(`Console diff style: ${X(r)}`))}function or(e){const t=Wt(e);ue(t),y.pending=!0,y.expected=t,y.timer&&window.clearTimeout(y.timer),y.timer=window.setTimeout(()=>{y.timer=void 0;const r=C();if(!r){y.pending=!1,y.expected=void 0;return}zt({url:r.url,dir:"",scope:"global"},{console:{context_sidebar_width:t}}).catch(u=>{y.expected=void 0,console.warn(`Console sidebar width: ${X(u)}`)}).finally(()=>{y.pending=!1})},350)}function Ae(){return Math.max(Rt,Math.min(Jr,ye()-604))}function Be(e,t){te(e),re(void 0),t().then(()=>ve()).catch(r=>re(X(r))).finally(()=>te(void 0))}function sr(){se()&&ie({kind:"create",value:""})}function ar(){const e=ne();if(!e)return;if(e.kind==="rename"){const u=e.value.trim();u&&window.localStorage.setItem(Ie(e.item.dir),u),u||window.localStorage.removeItem(Ie(e.item.dir)),rt(f=>f+1),ie(void 0);return}const t=se();if(!t)return;const r=e.value.trim()||void 0;ie(void 0),Be("Creating worktree",async()=>{const u=await Xr(t,r);T(u.directory),window.localStorage.setItem(`kilo.console.${W()}.dir`,u.directory)})}function lr(e=E()){const t=C();if(!t||!e)return;const r={url:t.url,dir:e.dir},u=`Kilo ${me(e.dir).length+1}`;te("Creating session"),re(void 0),Or(r,e.dir,u).then(f=>{const _={...f,directory:e.dir};return H(he=>[...he.filter(le=>le.id!==_.id),_]),T(e.dir),B(_.id),ae(e.dir,_.id),ve()}).catch(f=>re(X(f))).finally(()=>te(void 0))}function ct(e){H(t=>t.filter(r=>r.id!==e)),R()===e&&(B(""),window.localStorage.removeItem(`kilo.console.${W()}.pty`))}function cr(e){ct(e),ve()}function dr(e){const t={url:C()?.url??"",dir:e.directory};t.url&&(Ue(r=>new Set([...r,e.id])),ct(e.id),te("Closing terminal"),re(void 0),qr(t,e.id).then(()=>ve()).then(()=>{Ue(r=>{const u=new Set(r);return u.delete(e.id),u})}).catch(r=>{Ue(u=>{const f=new Set(u);return f.delete(e.id),f}),re(X(r))}).finally(()=>te(void 0)))}function ur(e){e.kind!=="local"&&ie({kind:"rename",item:e,value:M(e)})}function Ne(e){return e?.kind==="worktree"&&e.managed}function dt(e){!se()||!Ne(e)||ke({kind:"delete",item:e})}function fr(){const e=E();e&&dt(e)}function gr(){const e=E();!se()||!Ne(e)||ke({kind:"reset",item:e})}function vr(){const e=fe(),t=se();if(!(!e||!t)){if(ke(void 0),e.kind==="reset"){Be("Resetting worktree",async()=>Hr(t,e.item.dir));return}Be("Removing worktree",async()=>{await Vr(t,e.item.dir),window.localStorage.removeItem(Ie(e.item.dir)),rt(r=>r+1),q()===e.item.dir&&(T(t.dir),ae(t.dir))})}}function pr(e){ie(t=>t&&{...t,value:e})}function mr(){const e=ne();return!e||e.kind==="create"?"Create worktree":`Rename ${M(e.item)}`}function hr(){return ne()?.kind==="rename"?"Leave the name blank to restore the generated worktree name.":"Choose a recognizable name, or leave it blank to generate one automatically."}function wr(){const e=fe();return e?`${e.kind==="reset"?"Reset":"Delete"} worktree ${M(e.item)}?`:""}function br(){return fe()?.kind==="reset"?"This discards all uncommitted changes in the worktree.":"This removes the worktree directory and its files from the project."}A(()=>{const e=v();if(!e)return;const t=Wt(e.config.console?.context_sidebar_width);y.expected===t&&(y.expected=void 0),!y.pending&&y.expected===void 0&&ue(t),je(Qr(e.config.console?.diff_style))}),A(()=>{const e=h().get("server");e&&e!==w()&&b(e)}),A(zr(()=>Fe()?.dir,()=>{I([]),V({}),Ce.clear()},{defer:!0})),A(()=>{be(h())&&Rr().then(e=>{e&&(Dt(e),b(e))})}),A(()=>{const e=v();!e||_e().some(r=>r.dir===q())||(T(e.project.worktree),ae(e.project.worktree))}),A(()=>{const e=new Set((v()?.terminals??[]).map(r=>r.id));if(e.size===0)return;const t=O();t.some(r=>e.has(r.id))&&H(t.filter(r=>!e.has(r.id)))}),A(()=>{const e=E();if(!e||oe()?.directory===e.dir)return;const r=me(e.dir)[0];(r?.id??"")!==R()&&(B(r?.id??""),ae(e.dir,r?.id))}),A(()=>{const e=oe();e&&lt(e)});let Oe;const ut=gn(e=>console.warn(`Viewed sessions: ${X(e)}`));function ft(e=!1){const t=C(),r=v();if(!t||!r)return;const u=at(),f=new Set;u&&f.add(u);for(const le of Se()){const Pe=Le(le);Pe&&f.add(Pe)}const _={url:t.url,dir:r.project.worktree},he=_.url+"|"+_.dir+"|"+[...f].sort().join(",");Oe=_,ut.push({key:he,run:async()=>{await Lt(_,{id:d,active:!1},[...f],[])}},e)}A(()=>ft());const yr=window.setInterval(()=>ft(!0),6e4);return A(()=>{const e=C(),t=v();if(!e||!t)return;const r=new Set([t.project.worktree,...t.worktrees.map(f=>f.directory)]),u=Wr({url:e.url,dir:t.project.worktree},f=>{if(f.directory!=="global"&&!r.has(f.directory))return;const _=Un(f);_&&Fn(f)&&Jt(_),!(y.pending&&Qe(f)==="pty.updated")&&An(f)&&Qt()});Ke(u)}),Lr(()=>{const e=nt;if(!e)return;const t=()=>$e(e.clientWidth);t();const r=new ResizeObserver(t);r.observe(e),Ke(()=>r.disconnect())}),Ke(()=>{if(ge.timer&&window.clearTimeout(ge.timer),y.timer&&window.clearTimeout(y.timer),window.clearInterval(yr),Oe){const e=Oe;ut.push({key:e.url+"|"+e.dir+"|",run:async()=>{await Lt(e,{id:d,active:!1},[],[])}},!0)}}),A(()=>{if(!v.error||!be(h()))return;const e=Ot();!e||e!==w()||(Mr(),b(""),Ur().then(t=>{t&&(Dt(t),b(t))}))}),(()=>{var e=yn(),t=e.firstChild,r=t.firstChild,u=r.firstChild;u.firstChild;var f=u.nextSibling,_=f.firstChild,he=f.nextSibling,le=r.nextSibling,Pe=le.firstChild,gt=Pe.firstChild,$r=gt.firstChild,vt=$r.nextSibling,jr=gt.nextSibling,kr=le.nextSibling,ce=t.nextSibling,pt=ce.nextSibling,Ee=pt.firstChild,qe=Ee.firstChild;qe.firstChild;var mt=qe.nextSibling,ht=mt.nextSibling,Cr=Ee.nextSibling;return Dr(o=>{nt=o},e),a(u,s(Tt,{class:"project-title-settings",get href(){return st()},title:"Project Settings","aria-label":"Project Settings",get children(){return s(Xe,{name:"settings-gear",size:"small"})}}),null),a(_,(()=>{var o=we(()=>!!v()?.project.name);return()=>o()?Nt(v()?.project.name??""):Mt(v()?.project.worktree??W())})()),a(he,()=>v()?.vcs.branch??"No branch"),vt.$$click=sr,a(jr,s(He,{get each(){return _e()},children:o=>(()=>{var U=Cn(),G=U.firstChild,L=G.firstChild,K=L.firstChild,de=K.nextSibling,F=L.nextSibling,Y=F.firstChild;return L.$$click=()=>er(o),a(K,()=>M(o)),a(de,(()=>{var l=we(()=>o.kind==="local");return()=>l()?"project":qt(o.dir)})()),Y.$$click=l=>{l.stopPropagation(),lr(o)},a(F,s(D,{get when(){return o.kind==="worktree"},get children(){return[(()=>{var l=$n();return l.$$click=c=>{c.stopPropagation(),ur(o)},a(l,s(Xe,{name:"edit",size:"small"})),J(c=>{var z=!!P(),S=`Rename ${M(o)}`,x=`Rename ${M(o)}`;return z!==c.e&&(l.disabled=c.e=z),S!==c.t&&j(l,"title",c.t=S),x!==c.a&&j(l,"aria-label",c.a=x),c},{e:void 0,t:void 0,a:void 0}),l})(),s(D,{get when(){return o.managed},get children(){var l=jn();return l.$$click=c=>{c.stopPropagation(),dt(o)},a(l,s(Xe,{name:"trash",size:"small"})),J(c=>{var z=!!P(),S=`Delete ${M(o)}`,x=`Delete ${M(o)}`;return z!==c.e&&(l.disabled=c.e=z),S!==c.t&&j(l,"title",c.t=S),x!==c.a&&j(l,"aria-label",c.a=x),c},{e:void 0,t:void 0,a:void 0}),l}})]}}),null),a(U,s(D,{get when(){return me(o.dir).length>0},get children(){var l=kn();return a(l,s(He,{get each(){return me(o.dir)},children:c=>(()=>{var z=_n(),S=z.firstChild,x=S.firstChild,ze=x.nextSibling,Z=S.nextSibling;return S.$$click=()=>tr(c),a(ze,()=>De(c)),Z.$$click=p=>{p.stopPropagation(),dr(c)},J(p=>{var wt=R()===c.id,bt=R()===c.id,yt=`${De(c)} (${c.pid})`,$t=Te(c)==="idle",jt=Te(c)==="busy",kt=Te(c)==="attention",Ct=Te(c)==="unread",_t=!!P(),St=`Close ${De(c)}`,xt=`Close ${De(c)}`;return wt!==p.e&&z.classList.toggle("active",p.e=wt),bt!==p.t&&S.classList.toggle("active",p.t=bt),yt!==p.a&&j(S,"title",p.a=yt),$t!==p.o&&x.classList.toggle("project-console-dot-idle",p.o=$t),jt!==p.i&&x.classList.toggle("project-console-dot-busy",p.i=jt),kt!==p.n&&x.classList.toggle("project-console-dot-attention",p.n=kt),Ct!==p.s&&x.classList.toggle("project-console-dot-unread",p.s=Ct),_t!==p.h&&(Z.disabled=p.h=_t),St!==p.r&&j(Z,"title",p.r=St),xt!==p.d&&j(Z,"aria-label",p.d=xt),p},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),z})()})),l}}),null),J(l=>{var c=E()?.dir===o.dir&&!oe(),z=E()?.dir===o.dir&&!oe(),S=o.dir,x=!C()||!!P(),ze=`New session in ${M(o)}`,Z=`New session in ${M(o)}`;return c!==l.e&&G.classList.toggle("active",l.e=c),z!==l.t&&L.classList.toggle("active",l.t=z),S!==l.a&&j(L,"title",l.a=S),x!==l.o&&(Y.disabled=l.o=x),ze!==l.i&&j(Y,"title",l.i=ze),Z!==l.n&&j(Y,"aria-label",l.n=Z),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),U})()})),a(kr,s(Tt,{class:"project-settings-link",get href(){return st()},get children(){return[vn(),pn()]}})),a(ce,s(D,{get when(){return we(()=>!C())()&&be(h())},get children(){return s(Pt,{variant:"fullscreen"})}}),null),a(ce,s(D,{get when(){return we(()=>!!v.loading)()&&!v()},get children(){return s(Pt,{variant:"fullscreen"})}}),null),a(ce,s(D,{get when(){return v.error||Me()},get children(){return s(Fr,{class:"banner",variant:"error",get children(){return[mn(),(()=>{var o=hn();return a(o,()=>Me()??X(v.error)),o})()]}})}}),null),a(ce,s(He,{get each(){return Yt()},children:o=>{const U=$(()=>ot().get(o)),G=$(()=>{const L=U(),K=C();if(!(!L||!K))return{url:K.url,dir:L.directory,scope:"project"}});return s(D,{get when(){return G()},children:L=>{const K=U();return K?(()=>{var de=Sn();return a(de,s(Et,{get fallback(){return xn()},get children(){return s(En,{get query(){return L()},get pty(){return K.id},get active(){return xe()===o},onExit:()=>{const F=U();F&&cr(F.id)}})}})),J(F=>{var Y=xe()===o,l=xe()!==o;return Y!==F.e&&de.classList.toggle("active",F.e=Y),l!==F.t&&j(de,"aria-hidden",F.t=l),F},{e:void 0,t:void 0}),de})():null}})}}),null),a(ce,s(D,{get when(){return we(()=>!xe()&&!v.loading&&!v.error)()&&!Me()},get children(){return wn()}}),null),a(pt,s(on,{direction:"horizontal",edge:"start",get size(){return it()},min:Rt,get max(){return Ae()},"aria-label":"Resize project context sidebar",onResize:or}),Ee),a(qe,s(rn,{variant:"outline",get children(){return E()?.kind==="worktree"?"Worktree":"Local"}}),null),a(mt,Zt),a(ht,()=>E()?.dir??v()?.project.worktree??W()),a(Ee,s(D,{get when(){return Ne(E())},get children(){var o=bn();return a(o,s(Re,{variant:"secondary",size:"small",onClick:gr,get disabled(){return!!P()},children:"Reset"}),null),a(o,s(Re,{variant:"destructive",size:"small",onClick:fr,get disabled(){return!!P()},children:"Delete"}),null),o}}),null),a(Cr,s(D,{get when(){return!pe.error},get fallback(){return(()=>{var o=In();return a(o,()=>X(pe.error)),o})()},get children(){return s(D,{get when(){return!(pe.loading&&!pe())},get fallback(){return(()=>{var o=Ln(),U=o.firstChild;return a(o,s(en,{}),U),o})()},get children(){return s(Et,{get fallback(){return Dn()},get children(){return s(an,{component:Rn,get children(){return s(zn,{get diffs(){return Gt()},get title(){return Tn()},get diffStyle(){return ee()},onDiffStyleChange:ir,get open(){return Q()},onOpenChange:nr,get empty(){return Pn()}})}})}})}})}})),a(e,s(fn,{get open(){return!!ne()},get title(){return mr()},get message(){return hr()},label:"Worktree name",get value(){return ne()?.value??""},placeholder:"feature-name",get confirm(){return ne()?.kind==="rename"?"Save":"Create"},get busy(){return!!P()},onInput:pr,onCancel:()=>ie(void 0),onConfirm:ar}),null),a(e,s(tn,{get open(){return!!fe()},get title(){return wr()},get message(){return br()},get confirm(){return fe()?.kind==="reset"?"Reset":"Delete"},get busy(){return!!P()},onCancel:()=>ke(void 0),onConfirm:vr}),null),J(o=>{var U=`--project-info-width: ${it()}px; --project-info-max: ${Ae()}px`,G=!se()||!!P(),L=E()?.dir;return o.e=Ar(e,U,o.e),G!==o.t&&(vt.disabled=o.t=G),L!==o.a&&j(ht,"title",o.a=L),o},{e:void 0,t:void 0,a:void 0}),e})()}Bt(["click"]);export{Vn as ProjectConsoleRoute};