import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{Ei as t,Fi as n,er as r}from"./control-ui-foundation-CeFMP1Ly.js";import{U as i,cs as a,is as o}from"./control-ui-core-pH6nakZ-.js";import{G as s,J as c,W as l,Z as u,at as d,rt as f}from"./lit-runtime-BEtFSUCp.js";import{Cn as p,Gn as m,Sn as h,bn as g,cn as _,gn as v,ln as y,mn as ee,on as te,pn as b,qn as x,vn as S,wn as ne,yn as re,zn as C}from"./control-ui-core-DGVkFhVB.js";import{Ht as w,K as ie,Lt as T,Rt as E,q as ae,qt as D}from"./control-ui-core-Br5DB0Zj.js";import{Hl as oe,Ul as O,wr as k}from"./control-ui-boot-Cdpgu1Gm.js";import{a as A,c as j,g as M,h as N,i as P,n as F,t as I}from"./config-form.tiers-DLXolKGz.js";import{d as L,o as R,p as z,r as B}from"./memory-schema-3MkJhUhF.js";import{a as V,i as H}from"./settings-targets-GAGqNu16.js";function U(e){let t=D(e.labelKey);return{routeId:e.routeId,...e.search===void 0?{}:{search:e.search},hash:e.hash,label:t,searchText:[t,...e.searchKeys.map(e=>D(e)),e.aliases??``].join(` `)}}function W(e,t){let n=q[e],r=t.properties;if(!n||!r)return t;let i=new Set(n());return{...t,properties:Object.fromEntries(Object.entries(r).filter(([e])=>i.has(e)))}}function G(e){if(!e.query.trim())return[];let t=j(e.query),n=t.tags.length===0&&t.text?K.filter(t=>(e.identityAvailable||!t.requiresIdentity)&&b(t.routeId,e.canAdmin!==!1)).map(U).filter(e=>g(e.searchText,t.text)):[],r=e.schema&&typeof e.schema==`object`&&!Array.isArray(e.schema)?e.schema:null;if(!r||a(r)!==`object`||!r.properties)return n;let i=e.value??{};for(let[t,a]of Object.entries(r.properties)){let r=L(t);if(!b(r,e.canAdmin!==!1))continue;let o=W(r,a),s=N[t],c=F({schema:o,path:[t],hints:e.uiHints}),l=n=>!!(n&&A({key:t,schema:n,value:i[t],hints:e.uiHints,query:e.query,label:s?.label,description:s?.description,textMatcher:g})),u=l(c.common),d=l(c.advanced);if(!u&&!d)continue;let f=encodeURIComponent(t),p={search:``,hash:`#config-section-${f}`};n.push(r===`memory`?{routeId:r,label:s?.label??o.title??t,pathname:m(`settings`,e.basePath),hash:p.hash}:{routeId:r,label:s?.label??o.title??t,search:`?section=${f}${d?`&advanced=1`:``}`,hash:p.hash})}return n}var K,q;function J(){return(J=e((()=>{y(),C(),M(),P(),I(),w(),o(),z(),B(),V(),K=Object.values(H),q={memory:R,updates:()=>[`channel`,`auto`]}})))()}var Y,X;function Z(){return(Z=e((()=>{l(),u(),w(),E(),Y=2e3,X=class extends n{constructor(...e){super(...e),this.savedVisible=!1}createRenderRoot(){return this}willUpdate(){let e=this.props?.status;this.previousStatus===`saving`&&e===`saved`?(this.clearSavedTimer(),this.savedVisible=!0,this.savedTimer=globalThis.setTimeout(()=>{this.savedTimer=void 0,this.savedVisible=!1},Y)):e!==`saved`&&(this.clearSavedTimer(),this.savedVisible=!1),this.previousStatus=e}disconnectedCallback(){this.clearSavedTimer(),super.disconnectedCallback()}clearSavedTimer(){globalThis.clearTimeout(this.savedTimer),this.savedTimer=void 0}renderClaw(e){return c``}render(){let e=this.props;if(!e)return s;let t,n=``,r=``,i=``;if(e.applying)t=c` ${D(`configView.applying`)}`;else if(e.status===`saving`)t=c` ${this.renderClaw(`settings-save-indicator__claw--saving`)} ${D(`configView.autoSaveSaving`)}`;else if(e.status===`error`)i=e.lastError?.trim()??``,r=i?`${D(`configView.autoSaveFailed`)}: ${i}`:``,n=` settings-save-indicator--danger`,t=c` ${D(`configView.autoSaveFailed`)} `;else if(e.status===`paused`)t=c` ${D(`configView.autoSavePaused`)} `;else if(e.status===`conflict`)n=` settings-save-indicator--danger`,t=c` ${D(`configView.autoSaveConflict`)} `;else if(this.savedVisible)n=` settings-save-indicator--saved`,t=c` ${this.renderClaw(`settings-save-indicator__claw--saved`)} ${D(`configView.autoSaveSaved`)}`;else if(e.needsApply)t=c` `;else return s;return c`