home-hosted 0.10.2 → 0.11.0

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.
@@ -36,18 +36,18 @@ Right: ${t}`,gT=(e,t)=>`The intersection of two ordered unions is indeterminate:
36
36
  Left: ${e}
37
37
  Right: ${t}`,_T={implementation:LS({kind:`unit`,hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:e=>e instanceof Date?e.toISOString():FS(e)}},normalize:e=>e,defaults:{description:e=>Kx(e.unit),problem:({expected:e,actual:t})=>`${e===t?`must be reference equal to ${e} (serialized to the same value)`:`must be ${e} (was ${t})`}`},intersections:{unit:(e,t)=>sC.init(`unit`,e,t),...Iw(`unit`,(e,t)=>{if(t.allows(e.unit))return e;let n=t.hasKind(`intersection`)?t.basis:t;if(n){let t=n.hasKind(`domain`)?n:q.intrinsic.object;if(e.domain!==t.domain){let n=e.domain===`undefined`||e.domain===`null`||e.domain===`boolean`?e.domain:q.intrinsic[e.domain];return sC.init(`domain`,n,t)}}return sC.init(`assignability`,e,t.hasKind(`intersection`)?t.children.find(t=>!t.allows(e.unit)):t)})}}),Node:class extends Uw{compiledValue=this.json.unit;serializedValue=typeof this.unit==`string`||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=vT(this.unit,this.serializedValue);compiledNegation=vT(this.unit,this.serializedValue,`negated`);expression=Kx(this.unit);domain=hb(this.unit);get defaultShortDescription(){return this.domain===`object`?gb.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:`null`}:q.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:e.fallback.unit({code:`unit`,base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?e=>e instanceof Date&&e.toISOString()===this.compiledValue:Number.isNaN(this.unit)?e=>Number.isNaN(e):e=>e===this.unit}},vT=(e,t,n)=>{if(e instanceof Date){let e=`data instanceof Date && data.toISOString() === ${t}`;return n?`!(${e})`:e}return Number.isNaN(e)?`${n?`!`:``}Number.isNaN(data)`:`data ${n?`!`:`=`}== ${t}`},yT={implementation:LS({kind:`index`,hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(e,t)=>{let n=t.$.parseSchema(e);if(!n.extends(q.intrinsic.key))return K(xT(n.expression));let r=n.branches.filter(e=>e.hasKind(`unit`));return r.length?K(bT(r.map(e=>Kx(e.unit)))):n}},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`[${e.signature.expression}]: ${e.value.description}`},intersections:{index:(e,t,n)=>{if(e.signature.equals(t.signature)){let r=mC(e.value,t.value,n),i=r instanceof sC?q.intrinsic.never.internal:r;return n.$.node(`index`,{signature:e.signature,value:i})}return e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:null}}}),Node:class extends yC{impliedBasis=q.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=cb(this.value.flatRefs.map(e=>rC([this.signature,...e.path],e.node)),rC([this.signature],this.value));traverseAllows=(e,t)=>Pb(e).every(e=>!this.signature.traverseAllows(e[0],t)||XS(e[0],()=>this.value.traverseAllows(e[1],t),t));traverseApply=(e,t)=>{for(let n of Pb(e))this.signature.traverseAllows(n[0],t)&&XS(n[0],()=>this.value.traverseApply(n[1],t),t)};_transform(e,t){t.path.push(this.signature);let n=super._transform(e,t);return t.path.pop(),n}compile(){}}},bT=e=>`Index keys ${e.join(`, `)} should be specified as named props.`,xT=e=>`Indexed key definition '${e}' must be a string or symbol`,ST={implementation:LS({kind:`required`,hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(e,t)=>t.$.parseSchema(e)}},normalize:e=>e,defaults:{description:e=>`${e.compiledKey}: ${e.value.description}`,expected:e=>e.missingValueDescription,actual:()=>`missing`},intersections:{required:_w,optional:_w}}),Node:class extends vw{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:`required`,missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=IS(this.errorContext)}},CT=LS({kind:`sequence`,hasAssociatedError:!1,collapsibleKey:`variadic`,keys:{prefix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}},optionals:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}},defaultables:{child:e=>e.map(e=>e[0]),parse:(e,t)=>{if(e.length!==0)return e.map(e=>{let n=t.$.parseSchema(e[0]);return ww(n,e[1],null),[n,e[1]]})},serialize:e=>e.map(e=>[e[0].collapsibleJson,FS(e[1])]),reduceIo:(e,t,n)=>{e===`in`?t.optionals=n.map(e=>e[0].rawIn):t.prefix=n.map(e=>e[0].rawOut)}},variadic:{child:!0,parse:(e,t)=>t.$.parseSchema(e,t)},minVariadicLength:{parse:e=>e===0?void 0:e},postfix:{child:!0,parse:(e,t)=>{if(e.length!==0)return e.map(e=>t.$.parseSchema(e))}}},normalize:e=>{if(typeof e==`string`)return{variadic:e};if(`variadic`in e||`prefix`in e||`defaultables`in e||`optionals`in e||`postfix`in e||`minVariadicLength`in e){if(e.postfix?.length){if(!e.variadic)return K(jT);if(e.optionals?.length||e.defaultables?.length)return K(AT)}return e.minVariadicLength&&!e.variadic?K(`minVariadicLength may not be specified without a variadic element`):e}return{variadic:e}},reduce:(e,t)=>{let n=e.minVariadicLength??0,r=e.prefix?.slice()??[],i=e.defaultables?.slice()??[],a=e.optionals?.slice()??[],o=e.postfix?.slice()??[];if(e.variadic){for(;a[a.length-1]?.equals(e.variadic);)a.pop();if(a.length===0&&i.length===0)for(;r[r.length-1]?.equals(e.variadic);)r.pop(),n++;for(;o[0]?.equals(e.variadic);)o.shift(),n++}else a.length===0&&i.length===0&&r.push(...o.splice(0));if(n!==e.minVariadicLength||e.prefix&&e.prefix.length!==r.length)return t.node(`sequence`,{...e,prefix:r,defaultables:i,optionals:a,postfix:o,minVariadicLength:n},{prereduced:!0})},defaults:{description:e=>e.isVariadicOnly?`${e.variadic.nestableExpression}[]`:`[${e.tuple.map(e=>e.kind===`defaultables`?`${e.node.nestableExpression} = ${Kx(e.default)}`:e.kind===`optionals`?`${e.node.nestableExpression}?`:e.kind===`variadic`?`...${e.node.nestableExpression}[]`:e.node.expression).join(`, `)}]`},intersections:{sequence:(e,t,n)=>{let r=MT({l:e.tuple,r:t.tuple,disjoint:new sC,result:[],fixedVariants:[],ctx:n}),i=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return i.length===0?r.disjoint:i.length===1?n.$.node(`sequence`,kT(i[0].result)):n.$.node(`union`,i.map(e=>({proto:Array,sequence:kT(e.result)})))}}}),wT=class extends yC{impliedBasis=q.intrinsic.Array.internal;tuple=OT(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(e=>e.kind===`defaultables`||e.kind===`optionals`?(this.defaultablesAndOptionals.push(e.node),!0):e.kind===`prefix`);variadicOrPostfix=lb(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return aC(this.flatRefs,this.prevariadic.flatMap((e,t)=>cb(e.node.flatRefs.map(e=>rC([`${t}`,...e.path],e.node)),rC([`${t}`],e.node)))),aC(this.flatRefs,this.variadicOrPostfix.flatMap(e=>cb(e.flatRefs.map(e=>rC([q.intrinsic.nonNegativeIntegerString.internal,...e.path],e.node)),rC([q.intrinsic.nonNegativeIntegerString.internal],e)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node(`minLength`,this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node(`maxLength`,this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=ET(this);defaultValueMorphsReference=this.defaultValueMorphs.length?dS(this.defaultValueMorphs):void 0;optionalize(){let{prefix:e,defaultables:t,...n}=this.inner;return e?this.$.node(`sequence`,{...n,optionals:lb(e,this.defaultablesAndOptionals)}):this}require(){let{defaultables:e,optionals:t,...n}=this.inner;return this.$.node(`sequence`,{...n,prefix:lb(this.prefix,this.defaultablesAndOptionals)})}elementAtIndex(e,t){if(t<this.prevariadic.length)return this.tuple[t];let n=e.length-this.postfixLength;return t>=n?{kind:`postfix`,node:this.postfix[t-n]}:{kind:`variadic`,node:this.variadic??yb(`Unexpected attempt to access index ${t} on ${this}`)}}traverseAllows=(e,t)=>{for(let n=0;n<e.length;n++)if(!this.elementAtIndex(e,n).node.traverseAllows(e[n],t))return!1;return!0};traverseApply=(e,t)=>{let n=t.currentErrorCount,r=0;for(;r<e.length;r++)if(XS(r,()=>this.elementAtIndex(e,r).node.traverseApply(e[r],t),t),t.failFast&&t.currentErrorCount>n)return};get element(){return this.cacheGetter(`element`,this.$.node(`union`,this.children))}compile(e){if(e.traversalKind===`Apply`&&e.initializeErrorCount(),this.prefix)for(let[t,n]of this.prefix.entries())e.traverseKey(`${t}`,`data[${t}]`,n),e.traversalKind===`Apply`&&e.returnIfFailFast();for(let[t,n]of this.defaultablesAndOptionals.entries()){let r=`${t+this.prefixLength}`;e.if(`${r} >= data.length`,()=>e.traversalKind===`Allows`?e.return(!0):e.return()),e.traverseKey(r,`data[${r}]`,n),e.traversalKind===`Apply`&&e.returnIfFailFast()}if(this.variadic&&(this.postfix&&e.const(`firstPostfixIndex`,`data.length${this.postfix?`- ${this.postfix.length}`:``}`),e.for(`i < ${this.postfix?`firstPostfixIndex`:`data.length`}`,()=>(e.traverseKey(`i`,`data[i]`,this.variadic),e.traversalKind===`Apply`?e.returnIfFailFast():e),this.prevariadic.length),this.postfix))for(let[t,n]of this.postfix.entries()){let r=`firstPostfixIndex + ${t}`;e.traverseKey(r,`data[${r}]`,n),e.traversalKind===`Apply`&&e.returnIfFailFast()}e.traversalKind===`Allows`&&e.return(!0)}_transform(e,t){t.path.push(q.intrinsic.nonNegativeIntegerString.internal);let n=super._transform(e,t);return t.path.pop(),n}expression=this.description;reduceJsonSchema(e,t){let n=t.target===`draft-07`;if(this.prevariadic.length){let r=this.prevariadic.map(e=>{let n=e.node.toJsonSchemaRecurse(t);if(e.kind===`defaultables`){let r=typeof e.default==`function`?e.default():e.default;n.default=q.intrinsic.jsonData.allows(r)?r:t.fallback.defaultValue({code:`defaultValue`,base:n,value:r})}return n});n?e.items=r:e.prefixItems=r}if(this.minLength&&(e.minItems=this.minLength),this.variadic){let r=this.variadic.toJsonSchemaRecurse(t);if(n&&this.prevariadic.length?e.additionalItems=r:e.items=r,this.maxLength&&(e.maxItems=this.maxLength),this.postfix){let n=this.postfix.map(e=>e.toJsonSchemaRecurse(t));e=t.fallback.arrayPostfix({code:`arrayPostfix`,base:e,elements:n})}}else n?e.additionalItems=!1:e.items=!1,delete e.maxItems;return e}},TT={},ET=e=>{if(!e.defaultables)return[];let t=[],n=`[`,r=e.prefixLength+e.defaultablesLength-1;for(let i=e.prefixLength;i<=r;i++){let[r,a]=e.defaultables[i-e.prefixLength];t.push(Cw(i,r,a)),n+=`${i}: ${r.id} = ${FS(a)}, `}return n+=`]`,TT[n]??=t},DT={implementation:CT,Node:wT},OT=e=>{let t=[];if(e.prefix)for(let n of e.prefix)t.push({kind:`prefix`,node:n});if(e.defaultables)for(let[n,r]of e.defaultables)t.push({kind:`defaultables`,node:n,default:r});if(e.optionals)for(let n of e.optionals)t.push({kind:`optionals`,node:n});if(e.variadic&&t.push({kind:`variadic`,node:e.variadic}),e.postfix)for(let n of e.postfix)t.push({kind:`postfix`,node:n});return t},kT=e=>e.reduce((e,t)=>(t.kind===`variadic`?e.variadic=t.node:t.kind===`defaultables`?e.defaultables=cb(e.defaultables,[[t.node,t.default]]):e[t.kind]=cb(e[t.kind],t.node),e),{}),AT=`A postfix required element cannot follow an optional or defaultable element`,jT=`A postfix element requires a variadic element`,MT=e=>{let[t,...n]=e.l,[r,...i]=e.r;if(!t||!r)return e;let a=n[n.length-1]?.kind===`postfix`,o=i[i.length-1]?.kind===`postfix`,s=t.kind===`prefix`||r.kind===`prefix`?`prefix`:t.kind===`postfix`||r.kind===`postfix`?`postfix`:t.kind===`variadic`&&r.kind===`variadic`?`variadic`:a||o?`prefix`:t.kind===`defaultables`||r.kind===`defaultables`?`defaultables`:`optionals`;if(t.kind===`prefix`&&r.kind===`variadic`&&o){let t=MT({...e,fixedVariants:[],r:i.map(e=>({...e,kind:`prefix`}))});t.disjoint.length===0&&e.fixedVariants.push(t)}else if(r.kind===`prefix`&&t.kind===`variadic`&&a){let t=MT({...e,fixedVariants:[],l:n.map(e=>({...e,kind:`prefix`}))});t.disjoint.length===0&&e.fixedVariants.push(t)}let c=mC(t.node,r.node,e.ctx);if(c instanceof sC){if(s===`prefix`||s===`postfix`)e.disjoint.push(...c.withPrefixKey(s===`prefix`?e.result.length:`-${n.length+1}`,NT(t)&&NT(r)?`required`:`optional`)),e.result=[...e.result,{kind:s,node:q.intrinsic.never.internal}];else if(s===`optionals`||s===`defaultables`)return e;else return MT({...e,fixedVariants:[],l:n.map(e=>({...e,kind:`prefix`})),r:n.map(e=>({...e,kind:`prefix`}))})}else s===`defaultables`?(t.kind===`defaultables`&&r.kind===`defaultables`&&t.default!==r.default&&K(yw(t.default,r.default)),e.result=[...e.result,{kind:s,node:c,default:t.kind===`defaultables`?t.default:r.kind===`defaultables`?r.default:yb(`Unexpected defaultable intersection from ${t.kind} and ${r.kind} elements.`)}]):e.result=[...e.result,{kind:s,node:c}];let l=e.l.length,u=e.r.length;return(t.kind!==`variadic`||l>=u&&(r.kind===`variadic`||u===1))&&(e.l=n),(r.kind!==`variadic`||u>=l&&(t.kind===`variadic`||l===1))&&(e.r=i),MT(e)},NT=e=>e.kind===`prefix`||e.kind===`postfix`,PT=e=>t=>{if(t.props.length||t.index){let n=t.index?.map(t=>t[e])??[];for(let r of t.props)n.push(r[e]);t.undeclared&&n.push(`+ (undeclared): ${t.undeclared}`);let r=`{ ${n.join(`, `)} }`;return t.sequence?`${r} & ${t.sequence.description}`:r}return t.sequence?.description??`{}`},FT=PT(`description`),IT=PT(`expression`),LT=(e,t,n)=>{let r=e.required?`required`:`optional`;if(!t.signature.allows(e.key))return null;let i=fC(e.value,t.value,n);return i instanceof sC?r===`optional`?n.node(`optional`,{key:e.key,value:q.intrinsic.never.internal}):i.withPrefixKey(e.key,e.kind):null},RT=LS({kind:`structure`,hasAssociatedError:!1,normalize:e=>e,applyConfig:(e,t)=>!e.undeclared&&t.onUndeclaredKey!==`ignore`?{...e,undeclared:t.onUndeclaredKey}:e,keys:{required:{child:!0,parse:xC(`required`),reduceIo:(e,t,n)=>{t.required=cb(t.required,n.map(t=>e===`in`?t.rawIn:t.rawOut))}},optional:{child:!0,parse:xC(`optional`),reduceIo:(e,t,n)=>{if(e===`in`)t.optional=n.map(e=>e.rawIn);else for(let e of n)t[e.outProp.kind]=cb(t[e.outProp.kind],e.outProp.rawOut)}},index:{child:!0,parse:xC(`index`)},sequence:{child:!0,parse:xC(`sequence`)},undeclared:{parse:e=>e===`ignore`?void 0:e,reduceIo:(e,t,n)=>{n===`reject`?t.undeclared=`reject`:e===`in`?delete t.undeclared:t.undeclared=`reject`}}},defaults:{description:FT},intersections:{structure:(e,t,n)=>{let r={...e.inner},i={...t.inner},a=new sC,o=[];if(e.undeclared){let r=e.keyof();for(let e of t.requiredKeys)r.allows(e)||a.add(`presence`,q.intrinsic.never.internal,t.propsByKey[e].value,{path:[e]});i.optional&&=i.optional.filter(e=>r.allows(e.key)),i.index&&=i.index.flatMap(e=>{if(e.signature.extends(r))return e;let t=fC(r,e.signature,n.$);if(t instanceof sC)return[];let i=qT(t,e.value,n.$);return o.push(...i.required??[]),o.push(...i.optional??[]),i.index??[]})}if(t.undeclared){let i=t.keyof();for(let t of e.requiredKeys)i.allows(t)||a.add(`presence`,e.propsByKey[t].value,q.intrinsic.never.internal,{path:[t]});r.optional&&=r.optional.filter(e=>i.allows(e.key)),r.index&&=r.index.flatMap(e=>{if(e.signature.extends(i))return e;let t=fC(i,e.signature,n.$);if(t instanceof sC)return[];let r=qT(t,e.value,n.$);return o.push(...r.required??[]),o.push(...r.optional??[]),r.index??[]})}let s={};(e.undeclared||t.undeclared)&&(s.undeclared=e.undeclared===`reject`||t.undeclared===`reject`?`reject`:`delete`);let c=SC({kind:`structure`,baseInner:s,l:CC(r),r:[...CC(i),...o],roots:[],ctx:n});return c instanceof sC&&a.push(...c),a.length?a:c}},reduce:(e,t)=>{if(!e.required&&!e.optional)return;let n=Object.create(null),r=!1,i=e.optional?[...e.optional]:[];if(e.required)for(let r=0;r<e.required.length;r++){let i=e.required[r];if(i.key in n&&K(XT(i.key)),n[i.key]=!0,e.index)for(let n of e.index){let e=LT(i,n,t);if(e instanceof sC)return e}}if(e.optional)for(let a=0;a<e.optional.length;a++){let o=e.optional[a];if(o.key in n&&K(XT(o.key)),n[o.key]=!0,e.index)for(let n of e.index){let e=LT(o,n,t);if(e instanceof sC)return e;e!==null&&(i[a]=e,r=!0)}}if(r)return t.node(`structure`,{...e,optional:i},{prereduced:!0})}}),zT=class extends yC{impliedBasis=q.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=lb(this.required,this.optional);propsByKey=Cb(this.props,(e,t)=>[t.key,t]);propsByKeyReference=dS(this.propsByKey);expression=IT(this);requiredKeys=this.required?.map(e=>e.key)??[];optionalKeys=this.optional?.map(e=>e.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.$.units(this.literalKeys).branches;if(this.index)for(let{signature:t}of this.index)e=e.concat(t.branches);return this._keyof=this.$.node(`union`,e)}map(e){return this.$.node(`structure`,this.props.flatMap(e).reduce((e,t)=>{let n=this.propsByKey[t.key];if(xS(t))return t.kind!==`required`&&t.kind!==`optional`?K(`Map result must have kind "required" or "optional" (was ${t.kind})`):(e[t.kind]=cb(e[t.kind],t),e);let r=t.kind??n?.kind??`required`,i=Cb(t,(e,t)=>e in bw.implementation.keys?[e,t]:[]);return e[r]=cb(e[r],this.$.node(r,i)),e},{}))}assertHasKeys(e){let t=e.filter(e=>!Mw(e,this.keyof()));if(t.length)return K(YT(this.expression,t))}get(e,...t){let n,r=!1,i=GT(e);if((typeof i==`string`||typeof i==`symbol`)&&this.propsByKey[i]&&(n=this.propsByKey[i].value,r=this.propsByKey[i].required),this.index)for(let e of this.index)Mw(i,e.signature)&&(n=n?.and(e.value)??e.value);if(this.sequence&&Mw(i,q.intrinsic.nonNegativeIntegerString)){if(bS(i,`root`))this.sequence.variadic&&(n=n?.and(this.sequence.element)??this.sequence.element);else{let e=Number.parseInt(i);if(e<this.sequence.prevariadic.length){let t=this.sequence.prevariadic[e].node;n=n?.and(t)??t,r||=e<this.sequence.prefixLength}else if(this.sequence.variadic){let e=this.$.node(`union`,this.sequence.variadicOrPostfix);n=n?.and(e)??e}}}if(!n)return this.sequence?.variadic&&bS(i,`root`)&&i.extends(q.intrinsic.number)?K(KT(i.expression,this.sequence.expression)):K(YT(this.expression,[i]));let a=n.get(...t);return r?a:a.or(q.intrinsic.undefined)}pick(...e){return this.assertHasKeys(e),this.$.node(`structure`,this.filterKeys(`pick`,e))}omit(...e){return this.assertHasKeys(e),this.$.node(`structure`,this.filterKeys(`omit`,e))}optionalize(){let{required:e,...t}=this.inner;return this.$.node(`structure`,{...t,...t.sequence?{sequence:t.sequence.optionalize()}:{},optional:this.props.map(e=>e.hasKind(`required`)?this.$.node(`optional`,e.inner):e)})}require(){let{optional:e,...t}=this.inner;return this.$.node(`structure`,{...t,...t.sequence?{sequence:t.sequence.require()}:{},required:this.props.map(e=>e.hasKind(`optional`)?{key:e.key,value:e.value}:e)})}merge(e){let t=this.filterKeys(`omit`,[e.keyof()]);return e.required&&(t.required=cb(t.required,e.required)),e.optional&&(t.optional=cb(t.optional,e.optional)),e.index&&(t.index=cb(t.index,e.index)),e.sequence&&(t.sequence=e.sequence),e.undeclared?t.undeclared=e.undeclared:delete t.undeclared,this.$.node(`structure`,t)}filterKeys(e,t){let n=vS(this.inner),r=n=>{let r=t.some(e=>Mw(n,e));return e===`pick`?r:!r};return n.required&&=n.required.filter(e=>r(e.key)),n.optional&&=n.optional.filter(e=>r(e.key)),n.index&&=n.index.filter(e=>r(e.signature)),n}traverseAllows=(e,t)=>this._traverse(`Allows`,e,t);traverseApply=(e,t)=>this._traverse(`Apply`,e,t);_traverse=(e,t,n)=>{let r=n?.currentErrorCount??0;for(let i=0;i<this.props.length;i++)if(e===`Allows`){if(!this.props[i].traverseAllows(t,n))return!1}else if(this.props[i].traverseApply(t,n),n.failFast&&n.currentErrorCount>r)return!1;if(this.sequence){if(e===`Allows`){if(!this.sequence.traverseAllows(t,n))return!1}else if(this.sequence.traverseApply(t,n),n.failFast&&n.currentErrorCount>r)return!1}if(this.index||this.undeclared===`reject`){let i=Object.keys(t);i.push(...Object.getOwnPropertySymbols(t));for(let a=0;a<i.length;a++){let o=i[a];if(this.index){for(let i of this.index)if(i.signature.traverseAllows(o,n)){if(e===`Allows`){if(!XS(o,()=>i.value.traverseAllows(t[o],n),n))return!1}else if(XS(o,()=>i.value.traverseApply(t[o],n),n),n.failFast&&n.currentErrorCount>r)return!1}}if(this.undeclared===`reject`&&!this.declaresKey(o)&&(e===`Allows`||(n.errorFromNodeContext({code:`predicate`,expected:`removed`,actual:``,relativePath:[o],meta:this.meta}),n.failFast)))return!1}}return this.structuralMorph&&n&&!n.hasError()&&n.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter(`defaultable`,this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(t=>t.signature.allows(e))||this.sequence!==void 0&&q.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){let t=[];if(this.props.length&&t.push(`k in ${this.propsByKeyReference}`),this.index)for(let n of this.index)t.push(e.invoke(n.signature,{kind:`Allows`,arg:`k`}));return this.sequence&&t.push(`$ark.intrinsic.nonNegativeIntegerString.allows(k)`),t.join(` || `)||`false`}get structuralMorph(){return this.cacheGetter(`structuralMorph`,HT(this))}structuralMorphRef=this.structuralMorph&&dS(this.structuralMorph);compile(e){e.traversalKind===`Apply`&&e.initializeErrorCount();for(let t of this.props)e.check(t),e.traversalKind===`Apply`&&e.returnIfFailFast();if(this.sequence&&(e.check(this.sequence),e.traversalKind===`Apply`&&e.returnIfFailFast()),(this.index||this.undeclared===`reject`)&&(e.const(`keys`,`Object.keys(data)`),e.line(`keys.push(...Object.getOwnPropertySymbols(data))`),e.for(`i < keys.length`,()=>this.compileExhaustiveEntry(e))),e.traversalKind===`Allows`)return e.return(!0);this.structuralMorphRef&&e.if(`ctx && !ctx.hasError()`,()=>(e.line(`ctx.queueMorphs([`),UT(e,this),e.line(`])`)))}compileExhaustiveEntry(e){if(e.const(`k`,`keys[i]`),this.index)for(let t of this.index)e.if(`${e.invoke(t.signature,{arg:`k`,kind:`Allows`})}`,()=>e.traverseKey(`k`,`data[k]`,t.value));return this.undeclared===`reject`&&e.if(`!(${this._compileDeclaresKey(e)})`,()=>e.traversalKind===`Allows`?e.return(!1):e.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if(`ctx.failFast`,()=>e.return())),e}reduceJsonSchema(e,t){switch(e.type){case`object`:return this.reduceObjectJsonSchema(e,t);case`array`:let n=this.sequence?.reduceJsonSchema(e,t)??e;return this.props.length||this.index?t.fallback.arrayObject({code:`arrayObject`,base:n,object:this.reduceObjectJsonSchema({type:`object`},t)}):n;default:return RS.throwInternalOperandError(`structure`,e)}}reduceObjectJsonSchema(e,t){if(this.props.length){e.properties={};for(let n of this.props){let r=n.value.toJsonSchemaRecurse(t);if(typeof n.key==`symbol`)t.fallback.symbolKey({code:`symbolKey`,base:e,key:n.key,value:r,optional:n.optional});else{if(n.hasDefault()){let e=typeof n.default==`function`?n.default():n.default;r.default=q.intrinsic.jsonData.allows(e)?e:t.fallback.defaultValue({code:`defaultValue`,base:r,value:e})}e.properties[n.key]=r}}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(t=>typeof t==`string`&&t in e.properties))}if(this.index)for(let n of this.index){let r=n.value.toJsonSchemaRecurse(t);if(n.signature.equals(q.intrinsic.string))e.additionalProperties=r;else for(let i of n.signature.branches){if(!i.extends(q.intrinsic.string)){e=t.fallback.symbolKey({code:`symbolKey`,base:e,key:null,value:r,optional:!1});continue}let n={type:`string`};if(i.hasKind(`morph`)&&(n=t.fallback.morph({code:`morph`,base:i.rawIn.toJsonSchemaRecurse(t),out:i.rawOut.toJsonSchemaRecurse(t)})),!i.hasKind(`intersection`))return yb(`Unexpected index branch kind ${i.kind}.`);let{pattern:a}=i.inner;if(a){let i=Object.assign(n,{pattern:a[0].rule});for(let e=1;e<a.length;e++)n=t.fallback.patternIntersection({code:`patternIntersection`,base:i,pattern:a[e].rule});e.patternProperties??={},e.patternProperties[i.pattern]=r}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}},BT={},VT=e=>{let t=``;for(let n=0;n<e.defaultable.length;n++)t+=e.defaultable[n].defaultValueMorphRef;if(e.sequence?.defaultValueMorphsReference&&(t+=e.sequence?.defaultValueMorphsReference),e.undeclared===`delete`){if(t+=`delete !(`,e.required)for(let n of e.required)t+=n.compiledKey+` | `;if(e.optional)for(let n of e.optional)t+=n.compiledKey+` | `;if(e.index)for(let n of e.index)t+=n.signature.id+` | `;if(e.sequence){if(e.sequence.maxLength===null)t+=jE.nonNegativeIntegerString.id;else for(let n=0;n<e.sequence.tuple.length;n++)t+=n+` | `}t+=`)`}return t},HT=e=>{let t=VT(e);return t?BT[t]?BT[t]:BT[t]=(t,n)=>{for(let r=0;r<e.defaultable.length;r++)e.defaultable[r].key in t||e.defaultable[r].defaultValueMorph(t,n);if(e.sequence?.defaultables)for(let r=t.length-e.sequence.prefixLength;r<e.sequence.defaultables.length;r++)e.sequence.defaultValueMorphs[r](t,n);if(e.undeclared===`delete`)for(let n in t)e.declaresKey(n)||delete t[n];return t}:void 0},UT=(e,t)=>{let n=`(data${t.defaultable.some(e=>e.defaultValueMorph.length===2)||t.sequence?.defaultValueMorphs.some(e=>e.length===2)?`, ctx`:``})`;return e.block(`${n} => `,e=>{for(let r=0;r<t.defaultable.length;r++){let{serializedKey:i,defaultValueMorphRef:a}=t.defaultable[r];e.if(`!(${i} in data)`,e=>e.line(`${a}${n}`))}return t.sequence?.defaultables&&e.for(`i < ${t.sequence.defaultables.length}`,e=>e.line(`${t.sequence.defaultValueMorphsReference}[i]${n}`),`data.length - ${t.sequence.prefixLength}`),t.undeclared===`delete`&&e.forIn(`data`,e=>e.if(`!(${t._compileDeclaresKey(e)})`,e=>e.line(`delete data[k]`))),e.return(`data`)})},WT={implementation:RT,Node:zT},GT=e=>(bS(e,`root`)&&e.hasKind(`unit`)&&(e=e.unit),typeof e==`number`&&(e=`${e}`),e),KT=(e,t)=>`${e} is not allowed as an array index on ${t}. Use the 'nonNegativeIntegerString' keyword instead.`,qT=(e,t,n)=>{let[r,i]=ib(e.branches,e=>e.hasKind(`unit`));if(!r.length)return{index:n.node(`index`,{signature:e,value:t})};let a={};for(let e of r){let r=n.node(`required`,{key:e.unit,value:t});a[r.kind]=cb(a[r.kind],r)}return i.length&&(a.index=n.node(`index`,{signature:i,value:t})),a},JT=e=>bS(e,`root`)?e.expression:Kx(e),YT=(e,t)=>`Key${t.length===1?``:`s`} ${t.map(JT).join(`, `)} ${t.length===1?`does`:`do`} not exist on ${e}`,XT=e=>`Duplicate key ${pS(e)}`,ZT={...nw,alias:Hw.implementation,domain:Ww.implementation,unit:_T.implementation,proto:Xw.implementation,union:oT.implementation,morph:Jw.implementation,intersection:Gw.implementation,divisor:NC.implementation,pattern:iw.implementation,predicate:MC.implementation,required:ST.implementation,optional:bw.implementation,index:yT.implementation,sequence:DT.implementation,structure:WT.implementation};q.defaultConfig=Ib(Object.assign(Cb(ZT,(e,t)=>[e,t.defaults]),{jitless:ax(),clone:$b,onUndeclaredKey:`ignore`,exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:RS.defaultConfig})),q.resolvedConfig=zS(q.defaultConfig,q.config);var QT={...rw,alias:Hw.Node,domain:Ww.Node,unit:_T.Node,proto:Xw.Node,union:oT.Node,morph:Jw.Node,intersection:Gw.Node,divisor:NC.Node,pattern:iw.Node,predicate:MC.Node,required:ST.Node,optional:bw.Node,index:yT.Node,sequence:DT.Node,structure:WT.Node},$T=class extends Ob{get[yS](){return`module`}},eE=(e,t)=>new $T(Cb(e,(e,n)=>[e,bS(n,`module`)?eE(n,t):t.bindReference(n)])),tE=e=>Kb(e)?e:`branches`in e&&Kb(e.branches)?e.branches:void 0,nE=(e,t)=>K(`Node of kind ${t} is not valid as a ${e} definition`),rE=e=>`#${e} duplicates public alias ${e}`,iE=0;q.ambient??={};var aE,oE=`function $`,sE=e=>cE(e,lE(e)),cE=(e,t,n)=>{let r=t.write(oE,4),i=t.compile()();for(let t of e)(!t.precompilation||n&&t.$===n)&&(t.traverseAllows=i[`${t.id}Allows`].bind(i),t.isRoot()&&!t.allowsRequiresContext&&(t.allows=t.traverseAllows),t.traverseApply=i[`${t.id}Apply`].bind(i),i[`${t.id}Optimistic`]&&(t.traverseOptimistic=i[`${t.id}Optimistic`].bind(i)),t.precompilation=r)},lE=e=>new fS().return(e.reduce((e,t)=>{let n=new _S({kind:`Allows`}).indent();t.compile(n);let r=n.write(`${t.id}Allows`),i=new _S({kind:`Apply`}).indent();t.compile(i);let a=`${e}${r},\n${i.write(`${t.id}Apply`)},\n`;if(!t.hasKind(`union`))return a;let o=new _S({kind:`Allows`,optimistic:!0}).indent();return t.compile(o),`${a}${o.write(`${t.id}Optimistic`)},\n`},`{
38
38
  `)+`}`),uE=class{config;resolvedConfig;name;get[yS](){return`scope`}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,t){this.config=zS(q.config,t),this.resolvedConfig=zS(q.resolvedConfig,t),this.name=this.resolvedConfig.name??`anonymousScope${iE++}`;let n=Object.entries(e).map(e=>this.preparseOwnAliasEntry(...e));for(let[e,t]of n){let n=e;if(e[0]===`#`?(n=e.slice(1),n in this.aliases&&K(rE(n)),this.aliases[n]=t):(n in this.aliases&&K(rE(e)),this.aliases[n]=t,this.exportedNames.push(n)),!bS(t,`module`)&&!bS(t,`generic`)&&!nx(t)){let e=this.preparseOwnDefinitionFormat(t,{alias:n});this.resolutions[n]=bS(e,`root`)?this.bindReference(e):this.createParseContext(e).id}}aE??=this.node(`union`,{branches:[`string`,`number`,`object`,`bigint`,`symbol`,{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[aE.hash]=this.node(`intersection`,{},{prereduced:!0}),this.intrinsic=q.intrinsic?Cb(q.intrinsic,(e,t)=>e.startsWith(`json`)?[]:[e,this.bindReference(t)]):{}}cacheGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{let t=this;return(n,r)=>new kC(e,r?new OC(n):n,t,t,r??null)};units=(e,t)=>{let n=[];for(let t of e)n.includes(t)||n.push(t);let r=n.map(e=>this.node(`unit`,{unit:e},t));return this.node(`union`,r,{...t,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,t){let n=this.node(`alias`,{reference:t??`synthetic`,resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(n),n}schema=(e,t)=>this.finalize(this.parseSchema(e,t));parseSchema=(e,t)=>this.node(aw(e),e,t);preparseNode(e,t,n){let r=typeof e==`string`?e:aw(t,e);if(xS(t)&&t.kind===r)return t;if(r===`alias`&&!n?.prereduced){let{reference:e}=Hw.implementation.normalize(t,this);if(e.startsWith(`$`)){let n=this.resolveRoot(e.slice(1));t=n,r=n.kind}}else if(r===`union`&&mb(t,`object`)){let e=tE(t);e?.length===1&&(t=e[0],r=aw(t))}if(xS(t)&&t.kind===r)return t;let i=ZT[r].normalize?.(t,this)??t;return xS(i)?i.kind===r?i:nE(r,i.kind):{...n,$:this,kind:r,def:i,prefix:n.alias??r}}bindReference(e){let t;return t=xS(e)?e.$===this?e:new e.constructor(e.attachments,this):e.$===this?e:new kC(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,t.referencesById),t}resolveRoot(e){return this.maybeResolveRoot(e)??K(xE(e))}maybeResolveRoot(e){let t=this.maybeResolve(e);if(!bS(t,`generic`))return t}maybeResolveSubalias(e){return _E(this.aliases,e)??_E(this.ambient,e)}get ambient(){return q.ambient}maybeResolve(e){let t=this.resolutions[e];if(t){if(typeof t!=`string`)return this.bindReference(t);let n=uw[t];if(bS(n,`root`))return this.resolutions[e]=n;if(bS(n,`context`)){if(n.phase===`resolving`)return this.node(`alias`,{reference:`$${e}`},{prereduced:!0});if(n.phase===`resolved`)return yb(`Unexpected resolved context for was uncached by its scope: ${Kx(n)}`);n.phase=`resolving`;let t=this.bindReference(this.parseOwnDefinitionFormat(n.def,n));return n.phase=`resolved`,uw[t.id]=t,uw[n.id]=t,this.resolutions[e]=t}return yb(`Unexpected nodesById entry for ${t}: ${Kx(n)}`)}let n=this.aliases[e]??this.ambient?.[e];return n?(n=this.normalizeRootScopeValue(n),bS(n,`generic`)?this.resolutions[e]=this.bindReference(n):bS(n,`module`)?(n.root||K(CE(e)),this.resolutions[e]=this.bindReference(n.root)):this.resolutions[e]=this.parse(n,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){let t=e.id??dw(e.prefix);return uw[t]=Object.assign(e,{[yS]:`context`,$:this,id:t,phase:`unresolved`})}traversal(e){return new YS(e,this.resolvedConfig)}import(...e){return new $T(Cb(this.export(...e),(e,t)=>[`#${e}`,t]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(let e of this.exportedNames){let t=this.aliases[e];this._exports[e]=bS(t,`module`)?eE(t,this):mE(this.maybeResolve(e))}for(let e of this.lazyResolutions)e.resolution;if(this._exportedResolutions=bE(this,this._exports),this._json=gE(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){let e=lE(this.references);this.precompilation=e.write(oE,4),cE(this.references,e,this)}this.resolved=!0}return new $T(Cb(e.length?e:this.exportedNames,(e,t)=>[t,this._exports[t]]))}resolve(e){return this.export()[e]}node=(e,t,n={})=>{let r=this.preparseNode(e,t,n);if(xS(r))return this.bindReference(r);let i=r.id!==void 0,a=this.createParseContext(r),o=fw(a),s=this.bindReference(o);return i?uw[a.id]=s:fE(a.id,s),s};parse=(e,t={})=>this.finalize(this.parseDefinition(e,t));parseDefinition(e,t={}){if(bS(e,`root`))return this.bindReference(e);let n=this.preparseOwnDefinitionFormat(e,t);if(bS(n,`root`))return this.bindReference(n);let r=n.id!==void 0,i=this.createParseContext(n),a=this.bindReference(this.parseOwnDefinitionFormat(e,i));return a.isCyclic&&(a=mw(a,i.id)),r?uw[i.id]=a:fE(i.id,a),a}finalize(e){return e.isCyclic&&pE(e)||(mE(e),!e.precompilation&&!this.resolvedConfig.jitless&&sE(e.references)),e}},dE=class extends uE{parseOwnDefinitionFormat(e,t){return fw(t)}preparseOwnDefinitionFormat(e,t){return this.preparseNode(aw(e),e,t)}preparseOwnAliasEntry(e,t){return[e,t]}normalizeRootScopeValue(e){return e}},fE=(e,t)=>{t.id===e?uw[e]=t:delete uw[e]},pE=e=>e.references.some(e=>e.hasKind(`alias`)&&e.reference[0]!==`$`&&bS(uw[e.reference],`context`)),mE=e=>{let t=e.references.filter(e=>e.hasKind(`alias`));for(let n of t){hE(n.referencesById,n.resolution.referencesById);for(let t of e.references)n.id in t.referencesById&&hE(t.referencesById,n.referencesById)}return e},hE=(e,t)=>{for(let n in t)e[n]??=t[n]},gE=e=>Cb(e,(e,t)=>[e,bS(t,`root`)||bS(t,`generic`)?t.json:bS(t,`module`)?gE(t):yb(`Unexpected resolution ${Kx(t)}`)]),_E=(e,t)=>{let n=t.indexOf(`.`);if(n===-1)return;let r=t.slice(0,n),i=e[r];if(i===void 0)return;if(!bS(i,`module`))return K(SE(r));let a=t.slice(n+1),o=i[a];if(o===void 0)return _E(i,a);if(bS(o,`root`)||bS(o,`generic`))return o;if(bS(o,`module`))return o.root??K(CE(t));yb(`Unexpected resolution for alias '${t}': ${Kx(o)}`)},vE=(e,t)=>new dE(e,t),yE=new dE({}),bE=(e,t)=>{let n={};for(let r in t){let i=t[r];if(bS(i,`module`)){let t=Cb(bE(e,i),(e,t)=>[`${r}.${e}`,t]);Object.assign(n,t)}else bS(i,`root`)||bS(i,`generic`)?n[r]=i:yb(`Unexpected scope resolution ${Kx(i)}`)}return n},xE=e=>`'${e}' is unresolvable`,SE=e=>`'${e}' must reference a module to be accessed using dot syntax`,CE=e=>`Reference to submodule '${e}' must specify an alias`;yE.export();var wE=yE.schema,TE=yE.node;yE.defineSchema;var EE=yE.generic,DE=`^(?:0|[1-9]\\d*)$`;dS(new RegExp(DE));var OE=vE({bigint:`bigint`,boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:`number`,object:`object`,string:`string`,symbol:`symbol`,true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();q.intrinsic={...OE};var kE=vE({integer:{domain:`number`,divisor:1},lengthBoundable:[`string`,Array],key:[`string`,`symbol`],nonNegativeIntegerString:{domain:`string`,pattern:DE}},{prereducedAliases:!0}).export();Object.assign(q.intrinsic,kE);var AE=vE({jsonPrimitive:[`string`,`number`,{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:`object`,index:{signature:`string`,value:`$jsonData`}},jsonData:[`$jsonPrimitive`,`$jsonObject`]},{prereducedAliases:!0}).export(),jE={...OE,...kE,...AE,emptyStructure:TE(`structure`,{},{prereduced:!0})};q.intrinsic={...jE};var ME=((e,t)=>new RegExp(e,t));Object.assign(ME,{as:ME});var NE=e=>typeof e==`string`&&e[0]===`d`&&(e[1]===`'`||e[1]===`"`)&&e[e.length-1]===e[1],PE=e=>e.toString()!==`Invalid Date`,FE=e=>e.slice(2,-1),IE=e=>`'${e}' could not be parsed by the Date constructor`,LE=(e,t)=>RE(e,t),RE=(e,t)=>{let n=new Date(e);if(PE(n))return n;let r=Nx(e);if(r!==void 0){let e=new Date(r);if(PE(e))return e}return t?K(t===!0?IE(e):t):void 0},zE=wE({proto:`Array`,sequence:`string`,required:{key:`groups`,value:[`object`,{unit:void 0}]}}),BE=(e,t)=>{let n=e.scanner.shiftUntilEscapable(KE[GE[t]],t in WE?`\\`:``);if(e.scanner.lookahead===``)return e.error(JE(n,t));if(e.scanner.shift(),t in WE){let r;try{r=new RegExp(n)}catch(e){K(String(e))}e.root=e.ctx.$.node(`intersection`,{domain:`string`,pattern:n},{prereduced:!0}),t===`x/`&&(e.root=e.ctx.$.node(`morph`,{in:e.root,morphs:e=>r.exec(e),declaredOut:zE}))}else if(Eb(t,VE))e.root=e.ctx.$.node(`unit`,{unit:n});else{let t=LE(n,IE(n));e.root=e.ctx.$.node(`unit`,{meta:n,unit:t})}},VE={"'":1,'"':1},HE={"/":1,"'":1,'"':1},UE={"d'":`'`,'d"':`"`,"'":`'`,'"':`"`},WE={"/":`/`,"x/":`/`},GE={...UE,...WE},KE={"'":e=>e.lookahead===`'`,'"':e=>e.lookahead===`"`,"/":e=>e.lookahead===`/`},qE={'"':`double-quote`,"'":`single-quote`,"/":`forward slash`},JE=(e,t)=>`${t}${e} requires a closing ${qE[GE[t]]}`,YE=e=>`Private type references should not include '#'. Use '${e}' instead.`,XE=`Optional definitions like 'string?' are only valid as properties in an object or tuple`,ZE=`Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple`,QE={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...px},$E=(e,t)=>e===`>`?t[0]===`=`?t[1]===`=`:t.trimStart()===``||Eb(t.trimStart()[0],QE):e===`=`?t[0]!==`=`:e===`,`||e===`?`,eD=(e,t,n)=>tD(e,t,n,[]),tD=(e,t,n,r)=>{let i=n.parseUntilFinalizer();return r.push(i.root),i.finalizer===`>`?r.length===t.params.length?r:n.error(nD(e,t.names,r.map(e=>e.expression))):i.finalizer===`,`?tD(e,t,n,r):i.error(oS(`>`))},nD=(e,t,n)=>`${e}<${t.join(`, `)}> requires exactly ${t.length} args (got ${n.length}${n.length===0?``:`: ${n.join(`, `)}`})`,rD=e=>{let t=e.scanner.shiftUntilLookahead(QE);t===`keyof`?e.addPrefix(`keyof`):e.root=aD(e,t)},iD=(e,t,n)=>(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()===`<`?t(...eD(e,t,n)):n.error(nD(e,t.names,[]))),aD=(e,t)=>oD(e,t)??sD(e,t)??e.error(t===``?e.scanner.lookahead===`#`?YE(e.shiftedBy(1).scanner.shiftUntilLookahead(QE)):cD(e):xE(t)),oD=(e,t)=>{if(e.ctx.args?.[t]){let n=e.ctx.args[t];return typeof n==`string`?e.ctx.$.node(`alias`,{reference:n},{prereduced:!0}):n}let n=e.ctx.$.maybeResolve(t);if(bS(n,`root`))return n;if(n!==void 0)return bS(n,`generic`)?iD(t,n,e):K(`Unexpected resolution ${Kx(n)}`)},sD=(e,t)=>{let n=Px(t);if(n!==void 0)return e.ctx.$.node(`unit`,{unit:n});let r=Lx(t);if(r!==void 0)return e.ctx.$.node(`unit`,{unit:r})},cD=e=>{let t=e.previousOperator();return t?lD(t,e.scanner.unscanned):uD(e.scanner.unscanned)},lD=(e,t=``)=>`Token '${e}' requires a right operand${t?` before '${t}'`:``}`,uD=e=>`Expected an expression${e?` before '${e}'`:``}`,dD=e=>e.scanner.lookahead===``?e.error(cD(e)):e.scanner.lookahead===`(`?e.shiftedBy(1).reduceGroupOpen():e.scanner.lookaheadIsIn(HE)?BE(e,e.scanner.shift()):e.scanner.lookaheadIsIn(px)?dD(e.shiftedBy(1)):e.scanner.lookahead===`d`?e.scanner.nextLookahead in VE?BE(e,`${e.scanner.shift()}${e.scanner.shift()}`):rD(e):e.scanner.lookahead===`x`&&e.scanner.nextLookahead===`/`?e.shiftedBy(2)&&BE(e,`x/`):rD(e),fD={">":!0,">=":!0},pD={"<":!0,"<=":!0},mD={"<":`>`,">":`<`,"<=":`>=`,">=":`<=`,"==":`==`},hD=(e,t)=>`Left bounds are only valid when paired with right bounds (try ...${t}${e})`,gD=e=>`Left-bounded expressions must specify their limits using < or <= (was ${e})`,_D=(e,t,n,r)=>`An expression may have at most one left bound (parsed ${e}${mD[t]}, ${n}${mD[r]})`,vD=(e,t)=>{let n=bD(e,t);if(e.root.hasKind(`unit`)){if(typeof e.root.unit==`number`){e.reduceLeftBound(e.root.unit,n),e.unsetRoot();return}if(e.root.unit instanceof Date){let t=`d'${e.root.description??e.root.unit.toISOString()}'`;e.unsetRoot(),e.reduceLeftBound(t,n);return}}return CD(e,n)},yD={"<":1,">":1,"=":1},bD=(e,t)=>e.scanner.lookaheadIs(`=`)?`${t}${e.scanner.shift()}`:t,xD=(e,t,n,r)=>n.extends(q.intrinsic.number)?typeof t==`number`?e===`==`?[`min`,`max`]:e[0]===`>`?[`min`]:[`max`]:K(wD(e,t,r)):n.extends(q.intrinsic.lengthBoundable)?typeof t==`number`?e===`==`?[`exactLength`]:e[0]===`>`?[`minLength`]:[`maxLength`]:K(wD(e,t,r)):n.extends(q.intrinsic.Date)?e===`==`?[`after`,`before`]:e[0]===`>`?[`after`]:[`before`]:K(JC(n.expression)),SD=e=>({rule:NE(e.limit)?FE(e.limit):e.limit,exclusive:e.comparator.length===1}),CD=(e,t)=>{let n=e.unsetRoot(),r=e.scanner.location;e.parseOperand();let i=e.unsetRoot(),a=e.scanner.sliceChars(r,e.scanner.location);if(e.root=n,!i.hasKind(`unit`)||typeof i.unit!=`number`&&!(i.unit instanceof Date))return e.error(wD(t,a,`right`));let o=i.unit,s=t.length===1,c=xD(t,typeof o==`number`?o:a,n,`right`);for(let n of c)e.constrainRoot(n,t===`==`?{rule:o}:{rule:o,exclusive:s});if(!e.branches.leftBound)return;if(!Eb(t,pD))return e.error(gD(t));let l=xD(e.branches.leftBound.comparator,e.branches.leftBound.limit,n,`left`);e.constrainRoot(l[0],SD(e.branches.leftBound)),e.branches.leftBound=null},wD=(e,t,n)=>`Comparator ${n===`left`?mD[e]:e} must be ${n===`left`?`preceded`:`followed`} by a corresponding literal (was ${t})`,TD=e=>{e.scanner.shiftUntilNonWhitespace();let t=e.scanner.shiftUntilLookahead(QE);e.root=e.root.brand(t)},ED=e=>{e.scanner.shiftUntilNonWhitespace();let t=e.scanner.shiftUntilLookahead(QE),n=Fx(t,{errorOnFail:DD(t)});n===0&&e.error(DD(0)),e.root=e.root.constrain(`divisor`,n)},DD=e=>`% operator must be followed by a non-zero integer literal (was ${e})`,OD=e=>{let t=e.scanner.shift();return t===``?e.finalize(``):t===`[`?e.scanner.shift()===`]`?e.setRoot(e.root.rawArray()):e.error(AD):t===`|`?e.scanner.lookahead===`>`?e.shiftedBy(1).pushRootToBranch(`|>`):e.pushRootToBranch(t):t===`&`?e.pushRootToBranch(t):t===`)`?e.finalizeGroup():$E(t,e.scanner.unscanned)?e.finalize(t):Eb(t,yD)?vD(e,t):t===`%`?ED(e):t===`#`?TD(e):t in px?OD(e):e.error(kD(t))},kD=(e,t=``)=>`'${e}' is not allowed here${t&&` (should be ${t})`}`,AD=`Missing expected ']'`,jD={"[]":()=>[],"{}":()=>({})},MD=Tb(jD),ND=e=>{let t=e.unsetRoot();e.scanner.shiftUntilNonWhitespace();let n=MD.find(t=>e.scanner.unscanned.startsWith(t));if(n!==void 0)return e.scanner.jumpForward(n.length),[t,`=`,jD[n]];e.parseOperand();let r=e.unsetRoot();return r.hasKind(`unit`)?[t,`=`,r.unit instanceof Date?()=>new Date(r.unit):r.unit]:e.error(PD(r.expression))},PD=e=>`Default value '${e}' must be a literal value`,FD=(e,t)=>{let n=t.$.maybeResolveRoot(e);if(n)return n;if(e.endsWith(`[]`)){let n=t.$.maybeResolveRoot(e.slice(0,-2));if(n)return n.rawArray()}let r=new zD(new iS(e),t),i=ID(r);return r.finalizer===`>`&&K(kD(`>`)),i},ID=e=>{e.parseOperand();let t=LD(e).root;return t?(e.finalizer===`=`?t=ND(e):e.finalizer===`?`&&(t=[t,`?`]),e.scanner.shiftUntilNonWhitespace(),e.scanner.lookahead&&K(kD(e.scanner.lookahead)),t):yb(`Root was unexpectedly unset after parsing string '${e.scanner.scanned}'`)},LD=e=>{for(;e.finalizer===void 0;)RD(e);return e},RD=e=>e.hasRoot()?e.parseOperator():e.parseOperand(),zD=class e{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,t){this.scanner=e,this.ctx=t}error(e){return K(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){let e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(oS(`)`));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,t){let n=mD[t];if(!Eb(n,fD))return this.error(gD(t));if(this.branches.leftBound)return this.error(_D(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,n));this.branches.leftBound={comparator:n,limit:e}}finalizeBranches(){this.assertRangeUnset(),this.branches.pipe?(this.pushRootToBranch(`|>`),this.root=this.branches.pipe):this.branches.union?(this.pushRootToBranch(`|`),this.root=this.branches.union):this.branches.intersection?(this.pushRootToBranch(`&`),this.root=this.branches.intersection):this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();let e=this.groups.pop();if(!e)return this.error(aS(`)`,this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){let e=this.branches.prefixes.pop();this.root=e===`keyof`?this.root.keyof():yb(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();let t=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(t)??t,e!==`&`&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!==`|`&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return LD(new e(this.scanner,this.ctx))}parseOperator(){return OD(this)}parseOperand(){return dD(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(hD(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes[this.branches.prefixes.length-1]??(this.branches.intersection?`&`:this.branches.union?`|`:this.branches.pipe?`|>`:void 0)}shiftedBy(e){return this.scanner.jumpForward(e),this}},BD=`An empty string is not a valid generic parameter name`,VD=(e,t,n)=>{e.shiftUntilNonWhitespace();let r=e.shiftUntilLookahead(QE);return r===``?e.lookahead===``&&t.length?t:K(BD):(e.shiftUntilNonWhitespace(),UD(e,r,t,n))},HD=`extends `,UD=(e,t,n,r)=>{if(e.shiftUntilNonWhitespace(),e.unscanned.startsWith(HD))e.jumpForward(8);else return e.lookahead===`,`&&e.shift(),n.push(t),VD(e,n,r);let i=LD(new zD(e,r));return n.push([t,i.root]),VD(e,n,r)},WD=class extends ix{constructor(e){let t=(...t)=>{let n=t.indexOf(`:`),r=n===-1?t.length-1:n-1,i=t.slice(0,r+1),a=e.parse(i).assertHasKind(`intersection`),o=e.intrinsic.unknown;if(n!==-1){if(n!==t.length-2)return K(KD);o=e.parse(t[n+1])}return e=>new GD(e,a,o)};super(t,{attach:{$:e,raw:t}})}},GD=class extends ix{raw;params;returns;expression;constructor(e,t,n){let r=`typed ${e.name}`,i={[r]:(...r)=>{let i=e(...t.assert(r));return n.assert(i)}}[r];super(i),this.raw=e,this.params=t,this.returns=n;let a=t.expression;a[0]===`[`&&a[a.length-1]===`]`?a=a.slice(1,-1):a.endsWith(`[]`)&&(a=`...${a}`),this.expression=`(${a}) => ${n?.expression??`unknown`}`}},KD=`":" must be followed by exactly one return type e.g:
39
- fn("string", ":", "number")(s => s.length)`,qD=class extends ix{$;constructor(e){super((...t)=>new JD(e)(...t),{bind:e}),this.$=e}in(e){return new JD(this.$,e===void 0?void 0:this.$.parse(e))}at(e,t){return new JD(this.$).at(e,t)}case(e,t){return new JD(this.$).case(e,t)}},JD=class extends ix{$;in;key;branches=[];constructor(e,t){super(e=>this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.parse(e),t]))),this.$=e,this.in=t}at(e,t){return this.key&&K(ZD),this.branches.length&&K(XD),this.key=e,t?this.match(t):this}case(e,t){return this.caseEntry(this.$.parse(e),t)}caseEntry(e,t){let n=(this.key?this.$.parse({[this.key]:e}):e).pipe(t);return this.branches.push(n),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.node(`unit`,{unit:e}),t]))}caseEntries(e){for(let t=0;t<e.length;t++){let[n,r]=e[t];if(n==="default")return t!==e.length-1&&K(`default may only be specified as the last key of a switch definition`),this.default(r);if(typeof r!=`function`)return K(`Value for case "${n}" must be a function (was ${hb(r)})`);this.caseEntry(n,r)}return this}default(e){typeof e==`function`&&this.case(jE.unknown,e);let t={branches:this.branches,ordered:!0};(e===`never`||e===`assert`)&&(t.meta={onFail:YD});let n=this.$.node(`union`,t);if(!this.in)return this.$.finalize(n);let r=this.in.pipe(n);return(e===`never`||e===`assert`)&&(r=r.configureReferences({onFail:YD},`self`)),this.$.finalize(r)}},YD=e=>e.throw(),XD=`A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')`,ZD=`At most one key matcher may be specified per expression`,QD=(e,t)=>{if(Kb(e)){if(e[1]===`=`)return[t.$.parseOwnDefinitionFormat(e[0],t),`=`,e[2]];if(e[1]===`?`)return[t.$.parseOwnDefinitionFormat(e[0],t),`?`]}return FO(e,t)},$D=`Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`,eO=`Only required keys may specify default values, e.g. { value: 'number = 0' }`,tO=(e,t)=>{let n,r={},i=Pb(e);for(let[e,a]of i){let i=aO(e);if(i.kind===`spread`){if(!Nb(r))return K(iO);let e=t.$.parseOwnDefinitionFormat(a,t);if(e.equals(jE.object))continue;if(!e.hasKind(`intersection`)||!e.basis?.equals(jE.object))return K(oO(e.expression));n=e.structure;continue}if(i.kind===`undeclared`){a!==`reject`&&a!==`delete`&&a!==`ignore`&&K(rO(a)),r.undeclared=a;continue}let o=QD(a,t),s=i;if(i.kind===`required`){Kb(o)?nO(r,`optional`,o[1]===`=`?{key:i.normalized,value:o[0],default:o[2]}:{key:i.normalized,value:o[0]},t):nO(r,`required`,{key:i.normalized,value:o},t);continue}if(Kb(o)&&(o[1]===`?`&&K($D),o[1]===`=`&&K(eO)),i.kind===`optional`){nO(r,`optional`,{key:i.normalized,value:o},t);continue}let c=qT(t.$.parseOwnDefinitionFormat(s.normalized,t),o,t.$);c.index&&(r.index=cb(r.index,c.index)),c.required&&(r.required=cb(r.required,c.required))}let a=t.$.node(`structure`,r);return t.$.parseSchema({domain:`object`,structure:n?.merge(a)??a})},nO=(e,t,n,r)=>{e[t]=cb(e[t],r.$.node(t,n))},rO=e=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Kx(e)})`,iO=`Spread operator may only be used as the first key in an object`,aO=e=>typeof e==`symbol`?{kind:`required`,normalized:e}:e[e.length-1]===`?`?e[e.length-2]===`\\`?{kind:`required`,normalized:`${e.slice(0,-2)}?`}:{kind:`optional`,normalized:e.slice(0,-1)}:e[0]===`[`&&e[e.length-1]===`]`?{kind:`index`,normalized:e.slice(1,-1)}:e[0]===`\\`&&e[1]===`[`&&e[e.length-1]===`]`?{kind:`required`,normalized:e.slice(1)}:e===`...`?{kind:`spread`}:e===`+`?{kind:`undeclared`}:{kind:`required`,normalized:e===`\\...`?`...`:e===`\\+`?`+`:e},oO=e=>`Spread operand must resolve to an object literal type (was ${e})`,sO=(e,t)=>xO(e)?bO[e[0]](e,t):yO(e)?vO[e[1]](e,t):null,cO=(e,t)=>t.$.parseOwnDefinitionFormat(e[1],t).keyof(),lO=(e,t)=>{if(e[2]===void 0)return K(lD(e[1],``));let n=t.$.parseOwnDefinitionFormat(e[0],t),r=t.$.parseOwnDefinitionFormat(e[2],t);if(e[1]===`|`)return t.$.node(`union`,{branches:[n,r]});let i=e[1]===`&`?fC(n,r,t.$):pC(n,r,t.$);return i instanceof sC?i.throw():i},uO=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).rawArray(),dO=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).pipe(e[2]):K(fO(`=>`,e[2])),fO=(e,t)=>`${e===`:`?`Narrow`:`Morph`} expression requires a function following '${e}' (was ${typeof t})`,pO=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).constrain(`predicate`,e[2]):K(fO(`:`,e[2])),mO=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).configure(e[2],e[3]),hO=e=>e,gO=hO({"[]":uO,"?":()=>K(XE)}),_O=hO({"|":lO,"&":lO,":":pO,"=>":dO,"|>":lO,"@":mO,"=":()=>K(ZE)}),vO={...gO,..._O},yO=e=>vO[e[1]]!==void 0,bO=(e=>e)({keyof:cO,instanceof:(e,t)=>{if(typeof e[1]!=`function`)return K(SO(Gb(e[1])));let n=e.slice(1).map(e=>typeof e==`function`?t.$.node(`proto`,{proto:e}):K(SO(Gb(e))));return n.length===1?n[0]:t.$.node(`union`,{branches:n})},"===":(e,t)=>t.$.units(e.slice(1))}),xO=e=>bO[e[0]]!==void 0,SO=e=>`Expected a constructor following 'instanceof' operator (was ${e})`,CO=(e,t)=>{let n=[{}],r=0;for(;r<e.length;){let i=!1;e[r]===`...`&&r<e.length-1&&(i=!0,r++);let a=QD(e[r],t),[o,s,c]=Kb(a)?a:[a];if(r++,i){if(!o.extends(q.intrinsic.Array))return K(kO(o.expression));n=n.flatMap(e=>o.distribute(t=>OO(vS(e),t)))}else n=n.map(e=>s===`?`?TO(e,o):s===`=`?EO(e,o,c):wO(e,o))}return t.$.parseSchema(n.map(e=>Nb(e)?{proto:Array,exactLength:0}:{proto:Array,sequence:e}))},wO=(e,t)=>e.defaultables||e.optionals?K(e.variadic?AT:jO):(e.variadic?e.postfix=cb(e.postfix,t):e.prefix=cb(e.prefix,t),e),TO=(e,t)=>e.variadic?K(MO):(e.optionals=cb(e.optionals,t),e),EO=(e,t,n)=>e.variadic?K(MO):e.optionals?K(NO):(e.defaultables=cb(e.defaultables,[[t,n]]),e),DO=(e,t)=>(e.postfix&&K(AO),e.variadic?e.variadic.equals(t)||K(AO):e.variadic=t.internal,e),OO=(e,t)=>{let n=t.select({method:`find`,kind:`sequence`});if(!n)return DO(e,q.intrinsic.unknown);if(n.prefix)for(let t of n.prefix)wO(e,t);if(n.optionals)for(let t of n.optionals)TO(e,t);if(n.variadic&&DO(e,n.variadic),n.postfix)for(let t of n.postfix)wO(e,t);return e},kO=e=>`Spread element must be an array (was ${e})`,AO=`A tuple may have at most one variadic element`,jO=`A required element may not follow an optional element`,MO=`An optional element may not follow a variadic element`,NO=`A defaultable element may not follow an optional element without a default`,PO=new WeakMap,FO=(e,t)=>{if(typeof e==`string`){if(t.args&&Object.keys(t.args).some(t=>e.includes(t)))return FD(e,t);let n=PO.get(t.$);return n||(n={},PO.set(t.$,n)),n[e]??=FD(e,t)}return mb(e,`object`)?IO(e,t):K(zO(hb(e)))},IO=(e,t)=>{let n=Wb(e);switch(n){case void 0:return bS(e,`root`)?e:`~standard`in e?LO(e,t):tO(e,t);case`Array`:return RO(e,t);case`RegExp`:return t.$.node(`intersection`,{domain:`string`,pattern:e},{prereduced:!0});case`Function`:{let t=nx(e)?e():e;return bS(t,`root`)?t:K(zO(`Function`))}default:return K(zO(n??Kx(e)))}},LO=(e,t)=>t.$.intrinsic.unknown.pipe((t,n)=>{let r=e[`~standard`].validate(t);if(!r.issues)return r.value;for(let{message:e,path:t}of r.issues)t&&t.length?n.error({problem:lx(e),relativePath:t.map(e=>typeof e==`object`?e.key:e)}):n.error({message:e})}),RO=(e,t)=>sO(e,t)??CO(e,t),zO=e=>`Type definitions must be strings or objects (was ${e})`,BO=class extends ix{constructor(e){let t=Object.assign({errors:KS,hkt:ox,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...t)=>{if(t.length===1)return e.parse(t[0]);if(t.length===2&&typeof t[0]==`string`&&t[0][0]===`<`&&t[0][t[0].length-1]===`>`){let n=t[0].slice(1,-1);return new kC(e.parseGenericParams(n,{}),t[1],e,e,null)}return e.parse(t)},{attach:t})}},VO=q,HO=class e extends uE{get ambientAttachments(){if(VO.typeAttachments)return this.cacheGetter(`ambientAttachments`,Cb(VO.typeAttachments,(e,t)=>[e,this.bindReference(t)]))}preparseOwnAliasEntry(e,t){let n=e.indexOf(`<`);if(n===-1){if(bS(t,`module`)||bS(t,`generic`))return[e,t];let n=this.name===`ark`?e:e===`root`?this.name:`${this.name}.${e}`,r=this.resolvedConfig.keywords?.[n];return r&&(t=[t,`@`,r]),[e,t]}e[e.length-1]!==`>`&&K(`'>' must be the last character of a generic declaration in a scope`);let r=e.slice(0,n),i=e.slice(n+1,-1);return[r,()=>DC(this.parseGenericParams(i,{alias:r}),t,this)]}parseGenericParams(e,t){return VD(new iS(e),[],this.createParseContext({...t,def:e,prefix:`generic`}))}normalizeRootScopeValue(e){return nx(e)&&!bS(e,`generic`)?e():e}preparseOwnDefinitionFormat(e,t){return{...t,def:e,prefix:t.alias??`type`}}parseOwnDefinitionFormat(e,t){!(t.alias&&t.alias in this.aliases)&&!t.args&&(t.args={this:t.id});let n=FO(e,t);if(Kb(n)){if(n[1]===`=`)return K(ZE);if(n[1]===`?`)return K(XE)}return n}unit=e=>this.units([e]);valueOf=e=>this.units(Rb(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node(`proto`,{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(e=>this.parse(e)));and=(...e)=>e.reduce((e,t)=>e.and(this.parse(t)),this.intrinsic.unknown);merge=(...e)=>e.reduce((e,t)=>e.merge(this.parse(t)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new WD(this);match=new qD(this);declare=()=>({type:this.type});define(e){return e}type=new BO(this);static scope=((t,n={})=>new e(t,n));static module=((t,n={})=>e.scope(t,n).export())},UO=Object.assign(HO.scope,{define:e=>e}),WO=HO,GO=class extends ox{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'},KO=EE([`base`,jE.object],[`props`,jE.object])(e=>e.base.merge(e.props),GO),qO=WO.module({Key:jE.key,Merge:KO}),JO=class extends ox{},YO=EE(`element`)(e=>{let t=e.element.exclude(jE.Array),n=t.array();return t.rawOr(n).pipe(rb).distribute(e=>e.assertHasKind(`morph`).declareOut(n),wE)},JO),XO=WO.module({root:jE.Array,readonly:`root`,index:jE.nonNegativeIntegerString,liftFrom:YO},{name:`Array`}),ZO=wE([`string`,Rx.FileConstructor]),QO=wE({meta:`an object representing parsed form data`,domain:`object`,index:{signature:`string`,value:ZO.rawOr(ZO.array())}}),$O=WO.module({root:[`instanceof`,FormData],value:ZO,parsed:QO,parse:wE({in:FormData,morphs:e=>{let t={};for(let[n,r]of e)if(n in t){let e=t[n];typeof e==`string`||e instanceof Rx.FileConstructor?t[n]=[e,r]:e.push(r)}else t[n]=r;return t},declaredOut:QO})},{name:`FormData`}),ek=WO.module({Int8:[`instanceof`,Int8Array],Uint8:[`instanceof`,Uint8Array],Uint8Clamped:[`instanceof`,Uint8ClampedArray],Int16:[`instanceof`,Int16Array],Uint16:[`instanceof`,Uint16Array],Int32:[`instanceof`,Int32Array],Uint32:[`instanceof`,Uint32Array],Float32:[`instanceof`,Float32Array],Float64:[`instanceof`,Float64Array],BigInt64:[`instanceof`,BigInt64Array],BigUint64:[`instanceof`,BigUint64Array]},{name:`TypedArray`}),tk={Boolean:1,Number:1,String:1},nk=WO.module({...Cb({...zb,...Vb},(e,t)=>e in tk?[]:[e,[`instanceof`,t]]),Array:XO,TypedArray:ek,FormData:$O}),rk=wE({domain:{domain:`number`,meta:`a number representing a Unix timestamp`},divisor:{rule:1,meta:`an integer representing a Unix timestamp`},min:{rule:-864e13,meta:`a Unix timestamp after -8640000000000000`},max:{rule:864e13,meta:`a Unix timestamp before 8640000000000000`},meta:`an integer representing a safe Unix timestamp`}),ik=wE({domain:`number`,divisor:1}),ak=WO.module({root:jE.number,integer:ik,epoch:rk,safe:wE({domain:{domain:`number`,numberAllowsNaN:!1},min:-(2**53-1),max:2**53-1}),NaN:[`===`,NaN],Infinity:[`===`,1/0],NegativeInfinity:[`===`,-1/0]},{name:`number`}),ok=(e,t,n)=>{let r={domain:`string`,pattern:{rule:e.source,flags:e.flags,meta:t}};return n&&(r.meta={format:n}),TE(`intersection`,r)},sk=ok(wx,`a well-formed integer string`),ck=WO.module({root:sk,parse:wE({in:sk,morphs:(e,t)=>{let n=Number.parseInt(e);return Number.isSafeInteger(n)?n:t.error(`an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER`)},declaredOut:jE.integer})},{name:`string.integer`}),lk=ok(/^[\dA-Fa-f]+$/,`hex characters only`),uk=ok(/^[1-9A-HJ-NP-Za-km-z]+$/,`base58-encoded`),dk=WO.module({root:ok(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,`base64-encoded`),url:ok(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,`base64url-encoded`)},{name:`string.base64`}),fk=ok(/^[A-Z].*$/,`capitalized`),pk=WO.module({root:wE({in:`string`,morphs:e=>e.charAt(0).toUpperCase()+e.slice(1),declaredOut:fk}),preformatted:fk},{name:`string.capitalize`}),mk=wE({domain:`string`,pattern:{meta:`a credit card number`,rule:`^(?:4\\d{12}(?:\\d{3,6})?|5[1-5]\\d{14}|(222[1-9]|22[3-9]\\d|2[3-6]\\d{2}|27[01]\\d|2720)\\d{12}|6(?:011|5\\d\\d)\\d{12,15}|3[47]\\d{13}|3(?:0[0-5]|[68]\\d)\\d{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27]\\d{14}|^(81\\d{14,17}))$`},predicate:{meta:`a credit card number`,predicate:e=>{let t=e.replace(/[ -]+/g,``),n=0,r,i,a=!1;for(let e=t.length-1;e>=0;e--)r=t.substring(e,e+1),i=Number.parseInt(r,10),a?(i*=2,n+=i>=10?i%10+1:i):n+=i,a=!a;return!!(n%10==0&&t)}}}),hk=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,gk=wE({domain:`string`,predicate:{meta:`a parsable date`,predicate:e=>!Number.isNaN(new Date(e).valueOf())}}).assertHasKind(`intersection`),_k=ck.root.internal.narrow((e,t)=>{let n=Number.parseInt(e),r=ak.epoch(n);return r instanceof KS?(t.errors.merge(r),!1):!0}).configure({description:`an integer string representing a safe Unix timestamp`},`self`).assertHasKind(`intersection`),vk=WO.module({root:_k,parse:wE({in:_k,morphs:e=>new Date(Number.parseInt(e)),declaredOut:jE.Date})},{name:`string.date.epoch`}),yk=ok(hk,`an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date`).internal.assertHasKind(`intersection`),bk=WO.module({root:yk,parse:wE({in:yk,morphs:e=>new Date(e),declaredOut:jE.Date})},{name:`string.date.iso`}),xk=WO.module({root:gk,parse:wE({declaredIn:gk,in:`string`,morphs:(e,t)=>{let n=new Date(e);return Number.isNaN(n.valueOf())?t.error(`a parsable date`):n},declaredOut:jE.Date}),iso:bk,epoch:vk},{name:`string.date`}),Sk=ok(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,`an email address`,`email`),Ck=`(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,wk=`(${Ck}[.]){3}${Ck}`,Tk=RegExp(`^${wk}$`),Ek=`(?:[0-9a-fA-F]{1,4})`,Dk=RegExp(`^((?:${Ek}:){7}(?:${Ek}|:)|(?:${Ek}:){6}(?:${wk}|:${Ek}|:)|(?:${Ek}:){5}(?::${wk}|(:${Ek}){1,2}|:)|(?:${Ek}:){4}(?:(:${Ek}){0,1}:${wk}|(:${Ek}){1,3}|:)|(?:${Ek}:){3}(?:(:${Ek}){0,2}:${wk}|(:${Ek}){1,4}|:)|(?:${Ek}:){2}(?:(:${Ek}){0,3}:${wk}|(:${Ek}){1,5}|:)|(?:${Ek}:){1}(?:(:${Ek}){0,4}:${wk}|(:${Ek}){1,6}|:)|(?::((?::${Ek}){0,5}:${wk}|(?::${Ek}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),Ok=WO.module({root:[`v4 | v6`,`@`,`an IP address`],v4:ok(Tk,`an IPv4 address`,`ipv4`),v6:ok(Dk,`an IPv6 address`,`ipv6`)},{name:`string.ip`}),kk=`a JSON string`,Ak=e=>{if(!(e instanceof SyntaxError))throw e;return`must be ${kk} (${e})`},jk=wE({meta:kk,domain:`string`,predicate:{meta:kk,predicate:(e,t)=>{try{return JSON.parse(e),!0}catch(e){return t.reject({code:`predicate`,expected:kk,problem:Ak(e)})}}}}),Mk=WO.module({root:jk,parse:wE({meta:`safe JSON string parser`,in:`string`,morphs:(e,t)=>{if(e.length===0)return t.error({code:`predicate`,expected:kk,actual:`empty`});try{return JSON.parse(e)}catch(e){return t.error({code:`predicate`,expected:kk,problem:Ak(e)})}},declaredOut:jE.jsonObject})},{name:`string.json`}),Nk=ok(/^[a-z]*$/,`only lowercase letters`),Pk=WO.module({root:wE({in:`string`,morphs:e=>e.toLowerCase(),declaredOut:Nk}),preformatted:Nk},{name:`string.lower`}),Fk=[`NFC`,`NFD`,`NFKC`,`NFKD`],Ik=Cb(Fk,(e,t)=>[t,wE({domain:`string`,predicate:e=>e.normalize(t)===e,meta:`${t}-normalized unicode`})]),Lk=Cb(Fk,(e,t)=>[t,wE({in:`string`,morphs:e=>e.normalize(t),declaredOut:Ik[t]})]),Rk=WO.module({root:Lk.NFC,preformatted:Ik.NFC},{name:`string.normalize.NFC`}),zk=WO.module({root:Lk.NFD,preformatted:Ik.NFD},{name:`string.normalize.NFD`}),Bk=WO.module({root:Lk.NFKC,preformatted:Ik.NFKC},{name:`string.normalize.NFKC`}),Vk=WO.module({root:Lk.NFKD,preformatted:Ik.NFKD},{name:`string.normalize.NFKD`}),Hk=WO.module({root:`NFC`,NFC:Rk,NFD:zk,NFKC:Bk,NFKD:Vk},{name:`string.normalize`}),Uk=ok(xx,`a well-formed numeric string`),Wk=WO.module({root:Uk,parse:wE({in:Uk,morphs:e=>Number.parseFloat(e),declaredOut:jE.number})},{name:`string.numeric`}),Gk=`a regex pattern`,Kk=wE({domain:`string`,predicate:{meta:Gk,predicate:(e,t)=>{try{return new RegExp(e),!0}catch(e){return t.reject({code:`predicate`,expected:Gk,problem:String(e)})}}},meta:{format:`regex`}}),qk=ok(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,`a semantic version (see https://semver.org/)`),Jk=ok(/^\S.*\S$|^\S?$/,`trimmed`),Yk=WO.module({root:wE({in:`string`,morphs:e=>e.trim(),declaredOut:Jk}),preformatted:Jk},{name:`string.trim`}),Xk=ok(/^[A-Z]*$/,`only uppercase letters`),Zk=WO.module({root:wE({in:`string`,morphs:e=>e.toUpperCase(),declaredOut:Xk}),preformatted:Xk},{name:`string.upper`}),Qk=wE({domain:`string`,predicate:{meta:`a URL string`,predicate:e=>URL.canParse(e)},meta:{format:`uri`}}),$k=WO.module({root:Qk,parse:wE({declaredIn:Qk,in:`string`,morphs:(e,t)=>{try{return new URL(e)}catch{return t.error(`a URL string`)}},declaredOut:wE(URL)})},{name:`string.url`}),eA=WO.module({root:[`versioned | nil | max`,`@`,{description:`a UUID`,format:`uuid`}],"#nil":`'00000000-0000-0000-0000-000000000000'`,"#max":`'ffffffff-ffff-ffff-ffff-ffffffffffff'`,"#versioned":/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[1-8][\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,v1:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-1[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv1`),v2:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-2[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv2`),v3:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-3[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv3`),v4:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-4[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv4`),v5:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-5[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv5`),v6:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-6[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv6`),v7:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-7[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv7`),v8:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-8[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv8`)},{name:`string.uuid`}),tA=WO.module({root:jE.string,alpha:ok(/^[A-Za-z]*$/,`only letters`),alphanumeric:ok(/^[\dA-Za-z]*$/,`only letters and digits 0-9`),hex:lk,base58:uk,base64:dk,capitalize:pk,creditCard:mk,date:xk,digits:ok(/^\d*$/,`only digits 0-9`),email:Sk,integer:ck,ip:Ok,json:Mk,lower:Pk,normalize:Hk,numeric:Wk,regex:Kk,semver:qk,trim:Yk,upper:Zk,url:$k,uuid:eA},{name:`string`}),nA=WO.module({bigint:jE.bigint,boolean:jE.boolean,false:jE.false,never:jE.never,null:jE.null,number:jE.number,object:jE.object,string:jE.string,symbol:jE.symbol,true:jE.true,unknown:jE.unknown,undefined:jE.undefined}),rA=WO.module({root:jE.unknown,any:jE.unknown},{name:`unknown`}),iA=WO.module({root:jE.jsonObject,stringify:TE(`morph`,{in:jE.jsonObject,morphs:e=>JSON.stringify(e),declaredOut:jE.string})},{name:`object.json`}),aA=WO.module({root:jE.object,json:iA},{name:`object`}),oA=class extends ox{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'},sA=EE([`K`,jE.key],`V`)(e=>({domain:`object`,index:{signature:e.K,value:e.V}}),oA),cA=class extends ox{description='pick a set of properties from an object like `Pick(User, "name | age")`'},lA=EE([`T`,jE.object],[`K`,jE.key])(e=>e.T.pick(e.K),cA),uA=class extends ox{description='omit a set of properties from an object like `Omit(User, "age")`'},dA=EE([`T`,jE.object],[`K`,jE.key])(e=>e.T.omit(e.K),uA),fA=class extends ox{description="make all named properties of an object optional like `Partial(User)`"},pA=EE([`T`,jE.object])(e=>e.T.partial(),fA),mA=class extends ox{description="make all named properties of an object required like `Required(User)`"},hA=EE([`T`,jE.object])(e=>e.T.required(),mA),gA=class extends ox{description='exclude branches of a union like `Exclude("boolean", "true")`'},_A=EE(`T`,`U`)(e=>e.T.exclude(e.U),gA),vA=class extends ox{description='extract branches of a union like `Extract("0 | false | 1", "number")`'},yA=EE(`T`,`U`)(e=>e.T.extract(e.U),vA),bA=WO.module({Exclude:_A,Extract:yA,Omit:dA,Partial:pA,Pick:lA,Record:sA,Required:hA}),xA=UO({...nA,...bA,...nk,...qO,string:tA,number:ak,object:aA,unknown:rA},{prereducedAliases:!0,name:`ark`}),SA=xA.export();Object.assign(VO.ambient,SA),VO.typeAttachments={string:SA.string.root,number:SA.number.root,bigint:SA.bigint,boolean:SA.boolean,symbol:SA.symbol,undefined:SA.undefined,null:SA.null,object:SA.object.root,unknown:SA.unknown.root,false:SA.false,true:SA.true,never:SA.never,arrayIndex:SA.Array.index,Key:SA.Key,Record:SA.Record,Array:SA.Array.root,Date:SA.Date};var J=Object.assign(xA.type,VO.typeAttachments);xA.match,xA.fn,xA.generic,xA.schema,xA.define,xA.declare;var CA=J(`"local" | "lan" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/`),wA=J(`/^[a-z0-9][a-z0-9_-]*$/`);J({id:wA,label:`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({"id?":wA,"label?":`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60`}).onUndeclaredKey(`reject`);function TA(e){let t=CA(e);return t instanceof J.errors?null:t}var EA=J(`1 <= number.integer <= 65535 | null`),DA=J.enumerated(`block`,`warn`,`follow`,`reclaim`,`kill`),OA=DA.default(`block`),kA=J({enabled:`boolean = true`,maxRetries:`number.integer >= 0 = 3`,baseDelayMs:`number >= 0 = 1000`,factor:`number >= 1 = 2`,maxDelayMs:`number >= 0 = 30000`,resetAfterMs:`number >= 0 = 60000`}).onUndeclaredKey(`reject`),AA=J({scheme:`"http" | "https" = "http"`,allowInvalidCert:`boolean = false`,path:`string = "/"`,method:`"GET" | "HEAD" = "GET"`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer = 400`,expectBody:`string = ""`}).onUndeclaredKey(`reject`),jA=J({maxRssBytes:`number.integer >= 0 = 0`}).onUndeclaredKey(`reject`),MA=J({enabled:`boolean = true`,mode:`"port" | "http" = "port"`,http:AA.default(()=>({})),intervalMs:`number >= 500 = 5000`,timeoutMs:`number >= 100 = 1500`,unhealthyThreshold:`number.integer >= 1 = 3`,forceRestartAfterMs:`number >= 0 = 0`,startTimeoutMs:`number >= 0 = 20000`}).onUndeclaredKey(`reject`),NA=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL" = "SIGTERM"`,killGroup:`boolean = true`,graceMs:`number >= 0 = 5000`,killPortHolders:`boolean = false`}).onUndeclaredKey(`reject`),PA=J({command:`string`,args:J(`string[]`).default(()=>[]),env:J(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 120000`,runOnce:`boolean = true`}).onUndeclaredKey(`reject`).or(J(`null`)),FA=J({command:`string >= 1`,args:J(`string[]`).default(()=>[]),env:J(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 600000`,waitMs:`number >= 0 = 2000`}).onUndeclaredKey(`reject`).or(J(`null`)),IA=J(`string | null`),LA=J(`50 <= number.integer <= 100000`),RA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:IA.optional(),enabled:`boolean = true`,autostart:`boolean = false`,persistent:`boolean = false`,command:`string >= 1`,args:J(`string[]`).default(()=>[]),cwd:`string = "."`,env:J(`Record<string, string>`).default(()=>({})),dataEnvs:J(`Record<string, string>`).default(()=>({})),bootstrap:PA.optional(),dump:FA.optional(),load:FA.optional(),port:EA.optional(),bind:CA.default(()=>`local`),onPortConflict:OA,restart:kA.default(()=>({})),health:MA.default(()=>({})),stop:NA.default(()=>({})),logBufferLines:LA.default(()=>500),dependsOn:J(`string[]`).default(()=>[]),envFile:`string = ""`,resources:jA.default(()=>({})),backupPaths:J(`string[]`).default(()=>[]),backupIgnoreGenerated:`boolean = true`}).onUndeclaredKey(`reject`),zA=J({enabled:`boolean = true`,sessionTtlMs:`number >= 60000 = 604800000`,cookieSecure:`"auto" | "always" | "never" = "auto"`,trustProxy:`boolean | "loopback" = false`,maxLoginAttempts:`number.integer >= 1 = 5`,lockoutMs:`number >= 1000 = 60000`}).onUndeclaredKey(`reject`),BA={onCrash:`boolean = true`,onUnhealthy:`boolean = true`,onForcedRestart:`boolean = true`,onRecovered:`boolean = false`,onHost:`boolean = true`,onDdns:`boolean = true`,cooldownMs:`number >= 0 = 120000`},VA=J({...BA}).onUndeclaredKey(`reject`),HA=J({...BA}),UA=`boolean = true`,WA=J({kind:`"telegram"`,id:`/^[a-z0-9][a-z0-9_-]*$/`,enabled:`boolean = false`,chatId:`string = ""`,useOwnSettings:UA,...BA}).onUndeclaredKey(`reject`),GA=J({kind:`"webhook"`,id:`/^[a-z0-9][a-z0-9_-]*$/`,url:`string = ""`,enabled:`boolean = true`,method:`"POST" | "PUT" = "POST"`,format:`"json" | "text" = "json"`,headers:`string = ""`,useOwnSettings:UA,...BA}).onUndeclaredKey(`reject`),KA=WA.or(GA).array();J({defaults:VA.default(()=>({})),destinations:KA.default(()=>[])}).onUndeclaredKey(`reject`);var qA=J({persist:`boolean = true`,maxBytes:`10000 <= number <= 100000000 = 2000000`,keep:`1 <= number.integer <= 10 = 3`}).onUndeclaredKey(`reject`),JA=J({enabled:`boolean = false`}).onUndeclaredKey(`reject`),YA=J({enabled:`boolean = true`,intervalMs:`number >= 5000 = 15000`,diskPaths:J(`string[]`).default(()=>[`.`]),diskUsedPercent:`number >= 0 = 90`,memoryUsedPercent:`number >= 0 = 90`,swapUsedPercent:`number >= 0 = 50`,loadPerCpu:`number >= 0 = 2`,tempCelsius:`number >= 0 = 85`,tempCommand:`string <= 512 = ""`,tempCommandTimeoutMs:`100 <= number <= 30000 = 5000`}).onUndeclaredKey(`reject`),XA=J.enumerated(`A`,`AAAA`),ZA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,provider:`string >= 1`,label:`string = ""`}).onUndeclaredKey(`reject`),QA=J({host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/`,account:`string >= 1`,types:XA.array().default(()=>[`A`]),zone:`string?`,ttl:`number.integer >= 1?`,proxied:`boolean = false`,enabled:`boolean = true`}).onUndeclaredKey(`reject`),$A=J({enabled:`boolean = true`,url:`string = ""`}).onUndeclaredKey(`reject`),ej=J({enabled:`boolean = false`,url:`string = ""`}).onUndeclaredKey(`reject`),tj=J({enabled:`boolean = false`,intervalMs:`number >= 60000 = 300000`,ipv4:$A.default(()=>({})),ipv6:ej.default(()=>({})),ttl:`number.integer >= 1 = 1`,accounts:ZA.array().default(()=>[]),domains:QA.array().default(()=>[])}).onUndeclaredKey(`reject`),nj=J({enabled:`boolean`,running:`boolean`,lastRunAt:`number | null`,lastResult:`string | null`,ipv4:`string | null`,ipv6:`string | null`,records:J({host:`string`,account:`string`,provider:`string`,type:XA,ip:`string | null`,state:J(`"pending" | "ok" | "unchanged" | "error" | "skipped"`),message:`string | null`,updatedAt:`number | null`}).array()}),rj=J({key:`string`,label:`string`,hint:`string = ""`,optional:`boolean = false`}),ij=J({config:tj,status:nj,providers:J({id:`string`,label:`string`,docsUrl:`string`,families:XA.array(),fields:rj.array(),ttl:`boolean`,proxied:`boolean`,txt:`boolean`}).array(),credentials:J(`string[]`)});J({provider:`string >= 1`,credentials:J(`Record<string, string>`)}).onUndeclaredKey(`reject`),J({enabled:`boolean?`,intervalMs:`number >= 60000?`,ipv4:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ipv6:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ttl:`number.integer >= 1?`,accounts:ZA.array().optional(),domains:QA.array().optional()}).onUndeclaredKey(`reject`);var aj=J({mode:`"only" | "except"`,ids:J(`string >= 1`).array().atLeastLength(1)}).onUndeclaredKey(`reject`),oj=J({intervalMs:`number.integer >= 0 = 0`,keep:`number.integer >= 1 = 7`,scope:aj.optional()}).onUndeclaredKey(`reject`);J({enabled:`boolean = true`,dir:`string = ".backups"`,keep:`number.integer >= 1 = 5`,includePaths:J(`string[]`).default(()=>[]),schedule:oj.default(()=>({}))}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60 = "home-hosted"`,port:`1 <= number.integer <= 65535 = 3999`,host:CA.default(()=>`local`),openBrowser:`boolean = false`,auth:zA.default(()=>({})),tls:JA.default(()=>({}))}).onUndeclaredKey(`reject`);var sj=J({enabled:`boolean = true`,autostart:`boolean = false`,bind:CA.default(()=>`local`),onPortConflict:OA,restart:kA.default(()=>({})),health:MA.default(()=>({})),stop:NA.default(()=>({})),logBufferLines:LA.default(()=>500)}).onUndeclaredKey(`reject`),cj=J({enabled:`boolean?`,maxRetries:`number.integer >= 0?`,baseDelayMs:`number >= 0?`,factor:`number >= 1?`,maxDelayMs:`number >= 0?`,resetAfterMs:`number >= 0?`}).onUndeclaredKey(`reject`),lj=J({scheme:`"http" | "https"?`,allowInvalidCert:`boolean?`,path:`string?`,method:`"GET" | "HEAD"?`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer?`,expectBody:`string?`}).onUndeclaredKey(`reject`),uj=J({maxRssBytes:`number.integer >= 0?`}).onUndeclaredKey(`reject`),dj=J({enabled:`boolean?`,mode:`"port" | "http"?`,http:lj.optional(),intervalMs:`number >= 500?`,timeoutMs:`number >= 100?`,unhealthyThreshold:`number.integer >= 1?`,forceRestartAfterMs:`number >= 0?`,startTimeoutMs:`number >= 0?`}).onUndeclaredKey(`reject`),fj=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL"?`,killGroup:`boolean?`,graceMs:`number >= 0?`,killPortHolders:`boolean?`}).onUndeclaredKey(`reject`),pj=J({enabled:`boolean?`,sessionTtlMs:`number >= 60000?`,cookieSecure:`"auto" | "always" | "never"?`,trustProxy:`boolean | "loopback"?`,maxLoginAttempts:`number.integer >= 1?`,lockoutMs:`number >= 1000?`}).onUndeclaredKey(`reject`),mj={onCrash:`boolean?`,onUnhealthy:`boolean?`,onForcedRestart:`boolean?`,onRecovered:`boolean?`,onHost:`boolean?`,onDdns:`boolean?`,cooldownMs:`number >= 0?`},hj=J({kind:`"telegram" | "webhook"`,id:`/^[a-z0-9][a-z0-9_-]*$/`,enabled:`boolean?`,useOwnSettings:`boolean?`,chatId:`string?`,url:`string?`,method:`"POST" | "PUT"?`,format:`"json" | "text"?`,headers:`string?`,...mj}).onUndeclaredKey(`reject`),gj=J({defaults:J({...mj}).onUndeclaredKey(`reject`).optional(),destinations:hj.array().optional()}).onUndeclaredKey(`reject`),_j=J({enabled:`boolean?`,intervalMs:`number >= 5000?`,diskPaths:J(`string[]`).optional(),diskUsedPercent:`number >= 0?`,memoryUsedPercent:`number >= 0?`,swapUsedPercent:`number >= 0?`,loadPerCpu:`number >= 0?`,tempCelsius:`number >= 0?`,tempCommand:`string <= 512?`,tempCommandTimeoutMs:`100 <= number <= 30000?`}).onUndeclaredKey(`reject`),vj=J({intervalMs:`number.integer >= 0?`,keep:`number.integer >= 1?`,scope:aj.or(J(`null`)).optional()}).onUndeclaredKey(`reject`),yj=J({enabled:`boolean?`,dir:`string?`,keep:`number.integer >= 1?`,includePaths:J(`string[]`).optional(),schedule:vj.optional()}).onUndeclaredKey(`reject`),bj=J({persist:`boolean?`,maxBytes:`10000 <= number <= 100000000?`,keep:`1 <= number.integer <= 10?`}).onUndeclaredKey(`reject`),xj=J({enabled:`boolean?`}).onUndeclaredKey(`reject`),Sj=J({label:`1 <= string <= 60 | null?`,port:`1 <= number.integer <= 65535?`,host:CA.optional(),openBrowser:`boolean?`,auth:pj.optional(),tls:xj.optional()}).onUndeclaredKey(`reject`),Cj=J({enabled:`boolean?`,autostart:`boolean?`,bind:CA.optional(),onPortConflict:DA.optional(),restart:cj.optional(),health:dj.optional(),stop:fj.optional(),logBufferLines:LA.optional()}).onUndeclaredKey(`reject`),wj={label:IA.optional(),enabled:`boolean?`,autostart:`boolean?`,persistent:`boolean?`,command:`string?`,args:`string[]?`,cwd:`string?`,env:`Record<string, string>?`,dataEnvs:`Record<string, string>?`,bootstrap:PA.optional(),dump:FA.optional(),load:FA.optional(),port:EA.optional(),bind:CA.optional(),onPortConflict:DA.optional(),restart:cj.optional(),health:dj.optional(),stop:fj.optional(),logBufferLines:LA.optional(),dependsOn:J(`string[]`).optional(),envFile:`string?`,resources:uj.optional(),backupPaths:J(`string[]`).optional(),backupIgnoreGenerated:`boolean?`},Tj=J(wj).onUndeclaredKey(`reject`),Ej=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,...wj,command:`string`}).onUndeclaredKey(`reject`);J({serverId:`string`,command:`string`,args:`string[]`,cwd:`string`,env:`Record<string, string>`,logDir:`string`,logs:qA,stop:NA}).onUndeclaredKey(`reject`),J({serverId:`string`,nannyPid:`number`,childPid:`number | null`,startedAt:`number`,logFile:`string`,heartbeatAt:`number`,"lastExit?":J({code:`number | null`,signal:`string | null`,at:`number`,runtimeMs:`number`}).onUndeclaredKey(`reject`)}).onUndeclaredKey(`reject`),J({restarts:`number.integer >= 0`,"healthRestarts?":`number.integer >= 0`,bootstrapDone:`boolean`,"pendingLoad?":`string | null`,"lastPid?":`number | null`,"lastStartedAt?":`number | null`});var Dj=J({control:Sj.optional(),host:_j.optional(),backups:yj.optional()}).onUndeclaredKey(`reject`),Oj=J({defaults:Cj.optional(),logs:bj.optional(),notifications:gj.optional()}).onUndeclaredKey(`reject`),kj=J({enabled:`boolean`,passwordSet:`boolean`,passwordUpdatedAt:`number | null`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,exposed:`boolean`,blockedReason:`string | null`,sessionTtlMs:`number`,cookieSecure:`string`,trustProxy:`boolean | "loopback"`,maxLoginAttempts:`number`,lockoutMs:`number`}),Aj=J({enabled:`boolean`,certPresent:`boolean`,subject:`string | null`,issuer:`string | null`,validFrom:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,fingerprint:`string | null`,keyMatches:`boolean | null`,error:`string | null`}),jj=J.enumerated(`caddy`),Mj=J.enumerated(`server`,`panel`,`external`),Nj=J.enumerated(`auto`,`off`,`manual`),Pj=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/`,enabled:`boolean = true`,target:Mj.default(()=>`server`),workspace:`string = ""`,server:`string = ""`,url:`string = ""`,path:`string = ""`,tls:Nj.default(()=>`auto`),dnsAccount:`string = ""`}).onUndeclaredKey(`reject`),Fj=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:`string = ""`}).onUndeclaredKey(`reject`),Ij=J.enumerated(`off`,`local`,`uploaded`,`issued`,`pending`,`failed`,`fallback`),Lj=J({enabled:`boolean = false`,resolvers:J(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),Rj=J({enabled:`boolean = false`,engine:jj.default(()=>`caddy`),httpPort:`1 <= number.integer <= 65535 = 80`,httpsPort:`1 <= number.integer <= 65535 = 443`,email:`string = ""`,staging:`boolean = false`,dns01:Lj.default(()=>({})),certificates:Fj.array().default(()=>[]),routes:Pj.array().default(()=>[])}).onUndeclaredKey(`reject`),zj=J({id:jj,installed:`boolean`,version:`string | null`,source:J.enumerated(`downloaded`,`custom`).or(J(`null`)),path:`string | null`,bytes:`number | null`,error:`string | null`}),Bj=J({id:jj,label:`string`,docsUrl:`string`,releaseUrl:`string`,acme:`boolean`,internalCa:`boolean`,dns01:`boolean`,tcp:`boolean`}),Vj=J({route:Pj,status:J.enumerated(`ok`,`disabled`,`no-upstream`,`error`),upstream:`string | null`,message:`string | null`,"certificate?":J({state:Ij,message:`string | null`,"retryInMinutes?":`number`})}),Hj=J({state:J.enumerated(`off`,`stopped`,`starting`,`running`,`error`,`unsupported`),pid:`number | null`,urls:J(`string[]`),certExpiryDays:`number | null`,since:`number | null`,lastError:`string | null`}),Uj=J({id:`string`,label:`string`,present:`boolean`,used:`boolean`,subject:`string | null`,issuer:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,hosts:J(`string[]`),error:`string | null`}),Wj=J({workspace:`string`,account:`string`,provider:`string`,label:`string`,writesTxt:`boolean`,hasCredentials:`boolean`}),Gj=J({config:Rj,engine:zj,engines:Bj.array(),status:Hj,routes:Vj.array(),certificates:Uj.array(),"dnsAccounts?":Wj.array()}),Kj=J({id:`string`,host:`string`,enabled:`boolean?`,target:Mj.optional(),workspace:`string?`,server:`string?`,url:`string?`,path:`string?`,tls:Nj.optional(),dnsAccount:`string?`}).onUndeclaredKey(`reject`),qj=J({enabled:`boolean?`,engine:jj.optional(),httpPort:`1 <= number.integer <= 65535?`,httpsPort:`1 <= number.integer <= 65535?`,email:`string?`,staging:`boolean?`,dns01:J({enabled:`boolean | null?`,resolvers:`string[] | null?`}).onUndeclaredKey(`reject`).optional(),certificates:Fj.array().optional(),routes:Kj.array().optional()}).onUndeclaredKey(`reject`),Jj=J({label:`string = ""`,certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`);J({version:`string = ""`}).onUndeclaredKey(`reject`);var Yj=J({id:`string`,kind:`"telegram" | "webhook"`,enabled:`boolean`,useOwnSettings:`boolean`,onCrash:`boolean`,onUnhealthy:`boolean`,onForcedRestart:`boolean`,onRecovered:`boolean`,onHost:`boolean`,onDdns:`boolean?`,cooldownMs:`number`,chatId:`string | null`,tokenSet:`boolean`,url:`string | null`,method:`"POST" | "PUT" | null`,format:`"json" | "text" | null`,headers:`string | null`,"lastResult?":`string | null`,"lastResultAt?":`number | null`});J({chats:J({id:`string | number`,title:`string`}).array()});var Xj=J({"defaults?":HA,"destinations?":Yj.array()});J({authenticated:`boolean`,authRequired:`boolean`,passwordSet:`boolean`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,defaultPassword:`string | null`,sessionTtlMs:`number`});var Zj=J({password:`string`}).onUndeclaredKey(`reject`),Qj=J(`1 <= string <= 512`),$j=J({currentPassword:`string?`,newPassword:Qj}).onUndeclaredKey(`reject`),eM=J(`"stopped" | "starting" | "running" | "stopping" | "backoff" | "crashed" | "conflict"`),tM=J(`"disabled" | "unknown" | "healthy" | "unhealthy"`),nM=J(`"unknown" | "free" | "in-use"`),rM=J({ts:`number`,stream:J(`"stdout" | "stderr" | "system"`),text:`string`}),iM=J({windowMs:`number`,uptimeRatio:`number | null`,restarts:`number`,crashes:`number`,forcedRestarts:`number`,lastCrashAt:`number | null`,lastExitAt:`number | null`,lastRuntimeMs:`number | null`,events:J({serverId:`string`,ts:`number`,type:`"start" | "exit" | "crash" | "forced-restart" | "unhealthy" | "recovered"`,detail:`string`,runtimeMs:`number?`,"actor?":J.enumerated(`policy`,`user`,`agent`,`boot`)}).array()}),aM=J({cpuPercent:`number | null`,rssBytes:`number | null`,processes:`number`,sampledAt:`number`}),oM=J({path:`string`,totalBytes:`number`,freeBytes:`number`,usedPercent:`number`}),sM=J({enabled:`boolean`,cpus:`number`,loadAvg:J(`number[]`),"cpuUsedPercent?":`number | null`,uptimeMs:`number`,memoryUsedPercent:`number`,swapUsedPercent:`number`,tempCelsius:`number | null`,disks:oM.array(),alerts:J(`string[]`),sampledAt:`number | null`});J({wsl:`boolean`,supported:`boolean`,configured:`boolean`,scriptWritten:`boolean`,libraryPresent:`boolean`,scriptPath:`string | null`,"tempCommand?":`string | null`,"lastReadingCelsius?":`number | null`,"lastError?":`string | null`});var cM=J({name:`string`,sizeBytes:`number`,createdAt:`number`,encrypted:`boolean`}),lM=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "tls" | "workspace"`,"workspaceId?":`string`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,items:J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "servers" | "secrets" | "data"`,"secret?":`string`,"path?":`string`,"origin?":`string`,included:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,"ignoreGenerated?":`boolean`}).array()}),uM=J({enabled:`boolean`,dir:`string`,keep:`number`,"schedule?":oj.onDeepUndeclaredKey(`ignore`),"lastAutomaticAt?":`number | null`,"scheduleError?":J({message:`string`,at:`number`}),includePaths:J(`string[]`),entries:lM.array(),files:cM.array()}),dM=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "servers" | "tls" | "data"`,"workspaceId?":`string`,restorable:`boolean`,selected:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`}),fM=J({label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,"reasonKey?":`string`,"reasonParams?":`Record<string, string>`});J({dryRun:`boolean`,encrypted:`boolean`,needsPassword:`boolean`,"archive?":J({"writtenBy?":`string`,"schema?":`number`}),items:dM.array(),"hooks?":J({serverId:`string`,workspaceId:`string`,action:`"dump" | "load"`,ok:`boolean`,"output?":`string`}).array(),applied:J(`string[]`),"appliedIds?":J(`string[]`),skipped:J(`string[]`),"skippedItems?":fM.array(),restartRequired:`boolean`,reloaded:`boolean`,"replacedUnderRunning?":J({workspaceId:`string`,serverId:`string`,path:`string`}).array(),"createdWorkspaces?":J(`string[]`),error:`string?`}),J({password:Qj.optional(),include:J(`string[] >= 1`).optional(),exclude:J(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`),J({name:`string?`,password:Qj.optional(),include:J(`string[]`).optional(),exclude:J(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`);var pM=J({id:`string`,"workspaceId?":`string`,config:RA,bindHost:`string`,url:`string | null`,status:eM,health:tM,portState:nM,pid:`number | null`,adopted:`boolean?`,"stoppedByPanel?":`boolean`,startedAt:`number | null`,exitCode:`number | null`,exitSignal:`string | null`,restarts:`number`,maxRetries:`number`,lastError:`string | null`,nextRetryAt:`number | null`,unhealthySince:`number | null`,bufferedLines:`number`,history:iM,responseMs:`number | null`,resources:aM.or(J(`null`))});J({status:`"ok" | "degraded"`,uptimeMs:`number`,"servers?":J({total:`number`,running:`number`,crashed:`number`,unhealthy:`number`}),"hostAlerts?":`string[]`});var mM=J({label:`string`,port:`number`,host:`string`,bindHost:`string`,url:`string`,openBrowser:`boolean`,restartRequired:`boolean`,protocol:`string`,auth:kj,tls:Aj}),hM=J({custom:`boolean`,dir:`string`,meta:J({"name?":`string`,"version?":`string | null`,"uploadedAt?":`number`,"files?":`number.integer >= 1`,"repo?":`string`,"tag?":`string`,"asset?":`string`,"unix?":`number.integer >= 0`}).or(J(`null`))}),gM=J({serverId:`string`,pid:`number`,startedAt:`number | null`}),_M=J({id:`string`,label:`string`,configPath:`string`,settingsPath:`string`,configError:`string | null`,"configWarnings?":J(`string[]`),logsDir:`string`,defaults:sj,logs:qA,notifications:Xj,"ddns?":nj,serverCount:`number`,runningCount:`number`,crashedCount:`number`,"orphans?":gM.array(),servers:pM.array()}),vM=J({control:mM,host:sM,backups:uM,ui:hM,workspaces:_M.array(),"proxy?":Gj,projectDir:`string`,dataRoot:`string`,"version?":`string`}),yM=J({type:`"hello" | "state" | "log" | "server"`,ts:`number`,"workspaceId?":`string`,serverId:`string?`,state:vM.optional(),server:pM.optional(),lines:rM.array().optional()});J({limit:`string?`}),J({ok:`boolean`,"error?":`string`,"code?":`string`}),J({ok:`boolean`,"error?":`string`}),J({ok:`boolean`,enabled:`boolean`,sessionsInvalidated:`boolean`}),J({control:mM,rebinding:`boolean`,targetUrl:`string`}),J({ok:`boolean`}),J({ok:`boolean`,files:cM.array()}),J({ok:`boolean`,"meta?":hM.get(`meta`),ui:hM,"removed?":`boolean`}),J({file:cM,files:cM.array()}),J({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:`string[]`,searched:rM.array().or(J(`null`)),lines:rM.array()}),J({ok:`boolean`,port:`number | null`,terminated:`number[]`,forced:`number[]`,skipped:`number[]`,free:`boolean`}),J({tail:`string?`,search:`string?`,stream:`"stdout" | "stderr" | "system"?`});var bM=J({servers:J({serverId:`string`,label:`string`,status:eM,enabled:`boolean`,sizeBytes:`number`,files:J({name:`string`,sizeBytes:`number`}).array()}).array()}),xM=J({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:J(`string[]`),searched:`number | null`,lines:rM.array()});J({botToken:`string?`,chatId:`string?`}).onUndeclaredKey(`reject`),J({id:`/^[a-z0-9][a-z0-9_-]*$/`}),J({target:GA.omit(`kind`,`id`).and(J({id:`string?`,kind:`"webhook"?`})),id:`string?`}).onUndeclaredKey(`reject`),J({botToken:`string >= 1`}).onUndeclaredKey(`reject`),J({message:`string`,code:`string`,"detail?":`unknown`}).onUndeclaredKey(`reject`),J({certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`),J({control:mM,host:YA,backups:uM,ui:hM}).and(J({rebinding:`boolean`,targetUrl:`string | null`}));var SM=J({id:`string`,label:`string`,settingsPath:`string`,configPath:`string`,configError:`string | null`,defaults:sj,logs:qA,notifications:Xj});function CM(e){return e instanceof Error?e.message:String(e)}function wM(e,t){return`${e}/${t}`}function TM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var EM=class extends Error{name=`AuthRequiredError`;constructor(){super(`authentication required`)}};async function DM(e,t){let n=await fetch(e,{...t,headers:{"Content-Type":`application/json`,...t?.headers}}),r=await n.text(),i=r.length>0?JSON.parse(r):null;if(!n.ok)throw n.status===401&&TM(i)&&i.code===`AUTH_REQUIRED`?new EM:Error(OM(i,n.status));return i}function OM(e,t){if(TM(e)){if(typeof e.message==`string`&&e.message.length>0)return e.message;if(typeof e.error==`string`&&e.error.length>0)return e.error;if(e.error!==void 0&&e.error!==null&&String(e.error).length>0)return String(e.error)}return`request failed with ${t}`}async function kM(e){let t=Gj(e);if(t instanceof J.errors)throw Error(`proxy contract mismatch: ${t.summary}`);return t}async function AM(e){let t=ij(e);if(t instanceof J.errors)throw Error(`ddns contract mismatch: ${t.summary}`);return t}function jM(e){return DM(`/api/proxy/${e}`,{method:`POST`}).then(kM)}function MM(){return jM(`apply`)}function NM(e){return`/api/backups/${encodeURIComponent(e)}/download`}function PM(e){let t={};for(let n of[`include`,`exclude`]){let r=e[n];if(r!==void 0){if(r.length===0)throw Error(`nothing is ${n===`include`?`selected`:`excluded`}: omit \`${n}\` or name at least one item`);t[n]=r}}return t}function FM(e={}){let t=PM(e);return e.password!==void 0&&e.password.length>0&&(t.password=e.password),t}function IM(e={}){return DM(`/api/backups`,{method:`POST`,body:JSON.stringify(FM(e))})}function LM(){return DM(`/api/auth/password`,{method:`DELETE`})}async function RM(e){return kM(await DM(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`DELETE`}))}function zM(e){return DM(`/api/backups/${encodeURIComponent(e)}`,{method:`DELETE`})}function BM(){return DM(`/api/host/temperature`)}function VM(){return DM(`/api/host/temperature`,{method:`POST`})}function HM(){return DM(`/api/host/temperature`,{method:`DELETE`})}async function UM(){return kM(await DM(`/api/proxy`))}function WM(){return DM(`/api/auth/session`)}function GM(){return DM(`/api/settings`)}async function KM(e=``){return kM(await DM(`/api/proxy/engine`,{method:`POST`,body:JSON.stringify({version:e})}))}function qM(e){let t=Zj({password:e});if(t instanceof J.errors)throw Error(t.summary);return DM(`/api/auth/login`,{method:`POST`,body:JSON.stringify(t)})}function JM(){return DM(`/api/auth/logout`,{method:`POST`})}async function YM(e){let t=qj(e);if(t instanceof J.errors)throw Error(t.summary);return kM(await DM(`/api/proxy`,{method:`PATCH`,body:JSON.stringify(t)}))}function XM(e){let t=PM(e);return e.password!==void 0&&e.password.length>0&&(t.password=e.password),t}function ZM(e,t,n={}){return DM(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:JSON.stringify({name:e,...XM(n)})})}async function QM(e,t,n={}){let r=new FormData;r.append(`file`,e);for(let[e,t]of Object.entries(XM(n)))r.append(e,e===`password`?String(t):JSON.stringify(t));let i=await fetch(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:r}),a=await i.json().catch(()=>null);if(!i.ok)throw Error(a?.message??a?.error??`restore failed with ${i.status}`);return a}async function $M(e){return kM(await DM(`/api/proxy/routes/${encodeURIComponent(e)}/retry-certificate`,{method:`POST`}))}function eN(){return jM(`revert`)}function tN(){return DM(`/api/settings/ui`,{method:`DELETE`})}function nN(e,t){let n=$j(e===void 0?{newPassword:t}:{currentPassword:e,newPassword:t});if(n instanceof J.errors)throw Error(n.summary);return DM(`/api/auth/password`,{method:`POST`,body:JSON.stringify(n)})}function rN(){return jM(`start`)}function iN(){return jM(`stop`)}async function aN(e,t,n,r){let i=Jj({label:t,certificate:n,privateKey:r});if(i instanceof J.errors)throw Error(i.summary);return kM(await DM(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(i)}))}async function oN(e){let t=new FormData;t.append(`file`,e);let n=await fetch(`/api/settings/ui`,{method:`POST`,body:t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??r?.error??`the upload failed with ${n.status}`);return r}var sN=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),cN=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,()=>r?`/${r}`:``)}return e},lN=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.set(n,r)}return t},uN=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},dN=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function fN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pN(e,t){if(!fN(e)&&!fN(t))return t;let n={...e};for(let e in t){let r=t[e];n[e]=fN(n[e])&&fN(r)?pN(n[e],r):r}return n}var mN=/^[\w!#$%&'*.^`|~+-]+$/,hN=(e,t,n={})=>{if(!mN.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},gN=(e,t,n)=>(t=encodeURIComponent(t),hN(e,t,n)),_N=(e,t)=>new Proxy(()=>{},{get(n,r){if(typeof r==`string`&&r!==`then`)return _N(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),vN=(e,t)=>{let n=t.toString();return n?`${e}?${n}`:e},yN=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.append(n,r)}this.rBody=t}e.json!==void 0&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))r!==void 0&&t.push(gN(n,r));t.length>0&&(r.Cookie=t.join(`; `))}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers;for(let[e,t]of Object.entries(r))t!==void 0&&i.set(e,t);let a=this.url;a=dN(a),a=cN(a,this.pathParams),this.queryParams&&(a=vN(a,this.queryParams)),n=this.method.toUpperCase();let o=n!==`GET`&&n!==`HEAD`;return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},bN=((e,t)=>_N(function n(r){let i=t?.buildSearchParams??lN,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=sN(e,a.join(`/`));if(s===`url`||s===`path`){let t=dN(c);return r.args[0]&&(r.args[0].param&&(t=cN(t,r.args[0].param)),r.args[0].query&&(t=vN(t,i(r.args[0].query)))),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=dN(c),n=uN(r.args[0]?.param?cN(e,r.args[0].param):e,`ws`),a=new URL(n),o=r.args[0]?.query;return o&&i(o).forEach((e,t)=>{a.searchParams.append(t,e)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(a.toString())}let l=new yN(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=pN(t,e);return l.fetch(r.args[0],a)}return l},[]))(typeof window>`u`?`http://127.0.0.1`:window.location.origin);J({workspaces:_M.array()});var xN=J({workspace:_M}),SN=J({ok:`boolean`,removed:`unknown`});function CN(e){return e==null||e.length===0?``:`?workspace=${encodeURIComponent(e)}`}function wN(e,t){return{param:{id:t},query:e.length>0?{workspace:e}:{}}}function TN(e,t,n){let r=n??new URLSearchParams;t.length>0&&r.set(`workspace`,t);let i=r.toString();return i.length>0?`${e}?${i}`:e}async function EN(){let e=vM(await DM(`/api/state`));if(e instanceof J.errors)throw Error(`state contract mismatch: ${e.summary}`);return e}async function DN(e){let t=xN(e);if(t instanceof J.errors)throw Error(`workspace contract mismatch: ${t.summary}`);return t.workspace}async function ON(e){return DN(await DM(`/api/workspaces`,{method:`POST`,body:JSON.stringify(e)}))}async function kN(e,t){return DN(await DM(`/api/workspaces/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({label:t})}))}async function AN(e){let t=SN(await DM(`/api/workspaces/${encodeURIComponent(e)}`,{method:`DELETE`}));if(t instanceof J.errors)throw Error(`workspace removal contract mismatch: ${t.summary}`);return t}function jN(e){let t=Dj(e);if(t instanceof J.errors)throw Error(t.summary);return DM(`/api/settings`,{method:`PATCH`,body:JSON.stringify(t)})}async function MN(e,t){let n=Oj(t);if(n instanceof J.errors)throw Error(n.summary);let r=SM(await DM(TN(`/api/settings/workspace`,e),{method:`PATCH`,body:JSON.stringify(n)}));if(r instanceof J.errors)throw Error(`workspace settings contract mismatch: ${r.summary}`);return r}async function NN(e){let t=bM(await DM(TN(`/api/logs`,e)));if(t instanceof J.errors)throw Error(`logs contract mismatch: ${t.summary}`);return t.servers}async function PN(e,t,n){let r=new URLSearchParams;n.tail!==void 0&&r.set(`tail`,String(n.tail)),n.search!==void 0&&n.search.length>0&&r.set(`search`,n.search),n.stream!==void 0&&n.stream.length>0&&r.set(`stream`,n.stream);let i=xM(await DM(TN(`/api/logs/${encodeURIComponent(t)}`,e,r)));if(i instanceof J.errors)throw Error(`log history contract mismatch: ${i.summary}`);return i}function FN(e,t){return DM(TN(`/api/logs/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function IN(e,t,n){return TN(`/api/logs/${encodeURIComponent(t)}/download`,e,new URLSearchParams({file:n}))}function LN(e,t,n){return DM(TN(`/api/notifications/destinations/${encodeURIComponent(t)}/token`,e),{method:`PUT`,body:JSON.stringify({botToken:n})})}function RN(e,t){return DM(TN(`/api/notifications/destinations/${encodeURIComponent(t)}/token`,e),{method:`DELETE`})}function zN(e,t,n){return DM(TN(`/api/notifications/destinations/${encodeURIComponent(t)}/test`,e),{method:`POST`,body:JSON.stringify(n)})}function BN(e,t,n){return DM(TN(`/api/notifications/destinations/${encodeURIComponent(t)}/detect-chats`,e),{method:`POST`,body:JSON.stringify(n)})}function VN(e,t){return DM(TN(`/api/notifications/test-webhook`,e),{method:`POST`,body:JSON.stringify(t)})}async function HN(e){return AM(await DM(TN(`/api/ddns`,e)))}async function UN(e,t){return AM(await DM(TN(`/api/ddns`,e),{method:`PUT`,body:JSON.stringify(t)}))}async function WN(e,t,n,r){return AM(await DM(TN(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`PUT`,body:JSON.stringify({provider:n,credentials:r})}))}async function GN(e,t){return AM(await DM(TN(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`DELETE`}))}async function KN(e){return AM(await DM(TN(`/api/ddns/check`,e),{method:`POST`}))}function qN(e,t){return DM(`/api/settings/tls`,{method:`POST`,body:JSON.stringify({certificate:e,privateKey:t})})}function JN(){return DM(`/api/settings/tls`,{method:`DELETE`})}async function YN(e,t,n){let r=await bN.api.servers[`:id`][n].$post(wN(e,t)),i=await r.json().catch(()=>null);if(!r.ok)throw Error(OM(i,r.status));return i??{ok:!0}}async function XN(e,t){return DM(TN(`/api/servers/orphans/${encodeURIComponent(t)}/stop`,e),{method:`POST`})}function ZN(e){return DM(TN(`/api/servers/start-all`,e),{method:`POST`})}async function QN(e,t){let n=await bN.api.servers[`:id`][`free-port`].$post(wN(e,t)),r=await n.json().catch(()=>null);if(!n.ok)throw Error(OM(r,n.status));return r??{ok:!0,port:null,terminated:[],forced:[],skipped:[],free:!1}}function $N(e,t={}){return DM(TN(`/api/servers/stop-all`,e,t.withPersistent===!0?new URLSearchParams({withPersistent:`true`}):void 0),{method:`POST`})}function eP(e,t){return DM(TN(`/api/servers/${encodeURIComponent(t)}/clear-logs`,e),{method:`POST`})}function tP(e,t,n){return DM(TN(`/api/servers/${encodeURIComponent(t)}`,e),{method:`PATCH`,body:JSON.stringify(n)})}function nP(e,t){return DM(TN(`/api/servers/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function rP(e,t){return DM(TN(`/api/servers`,e),{method:`POST`,body:JSON.stringify(t)})}var iP=k(null),aP=k(null);function oP(e){return e===null?`wait`:e.authRequired&&!e.authenticated?`login`:`connect`}function sP(){async function e(){try{iP.value=await WM()}catch{iP.value=null}}async function t(e){aP.value=null;try{return iP.value=await qM(e),!0}catch(e){return aP.value=CM(e),!1}}async function n(){try{await JM()}finally{await e()}}function r(){iP.value={authenticated:!1,authRequired:!0,passwordSet:iP.value?.passwordSet??!0,apiTokenSet:iP.value?.apiTokenSet??!1,usingDefaultPassword:iP.value?.usingDefaultPassword??!1,defaultPassword:iP.value?.defaultPassword??null,sessionTtlMs:iP.value?.sessionTtlMs??0}}async function i(t,n){aP.value=null;try{return await nN(t,n),await e(),null}catch(e){return CM(e)}}async function a(){aP.value=null;try{return await LM(),await e(),null}catch(e){return CM(e)}}return{session:rn(iP),error:rn(aP),refresh:e,login:t,logout:n,requireLogin:r,setPassword:i,clearPassword:a}}var cP=k([]),lP=1;function uP(e){cP.value=cP.value.filter(t=>t.id!==e)}function dP(e,t=4800){let n=lP++;return cP.value=[...cP.value,{...e,id:n}],t>0&&setTimeout(uP,t,n),n}function fP(){return{toasts:rn(cP),dismiss:uP,push:dP,success:(e,t)=>dP({tone:`ok`,title:e,description:t}),failure:(e,t)=>dP({tone:`danger`,title:e,description:t},9e3),info:(e,t)=>dP({tone:`info`,title:e,description:t}),warn:(e,t)=>dP({tone:`warn`,title:e,description:t},7e3)}}var pP=t({default:()=>mP}),mP={"activity.emptyTitle":`No events in the last 24 hours`,"activity.emptyDescription":`Starts, exits, crashes and recoveries show up here as they happen.`,"activity.ran":`ran {duration}`,"addServer.title":`Add a server`,"addServer.description":`Tell it what to run in {workspace} — a command and the folder it runs in are enough to start.`,"addServer.thisWorkspace":`this workspace`,"addServer.identity":`Identity`,"addServer.id":`Id`,"addServer.idHint":`Lowercase letters, digits, dashes and underscores; used in URLs and logs.`,"addServer.labelHint":`Shown in the panel; defaults to the id.`,"addServer.process":`Process`,"addServer.commandHint":`Spawned without a shell.`,"addServer.argumentsHint":`One argument per line; whitespace inside a line is preserved.`,"addServer.portLifecycle":`Port & lifecycle`,"addServer.bindHint":`lan exposes it to the network; only do that behind auth.`,"addServer.advanced":`Advanced settings`,"addServer.advancedHint":`environment, backups, policy, lifecycle, bootstrap`,"addServer.backups":`Backups`,"addServer.backupIgnore":`Ignore known generated files`,"addServer.bootstrapDescription":`A one-off command run before the first start.`,"addServer.bootstrapHint":`Installs, migrations, downloads — before the first start, not on every one.`,"addServer.policyResources":`Policy & resources`,"addServer.logBufferHint":`Blank keeps the default.`,"addServer.inheritNote":`Restart, health and stop start out matching {settings}; change one here and it is written into this entry instead of staying inherited.`,"addServer.serverDefaults":`Settings → Server defaults`,"addServer.placeholdersTitle":`Available placeholders (arguments and environment)`,"addServer.submit":`Add server`,"app.name":`home-hosted`,"app.tagline":`Process supervisor control panel`,"bind.local":`local — 127.0.0.1`,"bind.lan":`lan — 0.0.0.0`,"bind.explicit":`{bind} — explicit`,"common.cancel":`Cancel`,"common.confirm":`Confirm`,"common.reset":`Reset`,"common.sending":`Sending…`,"common.keepIt":`Keep it`,"common.remove":`Remove`,"common.close":`Close`,"common.save":`Save`,"common.saving":`Saving…`,"common.discard":`Discard`,"common.delete":`Delete`,"common.edit":`Edit`,"common.add":`Add`,"common.retry":`Retry`,"common.copy":`Copy`,"common.copied":`Copied`,"common.copyFailed":`Could not copy`,"common.enabled":`Enabled`,"common.disabled":`Disabled`,"common.none":`None`,"common.unknown":`unknown`,"common.loading":`Loading…`,"common.selectAll":`Select all`,"common.selectNone":`Select none`,"common.name":`Name`,"common.label":`Label`,"common.hostname":`Hostname`,"common.port":`Port`,"common.command":`Command`,"common.environment":`Environment`,"common.memory":`Memory`,"common.cpu":`CPU`,"common.disk":`Disk`,"common.uptime":`Uptime`,"common.status":`Status`,"common.actions":`Actions`,"common.details":`Details`,"common.overview":`Overview`,"common.warning":`Warning`,"common.error":`Error`,"common.confirmQuestion":`{label}?`,"common.unset":`unset`,"common.never":`never`,"common.now":`now`,"common.dismiss":`Dismiss`,"common.notAvailable":`n/a`,"connection.live":`Live`,"connection.connecting":`Connecting`,"connection.reconnecting":`Reconnecting`,"connection.liveUpdates":`Live updates`,"editor.title":`Edit configuration`,"editor.description":`Writes overrides to {file}; anything left alone keeps inheriting the defaults.`,"editor.inSync":`in sync`,"editor.process":`Process`,"editor.processDescription":`What gets spawned, where, and with which environment.`,"editor.labelPlaceholder":`falls back to the id`,"editor.argumentsHint":`One per line; {port} {host} {home} {projectDir} {dataRoot} {id} {label} {cwd} {bind} {lanIp} are substituted.`,"editor.portTitle":`Port & binding`,"editor.portDescription":`How the port is preflighted and where the process is reachable.`,"editor.bindHint":`A custom IPv4 the config already sets stays selectable.`,"editor.lifecycle":`Lifecycle`,"editor.lifecycleDescription":`Whether the supervisor owns this entry at all.`,"editor.save":`Save to servers.config.json`,"editor.changesTitle":`Unsaved changes`,"editor.changesDescription":`What Save would write to servers.config.json.`,"editor.nothingToSave":`Nothing to save.`,"health.disabled":`Not checked`,"health.unknown":`Not probed`,"health.healthy":`Healthy`,"health.unhealthy":`Unhealthy`,"history.start":`Started`,"history.exit":`Exited`,"history.crash":`Crashed`,"history.forcedRestart":`Forced restart`,"history.unhealthy":`Unhealthy`,"history.recovered":`Recovered`,"host.loadPerCpu":`Load / cpu`,"host.cpuTemp":`CPU temp`,"host.samplingOff":`Host sampling is off`,"host.samplingOffDescription":`Turn it on in Settings to collect load, memory, disk and temperature.`,"host.swap":`Swap`,"host.cpus":`CPUs`,"host.loadAverage":`Load 1 / 5 / 15`,"host.memoryUsed":`Memory used`,"host.sampled":`Sampled`,"host.filesystems":`Filesystems`,"host.thresholdsBreached":`Thresholds breached`,"host.cpuUsage":`CPU usage`,"host.loadHint":`Load counts runnable tasks, it is not a percentage: 1.00 is one core’s worth of work. CPU usage above is the real share of this machine.`,"host.perCpu":`per cpu`,"host.samplingOffCompact":`Sampling is disabled in Settings.`,"host.statusOff":`off`,"killPort.trigger":`Kill what holds port {port}`,"killPort.title":`Kill the process on port {port}?`,"killPort.body":`It is asked to stop first, and killed only if it ignores that. Anything this panel supervises is refused, so a managed server cannot be lost this way.`,"killPort.confirm":`Kill it`,"language.label":`Language`,"language.select":`Select a language`,"lifecycle.restartTitle":`Restart policy`,"lifecycle.restartDescription":`Backoff between attempts after a crash.`,"lifecycle.restartOnCrash":`Restart on crash`,"lifecycle.maxRetries":`Max retries`,"lifecycle.maxRetriesHint":`Attempts before the server is left crashed.`,"lifecycle.baseDelay":`Base delay (ms)`,"lifecycle.factor":`Backoff factor`,"lifecycle.maxDelay":`Max delay (ms)`,"lifecycle.resetAfter":`Reset after (ms)`,"lifecycle.resetAfterHint":`A run this long clears the retry counter.`,"lifecycle.healthTitle":`Health check`,"lifecycle.healthDescription":`How readiness is probed once the process is up.`,"lifecycle.probe":`Probe this server`,"lifecycle.probeType":`Probe type`,"lifecycle.probePort":`TCP port — connection only`,"lifecycle.probeHttp":`HTTP request — assert a response`,"lifecycle.interval":`Interval (ms)`,"lifecycle.timeout":`Timeout (ms)`,"lifecycle.unhealthyAfter":`Unhealthy after`,"lifecycle.unhealthyAfterHint":`Consecutive failed probes.`,"lifecycle.forceRestartAfter":`Force restart after (ms)`,"lifecycle.forceRestartAfterHint":`0 disables it.`,"lifecycle.startTimeout":`Start timeout (ms)`,"lifecycle.httpScheme":`Scheme`,"lifecycle.allowInvalidCert":`Accept any certificate`,"lifecycle.allowInvalidCertHint":`For a self-signed backend. Only meaningful over https.`,"lifecycle.httpPath":`HTTP path`,"lifecycle.httpMethod":`HTTP method`,"lifecycle.expectStatus":`Expect status`,"lifecycle.expectStatusHint":`Blank accepts anything below.`,"lifecycle.expectStatusBelow":`Healthy below status`,"lifecycle.expectBody":`Body must contain`,"lifecycle.expectBodyPlaceholder":`optional substring`,"lifecycle.headBodyHint":`HEAD has no response body, so this check is ignored — use GET, or clear it.`,"lifecycle.stopTitle":`Stop behaviour`,"lifecycle.stopDescription":`How the process tree is asked to go away.`,"lifecycle.signal":`Signal`,"lifecycle.signalTerm":`SIGTERM — ask it to stop`,"lifecycle.signalInt":`SIGINT — interrupt (Ctrl-C)`,"lifecycle.signalKill":`SIGKILL — kill immediately`,"lifecycle.grace":`Grace period (ms)`,"lifecycle.killGroup":`Kill the whole process group`,"lifecycle.killPortHolders":`Also kill whatever holds the port`,"login.title":`Sign in to continue`,"login.firstRunTitle":`This panel has no password yet`,"login.firstRunSubtitle":`Anything on this machine can reach it. Set a password right after you are in.`,"login.authOffTitle":`Authentication is turned off`,"login.authOffSubtitle":`The panel only listens on loopback, which is the only thing protecting it right now.`,"login.subtitle":`The control panel is protected. Enter the password to continue.`,"login.password":`Password`,"login.showPassword":`Show password`,"login.hidePassword":`Hide password`,"login.signIn":`Sign in`,"login.openDashboard":`Open the dashboard`,"login.exposed":`Exposed`,"login.defaultPasswordWarning":`Still on the default password {password}. Change it under Settings — binding beyond 127.0.0.1 stays refused until you do.`,"login.noPasswordWarning":`No password is set. Open Settings from this machine to add one, or run {command}.`,"login.sessionNote":`Sessions stay signed in for {duration} after the last visit — each request extends that window. Signing out clears this browser only.`,"login.servedFromThisMachine":`served from this machine`,"logs.emptyHint":`No output yet.`,"logs.noMatches":`Nothing matches that search or stream filter.`,"logs.searchPlaceholder":`Search this output`,"logs.searchLabel":`Search the log output`,"logs.clearSearch":`Clear the search`,"logs.prevMatch":`Previous match`,"logs.nextMatch":`Next match`,"logs.showTimestamps":`Show timestamps`,"logs.hideTimestamps":`Hide timestamps`,"logs.timestampsShort":`ts`,"logs.pause":`Pause`,"logs.follow":`Follow`,"logs.clearHint":`Clear the in-memory buffer`,"logs.clearLabel":`Clear the log buffer`,"logs.downloadHint":`Download the persisted file`,"logs.downloadLabel":`Download the log file`,"logs.outputLabel":`Log output`,"logs.jumpToLatest":`Jump to latest`,"logs.streaming":`streaming`,"logs.paused":`paused`,"logs.snapshot":`snapshot`,"logs.linesOf":`{count} of {total} lines`,"logs.matches":`{count} matches`,"logs.rowHeight":`row height {height}px · windowed`,"logs.streamAll":`All`,"logs.streamOut":`out`,"logs.streamErr":`err`,"logs.streamSys":`sys`,"metric.emptyHint":`collecting…`,"metric.notRunning":`not running`,"nav.global":`Global`,"nav.workspace":`Workspace`,"nav.others":`Others`,"nav.overview":`Overview`,"nav.servers":`Servers`,"nav.logs":`Logs`,"nav.workspaceSettings":`Workspace settings`,"nav.globalOverview":`Global Overview`,"nav.globalSettings":`Global settings`,"nav.reverseProxy":`Reverse Proxy`,"nav.navigation":`Navigation`,"nav.closeNavigation":`Close navigation`,"nav.hostVitals":`Host vitals`,"notice.configError":`The config could not be read: {error}`,"notice.configErrorHint":`The panel keeps running the config it already had; fix {path} and it reloads on its own.`,"notice.defaultPassword":`This panel is still on its default password.`,"notice.defaultPasswordHint":`Change it in Global settings — binding beyond 127.0.0.1 stays refused until you do.`,"notice.noPassword":`Authentication is on but no password is set, so nothing is being asked for.`,"notice.noPasswordHint":`Set one in Global settings to actually lock the panel.`,"notice.exposed":`This panel is reachable beyond 127.0.0.1.`,"notice.exposedHint":`Keep the password strong, or put a TLS-terminating proxy in front of it.`,"notice.authOff":`Authentication is disabled — the panel is only protected by its loopback bind.`,"onPortConflict.block":`block — refuse to start`,"onPortConflict.warn":`warn — start anyway`,"onPortConflict.follow":`follow — adopt a detached restart of itself`,"onPortConflict.reclaim":`reclaim — replace it with a supervised copy`,"onPortConflict.kill":`kill — stop whatever holds the port`,"palette.placeholder":`Jump to a server, run an action, open a setting…`,"palette.openServer":`Open {label}`,"palette.serverLogs":`Logs for {label}`,"palette.startServer":`Start {label}`,"palette.stopServer":`Stop {label}`,"palette.restartServer":`Restart {label}`,"palette.goOverview":`Go to Overview`,"palette.goGlobalOverview":`Go to Global Overview`,"palette.goGlobalSettings":`Go to Global settings`,"palette.goProxy":`Go to Reverse Proxy`,"palette.goServers":`Go to Servers`,"palette.goLogs":`Go to Logs`,"palette.goWorkspaceSettings":`Go to Workspace settings`,"palette.startAll":`Start every enabled server here`,"palette.stopAll":`Stop every server here`,"palette.switchWorkspace":`Switch to {label}`,"palette.globalSetting":`Global setting: {label}`,"palette.workspaceSetting":`Workspace setting: {label}`,"palette.theme":`{theme} theme`,"palette.groupServers":`Servers`,"palette.groupActions":`Actions`,"palette.groupNavigate":`Navigate`,"palette.groupWorkspaces":`Workspaces`,"palette.groupAppearance":`Appearance`,"palette.navigate":`navigate`,"palette.run":`run`,"palette.noMatches":`Nothing matches “{query}”.`,"presets.pickTitle":`What do you want to run?`,"presets.pickDescription":`Pick one and it fills the form for you. You can change every field afterwards.`,"presets.startFromScratch":`Start from scratch`,"presets.minecraft":`Minecraft`,"presets.minecraftHint":`A Java server: set the working directory to the folder holding server.jar, and raise the memory limit if it is a big world.`,"presets.node":`A Node app`,"presets.nodeHint":`A Node app: set the working directory to your project and change server.js if your entry file is named differently.`,"presets.python":`A Python server`,"presets.pythonHint":`A quick file server: it serves the working directory, so point that at the folder you want to share.`,"presets.docker":`Docker Compose`,"presets.dockerHint":`Runs docker compose up in the working directory; set the port to what the file publishes.`,"presets.bot":`A chat bot`,"presets.botHint":`A chat bot: set the working directory to its folder and change bot.js to your script. A bot has no port, so leave the port blank.`,"presets.jellyfin":`Jellyfin`,"presets.jellyfinHint":`A media server: start it once and set up your library in Jellyfin’s own web page on port 8096.`,"presets.gitea":`Gitea (rootless)`,"presets.giteaHint":`The rootless binary: set the working directory to its folder, then finish setup in its web page on port 3000. Git over SSH uses port 2222.`,"presets.mongodb":`MongoDB`,"presets.mongodbHint":`A database: the working directory holds its data folder, so add that folder to the entry’s backup paths.`,"proxy.account.automatic":`Automatic (the only account that can answer)`,"proxy.account.noTxt":`no TXT support`,"proxy.account.noCredentials":`no credentials`,"proxy.account.gone":`That account is no longer configured.`,"proxy.account.emptyHint":`DNS-01 writes the challenge record here. Empty uses the only account that can answer a challenge, when there is one.`,"proxy.account.cannotWrite":`A {provider} account cannot write TXT records, so it cannot answer a DNS-01 challenge.`,"proxy.account.noCredentialsYet":`No credentials are stored for this {provider} account yet.`,"proxy.account.through":`The challenge is written through this {provider} account.`,"proxy.certificate.title":`Uploaded certificates`,"proxy.certificate.description":`Served by routes set to “Uploaded certificate”. Everything else — public or local — is certified by the engine on its own.`,"proxy.certificate.add":`Add certificate`,"proxy.certificate.emptyTitle":`No certificate uploaded`,"proxy.certificate.emptyDescription":`A route set to “Uploaded certificate” needs a pair covering its hostname, or the engine has nothing to serve for it.`,"proxy.certificate.daysLeft":`{days} days left`,"proxy.certificate.subject":`Subject`,"proxy.certificate.issuer":`Issuer`,"proxy.certificate.validUntil":`Valid until`,"proxy.certificate.covers":`Covers`,"proxy.certificate.noSans":`no hostnames in its SANs`,"proxy.certificate.removeAria":`Remove {name}`,"proxy.certificate.removeQuestion":`Remove “{name}”?`,"proxy.certificate.removeBody":`The pair is deleted from disk. A route still set to “Uploaded certificate” keeps serving the engine's own certificate until you change it, and the panel refuses this while one still serves it.`,"proxy.certificate.removeIt":`Remove it`,"proxy.certificate.stored":`“{label}” stored.`,"proxy.certificate.removed":`“{name}” removed.`,"proxy.certificateDialog.title":`Add a certificate`,"proxy.certificateDialog.description":`The pair is stored on disk under its id, and a route set to “Uploaded certificate” can serve it.`,"proxy.certificateDialog.label":`Label`,"proxy.certificateDialog.labelPlaceholder":`Home wildcard`,"proxy.certificateDialog.id":`Id`,"proxy.certificateDialog.idHint":`names the files on disk`,"proxy.certificateDialog.certFile":`Certificate file (.pem, .crt)`,"proxy.certificateDialog.keyFile":`Private key file (.pem, .key)`,"proxy.certificateDialog.pasteCert":`Or paste the certificate`,"proxy.certificateDialog.pasteKey":`Or paste the private key`,"proxy.certificateDialog.certPlaceholder":`-----BEGIN CERTIFICATE-----`,"proxy.certificateDialog.keyPlaceholder":`-----BEGIN PRIVATE KEY-----`,"proxy.certificateDialog.store":`Store the certificate`,"proxy.certificateDialog.errorLabel":`a label is required`,"proxy.certificateDialog.errorId":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.certificateDialog.errorTaken":`“{id}” is already used by another certificate`,"proxy.certificateDialog.errorCertificate":`paste or choose the certificate`,"proxy.certificateDialog.errorPrivateKey":`paste or choose the private key`,"proxy.engine.title":`Engine`,"proxy.engine.description":`The reverse proxy itself. The panel downloads the current build, supervises it and applies its configuration through the engine's own admin API.`,"proxy.engine.notInFrame":`The proxy state is not in this panel's frame yet.`,"proxy.engine.readFailed":`The engine could not be read`,"proxy.engine.notInstalled":`No engine installed`,"proxy.engine.installNote":`Installing downloads the current {engine} release the panel supervises — about 46 MB, once. Nothing is exposed until a route is added and the proxy is switched on.`,"proxy.engine.version":`Version`,"proxy.engine.notProbed":`not probed yet`,"proxy.engine.source":`Source`,"proxy.engine.sourceCustom":`a path configured by hand`,"proxy.engine.sourceDownloaded":`downloaded by the panel`,"proxy.engine.size":`Size`,"proxy.engine.binary":`Binary`,"proxy.engine.copyPath":`Copy the binary path`,"proxy.engine.address":`Live address`,"proxy.engine.process":`Process`,"proxy.engine.certificates":`Certificates`,"proxy.engine.noCert":`no public certificate yet`,"proxy.engine.expiresSoon":`soonest expires in {days} days`,"proxy.engine.acme":`ACME certificates`,"proxy.engine.localCa":`Local CA`,"proxy.engine.dns01":`DNS-01`,"proxy.engine.tcpUdp":`TCP/UDP`,"proxy.engine.documentation":`{engine} documentation`,"proxy.engine.failed":`The engine reported a failure`,"proxy.engine.setcapHint":`A privileged port (below 1024) needs this once on Linux:`,"proxy.engine.copyCommand":`Copy the command`,"proxy.engine.install":`Install engine`,"proxy.engine.start":`Start`,"proxy.engine.stop":`Stop`,"proxy.engine.apply":`Apply configuration`,"proxy.engine.revert":`Revert`,"proxy.engine.revertHint":`Go back to the configuration that applied before the last one`,"proxy.engine.update":`Update engine`,"proxy.listener.title":`Listener & certificates`,"proxy.listener.description":`Where the proxy listens. 80 and 443 are what a router forwards and what an ACME challenge expects; a port below 1024 needs a privileged bind.`,"proxy.listener.unprivilegedPorts":`unprivileged ports`,"proxy.listener.run":`Run the reverse proxy`,"proxy.listener.runHint":`Saved with Save settings; the panel starts or stops the engine to match.`,"proxy.listener.httpPort":`HTTP port`,"proxy.listener.httpPortHint":`ACME HTTP-01 challenges and the redirect to HTTPS.`,"proxy.listener.httpsPort":`HTTPS port`,"proxy.listener.httpsPortHint":`Where certificates are served.`,"proxy.listener.useFallback":`Use {http} / {https}`,"proxy.listener.useStandard":`Use 80 / 443`,"proxy.listener.forwardHint":`Running unprivileged — forward 80 and 443 to these ports on your router.`,"proxy.listener.privilegedTitle":`A port below 1024 needs a privileged bind`,"proxy.listener.privilegedBody":`Running the panel as your own user cannot bind 80 or 443 without permission. Either grant it once {how} and restart the engine, or keep {http}/{https} and forward 80/443 from your router. On Windows the port is free to bind, but something else may hold it.`,"proxy.listener.privilegedWithSetcap":`with {command} on the engine binary`,"proxy.listener.email":`ACME account e-mail`,"proxy.listener.emailPlaceholder":`you@example.com`,"proxy.listener.emailHint":`Let's Encrypt uses it to warn you about an expiring certificate. A local-only name gets the engine's own CA and needs none.`,"proxy.listener.emailNeededTitle":`An e-mail is needed for automatic HTTPS`,"proxy.listener.emailNeededBody":`“{host}” is a public hostname, so the engine asks a CA for a certificate and the account address is required. Fill it in, switch the route's TLS off, or turn on the staging endpoint while you try things out.`,"proxy.listener.staging":`Use the ACME staging endpoint`,"proxy.listener.stagingHint":`Untrusted certificates and no rate-limit burn while you try things out.`,"proxy.listener.dns01":`Answer challenges with DNS-01`,"proxy.listener.dns01Hint":`The panel writes the challenge record through a route's DNS account, so no inbound port is needed to get a certificate.`,"proxy.listener.resolvers":`Check the record against`,"proxy.listener.resolversPlaceholder":`1.1.1.1, 8.8.8.8`,"proxy.listener.resolversHint":`Nameservers the engine reads the record from; empty uses its own. Needed where split-horizon DNS shows it a different view.`,"proxy.listener.noAccountTitle":`No DNS account can answer a challenge`,"proxy.listener.noAccountBody":`DNS-01 is on, but no account has credentials it can use. Add one under Workspace Settings → Dynamic DNS, or public names stay on the port challenges and wait for a CA that cannot reach them.`,"proxy.listener.manyAccountsTitle":`Each public route has to pick an account`,"proxy.listener.manyAccountsBody":`More than one account can answer, so “Automatic” cannot choose. Pick one per route, or those names stay on the port challenges.`,"proxy.listener.accountNote":`Each route picks its own account, so names in different zones each get the right one. A route left on “Automatic” uses the only account the table names. A name no account answers stays on the port challenges.`,"proxy.listener.pendingNote":`A public name whose certificate is still being issued is reachable in the meantime — over HTTPS with a temporary untrusted certificate, or over plain HTTP with a page naming the ports to forward.`,"proxy.retry.inFallback":`~8 hours`,"proxy.retryButton.force":`Force retry certificate`,"proxy.retryButton.question":`Ask the CA again for {host}?`,"proxy.retryButton.body":`The engine failed to obtain a CA certificate for this hostname previously and is using its local CA. It retries automatically every {retryIn}.`,"proxy.retryButton.warning":`Retrying now will kill this route and make it unavailable for a bit, are you sure to continue?`,"proxy.retryButton.leave":`Leave it`,"proxy.retryButton.now":`Retry now`,"proxy.routeDialog.titleEdit":`Edit route`,"proxy.routeDialog.titleAdd":`Add route`,"proxy.routeDialog.description":`A hostname, what it forwards to, and how it is served over TLS.`,"proxy.routeDialog.hostname":`Hostname`,"proxy.routeDialog.hostnamePlaceholder":`gitea.example.com`,"proxy.routeDialog.path":`Path prefix`,"proxy.routeDialog.pathPlaceholder":`/optional`,"proxy.routeDialog.pathHint":`Empty serves the whole host.`,"proxy.routeDialog.target":`Target`,"proxy.routeDialog.tls":`TLS`,"proxy.routeDialog.dnsAccount":`DNS account`,"proxy.routeDialog.localNote":`A local-only name is signed by the engine's own CA, so no DNS account is involved.`,"proxy.routeDialog.workspace":`Workspace`,"proxy.routeDialog.server":`Server`,"proxy.routeDialog.noServers":`this workspace has no servers`,"proxy.routeDialog.stoppedNote":`A server that is stopped is not routed: the row shows “No upstream” until it runs again.`,"proxy.routeDialog.upstream":`Upstream`,"proxy.routeDialog.upstreamPlaceholder":`http://10.0.0.5:8080`,"proxy.routeDialog.upstreamHint":`A literal address, including the port. A scheme is optional.`,"proxy.routeDialog.panelNote":`Serving the control panel needs authentication on and a password that is not the default — the panel refuses the save otherwise.`,"proxy.routeDialog.save":`Save route`,"proxy.routes.title":`Routes`,"proxy.routes.description":`One public hostname per service. A route may point at a supervised server in any workspace, at this panel, or at a literal upstream.`,"proxy.routes.add":`Add route`,"proxy.routes.cannotSaveTitle":`These routes cannot be saved as they stand`,"proxy.routes.cannotRoute":`{host} cannot be routed`,"proxy.routes.emptyTitle":`No routes yet`,"proxy.routes.emptyDescription":`Add one to expose a server through a domain — the engine gets the certificate on its own.`,"proxy.routes.addFirst":`Add the first route`,"proxy.routes.columnHostname":`Hostname`,"proxy.routes.columnTarget":`Target`,"proxy.routes.columnUpstream":`Upstream`,"proxy.routes.columnTls":`TLS`,"proxy.routes.columnState":`State`,"proxy.routes.columnOn":`On`,"proxy.routes.openInTab":`Open {url} in a new tab`,"proxy.routes.noHostname":`no hostname yet`,"proxy.routes.toggle":`Route {name}`,"proxy.routes.edit":`Edit {name}`,"proxy.routes.remove":`Remove {name}`,"proxy.status.certified":`certificate ready`,"proxy.status.localCa":`engine CA`,"proxy.status.uploaded":`uploaded pair`,"proxy.status.awaitingCa":`waiting for the CA`,"proxy.status.failed":`certificate failed`,"proxy.status.fellBack":`Fell back to Local CA`,"proxy.status.serving":`Serving`,"proxy.status.disabled":`Disabled`,"proxy.status.noUpstream":`No upstream`,"proxy.status.error":`Error`,"proxy.status.unapplied":`Not applied yet`,"proxy.status.off":`Off`,"proxy.status.stopped":`Stopped`,"proxy.status.starting":`Starting`,"proxy.status.running":`Running`,"proxy.status.unsupported":`Unsupported`,"proxy.target.server":`A supervised server`,"proxy.target.panel":`This control panel`,"proxy.target.external":`A literal upstream`,"proxy.target.controlPanel":`control panel`,"proxy.target.noServer":`no server picked`,"proxy.target.noUpstream":`no upstream`,"proxy.tls.auto":`Automatic — the engine decides`,"proxy.tls.off":`Off — plain HTTP`,"proxy.tls.manual":`Uploaded certificate`,"proxy.tls.plain":`plain HTTP`,"proxy.tls.uploaded":`uploaded certificate`,"proxy.tls.letsEncrypt":`Let’s Encrypt`,"proxy.tls.engineCa":`engine CA (local)`,"proxy.tls.hintOff":`Plain HTTP: no certificate is served for this hostname.`,"proxy.tls.hintManual":`Serves the certificate pair uploaded below.`,"proxy.tls.hintEmpty":`A public hostname gets an ACME certificate; a local-only name gets the engine’s own CA.`,"proxy.tls.hintPublic":`A public hostname, so the engine asks a CA for a certificate — an ACME account e-mail is needed.`,"proxy.tls.hintLocal":`A local-only name, so the engine signs it with its own locally-trusted CA.`,"proxy.validation.labelRequired":`a label is required`,"proxy.validation.idPattern":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.validation.hostRequired":`a hostname is required`,"proxy.validation.hostPattern":`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,"proxy.validation.hostTaken":`"{host}" is already routed for this path`,"proxy.validation.pathSlash":`a path prefix starts with /`,"proxy.validation.pathSpace":`a path prefix cannot contain a space`,"proxy.validation.idTaken":`route id "{id}" is used twice`,"proxy.validation.workspaceRequired":`pick the workspace that owns the server`,"proxy.validation.serverRequired":`pick a server in that workspace`,"proxy.validation.url":`an upstream like http://10.0.0.5:8080`,"proxy.view.title":`Reverse Proxy`,"proxy.view.description":`Expose your servers through domains, with automatic HTTPS via 80/443 or a DNS challenge.`,"proxy.view.dnsNote":`For DNS-01, add the domain's DNS provider to any workspace under Workspace Settings → Dynamic DNS; a route can then pick that account, from any workspace.`,"proxy.view.readFailed":`The reverse proxy could not be read`,"proxy.view.reading":`Reading the reverse proxy…`,"proxy.view.engineInstalled":`Engine installed`,"proxy.view.engineStarting":`Engine starting`,"proxy.view.engineStopping":`Engine stopping`,"proxy.view.configApplied":`Configuration applied`,"proxy.view.configReverted":`Configuration reverted`,"proxy.view.settingsSaved":`Settings saved.`,"proxy.view.settingsSavedToast":`Settings saved`,"proxy.view.retryFailed":`the retry failed`,"proxy.view.retryAsked":`asking the CA again for {host}`,"proxy.view.fieldChanged":`field changed`,"proxy.view.fieldsChanged":`fields changed`,"proxy.view.noChanges":`No unsaved changes`,"proxy.view.discard":`Discard changes`,"proxy.view.save":`Save settings`,"proxy.view.concurrentEdit":`Someone else changed {ids} while you had this page open. Reload to see their version, then reapply your edit.`,"serverCard.open":`Open {url}`,"serverCard.adoptedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"serverCard.detached":`detached`,"serverCard.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only an explicit stop does.","serverCard.persistent":`persistent`,"serverCard.disabled":`disabled`,"serverCard.autostart":`autostart`,"serverCard.healthProbe":`Health probe`,"serverCard.notProbed":`not probed`,"serverCard.restarts":`Restarts`,"serverCard.pid":`PID`,"serverCard.rss":`RSS`,"serverCard.procs":`Procs`,"serverCard.portFree":`free`,"serverCard.portInUse":`in-use`,"serverCard.uptime24h":`24h up`,"serverCard.probe":`Probe`,"serverCard.crashes24h":`24h crashes`,"serverCard.lastCrash":`Last crash`,"serverCard.unhealthyFor":`Unhealthy for {duration}`,"serverCard.nextAttempt":`Next attempt {when}`,"serverCard.start":`Start`,"serverCard.stop":`Stop`,"serverCard.restart":`Restart`,"serverCard.detailsHint":`Live logs and full telemetry`,"serverCard.moreActions":`More actions for {label}`,"serverCard.disable":`Disable server`,"serverCard.enable":`Enable server`,"serverCard.removeFromAutostart":`Remove from autostart`,"serverCard.autostartWithPanel":`Autostart with the panel`,"serverCard.clearLogBuffer":`Clear log buffer`,"serverCard.removeServer":`Remove server`,"serverCard.removeTitle":`Remove this server?`,"serverCard.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"serverCard.statusField":`status`,"serverCard.idField":`id`,"serverForm.workingDirectory":`Working directory`,"serverForm.cwdHint":`Relative paths resolve under projectDir.`,"serverForm.arguments":`Arguments`,"serverForm.portHint":`Blank means the server has no port to probe or preflight.`,"serverForm.bindAddress":`Bind address`,"serverForm.autostart":`Autostart with up`,"serverForm.autostartHint":`Start it whenever the control plane comes up.`,"serverForm.persistent":`Persistent`,"serverForm.persistentHint":"Keeps running when the panel stops; `down` reports it instead of stopping it.","serverForm.envHint":`KEY=value per line, exported to the process. Placeholders like {port} work here too.`,"serverForm.dataEnvs":`Data envs`,"serverForm.dataEnvsHint":`ENV=path per line — exported to the process and backed up automatically.`,"serverForm.envFile":`Env file`,"serverForm.envFilePlaceholder":`optional KEY=value file`,"serverForm.envFileHint":`Loaded at spawn; its values override env.`,"serverForm.dependsOn":`Depends on`,"serverForm.dependsOnHint":`Comma separated; started first and waited for until healthy, stopped last.`,"serverForm.backupPaths":`Extra backup paths`,"serverForm.backupPathsHint":`One per line, placeholders allowed; data envs are captured already.`,"serverForm.backupIgnore":`Ignore known generated files when backing this up`,"serverForm.backupIgnoreHint":`Skips node_modules, dist, .next and the other caches nothing restores from.`,"serverForm.bootstrap":`Bootstrap`,"serverForm.bootstrapDescription":`A one-off command run before the first start — installs, migrations, downloads.`,"serverForm.runBootstrap":`Run a bootstrap`,"serverForm.bootstrapHint":`Off means the entry has none and the key is sent as null.`,"serverForm.timeoutMs":`Timeout (ms)`,"serverForm.runOnce":`Only once per session`,"serverForm.runOnceHint":`Off means every start re-runs it.`,"serverForm.bootstrapArgs":`Bootstrap arguments`,"serverForm.bootstrapArgsHint":`One per line; same placeholders as the main arguments.`,"serverForm.bootstrapEnv":`Bootstrap environment`,"serverForm.bootstrapEnvHint":`KEY=value per line, exported to the bootstrap process only.`,"serverForm.onPortConflict":`On port conflict`,"serverForm.logBufferLines":`Log buffer lines`,"serverForm.maxRssMb":`Max RSS (MB)`,"serverForm.maxRssHint":`Restart above this; blank or 0 disables it.`,"serverForm.enabledHint":`Off keeps the entry in the config but refuses to start it.`,"serverForm.backupHooks":`Backups: dump and load`,"serverForm.backupHooksDescription":`For a database engine: take its own consistent dump before a backup, and load it back after a restore. {dumpDir} is the directory both commands see.`,"serverForm.dumpEnabled":`Dump before backup`,"serverForm.dumpEnabledHint":`A failed dump refuses the backup, so an archive is never half-done.`,"serverForm.dumpCommand":`Dump command`,"serverForm.dumpArgs":`Dump arguments`,"serverForm.dumpArgsHint":"One per line. `--archive={dumpDir}/db.archive` writes into the directory the archive carries.","serverForm.loadEnabled":`Load after restore`,"serverForm.loadEnabledHint":`Runs on the entry’s next start, once it is answering: mongorestore needs a live server.`,"serverForm.loadCommand":`Load command`,"serverForm.loadArgs":`Load arguments`,"serverForm.loadArgsHint":"One per line, same `{dumpDir}` the dump wrote to.","serverForm.hookEnv":`Environment`,"settings.auth.policyTitle":`Access policy`,"settings.auth.policyDescription":`Authentication applies whether the panel is on loopback or exposed to the network.`,"settings.auth.requirePassword":`Require a password`,"settings.auth.requirePasswordHint":`Every request needs a signed-in session.`,"settings.auth.sessionLifetime":`Session lifetime (s)`,"settings.auth.sessionLifetimeHint":`Idle timeout in seconds: 604800 is one week of no activity. Each request restarts it.`,"settings.auth.cookieSecure":`Cookie Secure`,"settings.auth.cookieSecureAuto":`Auto — only over HTTPS`,"settings.auth.cookieSecureAlways":`Always`,"settings.auth.cookieSecureNever":`Never — plain HTTP`,"settings.auth.trustProxy":`Behind a reverse proxy`,"settings.auth.trustProxyOff":`No — ignore x-forwarded-*`,"settings.auth.trustProxyLoopback":`Yes, from this machine only`,"settings.auth.trustProxyAny":`Yes, from any caller`,"settings.auth.trustProxyHint":`Trust x-forwarded-* for the client address and protocol. 'From this machine only' is the safe choice for a proxy on the same host. 'From any caller' believes the caller's own header, so login lockout counts per forged address and can be bypassed.`,"settings.auth.maxLoginAttempts":`Max login attempts`,"settings.auth.maxLoginAttemptsHint":`Failures before a temporary lockout.`,"settings.auth.lockout":`Lockout (s)`,"settings.auth.apiTokenSet":`An API token is set`,"settings.auth.apiTokenMissing":`No API token`,"settings.auth.apiTokenNote":`Scripts can call the API with {code} instead of signing in.`,"settings.auth.apiTokenRotation":`Changing the password does not revoke this token — run {command} and store the new one if it may have leaked.`,"settings.auth.noTokenNote":`For shell scripts and agents, generate one with {command}.`,"settings.auth.defaultPasswordTitle":`The default password is still in use`,"settings.auth.defaultPasswordText":`Set your own password below. Binding beyond {address} stays refused until you do.`,"settings.auth.blockedTitle":`This listener is being refused`,"settings.auth.noPasswordTitle":`Authentication is on but no password is set`,"settings.auth.noPasswordText":`Nothing is actually required yet, and binding beyond {address} stays refused until a password exists.`,"settings.auth.exposedTitle":`Reachable beyond 127.0.0.1`,"settings.auth.exposedText":`Keep the password strong, or put a TLS-terminating proxy in front of the panel.`,"settings.auth.changePassword":`Change password`,"settings.auth.setPassword":`Set a password`,"settings.auth.passwordDescription":`Stored as a scrypt hash in the secrets file, never in the config.`,"settings.auth.currentPassword":`Current password`,"settings.auth.newPassword":`New password`,"settings.auth.repeatPassword":`Repeat new password`,"settings.auth.passwordMismatch":`The two passwords do not match.`,"settings.auth.updatePassword":`Update password`,"settings.auth.setPasswordAndEnable":`Set password and enable auth`,"settings.auth.clearPassword":`Clear password`,"settings.auth.clearPasswordConfirm":`Confirm clear`,"settings.auth.clearPasswordTitle":`Clear the password?`,"settings.auth.clearPasswordHint":`Authentication is switched off with it, and anyone reaching the panel is let straight in.`,"settings.auth.shortPasswordTitle":`That is a short password`,"settings.auth.shortPasswordText":`It is allowed, but longer is the only thing standing between the network and this panel.`,"settings.auth.passwordUpdated":`Password updated. Other sessions were signed out.`,"settings.auth.passwordCleared":`Password cleared and authentication disabled.`,"settings.backup.createTitle":`Create a backup`,"settings.backup.createDescription":`Pick what this archive captures. Nothing is written until you create it.`,"settings.backup.chooseItems":`Choose items`,"settings.backup.partialCapture":`Only the chosen items are captured.`,"settings.backup.withoutGlobalSettings":`Without the global settings, a restore can only place a workspace where the target panel already declares it.`,"settings.backup.password":`Password (optional)`,"settings.backup.passwordHint":`Encrypts the archive; restoring it asks for the same password.`,"settings.backup.create":`Create backup`,"settings.backup.chooseItemsFor":`{label} — choose items`,"settings.backup.subDescription":`A workspace can be captured whole or only its settings, servers, secrets and declared data paths.`,"settings.backup.selectedOf":`{selected} of {total} selected`,"settings.backup.nothingSelectable":`This workspace declares nothing selectable yet.`,"settings.backup.apply":`Apply`,"settings.backup.created":`Backup created.`,"settings.backup.leafSettingsHint":`Server defaults, log retention and notifications`,"settings.backup.leafServersHint":`Every entry in servers.config.json`,"settings.backup.leafSecretsHint":`Telegram bot token and DDNS credentials`,"settings.backup.leafDataHint":`A declared data path`,"settings.backup.pathFromOrigin":`{path} — from {origin}`,"settings.backup.entrySettingsHint":`Listener, auth, host vitals and the backups policy`,"settings.backup.entrySecretsHint":`Password hash and API token hash`,"settings.backup.entryTlsHint":`The panel's own certificate pair`,"settings.backup.entryWorkspaceHint":`Its settings, servers, secrets and declared data paths`,"settings.backup.entryGlobalSettings":`Global settings`,"settings.backup.entryGlobalSecrets":`Global secrets (password, API token)`,"settings.backup.entryTlsCertificate":`TLS certificate`,"settings.backup.leafSettings":`Settings`,"settings.backup.leafServers":`Servers`,"settings.backup.leafSecrets":`Secrets`,"settings.backup.secretPassword":`Password`,"settings.backup.secretPasswordHint":`The panel's own password hash; restoring it reinstates the old password`,"settings.backup.secretApiToken":`API token`,"settings.backup.secretApiTokenHint":`The long-lived token scripts and agents use`,"settings.backup.secretTelegram":`Telegram bot token`,"settings.backup.secretTelegramHint":`Used for notifications`,"settings.backup.secretDdns":`DDNS credentials`,"settings.backup.secretDdnsHint":`Provider credentials, kept sealed with their key`,"settings.backup.restoreItemLabel":`{workspace}: {item}`,"settings.backup.noteMissing":`not set`,"settings.backup.noteCovered":`covered by {path}`,"settings.backup.noteAlreadyDeclared":`already declared by {origin}`,"settings.backup.noteContainsBackupDir":`contains the backup directory`,"settings.backup.noteMissingFromArchive":`missing from the archive`,"settings.backup.noteDeclaredByBackup":`declared by the backup's config, which is not being restored`,"settings.backup.noteNotDeclared":`not declared by this config, nor by the backup`,"settings.backup.noteRestoredFrom":`restored from {path}`,"settings.backups.policyTitle":`Policy`,"settings.backups.policyDescription":`How many archives the panel keeps, and the extra paths every one of them captures.`,"settings.backups.allow":`Allow backups`,"settings.backups.allowHint":`Off stops new archives; whatever is already on disk stays downloadable and restorable.`,"settings.backups.offTitle":`Backups are off`,"settings.backups.offText":`Nothing new is archived until this is back on. The archives below can still be downloaded, restored and deleted.`,"settings.backups.keep":`Keep`,"settings.backups.keepHint":`Older archives are pruned after each backup.`,"settings.backups.schedule":`Automatic backups`,"settings.backups.scheduleHint":`The panel writes one archive on its own, on this interval.`,"settings.backups.scheduleHours":`Every (hours)`,"settings.backups.scheduleHoursHint":`24 is a daily archive.`,"settings.backups.scheduleKeep":`Keep automatic`,"settings.backups.scheduleKeepHint":`Manual archives are counted separately, by Keep.`,"settings.backups.scheduleLast":`Last automatic: {when}`,"settings.backups.scheduleFailed":`Last attempt failed at {when}: {message}`,"settings.backups.extraPaths":`Extra paths`,"settings.backups.extraPathsHint":`Comma separated, captured in every archive on top of what each workspace declares.`,"settings.backups.extraPathsPlaceholder":`{home}/myapp-data`,"settings.backups.archiveDirectory":`Archive directory`,"settings.backups.copyArchiveDirectory":`Copy the archive directory`,"settings.backups.changeDirectory":`Changing it is a file-level decision: edit {path}.`,"settings.backups.theSettingsFile":`the settings file`,"settings.backups.capturesTitle":`What a backup captures`,"settings.backups.capturesDescription":`Pick these in the create dialog. A workspace can be taken whole or only its settings, servers, secrets and declared data paths.`,"settings.backups.nothingSelectable":`Nothing is selectable yet.`,"settings.backups.fromOrigin":`from {origin}`,"settings.backups.notCaptured":`not captured`,"settings.backups.generatedSkipped":`generated directories skipped`,"settings.backups.included":`included`,"settings.backups.skipped":`skipped`,"settings.backups.workspacesNote":`This panel serves {count} workspaces; each is its own selectable entry.`,"settings.backups.archivesTitle":`Archives`,"settings.backups.archivesDescription":`Stored in the backup directory and downloadable at any time.`,"settings.backups.create":`Create backup…`,"settings.backups.restore":`Restore…`,"settings.backups.noArchives":`No archives yet`,"settings.backups.noArchivesEnabled":`Create one now to capture the panel and whichever workspaces you pick.`,"settings.backups.noArchivesDisabled":`Nothing has been archived yet, and backups are off.`,"settings.backups.encrypted":`encrypted`,"settings.backups.download":`Download`,"settings.backups.restoreAction":`Restore`,"settings.backups.confirmDelete":`Confirm delete`,"settings.backups.deleted":`Deleted {name}.`,"settings.backups.kindSettings":`settings`,"settings.backups.kindServers":`servers`,"settings.backups.kindSecrets":`secrets`,"settings.backups.kindTls":`tls`,"settings.backups.kindData":`data`,"settings.backups.kindWorkspace":`workspace`,"settings.backups.scopeTitle":`What an automatic backup contains`,"settings.backups.scopeHint":`Left as it is, an automatic archive takes the whole default scope — every workspace and the extra paths. A choice here is written down as ids, so a workspace declared later is only covered when nothing was narrowed.`,"settings.backups.scopeChoose":`Choose…`,"settings.backups.scopeDialogTitle":`What an automatic backup contains`,"settings.backups.scopeDialogDescription":`Every automatic archive will capture this, unattended.`,"settings.backups.scopeMode":`Mode`,"settings.backups.scopeOnly":`Only these`,"settings.backups.scopeExcept":`Everything except`,"settings.backups.scopeOnlyHint":`The archive carries only what is ticked.`,"settings.backups.scopeExceptHint":`The archive carries everything except what is ticked.`,"settings.backups.scopeNothing":`Nothing is ticked — an archive of nothing is refused, so tick at least one item.`,"settings.backups.scopeSummaryAll":`Everything (the default scope)`,"settings.backups.scopeSummaryOnly":`Only {count} selected`,"settings.backups.scopeSummaryExcept":`Everything except {count}`,"settings.ddns.statePending":`Waiting`,"settings.ddns.stateOk":`Updated`,"settings.ddns.stateUnchanged":`Current`,"settings.ddns.stateSkipped":`Skipped`,"settings.ddns.stateError":`Failed`,"settings.ddns.passFinished":`Dynamic DNS pass finished`,"settings.ddns.credentialsSaved":`Credentials saved for {account}`,"settings.ddns.credentialsRemoved":`Credentials removed for {account}`,"settings.ddns.loadErrorTitle":`Dynamic DNS settings could not be loaded`,"settings.ddns.title":`Dynamic DNS`,"settings.ddns.description":`Keep these hostnames pointed at this machine's public address. Credentials live in the secrets file, never in servers.config.json.`,"settings.ddns.checking":`checking`,"settings.ddns.needsAttention":`needs attention`,"settings.ddns.watching":`watching`,"settings.ddns.updateNow":`Update now`,"settings.ddns.enabled":`Keep dynamic DNS updated`,"settings.ddns.enabledHint":`A pass runs on the interval below; a provider is only called when the address actually changed.`,"settings.ddns.interval":`Check every (s)`,"settings.ddns.intervalHint":`60 is one minute; the default is five.`,"settings.ddns.ttl":`TTL (s)`,"settings.ddns.ttlHint":`1 means automatic where the provider supports it.`,"settings.ddns.detectIpv4":`Detect IPv4`,"settings.ddns.detectIpv4Hint":`Needed for A records.`,"settings.ddns.detectIpv6":`Detect IPv6`,"settings.ddns.detectIpv6Hint":`Needed for AAAA records.`,"settings.ddns.accountsTitle":`Provider accounts`,"settings.ddns.accountsDescription":`One entry per API token. Credentials are stored on the server and never come back.`,"settings.ddns.credentialsSet":`credentials saved`,"settings.ddns.noCredentials":`no credentials`,"settings.ddns.credentials":`Credentials`,"settings.ddns.removeAccountBlocked":`Remove the hostnames using this account first`,"settings.ddns.noAccounts":`No accounts yet. Pick a provider and add one.`,"settings.ddns.provider":`Provider`,"settings.ddns.accountId":`Account id`,"settings.ddns.accountIdPlaceholder":`cloudflare-home`,"settings.ddns.accountIdHint":"The account id names the account and keys its stored credentials; lowercase letters, digits, `-` and `_`.","settings.ddns.hostnamesTitle":`Hostnames`,"settings.ddns.hostnamesDescription":`The whole list to keep updated — suba.domain.com, domain.xyz and so on.`,"settings.ddns.account":`Account`,"settings.ddns.recordA":`A (IPv4)`,"settings.ddns.recordAaaa":`AAAA (IPv6)`,"settings.ddns.aaaaUnsupported":`This provider cannot manage AAAA records.`,"settings.ddns.proxied":`Proxied`,"settings.ddns.proxiedHint":`Cloudflare serves this record through its own network.`,"settings.ddns.ipv6Off":`IPv6 detection is off`,"settings.ddns.advanced":`Advanced`,"settings.ddns.advancedHint":`registered domain and TTL override`,"settings.ddns.registeredDomain":`Registered domain`,"settings.ddns.registeredDomainPlaceholder":`example.co.uk`,"settings.ddns.registeredDomainHint":`Only when the provider has to be told the apex, e.g. three-label domains.`,"settings.ddns.ttlOverride":`TTL override (s)`,"settings.ddns.ttlOverrideHint":`Blank uses the value above.`,"settings.ddns.noHostnames":`No hostnames yet.`,"settings.ddns.hostnamePlaceholder":`home.example.com`,"settings.ddns.lastPass":`Last pass`,"settings.ddns.ipv4Value":`IPv4 {address}`,"settings.ddns.ipv6Value":`IPv6 {address}`,"settings.ddns.type":`Type`,"settings.ddns.state":`State`,"settings.ddns.address":`Address`,"settings.ddns.detail":`Detail`,"settings.ddns.credentialsTitle":`Provider credentials`,"settings.ddns.credentialsDescription":`Saved fields are never sent back. Saving replaces every field for this account and runs a pass right away.`,"settings.ddns.optional":`Optional.`,"settings.ddns.whereToGet":`Where to get these`,"settings.ddns.forget":`Forget`,"settings.ddns.forgetConfirm":`Forget them`,"settings.ddns.forgetTitle":`Forget the stored credentials?`,"settings.ddns.forgetHint":`They are removed from disk and cannot be read back; you would need to paste them again.`,"settings.ddns.saveCredentials":`Save credentials`,"settings.defaults.title":`Server defaults`,"settings.defaults.description":`Applied to every entry that does not set its own value.`,"settings.defaults.enabledHint":`New entries start enabled.`,"settings.defaults.autostart":`Autostart with the panel`,"settings.defaults.bind":`Bind`,"settings.defaults.bindLocal":`Local — 127.0.0.1`,"settings.defaults.bindLan":`LAN — 0.0.0.0`,"settings.defaults.onPortConflict":`On port conflict`,"settings.defaults.conflictBlock":`Block the start`,"settings.defaults.conflictWarn":`Warn and start anyway`,"settings.defaults.conflictFollow":`Follow a detached restart of itself`,"settings.defaults.conflictReclaim":`Replace a detached restart with a supervised copy`,"settings.defaults.conflictKill":`Kill whatever holds the port`,"settings.defaults.logBufferLines":`Log buffer lines`,"settings.defaults.logBufferLinesHint":`Kept in memory per server.`,"settings.destination.title":`Destinations`,"settings.destination.generalTitle":`General`,"settings.destination.generalDescription":`What every destination follows unless it sets its own.`,"settings.destination.description":`Where events go. Each one may follow the general settings above, or carry its own.`,"settings.destination.addTelegram":`Add Telegram`,"settings.destination.addWebhook":`Add webhook`,"settings.destination.empty":`No destination yet. Add a Telegram chat or a webhook to start receiving alerts.`,"settings.destination.chatId":`Chat id`,"settings.destination.chatIdHint":`Use Detect chats to fill this from the bot's updates.`,"settings.destination.botToken":`Bot token`,"settings.destination.saveToken":`Save token`,"settings.destination.tokenSet":`token set`,"settings.destination.noToken":`no token`,"settings.destination.detectChats":`Detect chats`,"settings.destination.sendTest":`Send a test`,"settings.destination.remove":`Remove`,"settings.destination.removeQuestion":`Remove {name}?`,"settings.destination.removeBody":`Its events stop being sent, and any stored bot token for it is removed.`,"settings.destination.ownSettings":`Own settings`,"settings.destination.ownSettingsHint":`Off follows the general settings above.`,"settings.destination.lastSend":`Last send: {result} {when}`,"settings.destination.testSent":`Test sent.`,"settings.host.title":`Thresholds`,"settings.host.description":`A threshold of 0 disables that alert. Breaches notify once, and once more on recovery.`,"settings.host.enabled":`Sample this machine`,"settings.host.enabledHint":`Load, memory, swap, disk and CPU temperature, on the interval below.`,"settings.host.interval":`Interval (s)`,"settings.host.intervalHint":`How often the host is sampled and alerts are checked.`,"settings.host.diskPaths":`Disk paths`,"settings.host.diskPathsHint":`Comma separated; templates like {home} are expanded.`,"settings.host.diskUsed":`Disk used (%)`,"settings.host.memoryUsed":`Memory used (%)`,"settings.host.swapUsed":`Swap used (%)`,"settings.host.zeroDisables":`0 disables the alert.`,"settings.host.loadPerCpu":`Load per CPU`,"settings.host.loadPerCpuHint":`1-minute load average divided by the core count — a count, not a percentage: 1 means one core’s worth of waiting work. CPU usage is shown separately.`,"settings.host.tempCelsius":`CPU temperature (°C)`,"settings.host.tempCelsiusHint":`Above this is alerted; the tile reads n/a where the OS exposes no sensor.`,"settings.host.tempCommand":`Temperature command`,"settings.host.tempCommandHint":`Prints one number in °C. For a machine with no readable sensor — a WSL2 guest above all. Empty uses the built-in probe; docs/SERVERS.md has the WSL2 setup.`,"settings.host.tempCommandPlaceholder":`e.g. cat /sys/class/hwmon/hwmon0/temp1_input`,"settings.host.tempCommandTimeout":`Command timeout (ms)`,"settings.host.tempCommandTimeoutHint":`Killed after this long, so a hung helper cannot stall a sample.`,"settings.host.breachingNow":`Breaching now:`,"settings.host.nothingBreaching":`Nothing is breaching right now.`,"settings.host.wslTitle":`WSL2 temperature`,"settings.host.wslDescription":`A WSL2 guest exposes no CPU sensor. This reads the temperature through the Windows host instead — one button, and you can remove it again.`,"settings.host.wslSetup":`Set it up`,"settings.host.wslRemove":`Stop using it`,"settings.host.wslReading":`Reading {celsius}°C`,"settings.host.wslFailed":`It did not answer: {reason}`,"settings.host.wslNeedsLibrary":`LibreHardwareMonitor is not installed on Windows. Put it in C:\\\\Tools\\\\LibreHardwareMonitor, then set it up again.`,"settings.interface.title":`Interface`,"settings.interface.description":`The panel is a static site: keep the stock one, or serve your own build from the state directory.`,"settings.interface.currentlyServing":`Currently serving`,"settings.interface.copyDirectory":`Copy the UI directory`,"settings.interface.fileCount":`{count} files`,"settings.interface.sourceStock":`stock`,"settings.interface.sourceCustom":`custom`,"settings.interface.unnamed":`unnamed`,"settings.interface.panelVersion":`Panel version`,"settings.interface.copyPanelVersion":`Copy the panel version`,"settings.interface.panelVersionHint":`The release this panel process is running — {command} prints the same number.`,"settings.interface.panelName":`Panel name`,"settings.interface.panelNameHint":`Shown in the sidebar by the stock UI. A custom UI may show its own name instead.`,"settings.interface.uploadLabel":`Upload a UI build (.zip with an index.html)`,"settings.interface.docsHint":`See {docs} for the API contract. If a custom UI breaks the panel, {command} puts the stock one back from the terminal.`,"settings.interface.resetName":`Reset name`,"settings.interface.confirmRevert":`Confirm revert`,"settings.interface.revertToStock":`Revert to stock`,"settings.interface.install":`Install UI`,"settings.interface.installed":`UI replaced with {name} — refresh the page`,"settings.interface.yourBuild":`your build`,"settings.interface.restored":`stock UI restored — refresh the page`,"settings.interface.nothingInstalled":`no custom UI was installed`,"settings.listener.title":`Listener`,"settings.listener.description":`Where the panel answers. Moving this restarts the panel and sends this page to the new address.`,"settings.listener.port":`Control port`,"settings.listener.portHint":`Default 3999.`,"settings.listener.bind":`Bind`,"settings.listener.bindLocal":`Local`,"settings.listener.bindLan":`LAN`,"settings.listener.bindCustom":`Custom`,"settings.listener.bindLanHint":`0.0.0.0 — reachable from the whole network.`,"settings.listener.bindLocalHint":`127.0.0.1 — this machine only.`,"settings.listener.bindCustomHint":`A specific interface address you type in below.`,"settings.listener.ipv4":`IPv4 address`,"settings.listener.ipv4Placeholder":`192.168.1.20`,"settings.listener.ipv4Error":`Enter an IPv4 address, for example 192.168.1.20.`,"settings.listener.ipv4Hint":`Binding beyond 127.0.0.1 needs a real password.`,"settings.listener.openBrowser":`Open a browser when the panel comes up`,"settings.listener.liveAddress":`Live address`,"settings.listener.restartRequired":`restart required`,"settings.listener.copyLiveAddress":`Copy the live address`,"settings.listener.liveAddressHint":`What the listener is bound to right now; saved changes take effect after the panel rebinds.`,"settings.logs.title":`Retention`,"settings.logs.description":`The live view always comes from memory; these files survive a restart and feed the Logs page.`,"settings.logs.persist":`Keep logs on disk`,"settings.logs.persistHint":`Turn off to hold everything in memory only.`,"settings.logs.maxBytes":`Rotate at (bytes)`,"settings.logs.maxBytesHint":`Per server, before rolling to .1, .2, …`,"settings.logs.keep":`Keep rotated files`,"settings.logs.directory":`Logs directory`,"settings.logs.copyDirectory":`Copy the logs directory`,"settings.logs.browseHint":`Browse and download these files on the {logs} page.`,"settings.paths.dataRoot":`Data root`,"settings.paths.dataRootHint":`HHOSTED_HOME — global settings, workspaces, TLS, backups and the UI.`,"settings.paths.globalSettings":`Global settings`,"settings.paths.globalSettingsHint":`settings.json — listener, auth, TLS policy, host vitals, backups.`,"settings.paths.projectDir":`Project directory`,"settings.paths.projectDirHint":`Base for relative entry paths.`,"settings.paths.panelAddress":`Panel address`,"settings.paths.panelAddressHint":`Where this control panel is live right now.`,"settings.paths.serversConfig":`Servers config`,"settings.paths.serversConfigHint":`{label}'s servers.config.json.`,"settings.paths.workspaceSettings":`Workspace settings`,"settings.paths.workspaceSettingsHint":`Server defaults, log retention, notifications, DDNS.`,"settings.paths.logs":`Logs`,"settings.paths.logsHint":`Persisted output for this workspace.`,"settings.paths.copyPath":`Copy {label}`,"settings.paths.whereThingsLive":`Where things live`,"settings.paths.whereThingsLiveDescription":`Read-only. Copy a path straight into a shell or an editor.`,"settings.paths.workspaceFiles":`Workspace files`,"settings.paths.workspaceFilesDescription":`Each workspace owns its config, settings and log directory; nothing is shared between them.`,"settings.rebind.failed":`The control panel did not answer on {target}. Check the console for the new listener.`,"settings.restore.title":`Restore a backup`,"settings.restore.description":`Nothing is written until the plan is applied.`,"settings.restore.archive":`Archive`,"settings.restore.archiveHint":`A stored archive, or a .zip from this machine.`,"settings.restore.encryptedName":`{name} — encrypted`,"settings.restore.uploadOption":`Upload a file…`,"settings.restore.archiveFile":`Archive file (.zip)`,"settings.restore.unchangedTitle":`Nothing has changed yet`,"settings.restore.archiveLine":`Archive {name}.`,"settings.restore.uploadedArchive":`The uploaded archive.`,"settings.restore.passwordProtected":`This backup is password-protected.`,"settings.restore.password":`Password`,"settings.restore.checkAgain":`Check again with the password`,"settings.restore.choosePrompt":`Choose what to restore — {selected} of {total} selected.`,"settings.restore.willRestore":`Will restore: {items}.`,"settings.restore.skipped":`Skipped: {items}.`,"settings.restore.nothing":`nothing`,"settings.restore.restartNote":`The panel's own settings differ, so restart the panel afterwards.`,"settings.restore.reloadedNote":`Restored workspaces are reloaded immediately; entries marked autostart start on their own.`,"settings.restore.applyStored":`Apply this restore`,"settings.restore.applyUpload":`Restore the upload`,"settings.restore.restored":`Restored {count} item(s).`,"settings.restore.restoredWithNotes":`Restored {count} item(s) — {notes}.`,"settings.restore.noteReloaded":`the restored servers are live, autostart entries starting`,"settings.restore.noteRestart":`restart the panel to apply its own settings`,"settings.restore.reasonSymbolicLink":`symbolic link, skipped`,"settings.restore.reasonNotSelected":`not selected`,"settings.restore.reasonUnrestorable":`cannot be restored here`,"settings.restore.reasonInvalidSettings":`the archive's settings are not valid`,"settings.restore.reasonInvalidServers":`the archive's servers are not valid`,"settings.restore.reasonInvalidWorkspace":`not a usable workspace id`,"settings.restore.createdWorkspaces":`Created workspaces: {items}.`,"settings.restore.replacedUnderRunning":`Data was replaced under a running server — stop and start {items} so it reads the restored files.`,"settings.shell.noUnsavedChanges":`No unsaved changes`,"settings.shell.discard":`Discard changes`,"settings.shell.save":`Save settings`,"settings.shell.unsavedTitle":`Unsaved changes`,"settings.shell.nothingToSave":`Nothing to save.`,"settings.telegram.title":`Telegram`,"settings.telegram.description":`Policy lives in the config; the bot token is a secret and never comes back from the server.`,"settings.telegram.enabled":`Send notifications`,"settings.telegram.enabledHint":`One message per event, throttled by the cooldown below.`,"settings.telegram.chatId":`Chat id`,"settings.telegram.chatIdPlaceholder":`123456789 or @channel`,"settings.telegram.chatIdHint":`Use Detect chats to fill this from the bot's updates.`,"settings.telegram.cooldown":`Cooldown per event (s)`,"settings.telegram.cooldownHint":`Per server and reason, so a flapping server cannot spam.`,"settings.telegram.onCrash":`Retries exhausted`,"settings.telegram.onUnhealthy":`Port unhealthy`,"settings.telegram.onForcedRestart":`Forced restart`,"settings.telegram.onRecovered":`Recovered`,"settings.telegram.onHost":`Host vitals breached`,"settings.telegram.onHostHint":`Disk, memory, swap, load and CPU temperature, per the thresholds under Host vitals.`,"settings.telegram.onDdns":`Dynamic DNS changed or failed`,"settings.telegram.onDdnsHint":`One message per pass that changed a record, and one for a pass that failed.`,"settings.telegram.botToken":`Bot token`,"settings.telegram.tokenSet":`token set`,"settings.telegram.noToken":`no token`,"settings.telegram.tokenNote":`From @BotFather — a secret, never in servers.config.json.`,"settings.telegram.tokenPlaceholder":`123456789:AA…`,"settings.telegram.tokenSavedPlaceholder":`Saved — type a new token to replace it`,"settings.telegram.saveToken":`Save token`,"settings.telegram.detectChats":`Detect chats`,"settings.telegram.sendTest":`Send test`,"settings.telegram.removeToken":`Remove token`,"settings.telegram.removeTokenConfirm":`Confirm remove`,"settings.telegram.removeTokenTitle":`Remove the bot token?`,"settings.telegram.removeTokenHint":`Notifications stop until you paste a token again.`,"settings.telegram.tokenSaved":`Token saved.`,"settings.telegram.tokenSavedFor":`Token saved for @{username}.`,"settings.telegram.tokenRemoved":`Token removed.`,"settings.telegram.noChats":`No chats found. Send /start to the bot first, then detect again.`,"settings.telegram.testSent":`Test message sent.`,"settings.telegram.testFailed":`The test message failed.`,"settings.telegram.chatsSeen":`Chats the bot has seen:`,"settings.telegram.lastSend":`Last send: {result}`,"settings.tls.title":`HTTPS`,"settings.tls.description":`Upload a PEM pair and the panel serves TLS on its own listener. A self-signed certificate is fine on a home network.`,"settings.tls.serve":`Serve the panel over HTTPS`,"settings.tls.serveHint":`Saved with Save settings; the panel rebinds and this page follows it.`,"settings.tls.certificateTitle":`Certificate`,"settings.tls.certificateDescription":`PEM-encoded certificate and its private key. Both stay in the secrets file.`,"settings.tls.unusableTitle":`The stored certificate cannot be used`,"settings.tls.subject":`Subject`,"settings.tls.issuer":`Issuer`,"settings.tls.validUntil":`Valid until`,"settings.tls.days":`{count} days`,"settings.tls.privateKey":`Private key`,"settings.tls.keyMatches":`matches the certificate`,"settings.tls.keyMismatch":`does not match`,"settings.tls.fingerprint":`Fingerprint`,"settings.tls.copyFingerprint":`Copy the fingerprint`,"settings.tls.noCertificateTitle":`No certificate uploaded`,"settings.tls.noCertificateText":`Upload a PEM certificate and key below, then save. HTTPS is not served until a certificate is present.`,"settings.tls.certFile":`Certificate file (.pem, .crt)`,"settings.tls.keyFile":`Private key file (.pem, .key)`,"settings.tls.pasteCertificate":`Or paste the certificate`,"settings.tls.pasteKey":`Or paste the private key`,"settings.tls.saveCertificate":`Save certificate`,"settings.tls.removeCertificate":`Remove certificate`,"settings.tls.confirmRemove":`Confirm remove`,"settings.tls.removeTitle":`Remove the certificate?`,"settings.tls.removeHint":`TLS stays on but has nothing to serve, so the panel falls back to http once the listener rebinds.`,"settings.tls.stored":`Certificate stored.`,"settings.tls.removed":`Certificate removed.`,"settings.webhook.title":`Webhooks`,"settings.webhook.description":`Send the same events anywhere that accepts an HTTP request.`,"settings.webhook.empty":`No webhook yet. Add one to POST events somewhere else.`,"settings.webhook.add":`Add a webhook`,"settings.webhook.newTarget":`hook`,"settings.webhook.url":`URL`,"settings.webhook.urlPlaceholder":`https://ntfy.sh/my-topic`,"settings.webhook.method":`Method`,"settings.webhook.format":`Body`,"settings.webhook.formatJson":`JSON`,"settings.webhook.formatText":`Plain text`,"settings.webhook.formatHint":`JSON for Discord, Slack or your own endpoint; plain text for ntfy.`,"settings.webhook.headers":`Headers`,"settings.webhook.headersHint":`One Name: value per line, sent with every request. ntfy reads Title and Priority here; a bearer token goes in Authorization.`,"settings.webhook.presets":`Presets`,"settings.webhook.presetNtfy":`ntfy`,"settings.webhook.presetDiscord":`Discord`,"settings.webhook.presetSlack":`Slack`,"settings.webhook.sendTest":`Send a test`,"settings.webhook.testSent":`Test sent.`,"settings.webhook.cooldown":`Cooldown (ms)`,"settings.webhook.cooldownHint":`Per server and reason, for this target alone. 0 disables it.`,"settings.webhook.lastSend":`Last send: {result} {when}`,"settings.webhook.removeQuestion":`Remove {name}?`,"settings.webhook.removeBody":`Its events stop being sent. The URL and headers are removed from this workspace's config.`,"status.stopped":`Stopped`,"status.starting":`Starting`,"status.running":`Running`,"status.stopping":`Stopping`,"status.backoff":`Restarting`,"status.crashed":`Crashed`,"status.conflict":`Port conflict`,"theme.label":`Theme: {theme}`,"theme.light":`light`,"theme.dark":`dark`,"theme.system":`system`,"toast.refreshFailed":`Refresh failed`,"toast.startFailed":`Could not start {id}`,"toast.stopFailed":`Could not stop {id}`,"toast.restartFailed":`Could not restart {id}`,"toast.startAllFailed":`Could not start every server`,"toast.startAllStarted":`Starting every enabled server`,"toast.stopOrphanFailed":`Could not stop the orphaned process “{id}”`,"toast.stopOrphanDone":`Orphaned process stopped`,"toast.stopAllFailed":`Could not stop every server`,"toast.stopAllStarted":`Stopping every server`,"toast.stopAllWithPersistent":`Stopping every server, persistent entries included`,"toast.autostartFailed":`Could not change autostart for {id}`,"toast.changeFailed":`Could not change {id}`,"toast.freePortFailed":`Could not free the port for {id}`,"toast.portFree":`Port {port} is free — start {id} now`,"toast.portHeld":`Port {port} is still held`,"toast.bindFailed":`Could not change the bind for {id}`,"toast.bindInvalid":`“{bind}” is not a bind value`,"toast.saveServerFailed":`Could not save {id}`,"toast.serverUpdated":`{id} updated`,"toast.saveSettingsFailed":`Could not save the settings`,"toast.clearLogsFailed":`Could not clear the logs for {id}`,"toast.logsCleared":`Buffer cleared`,"toast.addServerFailed":`Could not add the server`,"toast.serverAdded":`Server added`,"toast.removeServerFailed":`Could not remove {id}`,"toast.serverRemoved":`{id} removed`,"toast.readWorkspacesFailed":`Could not read the workspaces`,"toast.workspaceCreated":`Workspace “{workspace}” created`,"toast.workspaceCreateFailed":`Could not create the workspace`,"toast.workspaceRenamed":`Workspace renamed`,"toast.workspaceRenameFailed":`Could not rename the workspace`,"toast.workspaceDeleted":`Workspace deleted`,"toast.workspaceDeleteFailed":`Could not delete the workspace`,"topbar.search":`Search or run a command`,"topbar.openNavigation":`Open navigation`,"topbar.commandPalette":`Command palette`,"topbar.account":`Account`,"topbar.signedIn":`Signed in`,"topbar.signOut":`Sign out`,"topbar.workspaceLabel":`Workspace: {name}`,"validation.port":`Port must be a whole number between 1 and 65535.`,"validation.idRequired":`An id is required — it is the key this server lives under.`,"validation.idPattern":`The id must start with a lowercase letter or digit and contain only lowercase letters, digits, dashes and underscores.`,"validation.commandRequired":`A command is required — the executable the supervisor spawns.`,"validation.bootstrapCommand":`A bootstrap needs a command to run.`,"views.actions.addAServer":`Add a server`,"views.actions.addServer":`Add server`,"views.actions.startAll":`Start all`,"views.actions.stopAll":`Stop all`,"views.actions.stopAllIgnore":`Ignore`,"views.actions.stopAllWithPersistent":`With persistent`,"views.actions.stopAllQuestion":`Stop every server in this workspace?`,"views.actions.stopAllHint":`Persistent entries keep running unless you choose “With persistent”.`,"views.common.thisWorkspace":`this workspace`,"views.globalOverview.configError":`The config could not be read: {error}`,"views.globalOverview.degraded":`degraded`,"views.globalOverview.description":`Host vitals and every server from every workspace, grouped by where it lives.`,"views.globalOverview.emptyDescription":`Pick a workspace in the header and add the first process it should keep alive.`,"views.globalOverview.emptyTitle":`No servers anywhere yet`,"views.globalOverview.groupEmptyDescription":`Add one and it will show up here and on the workspace page.`,"views.globalOverview.groupRunning":`{running}/{total} running`,"views.globalOverview.hostUptime":`Host uptime`,"views.globalOverview.hostVitals":`Host vitals`,"views.globalOverview.hostVitalsNote":`This machine, shared by every workspace.`,"views.globalOverview.openWorkspace":`Open workspace`,"views.globalOverview.panelUptime":`Panel uptime`,"views.globalOverview.samplingOff":`sampling off`,"views.globalOverview.samplingOn":`sampling on`,"views.globalOverview.serving":`serving`,"views.globalOverview.workspaces":`Workspaces`,"views.globalSettings.authenticationDescription":`Who may sign in to this panel, and how a session is trusted.`,"views.globalSettings.backupsDescription":`One archive per capture, covering the panel and any workspace you pick.`,"views.globalSettings.changesDescription":`What Save would write to the panel's settings file.`,"views.globalSettings.description":`Listener, access, host vitals, backups, TLS and paths for this panel — shared by every workspace.`,"views.globalSettings.hostDescription":`Alert thresholds for this machine's own resources.`,"views.globalSettings.interfaceDescription":`Serve your own panel UI instead of the stock one.`,"views.globalSettings.languageDescription":`The language this panel is shown in, for this browser.`,"views.globalSettings.languageNote":`Your choice is kept in this browser and applies to the login page too. It does not change the panel's own log output or its API messages.`,"views.globalSettings.listenerDescription":`Where the control panel listens and how it announces itself.`,"views.globalSettings.loadErrorTitle":`Some file-only values could not be loaded`,"views.globalSettings.navLabel":`Global settings sections`,"views.globalSettings.pathsDescription":`Where home-hosted keeps its files, globally and per workspace.`,"views.globalSettings.saveFailed":`The settings could not be saved.`,"views.globalSettings.saved":`Settings saved.`,"views.globalSettings.savedRebinding":`Settings saved — the panel is moving to a new address.`,"views.globalSettings.savedToast":`Settings saved`,"views.globalSettings.sectionAuthentication":`Authentication`,"views.globalSettings.sectionBackups":`Backups`,"views.globalSettings.sectionHost":`Host vitals`,"views.globalSettings.sectionInterface":`Interface`,"views.globalSettings.sectionListener":`Listener`,"views.globalSettings.sectionPaths":`Paths`,"views.globalSettings.sectionTls":`TLS`,"views.globalSettings.title":`Global settings`,"views.globalSettings.tlsDescription":`Serve the panel over HTTPS with your own certificate.`,"views.logs.allStreams":`All streams`,"views.logs.clear":`Clear`,"views.logs.clearDescription":`{server} — the file on disk is truncated. The process keeps running and new lines are written from here on.`,"views.logs.clearFile":`Clear file`,"views.logs.clearNote":`Download it first if the output is still needed — this cannot be undone from the panel.`,"views.logs.clearTitle":`Clear the persisted log file?`,"views.logs.fileEmpty":`The persisted file is empty.`,"views.logs.loadedLines":`loaded {count} lines`,"views.logs.modeLive":`Live stream`,"views.logs.modePersisted":`Persisted`,"views.logs.noServersDescription":`Add one and its output will be persisted here.`,"views.logs.noServersTitle":`No servers`,"views.logs.nothingOnDisk":`Nothing on disk for this server — persistence is off, or it has not written anything yet.`,"views.logs.nothingPersisted":`nothing persisted`,"views.logs.persistedSummary":`{workspace} · {persisted} of {total} servers on disk · {size}`,"views.logs.persistedTitle":`Persisted logs`,"views.logs.pickServerDescription":`Persisted output and live streams are per server. Choose one from the list.`,"views.logs.pickServerTitle":`Pick a server`,"views.logs.reload":`Reload`,"views.logs.retentionNote":`Rotation and retention are set under Workspace settings → Logs.`,"views.logs.searchAria":`Search the log`,"views.logs.searchPlaceholder":`search the tail window`,"views.logs.searchedLines":`searched {count} lines`,"views.logs.streamAria":`Stream`,"views.logs.tailAria":`Tail size`,"views.logs.waitingOutput":`Connected — waiting for output.`,"views.overview.acrossTree":`across the tree`,"views.overview.cpuNow":`{value}% cpu now`,"views.overview.crashedOrUnhealthy":`crashed or unhealthy`,"views.overview.description":`Live state of every server in this workspace, refreshed over a single event stream.`,"views.overview.emptyDescription":`Add the first process this workspace should keep alive.`,"views.overview.emptyTitle":`No servers in this workspace`,"views.overview.enabled":`{count} enabled`,"views.overview.longestUptime":`Longest uptime`,"views.overview.needsAttention":`Needs attention`,"views.overview.notUp":`{count} not up`,"views.overview.nothingBroken":`nothing is broken`,"views.overview.nothingRunning":`nothing running`,"views.overview.openFullList":`Open the full list`,"views.overview.peak":`peak {value}`,"views.overview.processMemory":`Process memory`,"views.overview.recentActivity":`Recent activity`,"views.overview.running":`Running`,"views.overview.sampling":`resource history is sampled every 5 s and kept for this session`,"views.overview.stopped":`Stopped`,"views.overview.workspaceLabel":`workspace {id}`,"views.route.server":`Server`,"views.serverDetail.allServers":`All servers`,"views.serverDetail.autostart":`Autostart with the panel`,"views.serverDetail.backToServers":`Back to servers`,"views.serverDetail.bind":`Bind`,"views.serverDetail.bindCustom":`{bind} — custom`,"views.serverDetail.bindLan":`0.0.0.0 — every interface`,"views.serverDetail.bindLocal":`127.0.0.1 — this machine only`,"views.serverDetail.closeEditor":`Close editor`,"views.serverDetail.copyJson":`Copy the JSON config`,"views.serverDetail.crashes24":`24h crashes`,"views.serverDetail.dependencies":`Dependencies`,"views.serverDetail.detached":`detached`,"views.serverDetail.detachedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"views.serverDetail.disableServer":`Disable server`,"views.serverDetail.disabledNote":`Disabled — Start and Restart are refused until it is enabled again, from the ⋯ menu above.`,"views.serverDetail.editHint":`Edit every field of this entry`,"views.serverDetail.effectiveConfig":`Effective configuration`,"views.serverDetail.effectiveConfigNote":`Defaults from Settings are already merged into these values.`,"views.serverDetail.enableServer":`Enable server`,"views.serverDetail.eventHistory":`Event history`,"views.serverDetail.eventHistoryNote":`Kept by the panel for 24 hours.`,"views.serverDetail.fieldArgs":`args`,"views.serverDetail.fieldBackupPaths":`backup paths`,"views.serverDetail.fieldBootstrap":`bootstrap`,"views.serverDetail.fieldCommand":`command`,"views.serverDetail.fieldCwd":`cwd`,"views.serverDetail.fieldDataEnvs":`data envs`,"views.serverDetail.fieldDependsOn":`depends on`,"views.serverDetail.fieldEnv":`env`,"views.serverDetail.fieldEnvFile":`env file`,"views.serverDetail.fieldHealth":`health`,"views.serverDetail.fieldLogBuffer":`log buffer`,"views.serverDetail.fieldOnPortConflict":`on port conflict`,"views.serverDetail.fieldPortBind":`port · bind`,"views.serverDetail.fieldRestart":`restart`,"views.serverDetail.fieldRssLimit":`RSS limit`,"views.serverDetail.fieldStop":`stop`,"views.serverDetail.fields":`Fields`,"views.serverDetail.goneDescription":`{id} is not in servers.config.json any more. It may have been removed from another tab.`,"views.serverDetail.goneTitle":`That server is gone`,"views.serverDetail.health":`Health`,"views.serverDetail.healthProbe":`Health probe`,"views.serverDetail.lastCrash":`Last crash`,"views.serverDetail.lastProbe":`Last probe`,"views.serverDetail.logBufferLines":`{count} lines`,"views.serverDetail.memoryRss":`Memory (RSS)`,"views.serverDetail.moreActions":`More actions for {label}`,"views.serverDetail.neverWritten":`This server has not written anything yet.`,"views.serverDetail.nextAttempt":`Next attempt`,"views.serverDetail.none":`none`,"views.serverDetail.off":`off`,"views.serverDetail.persistent":`persistent`,"views.serverDetail.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only Stop does.","views.serverDetail.pid":`PID`,"views.serverDetail.portFree":`free`,"views.serverDetail.portInUse":`in use`,"views.serverDetail.portState":`Port state`,"views.serverDetail.probeFailed":`The health probe has not passed.`,"views.serverDetail.probeFailedFor":`The health probe has not passed for {duration}.`,"views.serverDetail.processes":`Processes`,"views.serverDetail.rawJson":`Raw JSON`,"views.serverDetail.removeAutostart":`Remove from autostart`,"views.serverDetail.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"views.serverDetail.removeNote":`This cannot be undone from the panel — the entry has to be added back by hand or from a backup.`,"views.serverDetail.removeServer":`Remove server`,"views.serverDetail.removeTitle":`Remove this server?`,"views.serverDetail.restart":`Restart`,"views.serverDetail.restarts":`Restarts`,"views.serverDetail.sectionConfig":`Configuration`,"views.serverDetail.sectionHistory":`History`,"views.serverDetail.sectionOutput":`Live output`,"views.serverDetail.start":`Start`,"views.serverDetail.startsOnItsOwn":`Starts on its own. Add ids under {code} to order it after other servers.`,"views.serverDetail.stop":`Stop`,"views.serverDetail.telemetry":`Telemetry`,"views.serverDetail.telemetryNote":`Sampled every 5 s while this page is open.`,"views.serverDetail.unhealthyFor":`Unhealthy for`,"views.serverDetail.uptime24":`24h uptime`,"views.serverDetail.waitingFirstLine":`Waiting for the first line…`,"views.servers.clearFilter":`Clear the filter`,"views.servers.clearFilters":`Clear filters`,"views.servers.description":`Every entry in {workspace}'s servers.config.json, with live resources, health and history.`,"views.servers.emptyDescription":`Add the first process this panel should supervise. Its command, args, env and working directory all live in the config file.`,"views.servers.emptyTitle":`No servers configured`,"views.servers.filterAll":`All`,"views.servers.filterAria":`Filter servers`,"views.servers.filterAttention":`Attention`,"views.servers.filterDisabled":`Disabled`,"views.servers.filterPlaceholder":`Filter by id, label, command or port`,"views.servers.filterRunning":`Running`,"views.servers.filterStopped":`Stopped`,"views.servers.noMatchDescription":`Try a different status or clear the search.`,"views.servers.noMatchTitle":`Nothing matches that filter`,"views.servers.orphansTitle":`Orphaned processes`,"views.servers.orphansDescription":`These were started by the panel and no server entry owns them any more — a renamed or removed entry left them running. Stop them here or they keep holding their resources.`,"views.servers.orphanStartedAt":`started {when}`,"views.servers.stopOrphan":`Stop it`,"views.servers.orphanPid":`pid {pid}`,"views.settings.changesDescription":`What Save would write to {workspace}'s settings.`,"views.settings.configErrorNote":`The panel keeps supervising with the config it already had; fixing the file reloads it on its own.`,"views.settings.configErrorTitle":`The workspace config could not be read`,"views.settings.configWarningTitle":`This workspace's config has a warning`,"views.settings.ddnsDescription":`Keep hostnames pointed at this machine's public address, whichever registrar holds them.`,"views.settings.defaultsDescription":`Applied to every entry in this workspace that does not set its own value.`,"views.settings.description":`Server defaults, log retention, notifications and dynamic DNS for {workspace}.`,"views.settings.logsDescription":`How much output this workspace keeps on disk and for how long.`,"views.settings.navLabel":`Workspace settings sections`,"views.settings.notificationsDescription":`Crash and health alerts for this workspace, sent to a Telegram chat.`,"views.settings.saveFailed":`The settings could not be saved.`,"views.settings.saved":`Workspace settings saved.`,"views.settings.savedToast":`Workspace settings saved`,"views.settings.sectionDdns":`Dynamic DNS`,"views.settings.sectionDefaults":`Server defaults`,"views.settings.sectionLogs":`Logs`,"views.settings.sectionNotifications":`Notifications`,"views.settings.concurrentEdit":`Someone else changed {ids} while you had this page open. Reload to see their version, then reapply your edit.`,"workspace.new":`New workspace`,"workspace.rename":`Rename workspace`,"workspace.create":`Create workspace`,"workspace.renameAction":`Rename`,"workspace.createHint":`Its own settings, servers, logs, secrets and backups entry — served by this same panel.`,"workspace.renameHint":`Only the name changes; the workspace id stays, so URLs and paths keep working.`,"workspace.nameHint":`Shown in the header.`,"workspace.nameHintId":`Shown in the header. Id: {id}`,"workspace.none":`No workspace`,"workspace.delete":`Delete workspace`,"workspace.listHeading":`Workspaces`,"workspace.emptyList":`The panel serves no workspace yet.`,"workspace.newAction":`New workspace…`,"workspace.renameActionFor":`Rename “{name}”…`,"workspace.deleteActionFor":`Delete “{name}”…`,"workspace.deleteTitle":`Delete “{name}”?`,"workspace.deleteBody":`Its servers are stopped, and its config, settings, logs, secrets and nanny state are removed from disk. A backup taken first is the only way back.`,"workspace.nameRequired":`A workspace needs a name.`,"workspace.namePlaceholder":`Home lab`,"days.remaining":{one:`{count} day`,other:`{count} days`},"editor.unsaved":{one:`unsaved change`,other:`unsaved changes`},"editor.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"logs.lines":{one:`{count} line`,other:`{count} lines`},"palette.results":{one:`{count} result`,other:`{count} results`},"proxy.retry.inMinutes":{one:`~{count} minute`,other:`~{count} minutes`},"proxy.retry.inHours":{one:`~{count} hour`,other:`~{count} hours`},"servers.total":{one:`{count} server`,other:`{count} servers`},"servers.running":{one:`{count} running`,other:`{count} running`},"settings.backup.entriesCount":{one:`{count} entry`,other:`{count} entries`},"settings.backup.itemsSelected":{one:`{count} item selected`,other:`{count} items selected`},"settings.ddns.hostnameCount":{one:`{count} hostname`,other:`{count} hostnames`},"settings.shell.fieldsChanged":{one:`field changed`,other:`fields changed`},"settings.shell.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"views.globalOverview.needLook":{one:`{count} server needs a look`,other:`{count} servers need a look`},"views.globalOverview.serversTotal":{one:`{count} server in total`,other:`{count} servers in total`},"views.logs.filesOnDisk":{one:`{count} file`,other:`{count} files`},"views.overview.needLook":{one:`{count} server needs a look`,other:`{count} servers need a look`}},hP=/\{(\w+)\}/g;function gP(e,t){return`${e}:${t||`index`}`}function _P(e,t){if(e==null)return null;let n=CP(e,t);return n===void 0?null:n}function vP(e,t,n){n?.preserveExisting?xP(e,t):bP(e,t)}function yP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(typeof a!=`object`||!a||Array.isArray(a)){e[i]=a;continue}let o=e[i];typeof o==`object`&&o&&!Array.isArray(o)?bP(o,a):e[i]=a}}function xP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(!Object.prototype.hasOwnProperty.call(e,i)){e[i]=a;continue}let o=e[i];yP(a)&&yP(o)&&xP(o,a)}}function SP(e,t){return!t||e.indexOf(`{`)===-1?e:e.replace(hP,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)})}function CP(e,t){if(e==null||typeof t!=`string`||t.length===0)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(!t.includes(`.`))return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let t=r;if(!Object.prototype.hasOwnProperty.call(t,e))return;r=t[e]}return r}function wP(e,t,n){if(typeof t!=`string`||t.length===0)return e;if(Object.prototype.hasOwnProperty.call(e,t)||!t.includes(`.`))return t===`__proto__`?e:{...e,[t]:n};let r=t.split(`.`);if(r.some(e=>e===`__proto__`))return e;let i={...e},a=i;for(let e of r.slice(0,-1)){let t=a[e],n=yP(t)?{...t}:{};a[e]=n,a=n}return a[r[r.length-1]]=n,i}function TP(e,t){let n=EP(e,t),r={};return DP(e,t,``,r),Object.keys(r).length===0?n:{...n,...r}}function EP(e,t){let n={...e};for(let e of Object.keys(t)){if(e===`__proto__`)continue;let r=t[e];if(r==null)continue;let i=n[e];n[e]=yP(r)&&yP(i)?EP(i,r):r}return n}function DP(e,t,n,r){for(let i of Object.keys(e)){if(i===`__proto__`)continue;let a=e[i];if(!yP(a))continue;let o=n?`${n}.${i}`:i,s=t[i];yP(s)?DP(a,s,o,r):s!=null&&OP(a,o,r)}}function OP(e,t,n){for(let r of Object.keys(e)){if(r===`__proto__`)continue;let i=e[r],a=`${t}.${r}`;yP(i)?OP(i,a,n):n[a]=i}}var kP=(e,t,n,r,i)=>{let a=i(e);if(!a)return null;let o=a.toString().split(`|`);if(o.length===0)return null;let s=t<o.length?o[t]:o[o.length-1];return s?SP(s.trim(),{...n,count:t}):null};function AP(e){if(!e)return``;let t=Object.keys(e).sort();if(t.length===0)return``;let n={};for(let r of t)n[r]=e[r];return JSON.stringify(n)}function jP(e,t){let n=AP(t);return n?`${e}\0${n}`:e}var MP=class{constructor(e={}){this.numberCache=new Map,this.dateCache=new Map,this.relativeCache=new Map,this.numberFormats=e.numberFormats??{},this.datetimeFormats=e.datetimeFormats??{}}setNumberFormats(e){this.numberFormats=e,this.numberCache.clear()}setDateTimeFormats(e){this.datetimeFormats=e,this.dateCache.clear()}getNumberFormats(){return this.numberFormats}getDateTimeFormats(){return this.datetimeFormats}clearCache(){this.numberCache.clear(),this.dateCache.clear(),this.relativeCache.clear()}resolveNumberFormat(e,t){return this.numberFormats[e]?.[t]??this.numberFormats[e.split(`-`)[0]]?.[t]}resolveDateTimeFormat(e,t){return this.datetimeFormats[e]?.[t]??this.datetimeFormats[e.split(`-`)[0]]?.[t]}getNumberFormatter(e,t){let n=jP(e,t),r=this.numberCache.get(n);return r||(r=new Intl.NumberFormat(e,t),this.numberCache.set(n,r)),r}getDateTimeFormatter(e,t){let n=jP(e,t),r=this.dateCache.get(n);return r||(r=new Intl.DateTimeFormat(e,t),this.dateCache.set(n,r)),r}getRelativeTimeFormatter(e,t){let n=jP(e,t),r=this.relativeCache.get(n);return r||(r=new Intl.RelativeTimeFormat(e,t),this.relativeCache.set(n,r)),r}formatNumber(e,t,n){return this.getNumberFormatter(t,n).format(e)}formatDate(e,t,n){let r=new Date(e);return Number.isNaN(r.getTime())?`Invalid Date`:this.getDateTimeFormatter(t,n).format(r)}formatRelativeTime(e,t,n){let r=new Date(e),i=this.getRelativeTimeFormatter(t,n);if(Number.isNaN(r.getTime()))return i.format(0,`second`);let a=Math.floor((Date.now()-r.getTime())/1e3);for(let{unit:e,seconds:t}of[{unit:`year`,seconds:31536e3},{unit:`month`,seconds:2592e3},{unit:`day`,seconds:86400},{unit:`hour`,seconds:3600},{unit:`minute`,seconds:60},{unit:`second`,seconds:1}]){let n=Math.floor(a/t);if(n>=1)return i.format(-n,e)}return i.format(0,`second`)}},NP=Symbol(`i18n-leaf-miss`),PP=new WeakMap;function FP(e){let t=PP.get(e);return t||(t={leafByChunk:new Map,generation:0},PP.set(e,t)),t}function IP(e){let t=e?.translations??new Map,n=FP(t),{leafByChunk:r}=n;function i(){n.generation++}function a(e){r.delete(e)}function o(){r.clear()}function s(e){let t=r.get(e);return t||(t=new Map,r.set(e,t)),t}function c(e,t,n){let i=r.get(e);if(i?.has(n)){let e=i.get(n);return e===NP?null:e}if(!t)return s(e).set(n,NP),null;let a=_P(t,n);return s(e).set(n,a===null?NP:a),a}function l(e,n){t.set(e,n),a(e),i()}function u(e,n){let r=t.get(e);r?(vP(r,n),a(e),i()):l(e,{...n})}return{hasCache(e,n){return t.has(gP(e,n))},getCache(e,n){return t.get(gP(e,n))},setCache(e,t,n){r.set(gP(e,t),n)},getGeneration(){return n.generation},hasTranslation(e,n){let r=`${e}:`;for(let[e,i]of t)if(e.startsWith(r)&&_P(i,n)!==null)return!0;return!1},hasPageTranslation(e,n){return t.has(gP(e,n))},getTranslation(e,n,r){let i=gP(e,n);return c(i,t.get(i),r)},lookupIn:c,loadTranslations(e,t,n=`index`){u(gP(e,n),t)},setTranslations(e,t,n=`index`){l(gP(e,n),t)},loadPageTranslations(e,n,r){let i=gP(e,n),a=t.get(i);!a||Object.keys(a).length===0?l(i,{...r}):u(i,r)},mergeTranslation(e,t,n,r=!1){u(gP(e,t),n)},clearCache(){t.clear(),o(),i()}}}var LP=class{constructor(e={}){this.formatter=new MP,this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1,this.helper=IP(e.storage);let t={numberFormats:e.numberFormats,datetimeFormats:e.datetimeFormats};this.formatter=new MP(t),this.pluralFunc=e.plural&&e.plural!==kP?(t,n,r,i,a)=>e.plural(t,n,r,i,a)??kP(t,n,r,i,a):kP,this.missingWarn=e.missingWarn??!0,this.missingHandler=e.missingHandler,this.getCustomMissingHandler=e.getCustomMissingHandler}touch(){}resolveRouteName(e){return typeof e==`string`?e:this.getRoute()}ensurePinnedChunk(e,t){let n=gP(e,t),r=this.helper.getGeneration();(this.pinnedCacheKey!==n||this.pinnedGeneration!==r)&&(this.pinnedCacheKey=n,this.pinnedGeneration=r,this.pinnedTree=this.helper.getCache(e,t)??null)}invalidatePin(){this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1}resolveLookup(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e),a=t===void 0||r===this.getRoute(),o;if(a?(this.ensurePinnedChunk(n,r),o=this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)):o=this.helper.getTranslation(n,r,i),o!==null)return o;let s=this.getFallbackLocale();return n===s?null:this.helper.getTranslation(s,r,i)}resolveHas(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e);return t===void 0||r===this.getRoute()?(this.ensurePinnedChunk(n,r),this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)!==null):this.helper.getTranslation(n,r,i)!==null}resolveTranslationTree(e,t){return TP(e,t)}resolveTranslations(e){this.touch();let t=this.getLocale(),n=this.resolveRouteName(e),r=this.helper.getCache(t,n)??{},i=this.getFallbackLocale();if(i===t)return r;let a=this.helper.getCache(i,n);return a?this.resolveTranslationTree(a,r):r}onTranslationsChanged(){}getMissingContext(e){return{locale:this.getLocale(),routeName:this.resolveRouteName(e)}}warnDev(e){this.missingWarn}warnMissing(e,t){let{locale:n,routeName:r}=this.getMissingContext(t),i=this.getCustomMissingHandler?.();i?i(n,String(e),r):this.missingHandler?this.missingHandler(n,String(e),r):this.warnDev(`Not found '${e}' key in '${n}' locale messages for route '${r}'.`)}warnMissingFormat(e,t,n){this.warnDev(`Not found '${t}' ${e} format in '${n}' locale. Falling back to default Intl options.`)}t(e,t,n,r){if(!e)return``;if(this.touch(),t===void 0&&n===void 0&&r===void 0&&typeof e==`string`)return this.resolveLookup(e)??(this.warnMissing(e),e);let i=this.resolveLookup(e,r);return i==null?(this.warnMissing(e,r),n===void 0?e:n||e):typeof i!=`string`||!t?i:SP(i,t)}ts(e,t,n,r){return this.t(e,t,n,r)?.toString()??n??e}tc(e,t,n){this.touch();let{count:r,...i}=typeof t==`number`?{count:t}:t;return r===void 0?n??e:this.pluralFunc(e,Number.parseInt(r.toString(),10),i,this.getLocale(),(e,t,n)=>{let r=this.resolveLookup(e);return r==null?n===void 0?void 0:n||e:typeof r!=`string`||!t?r:SP(r,t)})??n??e}tn(e,t,n,r){this.touch();let i=this.resolveNumberFormatArgs(t,n,r);return this.formatter.formatNumber(e,i.locale,i.options)}td(e,t,n,r){this.touch();let i=this.resolveDateTimeFormatArgs(t,n,r);return this.formatter.formatDate(e,i.locale,i.options)}tdr(e,t){return this.touch(),this.formatter.formatRelativeTime(e,this.getLocale(),t)}has(e,t){return this.touch(),this.resolveHas(e,t)}setTranslation(e,t){let n=this.getLocale(),r=this.getRoute(),i=this.helper.getCache(n,r)??{};this.helper.setTranslations(n,wP(i,String(e),t),r),this.invalidatePin(),this.onTranslationsChanged()}clearCache(){this.helper.clearCache(),this.formatter.clearCache(),this.invalidatePin()}resolveNumberFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveNumberFormat(r,e);return a||this.warnMissingFormat(`number`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}resolveDateTimeFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveDateTimeFormat(r,e);return a||this.warnMissingFormat(`datetime`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}loadTranslationsCore(e,t,n,r=`index`){n?this.helper.mergeTranslation(e,r,t,!0):this.helper.setTranslations(e,t,r),this.invalidatePin()}loadRouteTranslationsCore(e,t,n,r){r?this.helper.mergeTranslation(e,t,n,!0):this.helper.loadPageTranslations(e,t,n),this.invalidatePin()}extend(e){return Object.assign(this,e)}},RP=Symbol(`i18n`),zP=Symbol(`i18n-locales`),BP=Symbol(`i18n-default-locale`),VP=Symbol(`i18n-router-strategy`),HP=N({name:`I18nGroup`,props:{prefix:{type:String,required:!0},groupClass:{type:String,default:``}},setup(e,{slots:t}){let n=Dr(RP);if(!n)throw Error(`[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.`);let r=(t,r)=>n.t(`${e.prefix}.${t}`,r,void 0,n.getRoute());return()=>sc(`div`,{class:[`i18n-group`,e.groupClass]},t.default?.({prefix:e.prefix,t:r}))}}),UP=N({name:`I18nLink`,props:{to:{type:[String,Object],required:!0},activeStyle:{type:Object,default:()=>({})},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Dr(RP),r=Dr(VP,void 0);if(!n)throw Error(`[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.`);let i=W(()=>typeof e.to==`string`&&/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(e.to)),a=W(()=>{if(i.value)return e.to;if(e.localeRoute){let t=e.localeRoute(e.to);return typeof t==`string`?t:t.path||`/`}if(!r?.resolvePath)return typeof e.to==`string`?e.to:e.to.path||`/`;let t=r.resolvePath(e.to,n.locale.value);return typeof t==`string`?t:t.path||`/`}),o=W(()=>i.value||!r?!1:r.getCurrentPath().replace(/#.*$/,``).replace(/\/$/,``)===a.value.replace(/#.*$/,``).replace(/\/$/,``)),s=W(()=>o.value?e.activeStyle:{});return()=>i.value?sc(`a`,{href:a.value,target:`_blank`,rel:`noopener noreferrer`,style:s.value},t.default?.()):r?.linkComponent?sc(r.linkComponent,{to:a.value,style:s.value},{default:t.default}):sc(`a`,{href:a.value,style:s.value,onClick:e=>{e.preventDefault(),r?r.push({path:a.value}):window.location.href=a.value}},t.default?.())}}),WP=N({name:`I18nSwitcher`,props:{customLabels:{type:Object,default:()=>({})},customWrapperStyle:{type:Object,default:()=>({})},customButtonStyle:{type:Object,default:()=>({})},customDropdownStyle:{type:Object,default:()=>({})},customItemStyle:{type:Object,default:()=>({})},customLinkStyle:{type:Object,default:()=>({})},customActiveLinkStyle:{type:Object,default:()=>({})},customDisabledLinkStyle:{type:Object,default:()=>({})},customIconStyle:{type:Object,default:()=>({})},locales:{type:Array,default:void 0},currentLocale:{type:[String,Function],default:void 0},getLocaleName:{type:Function,default:void 0},switchLocale:{type:Function,default:void 0},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Dr(RP),r=Dr(VP,void 0),i=Dr(zP,void 0);if(!n)throw Error(`[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.`);if(!i&&!e.locales)throw Error(`[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.`);let a=W(()=>e.locales||i||[]),o=W(()=>a.value.filter(e=>!e.disabled)),s=W(()=>e.currentLocale===void 0?n.locale.value:typeof e.currentLocale==`function`?e.currentLocale():e.currentLocale),c=W(()=>a.value.some(e=>e.code===s.value&&e.disabled)),l=W(()=>e.getLocaleName?e.getLocaleName()||null:a.value.find(e=>e.code===n.locale.value)?.displayName||null),u=k(!1),d=k(null),f=e=>{e&&(e.stopPropagation(),e.preventDefault()),u.value=!u.value},p=t=>e.customLabels[t.code]||t.displayName||t.code,m=W(()=>{let e=a.value.find(e=>e.code===s.value);return e?p(e):l.value||s.value}),h=async t=>{if(u.value=!1,await ir(),e.switchLocale){e.switchLocale(t);return}if(n.locale.value=t,!r)return;let i=r.getCurrentPath(),a=e.localeRoute?(()=>{let n=e.localeRoute(i,t);return typeof n==`string`?n:n.path||`/`})():r?.resolvePath?(()=>{let e=r.resolvePath(i,t);return typeof e==`string`?e:e.path||`/`})():i;r.push({path:a})},g={position:`relative`,display:`inline-block`,verticalAlign:`middle`},_={padding:`4px 12px`,fontSize:`16px`,cursor:`pointer`,backgroundColor:`#fff`,border:`1px solid #333`,transition:`background-color 0.3s ease`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},v={position:`absolute`,top:`100%`,left:`0`,zIndex:1e3,backgroundColor:`#fff`,border:`1px solid #333`,listStyle:`none`,padding:`0`,margin:`4px 0 0 0`,minWidth:`150px`,boxShadow:`0 2px 8px rgba(0,0,0,0.15)`},y={margin:`0`,padding:`0`},b={display:`block`,padding:`8px 12px`,color:`#333`,textDecoration:`none`,transition:`background-color 0.3s ease`,cursor:`pointer`},x={fontWeight:`bold`,color:`#007bff`,cursor:`not-allowed`},S={marginLeft:`8px`,display:`inline-block`,transition:`transform 0.3s ease`},C={transform:`rotate(180deg)`},w=e=>e?Array.isArray(e)?e:[e]:[],T=e=>{if(!u.value)return;let t=e.target;if(!t||!d.value)return;let n=d.value.contains(t),r=t.closest(`.i18n-switcher-button`)!==null;!n&&!r&&(u.value=!1)};return ia(()=>{document.addEventListener(`click`,T)}),ca(()=>{document.removeEventListener(`click`,T)}),()=>{let n=[];t[`before-button`]&&n.push(...w(t[`before-button`]()));let i=[];if(t[`before-selected-locale`]&&i.push(...w(t[`before-selected-locale`]())),i.push(sc(`span`,m.value)),t[`after-selected-locale`]&&i.push(...w(t[`after-selected-locale`]())),i.push(sc(`span`,{style:{...S,...u.value?C:{},...e.customIconStyle}},`▼`)),n.push(sc(`button`,{class:`i18n-switcher-button`,style:{..._,...e.customButtonStyle,...c.value?e.customDisabledLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),f(e)},type:`button`,ariaHaspopup:!0,ariaExpanded:u.value},i)),t[`before-dropdown`]&&n.push(...w(t[`before-dropdown`]())),u.value){let i=[];t[`before-dropdown-items`]&&i.push(...w(t[`before-dropdown-items`]())),o.value.forEach(n=>{let a=[];t[`before-item`]&&a.push(...w(t[`before-item`]({locale:n})));let o=[];t[`before-link-content`]&&o.push(...w(t[`before-link-content`]({locale:n}))),o.push(p(n)),t[`after-link-content`]&&o.push(...w(t[`after-link-content`]({locale:n})));let c=typeof window<`u`?window.location.pathname:`/`,l=e.localeRoute?e.localeRoute(c,n.code):r?.resolvePath?r.resolvePath(c,n.code):c,u=typeof l==`string`?l:l.path||`#`,d=n.code===s.value;a.push(sc(`a`,{class:`switcher-locale-${n.code}`,href:typeof u==`string`?u:`#`,style:{...b,...d?x:{},...e.customLinkStyle,...d?e.customActiveLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),h(n.code)}},o)),t[`after-item`]&&a.push(...w(t[`after-item`]({locale:n}))),i.push(sc(`li`,{key:n.code,style:{...y,...e.customItemStyle}},a))}),t[`after-dropdown-items`]&&i.push(...w(t[`after-dropdown-items`]())),n.push(sc(`ul`,{class:`i18n-switcher-dropdown`,style:{...v,...e.customDropdownStyle}},i))}return t[`after-dropdown`]&&n.push(...w(t[`after-dropdown`]())),sc(`div`,{ref:d,class:`i18n-switcher-wrapper`,style:{...g,...e.customWrapperStyle}},n)}}}),GP=N({name:`I18nT`,inheritAttrs:!1,props:{keypath:{type:String,required:!0},plural:{type:[Number,String]},tag:{type:String,default:`span`},params:{type:Object,default:()=>({})},defaultValue:{type:String,default:``},html:{type:Boolean,default:!1},hideIfEmpty:{type:Boolean,default:!1},customPluralRule:{type:Function,default:null},number:{type:[Number,String]},date:{type:[Date,String,Number]},relativeDate:{type:[Date,String,Number]}},setup(e,{slots:t,attrs:n}){let r=Dr(RP);if(!r)throw Error(`[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.`);return()=>{let i={},a=r.getRoute(),o={...n};delete o.innerHTML;let s=t=>e.html?sc(e.tag,{...o,innerHTML:t}):sc(e.tag,o,t);if(e.number!==void 0){let t=Number(e.number),n=r.tn(t),i=r.t(e.keypath,{number:n,...e.params},void 0,a);return s(String(i??``))}if(e.date!==void 0){let t=r.td(e.date),n=r.t(e.keypath,{date:t,...e.params},void 0,a);return s(String(n??``))}if(e.relativeDate!==void 0){let t=r.tdr(e.relativeDate),n=r.t(e.keypath,{relativeDate:t,...e.params},void 0,a);return s(String(n??``))}if(e.plural!==void 0){let t=Number.parseInt(e.plural.toString(),10);return e.customPluralRule?s(e.customPluralRule(e.keypath,t,e.params,r.locale.value,(e,t,n)=>r.t(e,t,n,a))||``):s(r.tc(e.keypath,{count:t,...e.params}))}let c=(r.t(e.keypath,{...e.params,...i},void 0,a)??``).toString();if(e.hideIfEmpty&&!c.trim())return e.defaultValue??null;if(e.html)return s(c);if(t.default)return sc(e.tag,o,t.default({translation:c}));let l=[],u=0;for(let[e,n]of Object.entries(t)){if(e==="default")continue;let t=`{${e}}`,r=c.indexOf(t,u);r!==-1&&(r>u&&l.push(c.slice(u,r)),n&&l.push(sc(n)),u=r+t.length)}return u<c.length&&l.push(c.slice(u)),t.default?sc(e.tag,o,t.default({children:l})):l.length>0?sc(e.tag,o,l):sc(e.tag,o,c)}}}),KP=class extends LP{constructor(e){let t={translations:new Map};if(super({storage:t,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this.listeners=new Set,this.storage=t,this._locale=gn(e.locale),this._fallbackLocale=gn(e.fallbackLocale||e.locale),this._currentRoute=gn(`index`),this._revision=gn(0),e.messages)for(let[t,n]of Object.entries(e.messages))this.helper.loadTranslations(t,n)}get locale(){return this._locale}set locale(e){typeof e==`string`?this._locale.value=e:this._locale=e}get fallbackLocale(){return this._fallbackLocale}set fallbackLocale(e){typeof e==`string`?this._fallbackLocale.value=e:this._fallbackLocale=e}get currentRoute(){return this._currentRoute}setRoute(e){this._currentRoute.value=e}getLocale(){return this._locale.value}getFallbackLocale(){return this._fallbackLocale.value}getRoute(){return this._currentRoute.value}addTranslations(e,t,n=!0){super.loadTranslationsCore(e,t,n),this._revision.value++,this.notifyListeners()}addRouteTranslations(e,t,n,r=!0){super.loadRouteTranslationsCore(e,t,n,r),this._revision.value++,this.notifyListeners()}mergeTranslations(e,t,n){this.helper.mergeTranslation(e,t,n,!0),this._revision.value++,this.notifyListeners()}clearCache(){super.clearCache(),this._revision.value++,this.notifyListeners()}onTranslationsChanged(){this._revision.value++,this.notifyListeners()}subscribeToChanges(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}getStorage(){return this.storage}getRouteCache(){let e={};for(let[t,n]of this.storage.translations)e[t]=n;return e}};function qP(e){let{routingStrategy:t,locales:n,defaultLocale:r,...i}=e,a=new KP(i),o=null,s=t||null;return{global:a,setRoutingStrategy:e=>{s=e,o&&o.provide(VP,e)},install(e){o=e,e.provide(RP,a),s&&e.provide(VP,s),n&&e.provide(zP,n),r&&e.provide(BP,r),e.config.globalProperties.$t=(e,t,n,r)=>a.t(e,t,n,r),e.config.globalProperties.$ts=(e,t,n,r)=>a.ts(e,t,n,r),e.config.globalProperties.$tc=(e,t,n)=>a.tc(e,t,n),e.config.globalProperties.$tn=a.tn.bind(a),e.config.globalProperties.$td=a.td.bind(a),e.config.globalProperties.$tdr=a.tdr.bind(a),e.config.globalProperties.$has=(e,t)=>a.has(e,t),e.config.globalProperties.$i18n=a,e.component(`I18nT`,GP),e.component(`I18nLink`,UP),e.component(`I18nGroup`,HP),e.component(`I18nSwitcher`,WP)}}}var JP=[{code:`en`,iso:`en-US`,name:`English`},{code:`vi`,iso:`vi-VN`,name:`Tiếng Việt`},{code:`zh-CN`,iso:`zh-CN`,name:`简体中文`},{code:`ja`,iso:`ja-JP`,name:`日本語`},{code:`es`,iso:`es-ES`,name:`Español`},{code:`ko`,iso:`ko-KR`,name:`한국어`},{code:`ru`,iso:`ru-RU`,name:`Русский`},{code:`fr`,iso:`fr-FR`,name:`Français`},{code:`de`,iso:`de-DE`,name:`Deutsch`}],YP=`hh.locale`,XP=new Map(JP.map(e=>[e.code,e]));function ZP(e){return XP.get(e)}function QP(e){return XP.has(e)}function $P(e){if(e.length===0)return null;let t=e.toLowerCase(),n=JP.find(e=>e.code.toLowerCase()===t);if(n!==void 0)return n.code;let r=t.split(`-`)[0];return JP.find(e=>e.code.toLowerCase()===r||e.code.toLowerCase().split(`-`)[0]===r)?.code??null}function eF(e,t,n){return e.replace(/\{(\w+)\}/g,(e,r)=>{if(r===`count`)return String(n);let i=t[r];return i===void 0?e:String(i)})}var tF=new Map,nF=(e,t,n,r,i)=>{let a=i(e);if(a==null)return null;if(typeof a==`string`)return eF(a.split(`|`)[0].trim(),n??{},t);let o=tF.get(r);o===void 0&&(o=new Intl.PluralRules(r),tF.set(r,o));let s=a[o.select(t)]??a.other;return typeof s==`string`?eF(s,n??{},t):null},rF=`modulepreload`,iF=function(e){return`/`+e},aF={},oF=function(e){return e.pathname.endsWith(`.css`)},sF=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},cF=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=iF(t,n);let r=s(t),i=oF(r);return sF(aF,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:rF,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},lF=Object.assign({"../../i18n/generated/en.json":pP}),uF=Object.assign({"../../i18n/generated/de.json":()=>cF(()=>import(`./de-DqCaD5Wo.js`),[]),"../../i18n/generated/es.json":()=>cF(()=>import(`./es-C9BCeLRB.js`),[]),"../../i18n/generated/fr.json":()=>cF(()=>import(`./fr-DSqr4dJR.js`),[]),"../../i18n/generated/ja.json":()=>cF(()=>import(`./ja-BXh5KQLu.js`),[]),"../../i18n/generated/ko.json":()=>cF(()=>import(`./ko-CaUuJamy.js`),[]),"../../i18n/generated/ru.json":()=>cF(()=>import(`./ru-DqMXLbiM.js`),[]),"../../i18n/generated/vi.json":()=>cF(()=>import(`./vi-B4JcXw2N.js`),[]),"../../i18n/generated/zh-CN.json":()=>cF(()=>import(`./zh-CN-Bb8pDaqj.js`),[])}),dF=qP({locale:`en`,fallbackLocale:`en`,defaultLocale:`en`,plural:nF,missingWarn:!1,messages:{en:Object.values(lF)[0]?.default??{}},locales:JP.map(e=>({...e}))}),fF=new Set([`en`]),pF=new Map;function mF(){try{let e=localStorage.getItem(YP);if(e!==null&&QP(e))return e}catch{}return null}function hF(){let e=typeof navigator>`u`?[]:[...navigator.languages??[],navigator.language].filter(e=>typeof e==`string`);for(let t of e){let e=$P(t);if(e!==null)return e}return`en`}async function gF(e){if(fF.has(e))return;let t=pF.get(e);if(t!==void 0)return t;let n=uF[`../../i18n/generated/${e}.json`];if(n===void 0)return;let r=n().then(t=>{dF.global.addTranslations(e,t.default,!0),fF.add(e)}).finally(()=>pF.delete(e));return pF.set(e,r),r}function _F(e){typeof document<`u`&&(document.documentElement.lang=ZP(e)?.iso??e)}async function vF(e){if(QP(e)&&e!==dF.global.locale.value){try{await gF(e)}catch{return}dF.global.locale.value=e,_F(e);try{localStorage.setItem(YP,e)}catch{}}}async function yF(){let e=mF()??hF();try{await gF(e)}catch{_F(`en`);return}e!==`en`&&(dF.global.locale.value=e),_F(e)}function Y(e,t,n){let r=dF.global.t(e,t,n??null);return typeof r==`string`?r:String(r??``)}function bF(e,t,n){let r={...n,count:t},i=dF.global.resolveTranslations()[e];return i===void 0?Y(e,r,e):nF(e,t,r,xF(),()=>i)??Y(e,r,e)}function xF(){return dF.global.locale.value}var SF={responseMs:null,cpuPercent:null,rssBytes:null,processes:null};function CF(e){return e.status===`running`?{responseMs:e.responseMs??null,cpuPercent:e.resources?.cpuPercent??null,rssBytes:e.resources?.rssBytes??null,processes:e.resources?.processes??null}:SF}var wF=4e3;function TF(){return tn({ts:[],cpu:[],rss:[],probe:[],lastSampledAt:-1})}function EF(e){let t=e.ts.length-120;t<=0||(e.ts.splice(0,t),e.cpu.splice(0,t),e.rss.splice(0,t),e.probe.splice(0,t))}function DF(e,t,n){let r=t.resources?.sampledAt??0,i=e.ts[e.ts.length-1]??0,a=r!==e.lastSampledAt||n-i>=wF,o=CF(t);a?(e.lastSampledAt=r,e.ts.push(n),e.cpu.push(o.cpuPercent),e.rss.push(o.rssBytes),e.probe.push(o.responseMs),EF(e)):e.probe.length>0&&(e.probe[e.probe.length-1]=o.responseMs)}function OF(e){let t=0;for(let n of e)n!==null&&n>t&&(t=n);return t}function kF(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!=null)return n}return null}var AF=8e3,jF=k(null),MF=k(`connecting`),NF=k(null),PF=k(Date.now()),FF=new Map,IF=fP(),LF=new Map,RF=k(0),zF=null,BF=null;function VF(e){let t=LF.get(e);if(t)return t;let n={lines:[],version:k(0),refs:0,source:null};return LF.set(e,n),n}function HF(e,t){let n=VF(e),r=n.lines.concat(t);n.lines=r.length>8e3?r.slice(r.length-AF):r,n.version.value+=1,RF.value+=1}function UF(e){return LF.get(e)?.lines??[]}function WF(e){let t=LF.get(e);t&&(t.lines=[],t.version.value+=1,RF.value+=1)}function GF(e){let t=FF.get(e);if(t)return t;let n=TF();return FF.set(e,n),n}function KF(e){e.workspaceId!==void 0&&DF(GF(wM(e.workspaceId,e.id)),e,Date.now())}function qF(e){let t=jF.value;if(!t)return;let n=e.workspaceId,r=n===void 0?t.workspaces.filter(t=>t.servers.some(t=>t.id===e.id)):t.workspaces.filter(e=>e.id===n);if(r.length!==1)return;let i=r[0],a=i.servers.find(t=>t.id===e.id),o=n===void 0?{...e,workspaceId:i.id}:e;i.servers=a===void 0?[...i.servers,o]:i.servers.map(t=>t.id===e.id?o:t)}function JF(e){let t;try{t=JSON.parse(e)}catch{return}let n=yM(t);if(n instanceof J.errors)console.warn(`[home-hosted] ignored malformed SSE frame`,n.summary);else if(n.type===`hello`||n.type===`state`){if(n.state){jF.value=n.state;for(let e of jF.value.workspaces)for(let t of e.servers)KF(t)}}else if(n.type===`server`&&n.server){let e=n.server;qF(e),KF(e)}else if(n.type===`log`&&n.serverId&&n.lines){let e=n.workspaceId;if(e===void 0)return;HF(wM(e,n.serverId),n.lines)}}function YF(e,t,n){let r=wM(e,t);n.lines=[],n.version.value+=1,RF.value+=1;let i=new EventSource(`/api/servers/${encodeURIComponent(t)}/stream${CN(e)}`),a=e=>{let t=e,n;try{n=JSON.parse(t.data)}catch{return}let i=yM(n);i instanceof J.errors?console.warn(`[home-hosted] ignored malformed SSE frame`,i.summary):i.type===`log`&&i.lines?HF(r,i.lines):i.type===`server`&&i.server&&qF(i.server)};for(let e of[`log`,`server`])i.addEventListener(e,a);i.onerror=()=>{},n.source=i}function XF(e,t){let n=VF(wM(e,t));n.refs+=1,n.source||YF(e,t,n)}function ZF(e,t){let n=LF.get(wM(e,t));n&&(n.refs=Math.max(0,n.refs-1),n.refs===0&&(n.source?.close(),n.source=null))}function QF(){if(zF)return;BF??=setInterval(()=>{PF.value=Date.now()},1e3);let e=new EventSource(`/api/events?logs=0`);zF=e,MF.value=`connecting`,e.onopen=()=>{MF.value=`open`},e.onerror=()=>{MF.value=`closed`};for(let t of[`hello`,`state`,`server`,`log`])e.addEventListener(t,e=>{JF(e.data)})}function $F(){zF?.close(),zF=null,BF&&clearInterval(BF),BF=null}function eI(e,t){let n=W(()=>{let n=bn(e),r=bn(t);return n===null||r===null?null:wM(n,r)}),r=null;return M(n,e=>{if(r!==null&&r!==e){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&ZF(e,t)}if(r=e,e!==null){let[t,n]=e.split(`/`);t!==void 0&&n!==void 0&&XF(t,n)}},{immediate:!0}),ze(()=>{if(r!==null){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&ZF(e,t)}r=null}),{version:W(()=>{let e=n.value;return RF.value,e===null?0:LF.get(e)?.version.value??0}),lines(){let e=n.value;return e===null?[]:UF(e)},count:W(()=>{let e=n.value;return RF.value,e===null?0:LF.get(e)?.lines.length??0}),clear(){let e=n.value;e!==null&&WF(e)}}}function tI(){let e=W(()=>jF.value?.workspaces??[]),t=W(()=>e.value.flatMap(e=>e.servers.map(t=>({workspace:e,server:t})))),n=W(()=>jF.value?.control??null),r=W(()=>jF.value?.host??null),i=W(()=>jF.value?.backups??null),a=W(()=>jF.value?.proxy??null),o=W(()=>jF.value?.projectDir??null),s=W(()=>jF.value?.dataRoot??null),c=W(()=>jF.value?.version??null);function l(e){return jF.value?.workspaces.find(t=>t.id===e)}function u(e,t){return l(e)?.servers.find(e=>e.id===t)}function d(e,t){return GF(wM(e,t))}async function f(){if(jF.value===null)try{jF.value=await EN()}catch(e){e instanceof EM&&sP().requireLogin()}}async function p(e,t){NF.value=null;try{let n=await e();jF.value=await EN();let r=typeof t.success==`function`?t.success(n):t.success;return r&&IF.success(r),n}catch(e){if(e instanceof EM){sP().requireLogin();return}let n=CM(e);NF.value=n,IF.failure(t.title,n);return}}return{appState:jF,workspaces:e,allServers:t,control:n,host:r,backups:i,proxy:a,projectDir:o,dataRoot:s,version:c,connection:rn(MF),lastError:rn(NF),now:rn(PF),workspaceById:l,ensureState:f,serverById:u,seriesOf:d,refresh:(e=Y(`toast.refreshFailed`))=>p(async()=>{},{title:e}),start:(e,t)=>p(()=>YN(e,t,`start`),{title:Y(`toast.startFailed`,{id:t})}),stop:(e,t)=>p(()=>YN(e,t,`stop`),{title:Y(`toast.stopFailed`,{id:t})}),restart:(e,t)=>p(()=>YN(e,t,`restart`),{title:Y(`toast.restartFailed`,{id:t})}),startAll:e=>p(()=>ZN(e),{title:Y(`toast.startAllFailed`),success:Y(`toast.startAllStarted`)}),stopOrphan:(e,t)=>p(()=>XN(e,t),{title:Y(`toast.stopOrphanFailed`,{id:t}),success:Y(`toast.stopOrphanDone`)}),stopAll:(e,t={})=>p(()=>$N(e,t),{title:Y(`toast.stopAllFailed`),success:Y(t.withPersistent===!0?`toast.stopAllWithPersistent`:`toast.stopAllStarted`)}),setAutostart:(e,t,n)=>p(()=>tP(e,t,{autostart:n}),{title:Y(`toast.autostartFailed`,{id:t})}),setEnabled:(e,t,n)=>p(()=>tP(e,t,{enabled:n}),{title:Y(`toast.changeFailed`,{id:t})}),freePort:(e,t)=>p(()=>QN(e,t),{title:Y(`toast.freePortFailed`,{id:t}),success:e=>e.free?Y(`toast.portFree`,{port:e.port,id:t}):Y(`toast.portHeld`,{port:e.port})}),setBind:(e,t,n)=>{let r=TA(n);return r===null?(IF.failure(Y(`toast.bindFailed`,{id:t}),Y(`toast.bindInvalid`,{bind:n})),Promise.resolve(void 0)):p(()=>tP(e,t,{bind:r}),{title:Y(`toast.bindFailed`,{id:t})})},saveConfig:(e,t,n)=>p(()=>tP(e,t,n),{title:Y(`toast.saveServerFailed`,{id:t}),success:Y(`toast.serverUpdated`,{id:t})}),saveGlobalSettings:e=>p(()=>jN(e),{title:Y(`toast.saveSettingsFailed`)}),saveWorkspaceSettings:(e,t)=>p(()=>MN(e,t),{title:Y(`toast.saveSettingsFailed`)}),clearLogs:(e,t)=>p(async()=>{await eP(e,t),WF(wM(e,t))},{title:Y(`toast.clearLogsFailed`,{id:t}),success:Y(`toast.logsCleared`)}),create:(e,t)=>p(()=>rP(e,t),{title:Y(`toast.addServerFailed`),success:Y(`toast.serverAdded`)}),remove:(e,t)=>p(async()=>{await nP(e,t),ZF(e,t),LF.delete(wM(e,t)),FF.delete(wM(e,t))},{title:Y(`toast.removeServerFailed`,{id:t}),success:Y(`toast.serverRemoved`,{id:t})})}}var nI=`hh.theme`;function rI(){try{let e=localStorage.getItem(nI);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var iI=k(rI()),aI=k(typeof matchMedia<`u`&&matchMedia(`(prefers-color-scheme: dark)`).matches),oI=!1;function sI(){oI||typeof matchMedia>`u`||(oI=!0,matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,e=>{aI.value=e.matches,lI()}))}var cI=W(()=>iI.value===`system`?aI.value:iI.value===`dark`);function lI(){typeof document<`u`&&document.documentElement.classList.toggle(`dark`,cI.value)}function uI(){sI(),lI();function e(e){iI.value=e;try{localStorage.setItem(nI,e)}catch{}lI()}return{preference:iI,isDark:cI,setPreference:e,cycle(){e(iI.value===`light`?`dark`:iI.value===`dark`?`system`:`light`)}}}var dI=`hh.workspace`;function fI(){try{return localStorage.getItem(dI)}catch{return null}}function pI(e){try{e===null?localStorage.removeItem(dI):localStorage.setItem(dI,e)}catch{}}var mI=k(fI()),hI=k(!1);function gI(){let e=tI(),t=fP(),n=W(()=>e.appState.value?.workspaces??[]),r=W(()=>{let e=n.value;return e.find(e=>e.id===mI.value)??e[0]??null}),i=W(()=>r.value?.id??``);M([n,mI],()=>{let e=n.value;if(e.length===0)return;let t=e.find(e=>e.id===mI.value)?.id??e[0].id;t!==mI.value&&(mI.value=t,pI(t))},{immediate:!0});function a(e){mI.value=e,pI(e)}let o=W(()=>r.value?.servers??[]),s=W(()=>r.value?.defaults??null),c=W(()=>r.value?.logs??null),l=W(()=>r.value?.notifications??null),u=W(()=>r.value?.configError??null),d=W(()=>r.value?.configWarnings??[]),f=W(()=>r.value?.logsDir??null),p=W(()=>r.value?.serverCount??0),m=W(()=>r.value?.runningCount??0),h=W(()=>r.value?.crashedCount??0);function g(e){return o.value.find(t=>t.id===e)}function _(t){return e.seriesOf(i.value,t)}async function v(n){hI.value=!0;try{let r=await ON(n.trim().length>0?{label:n.trim()}:{});return await e.refresh(Y(`toast.readWorkspacesFailed`)),a(r.id),t.success(Y(`toast.workspaceCreated`,{workspace:r.label})),r}catch(e){t.failure(Y(`toast.workspaceCreateFailed`),CM(e));return}finally{hI.value=!1}}async function y(n,r){try{return await kN(n,r.trim()),await e.refresh(Y(`toast.readWorkspacesFailed`)),t.success(Y(`toast.workspaceRenamed`)),!0}catch(e){return t.failure(Y(`toast.workspaceRenameFailed`),CM(e)),!1}}async function b(n){try{return await AN(n),await e.refresh(Y(`toast.readWorkspacesFailed`)),t.success(Y(`toast.workspaceDeleted`)),!0}catch(e){return t.failure(Y(`toast.workspaceDeleteFailed`),CM(e)),!1}}return{workspaces:n,selectedId:rn(mI),selected:r,activeId:i,creating:rn(hI),select:a,create:v,rename:y,remove:b,servers:o,serverById:g,seriesOf:_,defaults:s,logsConfig:c,notifications:l,configError:u,configWarnings:d,logsDir:f,serverCount:p,runningCount:m,crashedCount:h,refresh:e.refresh,start:t=>e.start(i.value,t),stop:t=>e.stop(i.value,t),restart:t=>e.restart(i.value,t),startAll:()=>e.startAll(i.value),stopAll:(t={})=>e.stopAll(i.value,t),setEnabled:(t,n)=>e.setEnabled(i.value,t,n),setAutostart:(t,n)=>e.setAutostart(i.value,t,n),setBind:(t,n)=>e.setBind(i.value,t,n),freePort:t=>e.freePort(i.value,t),clearLogs:t=>e.clearLogs(i.value,t),saveConfig:(t,n)=>e.saveConfig(i.value,t,n),createServer:t=>e.create(i.value,t),removeServer:t=>e.remove(i.value,t)}}function _I(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=_I(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function vI(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=_I(e))&&(r&&(r+=` `),r+=t);return r}var yI=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},bI=(e,t)=>({classGroupId:e,validator:t}),xI=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),SI=`-`,CI=[],wI=`arbitrary..`,TI=e=>{let t=OI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return DI(e);let n=e.split(SI);return EI(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?yI(i,t):t:i||CI}return n[e]||CI}}},EI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=EI(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(SI):e.slice(t).join(SI),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},DI=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?wI+r:void 0})(),OI=e=>{let{theme:t,classGroups:n}=e;return kI(n,t)},kI=(e,t)=>{let n=xI();for(let r in e){let i=e[r];AI(i,n,r,t)}return n},AI=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];jI(i,t,n,r)}},jI=(e,t,n,r)=>{typeof e==`string`?MI(e,t,n):typeof e==`function`?NI(e,t,n,r):PI(e,t,n,r)},MI=(e,t,n)=>{let r=e===``?t:FI(t,e);r.classGroupId=n},NI=(e,t,n,r)=>{II(e)?AI(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(bI(n,e)))},PI=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];AI(o,FI(t,a),n,r)}},FI=(e,t)=>{let n=e,r=t.split(SI),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=xI(),n.nextPart.set(t,i)),n=i}return n},II=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,LI=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},RI=`!`,zI=`:`,BI=[],VI=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),HI=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===zI){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(RI)?(c=s.slice(0,-1),l=!0):s.startsWith(RI)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return VI(t,l,c,u)};if(t){let e=t+zI,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):VI(BI,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},UI=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},WI=e=>({cache:LI(e.cacheSize),parseClassName:HI(e),sortModifiers:UI(e),postfixLookupClassGroupIds:GI(e),...TI(e)}),GI=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},KI=/\s+/,qI=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(KI),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+RI:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},JI=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=YI(n))&&(i&&(i+=` `),i+=r);return i},YI=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=YI(e[r]))&&(n&&(n+=` `),n+=t);return n},XI=(e,...t)=>{let n,r,i,a,o=o=>(n=WI(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=qI(e,n);return i(e,a),a};return a=o,(...e)=>a(JI(...e))},ZI=[],QI=e=>{let t=t=>t[e]||ZI;return t.isThemeGetter=!0,t.themeKey=e,t},$I=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,eL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,nL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,iL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,aL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sL=e=>tL.test(e),cL=e=>!!e&&!Number.isNaN(Number(e)),lL=e=>!!e&&Number.isInteger(Number(e)),uL=e=>e.endsWith(`%`)&&cL(e.slice(0,-1)),dL=e=>nL.test(e),fL=()=>!0,pL=e=>rL.test(e)&&!iL.test(e),mL=()=>!1,hL=e=>aL.test(e),gL=e=>oL.test(e),_L=e=>!X(e)&&!Z(e),vL=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),yL=e=>PL(e,RL,mL),X=e=>$I.test(e),bL=e=>PL(e,zL,pL),xL=e=>PL(e,BL,cL),SL=e=>PL(e,HL,fL),CL=e=>PL(e,VL,mL),wL=e=>PL(e,IL,mL),TL=e=>PL(e,LL,gL),EL=e=>PL(e,UL,hL),Z=e=>eL.test(e),DL=e=>FL(e,zL),OL=e=>FL(e,VL),kL=e=>FL(e,IL),AL=e=>FL(e,RL),jL=e=>FL(e,LL),ML=e=>FL(e,UL,!0),NL=e=>FL(e,HL,!0),PL=(e,t,n)=>{let r=$I.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},FL=(e,t,n=!1)=>{let r=eL.exec(e);return r?r[1]?t(r[1]):n:!1},IL=e=>e===`position`||e===`percentage`,LL=e=>e===`image`||e===`url`,RL=e=>e===`length`||e===`size`||e===`bg-size`,zL=e=>e===`length`,BL=e=>e===`number`,VL=e=>e===`family-name`,HL=e=>e===`number`||e===`weight`,UL=e=>e===`shadow`,WL=XI(()=>{let e=QI(`color`),t=QI(`font`),n=QI(`text`),r=QI(`font-weight`),i=QI(`tracking`),a=QI(`leading`),o=QI(`breakpoint`),s=QI(`container`),c=QI(`spacing`),l=QI(`radius`),u=QI(`shadow`),d=QI(`inset-shadow`),f=QI(`text-shadow`),p=QI(`drop-shadow`),m=QI(`blur`),h=QI(`perspective`),g=QI(`aspect`),_=QI(`ease`),v=QI(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[sL,`full`,`auto`,...w()],ee=()=>[lL,`none`,`subgrid`,Z,X],te=()=>[`auto`,{span:[`full`,lL,Z,X]},lL,Z,X],ne=()=>[lL,`auto`,Z,X],re=()=>[`auto`,`min`,`max`,`fr`,Z,X],ie=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ae=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],oe=()=>[`auto`,...w()],se=()=>[sL,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ce=()=>[s,sL,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],le=()=>[sL,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],E=()=>[e,Z,X],ue=()=>[...b(),kL,wL,{position:[Z,X]}],de=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],fe=()=>[`auto`,`cover`,`contain`,AL,yL,{size:[Z,X]}],pe=()=>[uL,DL,bL],me=()=>[``,`none`,`full`,l,Z,X],he=()=>[``,cL,DL,bL],ge=()=>[`solid`,`dashed`,`dotted`,`double`],_e=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ve=()=>[cL,uL,kL,wL],ye=()=>[``,`none`,m,Z,X],be=()=>[`none`,cL,Z,X],xe=()=>[`none`,cL,Z,X],D=()=>[cL,Z,X],Se=()=>[sL,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[dL],breakpoint:[dL],color:[fL],container:[dL],"drop-shadow":[dL],ease:[`in`,`out`,`in-out`],font:[_L],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[dL],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[dL],shadow:[dL],spacing:[`px`,cL],text:[dL],"text-shadow":[dL],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,sL,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[vL],columns:[{columns:[cL,`auto`,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[lL,`auto`,Z,X]}],basis:[{basis:[sL,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[cL,sL,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,cL,Z,X]}],shrink:[{shrink:[``,cL,Z,X]}],order:[{order:[lL,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ie(),`normal`]}],"justify-items":[{"justify-items":[...ae(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ae()]}],"align-content":[{content:[`normal`,...ie()]}],"align-items":[{items:[...ae(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ae(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...ae(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ae()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:se()}],"inline-size":[{inline:[`auto`,...ce()]}],"min-inline-size":[{"min-inline":[`auto`,...ce()]}],"max-inline-size":[{"max-inline":[`none`,...ce()]}],"block-size":[{block:[`auto`,...le()]}],"min-block-size":[{"min-block":[`auto`,...le()]}],"max-block-size":[{"max-block":[`none`,...le()]}],w:[{w:[s,`screen`,...se()]}],"min-w":[{"min-w":[s,`screen`,`none`,...se()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...se()]}],h:[{h:[`screen`,`lh`,...se()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...se()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...se()]}],"font-size":[{text:[`base`,n,DL,bL]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,NL,SL]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,uL,X]}],"font-family":[{font:[OL,CL,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[cL,`none`,Z,xL]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ge(),`wavy`]}],"text-decoration-thickness":[{decoration:[cL,`from-font`,`auto`,Z,bL]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[cL,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[lL,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},lL,Z,X],radial:[``,Z,X],conic:[``,lL,Z,X]},jL,TL]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:me()}],"rounded-s":[{"rounded-s":me()}],"rounded-e":[{"rounded-e":me()}],"rounded-t":[{"rounded-t":me()}],"rounded-r":[{"rounded-r":me()}],"rounded-b":[{"rounded-b":me()}],"rounded-l":[{"rounded-l":me()}],"rounded-ss":[{"rounded-ss":me()}],"rounded-se":[{"rounded-se":me()}],"rounded-ee":[{"rounded-ee":me()}],"rounded-es":[{"rounded-es":me()}],"rounded-tl":[{"rounded-tl":me()}],"rounded-tr":[{"rounded-tr":me()}],"rounded-br":[{"rounded-br":me()}],"rounded-bl":[{"rounded-bl":me()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":he()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ge(),`hidden`,`none`]}],"divide-style":[{divide:[...ge(),`hidden`,`none`]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...ge(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[cL,Z,X]}],"outline-w":[{outline:[``,cL,DL,bL]}],"outline-color":[{outline:E()}],shadow:[{shadow:[``,`inner`,`none`,u,ML,EL]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":[`none`,d,ML,EL]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:he()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[cL,bL]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":[`none`,f,ML,EL]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[cL,Z,X]}],"mix-blend":[{"mix-blend":[..._e(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":_e()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[cL]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[cL]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ye()}],brightness:[{brightness:[cL,Z,X]}],contrast:[{contrast:[cL,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,ML,EL]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:[``,cL,Z,X]}],"hue-rotate":[{"hue-rotate":[cL,Z,X]}],invert:[{invert:[``,cL,Z,X]}],saturate:[{saturate:[cL,Z,X]}],sepia:[{sepia:[``,cL,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[cL,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[cL,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,cL,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[cL,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,cL,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[cL,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[cL,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,cL,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[cL,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[cL,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":[`scale-3d`],skew:[{skew:D()}],"skew-x":[{"skew-x":D()}],"skew-y":[{"skew-y":D()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":[`translate-none`],zoom:[{zoom:[lL,Z,X]}],accent:[{accent:E()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...E()]}],"stroke-w":[{stroke:[cL,DL,bL,xL]}],stroke:[{stroke:[`none`,...E()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return WL(vI(e))}var GL={stopped:{labelKey:`status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`status.running`,tone:`ok`,transitional:!1},stopping:{labelKey:`status.stopping`,tone:`warn`,transitional:!0},backoff:{labelKey:`status.backoff`,tone:`warn`,transitional:!0},crashed:{labelKey:`status.crashed`,tone:`danger`,transitional:!1},conflict:{labelKey:`status.conflict`,tone:`danger`,transitional:!1}},KL={disabled:{labelKey:`health.disabled`,tone:`neutral`},unknown:{labelKey:`health.unknown`,tone:`neutral`},healthy:{labelKey:`health.healthy`,tone:`ok`},unhealthy:{labelKey:`health.unhealthy`,tone:`danger`}},qL={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},JL={ok:`bg-ok-soft text-ok border-ok/25`,warn:`bg-warn-soft text-warn border-warn/25`,danger:`bg-danger-soft text-danger border-danger/25`,info:`bg-info-soft text-info border-info/25`,neutral:`bg-hover text-muted border-line`,accent:`bg-accent-soft text-accent border-accent/25`},YL={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,info:`bg-info`,neutral:`bg-faint`,accent:`bg-accent`};function XL(e,t){return e===`crashed`||e===`conflict`||t===`unhealthy`?`danger`:e===`starting`||e===`stopping`||e===`backoff`?`warn`:e===`running`?`ok`:`neutral`}var ZL={start:`history.start`,exit:`history.exit`,crash:`history.crash`,"forced-restart":`history.forcedRestart`,unhealthy:`history.unhealthy`,recovered:`history.recovered`},QL={start:`ok`,exit:`neutral`,crash:`danger`,"forced-restart":`warn`,unhealthy:`warn`,recovered:`info`};function $L(e,t){let n=t?.authRequired===!0,r=t?.authenticated===!0;return n&&!r&&e.name!==`login`?{name:`login`,...e.fullPath===`/`?{}:{query:{next:e.fullPath}}}:e.name===`login`&&r?{name:`global-overview`,replace:!0}:null}var eR={viewBox:`0 0 80 80`,class:`size-full -rotate-0`},tR=[`stroke-dasharray`],nR=[`stroke-dasharray`],rR={class:`absolute inset-0 grid place-items-center`},iR={class:`font-mono text-sm font-semibold tabular-nums text-ink`},aR={class:`text-2xs font-medium text-faint`},oR=34,sR=.75,cR=N({__name:`Gauge`,props:{value:{},label:{},display:{default:void 0},size:{default:74},tone:{default:void 0},warnAt:{default:75},dangerAt:{default:90}},setup(e){let t=e,n=2*Math.PI*oR,r=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(1,Math.max(0,t.value/100))*sR),i=W(()=>t.tone?t.tone:t.value===null||!Number.isFinite(t.value)?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),a={ok:`stroke-ok`,warn:`stroke-warn`,danger:`stroke-danger`,info:`stroke-info`,neutral:`stroke-faint`,accent:`stroke-accent`};return(e,o)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center gap-1`))},[B(`div`,{class:`relative`,style:_e({width:`${t.size}px`,height:`${t.size}px`})},[(L(),R(`svg`,eR,[B(`circle`,{cx:`40`,cy:`40`,r:oR,fill:`none`,class:`stroke-line-soft`,"stroke-width":6,"stroke-dasharray":`${sR*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,8,tR),B(`circle`,{cx:`40`,cy:`40`,r:oR,fill:`none`,class:D([a[i.value],`transition-[stroke-dasharray] duration-300 ease-out`]),"stroke-width":6,"stroke-dasharray":`${r.value*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,10,nR)])),B(`div`,rR,[B(`span`,iR,O(t.display??(t.value===null?`—`:`${Math.round(t.value)}%`)),1)])],4),B(`span`,aR,O(t.label),1)],2))}}),lR=N({__name:`Meter`,props:{value:{},warnAt:{default:75},dangerAt:{default:90},height:{default:`h-1.5`},class:{default:void 0}},setup(e){let t=e,n=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(100,Math.max(0,t.value))),r=W(()=>t.value===null?`neutral`:t.value>=t.dangerAt?`danger`:t.value>=t.warnAt?`warn`:`ok`),i={ok:`bg-ok/80`,warn:`bg-warn/85`,danger:`bg-danger/85`,info:`bg-info/80`,neutral:`bg-faint/60`,accent:`bg-accent/80`};return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`w-full overflow-hidden rounded-full bg-line-soft`,t.height,t.class))},[B(`div`,{class:D(A(Q)(`h-full rounded-full transition-[width] duration-300 ease-out`,i[r.value])),style:_e({width:`${n.value}%`})},null,6)],2))}}),uR={key:0,class:`grid size-10 place-items-center rounded-full border border-line bg-panel-2 text-faint`},dR={class:`max-w-sm space-y-1`},fR={class:`text-sm font-medium text-ink`},pR={key:0,class:`text-xs leading-relaxed text-muted`},mR={key:1,class:`flex items-center gap-2`},hR=N({__name:`EmptyState`,props:{title:{},description:{default:void 0},compact:{type:Boolean,default:!1}},setup(e){return(e,t)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center justify-center gap-3 text-center`,e.$props.compact?`px-4 py-8`:`px-6 py-14`))},[e.$slots.icon?(L(),R(`div`,uR,[F(e.$slots,`icon`)])):U(``,!0),B(`div`,dR,[B(`p`,fR,O(e.$props.title),1),e.$props.description?(L(),R(`p`,pR,O(e.$props.description),1)):U(``,!0)]),e.$slots.action?(L(),R(`div`,mR,[F(e.$slots,`action`)])):U(``,!0)],2))}});function gR(e){return e===null||!Number.isFinite(e)?`—`:`${(e*100).toFixed(e>=.999?0:1)}%`}var _R={span:(e,t,n)=>n===null?`${e}${t}`:`${e}${t} ${n.value}${n.unit}`,now:()=>`now`,ahead:(e,t)=>`in ${e}${t}`,ago:(e,t)=>`${e}${t} ago`,never:()=>`never`};function vR(e,t=_R){if(!Number.isFinite(e)||e<0)return`—`;let n=Math.floor(e/1e3);if(n<60)return t.span(n,`s`,null);let r=Math.floor(n/60);if(r<60)return t.span(r,`m`,{value:n%60,unit:`s`});let i=Math.floor(r/60);return i<24?t.span(i,`h`,{value:r%60,unit:`m`}):t.span(Math.floor(i/24),`d`,{value:i%24,unit:`h`})}function yR(e,t,n=_R){let r=Math.max(0,e-t);return r<1e3?n.now():r<6e4?n.ahead(Math.ceil(r/1e3),`s`):n.ahead(Math.ceil(r/6e4),`m`)}function bR(e,t,n=_R){if(e===null)return n.never();let r=Math.max(0,t-e);return r<6e4?n.ago(Math.floor(r/1e3),`s`):r<36e5?n.ago(Math.floor(r/6e4),`m`):r<864e5?n.ago(Math.floor(r/36e5),`h`):n.ago(Math.floor(r/864e5),`d`)}var xR=1e3;function SR(e){return Math.round(e/xR)}function CR(e){return Math.round(e)*xR}function wR(){return ZP(xF())?.iso}var TR=new Map,ER=new Map,DR={s:`s`,m:`m`,h:`h`,d:`d`};function OR(){return xF()===`en`}function kR(){let e=wR(),t=OR()?`narrow`:`short`,n=`${e??``}:${t}`,r=TR.get(n);return r===void 0&&(r=new Intl.RelativeTimeFormat(e,{numeric:`always`,style:t}),TR.set(n,r)),r}function AR(e,t){if(OR())return`${e}${DR[t]}`;let n={s:`second`,m:`minute`,h:`hour`,d:`day`},r=wR(),i=`${r??``}:${t}`,a=ER.get(i);return a===void 0&&(a=new Intl.NumberFormat(r,{style:`unit`,unit:n[t],unitDisplay:`short`}),ER.set(i,a)),a.format(e)}function jR(e,t,n){return kR().format(n*e,{s:`second`,m:`minute`,h:`hour`,d:`day`}[t])}var MR={span:(e,t,n)=>n===null?AR(e,t):`${AR(e,t)} ${AR(n.value,n.unit)}`,now:()=>Y(`common.now`),ahead:(e,t)=>jR(e,t,1),ago:(e,t)=>jR(e,t,-1),never:()=>Y(`common.never`)};function NR(e){return vR(e,MR)}function PR(e,t){return yR(e,t,MR)}function FR(e,t){return bR(e,t,MR)}function IR(e){let t=new Date(e);return`${t.toLocaleTimeString(wR(),{hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function LR(e){return new Date(e).toLocaleString(wR(),{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function RR(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`:`—`}function zR(e){if(e===null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t<1e3?`${e} B`:t<1e6?`${(e/1e3).toFixed(0)} kB`:t<1e9?`${(e/1e3/1e3).toFixed(1)} MB`:`${(e/1e3/1e3/1e3).toFixed(2)} GB`}function BR(e){return e===null||!Number.isFinite(e)?`—`:e>=100?`${Math.round(e)}%`:`${e.toFixed(1)}%`}function VR(e){return e===void 0?Y(`common.unset`):typeof e==`string`?e:JSON.stringify(e)}var HR={key:1,class:`space-y-4`},UR={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},WR={class:`grid grid-cols-2 gap-x-4 gap-y-2 border-t border-line-soft pt-3 sm:grid-cols-4`},GR={class:`flex items-center gap-1 text-2xs text-faint`},KR={class:`font-mono text-xs text-ink`},qR=[`title`],JR={class:`font-mono text-xs tabular-nums text-ink`},YR={class:`font-mono text-2xs tabular-nums text-faint`},XR={class:`flex items-center gap-1 text-2xs text-faint`},ZR={class:`font-mono text-xs text-ink`},QR={class:`flex items-center gap-1 text-2xs text-faint`},$R={class:`font-mono text-xs text-ink`},ez={class:`space-y-2 border-t border-line-soft pt-3`},tz={class:`flex items-center gap-1.5 text-2xs font-medium text-faint`},nz={class:`flex items-baseline justify-between gap-2`},rz=[`title`],iz={class:`shrink-0 font-mono text-2xs tabular-nums text-faint`},az={key:0,class:`space-y-1 rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2`},oz={class:`text-2xs font-medium text-danger`},sz=N({__name:`HostVitalsPanel`,props:{host:{},now:{}},setup(e){let t=e,n=W(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),r=W(()=>t.host?.loadAvg.map(e=>e.toFixed(2)).join(` `)??`—`),i=W(()=>t.host?.cpuUsedPercent??null);return(e,a)=>!t.host||!t.host.enabled?(L(),z(hR,{key:0,compact:``,title:A(Y)(`host.samplingOff`),description:A(Y)(`host.samplingOffDescription`)},null,8,[`title`,`description`])):(L(),R(`div`,HR,[B(`div`,UR,[V(cR,{value:i.value,label:A(Y)(`host.cpuUsage`),size:72,"warn-at":80,"danger-at":95},null,8,[`value`,`label`]),V(cR,{value:t.host.memoryUsedPercent,label:A(Y)(`common.memory`),size:72},null,8,[`value`,`label`]),V(cR,{value:t.host.swapUsedPercent,label:A(Y)(`host.swap`),size:72,"warn-at":50},null,8,[`value`,`label`]),V(cR,{value:t.host.tempCelsius===null?null:t.host.tempCelsius/85*100,label:A(Y)(`host.cpuTemp`),display:t.host.tempCelsius===null?A(Y)(`common.notAvailable`):`${Math.round(t.host.tempCelsius)}°C`,size:72},null,8,[`value`,`label`,`display`])]),B(`dl`,WR,[B(`div`,null,[B(`dt`,GR,[V(A(dy),{class:`size-3`}),H(O(A(Y)(`host.cpus`)),1)]),B(`dd`,KR,O(t.host.cpus),1)]),B(`div`,null,[B(`dt`,{class:`text-2xs text-faint`,title:A(Y)(`host.loadHint`)},O(A(Y)(`host.loadAverage`)),9,qR),B(`dd`,JR,O(r.value),1),B(`dd`,YR,O(n.value===null?`—`:`${n.value.toFixed(2)} ${A(Y)(`host.perCpu`)}`),1)]),B(`div`,null,[B(`dt`,XR,[V(A(Dy),{class:`size-3`}),H(O(A(Y)(`host.memoryUsed`)),1)]),B(`dd`,ZR,O(t.host.memoryUsedPercent.toFixed(0))+`% `,1)]),B(`div`,null,[B(`dt`,QR,[V(A(Zy),{class:`size-3`}),H(O(A(Y)(`host.sampled`)),1)]),B(`dd`,$R,O(A(FR)(t.host.sampledAt,t.now)),1)])]),B(`div`,ez,[B(`p`,tz,[V(A(yy),{class:`size-3`}),H(O(A(Y)(`host.filesystems`)),1)]),(L(!0),R(I,null,P(t.host.disks,e=>(L(),R(`div`,{key:e.path,class:`space-y-1`},[B(`div`,nz,[B(`span`,{class:`truncate font-mono text-2xs text-muted`,title:e.path},O(e.path),9,rz),B(`span`,iz,O(A(RR)(e.totalBytes-e.freeBytes))+` / `+O(A(RR)(e.totalBytes))+` · `+O(e.usedPercent.toFixed(0))+`% `,1)]),V(lR,{value:e.usedPercent},null,8,[`value`])]))),128))]),t.host.alerts.length>0?(L(),R(`div`,az,[B(`p`,oz,O(A(Y)(`host.thresholdsBreached`)),1),(L(!0),R(I,null,P(t.host.alerts,e=>(L(),R(`p`,{key:e,class:`text-2xs text-danger`},O(e),1))),128))])):U(``,!0)]))}}),cz={key:1,class:`flex flex-col`},lz={class:`min-w-0 flex-1`},uz={class:`flex items-baseline gap-1.5`},dz={class:`truncate text-xs font-medium text-ink`},fz={key:0,class:`text-faint`},pz=[`title`],mz={key:0,class:`text-muted`},hz={class:`shrink-0 pt-0.5 text-2xs text-faint`},gz=N({__name:`ActivityFeed`,props:{servers:{},now:{},limit:{default:12},serverId:{default:void 0},qualify:{type:Boolean,default:!1}},setup(e){let t=e,n={start:Py,exit:Jy,crash:iy,"forced-restart":zy,unhealthy:eb,recovered:ay},r=gI();function i(e){return r.workspaces.value.find(t=>t.id===e)?.label??e}let a=W(()=>{let e=[];for(let n of t.servers){if(t.serverId!==void 0&&n.id!==t.serverId)continue;let r=n.workspaceId??``;for(let t of n.history.events)e.push({...t,label:n.config.label??n.id,workspaceId:r,workspaceLabel:i(r)})}return e.sort((e,t)=>t.ts-e.ts).slice(0,t.limit)});return(e,r)=>{let i=ha(`RouterLink`);return a.value.length===0?(L(),z(hR,{key:0,compact:``,title:A(Y)(`activity.emptyTitle`),description:A(Y)(`activity.emptyDescription`)},null,8,[`title`,`description`])):(L(),R(`ol`,cz,[(L(!0),R(I,null,P(a.value,(e,r)=>(L(),R(`li`,{key:`${e.serverId}-${e.ts}-${r}`,class:D([`flex items-start gap-2.5 border-line-soft py-2`,r>0&&`border-t`])},[(L(),z(_a(n[e.type]),{class:D(A(Q)(`mt-0.5 size-3.5 shrink-0`,A(qL)[A(QL)[e.type]]))},null,8,[`class`])),B(`div`,lz,[B(`p`,uz,[B(`span`,dz,O(A(Y)(A(ZL)[e.type])),1),V(i,{to:A(D2)(e.workspaceId,`servers`,e.serverId),class:`truncate text-2xs text-muted hover:text-accent`,title:t.qualify?`${e.workspaceLabel}/${e.label}`:e.label},{default:j(()=>[t.qualify?(L(),R(`span`,fz,O(e.workspaceLabel)+`/`,1)):U(``,!0),H(O(e.label),1)]),_:2},1032,[`to`,`title`])]),B(`p`,{class:`mt-0.5 truncate font-mono text-2xs text-faint`,title:e.detail},[H(O(e.detail)+` `,1),e.runtimeMs===void 0?U(``,!0):(L(),R(`span`,mz,` · `+O(A(Y)(`activity.ran`,{duration:A(NR)(e.runtimeMs)})),1))],8,pz)]),B(`span`,hz,O(A(FR)(e.ts,t.now)),1)],2))),128))]))}}}),_z=[`restart`,`health`,`stop`];function vz(e,t){return JSON.stringify(yz(e))===JSON.stringify(yz(t))}function yz(e){if(Array.isArray(e))return e.map(yz);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!=null&&(t[n]=yz(r))}return t}return e??null}function bz(e,t,n=[]){let r={};for(let[i,a]of Object.entries(t))if(n.includes(i)){let t=e[i]??{},n={};for(let[e,r]of Object.entries(a??{}))vz(t[e],r)||(n[e]=r);Object.keys(n).length>0&&(r[i]=n)}else vz(e[i],a)||(r[i]=a);return r}function xz({filled:e,draft:t,live:n,key:r}){if(e===void 0)return[];let i=new Map(n.map(e=>[r(e),e])),a=new Map(t.map(e=>[r(e),e])),o=[];for(let t of e){let e=r(t),n=a.get(e),s=i.get(e);n!==void 0&&s!==void 0&&!vz(t,n)&&!vz(t,s)&&o.push(e)}return o}function Sz({filled:e,draft:t,live:n,key:r}){if(e===void 0||vz(e,t))return null;let i=new Set(e.map(r)),a=n.filter(e=>!i.has(r(e))&&!t.some(t=>r(t)===r(e)));return[...t,...a]}function Cz(e,t){let n=e;return bz({...n,label:n.label??``},t,_z)}function wz(e,t=``){return typeof e!=`object`||!e||Array.isArray(e)?[{path:t,value:e}]:Object.entries(e).flatMap(([e,n])=>wz(n,t.length===0?e:`${t}.${e}`))}function Tz(e,t){let n=new Map(wz(t).map(e=>[e.path,e.value]));return wz(e).map(e=>({path:e.path,from:n.get(e.path),to:e.value}))}function Ez(e){let t=0;for(let n of Object.values(e))t+=typeof n==`object`&&n&&!Array.isArray(n)?Ez(n):1;return t}function Dz(e){return e.selected&&(e.leaves.length===0||e.leaves.some(e=>e.selected))}function Oz(e){return e.selected&&(e.leaves.length===0||e.leaves.every(e=>e.selected))}function kz(e){return e.flatMap(e=>Oz(e)?[e.id]:Dz(e)?e.leaves.filter(e=>e.selected).map(e=>e.id):[])}function Az(e){return e.flatMap(e=>Dz(e)?Oz(e)?[]:e.leaves.filter(e=>!e.selected).map(e=>e.id):[e.id])}function jz(e,t){return e.length===0||kz(e).length===0?{kind:`nothing`}:Az(e).length===0?{kind:`everything`}:{kind:`scope`,scope:{mode:t,ids:t===`only`?kz(e):Az(e)}}}function Mz(e,t){return e==null||t==null?(e??null)===(t??null):e.mode===t.mode&&[...e.ids].sort().join(`
39
+ fn("string", ":", "number")(s => s.length)`,qD=class extends ix{$;constructor(e){super((...t)=>new JD(e)(...t),{bind:e}),this.$=e}in(e){return new JD(this.$,e===void 0?void 0:this.$.parse(e))}at(e,t){return new JD(this.$).at(e,t)}case(e,t){return new JD(this.$).case(e,t)}},JD=class extends ix{$;in;key;branches=[];constructor(e,t){super(e=>this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.parse(e),t]))),this.$=e,this.in=t}at(e,t){return this.key&&K(ZD),this.branches.length&&K(XD),this.key=e,t?this.match(t):this}case(e,t){return this.caseEntry(this.$.parse(e),t)}caseEntry(e,t){let n=(this.key?this.$.parse({[this.key]:e}):e).pipe(t);return this.branches.push(n),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([e,t])=>e==="default"?[e,t]:[this.$.node(`unit`,{unit:e}),t]))}caseEntries(e){for(let t=0;t<e.length;t++){let[n,r]=e[t];if(n==="default")return t!==e.length-1&&K(`default may only be specified as the last key of a switch definition`),this.default(r);if(typeof r!=`function`)return K(`Value for case "${n}" must be a function (was ${hb(r)})`);this.caseEntry(n,r)}return this}default(e){typeof e==`function`&&this.case(jE.unknown,e);let t={branches:this.branches,ordered:!0};(e===`never`||e===`assert`)&&(t.meta={onFail:YD});let n=this.$.node(`union`,t);if(!this.in)return this.$.finalize(n);let r=this.in.pipe(n);return(e===`never`||e===`assert`)&&(r=r.configureReferences({onFail:YD},`self`)),this.$.finalize(r)}},YD=e=>e.throw(),XD=`A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')`,ZD=`At most one key matcher may be specified per expression`,QD=(e,t)=>{if(Kb(e)){if(e[1]===`=`)return[t.$.parseOwnDefinitionFormat(e[0],t),`=`,e[2]];if(e[1]===`?`)return[t.$.parseOwnDefinitionFormat(e[0],t),`?`]}return FO(e,t)},$D=`Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`,eO=`Only required keys may specify default values, e.g. { value: 'number = 0' }`,tO=(e,t)=>{let n,r={},i=Pb(e);for(let[e,a]of i){let i=aO(e);if(i.kind===`spread`){if(!Nb(r))return K(iO);let e=t.$.parseOwnDefinitionFormat(a,t);if(e.equals(jE.object))continue;if(!e.hasKind(`intersection`)||!e.basis?.equals(jE.object))return K(oO(e.expression));n=e.structure;continue}if(i.kind===`undeclared`){a!==`reject`&&a!==`delete`&&a!==`ignore`&&K(rO(a)),r.undeclared=a;continue}let o=QD(a,t),s=i;if(i.kind===`required`){Kb(o)?nO(r,`optional`,o[1]===`=`?{key:i.normalized,value:o[0],default:o[2]}:{key:i.normalized,value:o[0]},t):nO(r,`required`,{key:i.normalized,value:o},t);continue}if(Kb(o)&&(o[1]===`?`&&K($D),o[1]===`=`&&K(eO)),i.kind===`optional`){nO(r,`optional`,{key:i.normalized,value:o},t);continue}let c=qT(t.$.parseOwnDefinitionFormat(s.normalized,t),o,t.$);c.index&&(r.index=cb(r.index,c.index)),c.required&&(r.required=cb(r.required,c.required))}let a=t.$.node(`structure`,r);return t.$.parseSchema({domain:`object`,structure:n?.merge(a)??a})},nO=(e,t,n,r)=>{e[t]=cb(e[t],r.$.node(t,n))},rO=e=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Kx(e)})`,iO=`Spread operator may only be used as the first key in an object`,aO=e=>typeof e==`symbol`?{kind:`required`,normalized:e}:e[e.length-1]===`?`?e[e.length-2]===`\\`?{kind:`required`,normalized:`${e.slice(0,-2)}?`}:{kind:`optional`,normalized:e.slice(0,-1)}:e[0]===`[`&&e[e.length-1]===`]`?{kind:`index`,normalized:e.slice(1,-1)}:e[0]===`\\`&&e[1]===`[`&&e[e.length-1]===`]`?{kind:`required`,normalized:e.slice(1)}:e===`...`?{kind:`spread`}:e===`+`?{kind:`undeclared`}:{kind:`required`,normalized:e===`\\...`?`...`:e===`\\+`?`+`:e},oO=e=>`Spread operand must resolve to an object literal type (was ${e})`,sO=(e,t)=>xO(e)?bO[e[0]](e,t):yO(e)?vO[e[1]](e,t):null,cO=(e,t)=>t.$.parseOwnDefinitionFormat(e[1],t).keyof(),lO=(e,t)=>{if(e[2]===void 0)return K(lD(e[1],``));let n=t.$.parseOwnDefinitionFormat(e[0],t),r=t.$.parseOwnDefinitionFormat(e[2],t);if(e[1]===`|`)return t.$.node(`union`,{branches:[n,r]});let i=e[1]===`&`?fC(n,r,t.$):pC(n,r,t.$);return i instanceof sC?i.throw():i},uO=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).rawArray(),dO=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).pipe(e[2]):K(fO(`=>`,e[2])),fO=(e,t)=>`${e===`:`?`Narrow`:`Morph`} expression requires a function following '${e}' (was ${typeof t})`,pO=(e,t)=>typeof e[2]==`function`?t.$.parseOwnDefinitionFormat(e[0],t).constrain(`predicate`,e[2]):K(fO(`:`,e[2])),mO=(e,t)=>t.$.parseOwnDefinitionFormat(e[0],t).configure(e[2],e[3]),hO=e=>e,gO=hO({"[]":uO,"?":()=>K(XE)}),_O=hO({"|":lO,"&":lO,":":pO,"=>":dO,"|>":lO,"@":mO,"=":()=>K(ZE)}),vO={...gO,..._O},yO=e=>vO[e[1]]!==void 0,bO=(e=>e)({keyof:cO,instanceof:(e,t)=>{if(typeof e[1]!=`function`)return K(SO(Gb(e[1])));let n=e.slice(1).map(e=>typeof e==`function`?t.$.node(`proto`,{proto:e}):K(SO(Gb(e))));return n.length===1?n[0]:t.$.node(`union`,{branches:n})},"===":(e,t)=>t.$.units(e.slice(1))}),xO=e=>bO[e[0]]!==void 0,SO=e=>`Expected a constructor following 'instanceof' operator (was ${e})`,CO=(e,t)=>{let n=[{}],r=0;for(;r<e.length;){let i=!1;e[r]===`...`&&r<e.length-1&&(i=!0,r++);let a=QD(e[r],t),[o,s,c]=Kb(a)?a:[a];if(r++,i){if(!o.extends(q.intrinsic.Array))return K(kO(o.expression));n=n.flatMap(e=>o.distribute(t=>OO(vS(e),t)))}else n=n.map(e=>s===`?`?TO(e,o):s===`=`?EO(e,o,c):wO(e,o))}return t.$.parseSchema(n.map(e=>Nb(e)?{proto:Array,exactLength:0}:{proto:Array,sequence:e}))},wO=(e,t)=>e.defaultables||e.optionals?K(e.variadic?AT:jO):(e.variadic?e.postfix=cb(e.postfix,t):e.prefix=cb(e.prefix,t),e),TO=(e,t)=>e.variadic?K(MO):(e.optionals=cb(e.optionals,t),e),EO=(e,t,n)=>e.variadic?K(MO):e.optionals?K(NO):(e.defaultables=cb(e.defaultables,[[t,n]]),e),DO=(e,t)=>(e.postfix&&K(AO),e.variadic?e.variadic.equals(t)||K(AO):e.variadic=t.internal,e),OO=(e,t)=>{let n=t.select({method:`find`,kind:`sequence`});if(!n)return DO(e,q.intrinsic.unknown);if(n.prefix)for(let t of n.prefix)wO(e,t);if(n.optionals)for(let t of n.optionals)TO(e,t);if(n.variadic&&DO(e,n.variadic),n.postfix)for(let t of n.postfix)wO(e,t);return e},kO=e=>`Spread element must be an array (was ${e})`,AO=`A tuple may have at most one variadic element`,jO=`A required element may not follow an optional element`,MO=`An optional element may not follow a variadic element`,NO=`A defaultable element may not follow an optional element without a default`,PO=new WeakMap,FO=(e,t)=>{if(typeof e==`string`){if(t.args&&Object.keys(t.args).some(t=>e.includes(t)))return FD(e,t);let n=PO.get(t.$);return n||(n={},PO.set(t.$,n)),n[e]??=FD(e,t)}return mb(e,`object`)?IO(e,t):K(zO(hb(e)))},IO=(e,t)=>{let n=Wb(e);switch(n){case void 0:return bS(e,`root`)?e:`~standard`in e?LO(e,t):tO(e,t);case`Array`:return RO(e,t);case`RegExp`:return t.$.node(`intersection`,{domain:`string`,pattern:e},{prereduced:!0});case`Function`:{let t=nx(e)?e():e;return bS(t,`root`)?t:K(zO(`Function`))}default:return K(zO(n??Kx(e)))}},LO=(e,t)=>t.$.intrinsic.unknown.pipe((t,n)=>{let r=e[`~standard`].validate(t);if(!r.issues)return r.value;for(let{message:e,path:t}of r.issues)t&&t.length?n.error({problem:lx(e),relativePath:t.map(e=>typeof e==`object`?e.key:e)}):n.error({message:e})}),RO=(e,t)=>sO(e,t)??CO(e,t),zO=e=>`Type definitions must be strings or objects (was ${e})`,BO=class extends ix{constructor(e){let t=Object.assign({errors:KS,hkt:ox,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...t)=>{if(t.length===1)return e.parse(t[0]);if(t.length===2&&typeof t[0]==`string`&&t[0][0]===`<`&&t[0][t[0].length-1]===`>`){let n=t[0].slice(1,-1);return new kC(e.parseGenericParams(n,{}),t[1],e,e,null)}return e.parse(t)},{attach:t})}},VO=q,HO=class e extends uE{get ambientAttachments(){if(VO.typeAttachments)return this.cacheGetter(`ambientAttachments`,Cb(VO.typeAttachments,(e,t)=>[e,this.bindReference(t)]))}preparseOwnAliasEntry(e,t){let n=e.indexOf(`<`);if(n===-1){if(bS(t,`module`)||bS(t,`generic`))return[e,t];let n=this.name===`ark`?e:e===`root`?this.name:`${this.name}.${e}`,r=this.resolvedConfig.keywords?.[n];return r&&(t=[t,`@`,r]),[e,t]}e[e.length-1]!==`>`&&K(`'>' must be the last character of a generic declaration in a scope`);let r=e.slice(0,n),i=e.slice(n+1,-1);return[r,()=>DC(this.parseGenericParams(i,{alias:r}),t,this)]}parseGenericParams(e,t){return VD(new iS(e),[],this.createParseContext({...t,def:e,prefix:`generic`}))}normalizeRootScopeValue(e){return nx(e)&&!bS(e,`generic`)?e():e}preparseOwnDefinitionFormat(e,t){return{...t,def:e,prefix:t.alias??`type`}}parseOwnDefinitionFormat(e,t){!(t.alias&&t.alias in this.aliases)&&!t.args&&(t.args={this:t.id});let n=FO(e,t);if(Kb(n)){if(n[1]===`=`)return K(ZE);if(n[1]===`?`)return K(XE)}return n}unit=e=>this.units([e]);valueOf=e=>this.units(Rb(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node(`proto`,{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(e=>this.parse(e)));and=(...e)=>e.reduce((e,t)=>e.and(this.parse(t)),this.intrinsic.unknown);merge=(...e)=>e.reduce((e,t)=>e.merge(this.parse(t)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new WD(this);match=new qD(this);declare=()=>({type:this.type});define(e){return e}type=new BO(this);static scope=((t,n={})=>new e(t,n));static module=((t,n={})=>e.scope(t,n).export())},UO=Object.assign(HO.scope,{define:e=>e}),WO=HO,GO=class extends ox{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'},KO=EE([`base`,jE.object],[`props`,jE.object])(e=>e.base.merge(e.props),GO),qO=WO.module({Key:jE.key,Merge:KO}),JO=class extends ox{},YO=EE(`element`)(e=>{let t=e.element.exclude(jE.Array),n=t.array();return t.rawOr(n).pipe(rb).distribute(e=>e.assertHasKind(`morph`).declareOut(n),wE)},JO),XO=WO.module({root:jE.Array,readonly:`root`,index:jE.nonNegativeIntegerString,liftFrom:YO},{name:`Array`}),ZO=wE([`string`,Rx.FileConstructor]),QO=wE({meta:`an object representing parsed form data`,domain:`object`,index:{signature:`string`,value:ZO.rawOr(ZO.array())}}),$O=WO.module({root:[`instanceof`,FormData],value:ZO,parsed:QO,parse:wE({in:FormData,morphs:e=>{let t={};for(let[n,r]of e)if(n in t){let e=t[n];typeof e==`string`||e instanceof Rx.FileConstructor?t[n]=[e,r]:e.push(r)}else t[n]=r;return t},declaredOut:QO})},{name:`FormData`}),ek=WO.module({Int8:[`instanceof`,Int8Array],Uint8:[`instanceof`,Uint8Array],Uint8Clamped:[`instanceof`,Uint8ClampedArray],Int16:[`instanceof`,Int16Array],Uint16:[`instanceof`,Uint16Array],Int32:[`instanceof`,Int32Array],Uint32:[`instanceof`,Uint32Array],Float32:[`instanceof`,Float32Array],Float64:[`instanceof`,Float64Array],BigInt64:[`instanceof`,BigInt64Array],BigUint64:[`instanceof`,BigUint64Array]},{name:`TypedArray`}),tk={Boolean:1,Number:1,String:1},nk=WO.module({...Cb({...zb,...Vb},(e,t)=>e in tk?[]:[e,[`instanceof`,t]]),Array:XO,TypedArray:ek,FormData:$O}),rk=wE({domain:{domain:`number`,meta:`a number representing a Unix timestamp`},divisor:{rule:1,meta:`an integer representing a Unix timestamp`},min:{rule:-864e13,meta:`a Unix timestamp after -8640000000000000`},max:{rule:864e13,meta:`a Unix timestamp before 8640000000000000`},meta:`an integer representing a safe Unix timestamp`}),ik=wE({domain:`number`,divisor:1}),ak=WO.module({root:jE.number,integer:ik,epoch:rk,safe:wE({domain:{domain:`number`,numberAllowsNaN:!1},min:-(2**53-1),max:2**53-1}),NaN:[`===`,NaN],Infinity:[`===`,1/0],NegativeInfinity:[`===`,-1/0]},{name:`number`}),ok=(e,t,n)=>{let r={domain:`string`,pattern:{rule:e.source,flags:e.flags,meta:t}};return n&&(r.meta={format:n}),TE(`intersection`,r)},sk=ok(wx,`a well-formed integer string`),ck=WO.module({root:sk,parse:wE({in:sk,morphs:(e,t)=>{let n=Number.parseInt(e);return Number.isSafeInteger(n)?n:t.error(`an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER`)},declaredOut:jE.integer})},{name:`string.integer`}),lk=ok(/^[\dA-Fa-f]+$/,`hex characters only`),uk=ok(/^[1-9A-HJ-NP-Za-km-z]+$/,`base58-encoded`),dk=WO.module({root:ok(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,`base64-encoded`),url:ok(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,`base64url-encoded`)},{name:`string.base64`}),fk=ok(/^[A-Z].*$/,`capitalized`),pk=WO.module({root:wE({in:`string`,morphs:e=>e.charAt(0).toUpperCase()+e.slice(1),declaredOut:fk}),preformatted:fk},{name:`string.capitalize`}),mk=wE({domain:`string`,pattern:{meta:`a credit card number`,rule:`^(?:4\\d{12}(?:\\d{3,6})?|5[1-5]\\d{14}|(222[1-9]|22[3-9]\\d|2[3-6]\\d{2}|27[01]\\d|2720)\\d{12}|6(?:011|5\\d\\d)\\d{12,15}|3[47]\\d{13}|3(?:0[0-5]|[68]\\d)\\d{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27]\\d{14}|^(81\\d{14,17}))$`},predicate:{meta:`a credit card number`,predicate:e=>{let t=e.replace(/[ -]+/g,``),n=0,r,i,a=!1;for(let e=t.length-1;e>=0;e--)r=t.substring(e,e+1),i=Number.parseInt(r,10),a?(i*=2,n+=i>=10?i%10+1:i):n+=i,a=!a;return!!(n%10==0&&t)}}}),hk=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,gk=wE({domain:`string`,predicate:{meta:`a parsable date`,predicate:e=>!Number.isNaN(new Date(e).valueOf())}}).assertHasKind(`intersection`),_k=ck.root.internal.narrow((e,t)=>{let n=Number.parseInt(e),r=ak.epoch(n);return r instanceof KS?(t.errors.merge(r),!1):!0}).configure({description:`an integer string representing a safe Unix timestamp`},`self`).assertHasKind(`intersection`),vk=WO.module({root:_k,parse:wE({in:_k,morphs:e=>new Date(Number.parseInt(e)),declaredOut:jE.Date})},{name:`string.date.epoch`}),yk=ok(hk,`an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date`).internal.assertHasKind(`intersection`),bk=WO.module({root:yk,parse:wE({in:yk,morphs:e=>new Date(e),declaredOut:jE.Date})},{name:`string.date.iso`}),xk=WO.module({root:gk,parse:wE({declaredIn:gk,in:`string`,morphs:(e,t)=>{let n=new Date(e);return Number.isNaN(n.valueOf())?t.error(`a parsable date`):n},declaredOut:jE.Date}),iso:bk,epoch:vk},{name:`string.date`}),Sk=ok(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,`an email address`,`email`),Ck=`(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,wk=`(${Ck}[.]){3}${Ck}`,Tk=RegExp(`^${wk}$`),Ek=`(?:[0-9a-fA-F]{1,4})`,Dk=RegExp(`^((?:${Ek}:){7}(?:${Ek}|:)|(?:${Ek}:){6}(?:${wk}|:${Ek}|:)|(?:${Ek}:){5}(?::${wk}|(:${Ek}){1,2}|:)|(?:${Ek}:){4}(?:(:${Ek}){0,1}:${wk}|(:${Ek}){1,3}|:)|(?:${Ek}:){3}(?:(:${Ek}){0,2}:${wk}|(:${Ek}){1,4}|:)|(?:${Ek}:){2}(?:(:${Ek}){0,3}:${wk}|(:${Ek}){1,5}|:)|(?:${Ek}:){1}(?:(:${Ek}){0,4}:${wk}|(:${Ek}){1,6}|:)|(?::((?::${Ek}){0,5}:${wk}|(?::${Ek}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),Ok=WO.module({root:[`v4 | v6`,`@`,`an IP address`],v4:ok(Tk,`an IPv4 address`,`ipv4`),v6:ok(Dk,`an IPv6 address`,`ipv6`)},{name:`string.ip`}),kk=`a JSON string`,Ak=e=>{if(!(e instanceof SyntaxError))throw e;return`must be ${kk} (${e})`},jk=wE({meta:kk,domain:`string`,predicate:{meta:kk,predicate:(e,t)=>{try{return JSON.parse(e),!0}catch(e){return t.reject({code:`predicate`,expected:kk,problem:Ak(e)})}}}}),Mk=WO.module({root:jk,parse:wE({meta:`safe JSON string parser`,in:`string`,morphs:(e,t)=>{if(e.length===0)return t.error({code:`predicate`,expected:kk,actual:`empty`});try{return JSON.parse(e)}catch(e){return t.error({code:`predicate`,expected:kk,problem:Ak(e)})}},declaredOut:jE.jsonObject})},{name:`string.json`}),Nk=ok(/^[a-z]*$/,`only lowercase letters`),Pk=WO.module({root:wE({in:`string`,morphs:e=>e.toLowerCase(),declaredOut:Nk}),preformatted:Nk},{name:`string.lower`}),Fk=[`NFC`,`NFD`,`NFKC`,`NFKD`],Ik=Cb(Fk,(e,t)=>[t,wE({domain:`string`,predicate:e=>e.normalize(t)===e,meta:`${t}-normalized unicode`})]),Lk=Cb(Fk,(e,t)=>[t,wE({in:`string`,morphs:e=>e.normalize(t),declaredOut:Ik[t]})]),Rk=WO.module({root:Lk.NFC,preformatted:Ik.NFC},{name:`string.normalize.NFC`}),zk=WO.module({root:Lk.NFD,preformatted:Ik.NFD},{name:`string.normalize.NFD`}),Bk=WO.module({root:Lk.NFKC,preformatted:Ik.NFKC},{name:`string.normalize.NFKC`}),Vk=WO.module({root:Lk.NFKD,preformatted:Ik.NFKD},{name:`string.normalize.NFKD`}),Hk=WO.module({root:`NFC`,NFC:Rk,NFD:zk,NFKC:Bk,NFKD:Vk},{name:`string.normalize`}),Uk=ok(xx,`a well-formed numeric string`),Wk=WO.module({root:Uk,parse:wE({in:Uk,morphs:e=>Number.parseFloat(e),declaredOut:jE.number})},{name:`string.numeric`}),Gk=`a regex pattern`,Kk=wE({domain:`string`,predicate:{meta:Gk,predicate:(e,t)=>{try{return new RegExp(e),!0}catch(e){return t.reject({code:`predicate`,expected:Gk,problem:String(e)})}}},meta:{format:`regex`}}),qk=ok(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,`a semantic version (see https://semver.org/)`),Jk=ok(/^\S.*\S$|^\S?$/,`trimmed`),Yk=WO.module({root:wE({in:`string`,morphs:e=>e.trim(),declaredOut:Jk}),preformatted:Jk},{name:`string.trim`}),Xk=ok(/^[A-Z]*$/,`only uppercase letters`),Zk=WO.module({root:wE({in:`string`,morphs:e=>e.toUpperCase(),declaredOut:Xk}),preformatted:Xk},{name:`string.upper`}),Qk=wE({domain:`string`,predicate:{meta:`a URL string`,predicate:e=>URL.canParse(e)},meta:{format:`uri`}}),$k=WO.module({root:Qk,parse:wE({declaredIn:Qk,in:`string`,morphs:(e,t)=>{try{return new URL(e)}catch{return t.error(`a URL string`)}},declaredOut:wE(URL)})},{name:`string.url`}),eA=WO.module({root:[`versioned | nil | max`,`@`,{description:`a UUID`,format:`uuid`}],"#nil":`'00000000-0000-0000-0000-000000000000'`,"#max":`'ffffffff-ffff-ffff-ffff-ffffffffffff'`,"#versioned":/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-[1-8][\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,v1:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-1[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv1`),v2:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-2[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv2`),v3:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-3[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv3`),v4:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-4[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv4`),v5:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-5[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv5`),v6:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-6[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv6`),v7:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-7[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv7`),v8:ok(/^[\dA-Fa-f]{8}-[\dA-Fa-f]{4}-8[\dA-Fa-f]{3}-[89ABab][\dA-Fa-f]{3}-[\dA-Fa-f]{12}$/,`a UUIDv8`)},{name:`string.uuid`}),tA=WO.module({root:jE.string,alpha:ok(/^[A-Za-z]*$/,`only letters`),alphanumeric:ok(/^[\dA-Za-z]*$/,`only letters and digits 0-9`),hex:lk,base58:uk,base64:dk,capitalize:pk,creditCard:mk,date:xk,digits:ok(/^\d*$/,`only digits 0-9`),email:Sk,integer:ck,ip:Ok,json:Mk,lower:Pk,normalize:Hk,numeric:Wk,regex:Kk,semver:qk,trim:Yk,upper:Zk,url:$k,uuid:eA},{name:`string`}),nA=WO.module({bigint:jE.bigint,boolean:jE.boolean,false:jE.false,never:jE.never,null:jE.null,number:jE.number,object:jE.object,string:jE.string,symbol:jE.symbol,true:jE.true,unknown:jE.unknown,undefined:jE.undefined}),rA=WO.module({root:jE.unknown,any:jE.unknown},{name:`unknown`}),iA=WO.module({root:jE.jsonObject,stringify:TE(`morph`,{in:jE.jsonObject,morphs:e=>JSON.stringify(e),declaredOut:jE.string})},{name:`object.json`}),aA=WO.module({root:jE.object,json:iA},{name:`object`}),oA=class extends ox{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'},sA=EE([`K`,jE.key],`V`)(e=>({domain:`object`,index:{signature:e.K,value:e.V}}),oA),cA=class extends ox{description='pick a set of properties from an object like `Pick(User, "name | age")`'},lA=EE([`T`,jE.object],[`K`,jE.key])(e=>e.T.pick(e.K),cA),uA=class extends ox{description='omit a set of properties from an object like `Omit(User, "age")`'},dA=EE([`T`,jE.object],[`K`,jE.key])(e=>e.T.omit(e.K),uA),fA=class extends ox{description="make all named properties of an object optional like `Partial(User)`"},pA=EE([`T`,jE.object])(e=>e.T.partial(),fA),mA=class extends ox{description="make all named properties of an object required like `Required(User)`"},hA=EE([`T`,jE.object])(e=>e.T.required(),mA),gA=class extends ox{description='exclude branches of a union like `Exclude("boolean", "true")`'},_A=EE(`T`,`U`)(e=>e.T.exclude(e.U),gA),vA=class extends ox{description='extract branches of a union like `Extract("0 | false | 1", "number")`'},yA=EE(`T`,`U`)(e=>e.T.extract(e.U),vA),bA=WO.module({Exclude:_A,Extract:yA,Omit:dA,Partial:pA,Pick:lA,Record:sA,Required:hA}),xA=UO({...nA,...bA,...nk,...qO,string:tA,number:ak,object:aA,unknown:rA},{prereducedAliases:!0,name:`ark`}),SA=xA.export();Object.assign(VO.ambient,SA),VO.typeAttachments={string:SA.string.root,number:SA.number.root,bigint:SA.bigint,boolean:SA.boolean,symbol:SA.symbol,undefined:SA.undefined,null:SA.null,object:SA.object.root,unknown:SA.unknown.root,false:SA.false,true:SA.true,never:SA.never,arrayIndex:SA.Array.index,Key:SA.Key,Record:SA.Record,Array:SA.Array.root,Date:SA.Date};var J=Object.assign(xA.type,VO.typeAttachments);xA.match,xA.fn,xA.generic,xA.schema,xA.define,xA.declare;var CA={diskUsedPercent:90,memoryUsedPercent:90,swapUsedPercent:50,tempCelsius:85},wA={sampled:!1,cpuUsedPercent:null,memoryUsedPercent:null,swapUsedPercent:null,load1m:null,load5m:null,load15m:null,loadPerCpu:null,tempCelsius:null,disks:[],loadBand:null,memoryBand:null,swapBand:null,tempBand:null};function TA(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function EA(e,t){return MA(e,t,2)}var DA={warnAt:80,dangerAt:95};function OA(e){return e===null||!Number.isFinite(e)?null:e>=DA.dangerAt?`danger`:e>=DA.warnAt?`warn`:`ok`}function kA(e,t,n){return MA(e,t,n)}function AA(e){return e===void 0||!Number.isFinite(e)||e<=0?CA.tempCelsius:e}function jA(e,t){let n=TA(e);return n===null?null:n/AA(t)*100}function MA(e,t,n){if(e===null||!Number.isFinite(e))return null;let r=t===void 0||!Number.isFinite(t)?n:t;return r<=0?`ok`:e>=r?`danger`:e>=r*.7?`warn`:`ok`}function NA(e){if(e==null)return wA;if(e.sampledAt===null)return{...wA,disks:[]};let t=TA(e.loadAvg[0]),n=TA(e.cpus),r=t===null?null:t/Math.max(1,n??1);return{sampled:!0,cpuUsedPercent:TA(e.cpuUsedPercent),memoryUsedPercent:TA(e.memoryUsedPercent),swapUsedPercent:TA(e.swapUsedPercent),load1m:t,load5m:TA(e.loadAvg[1]),load15m:TA(e.loadAvg[2]),loadPerCpu:r,loadBand:EA(r,e.loadAlertPerCpu),memoryBand:kA(TA(e.memoryUsedPercent),e.memoryUsedPercentAlert,CA.memoryUsedPercent),swapBand:kA(TA(e.swapUsedPercent),e.swapUsedPercentAlert,CA.swapUsedPercent),tempBand:kA(TA(e.tempCelsius),e.tempCelsiusAlert,CA.tempCelsius),tempCelsius:TA(e.tempCelsius),disks:e.disks.map(t=>({...t,band:kA(TA(t.usedPercent),e.diskUsedPercentAlert,CA.diskUsedPercent)}))}}var PA=J(`"local" | "lan" | /^\\d{1,3}(?:\\.\\d{1,3}){3}$/`),FA=J(`/^[a-z0-9][a-z0-9_-]*$/`);J({id:FA,label:`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({"id?":FA,"label?":`1 <= string <= 60`}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60`}).onUndeclaredKey(`reject`);function IA(e){let t=PA(e);return t instanceof J.errors?null:t}var LA=J(`1 <= number.integer <= 65535 | null`),RA=J.enumerated(`block`,`warn`,`follow`,`reclaim`,`kill`),zA=RA.default(`block`),BA=J({enabled:`boolean = true`,maxRetries:`number.integer >= 0 = 3`,baseDelayMs:`number >= 0 = 1000`,factor:`number >= 1 = 2`,maxDelayMs:`number >= 0 = 30000`,resetAfterMs:`number >= 0 = 60000`}).onUndeclaredKey(`reject`),VA=J({scheme:`"http" | "https" = "http"`,allowInvalidCert:`boolean = false`,path:`string = "/"`,method:`"GET" | "HEAD" = "GET"`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer = 400`,expectBody:`string = ""`}).onUndeclaredKey(`reject`),HA=J({maxRssBytes:`number.integer >= 0 = 0`}).onUndeclaredKey(`reject`),UA=J({enabled:`boolean = true`,mode:`"port" | "http" = "port"`,http:VA.default(()=>({})),intervalMs:`number >= 500 = 5000`,timeoutMs:`number >= 100 = 1500`,unhealthyThreshold:`number.integer >= 1 = 3`,forceRestartAfterMs:`number >= 0 = 0`,startTimeoutMs:`number >= 0 = 20000`}).onUndeclaredKey(`reject`),WA=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL" = "SIGTERM"`,killGroup:`boolean = true`,graceMs:`number >= 0 = 5000`,killPortHolders:`boolean = false`}).onUndeclaredKey(`reject`),GA=J({command:`string`,args:J(`string[]`).default(()=>[]),env:J(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 120000`,runOnce:`boolean = true`}).onUndeclaredKey(`reject`).or(J(`null`)),KA=J({command:`string >= 1?`,args:`string[]?`,env:`Record<string, string>?`,timeoutMs:`number >= 1000?`,runOnce:`boolean?`}).onUndeclaredKey(`reject`).or(J(`null`)),qA=J({command:`string >= 1`,args:J(`string[]`).default(()=>[]),env:J(`Record<string, string>`).default(()=>({})),timeoutMs:`number >= 1000 = 600000`,waitMs:`number >= 0 = 2000`}).onUndeclaredKey(`reject`).or(J(`null`)),JA=J({command:`string >= 1?`,args:`string[]?`,env:`Record<string, string>?`,timeoutMs:`number >= 1000?`,waitMs:`number >= 0?`}).onUndeclaredKey(`reject`).or(J(`null`)),YA=J(`string | null`),XA=J(`50 <= number.integer <= 100000`),ZA=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:YA.optional(),enabled:`boolean = true`,autostart:`boolean = false`,persistent:`boolean = false`,command:`string >= 1`,args:J(`string[]`).default(()=>[]),cwd:`string = "."`,env:J(`Record<string, string>`).default(()=>({})),dataEnvs:J(`Record<string, string>`).default(()=>({})),bootstrap:GA.optional(),dump:qA.optional(),load:qA.optional(),port:LA.optional(),bind:PA.default(()=>`local`),onPortConflict:zA,restart:BA.default(()=>({})),health:UA.default(()=>({})),stop:WA.default(()=>({})),logBufferLines:XA.default(()=>500),dependsOn:J(`string[]`).default(()=>[]),envFile:`string = ""`,resources:HA.default(()=>({})),backupPaths:J(`string[]`).default(()=>[]),backupIgnoreGenerated:`boolean = true`}).onUndeclaredKey(`reject`),QA=J({enabled:`boolean = true`,sessionTtlMs:`number >= 60000 = 604800000`,cookieSecure:`"auto" | "always" | "never" = "auto"`,trustProxy:`boolean | "loopback" = false`,maxLoginAttempts:`number.integer >= 1 = 5`,lockoutMs:`number >= 1000 = 60000`}).onUndeclaredKey(`reject`),$A={onCrash:`boolean = true`,onUnhealthy:`boolean = true`,onForcedRestart:`boolean = true`,onRecovered:`boolean = false`,onHost:`boolean = true`,onDdns:`boolean = true`,cooldownMs:`number >= 0 = 120000`},ej=J({...$A}).onUndeclaredKey(`reject`),tj=J({...$A}),nj=`boolean = true`,rj=J({kind:`"telegram"`,id:`/^[a-z0-9][a-z0-9_-]*$/`,enabled:`boolean = false`,chatId:`string = ""`,useOwnSettings:nj,...$A}).onUndeclaredKey(`reject`),ij=J({kind:`"webhook"`,id:`/^[a-z0-9][a-z0-9_-]*$/`,url:`string = ""`,enabled:`boolean = true`,method:`"POST" | "PUT" = "POST"`,format:`"json" | "text" = "json"`,headers:`string = ""`,useOwnSettings:nj,...$A}).onUndeclaredKey(`reject`),aj=rj.or(ij).array();J({defaults:ej.default(()=>({})),destinations:aj.default(()=>[])}).onUndeclaredKey(`reject`);var oj=J({persist:`boolean = true`,maxBytes:`10000 <= number <= 100000000 = 2000000`,keep:`1 <= number.integer <= 10 = 3`}).onUndeclaredKey(`reject`),sj=J({enabled:`boolean = false`}).onUndeclaredKey(`reject`),cj=J({enabled:`boolean = true`,intervalMs:`number >= 5000 = 15000`,diskPaths:J(`string[]`).default(()=>[`.`]),diskUsedPercent:`number >= 0 = ${CA.diskUsedPercent}`,memoryUsedPercent:`number >= 0 = ${CA.memoryUsedPercent}`,swapUsedPercent:`number >= 0 = ${CA.swapUsedPercent}`,loadPerCpu:J(`number >= 0`).default(2),tempCelsius:`number >= 0 = ${CA.tempCelsius}`,tempCommand:`string <= 512 = ""`,tempCommandTimeoutMs:`100 <= number <= 30000 = 5000`}).onUndeclaredKey(`reject`),lj=J.enumerated(`A`,`AAAA`),uj=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,provider:`string >= 1`,label:`string = ""`}).onUndeclaredKey(`reject`),dj=J({host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/`,account:`string >= 1`,types:lj.array().default(()=>[`A`]),zone:`string?`,ttl:`number.integer >= 1?`,proxied:`boolean = false`,enabled:`boolean = true`}).onUndeclaredKey(`reject`),fj=J({enabled:`boolean = true`,url:`string = ""`}).onUndeclaredKey(`reject`),pj=J({enabled:`boolean = false`,url:`string = ""`}).onUndeclaredKey(`reject`),mj=J({enabled:`boolean = false`,intervalMs:`number >= 60000 = 300000`,ipv4:fj.default(()=>({})),ipv6:pj.default(()=>({})),ttl:`number.integer >= 1 = 1`,accounts:uj.array().default(()=>[]),domains:dj.array().default(()=>[])}).onUndeclaredKey(`reject`),hj=J({enabled:`boolean`,running:`boolean`,lastRunAt:`number | null`,lastResult:`string | null`,ipv4:`string | null`,ipv6:`string | null`,records:J({host:`string`,account:`string`,provider:`string`,type:lj,ip:`string | null`,state:J(`"pending" | "ok" | "unchanged" | "error" | "skipped"`),message:`string | null`,updatedAt:`number | null`}).array()}),gj=J({key:`string`,label:`string`,hint:`string = ""`,optional:`boolean = false`}),_j=J({config:mj,status:hj,providers:J({id:`string`,label:`string`,docsUrl:`string`,families:lj.array(),fields:gj.array(),ttl:`boolean`,proxied:`boolean`,txt:`boolean`}).array(),credentials:J(`string[]`)}).onDeepUndeclaredKey(`ignore`);J({provider:`string >= 1`,credentials:J(`Record<string, string>`)}).onUndeclaredKey(`reject`),J({enabled:`boolean?`,intervalMs:`number >= 60000?`,ipv4:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ipv6:J({enabled:`boolean?`,url:`string?`}).onUndeclaredKey(`reject`).optional(),ttl:`number.integer >= 1?`,accounts:uj.array().optional(),domains:dj.array().optional()}).onUndeclaredKey(`reject`);var vj=J({mode:`"only" | "except"`,ids:J(`string >= 1`).array().atLeastLength(1)}).onUndeclaredKey(`reject`),yj=J({intervalMs:`number.integer >= 0 = 0`,keep:`number.integer >= 1 = 7`,scope:vj.optional()}).onUndeclaredKey(`reject`);J({enabled:`boolean = true`,dir:`string = ".backups"`,keep:`number.integer >= 1 = 5`,includePaths:J(`string[]`).default(()=>[]),schedule:yj.default(()=>({}))}).onUndeclaredKey(`reject`),J({label:`1 <= string <= 60 = "home-hosted"`,port:`1 <= number.integer <= 65535 = 3999`,host:PA.default(()=>`local`),openBrowser:`boolean = false`,auth:QA.default(()=>({})),tls:sj.default(()=>({}))}).onUndeclaredKey(`reject`);var bj=J({enabled:`boolean = true`,autostart:`boolean = false`,bind:PA.default(()=>`local`),onPortConflict:zA,restart:BA.default(()=>({})),health:UA.default(()=>({})),stop:WA.default(()=>({})),logBufferLines:XA.default(()=>500)}).onUndeclaredKey(`reject`),xj=J({enabled:`boolean?`,maxRetries:`number.integer >= 0?`,baseDelayMs:`number >= 0?`,factor:`number >= 1?`,maxDelayMs:`number >= 0?`,resetAfterMs:`number >= 0?`}).onUndeclaredKey(`reject`),Sj=J({scheme:`"http" | "https"?`,allowInvalidCert:`boolean?`,path:`string?`,method:`"GET" | "HEAD"?`,expectStatus:`number.integer | null?`,expectStatusBelow:`number.integer?`,expectBody:`string?`}).onUndeclaredKey(`reject`),Cj=J({maxRssBytes:`number.integer >= 0?`}).onUndeclaredKey(`reject`),wj=J({enabled:`boolean?`,mode:`"port" | "http"?`,http:Sj.optional(),intervalMs:`number >= 500?`,timeoutMs:`number >= 100?`,unhealthyThreshold:`number.integer >= 1?`,forceRestartAfterMs:`number >= 0?`,startTimeoutMs:`number >= 0?`}).onUndeclaredKey(`reject`),Tj=J({signal:`"SIGTERM" | "SIGINT" | "SIGKILL"?`,killGroup:`boolean?`,graceMs:`number >= 0?`,killPortHolders:`boolean?`}).onUndeclaredKey(`reject`),Ej=J({enabled:`boolean?`,sessionTtlMs:`number >= 60000?`,cookieSecure:`"auto" | "always" | "never"?`,trustProxy:`boolean | "loopback"?`,maxLoginAttempts:`number.integer >= 1?`,lockoutMs:`number >= 1000?`}).onUndeclaredKey(`reject`),Dj={onCrash:`boolean?`,onUnhealthy:`boolean?`,onForcedRestart:`boolean?`,onRecovered:`boolean?`,onHost:`boolean?`,onDdns:`boolean?`,cooldownMs:`number >= 0?`},Oj=J({kind:`"telegram" | "webhook"`,id:`/^[a-z0-9][a-z0-9_-]*$/`,enabled:`boolean?`,useOwnSettings:`boolean?`,chatId:`string?`,url:`string?`,method:`"POST" | "PUT"?`,format:`"json" | "text"?`,headers:`string?`,...Dj}).onUndeclaredKey(`reject`),kj=J({defaults:J({...Dj}).onUndeclaredKey(`reject`).optional(),destinations:Oj.array().optional()}).onUndeclaredKey(`reject`),Aj=J({enabled:`boolean?`,intervalMs:`number >= 5000?`,diskPaths:J(`string[]`).optional(),diskUsedPercent:`number >= 0?`,memoryUsedPercent:`number >= 0?`,swapUsedPercent:`number >= 0?`,loadPerCpu:`number >= 0?`,tempCelsius:`number >= 0?`,tempCommand:`string <= 512?`,tempCommandTimeoutMs:`100 <= number <= 30000?`}).onUndeclaredKey(`reject`),jj=J({intervalMs:`number.integer >= 0?`,keep:`number.integer >= 1?`,scope:vj.or(J(`null`)).optional()}).onUndeclaredKey(`reject`),Mj=J({enabled:`boolean?`,dir:`string?`,keep:`number.integer >= 1?`,includePaths:J(`string[]`).optional(),schedule:jj.optional()}).onUndeclaredKey(`reject`),Nj=J({persist:`boolean?`,maxBytes:`10000 <= number <= 100000000?`,keep:`1 <= number.integer <= 10?`}).onUndeclaredKey(`reject`),Pj=J({enabled:`boolean?`}).onUndeclaredKey(`reject`),Fj=J({label:`1 <= string <= 60 | null?`,port:`1 <= number.integer <= 65535?`,host:PA.optional(),openBrowser:`boolean?`,auth:Ej.optional(),tls:Pj.optional()}).onUndeclaredKey(`reject`),Ij=J({enabled:`boolean?`,autostart:`boolean?`,bind:PA.optional(),onPortConflict:RA.optional(),restart:xj.optional(),health:wj.optional(),stop:Tj.optional(),logBufferLines:XA.optional()}).onUndeclaredKey(`reject`),Lj={label:YA.optional(),enabled:`boolean?`,autostart:`boolean?`,persistent:`boolean?`,command:`string?`,args:`string[]?`,cwd:`string?`,env:`Record<string, string>?`,dataEnvs:`Record<string, string>?`,bootstrap:KA.optional(),dump:JA.optional(),load:JA.optional(),port:LA.optional(),bind:PA.optional(),onPortConflict:RA.optional(),restart:xj.optional(),health:wj.optional(),stop:Tj.optional(),logBufferLines:XA.optional(),dependsOn:J(`string[]`).optional(),envFile:`string?`,resources:Cj.optional(),backupPaths:J(`string[]`).optional(),backupIgnoreGenerated:`boolean?`},Rj=J(Lj).onUndeclaredKey(`reject`),zj=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,...Lj,command:`string`}).onUndeclaredKey(`reject`);J({serverId:`string`,command:`string`,args:`string[]`,cwd:`string`,env:`Record<string, string>`,logDir:`string`,logs:oj,stop:WA}).onUndeclaredKey(`reject`),J({serverId:`string`,nannyPid:`number`,childPid:`number | null`,startedAt:`number`,logFile:`string`,heartbeatAt:`number`,"lastExit?":J({code:`number | null`,signal:`string | null`,at:`number`,runtimeMs:`number`}).onUndeclaredKey(`reject`)}).onUndeclaredKey(`reject`),J({restarts:`number.integer >= 0`,"healthRestarts?":`number.integer >= 0`,bootstrapDone:`boolean`,"pendingLoad?":`string | null`,"lastPid?":`number | null`,"lastStartedAt?":`number | null`});var Bj=J({control:Fj.optional(),host:Aj.optional(),backups:Mj.optional()}).onUndeclaredKey(`reject`),Vj=J({defaults:Ij.optional(),logs:Nj.optional(),notifications:kj.optional()}).onUndeclaredKey(`reject`),Hj=J({enabled:`boolean`,passwordSet:`boolean`,passwordUpdatedAt:`number | null`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,exposed:`boolean`,blockedReason:`string | null`,sessionTtlMs:`number`,cookieSecure:`string`,trustProxy:`boolean | "loopback"`,maxLoginAttempts:`number`,lockoutMs:`number`}),Uj=J({enabled:`boolean`,certPresent:`boolean`,subject:`string | null`,issuer:`string | null`,validFrom:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,fingerprint:`string | null`,keyMatches:`boolean | null`,error:`string | null`}),Wj=J.enumerated(`caddy`),Gj=J.enumerated(`server`,`panel`,`external`),Kj=J.enumerated(`auto`,`off`,`manual`),qj=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,host:`/^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/`,enabled:`boolean = true`,target:Gj.default(()=>`server`),workspace:`string = ""`,server:`string = ""`,url:`string = ""`,path:`string = ""`,tls:Kj.default(()=>`auto`),dnsAccount:`string = ""`}).onUndeclaredKey(`reject`),Jj=J({id:`/^[a-z0-9][a-z0-9_-]*$/`,label:`string = ""`}).onUndeclaredKey(`reject`),Yj=J.enumerated(`off`,`local`,`uploaded`,`issued`,`pending`,`failed`,`fallback`),Xj=J({enabled:`boolean = false`,resolvers:J(`string[]`).default(()=>[])}).onUndeclaredKey(`reject`),Zj=J({enabled:`boolean = false`,engine:Wj.default(()=>`caddy`),httpPort:`1 <= number.integer <= 65535 = 80`,httpsPort:`1 <= number.integer <= 65535 = 443`,email:`string = ""`,staging:`boolean = false`,dns01:Xj.default(()=>({})),certificates:Jj.array().default(()=>[]),routes:qj.array().default(()=>[])}).onUndeclaredKey(`reject`),Qj=J({id:Wj,installed:`boolean`,version:`string | null`,source:J.enumerated(`downloaded`,`custom`).or(J(`null`)),path:`string | null`,bytes:`number | null`,error:`string | null`}),$j=J({id:Wj,label:`string`,docsUrl:`string`,releaseUrl:`string`,acme:`boolean`,internalCa:`boolean`,dns01:`boolean`,tcp:`boolean`}),eM=J({route:qj,status:J.enumerated(`ok`,`disabled`,`no-upstream`,`error`),upstream:`string | null`,message:`string | null`,"certificate?":J({state:Yj,message:`string | null`,"retryInMinutes?":`number`})}).onDeepUndeclaredKey(`ignore`),tM=J({state:J.enumerated(`off`,`stopped`,`starting`,`running`,`error`,`unsupported`),pid:`number | null`,urls:J(`string[]`),certExpiryDays:`number | null`,since:`number | null`,lastError:`string | null`}),nM=J({id:`string`,label:`string`,present:`boolean`,used:`boolean`,subject:`string | null`,issuer:`string | null`,validTo:`string | null`,daysRemaining:`number | null`,hosts:J(`string[]`),error:`string | null`}),rM=J({workspace:`string`,account:`string`,provider:`string`,label:`string`,writesTxt:`boolean`,hasCredentials:`boolean`}),iM=J({config:Zj,engine:Qj,engines:$j.array(),status:tM,routes:eM.array(),certificates:nM.array(),"dnsAccounts?":rM.array()}).onDeepUndeclaredKey(`ignore`),aM=J({id:`string`,host:`string`,enabled:`boolean?`,target:Gj.optional(),workspace:`string?`,server:`string?`,url:`string?`,path:`string?`,tls:Kj.optional(),dnsAccount:`string?`}).onUndeclaredKey(`reject`),oM=J({enabled:`boolean?`,engine:Wj.optional(),httpPort:`1 <= number.integer <= 65535?`,httpsPort:`1 <= number.integer <= 65535?`,email:`string?`,staging:`boolean?`,dns01:J({enabled:`boolean | null?`,resolvers:`string[] | null?`}).onUndeclaredKey(`reject`).optional(),certificates:Jj.array().optional(),routes:aM.array().optional()}).onUndeclaredKey(`reject`),sM=J({label:`string = ""`,certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`);J({version:`string = ""`}).onUndeclaredKey(`reject`);var cM=J({id:`string`,kind:`"telegram" | "webhook"`,enabled:`boolean`,useOwnSettings:`boolean`,onCrash:`boolean`,onUnhealthy:`boolean`,onForcedRestart:`boolean`,onRecovered:`boolean`,onHost:`boolean`,onDdns:`boolean?`,cooldownMs:`number`,chatId:`string | null`,tokenSet:`boolean`,url:`string | null`,method:`"POST" | "PUT" | null`,format:`"json" | "text" | null`,headers:`string | null`,"lastResult?":`string | null`,"lastResultAt?":`number | null`});J({chats:J({id:`string | number`,title:`string`}).array()});var lM=J({"defaults?":tj,"destinations?":cM.array()});J({authenticated:`boolean`,authRequired:`boolean`,passwordSet:`boolean`,apiTokenSet:`boolean?`,usingDefaultPassword:`boolean`,defaultPassword:`string | null`,sessionTtlMs:`number`});var uM=J({password:`string`}).onUndeclaredKey(`reject`),dM=J(`1 <= string <= 512`),fM=J({currentPassword:`string?`,newPassword:dM}).onUndeclaredKey(`reject`),pM=J(`"stopped" | "starting" | "running" | "stopping" | "backoff" | "crashed" | "conflict"`),mM=J(`"disabled" | "unknown" | "healthy" | "unhealthy"`),hM=J(`"unknown" | "free" | "in-use"`),gM=J({ts:`number`,stream:J(`"stdout" | "stderr" | "system"`),text:`string`}),_M=J({windowMs:`number`,uptimeRatio:`number | null`,restarts:`number`,crashes:`number`,forcedRestarts:`number`,lastCrashAt:`number | null`,lastExitAt:`number | null`,lastRuntimeMs:`number | null`,events:J({serverId:`string`,ts:`number`,type:`"start" | "exit" | "crash" | "forced-restart" | "unhealthy" | "recovered"`,detail:`string`,runtimeMs:`number?`,"actor?":J.enumerated(`policy`,`user`,`agent`,`boot`)}).array()}),vM=J({cpuPercent:`number | null`,rssBytes:`number | null`,processes:`number`,sampledAt:`number`}),yM=J({path:`string`,totalBytes:`number`,freeBytes:`number`,usedPercent:`number`}),bM=J({enabled:`boolean`,cpus:`number`,loadAvg:J(`number[]`),"cpuUsedPercent?":`number | null`,uptimeMs:`number`,memoryUsedPercent:`number`,swapUsedPercent:`number`,tempCelsius:`number | null`,disks:yM.array(),alerts:J(`string[]`),sampledAt:`number | null`,"loadAlertPerCpu?":`number`,"memoryUsedPercentAlert?":`number`,"swapUsedPercentAlert?":`number`,"tempCelsiusAlert?":`number`,"diskUsedPercentAlert?":`number`});J({wsl:`boolean`,supported:`boolean`,configured:`boolean`,scriptWritten:`boolean`,libraryPresent:`boolean`,scriptPath:`string | null`,"tempCommand?":`string | null`,"lastReadingCelsius?":`number | null`,"lastError?":`string | null`,"needsDownload?":`boolean`});var xM=J({name:`string`,sizeBytes:`number`,createdAt:`number`,encrypted:`boolean`}),SM=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "tls" | "workspace"`,"workspaceId?":`string`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,items:J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "servers" | "secrets" | "data"`,"secret?":`string`,"path?":`string`,"origin?":`string`,included:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`,"ignoreGenerated?":`boolean`}).array()}),CM=J({enabled:`boolean`,dir:`string`,keep:`number`,"schedule?":yj.onDeepUndeclaredKey(`ignore`),"lastAutomaticAt?":`number | null`,"scheduleError?":J({message:`string`,at:`number`}),includePaths:J(`string[]`),"entries?":SM.array(),"files?":xM.array()});J({dir:`string`,entries:SM.array(),files:xM.array()});var wM=J({id:`string`,label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,kind:`"settings" | "secrets" | "servers" | "tls" | "data"`,"workspaceId?":`string`,restorable:`boolean`,selected:`boolean`,note:`string | null`,"noteKey?":`string`,"noteParams?":`Record<string, string>`}),TM=J({label:`string`,"labelKey?":`string`,"labelParams?":`Record<string, string>`,"reasonKey?":`string`,"reasonParams?":`Record<string, string>`});J({dryRun:`boolean`,encrypted:`boolean`,needsPassword:`boolean`,"archive?":J({"writtenBy?":`string`,"schema?":`number`}),items:wM.array(),"hooks?":J({serverId:`string`,workspaceId:`string`,action:`"dump" | "load"`,ok:`boolean`,"output?":`string`}).array(),applied:J(`string[]`),"appliedIds?":J(`string[]`),skipped:J(`string[]`),"skippedItems?":TM.array(),restartRequired:`boolean`,reloaded:`boolean`,"replacedUnderRunning?":J({workspaceId:`string`,serverId:`string`,path:`string`}).array(),"createdWorkspaces?":J(`string[]`),error:`string?`}),J({password:dM.optional(),include:J(`string[] >= 1`).optional(),exclude:J(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`),J({name:`string?`,password:dM.optional(),include:J(`string[]`).optional(),exclude:J(`string[] >= 1`).optional()}).onUndeclaredKey(`reject`);var EM=J({id:`string`,"workspaceId?":`string`,config:ZA,bindHost:`string`,url:`string | null`,status:pM,health:mM,portState:hM,pid:`number | null`,adopted:`boolean?`,"stoppedByPanel?":`boolean`,startedAt:`number | null`,exitCode:`number | null`,exitSignal:`string | null`,restarts:`number`,maxRetries:`number`,lastError:`string | null`,nextRetryAt:`number | null`,unhealthySince:`number | null`,bufferedLines:`number`,history:_M,responseMs:`number | null`,resources:vM.or(J(`null`))}).onDeepUndeclaredKey(`ignore`);J({status:`"ok" | "degraded"`,uptimeMs:`number`,"servers?":J({total:`number`,running:`number`,crashed:`number`,unhealthy:`number`}),"hostAlerts?":`string[]`});var DM=J({label:`string`,port:`number`,host:`string`,bindHost:`string`,url:`string`,openBrowser:`boolean`,restartRequired:`boolean`,protocol:`string`,auth:Hj,tls:Uj}),OM=J({custom:`boolean`,dir:`string`,meta:J({"name?":`string`,"version?":`string | null`,"uploadedAt?":`number`,"files?":`number.integer >= 1`,"repo?":`string`,"tag?":`string`,"asset?":`string`,"unix?":`number.integer >= 0`}).or(J(`null`))}),kM=J({serverId:`string`,pid:`number`,startedAt:`number | null`}),AM=J({id:`string`,label:`string`,configPath:`string`,settingsPath:`string`,configError:`string | null`,"configWarnings?":J(`string[]`),logsDir:`string`,defaults:bj,logs:oj,notifications:lM,"ddns?":hj,serverCount:`number`,runningCount:`number`,crashedCount:`number`,"orphans?":kM.array(),servers:EM.array()}).onDeepUndeclaredKey(`ignore`),jM=J({control:DM,host:bM,backups:CM,ui:OM,workspaces:AM.array(),"proxy?":iM,projectDir:`string`,dataRoot:`string`,"version?":`string`}).onDeepUndeclaredKey(`ignore`),MM=J({type:`"hello" | "state" | "log" | "server"`,ts:`number`,"workspaceId?":`string`,serverId:`string?`,state:jM.optional(),server:EM.optional(),lines:gM.array().optional()}).onDeepUndeclaredKey(`ignore`);J({limit:`string?`}),J({ok:`boolean`,"error?":`string`,"code?":`string`}),J({ok:`boolean`,"error?":`string`}),J({ok:`boolean`,enabled:`boolean`,sessionsInvalidated:`boolean`}),J({control:DM,rebinding:`boolean`,targetUrl:`string`}),J({ok:`boolean`}),J({ok:`boolean`,files:xM.array()}),J({ok:`boolean`,"meta?":OM.get(`meta`),ui:OM,"removed?":`boolean`}),J({file:xM,files:xM.array()}),J({lines:gM.array()}),J({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:`string[]`,searched:`number | null`,lines:gM.array()}),J({ok:`boolean`,port:`number | null`,terminated:`number[]`,forced:`number[]`,skipped:`number[]`,free:`boolean`}),J({tail:`string?`,search:`string?`,stream:`"stdout" | "stderr" | "system"?`});var NM=J({servers:J({serverId:`string`,label:`string`,status:pM,enabled:`boolean`,sizeBytes:`number`,files:J({name:`string`,sizeBytes:`number`}).array()}).array()}),PM=J({serverId:`string`,enabled:`boolean`,sizeBytes:`number`,files:J(`string[]`),searched:`number | null`,lines:gM.array()});J({botToken:`string?`,chatId:`string?`}).onUndeclaredKey(`reject`),J({id:`/^[a-z0-9][a-z0-9_-]*$/`}),J({target:ij.omit(`kind`,`id`).and(J({id:`string?`,kind:`"webhook"?`})),id:`string?`}).onUndeclaredKey(`reject`),J({botToken:`string >= 1`}).onUndeclaredKey(`reject`),J({message:`string`,code:`string`,"detail?":`unknown`}).onUndeclaredKey(`reject`),J({certificate:`string >= 1`,privateKey:`string >= 1`}).onUndeclaredKey(`reject`),J({control:DM,host:cj,backups:CM,ui:OM}).onDeepUndeclaredKey(`ignore`).and(J({rebinding:`boolean`,targetUrl:`string | null`}));var FM=J({id:`string`,label:`string`,settingsPath:`string`,configPath:`string`,configError:`string | null`,defaults:bj,logs:oj,notifications:lM}).onDeepUndeclaredKey(`ignore`);function IM(e){return e instanceof Error?e.message:String(e)}function LM(e,t){return`${e}/${t}`}function RM(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var zM=class extends Error{name=`AuthRequiredError`;constructor(){super(`authentication required`)}};async function BM(e,t){let n=await fetch(e,{...t,headers:{"Content-Type":`application/json`,...t?.headers}}),r=await n.text(),i=r.length>0?JSON.parse(r):null;if(!n.ok)throw n.status===401&&RM(i)&&i.code===`AUTH_REQUIRED`?new zM:Error(VM(i,n.status));return i}function VM(e,t){if(RM(e)){if(typeof e.message==`string`&&e.message.length>0)return e.message;if(typeof e.error==`string`&&e.error.length>0)return e.error;if(e.error!==void 0&&e.error!==null&&String(e.error).length>0)return String(e.error)}return`request failed with ${t}`}async function HM(e){let t=iM(e);if(t instanceof J.errors)throw Error(`proxy contract mismatch: ${t.summary}`);return t}async function UM(e){let t=_j(e);if(t instanceof J.errors)throw Error(`ddns contract mismatch: ${t.summary}`);return t}function WM(e){return BM(`/api/proxy/${e}`,{method:`POST`}).then(HM)}function GM(){return WM(`apply`)}function KM(e){return`/api/backups/${encodeURIComponent(e)}/download`}function qM(e){let t={};for(let n of[`include`,`exclude`]){let r=e[n];if(r!==void 0){if(r.length===0)throw Error(`nothing is ${n===`include`?`selected`:`excluded`}: omit \`${n}\` or name at least one item`);t[n]=r}}return t}function JM(e={}){let t=qM(e);return e.password!==void 0&&e.password.length>0&&(t.password=e.password),t}function YM(e={}){return BM(`/api/backups`,{method:`POST`,body:JSON.stringify(JM(e))})}function XM(){return BM(`/api/auth/password`,{method:`DELETE`})}async function ZM(e){return HM(await BM(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`DELETE`}))}function QM(e){return BM(`/api/backups/${encodeURIComponent(e)}`,{method:`DELETE`})}function $M(){return BM(`/api/host/temperature`)}function eN(e={}){return BM(`/api/host/temperature${e.download===!0?`?download=true`:``}`,{method:`POST`})}function tN(){return BM(`/api/host/temperature`,{method:`DELETE`})}async function nN(){return HM(await BM(`/api/proxy`))}function rN(){return BM(`/api/auth/session`)}function iN(){return BM(`/api/settings`)}async function aN(e=``){return HM(await BM(`/api/proxy/engine`,{method:`POST`,body:JSON.stringify({version:e})}))}function oN(e){let t=uM({password:e});if(t instanceof J.errors)throw Error(t.summary);return BM(`/api/auth/login`,{method:`POST`,body:JSON.stringify(t)})}function sN(){return BM(`/api/auth/logout`,{method:`POST`})}async function cN(e){let t=oM(e);if(t instanceof J.errors)throw Error(t.summary);return HM(await BM(`/api/proxy`,{method:`PATCH`,body:JSON.stringify(t)}))}function lN(e){let t=qM(e);return e.password!==void 0&&e.password.length>0&&(t.password=e.password),t}function uN(e,t,n={}){return BM(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:JSON.stringify({name:e,...lN(n)})})}async function dN(e,t,n={}){let r=new FormData;r.append(`file`,e);for(let[e,t]of Object.entries(lN(n)))r.append(e,e===`password`?String(t):JSON.stringify(t));let i=await fetch(`/api/backups/restore?confirm=${t}`,{method:`POST`,body:r}),a=await i.json().catch(()=>null);if(!i.ok)throw Error(a?.message??a?.error??`restore failed with ${i.status}`);return a}async function fN(e){return HM(await BM(`/api/proxy/routes/${encodeURIComponent(e)}/retry-certificate`,{method:`POST`}))}function pN(){return WM(`revert`)}function mN(){return BM(`/api/settings/ui`,{method:`DELETE`})}function hN(e,t){let n=fM(e===void 0?{newPassword:t}:{currentPassword:e,newPassword:t});if(n instanceof J.errors)throw Error(n.summary);return BM(`/api/auth/password`,{method:`POST`,body:JSON.stringify(n)})}function gN(){return WM(`start`)}function _N(){return WM(`stop`)}async function vN(e,t,n,r){let i=sM({label:t,certificate:n,privateKey:r});if(i instanceof J.errors)throw Error(i.summary);return HM(await BM(`/api/proxy/certificates/${encodeURIComponent(e)}`,{method:`PUT`,body:JSON.stringify(i)}))}async function yN(e){let t=new FormData;t.append(`file`,e);let n=await fetch(`/api/settings/ui`,{method:`POST`,body:t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.message??r?.error??`the upload failed with ${n.status}`);return r}var bN=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),xN=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,()=>r?`/${r}`:``)}return e},SN=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.set(n,r)}return t},CN=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},wN=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function TN(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function EN(e,t){if(!TN(e)&&!TN(t))return t;let n={...e};for(let e in t){let r=t[e];n[e]=TN(n[e])&&TN(r)?EN(n[e],r):r}return n}var DN=/^[\w!#$%&'*.^`|~+-]+$/,ON=(e,t,n={})=>{if(!DN.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},kN=(e,t,n)=>(t=encodeURIComponent(t),ON(e,t,n)),AN=(e,t)=>new Proxy(()=>{},{get(n,r){if(typeof r==`string`&&r!==`then`)return AN(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),jN=(e,t)=>{let n=t.toString();return n?`${e}?${n}`:e},MN=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0){if(Array.isArray(r))for(let e of r)e!==void 0&&t.append(n,e);else t.append(n,r)}this.rBody=t}e.json!==void 0&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))r!==void 0&&t.push(kN(n,r));t.length>0&&(r.Cookie=t.join(`; `))}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers;for(let[e,t]of Object.entries(r))t!==void 0&&i.set(e,t);let a=this.url;a=wN(a),a=xN(a,this.pathParams),this.queryParams&&(a=jN(a,this.queryParams)),n=this.method.toUpperCase();let o=n!==`GET`&&n!==`HEAD`;return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},NN=((e,t)=>AN(function n(r){let i=t?.buildSearchParams??SN,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=bN(e,a.join(`/`));if(s===`url`||s===`path`){let t=wN(c);return r.args[0]&&(r.args[0].param&&(t=xN(t,r.args[0].param)),r.args[0].query&&(t=jN(t,i(r.args[0].query)))),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=wN(c),n=CN(r.args[0]?.param?xN(e,r.args[0].param):e,`ws`),a=new URL(n),o=r.args[0]?.query;return o&&i(o).forEach((e,t)=>{a.searchParams.append(t,e)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(a.toString())}let l=new MN(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=EN(t,e);return l.fetch(r.args[0],a)}return l},[]))(typeof window>`u`?`http://127.0.0.1`:window.location.origin);J({workspaces:AM.array()});var PN=J({workspace:AM}),FN=J({ok:`boolean`,removed:`unknown`});function IN(e){return e==null||e.length===0?``:`?workspace=${encodeURIComponent(e)}`}function LN(e,t){return{param:{id:t},query:e.length>0?{workspace:e}:{}}}function RN(e,t,n){let r=n??new URLSearchParams;t.length>0&&r.set(`workspace`,t);let i=r.toString();return i.length>0?`${e}?${i}`:e}async function zN(){let e=jM(await BM(`/api/state`));if(e instanceof J.errors)throw Error(`state contract mismatch: ${e.summary}`);return e}async function BN(e){let t=PN(e);if(t instanceof J.errors)throw Error(`workspace contract mismatch: ${t.summary}`);return t.workspace}async function VN(e){return BN(await BM(`/api/workspaces`,{method:`POST`,body:JSON.stringify(e)}))}async function HN(e,t){return BN(await BM(`/api/workspaces/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({label:t})}))}async function UN(e){let t=FN(await BM(`/api/workspaces/${encodeURIComponent(e)}`,{method:`DELETE`}));if(t instanceof J.errors)throw Error(`workspace removal contract mismatch: ${t.summary}`);return t}function WN(e){let t=Bj(e);if(t instanceof J.errors)throw Error(t.summary);return BM(`/api/settings`,{method:`PATCH`,body:JSON.stringify(t)})}async function GN(e,t){let n=Vj(t);if(n instanceof J.errors)throw Error(n.summary);let r=FM(await BM(RN(`/api/settings/workspace`,e),{method:`PATCH`,body:JSON.stringify(n)}));if(r instanceof J.errors)throw Error(`workspace settings contract mismatch: ${r.summary}`);return r}async function KN(e){let t=NM(await BM(RN(`/api/logs`,e)));if(t instanceof J.errors)throw Error(`logs contract mismatch: ${t.summary}`);return t.servers}async function qN(e,t,n){let r=new URLSearchParams;n.tail!==void 0&&r.set(`tail`,String(n.tail)),n.search!==void 0&&n.search.length>0&&r.set(`search`,n.search),n.stream!==void 0&&n.stream.length>0&&r.set(`stream`,n.stream);let i=PM(await BM(RN(`/api/logs/${encodeURIComponent(t)}`,e,r)));if(i instanceof J.errors)throw Error(`log history contract mismatch: ${i.summary}`);return i}function JN(e,t){return BM(RN(`/api/logs/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function YN(e,t,n){return RN(`/api/logs/${encodeURIComponent(t)}/download`,e,new URLSearchParams({file:n}))}function XN(){return BM(`/api/backups`)}function ZN(e,t,n){return BM(RN(`/api/notifications/destinations/${encodeURIComponent(t)}/token`,e),{method:`PUT`,body:JSON.stringify({botToken:n})})}function QN(e,t){return BM(RN(`/api/notifications/destinations/${encodeURIComponent(t)}/token`,e),{method:`DELETE`})}function $N(e,t,n){return BM(RN(`/api/notifications/destinations/${encodeURIComponent(t)}/test`,e),{method:`POST`,body:JSON.stringify(n)})}function eP(e,t,n){return BM(RN(`/api/notifications/destinations/${encodeURIComponent(t)}/detect-chats`,e),{method:`POST`,body:JSON.stringify(n)})}function tP(e,t){return BM(RN(`/api/notifications/test-webhook`,e),{method:`POST`,body:JSON.stringify(t)})}async function nP(e){return UM(await BM(RN(`/api/ddns`,e)))}async function rP(e,t){return UM(await BM(RN(`/api/ddns`,e),{method:`PUT`,body:JSON.stringify(t)}))}async function iP(e,t,n,r){return UM(await BM(RN(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`PUT`,body:JSON.stringify({provider:n,credentials:r})}))}async function aP(e,t){return UM(await BM(RN(`/api/ddns/credentials/${encodeURIComponent(t)}`,e),{method:`DELETE`}))}async function oP(e){return UM(await BM(RN(`/api/ddns/check`,e),{method:`POST`}))}function sP(e,t){return BM(`/api/settings/tls`,{method:`POST`,body:JSON.stringify({certificate:e,privateKey:t})})}function cP(){return BM(`/api/settings/tls`,{method:`DELETE`})}async function lP(e,t,n){let r=await NN.api.servers[`:id`][n].$post(LN(e,t)),i=await r.json().catch(()=>null);if(!r.ok)throw Error(VM(i,r.status));return i??{ok:!0}}async function uP(e,t){return BM(RN(`/api/servers/orphans/${encodeURIComponent(t)}/stop`,e),{method:`POST`})}function dP(e){return BM(RN(`/api/servers/start-all`,e),{method:`POST`})}async function fP(e,t){let n=await NN.api.servers[`:id`][`free-port`].$post(LN(e,t)),r=await n.json().catch(()=>null);if(!n.ok)throw Error(VM(r,n.status));return r??{ok:!0,port:null,terminated:[],forced:[],skipped:[],free:!1}}function pP(e,t={}){return BM(RN(`/api/servers/stop-all`,e,t.withPersistent===!0?new URLSearchParams({withPersistent:`true`}):void 0),{method:`POST`})}function mP(e,t){return BM(RN(`/api/servers/${encodeURIComponent(t)}/clear-logs`,e),{method:`POST`})}function hP(e,t,n){return BM(RN(`/api/servers/${encodeURIComponent(t)}`,e),{method:`PATCH`,body:JSON.stringify(n)})}function gP(e,t){return BM(RN(`/api/servers/${encodeURIComponent(t)}`,e),{method:`DELETE`})}function _P(e,t){return BM(RN(`/api/servers`,e),{method:`POST`,body:JSON.stringify(t)})}var vP=k(null),yP=k(null);function bP(e){return e===null?`wait`:e.authRequired&&!e.authenticated?`login`:`connect`}function xP(){async function e(){try{vP.value=await rN()}catch{vP.value=null}}async function t(e){yP.value=null;try{return vP.value=await oN(e),!0}catch(e){return yP.value=IM(e),!1}}async function n(){try{await sN()}finally{await e()}}function r(){vP.value={authenticated:!1,authRequired:!0,passwordSet:vP.value?.passwordSet??!0,apiTokenSet:vP.value?.apiTokenSet??!1,usingDefaultPassword:vP.value?.usingDefaultPassword??!1,defaultPassword:vP.value?.defaultPassword??null,sessionTtlMs:vP.value?.sessionTtlMs??0}}async function i(t,n){yP.value=null;try{return await hN(t,n),await e(),null}catch(e){return IM(e)}}async function a(){yP.value=null;try{return await XM(),await e(),null}catch(e){return IM(e)}}return{session:rn(vP),error:rn(yP),refresh:e,login:t,logout:n,requireLogin:r,setPassword:i,clearPassword:a}}var SP=k([]),CP=1;function wP(e){SP.value=SP.value.filter(t=>t.id!==e)}function TP(e,t=4800){let n=CP++;return SP.value=[...SP.value,{...e,id:n}],t>0&&setTimeout(wP,t,n),n}function EP(){return{toasts:rn(SP),dismiss:wP,push:TP,success:(e,t)=>TP({tone:`ok`,title:e,description:t}),failure:(e,t)=>TP({tone:`danger`,title:e,description:t},9e3),info:(e,t)=>TP({tone:`info`,title:e,description:t}),warn:(e,t)=>TP({tone:`warn`,title:e,description:t},7e3)}}var DP=t({default:()=>OP}),OP={"activity.emptyTitle":`No events in the last 24 hours`,"activity.emptyDescription":`Starts, exits, crashes and recoveries show up here as they happen.`,"activity.ran":`ran {duration}`,"addServer.title":`Add a server`,"addServer.description":`Tell it what to run in {workspace} — a command and the folder it runs in are enough to start.`,"addServer.thisWorkspace":`this workspace`,"addServer.identity":`Identity`,"addServer.id":`Id`,"addServer.idHint":`Lowercase letters, digits, dashes and underscores; used in URLs and logs.`,"addServer.labelHint":`Shown in the panel; defaults to the id.`,"addServer.process":`Process`,"addServer.commandHint":`Spawned without a shell.`,"addServer.argumentsHint":`One argument per line; whitespace inside a line is preserved.`,"addServer.portLifecycle":`Port & lifecycle`,"addServer.bindHint":`lan exposes it to the network; only do that behind auth.`,"addServer.advanced":`Advanced settings`,"addServer.advancedHint":`environment, backups, policy, lifecycle, bootstrap`,"addServer.backups":`Backups`,"addServer.backupIgnore":`Ignore known generated files`,"addServer.bootstrapDescription":`A one-off command run before the first start.`,"addServer.bootstrapHint":`Installs, migrations, downloads — before the first start, not on every one.`,"addServer.policyResources":`Policy & resources`,"addServer.logBufferHint":`Blank keeps the default.`,"addServer.inheritNote":`Restart, health and stop start out matching {settings}; change one here and it is written into this entry instead of staying inherited.`,"addServer.serverDefaults":`Settings → Server defaults`,"addServer.placeholdersTitle":`Available placeholders (arguments and environment)`,"addServer.submit":`Add server`,"app.name":`home-hosted`,"app.tagline":`Process supervisor control panel`,"bind.local":`local — 127.0.0.1`,"bind.lan":`lan — 0.0.0.0`,"bind.explicit":`{bind} — explicit`,"common.cancel":`Cancel`,"common.confirm":`Confirm`,"common.reset":`Reset`,"common.sending":`Sending…`,"common.keepIt":`Keep it`,"common.remove":`Remove`,"common.close":`Close`,"common.save":`Save`,"common.saving":`Saving…`,"common.discard":`Discard`,"common.delete":`Delete`,"common.edit":`Edit`,"common.add":`Add`,"common.retry":`Retry`,"common.copy":`Copy`,"common.copied":`Copied`,"common.copyFailed":`Could not copy`,"common.enabled":`Enabled`,"common.disabled":`Disabled`,"common.none":`None`,"common.unknown":`unknown`,"common.loading":`Loading…`,"common.selectAll":`Select all`,"common.selectNone":`Select none`,"common.name":`Name`,"common.label":`Label`,"common.hostname":`Hostname`,"common.port":`Port`,"common.command":`Command`,"common.environment":`Environment`,"common.memory":`Memory`,"common.cpu":`CPU`,"common.disk":`Disk`,"common.uptime":`Uptime`,"common.status":`Status`,"common.actions":`Actions`,"common.details":`Details`,"common.overview":`Overview`,"common.warning":`Warning`,"common.error":`Error`,"common.confirmQuestion":`{label}?`,"common.unset":`unset`,"common.never":`never`,"common.now":`now`,"common.dismiss":`Dismiss`,"common.notAvailable":`n/a`,"connection.live":`Live`,"connection.connecting":`Connecting`,"connection.reconnecting":`Reconnecting`,"connection.liveUpdates":`Live updates`,"editor.title":`Edit configuration`,"editor.description":`Writes overrides to {file}; anything left alone keeps inheriting the defaults.`,"editor.inSync":`in sync`,"editor.process":`Process`,"editor.processDescription":`What gets spawned, where, and with which environment.`,"editor.labelPlaceholder":`falls back to the id`,"editor.argumentsHint":`One per line; {port} {host} {home} {projectDir} {dataRoot} {id} {label} {cwd} {bind} {lanIp} are substituted.`,"editor.portTitle":`Port & binding`,"editor.portDescription":`How the port is preflighted and where the process is reachable.`,"editor.bindHint":`A custom IPv4 the config already sets stays selectable.`,"editor.lifecycle":`Lifecycle`,"editor.lifecycleDescription":`Whether the supervisor owns this entry at all.`,"editor.save":`Save to servers.config.json`,"editor.changesTitle":`Unsaved changes`,"editor.changesDescription":`What Save would write to servers.config.json.`,"editor.nothingToSave":`Nothing to save.`,"health.disabled":`Not checked`,"health.unknown":`Not probed`,"health.healthy":`Healthy`,"health.unhealthy":`Unhealthy`,"history.start":`Started`,"history.exit":`Exited`,"history.crash":`Crashed`,"history.forcedRestart":`Forced restart`,"history.unhealthy":`Unhealthy`,"history.recovered":`Recovered`,"host.loadPerCpu":`Load / cpu`,"host.cpuTemp":`CPU temp`,"host.samplingOff":`Host sampling is off`,"host.samplingOffDescription":`Turn it on in Settings to collect load, memory, disk and temperature.`,"host.swap":`Swap`,"host.cpus":`CPUs`,"host.loadAverage":`Load 1 / 5 / 15`,"host.memoryUsed":`Memory used`,"host.sampled":`Sampled`,"host.filesystems":`Filesystems`,"host.thresholdsBreached":`Thresholds breached`,"host.cpuUsage":`CPU usage`,"host.loadHint":`Load counts runnable tasks, it is not a percentage: 1.00 is one core’s worth of work. CPU usage above is the real share of this machine.`,"host.perCpu":`per cpu`,"host.samplingOffCompact":`Sampling is disabled in Settings.`,"host.statusOff":`off`,"killPort.trigger":`Kill what holds port {port}`,"killPort.title":`Kill the process on port {port}?`,"killPort.body":`It is asked to stop first, and killed only if it ignores that. Anything this panel supervises is refused, so a managed server cannot be lost this way.`,"killPort.confirm":`Kill it`,"language.label":`Language`,"language.select":`Select a language`,"lifecycle.restartTitle":`Restart policy`,"lifecycle.restartDescription":`Backoff between attempts after a crash.`,"lifecycle.restartOnCrash":`Restart on crash`,"lifecycle.maxRetries":`Max retries`,"lifecycle.maxRetriesHint":`Attempts before the server is left crashed.`,"lifecycle.baseDelay":`Base delay (ms)`,"lifecycle.factor":`Backoff factor`,"lifecycle.maxDelay":`Max delay (ms)`,"lifecycle.resetAfter":`Reset after (ms)`,"lifecycle.resetAfterHint":`A run this long clears the retry counter.`,"lifecycle.healthTitle":`Health check`,"lifecycle.healthDescription":`How readiness is probed once the process is up.`,"lifecycle.probe":`Probe this server`,"lifecycle.probeType":`Probe type`,"lifecycle.probePort":`TCP port — connection only`,"lifecycle.probeHttp":`HTTP request — assert a response`,"lifecycle.interval":`Interval (ms)`,"lifecycle.timeout":`Timeout (ms)`,"lifecycle.unhealthyAfter":`Unhealthy after`,"lifecycle.unhealthyAfterHint":`Consecutive failed probes.`,"lifecycle.forceRestartAfter":`Force restart after (ms)`,"lifecycle.forceRestartAfterHint":`0 disables it.`,"lifecycle.startTimeout":`Start timeout (ms)`,"lifecycle.httpScheme":`Scheme`,"lifecycle.allowInvalidCert":`Accept any certificate`,"lifecycle.allowInvalidCertHint":`For a self-signed backend. Only meaningful over https.`,"lifecycle.httpPath":`HTTP path`,"lifecycle.httpMethod":`HTTP method`,"lifecycle.expectStatus":`Expect status`,"lifecycle.expectStatusHint":`Blank accepts anything below.`,"lifecycle.expectStatusBelow":`Healthy below status`,"lifecycle.expectBody":`Body must contain`,"lifecycle.expectBodyPlaceholder":`optional substring`,"lifecycle.headBodyHint":`HEAD has no response body, so this check is ignored — use GET, or clear it.`,"lifecycle.stopTitle":`Stop behaviour`,"lifecycle.stopDescription":`How the process tree is asked to go away.`,"lifecycle.signal":`Signal`,"lifecycle.signalTerm":`SIGTERM — ask it to stop`,"lifecycle.signalInt":`SIGINT — interrupt (Ctrl-C)`,"lifecycle.signalKill":`SIGKILL — kill immediately`,"lifecycle.grace":`Grace period (ms)`,"lifecycle.killGroup":`Kill the whole process group`,"lifecycle.killPortHolders":`Also kill whatever holds the port`,"login.title":`Sign in to continue`,"login.firstRunTitle":`This panel has no password yet`,"login.firstRunSubtitle":`Anything on this machine can reach it. Set a password right after you are in.`,"login.authOffTitle":`Authentication is turned off`,"login.authOffSubtitle":`The panel only listens on loopback, which is the only thing protecting it right now.`,"login.subtitle":`The control panel is protected. Enter the password to continue.`,"login.password":`Password`,"login.showPassword":`Show password`,"login.hidePassword":`Hide password`,"login.signIn":`Sign in`,"login.openDashboard":`Open the dashboard`,"login.exposed":`Exposed`,"login.defaultPasswordWarning":`Still on the default password {password}. Change it under Settings — binding beyond 127.0.0.1 stays refused until you do.`,"login.noPasswordWarning":`No password is set. Open Settings from this machine to add one, or run {command}.`,"login.sessionNote":`Sessions stay signed in for {duration} after the last visit — each request extends that window. Signing out clears this browser only.`,"login.servedFromThisMachine":`served from this machine`,"logs.emptyHint":`No output yet.`,"logs.noMatches":`Nothing matches that search or stream filter.`,"logs.searchPlaceholder":`Search this output`,"logs.searchLabel":`Search the log output`,"logs.clearSearch":`Clear the search`,"logs.prevMatch":`Previous match`,"logs.nextMatch":`Next match`,"logs.showTimestamps":`Show timestamps`,"logs.hideTimestamps":`Hide timestamps`,"logs.timestampsShort":`ts`,"logs.pause":`Pause`,"logs.follow":`Follow`,"logs.clearHint":`Clear the in-memory buffer`,"logs.clearLabel":`Clear the log buffer`,"logs.downloadHint":`Download the persisted file`,"logs.downloadLabel":`Download the log file`,"logs.outputLabel":`Log output`,"logs.jumpToLatest":`Jump to latest`,"logs.streaming":`streaming`,"logs.paused":`paused`,"logs.snapshot":`snapshot`,"logs.linesOf":`{count} of {total} lines`,"logs.matches":`{count} matches`,"logs.rowHeight":`row height {height}px · windowed`,"logs.streamAll":`All`,"logs.streamOut":`out`,"logs.streamErr":`err`,"logs.streamSys":`sys`,"metric.emptyHint":`collecting…`,"metric.notRunning":`not running`,"nav.global":`Global`,"nav.workspace":`Workspace`,"nav.others":`Others`,"nav.overview":`Overview`,"nav.servers":`Servers`,"nav.logs":`Logs`,"nav.workspaceSettings":`Workspace settings`,"nav.globalOverview":`Global Overview`,"nav.globalSettings":`Global settings`,"nav.reverseProxy":`Reverse Proxy`,"nav.navigation":`Navigation`,"nav.closeNavigation":`Close navigation`,"nav.hostVitals":`Host vitals`,"notice.configError":`The config could not be read: {error}`,"notice.configErrorHint":`The panel keeps running the config it already had; fix {path} and it reloads on its own.`,"notice.defaultPassword":`This panel is still on its default password.`,"notice.defaultPasswordHint":`Change it in Global settings — binding beyond 127.0.0.1 stays refused until you do.`,"notice.noPassword":`Authentication is on but no password is set, so nothing is being asked for.`,"notice.noPasswordHint":`Set one in Global settings to actually lock the panel.`,"notice.exposed":`This panel is reachable beyond 127.0.0.1.`,"notice.exposedHint":`Keep the password strong, or put a TLS-terminating proxy in front of it.`,"notice.authOff":`Authentication is disabled — the panel is only protected by its loopback bind.`,"onPortConflict.block":`block — refuse to start`,"onPortConflict.warn":`warn — start anyway`,"onPortConflict.follow":`follow — adopt a detached restart of itself`,"onPortConflict.reclaim":`reclaim — replace it with a supervised copy`,"onPortConflict.kill":`kill — stop whatever holds the port`,"palette.placeholder":`Jump to a server, run an action, open a setting…`,"palette.openServer":`Open {label}`,"palette.serverLogs":`Logs for {label}`,"palette.startServer":`Start {label}`,"palette.stopServer":`Stop {label}`,"palette.restartServer":`Restart {label}`,"palette.goOverview":`Go to Overview`,"palette.goGlobalOverview":`Go to Global Overview`,"palette.goGlobalSettings":`Go to Global settings`,"palette.goProxy":`Go to Reverse Proxy`,"palette.goServers":`Go to Servers`,"palette.goLogs":`Go to Logs`,"palette.goWorkspaceSettings":`Go to Workspace settings`,"palette.startAll":`Start every enabled server here`,"palette.stopAll":`Stop every server here`,"palette.switchWorkspace":`Switch to {label}`,"palette.globalSetting":`Global setting: {label}`,"palette.workspaceSetting":`Workspace setting: {label}`,"palette.theme":`{theme} theme`,"palette.groupServers":`Servers`,"palette.groupActions":`Actions`,"palette.groupNavigate":`Navigate`,"palette.groupWorkspaces":`Workspaces`,"palette.groupAppearance":`Appearance`,"palette.navigate":`navigate`,"palette.run":`run`,"palette.noMatches":`Nothing matches “{query}”.`,"presets.pickTitle":`What do you want to run?`,"presets.pickDescription":`Pick one and it fills the form for you. You can change every field afterwards.`,"presets.startFromScratch":`Start from scratch`,"presets.minecraft":`Minecraft`,"presets.minecraftHint":`A Java server: set the working directory to the folder holding server.jar, and raise the memory limit if it is a big world.`,"presets.node":`A Node app`,"presets.nodeHint":`A Node app: set the working directory to your project and change server.js if your entry file is named differently.`,"presets.python":`A Python server`,"presets.pythonHint":`A quick file server: it serves the working directory, so point that at the folder you want to share.`,"presets.docker":`Docker Compose`,"presets.dockerHint":`Runs docker compose up in the working directory; set the port to what the file publishes.`,"presets.bot":`A chat bot`,"presets.botHint":`A chat bot: set the working directory to its folder and change bot.js to your script. A bot has no port, so leave the port blank.`,"presets.jellyfin":`Jellyfin`,"presets.jellyfinHint":`A media server: start it once and set up your library in Jellyfin’s own web page on port 8096.`,"presets.gitea":`Gitea (rootless)`,"presets.giteaHint":`The rootless binary: set the working directory to its folder, then finish setup in its web page on port 3000. Git over SSH uses port 2222.`,"presets.mongodb":`MongoDB`,"presets.mongodbHint":`A database: the working directory holds its data folder, so add that folder to the entry’s backup paths.`,"proxy.account.automatic":`Automatic (the only account that can answer)`,"proxy.account.noTxt":`no TXT support`,"proxy.account.noCredentials":`no credentials`,"proxy.account.gone":`That account is no longer configured.`,"proxy.account.emptyHint":`DNS-01 writes the challenge record here. Empty uses the only account that can answer a challenge, when there is one.`,"proxy.account.cannotWrite":`A {provider} account cannot write TXT records, so it cannot answer a DNS-01 challenge.`,"proxy.account.noCredentialsYet":`No credentials are stored for this {provider} account yet.`,"proxy.account.through":`The challenge is written through this {provider} account.`,"proxy.certificate.title":`Uploaded certificates`,"proxy.certificate.description":`Served by routes set to “Uploaded certificate”. Everything else — public or local — is certified by the engine on its own.`,"proxy.certificate.add":`Add certificate`,"proxy.certificate.emptyTitle":`No certificate uploaded`,"proxy.certificate.emptyDescription":`A route set to “Uploaded certificate” needs a pair covering its hostname, or the engine has nothing to serve for it.`,"proxy.certificate.daysLeft":`{days} days left`,"proxy.certificate.subject":`Subject`,"proxy.certificate.issuer":`Issuer`,"proxy.certificate.validUntil":`Valid until`,"proxy.certificate.covers":`Covers`,"proxy.certificate.noSans":`no hostnames in its SANs`,"proxy.certificate.removeAria":`Remove {name}`,"proxy.certificate.removeQuestion":`Remove “{name}”?`,"proxy.certificate.removeBody":`The pair is deleted from disk. A route still set to “Uploaded certificate” keeps serving the engine's own certificate until you change it, and the panel refuses this while one still serves it.`,"proxy.certificate.removeIt":`Remove it`,"proxy.certificate.stored":`“{label}” stored.`,"proxy.certificate.removed":`“{name}” removed.`,"proxy.certificateDialog.title":`Add a certificate`,"proxy.certificateDialog.description":`The pair is stored on disk under its id, and a route set to “Uploaded certificate” can serve it.`,"proxy.certificateDialog.label":`Label`,"proxy.certificateDialog.labelPlaceholder":`Home wildcard`,"proxy.certificateDialog.id":`Id`,"proxy.certificateDialog.idHint":`names the files on disk`,"proxy.certificateDialog.certFile":`Certificate file (.pem, .crt)`,"proxy.certificateDialog.keyFile":`Private key file (.pem, .key)`,"proxy.certificateDialog.pasteCert":`Or paste the certificate`,"proxy.certificateDialog.pasteKey":`Or paste the private key`,"proxy.certificateDialog.certPlaceholder":`-----BEGIN CERTIFICATE-----`,"proxy.certificateDialog.keyPlaceholder":`-----BEGIN PRIVATE KEY-----`,"proxy.certificateDialog.store":`Store the certificate`,"proxy.certificateDialog.errorLabel":`a label is required`,"proxy.certificateDialog.errorId":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.certificateDialog.errorTaken":`“{id}” is already used by another certificate`,"proxy.certificateDialog.errorCertificate":`paste or choose the certificate`,"proxy.certificateDialog.errorPrivateKey":`paste or choose the private key`,"proxy.engine.title":`Engine`,"proxy.engine.description":`The reverse proxy itself. The panel downloads the current build, supervises it and applies its configuration through the engine's own admin API.`,"proxy.engine.notInFrame":`The proxy state is not in this panel's frame yet.`,"proxy.engine.readFailed":`The engine could not be read`,"proxy.engine.notInstalled":`No engine installed`,"proxy.engine.installNote":`Installing downloads the current {engine} release the panel supervises — about 46 MB, once. Nothing is exposed until a route is added and the proxy is switched on.`,"proxy.engine.version":`Version`,"proxy.engine.notProbed":`not probed yet`,"proxy.engine.source":`Source`,"proxy.engine.sourceCustom":`a path configured by hand`,"proxy.engine.sourceDownloaded":`downloaded by the panel`,"proxy.engine.size":`Size`,"proxy.engine.binary":`Binary`,"proxy.engine.copyPath":`Copy the binary path`,"proxy.engine.address":`Live address`,"proxy.engine.process":`Process`,"proxy.engine.certificates":`Certificates`,"proxy.engine.noCert":`no public certificate yet`,"proxy.engine.expiresSoon":`soonest expires in {days} days`,"proxy.engine.acme":`ACME certificates`,"proxy.engine.localCa":`Local CA`,"proxy.engine.dns01":`DNS-01`,"proxy.engine.tcpUdp":`TCP/UDP`,"proxy.engine.documentation":`{engine} documentation`,"proxy.engine.failed":`The engine reported a failure`,"proxy.engine.setcapHint":`A privileged port (below 1024) needs this once on Linux:`,"proxy.engine.copyCommand":`Copy the command`,"proxy.engine.install":`Install engine`,"proxy.engine.start":`Start`,"proxy.engine.stop":`Stop`,"proxy.engine.apply":`Apply configuration`,"proxy.engine.revert":`Revert`,"proxy.engine.revertHint":`Go back to the configuration that applied before the last one`,"proxy.engine.update":`Update engine`,"proxy.listener.title":`Listener & certificates`,"proxy.listener.description":`Where the proxy listens. 80 and 443 are what a router forwards and what an ACME challenge expects; a port below 1024 needs a privileged bind.`,"proxy.listener.unprivilegedPorts":`unprivileged ports`,"proxy.listener.run":`Run the reverse proxy`,"proxy.listener.runHint":`Saved with Save settings; the panel starts or stops the engine to match.`,"proxy.listener.httpPort":`HTTP port`,"proxy.listener.httpPortHint":`ACME HTTP-01 challenges and the redirect to HTTPS.`,"proxy.listener.httpsPort":`HTTPS port`,"proxy.listener.httpsPortHint":`Where certificates are served.`,"proxy.listener.useFallback":`Use {http} / {https}`,"proxy.listener.useStandard":`Use 80 / 443`,"proxy.listener.forwardHint":`Running unprivileged — forward 80 and 443 to these ports on your router.`,"proxy.listener.privilegedTitle":`A port below 1024 needs a privileged bind`,"proxy.listener.privilegedBody":`Running the panel as your own user cannot bind 80 or 443 without permission. Either grant it once {how} and restart the engine, or keep {http}/{https} and forward 80/443 from your router. On Windows the port is free to bind, but something else may hold it.`,"proxy.listener.privilegedWithSetcap":`with {command} on the engine binary`,"proxy.listener.email":`ACME account e-mail`,"proxy.listener.emailPlaceholder":`you@example.com`,"proxy.listener.emailHint":`Let's Encrypt uses it to warn you about an expiring certificate. A local-only name gets the engine's own CA and needs none.`,"proxy.listener.emailNeededTitle":`An e-mail is needed for automatic HTTPS`,"proxy.listener.emailNeededBody":`“{host}” is a public hostname, so the engine asks a CA for a certificate and the account address is required. Fill it in, switch the route's TLS off, or turn on the staging endpoint while you try things out.`,"proxy.listener.staging":`Use the ACME staging endpoint`,"proxy.listener.stagingHint":`Untrusted certificates and no rate-limit burn while you try things out.`,"proxy.listener.dns01":`Answer challenges with DNS-01`,"proxy.listener.dns01Hint":`The panel writes the challenge record through a route's DNS account, so no inbound port is needed to get a certificate.`,"proxy.listener.resolvers":`Check the record against`,"proxy.listener.resolversPlaceholder":`1.1.1.1, 8.8.8.8`,"proxy.listener.resolversHint":`Nameservers the engine reads the record from; empty uses its own. Needed where split-horizon DNS shows it a different view.`,"proxy.listener.noAccountTitle":`No DNS account can answer a challenge`,"proxy.listener.noAccountBody":`DNS-01 is on, but no account has credentials it can use. Add one under Workspace Settings → Dynamic DNS, or public names stay on the port challenges and wait for a CA that cannot reach them.`,"proxy.listener.manyAccountsTitle":`Each public route has to pick an account`,"proxy.listener.manyAccountsBody":`More than one account can answer, so “Automatic” cannot choose. Pick one per route, or those names stay on the port challenges.`,"proxy.listener.accountNote":`Each route picks its own account, so names in different zones each get the right one. A route left on “Automatic” uses the only account the table names. A name no account answers stays on the port challenges.`,"proxy.listener.pendingNote":`A public name whose certificate is still being issued is reachable in the meantime — over HTTPS with a temporary untrusted certificate, or over plain HTTP with a page naming the ports to forward.`,"proxy.retry.inFallback":`~8 hours`,"proxy.retryButton.force":`Force retry certificate`,"proxy.retryButton.question":`Ask the CA again for {host}?`,"proxy.retryButton.body":`The engine failed to obtain a CA certificate for this hostname previously and is using its local CA. It retries automatically every {retryIn}.`,"proxy.retryButton.warning":`Retrying now will kill this route and make it unavailable for a bit, are you sure to continue?`,"proxy.retryButton.leave":`Leave it`,"proxy.retryButton.now":`Retry now`,"proxy.routeDialog.titleEdit":`Edit route`,"proxy.routeDialog.titleAdd":`Add route`,"proxy.routeDialog.description":`A hostname, what it forwards to, and how it is served over TLS.`,"proxy.routeDialog.hostname":`Hostname`,"proxy.routeDialog.hostnamePlaceholder":`gitea.example.com`,"proxy.routeDialog.path":`Path prefix`,"proxy.routeDialog.pathPlaceholder":`/optional`,"proxy.routeDialog.pathHint":`Empty serves the whole host.`,"proxy.routeDialog.target":`Target`,"proxy.routeDialog.tls":`TLS`,"proxy.routeDialog.dnsAccount":`DNS account`,"proxy.routeDialog.localNote":`A local-only name is signed by the engine's own CA, so no DNS account is involved.`,"proxy.routeDialog.workspace":`Workspace`,"proxy.routeDialog.server":`Server`,"proxy.routeDialog.noServers":`this workspace has no servers`,"proxy.routeDialog.stoppedNote":`A server that is stopped is not routed: the row shows “No upstream” until it runs again.`,"proxy.routeDialog.upstream":`Upstream`,"proxy.routeDialog.upstreamPlaceholder":`http://10.0.0.5:8080`,"proxy.routeDialog.upstreamHint":`A literal address, including the port. A scheme is optional.`,"proxy.routeDialog.panelNote":`Serving the control panel needs authentication on and a password that is not the default — the panel refuses the save otherwise.`,"proxy.routeDialog.save":`Save route`,"proxy.routes.title":`Routes`,"proxy.routes.description":`One public hostname per service. A route may point at a supervised server in any workspace, at this panel, or at a literal upstream.`,"proxy.routes.add":`Add route`,"proxy.routes.cannotSaveTitle":`These routes cannot be saved as they stand`,"proxy.routes.cannotRoute":`{host} cannot be routed`,"proxy.routes.emptyTitle":`No routes yet`,"proxy.routes.emptyDescription":`Add one to expose a server through a domain — the engine gets the certificate on its own.`,"proxy.routes.addFirst":`Add the first route`,"proxy.routes.columnHostname":`Hostname`,"proxy.routes.columnTarget":`Target`,"proxy.routes.columnUpstream":`Upstream`,"proxy.routes.columnTls":`TLS`,"proxy.routes.columnState":`State`,"proxy.routes.columnOn":`On`,"proxy.routes.openInTab":`Open {url} in a new tab`,"proxy.routes.noHostname":`no hostname yet`,"proxy.routes.toggle":`Route {name}`,"proxy.routes.edit":`Edit {name}`,"proxy.routes.remove":`Remove {name}`,"proxy.status.certified":`certificate ready`,"proxy.status.localCa":`engine CA`,"proxy.status.uploaded":`uploaded pair`,"proxy.status.awaitingCa":`waiting for the CA`,"proxy.status.failed":`certificate failed`,"proxy.status.fellBack":`Fell back to Local CA`,"proxy.status.serving":`Serving`,"proxy.status.disabled":`Disabled`,"proxy.status.noUpstream":`No upstream`,"proxy.status.error":`Error`,"proxy.status.unapplied":`Not applied yet`,"proxy.status.off":`Off`,"proxy.status.stopped":`Stopped`,"proxy.status.starting":`Starting`,"proxy.status.running":`Running`,"proxy.status.unsupported":`Unsupported`,"proxy.target.server":`A supervised server`,"proxy.target.panel":`This control panel`,"proxy.target.external":`A literal upstream`,"proxy.target.controlPanel":`control panel`,"proxy.target.noServer":`no server picked`,"proxy.target.noUpstream":`no upstream`,"proxy.tls.auto":`Automatic — the engine decides`,"proxy.tls.off":`Off — plain HTTP`,"proxy.tls.manual":`Uploaded certificate`,"proxy.tls.plain":`plain HTTP`,"proxy.tls.uploaded":`uploaded certificate`,"proxy.tls.letsEncrypt":`Let’s Encrypt`,"proxy.tls.engineCa":`engine CA (local)`,"proxy.tls.hintOff":`Plain HTTP: no certificate is served for this hostname.`,"proxy.tls.hintManual":`Serves the certificate pair uploaded below.`,"proxy.tls.hintEmpty":`A public hostname gets an ACME certificate; a local-only name gets the engine’s own CA.`,"proxy.tls.hintPublic":`A public hostname, so the engine asks a CA for a certificate — an ACME account e-mail is needed.`,"proxy.tls.hintLocal":`A local-only name, so the engine signs it with its own locally-trusted CA.`,"proxy.validation.labelRequired":`a label is required`,"proxy.validation.idPattern":`the id must start with a letter or digit, then letters, digits, dash or underscore`,"proxy.validation.hostRequired":`a hostname is required`,"proxy.validation.hostPattern":`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,"proxy.validation.hostTaken":`"{host}" is already routed for this path`,"proxy.validation.pathSlash":`a path prefix starts with /`,"proxy.validation.pathSpace":`a path prefix cannot contain a space`,"proxy.validation.idTaken":`route id "{id}" is used twice`,"proxy.validation.workspaceRequired":`pick the workspace that owns the server`,"proxy.validation.serverRequired":`pick a server in that workspace`,"proxy.validation.url":`an upstream like http://10.0.0.5:8080`,"proxy.view.title":`Reverse Proxy`,"proxy.view.description":`Expose your servers through domains, with automatic HTTPS via 80/443 or a DNS challenge.`,"proxy.view.dnsNote":`For DNS-01, add the domain's DNS provider to any workspace under Workspace Settings → Dynamic DNS; a route can then pick that account, from any workspace.`,"proxy.view.readFailed":`The reverse proxy could not be read`,"proxy.view.reading":`Reading the reverse proxy…`,"proxy.view.engineInstalled":`Engine installed`,"proxy.view.engineStarting":`Engine starting`,"proxy.view.engineStopping":`Engine stopping`,"proxy.view.configApplied":`Configuration applied`,"proxy.view.configReverted":`Configuration reverted`,"proxy.view.settingsSaved":`Settings saved.`,"proxy.view.settingsSavedToast":`Settings saved`,"proxy.view.retryFailed":`the retry failed`,"proxy.view.retryAsked":`asking the CA again for {host}`,"proxy.view.fieldChanged":`field changed`,"proxy.view.fieldsChanged":`fields changed`,"proxy.view.noChanges":`No unsaved changes`,"proxy.view.discard":`Discard changes`,"proxy.view.save":`Save settings`,"proxy.view.concurrentEdit":`Someone else changed {ids} while you had this page open. Reload to see their version, then reapply your edit.`,"serverCard.open":`Open {url}`,"serverCard.adoptedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"serverCard.detached":`detached`,"serverCard.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only an explicit stop does.","serverCard.persistent":`persistent`,"serverCard.disabled":`disabled`,"serverCard.autostart":`autostart`,"serverCard.healthProbe":`Health probe`,"serverCard.notProbed":`not probed`,"serverCard.restarts":`Restarts`,"serverCard.pid":`PID`,"serverCard.rss":`RSS`,"serverCard.procs":`Procs`,"serverCard.portFree":`free`,"serverCard.portInUse":`in-use`,"serverCard.uptime24h":`24h up`,"serverCard.probe":`Probe`,"serverCard.crashes24h":`24h crashes`,"serverCard.lastCrash":`Last crash`,"serverCard.unhealthyFor":`Unhealthy for {duration}`,"serverCard.nextAttempt":`Next attempt {when}`,"serverCard.start":`Start`,"serverCard.stop":`Stop`,"serverCard.restart":`Restart`,"serverCard.detailsHint":`Live logs and full telemetry`,"serverCard.moreActions":`More actions for {label}`,"serverCard.disable":`Disable server`,"serverCard.enable":`Enable server`,"serverCard.removeFromAutostart":`Remove from autostart`,"serverCard.autostartWithPanel":`Autostart with the panel`,"serverCard.clearLogBuffer":`Clear log buffer`,"serverCard.removeServer":`Remove server`,"serverCard.removeTitle":`Remove this server?`,"serverCard.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"serverCard.statusField":`status`,"serverCard.idField":`id`,"serverForm.workingDirectory":`Working directory`,"serverForm.cwdHint":`Relative paths resolve under projectDir.`,"serverForm.arguments":`Arguments`,"serverForm.portHint":`Blank means the server has no port to probe or preflight.`,"serverForm.bindAddress":`Bind address`,"serverForm.autostart":`Autostart with up`,"serverForm.autostartHint":`Start it whenever the control plane comes up.`,"serverForm.persistent":`Persistent`,"serverForm.persistentHint":"Keeps running when the panel stops; `down` reports it instead of stopping it.","serverForm.envHint":`KEY=value per line, exported to the process. Placeholders like {port} work here too.`,"serverForm.dataEnvs":`Data envs`,"serverForm.dataEnvsHint":`ENV=path per line — exported to the process and backed up automatically.`,"serverForm.envFile":`Env file`,"serverForm.envFilePlaceholder":`optional KEY=value file`,"serverForm.envFileHint":`Loaded at spawn; its values override env.`,"serverForm.dependsOn":`Depends on`,"serverForm.dependsOnHint":`Comma separated; started first and waited for until healthy, stopped last.`,"serverForm.backupPaths":`Extra backup paths`,"serverForm.backupPathsHint":`One per line, placeholders allowed; data envs are captured already.`,"serverForm.backupIgnore":`Ignore known generated files when backing this up`,"serverForm.backupIgnoreHint":`Skips node_modules, dist, .next and the other caches nothing restores from.`,"serverForm.bootstrap":`Bootstrap`,"serverForm.bootstrapDescription":`A one-off command run before the first start — installs, migrations, downloads.`,"serverForm.runBootstrap":`Run a bootstrap`,"serverForm.bootstrapHint":`Off means the entry has none and the key is sent as null.`,"serverForm.timeoutMs":`Timeout (ms)`,"serverForm.runOnce":`Only once per session`,"serverForm.runOnceHint":`Off means every start re-runs it.`,"serverForm.bootstrapArgs":`Bootstrap arguments`,"serverForm.bootstrapArgsHint":`One per line; same placeholders as the main arguments.`,"serverForm.bootstrapEnv":`Bootstrap environment`,"serverForm.bootstrapEnvHint":`KEY=value per line, exported to the bootstrap process only.`,"serverForm.onPortConflict":`On port conflict`,"serverForm.logBufferLines":`Log buffer lines`,"serverForm.maxRssMb":`Max RSS (MB)`,"serverForm.maxRssHint":`Restart above this; blank or 0 disables it.`,"serverForm.enabledHint":`Off keeps the entry in the config but refuses to start it.`,"serverForm.backupHooks":`Backups: dump and load`,"serverForm.backupHooksDescription":`For a database engine: take its own consistent dump before a backup, and load it back after a restore. {dumpDir} is the directory both commands see.`,"serverForm.dumpEnabled":`Dump before backup`,"serverForm.dumpEnabledHint":`A failed dump refuses the backup, so an archive is never half-done.`,"serverForm.dumpCommand":`Dump command`,"serverForm.dumpArgs":`Dump arguments`,"serverForm.dumpArgsHint":"One per line. `--archive={dumpDir}/db.archive` writes into the directory the archive carries.","serverForm.loadEnabled":`Load after restore`,"serverForm.loadEnabledHint":`Runs on the entry’s next start, once it is answering: mongorestore needs a live server.`,"serverForm.loadCommand":`Load command`,"serverForm.loadArgs":`Load arguments`,"serverForm.loadArgsHint":"One per line, same `{dumpDir}` the dump wrote to.","serverForm.hookEnv":`Environment`,"settings.auth.policyTitle":`Access policy`,"settings.auth.policyDescription":`Authentication applies whether the panel is on loopback or exposed to the network.`,"settings.auth.requirePassword":`Require a password`,"settings.auth.requirePasswordHint":`Every request needs a signed-in session.`,"settings.auth.sessionLifetime":`Session lifetime (s)`,"settings.auth.sessionLifetimeHint":`Idle timeout in seconds: 604800 is one week of no activity. Each request restarts it.`,"settings.auth.cookieSecure":`Cookie Secure`,"settings.auth.cookieSecureAuto":`Auto — only over HTTPS`,"settings.auth.cookieSecureAlways":`Always`,"settings.auth.cookieSecureNever":`Never — plain HTTP`,"settings.auth.trustProxy":`Behind a reverse proxy`,"settings.auth.trustProxyOff":`No — ignore x-forwarded-*`,"settings.auth.trustProxyLoopback":`Yes, from this machine only`,"settings.auth.trustProxyAny":`Yes, from any caller`,"settings.auth.trustProxyHint":`Trust x-forwarded-* for the client address and protocol. 'From this machine only' is the safe choice for a proxy on the same host. 'From any caller' believes the caller's own header, so login lockout counts per forged address and can be bypassed.`,"settings.auth.maxLoginAttempts":`Max login attempts`,"settings.auth.maxLoginAttemptsHint":`Failures before a temporary lockout.`,"settings.auth.lockout":`Lockout (s)`,"settings.auth.apiTokenSet":`An API token is set`,"settings.auth.apiTokenMissing":`No API token`,"settings.auth.apiTokenNote":`Scripts can call the API with {code} instead of signing in.`,"settings.auth.apiTokenRotation":`Changing the password does not revoke this token — run {command} and store the new one if it may have leaked.`,"settings.auth.noTokenNote":`For shell scripts and agents, generate one with {command}.`,"settings.auth.defaultPasswordTitle":`The default password is still in use`,"settings.auth.defaultPasswordText":`Set your own password below. Binding beyond {address} stays refused until you do.`,"settings.auth.blockedTitle":`This listener is being refused`,"settings.auth.noPasswordTitle":`Authentication is on but no password is set`,"settings.auth.noPasswordText":`Nothing is actually required yet, and binding beyond {address} stays refused until a password exists.`,"settings.auth.exposedTitle":`Reachable beyond 127.0.0.1`,"settings.auth.exposedText":`Keep the password strong, or put a TLS-terminating proxy in front of the panel.`,"settings.auth.changePassword":`Change password`,"settings.auth.setPassword":`Set a password`,"settings.auth.passwordDescription":`Stored as a scrypt hash in the secrets file, never in the config.`,"settings.auth.currentPassword":`Current password`,"settings.auth.newPassword":`New password`,"settings.auth.repeatPassword":`Repeat new password`,"settings.auth.passwordMismatch":`The two passwords do not match.`,"settings.auth.updatePassword":`Update password`,"settings.auth.setPasswordAndEnable":`Set password and enable auth`,"settings.auth.clearPassword":`Clear password`,"settings.auth.clearPasswordConfirm":`Confirm clear`,"settings.auth.clearPasswordTitle":`Clear the password?`,"settings.auth.clearPasswordHint":`Authentication is switched off with it, and anyone reaching the panel is let straight in.`,"settings.auth.shortPasswordTitle":`That is a short password`,"settings.auth.shortPasswordText":`It is allowed, but longer is the only thing standing between the network and this panel.`,"settings.auth.passwordUpdated":`Password updated. Other sessions were signed out.`,"settings.auth.passwordCleared":`Password cleared and authentication disabled.`,"settings.backup.createTitle":`Create a backup`,"settings.backup.createDescription":`Pick what this archive captures. Nothing is written until you create it.`,"settings.backup.chooseItems":`Choose items`,"settings.backup.partialCapture":`Only the chosen items are captured.`,"settings.backup.withoutGlobalSettings":`Without the global settings, a restore can only place a workspace where the target panel already declares it.`,"settings.backup.password":`Password (optional)`,"settings.backup.passwordHint":`Encrypts the archive; restoring it asks for the same password.`,"settings.backup.create":`Create backup`,"settings.backup.chooseItemsFor":`{label} — choose items`,"settings.backup.subDescription":`A workspace can be captured whole or only its settings, servers, secrets and declared data paths.`,"settings.backup.selectedOf":`{selected} of {total} selected`,"settings.backup.nothingSelectable":`This workspace declares nothing selectable yet.`,"settings.backup.apply":`Apply`,"settings.backup.created":`Backup created.`,"settings.backup.leafSettingsHint":`Server defaults, log retention and notifications`,"settings.backup.leafServersHint":`Every entry in servers.config.json`,"settings.backup.leafSecretsHint":`Telegram bot token and DDNS credentials`,"settings.backup.leafDataHint":`A declared data path`,"settings.backup.pathFromOrigin":`{path} — from {origin}`,"settings.backup.entrySettingsHint":`Listener, auth, host vitals and the backups policy`,"settings.backup.entrySecretsHint":`Password hash and API token hash`,"settings.backup.entryTlsHint":`The panel's own certificate pair`,"settings.backup.entryWorkspaceHint":`Its settings, servers, secrets and declared data paths`,"settings.backup.entryGlobalSettings":`Global settings`,"settings.backup.entryGlobalSecrets":`Global secrets (password, API token)`,"settings.backup.entryTlsCertificate":`TLS certificate`,"settings.backup.leafSettings":`Settings`,"settings.backup.leafServers":`Servers`,"settings.backup.leafSecrets":`Secrets`,"settings.backup.secretPassword":`Password`,"settings.backup.secretPasswordHint":`The panel's own password hash; restoring it reinstates the old password`,"settings.backup.secretApiToken":`API token`,"settings.backup.secretApiTokenHint":`The long-lived token scripts and agents use`,"settings.backup.secretTelegram":`Telegram bot token`,"settings.backup.secretTelegramHint":`Used for notifications`,"settings.backup.secretDdns":`DDNS credentials`,"settings.backup.secretDdnsHint":`Provider credentials, kept sealed with their key`,"settings.backup.restoreItemLabel":`{workspace}: {item}`,"settings.backup.noteMissing":`not set`,"settings.backup.noteCovered":`covered by {path}`,"settings.backup.noteAlreadyDeclared":`already declared by {origin}`,"settings.backup.noteContainsBackupDir":`contains the backup directory`,"settings.backup.noteMissingFromArchive":`missing from the archive`,"settings.backup.noteDeclaredByBackup":`declared by the backup's config, which is not being restored`,"settings.backup.noteNotDeclared":`not declared by this config, nor by the backup`,"settings.backup.noteRestoredFrom":`restored from {path}`,"settings.backups.policyTitle":`Policy`,"settings.backups.policyDescription":`How many archives the panel keeps, and the extra paths every one of them captures.`,"settings.backups.allow":`Allow backups`,"settings.backups.allowHint":`Off stops new archives; whatever is already on disk stays downloadable and restorable.`,"settings.backups.offTitle":`Backups are off`,"settings.backups.offText":`Nothing new is archived until this is back on. The archives below can still be downloaded, restored and deleted.`,"settings.backups.keep":`Keep`,"settings.backups.keepHint":`Older archives are pruned after each backup.`,"settings.backups.schedule":`Automatic backups`,"settings.backups.scheduleHint":`The panel writes one archive on its own, on this interval.`,"settings.backups.scheduleHours":`Every (hours)`,"settings.backups.scheduleHoursHint":`24 is a daily archive.`,"settings.backups.scheduleKeep":`Keep automatic`,"settings.backups.scheduleKeepHint":`Manual archives are counted separately, by Keep.`,"settings.backups.scheduleLast":`Last automatic: {when}`,"settings.backups.scheduleFailed":`Last attempt failed at {when}: {message}`,"settings.backups.extraPaths":`Extra paths`,"settings.backups.extraPathsHint":`Comma separated, captured in every archive on top of what each workspace declares.`,"settings.backups.extraPathsPlaceholder":`{home}/myapp-data`,"settings.backups.archiveDirectory":`Archive directory`,"settings.backups.copyArchiveDirectory":`Copy the archive directory`,"settings.backups.changeDirectory":`Changing it is a file-level decision: edit {path}.`,"settings.backups.theSettingsFile":`the settings file`,"settings.backups.capturesTitle":`What a backup captures`,"settings.backups.capturesDescription":`Pick these in the create dialog. A workspace can be taken whole or only its settings, servers, secrets and declared data paths.`,"settings.backups.nothingSelectable":`Nothing is selectable yet.`,"settings.backups.fromOrigin":`from {origin}`,"settings.backups.notCaptured":`not captured`,"settings.backups.generatedSkipped":`generated directories skipped`,"settings.backups.included":`included`,"settings.backups.skipped":`skipped`,"settings.backups.workspacesNote":`This panel serves {count} workspaces; each is its own selectable entry.`,"settings.backups.archivesTitle":`Archives`,"settings.backups.archivesDescription":`Stored in the backup directory and downloadable at any time.`,"settings.backups.create":`Create backup…`,"settings.backups.restore":`Restore…`,"settings.backups.noArchives":`No archives yet`,"settings.backups.noArchivesEnabled":`Create one now to capture the panel and whichever workspaces you pick.`,"settings.backups.noArchivesDisabled":`Nothing has been archived yet, and backups are off.`,"settings.backups.encrypted":`encrypted`,"settings.backups.download":`Download`,"settings.backups.restoreAction":`Restore`,"settings.backups.confirmDelete":`Confirm delete`,"settings.backups.deleted":`Deleted {name}.`,"settings.backups.kindSettings":`settings`,"settings.backups.kindServers":`servers`,"settings.backups.kindSecrets":`secrets`,"settings.backups.kindTls":`tls`,"settings.backups.kindData":`data`,"settings.backups.kindWorkspace":`workspace`,"settings.backups.scopeTitle":`What an automatic backup contains`,"settings.backups.scopeHint":`Left as it is, an automatic archive takes the whole default scope — every workspace and the extra paths. A choice here is written down as ids, so a workspace declared later is only covered when nothing was narrowed.`,"settings.backups.scopeChoose":`Choose…`,"settings.backups.scopeDialogTitle":`What an automatic backup contains`,"settings.backups.scopeDialogDescription":`Every automatic archive will capture this, unattended.`,"settings.backups.scopeMode":`Mode`,"settings.backups.scopeOnly":`Only these`,"settings.backups.scopeExcept":`Everything except`,"settings.backups.scopeOnlyHint":`The archive carries only what is ticked.`,"settings.backups.scopeExceptHint":`The archive carries everything except what is ticked.`,"settings.backups.scopeNothing":`Nothing is ticked — an archive of nothing is refused, so tick at least one item.`,"settings.backups.scopeSummaryAll":`Everything (the default scope)`,"settings.backups.scopeSummaryOnly":`Only {count} selected`,"settings.backups.scopeSummaryExcept":`Everything except {count}`,"settings.ddns.statePending":`Waiting`,"settings.ddns.stateOk":`Updated`,"settings.ddns.stateUnchanged":`Current`,"settings.ddns.stateSkipped":`Skipped`,"settings.ddns.stateError":`Failed`,"settings.ddns.passFinished":`Dynamic DNS pass finished`,"settings.ddns.credentialsSaved":`Credentials saved for {account}`,"settings.ddns.credentialsRemoved":`Credentials removed for {account}`,"settings.ddns.loadErrorTitle":`Dynamic DNS settings could not be loaded`,"settings.ddns.title":`Dynamic DNS`,"settings.ddns.description":`Keep these hostnames pointed at this machine's public address. Credentials live in the secrets file, never in servers.config.json.`,"settings.ddns.checking":`checking`,"settings.ddns.needsAttention":`needs attention`,"settings.ddns.watching":`watching`,"settings.ddns.updateNow":`Update now`,"settings.ddns.enabled":`Keep dynamic DNS updated`,"settings.ddns.enabledHint":`A pass runs on the interval below; a provider is only called when the address actually changed.`,"settings.ddns.interval":`Check every (s)`,"settings.ddns.intervalHint":`60 is one minute; the default is five.`,"settings.ddns.ttl":`TTL (s)`,"settings.ddns.ttlHint":`1 means automatic where the provider supports it.`,"settings.ddns.detectIpv4":`Detect IPv4`,"settings.ddns.detectIpv4Hint":`Needed for A records.`,"settings.ddns.detectIpv6":`Detect IPv6`,"settings.ddns.detectIpv6Hint":`Needed for AAAA records.`,"settings.ddns.accountsTitle":`Provider accounts`,"settings.ddns.accountsDescription":`One entry per API token. Credentials are stored on the server and never come back.`,"settings.ddns.credentialsSet":`credentials saved`,"settings.ddns.noCredentials":`no credentials`,"settings.ddns.credentials":`Credentials`,"settings.ddns.removeAccountBlocked":`Remove the hostnames using this account first`,"settings.ddns.noAccounts":`No accounts yet. Pick a provider and add one.`,"settings.ddns.provider":`Provider`,"settings.ddns.accountId":`Account id`,"settings.ddns.accountIdPlaceholder":`cloudflare-home`,"settings.ddns.accountIdHint":"The account id names the account and keys its stored credentials; lowercase letters, digits, `-` and `_`.","settings.ddns.hostnamesTitle":`Hostnames`,"settings.ddns.hostnamesDescription":`The whole list to keep updated — suba.domain.com, domain.xyz and so on.`,"settings.ddns.account":`Account`,"settings.ddns.recordA":`A (IPv4)`,"settings.ddns.recordAaaa":`AAAA (IPv6)`,"settings.ddns.aaaaUnsupported":`This provider cannot manage AAAA records.`,"settings.ddns.proxied":`Proxied`,"settings.ddns.proxiedHint":`Cloudflare serves this record through its own network.`,"settings.ddns.ipv6Off":`IPv6 detection is off`,"settings.ddns.advanced":`Advanced`,"settings.ddns.advancedHint":`registered domain and TTL override`,"settings.ddns.registeredDomain":`Registered domain`,"settings.ddns.registeredDomainPlaceholder":`example.co.uk`,"settings.ddns.registeredDomainHint":`Only when the provider has to be told the apex, e.g. three-label domains.`,"settings.ddns.ttlOverride":`TTL override (s)`,"settings.ddns.ttlOverrideHint":`Blank uses the value above.`,"settings.ddns.noHostnames":`No hostnames yet.`,"settings.ddns.hostnamePlaceholder":`home.example.com`,"settings.ddns.lastPass":`Last pass`,"settings.ddns.ipv4Value":`IPv4 {address}`,"settings.ddns.ipv6Value":`IPv6 {address}`,"settings.ddns.type":`Type`,"settings.ddns.state":`State`,"settings.ddns.address":`Address`,"settings.ddns.detail":`Detail`,"settings.ddns.credentialsTitle":`Provider credentials`,"settings.ddns.credentialsDescription":`Saved fields are never sent back. Saving replaces every field for this account and runs a pass right away.`,"settings.ddns.optional":`Optional.`,"settings.ddns.whereToGet":`Where to get these`,"settings.ddns.forget":`Forget`,"settings.ddns.forgetConfirm":`Forget them`,"settings.ddns.forgetTitle":`Forget the stored credentials?`,"settings.ddns.forgetHint":`They are removed from disk and cannot be read back; you would need to paste them again.`,"settings.ddns.saveCredentials":`Save credentials`,"settings.defaults.title":`Server defaults`,"settings.defaults.description":`Applied to every entry that does not set its own value.`,"settings.defaults.enabledHint":`New entries start enabled.`,"settings.defaults.autostart":`Autostart with the panel`,"settings.defaults.bind":`Bind`,"settings.defaults.bindLocal":`Local — 127.0.0.1`,"settings.defaults.bindLan":`LAN — 0.0.0.0`,"settings.defaults.onPortConflict":`On port conflict`,"settings.defaults.conflictBlock":`Block the start`,"settings.defaults.conflictWarn":`Warn and start anyway`,"settings.defaults.conflictFollow":`Follow a detached restart of itself`,"settings.defaults.conflictReclaim":`Replace a detached restart with a supervised copy`,"settings.defaults.conflictKill":`Kill whatever holds the port`,"settings.defaults.logBufferLines":`Log buffer lines`,"settings.defaults.logBufferLinesHint":`Kept in memory per server.`,"settings.destination.title":`Destinations`,"settings.destination.generalTitle":`General`,"settings.destination.generalDescription":`What every destination follows unless it sets its own.`,"settings.destination.description":`Where events go. Each one may follow the general settings above, or carry its own.`,"settings.destination.addTelegram":`Add Telegram`,"settings.destination.addWebhook":`Add webhook`,"settings.destination.empty":`No destination yet. Add a Telegram chat or a webhook to start receiving alerts.`,"settings.destination.chatId":`Chat id`,"settings.destination.chatIdHint":`Use Detect chats to fill this from the bot's updates.`,"settings.destination.botToken":`Bot token`,"settings.destination.saveToken":`Save token`,"settings.destination.tokenSet":`token set`,"settings.destination.noToken":`no token`,"settings.destination.detectChats":`Detect chats`,"settings.destination.sendTest":`Send a test`,"settings.destination.remove":`Remove`,"settings.destination.removeQuestion":`Remove {name}?`,"settings.destination.removeBody":`Its events stop being sent, and any stored bot token for it is removed.`,"settings.destination.ownSettings":`Own settings`,"settings.destination.ownSettingsHint":`Off follows the general settings above.`,"settings.destination.lastSend":`Last send: {result} {when}`,"settings.destination.testSent":`Test sent.`,"settings.host.title":`Thresholds`,"settings.host.description":`A threshold of 0 disables that alert. Breaches notify once, and once more on recovery.`,"settings.host.enabled":`Sample this machine`,"settings.host.enabledHint":`Load, memory, swap, disk and CPU temperature, on the interval below.`,"settings.host.interval":`Interval (s)`,"settings.host.intervalHint":`How often the host is sampled and alerts are checked.`,"settings.host.diskPaths":`Disk paths`,"settings.host.diskPathsHint":`Comma separated; templates like {home} are expanded.`,"settings.host.diskUsed":`Disk used (%)`,"settings.host.memoryUsed":`Memory used (%)`,"settings.host.swapUsed":`Swap used (%)`,"settings.host.zeroDisables":`0 disables the alert.`,"settings.host.loadPerCpu":`Load per CPU`,"settings.host.loadPerCpuHint":`1-minute load average divided by the core count — a count, not a percentage: 1 means one core’s worth of waiting work. CPU usage is shown separately.`,"settings.host.tempCelsius":`CPU temperature (°C)`,"settings.host.tempCelsiusHint":`Above this is alerted; the tile reads n/a where the OS exposes no sensor.`,"settings.host.tempCommand":`Temperature command`,"settings.host.tempCommandHint":`Prints one number in °C. For a machine with no readable sensor — a WSL2 guest above all. Empty uses the built-in probe; docs/SERVERS.md has the WSL2 setup.`,"settings.host.tempCommandPlaceholder":`e.g. cat /sys/class/hwmon/hwmon0/temp1_input`,"settings.host.tempCommandTimeout":`Command timeout (ms)`,"settings.host.tempCommandTimeoutHint":`Killed after this long, so a hung helper cannot stall a sample.`,"settings.host.breachingNow":`Breaching now:`,"settings.host.nothingBreaching":`Nothing is breaching right now.`,"settings.host.wslTitle":`WSL2 temperature`,"settings.host.wslDescription":`A WSL2 guest exposes no CPU sensor. This reads the temperature through the Windows host instead — one button, and you can remove it again.`,"settings.host.wslSetup":`Set it up`,"settings.host.wslRemove":`Stop using it`,"settings.host.wslReading":`Reading {celsius}°C`,"settings.host.wslFailed":`It did not answer: {reason}`,"settings.host.wslNeedsLibrary":`LibreHardwareMonitor is not installed on Windows. Press the button to fetch it.`,"settings.host.wslDownloadNow":`Download and finish`,"settings.host.wslDownloadConfirm":`Download (~6 MB)`,"settings.host.wslDownloadTitle":`Download LibreHardwareMonitor?`,"settings.host.wslDownloadHint":`A third-party tool (~6 MB) from its GitHub release, pinned and sha256-checked. It reads the CPU temperature on the Windows side, where this guest cannot.`,"settings.interface.title":`Interface`,"settings.interface.description":`The panel is a static site: keep the stock one, or serve your own build from the state directory.`,"settings.interface.currentlyServing":`Currently serving`,"settings.interface.copyDirectory":`Copy the UI directory`,"settings.interface.fileCount":`{count} files`,"settings.interface.sourceStock":`stock`,"settings.interface.sourceCustom":`custom`,"settings.interface.unnamed":`unnamed`,"settings.interface.panelVersion":`Panel version`,"settings.interface.copyPanelVersion":`Copy the panel version`,"settings.interface.panelVersionHint":`The release this panel process is running — {command} prints the same number.`,"settings.interface.panelName":`Panel name`,"settings.interface.panelNameHint":`Shown in the sidebar by the stock UI. A custom UI may show its own name instead.`,"settings.interface.uploadLabel":`Upload a UI build (.zip with an index.html)`,"settings.interface.docsHint":`See {docs} for the API contract. If a custom UI breaks the panel, {command} puts the stock one back from the terminal.`,"settings.interface.resetName":`Reset name`,"settings.interface.confirmRevert":`Confirm revert`,"settings.interface.revertToStock":`Revert to stock`,"settings.interface.revertTitle":`Delete the uploaded UI?`,"settings.interface.revertHint":`It is deleted, not archived — re-installing means uploading the zip again.`,"settings.interface.install":`Install UI`,"settings.interface.installed":`UI replaced with {name} — refresh the page`,"settings.interface.yourBuild":`your build`,"settings.interface.restored":`stock UI restored — refresh the page`,"settings.interface.nothingInstalled":`no custom UI was installed`,"settings.listener.title":`Listener`,"settings.listener.description":`Where the panel answers. Moving this restarts the panel and sends this page to the new address.`,"settings.listener.port":`Control port`,"settings.listener.portHint":`Default 3999.`,"settings.listener.bind":`Bind`,"settings.listener.bindLocal":`Local`,"settings.listener.bindLan":`LAN`,"settings.listener.bindCustom":`Custom`,"settings.listener.bindLanHint":`0.0.0.0 — reachable from the whole network.`,"settings.listener.bindLocalHint":`127.0.0.1 — this machine only.`,"settings.listener.bindCustomHint":`A specific interface address you type in below.`,"settings.listener.ipv4":`IPv4 address`,"settings.listener.ipv4Placeholder":`192.168.1.20`,"settings.listener.ipv4Error":`Enter an IPv4 address, for example 192.168.1.20.`,"settings.listener.ipv4Hint":`Binding beyond 127.0.0.1 needs a real password.`,"settings.listener.openBrowser":`Open a browser when the panel comes up`,"settings.listener.liveAddress":`Live address`,"settings.listener.restartRequired":`restart required`,"settings.listener.copyLiveAddress":`Copy the live address`,"settings.listener.liveAddressHint":`What the listener is bound to right now; saved changes take effect after the panel rebinds.`,"settings.logs.title":`Retention`,"settings.logs.description":`The live view always comes from memory; these files survive a restart and feed the Logs page.`,"settings.logs.persist":`Keep logs on disk`,"settings.logs.persistHint":`Turn off to hold everything in memory only.`,"settings.logs.maxBytes":`Rotate at (bytes)`,"settings.logs.maxBytesHint":`Per server, before rolling to .1, .2, …`,"settings.logs.keep":`Keep rotated files`,"settings.logs.directory":`Logs directory`,"settings.logs.copyDirectory":`Copy the logs directory`,"settings.logs.browseHint":`Browse and download these files on the {logs} page.`,"settings.paths.dataRoot":`Data root`,"settings.paths.dataRootHint":`HHOSTED_HOME — global settings, workspaces, TLS, backups and the UI.`,"settings.paths.globalSettings":`Global settings`,"settings.paths.globalSettingsHint":`settings.json — listener, auth, TLS policy, host vitals, backups.`,"settings.paths.projectDir":`Project directory`,"settings.paths.projectDirHint":`Base for relative entry paths.`,"settings.paths.panelAddress":`Panel address`,"settings.paths.panelAddressHint":`Where this control panel is live right now.`,"settings.paths.serversConfig":`Servers config`,"settings.paths.serversConfigHint":`{label}'s servers.config.json.`,"settings.paths.workspaceSettings":`Workspace settings`,"settings.paths.workspaceSettingsHint":`Server defaults, log retention, notifications, DDNS.`,"settings.paths.logs":`Logs`,"settings.paths.logsHint":`Persisted output for this workspace.`,"settings.paths.copyPath":`Copy {label}`,"settings.paths.whereThingsLive":`Where things live`,"settings.paths.whereThingsLiveDescription":`Read-only. Copy a path straight into a shell or an editor.`,"settings.paths.workspaceFiles":`Workspace files`,"settings.paths.workspaceFilesDescription":`Each workspace owns its config, settings and log directory; nothing is shared between them.`,"settings.rebind.failed":`The control panel did not answer on {target}. Check the console for the new listener.`,"settings.restore.title":`Restore a backup`,"settings.restore.description":`Nothing is written until the plan is applied.`,"settings.restore.archive":`Archive`,"settings.restore.archiveHint":`A stored archive, or a .zip from this machine.`,"settings.restore.encryptedName":`{name} — encrypted`,"settings.restore.uploadOption":`Upload a file…`,"settings.restore.archiveFile":`Archive file (.zip)`,"settings.restore.unchangedTitle":`Nothing has changed yet`,"settings.restore.archiveLine":`Archive {name}.`,"settings.restore.uploadedArchive":`The uploaded archive.`,"settings.restore.passwordProtected":`This backup is password-protected.`,"settings.restore.password":`Password`,"settings.restore.checkAgain":`Check again with the password`,"settings.restore.choosePrompt":`Choose what to restore — {selected} of {total} selected.`,"settings.restore.willRestore":`Will restore: {items}.`,"settings.restore.skipped":`Skipped: {items}.`,"settings.restore.nothing":`nothing`,"settings.restore.restartNote":`The panel's own settings differ, so restart the panel afterwards.`,"settings.restore.reloadedNote":`Restored workspaces are reloaded immediately; entries marked autostart start on their own.`,"settings.restore.applyStored":`Apply this restore`,"settings.restore.applyUpload":`Restore the upload`,"settings.restore.restored":`Restored {count} item(s).`,"settings.restore.restoredWithNotes":`Restored {count} item(s) — {notes}.`,"settings.restore.noteReloaded":`the restored servers are live, autostart entries starting`,"settings.restore.noteRestart":`restart the panel to apply its own settings`,"settings.restore.reasonSymbolicLink":`symbolic link, skipped`,"settings.restore.reasonNotSelected":`not selected`,"settings.restore.reasonUnrestorable":`cannot be restored here`,"settings.restore.reasonInvalidSettings":`the archive's settings are not valid`,"settings.restore.reasonInvalidServers":`the archive's servers are not valid`,"settings.restore.reasonInvalidWorkspace":`not a usable workspace id`,"settings.restore.createdWorkspaces":`Created workspaces: {items}.`,"settings.restore.replacedUnderRunning":`Data was replaced under a running server — stop and start {items} so it reads the restored files.`,"settings.shell.noUnsavedChanges":`No unsaved changes`,"settings.shell.discard":`Discard changes`,"settings.shell.save":`Save settings`,"settings.shell.unsavedTitle":`Unsaved changes`,"settings.shell.nothingToSave":`Nothing to save.`,"settings.telegram.title":`Telegram`,"settings.telegram.description":`Policy lives in the config; the bot token is a secret and never comes back from the server.`,"settings.telegram.enabled":`Send notifications`,"settings.telegram.enabledHint":`One message per event, throttled by the cooldown below.`,"settings.telegram.chatId":`Chat id`,"settings.telegram.chatIdPlaceholder":`123456789 or @channel`,"settings.telegram.chatIdHint":`Use Detect chats to fill this from the bot's updates.`,"settings.telegram.cooldown":`Cooldown per event (s)`,"settings.telegram.cooldownHint":`Per server and reason, so a flapping server cannot spam.`,"settings.telegram.onCrash":`Retries exhausted`,"settings.telegram.onUnhealthy":`Port unhealthy`,"settings.telegram.onForcedRestart":`Forced restart`,"settings.telegram.onRecovered":`Recovered`,"settings.telegram.onHost":`Host vitals breached`,"settings.telegram.onHostHint":`Disk, memory, swap, load and CPU temperature, per the thresholds under Host vitals.`,"settings.telegram.onDdns":`Dynamic DNS changed or failed`,"settings.telegram.onDdnsHint":`One message per pass that changed a record, and one for a pass that failed.`,"settings.telegram.botToken":`Bot token`,"settings.telegram.tokenSet":`token set`,"settings.telegram.noToken":`no token`,"settings.telegram.tokenNote":`From @BotFather — a secret, never in servers.config.json.`,"settings.telegram.tokenPlaceholder":`123456789:AA…`,"settings.telegram.tokenSavedPlaceholder":`Saved — type a new token to replace it`,"settings.telegram.saveToken":`Save token`,"settings.telegram.detectChats":`Detect chats`,"settings.telegram.sendTest":`Send test`,"settings.telegram.removeToken":`Remove token`,"settings.telegram.removeTokenConfirm":`Confirm remove`,"settings.telegram.removeTokenTitle":`Remove the bot token?`,"settings.telegram.removeTokenHint":`Notifications stop until you paste a token again.`,"settings.telegram.tokenSaved":`Token saved.`,"settings.telegram.tokenSavedFor":`Token saved for @{username}.`,"settings.telegram.tokenRemoved":`Token removed.`,"settings.telegram.noChats":`No chats found. Send /start to the bot first, then detect again.`,"settings.telegram.testSent":`Test message sent.`,"settings.telegram.testFailed":`The test message failed.`,"settings.telegram.chatsSeen":`Chats the bot has seen:`,"settings.telegram.lastSend":`Last send: {result}`,"settings.tls.title":`HTTPS`,"settings.tls.description":`Upload a PEM pair and the panel serves TLS on its own listener. A self-signed certificate is fine on a home network.`,"settings.tls.serve":`Serve the panel over HTTPS`,"settings.tls.serveHint":`Saved with Save settings; the panel rebinds and this page follows it.`,"settings.tls.certificateTitle":`Certificate`,"settings.tls.certificateDescription":`PEM-encoded certificate and its private key. Both stay in the secrets file.`,"settings.tls.unusableTitle":`The stored certificate cannot be used`,"settings.tls.subject":`Subject`,"settings.tls.issuer":`Issuer`,"settings.tls.validUntil":`Valid until`,"settings.tls.days":`{count} days`,"settings.tls.privateKey":`Private key`,"settings.tls.keyMatches":`matches the certificate`,"settings.tls.keyMismatch":`does not match`,"settings.tls.fingerprint":`Fingerprint`,"settings.tls.copyFingerprint":`Copy the fingerprint`,"settings.tls.noCertificateTitle":`No certificate uploaded`,"settings.tls.noCertificateText":`Upload a PEM certificate and key below, then save. HTTPS is not served until a certificate is present.`,"settings.tls.certFile":`Certificate file (.pem, .crt)`,"settings.tls.keyFile":`Private key file (.pem, .key)`,"settings.tls.pasteCertificate":`Or paste the certificate`,"settings.tls.pasteKey":`Or paste the private key`,"settings.tls.saveCertificate":`Save certificate`,"settings.tls.removeCertificate":`Remove certificate`,"settings.tls.confirmRemove":`Confirm remove`,"settings.tls.removeTitle":`Remove the certificate?`,"settings.tls.removeHint":`TLS stays on but has nothing to serve, so the panel falls back to http once the listener rebinds.`,"settings.tls.stored":`Certificate stored.`,"settings.tls.removed":`Certificate removed.`,"settings.webhook.title":`Webhooks`,"settings.webhook.description":`Send the same events anywhere that accepts an HTTP request.`,"settings.webhook.empty":`No webhook yet. Add one to POST events somewhere else.`,"settings.webhook.add":`Add a webhook`,"settings.webhook.newTarget":`hook`,"settings.webhook.url":`URL`,"settings.webhook.urlPlaceholder":`https://ntfy.sh/my-topic`,"settings.webhook.method":`Method`,"settings.webhook.format":`Body`,"settings.webhook.formatJson":`JSON`,"settings.webhook.formatText":`Plain text`,"settings.webhook.formatHint":`JSON for Discord, Slack or your own endpoint; plain text for ntfy.`,"settings.webhook.headers":`Headers`,"settings.webhook.headersHint":`One Name: value per line, sent with every request. ntfy reads Title and Priority here; a bearer token goes in Authorization.`,"settings.webhook.presets":`Presets`,"settings.webhook.presetNtfy":`ntfy`,"settings.webhook.presetDiscord":`Discord`,"settings.webhook.presetSlack":`Slack`,"settings.webhook.sendTest":`Send a test`,"settings.webhook.testSent":`Test sent.`,"settings.webhook.cooldown":`Cooldown (ms)`,"settings.webhook.cooldownHint":`Per server and reason, for this target alone. 0 disables it.`,"settings.webhook.lastSend":`Last send: {result} {when}`,"settings.webhook.removeQuestion":`Remove {name}?`,"settings.webhook.removeBody":`Its events stop being sent. The URL and headers are removed from this workspace's config.`,"status.stopped":`Stopped`,"status.starting":`Starting`,"status.running":`Running`,"status.stopping":`Stopping`,"status.backoff":`Restarting`,"status.crashed":`Crashed`,"status.conflict":`Port conflict`,"theme.label":`Theme: {theme}`,"theme.light":`light`,"theme.dark":`dark`,"theme.system":`system`,"toast.refreshFailed":`Refresh failed`,"toast.startFailed":`Could not start {id}`,"toast.stopFailed":`Could not stop {id}`,"toast.restartFailed":`Could not restart {id}`,"toast.startAllFailed":`Could not start every server`,"toast.startAllStarted":`Starting every enabled server`,"toast.stopOrphanFailed":`Could not stop the orphaned process “{id}”`,"toast.stopOrphanDone":`Orphaned process stopped`,"toast.stopAllFailed":`Could not stop every server`,"toast.stopAllStarted":`Stopping every server`,"toast.stopAllWithPersistent":`Stopping every server, persistent entries included`,"toast.autostartFailed":`Could not change autostart for {id}`,"toast.changeFailed":`Could not change {id}`,"toast.freePortFailed":`Could not free the port for {id}`,"toast.portFree":`Port {port} is free — start {id} now`,"toast.portHeld":`Port {port} is still held`,"toast.bindFailed":`Could not change the bind for {id}`,"toast.bindInvalid":`“{bind}” is not a bind value`,"toast.saveServerFailed":`Could not save {id}`,"toast.serverUpdated":`{id} updated`,"toast.saveSettingsFailed":`Could not save the settings`,"toast.clearLogsFailed":`Could not clear the logs for {id}`,"toast.logsCleared":`Buffer cleared`,"toast.addServerFailed":`Could not add the server`,"toast.serverAdded":`Server added`,"toast.removeServerFailed":`Could not remove {id}`,"toast.serverRemoved":`{id} removed`,"toast.readWorkspacesFailed":`Could not read the workspaces`,"toast.workspaceCreated":`Workspace “{workspace}” created`,"toast.workspaceCreateFailed":`Could not create the workspace`,"toast.workspaceRenamed":`Workspace renamed`,"toast.workspaceRenameFailed":`Could not rename the workspace`,"toast.workspaceDeleted":`Workspace deleted`,"toast.workspaceDeleteFailed":`Could not delete the workspace`,"topbar.search":`Search or run a command`,"topbar.openNavigation":`Open navigation`,"topbar.commandPalette":`Command palette`,"topbar.account":`Account`,"topbar.signedIn":`Signed in`,"topbar.signOut":`Sign out`,"topbar.workspaceLabel":`Workspace: {name}`,"validation.port":`Port must be a whole number between 1 and 65535.`,"validation.idRequired":`An id is required — it is the key this server lives under.`,"validation.idPattern":`The id must start with a lowercase letter or digit and contain only lowercase letters, digits, dashes and underscores.`,"validation.commandRequired":`A command is required — the executable the supervisor spawns.`,"validation.bootstrapCommand":`A bootstrap needs a command to run.`,"views.actions.addAServer":`Add a server`,"views.actions.addServer":`Add server`,"views.actions.startAll":`Start all`,"views.actions.stopAll":`Stop all`,"views.actions.stopAllIgnore":`Ignore`,"views.actions.stopAllWithPersistent":`With persistent`,"views.actions.stopAllQuestion":`Stop every server in this workspace?`,"views.actions.stopAllHint":`Persistent entries keep running unless you choose “With persistent”.`,"views.common.thisWorkspace":`this workspace`,"views.globalOverview.configError":`The config could not be read: {error}`,"views.globalOverview.degraded":`degraded`,"views.globalOverview.description":`Host vitals and every server from every workspace, grouped by where it lives.`,"views.globalOverview.emptyDescription":`Pick a workspace in the header and add the first process it should keep alive.`,"views.globalOverview.emptyTitle":`No servers anywhere yet`,"views.globalOverview.groupEmptyDescription":`Add one and it will show up here and on the workspace page.`,"views.globalOverview.groupRunning":`{running}/{total} running`,"views.globalOverview.hostUptime":`Host uptime`,"views.globalOverview.hostVitals":`Host vitals`,"views.globalOverview.hostVitalsNote":`This machine, shared by every workspace.`,"views.globalOverview.openWorkspace":`Open workspace`,"views.globalOverview.panelUptime":`Panel uptime`,"views.globalOverview.samplingOff":`sampling off`,"views.globalOverview.samplingOn":`sampling on`,"views.globalOverview.serving":`serving`,"views.globalOverview.workspaces":`Workspaces`,"views.globalSettings.authenticationDescription":`Who may sign in to this panel, and how a session is trusted.`,"views.globalSettings.backupsDescription":`One archive per capture, covering the panel and any workspace you pick.`,"views.globalSettings.changesDescription":`What Save would write to the panel's settings file.`,"views.globalSettings.description":`Listener, access, host vitals, backups, TLS and paths for this panel — shared by every workspace.`,"views.globalSettings.hostDescription":`Alert thresholds for this machine's own resources.`,"views.globalSettings.interfaceDescription":`Serve your own panel UI instead of the stock one.`,"views.globalSettings.languageDescription":`The language this panel is shown in, for this browser.`,"views.globalSettings.languageNote":`Your choice is kept in this browser and applies to the login page too. It does not change the panel's own log output or its API messages.`,"views.globalSettings.listenerDescription":`Where the control panel listens and how it announces itself.`,"views.globalSettings.loadErrorTitle":`Some file-only values could not be loaded`,"views.globalSettings.navLabel":`Global settings sections`,"views.globalSettings.pathsDescription":`Where home-hosted keeps its files, globally and per workspace.`,"views.globalSettings.saveFailed":`The settings could not be saved.`,"views.globalSettings.saved":`Settings saved.`,"views.globalSettings.savedRebinding":`Settings saved — the panel is moving to a new address.`,"views.globalSettings.savedToast":`Settings saved`,"views.globalSettings.sectionAuthentication":`Authentication`,"views.globalSettings.sectionBackups":`Backups`,"views.globalSettings.sectionHost":`Host vitals`,"views.globalSettings.sectionInterface":`Interface`,"views.globalSettings.sectionListener":`Listener`,"views.globalSettings.sectionPaths":`Paths`,"views.globalSettings.sectionTls":`TLS`,"views.globalSettings.title":`Global settings`,"views.globalSettings.tlsDescription":`Serve the panel over HTTPS with your own certificate.`,"views.logs.allStreams":`All streams`,"views.logs.clear":`Clear`,"views.logs.clearDescription":`{server} — the file on disk is truncated. The process keeps running and new lines are written from here on.`,"views.logs.clearFile":`Clear file`,"views.logs.clearNote":`Download it first if the output is still needed — this cannot be undone from the panel.`,"views.logs.clearTitle":`Clear the persisted log file?`,"views.logs.fileEmpty":`The persisted file is empty.`,"views.logs.loadedLines":`loaded {count} lines`,"views.logs.modeLive":`Live stream`,"views.logs.modePersisted":`Persisted`,"views.logs.noServersDescription":`Add one and its output will be persisted here.`,"views.logs.noServersTitle":`No servers`,"views.logs.nothingOnDisk":`Nothing on disk for this server — persistence is off, or it has not written anything yet.`,"views.logs.nothingPersisted":`nothing persisted`,"views.logs.persistedSummary":`{workspace} · {persisted} of {total} servers on disk · {size}`,"views.logs.persistedTitle":`Persisted logs`,"views.logs.pickServerDescription":`Persisted output and live streams are per server. Choose one from the list.`,"views.logs.pickServerTitle":`Pick a server`,"views.logs.reload":`Reload`,"views.logs.retentionNote":`Rotation and retention are set under Workspace settings → Logs.`,"views.logs.searchAria":`Search the log`,"views.logs.searchPlaceholder":`search the tail window`,"views.logs.searchedLines":`searched {count} lines`,"views.logs.streamAria":`Stream`,"views.logs.tailAria":`Tail size`,"views.logs.waitingOutput":`Connected — waiting for output.`,"views.overview.acrossTree":`across the tree`,"views.overview.cpuNow":`{value}% cpu now`,"views.overview.crashedOrUnhealthy":`crashed or unhealthy`,"views.overview.description":`Live state of every server in this workspace, refreshed over a single event stream.`,"views.overview.emptyDescription":`Add the first process this workspace should keep alive.`,"views.overview.emptyTitle":`No servers in this workspace`,"views.overview.enabled":`{count} enabled`,"views.overview.longestUptime":`Longest uptime`,"views.overview.needsAttention":`Needs attention`,"views.overview.notUp":`{count} not up`,"views.overview.nothingBroken":`nothing is broken`,"views.overview.nothingRunning":`nothing running`,"views.overview.openFullList":`Open the full list`,"views.overview.peak":`peak {value}`,"views.overview.processMemory":`Process memory`,"views.overview.recentActivity":`Recent activity`,"views.overview.running":`Running`,"views.overview.sampling":`resource history is sampled every 5 s and kept for this session`,"views.overview.stopped":`Stopped`,"views.overview.workspaceLabel":`workspace {id}`,"views.route.server":`Server`,"views.serverDetail.allServers":`All servers`,"views.serverDetail.autostart":`Autostart with the panel`,"views.serverDetail.backToServers":`Back to servers`,"views.serverDetail.bind":`Bind`,"views.serverDetail.bindCustom":`{bind} — custom`,"views.serverDetail.bindLan":`0.0.0.0 — every interface`,"views.serverDetail.bindLocal":`127.0.0.1 — this machine only`,"views.serverDetail.closeEditor":`Close editor`,"views.serverDetail.copyJson":`Copy the JSON config`,"views.serverDetail.crashes24":`24h crashes`,"views.serverDetail.dependencies":`Dependencies`,"views.serverDetail.detached":`detached`,"views.serverDetail.detachedHint":`This process replaced itself: the panel adopted the successor instead of starting a second copy. Stop still works, its output stays where the successor sent it.`,"views.serverDetail.disableServer":`Disable server`,"views.serverDetail.disabledNote":`Disabled — Start and Restart are refused until it is enabled again, from the ⋯ menu above.`,"views.serverDetail.editHint":`Edit every field of this entry`,"views.serverDetail.effectiveConfig":`Effective configuration`,"views.serverDetail.effectiveConfigNote":`Defaults from Settings are already merged into these values.`,"views.serverDetail.enableServer":`Enable server`,"views.serverDetail.eventHistory":`Event history`,"views.serverDetail.eventHistoryNote":`Kept by the panel for 24 hours.`,"views.serverDetail.fieldArgs":`args`,"views.serverDetail.fieldBackupPaths":`backup paths`,"views.serverDetail.fieldBootstrap":`bootstrap`,"views.serverDetail.fieldCommand":`command`,"views.serverDetail.fieldCwd":`cwd`,"views.serverDetail.fieldDataEnvs":`data envs`,"views.serverDetail.fieldDependsOn":`depends on`,"views.serverDetail.fieldEnv":`env`,"views.serverDetail.fieldEnvFile":`env file`,"views.serverDetail.fieldHealth":`health`,"views.serverDetail.fieldLogBuffer":`log buffer`,"views.serverDetail.fieldOnPortConflict":`on port conflict`,"views.serverDetail.fieldPortBind":`port · bind`,"views.serverDetail.fieldRestart":`restart`,"views.serverDetail.fieldRssLimit":`RSS limit`,"views.serverDetail.fieldStop":`stop`,"views.serverDetail.fields":`Fields`,"views.serverDetail.goneDescription":`{id} is not in servers.config.json any more. It may have been removed from another tab.`,"views.serverDetail.goneTitle":`That server is gone`,"views.serverDetail.health":`Health`,"views.serverDetail.healthProbe":`Health probe`,"views.serverDetail.lastCrash":`Last crash`,"views.serverDetail.lastProbe":`Last probe`,"views.serverDetail.logBufferLines":`{count} lines`,"views.serverDetail.memoryRss":`Memory (RSS)`,"views.serverDetail.moreActions":`More actions for {label}`,"views.serverDetail.neverWritten":`This server has not written anything yet.`,"views.serverDetail.nextAttempt":`Next attempt`,"views.serverDetail.none":`none`,"views.serverDetail.off":`off`,"views.serverDetail.persistent":`persistent`,"views.serverDetail.persistentHint":"This entry runs under its own nanny, so it keeps running when the panel stops, restarts or is killed. `home-hosted down` reports it instead of stopping it; only Stop does.","views.serverDetail.pid":`PID`,"views.serverDetail.portFree":`free`,"views.serverDetail.portInUse":`in use`,"views.serverDetail.portState":`Port state`,"views.serverDetail.probeFailed":`The health probe has not passed.`,"views.serverDetail.probeFailedFor":`The health probe has not passed for {duration}.`,"views.serverDetail.processes":`Processes`,"views.serverDetail.rawJson":`Raw JSON`,"views.serverDetail.removeAutostart":`Remove from autostart`,"views.serverDetail.removeDescription":`{label} is removed from servers.config.json: its process is stopped, and its logs and crash history are deleted with it.`,"views.serverDetail.removeNote":`This cannot be undone from the panel — the entry has to be added back by hand or from a backup.`,"views.serverDetail.removeServer":`Remove server`,"views.serverDetail.removeTitle":`Remove this server?`,"views.serverDetail.restart":`Restart`,"views.serverDetail.restarts":`Restarts`,"views.serverDetail.sectionConfig":`Configuration`,"views.serverDetail.sectionHistory":`History`,"views.serverDetail.sectionOutput":`Live output`,"views.serverDetail.start":`Start`,"views.serverDetail.startsOnItsOwn":`Starts on its own. Add ids under {code} to order it after other servers.`,"views.serverDetail.stop":`Stop`,"views.serverDetail.telemetry":`Telemetry`,"views.serverDetail.telemetryNote":`Sampled every 5 s while this page is open.`,"views.serverDetail.unhealthyFor":`Unhealthy for`,"views.serverDetail.uptime24":`24h uptime`,"views.serverDetail.waitingFirstLine":`Waiting for the first line…`,"views.servers.clearFilter":`Clear the filter`,"views.servers.clearFilters":`Clear filters`,"views.servers.description":`Every entry in {workspace}'s servers.config.json, with live resources, health and history.`,"views.servers.emptyDescription":`Add the first process this panel should supervise. Its command, args, env and working directory all live in the config file.`,"views.servers.emptyTitle":`No servers configured`,"views.servers.filterAll":`All`,"views.servers.filterAria":`Filter servers`,"views.servers.filterAttention":`Attention`,"views.servers.filterDisabled":`Disabled`,"views.servers.filterPlaceholder":`Filter by id, label, command or port`,"views.servers.filterRunning":`Running`,"views.servers.filterStopped":`Stopped`,"views.servers.noMatchDescription":`Try a different status or clear the search.`,"views.servers.noMatchTitle":`Nothing matches that filter`,"views.servers.orphansTitle":`Orphaned processes`,"views.servers.orphansDescription":`These were started by the panel and no server entry owns them any more — a renamed or removed entry left them running. Stop them here or they keep holding their resources.`,"views.servers.orphanStartedAt":`started {when}`,"views.servers.stopOrphan":`Stop it`,"views.servers.orphanPid":`pid {pid}`,"views.settings.changesDescription":`What Save would write to {workspace}'s settings.`,"views.settings.configErrorNote":`The panel keeps supervising with the config it already had; fixing the file reloads it on its own.`,"views.settings.configErrorTitle":`The workspace config could not be read`,"views.settings.configWarningTitle":`This workspace's config has a warning`,"views.settings.ddnsDescription":`Keep hostnames pointed at this machine's public address, whichever registrar holds them.`,"views.settings.defaultsDescription":`Applied to every entry in this workspace that does not set its own value.`,"views.settings.description":`Server defaults, log retention, notifications and dynamic DNS for {workspace}.`,"views.settings.logsDescription":`How much output this workspace keeps on disk and for how long.`,"views.settings.navLabel":`Workspace settings sections`,"views.settings.notificationsDescription":`Crash and health alerts for this workspace, sent to a Telegram chat.`,"views.settings.saveFailed":`The settings could not be saved.`,"views.settings.saved":`Workspace settings saved.`,"views.settings.savedToast":`Workspace settings saved`,"views.settings.sectionDdns":`Dynamic DNS`,"views.settings.sectionDefaults":`Server defaults`,"views.settings.sectionLogs":`Logs`,"views.settings.sectionNotifications":`Notifications`,"views.settings.concurrentEdit":`Someone else changed {ids} while you had this page open. Reload to see their version, then reapply your edit.`,"workspace.new":`New workspace`,"workspace.rename":`Rename workspace`,"workspace.create":`Create workspace`,"workspace.renameAction":`Rename`,"workspace.createHint":`Its own settings, servers, logs, secrets and backups entry — served by this same panel.`,"workspace.renameHint":`Only the name changes; the workspace id stays, so URLs and paths keep working.`,"workspace.nameHint":`Shown in the header.`,"workspace.nameHintId":`Shown in the header. Id: {id}`,"workspace.none":`No workspace`,"workspace.delete":`Delete workspace`,"workspace.listHeading":`Workspaces`,"workspace.emptyList":`The panel serves no workspace yet.`,"workspace.newAction":`New workspace…`,"workspace.renameActionFor":`Rename “{name}”…`,"workspace.deleteActionFor":`Delete “{name}”…`,"workspace.deleteTitle":`Delete “{name}”?`,"workspace.deleteBody":`Its servers are stopped, and its config, settings, logs, secrets and nanny state are removed from disk. A backup taken first is the only way back.`,"workspace.nameRequired":`A workspace needs a name.`,"workspace.namePlaceholder":`Home lab`,"days.remaining":{one:`{count} day`,other:`{count} days`},"editor.unsaved":{one:`unsaved change`,other:`unsaved changes`},"editor.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"logs.lines":{one:`{count} line`,other:`{count} lines`},"palette.results":{one:`{count} result`,other:`{count} results`},"proxy.retry.inMinutes":{one:`~{count} minute`,other:`~{count} minutes`},"proxy.retry.inHours":{one:`~{count} hour`,other:`~{count} hours`},"servers.total":{one:`{count} server`,other:`{count} servers`},"servers.running":{one:`{count} running`,other:`{count} running`},"settings.backup.entriesCount":{one:`{count} entry`,other:`{count} entries`},"settings.backup.itemsSelected":{one:`{count} item selected`,other:`{count} items selected`},"settings.ddns.hostnameCount":{one:`{count} hostname`,other:`{count} hostnames`},"settings.shell.fieldsChanged":{one:`field changed`,other:`fields changed`},"settings.shell.saveChanges":{one:`Save {count} change`,other:`Save {count} changes`},"views.globalOverview.needLook":{one:`{count} server needs a look`,other:`{count} servers need a look`},"views.globalOverview.serversTotal":{one:`{count} server in total`,other:`{count} servers in total`},"views.logs.filesOnDisk":{one:`{count} file`,other:`{count} files`},"views.overview.needLook":{one:`{count} server needs a look`,other:`{count} servers need a look`}},kP=/\{(\w+)\}/g;function AP(e,t){return`${e}:${t||`index`}`}function jP(e,t){if(e==null)return null;let n=LP(e,t);return n===void 0?null:n}function MP(e,t,n){n?.preserveExisting?FP(e,t):PP(e,t)}function NP(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function PP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(typeof a!=`object`||!a||Array.isArray(a)){e[i]=a;continue}let o=e[i];typeof o==`object`&&o&&!Array.isArray(o)?PP(o,a):e[i]=a}}function FP(e,t){let n=Object.keys(t);for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i===`__proto__`)continue;let a=t[i];if(!Object.prototype.hasOwnProperty.call(e,i)){e[i]=a;continue}let o=e[i];NP(a)&&NP(o)&&FP(o,a)}}function IP(e,t){return!t||e.indexOf(`{`)===-1?e:e.replace(kP,(e,n)=>{let r=t[n];return r===void 0?`{${n}}`:String(r)})}function LP(e,t){if(e==null||typeof t!=`string`||t.length===0)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];if(!t.includes(`.`))return;let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;let t=r;if(!Object.prototype.hasOwnProperty.call(t,e))return;r=t[e]}return r}function RP(e,t,n){if(typeof t!=`string`||t.length===0)return e;if(Object.prototype.hasOwnProperty.call(e,t)||!t.includes(`.`))return t===`__proto__`?e:{...e,[t]:n};let r=t.split(`.`);if(r.some(e=>e===`__proto__`))return e;let i={...e},a=i;for(let e of r.slice(0,-1)){let t=a[e],n=NP(t)?{...t}:{};a[e]=n,a=n}return a[r[r.length-1]]=n,i}function zP(e,t){let n=BP(e,t),r={};return VP(e,t,``,r),Object.keys(r).length===0?n:{...n,...r}}function BP(e,t){let n={...e};for(let e of Object.keys(t)){if(e===`__proto__`)continue;let r=t[e];if(r==null)continue;let i=n[e];n[e]=NP(r)&&NP(i)?BP(i,r):r}return n}function VP(e,t,n,r){for(let i of Object.keys(e)){if(i===`__proto__`)continue;let a=e[i];if(!NP(a))continue;let o=n?`${n}.${i}`:i,s=t[i];NP(s)?VP(a,s,o,r):s!=null&&HP(a,o,r)}}function HP(e,t,n){for(let r of Object.keys(e)){if(r===`__proto__`)continue;let i=e[r],a=`${t}.${r}`;NP(i)?HP(i,a,n):n[a]=i}}var UP=(e,t,n,r,i)=>{let a=i(e);if(!a)return null;let o=a.toString().split(`|`);if(o.length===0)return null;let s=t<o.length?o[t]:o[o.length-1];return s?IP(s.trim(),{...n,count:t}):null};function WP(e){if(!e)return``;let t=Object.keys(e).sort();if(t.length===0)return``;let n={};for(let r of t)n[r]=e[r];return JSON.stringify(n)}function GP(e,t){let n=WP(t);return n?`${e}\0${n}`:e}var KP=class{constructor(e={}){this.numberCache=new Map,this.dateCache=new Map,this.relativeCache=new Map,this.numberFormats=e.numberFormats??{},this.datetimeFormats=e.datetimeFormats??{}}setNumberFormats(e){this.numberFormats=e,this.numberCache.clear()}setDateTimeFormats(e){this.datetimeFormats=e,this.dateCache.clear()}getNumberFormats(){return this.numberFormats}getDateTimeFormats(){return this.datetimeFormats}clearCache(){this.numberCache.clear(),this.dateCache.clear(),this.relativeCache.clear()}resolveNumberFormat(e,t){return this.numberFormats[e]?.[t]??this.numberFormats[e.split(`-`)[0]]?.[t]}resolveDateTimeFormat(e,t){return this.datetimeFormats[e]?.[t]??this.datetimeFormats[e.split(`-`)[0]]?.[t]}getNumberFormatter(e,t){let n=GP(e,t),r=this.numberCache.get(n);return r||(r=new Intl.NumberFormat(e,t),this.numberCache.set(n,r)),r}getDateTimeFormatter(e,t){let n=GP(e,t),r=this.dateCache.get(n);return r||(r=new Intl.DateTimeFormat(e,t),this.dateCache.set(n,r)),r}getRelativeTimeFormatter(e,t){let n=GP(e,t),r=this.relativeCache.get(n);return r||(r=new Intl.RelativeTimeFormat(e,t),this.relativeCache.set(n,r)),r}formatNumber(e,t,n){return this.getNumberFormatter(t,n).format(e)}formatDate(e,t,n){let r=new Date(e);return Number.isNaN(r.getTime())?`Invalid Date`:this.getDateTimeFormatter(t,n).format(r)}formatRelativeTime(e,t,n){let r=new Date(e),i=this.getRelativeTimeFormatter(t,n);if(Number.isNaN(r.getTime()))return i.format(0,`second`);let a=Math.floor((Date.now()-r.getTime())/1e3);for(let{unit:e,seconds:t}of[{unit:`year`,seconds:31536e3},{unit:`month`,seconds:2592e3},{unit:`day`,seconds:86400},{unit:`hour`,seconds:3600},{unit:`minute`,seconds:60},{unit:`second`,seconds:1}]){let n=Math.floor(a/t);if(n>=1)return i.format(-n,e)}return i.format(0,`second`)}},qP=Symbol(`i18n-leaf-miss`),JP=new WeakMap;function YP(e){let t=JP.get(e);return t||(t={leafByChunk:new Map,generation:0},JP.set(e,t)),t}function XP(e){let t=e?.translations??new Map,n=YP(t),{leafByChunk:r}=n;function i(){n.generation++}function a(e){r.delete(e)}function o(){r.clear()}function s(e){let t=r.get(e);return t||(t=new Map,r.set(e,t)),t}function c(e,t,n){let i=r.get(e);if(i?.has(n)){let e=i.get(n);return e===qP?null:e}if(!t)return s(e).set(n,qP),null;let a=jP(t,n);return s(e).set(n,a===null?qP:a),a}function l(e,n){t.set(e,n),a(e),i()}function u(e,n){let r=t.get(e);r?(MP(r,n),a(e),i()):l(e,{...n})}return{hasCache(e,n){return t.has(AP(e,n))},getCache(e,n){return t.get(AP(e,n))},setCache(e,t,n){r.set(AP(e,t),n)},getGeneration(){return n.generation},hasTranslation(e,n){let r=`${e}:`;for(let[e,i]of t)if(e.startsWith(r)&&jP(i,n)!==null)return!0;return!1},hasPageTranslation(e,n){return t.has(AP(e,n))},getTranslation(e,n,r){let i=AP(e,n);return c(i,t.get(i),r)},lookupIn:c,loadTranslations(e,t,n=`index`){u(AP(e,n),t)},setTranslations(e,t,n=`index`){l(AP(e,n),t)},loadPageTranslations(e,n,r){let i=AP(e,n),a=t.get(i);!a||Object.keys(a).length===0?l(i,{...r}):u(i,r)},mergeTranslation(e,t,n,r=!1){u(AP(e,t),n)},clearCache(){t.clear(),o(),i()}}}var ZP=class{constructor(e={}){this.formatter=new KP,this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1,this.helper=XP(e.storage);let t={numberFormats:e.numberFormats,datetimeFormats:e.datetimeFormats};this.formatter=new KP(t),this.pluralFunc=e.plural&&e.plural!==UP?(t,n,r,i,a)=>e.plural(t,n,r,i,a)??UP(t,n,r,i,a):UP,this.missingWarn=e.missingWarn??!0,this.missingHandler=e.missingHandler,this.getCustomMissingHandler=e.getCustomMissingHandler}touch(){}resolveRouteName(e){return typeof e==`string`?e:this.getRoute()}ensurePinnedChunk(e,t){let n=AP(e,t),r=this.helper.getGeneration();(this.pinnedCacheKey!==n||this.pinnedGeneration!==r)&&(this.pinnedCacheKey=n,this.pinnedGeneration=r,this.pinnedTree=this.helper.getCache(e,t)??null)}invalidatePin(){this.pinnedCacheKey=``,this.pinnedTree=null,this.pinnedGeneration=-1}resolveLookup(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e),a=t===void 0||r===this.getRoute(),o;if(a?(this.ensurePinnedChunk(n,r),o=this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)):o=this.helper.getTranslation(n,r,i),o!==null)return o;let s=this.getFallbackLocale();return n===s?null:this.helper.getTranslation(s,r,i)}resolveHas(e,t){let n=this.getLocale(),r=this.resolveRouteName(t),i=typeof e==`string`?e:String(e);return t===void 0||r===this.getRoute()?(this.ensurePinnedChunk(n,r),this.helper.lookupIn(this.pinnedCacheKey,this.pinnedTree,i)!==null):this.helper.getTranslation(n,r,i)!==null}resolveTranslationTree(e,t){return zP(e,t)}resolveTranslations(e){this.touch();let t=this.getLocale(),n=this.resolveRouteName(e),r=this.helper.getCache(t,n)??{},i=this.getFallbackLocale();if(i===t)return r;let a=this.helper.getCache(i,n);return a?this.resolveTranslationTree(a,r):r}onTranslationsChanged(){}getMissingContext(e){return{locale:this.getLocale(),routeName:this.resolveRouteName(e)}}warnDev(e){this.missingWarn}warnMissing(e,t){let{locale:n,routeName:r}=this.getMissingContext(t),i=this.getCustomMissingHandler?.();i?i(n,String(e),r):this.missingHandler?this.missingHandler(n,String(e),r):this.warnDev(`Not found '${e}' key in '${n}' locale messages for route '${r}'.`)}warnMissingFormat(e,t,n){this.warnDev(`Not found '${t}' ${e} format in '${n}' locale. Falling back to default Intl options.`)}t(e,t,n,r){if(!e)return``;if(this.touch(),t===void 0&&n===void 0&&r===void 0&&typeof e==`string`)return this.resolveLookup(e)??(this.warnMissing(e),e);let i=this.resolveLookup(e,r);return i==null?(this.warnMissing(e,r),n===void 0?e:n||e):typeof i!=`string`||!t?i:IP(i,t)}ts(e,t,n,r){return this.t(e,t,n,r)?.toString()??n??e}tc(e,t,n){this.touch();let{count:r,...i}=typeof t==`number`?{count:t}:t;return r===void 0?n??e:this.pluralFunc(e,Number.parseInt(r.toString(),10),i,this.getLocale(),(e,t,n)=>{let r=this.resolveLookup(e);return r==null?n===void 0?void 0:n||e:typeof r!=`string`||!t?r:IP(r,t)})??n??e}tn(e,t,n,r){this.touch();let i=this.resolveNumberFormatArgs(t,n,r);return this.formatter.formatNumber(e,i.locale,i.options)}td(e,t,n,r){this.touch();let i=this.resolveDateTimeFormatArgs(t,n,r);return this.formatter.formatDate(e,i.locale,i.options)}tdr(e,t){return this.touch(),this.formatter.formatRelativeTime(e,this.getLocale(),t)}has(e,t){return this.touch(),this.resolveHas(e,t)}setTranslation(e,t){let n=this.getLocale(),r=this.getRoute(),i=this.helper.getCache(n,r)??{};this.helper.setTranslations(n,RP(i,String(e),t),r),this.invalidatePin(),this.onTranslationsChanged()}clearCache(){this.helper.clearCache(),this.formatter.clearCache(),this.invalidatePin()}resolveNumberFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveNumberFormat(r,e);return a||this.warnMissingFormat(`number`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}resolveDateTimeFormatArgs(e,t,n){if(typeof e!=`string`)return{locale:this.getLocale(),options:e};let r=this.getLocale(),i;typeof t==`string`?(r=t,i=n):i=t;let a=this.formatter.resolveDateTimeFormat(r,e);return a||this.warnMissingFormat(`datetime`,e,r),!a&&!i?{locale:r,options:void 0}:{locale:r,options:a?{...a,...i}:i}}loadTranslationsCore(e,t,n,r=`index`){n?this.helper.mergeTranslation(e,r,t,!0):this.helper.setTranslations(e,t,r),this.invalidatePin()}loadRouteTranslationsCore(e,t,n,r){r?this.helper.mergeTranslation(e,t,n,!0):this.helper.loadPageTranslations(e,t,n),this.invalidatePin()}extend(e){return Object.assign(this,e)}},QP=Symbol(`i18n`),$P=Symbol(`i18n-locales`),eF=Symbol(`i18n-default-locale`),tF=Symbol(`i18n-router-strategy`),nF=N({name:`I18nGroup`,props:{prefix:{type:String,required:!0},groupClass:{type:String,default:``}},setup(e,{slots:t}){let n=Dr(QP);if(!n)throw Error(`[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.`);let r=(t,r)=>n.t(`${e.prefix}.${t}`,r,void 0,n.getRoute());return()=>sc(`div`,{class:[`i18n-group`,e.groupClass]},t.default?.({prefix:e.prefix,t:r}))}}),rF=N({name:`I18nLink`,props:{to:{type:[String,Object],required:!0},activeStyle:{type:Object,default:()=>({})},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Dr(QP),r=Dr(tF,void 0);if(!n)throw Error(`[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.`);let i=W(()=>typeof e.to==`string`&&/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(e.to)),a=W(()=>{if(i.value)return e.to;if(e.localeRoute){let t=e.localeRoute(e.to);return typeof t==`string`?t:t.path||`/`}if(!r?.resolvePath)return typeof e.to==`string`?e.to:e.to.path||`/`;let t=r.resolvePath(e.to,n.locale.value);return typeof t==`string`?t:t.path||`/`}),o=W(()=>i.value||!r?!1:r.getCurrentPath().replace(/#.*$/,``).replace(/\/$/,``)===a.value.replace(/#.*$/,``).replace(/\/$/,``)),s=W(()=>o.value?e.activeStyle:{});return()=>i.value?sc(`a`,{href:a.value,target:`_blank`,rel:`noopener noreferrer`,style:s.value},t.default?.()):r?.linkComponent?sc(r.linkComponent,{to:a.value,style:s.value},{default:t.default}):sc(`a`,{href:a.value,style:s.value,onClick:e=>{e.preventDefault(),r?r.push({path:a.value}):window.location.href=a.value}},t.default?.())}}),iF=N({name:`I18nSwitcher`,props:{customLabels:{type:Object,default:()=>({})},customWrapperStyle:{type:Object,default:()=>({})},customButtonStyle:{type:Object,default:()=>({})},customDropdownStyle:{type:Object,default:()=>({})},customItemStyle:{type:Object,default:()=>({})},customLinkStyle:{type:Object,default:()=>({})},customActiveLinkStyle:{type:Object,default:()=>({})},customDisabledLinkStyle:{type:Object,default:()=>({})},customIconStyle:{type:Object,default:()=>({})},locales:{type:Array,default:void 0},currentLocale:{type:[String,Function],default:void 0},getLocaleName:{type:Function,default:void 0},switchLocale:{type:Function,default:void 0},localeRoute:{type:Function,default:void 0}},setup(e,{slots:t}){let n=Dr(QP),r=Dr(tF,void 0),i=Dr($P,void 0);if(!n)throw Error(`[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.`);if(!i&&!e.locales)throw Error(`[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.`);let a=W(()=>e.locales||i||[]),o=W(()=>a.value.filter(e=>!e.disabled)),s=W(()=>e.currentLocale===void 0?n.locale.value:typeof e.currentLocale==`function`?e.currentLocale():e.currentLocale),c=W(()=>a.value.some(e=>e.code===s.value&&e.disabled)),l=W(()=>e.getLocaleName?e.getLocaleName()||null:a.value.find(e=>e.code===n.locale.value)?.displayName||null),u=k(!1),d=k(null),f=e=>{e&&(e.stopPropagation(),e.preventDefault()),u.value=!u.value},p=t=>e.customLabels[t.code]||t.displayName||t.code,m=W(()=>{let e=a.value.find(e=>e.code===s.value);return e?p(e):l.value||s.value}),h=async t=>{if(u.value=!1,await ir(),e.switchLocale){e.switchLocale(t);return}if(n.locale.value=t,!r)return;let i=r.getCurrentPath(),a=e.localeRoute?(()=>{let n=e.localeRoute(i,t);return typeof n==`string`?n:n.path||`/`})():r?.resolvePath?(()=>{let e=r.resolvePath(i,t);return typeof e==`string`?e:e.path||`/`})():i;r.push({path:a})},g={position:`relative`,display:`inline-block`,verticalAlign:`middle`},_={padding:`4px 12px`,fontSize:`16px`,cursor:`pointer`,backgroundColor:`#fff`,border:`1px solid #333`,transition:`background-color 0.3s ease`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},v={position:`absolute`,top:`100%`,left:`0`,zIndex:1e3,backgroundColor:`#fff`,border:`1px solid #333`,listStyle:`none`,padding:`0`,margin:`4px 0 0 0`,minWidth:`150px`,boxShadow:`0 2px 8px rgba(0,0,0,0.15)`},y={margin:`0`,padding:`0`},b={display:`block`,padding:`8px 12px`,color:`#333`,textDecoration:`none`,transition:`background-color 0.3s ease`,cursor:`pointer`},x={fontWeight:`bold`,color:`#007bff`,cursor:`not-allowed`},S={marginLeft:`8px`,display:`inline-block`,transition:`transform 0.3s ease`},C={transform:`rotate(180deg)`},w=e=>e?Array.isArray(e)?e:[e]:[],T=e=>{if(!u.value)return;let t=e.target;if(!t||!d.value)return;let n=d.value.contains(t),r=t.closest(`.i18n-switcher-button`)!==null;!n&&!r&&(u.value=!1)};return ia(()=>{document.addEventListener(`click`,T)}),ca(()=>{document.removeEventListener(`click`,T)}),()=>{let n=[];t[`before-button`]&&n.push(...w(t[`before-button`]()));let i=[];if(t[`before-selected-locale`]&&i.push(...w(t[`before-selected-locale`]())),i.push(sc(`span`,m.value)),t[`after-selected-locale`]&&i.push(...w(t[`after-selected-locale`]())),i.push(sc(`span`,{style:{...S,...u.value?C:{},...e.customIconStyle}},`▼`)),n.push(sc(`button`,{class:`i18n-switcher-button`,style:{..._,...e.customButtonStyle,...c.value?e.customDisabledLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),f(e)},type:`button`,ariaHaspopup:!0,ariaExpanded:u.value},i)),t[`before-dropdown`]&&n.push(...w(t[`before-dropdown`]())),u.value){let i=[];t[`before-dropdown-items`]&&i.push(...w(t[`before-dropdown-items`]())),o.value.forEach(n=>{let a=[];t[`before-item`]&&a.push(...w(t[`before-item`]({locale:n})));let o=[];t[`before-link-content`]&&o.push(...w(t[`before-link-content`]({locale:n}))),o.push(p(n)),t[`after-link-content`]&&o.push(...w(t[`after-link-content`]({locale:n})));let c=typeof window<`u`?window.location.pathname:`/`,l=e.localeRoute?e.localeRoute(c,n.code):r?.resolvePath?r.resolvePath(c,n.code):c,u=typeof l==`string`?l:l.path||`#`,d=n.code===s.value;a.push(sc(`a`,{class:`switcher-locale-${n.code}`,href:typeof u==`string`?u:`#`,style:{...b,...d?x:{},...e.customLinkStyle,...d?e.customActiveLinkStyle:{}},onClick:e=>{e.preventDefault(),e.stopPropagation(),h(n.code)}},o)),t[`after-item`]&&a.push(...w(t[`after-item`]({locale:n}))),i.push(sc(`li`,{key:n.code,style:{...y,...e.customItemStyle}},a))}),t[`after-dropdown-items`]&&i.push(...w(t[`after-dropdown-items`]())),n.push(sc(`ul`,{class:`i18n-switcher-dropdown`,style:{...v,...e.customDropdownStyle}},i))}return t[`after-dropdown`]&&n.push(...w(t[`after-dropdown`]())),sc(`div`,{ref:d,class:`i18n-switcher-wrapper`,style:{...g,...e.customWrapperStyle}},n)}}}),aF=N({name:`I18nT`,inheritAttrs:!1,props:{keypath:{type:String,required:!0},plural:{type:[Number,String]},tag:{type:String,default:`span`},params:{type:Object,default:()=>({})},defaultValue:{type:String,default:``},html:{type:Boolean,default:!1},hideIfEmpty:{type:Boolean,default:!1},customPluralRule:{type:Function,default:null},number:{type:[Number,String]},date:{type:[Date,String,Number]},relativeDate:{type:[Date,String,Number]}},setup(e,{slots:t,attrs:n}){let r=Dr(QP);if(!r)throw Error(`[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.`);return()=>{let i={},a=r.getRoute(),o={...n};delete o.innerHTML;let s=t=>e.html?sc(e.tag,{...o,innerHTML:t}):sc(e.tag,o,t);if(e.number!==void 0){let t=Number(e.number),n=r.tn(t),i=r.t(e.keypath,{number:n,...e.params},void 0,a);return s(String(i??``))}if(e.date!==void 0){let t=r.td(e.date),n=r.t(e.keypath,{date:t,...e.params},void 0,a);return s(String(n??``))}if(e.relativeDate!==void 0){let t=r.tdr(e.relativeDate),n=r.t(e.keypath,{relativeDate:t,...e.params},void 0,a);return s(String(n??``))}if(e.plural!==void 0){let t=Number.parseInt(e.plural.toString(),10);return e.customPluralRule?s(e.customPluralRule(e.keypath,t,e.params,r.locale.value,(e,t,n)=>r.t(e,t,n,a))||``):s(r.tc(e.keypath,{count:t,...e.params}))}let c=(r.t(e.keypath,{...e.params,...i},void 0,a)??``).toString();if(e.hideIfEmpty&&!c.trim())return e.defaultValue??null;if(e.html)return s(c);if(t.default)return sc(e.tag,o,t.default({translation:c}));let l=[],u=0;for(let[e,n]of Object.entries(t)){if(e==="default")continue;let t=`{${e}}`,r=c.indexOf(t,u);r!==-1&&(r>u&&l.push(c.slice(u,r)),n&&l.push(sc(n)),u=r+t.length)}return u<c.length&&l.push(c.slice(u)),t.default?sc(e.tag,o,t.default({children:l})):l.length>0?sc(e.tag,o,l):sc(e.tag,o,c)}}}),oF=class extends ZP{constructor(e){let t={translations:new Map};if(super({storage:t,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this.listeners=new Set,this.storage=t,this._locale=gn(e.locale),this._fallbackLocale=gn(e.fallbackLocale||e.locale),this._currentRoute=gn(`index`),this._revision=gn(0),e.messages)for(let[t,n]of Object.entries(e.messages))this.helper.loadTranslations(t,n)}get locale(){return this._locale}set locale(e){typeof e==`string`?this._locale.value=e:this._locale=e}get fallbackLocale(){return this._fallbackLocale}set fallbackLocale(e){typeof e==`string`?this._fallbackLocale.value=e:this._fallbackLocale=e}get currentRoute(){return this._currentRoute}setRoute(e){this._currentRoute.value=e}getLocale(){return this._locale.value}getFallbackLocale(){return this._fallbackLocale.value}getRoute(){return this._currentRoute.value}addTranslations(e,t,n=!0){super.loadTranslationsCore(e,t,n),this._revision.value++,this.notifyListeners()}addRouteTranslations(e,t,n,r=!0){super.loadRouteTranslationsCore(e,t,n,r),this._revision.value++,this.notifyListeners()}mergeTranslations(e,t,n){this.helper.mergeTranslation(e,t,n,!0),this._revision.value++,this.notifyListeners()}clearCache(){super.clearCache(),this._revision.value++,this.notifyListeners()}onTranslationsChanged(){this._revision.value++,this.notifyListeners()}subscribeToChanges(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}getStorage(){return this.storage}getRouteCache(){let e={};for(let[t,n]of this.storage.translations)e[t]=n;return e}};function sF(e){let{routingStrategy:t,locales:n,defaultLocale:r,...i}=e,a=new oF(i),o=null,s=t||null;return{global:a,setRoutingStrategy:e=>{s=e,o&&o.provide(tF,e)},install(e){o=e,e.provide(QP,a),s&&e.provide(tF,s),n&&e.provide($P,n),r&&e.provide(eF,r),e.config.globalProperties.$t=(e,t,n,r)=>a.t(e,t,n,r),e.config.globalProperties.$ts=(e,t,n,r)=>a.ts(e,t,n,r),e.config.globalProperties.$tc=(e,t,n)=>a.tc(e,t,n),e.config.globalProperties.$tn=a.tn.bind(a),e.config.globalProperties.$td=a.td.bind(a),e.config.globalProperties.$tdr=a.tdr.bind(a),e.config.globalProperties.$has=(e,t)=>a.has(e,t),e.config.globalProperties.$i18n=a,e.component(`I18nT`,aF),e.component(`I18nLink`,rF),e.component(`I18nGroup`,nF),e.component(`I18nSwitcher`,iF)}}}var cF=[{code:`en`,iso:`en-US`,name:`English`},{code:`vi`,iso:`vi-VN`,name:`Tiếng Việt`},{code:`zh-CN`,iso:`zh-CN`,name:`简体中文`},{code:`ja`,iso:`ja-JP`,name:`日本語`},{code:`es`,iso:`es-ES`,name:`Español`},{code:`ko`,iso:`ko-KR`,name:`한국어`},{code:`ru`,iso:`ru-RU`,name:`Русский`},{code:`fr`,iso:`fr-FR`,name:`Français`},{code:`de`,iso:`de-DE`,name:`Deutsch`}],lF=`hh.locale`,uF=new Map(cF.map(e=>[e.code,e]));function dF(e){return uF.get(e)}function fF(e){return uF.has(e)}function pF(e){if(e.length===0)return null;let t=e.toLowerCase(),n=cF.find(e=>e.code.toLowerCase()===t);if(n!==void 0)return n.code;let r=t.split(`-`)[0];return cF.find(e=>e.code.toLowerCase()===r||e.code.toLowerCase().split(`-`)[0]===r)?.code??null}function mF(e,t,n){return e.replace(/\{(\w+)\}/g,(e,r)=>{if(r===`count`)return String(n);let i=t[r];return i===void 0?e:String(i)})}var hF=new Map,gF=(e,t,n,r,i)=>{let a=i(e);if(a==null)return null;if(typeof a==`string`)return mF(a.split(`|`)[0].trim(),n??{},t);let o=hF.get(r);o===void 0&&(o=new Intl.PluralRules(r),hF.set(r,o));let s=a[o.select(t)]??a.other;return typeof s==`string`?mF(s,n??{},t):null},_F=`modulepreload`,vF=function(e){return`/`+e},yF={},bF=function(e){return e.pathname.endsWith(`.css`)},xF=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},SF=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=vF(t,n);let r=s(t),i=bF(r);return xF(yF,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:_F,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},CF=Object.assign({"../../i18n/generated/en.json":DP}),wF=Object.assign({"../../i18n/generated/de.json":()=>SF(()=>import(`./de-0YLueNal.js`),[]),"../../i18n/generated/es.json":()=>SF(()=>import(`./es-FCHhRmn2.js`),[]),"../../i18n/generated/fr.json":()=>SF(()=>import(`./fr-C69Z8o0z.js`),[]),"../../i18n/generated/ja.json":()=>SF(()=>import(`./ja-Chz9YOqR.js`),[]),"../../i18n/generated/ko.json":()=>SF(()=>import(`./ko-CtXZ2x1l.js`),[]),"../../i18n/generated/ru.json":()=>SF(()=>import(`./ru-D_jE64xN.js`),[]),"../../i18n/generated/vi.json":()=>SF(()=>import(`./vi-sxSffss7.js`),[]),"../../i18n/generated/zh-CN.json":()=>SF(()=>import(`./zh-CN-ChTpf29X.js`),[])}),TF=sF({locale:`en`,fallbackLocale:`en`,defaultLocale:`en`,plural:gF,missingWarn:!1,messages:{en:Object.values(CF)[0]?.default??{}},locales:cF.map(e=>({...e}))}),EF=new Set([`en`]),DF=new Map;function OF(){try{let e=localStorage.getItem(lF);if(e!==null&&fF(e))return e}catch{}return null}function kF(){let e=typeof navigator>`u`?[]:[...navigator.languages??[],navigator.language].filter(e=>typeof e==`string`);for(let t of e){let e=pF(t);if(e!==null)return e}return`en`}async function AF(e){if(EF.has(e))return;let t=DF.get(e);if(t!==void 0)return t;let n=wF[`../../i18n/generated/${e}.json`];if(n===void 0)return;let r=n().then(t=>{TF.global.addTranslations(e,t.default,!0),EF.add(e)}).finally(()=>DF.delete(e));return DF.set(e,r),r}function jF(e){typeof document<`u`&&(document.documentElement.lang=dF(e)?.iso??e)}async function MF(e){if(fF(e)&&e!==TF.global.locale.value){try{await AF(e)}catch{return}TF.global.locale.value=e,jF(e);try{localStorage.setItem(lF,e)}catch{}}}async function NF(){let e=OF()??kF();try{await AF(e)}catch{jF(`en`);return}e!==`en`&&(TF.global.locale.value=e),jF(e)}function Y(e,t,n){let r=TF.global.t(e,t,n??null);return typeof r==`string`?r:String(r??``)}function PF(e,t,n){let r={...n,count:t},i=TF.global.resolveTranslations()[e];return i===void 0?Y(e,r,e):gF(e,t,r,FF(),()=>i)??Y(e,r,e)}function FF(){return TF.global.locale.value}var IF={responseMs:null,cpuPercent:null,rssBytes:null,processes:null};function LF(e){return e.status===`running`?{responseMs:e.responseMs??null,cpuPercent:e.resources?.cpuPercent??null,rssBytes:e.resources?.rssBytes??null,processes:e.resources?.processes??null}:IF}function RF(e,t){let n=0;for(let r of e){let e=LF(r)[t];if(typeof e!=`number`)return null;n+=e}return n}var zF=4e3;function BF(){return tn({ts:[],cpu:[],rss:[],probe:[],lastSampledAt:-1})}function VF(e){let t=e.ts.length-120;t<=0||(e.ts.splice(0,t),e.cpu.splice(0,t),e.rss.splice(0,t),e.probe.splice(0,t))}function HF(e,t,n){let r=t.resources?.sampledAt??0,i=e.ts[e.ts.length-1]??0,a=r!==e.lastSampledAt||n-i>=zF,o=LF(t);a?(e.lastSampledAt=r,e.ts.push(n),e.cpu.push(o.cpuPercent),e.rss.push(o.rssBytes),e.probe.push(o.responseMs),VF(e)):e.probe.length>0&&(e.probe[e.probe.length-1]=o.responseMs)}function UF(e){let t=0;for(let n of e)n!==null&&n>t&&(t=n);return t}function WF(e){for(let t=e.length-1;t>=0;--t){let n=e[t];if(n!=null)return n}return null}var GF=8e3,KF=k(null),qF=k(`connecting`),JF=k(null),YF=k(Date.now()),XF=new Map,ZF=EP(),QF=new Map,$F=k(0),eI=null,tI=null;function nI(e){let t=QF.get(e);if(t)return t;let n={lines:[],version:k(0),refs:0,source:null};return QF.set(e,n),n}function rI(e,t){let n=nI(e),r=n.lines.concat(t);n.lines=r.length>8e3?r.slice(r.length-GF):r,n.version.value+=1,$F.value+=1}function iI(e){return QF.get(e)?.lines??[]}function aI(e){let t=QF.get(e);t&&(t.lines=[],t.version.value+=1,$F.value+=1)}function oI(e){let t=XF.get(e);if(t)return t;let n=BF();return XF.set(e,n),n}function sI(e){e.workspaceId!==void 0&&HF(oI(LM(e.workspaceId,e.id)),e,Date.now())}function cI(e){let t=KF.value;if(!t)return;let n=e.workspaceId,r=n===void 0?t.workspaces.filter(t=>t.servers.some(t=>t.id===e.id)):t.workspaces.filter(e=>e.id===n);if(r.length!==1)return;let i=r[0],a=i.servers.find(t=>t.id===e.id),o=n===void 0?{...e,workspaceId:i.id}:e;i.servers=a===void 0?[...i.servers,o]:i.servers.map(t=>t.id===e.id?o:t)}function lI(e){let t;try{t=JSON.parse(e)}catch{return}let n=MM(t);if(n instanceof J.errors)console.warn(`[home-hosted] ignored malformed SSE frame`,n.summary);else if(n.type===`hello`||n.type===`state`){if(n.state){KF.value=n.state;for(let e of KF.value.workspaces)for(let t of e.servers)sI(t)}}else if(n.type===`server`&&n.server){let e=n.server;cI(e),sI(e)}else if(n.type===`log`&&n.serverId&&n.lines){let e=n.workspaceId;if(e===void 0)return;rI(LM(e,n.serverId),n.lines)}}function uI(e,t,n){let r=LM(e,t);n.lines=[],n.version.value+=1,$F.value+=1;let i=new EventSource(`/api/servers/${encodeURIComponent(t)}/stream${IN(e)}`),a=e=>{let t=e,n;try{n=JSON.parse(t.data)}catch{return}let i=MM(n);i instanceof J.errors?console.warn(`[home-hosted] ignored malformed SSE frame`,i.summary):i.type===`log`&&i.lines?rI(r,i.lines):i.type===`server`&&i.server&&cI(i.server)};for(let e of[`log`,`server`])i.addEventListener(e,a);i.onerror=()=>{},n.source=i}function dI(e,t){let n=nI(LM(e,t));n.refs+=1,n.source||uI(e,t,n)}function fI(e,t){let n=QF.get(LM(e,t));n&&(n.refs=Math.max(0,n.refs-1),n.refs===0&&(n.source?.close(),n.source=null))}function pI(){if(eI)return;tI??=setInterval(()=>{YF.value=Date.now()},1e3);let e=new EventSource(`/api/events?logs=0`);eI=e,qF.value=`connecting`,e.onopen=()=>{qF.value=`open`},e.onerror=()=>{qF.value=`closed`};for(let t of[`hello`,`state`,`server`,`log`])e.addEventListener(t,e=>{lI(e.data)})}function mI(){eI?.close(),eI=null,tI&&clearInterval(tI),tI=null}function hI(e,t){let n=W(()=>{let n=bn(e),r=bn(t);return n===null||r===null?null:LM(n,r)}),r=null;return M(n,e=>{if(r!==null&&r!==e){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&fI(e,t)}if(r=e,e!==null){let[t,n]=e.split(`/`);t!==void 0&&n!==void 0&&dI(t,n)}},{immediate:!0}),ze(()=>{if(r!==null){let[e,t]=r.split(`/`);e!==void 0&&t!==void 0&&fI(e,t)}r=null}),{version:W(()=>{let e=n.value;return $F.value,e===null?0:QF.get(e)?.version.value??0}),lines(){let e=n.value;return e===null?[]:iI(e)},count:W(()=>{let e=n.value;return $F.value,e===null?0:QF.get(e)?.lines.length??0}),clear(){let e=n.value;e!==null&&aI(e)}}}function gI(){let e=W(()=>KF.value?.workspaces??[]),t=W(()=>e.value.flatMap(e=>e.servers.map(t=>({workspace:e,server:t})))),n=W(()=>KF.value?.control??null),r=W(()=>KF.value?.host??null),i=W(()=>KF.value?.backups??null),a=W(()=>KF.value?.proxy??null),o=W(()=>KF.value?.projectDir??null),s=W(()=>KF.value?.dataRoot??null),c=W(()=>KF.value?.version??null);function l(e){return KF.value?.workspaces.find(t=>t.id===e)}function u(e,t){return l(e)?.servers.find(e=>e.id===t)}function d(e,t){return oI(LM(e,t))}async function f(){if(KF.value===null)try{KF.value=await zN()}catch(e){e instanceof zM&&xP().requireLogin()}}async function p(e,t){JF.value=null;try{let n=await e();KF.value=await zN();let r=typeof t.success==`function`?t.success(n):t.success;return r&&ZF.success(r),n}catch(e){if(e instanceof zM){xP().requireLogin();return}let n=IM(e);JF.value=n,ZF.failure(t.title,n);return}}return{appState:KF,workspaces:e,allServers:t,control:n,host:r,backups:i,proxy:a,projectDir:o,dataRoot:s,version:c,connection:rn(qF),lastError:rn(JF),now:rn(YF),workspaceById:l,ensureState:f,serverById:u,seriesOf:d,refresh:(e=Y(`toast.refreshFailed`))=>p(async()=>{},{title:e}),start:(e,t)=>p(()=>lP(e,t,`start`),{title:Y(`toast.startFailed`,{id:t})}),stop:(e,t)=>p(()=>lP(e,t,`stop`),{title:Y(`toast.stopFailed`,{id:t})}),restart:(e,t)=>p(()=>lP(e,t,`restart`),{title:Y(`toast.restartFailed`,{id:t})}),startAll:e=>p(()=>dP(e),{title:Y(`toast.startAllFailed`),success:Y(`toast.startAllStarted`)}),stopOrphan:(e,t)=>p(()=>uP(e,t),{title:Y(`toast.stopOrphanFailed`,{id:t}),success:Y(`toast.stopOrphanDone`)}),stopAll:(e,t={})=>p(()=>pP(e,t),{title:Y(`toast.stopAllFailed`),success:Y(t.withPersistent===!0?`toast.stopAllWithPersistent`:`toast.stopAllStarted`)}),setAutostart:(e,t,n)=>p(()=>hP(e,t,{autostart:n}),{title:Y(`toast.autostartFailed`,{id:t})}),setEnabled:(e,t,n)=>p(()=>hP(e,t,{enabled:n}),{title:Y(`toast.changeFailed`,{id:t})}),freePort:(e,t)=>p(()=>fP(e,t),{title:Y(`toast.freePortFailed`,{id:t}),success:e=>e.free?Y(`toast.portFree`,{port:e.port,id:t}):Y(`toast.portHeld`,{port:e.port})}),setBind:(e,t,n)=>{let r=IA(n);return r===null?(ZF.failure(Y(`toast.bindFailed`,{id:t}),Y(`toast.bindInvalid`,{bind:n})),Promise.resolve(void 0)):p(()=>hP(e,t,{bind:r}),{title:Y(`toast.bindFailed`,{id:t})})},saveConfig:(e,t,n)=>p(()=>hP(e,t,n),{title:Y(`toast.saveServerFailed`,{id:t}),success:Y(`toast.serverUpdated`,{id:t})}),saveGlobalSettings:e=>p(()=>WN(e),{title:Y(`toast.saveSettingsFailed`)}),saveWorkspaceSettings:(e,t)=>p(()=>GN(e,t),{title:Y(`toast.saveSettingsFailed`)}),clearLogs:(e,t)=>p(async()=>{await mP(e,t),aI(LM(e,t))},{title:Y(`toast.clearLogsFailed`,{id:t}),success:Y(`toast.logsCleared`)}),create:(e,t)=>p(()=>_P(e,t),{title:Y(`toast.addServerFailed`),success:Y(`toast.serverAdded`)}),remove:(e,t)=>p(async()=>{await gP(e,t),fI(e,t),QF.delete(LM(e,t)),XF.delete(LM(e,t))},{title:Y(`toast.removeServerFailed`,{id:t}),success:Y(`toast.serverRemoved`,{id:t})})}}var _I=`hh.theme`;function vI(){try{let e=localStorage.getItem(_I);if(e===`light`||e===`dark`||e===`system`)return e}catch{}return`system`}var yI=k(vI()),bI=k(typeof matchMedia<`u`&&matchMedia(`(prefers-color-scheme: dark)`).matches),xI=!1;function SI(){xI||typeof matchMedia>`u`||(xI=!0,matchMedia(`(prefers-color-scheme: dark)`).addEventListener(`change`,e=>{bI.value=e.matches,wI()}))}var CI=W(()=>yI.value===`system`?bI.value:yI.value===`dark`);function wI(){typeof document<`u`&&document.documentElement.classList.toggle(`dark`,CI.value)}function TI(){SI(),wI();function e(e){yI.value=e;try{localStorage.setItem(_I,e)}catch{}wI()}return{preference:yI,isDark:CI,setPreference:e,cycle(){e(yI.value===`light`?`dark`:yI.value===`dark`?`system`:`light`)}}}var EI=`hh.workspace`;function DI(){try{return localStorage.getItem(EI)}catch{return null}}function OI(e){try{e===null?localStorage.removeItem(EI):localStorage.setItem(EI,e)}catch{}}var kI=k(DI()),AI=k(!1);function jI(){let e=gI(),t=EP(),n=W(()=>e.appState.value?.workspaces??[]),r=W(()=>{let e=n.value;return e.find(e=>e.id===kI.value)??e[0]??null}),i=W(()=>r.value?.id??``);M([n,kI],()=>{let e=n.value;if(e.length===0)return;let t=e.find(e=>e.id===kI.value)?.id??e[0].id;t!==kI.value&&(kI.value=t,OI(t))},{immediate:!0});function a(e){kI.value=e,OI(e)}let o=W(()=>r.value?.servers??[]),s=W(()=>r.value?.defaults??null),c=W(()=>r.value?.logs??null),l=W(()=>r.value?.notifications??null),u=W(()=>r.value?.configError??null),d=W(()=>r.value?.configWarnings??[]),f=W(()=>r.value?.logsDir??null),p=W(()=>r.value?.serverCount??0),m=W(()=>r.value?.runningCount??0),h=W(()=>r.value?.crashedCount??0);function g(e){return o.value.find(t=>t.id===e)}function _(t){return e.seriesOf(i.value,t)}async function v(n){AI.value=!0;try{let r=await VN(n.trim().length>0?{label:n.trim()}:{});return await e.refresh(Y(`toast.readWorkspacesFailed`)),a(r.id),t.success(Y(`toast.workspaceCreated`,{workspace:r.label})),r}catch(e){t.failure(Y(`toast.workspaceCreateFailed`),IM(e));return}finally{AI.value=!1}}async function y(n,r){try{return await HN(n,r.trim()),await e.refresh(Y(`toast.readWorkspacesFailed`)),t.success(Y(`toast.workspaceRenamed`)),!0}catch(e){return t.failure(Y(`toast.workspaceRenameFailed`),IM(e)),!1}}async function b(n){try{return await UN(n),await e.refresh(Y(`toast.readWorkspacesFailed`)),t.success(Y(`toast.workspaceDeleted`)),!0}catch(e){return t.failure(Y(`toast.workspaceDeleteFailed`),IM(e)),!1}}return{workspaces:n,selectedId:rn(kI),selected:r,activeId:i,creating:rn(AI),select:a,create:v,rename:y,remove:b,servers:o,serverById:g,seriesOf:_,defaults:s,logsConfig:c,notifications:l,configError:u,configWarnings:d,logsDir:f,serverCount:p,runningCount:m,crashedCount:h,refresh:e.refresh,start:t=>e.start(i.value,t),stop:t=>e.stop(i.value,t),restart:t=>e.restart(i.value,t),startAll:()=>e.startAll(i.value),stopAll:(t={})=>e.stopAll(i.value,t),setEnabled:(t,n)=>e.setEnabled(i.value,t,n),setAutostart:(t,n)=>e.setAutostart(i.value,t,n),setBind:(t,n)=>e.setBind(i.value,t,n),freePort:t=>e.freePort(i.value,t),clearLogs:t=>e.clearLogs(i.value,t),saveConfig:(t,n)=>e.saveConfig(i.value,t,n),createServer:t=>e.create(i.value,t),removeServer:t=>e.remove(i.value,t)}}function MI(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=MI(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function NI(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=MI(e))&&(r&&(r+=` `),r+=t);return r}var PI=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},FI=(e,t)=>({classGroupId:e,validator:t}),II=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),LI=`-`,RI=[],zI=`arbitrary..`,BI=e=>{let t=UI(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return HI(e);let n=e.split(LI);return VI(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?PI(i,t):t:i||RI}return n[e]||RI}}},VI=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=VI(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(LI):e.slice(t).join(LI),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},HI=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?zI+r:void 0})(),UI=e=>{let{theme:t,classGroups:n}=e;return WI(n,t)},WI=(e,t)=>{let n=II();for(let r in e){let i=e[r];GI(i,n,r,t)}return n},GI=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];KI(i,t,n,r)}},KI=(e,t,n,r)=>{typeof e==`string`?qI(e,t,n):typeof e==`function`?JI(e,t,n,r):YI(e,t,n,r)},qI=(e,t,n)=>{let r=e===``?t:XI(t,e);r.classGroupId=n},JI=(e,t,n,r)=>{ZI(e)?GI(e(r),t,n,r):(t.validators===null&&(t.validators=[]),t.validators.push(FI(n,e)))},YI=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];GI(o,XI(t,a),n,r)}},XI=(e,t)=>{let n=e,r=t.split(LI),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=II(),n.nextPart.set(t,i)),n=i}return n},ZI=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,QI=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},$I=`!`,eL=`:`,tL=[],nL=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),rL=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===eL){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith($I)?(c=s.slice(0,-1),l=!0):s.startsWith($I)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return nL(t,l,c,u)};if(t){let e=t+eL,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):nL(tL,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},iL=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},aL=e=>({cache:QI(e.cacheSize),parseClassName:rL(e),sortModifiers:iL(e),postfixLookupClassGroupIds:oL(e),...BI(e)}),oL=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},sL=/\s+/,cL=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(sL),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h||(g=r(p),!g)){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+$I:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},lL=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=uL(n))&&(i&&(i+=` `),i+=r);return i},uL=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=uL(e[r]))&&(n&&(n+=` `),n+=t);return n},dL=(e,...t)=>{let n,r,i,a,o=o=>(n=aL(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=cL(e,n);return i(e,a),a};return a=o,(...e)=>a(lL(...e))},fL=[],pL=e=>{let t=t=>t[e]||fL;return t.isThemeGetter=!0,t.themeKey=e,t},mL=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hL=/^\((?:(\w[\w-]*):)?(.+)\)$/i,gL=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_L=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,bL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,SL=e=>gL.test(e),CL=e=>!!e&&!Number.isNaN(Number(e)),wL=e=>!!e&&Number.isInteger(Number(e)),TL=e=>e.endsWith(`%`)&&CL(e.slice(0,-1)),EL=e=>_L.test(e),DL=()=>!0,OL=e=>vL.test(e)&&!yL.test(e),kL=()=>!1,AL=e=>bL.test(e),jL=e=>xL.test(e),ML=e=>!X(e)&&!Z(e),NL=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),PL=e=>YL(e,$L,kL),X=e=>mL.test(e),FL=e=>YL(e,eR,OL),IL=e=>YL(e,tR,CL),LL=e=>YL(e,rR,DL),RL=e=>YL(e,nR,kL),zL=e=>YL(e,ZL,kL),BL=e=>YL(e,QL,jL),VL=e=>YL(e,iR,AL),Z=e=>hL.test(e),HL=e=>XL(e,eR),UL=e=>XL(e,nR),WL=e=>XL(e,ZL),GL=e=>XL(e,$L),KL=e=>XL(e,QL),qL=e=>XL(e,iR,!0),JL=e=>XL(e,rR,!0),YL=(e,t,n)=>{let r=mL.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},XL=(e,t,n=!1)=>{let r=hL.exec(e);return r?r[1]?t(r[1]):n:!1},ZL=e=>e===`position`||e===`percentage`,QL=e=>e===`image`||e===`url`,$L=e=>e===`length`||e===`size`||e===`bg-size`,eR=e=>e===`length`,tR=e=>e===`number`,nR=e=>e===`family-name`,rR=e=>e===`number`||e===`weight`,iR=e=>e===`shadow`,aR=dL(()=>{let e=pL(`color`),t=pL(`font`),n=pL(`text`),r=pL(`font-weight`),i=pL(`tracking`),a=pL(`leading`),o=pL(`breakpoint`),s=pL(`container`),c=pL(`spacing`),l=pL(`radius`),u=pL(`shadow`),d=pL(`inset-shadow`),f=pL(`text-shadow`),p=pL(`drop-shadow`),m=pL(`blur`),h=pL(`perspective`),g=pL(`aspect`),_=pL(`ease`),v=pL(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[SL,`full`,`auto`,...w()],ee=()=>[wL,`none`,`subgrid`,Z,X],te=()=>[`auto`,{span:[`full`,wL,Z,X]},wL,Z,X],ne=()=>[wL,`auto`,Z,X],re=()=>[`auto`,`min`,`max`,`fr`,Z,X],ie=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ae=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],oe=()=>[`auto`,...w()],se=()=>[SL,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ce=()=>[s,SL,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],le=()=>[SL,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],E=()=>[e,Z,X],ue=()=>[...b(),WL,zL,{position:[Z,X]}],de=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],fe=()=>[`auto`,`cover`,`contain`,GL,PL,{size:[Z,X]}],pe=()=>[TL,HL,FL],me=()=>[``,`none`,`full`,l,Z,X],he=()=>[``,CL,HL,FL],ge=()=>[`solid`,`dashed`,`dotted`,`double`],_e=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ve=()=>[CL,TL,WL,zL],ye=()=>[``,`none`,m,Z,X],be=()=>[`none`,CL,Z,X],xe=()=>[`none`,CL,Z,X],D=()=>[CL,Z,X],Se=()=>[SL,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[EL],breakpoint:[EL],color:[DL],container:[EL],"drop-shadow":[EL],ease:[`in`,`out`,`in-out`],font:[ML],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[EL],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[EL],shadow:[EL],spacing:[`px`,CL],text:[EL],"text-shadow":[EL],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,SL,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[NL],columns:[{columns:[CL,`auto`,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[wL,`auto`,Z,X]}],basis:[{basis:[SL,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[CL,SL,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,CL,Z,X]}],shrink:[{shrink:[``,CL,Z,X]}],order:[{order:[wL,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":re()}],"auto-rows":[{"auto-rows":re()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ie(),`normal`]}],"justify-items":[{"justify-items":[...ae(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ae()]}],"align-content":[{content:[`normal`,...ie()]}],"align-items":[{items:[...ae(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ae(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ie()}],"place-items":[{"place-items":[...ae(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ae()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:oe()}],mx:[{mx:oe()}],my:[{my:oe()}],ms:[{ms:oe()}],me:[{me:oe()}],mbs:[{mbs:oe()}],mbe:[{mbe:oe()}],mt:[{mt:oe()}],mr:[{mr:oe()}],mb:[{mb:oe()}],ml:[{ml:oe()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:se()}],"inline-size":[{inline:[`auto`,...ce()]}],"min-inline-size":[{"min-inline":[`auto`,...ce()]}],"max-inline-size":[{"max-inline":[`none`,...ce()]}],"block-size":[{block:[`auto`,...le()]}],"min-block-size":[{"min-block":[`auto`,...le()]}],"max-block-size":[{"max-block":[`none`,...le()]}],w:[{w:[s,`screen`,...se()]}],"min-w":[{"min-w":[s,`screen`,`none`,...se()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...se()]}],h:[{h:[`screen`,`lh`,...se()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...se()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...se()]}],"font-size":[{text:[`base`,n,HL,FL]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,JL,LL]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,TL,X]}],"font-family":[{font:[UL,RL,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[CL,`none`,Z,IL]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ge(),`wavy`]}],"text-decoration-thickness":[{decoration:[CL,`from-font`,`auto`,Z,FL]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[CL,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[wL,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ue()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},wL,Z,X],radial:[``,Z,X],conic:[``,wL,Z,X]},KL,BL]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:me()}],"rounded-s":[{"rounded-s":me()}],"rounded-e":[{"rounded-e":me()}],"rounded-t":[{"rounded-t":me()}],"rounded-r":[{"rounded-r":me()}],"rounded-b":[{"rounded-b":me()}],"rounded-l":[{"rounded-l":me()}],"rounded-ss":[{"rounded-ss":me()}],"rounded-se":[{"rounded-se":me()}],"rounded-ee":[{"rounded-ee":me()}],"rounded-es":[{"rounded-es":me()}],"rounded-tl":[{"rounded-tl":me()}],"rounded-tr":[{"rounded-tr":me()}],"rounded-br":[{"rounded-br":me()}],"rounded-bl":[{"rounded-bl":me()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":he()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ge(),`hidden`,`none`]}],"divide-style":[{divide:[...ge(),`hidden`,`none`]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-bs":[{"border-bs":E()}],"border-color-be":[{"border-be":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...ge(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[CL,Z,X]}],"outline-w":[{outline:[``,CL,HL,FL]}],"outline-color":[{outline:E()}],shadow:[{shadow:[``,`inner`,`none`,u,qL,VL]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":[`none`,d,qL,VL]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:he()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[CL,FL]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":[`none`,f,qL,VL]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[CL,Z,X]}],"mix-blend":[{"mix-blend":[..._e(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":_e()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[CL]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[CL]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ue()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ye()}],brightness:[{brightness:[CL,Z,X]}],contrast:[{contrast:[CL,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,qL,VL]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:[``,CL,Z,X]}],"hue-rotate":[{"hue-rotate":[CL,Z,X]}],invert:[{invert:[``,CL,Z,X]}],saturate:[{saturate:[CL,Z,X]}],sepia:[{sepia:[``,CL,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ye()}],"backdrop-brightness":[{"backdrop-brightness":[CL,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[CL,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,CL,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[CL,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,CL,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[CL,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[CL,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,CL,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[CL,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[CL,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":[`scale-3d`],skew:[{skew:D()}],"skew-x":[{"skew-x":D()}],"skew-y":[{"skew-y":D()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":[`translate-none`],zoom:[{zoom:[wL,Z,X]}],accent:[{accent:E()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":E()}],"scrollbar-track-color":[{"scrollbar-track":E()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...E()]}],"stroke-w":[{stroke:[CL,HL,FL,IL]}],stroke:[{stroke:[`none`,...E()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Q(...e){return aR(NI(e))}var oR={stopped:{labelKey:`status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`status.running`,tone:`ok`,transitional:!1},stopping:{labelKey:`status.stopping`,tone:`warn`,transitional:!0},backoff:{labelKey:`status.backoff`,tone:`warn`,transitional:!0},crashed:{labelKey:`status.crashed`,tone:`danger`,transitional:!1},conflict:{labelKey:`status.conflict`,tone:`danger`,transitional:!1}},sR={disabled:{labelKey:`health.disabled`,tone:`neutral`},unknown:{labelKey:`health.unknown`,tone:`neutral`},healthy:{labelKey:`health.healthy`,tone:`ok`},unhealthy:{labelKey:`health.unhealthy`,tone:`danger`}},cR={ok:`text-ok`,warn:`text-warn`,danger:`text-danger`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},lR={ok:`bg-ok-soft text-ok border-ok/25`,warn:`bg-warn-soft text-warn border-warn/25`,danger:`bg-danger-soft text-danger border-danger/25`,info:`bg-info-soft text-info border-info/25`,neutral:`bg-hover text-muted border-line`,accent:`bg-accent-soft text-accent border-accent/25`},uR={ok:`bg-ok`,warn:`bg-warn`,danger:`bg-danger`,info:`bg-info`,neutral:`bg-faint`,accent:`bg-accent`};function dR(e,t){return e===`crashed`||e===`conflict`||t===`unhealthy`?`danger`:e===`starting`||e===`stopping`||e===`backoff`?`warn`:e===`running`?`ok`:`neutral`}var fR={start:`history.start`,exit:`history.exit`,crash:`history.crash`,"forced-restart":`history.forcedRestart`,unhealthy:`history.unhealthy`,recovered:`history.recovered`},pR={start:`ok`,exit:`neutral`,crash:`danger`,"forced-restart":`warn`,unhealthy:`warn`,recovered:`info`};function mR(e,t){let n=t?.authRequired===!0,r=t?.authenticated===!0;return n&&!r&&e.name!==`login`?{name:`login`,...e.fullPath===`/`?{}:{query:{next:e.fullPath}}}:e.name===`login`&&r?{name:`global-overview`,replace:!0}:null}var hR={viewBox:`0 0 80 80`,class:`size-full -rotate-0`},gR=[`stroke-dasharray`],_R=[`stroke-dasharray`],vR={class:`absolute inset-0 grid place-items-center`},yR={class:`font-mono text-sm font-semibold tabular-nums text-ink`},bR={class:`text-2xs font-medium text-faint`},xR=34,SR=.75,CR=N({__name:`Gauge`,props:{value:{},label:{},display:{default:void 0},size:{default:74},tone:{}},setup(e){let t=e,n=2*Math.PI*xR,r=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(1,Math.max(0,t.value/100))*SR),i={ok:`stroke-ok`,warn:`stroke-warn`,danger:`stroke-danger`,info:`stroke-info`,neutral:`stroke-faint`,accent:`stroke-accent`};return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center gap-1`))},[B(`div`,{class:`relative`,style:_e({width:`${t.size}px`,height:`${t.size}px`})},[(L(),R(`svg`,hR,[B(`circle`,{cx:`40`,cy:`40`,r:xR,fill:`none`,class:`stroke-line-soft`,"stroke-width":6,"stroke-dasharray":`${SR*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,8,gR),B(`circle`,{cx:`40`,cy:`40`,r:xR,fill:`none`,class:D([i[t.tone],`transition-[stroke-dasharray] duration-300 ease-out`]),"stroke-width":6,"stroke-dasharray":`${r.value*n} ${n}`,transform:`rotate(135 40 40)`,"stroke-linecap":`round`},null,10,_R)])),B(`div`,vR,[B(`span`,yR,O(t.display??(t.value===null?`—`:`${Math.round(t.value)}%`)),1)])],4),B(`span`,bR,O(t.label),1)],2))}}),wR=N({__name:`Meter`,props:{value:{},tone:{},height:{default:`h-1.5`},class:{default:void 0}},setup(e){let t=e,n=W(()=>t.value===null||!Number.isFinite(t.value)?0:Math.min(100,Math.max(0,t.value))),r={ok:`bg-ok/80`,warn:`bg-warn/85`,danger:`bg-danger/85`,info:`bg-info/80`,neutral:`bg-faint/60`,accent:`bg-accent/80`};return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`w-full overflow-hidden rounded-full bg-line-soft`,t.height,t.class))},[B(`div`,{class:D(A(Q)(`h-full rounded-full transition-[width] duration-300 ease-out`,r[t.tone])),style:_e({width:`${n.value}%`})},null,6)],2))}}),TR={key:0,class:`grid size-10 place-items-center rounded-full border border-line bg-panel-2 text-faint`},ER={class:`max-w-sm space-y-1`},DR={class:`text-sm font-medium text-ink`},OR={key:0,class:`text-xs leading-relaxed text-muted`},kR={key:1,class:`flex items-center gap-2`},AR=N({__name:`EmptyState`,props:{title:{},description:{default:void 0},compact:{type:Boolean,default:!1}},setup(e){return(e,t)=>(L(),R(`div`,{class:D(A(Q)(`flex flex-col items-center justify-center gap-3 text-center`,e.$props.compact?`px-4 py-8`:`px-6 py-14`))},[e.$slots.icon?(L(),R(`div`,TR,[F(e.$slots,`icon`)])):U(``,!0),B(`div`,ER,[B(`p`,DR,O(e.$props.title),1),e.$props.description?(L(),R(`p`,OR,O(e.$props.description),1)):U(``,!0)]),e.$slots.action?(L(),R(`div`,kR,[F(e.$slots,`action`)])):U(``,!0)],2))}});function jR(e){return e===null||!Number.isFinite(e)?`—`:`${(e*100).toFixed(e>=.999?0:1)}%`}var MR={span:(e,t,n)=>n===null?`${e}${t}`:`${e}${t} ${n.value}${n.unit}`,now:()=>`now`,ahead:(e,t)=>`in ${e}${t}`,ago:(e,t)=>`${e}${t} ago`,never:()=>`never`};function NR(e,t=MR){if(!Number.isFinite(e)||e<0)return`—`;let n=Math.floor(e/1e3);if(n<60)return t.span(n,`s`,null);let r=Math.floor(n/60);if(r<60)return t.span(r,`m`,{value:n%60,unit:`s`});let i=Math.floor(r/60);return i<24?t.span(i,`h`,{value:r%60,unit:`m`}):t.span(Math.floor(i/24),`d`,{value:i%24,unit:`h`})}function PR(e,t,n=MR){let r=Math.max(0,e-t);return r<1e3?n.now():r<6e4?n.ahead(Math.ceil(r/1e3),`s`):n.ahead(Math.ceil(r/6e4),`m`)}function FR(e,t,n=MR){if(e===null)return n.never();let r=Math.max(0,t-e);return r<6e4?n.ago(Math.floor(r/1e3),`s`):r<36e5?n.ago(Math.floor(r/6e4),`m`):r<864e5?n.ago(Math.floor(r/36e5),`h`):n.ago(Math.floor(r/864e5),`d`)}var IR=1e3;function LR(e){return Math.round(e/IR)}function RR(e){return Math.round(e)*IR}function zR(e,t){return e==null||!Number.isFinite(e)?t:RR(e)}function BR(){return dF(FF())?.iso}var VR=new Map,HR=new Map,UR={s:`s`,m:`m`,h:`h`,d:`d`};function WR(){return FF()===`en`}function GR(){let e=BR(),t=WR()?`narrow`:`short`,n=`${e??``}:${t}`,r=VR.get(n);return r===void 0&&(r=new Intl.RelativeTimeFormat(e,{numeric:`always`,style:t}),VR.set(n,r)),r}function KR(e,t){if(WR())return`${e}${UR[t]}`;let n={s:`second`,m:`minute`,h:`hour`,d:`day`},r=BR(),i=`${r??``}:${t}`,a=HR.get(i);return a===void 0&&(a=new Intl.NumberFormat(r,{style:`unit`,unit:n[t],unitDisplay:`short`}),HR.set(i,a)),a.format(e)}function qR(e,t,n){return GR().format(n*e,{s:`second`,m:`minute`,h:`hour`,d:`day`}[t])}var JR={span:(e,t,n)=>n===null?KR(e,t):`${KR(e,t)} ${KR(n.value,n.unit)}`,now:()=>Y(`common.now`),ahead:(e,t)=>qR(e,t,1),ago:(e,t)=>qR(e,t,-1),never:()=>Y(`common.never`)};function YR(e){return NR(e,JR)}function XR(e,t){return PR(e,t,JR)}function ZR(e,t){return FR(e,t,JR)}function QR(e){let t=new Date(e);return`${t.toLocaleTimeString(BR(),{hour12:!1})}.${String(t.getMilliseconds()).padStart(3,`0`)}`}function $R(e){return new Date(e).toLocaleString(BR(),{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function ez(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(0)} KiB`:e<1073741824?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(2)} GiB`:`—`}function tz(e){if(e===null||!Number.isFinite(e))return`—`;let t=Math.abs(e);return t<1e3?`${e} B`:t<1e6?`${(e/1e3).toFixed(0)} kB`:t<1e9?`${(e/1e3/1e3).toFixed(1)} MB`:`${(e/1e3/1e3/1e3).toFixed(2)} GB`}function nz(e){return e===null||!Number.isFinite(e)?`—`:e>=100?`${Math.round(e)}%`:`${e.toFixed(1)}%`}function rz(e){return e===void 0?Y(`common.unset`):typeof e==`string`?e:JSON.stringify(e)}var iz={key:1,class:`space-y-4`},az={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},oz={class:`grid grid-cols-2 gap-x-4 gap-y-2 border-t border-line-soft pt-3 sm:grid-cols-4`},sz={class:`flex items-center gap-1 text-2xs text-faint`},cz={class:`font-mono text-xs text-ink`},lz=[`title`],uz={class:`font-mono text-xs tabular-nums text-ink`},dz={class:`font-mono text-2xs tabular-nums text-faint`},fz={class:`flex items-center gap-1 text-2xs text-faint`},pz={class:`font-mono text-xs text-ink`},mz={class:`flex items-center gap-1 text-2xs text-faint`},hz={class:`font-mono text-xs text-ink`},gz={class:`space-y-2 border-t border-line-soft pt-3`},_z={class:`flex items-center gap-1.5 text-2xs font-medium text-faint`},vz={class:`flex items-baseline justify-between gap-2`},yz=[`title`],bz={class:`shrink-0 font-mono text-2xs tabular-nums text-faint`},xz={key:0,class:`space-y-1 rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2`},Sz={class:`text-2xs font-medium text-danger`},Cz=N({__name:`HostVitalsPanel`,props:{host:{},now:{}},setup(e){let t=e,n=W(()=>NA(t.host)),r=W(()=>{let{load1m:e,load5m:t,load15m:r}=n.value;return e===null||t===null||r===null?`—`:[e,t,r].map(e=>e.toFixed(2)).join(` `)}),i=W(()=>n.value.cpuUsedPercent),a=W(()=>OA(i.value)??`ok`);function o(e){return e??`neutral`}let s=W(()=>jA(n.value.tempCelsius,t.host?.tempCelsiusAlert)),c=W(()=>o(n.value.memoryBand)),l=W(()=>o(n.value.swapBand)),u=W(()=>o(n.value.tempBand));return(e,o)=>!t.host||!t.host.enabled?(L(),z(AR,{key:0,compact:``,title:A(Y)(`host.samplingOff`),description:A(Y)(`host.samplingOffDescription`)},null,8,[`title`,`description`])):(L(),R(`div`,iz,[B(`div`,az,[V(CR,{value:i.value,label:A(Y)(`host.cpuUsage`),size:72,tone:a.value},null,8,[`value`,`label`,`tone`]),V(CR,{value:n.value.memoryUsedPercent,label:A(Y)(`common.memory`),size:72,tone:c.value},null,8,[`value`,`label`,`tone`]),V(CR,{value:n.value.swapUsedPercent,label:A(Y)(`host.swap`),size:72,tone:l.value},null,8,[`value`,`label`,`tone`]),V(CR,{value:s.value,label:A(Y)(`host.cpuTemp`),display:n.value.tempCelsius===null?A(Y)(`common.notAvailable`):`${Math.round(n.value.tempCelsius)}°C`,size:72,tone:u.value},null,8,[`value`,`label`,`display`,`tone`])]),B(`dl`,oz,[B(`div`,null,[B(`dt`,sz,[V(A(dy),{class:`size-3`}),H(O(A(Y)(`host.cpus`)),1)]),B(`dd`,cz,O(t.host.cpus),1)]),B(`div`,null,[B(`dt`,{class:`text-2xs text-faint`,title:A(Y)(`host.loadHint`)},O(A(Y)(`host.loadAverage`)),9,lz),B(`dd`,uz,O(r.value),1),B(`dd`,dz,O(n.value.loadPerCpu===null?`—`:`${n.value.loadPerCpu.toFixed(2)} ${A(Y)(`host.perCpu`)}`),1)]),B(`div`,null,[B(`dt`,fz,[V(A(Dy),{class:`size-3`}),H(O(A(Y)(`host.memoryUsed`)),1)]),B(`dd`,pz,O(n.value.memoryUsedPercent===null?`—`:`${n.value.memoryUsedPercent.toFixed(0)}%`),1)]),B(`div`,null,[B(`dt`,mz,[V(A(Zy),{class:`size-3`}),H(O(A(Y)(`host.sampled`)),1)]),B(`dd`,hz,O(A(ZR)(t.host.sampledAt,t.now)),1)])]),B(`div`,gz,[B(`p`,_z,[V(A(yy),{class:`size-3`}),H(O(A(Y)(`host.filesystems`)),1)]),(L(!0),R(I,null,P(n.value.disks,e=>(L(),R(`div`,{key:e.path,class:`space-y-1`},[B(`div`,vz,[B(`span`,{class:`truncate font-mono text-2xs text-muted`,title:e.path},O(e.path),9,yz),B(`span`,bz,O(A(ez)(e.totalBytes-e.freeBytes))+` / `+O(A(ez)(e.totalBytes))+` · `+O(e.usedPercent.toFixed(0))+`% `,1)]),V(wR,{value:e.usedPercent,tone:e.band??`neutral`},null,8,[`value`,`tone`])]))),128))]),t.host.alerts.length>0?(L(),R(`div`,xz,[B(`p`,Sz,O(A(Y)(`host.thresholdsBreached`)),1),(L(!0),R(I,null,P(t.host.alerts,e=>(L(),R(`p`,{key:e,class:`text-2xs text-danger`},O(e),1))),128))])):U(``,!0)]))}}),wz={key:1,class:`flex flex-col`},Tz={class:`min-w-0 flex-1`},Ez={class:`flex items-baseline gap-1.5`},Dz={class:`truncate text-xs font-medium text-ink`},Oz={key:0,class:`text-faint`},kz=[`title`],Az={key:0,class:`text-muted`},jz={class:`shrink-0 pt-0.5 text-2xs text-faint`},Mz=N({__name:`ActivityFeed`,props:{servers:{},now:{},limit:{default:12},serverId:{default:void 0},qualify:{type:Boolean,default:!1}},setup(e){let t=e,n={start:Py,exit:Jy,crash:iy,"forced-restart":zy,unhealthy:eb,recovered:ay},r=jI();function i(e){return r.workspaces.value.find(t=>t.id===e)?.label??e}let a=W(()=>{let e=[];for(let n of t.servers){if(t.serverId!==void 0&&n.id!==t.serverId)continue;let r=n.workspaceId??``;for(let t of n.history.events)e.push({...t,label:n.config.label??n.id,workspaceId:r,workspaceLabel:i(r)})}return e.sort((e,t)=>t.ts-e.ts).slice(0,t.limit)});return(e,r)=>{let i=ha(`RouterLink`);return a.value.length===0?(L(),z(AR,{key:0,compact:``,title:A(Y)(`activity.emptyTitle`),description:A(Y)(`activity.emptyDescription`)},null,8,[`title`,`description`])):(L(),R(`ol`,wz,[(L(!0),R(I,null,P(a.value,(e,r)=>(L(),R(`li`,{key:`${e.serverId}-${e.ts}-${r}`,class:D([`flex items-start gap-2.5 border-line-soft py-2`,r>0&&`border-t`])},[(L(),z(_a(n[e.type]),{class:D(A(Q)(`mt-0.5 size-3.5 shrink-0`,A(cR)[A(pR)[e.type]]))},null,8,[`class`])),B(`div`,Tz,[B(`p`,Ez,[B(`span`,Dz,O(A(Y)(A(fR)[e.type])),1),V(i,{to:A(J2)(e.workspaceId,`servers`,e.serverId),class:`truncate text-2xs text-muted hover:text-accent`,title:t.qualify?`${e.workspaceLabel}/${e.label}`:e.label},{default:j(()=>[t.qualify?(L(),R(`span`,Oz,O(e.workspaceLabel)+`/`,1)):U(``,!0),H(O(e.label),1)]),_:2},1032,[`to`,`title`])]),B(`p`,{class:`mt-0.5 truncate font-mono text-2xs text-faint`,title:e.detail},[H(O(e.detail)+` `,1),e.runtimeMs===void 0?U(``,!0):(L(),R(`span`,Az,` · `+O(A(Y)(`activity.ran`,{duration:A(YR)(e.runtimeMs)})),1))],8,kz)]),B(`span`,jz,O(A(ZR)(e.ts,t.now)),1)],2))),128))]))}}}),Nz=[`restart`,`health`,`stop`];function Pz(e,t){return JSON.stringify(Fz(e))===JSON.stringify(Fz(t))}function Fz(e){if(Array.isArray(e))return e.map(Fz);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort()){let r=e[n];r!=null&&(t[n]=Fz(r))}return t}return e??null}function Iz(e,t,n=[]){let r={};for(let[i,a]of Object.entries(t))if(n.includes(i)){let t=e[i]??{},n={};for(let[e,r]of Object.entries(a??{}))Pz(t[e],r)||(n[e]=r);Object.keys(n).length>0&&(r[i]=n)}else Pz(e[i],a)||(r[i]=a);return r}function Lz({filled:e,draft:t,live:n,key:r}){if(e===void 0)return[];let i=new Map(n.map(e=>[r(e),e])),a=new Map(t.map(e=>[r(e),e])),o=[];for(let t of e){let e=r(t),n=a.get(e),s=i.get(e);n!==void 0&&s!==void 0&&!Pz(t,n)&&!Pz(t,s)&&o.push(e)}return o}function Rz({filled:e,draft:t,live:n,key:r}){if(e===void 0||Pz(e,t))return null;let i=new Set(e.map(r)),a=n.filter(e=>!i.has(r(e))&&!t.some(t=>r(t)===r(e)));return[...t,...a]}function zz(e,t){let n=e;return Iz({...n,label:n.label??``},t,Nz)}function Bz(e,t=``){return typeof e!=`object`||!e||Array.isArray(e)?[{path:t,value:e}]:Object.entries(e).flatMap(([e,n])=>Bz(n,t.length===0?e:`${t}.${e}`))}function Vz(e,t){let n=new Map(Bz(t).map(e=>[e.path,e.value]));return Bz(e).map(e=>({path:e.path,from:n.get(e.path),to:e.value}))}function Hz(e){let t=0;for(let n of Object.values(e))t+=typeof n==`object`&&n&&!Array.isArray(n)?Hz(n):1;return t}function Uz(e){return e.selected&&(e.leaves.length===0||e.leaves.some(e=>e.selected))}function Wz(e){return e.selected&&(e.leaves.length===0||e.leaves.every(e=>e.selected))}function Gz(e){return e.flatMap(e=>Wz(e)?[e.id]:Uz(e)?e.leaves.filter(e=>e.selected).map(e=>e.id):[])}function Kz(e){return e.flatMap(e=>Uz(e)?Wz(e)?[]:e.leaves.filter(e=>!e.selected).map(e=>e.id):[e.id])}function qz(e,t){return e.length===0||Gz(e).length===0?{kind:`nothing`}:Kz(e).length===0?{kind:`everything`}:{kind:`scope`,scope:{mode:t,ids:t===`only`?Gz(e):Kz(e)}}}function Jz(e,t){return e==null||t==null?(e??null)===(t??null):e.mode===t.mode&&[...e.ids].sort().join(`
40
40
  `)===[...t.ids].sort().join(`
41
- `)}async function Nz(e,t=8e3){let n=Date.now()+t;for(;;){try{if((await fetch(`${e}/api/auth/session`,{cache:`no-store`})).ok)return!0}catch{}if(Date.now()>n)return!1;await new Promise(e=>setTimeout(e,250))}}var Pz=36e5,Fz={enabled:!0,maxRetries:3,baseDelayMs:1e3,factor:2,maxDelayMs:3e4,resetAfterMs:6e4},Iz={enabled:!0,mode:`port`,http:{scheme:`http`,allowInvalidCert:!1,path:`/`,method:`GET`,expectStatusBelow:400,expectBody:``},intervalMs:5e3,timeoutMs:1500,unhealthyThreshold:3,forceRestartAfterMs:0,startTimeoutMs:2e4},Lz={signal:`SIGTERM`,killGroup:!0,graceMs:5e3,killPortHolders:!1};function Rz(e){return{...e,http:{...e.http}}}function zz(){return{control:{label:`home-hosted`,port:3999,host:`local`,openBrowser:!1,tlsEnabled:!1},auth:{enabled:!1,sessionTtlMs:6048e5,cookieSecure:`auto`,trustProxy:`off`,maxLoginAttempts:5,lockoutMs:6e4},host:{enabled:!0,intervalMs:15e3,diskPaths:`.`,diskUsedPercent:90,memoryUsedPercent:90,swapUsedPercent:50,loadPerCpu:2,tempCelsius:85,tempCommand:``,tempCommandTimeoutMs:5e3},backups:{enabled:!0,keep:5,includePaths:``,scheduleEnabled:!1,scheduleHours:24,scheduleKeep:7,scheduleScope:null}}}function Bz(){return{defaults:{enabled:!0,autostart:!1,bind:`local`,onPortConflict:`block`,logBufferLines:500,restart:{...Fz},health:Rz(Iz),stop:{...Lz}},logs:{persist:!0,maxBytes:2e6,keep:3},policy:{onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0,cooldownMs:12e4},destinations:[]}}function Vz(e){return e===`loopback`?`loopback`:e===`any`||e===!0}function Hz(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:Vz(e.trustProxy),maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function Uz(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:e.trustProxy===`loopback`?`loopback`:e.trustProxy?`any`:`off`,maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function Wz(e){return{label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,tlsEnabled:e.tls.enabled}}function Gz(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function Kz(e){return{enabled:e.enabled,intervalMs:e.intervalMs,diskPaths:e.diskPaths.join(`, `),diskUsedPercent:e.diskUsedPercent,memoryUsedPercent:e.memoryUsedPercent,swapUsedPercent:e.swapUsedPercent,loadPerCpu:e.loadPerCpu,tempCelsius:e.tempCelsius,tempCommand:e.tempCommand??``,tempCommandTimeoutMs:e.tempCommandTimeoutMs??5e3}}var qz={intervalMs:0,keep:7};function Jz(e){let t=e.schedule??qz;return{enabled:e.enabled,keep:e.keep,includePaths:e.includePaths.join(`, `),scheduleEnabled:t.intervalMs>0,scheduleHours:Math.max(1,Math.round(t.intervalMs/Pz)||1),scheduleKeep:t.keep,scheduleScope:t.scope??null}}function Yz(e,t){let n=Kz(e);return bz({...n,diskPaths:Gz(n.diskPaths)},{...t,diskPaths:Gz(t.diskPaths)})}function Xz(e,t){let n=Jz(e),r={};return(t.scheduleEnabled!==n.scheduleEnabled||t.scheduleHours!==n.scheduleHours)&&(r.intervalMs=t.scheduleEnabled?t.scheduleHours*Pz:0),t.scheduleKeep!==n.scheduleKeep&&(r.keep=t.scheduleKeep),Mz(t.scheduleScope,n.scheduleScope)||(r.scope=t.scheduleScope),bz({enabled:e.enabled,keep:e.keep,includePaths:e.includePaths,schedule:e.schedule??qz},{enabled:t.enabled,keep:t.keep,includePaths:Gz(t.includePaths),schedule:r},[`schedule`])}function Zz(e,t){return bz({label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,auth:Hz(e.auth),tls:{enabled:e.tls.enabled}},{label:t.control.label,port:t.control.port,host:t.control.host,openBrowser:t.control.openBrowser,auth:{...t.auth,trustProxy:Vz(t.auth.trustProxy)},tls:{enabled:t.control.tlsEnabled}},[`auth`,`tls`])}function Qz(e,t){return bz(e,t,[`restart`,`health`,`stop`])}function $z(e,t){return bz(e,t)}function eB(e){return{onCrash:e.onCrash,onUnhealthy:e.onUnhealthy,onForcedRestart:e.onForcedRestart,onRecovered:e.onRecovered,onHost:e.onHost,onDdns:e.onDdns??!0,cooldownMs:e.cooldownMs}}function tB(e){return{id:e.id,kind:e.kind,enabled:e.enabled,useOwnSettings:e.useOwnSettings,chatId:e.chatId??``,tokenSet:e.tokenSet,url:e.url??``,method:e.method??`POST`,format:e.format??`json`,headers:e.headers??``,policy:eB(e)}}function nB(e,t){let n=bz({defaults:eB(e)},{defaults:{...t}},[`defaults`]);return Object.keys(n).length===0?null:n}function rB(e){return{kind:e.kind,id:e.id,enabled:e.enabled,useOwnSettings:e.useOwnSettings,...e.kind===`telegram`?{chatId:e.chatId}:{url:e.url,method:e.method,format:e.format,headers:e.headers},...e.useOwnSettings?e.policy:{}}}function iB(e,t,n){let r=Sz({filled:n,draft:t,live:e.map(tB),key:e=>e.id});return r===null?null:{destinations:r.map(rB)}}function aB(e,t,n){return xz({filled:n,draft:t,live:e.map(tB),key:e=>e.id})}function oB(e,t){switch(t){case`control`:return{...e.control,auth:{...e.auth}};case`host`:return{...e.host};case`backups`:return{...e.backups}}}function sB(e,t){return t===`auth`?{...e.auth}:t===`tls`?e.control.tlsEnabled:{label:e.control.label,port:e.control.port,host:e.control.host,openBrowser:e.control.openBrowser}}function cB(e,t,n){return t!==void 0&&fB(t[n],sB(e,n))}function lB(e,t,n){t.control={...t.control??{},[n]:sB(e,n)}}function uB(e,t){switch(t){case`defaults`:return{...e.defaults,restart:{...e.defaults.restart},health:Rz(e.defaults.health),stop:{...e.defaults.stop}};case`logs`:return{...e.logs};case`notifications`:return{policy:{...e.policy},destinations:e.destinations.map(e=>({...e,policy:{...e.policy}}))}}}function dB(e){if(typeof e!=`object`||!e)return;let t=e.destinations;return Array.isArray(t)?t:void 0}function fB(e,t){return e!==void 0&&JSON.stringify(e)!==JSON.stringify(t)}function pB(e,t){return e.label!==t.control.label||e.port!==t.control.port||e.host!==t.control.host||e.openBrowser!==t.control.openBrowser}function mB(e,t){return e.tls.enabled!==t.control.tlsEnabled}function hB(e,t){return Ez(bz({...Uz(e.auth)},{...t.auth}))>0}function gB(e,t,n){return W({get:()=>SR(e()),set:e=>{t(e===null||Number.isNaN(e)?n:CR(e))}})}function _B(e,t,n){return W({get:e,set:e=>{t(e===null||Number.isNaN(e)?n:e)}})}async function vB(e){if(!e.rebinding)return null;let t=e.targetUrl??e.control.url;return t.length===0||t===window.location.origin?null:await Nz(t)?(window.location.replace(t),null):Y(`settings.rebind.failed`,{target:t})}function yB(e){return e.split(`
42
- `).map(e=>e.trim()).filter(e=>e.length>0)}function bB(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
43
- `)}function xB(e){let t={};for(let n of yB(e)){let e=n.indexOf(`=`);e<=0||(t[n.slice(0,e).trim()]=n.slice(e+1).trim())}return t}function SB(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}var CB=/^[a-z0-9][a-z0-9_-]*$/;function wB(e){return{id:``,label:``,command:``,args:``,cwd:``,port:null,bind:e?.bind??`local`,autostart:e?.autostart??!1,persistent:!1,enabled:e?.enabled??!0,onPortConflict:e?.onPortConflict??`block`,logBufferLines:null,dependsOn:``,envFile:``,env:``,dataEnvs:``,backupPaths:``,backupIgnoreGenerated:!0,maxRssMb:null,restart:{...e?.restart??Fz},health:Rz(e?.health??Iz),stop:{...e?.stop??Lz},bootstrapEnabled:!1,bootstrapCommand:``,bootstrapArgs:``,bootstrapEnv:``,bootstrapTimeoutMs:12e4,bootstrapRunOnce:!0}}var TB={port:`validation.port`,idRequired:`validation.idRequired`,idPattern:`validation.idPattern`,commandRequired:`validation.commandRequired`,bootstrapCommand:`validation.bootstrapCommand`};function EB(e){return e!==null&&Number.isFinite(e)?e:0}function DB(e){return{args:[],cwd:`.`,env:{},dataEnvs:{},dependsOn:[],envFile:``,backupPaths:[],backupIgnoreGenerated:!0,resources:{maxRssBytes:0},bind:e?.bind??`local`,enabled:e?.enabled??!0,autostart:e?.autostart??!1,persistent:!1,onPortConflict:e?.onPortConflict??`block`,logBufferLines:e?.logBufferLines??500}}function OB(e){return e===null||Number.isNaN(e)||Number.isInteger(e)&&e>=1&&e<=65535?null:TB.port}function kB(e,t){let n=EB(e.maxRssMb),r=EB(e.bootstrapTimeoutMs),i=DB(t),a=bz({restart:t?.restart??Fz,health:t?.health??Iz,stop:t?.stop??Lz},{restart:e.restart,health:e.health,stop:e.stop});return{...bz(i,{args:yB(e.args),cwd:e.cwd.trim().length>0?e.cwd.trim():`.`,env:xB(e.env),dataEnvs:xB(e.dataEnvs),dependsOn:SB(e.dependsOn),envFile:e.envFile.trim(),backupPaths:yB(e.backupPaths),backupIgnoreGenerated:e.backupIgnoreGenerated,resources:{maxRssBytes:n>0?Math.round(n*1024*1024):0},bind:e.bind,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent,onPortConflict:e.onPortConflict,logBufferLines:EB(e.logBufferLines)>0?EB(e.logBufferLines):i.logBufferLines}),...a,id:e.id.trim(),...e.label.trim().length===0?{}:{label:e.label.trim()},command:e.command.trim(),...e.port===null||Number.isNaN(e.port)?{}:{port:e.port},...e.bootstrapEnabled?{bootstrap:{command:e.bootstrapCommand.trim(),args:yB(e.bootstrapArgs),env:xB(e.bootstrapEnv),timeoutMs:r>=1e3?r:12e4,runOnce:e.bootstrapRunOnce}}:{}}}function AB(e){if(e.id.trim().length===0)return{key:TB.idRequired,field:`id`};if(!CB.test(e.id.trim()))return{key:TB.idPattern,field:`id`};if(e.command.trim().length===0)return{key:TB.commandRequired,field:`command`};if(e.bootstrapEnabled&&e.bootstrapCommand.trim().length===0)return{key:TB.bootstrapCommand,field:`bootstrapCommand`};let t=OB(e.port);return t===null?null:{key:t,field:`port`}}var jB={class:`mb-3 flex items-start justify-between gap-3`},MB={class:`min-w-0`},NB={class:`text-xs font-semibold text-ink`},PB={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},FB={class:`flex shrink-0 items-center gap-2`},IB=N({__name:`FieldGroup`,props:{title:{},description:{default:void 0},columns:{default:2},dense:{type:Boolean,default:!1},class:{default:void 0}},setup(e){let t=e,n=W(()=>({1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`})[t.columns]);return(e,r)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel-2/40`,t.dense?`p-3`:`p-3.5`,t.class))},[B(`header`,jB,[B(`div`,MB,[B(`h3`,NB,O(t.title),1),t.description?(L(),R(`p`,PB,O(t.description),1)):U(``,!0)]),B(`div`,FB,[F(e.$slots,`actions`)])]),B(`div`,{class:D(A(Q)(`grid gap-3`,n.value))},[F(e.$slots,`default`)],2)],2))}});function LB(e){return e==null||Number.isNaN(e)?``:String(e)}function RB(e,t){let n=String(e??``).trim();if(n.length===0)return t?null:NaN;let r=Number(n);return Number.isNaN(r)?NaN:r}var zB=`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 focus-visible:ring-offset-2 focus-visible:ring-offset-page`,BB=`text-xs font-medium text-muted`,VB=`text-2xs leading-4 text-faint`,HB=[`w-full min-w-0 rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-sm text-ink`,`placeholder:text-faint transition-colors duration-150`,`hover:border-line/80 hover:bg-page`,`focus:border-accent focus:bg-page focus:outline-none focus:ring-2 focus:ring-accent/25`,`disabled:cursor-not-allowed disabled:opacity-50`,`aria-[invalid=true]:border-danger aria-[invalid=true]:focus:ring-danger/25`].join(` `),UB=`${HB} font-mono text-xs`,WB=[`for`],GB=[`id`,`step`,`min`,`max`,`aria-invalid`],KB={key:1,class:`text-2xs text-danger`},qB=N({inheritAttrs:!1,__name:`NumberField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1},nullable:{type:Boolean,default:!1},step:{default:void 0},min:{default:void 0},max:{default:void 0}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi(),i=W({get:()=>LB(n.value),set:e=>{n.value=RB(e,t.nullable)}}),a=W(()=>n.value!==null&&Number.isNaN(n.value));return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(BB))},O(t.label),11,WB)):U(``,!0),wr(B(`input`,Ps({id:A(r),"onUpdate:modelValue":n[0]||=e=>i.value=e,type:`number`,inputmode:`numeric`,step:t.step,min:t.min,max:t.max,class:A(Q)(A(HB),`font-mono tabular-nums`,(t.error||a.value)&&`border-danger`),"aria-invalid":t.error||a.value?!0:void 0},e.$attrs),null,16,GB),[[nu,i.value]]),t.error?(L(),R(`p`,KB,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(VB))},O(t.hint),3)):U(``,!0)],2))}}),JB=[`for`],YB={class:`relative`},XB=[`id`],ZB=[`value`,`disabled`],QB={key:1,class:`text-2xs text-danger`},$B=N({inheritAttrs:!1,__name:`SelectField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},options:{},wide:{type:Boolean,default:!1},mono:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi();return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(BB))},O(t.label),11,JB)):U(``,!0),B(`div`,YB,[wr(B(`select`,Ps({id:A(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,class:A(Q)(A(HB),`cursor-pointer appearance-none pr-7`,t.mono&&`font-mono text-xs`,t.error&&`border-danger`)},e.$attrs),[(L(!0),R(I,null,P(t.options,e=>(L(),R(`option`,{key:e.value,value:e.value,disabled:e.disabled},O(e.label),9,ZB))),128))],16,XB),[[ou,n.value]]),V(A($v),{class:`pointer-events-none absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`,"aria-hidden":`true`})]),t.error?(L(),R(`p`,QB,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(VB))},O(t.hint),3)):U(``,!0)],2))}}),eV=[`for`],tV=[`id`,`aria-invalid`,`aria-describedby`],nV=[`id`],rV=[`id`],iV=N({inheritAttrs:!1,__name:`TextField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi(),i=W(()=>t.hint||t.error?`${r}-hint`:void 0);return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(BB))},O(t.label),11,eV)):U(``,!0),wr(B(`input`,Ps({id:A(r),"onUpdate:modelValue":a[0]||=e=>n.value=e,class:A(Q)(A(HB),t.error&&`border-danger`),"aria-invalid":t.error?!0:void 0,"aria-describedby":i.value},e.$attrs),null,16,tV),[[du,n.value]]),t.error?(L(),R(`p`,{key:1,id:`${A(r)}-hint`,class:`text-2xs text-danger`},O(t.error),9,nV)):t.hint?(L(),R(`p`,{key:2,id:`${A(r)}-hint`,class:D(A(VB))},O(t.hint),11,rV)):U(``,!0)],2))}}),aV=[`id`],oV={key:0,class:`block text-2xs text-faint`},sV=N({__name:`ToggleSwitch`,props:Va({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1},trailing:{type:Boolean,default:!1},wide:{type:Boolean,default:!1},srOnly:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=fi(),r=lo(e,`modelValue`);return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex items-center gap-2.5`,t.trailing&&`flex-row-reverse justify-end`,t.wide&&`sm:col-span-2`))},[V(A(xg),{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,disabled:t.disabled,"aria-labelledby":A(n),class:D(A(Q)(`relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-150`,`data-[state=checked]:border-accent data-[state=checked]:bg-accent`,`data-[state=unchecked]:border-line data-[state=unchecked]:bg-line-soft`,`disabled:cursor-not-allowed disabled:opacity-45`,A(zB)))},{default:j(()=>[V(A(Sg),{class:`block size-3 translate-x-[3px] rounded-full bg-white shadow-sm transition-transform duration-150 ease-out data-[state=checked]:translate-x-[16px]`})]),_:1},8,[`modelValue`,`disabled`,`aria-labelledby`,`class`]),B(`label`,{class:`min-w-0 cursor-pointer select-none`,onClick:i[1]||=e=>!t.disabled&&(r.value=!r.value)},[B(`span`,{id:A(n),class:D(A(Q)(`block text-xs text-ink`,t.srOnly&&`sr-only`))},O(t.label),11,aV),t.hint?(L(),R(`span`,oV,O(t.hint),1)):U(``,!0)])],2))}}),cV=N({__name:`LifecycleFields`,props:Va({showHttp:{type:Boolean,default:!0}},{restart:{required:!0},restartModifiers:{},health:{required:!0},healthModifiers:{},stop:{required:!0},stopModifiers:{}}),emits:[`update:restart`,`update:health`,`update:stop`],setup(e){let t=lo(e,`restart`),n=lo(e,`health`),r=lo(e,`stop`);function i(e,t,n=0){return W({get:e,set:e=>t(e===null||Number.isNaN(e)?n:e)})}let a=i(()=>t.value.maxRetries,e=>t.value.maxRetries=e),o=i(()=>t.value.baseDelayMs,e=>t.value.baseDelayMs=e),s=i(()=>t.value.factor,e=>t.value.factor=e,1),c=i(()=>t.value.maxDelayMs,e=>t.value.maxDelayMs=e),l=i(()=>t.value.resetAfterMs,e=>t.value.resetAfterMs=e),u=i(()=>n.value.intervalMs,e=>n.value.intervalMs=e,500),d=i(()=>n.value.timeoutMs,e=>n.value.timeoutMs=e,100),f=i(()=>n.value.unhealthyThreshold,e=>n.value.unhealthyThreshold=e,1),p=i(()=>n.value.forceRestartAfterMs,e=>n.value.forceRestartAfterMs=e),m=i(()=>n.value.startTimeoutMs,e=>n.value.startTimeoutMs=e),h=W({get:()=>n.value.http.expectStatus??null,set:e=>{e===null||Number.isNaN(e)?delete n.value.http.expectStatus:n.value.http.expectStatus=e}}),g=i(()=>n.value.http.expectStatusBelow,e=>n.value.http.expectStatusBelow=e,400),_=i(()=>r.value.graceMs,e=>r.value.graceMs=e),v=W(()=>[{value:`SIGTERM`,label:Y(`lifecycle.signalTerm`)},{value:`SIGINT`,label:Y(`lifecycle.signalInt`)},{value:`SIGKILL`,label:Y(`lifecycle.signalKill`)}]);return(i,y)=>(L(),R(I,null,[V(IB,{title:A(Y)(`lifecycle.restartTitle`),description:A(Y)(`lifecycle.restartDescription`),columns:3},{default:j(()=>[V(sV,{modelValue:t.value.enabled,"onUpdate:modelValue":y[0]||=e=>t.value.enabled=e,label:A(Y)(`lifecycle.restartOnCrash`),wide:``},null,8,[`modelValue`,`label`]),V(qB,{modelValue:A(a),"onUpdate:modelValue":y[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`lifecycle.maxRetries`),min:0,hint:A(Y)(`lifecycle.maxRetriesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(o),"onUpdate:modelValue":y[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`lifecycle.baseDelay`),min:0},null,8,[`modelValue`,`label`]),V(qB,{modelValue:A(s),"onUpdate:modelValue":y[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`lifecycle.factor`),min:1,step:.1},null,8,[`modelValue`,`label`]),V(qB,{modelValue:A(c),"onUpdate:modelValue":y[4]||=e=>hn(c)?c.value=e:null,label:A(Y)(`lifecycle.maxDelay`),min:0},null,8,[`modelValue`,`label`]),V(qB,{modelValue:A(l),"onUpdate:modelValue":y[5]||=e=>hn(l)?l.value=e:null,label:A(Y)(`lifecycle.resetAfter`),min:0,hint:A(Y)(`lifecycle.resetAfterHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`lifecycle.healthTitle`),description:A(Y)(`lifecycle.healthDescription`),columns:3},{default:j(()=>[V(sV,{modelValue:n.value.enabled,"onUpdate:modelValue":y[6]||=e=>n.value.enabled=e,label:A(Y)(`lifecycle.probe`),wide:``},null,8,[`modelValue`,`label`]),V($B,{modelValue:n.value.mode,"onUpdate:modelValue":y[7]||=e=>n.value.mode=e,label:A(Y)(`lifecycle.probeType`),options:[{value:`port`,label:A(Y)(`lifecycle.probePort`)},{value:`http`,label:A(Y)(`lifecycle.probeHttp`)}]},null,8,[`modelValue`,`label`,`options`]),V(qB,{modelValue:A(u),"onUpdate:modelValue":y[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`lifecycle.interval`),min:500,step:100},null,8,[`modelValue`,`label`]),V(qB,{modelValue:A(d),"onUpdate:modelValue":y[9]||=e=>hn(d)?d.value=e:null,label:A(Y)(`lifecycle.timeout`),min:100,step:100},null,8,[`modelValue`,`label`]),V(qB,{modelValue:A(f),"onUpdate:modelValue":y[10]||=e=>hn(f)?f.value=e:null,label:A(Y)(`lifecycle.unhealthyAfter`),min:1,hint:A(Y)(`lifecycle.unhealthyAfterHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(p),"onUpdate:modelValue":y[11]||=e=>hn(p)?p.value=e:null,label:A(Y)(`lifecycle.forceRestartAfter`),min:0,hint:A(Y)(`lifecycle.forceRestartAfterHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(m),"onUpdate:modelValue":y[12]||=e=>hn(m)?m.value=e:null,label:A(Y)(`lifecycle.startTimeout`),min:0},null,8,[`modelValue`,`label`]),e.showHttp&&n.value.mode===`http`?(L(),R(I,{key:0},[V($B,{modelValue:n.value.http.scheme,"onUpdate:modelValue":y[13]||=e=>n.value.http.scheme=e,label:A(Y)(`lifecycle.httpScheme`),options:[{value:`http`,label:`http`},{value:`https`,label:`https`}]},null,8,[`modelValue`,`label`]),V(iV,{modelValue:n.value.http.path,"onUpdate:modelValue":y[14]||=e=>n.value.http.path=e,label:A(Y)(`lifecycle.httpPath`),placeholder:`/healthz`},null,8,[`modelValue`,`label`]),V($B,{modelValue:n.value.http.method,"onUpdate:modelValue":y[15]||=e=>n.value.http.method=e,label:A(Y)(`lifecycle.httpMethod`),options:[{value:`GET`,label:`GET`},{value:`HEAD`,label:`HEAD`}]},null,8,[`modelValue`,`label`]),V(qB,{modelValue:h.value,"onUpdate:modelValue":y[16]||=e=>h.value=e,label:A(Y)(`lifecycle.expectStatus`),nullable:``,hint:A(Y)(`lifecycle.expectStatusHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(g),"onUpdate:modelValue":y[17]||=e=>hn(g)?g.value=e:null,label:A(Y)(`lifecycle.expectStatusBelow`),min:100},null,8,[`modelValue`,`label`]),n.value.http.scheme===`https`?(L(),z(sV,{key:0,modelValue:n.value.http.allowInvalidCert,"onUpdate:modelValue":y[18]||=e=>n.value.http.allowInvalidCert=e,label:A(Y)(`lifecycle.allowInvalidCert`),hint:A(Y)(`lifecycle.allowInvalidCertHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])):U(``,!0),V(iV,{modelValue:n.value.http.expectBody,"onUpdate:modelValue":y[19]||=e=>n.value.http.expectBody=e,label:A(Y)(`lifecycle.expectBody`),placeholder:A(Y)(`lifecycle.expectBodyPlaceholder`),wide:``,hint:n.value.http.method===`HEAD`&&n.value.http.expectBody.length>0?A(Y)(`lifecycle.headBodyHint`):void 0},null,8,[`modelValue`,`label`,`placeholder`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`lifecycle.stopTitle`),description:A(Y)(`lifecycle.stopDescription`),columns:3},{default:j(()=>[V($B,{modelValue:r.value.signal,"onUpdate:modelValue":y[20]||=e=>r.value.signal=e,label:A(Y)(`lifecycle.signal`),options:v.value},null,8,[`modelValue`,`label`,`options`]),V(qB,{modelValue:A(_),"onUpdate:modelValue":y[21]||=e=>hn(_)?_.value=e:null,label:A(Y)(`lifecycle.grace`),min:0},null,8,[`modelValue`,`label`]),V(sV,{modelValue:r.value.killGroup,"onUpdate:modelValue":y[22]||=e=>r.value.killGroup=e,label:A(Y)(`lifecycle.killGroup`)},null,8,[`modelValue`,`label`]),V(sV,{modelValue:r.value.killPortHolders,"onUpdate:modelValue":y[23]||=e=>r.value.killPortHolders=e,label:A(Y)(`lifecycle.killPortHolders`),wide:``},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`])],64))}}),lV=[{id:`minecraft`,nameKey:`presets.minecraft`,descriptionKey:`presets.minecraftHint`,command:`java`,args:[`-Xmx2G`,`-jar`,`server.jar`,`nogui`],port:25565,autostart:!0,label:`Minecraft`},{id:`jellyfin`,nameKey:`presets.jellyfin`,descriptionKey:`presets.jellyfinHint`,command:`jellyfin`,args:[],port:8096,autostart:!0,label:`Jellyfin`},{id:`node`,nameKey:`presets.node`,descriptionKey:`presets.nodeHint`,command:`node`,args:[`server.js`],port:3e3,autostart:!0,label:`Node app`,env:[`PORT={port}`]},{id:`python`,nameKey:`presets.python`,descriptionKey:`presets.pythonHint`,command:`python`,args:[`-m`,`http.server`,`{port}`],port:8e3,autostart:!1,label:`Python server`},{id:`gitea`,nameKey:`presets.gitea`,descriptionKey:`presets.giteaHint`,command:`gitea`,args:[`web`],port:3e3,autostart:!0,label:`Gitea (rootless)`,env:[`GITEA_WORK_DIR=./data`,`GITEA__server__HTTP_PORT={port}`,`GITEA__server__SSH_PORT=2222`,`GITEA__server__START_SSH_SERVER=true`]},{id:`mongodb`,nameKey:`presets.mongodb`,descriptionKey:`presets.mongodbHint`,command:`mongod`,args:[`--dbpath`,`./data`,`--port`,`{port}`],port:27017,autostart:!0,label:`MongoDB`},{id:`docker`,nameKey:`presets.docker`,descriptionKey:`presets.dockerHint`,command:`docker`,args:[`compose`,`up`],port:null,autostart:!0,label:`Docker Compose`},{id:`bot`,nameKey:`presets.bot`,descriptionKey:`presets.botHint`,command:`node`,args:[`bot.js`],port:null,autostart:!0,label:`Bot`}];function uV(e,t={}){return{...wB(t.defaults),id:t.id!==void 0&&t.id.length>0?t.id:e.id,label:t.label!==void 0&&t.label.length>0?t.label:e.label,command:e.command,args:e.args.join(`
41
+ `)}async function Yz(e,t=8e3){let n=Date.now()+t;for(;;){try{if((await fetch(`${e}/api/auth/session`,{cache:`no-store`})).ok)return!0}catch{}if(Date.now()>n)return!1;await new Promise(e=>setTimeout(e,250))}}var Xz=36e5,Zz={enabled:!0,maxRetries:3,baseDelayMs:1e3,factor:2,maxDelayMs:3e4,resetAfterMs:6e4},Qz={enabled:!0,mode:`port`,http:{scheme:`http`,allowInvalidCert:!1,path:`/`,method:`GET`,expectStatusBelow:400,expectBody:``},intervalMs:5e3,timeoutMs:1500,unhealthyThreshold:3,forceRestartAfterMs:0,startTimeoutMs:2e4},$z={signal:`SIGTERM`,killGroup:!0,graceMs:5e3,killPortHolders:!1};function eB(e){return{...e,http:{...e.http}}}function tB(){return{control:{label:`home-hosted`,port:3999,host:`local`,openBrowser:!1,tlsEnabled:!1},auth:{enabled:!1,sessionTtlMs:6048e5,cookieSecure:`auto`,trustProxy:`off`,maxLoginAttempts:5,lockoutMs:6e4},host:{enabled:!0,intervalMs:15e3,diskPaths:`.`,diskUsedPercent:90,memoryUsedPercent:90,swapUsedPercent:50,loadPerCpu:2,tempCelsius:85,tempCommand:``,tempCommandTimeoutMs:5e3},backups:{enabled:!0,keep:5,includePaths:``,scheduleEnabled:!1,scheduleHours:24,scheduleKeep:7,scheduleScope:null}}}function nB(){return{defaults:{enabled:!0,autostart:!1,bind:`local`,onPortConflict:`block`,logBufferLines:500,restart:{...Zz},health:eB(Qz),stop:{...$z}},logs:{persist:!0,maxBytes:2e6,keep:3},policy:{onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0,cooldownMs:12e4},destinations:[]}}function rB(e){return e===`loopback`?`loopback`:e===`any`||e===!0}function iB(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:rB(e.trustProxy),maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function aB(e){return{enabled:e.enabled,sessionTtlMs:e.sessionTtlMs,cookieSecure:e.cookieSecure,trustProxy:e.trustProxy===`loopback`?`loopback`:e.trustProxy?`any`:`off`,maxLoginAttempts:e.maxLoginAttempts,lockoutMs:e.lockoutMs}}function oB(e){return{label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,tlsEnabled:e.tls.enabled}}function sB(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}function cB(e){return{enabled:e.enabled,intervalMs:e.intervalMs,diskPaths:e.diskPaths.join(`, `),diskUsedPercent:e.diskUsedPercent,memoryUsedPercent:e.memoryUsedPercent,swapUsedPercent:e.swapUsedPercent,loadPerCpu:e.loadPerCpu,tempCelsius:e.tempCelsius,tempCommand:e.tempCommand??``,tempCommandTimeoutMs:e.tempCommandTimeoutMs??5e3}}var lB={intervalMs:0,keep:7};function uB(e){let t=e.schedule??lB;return{enabled:e.enabled,keep:e.keep,includePaths:e.includePaths.join(`, `),scheduleEnabled:t.intervalMs>0,scheduleHours:Math.max(1,Math.round(t.intervalMs/Xz)||1),scheduleKeep:t.keep,scheduleScope:t.scope??null}}function dB(e,t){let n=cB(e);return Iz({...n,diskPaths:sB(n.diskPaths)},{...t,diskPaths:sB(t.diskPaths)})}function fB(e,t){let n=uB(e),r={};return(t.scheduleEnabled!==n.scheduleEnabled||t.scheduleHours!==n.scheduleHours)&&(r.intervalMs=t.scheduleEnabled?t.scheduleHours*Xz:0),t.scheduleKeep!==n.scheduleKeep&&(r.keep=t.scheduleKeep),Jz(t.scheduleScope,n.scheduleScope)||(r.scope=t.scheduleScope),Iz({enabled:e.enabled,keep:e.keep,includePaths:e.includePaths,schedule:e.schedule??lB},{enabled:t.enabled,keep:t.keep,includePaths:sB(t.includePaths),schedule:r},[`schedule`])}function pB(e,t){return Iz({label:e.label,port:e.port,host:e.host,openBrowser:e.openBrowser,auth:iB(e.auth),tls:{enabled:e.tls.enabled}},{label:t.control.label,port:t.control.port,host:t.control.host,openBrowser:t.control.openBrowser,auth:{...t.auth,trustProxy:rB(t.auth.trustProxy)},tls:{enabled:t.control.tlsEnabled}},[`auth`,`tls`])}function mB(e,t){return Iz(e,t,[`restart`,`health`,`stop`])}function hB(e,t){return Iz(e,t)}function gB(e){return{onCrash:e.onCrash,onUnhealthy:e.onUnhealthy,onForcedRestart:e.onForcedRestart,onRecovered:e.onRecovered,onHost:e.onHost,onDdns:e.onDdns??!0,cooldownMs:e.cooldownMs}}function _B(e){return{id:e.id,kind:e.kind,enabled:e.enabled,useOwnSettings:e.useOwnSettings,chatId:e.chatId??``,tokenSet:e.tokenSet,url:e.url??``,method:e.method??`POST`,format:e.format??`json`,headers:e.headers??``,policy:gB(e)}}function vB(e,t){let n=Iz({defaults:gB(e)},{defaults:{...t}},[`defaults`]);return Object.keys(n).length===0?null:n}function yB(e){return{kind:e.kind,id:e.id,enabled:e.enabled,useOwnSettings:e.useOwnSettings,...e.kind===`telegram`?{chatId:e.chatId}:{url:e.url,method:e.method,format:e.format,headers:e.headers},...e.useOwnSettings?e.policy:{}}}function bB(e,t,n){let r=Rz({filled:n,draft:t,live:e.map(_B),key:e=>e.id});return r===null?null:{destinations:r.map(yB)}}function xB(e,t,n){return Lz({filled:n,draft:t,live:e.map(_B),key:e=>e.id})}function SB(e,t){switch(t){case`control`:return{...e.control,auth:{...e.auth}};case`host`:return{...e.host};case`backups`:return{...e.backups}}}function CB(e,t){return t===`auth`?{...e.auth}:t===`tls`?e.control.tlsEnabled:{label:e.control.label,port:e.control.port,host:e.control.host,openBrowser:e.control.openBrowser}}function wB(e,t,n){return t!==void 0&&OB(t[n],CB(e,n))}function TB(e,t,n){t.control={...t.control??{},[n]:CB(e,n)}}function EB(e,t){switch(t){case`defaults`:return{...e.defaults,restart:{...e.defaults.restart},health:eB(e.defaults.health),stop:{...e.defaults.stop}};case`logs`:return{...e.logs};case`notifications`:return{policy:{...e.policy},destinations:e.destinations.map(e=>({...e,policy:{...e.policy}}))}}}function DB(e){if(typeof e!=`object`||!e)return;let t=e.destinations;return Array.isArray(t)?t:void 0}function OB(e,t){return e!==void 0&&JSON.stringify(e)!==JSON.stringify(t)}function kB(e,t){return e.label!==t.control.label||e.port!==t.control.port||e.host!==t.control.host||e.openBrowser!==t.control.openBrowser}function AB(e,t){return e.tls.enabled!==t.control.tlsEnabled}function jB(e,t){return Hz(Iz({...aB(e.auth)},{...t.auth}))>0}function MB(e,t,n){return W({get:()=>LR(e()),set:e=>{t(e===null||Number.isNaN(e)?n:RR(e))}})}function NB(e,t,n){return W({get:e,set:e=>{t(e===null||Number.isNaN(e)?n:e)}})}async function PB(e){if(!e.rebinding)return null;let t=e.targetUrl??e.control.url;return t.length===0||t===window.location.origin?null:await Yz(t)?(window.location.replace(t),null):Y(`settings.rebind.failed`,{target:t})}function FB(e){return e.split(`
42
+ `).map(e=>e.trim()).filter(e=>e.length>0)}function IB(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
43
+ `)}function LB(e){let t={};for(let n of FB(e)){let e=n.indexOf(`=`);e<=0||(t[n.slice(0,e).trim()]=n.slice(e+1).trim())}return t}function RB(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e.length>0)}var zB=/^[a-z0-9][a-z0-9_-]*$/;function BB(e){return{id:``,label:``,command:``,args:``,cwd:``,port:null,bind:e?.bind??`local`,autostart:e?.autostart??!1,persistent:!1,enabled:e?.enabled??!0,onPortConflict:e?.onPortConflict??`block`,logBufferLines:null,dependsOn:``,envFile:``,env:``,dataEnvs:``,backupPaths:``,backupIgnoreGenerated:!0,maxRssMb:null,restart:{...e?.restart??Zz},health:eB(e?.health??Qz),stop:{...e?.stop??$z},bootstrapEnabled:!1,bootstrapCommand:``,bootstrapArgs:``,bootstrapEnv:``,bootstrapTimeoutMs:12e4,bootstrapRunOnce:!0}}var VB={port:`validation.port`,idRequired:`validation.idRequired`,idPattern:`validation.idPattern`,commandRequired:`validation.commandRequired`,bootstrapCommand:`validation.bootstrapCommand`};function HB(e){return e!==null&&Number.isFinite(e)?e:0}function UB(e){return{args:[],cwd:`.`,env:{},dataEnvs:{},dependsOn:[],envFile:``,backupPaths:[],backupIgnoreGenerated:!0,resources:{maxRssBytes:0},bind:e?.bind??`local`,enabled:e?.enabled??!0,autostart:e?.autostart??!1,persistent:!1,onPortConflict:e?.onPortConflict??`block`,logBufferLines:e?.logBufferLines??500}}function WB(e){return e===null||Number.isNaN(e)||Number.isInteger(e)&&e>=1&&e<=65535?null:VB.port}function GB(e,t){let n=HB(e.maxRssMb),r=HB(e.bootstrapTimeoutMs),i=UB(t),a=Iz({restart:t?.restart??Zz,health:t?.health??Qz,stop:t?.stop??$z},{restart:e.restart,health:e.health,stop:e.stop});return{...Iz(i,{args:FB(e.args),cwd:e.cwd.trim().length>0?e.cwd.trim():`.`,env:LB(e.env),dataEnvs:LB(e.dataEnvs),dependsOn:RB(e.dependsOn),envFile:e.envFile.trim(),backupPaths:FB(e.backupPaths),backupIgnoreGenerated:e.backupIgnoreGenerated,resources:{maxRssBytes:n>0?Math.round(n*1024*1024):0},bind:e.bind,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent,onPortConflict:e.onPortConflict,logBufferLines:HB(e.logBufferLines)>0?HB(e.logBufferLines):i.logBufferLines}),...a,id:e.id.trim(),...e.label.trim().length===0?{}:{label:e.label.trim()},command:e.command.trim(),...e.port===null||Number.isNaN(e.port)?{}:{port:e.port},...e.bootstrapEnabled?{bootstrap:{command:e.bootstrapCommand.trim(),args:FB(e.bootstrapArgs),env:LB(e.bootstrapEnv),timeoutMs:r>=1e3?r:12e4,runOnce:e.bootstrapRunOnce}}:{}}}function KB(e){if(e.id.trim().length===0)return{key:VB.idRequired,field:`id`};if(!zB.test(e.id.trim()))return{key:VB.idPattern,field:`id`};if(e.command.trim().length===0)return{key:VB.commandRequired,field:`command`};if(e.bootstrapEnabled&&e.bootstrapCommand.trim().length===0)return{key:VB.bootstrapCommand,field:`bootstrapCommand`};let t=WB(e.port);return t===null?null:{key:t,field:`port`}}var qB={class:`mb-3 flex items-start justify-between gap-3`},JB={class:`min-w-0`},YB={class:`text-xs font-semibold text-ink`},XB={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},ZB={class:`flex shrink-0 items-center gap-2`},QB=N({__name:`FieldGroup`,props:{title:{},description:{default:void 0},columns:{default:2},dense:{type:Boolean,default:!1},class:{default:void 0}},setup(e){let t=e,n=W(()=>({1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`})[t.columns]);return(e,r)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel-2/40`,t.dense?`p-3`:`p-3.5`,t.class))},[B(`header`,qB,[B(`div`,JB,[B(`h3`,YB,O(t.title),1),t.description?(L(),R(`p`,XB,O(t.description),1)):U(``,!0)]),B(`div`,ZB,[F(e.$slots,`actions`)])]),B(`div`,{class:D(A(Q)(`grid gap-3`,n.value))},[F(e.$slots,`default`)],2)],2))}});function $B(e){return e==null||Number.isNaN(e)?``:String(e)}function eV(e,t){let n=String(e??``).trim();if(n.length===0)return t?null:NaN;let r=Number(n);return Number.isNaN(r)?NaN:r}var tV=`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60 focus-visible:ring-offset-2 focus-visible:ring-offset-page`,nV=`text-xs font-medium text-muted`,rV=`text-2xs leading-4 text-faint`,iV=[`w-full min-w-0 rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-sm text-ink`,`placeholder:text-faint transition-colors duration-150`,`hover:border-line/80 hover:bg-page`,`focus:border-accent focus:bg-page focus:outline-none focus:ring-2 focus:ring-accent/25`,`disabled:cursor-not-allowed disabled:opacity-50`,`aria-[invalid=true]:border-danger aria-[invalid=true]:focus:ring-danger/25`].join(` `),aV=`${iV} font-mono text-xs`,oV=[`for`],sV=[`id`,`step`,`min`,`max`,`aria-invalid`],cV={key:1,class:`text-2xs text-danger`},lV=N({inheritAttrs:!1,__name:`NumberField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1},nullable:{type:Boolean,default:!1},step:{default:void 0},min:{default:void 0},max:{default:void 0}},{modelValue:{default:null},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi(),i=W({get:()=>$B(n.value),set:e=>{n.value=eV(e,t.nullable)}}),a=W(()=>n.value!==null&&Number.isNaN(n.value));return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(nV))},O(t.label),11,oV)):U(``,!0),wr(B(`input`,Ps({id:A(r),"onUpdate:modelValue":n[0]||=e=>i.value=e,type:`number`,inputmode:`numeric`,step:t.step,min:t.min,max:t.max,class:A(Q)(A(iV),`font-mono tabular-nums`,(t.error||a.value)&&`border-danger`),"aria-invalid":t.error||a.value?!0:void 0},e.$attrs),null,16,sV),[[nu,i.value]]),t.error?(L(),R(`p`,cV,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(rV))},O(t.hint),3)):U(``,!0)],2))}}),uV=[`for`],dV={class:`relative`},fV=[`id`],pV=[`value`,`disabled`],mV={key:1,class:`text-2xs text-danger`},hV=N({inheritAttrs:!1,__name:`SelectField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},options:{},wide:{type:Boolean,default:!1},mono:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi();return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(nV))},O(t.label),11,uV)):U(``,!0),B(`div`,dV,[wr(B(`select`,Ps({id:A(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,class:A(Q)(A(iV),`cursor-pointer appearance-none pr-7`,t.mono&&`font-mono text-xs`,t.error&&`border-danger`)},e.$attrs),[(L(!0),R(I,null,P(t.options,e=>(L(),R(`option`,{key:e.value,value:e.value,disabled:e.disabled},O(e.label),9,pV))),128))],16,fV),[[ou,n.value]]),V(A($v),{class:`pointer-events-none absolute right-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`,"aria-hidden":`true`})]),t.error?(L(),R(`p`,mV,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(rV))},O(t.hint),3)):U(``,!0)],2))}}),gV=[`for`],_V=[`id`,`aria-invalid`,`aria-describedby`],vV=[`id`],yV=[`id`],bV=N({inheritAttrs:!1,__name:`TextField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},wide:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi(),i=W(()=>t.hint||t.error?`${r}-hint`:void 0);return(e,a)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(nV))},O(t.label),11,gV)):U(``,!0),wr(B(`input`,Ps({id:A(r),"onUpdate:modelValue":a[0]||=e=>n.value=e,class:A(Q)(A(iV),t.error&&`border-danger`),"aria-invalid":t.error?!0:void 0,"aria-describedby":i.value},e.$attrs),null,16,_V),[[du,n.value]]),t.error?(L(),R(`p`,{key:1,id:`${A(r)}-hint`,class:`text-2xs text-danger`},O(t.error),9,vV)):t.hint?(L(),R(`p`,{key:2,id:`${A(r)}-hint`,class:D(A(rV))},O(t.hint),11,yV)):U(``,!0)],2))}}),xV=[`id`],SV={key:0,class:`block text-2xs text-faint`},CV=N({__name:`ToggleSwitch`,props:Va({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1},trailing:{type:Boolean,default:!1},wide:{type:Boolean,default:!1},srOnly:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=fi(),r=lo(e,`modelValue`);return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex items-center gap-2.5`,t.trailing&&`flex-row-reverse justify-end`,t.wide&&`sm:col-span-2`))},[V(A(xg),{modelValue:r.value,"onUpdate:modelValue":i[0]||=e=>r.value=e,disabled:t.disabled,"aria-labelledby":A(n),class:D(A(Q)(`relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-150`,`data-[state=checked]:border-accent data-[state=checked]:bg-accent`,`data-[state=unchecked]:border-line data-[state=unchecked]:bg-line-soft`,`disabled:cursor-not-allowed disabled:opacity-45`,A(tV)))},{default:j(()=>[V(A(Sg),{class:`block size-3 translate-x-[3px] rounded-full bg-white shadow-sm transition-transform duration-150 ease-out data-[state=checked]:translate-x-[16px]`})]),_:1},8,[`modelValue`,`disabled`,`aria-labelledby`,`class`]),B(`label`,{class:`min-w-0 cursor-pointer select-none`,onClick:i[1]||=e=>!t.disabled&&(r.value=!r.value)},[B(`span`,{id:A(n),class:D(A(Q)(`block text-xs text-ink`,t.srOnly&&`sr-only`))},O(t.label),11,xV),t.hint?(L(),R(`span`,SV,O(t.hint),1)):U(``,!0)])],2))}}),wV=N({__name:`LifecycleFields`,props:Va({showHttp:{type:Boolean,default:!0}},{restart:{required:!0},restartModifiers:{},health:{required:!0},healthModifiers:{},stop:{required:!0},stopModifiers:{}}),emits:[`update:restart`,`update:health`,`update:stop`],setup(e){let t=lo(e,`restart`),n=lo(e,`health`),r=lo(e,`stop`);function i(e,t,n=0){return W({get:e,set:e=>t(e===null||Number.isNaN(e)?n:e)})}let a=i(()=>t.value.maxRetries,e=>t.value.maxRetries=e),o=i(()=>t.value.baseDelayMs,e=>t.value.baseDelayMs=e),s=i(()=>t.value.factor,e=>t.value.factor=e,1),c=i(()=>t.value.maxDelayMs,e=>t.value.maxDelayMs=e),l=i(()=>t.value.resetAfterMs,e=>t.value.resetAfterMs=e),u=i(()=>n.value.intervalMs,e=>n.value.intervalMs=e,500),d=i(()=>n.value.timeoutMs,e=>n.value.timeoutMs=e,100),f=i(()=>n.value.unhealthyThreshold,e=>n.value.unhealthyThreshold=e,1),p=i(()=>n.value.forceRestartAfterMs,e=>n.value.forceRestartAfterMs=e),m=i(()=>n.value.startTimeoutMs,e=>n.value.startTimeoutMs=e),h=W({get:()=>n.value.http.expectStatus??null,set:e=>{e===null||Number.isNaN(e)?delete n.value.http.expectStatus:n.value.http.expectStatus=e}}),g=i(()=>n.value.http.expectStatusBelow,e=>n.value.http.expectStatusBelow=e,400),_=i(()=>r.value.graceMs,e=>r.value.graceMs=e),v=W(()=>[{value:`SIGTERM`,label:Y(`lifecycle.signalTerm`)},{value:`SIGINT`,label:Y(`lifecycle.signalInt`)},{value:`SIGKILL`,label:Y(`lifecycle.signalKill`)}]);return(i,y)=>(L(),R(I,null,[V(QB,{title:A(Y)(`lifecycle.restartTitle`),description:A(Y)(`lifecycle.restartDescription`),columns:3},{default:j(()=>[V(CV,{modelValue:t.value.enabled,"onUpdate:modelValue":y[0]||=e=>t.value.enabled=e,label:A(Y)(`lifecycle.restartOnCrash`),wide:``},null,8,[`modelValue`,`label`]),V(lV,{modelValue:A(a),"onUpdate:modelValue":y[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`lifecycle.maxRetries`),min:0,hint:A(Y)(`lifecycle.maxRetriesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(o),"onUpdate:modelValue":y[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`lifecycle.baseDelay`),min:0},null,8,[`modelValue`,`label`]),V(lV,{modelValue:A(s),"onUpdate:modelValue":y[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`lifecycle.factor`),min:1,step:.1},null,8,[`modelValue`,`label`]),V(lV,{modelValue:A(c),"onUpdate:modelValue":y[4]||=e=>hn(c)?c.value=e:null,label:A(Y)(`lifecycle.maxDelay`),min:0},null,8,[`modelValue`,`label`]),V(lV,{modelValue:A(l),"onUpdate:modelValue":y[5]||=e=>hn(l)?l.value=e:null,label:A(Y)(`lifecycle.resetAfter`),min:0,hint:A(Y)(`lifecycle.resetAfterHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`lifecycle.healthTitle`),description:A(Y)(`lifecycle.healthDescription`),columns:3},{default:j(()=>[V(CV,{modelValue:n.value.enabled,"onUpdate:modelValue":y[6]||=e=>n.value.enabled=e,label:A(Y)(`lifecycle.probe`),wide:``},null,8,[`modelValue`,`label`]),V(hV,{modelValue:n.value.mode,"onUpdate:modelValue":y[7]||=e=>n.value.mode=e,label:A(Y)(`lifecycle.probeType`),options:[{value:`port`,label:A(Y)(`lifecycle.probePort`)},{value:`http`,label:A(Y)(`lifecycle.probeHttp`)}]},null,8,[`modelValue`,`label`,`options`]),V(lV,{modelValue:A(u),"onUpdate:modelValue":y[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`lifecycle.interval`),min:500,step:100},null,8,[`modelValue`,`label`]),V(lV,{modelValue:A(d),"onUpdate:modelValue":y[9]||=e=>hn(d)?d.value=e:null,label:A(Y)(`lifecycle.timeout`),min:100,step:100},null,8,[`modelValue`,`label`]),V(lV,{modelValue:A(f),"onUpdate:modelValue":y[10]||=e=>hn(f)?f.value=e:null,label:A(Y)(`lifecycle.unhealthyAfter`),min:1,hint:A(Y)(`lifecycle.unhealthyAfterHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(p),"onUpdate:modelValue":y[11]||=e=>hn(p)?p.value=e:null,label:A(Y)(`lifecycle.forceRestartAfter`),min:0,hint:A(Y)(`lifecycle.forceRestartAfterHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(m),"onUpdate:modelValue":y[12]||=e=>hn(m)?m.value=e:null,label:A(Y)(`lifecycle.startTimeout`),min:0},null,8,[`modelValue`,`label`]),e.showHttp&&n.value.mode===`http`?(L(),R(I,{key:0},[V(hV,{modelValue:n.value.http.scheme,"onUpdate:modelValue":y[13]||=e=>n.value.http.scheme=e,label:A(Y)(`lifecycle.httpScheme`),options:[{value:`http`,label:`http`},{value:`https`,label:`https`}]},null,8,[`modelValue`,`label`]),V(bV,{modelValue:n.value.http.path,"onUpdate:modelValue":y[14]||=e=>n.value.http.path=e,label:A(Y)(`lifecycle.httpPath`),placeholder:`/healthz`},null,8,[`modelValue`,`label`]),V(hV,{modelValue:n.value.http.method,"onUpdate:modelValue":y[15]||=e=>n.value.http.method=e,label:A(Y)(`lifecycle.httpMethod`),options:[{value:`GET`,label:`GET`},{value:`HEAD`,label:`HEAD`}]},null,8,[`modelValue`,`label`]),V(lV,{modelValue:h.value,"onUpdate:modelValue":y[16]||=e=>h.value=e,label:A(Y)(`lifecycle.expectStatus`),nullable:``,hint:A(Y)(`lifecycle.expectStatusHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(g),"onUpdate:modelValue":y[17]||=e=>hn(g)?g.value=e:null,label:A(Y)(`lifecycle.expectStatusBelow`),min:100},null,8,[`modelValue`,`label`]),n.value.http.scheme===`https`?(L(),z(CV,{key:0,modelValue:n.value.http.allowInvalidCert,"onUpdate:modelValue":y[18]||=e=>n.value.http.allowInvalidCert=e,label:A(Y)(`lifecycle.allowInvalidCert`),hint:A(Y)(`lifecycle.allowInvalidCertHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])):U(``,!0),V(bV,{modelValue:n.value.http.expectBody,"onUpdate:modelValue":y[19]||=e=>n.value.http.expectBody=e,label:A(Y)(`lifecycle.expectBody`),placeholder:A(Y)(`lifecycle.expectBodyPlaceholder`),wide:``,hint:n.value.http.method===`HEAD`&&n.value.http.expectBody.length>0?A(Y)(`lifecycle.headBodyHint`):void 0},null,8,[`modelValue`,`label`,`placeholder`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`lifecycle.stopTitle`),description:A(Y)(`lifecycle.stopDescription`),columns:3},{default:j(()=>[V(hV,{modelValue:r.value.signal,"onUpdate:modelValue":y[20]||=e=>r.value.signal=e,label:A(Y)(`lifecycle.signal`),options:v.value},null,8,[`modelValue`,`label`,`options`]),V(lV,{modelValue:A(_),"onUpdate:modelValue":y[21]||=e=>hn(_)?_.value=e:null,label:A(Y)(`lifecycle.grace`),min:0},null,8,[`modelValue`,`label`]),V(CV,{modelValue:r.value.killGroup,"onUpdate:modelValue":y[22]||=e=>r.value.killGroup=e,label:A(Y)(`lifecycle.killGroup`)},null,8,[`modelValue`,`label`]),V(CV,{modelValue:r.value.killPortHolders,"onUpdate:modelValue":y[23]||=e=>r.value.killPortHolders=e,label:A(Y)(`lifecycle.killPortHolders`),wide:``},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`])],64))}}),TV=[{id:`minecraft`,nameKey:`presets.minecraft`,descriptionKey:`presets.minecraftHint`,command:`java`,args:[`-Xmx2G`,`-jar`,`server.jar`,`nogui`],port:25565,autostart:!0,label:`Minecraft`},{id:`jellyfin`,nameKey:`presets.jellyfin`,descriptionKey:`presets.jellyfinHint`,command:`jellyfin`,args:[],port:8096,autostart:!0,label:`Jellyfin`},{id:`node`,nameKey:`presets.node`,descriptionKey:`presets.nodeHint`,command:`node`,args:[`server.js`],port:3e3,autostart:!0,label:`Node app`,env:[`PORT={port}`]},{id:`python`,nameKey:`presets.python`,descriptionKey:`presets.pythonHint`,command:`python`,args:[`-m`,`http.server`,`{port}`],port:8e3,autostart:!1,label:`Python server`},{id:`gitea`,nameKey:`presets.gitea`,descriptionKey:`presets.giteaHint`,command:`gitea`,args:[`web`],port:3e3,autostart:!0,label:`Gitea (rootless)`,env:[`GITEA_WORK_DIR=./data`,`GITEA__server__HTTP_PORT={port}`,`GITEA__server__SSH_PORT=2222`,`GITEA__server__START_SSH_SERVER=true`]},{id:`mongodb`,nameKey:`presets.mongodb`,descriptionKey:`presets.mongodbHint`,command:`mongod`,args:[`--dbpath`,`./data`,`--port`,`{port}`],port:27017,autostart:!0,label:`MongoDB`},{id:`docker`,nameKey:`presets.docker`,descriptionKey:`presets.dockerHint`,command:`docker`,args:[`compose`,`up`],port:null,autostart:!0,label:`Docker Compose`},{id:`bot`,nameKey:`presets.bot`,descriptionKey:`presets.botHint`,command:`node`,args:[`bot.js`],port:null,autostart:!0,label:`Bot`}];function EV(e,t={}){return{...BB(t.defaults),id:t.id!==void 0&&t.id.length>0?t.id:e.id,label:t.label!==void 0&&t.label.length>0?t.label:e.label,command:e.command,args:e.args.join(`
44
44
  `),port:e.port,autostart:e.autostart,env:(e.env??[]).join(`
45
- `)}}var dV=[`type`,`disabled`,`aria-busy`],$=N({inheritAttrs:!1,__name:`AppButton`,props:{variant:{default:`secondary`},size:{default:`sm`},type:{default:`button`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},block:{type:Boolean,default:!1}},setup(e){let t=e,n=La(),r={primary:`bg-accent text-accent-ink border-transparent hover:brightness-110 active:brightness-95 shadow-[inset_0_1px_0_rgb(255_255_255/0.14)]`,secondary:`bg-raise text-ink border-line hover:bg-hover`,ghost:`bg-transparent text-muted border-transparent hover:bg-hover hover:text-ink`,danger:`bg-danger text-white border-transparent hover:brightness-110 active:brightness-95`,"danger-ghost":`bg-transparent text-danger border-danger/30 hover:bg-danger-soft`},i={xs:`h-6 gap-1 px-1.5 text-2xs`,sm:`h-8 gap-1.5 px-2.5 text-xs`,md:`h-9 gap-2 px-3.5 text-sm`,icon:`h-9 w-9 justify-center`,"icon-sm":`h-8 w-8 justify-center`},a=W(()=>Q(`inline-flex select-none items-center rounded-control border font-medium whitespace-nowrap`,`transition-[background-color,border-color,color,filter,opacity] duration-150 ease-out`,`disabled:pointer-events-none disabled:opacity-45`,r[t.variant],i[t.size],t.block&&`w-full`,zB,n.class));return(e,r)=>(L(),R(`button`,Ps({...A(n),class:void 0},{type:t.type,class:a.value,disabled:t.disabled||t.loading,"aria-busy":t.loading||void 0}),[t.loading?(L(),z(A(wy),{key:0,class:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`})):U(``,!0),F(e.$slots,`default`)],16,dV))}}),fV=[`open`],pV={class:`flex cursor-pointer list-none select-none items-center gap-1.5 px-3 py-2 text-xs font-semibold text-ink [&::-webkit-details-marker]:hidden`},mV={key:0,class:`ml-1 truncate text-2xs font-normal text-faint`},hV={class:`grid gap-3 border-t border-line-soft px-3 py-3`},gV=N({__name:`Disclosure`,props:{title:{},hint:{default:void 0},open:{type:Boolean,default:!1}},setup(e){let t=e;return(e,n)=>(L(),R(`details`,{class:`group rounded-panel border border-line bg-panel-2/40`,open:t.open},[B(`summary`,pV,[V(A(ty),{class:`size-3.5 shrink-0 text-muted transition-transform duration-150 group-open:rotate-90`,"aria-hidden":`true`}),H(` `+O(t.title)+` `,1),t.hint?(L(),R(`span`,mV,O(t.hint),1)):U(``,!0)]),B(`div`,hV,[F(e.$slots,`default`)])],8,fV))}}),_V={class:`flex shrink-0 items-start justify-between gap-4 border-b border-line px-4 py-3`},vV={class:`min-w-0`},yV={class:`min-h-0 flex-1 overflow-y-auto px-4 py-3.5`},bV={key:0,class:`flex shrink-0 items-center justify-end gap-2 border-t border-line bg-panel-2 px-4 py-3`},xV=N({__name:`Modal`,props:Va({title:{},description:{default:void 0},width:{default:`w-[min(92vw,34rem)]`}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=lo(e,`open`);return(e,r)=>(L(),z(A(yf),{open:n.value,"onUpdate:open":r[0]||=e=>n.value=e},{default:j(()=>[V(A(lp),null,{default:j(()=>[V(A(sp),{class:`fixed inset-0 z-50 bg-black/45 backdrop-blur-[1px] data-[state=closed]:animate-[hh-fade-out_120ms_ease-in] data-[state=open]:animate-[hh-fade-in_150ms_ease-out]`}),V(A(ip),{class:D(A(Q)(`fixed left-1/2 top-1/2 z-50 flex max-h-[88dvh] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-panel border border-line bg-panel shadow-float`,`data-[state=closed]:animate-[hh-pop-out_120ms_ease-in] data-[state=open]:animate-[hh-pop-in_160ms_var(--ease-out-quick)]`,t.width))},{default:j(()=>[B(`header`,_V,[B(`div`,vV,[V(A(up),{class:`text-sm font-semibold text-ink`},{default:j(()=>[H(O(t.title),1)]),_:1}),t.description?(L(),z(A(ap),{key:0,class:`mt-0.5 text-xs text-muted`},{default:j(()=>[H(O(t.description),1)]),_:1})):U(``,!0)]),V(A(bf),{class:D(A(Q)(`-mr-1 -mt-0.5 grid size-7 shrink-0 place-items-center rounded-control text-muted transition-colors duration-150 hover:bg-hover hover:text-ink`,A(zB))),"aria-label":A(Y)(`common.close`)},{default:j(()=>[V(A(nb),{class:`size-4`})]),_:1},8,[`class`,`aria-label`])]),B(`div`,yV,[F(e.$slots,`default`)]),e.$slots.footer?(L(),R(`footer`,bV,[F(e.$slots,`footer`)])):U(``,!0)]),_:3},8,[`class`])]),_:3})]),_:3},8,[`open`]))}}),SV=[`for`],CV=[`id`,`rows`,`placeholder`],wV={key:1,class:`text-2xs text-danger`},TV=N({inheritAttrs:!1,__name:`TextAreaField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},rows:{default:3},placeholder:{default:void 0},wide:{type:Boolean,default:!0},mono:{type:Boolean,default:!0}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi();return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(BB))},O(t.label),11,SV)):U(``,!0),wr(B(`textarea`,Ps({id:A(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,rows:t.rows,placeholder:t.placeholder,spellcheck:`false`,class:A(Q)(t.mono?A(UB):`font-sans`,`resize-y leading-relaxed`,t.error&&`border-danger`)},e.$attrs),null,16,CV),[[nu,n.value]]),t.error?(L(),R(`p`,wV,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(VB))},O(t.hint),3)):U(``,!0)],2))}}),EV=N({__name:`TransText`,props:{k:{},params:{}},setup(e){let t=e,n=Ia(),r=W(()=>Object.keys(n)),i=W(()=>{let e={...t.params};for(let t of r.value)delete e[t];let n=Y(t.k,e),i=[],a=/\{(\w+)\}/g,o=0,s=a.exec(n);for(;s!==null;){s.index>o&&i.push({text:n.slice(o,s.index)});let e=s[1];i.push(r.value.includes(e)?{slot:e}:{text:s[0]}),o=s.index+s[0].length,s=a.exec(n)}return o<n.length&&i.push({text:n.slice(o)}),i});return(e,t)=>(L(),R(`span`,null,[(L(!0),R(I,null,P(i.value,(t,n)=>(L(),R(I,{key:n},[t.slot?F(e.$slots,t.slot,{},void 0,void 0,0):(L(),R(I,{key:1},[H(O(t.text),1)],64))],64))),128))]))}}),DV={key:0,role:`alert`,class:`sticky top-0 z-10 mb-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},OV={key:1,class:`flex flex-col gap-3`},kV={class:`text-sm font-medium text-ink`},AV={class:`mt-0.5 text-2xs text-muted`},jV={class:`grid grid-cols-1 gap-2 sm:grid-cols-2`},MV=[`onClick`],NV={class:`text-xs font-medium text-ink`},PV={class:`text-2xs leading-4 text-muted`},FV={"data-field":`id`},IV={"data-field":`command`},LV={class:`text-2xs leading-4 text-faint`},RV={class:`font-mono`},zV={class:`rounded-panel border border-line-soft bg-panel-2/40 p-3`},BV={class:`text-2xs font-medium text-muted`},VV={class:`mt-1.5 flex flex-wrap gap-1`},HV=N({__name:`AddServerDialog`,props:Va({workspaceId:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=tI(),o=k(!1),s=k(null),c=k(null),l=k(null),u=k(!0),d=[`{port}`,`{host}`,`{home}`,`{projectDir}`,`{dataRoot}`,`{id}`,`{label}`,`{cwd}`,`{bind}`,`{lanIp}`],f=W(()=>a.workspaceById(n.workspaceId)?.defaults),p=W(()=>a.workspaceById(n.workspaceId)?.label??Y(`addServer.thisWorkspace`)),m=tn(wB(f.value));function h(e){Object.assign(m,uV(e,{...f.value===void 0?{}:{defaults:f.value},id:m.id,label:m.label})),u.value=!1,s.value=null,c.value=null}function g(){u.value=!1}let _=W(()=>{let e=OB(m.port);return e===null?null:Y(e)});function v(){Object.assign(m,wB(f.value)),s.value=null,c.value=null,u.value=!0}function y(e,t){if(s.value=e,c.value=t,t===null)return;let n=l.value?.querySelector(`[data-field="${t}"] input, [data-field="${t}"] textarea`);n?.scrollIntoView({block:`center`,behavior:`smooth`}),n?.focus()}M(i,e=>{e&&v()});async function b(){s.value=null,c.value=null;let e=AB(m);if(e!==null){y(Y(e.key),e.field);return}let t=Ej(kB(m,f.value));if(t instanceof J.errors)y(t.summary,null);else{o.value=!0;try{if(await a.create(n.workspaceId,t),a.lastError.value!==null){y(a.lastError.value,null);return}r(`created`),i.value=!1,v()}finally{o.value=!1}}}return(e,t)=>(L(),z(xV,{open:i.value,"onUpdate:open":t[29]||=e=>i.value=e,title:A(Y)(`addServer.title`),description:A(Y)(`addServer.description`,{workspace:p.value}),width:`w-[min(94vw,40rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[28]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),u.value?U(``,!0):(L(),z($,{key:0,type:`submit`,form:`add-server-form`,variant:`primary`,loading:o.value},{default:j(()=>[H(O(A(Y)(`addServer.submit`)),1)]),_:1},8,[`loading`]))]),default:j(()=>[s.value?(L(),R(`p`,DV,O(s.value),1)):U(``,!0),u.value?(L(),R(`div`,OV,[B(`div`,null,[B(`p`,kV,O(A(Y)(`presets.pickTitle`)),1),B(`p`,AV,O(A(Y)(`presets.pickDescription`)),1)]),B(`ul`,jV,[(L(!0),R(I,null,P(A(lV),e=>(L(),R(`li`,{key:e.id},[B(`button`,{type:`button`,class:`flex h-full w-full flex-col items-start gap-1 rounded-panel border border-line bg-raise px-3 py-2.5 text-left transition-colors hover:bg-hover`,onClick:t=>h(e)},[B(`span`,NV,O(A(Y)(e.nameKey)),1),B(`span`,PV,O(A(Y)(e.descriptionKey)),1)],8,MV)]))),128))]),V($,{variant:`ghost`,size:`xs`,class:`self-start`,onClick:g},{default:j(()=>[H(O(A(Y)(`presets.startFromScratch`)),1)]),_:1})])):U(``,!0),wr(B(`form`,{id:`add-server-form`,ref_key:`formEl`,ref:l,class:`flex flex-col gap-3`,onSubmit:_u(b,[`prevent`])},[V(IB,{title:A(Y)(`addServer.identity`),columns:2,dense:``},{default:j(()=>[B(`div`,FV,[V(iV,{modelValue:m.id,"onUpdate:modelValue":t[0]||=e=>m.id=e,label:A(Y)(`addServer.id`),placeholder:`my-server`,hint:A(Y)(`addServer.idHint`),error:c.value===`id`?s.value:null,class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`,`error`])]),V(iV,{modelValue:m.label,"onUpdate:modelValue":t[1]||=e=>m.label=e,label:A(Y)(`common.label`),placeholder:`My server`,hint:A(Y)(`addServer.labelHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(IB,{title:A(Y)(`addServer.process`),columns:2,dense:``},{default:j(()=>[B(`div`,IV,[V(iV,{modelValue:m.command,"onUpdate:modelValue":t[2]||=e=>m.command=e,label:A(Y)(`common.command`),placeholder:`node`,hint:A(Y)(`addServer.commandHint`),error:c.value===`command`?s.value:null,class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`,`error`])]),V(iV,{modelValue:m.cwd,"onUpdate:modelValue":t[3]||=e=>m.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(TV,{modelValue:m.args,"onUpdate:modelValue":t[4]||=e=>m.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`addServer.argumentsHint`),placeholder:`-p
46
- {port}`},null,8,[`modelValue`,`label`,`hint`]),V(IB,{title:A(Y)(`addServer.portLifecycle`),columns:2,dense:``},{default:j(()=>[V(qB,{modelValue:m.port,"onUpdate:modelValue":t[5]||=e=>m.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,error:_.value,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`error`,`hint`]),V($B,{modelValue:m.bind,"onUpdate:modelValue":t[6]||=e=>m.bind=e,label:A(Y)(`serverForm.bindAddress`),options:[{value:`local`,label:A(Y)(`bind.local`)},{value:`lan`,label:A(Y)(`bind.lan`)}],hint:A(Y)(`addServer.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(sV,{modelValue:m.autostart,"onUpdate:modelValue":t[7]||=e=>m.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:m.persistent,"onUpdate:modelValue":t[8]||=e=>m.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(gV,{title:A(Y)(`addServer.advanced`),hint:A(Y)(`addServer.advancedHint`)},{default:j(()=>[V(IB,{title:A(Y)(`common.environment`),columns:2,dense:``},{default:j(()=>[V(TV,{modelValue:m.env,"onUpdate:modelValue":t[9]||=e=>m.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:m.dataEnvs,"onUpdate:modelValue":t[10]||=e=>m.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(iV,{modelValue:m.envFile,"onUpdate:modelValue":t[11]||=e=>m.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(iV,{modelValue:m.dependsOn,"onUpdate:modelValue":t[12]||=e=>m.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(IB,{title:A(Y)(`addServer.backups`),columns:2,dense:``},{default:j(()=>[V(TV,{modelValue:m.backupPaths,"onUpdate:modelValue":t[13]||=e=>m.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:m.backupIgnoreGenerated,"onUpdate:modelValue":t[14]||=e=>m.backupIgnoreGenerated=e,label:A(Y)(`addServer.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(cV,{restart:m.restart,"onUpdate:restart":t[15]||=e=>m.restart=e,health:m.health,"onUpdate:health":t[16]||=e=>m.health=e,stop:m.stop,"onUpdate:stop":t[17]||=e=>m.stop=e},null,8,[`restart`,`health`,`stop`]),V(IB,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`addServer.bootstrapDescription`),columns:2,dense:``},{default:j(()=>[V(sV,{modelValue:m.bootstrapEnabled,"onUpdate:modelValue":t[18]||=e=>m.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`addServer.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),m.bootstrapEnabled?(L(),R(I,{key:0},[V(iV,{modelValue:m.bootstrapCommand,"onUpdate:modelValue":t[19]||=e=>m.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(qB,{modelValue:m.bootstrapTimeoutMs,"onUpdate:modelValue":t[20]||=e=>m.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(sV,{modelValue:m.bootstrapRunOnce,"onUpdate:modelValue":t[21]||=e=>m.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:m.bootstrapArgs,"onUpdate:modelValue":t[22]||=e=>m.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:m.bootstrapEnv,"onUpdate:modelValue":t[23]||=e=>m.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`addServer.policyResources`),columns:2,dense:``},{default:j(()=>[V($B,{modelValue:m.onPortConflict,"onUpdate:modelValue":t[24]||=e=>m.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(qB,{modelValue:m.logBufferLines,"onUpdate:modelValue":t[25]||=e=>m.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50,hint:A(Y)(`addServer.logBufferHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:m.maxRssMb,"onUpdate:modelValue":t[26]||=e=>m.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:m.enabled,"onUpdate:modelValue":t[27]||=e=>m.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),B(`p`,LV,[V(EV,{k:`addServer.inheritNote`},{settings:j(()=>[B(`span`,RV,O(A(Y)(`addServer.serverDefaults`)),1)]),_:1})])]),_:1},8,[`title`,`hint`]),B(`div`,zV,[B(`p`,BV,O(A(Y)(`addServer.placeholdersTitle`)),1),B(`div`,VV,[(L(),R(I,null,P(d,e=>B(`code`,{key:e,class:`rounded-control border border-line bg-raise px-1.5 py-0.5 font-mono text-2xs text-ink`},O(e),1)),64))])])],544),[[Jc,!u.value]])]),_:1},8,[`open`,`title`,`description`]))}});function UV(e){let t=e.trim().toLowerCase();return t===`localhost`||t===`::1`||t===`[::1]`||t.endsWith(`.localhost`)?!0:/^127(?:\.\d{1,3}){3}$/.test(t)}function WV(e,t){let{url:n,bindHost:r}=e,i=t.trim();if(n===null||r.trim()!==`0.0.0.0`||i===``||UV(i))return n;try{let e=new URL(n),t=i.includes(`:`)&&!i.startsWith(`[`)?`[${i}]`:i,r=e.port.length>0?`:${e.port}`:``,a=e.pathname===`/`?``:e.pathname;return`${e.protocol}//${t}${r}${a}${e.search}${e.hash}`}catch{return n}}function GV(){return globalThis.location?.hostname??``}var KV={class:`text-xs font-semibold text-ink`},qV={class:`mt-1 text-2xs leading-4 text-muted`},JV={class:`mt-2.5 flex justify-end gap-1.5`},YV=N({__name:`KillPortButton`,props:{port:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{variant:`danger-ghost`,size:`xs`,loading:n.busy},{default:j(()=>[H(O(A(Y)(`killPort.trigger`,{port:n.port})),1)]),_:1},8,[`loading`])]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`start`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,KV,O(A(Y)(`killPort.title`,{port:n.port})),1),B(`p`,qV,O(A(Y)(`killPort.body`)),1),B(`div`,JV,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`killPort.confirm`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),XV=[`viewBox`],ZV=[`id`],QV=[`stop-color`],$V=[`stop-color`],eH=[`d`,`fill`],tH=[`d`,`stroke`,`stroke-width`],nH=[`x1`,`x2`,`y2`,`stroke`],rH=[`cx`,`cy`,`fill`],iH={key:0,class:`absolute inset-x-0 top-1/2 border-t border-dashed border-line`},aH=100,oH=N({__name:`Sparkline`,props:Va({values:{},height:{default:34},max:{default:null},min:{default:null},fill:{type:Boolean,default:!0},strokeWidth:{default:1.5},color:{default:void 0},class:{default:void 0},interactive:{type:Boolean,default:!1}},{hoverIndex:{default:null},hoverIndexModifiers:{}}),emits:[`update:hoverIndex`],setup(e){let t=e,n=lo(e,`hoverIndex`),r=fi(),i=k(null),a=W(()=>{let e=t.values.filter(e=>e!==null&&Number.isFinite(e)),n=t.max??(e.length>0?Math.max(...e):1),r=t.min??0;return{bottom:r,ceiling:n===r?r+1:n}}),o=W(()=>{let e=t.values,{bottom:n,ceiling:r}=a.value,i=r-n,o=e.length>1?aH/(e.length-1):aH,s=e=>t.height-(e-n)/i*t.height,c=[],l=[],u=()=>{if(l.length===0)return;let e=l.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(` `),n=l[0],r=`${e} L${l[l.length-1].x.toFixed(2)} ${t.height} L${n.x.toFixed(2)} ${t.height} Z`;c.push({line:e,area:r}),l=[]};return e.forEach((e,t)=>{e===null||!Number.isFinite(e)?u():l.push({x:t*o,y:s(e)})}),u(),c}),s=W(()=>n.value===null||t.values.length<2?null:n.value/(t.values.length-1)*aH),c=W(()=>{let e=n.value;if(e===null)return null;let r=t.values[e];if(r==null||!Number.isFinite(r))return null;let{bottom:i,ceiling:o}=a.value;return t.height-(r-i)/(o-i)*t.height});function l(e){if(!t.interactive||!i.value||t.values.length===0)return;let r=i.value.getBoundingClientRect();if(r.width===0)return;let a=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));n.value=Math.round(a*(t.values.length-1))}function u(){n.value=null}return(e,n)=>(L(),R(`div`,{ref_key:`track`,ref:i,class:D(A(Q)(`relative w-full`,t.class)),style:_e({height:`${t.height}px`}),onMousemove:l,onMouseleave:u},[(L(),R(`svg`,{viewBox:`0 0 ${aH} ${t.height}`,preserveAspectRatio:`none`,class:`block size-full overflow-visible`,role:`img`,"aria-hidden":`true`},[B(`defs`,null,[B(`linearGradient`,{id:A(r),x1:`0`,y1:`0`,x2:`0`,y2:`1`},[B(`stop`,{offset:`0%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0.26`},null,8,QV),B(`stop`,{offset:`100%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0`},null,8,$V)],8,ZV)]),(L(!0),R(I,null,P(o.value,(e,n)=>(L(),R(I,{key:n},[t.fill?(L(),R(`path`,{key:0,d:e.area,fill:`url(#${A(r)})`,stroke:`none`},null,8,eH)):U(``,!0),B(`path`,{d:e.line,fill:`none`,stroke:t.color??`currentColor`,"stroke-width":t.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,tH)],64))),128)),s.value===null?U(``,!0):(L(),R(`line`,{key:0,x1:s.value,x2:s.value,y1:`0`,y2:t.height,stroke:t.color??`currentColor`,"stroke-width":`1`,"stroke-dasharray":`2 2`,"vector-effect":`non-scaling-stroke`,opacity:`0.5`},null,8,nH)),s.value!==null&&c.value!==null?(L(),R(`circle`,{key:1,cx:s.value,cy:c.value,r:`2`,fill:t.color??`currentColor`,"vector-effect":`non-scaling-stroke`},null,8,rH)):U(``,!0)],8,XV)),o.value.length===0?(L(),R(`div`,iH)):U(``,!0)],38))}}),sH={class:`min-w-0`},cH={class:`flex items-baseline justify-between gap-2`},lH={class:`truncate text-2xs font-medium text-faint`},uH={class:`flex shrink-0 items-baseline gap-1.5`},dH={key:0,class:`font-mono text-2xs text-faint`},fH=N({__name:`MetricSpark`,props:{label:{},values:{},format:{},max:{default:null},colorClass:{default:`text-accent`},height:{default:30},sampleMs:{default:5e3},emptyHint:{default:void 0}},setup(e){let t=e,n=k(null),r=W(()=>kF(t.values)),i=W(()=>t.values.some(e=>e!==null)),a=W(()=>{let e=n.value;return e!==null&&t.values[e]!==void 0?t.values[e]??null:r.value}),o=W(()=>{let e=n.value;if(e===null)return null;let r=t.values.length-1-e;if(r<=0)return null;let i=Math.round(r*t.sampleMs/1e3);return i<60?`−${i}s`:`−${Math.round(i/60)}m`});return(e,r)=>(L(),R(`div`,sH,[B(`div`,cH,[B(`span`,lH,O(t.label),1),B(`span`,uH,[o.value?(L(),R(`span`,dH,O(o.value),1)):U(``,!0),B(`span`,{class:D(A(Q)(`font-mono text-xs font-medium tabular-nums`,i.value?`text-ink`:`text-faint`))},O(i.value?t.format(a.value):t.emptyHint??A(Y)(`metric.emptyHint`)),3)])]),V(oH,{"hover-index":n.value,"onUpdate:hoverIndex":r[0]||=e=>n.value=e,values:t.values,height:t.height,max:t.max,interactive:``,class:D(A(Q)(`mt-1`,t.colorClass))},null,8,[`hover-index`,`values`,`height`,`max`,`class`])]))}}),pH={class:`inline-flex flex-wrap items-center gap-1.5`},mH={class:`relative flex size-1.5`},hH={key:0,class:`absolute inset-0 rounded-full bg-current opacity-60`,style:{animation:`hh-pulse-ring 1.6s ease-out infinite`}},gH=N({__name:`StatusPill`,props:{status:{},health:{default:null},showHealth:{type:Boolean,default:!0}},setup(e){let t=e,n=W(()=>GL[t.status]),r=W(()=>t.health?KL[t.health]:null),i=W(()=>t.showHealth&&r.value!==null&&t.health!==`disabled`&&t.health!==`unknown`&&(r.value.tone===`danger`||r.value.tone===`warn`)),a=W(()=>n.value.transitional);return(e,t)=>(L(),R(`span`,pH,[B(`span`,{class:D(A(Q)(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(JL)[n.value.tone]))},[B(`span`,mH,[a.value?(L(),R(`span`,hH)):U(``,!0),B(`span`,{class:D(A(Q)(`relative size-1.5 rounded-full`,A(YL)[n.value.tone]))},null,2)]),H(` `+O(A(Y)(n.value.labelKey)),1)],2),i.value&&r.value?(L(),R(`span`,{key:0,class:D(A(Q)(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(JL)[r.value.tone]))},O(A(Y)(r.value.labelKey)),3)):U(``,!0)]))}}),_H=N({__name:`Tip`,props:{label:{},side:{default:`top`},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),z(A(kg),{"delay-duration":350},{default:j(()=>[V(A(Pg),{"as-child":``},{default:j(()=>[F(t.$slots,`default`)]),_:3}),e.disabled?U(``,!0):(L(),z(A(Ng),{key:0},{default:j(()=>[V(A(Mg),{side:e.side,"side-offset":6,class:`z-50 max-w-64 rounded-control border border-line bg-raise px-2 py-1 text-2xs text-ink shadow-float data-[state=delayed-open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[H(O(e.label),1)]),_:1},8,[`side`])]),_:1}))]),_:3}))}}),vH={class:`flex items-start justify-between gap-3 px-4 pb-2.5 pt-3.5`},yH={class:`min-w-0`},bH={class:`flex items-center gap-2`},xH=[`href`,`title`,`aria-label`],SH={class:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-2xs text-faint`},CH={class:`text-muted`},wH={key:1,class:`rounded bg-hover px-1 py-px text-muted`},TH={key:2,class:`rounded bg-accent-soft px-1 py-px text-accent`},EH={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},DH={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},OH=[`title`],kH={key:0,class:`space-y-2.5 border-y border-line-soft px-4 py-3`},AH={class:`grid grid-cols-2 gap-x-4 gap-y-2`},jH={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pt-2.5`},MH={class:`text-muted`},NH={class:`text-faint`},PH={key:2,class:`flex flex-col gap-1 px-4 pt-2.5`},FH={key:0,class:`flex items-start gap-1.5 text-2xs leading-4 text-danger`},IH={class:`min-w-0 break-words`},LH={key:2,class:`text-2xs leading-4 text-warn`},RH={key:3,class:`text-2xs leading-4 text-warn`},zH={class:`grid grid-cols-2 gap-x-4 gap-y-1 px-4 py-3 sm:grid-cols-4`},BH={class:`truncate text-2xs text-faint`},VH={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},HH={class:`mt-auto flex flex-wrap items-center gap-1.5 border-t border-line-soft px-4 py-2.5`},UH={class:`grid grid-cols-2 gap-2 text-xs`},WH={class:`text-faint`},GH={class:`font-mono text-ink`},KH={class:`text-faint`},qH={class:`text-ink capitalize`},JH=N({__name:`ServerCard`,props:{server:{},workspaceId:{},series:{},now:{},variant:{default:`default`}},setup(e){let t=e,n={start:Py,exit:Jy,crash:iy,"forced-restart":zy,unhealthy:eb,recovered:ay},r=tI(),i=gI(),a=k(!1),o=k(!1),s=W(()=>t.server.config),c=W(()=>s.value.label&&s.value.label.length>0?s.value.label:t.server.id),l=W(()=>`${s.value.command} ${s.value.args.join(` `)}`.trim()),u=W(()=>XL(t.server.status,t.server.health)),d=W(()=>WV(t.server,GV())),f=W(()=>t.server.status===`running`),p=W(()=>s.value.enabled&&[`stopped`,`crashed`,`conflict`].includes(t.server.status)),m=W(()=>[`running`,`starting`,`backoff`].includes(t.server.status)),h=W(()=>t.server.startedAt===null||!f.value?`—`:NR(t.now-t.server.startedAt)),g=W(()=>t.server.nextRetryAt===null?null:PR(t.server.nextRetryAt,t.now)),_=W(()=>t.server.health!==`unhealthy`||t.server.unhealthySince===null?null:NR(t.now-t.server.unhealthySince)),v=W(()=>t.series?.cpu??[]),y=W(()=>t.series?.rss??[]),b=W(()=>t.series?.probe??[]),x=W(()=>Math.max(100,(r.host.value?.cpus??1)*100)),S=W(()=>[...t.server.history.events].slice(-3).reverse()),C={unknown:`common.unknown`,free:`serverCard.portFree`,"in-use":`serverCard.portInUse`},w=W(()=>{let e=t.server,n=CF(e),r=[{key:`pid`,label:Y(`serverCard.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:h.value},{key:`restarts`,label:Y(`serverCard.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`port`,label:Y(`common.port`),value:Y(C[e.portState]??`common.unknown`)},{key:`uptime24`,label:Y(`serverCard.uptime24h`),value:gR(e.history.uptimeRatio)},{key:`probe`,label:Y(`serverCard.probe`),value:n.responseMs===null?`—`:`${n.responseMs} ms`},{key:`rss`,label:Y(`serverCard.rss`),value:zR(n.rssBytes)},{key:`procs`,label:Y(`serverCard.procs`),value:n.processes===null?`—`:String(n.processes)}];return e.history.crashes>0&&r.splice(5,0,{key:`crashes`,label:Y(`serverCard.crashes24h`),value:String(e.history.crashes)}),e.history.lastCrashAt!==null&&r.push({key:`lastcrash`,label:Y(`serverCard.lastCrash`),value:FR(e.history.lastCrashAt,t.now)}),r});async function T(e){a.value=!0;try{await r[e](t.workspaceId,t.server.id)}finally{a.value=!1}}async function ee(){a.value=!0;try{await r.freePort(t.workspaceId,t.server.id)}finally{a.value=!1}}async function te(e){let n=!(e===`enabled`?s.value.enabled:s.value.autostart);e===`enabled`?await r.setEnabled(t.workspaceId,t.server.id,n):await r.setAutostart(t.workspaceId,t.server.id,n)}async function ne(){o.value=!1,await r.remove(t.workspaceId,t.server.id)}let re=W(()=>D2(t.workspaceId,`servers`,t.server.id));function ie(){i.select(t.workspaceId)}return(i,h)=>{let C=ha(`RouterLink`);return L(),R(`article`,{class:D(A(Q)(`group relative flex flex-col rounded-panel border bg-panel shadow-card transition-colors duration-150`,`hover:border-line/90`,t.server.status===`crashed`||t.server.status===`conflict`?`border-danger/30`:`border-line`,!s.value.enabled&&`opacity-70`))},[B(`span`,{class:D(A(Q)(`absolute inset-y-3 left-0 w-0.5 rounded-full`,{"bg-ok":u.value===`ok`,"bg-warn":u.value===`warn`,"bg-danger":u.value===`danger`,"bg-faint/50":u.value===`neutral`,"bg-accent":u.value===`accent`||u.value===`info`}))},null,2),B(`header`,vH,[B(`div`,yH,[B(`div`,bH,[V(C,{to:re.value,class:`truncate text-sm font-semibold tracking-tight text-ink hover:text-accent`,onClick:ie},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`to`]),d.value?(L(),R(`a`,{key:0,href:d.value,target:`_blank`,rel:`noreferrer`,class:`-my-1 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-accent`,title:d.value,"aria-label":A(Y)(`serverCard.open`,{url:d.value})},[V(A(my),{class:`size-3.5`})],8,xH)):U(``,!0)]),B(`p`,SH,[B(`span`,null,O(e.server.id),1),s.value.port===null?U(``,!0):(L(),R(I,{key:0},[h[9]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,CH,`:`+O(s.value.port),1)],64)),h[10]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(e.server.bindHost),1),s.value.enabled?U(``,!0):(L(),R(`span`,wH,O(A(Y)(`serverCard.disabled`)),1)),s.value.autostart?(L(),R(`span`,TH,O(A(Y)(`serverCard.autostart`)),1)):U(``,!0)])]),V(gH,{status:e.server.status,health:e.server.health},null,8,[`status`,`health`]),e.server.adopted?(L(),z(_H,{key:0,label:A(Y)(`serverCard.adoptedHint`)},{default:j(()=>[B(`span`,EH,O(A(Y)(`serverCard.detached`)),1)]),_:1},8,[`label`])):U(``,!0),s.value.persistent?(L(),z(_H,{key:1,label:A(Y)(`serverCard.persistentHint`)},{default:j(()=>[B(`span`,DH,O(A(Y)(`serverCard.persistent`)),1)]),_:1},8,[`label`])):U(``,!0)]),B(`p`,{class:`truncate px-4 pb-3 font-mono text-2xs text-muted`,title:l.value},O(l.value),9,OH),t.variant===`compact`?U(``,!0):(L(),R(`div`,kH,[B(`div`,AH,[V(fH,{label:A(Y)(`common.cpu`),values:v.value,format:A(BR),max:x.value,"empty-hint":f.value?void 0:A(Y)(`metric.notRunning`),"color-class":`text-cpu`},null,8,[`label`,`values`,`format`,`max`,`empty-hint`]),V(fH,{label:A(Y)(`common.memory`),values:y.value,format:A(zR),"empty-hint":f.value?void 0:A(Y)(`metric.notRunning`),"color-class":`text-mem`},null,8,[`label`,`values`,`format`,`empty-hint`])]),V(fH,{label:A(Y)(`serverCard.healthProbe`),values:b.value,format:e=>e===null?`—`:`${e} ms`,height:22,"color-class":`text-probe`,"empty-hint":A(Y)(`serverCard.notProbed`)},null,8,[`label`,`values`,`format`,`empty-hint`])])),S.value.length>0?(L(),R(`div`,jH,[(L(!0),R(I,null,P(S.value,e=>(L(),R(`span`,{key:`${e.ts}`,class:`inline-flex items-center gap-1 text-2xs`},[(L(),z(_a(n[e.type]),{class:D(A(Q)(`size-3`,A(qL)[A(QL)[e.type]]))},null,8,[`class`])),B(`span`,MH,O(A(Y)(A(ZL)[e.type])),1),B(`span`,NH,O(A(FR)(e.ts,t.now)),1)]))),128))])):U(``,!0),e.server.lastError||_.value||g.value?(L(),R(`div`,PH,[e.server.lastError?(L(),R(`p`,FH,[V(A(iy),{class:`mt-0.5 size-3 shrink-0`}),B(`span`,IH,O(e.server.lastError),1)])):U(``,!0),e.server.status===`conflict`&&s.value.port!==null?(L(),z(YV,{key:1,port:s.value.port,busy:a.value,class:`self-start`,onConfirm:ee},null,8,[`port`,`busy`])):U(``,!0),_.value?(L(),R(`p`,LH,O(A(Y)(`serverCard.unhealthyFor`,{duration:_.value})),1)):U(``,!0),g.value?(L(),R(`p`,RH,O(A(Y)(`serverCard.nextAttempt`,{when:g.value})),1)):U(``,!0)])):U(``,!0),B(`dl`,zH,[(L(!0),R(I,null,P(w.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,BH,O(e.label),1),B(`dd`,VH,O(e.value),1)]))),128))]),B(`div`,HH,[V($,{variant:`primary`,size:`xs`,disabled:a.value||!p.value,onClick:h[0]||=e=>T(`start`)},{default:j(()=>[V(A(Py),{class:`size-3`}),H(O(A(Y)(`serverCard.start`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!m.value,onClick:h[1]||=e=>T(`stop`)},{default:j(()=>[V(A(Jy),{class:`size-3`}),H(O(A(Y)(`serverCard.stop`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!s.value.enabled,onClick:h[2]||=e=>T(`restart`)},{default:j(()=>[V(A(zy),{class:`size-3`}),H(O(A(Y)(`serverCard.restart`)),1)]),_:1},8,[`disabled`]),V(_H,{label:A(Y)(`serverCard.detailsHint`)},{default:j(()=>[V(C,{to:re.value,onClick:ie},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[V(A(By),{class:`size-3`}),H(O(A(Y)(`common.details`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`label`]),V(A(pg),null,{default:j(()=>[V(A(vg),{"as-child":``},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,class:`ml-auto`,"aria-label":A(Y)(`serverCard.moreActions`,{label:c.value})},{default:j(()=>[V(A(py),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(gg),null,{default:j(()=>[V(A(mg),{"side-offset":4,align:`end`,class:`z-50 min-w-52 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:h[3]||=e=>te(`enabled`)},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(s.value.enabled?A(Y)(`serverCard.disable`):A(Y)(`serverCard.enable`)),1)]),_:1}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:h[4]||=e=>te(`autostart`)},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(` `+O(s.value.autostart?A(Y)(`serverCard.removeFromAutostart`):A(Y)(`serverCard.autostartWithPanel`)),1)]),_:1}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:h[5]||=t=>A(r).clearLogs(e.workspaceId,e.server.id)},{default:j(()=>[V(A(By),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.clearLogBuffer`)),1)]),_:1}),V(A(_g),{class:`my-1 h-px bg-line`}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:h[6]||=e=>o.value=!0},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),V(xV,{open:o.value,"onUpdate:open":h[8]||=e=>o.value=e,title:A(Y)(`serverCard.removeTitle`),description:A(Y)(`serverCard.removeDescription`,{label:c.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:h[7]||=e=>o.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ne},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`dl`,UH,[B(`div`,null,[B(`dt`,WH,O(A(Y)(`serverCard.idField`)),1),B(`dd`,GH,O(e.server.id),1)]),B(`div`,null,[B(`dt`,KH,O(A(Y)(`serverCard.statusField`)),1),B(`dd`,qH,O(e.server.status),1)])])]),_:1},8,[`open`,`title`,`description`])],2)}}}),YH={class:`flex flex-wrap items-start justify-between gap-3`},XH={class:`min-w-0`},ZH={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},QH={class:`text-2xl font-semibold tracking-tight text-ink`},$H={key:1,class:`mt-1 max-w-2xl text-xs leading-relaxed text-muted`},eU={class:`flex min-w-0 flex-wrap items-center gap-2`},tU=N({__name:`PageHeader`,props:{title:{},description:{default:void 0},backTo:{default:void 0},backLabel:{default:`Back`}},setup(e){return(e,t)=>{let n=ha(`RouterLink`);return L(),R(`header`,YH,[B(`div`,XH,[e.$props.backTo?(L(),z(n,{key:0,to:e.$props.backTo,class:`mb-1 inline-flex items-center gap-1 text-2xs text-muted transition-colors duration-150 hover:text-ink`},{default:j(()=>[V(A(ey),{class:`size-3`}),H(` `+O(e.$props.backLabel),1)]),_:1},8,[`to`])):U(``,!0),B(`div`,ZH,[B(`h1`,QH,O(e.$props.title),1),F(e.$slots,`badges`)]),e.$props.description?(L(),R(`p`,$H,O(e.$props.description),1)):U(``,!0)]),B(`div`,eU,[F(e.$slots,`actions`)])])}}}),nU={key:0,class:`mb-3 flex items-start justify-between gap-3`},rU={class:`min-w-0`},iU={class:`flex shrink-0 items-center gap-1.5`},aU=N({__name:`Panel`,props:{padded:{type:Boolean,default:!0},class:{}},setup(e){return(e,t)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel shadow-card`,e.$props.padded&&`p-4`,e.$props.class))},[e.$slots.header||e.$slots.actions?(L(),R(`header`,nU,[B(`div`,rU,[F(e.$slots,`header`)]),B(`div`,iU,[F(e.$slots,`actions`)])])):U(``,!0),F(e.$slots,`default`)],2))}}),oU=N({__name:`Skeleton`,props:{class:{default:`h-4 w-24`},rounded:{default:`rounded`}},setup(e){return(t,n)=>(L(),R(`span`,{class:D(A(Q)(`block animate-pulse bg-line-soft`,e.rounded,t.$props.class)),style:{"animation-duration":`1.4s`},"aria-hidden":`true`},null,2))}}),sU={class:`min-w-0`},cU={class:`truncate text-2xs font-medium text-faint`},lU={key:0,class:`mt-0.5 truncate text-2xs text-muted`},uU=N({__name:`StatTile`,props:{label:{},value:{},hint:{default:void 0},tone:{default:`neutral`},mono:{type:Boolean,default:!0}},setup(e){return(e,t)=>(L(),R(`div`,sU,[B(`p`,cU,O(e.$props.label),1),B(`p`,{class:D(A(Q)(`mt-0.5 truncate text-xl font-semibold tracking-tight`,e.$props.mono&&`font-mono tabular-nums`,e.$props.tone===`neutral`?`text-ink`:A(qL)[e.$props.tone]))},O(e.$props.value),3),e.$props.hint?(L(),R(`p`,lU,O(e.$props.hint),1)):U(``,!0)]))}}),dU=k(null),fU=k(`unknown`),pU=null;async function mU(){try{let e=await(await fetch(`/healthz`,{cache:`no-store`})).json();typeof e.uptimeMs==`number`&&(dU.value=Date.now()-e.uptimeMs),fU.value=e.status===`degraded`?`degraded`:`ok`}catch{fU.value=`unknown`}}function hU(){return pU??=mU().finally(()=>{pU=null}),{startedAt:dU,status:fU,refresh:mU}}var gU={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},_U={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},vU={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},yU={class:`p-4`},bU={class:`p-4`},xU={class:`p-4`},SU={class:`p-4`},CU={class:`p-4`},wU={key:2,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},TU={class:`min-w-0`},EU={class:`text-xs font-medium text-danger`},DU={class:`mt-0.5 flex flex-wrap gap-x-3 gap-y-1 text-2xs text-danger`},OU=[`onClick`],kU={class:`grid grid-cols-1 gap-4 lg:grid-cols-3`},AU={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},jU={class:`text-2xs text-muted`},MU={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},NU={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},PU={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},FU={class:`font-mono text-2xs font-normal text-faint`},IU={class:`text-2xs text-muted`},LU={class:`ml-auto flex items-center gap-1.5`},RU={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-3 py-2 text-2xs leading-4 text-danger`},zU={key:2,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},BU={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},VU={class:`font-mono`},HU=N({__name:`GlobalOverviewView`,setup(e){let t=tI(),n=gI(),r=hU(),i=Qg(),a=k(!1),o=k(``),s=W(()=>t.appState.value===null),c=W(()=>t.workspaces.value),l=W(()=>t.allServers.value.map(e=>e.server)),u=W(()=>l.value.filter(e=>e.status===`running`)),d=W(()=>l.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),f=W(()=>t.host.value),p=W(()=>r.startedAt.value===null?`—`:NR(t.now.value-r.startedAt.value)),m=W(()=>f.value?.enabled?NR(f.value.uptimeMs):`—`),h=W(()=>c.value[0]?.id??n.activeId.value);function g(e){o.value=e,a.value=!0}function _(e,t){n.select(e),i.push(D2(e,`servers`,t))}return ia(async()=>{await r.refresh()}),(e,v)=>(L(),R(`div`,gU,[V(tU,{title:A(Y)(`nav.globalOverview`),description:A(Y)(`views.globalOverview.description`)},null,8,[`title`,`description`]),!s.value&&l.value.length===0?(L(),z(hR,{key:0,title:A(Y)(`views.globalOverview.emptyTitle`),description:A(Y)(`views.globalOverview.emptyDescription`)},{icon:j(()=>[V(A(Hy),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:v[0]||=e=>g(h.value)},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):U(``,!0),l.value.length>0||s.value?(L(),z(aU,{key:1,class:`p-0`},{default:j(()=>[s.value?(L(),R(`div`,_U,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(oU,{class:`h-2.5 w-16`}),V(oU,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,vU,[B(`div`,yU,[V(uU,{label:A(Y)(`views.globalOverview.workspaces`),value:String(c.value.length),hint:A(bF)(`views.globalOverview.serversTotal`,l.value.length)},null,8,[`label`,`value`,`hint`])]),B(`div`,bU,[V(uU,{label:A(Y)(`views.overview.running`),value:`${u.value.length}/${l.value.length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:l.value.length-u.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,xU,[V(uU,{label:A(Y)(`views.overview.needsAttention`),value:String(d.value.length),tone:d.value.length>0?`danger`:`ok`,hint:d.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,SU,[V(uU,{label:A(Y)(`views.globalOverview.panelUptime`),value:p.value,hint:A(r).status.value===`degraded`?A(Y)(`views.globalOverview.degraded`):A(Y)(`views.globalOverview.serving`)},null,8,[`label`,`value`,`hint`])]),B(`div`,CU,[V(uU,{label:A(Y)(`views.globalOverview.hostUptime`),value:m.value,hint:f.value?.enabled?A(Y)(`views.globalOverview.samplingOn`):A(Y)(`views.globalOverview.samplingOff`)},null,8,[`label`,`value`,`hint`])])]))]),_:1})):U(``,!0),d.value.length>0?(L(),R(`div`,wU,[V(A(iy),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,TU,[B(`p`,EU,O(A(bF)(`views.globalOverview.needLook`,d.value.length)),1),B(`p`,DU,[(L(!0),R(I,null,P(A(t).allServers.value.filter(e=>e.server.status===`crashed`||e.server.status===`conflict`||e.server.health===`unhealthy`),e=>(L(),R(`button`,{key:`${e.workspace.id}:${e.server.id}`,type:`button`,class:`font-mono underline decoration-danger/40 underline-offset-2 hover:decoration-danger`,onClick:t=>_(e.workspace.id,e.server.id)},O(e.workspace.label)+`/`+O(e.server.id),9,OU))),128))])])])):U(``,!0),B(`div`,kU,[V(aU,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,AU,[V(A(dy),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.globalOverview.hostVitals`)),1)]),B(`p`,jU,O(A(Y)(`views.globalOverview.hostVitalsNote`)),1)]),default:j(()=>[V(sz,{host:f.value,now:A(t).now.value},null,8,[`host`,`now`])]),_:1}),V(aU,null,{header:j(()=>[B(`h2`,MU,[V(A(Jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),default:j(()=>[V(gz,{servers:l.value,now:A(t).now.value,limit:12,qualify:``},null,8,[`servers`,`now`])]),_:1})]),(L(!0),R(I,null,P(c.value,e=>(L(),R(`section`,{key:e.id,class:`space-y-3`},[B(`div`,NU,[B(`h2`,PU,[V(A(Sy),{class:`size-3.5 text-faint`}),H(` `+O(e.label)+` `,1),B(`span`,FU,O(e.id),1)]),B(`span`,IU,O(A(Y)(`views.globalOverview.groupRunning`,{running:e.runningCount,total:e.serverCount})),1),B(`div`,LU,[V($,{size:`xs`,variant:`ghost`,onClick:t=>g(e.id)},{default:j(()=>[V(A(Fy),{class:`size-3`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`ghost`,onClick:t=>{A(n).select(e.id),A(i).push(A(D2)(e.id,`overview`))}},{default:j(()=>[H(O(A(Y)(`views.globalOverview.openWorkspace`)),1)]),_:1},8,[`onClick`])])]),e.configError?(L(),R(`p`,RU,O(A(Y)(`views.globalOverview.configError`,{error:e.configError})),1)):U(``,!0),e.servers.length===0?(L(),z(hR,{key:1,compact:``,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.globalOverview.groupEmptyDescription`)},{action:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t=>g(e.id)},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1},8,[`onClick`])]),_:2},1032,[`title`,`description`])):(L(),R(`div`,zU,[(L(!0),R(I,null,P(e.servers,n=>(L(),z(JH,{key:n.id,server:n,"workspace-id":e.id,series:A(t).seriesOf(e.id,n.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]))),128)),B(`p`,BU,[B(`span`,null,O(A(Y)(`views.overview.sampling`)),1),B(`span`,VU,O(A(t).appState.value?.control.url),1)]),V(HV,{open:a.value,"onUpdate:open":v[1]||=e=>a.value=e,"workspace-id":o.value},null,8,[`open`,`workspace-id`])]))}}),UU={class:`text-xs font-semibold text-ink`},WU={key:0,class:`mt-1 text-2xs leading-4 text-muted`},GU={class:`mt-2.5 flex justify-end gap-1.5`},KU=N({__name:`ConfirmButton`,props:{label:{},confirmLabel:{default:void 0},variant:{default:`danger-ghost`},confirmVariant:{default:`danger`},size:{default:`sm`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{default:void 0},hint:{default:void 0},alternativeLabel:{default:void 0}},emits:[`confirm`,`alternative`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=W(()=>n.confirmLabel??Y(`common.confirm`)),o=W(()=>n.title??Y(`common.confirmQuestion`,{label:a.value}));function s(){i.value=!1,r(`confirm`)}function c(){i.value=!1,r(`alternative`)}return(e,t)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{variant:n.variant,size:n.size,disabled:n.disabled,loading:n.loading},{default:j(()=>[H(O(n.label),1)]),_:1},8,[`variant`,`size`,`disabled`,`loading`])]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,UU,O(o.value),1),n.hint?(L(),R(`p`,WU,O(n.hint),1)):U(``,!0),B(`div`,GU,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`ghost`,loading:n.loading,onClick:s},{default:j(()=>[H(O(a.value),1)]),_:1},8,[`loading`]),n.alternativeLabel?(L(),z($,{key:0,size:`xs`,variant:n.confirmVariant,loading:n.loading,onClick:c},{default:j(()=>[H(O(n.alternativeLabel),1)]),_:1},8,[`variant`,`loading`])):U(``,!0)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),qU={class:`min-w-0 flex-1`},JU={key:0,class:`text-xs font-semibold`},YU=N({__name:`Notice`,props:{tone:{default:`info`},title:{default:void 0},class:{default:void 0}},setup(e){let t=e,n={ok:ay,warn:eb,danger:jy,info:by,neutral:by,accent:Wy},r=W(()=>n[t.tone]);return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex items-start gap-2 rounded-panel border px-3 py-2`,A(JL)[t.tone],t.class))},[(L(),z(_a(r.value),{class:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`})),B(`div`,qU,[t.title?(L(),R(`p`,JU,O(t.title),1)):U(``,!0),B(`div`,{class:D(A(Q)(`text-xs leading-relaxed text-ink/85`,t.title&&`mt-0.5`))},[F(e.$slots,`default`)],2)])],2))}}),XU={class:`space-y-2`},ZU={key:2,class:`mt-1`},QU={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},$U=N({__name:`AuthenticationSection`,props:Va({view:{},dirty:{type:Boolean}},{auth:{required:!0},authModifiers:{}}),emits:Va([`reset`],[`update:auth`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`auth`),a=gB(()=>i.value.sessionTtlMs,e=>i.value.sessionTtlMs=e,6048e5),o=_B(()=>i.value.maxLoginAttempts,e=>i.value.maxLoginAttempts=e,5),s=gB(()=>i.value.lockoutMs,e=>i.value.lockoutMs=e,6e4),c=W(()=>n.view?.auth.passwordSet===!0),l=W(()=>n.view?.auth.apiTokenSet===!0),u=W(()=>n.view?.auth.blockedReason??null),d=W(()=>n.view?.auth.exposed===!0),f=W(()=>n.view?.auth.usingDefaultPassword===!0),p=W(()=>i.value.enabled&&!c.value),{setPassword:m,clearPassword:h}=sP(),g=k(``),_=k(``),v=k(``),y=k(null),b=k(null),x=k(!1),S=W(()=>v.value.length>0&&v.value!==_.value),C=W(()=>_.value.length>0&&_.value.length<8),w=W(()=>_.value.length>0&&!S.value&&(!c.value||g.value.length>0));async function T(){if(w.value&&!x.value){x.value=!0,b.value=null,y.value=null;try{let e=await m(c.value?g.value:void 0,_.value);if(e!==null){b.value=e;return}g.value=``,_.value=``,v.value=``,y.value=Y(`settings.auth.passwordUpdated`)}finally{x.value=!1}}}async function ee(){b.value=null,y.value=null;let e=await h();e===null?y.value=Y(`settings.auth.passwordCleared`):b.value=e}return(e,t)=>(L(),R(I,null,[V(IB,{title:A(Y)(`settings.auth.policyTitle`),description:A(Y)(`settings.auth.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(sV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.auth.requirePassword`),hint:A(Y)(`settings.auth.requirePasswordHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.auth.sessionLifetime`),min:60,hint:A(Y)(`settings.auth.sessionLifetimeHint`)},null,8,[`modelValue`,`label`,`hint`]),V($B,{modelValue:i.value.cookieSecure,"onUpdate:modelValue":t[3]||=e=>i.value.cookieSecure=e,label:A(Y)(`settings.auth.cookieSecure`),options:[{value:`auto`,label:A(Y)(`settings.auth.cookieSecureAuto`)},{value:`always`,label:A(Y)(`settings.auth.cookieSecureAlways`)},{value:`never`,label:A(Y)(`settings.auth.cookieSecureNever`)}]},null,8,[`modelValue`,`label`,`options`]),V($B,{modelValue:i.value.trustProxy,"onUpdate:modelValue":t[4]||=e=>i.value.trustProxy=e,label:A(Y)(`settings.auth.trustProxy`),options:[{value:`off`,label:A(Y)(`settings.auth.trustProxyOff`)},{value:`loopback`,label:A(Y)(`settings.auth.trustProxyLoopback`)},{value:`any`,label:A(Y)(`settings.auth.trustProxyAny`)}],hint:A(Y)(`settings.auth.trustProxyHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`options`,`hint`]),V(qB,{modelValue:A(o),"onUpdate:modelValue":t[5]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.auth.maxLoginAttempts`),min:1,hint:A(Y)(`settings.auth.maxLoginAttemptsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(s),"onUpdate:modelValue":t[6]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.auth.lockout`),min:1},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),B(`div`,XU,[V(YU,{tone:l.value?`info`:`neutral`,title:l.value?A(Y)(`settings.auth.apiTokenSet`):A(Y)(`settings.auth.apiTokenMissing`)},{default:j(()=>[l.value?(L(),z(EV,{key:0,k:`settings.auth.apiTokenNote`},{code:j(()=>[...t[10]||=[B(`code`,null,`Authorization: Bearer …`,-1)]]),_:1})):(L(),z(EV,{key:1,k:`settings.auth.noTokenNote`},{command:j(()=>[...t[11]||=[B(`code`,null,`home-hosted set-token --generate`,-1)]]),_:1})),l.value?(L(),R(`p`,ZU,[V(EV,{k:`settings.auth.apiTokenRotation`},{command:j(()=>[...t[12]||=[B(`code`,null,`home-hosted set-token --generate`,-1)]]),_:1})])):U(``,!0)]),_:1},8,[`tone`,`title`]),f.value?(L(),z(YU,{key:0,tone:`warn`,title:A(Y)(`settings.auth.defaultPasswordTitle`)},{default:j(()=>[V(EV,{k:`settings.auth.defaultPasswordText`},{address:j(()=>[...t[13]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):U(``,!0),u.value?(L(),z(YU,{key:1,tone:`danger`,title:A(Y)(`settings.auth.blockedTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):p.value?(L(),z(YU,{key:2,tone:`warn`,title:A(Y)(`settings.auth.noPasswordTitle`)},{default:j(()=>[V(EV,{k:`settings.auth.noPasswordText`},{address:j(()=>[...t[14]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):d.value?(L(),z(YU,{key:3,tone:`warn`,title:A(Y)(`settings.auth.exposedTitle`)},{default:j(()=>[H(O(A(Y)(`settings.auth.exposedText`)),1)]),_:1},8,[`title`])):U(``,!0)]),B(`form`,{class:`mt-3`,onSubmit:_u(T,[`prevent`])},[V(IB,{title:c.value?A(Y)(`settings.auth.changePassword`):A(Y)(`settings.auth.setPassword`),description:A(Y)(`settings.auth.passwordDescription`)},{default:j(()=>[c.value?(L(),z(iV,{key:0,modelValue:g.value,"onUpdate:modelValue":t[7]||=e=>g.value=e,type:`password`,autocomplete:`current-password`,label:A(Y)(`settings.auth.currentPassword`)},null,8,[`modelValue`,`label`])):U(``,!0),V(iV,{modelValue:_.value,"onUpdate:modelValue":t[8]||=e=>_.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.newPassword`)},null,8,[`modelValue`,`label`]),V(iV,{modelValue:v.value,"onUpdate:modelValue":t[9]||=e=>v.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.repeatPassword`),error:S.value?A(Y)(`settings.auth.passwordMismatch`):null},null,8,[`modelValue`,`label`,`error`]),B(`div`,QU,[V($,{type:`submit`,variant:`primary`,disabled:!w.value,loading:x.value},{default:j(()=>[H(O(c.value?A(Y)(`settings.auth.updatePassword`):A(Y)(`settings.auth.setPasswordAndEnable`)),1)]),_:1},8,[`disabled`,`loading`]),c.value?(L(),z(KU,{key:0,label:A(Y)(`settings.auth.clearPassword`),"confirm-label":A(Y)(`settings.auth.clearPasswordConfirm`),"confirm-variant":`danger`,title:A(Y)(`settings.auth.clearPasswordTitle`),hint:A(Y)(`settings.auth.clearPasswordHint`),disabled:x.value,onConfirm:ee},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),C.value||b.value||y.value?(L(),R(I,{key:1},[C.value?(L(),z(YU,{key:0,tone:`warn`,title:A(Y)(`settings.auth.shortPasswordTitle`),class:`sm:col-span-2`},{default:j(()=>[H(O(A(Y)(`settings.auth.shortPasswordText`)),1)]),_:1},8,[`title`])):U(``,!0),b.value?(L(),z(YU,{key:1,tone:`danger`,class:`sm:col-span-2`},{default:j(()=>[H(O(b.value),1)]),_:1})):U(``,!0),y.value?(L(),z(YU,{key:2,tone:`ok`,class:`sm:col-span-2`},{default:j(()=>[H(O(y.value),1)]),_:1})):U(``,!0)],64)):U(``,!0)]),_:1},8,[`title`,`description`])],32)],64))}});function eW(e){return e.labelKey===void 0?e.label:Y(e.labelKey,e.labelParams,e.label)}function tW(e){return e.note===null?null:e.noteKey===void 0?e.note:Y(e.noteKey,e.noteParams,e.note)}var nW={settings:`settings.backups.kindSettings`,servers:`settings.backups.kindServers`,secrets:`settings.backups.kindSecrets`,tls:`settings.backups.kindTls`,data:`settings.backups.kindData`,workspace:`settings.backups.kindWorkspace`};function rW(e){let t=nW[e];return t===void 0?e:Y(t)}var iW={password:`settings.backup.secretPasswordHint`,apiToken:`settings.backup.secretApiTokenHint`,telegram:`settings.backup.secretTelegramHint`,ddns:`settings.backup.secretDdnsHint`};function aW(e){let t=tW(e);if(t!==null&&t.length>0)return t;if(e.kind===`settings`)return Y(`settings.backup.leafSettingsHint`);if(e.kind===`servers`)return Y(`settings.backup.leafServersHint`);if(e.kind===`secrets`){let t=e.secret===void 0?void 0:iW[e.secret];return Y(t===void 0?`settings.backup.leafSecretsHint`:t)}return e.path===void 0?Y(`settings.backup.leafDataHint`):e.origin===void 0?e.path:Y(`settings.backup.pathFromOrigin`,{path:e.path,origin:e.origin})}function oW(e){let t=tW(e);return t!==null&&t.length>0?t:e.kind===`settings`?Y(`settings.backup.entrySettingsHint`):e.kind===`secrets`?Y(`settings.backup.entrySecretsHint`):e.kind===`tls`?Y(`settings.backup.entryTlsHint`):Y(`settings.backup.entryWorkspaceHint`)}function sW(e,t=[]){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{id:e.id,label:eW(e),hint:oW(e),kind:e.kind,...e.workspaceId===void 0?{}:{workspaceId:e.workspaceId},selected:t?.selected??!0,leaves:e.items.map(e=>({id:e.id,label:eW(e),hint:aW(e),kind:e.kind,selected:t?.leaves.find(t=>t.id===e.id)?.selected??!0}))}})}function cW(e){return e.leaves.length===0?e.selected:e.selected&&e.leaves.some(e=>e.selected)}function lW(e){let t=jz(e,`only`);if(t.kind!==`everything`)return t.kind===`nothing`?[]:t.scope.ids}function uW(e){let t=0,n=0;for(let r of e)cW(r)&&(n+=1,t+=r.leaves.length===0?1:r.leaves.filter(e=>e.selected).length);return{entries:n,leaves:t}}var dW=[`disabled`],fW={class:`min-w-0`},pW={class:`text-ink`},mW=N({__name:`CheckField`,props:Va({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`);return(e,r)=>(L(),R(`label`,{class:D(A(Q)(`flex cursor-pointer select-none items-start gap-2 rounded-control px-2 py-1.5 text-xs transition-colors duration-150`,`hover:bg-hover`,t.disabled&&`cursor-not-allowed opacity-50 hover:bg-transparent`))},[wr(B(`input`,{"onUpdate:modelValue":r[0]||=e=>n.value=e,type:`checkbox`,disabled:t.disabled,class:`mt-0.5 size-3.5 shrink-0 cursor-pointer appearance-none rounded-[4px] border border-line bg-page checked:border-accent checked:bg-accent checked:bg-[length:9px] checked:bg-center checked:bg-no-repeat checked:[background-image:url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22white%22 stroke-width=%224%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M20 6 9 17l-5-5%22/></svg>')] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:cursor-not-allowed`},null,8,dW),[[ru,n.value]]),B(`span`,fW,[B(`span`,pW,O(t.label),1),t.hint?(L(),R(`span`,{key:0,class:D([`mt-0.5 block`,[A(VB)]])},O(t.hint),3)):U(``,!0),F(e.$slots,`default`)])],2))}}),hW={class:`space-y-3`},gW={class:`flex items-center justify-between gap-2`},_W={key:0,class:`text-xs font-medium text-muted`},vW={class:`ml-auto flex items-center gap-1.5`},yW={class:`space-y-1.5`},bW={class:`flex items-start gap-2.5`},xW={class:`min-w-0 flex-1`},SW={key:0,class:`flex shrink-0 items-center gap-1.5 pt-0.5`},CW={class:`font-mono text-2xs text-faint`},wW={key:1,class:`shrink-0 rounded-control border border-line px-1.5 py-0.5 text-2xs text-faint`},TW={key:0,class:`mt-1 flex items-center gap-1 pl-6 text-2xs text-warn`},EW={class:`space-y-3`},DW={class:`flex items-center justify-between gap-2`},OW={class:`text-xs font-medium text-muted`},kW={class:`flex items-center gap-1.5`},AW={class:`max-h-72 space-y-1 overflow-auto`},jW={key:0,class:`text-xs text-muted`},MW=N({__name:`CaptureTree`,props:{choices:{},disabled:{type:Boolean,default:!1},showCount:{type:Boolean,default:!1}},setup(e){let t=e,n=W(()=>{let e=0,n=0;for(let r of t.choices)!r.selected||r.leaves.length>0&&!r.leaves.some(e=>e.selected)||(e+=1,n+=r.leaves.length===0?1:r.leaves.filter(e=>e.selected).length);return{entries:e,leaves:n}});function r(e){for(let n of t.choices){n.selected=e;for(let t of n.leaves)t.selected=e}}let i=k(!1),a=k(null),o=k({}),s=W(()=>a.value===null?0:a.value.leaves.filter(e=>o.value[e.id]===!0).length);function c(e){a.value=e,o.value=Object.fromEntries(e.leaves.map(e=>[e.id,e.selected])),i.value=!0}function l(){let e=a.value;if(e!==null){for(let t of e.leaves)t.selected=o.value[t.id]===!0;e.leaves.some(e=>e.selected)&&(e.selected=!0),i.value=!1,a.value=null}}function u(e){let t=a.value;t!==null&&(o.value=Object.fromEntries(t.leaves.map(t=>[t.id,e])))}function d(e){return e.selected&&e.leaves.length>0&&e.leaves.some(e=>e.selected)&&e.leaves.some(e=>!e.selected)}return(e,f)=>(L(),R(`div`,hW,[B(`div`,gW,[t.showCount?(L(),R(`span`,_W,O(A(Y)(`settings.backup.entriesCount`,{count:n.value.entries}))+` · `+O(A(Y)(`settings.backup.itemsSelected`,{count:n.value.leaves})),1)):U(``,!0),B(`div`,vW,[V($,{size:`xs`,variant:`ghost`,disabled:t.disabled,onClick:f[0]||=e=>r(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:t.disabled,onClick:f[1]||=e=>r(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])])]),B(`ul`,yW,[(L(!0),R(I,null,P(t.choices,e=>(L(),R(`li`,{key:e.id,class:`rounded-control border border-line-soft bg-panel-2/30 px-2.5 py-2`},[B(`div`,bW,[B(`div`,xW,[V(mW,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:e.label,hint:e.hint,disabled:t.disabled},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]),e.leaves.length>0?(L(),R(`div`,SW,[B(`span`,CW,O(e.leaves.filter(e=>e.selected).length)+`/`+O(e.leaves.length),1),V($,{size:`xs`,variant:`secondary`,disabled:t.disabled,onClick:t=>c(e)},{default:j(()=>[V(A(Zv),{class:`size-3`}),H(O(A(Y)(`settings.backup.chooseItems`)),1)]),_:1},8,[`disabled`,`onClick`])])):(L(),R(`span`,wW,O(A(rW)(e.kind)),1))]),d(e)?(L(),R(`p`,TW,[V(A(Sy),{class:`size-3`}),H(` `+O(A(Y)(`settings.backup.partialCapture`)),1)])):U(``,!0)]))),128))]),V(xV,{open:i.value,"onUpdate:open":f[5]||=e=>i.value=e,title:a.value===null?A(Y)(`settings.backup.chooseItems`):A(Y)(`settings.backup.chooseItemsFor`,{label:a.value.label}),description:A(Y)(`settings.backup.subDescription`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:f[4]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:l},{default:j(()=>[H(O(A(Y)(`settings.backup.apply`)),1)]),_:1})]),default:j(()=>[B(`div`,EW,[B(`div`,DW,[B(`span`,OW,O(A(Y)(`settings.backup.selectedOf`,{selected:s.value,total:a.value?.leaves.length??0})),1),B(`div`,kW,[V($,{size:`xs`,variant:`ghost`,onClick:f[2]||=e=>u(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:f[3]||=e=>u(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1})])]),B(`ul`,AW,[(L(!0),R(I,null,P(a.value?.leaves??[],e=>(L(),R(`li`,{key:e.id,class:`rounded-control px-2 py-1.5 hover:bg-hover`},[V(mW,{"model-value":o.value[e.id]===!0,label:e.label,hint:e.hint,"onUpdate:modelValue":t=>o.value[e.id]=t===!0},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`])]))),128))]),a.value?.leaves.length===0?(L(),R(`p`,jW,O(A(Y)(`settings.backup.nothingSelectable`)),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])]))}}),NW={class:`space-y-3`},PW={class:`max-h-80 overflow-auto`},FW=N({__name:`BackupDialog`,props:Va({state:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(!1),o=k(null),s=k(``),c=k([]);function l(e){c.value=sW(n.state?.entries??[],e?c.value:[])}let u=W(()=>uW(c.value)),d=W(()=>c.value.some(e=>e.id===`global:settings`&&e.selected)),f=W(()=>n.state!==null&&u.value.leaves>0&&!a.value);M(i,e=>{e&&(s.value=``,o.value=null,l(!1))},{immediate:!0}),M(()=>n.state,()=>{i.value&&l(!0)});async function p(){if(f.value){a.value=!0,o.value=null;try{await IM({password:s.value,include:lW(c.value)}),i.value=!1,r(`created`,Y(`settings.backup.created`))}catch(e){o.value=CM(e)}finally{a.value=!1}}}return(e,t)=>(L(),z(xV,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,title:A(Y)(`settings.backup.createTitle`),description:A(Y)(`settings.backup.createDescription`),width:`w-[min(92vw,40rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,disabled:!f.value,loading:a.value,onClick:p},{default:j(()=>[H(O(A(Y)(`settings.backup.create`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,NW,[B(`div`,PW,[V(MW,{choices:c.value,disabled:a.value,"show-count":``},null,8,[`choices`,`disabled`])]),d.value?U(``,!0):(L(),z(YU,{key:0,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.backup.withoutGlobalSettings`)),1)]),_:1})),V(iV,{modelValue:s.value,"onUpdate:modelValue":t[0]||=e=>s.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.backup.password`),hint:A(Y)(`settings.backup.passwordHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),o.value?(L(),z(YU,{key:1,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),IW={class:`space-y-3`},LW={key:0,class:`flex min-w-0 flex-col gap-1`},RW=[`disabled`],zW={key:0,class:`font-mono text-2xs text-muted`},BW={class:`mt-2`},VW={class:`mt-2 max-w-sm`},HW={class:`mt-2`},UW={class:`mt-2`},WW={class:`mt-1 max-h-64 space-y-0.5 overflow-auto`},GW={class:`mt-2 flex flex-wrap items-center gap-2`},KW={class:`mt-2`},qW=`__upload__`,JW=N({__name:`RestoreDialog`,props:Va({files:{},initial:{default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`applied`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(``),u=k({kind:`upload`}),d=k(qW),f=W(()=>s.value?.items.filter(e=>e.selected).length??0),p=W(()=>{let e=s.value;return e===null?[]:e.appliedIds===void 0?e.applied:e.appliedIds.map(t=>eW(e.items.find(e=>e.id===t)??{label:t}))}),m=W(()=>{let e=s.value;return e===null?[]:e.skippedItems===void 0?e.skipped:e.skippedItems.map(e=>{let t=eW(e);return e.reasonKey===void 0?t:`${t} (${Y(e.reasonKey,e.reasonParams)})`})}),h=W(()=>s.value?.items.some(e=>e.id===`global:settings`&&e.selected)??!1),g=W(()=>s.value?.needsPassword===!0),_=W(()=>s.value!==null&&!g.value&&f.value>0&&!a.value),v=W(()=>[...n.files.map(e=>({value:e.name,label:e.encrypted?Y(`settings.restore.encryptedName`,{name:e.name}):e.name})),{value:qW,label:Y(`settings.restore.uploadOption`)}]),y=Q(HB,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);function b(e){return CM(e)}function x(){return l.value.length>0?{password:l.value}:{}}async function S(){let e=u.value;if(e.kind===`upload`&&c.value===null)s.value=null;else{a.value=!0,o.value=null,s.value=null;try{s.value=e.kind===`stored`?await ZM(e.name,!1,x()):await QM(c.value,!1,x())}catch(e){o.value=b(e)}finally{a.value=!1}}}function C(e){d.value=e,c.value=null,u.value=e===qW?{kind:`upload`}:{kind:`stored`,name:e},S()}function w(e){c.value=e.target.files?.[0]??null,S()}function T(e){for(let t of s.value?.items??[])t.restorable&&(t.selected=e)}async function ee(){let e=s.value,t=u.value;if(e===null||!_.value)return;a.value=!0,o.value=null;let n={...x(),include:e.items.filter(e=>e.restorable&&e.selected).map(e=>e.id)};try{let e=t.kind===`stored`?await ZM(t.name,!0,n):await QM(c.value,!0,n);i.value=!1,s.value=null,c.value=null,l.value=``;let a=[];if(e.reloaded&&a.push(Y(`settings.restore.noteReloaded`)),e.restartRequired&&a.push(Y(`settings.restore.noteRestart`)),e.createdWorkspaces!==void 0&&e.createdWorkspaces.length>0&&a.push(Y(`settings.restore.createdWorkspaces`,{items:e.createdWorkspaces.join(`, `)})),e.replacedUnderRunning!==void 0&&e.replacedUnderRunning.length>0){let t=[...new Set(e.replacedUnderRunning.map(e=>`${e.workspaceId}/${e.serverId}`))];a.push(Y(`settings.restore.replacedUnderRunning`,{items:t.join(`, `)}))}let o=e.applied.length;r(`applied`,a.length===0?Y(`settings.restore.restored`,{count:o}):Y(`settings.restore.restoredWithNotes`,{count:o,notes:a.join(`; `)}))}catch(e){o.value=b(e)}finally{a.value=!1}}return M(i,e=>{if(!e){s.value=null,c.value=null,l.value=``,o.value=null;return}let t=n.files[0];u.value=n.initial??(t===void 0?{kind:`upload`}:{kind:`stored`,name:t.name}),d.value=u.value.kind===`stored`?u.value.name:qW,S()},{immediate:!0}),(e,t)=>(L(),z(xV,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:A(Y)(`settings.restore.title`),description:A(Y)(`settings.restore.description`),width:`w-[min(92vw,38rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),s.value&&!g.value?(L(),z($,{key:0,size:`sm`,variant:`danger`,disabled:!_.value,loading:a.value,onClick:ee},{default:j(()=>[H(O(u.value.kind===`stored`?A(Y)(`settings.restore.applyStored`):A(Y)(`settings.restore.applyUpload`)),1)]),_:1},8,[`disabled`,`loading`])):U(``,!0)]),default:j(()=>[B(`div`,IW,[V($B,{"model-value":d.value,label:A(Y)(`settings.restore.archive`),hint:A(Y)(`settings.restore.archiveHint`),options:v.value,disabled:a.value,wide:``,"onUpdate:modelValue":C},null,8,[`model-value`,`label`,`hint`,`options`,`disabled`]),u.value.kind===`upload`?(L(),R(`div`,LW,[B(`label`,{class:D(A(BB)),for:`restore-upload`},O(A(Y)(`settings.restore.archiveFile`)),3),B(`input`,{id:`restore-upload`,type:`file`,accept:`.zip,application/zip`,class:D(A(y)),disabled:a.value,onChange:w},null,42,RW),c.value?(L(),R(`p`,zW,O(c.value.name),1)):U(``,!0)])):U(``,!0),a.value?(L(),z(oU,{key:1,class:`h-20 w-full`})):s.value?(L(),z(YU,{key:2,tone:`warn`,title:A(Y)(`settings.restore.unchangedTitle`)},{default:j(()=>[B(`p`,null,[u.value.kind===`stored`?(L(),z(EV,{key:0,k:`settings.restore.archiveLine`},{name:j(()=>[B(`code`,null,O(u.value.name),1)]),_:1})):(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.uploadedArchive`)),1)],64))]),s.value.needsPassword?(L(),R(I,{key:0},[B(`p`,BW,O(s.value.error??A(Y)(`settings.restore.passwordProtected`)),1),B(`div`,VW,[V(iV,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`password`,autocomplete:`off`,label:A(Y)(`settings.restore.password`)},null,8,[`modelValue`,`label`])]),B(`div`,HW,[V($,{size:`sm`,variant:`secondary`,disabled:a.value,onClick:S},{default:j(()=>[H(O(A(Y)(`settings.restore.checkAgain`)),1)]),_:1},8,[`disabled`])])],64)):(L(),R(I,{key:1},[B(`p`,UW,O(A(Y)(`settings.restore.choosePrompt`,{selected:f.value,total:s.value.items.length})),1),B(`ul`,WW,[(L(!0),R(I,null,P(s.value.items,e=>(L(),R(`li`,{key:e.id},[V(mW,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:A(eW)(e),hint:[A(rW)(e.kind),e.workspaceId,A(tW)(e)].filter(Boolean).join(` · `),disabled:!e.restorable||a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]))),128))]),B(`div`,GW,[V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>T(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[2]||=e=>T(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])]),B(`p`,KW,[H(O(A(Y)(`settings.restore.willRestore`,{items:p.value.join(`, `)||A(Y)(`settings.restore.nothing`)}))+` `,1),m.value.length>0?(L(),R(I,{key:0},[H(O(A(Y)(`settings.restore.skipped`,{items:m.value.join(`, `)})),1)],64)):U(``,!0),s.value.restartRequired?(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.restartNote`)),1)],64)):h.value?(L(),R(I,{key:2},[H(O(A(Y)(`settings.restore.reloadedNote`)),1)],64)):U(``,!0)])],64))]),_:1},8,[`title`])):U(``,!0),o.value?(L(),z(YU,{key:3,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),YW={class:`inline-flex items-center gap-0.5 rounded-control border border-line bg-panel-2 p-0.5`},XW=[`aria-pressed`,`onClick`],ZW=N({__name:`SegmentedControl`,props:Va({options:{},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`);return(e,r)=>(L(),R(`div`,YW,[(L(!0),R(I,null,P(t.options,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D(A(Q)(`rounded-[5px] font-medium transition-colors duration-150`,t.size===`sm`?`h-6 px-2 text-2xs`:`h-7 px-2.5 text-xs`,n.value===e.value?`bg-raise text-ink shadow-card`:`text-muted hover:text-ink`)),"aria-pressed":n.value===e.value,onClick:t=>n.value=e.value},O(e.label),11,XW))),128))]))}}),QW={class:`flex flex-col gap-2 sm:col-span-2`},$W={class:`flex flex-wrap items-center justify-between gap-2`},eG={class:`min-w-0`},tG={class:`text-xs font-medium text-ink`},nG={class:`mt-0.5 text-2xs leading-4 text-muted`},rG={class:`text-2xs leading-4 text-faint`},iG={class:`space-y-3`},aG={class:`flex flex-wrap items-center gap-2`},oG={class:`text-xs font-medium text-muted`},sG={class:`text-2xs leading-4 text-faint`},cG={class:`max-h-80 overflow-auto`},lG=N({__name:`ScheduleScope`,props:Va({state:{}},{scope:{required:!0},scopeModifiers:{}}),emits:[`update:scope`],setup(e){let t=e,n=lo(e,`scope`),r=k(!1),i=k([]),a=k(`only`);function o(e){let n=sW(t.state?.entries??[]);if(e===null)return n;let r=t=>e.ids.some(e=>t===e||t.startsWith(`${e}:`)),i=e.mode===`only`;for(let t of n){t.selected=i?r(t.id)||e.ids.some(e=>e.startsWith(`${t.id}:`)):!r(t.id);for(let e of t.leaves)e.selected=i?r(e.id):!r(e.id)}return n}M(r,e=>{e&&(i.value=o(n.value),a.value=n.value?.mode??`only`)},{immediate:!0});let s=W(()=>jz(i.value,a.value)),c=W(()=>s.value.kind===`nothing`),l=W(()=>{let e=n.value;return e===null?Y(`settings.backups.scopeSummaryAll`):e.mode===`only`?Y(`settings.backups.scopeSummaryOnly`,{count:e.ids.length}):Y(`settings.backups.scopeSummaryExcept`,{count:e.ids.length})});function u(){c.value||(n.value=s.value.kind===`scope`?s.value.scope:null,r.value=!1)}return(e,n)=>(L(),R(`div`,QW,[B(`div`,$W,[B(`div`,eG,[B(`p`,tG,O(A(Y)(`settings.backups.scopeTitle`)),1),B(`p`,nG,O(l.value),1)]),V($,{size:`xs`,variant:`secondary`,disabled:t.state===null,onClick:n[0]||=e=>r.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.scopeChoose`)),1)]),_:1},8,[`disabled`])]),B(`p`,rG,O(A(Y)(`settings.backups.scopeHint`)),1),V(xV,{open:r.value,"onUpdate:open":n[3]||=e=>r.value=e,title:A(Y)(`settings.backups.scopeDialogTitle`),description:A(Y)(`settings.backups.scopeDialogDescription`),width:`w-[min(92vw,40rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:n[2]||=e=>r.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:c.value,onClick:u},{default:j(()=>[H(O(A(Y)(`settings.backup.apply`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[B(`div`,iG,[B(`div`,aG,[B(`span`,oG,O(A(Y)(`settings.backups.scopeMode`)),1),V(ZW,{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e,options:[{value:`only`,label:A(Y)(`settings.backups.scopeOnly`)},{value:`except`,label:A(Y)(`settings.backups.scopeExcept`)}]},null,8,[`modelValue`,`options`])]),B(`p`,sG,O(a.value===`only`?A(Y)(`settings.backups.scopeOnlyHint`):A(Y)(`settings.backups.scopeExceptHint`)),1),B(`div`,cG,[V(MW,{choices:i.value,"show-count":``},null,8,[`choices`])]),c.value?(L(),z(YU,{key:0,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.backups.scopeNothing`)),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])]))}});async function uG(e){let t=navigator.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return dG(e)}function dG(e){if(typeof document>`u`||typeof document.execCommand!=`function`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t);try{return t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}var fG=[`aria-label`],pG=N({__name:`CopyButton`,props:{value:{},label:{default:void 0},class:{default:void 0}},setup(e){let t=e,n=fP(),r=k(!1),i=k(!1),a=null;function o(){a&&clearTimeout(a),a=setTimeout(()=>{r.value=!1,i.value=!1},1400)}async function s(){await uG(t.value)?(i.value=!1,r.value=!0,o()):(r.value=!1,i.value=!0,o(),n.failure(Y(`common.copyFailed`)))}return ze(()=>{a&&clearTimeout(a)}),(e,n)=>(L(),R(`button`,{type:`button`,class:D(A(Q)(`inline-grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,A(zB),t.class)),"aria-label":r.value?A(Y)(`common.copied`):i.value?A(Y)(`common.copyFailed`):t.label??A(Y)(`common.copy`),onClick:s},[r.value?(L(),z(A(Qv),{key:0,class:`size-3.5 text-ok`})):i.value?(L(),z(A(eb),{key:1,class:`size-3.5 text-warn`})):(L(),z(A(uy),{key:2,class:`size-3.5`}))],10,fG))}}),mG={key:0,class:`size-1.5 shrink-0 rounded-full bg-current`},hG=N({__name:`ToneBadge`,props:{tone:{default:`neutral`},dot:{type:Boolean,default:!1},mono:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){let t=e,n=W(()=>Q(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium whitespace-nowrap`,t.plain?Q(`border-transparent bg-transparent`,JL[t.tone].split(` `).filter(e=>e.startsWith(`text-`)).join(` `)):JL[t.tone],t.mono&&`font-mono`));return(e,r)=>(L(),R(`span`,{class:D(n.value)},[t.dot?(L(),R(`span`,mG)):U(``,!0),F(e.$slots,`default`)],2))}}),gG={class:`space-y-3`},_G={key:0,class:`sm:col-span-2`},vG={key:0,class:`text-2xs text-muted sm:col-span-2`},yG={key:1,class:`text-2xs text-danger sm:col-span-2`,role:`status`},bG={key:2,class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},xG={class:`text-xs font-medium text-muted`},SG={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},CG={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},wG={class:`text-2xs leading-4 text-faint`},TG={key:0,class:`space-y-2 sm:col-span-2`},EG={key:1,class:`text-xs text-muted sm:col-span-2`},DG={key:2,class:`divide-y divide-line-soft sm:col-span-2`},OG={class:`flex items-center gap-2`},kG={class:`min-w-0 flex-1 truncate text-xs font-medium text-ink`},AG={key:0,class:`font-mono text-2xs text-faint`},jG={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},MG={key:1,class:`mt-1 space-y-1`},NG={class:`min-w-0`},PG={class:`truncate font-mono text-2xs text-ink`},FG={class:`mt-0.5 text-2xs leading-4 text-faint`},IG={key:3,class:`text-2xs leading-4 text-faint sm:col-span-2`},LG={key:0,class:`space-y-2 sm:col-span-2`},RG={key:1,class:`sm:col-span-2`},zG={key:2,class:`divide-y divide-line-soft sm:col-span-2`},BG={class:`min-w-0 flex-1`},VG={class:`flex items-center gap-2`},HG={class:`truncate font-mono text-xs text-ink`},UG={class:`mt-0.5 font-mono text-2xs tabular-nums text-muted`},WG={class:`flex items-center gap-1.5`},GG=[`href`],KG={key:3,class:`space-y-2 sm:col-span-2`},qG=N({__name:`BackupsSection`,props:Va({state:{},policy:{},configPath:{},workspaces:{},dirty:{type:Boolean}},{form:{required:!0},formModifiers:{}}),emits:Va([`reset`],[`update:form`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`form`),a=tI(),o=_B(()=>i.value.keep,e=>i.value.keep=e,5),s=_B(()=>i.value.scheduleHours,e=>i.value.scheduleHours=e,24),c=_B(()=>i.value.scheduleKeep,e=>i.value.scheduleKeep=e,7),l=W(()=>{let e=n.state?.lastAutomaticAt??null;return e===null?null:LR(e)}),u=W(()=>n.state?.scheduleError??null),d=k(!1),f=k(null),p=k(null),m=k(!1),h=k(!1),g=k(null),_=W(()=>n.state?.files??[]),v=W(()=>n.state?.entries??[]),y=Q(`inline-flex h-6 shrink-0 items-center gap-1 rounded-control border border-line bg-raise px-2 text-2xs font-medium text-ink`,`transition-colors duration-150 hover:bg-hover`,zB);function b(e){g.value=e===void 0?null:{kind:`stored`,name:e},h.value=!0}function x(e){p.value=null,f.value=e,a.refresh()}function S(e){p.value=null,f.value=e,a.refresh()}async function C(e){d.value=!0,p.value=null,f.value=null;try{await zM(e),f.value=Y(`settings.backups.deleted`,{name:e}),await a.refresh()}catch(e){p.value=CM(e)}finally{d.value=!1}}return(e,t)=>(L(),R(`div`,gG,[V(IB,{title:A(Y)(`settings.backups.policyTitle`),description:A(Y)(`settings.backups.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(sV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.backups.allow`),hint:A(Y)(`settings.backups.allowHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),i.value.enabled?U(``,!0):(L(),R(`div`,_G,[V(YU,{tone:`warn`,title:A(Y)(`settings.backups.offTitle`)},{default:j(()=>[H(O(A(Y)(`settings.backups.offText`)),1)]),_:1},8,[`title`])])),V(qB,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.backups.keep`),min:1,hint:A(Y)(`settings.backups.keepHint`)},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:i.value.scheduleEnabled,"onUpdate:modelValue":t[3]||=e=>i.value.scheduleEnabled=e,label:A(Y)(`settings.backups.schedule`),hint:A(Y)(`settings.backups.scheduleHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),i.value.scheduleEnabled?(L(),R(I,{key:1},[V(qB,{modelValue:A(s),"onUpdate:modelValue":t[4]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.backups.scheduleHours`),min:1,hint:A(Y)(`settings.backups.scheduleHoursHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(c),"onUpdate:modelValue":t[5]||=e=>hn(c)?c.value=e:null,label:A(Y)(`settings.backups.scheduleKeep`),min:1,hint:A(Y)(`settings.backups.scheduleKeepHint`)},null,8,[`modelValue`,`label`,`hint`]),l.value===null?U(``,!0):(L(),R(`p`,vG,O(A(Y)(`settings.backups.scheduleLast`,{when:l.value})),1)),u.value===null?U(``,!0):(L(),R(`p`,yG,O(A(Y)(`settings.backups.scheduleFailed`,{when:A(LR)(u.value.at),message:u.value.message})),1)),V(lG,{scope:i.value.scheduleScope,"onUpdate:scope":t[6]||=e=>i.value.scheduleScope=e,state:n.state},null,8,[`scope`,`state`])],64)):U(``,!0),V(iV,{modelValue:i.value.includePaths,"onUpdate:modelValue":t[7]||=e=>i.value.includePaths=e,label:A(Y)(`settings.backups.extraPaths`),hint:A(Y)(`settings.backups.extraPathsHint`),placeholder:A(Y)(`settings.backups.extraPathsPlaceholder`)},null,8,[`modelValue`,`label`,`hint`,`placeholder`]),n.policy===null?U(``,!0):(L(),R(`div`,bG,[B(`span`,xG,O(A(Y)(`settings.backups.archiveDirectory`)),1),B(`div`,SG,[B(`span`,CG,O(n.policy.dir),1),V(pG,{value:n.policy.dir,label:A(Y)(`settings.backups.copyArchiveDirectory`)},null,8,[`value`,`label`])]),B(`p`,wG,[V(EV,{k:`settings.backups.changeDirectory`},{path:j(()=>[B(`code`,null,O(n.configPath??A(Y)(`settings.backups.theSettingsFile`)),1)]),_:1})])]))]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`settings.backups.capturesTitle`),description:A(Y)(`settings.backups.capturesDescription`)},{default:j(()=>[n.state===null?(L(),R(`div`,TG,[V(oU,{class:`h-4 w-full`}),V(oU,{class:`h-4 w-2/3`})])):v.value.length===0?(L(),R(`p`,EG,O(A(Y)(`settings.backups.nothingSelectable`)),1)):(L(),R(`ul`,DG,[(L(!0),R(I,null,P(v.value,e=>(L(),R(`li`,{key:e.id,class:`py-2 first:pt-0`},[B(`div`,OG,[B(`p`,kG,O(A(eW)(e)),1),V(hG,{tone:`neutral`,plain:``},{default:j(()=>[H(O(A(rW)(e.kind)),1)]),_:2},1024),e.workspaceId?(L(),R(`span`,AG,O(e.workspaceId),1)):U(``,!0)]),A(tW)(e)?(L(),R(`p`,jG,O(A(tW)(e)),1)):U(``,!0),e.items.length>0?(L(),R(`ul`,MG,[(L(!0),R(I,null,P(e.items,e=>(L(),R(`li`,{key:e.id,class:`flex items-start justify-between gap-3 rounded-control bg-panel-2/40 px-2 py-1`},[B(`div`,NG,[B(`p`,PG,O(e.path??A(eW)(e)),1),B(`p`,FG,[H(O(e.included?e.origin?A(Y)(`settings.backups.fromOrigin`,{origin:e.origin}):A(tW)(e)??A(Y)(`settings.backups.included`):A(tW)(e)??A(Y)(`settings.backups.notCaptured`))+` `,1),e.included&&e.ignoreGenerated?(L(),R(I,{key:0},[H(` · `+O(A(Y)(`settings.backups.generatedSkipped`)),1)],64)):U(``,!0)])]),V(hG,{tone:e.included?`ok`:`neutral`,plain:``},{default:j(()=>[H(O(e.included?A(Y)(`settings.backups.included`):A(Y)(`settings.backups.skipped`)),1)]),_:2},1032,[`tone`])]))),128))])):U(``,!0)]))),128))])),n.workspaces.length>1?(L(),R(`p`,IG,O(A(Y)(`settings.backups.workspacesNote`,{count:n.workspaces.length})),1)):U(``,!0)]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`settings.backups.archivesTitle`),description:A(Y)(`settings.backups.archivesDescription`)},{actions:j(()=>[i.value.enabled?(L(),z($,{key:0,size:`xs`,variant:`primary`,disabled:n.state===null,onClick:t[8]||=e=>m.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`secondary`,disabled:n.state===null,onClick:t[9]||=e=>b()},{default:j(()=>[H(O(A(Y)(`settings.backups.restore`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.state===null?(L(),R(`div`,LG,[V(oU,{class:`h-4 w-full`}),V(oU,{class:`h-4 w-2/3`})])):_.value.length===0?(L(),R(`div`,RG,[V(hR,{compact:``,title:A(Y)(`settings.backups.noArchives`),description:i.value.enabled?A(Y)(`settings.backups.noArchivesEnabled`):A(Y)(`settings.backups.noArchivesDisabled`)},xa({icon:j(()=>[V(A(Yv),{class:`size-4`})]),_:2},[i.value.enabled?{name:`action`,fn:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t[10]||=e=>m.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1})]),key:`0`}:void 0]),1032,[`title`,`description`])])):(L(),R(`ul`,zG,[(L(!0),R(I,null,P(_.value,e=>(L(),R(`li`,{key:e.name,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0 last:pb-0`},[B(`div`,BG,[B(`div`,VG,[B(`span`,HG,O(e.name),1),e.encrypted?(L(),z(hG,{key:0,tone:`warn`,plain:``},{default:j(()=>[H(O(A(Y)(`settings.backups.encrypted`)),1)]),_:1})):U(``,!0)]),B(`p`,UG,O(A(RR)(e.sizeBytes))+` · `+O(A(LR)(e.createdAt)),1)]),B(`div`,WG,[B(`a`,{href:NM(e.name),class:D(A(y))},[V(A(fy),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.download`)),1)],10,GG),V($,{size:`xs`,variant:`secondary`,onClick:t=>b(e.name)},{default:j(()=>[V(A(Ry),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.restoreAction`)),1)]),_:1},8,[`onClick`]),V(KU,{label:A(Y)(`common.delete`),"confirm-label":A(Y)(`settings.backups.confirmDelete`),size:`xs`,variant:`ghost`,"confirm-variant":`danger`,disabled:d.value,onConfirm:t=>C(e.name)},null,8,[`label`,`confirm-label`,`disabled`,`onConfirm`])])]))),128))])),p.value||f.value?(L(),R(`div`,KG,[p.value?(L(),z(YU,{key:0,tone:`danger`},{default:j(()=>[H(O(p.value),1)]),_:1})):U(``,!0),f.value?(L(),z(YU,{key:1,tone:`ok`},{default:j(()=>[H(O(f.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`]),V(FW,{open:m.value,"onUpdate:open":t[11]||=e=>m.value=e,state:n.state,onCreated:x},null,8,[`open`,`state`]),V(JW,{open:h.value,"onUpdate:open":t[12]||=e=>h.value=e,files:_.value,initial:g.value,onApplied:S},null,8,[`open`,`files`,`initial`])]))}}),JG={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},YG={key:2,class:`text-2xs font-medium text-ok`},XG={key:0,class:`text-2xs text-danger sm:col-span-2`,role:`status`},ZG={key:1,class:`text-2xs text-warn sm:col-span-2`},QG={key:1,class:`mt-3 flex flex-wrap items-center gap-1.5`},$G={class:`text-xs text-muted`},eK={key:2,class:`mt-3 text-xs text-muted`},tK=N({__name:`HostSection`,props:Va({config:{},alerts:{},dirty:{type:Boolean}},{host:{required:!0},hostModifiers:{}}),emits:Va([`reset`],[`update:host`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`host`),a=gB(()=>i.value.intervalMs,e=>i.value.intervalMs=e,15e3),o=_B(()=>i.value.diskUsedPercent,e=>i.value.diskUsedPercent=e,90),s=_B(()=>i.value.memoryUsedPercent,e=>i.value.memoryUsedPercent=e,90),c=_B(()=>i.value.swapUsedPercent,e=>i.value.swapUsedPercent=e,50),l=_B(()=>i.value.loadPerCpu,e=>i.value.loadPerCpu=e,2),u=_B(()=>i.value.tempCelsius,e=>i.value.tempCelsius=e,85),d=_B(()=>i.value.tempCommandTimeoutMs,e=>i.value.tempCommandTimeoutMs=e,5e3),f=k(null),p=k(!1),m=k(null),h=W(()=>f.value?.supported===!0);ia(async()=>{try{let e=await BM();f.value=e}catch{f.value=null}});async function g(){p.value=!0,m.value=null;try{let e=await VM();f.value=e,e.configured&&e.tempCommand!==null&&e.tempCommand!==void 0&&(i.value.tempCommand=e.tempCommand)}catch(e){m.value=CM(e)}finally{p.value=!1}}async function _(){p.value=!0,m.value=null;try{f.value=await HM(),i.value.tempCommand=``}catch(e){m.value=CM(e)}finally{p.value=!1}}return(e,t)=>(L(),R(I,null,[V(IB,{title:A(Y)(`settings.host.title`),description:A(Y)(`settings.host.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(sV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.host.enabled`),hint:A(Y)(`settings.host.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.host.interval`),min:5,hint:A(Y)(`settings.host.intervalHint`)},null,8,[`modelValue`,`label`,`hint`]),V(iV,{modelValue:i.value.diskPaths,"onUpdate:modelValue":t[3]||=e=>i.value.diskPaths=e,label:A(Y)(`settings.host.diskPaths`),hint:A(Y)(`settings.host.diskPathsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(o),"onUpdate:modelValue":t[4]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.host.diskUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(s),"onUpdate:modelValue":t[5]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.host.memoryUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(c),"onUpdate:modelValue":t[6]||=e=>hn(c)?c.value=e:null,label:A(Y)(`settings.host.swapUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(l),"onUpdate:modelValue":t[7]||=e=>hn(l)?l.value=e:null,label:A(Y)(`settings.host.loadPerCpu`),min:0,hint:A(Y)(`settings.host.loadPerCpuHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(u),"onUpdate:modelValue":t[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`settings.host.tempCelsius`),min:0,hint:A(Y)(`settings.host.tempCelsiusHint`)},null,8,[`modelValue`,`label`,`hint`]),V(iV,{modelValue:i.value.tempCommand,"onUpdate:modelValue":t[9]||=e=>i.value.tempCommand=e,label:A(Y)(`settings.host.tempCommand`),hint:A(Y)(`settings.host.tempCommandHint`),placeholder:A(Y)(`settings.host.tempCommandPlaceholder`),wide:``},null,8,[`modelValue`,`label`,`hint`,`placeholder`]),i.value.tempCommand.trim().length>0?(L(),z(qB,{key:0,modelValue:A(d),"onUpdate:modelValue":t[10]||=e=>hn(d)?d.value=e:null,label:A(Y)(`settings.host.tempCommandTimeout`),min:100,max:3e4,hint:A(Y)(`settings.host.tempCommandTimeoutHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0)]),_:1},8,[`title`,`description`]),h.value?(L(),z(IB,{key:0,title:A(Y)(`settings.host.wslTitle`),description:A(Y)(`settings.host.wslDescription`)},{default:j(()=>[B(`div`,JG,[f.value?.configured?(L(),z($,{key:1,size:`xs`,variant:`secondary`,loading:p.value,onClick:t[12]||=e=>_()},{default:j(()=>[H(O(A(Y)(`settings.host.wslRemove`)),1)]),_:1},8,[`loading`])):(L(),z($,{key:0,size:`xs`,variant:`primary`,loading:p.value,onClick:t[11]||=e=>g()},{default:j(()=>[H(O(A(Y)(`settings.host.wslSetup`)),1)]),_:1},8,[`loading`])),f.value?.lastReadingCelsius!==null&&f.value?.lastReadingCelsius!==void 0?(L(),R(`span`,YG,O(A(Y)(`settings.host.wslReading`,{celsius:f.value.lastReadingCelsius})),1)):U(``,!0)]),f.value?.lastError?(L(),R(`p`,XG,O(A(Y)(`settings.host.wslFailed`,{reason:f.value.lastError})),1)):f.value?.configured&&!f.value?.libraryPresent?(L(),R(`p`,ZG,O(A(Y)(`settings.host.wslNeedsLibrary`)),1)):U(``,!0),m.value?(L(),z(YU,{key:2,tone:`danger`},{default:j(()=>[H(O(m.value),1)]),_:1})):U(``,!0)]),_:1},8,[`title`,`description`])):U(``,!0),n.alerts.length>0?(L(),R(`div`,QG,[B(`span`,$G,O(A(Y)(`settings.host.breachingNow`)),1),(L(!0),R(I,null,P(n.alerts,e=>(L(),z(hG,{key:e,tone:`danger`,dot:``},{default:j(()=>[H(O(e),1)]),_:2},1024))),128))])):i.value.enabled?(L(),R(`p`,eK,O(A(Y)(`settings.host.nothingBreaching`)),1)):U(``,!0)],64))}}),nK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},rK={class:`text-xs font-medium text-muted`},iK={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},aK={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},oK={class:`text-2xs leading-4 text-faint`},sK={key:0},cK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},lK={class:`text-xs font-medium text-muted`},uK={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},dK={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},fK={class:`text-2xs leading-4 text-faint`},pK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},mK={class:`text-xs font-medium text-muted`},hK=[`disabled`],gK={class:`text-2xs leading-4 text-faint sm:col-span-2`},_K=N({__name:`InterfaceSection`,props:Va({ui:{},panelVersion:{},labelDirty:{type:Boolean}},{label:{required:!0},labelModifiers:{}}),emits:Va([`changed`,`resetLabel`],[`update:label`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`label`),a=k(null),o=k(!1),s=k(null),c=k(null),l=k(!1),u=W(()=>{let e=n.ui;if(e===null)return Y(`common.unknown`);if(!e.custom)return Y(`settings.interface.sourceStock`);let t=e.meta;return t===null?Y(`settings.interface.sourceCustom`):`${Y(`settings.interface.sourceCustom`)} · ${t.name??Y(`settings.interface.unnamed`)}${t.version==null?``:` ${t.version}`}`}),d=W(()=>{let e=n.ui?.meta;if(e==null)return null;let t=e.uploadedAt===void 0?null:LR(e.uploadedAt);return`${Y(`settings.interface.fileCount`,{count:e.files??0})}${t===null?``:` · ${t}`}`});function f(e){a.value=e.target.files?.[0]??null,s.value=null,c.value=null}async function p(){if(a.value!==null){o.value=!0,c.value=null,s.value=null;try{let e=await oN(a.value);s.value=Y(`settings.interface.installed`,{name:e.meta?.name??Y(`settings.interface.yourBuild`)}),a.value=null,r(`changed`)}catch(e){c.value=CM(e)}finally{o.value=!1}}}async function m(){if(!l.value)l.value=!0,setTimeout(()=>{l.value=!1},5e3);else{l.value=!1,o.value=!0,c.value=null;try{let e=await tN();s.value=e.removed?Y(`settings.interface.restored`):Y(`settings.interface.nothingInstalled`),r(`changed`)}catch(e){c.value=CM(e)}finally{o.value=!1}}}return(t,h)=>(L(),z(IB,{title:A(Y)(`settings.interface.title`),description:A(Y)(`settings.interface.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.labelDirty,onClick:h[1]||=e=>r(`resetLabel`)},{default:j(()=>[H(O(A(Y)(`settings.interface.resetName`)),1)]),_:1},8,[`disabled`]),e.ui?.custom?(L(),z($,{key:0,size:`xs`,variant:`ghost`,disabled:o.value,onClick:m},{default:j(()=>[H(O(l.value?A(Y)(`settings.interface.confirmRevert`):A(Y)(`settings.interface.revertToStock`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`primary`,disabled:o.value||a.value===null,onClick:p},{default:j(()=>[H(O(A(Y)(`settings.interface.install`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[B(`div`,nK,[B(`span`,rK,O(A(Y)(`settings.interface.currentlyServing`)),1),B(`div`,iK,[B(`span`,aK,O(u.value),1),V(pG,{value:e.ui?.dir??``,label:A(Y)(`settings.interface.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,oK,[d.value?(L(),R(`span`,sK,O(d.value)+` · `,1)):U(``,!0),B(`code`,null,O(e.ui?.dir??`—`),1)])]),B(`div`,cK,[B(`span`,lK,O(A(Y)(`settings.interface.panelVersion`)),1),B(`div`,uK,[B(`span`,dK,O(A(Y)(`app.name`))+` `+O(n.panelVersion??A(Y)(`common.unknown`)),1),n.panelVersion?(L(),z(pG,{key:0,value:n.panelVersion,label:A(Y)(`settings.interface.copyPanelVersion`)},null,8,[`value`,`label`])):U(``,!0)]),B(`p`,fK,[V(EV,{k:`settings.interface.panelVersionHint`},{command:j(()=>[...h[2]||=[B(`code`,null,`home-hosted status`,-1)]]),_:1})])]),V(iV,{modelValue:i.value,"onUpdate:modelValue":h[0]||=e=>i.value=e,label:A(Y)(`settings.interface.panelName`),hint:A(Y)(`settings.interface.panelNameHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),B(`label`,pK,[B(`span`,mK,O(A(Y)(`settings.interface.uploadLabel`)),1),B(`input`,{type:`file`,accept:`.zip,application/zip`,class:`rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-xs text-ink file:mr-2 file:rounded file:border-0 file:bg-line file:px-2 file:py-1 file:text-xs`,disabled:o.value,onChange:f},null,40,hK)]),c.value?(L(),z(YU,{key:0,tone:`warn`,title:c.value},null,8,[`title`])):s.value?(L(),z(YU,{key:1,tone:`ok`,title:s.value},null,8,[`title`])):U(``,!0),B(`p`,gK,[V(EV,{k:`settings.interface.docsHint`},{docs:j(()=>[...h[3]||=[B(`code`,null,`docs/UI_CREATION.md`,-1)]]),command:j(()=>[...h[4]||=[B(`code`,null,`home-hosted ui-revert`,-1)]]),_:1})])]),_:1},8,[`title`,`description`]))}}),vK={class:`flex min-w-0 flex-col gap-1`},yK={class:`text-xs font-medium text-muted`},bK={class:`text-2xs leading-4 text-faint`},xK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},SK={class:`text-xs font-medium text-muted`},CK={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},wK={class:`min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-ink`},TK={class:`text-2xs leading-4 text-faint`},EK=N({__name:`ListenerSection`,props:Va({view:{},dirty:{type:Boolean}},{control:{required:!0},controlModifiers:{}}),emits:Va([`reset`],[`update:control`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`control`),a=_B(()=>i.value.port,e=>i.value.port=e,3999),o=[`local`,`lan`],s=W({get:()=>o.includes(i.value.host)?i.value.host:`custom`,set:e=>{if(e!==`custom`){i.value.host=e;return}if(!o.includes(i.value.host))return;let t=n.view?.bindHost??``,r=t!==``&&t!==`0.0.0.0`&&t!==`127.0.0.1`&&TA(t)!==null;i.value.host=r?t:`127.0.0.1`}}),c=W(()=>{if(s.value===`custom`&&TA(i.value.host)===null)return Y(`settings.listener.ipv4Error`)}),l=W(()=>n.view?.url??`—`),u=W(()=>s.value===`lan`?Y(`settings.listener.bindLanHint`):s.value===`local`?Y(`settings.listener.bindLocalHint`):Y(`settings.listener.bindCustomHint`));return(e,t)=>(L(),z(IB,{title:A(Y)(`settings.listener.title`),description:A(Y)(`settings.listener.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(qB,{modelValue:A(a),"onUpdate:modelValue":t[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.listener.port`),min:1,max:65535,hint:A(Y)(`settings.listener.portHint`)},null,8,[`modelValue`,`label`,`hint`]),B(`div`,vK,[B(`span`,yK,O(A(Y)(`settings.listener.bind`)),1),V(ZW,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,options:[{value:`local`,label:A(Y)(`settings.listener.bindLocal`)},{value:`lan`,label:A(Y)(`settings.listener.bindLan`)},{value:`custom`,label:A(Y)(`settings.listener.bindCustom`)}]},null,8,[`modelValue`,`options`]),B(`p`,bK,O(u.value),1)]),s.value===`custom`?(L(),z(iV,{key:0,modelValue:i.value.host,"onUpdate:modelValue":t[3]||=e=>i.value.host=e,label:A(Y)(`settings.listener.ipv4`),placeholder:A(Y)(`settings.listener.ipv4Placeholder`),error:c.value,hint:A(Y)(`settings.listener.ipv4Hint`)},null,8,[`modelValue`,`label`,`placeholder`,`error`,`hint`])):U(``,!0),V(sV,{modelValue:i.value.openBrowser,"onUpdate:modelValue":t[4]||=e=>i.value.openBrowser=e,label:A(Y)(`settings.listener.openBrowser`),wide:``},null,8,[`modelValue`,`label`]),B(`div`,xK,[B(`span`,SK,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,CK,[B(`span`,wK,O(l.value),1),n.view?.restartRequired?(L(),z(hG,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.listener.restartRequired`)),1)]),_:1})):U(``,!0),V(pG,{value:l.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])]),B(`p`,TK,O(A(Y)(`settings.listener.liveAddressHint`)),1)])]),_:1},8,[`title`,`description`]))}}),DK={class:`space-y-3`},OK={class:`divide-y divide-line-soft sm:col-span-2`},kK={class:`min-w-0`},AK={class:`text-xs font-medium text-ink`},jK={class:`mt-0.5 text-2xs leading-4 text-faint`},MK={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},NK={class:`min-w-0 truncate font-mono text-xs text-ink`},PK={class:`flex items-center gap-2 text-xs font-medium text-ink`},FK={class:`font-mono text-2xs font-normal text-faint`},IK={class:`divide-y divide-line-soft`},LK={class:`min-w-0`},RK={class:`text-2xs font-medium text-ink`},zK={class:`mt-0.5 text-2xs leading-4 text-faint`},BK={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},VK={class:`min-w-0 truncate font-mono text-2xs text-ink`},HK=N({__name:`PathsSection`,props:{dataRoot:{},projectDir:{},panelUrl:{},workspaces:{}},setup(e){let t=e,n=W(()=>t.dataRoot===null?null:`${t.dataRoot}/settings.json`),r=W(()=>[{key:`data`,label:Y(`settings.paths.dataRoot`),hint:Y(`settings.paths.dataRootHint`),copyLabel:Y(`settings.paths.dataRoot`),value:t.dataRoot??`—`},{key:`settings`,label:Y(`settings.paths.globalSettings`),hint:Y(`settings.paths.globalSettingsHint`),copyLabel:Y(`settings.paths.globalSettings`),value:n.value??`—`},{key:`project`,label:Y(`settings.paths.projectDir`),hint:Y(`settings.paths.projectDirHint`),copyLabel:Y(`settings.paths.projectDir`),value:t.projectDir??`—`},{key:`panel`,label:Y(`settings.paths.panelAddress`),hint:Y(`settings.paths.panelAddressHint`),copyLabel:Y(`settings.paths.panelAddress`),value:t.panelUrl??`—`}]);function i(e){return[{key:`${e.id}:config`,label:Y(`settings.paths.serversConfig`),hint:Y(`settings.paths.serversConfigHint`,{label:e.label}),copyLabel:Y(`settings.paths.serversConfig`),value:e.configPath},{key:`${e.id}:settings`,label:Y(`settings.paths.workspaceSettings`),hint:Y(`settings.paths.workspaceSettingsHint`),copyLabel:Y(`settings.paths.workspaceSettings`),value:e.settingsPath},{key:`${e.id}:logs`,label:Y(`settings.paths.logs`),hint:Y(`settings.paths.logsHint`),copyLabel:Y(`settings.paths.logs`),value:e.logsDir}]}return(t,n)=>(L(),R(`div`,DK,[V(IB,{title:A(Y)(`settings.paths.whereThingsLive`),description:A(Y)(`settings.paths.whereThingsLiveDescription`)},{default:j(()=>[B(`ul`,OK,[(L(!0),R(I,null,P(r.value,e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`},[B(`div`,kK,[B(`p`,AK,O(e.label),1),B(`p`,jK,O(e.hint),1)]),B(`div`,MK,[B(`span`,NK,O(e.value),1),V(pG,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`settings.paths.workspaceFiles`),description:A(Y)(`settings.paths.workspaceFilesDescription`)},{default:j(()=>[(L(!0),R(I,null,P(e.workspaces,e=>(L(),R(`div`,{key:e.id,class:`space-y-2 sm:col-span-2`},[B(`p`,PK,[H(O(e.label)+` `,1),B(`span`,FK,O(e.id),1)]),B(`ul`,IK,[(L(!0),R(I,null,P(i(e),e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-1.5`},[B(`div`,LK,[B(`p`,RK,O(e.label),1),B(`p`,zK,O(e.hint),1)]),B(`div`,BK,[B(`span`,VK,O(e.value),1),V(pG,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]))),128))]),_:1},8,[`title`,`description`])]))}}),UK=[`id`],WK={class:`mb-3`},GK={class:`text-lg font-semibold text-ink`},KK={class:`mt-0.5 text-xs text-muted`},qK={class:`space-y-3`},JK=N({__name:`SettingsSection`,props:{id:{},title:{},description:{}},setup(e){return(t,n)=>(L(),R(`section`,{id:e.id,class:`scroll-mt-5`},[B(`header`,WK,[B(`h2`,GK,O(e.title),1),B(`p`,KK,O(e.description),1)]),B(`div`,qK,[F(t.$slots,`default`)])],8,UK))}}),YK={class:`min-h-full`},XK={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},ZK={class:`lg:grid lg:grid-cols-[11rem_minmax(0,1fr)] lg:gap-8`},QK=[`aria-label`],$K={class:`sticky top-6 space-y-0.5 border-l border-line`},eq=[`aria-current`,`onClick`],tq={class:`space-y-6`},nq={class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},rq={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},iq={class:`min-w-0 flex-1`},aq={class:`text-xs text-muted`},oq={class:`font-mono tabular-nums text-ink`},sq={key:0,class:`mt-0.5 text-xs text-danger`},cq={key:1,class:`mt-0.5 text-xs text-ok`},lq={class:`flex shrink-0 items-center gap-2`},uq={class:`max-h-[60dvh] overflow-auto px-4 py-3`},dq={key:0,class:`divide-y divide-line-soft`},fq={class:`font-mono text-xs text-ink`},pq={class:`ml-auto font-mono text-xs text-muted line-through`},mq={class:`font-mono text-xs text-accent`},hq={key:1,class:`text-xs text-muted`},gq={class:`flex items-center justify-end gap-2 border-t border-line px-4 py-3`},_q=N({__name:`SettingsShell`,props:{sections:{},navLabel:{},changesDescription:{},changedCount:{},changes:{},saveError:{},saveMessage:{},saving:{type:Boolean}},emits:[`save`,`discard`],setup(e,{emit:t}){let n=e,r=t,i=$g(),a=Qg(),o=k(n.sections[0]?.id??``),s=k(!1);function c(e){ir(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function l(e){o.value=e,i.query.section!==e&&a.replace({query:{...i.query,section:e}}),c(e)}M(()=>i.query.section,e=>{let t=typeof e==`string`?e:``;n.sections.some(e=>e.id===t)&&(o.value=t,c(t))},{immediate:!0});let u=null;ia(()=>{u=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];t!==void 0&&t.target.id.length>0&&(o.value=t.target.id)},{rootMargin:`-72px 0px -62% 0px`,threshold:0});for(let e of n.sections){let t=document.getElementById(e.id);t&&u.observe(t)}}),sa(()=>u?.disconnect());function d(){r(`save`),s.value=!1}return(e,t)=>(L(),R(I,null,[B(`div`,YK,[B(`div`,XK,[F(e.$slots,`header`),B(`div`,ZK,[B(`nav`,{"aria-label":n.navLabel,class:`hidden lg:block`},[B(`ul`,$K,[(L(!0),R(I,null,P(n.sections,e=>(L(),R(`li`,{key:e.id},[B(`button`,{type:`button`,"aria-current":o.value===e.id?`true`:void 0,class:D(A(Q)(`-ml-px block w-full border-l-2 py-1.5 pl-3 text-left text-xs transition-colors duration-150`,o.value===e.id?`border-accent font-medium text-accent`:`border-transparent text-muted hover:border-line hover:text-ink`)),onClick:t=>l(e.id)},O(e.title),11,eq)]))),128))])],8,QK),B(`div`,tq,[F(e.$slots,`default`)])])]),B(`div`,nq,[B(`div`,rq,[B(`div`,iq,[B(`p`,aq,[n.changedCount>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-xs text-muted underline decoration-line underline-offset-2 hover:text-ink`,onClick:t[0]||=e=>s.value=!0},[B(`span`,oq,O(n.changedCount),1),H(` `+O(A(bF)(`settings.shell.fieldsChanged`,n.changedCount)),1)])):(L(),R(I,{key:1},[H(O(A(Y)(`settings.shell.noUnsavedChanges`)),1)],64))]),n.saveError?(L(),R(`p`,sq,O(n.saveError),1)):n.saveMessage?(L(),R(`p`,cq,O(n.saveMessage),1)):U(``,!0)]),B(`div`,lq,[V($,{variant:`ghost`,disabled:n.changedCount===0||n.saving,onClick:t[1]||=e=>r(`discard`)},{default:j(()=>[H(O(A(Y)(`settings.shell.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:n.changedCount===0,loading:n.saving,onClick:t[2]||=e=>r(`save`)},{default:j(()=>[H(O(A(Y)(`settings.shell.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])]),V(xV,{open:s.value,"onUpdate:open":t[4]||=e=>s.value=e,title:A(Y)(`settings.shell.unsavedTitle`),description:n.changesDescription,width:`w-[min(92vw,42rem)]`},{default:j(()=>[B(`div`,uq,[n.changes.length>0?(L(),R(`ul`,dq,[(L(!0),R(I,null,P(n.changes,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,fq,O(e.path),1),B(`span`,pq,O(A(VR)(e.from)),1),t[5]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,mq,O(A(VR)(e.to)),1)]))),128))])):(L(),R(`p`,hq,O(A(Y)(`settings.shell.nothingToSave`)),1))]),B(`footer`,gq,[V($,{size:`sm`,variant:`ghost`,onClick:t[3]||=e=>s.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:n.changes.length===0||n.saving,loading:n.saving,onClick:d},{default:j(()=>[H(O(A(bF)(`settings.shell.saveChanges`,n.changes.length)),1)]),_:1},8,[`disabled`,`loading`])])]),_:1},8,[`open`,`title`,`description`])],64))}}),vq={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},yq={class:`text-xs font-medium text-muted`},bq={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},xq={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},Sq={key:0,class:`sm:col-span-2`},Cq={key:1,class:`space-y-3 sm:col-span-2`},wq={class:`divide-y divide-line-soft text-xs`},Tq={class:`flex items-start justify-between gap-4 py-1.5`},Eq={class:`text-muted`},Dq={class:`min-w-0 text-right font-mono text-xs text-ink`},Oq={class:`flex items-start justify-between gap-4 py-1.5`},kq={class:`text-muted`},Aq={class:`min-w-0 text-right font-mono text-xs text-ink`},jq={class:`flex items-start justify-between gap-4 py-1.5`},Mq={class:`text-muted`},Nq={class:`font-mono text-xs tabular-nums text-ink`},Pq={class:`flex items-center justify-between gap-4 py-1.5`},Fq={class:`text-muted`},Iq={class:`flex items-start justify-between gap-4 py-1.5`},Lq={class:`text-muted`},Rq={class:`flex min-w-0 items-center gap-1.5`},zq={class:`min-w-0 truncate font-mono text-2xs text-ink`},Bq={key:2,class:`sm:col-span-2`},Vq={class:`flex min-w-0 flex-col gap-1`},Hq={class:`flex min-w-0 flex-col gap-1`},Uq={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},Wq={key:3,class:`space-y-2 sm:col-span-2`},Gq=N({__name:`TlsSection`,props:Va({view:{},dirty:{type:Boolean}},{tlsEnabled:{type:Boolean,required:!0},tlsEnabledModifiers:{}}),emits:Va([`reset`],[`update:tlsEnabled`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`tlsEnabled`),a=tI(),o=k(``),s=k(``),c=k(null),l=k(null),u=k(!1),d=W(()=>n.view?.tls??null),f=W(()=>n.view?`${n.view.protocol}://${n.view.bindHost}:${n.view.port}`:`—`),p=W(()=>o.value.trim().length>0&&s.value.trim().length>0&&!u.value),m=Q(HB,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?o.value=r:s.value=r}async function g(){u.value=!0,l.value=null,c.value=null;try{let e=await qN(o.value,s.value);o.value=``,s.value=``,c.value=Y(`settings.tls.stored`),await a.refresh();let t=await vB(e);t!==null&&(l.value=t)}catch(e){l.value=CM(e)}finally{u.value=!1}}async function _(){u.value=!0,l.value=null,c.value=null;try{let e=await JN();c.value=Y(`settings.tls.removed`),await a.refresh();let t=await vB(e);t!==null&&(l.value=t)}catch(e){l.value=CM(e)}finally{u.value=!1}}return(e,t)=>(L(),R(I,null,[V(IB,{title:A(Y)(`settings.tls.title`),description:A(Y)(`settings.tls.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(sV,{modelValue:i.value,"onUpdate:modelValue":t[1]||=e=>i.value=e,label:A(Y)(`settings.tls.serve`),hint:A(Y)(`settings.tls.serveHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),B(`div`,vq,[B(`span`,yq,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,bq,[B(`span`,xq,O(f.value),1),V(pG,{value:f.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])])])]),_:1},8,[`title`,`description`]),V(IB,{class:`mt-3`,title:A(Y)(`settings.tls.certificateTitle`),description:A(Y)(`settings.tls.certificateDescription`)},{default:j(()=>[d.value?.error?(L(),R(`div`,Sq,[V(YU,{tone:`danger`,title:A(Y)(`settings.tls.unusableTitle`)},{default:j(()=>[H(O(d.value.error),1)]),_:1},8,[`title`])])):d.value?.certPresent?(L(),R(`div`,Cq,[B(`dl`,wq,[B(`div`,Tq,[B(`dt`,Eq,O(A(Y)(`settings.tls.subject`)),1),B(`dd`,Dq,O(d.value.subject??`—`),1)]),B(`div`,Oq,[B(`dt`,kq,O(A(Y)(`settings.tls.issuer`)),1),B(`dd`,Aq,O(d.value.issuer??`—`),1)]),B(`div`,jq,[B(`dt`,Mq,O(A(Y)(`settings.tls.validUntil`)),1),B(`dd`,Nq,[H(O(d.value.validTo?d.value.validTo.slice(0,10):`—`)+` `,1),d.value.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D(A(Q)(`ml-1.5`,d.value.daysRemaining<14?`text-warn`:`text-faint`))},` (`+O(A(Y)(`settings.tls.days`,{count:d.value.daysRemaining}))+`) `,3))])]),B(`div`,Pq,[B(`dt`,Fq,O(A(Y)(`settings.tls.privateKey`)),1),B(`dd`,null,[V(hG,{tone:d.value.keyMatches?`ok`:`danger`,dot:``},{default:j(()=>[H(O(d.value.keyMatches?A(Y)(`settings.tls.keyMatches`):A(Y)(`settings.tls.keyMismatch`)),1)]),_:1},8,[`tone`])])]),B(`div`,Iq,[B(`dt`,Lq,O(A(Y)(`settings.tls.fingerprint`)),1),B(`dd`,Rq,[B(`span`,zq,O(d.value.fingerprint??`—`),1),d.value.fingerprint?(L(),z(pG,{key:0,value:d.value.fingerprint,label:A(Y)(`settings.tls.copyFingerprint`)},null,8,[`value`,`label`])):U(``,!0)])])])])):(L(),R(`div`,Bq,[V(YU,{tone:`info`,title:A(Y)(`settings.tls.noCertificateTitle`)},{default:j(()=>[H(O(A(Y)(`settings.tls.noCertificateText`)),1)]),_:1},8,[`title`])])),B(`div`,Vq,[B(`label`,{class:D(A(BB)),for:`tls-cert-file`},O(A(Y)(`settings.tls.certFile`)),3),B(`input`,{id:`tls-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(m)),onChange:t[2]||=e=>h(e,`cert`)},null,34)]),B(`div`,Hq,[B(`label`,{class:D(A(BB)),for:`tls-key-file`},O(A(Y)(`settings.tls.keyFile`)),3),B(`input`,{id:`tls-key-file`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(m)),onChange:t[3]||=e=>h(e,`key`)},null,34)]),V(TV,{modelValue:o.value,"onUpdate:modelValue":t[4]||=e=>o.value=e,label:A(Y)(`settings.tls.pasteCertificate`),rows:4,placeholder:`-----BEGIN CERTIFICATE-----`},null,8,[`modelValue`,`label`]),V(TV,{modelValue:s.value,"onUpdate:modelValue":t[5]||=e=>s.value=e,label:A(Y)(`settings.tls.pasteKey`),rows:4,placeholder:`-----BEGIN PRIVATE KEY-----`},null,8,[`modelValue`,`label`]),B(`div`,Uq,[V($,{variant:`primary`,disabled:!p.value,loading:u.value,onClick:g},{default:j(()=>[H(O(A(Y)(`settings.tls.saveCertificate`)),1)]),_:1},8,[`disabled`,`loading`]),d.value?.certPresent?(L(),z(KU,{key:0,label:A(Y)(`settings.tls.removeCertificate`),"confirm-label":A(Y)(`settings.tls.confirmRemove`),"confirm-variant":`danger`,title:A(Y)(`settings.tls.removeTitle`),hint:A(Y)(`settings.tls.removeHint`),disabled:u.value,onConfirm:_},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),l.value||c.value?(L(),R(`div`,Wq,[l.value?(L(),z(YU,{key:0,tone:`danger`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0),c.value?(L(),z(YU,{key:1,tone:`ok`},{default:j(()=>[H(O(c.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`])],64))}}),Kq=N({__name:`LanguageSelect`,props:{labelled:{type:Boolean,default:!0},wide:{type:Boolean,default:!1}},setup(e){let t=e,n=k(!1),r=W(()=>JP.map(e=>({value:e.code,label:e.name}))),i=k(null),a=W({get:()=>i.value??xF(),set:e=>{e!==xF()&&(i.value=e,n.value=!0,vF(e).finally(()=>{i.value=null,n.value=!1}))}});return(e,i)=>(L(),z($B,{modelValue:a.value,"onUpdate:modelValue":i[0]||=e=>a.value=e,label:t.labelled?A(Y)(`language.label`):void 0,options:r.value,wide:t.wide,disabled:n.value,"aria-label":t.labelled?void 0:A(Y)(`language.select`),"data-testid":`language-select`},null,8,[`modelValue`,`label`,`options`,`wide`,`disabled`,`aria-label`]))}}),qq={class:`mb-5`},Jq={class:`text-xl font-semibold tracking-tight text-ink`},Yq={class:`mt-1 text-xs text-muted`},Xq={class:`text-2xs leading-4 text-faint sm:col-span-2`},Zq=N({__name:`GlobalSettingsView`,setup(e){let t=W(()=>[{id:`listener`,title:Y(`views.globalSettings.sectionListener`)},{id:`authentication`,title:Y(`views.globalSettings.sectionAuthentication`)},{id:`host`,title:Y(`views.globalSettings.sectionHost`)},{id:`backups`,title:Y(`views.globalSettings.sectionBackups`)},{id:`tls`,title:Y(`views.globalSettings.sectionTls`)},{id:`language`,title:Y(`language.label`)},{id:`interface`,title:Y(`views.globalSettings.sectionInterface`)},{id:`paths`,title:Y(`views.globalSettings.sectionPaths`)}]),n=tI(),r=fP(),i=tn(zz()),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(null),u=W(()=>n.control.value),d=W(()=>n.host.value?.alerts??[]),f=W(()=>l.value?.host??null),p=W(()=>l.value?.backups??null),m=W(()=>n.backups.value),h=W(()=>l.value?.ui??null),g=W(()=>n.version.value),_=W(()=>n.dataRoot.value),v=W(()=>n.projectDir.value),y=W(()=>_.value===null?null:`${_.value}/settings.json`),b=W(()=>{let e={},t=u.value;if(t!==null){let n=Zz(t,i);Object.keys(n).length>0&&(e.control=n)}let n=f.value;if(n!==null){let t=Yz(n,i.host);Object.keys(t).length>0&&(e.host=t)}let r=p.value;if(r!==null){let t=Xz(r,i.backups);Object.keys(t).length>0&&(e.backups=t)}return e}),x=W(()=>Ez(b.value)),S=W(()=>{let e=u.value,t=f.value,n=p.value;return{control:e===null?{}:{...Wz(e),auth:Uz(e.auth)},host:t??{},backups:n===null?{}:{enabled:n.enabled,keep:n.keep,includePaths:n.includePaths,schedule:n.schedule??{}}}}),C=W(()=>Tz(b.value,S.value)),w=W(()=>u.value!==null&&pB(u.value,i)),T=W(()=>u.value!==null&&mB(u.value,i)),ee=W(()=>u.value!==null&&hB(u.value,i)),te=W(()=>f.value!==null&&Object.keys(Yz(f.value,i.host)).length>0),ne=W(()=>p.value!==null&&Object.keys(Xz(p.value,i.backups)).length>0),re={};function ie(){let e=(e,t)=>{fB(re[e],oB(i,e))||(t(),re[e]=oB(i,e))},t=u.value;t!==null&&(cB(i,re.control,`listener`)||(Object.assign(i.control,Wz(t)),lB(i,re,`listener`)),cB(i,re.control,`auth`)||(Object.assign(i.auth,Uz(t.auth)),lB(i,re,`auth`)),cB(i,re.control,`tls`)||(i.control.tlsEnabled=t.tls.enabled,lB(i,re,`tls`)));let n=f.value;n!==null&&e(`host`,()=>Object.assign(i.host,Kz(n)));let r=p.value;r!==null&&e(`backups`,()=>Object.assign(i.backups,Jz(r)))}function ae(){for(let e of Object.keys(re))delete re[e]}function oe(e){re[e]=oB(i,e)}M([u,l],()=>{ie()},{immediate:!0});async function se(){c.value=null;try{l.value=await GM()}catch(e){c.value=CM(e)}}ia(()=>{se()});async function ce(){let e=b.value;if(!(Object.keys(e).length===0||a.value)){a.value=!0,o.value=null,s.value=null;try{let t=await n.saveGlobalSettings(e);if(!t){o.value=n.lastError.value??Y(`views.globalSettings.saveFailed`);return}s.value=Y(`views.globalSettings.saved`),r.success(Y(`views.globalSettings.savedToast`)),await se(),ae(),ie();let i=await vB(t);i===null?t.rebinding&&(s.value=Y(`views.globalSettings.savedRebinding`)):(s.value=null,o.value=i)}finally{a.value=!1}}}function le(){o.value=null,s.value=null,ae(),ie()}function E(){f.value!==null&&Object.assign(i.host,Kz(f.value)),oe(`host`)}function ue(){p.value!==null&&Object.assign(i.backups,Jz(p.value)),oe(`backups`)}function de(){if(u.value!==null){let e=Wz(u.value);i.control.label=e.label,i.control.port=e.port,i.control.host=e.host,i.control.openBrowser=e.openBrowser}lB(i,re,`listener`)}function fe(){u.value!==null&&Object.assign(i.auth,Uz(u.value.auth)),lB(i,re,`auth`)}function pe(){u.value!==null&&(i.control.tlsEnabled=u.value.tls.enabled),lB(i,re,`tls`)}return(e,r)=>(L(),z(_q,{sections:t.value,"nav-label":A(Y)(`views.globalSettings.navLabel`),"changes-description":A(Y)(`views.globalSettings.changesDescription`),"changed-count":x.value,changes:C.value,"save-error":o.value,"save-message":s.value,saving:a.value,onSave:ce,onDiscard:le},{header:j(()=>[B(`header`,qq,[B(`h1`,Jq,O(A(Y)(`views.globalSettings.title`)),1),B(`p`,Yq,O(A(Y)(`views.globalSettings.description`)),1)]),c.value?(L(),z(YU,{key:0,tone:`warn`,title:A(Y)(`views.globalSettings.loadErrorTitle`),class:`mb-4`},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(JK,{id:`listener`,title:A(Y)(`views.globalSettings.sectionListener`),description:A(Y)(`views.globalSettings.listenerDescription`)},{default:j(()=>[V(EK,{control:i.control,"onUpdate:control":r[0]||=e=>i.control=e,view:u.value,dirty:w.value,onReset:de},null,8,[`control`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`authentication`,title:A(Y)(`views.globalSettings.sectionAuthentication`),description:A(Y)(`views.globalSettings.authenticationDescription`)},{default:j(()=>[V($U,{auth:i.auth,"onUpdate:auth":r[1]||=e=>i.auth=e,view:u.value,dirty:ee.value,onReset:fe},null,8,[`auth`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`host`,title:A(Y)(`views.globalSettings.sectionHost`),description:A(Y)(`views.globalSettings.hostDescription`)},{default:j(()=>[V(tK,{host:i.host,"onUpdate:host":r[2]||=e=>i.host=e,config:f.value,alerts:d.value,dirty:te.value,onReset:E},null,8,[`host`,`config`,`alerts`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`backups`,title:A(Y)(`views.globalSettings.sectionBackups`),description:A(Y)(`views.globalSettings.backupsDescription`)},{default:j(()=>[V(qG,{form:i.backups,"onUpdate:form":r[3]||=e=>i.backups=e,state:m.value,policy:p.value,"config-path":y.value,workspaces:A(n).workspaces.value,dirty:ne.value,onReset:ue},null,8,[`form`,`state`,`policy`,`config-path`,`workspaces`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`tls`,title:A(Y)(`views.globalSettings.sectionTls`),description:A(Y)(`views.globalSettings.tlsDescription`)},{default:j(()=>[V(Gq,{"tls-enabled":i.control.tlsEnabled,"onUpdate:tlsEnabled":r[4]||=e=>i.control.tlsEnabled=e,view:u.value,dirty:T.value,onReset:pe},null,8,[`tls-enabled`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`language`,title:A(Y)(`language.label`),description:A(Y)(`views.globalSettings.languageDescription`)},{default:j(()=>[V(Kq,{wide:!0}),B(`p`,Xq,O(A(Y)(`views.globalSettings.languageNote`)),1)]),_:1},8,[`title`,`description`]),V(JK,{id:`interface`,title:A(Y)(`views.globalSettings.sectionInterface`),description:A(Y)(`views.globalSettings.interfaceDescription`)},{default:j(()=>[V(_K,{label:i.control.label,"onUpdate:label":r[5]||=e=>i.control.label=e,ui:h.value,"panel-version":g.value,"label-dirty":w.value,onChanged:se,onResetLabel:de},null,8,[`label`,`ui`,`panel-version`,`label-dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`paths`,title:A(Y)(`views.globalSettings.sectionPaths`),description:A(Y)(`views.globalSettings.pathsDescription`)},{default:j(()=>[V(HK,{"data-root":_.value,"project-dir":v.value,"panel-url":u.value?.url??null,workspaces:A(n).workspaces.value},null,8,[`data-root`,`project-dir`,`panel-url`,`workspaces`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),Qq={class:`relative flex min-h-dvh items-center justify-center overflow-hidden bg-page px-4 py-10`},$q={class:`hh-enter relative w-full max-w-md`},eJ={class:`mb-6 flex items-center gap-3`},tJ={class:`text-lg font-semibold tracking-tight text-ink`},nJ={class:`text-xs text-muted`},rJ={class:`rounded-panel border border-line bg-panel/95 p-5 shadow-float backdrop-blur-sm`},iJ={class:`flex items-start justify-between gap-3`},aJ={class:`min-w-0`},oJ={class:`text-base font-semibold text-ink`},sJ={class:`mt-1 text-xs leading-relaxed text-muted`},cJ={class:`flex shrink-0 items-center gap-2`},lJ={class:`w-36`},uJ={class:`flex flex-col gap-1.5`},dJ={class:`relative`},fJ=[`type`],pJ=[`aria-label`],mJ={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`},hJ={key:1,class:`mt-5`},gJ={class:`mt-4 space-y-2`},_J={key:0,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},vJ={class:`text-2xs leading-4 text-warn`},yJ={class:`mx-1 rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},bJ={key:1,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},xJ={class:`text-2xs leading-4 text-warn`},SJ={key:2,class:`flex items-start gap-2 rounded-control border border-line-soft bg-panel-2 px-2.5 py-2`},CJ={class:`text-2xs leading-4 text-muted`},wJ={class:`mt-4 flex items-center justify-center gap-2 text-2xs text-faint`},TJ={class:`font-mono`},EJ=N({__name:`LoginView`,setup(e){let t=$g(),n=Qg(),r=tI(),{session:i,error:a,login:o,refresh:s}=sP(),c=k(``),l=k(!1),u=k(!1),d=W(()=>i.value?.passwordSet===!1),f=W(()=>i.value!==null&&!i.value.authRequired),p=W(()=>i.value?.usingDefaultPassword===!0&&i.value.defaultPassword!==null),m=W(()=>r.control.value?.auth.exposed===!0),h=W(()=>r.control.value?.url??`—`),g=W(()=>NR(i.value?.sessionTtlMs??0)),_=W(()=>d.value?Y(`login.firstRunTitle`):f.value?Y(`login.authOffTitle`):Y(`login.title`)),v=W(()=>d.value?Y(`login.firstRunSubtitle`):f.value?Y(`login.authOffSubtitle`):Y(`login.subtitle`));async function y(){l.value=!0;try{if(await o(c.value)){c.value=``;let e=typeof t.query.next==`string`?t.query.next:`/`;await n.push(e)}}finally{l.value=!1}}async function b(){await s(),await n.push(`/`)}return ia(async()=>{i.value===null&&await s()}),(e,t)=>(L(),R(`div`,Qq,[t[5]||=B(`div`,{class:`bg-instrument pointer-events-none absolute inset-0 opacity-60`},null,-1),t[6]||=B(`div`,{class:`pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_15%,var(--page)_78%)]`},null,-1),B(`div`,$q,[B(`div`,eJ,[t[2]||=As(`<span class="grid size-11 shrink-0 place-items-center rounded-panel border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,null,[B(`p`,tJ,O(A(Y)(`app.name`)),1),B(`p`,nJ,O(A(Y)(`app.tagline`)),1)])]),B(`section`,rJ,[B(`div`,iJ,[B(`div`,aJ,[B(`h1`,oJ,O(_.value),1),B(`p`,sJ,O(v.value),1)]),B(`div`,cJ,[m.value?(L(),z(hG,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`login.exposed`)),1)]),_:1})):U(``,!0),B(`div`,lJ,[V(Kq,{labelled:!1})])])]),f.value?(L(),R(`div`,hJ,[V($,{variant:`primary`,size:`md`,block:``,onClick:b},{default:j(()=>[H(O(A(Y)(`login.openDashboard`)),1)]),_:1})])):(L(),R(`form`,{key:0,class:`mt-5 space-y-3`,onSubmit:_u(y,[`prevent`])},[B(`div`,uJ,[B(`label`,{for:`hh-password`,class:D(A(BB))},O(A(Y)(`login.password`)),3),B(`div`,dJ,[wr(B(`input`,{id:`hh-password`,"onUpdate:modelValue":t[0]||=e=>c.value=e,type:u.value?`text`:`password`,autocomplete:`current-password`,autofocus:``,required:``,class:D(A(Q)(A(HB),`pr-9`))},null,10,fJ),[[du,c.value]]),B(`button`,{type:`button`,class:`absolute right-1 top-1/2 grid size-7 -translate-y-1/2 place-items-center rounded-control text-faint transition-colors duration-150 hover:text-ink`,"aria-label":u.value?A(Y)(`login.hidePassword`):A(Y)(`login.showPassword`),onClick:t[1]||=e=>u.value=!u.value},[u.value?(L(),z(A(hy),{key:0,class:`size-3.5`})):(L(),z(A(gy),{key:1,class:`size-3.5`}))],8,pJ)])]),A(a)?(L(),R(`p`,mJ,O(A(a)),1)):U(``,!0),V($,{type:`submit`,variant:`primary`,size:`md`,block:``,loading:l.value},{default:j(()=>[V(A(Ty),{class:`size-3.5`}),H(` `+O(A(Y)(`login.signIn`)),1)]),_:1},8,[`loading`])],32)),B(`div`,gJ,[p.value?(L(),R(`div`,_J,[V(A(Wy),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,vJ,[V(EV,{k:`login.defaultPasswordWarning`},{password:j(()=>[B(`code`,yJ,O(A(i)?.defaultPassword),1)]),_:1})])])):d.value?(L(),R(`div`,bJ,[V(A(Ky),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,xJ,[V(EV,{k:`login.noPasswordWarning`},{command:j(()=>[...t[3]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`home-hosted set-password`,-1)]]),_:1})])])):(L(),R(`div`,SJ,[V(A(Gy),{class:`mt-0.5 size-3.5 shrink-0 text-ok`}),B(`p`,CJ,O(A(Y)(`login.sessionNote`,{duration:g.value})),1)]))])]),B(`p`,wJ,[B(`span`,TJ,O(h.value),1),t[4]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(A(Y)(`login.servedFromThisMachine`)),1)])])]))}}),DJ=[`#3f4a5c`,`#f07178`,`#7fd88f`,`#e6b673`,`#82aaff`,`#c792ea`,`#7fdbca`,`#c7d2e3`,`#5a6779`,`#ff8b92`,`#9ae6a8`,`#f2c98a`,`#9dbaff`,`#d7aef0`,`#9ce9dc`,`#eef3fb`],OJ=[`#4b5563`,`#c0392b`,`#1c7c3f`,`#9a6700`,`#2f5fe0`,`#7c3aed`,`#0b6f89`,`#334155`,`#6b7280`,`#d64535`,`#22854a`,`#a8620d`,`#3f6bff`,`#8b5cf6`,`#0e7d9c`,`#0f1722`],kJ=/\u001B\[([0-9;]*)m/g,AJ=/\u001B(?:\[[0-9;?]*[A-HJKSTfhilmnprsu]|\][^\u0007\u001B]*(?:\u0007|\u001B\\)?|[()][0-9A-Z])/g;function jJ(e){return Math.max(0,Math.min(255,e))}function MJ(e){return e===0?0:55+e*40}function NJ(e,t){let n=t?DJ:OJ;if(e<16)return n[e]??n[7];if(e<232){let t=e-16;return`rgb(${MJ(Math.floor(t/36))} ${MJ(Math.floor(t%36/6))} ${MJ(t%6)})`}let r=8+(e-232)*10;return`rgb(${r} ${r} ${r})`}function PJ(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function FJ(e,t,n){let r=t.length===0?[0]:t.split(`;`).map(e=>e.length===0?0:Number(e));for(let t=0;t<r.length;t+=1){let i=r[t];if(i===0)Object.assign(e,PJ());else if(i===1)e.bold=!0;else if(i===2)e.dim=!0;else if(i===3)e.italic=!0;else if(i===4)e.underline=!0;else if(i===22)e.bold=!1,e.dim=!1;else if(i===23)e.italic=!1;else if(i===24)e.underline=!1;else if(i===39)e.fg=null;else if(i===49)e.bg=null;else if(i>=30&&i<=37)e.fg=(n?DJ:OJ)[i-30]??null;else if(i>=90&&i<=97)e.fg=(n?DJ:OJ)[i-90+8]??null;else if(i>=40&&i<=47)e.bg=(n?DJ:OJ)[i-40]??null;else if(i>=100&&i<=107)e.bg=(n?DJ:OJ)[i-100+8]??null;else if(i===38||i===48){let a=i===38?`fg`:`bg`,o=r[t+1];o===5&&r[t+2]!==void 0?(e[a]=NJ(jJ(r[t+2]),n),t+=2):o===2&&(e[a]=`rgb(${jJ(r[t+2]??0)} ${jJ(r[t+3]??0)} ${jJ(r[t+4]??0)})`,t+=4)}}}function IJ(e,t,n){if(t.length===0)return;let r=e[e.length-1];r&&r.fg===n.fg&&r.bg===n.bg&&r.bold===n.bold&&r.dim===n.dim&&r.italic===n.italic&&r.underline===n.underline?r.text+=t:e.push({text:t,...n})}function LJ(e){return e.includes(`\x1B`)}function RJ(e,t=!0){if(!LJ(e))return[{text:e,fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}];let n=[],r=PJ(),i=0;kJ.lastIndex=0;let a=kJ.exec(e);for(;a!==null;)IJ(n,e.slice(i,a.index).replace(AJ,``),r),FJ(r,a[1]??``,t),i=a.index+a[0].length,a=kJ.exec(e);return IJ(n,e.slice(i).replace(AJ,``),r),n}var zJ={class:`flex h-5 w-max min-w-full items-center gap-2 whitespace-pre px-2 font-mono text-xs leading-5`},BJ={key:0,class:`shrink-0 select-none text-faint`},VJ={class:`min-w-0`},HJ=N({__name:`LogRow`,props:{line:{},query:{},dark:{type:Boolean},showTime:{type:Boolean}},setup(e){let t=e,n=W(()=>RJ(t.line.text,t.dark)),r=W(()=>{let e=t.query.trim().toLowerCase(),r=[];for(let t of n.value){if(e.length===0){r.push({text:t.text,hit:!1,span:t});continue}let n=t.text.toLowerCase(),i=0,a=n.indexOf(e);for(;a!==-1;)a>i&&r.push({text:t.text.slice(i,a),hit:!1,span:t}),r.push({text:t.text.slice(a,a+e.length),hit:!0,span:t}),i=a+e.length,a=n.indexOf(e,i);i<t.text.length&&r.push({text:t.text.slice(i),hit:!1,span:t})}return r}),i={stdout:`bg-transparent`,stderr:`bg-danger`,system:`bg-info`};function a(e){let t={};return e.span.fg&&(t.color=e.span.fg),e.span.bg&&(t.backgroundColor=e.span.bg),e.span.bold&&(t.fontWeight=`600`),e.span.dim&&(t.opacity=`0.62`),e.span.italic&&(t.fontStyle=`italic`),e.span.underline&&(t.textDecoration=`underline`),e.hit&&(t.backgroundColor=`var(--warn)`,t.color=`var(--accent-ink)`,t.borderRadius=`2px`),t}return(e,n)=>(L(),R(`div`,zJ,[t.showTime?(L(),R(`span`,BJ,O(A(IR)(t.line.ts)),1)):U(``,!0),B(`span`,{class:D([`h-3.5 w-0.5 shrink-0 rounded-full`,[i[t.line.stream]]]),"aria-hidden":`true`},null,2),B(`span`,VJ,[(L(!0),R(I,null,P(r.value,(e,t)=>(L(),R(`span`,{key:t,style:_e(a(e))},O(e.text),5))),128))])]))}}),UJ={class:`flex min-h-0 flex-col overflow-hidden rounded-panel border border-line bg-panel`},WJ={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel-2/60 px-2.5 py-2`},GJ={class:`relative min-w-40 flex-1 sm:max-w-72`},KJ=[`placeholder`,`aria-label`],qJ={class:`absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5`},JJ={key:0,class:`px-1 font-mono text-2xs tabular-nums text-faint`},YJ=[`aria-label`],XJ=[`aria-label`],ZJ=[`aria-label`],QJ={class:`ml-auto flex items-center gap-1.5`},$J=[`href`,`download`],eY={class:`relative min-h-0 flex-1`},tY=[`aria-label`],nY={key:0,class:`px-3 py-6 text-center text-xs text-faint`},rY={class:`flex items-center gap-3 border-t border-line bg-panel-2/60 px-2.5 py-1.5 text-2xs text-faint`},iY={class:`flex items-center gap-1.5`},aY={class:`font-mono tabular-nums`},oY={key:0,class:`font-mono tabular-nums`},sY={class:`ml-auto hidden font-mono tabular-nums sm:inline`},cY=20,lY=12,uY=N({__name:`LogViewer`,props:{lines:{},version:{default:0},live:{type:Boolean,default:!1},emptyHint:{default:void 0},clearable:{type:Boolean,default:!1},downloadUrl:{default:void 0},downloadName:{default:void 0},minHeight:{default:`16rem`}},emits:[`clear`],setup(e,{emit:t}){let n=e,r=t,i=uI(),a=k(null),o=k(0),s=k(320),c=k(!0),l=k(`all`),u=k(``),d=k(!0),f=k(0),p=W(()=>{n.version;let e=u.value.trim().toLowerCase(),t=l.value;return e.length===0&&t===`all`?n.lines:n.lines.filter(n=>!(t!==`all`&&n.stream!==t||e.length>0&&!n.text.toLowerCase().includes(e)))}),m=W(()=>p.value.length),h=W(()=>{let e=u.value.trim().toLowerCase();if(e.length===0)return[];let t=[],n=p.value;for(let r=0;r<n.length;r+=1)n[r].text.toLowerCase().includes(e)&&t.push(r);return t}),g=W(()=>Math.max(0,Math.floor(o.value/cY)-lY)),_=W(()=>Math.min(m.value,Math.ceil((o.value+s.value)/cY)+lY)),v=W(()=>p.value.slice(g.value,_.value)),y=W(()=>h.value[f.value]??-1);function b(){let e=a.value;if(!e)return;o.value=e.scrollTop;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c.value=t<12}function x(){let e=a.value;e&&(e.scrollTop=e.scrollHeight,o.value=e.scrollTop,c.value=!0)}function S(e){let t=a.value;t&&(t.scrollTop=Math.max(0,e*cY-t.clientHeight/2),o.value=t.scrollTop,c.value=!1)}function C(e){let t=h.value.length;t!==0&&(f.value=(f.value+e+t)%t,S(h.value[f.value]))}M(()=>[n.version,m.value],()=>{c.value&&(f.value=0,requestAnimationFrame(x))}),M(h,()=>{f.value=0,h.value.length>0&&u.value.trim().length>0&&requestAnimationFrame(()=>S(h.value[0]))}),M(l,()=>{c.value=!0,requestAnimationFrame(x)});let w=null;ia(()=>{let e=a.value;e&&(s.value=e.clientHeight,w=new ResizeObserver(()=>{a.value&&(s.value=a.value.clientHeight)}),w.observe(e),x())}),ze(()=>{w?.disconnect(),w=null});let T=W(()=>[{value:`all`,label:Y(`logs.streamAll`)},{value:`stdout`,label:Y(`logs.streamOut`)},{value:`stderr`,label:Y(`logs.streamErr`)},{value:`system`,label:Y(`logs.streamSys`)}]);return(e,t)=>(L(),R(`div`,UJ,[B(`header`,WJ,[V(ZW,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,options:T.value},null,8,[`modelValue`,`options`]),B(`div`,GJ,[V(A(Vy),{class:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),wr(B(`input`,{"onUpdate:modelValue":t[1]||=e=>u.value=e,type:`search`,placeholder:A(Y)(`logs.searchPlaceholder`),class:D([`h-7 py-0 pl-7 text-xs`,[A(HB)]]),"aria-label":A(Y)(`logs.searchLabel`),onKeydown:t[2]||=yu(_u(e=>C(e.shiftKey?-1:1),[`prevent`]),[`enter`])},null,42,KJ),[[nu,u.value]]),B(`div`,qJ,[u.value.trim().length>0?(L(),R(`span`,JJ,O(h.value.length===0?`0`:`${f.value+1}/${h.value.length}`),1)):U(``,!0),u.value.length>0?(L(),R(`button`,{key:1,type:`button`,class:`grid size-6 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.clearSearch`),onClick:t[3]||=e=>u.value=``},[V(A(nb),{class:`size-3`})],8,YJ)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:2,type:`button`,class:`grid size-6 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.prevMatch`),onClick:t[4]||=e=>C(-1)},[V(A(ny),{class:`size-3`})],8,XJ)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:3,type:`button`,class:`grid size-6 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.nextMatch`),onClick:t[5]||=e=>C(1)},[V(A($v),{class:`size-3`})],8,ZJ)):U(``,!0)])]),B(`div`,QJ,[V(_H,{label:d.value?A(Y)(`logs.hideTimestamps`):A(Y)(`logs.showTimestamps`)},{default:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>d.value=!d.value},{default:j(()=>[V(A(sy),{class:D(A(Q)(`size-3`,d.value?`fill-accent text-accent`:`text-faint`))},null,8,[`class`]),H(` `+O(A(Y)(`logs.timestampsShort`)),1)]),_:1})]),_:1},8,[`label`]),V($,{size:`xs`,variant:c.value?`secondary`:`primary`,onClick:t[7]||=e=>c.value?c.value=!1:x()},{default:j(()=>[(L(),z(_a(c.value?A(My):A(Py)),{class:`size-3`})),H(` `+O(c.value?A(Y)(`logs.pause`):A(Y)(`logs.follow`)),1)]),_:1},8,[`variant`]),n.clearable?(L(),z(_H,{key:0,label:A(Y)(`logs.clearHint`)},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.clearLabel`),onClick:t[8]||=e=>r(`clear`)},{default:j(()=>[V(A($y),{class:`size-3.5`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`])):U(``,!0),n.downloadUrl?(L(),z(_H,{key:1,label:A(Y)(`logs.downloadHint`)},{default:j(()=>[B(`a`,{href:n.downloadUrl,download:n.downloadName},[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.downloadLabel`)},{default:j(()=>[V(A(Xv),{class:`size-3.5`})]),_:1},8,[`aria-label`])],8,$J)]),_:1},8,[`label`])):U(``,!0)])]),B(`div`,eY,[B(`div`,{ref_key:`scroller`,ref:a,class:`h-full overflow-auto overscroll-contain bg-page/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`,style:_e({minHeight:n.minHeight}),tabindex:`0`,role:`log`,"aria-label":A(Y)(`logs.outputLabel`),onScrollPassive:b},[m.value===0?(L(),R(`p`,nY,O(n.lines.length===0?n.emptyHint??A(Y)(`logs.emptyHint`):A(Y)(`logs.noMatches`)),1)):(L(),R(`div`,{key:1,class:`relative w-full`,style:_e({height:`${m.value*cY}px`})},[(L(!0),R(I,null,P(v.value,(e,t)=>(L(),R(`div`,{key:g.value+t,class:D([`absolute left-0 top-0`,g.value+t===y.value&&`bg-warn/10`]),style:_e({transform:`translateY(${(g.value+t)*cY}px)`})},[V(HJ,{line:e,query:u.value,dark:A(i).isDark.value,"show-time":d.value},null,8,[`line`,`query`,`dark`,`show-time`])],6))),128))],4))],44,tY),V(Ac,{"enter-active-class":`transition duration-150`,"leave-active-class":`transition duration-100`,"enter-from-class":`opacity-0 translate-y-1`,"leave-to-class":`opacity-0 translate-y-1`},{default:j(()=>[!c.value&&m.value>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-line bg-raise px-2.5 py-1 text-2xs text-muted shadow-float transition-colors duration-150 hover:text-ink`,onClick:x},[V(A(Xv),{class:`size-3`}),H(` `+O(A(Y)(`logs.jumpToLatest`)),1)])):U(``,!0)]),_:1})]),B(`footer`,rY,[B(`span`,iY,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,n.live?c.value?`bg-ok`:`bg-warn`:`bg-faint`))},null,2),H(` `+O(n.live?c.value?A(Y)(`logs.streaming`):A(Y)(`logs.paused`):A(Y)(`logs.snapshot`)),1)]),B(`span`,aY,O(m.value===n.lines.length?A(bF)(`logs.lines`,m.value):A(Y)(`logs.linesOf`,{count:m.value,total:n.lines.length})),1),u.value.trim().length>0?(L(),R(`span`,oY,O(A(Y)(`logs.matches`,{count:h.value.length})),1)):U(``,!0),B(`span`,sY,O(A(Y)(`logs.rowHeight`,{height:cY})),1)])]))}}),dY={class:`flex h-full min-h-0`},fY={class:`hidden w-64 shrink-0 flex-col border-r border-line bg-panel/40 md:flex`},pY={class:`border-b border-line px-3 py-2.5`},mY={class:`text-xs font-semibold text-ink`},hY={class:`mt-0.5 text-2xs text-faint`},gY={class:`min-h-0 flex-1 overflow-y-auto p-1.5`},_Y={key:0,class:`space-y-1.5 p-1.5`},vY=[`onClick`],yY={class:`min-w-0 flex-1`},bY={key:0,class:`block truncate font-mono text-2xs text-faint`},xY={key:1,class:`block truncate font-mono text-2xs text-faint`},SY={class:`border-t border-line p-2.5`},CY={class:`text-2xs leading-4 text-faint`},wY={class:`flex min-w-0 flex-1 flex-col`},TY={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel/40 px-3 py-2.5`},EY={class:`min-w-0`},DY={class:`truncate text-sm font-semibold text-ink`},OY={key:0,class:`ml-1.5 font-mono text-2xs font-normal text-faint`},kY=[`aria-label`,`placeholder`],AY={key:0,class:`flex flex-wrap items-center gap-1.5 border-b border-line-soft bg-panel-2/40 px-3 py-2`},jY=[`href`,`download`],MY={class:`text-faint`},NY={key:1,class:`text-2xs text-faint`},PY={key:2,class:`ml-auto font-mono text-2xs text-faint`},FY={key:3,class:`font-mono text-2xs text-faint`},IY={key:1,class:`flex items-center gap-1.5 border-b border-danger/25 bg-danger-soft px-3 py-2 text-2xs text-danger`},LY={class:`min-h-0 flex-1 p-3`},RY={class:`text-xs text-muted`},zY=N({__name:`LogsView`,setup(e){let t=$g(),n=Qg(),r=gI(),i=k([]),a=k(null),o=k(`disk`),s=k(`2000`),c=k(``),l=k(``),u=k(null),d=k(!1),f=k(null),p=k([]),m=k(0),h=k(!1),g=k(!0),_=W(()=>i.value.find(e=>e.serverId===a.value)??null),v=eI(r.activeId,()=>o.value===`live`?a.value:null),y=v.version,b=W(()=>(y.value,v.lines())),x=W(()=>o.value===`live`?b.value:p.value),S=W(()=>o.value===`live`?y.value:m.value),C=[200,500,2e3,5e3].map(e=>({value:String(e),label:bF(`logs.lines`,e,{count:e})})),w=[{value:``,label:Y(`views.logs.allStreams`)},{value:`stdout`,label:`stdout`},{value:`stderr`,label:`stderr`},{value:`system`,label:`system`}],T=W(()=>i.value.reduce((e,t)=>e+t.sizeBytes,0)),ee=W(()=>i.value.filter(e=>e.files.length>0).length);async function te(){g.value=!0;try{i.value=await NN(r.activeId.value);let e=typeof t.query.server==`string`?t.query.server:null,n=e&&i.value.some(t=>t.serverId===e)?e:a.value&&i.value.some(e=>e.serverId===a.value)?a.value:i.value[0]?.serverId??null;a.value=n}catch(e){f.value=CM(e)}finally{g.value=!1}}let ne=0;async function re(){let e=a.value;if(e===null||o.value===`live`)return;let t=++ne;d.value=!0,f.value=null;try{let n=await PN(r.activeId.value,e,{tail:Number(s.value),...c.value.length>0?{stream:c.value}:{},...l.value.trim().length>0?{search:l.value.trim()}:{}});if(t!==ne)return;p.value=n.lines,u.value=n.searched??null,m.value+=1}catch(e){if(t!==ne)return;f.value=CM(e)}finally{t===ne&&(d.value=!1)}}async function ie(){let e=a.value;if(e!==null){h.value=!1;try{await FN(r.activeId.value,e),p.value=[],m.value+=1,await te()}catch(e){f.value=CM(e)}}}function ae(e){a.value=e,o.value===`live`&&(p.value=[]),n.replace({query:{...t.query,server:e}})}M([a,s,c,o],()=>{o.value===`disk`?re():u.value=null},{immediate:!1});let oe=null;return M(l,()=>{oe!==null&&clearTimeout(oe),oe=setTimeout(()=>{oe=null,o.value===`disk`&&re()},300)}),ze(()=>{oe!==null&&clearTimeout(oe)}),M(()=>r.activeId.value,()=>{a.value=null,p.value=[],o.value=`disk`,te().then(()=>re())}),ia(async()=>{await te(),o.value===`disk`&&await re()}),(e,t)=>(L(),R(`div`,dY,[B(`aside`,fY,[B(`div`,pY,[B(`p`,mY,O(A(Y)(`views.logs.persistedTitle`)),1),B(`p`,hY,O(A(Y)(`views.logs.persistedSummary`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`),persisted:ee.value,total:i.value.length,size:A(RR)(T.value)})),1)]),B(`div`,gY,[g.value?(L(),R(`div`,_Y,[(L(),R(I,null,P(5,e=>V(oU,{key:e,class:`h-10 w-full`,rounded:`rounded-control`})),64))])):(L(!0),R(I,{key:1},P(i.value,e=>(L(),R(`button`,{key:e.serverId,type:`button`,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors duration-150`,e.serverId===a.value?`bg-accent-soft`:`hover:bg-hover`)),onClick:t=>ae(e.serverId)},[B(`span`,{class:D(A(Q)(`size-1.5 shrink-0 rounded-full`,A(YL)[A(GL)[e.status].tone]))},null,2),B(`span`,yY,[B(`span`,{class:D(A(Q)(`block truncate text-xs`,e.serverId===a.value?`font-medium text-accent`:`text-ink`))},O(e.label),3),e.files.length>0?(L(),R(`span`,bY,O(A(bF)(`views.logs.filesOnDisk`,e.files.length))+` · `+O(A(RR)(e.sizeBytes)),1)):(L(),R(`span`,xY,O(A(Y)(`views.logs.nothingPersisted`)),1))])],10,vY))),128)),!g.value&&i.value.length===0?(L(),z(hR,{key:2,compact:``,title:A(Y)(`views.logs.noServersTitle`),description:A(Y)(`views.logs.noServersDescription`)},null,8,[`title`,`description`])):U(``,!0)]),B(`div`,SY,[B(`p`,CY,O(A(Y)(`views.logs.retentionNote`)),1)])]),B(`div`,wY,[B(`header`,TY,[B(`div`,EY,[B(`h1`,DY,[H(O(_.value?.label??A(Y)(`nav.logs`))+` `,1),_.value?(L(),R(`span`,OY,O(_.value.serverId),1)):U(``,!0)])]),V(ZW,{modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,class:`ml-auto`,options:[{value:`disk`,label:A(Y)(`views.logs.modePersisted`)},{value:`live`,label:A(Y)(`views.logs.modeLive`)}]},null,8,[`modelValue`,`options`]),o.value===`disk`?(L(),z($B,{key:0,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,options:A(C),class:`w-32`,"aria-label":A(Y)(`views.logs.tailAria`)},null,8,[`modelValue`,`options`,`aria-label`])):U(``,!0),o.value===`disk`?(L(),z($B,{key:1,modelValue:c.value,"onUpdate:modelValue":t[2]||=e=>c.value=e,options:w,class:`w-32`,"aria-label":A(Y)(`views.logs.streamAria`)},null,8,[`modelValue`,`aria-label`])):U(``,!0),o.value===`disk`?wr((L(),R(`input`,{key:2,"onUpdate:modelValue":t[3]||=e=>l.value=e,type:`search`,class:`w-44 min-w-0 rounded-control border border-line bg-panel px-2.5 py-1.5 text-xs text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50`,"aria-label":A(Y)(`views.logs.searchAria`),placeholder:A(Y)(`views.logs.searchPlaceholder`)},null,8,kY)),[[nu,l.value]]):U(``,!0),o.value===`disk`?(L(),z($,{key:3,size:`sm`,loading:d.value,onClick:re},{default:j(()=>[V(A(Ly),{class:`size-3.5`}),H(O(A(Y)(`views.logs.reload`)),1)]),_:1},8,[`loading`])):U(``,!0),o.value===`disk`?(L(),z($,{key:4,size:`sm`,variant:`ghost`,disabled:!_.value||_.value.files.length===0,onClick:t[4]||=e=>h.value=!0},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clearFile`)),1)]),_:1},8,[`disabled`])):U(``,!0)]),_.value?(L(),R(`div`,AY,[V(A(_y),{class:`size-3.5 shrink-0 text-faint`}),_.value.files.length>0?(L(!0),R(I,{key:0},P(_.value.files,e=>(L(),R(`a`,{key:e.name,href:IN(A(r).activeId.value,_.value.serverId,e.name),download:e.name,class:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},[H(O(e.name)+` `,1),B(`span`,MY,O(A(RR)(e.sizeBytes)),1),V(A(Xv),{class:`size-3`})],8,jY))),128)):(L(),R(`span`,NY,O(A(Y)(`views.logs.nothingOnDisk`)),1)),o.value===`disk`&&p.value.length>0?(L(),R(`span`,PY,O(A(Y)(`views.logs.loadedLines`,{count:p.value.length})),1)):U(``,!0),u.value===null?U(``,!0):(L(),R(`span`,FY,` · `+O(A(Y)(`views.logs.searchedLines`,{count:u.value})),1))])):U(``,!0),f.value?(L(),R(`p`,IY,[V(A(iy),{class:`size-3.5`}),H(` `+O(f.value),1)])):U(``,!0),B(`div`,LY,[_.value?d.value&&x.value.length===0?(L(),z(oU,{key:1,class:`h-full w-full`,rounded:`rounded-panel`})):(L(),z(uY,{key:2,lines:x.value,version:S.value,live:o.value===`live`,class:`h-full`,"empty-hint":o.value===`live`?A(Y)(`views.logs.waitingOutput`):A(Y)(`views.logs.fileEmpty`),"min-height":`100%`},null,8,[`lines`,`version`,`live`,`empty-hint`])):(L(),z(hR,{key:0,title:A(Y)(`views.logs.pickServerTitle`),description:A(Y)(`views.logs.pickServerDescription`)},{icon:j(()=>[V(A(By),{class:`size-4`})]),_:1},8,[`title`,`description`]))])]),V(xV,{open:h.value,"onUpdate:open":t[6]||=e=>h.value=e,title:A(Y)(`views.logs.clearTitle`),description:A(Y)(`views.logs.clearDescription`,{server:_.value?.serverId??``}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[5]||=e=>h.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ie},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clear`)),1)]),_:1})]),default:j(()=>[B(`p`,RY,O(A(Y)(`views.logs.clearNote`)),1)]),_:1},8,[`open`,`title`,`description`])]))}}),BY={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},VY={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},HY={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},UY={class:`p-4`},WY={class:`p-4`},GY={class:`p-4`},KY={class:`p-4`},qY={class:`p-4`},JY={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},YY={class:`min-w-0`},XY={class:`text-xs font-medium text-danger`},ZY={class:`mt-0.5 flex flex-wrap gap-x-2 text-2xs text-danger`},QY={class:`space-y-3`},$Y={class:`flex items-center justify-between`},eX={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},tX={key:0,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},nX={key:2,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},rX={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},iX={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},aX={class:`flex items-center gap-1`},oX={class:`font-mono`},sX=N({__name:`OverviewView`,setup(e){let t=tI(),n=gI(),r=k(!1),i=W(()=>t.appState.value===null),a=n.servers,o=W(()=>n.selected.value?.label??Y(`nav.workspace`)),s=W(()=>a.value.filter(e=>e.status===`running`)),c=W(()=>a.value.filter(e=>[`stopped`,`stopping`].includes(e.status))),l=W(()=>a.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),u=W(()=>{let e=0;for(let t of s.value){let n=CF(t).rssBytes;typeof n==`number`&&(e+=n)}return e}),d=W(()=>{let e=0;for(let t of a.value){let r=OF(n.seriesOf(t.id).rss);r>e&&(e=r)}return e}),f=W(()=>{let e=0;for(let t of s.value)e+=CF(t).cpuPercent??0;return e}),p=W(()=>{let e=a.value.map(e=>e.startedAt).filter(e=>typeof e==`number`);return e.length===0?`—`:NR(t.now.value-Math.min(...e))});return(e,m)=>{let h=ha(`RouterLink`);return L(),R(`div`,BY,[V(tU,{title:o.value,description:A(Y)(`views.overview.description`)},{actions:j(()=>[V($,{variant:`ghost`,onClick:m[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V(KU,{label:A(Y)(`views.actions.stopAll`),"confirm-label":A(Y)(`views.actions.stopAllIgnore`),"alternative-label":A(Y)(`views.actions.stopAllWithPersistent`),title:A(Y)(`views.actions.stopAllQuestion`),hint:A(Y)(`views.actions.stopAllHint`),variant:`ghost`,"confirm-variant":`danger`,onConfirm:m[1]||=e=>A(n).stopAll(),onAlternative:m[2]||=e=>A(n).stopAll({withPersistent:!0})},null,8,[`label`,`confirm-label`,`alternative-label`,`title`,`hint`]),V($,{variant:`primary`,onClick:m[3]||=e=>r.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),V(aU,{class:`p-0`},{default:j(()=>[i.value?(L(),R(`div`,VY,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(oU,{class:`h-2.5 w-16`}),V(oU,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,HY,[B(`div`,UY,[V(uU,{label:A(Y)(`views.overview.running`),value:`${s.value.length}/${A(a).length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:A(a).length-s.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,WY,[V(uU,{label:A(Y)(`views.overview.stopped`),value:String(c.value.length),hint:A(Y)(`views.overview.enabled`,{count:A(a).filter(e=>e.config.enabled).length})},null,8,[`label`,`value`,`hint`])]),B(`div`,GY,[V(uU,{label:A(Y)(`views.overview.needsAttention`),value:String(l.value.length),tone:l.value.length>0?`danger`:`ok`,hint:l.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,KY,[V(uU,{label:A(Y)(`views.overview.processMemory`),value:A(zR)(u.value),hint:d.value>0?A(Y)(`views.overview.peak`,{value:A(zR)(d.value)}):A(Y)(`views.overview.acrossTree`)},null,8,[`label`,`value`,`hint`])]),B(`div`,qY,[V(uU,{label:A(Y)(`views.overview.longestUptime`),value:p.value,hint:s.value.length>0?A(Y)(`views.overview.cpuNow`,{value:f.value.toFixed(1)}):A(Y)(`views.overview.nothingRunning`)},null,8,[`label`,`value`,`hint`])])]))]),_:1}),l.value.length>0?(L(),R(`div`,JY,[V(A(iy),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,YY,[B(`p`,XY,O(A(bF)(`views.overview.needLook`,l.value.length)),1),B(`p`,ZY,[(L(!0),R(I,null,P(l.value,e=>(L(),z(h,{key:e.id,to:A(D2)(A(n).activeId.value,`servers`,e.id),class:`font-mono underline-offset-2 hover:underline`},{default:j(()=>[H(O(e.id),1)]),_:2},1032,[`to`]))),128))])])])):U(``,!0),B(`section`,QY,[B(`div`,$Y,[B(`h2`,eX,[V(A(Hy),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`nav.servers`)),1)]),V(h,{to:A(D2)(A(n).activeId.value,`servers`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`views.overview.openFullList`)),1)]),_:1},8,[`to`])]),i.value?(L(),R(`div`,tX,[(L(),R(I,null,P(4,e=>V(oU,{key:e,class:`h-64 w-full`,rounded:`rounded-panel`})),64))])):A(a).length===0?(L(),z(hR,{key:1,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.overview.emptyDescription`)},{icon:j(()=>[V(A(Hy),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:m[4]||=e=>r.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,nX,[(L(!0),R(I,null,P(A(a),e=>(L(),z(JH,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]),V(aU,null,{header:j(()=>[B(`h2`,rX,[V(A(Jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),actions:j(()=>[V(h,{to:A(D2)(A(n).activeId.value,`logs`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),default:j(()=>[V(gz,{servers:A(a),now:A(t).now.value,limit:10},null,8,[`servers`,`now`])]),_:1}),B(`p`,iX,[B(`span`,aX,[V(A(Qy),{class:`size-3`}),H(O(A(Y)(`views.overview.sampling`)),1)]),B(`span`,oX,O(A(n).selected.value?.configPath),1),B(`span`,{class:D(A(Q)(`flex items-center gap-1`))},[m[6]||=B(`span`,{class:`size-1.5 rounded-full bg-ok`},null,-1),H(` `+O(A(Y)(`views.overview.workspaceLabel`,{id:A(n).activeId.value})),1)],2)]),V(HV,{open:r.value,"onUpdate:open":m[5]||=e=>r.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])])}}}),cX=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i,lX=/^(?:[a-z][a-z0-9+.-]*:\/\/)?(?<authority>[^/?#]+)/i,uX=[`.localhost`,`.local`,`.internal`,`.home.arpa`,`.lan`,`.home`,`.test`,`.invalid`,`.example`],dX=/^[a-z0-9][a-z0-9_-]*$/,fX={hostRequired:()=>`a hostname is required`,hostInvalid:()=>`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,hostDuplicate:e=>`"${e}" is already routed for this path`,pathNeedsSlash:()=>`a path prefix starts with /`,pathHasSpace:()=>`a path prefix cannot contain a space`,idInvalid:()=>`the id must start with a letter or digit, then letters, digits, dash or underscore`,idDuplicate:e=>`route id "${e}" is used twice`,workspaceRequired:()=>`pick the workspace that owns the server`,serverRequired:()=>`pick a server in that workspace`,urlInvalid:()=>`an upstream like http://10.0.0.5:8080`},pX={controlPanel:()=>`control panel`,noUpstream:()=>`no upstream`,noServerPicked:()=>`no server picked`,fallbackRetry:()=>`~8 hours`,retryOne:(e,t)=>`~${e} ${t}`,retryMany:(e,t)=>`~${e} ${t}s`},mX=4443,hX=4480;function gX(e){return e.label.trim().length>0?e.label:e.id}var _X=0;function vX(e){return e.find(e=>e.tls!==`off`&&xX(e.host))?.host??null}function yX(e){if(e===null||e<0)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function bX(e){return e>0&&e<1024}function xX(e){let t=e.trim().toLowerCase();return t.length===0||t===`localhost`||!t.includes(`.`)||uX.some(e=>t.endsWith(e))?!1:!/^\d{1,3}(?:\.\d{1,3}){3,}$/.test(t)}function SX(e,t){let n={};e.enabled!==t.enabled&&(n.enabled=t.enabled),e.httpPort!==t.httpPort&&(n.httpPort=t.httpPort),e.httpsPort!==t.httpsPort&&(n.httpsPort=t.httpsPort),e.email!==t.email&&(n.email=t.email),e.staging!==t.staging&&(n.staging=t.staging);let r=TX(t.resolvers);return(e.dns01.enabled!==t.dns01||e.dns01.resolvers.join(`,`)!==r.join(`,`))&&(n.dns01={enabled:t.dns01,resolvers:r}),n}function CX(){return{key:wX(),id:`route`,host:``,enabled:!0,target:`server`,workspace:``,server:``,url:``,path:``,tls:`auto`,dnsAccount:``}}function wX(){return _X+=1,`proxy-route-${_X}`}function TX(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(e=>e.length>0)}function EX(e,t,n,r){let i=SX(e,t),a=jX(e.routes,n,r);return a!==null&&(i.routes=a),Object.keys(i).length===0?null:i}function DX(e,t){return e.staging||e.email.trim().length>0?!1:t.some(e=>e.tls!==`off`&&xX(e.host))}function OX(e,t=pX){if(e===null)return t.fallbackRetry();if(e<60)return e===1?t.retryOne(e,`minute`):t.retryMany(e,`minute`);let n=Math.max(1,Math.round(e/60));return n===1?t.retryOne(n,`hour`):t.retryMany(n,`hour`)}function kX(e,t,n){let r=e.host.trim();if(r.length===0)return null;let i=e.tls===`off`,a=i?t:n,o=i?80:443,s=e.path.length===0||e.path.startsWith(`/`)?e.path:`/${e.path}`;return`${i?`http`:`https`}://${r}${a===o?``:`:${a}`}${s}`}function AX(e,t){return e.length===t.length&&e.every((e,n)=>NX(e,t[n]))}function jX(e,t,n){return n===void 0?AX(e,t)?null:RX(t):Sz({filled:n.map(zX),draft:RX(t),live:e.map(zX),key:e=>e.id})}function MX(e,t,n){return n===void 0?[]:xz({filled:n.map(zX),draft:RX(t),live:e.map(zX),key:e=>e.id})}function NX(e,t){return JSON.stringify(zX(e))===JSON.stringify(zX(t))}function PX(e){return FX(e,`certificate`)}function FX(e,t){let n=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40).replace(/-+$/,``);return n.length===0?t:/^[a-z0-9]/.test(n)?n:`r-${n}`}function IX(e){return FX(e,`route`)}function LX(e,t,n=pX){return e.target===`panel`?n.controlPanel():e.target===`external`?e.url.trim().length>0?e.url.trim():n.noUpstream():e.workspace.length===0||e.server.length===0?n.noServerPicked():`${t.find(t=>t.id===e.workspace)?.label??e.workspace} / ${e.server}`}function RX(e){return e.map(zX)}function zX(e){return{id:e.id,host:e.host,enabled:e.enabled,target:e.target,workspace:e.workspace,server:e.server,url:e.url,path:e.path,tls:e.tls,dnsAccount:e.dnsAccount}}function BX(e,t){return VX(e,t)}function VX(e,t){let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}-${r}`);)r+=1;return`${e}-${r}`}function HX(e,t){return VX(e,t)}function UX(e){return e.httpPort===4480&&e.httpsPort===4443}function WX(e,t){let n={...fX,...t.messages},r={},i=e.host.trim();if(i.length===0?r.host=n.hostRequired():cX.test(i)?t.others.some(t=>t.host.trim().toLowerCase()===i.toLowerCase()&&t.path.replace(/\/+$/,``)===e.path.replace(/\/+$/,``))&&(r.host=n.hostDuplicate(i)):r.host=n.hostInvalid(),e.path.length>0&&!e.path.startsWith(`/`)?r.path=n.pathNeedsSlash():/\s/.test(e.path)&&(r.path=n.pathHasSpace()),dX.test(e.id)?t.others.some(t=>t.id===e.id)&&(r.id=n.idDuplicate(e.id)):r.id=n.idInvalid(),e.target===`server`){let i=t.workspaces.find(t=>t.id===e.workspace);e.workspace.length===0||i===void 0?r.workspace=n.workspaceRequired():(e.server.length===0||!i.servers.some(t=>t.id===e.server))&&(r.server=n.serverRequired())}e.target===`external`&&GX(e.url)===null&&(r.url=n.urlInvalid());let a=Pj({...zX(e),host:i});return a instanceof J.errors&&Object.keys(r).length===0&&(r.form=a.summary),r}function GX(e){let t=e.trim();if(t.length===0)return null;let n=lX.exec(t)?.groups?.authority;if(n===void 0||n.length===0||n.endsWith(`:`)||/\s/.test(n))return null;let r=t.slice(0,t.indexOf(`:`)).toLowerCase(),i=n.lastIndexOf(`:`);if(i<=0)return{host:n,port:r===`https`?`443`:`80`};let a=n.slice(i+1);return/^\d{1,5}$/.test(a)?{host:n.slice(0,i),port:a}:null}var KX=[{value:`server`,labelKey:`proxy.target.server`},{value:`panel`,labelKey:`proxy.target.panel`},{value:`external`,labelKey:`proxy.target.external`}],qX=[{value:`auto`,labelKey:`proxy.tls.auto`},{value:`off`,labelKey:`proxy.tls.off`},{value:`manual`,labelKey:`proxy.tls.manual`}],JX={off:{labelKey:`proxy.status.off`,tone:`neutral`,transitional:!1},stopped:{labelKey:`proxy.status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`proxy.status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`proxy.status.running`,tone:`ok`,transitional:!1},error:{labelKey:`proxy.status.error`,tone:`danger`,transitional:!1},unsupported:{labelKey:`proxy.status.unsupported`,tone:`warn`,transitional:!1}},YX={ok:{labelKey:`proxy.status.serving`,tone:`ok`},disabled:{labelKey:`proxy.status.disabled`,tone:`neutral`},"no-upstream":{labelKey:`proxy.status.noUpstream`,tone:`warn`},error:{labelKey:`proxy.status.error`,tone:`danger`}},XX={off:null,local:{labelKey:`proxy.status.localCa`,tone:`neutral`},uploaded:{labelKey:`proxy.status.uploaded`,tone:`info`},issued:{labelKey:`proxy.status.certified`,tone:`ok`},pending:{labelKey:`proxy.status.awaitingCa`,tone:`warn`},failed:{labelKey:`proxy.status.failed`,tone:`danger`},fallback:{labelKey:`proxy.status.fellBack`,tone:`warn`}};function ZX(e){let t=e.certificate;if(t===void 0)return null;let n=XX[t.state]??null;return n===null?null:{...n,message:t.message,retryInMinutes:t.retryInMinutes??null}}function QX(e){return{enabled:e.enabled,httpPort:e.httpPort,httpsPort:e.httpsPort,email:e.email,staging:e.staging,dns01:e.dns01.enabled,resolvers:e.dns01.resolvers.join(`, `)}}function $X(e){let t=[{value:``,label:Y(`proxy.account.automatic`)}];for(let n of e){let e=n.label.length>0?n.label:n.account,r=[n.writesTxt?null:Y(`proxy.account.noTxt`),n.writesTxt&&!n.hasCredentials?Y(`proxy.account.noCredentials`):null].filter(e=>e!==null);t.push({value:`${n.workspace}/${n.account}`,label:`${e} · ${n.provider} · ${n.workspace}${r.length>0?` (${r.join(`, `)})`:``}`})}return t}function eZ(e){return{...QX(e)}}function tZ(e){return structuredClone(dn(e)).map(e=>({...e,key:wX()}))}function nZ(e,t,n){return t===null?[...e,n]:e.map(e=>e.id===t.id?n:e)}function rZ(e){return e.tls===`off`?Y(`proxy.tls.plain`):e.tls===`manual`?Y(`proxy.tls.uploaded`):xX(e.host)?Y(`proxy.tls.letsEncrypt`):Y(`proxy.tls.engineCa`)}var iZ={controlPanel:()=>Y(`proxy.target.controlPanel`),noUpstream:()=>Y(`proxy.target.noUpstream`),noServerPicked:()=>Y(`proxy.target.noServer`),fallbackRetry:()=>Y(`proxy.retry.inFallback`),retryOne:(e,t)=>bF(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e),retryMany:(e,t)=>bF(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e)},aZ={hostRequired:()=>Y(`proxy.validation.hostRequired`),hostInvalid:()=>Y(`proxy.validation.hostPattern`),hostDuplicate:e=>Y(`proxy.validation.hostTaken`,{host:e}),pathNeedsSlash:()=>Y(`proxy.validation.pathSlash`),pathHasSpace:()=>Y(`proxy.validation.pathSpace`),idInvalid:()=>Y(`proxy.validation.idPattern`),idDuplicate:e=>Y(`proxy.validation.idTaken`,{id:e}),workspaceRequired:()=>Y(`proxy.validation.workspaceRequired`),serverRequired:()=>Y(`proxy.validation.serverRequired`),urlInvalid:()=>Y(`proxy.validation.url`)};function oZ(e,t){return LX(e,t,iZ)}function sZ(e){return OX(e,iZ)}var cZ={class:`grid grid-cols-1 gap-3 sm:grid-cols-2`},lZ={class:`grid grid-cols-1 gap-3 sm:grid-cols-2`},uZ={class:`flex min-w-0 flex-col gap-1`},dZ={class:`flex min-w-0 flex-col gap-1`},fZ=N({__name:`CertificateDialog`,props:Va({taken:{},busy:{type:Boolean},error:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`submit`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(``),o=k(``),s=k(``),c=k(``),l=k({}),u=k(!1),d=Q(HB,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`),f=W(()=>BX(PX(a.value),n.taken)),p=W(()=>!n.busy&&a.value.trim().length>0&&s.value.trim().length>0&&c.value.trim().length>0);function m(e){o.value=e,u.value=e.trim().length>0}M([a,()=>n.taken],()=>{u.value||(o.value=f.value)},{immediate:!0}),M(i,e=>{e&&(a.value=``,o.value=``,s.value=``,c.value=``,l.value={},u.value=!1)});async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?s.value=r:c.value=r}function g(){let e=a.value.trim(),t=o.value.trim(),i={};e.length===0&&(i.label=Y(`proxy.certificateDialog.errorLabel`)),dX.test(t)?n.taken.includes(t)&&(i.id=Y(`proxy.certificateDialog.errorTaken`,{id:t})):i.id=Y(`proxy.certificateDialog.errorId`),s.value.trim().length===0&&(i.certificate=Y(`proxy.certificateDialog.errorCertificate`)),c.value.trim().length===0&&(i.privateKey=Y(`proxy.certificateDialog.errorPrivateKey`)),l.value=i,!(Object.keys(i).length>0)&&r(`submit`,{id:t,label:e,certificate:s.value,privateKey:c.value})}return(e,t)=>(L(),z(xV,{open:i.value,"onUpdate:open":t[6]||=e=>i.value=e,title:A(Y)(`proxy.certificateDialog.title`),description:A(Y)(`proxy.certificateDialog.description`)},{footer:j(()=>[V($,{variant:`ghost`,disabled:n.busy,onClick:t[5]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:!p.value,loading:n.busy,onClick:g},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.store`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`form`,{class:`space-y-3`,onSubmit:_u(g,[`prevent`])},[B(`div`,cZ,[V(iV,{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:A(Y)(`proxy.certificateDialog.label`),placeholder:A(Y)(`proxy.certificateDialog.labelPlaceholder`),error:l.value.label},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(iV,{"model-value":o.value,label:A(Y)(`proxy.certificateDialog.id`),hint:A(Y)(`proxy.certificateDialog.idHint`),error:l.value.id,"onUpdate:modelValue":m},null,8,[`model-value`,`label`,`hint`,`error`])]),B(`div`,lZ,[B(`div`,uZ,[B(`label`,{class:D(A(BB)),for:`proxy-cert-file`},O(A(Y)(`proxy.certificateDialog.certFile`)),3),B(`input`,{id:`proxy-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(d)),onChange:t[1]||=e=>h(e,`cert`)},null,34)]),B(`div`,dZ,[B(`label`,{class:D(A(BB)),for:`proxy-cert-key`},O(A(Y)(`proxy.certificateDialog.keyFile`)),3),B(`input`,{id:`proxy-cert-key`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(d)),onChange:t[2]||=e=>h(e,`key`)},null,34)])]),V(TV,{modelValue:s.value,"onUpdate:modelValue":t[3]||=e=>s.value=e,label:A(Y)(`proxy.certificateDialog.pasteCert`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.certPlaceholder`),error:l.value.certificate},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(TV,{modelValue:c.value,"onUpdate:modelValue":t[4]||=e=>c.value=e,label:A(Y)(`proxy.certificateDialog.pasteKey`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.keyPlaceholder`),error:l.value.privateKey},null,8,[`modelValue`,`label`,`placeholder`,`error`]),n.error?(L(),z(YU,{key:0,tone:`danger`},{default:j(()=>[H(O(n.error),1)]),_:1})):U(``,!0)],32)]),_:1},8,[`open`,`title`,`description`]))}}),pZ={key:0,class:`sm:col-span-2`},mZ={key:1,class:`space-y-2 sm:col-span-2`},hZ={class:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},gZ={class:`min-w-0 text-xs font-medium text-ink`},_Z={class:`ml-1.5 font-mono text-2xs text-faint`},vZ={key:0,class:`mt-2`},yZ={key:1,class:`mt-2 divide-y divide-line-soft text-2xs`},bZ={class:`flex items-start justify-between gap-4 py-1`},xZ={class:`text-muted`},SZ={class:`min-w-0 text-right font-mono text-ink`},CZ={class:`flex items-start justify-between gap-4 py-1`},wZ={class:`text-muted`},TZ={class:`min-w-0 text-right font-mono text-ink`},EZ={class:`flex items-start justify-between gap-4 py-1`},DZ={class:`text-muted`},OZ={class:`font-mono text-ink`},kZ={class:`flex items-start justify-between gap-4 py-1`},AZ={class:`shrink-0 text-muted`},jZ={class:`min-w-0 text-right font-mono text-ink`},MZ={key:1,class:`text-faint`},NZ={class:`mt-2 flex justify-end`},PZ={class:`text-xs font-semibold text-ink`},FZ={class:`mt-1 text-2xs leading-4 text-muted`},IZ={class:`mt-2.5 flex justify-end gap-1.5`},LZ={key:2,class:`space-y-2 sm:col-span-2`},RZ=N({__name:`CertificatePanel`,props:{certificates:{},disabled:{type:Boolean}},emits:[`changed`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=k(null),s=k(null),c=k(null),l=W(()=>n.certificates.map(e=>e.id));async function u(e,t){a.value=!0,o.value=null,s.value=null;try{return r(`changed`,await e()),s.value=t,!0}catch(e){return o.value=CM(e),!1}finally{a.value=!1}}async function d(e){await u(()=>aN(e.id,e.label,e.certificate,e.privateKey),Y(`proxy.certificate.stored`,{label:e.label}))&&(i.value=!1)}function f(e){c.value=null,u(()=>RM(e.id),Y(`proxy.certificate.removed`,{name:gX(e)}))}return(e,t)=>(L(),z(IB,{title:A(Y)(`proxy.certificate.title`),description:A(Y)(`proxy.certificate.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled||a.value,onClick:t[0]||=e=>i.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.certificate.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.certificates.length===0?(L(),R(`div`,pZ,[V(hR,{compact:``,title:A(Y)(`proxy.certificate.emptyTitle`),description:A(Y)(`proxy.certificate.emptyDescription`)},{icon:j(()=>[V(A(xy),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled||a.value,onClick:t[1]||=e=>i.value=!0},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.title`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`ul`,mZ,[(L(!0),R(I,null,P(n.certificates,e=>(L(),R(`li`,{key:e.id,class:`rounded-panel border border-line bg-page/40 p-3`},[B(`div`,hZ,[B(`p`,gZ,[H(O(A(gX)(e))+` `,1),B(`span`,_Z,O(e.id),1)]),e.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D([`text-2xs tabular-nums`,e.daysRemaining<14?`text-warn`:`text-faint`])},O(A(Y)(`proxy.certificate.daysLeft`,{days:e.daysRemaining})),3))]),e.error?(L(),R(`div`,vZ,[V(YU,{tone:`danger`},{default:j(()=>[H(O(e.error),1)]),_:2},1024)])):(L(),R(`dl`,yZ,[B(`div`,bZ,[B(`dt`,xZ,O(A(Y)(`proxy.certificate.subject`)),1),B(`dd`,SZ,O(e.subject??`—`),1)]),B(`div`,CZ,[B(`dt`,wZ,O(A(Y)(`proxy.certificate.issuer`)),1),B(`dd`,TZ,O(e.issuer??`—`),1)]),B(`div`,EZ,[B(`dt`,DZ,O(A(Y)(`proxy.certificate.validUntil`)),1),B(`dd`,OZ,O(e.validTo?e.validTo.slice(0,10):`—`),1)]),B(`div`,kZ,[B(`dt`,AZ,O(A(Y)(`proxy.certificate.covers`)),1),B(`dd`,jZ,[e.hosts.length>0?(L(),R(I,{key:0},[H(O(e.hosts.join(`, `)),1)],64)):(L(),R(`span`,MZ,O(A(Y)(`proxy.certificate.noSans`)),1))])])])),B(`div`,NZ,[V(A(rg),{open:c.value===e.id,"onUpdate:open":t=>c.value=t?e.id:null},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`danger-ghost`,disabled:a.value,"aria-label":A(Y)(`proxy.certificate.removeAria`,{name:A(gX)(e)})},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`aria-label`])]),_:2},1024),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:D(A(Q)(`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float`,`focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`))},{default:j(()=>[B(`p`,PZ,O(A(Y)(`proxy.certificate.removeQuestion`,{name:A(gX)(e)})),1),B(`p`,FZ,O(A(Y)(`proxy.certificate.removeBody`)),1),B(`div`,IZ,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:a.value,onClick:t=>f(e)},{default:j(()=>[H(O(A(Y)(`proxy.certificate.removeIt`)),1)]),_:1},8,[`loading`,`onClick`])])]),_:2},1032,[`class`])]),_:2},1024)]),_:2},1032,[`open`,`onUpdate:open`])])]))),128))])),o.value||s.value?(L(),R(`div`,LZ,[o.value?(L(),z(YU,{key:0,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0),s.value?(L(),z(YU,{key:1,tone:`ok`},{default:j(()=>[H(O(s.value),1)]),_:1})):U(``,!0)])):U(``,!0),V(fZ,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,taken:l.value,busy:a.value,error:o.value,onSubmit:d},null,8,[`open`,`taken`,`busy`,`error`])]),_:1},8,[`title`,`description`]))}}),zZ={key:0,class:`sm:col-span-2`},BZ={key:0,class:`sm:col-span-2`},VZ={key:1,class:`sm:col-span-2`},HZ={class:`divide-y divide-line-soft text-xs sm:col-span-2`},UZ={class:`flex items-start justify-between gap-4 py-1.5`},WZ={class:`text-muted`},GZ={class:`font-mono text-xs text-ink`},KZ={class:`flex items-start justify-between gap-4 py-1.5`},qZ={class:`text-muted`},JZ={class:`text-right text-xs text-ink`},YZ={key:0,class:`flex items-start justify-between gap-4 py-1.5`},XZ={class:`text-muted`},ZZ={class:`font-mono text-xs tabular-nums text-ink`},QZ={key:1,class:`flex items-start justify-between gap-4 py-1.5`},$Z={class:`text-muted`},eQ={class:`flex min-w-0 items-center gap-1.5`},tQ={class:`min-w-0 truncate font-mono text-2xs text-ink`},nQ={class:`flex items-start justify-between gap-4 py-1.5`},rQ={class:`text-muted`},iQ={class:`flex flex-wrap items-center justify-end gap-x-2 gap-y-1 text-right font-mono text-xs`},aQ=[`href`],oQ={key:0,class:`text-ink`},sQ={class:`flex items-start justify-between gap-4 py-1.5`},cQ={class:`text-muted`},lQ={class:`font-mono text-xs tabular-nums text-ink`},uQ={class:`flex items-start justify-between gap-4 py-1.5`},dQ={class:`text-muted`},fQ={class:`text-xs text-ink`},pQ={class:`flex flex-wrap gap-1.5 sm:col-span-2`},mQ=[`href`],hQ={key:3,class:`sm:col-span-2`},gQ={key:4,class:`text-2xs leading-4 text-faint sm:col-span-2`},_Q={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},vQ={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},yQ=N({__name:`EnginePanel`,props:{view:{},busy:{}},emits:[`act`],setup(e,{emit:t}){let n=e,r=t,i=W(()=>n.view?.engine??null),a=W(()=>n.view?.status??null),o=W(()=>n.view?.engines[0]??null),s=W(()=>a.value===null?null:JX[a.value.state]),c=W(()=>i.value?.installed===!0),l=W(()=>i.value?.path??null),u=W(()=>l.value===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${l.value}`),d=[{key:`acme`,labelKey:`proxy.engine.acme`},{key:`internalCa`,labelKey:`proxy.engine.localCa`},{key:`dns01`,labelKey:`proxy.engine.dns01`},{key:`tcp`,labelKey:`proxy.engine.tcpUdp`}];return(e,t)=>(L(),z(IB,{title:A(Y)(`proxy.engine.title`),description:A(Y)(`proxy.engine.description`)},{actions:j(()=>[s.value?(L(),z(hG,{key:0,tone:s.value.tone,dot:``},{default:j(()=>[H(O(A(Y)(s.value.labelKey)),1)]),_:1},8,[`tone`])):U(``,!0)]),default:j(()=>[i.value===null?(L(),R(`div`,zZ,[V(YU,{tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.engine.notInFrame`)),1)]),_:1})])):(L(),R(I,{key:1},[i.value.error?(L(),R(`div`,BZ,[V(YU,{tone:`danger`,title:A(Y)(`proxy.engine.readFailed`)},{default:j(()=>[H(O(i.value.error),1)]),_:1},8,[`title`])])):U(``,!0),c.value?(L(),R(I,{key:2},[B(`dl`,HZ,[B(`div`,UZ,[B(`dt`,WZ,O(A(Y)(`proxy.engine.version`)),1),B(`dd`,GZ,O(i.value.version??A(Y)(`proxy.engine.notProbed`)),1)]),B(`div`,KZ,[B(`dt`,qZ,O(A(Y)(`proxy.engine.source`)),1),B(`dd`,JZ,O(i.value.source===`custom`?A(Y)(`proxy.engine.sourceCustom`):A(Y)(`proxy.engine.sourceDownloaded`)),1)]),i.value.bytes===null?U(``,!0):(L(),R(`div`,YZ,[B(`dt`,XZ,O(A(Y)(`proxy.engine.size`)),1),B(`dd`,ZZ,O(A(yX)(i.value.bytes)),1)])),l.value?(L(),R(`div`,QZ,[B(`dt`,$Z,O(A(Y)(`proxy.engine.binary`)),1),B(`dd`,eQ,[B(`span`,tQ,O(l.value),1),V(pG,{value:l.value,label:A(Y)(`proxy.engine.copyPath`)},null,8,[`value`,`label`])])])):U(``,!0),B(`div`,nQ,[B(`dt`,rQ,O(A(Y)(`proxy.engine.address`)),1),B(`dd`,iQ,[(L(!0),R(I,null,P(a.value?.urls??[],e=>(L(),R(`a`,{key:e,href:e,target:`_blank`,rel:`noreferrer`,class:`text-accent underline decoration-line underline-offset-2 hover:decoration-accent`},O(e),9,aQ))),128)),!a.value||a.value.urls.length===0?(L(),R(`span`,oQ,`—`)):U(``,!0)])]),B(`div`,sQ,[B(`dt`,cQ,O(A(Y)(`proxy.engine.process`)),1),B(`dd`,lQ,O(a.value?.pid??`—`),1)]),B(`div`,uQ,[B(`dt`,dQ,O(A(Y)(`proxy.engine.certificates`)),1),B(`dd`,fQ,O(a.value?.certExpiryDays===null||a.value?.certExpiryDays===void 0?A(Y)(`proxy.engine.noCert`):A(Y)(`proxy.engine.expiresSoon`,{days:a.value.certExpiryDays})),1)])]),B(`div`,pQ,[(L(),R(I,null,P(d,e=>V(hG,{key:e.key,tone:o.value?.[e.key]?`ok`:`neutral`},{default:j(()=>[H(O(o.value?.[e.key]?`✓`:`✗`)+` `+O(A(Y)(e.labelKey)),1)]),_:2},1032,[`tone`])),64)),o.value?(L(),R(`a`,{key:0,class:`ml-1 self-center text-2xs text-accent underline decoration-line underline-offset-2`,href:o.value.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`proxy.engine.documentation`,{engine:o.value.label})),9,mQ)):U(``,!0)])],64)):(L(),R(`div`,VZ,[V(YU,{tone:`info`,title:A(Y)(`proxy.engine.notInstalled`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.installNote`,{engine:o.value?.label??i.value.id})),1)]),_:1},8,[`title`])])),a.value?.lastError?(L(),R(`div`,hQ,[V(YU,{tone:`danger`,title:A(Y)(`proxy.engine.failed`)},{default:j(()=>[H(O(a.value.lastError),1)]),_:1},8,[`title`])])):U(``,!0),c.value&&u.value?(L(),R(`p`,gQ,[H(O(A(Y)(`proxy.engine.setcapHint`))+` `,1),B(`code`,_Q,O(u.value),1),V(pG,{value:u.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])])):U(``,!0)],64)),B(`div`,vQ,[c.value?(L(),R(I,{key:1},[V($,{variant:`primary`,disabled:n.busy!==null||a.value?.state===`running`,loading:n.busy===`start`,onClick:t[1]||=e=>r(`act`,`start`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.start`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state===`off`||a.value?.state===`stopped`,loading:n.busy===`stop`,onClick:t[2]||=e=>r(`act`,`stop`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.stop`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`apply`,onClick:t[3]||=e=>r(`act`,`apply`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.apply`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`ghost`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`revert`,title:A(Y)(`proxy.engine.revertHint`),onClick:t[4]||=e=>r(`act`,`revert`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.revert`)),1)]),_:1},8,[`disabled`,`loading`,`title`]),V($,{variant:`ghost`,disabled:n.busy!==null,loading:n.busy===`install`,onClick:t[5]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.update`)),1)]),_:1},8,[`disabled`,`loading`])],64)):(L(),z($,{key:0,variant:`primary`,loading:n.busy===`install`,disabled:n.busy!==null,onClick:t[0]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.install`)),1)]),_:1},8,[`loading`,`disabled`]))])]),_:1},8,[`title`,`description`]))}}),bQ={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},xQ={key:0,class:`text-2xs text-faint`},SQ={key:0,class:`sm:col-span-2`},CQ={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},wQ={key:1},TQ={key:1,class:`sm:col-span-2`},EQ={key:3,class:`sm:col-span-2`},DQ={key:4,class:`sm:col-span-2`},OQ={key:5,class:`text-2xs leading-4 text-faint sm:col-span-2`},kQ={class:`text-2xs leading-4 text-faint sm:col-span-2`},AQ=N({__name:`ListenerPanel`,props:Va({emailHost:{},enginePath:{},dnsAccounts:{}},{form:{required:!0},formModifiers:{}}),emits:[`update:form`],setup(e){let t=e,n=lo(e,`form`),r=W(()=>t.dnsAccounts.filter(e=>e.writesTxt&&e.hasCredentials)),i=W(()=>UX(n.value)),a=W(()=>t.enginePath===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${t.enginePath}`),o=W(()=>bX(n.value.httpPort)||bX(n.value.httpsPort));function s(){n.value.httpPort=hX,n.value.httpsPort=mX}function c(){n.value.httpPort=80,n.value.httpsPort=443}function l(e,t){e===null||Number.isNaN(e)||e>=1&&e<=65535&&(n.value[t]=Math.trunc(e))}return(e,u)=>(L(),z(IB,{title:A(Y)(`proxy.listener.title`),description:A(Y)(`proxy.listener.description`)},{actions:j(()=>[i.value?(L(),z(hG,{key:0,tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.listener.unprivilegedPorts`)),1)]),_:1})):U(``,!0)]),default:j(()=>[V(sV,{modelValue:n.value.enabled,"onUpdate:modelValue":u[0]||=e=>n.value.enabled=e,label:A(Y)(`proxy.listener.run`),hint:A(Y)(`proxy.listener.runHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(qB,{"model-value":n.value.httpPort,label:A(Y)(`proxy.listener.httpPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpPortHint`),"onUpdate:modelValue":u[1]||=e=>l(e,`httpPort`)},null,8,[`model-value`,`label`,`hint`]),V(qB,{"model-value":n.value.httpsPort,label:A(Y)(`proxy.listener.httpsPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpsPortHint`),"onUpdate:modelValue":u[2]||=e=>l(e,`httpsPort`)},null,8,[`model-value`,`label`,`hint`]),B(`div`,bQ,[V($,{size:`xs`,variant:`secondary`,onClick:s},{default:j(()=>[H(O(A(Y)(`proxy.listener.useFallback`,{http:A(hX),https:A(mX)})),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:c},{default:j(()=>[H(O(A(Y)(`proxy.listener.useStandard`)),1)]),_:1}),i.value?(L(),R(`span`,xQ,O(A(Y)(`proxy.listener.forwardHint`)),1)):U(``,!0)]),o.value?(L(),R(`div`,SQ,[V(YU,{tone:`warn`,title:A(Y)(`proxy.listener.privilegedTitle`)},{default:j(()=>[V(EV,{k:`proxy.listener.privilegedBody`,params:{http:A(hX),https:A(mX)}},{how:j(()=>[a.value?(L(),R(I,{key:0},[B(`code`,CQ,O(a.value),1),V(pG,{value:a.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])],64)):(L(),R(`span`,wQ,[V(EV,{k:`proxy.listener.privilegedWithSetcap`},{command:j(()=>[...u[7]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`setcap`,-1)]]),_:1})]))]),_:1},8,[`params`])]),_:1},8,[`title`])])):U(``,!0),V(iV,{modelValue:n.value.email,"onUpdate:modelValue":u[3]||=e=>n.value.email=e,label:A(Y)(`proxy.listener.email`),placeholder:A(Y)(`proxy.listener.emailPlaceholder`),hint:A(Y)(`proxy.listener.emailHint`),wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),t.emailHost===null?U(``,!0):(L(),R(`div`,TQ,[V(YU,{tone:`warn`,title:A(Y)(`proxy.listener.emailNeededTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.emailNeededBody`,{host:t.emailHost})),1)]),_:1},8,[`title`])])),V(sV,{modelValue:n.value.staging,"onUpdate:modelValue":u[4]||=e=>n.value.staging=e,label:A(Y)(`proxy.listener.staging`),hint:A(Y)(`proxy.listener.stagingHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:n.value.dns01,"onUpdate:modelValue":u[5]||=e=>n.value.dns01=e,label:A(Y)(`proxy.listener.dns01`),hint:A(Y)(`proxy.listener.dns01Hint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),n.value.dns01?(L(),z(iV,{key:2,modelValue:n.value.resolvers,"onUpdate:modelValue":u[6]||=e=>n.value.resolvers=e,label:A(Y)(`proxy.listener.resolvers`),placeholder:A(Y)(`proxy.listener.resolversPlaceholder`),hint:A(Y)(`proxy.listener.resolversHint`),spellcheck:`false`,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`])):U(``,!0),n.value.dns01&&r.value.length===0?(L(),R(`div`,EQ,[V(YU,{tone:`warn`,title:A(Y)(`proxy.listener.noAccountTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.noAccountBody`)),1)]),_:1},8,[`title`])])):n.value.dns01&&r.value.length>1?(L(),R(`div`,DQ,[V(YU,{tone:`info`,title:A(Y)(`proxy.listener.manyAccountsTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.manyAccountsBody`)),1)]),_:1},8,[`title`])])):U(``,!0),n.value.dns01?(L(),R(`p`,OQ,O(A(Y)(`proxy.listener.accountNote`)),1)):U(``,!0),B(`p`,kQ,O(A(Y)(`proxy.listener.pendingNote`)),1)]),_:1},8,[`title`,`description`]))}}),jQ={class:`space-y-3`},MQ={key:1,class:`text-2xs leading-4 text-faint sm:col-span-2`},NQ={class:`text-2xs leading-4 text-faint sm:col-span-2`},PQ={key:4,class:`text-2xs leading-4 text-warn sm:col-span-2`},FQ=N({__name:`RouteDialog`,props:Va({draft:{},others:{},workspaces:{},dnsAccounts:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`save`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(CX()),o=k({}),s=W(()=>n.draft!==null),c=W(()=>(n.workspaces.find(e=>e.id===a.value.workspace)?.servers??[]).map(e=>({value:e.id,label:e.id}))),l=W(()=>KX.map(e=>({value:e.value,label:Y(e.labelKey)}))),u=W(()=>qX.map(e=>({value:e.value,label:Y(e.labelKey)}))),d=W(()=>a.value.tls===`off`?Y(`proxy.tls.hintOff`):a.value.tls===`manual`?Y(`proxy.tls.hintManual`):a.value.host.trim().length===0?Y(`proxy.tls.hintEmpty`):xX(a.value.host)?Y(`proxy.tls.hintPublic`):Y(`proxy.tls.hintLocal`)),f=W(()=>a.value.tls===`auto`&&xX(a.value.host)),p=W(()=>$X(n.dnsAccounts)),m=W(()=>n.dnsAccounts.find(e=>`${e.workspace}/${e.account}`===a.value.dnsAccount)),h=W(()=>m.value===void 0?a.value.dnsAccount.length>0?Y(`proxy.account.gone`):Y(`proxy.account.emptyHint`):m.value.writesTxt?m.value.hasCredentials?Y(`proxy.account.through`,{provider:m.value.provider}):Y(`proxy.account.noCredentialsYet`,{provider:m.value.provider}):Y(`proxy.account.cannotWrite`,{provider:m.value.provider}));M(i,e=>{e&&(a.value=n.draft===null?CX():structuredClone(dn(n.draft)),a.value.workspace.length===0&&(a.value.workspace=n.workspaces[0]?.id??``),o.value={})}),M(()=>a.value.workspace,()=>{c.value.some(e=>e.value===a.value.server)||(a.value.server=c.value[0]?.value??``)});function g(){let e=a.value.host.trim().toLowerCase(),t={...a.value,host:e,id:HX(IX(e),n.others.map(e=>e.id)),workspace:a.value.target===`server`?a.value.workspace:``,server:a.value.target===`server`?a.value.server:``,url:a.value.target===`external`?a.value.url.trim():``},s=WX(t,{others:n.others,workspaces:n.workspaces,messages:aZ});o.value=s,!(Object.keys(s).length>0)&&(r(`save`,t),i.value=!1)}return(e,t)=>(L(),z(xV,{open:i.value,"onUpdate:open":t[9]||=e=>i.value=e,title:s.value?A(Y)(`proxy.routeDialog.titleEdit`):A(Y)(`proxy.routeDialog.titleAdd`),description:A(Y)(`proxy.routeDialog.description`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[8]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:g},{default:j(()=>[H(O(s.value?A(Y)(`proxy.routeDialog.save`):A(Y)(`proxy.routes.add`)),1)]),_:1})]),default:j(()=>[B(`div`,jQ,[V(iV,{modelValue:a.value.host,"onUpdate:modelValue":t[0]||=e=>a.value.host=e,label:A(Y)(`proxy.routeDialog.hostname`),placeholder:A(Y)(`proxy.routeDialog.hostnamePlaceholder`),autocomplete:`off`,spellcheck:`false`,error:o.value.host,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(iV,{modelValue:a.value.path,"onUpdate:modelValue":t[1]||=e=>a.value.path=e,label:A(Y)(`proxy.routeDialog.path`),placeholder:A(Y)(`proxy.routeDialog.pathPlaceholder`),hint:A(Y)(`proxy.routeDialog.pathHint`),spellcheck:`false`,error:o.value.path,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`]),V($B,{modelValue:a.value.target,"onUpdate:modelValue":t[2]||=e=>a.value.target=e,label:A(Y)(`proxy.routeDialog.target`),options:l.value},null,8,[`modelValue`,`label`,`options`]),V($B,{modelValue:a.value.tls,"onUpdate:modelValue":t[3]||=e=>a.value.tls=e,label:A(Y)(`proxy.routeDialog.tls`),options:u.value,hint:d.value},null,8,[`modelValue`,`label`,`options`,`hint`]),f.value?(L(),z($B,{key:0,modelValue:a.value.dnsAccount,"onUpdate:modelValue":t[4]||=e=>a.value.dnsAccount=e,label:A(Y)(`proxy.routeDialog.dnsAccount`),options:p.value,hint:h.value},null,8,[`modelValue`,`label`,`options`,`hint`])):a.value.tls===`auto`?(L(),R(`p`,MQ,O(A(Y)(`proxy.routeDialog.localNote`)),1)):U(``,!0),a.value.target===`server`?(L(),R(I,{key:2},[V($B,{modelValue:a.value.workspace,"onUpdate:modelValue":t[5]||=e=>a.value.workspace=e,label:A(Y)(`proxy.routeDialog.workspace`),options:n.workspaces.map(e=>({value:e.id,label:e.label})),error:o.value.workspace},null,8,[`modelValue`,`label`,`options`,`error`]),V($B,{modelValue:a.value.server,"onUpdate:modelValue":t[6]||=e=>a.value.server=e,label:A(Y)(`proxy.routeDialog.server`),options:c.value,disabled:c.value.length===0,error:o.value.server??(c.value.length===0?A(Y)(`proxy.routeDialog.noServers`):null)},null,8,[`modelValue`,`label`,`options`,`disabled`,`error`]),B(`p`,NQ,O(A(Y)(`proxy.routeDialog.stoppedNote`)),1)],64)):U(``,!0),a.value.target===`external`?(L(),z(iV,{key:3,modelValue:a.value.url,"onUpdate:modelValue":t[7]||=e=>a.value.url=e,label:A(Y)(`proxy.routeDialog.upstream`),placeholder:A(Y)(`proxy.routeDialog.upstreamPlaceholder`),hint:A(Y)(`proxy.routeDialog.upstreamHint`),spellcheck:`false`,error:o.value.url,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`])):U(``,!0),a.value.target===`panel`?(L(),R(`p`,PQ,O(A(Y)(`proxy.routeDialog.panelNote`)),1)):U(``,!0),o.value.form?(L(),z(YU,{key:5,tone:`danger`},{default:j(()=>[H(O(o.value.form),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),IQ={class:`text-xs font-semibold text-ink`},LQ={class:`mt-1 text-2xs leading-4 text-muted`},RQ={class:`mt-1 text-2xs leading-4 text-warn`},zQ={class:`mt-2.5 flex justify-end gap-1.5`},BQ=N({__name:`RetryCertificateButton`,props:{host:{},retryIn:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`secondary`,loading:n.busy,disabled:n.busy},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.force`)),1)]),_:1},8,[`loading`,`disabled`])]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,IQ,O(A(Y)(`proxy.retryButton.question`,{host:n.host})),1),B(`p`,LQ,O(A(Y)(`proxy.retryButton.body`,{retryIn:n.retryIn})),1),B(`p`,RQ,O(A(Y)(`proxy.retryButton.warning`)),1),B(`div`,zQ,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.leave`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`primary`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.now`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),VQ={key:0,class:`sm:col-span-2`},HQ={class:`list-disc space-y-0.5 pl-4`},UQ={key:1,class:`sm:col-span-2`},WQ={key:2,class:`overflow-x-auto sm:col-span-2`},GQ={class:`w-full text-left text-xs`},KQ={class:`text-2xs text-faint`},qQ={class:`py-1 pr-3 font-medium`},JQ={class:`py-1 pr-3 font-medium`},YQ={class:`py-1 pr-3 font-medium`},XQ={class:`py-1 pr-3 font-medium`},ZQ={class:`py-1 pr-3 font-medium`},QQ={class:`py-1 pr-3 font-medium`},$Q={class:`py-1 font-medium`},e$={class:`sr-only`},t$={class:`py-1.5 pr-3`},n$={class:`font-mono text-xs text-ink`},r$=[`href`,`title`],i$={key:2,class:`text-accent`},a$={class:`font-mono text-2xs text-faint`},o$={class:`py-1.5 pr-3 text-2xs text-muted`},s$={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},c$={class:`py-1.5 pr-3 text-2xs text-muted`},l$={key:0,class:`mt-0.5`},u$={key:1,class:`mt-1`},d$={class:`py-1.5 pr-3`},f$={class:`py-1.5 pr-3`},p$={class:`py-1.5`},m$={class:`flex items-center justify-end gap-1`},h$=N({__name:`RouteTable`,props:{routes:{},views:{},workspaces:{},httpPort:{},httpsPort:{},disabled:{type:Boolean}},emits:[`add`,`edit`,`remove`,`retry`,`toggle`],setup(e,{emit:t}){let n=e,r=t;function i(e){return e===`fallback`}let a=W(()=>n.routes.map(e=>{let t=n.views.find(t=>t.route.id===e.id)??null;return{route:e,view:t,meta:t===null?null:YX[t.status],target:oZ(e,n.workspaces),tls:rZ(e),certificate:t===null?null:ZX(t),url:kX(e,n.httpPort,n.httpsPort)}})),o=W(()=>a.value.filter(e=>e.view?.status===`error`));return(e,t)=>(L(),z(IB,{title:A(Y)(`proxy.routes.title`),description:A(Y)(`proxy.routes.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled,onClick:t[0]||=e=>r(`add`)},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.routes.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[o.value.length>0?(L(),R(`div`,VQ,[V(YU,{tone:`danger`,title:A(Y)(`proxy.routes.cannotSaveTitle`)},{default:j(()=>[B(`ul`,HQ,[(L(!0),R(I,null,P(o.value,e=>(L(),R(`li`,{key:e.route.id},O(e.view?.message??A(Y)(`proxy.routes.cannotRoute`,{host:e.route.host})),1))),128))])]),_:1},8,[`title`])])):U(``,!0),a.value.length===0?(L(),R(`div`,UQ,[V(hR,{compact:``,title:A(Y)(`proxy.routes.emptyTitle`),description:A(Y)(`proxy.routes.emptyDescription`)},{icon:j(()=>[V(A(tb),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled,onClick:t[1]||=e=>r(`add`)},{default:j(()=>[H(O(A(Y)(`proxy.routes.addFirst`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`div`,WQ,[B(`table`,GQ,[B(`thead`,null,[B(`tr`,KQ,[B(`th`,qQ,O(A(Y)(`proxy.routes.columnHostname`)),1),B(`th`,JQ,O(A(Y)(`proxy.routes.columnTarget`)),1),B(`th`,YQ,O(A(Y)(`proxy.routes.columnUpstream`)),1),B(`th`,XQ,O(A(Y)(`proxy.routes.columnTls`)),1),B(`th`,ZQ,O(A(Y)(`proxy.routes.columnState`)),1),B(`th`,QQ,O(A(Y)(`proxy.routes.columnOn`)),1),B(`th`,$Q,[B(`span`,e$,O(A(Y)(`common.actions`)),1)])])]),B(`tbody`,null,[(L(!0),R(I,null,P(a.value,e=>(L(),R(`tr`,{key:e.route.key,class:`border-t border-line-soft align-top`},[B(`td`,t$,[B(`p`,n$,[e.url!==null&&e.route.enabled?(L(),R(`a`,{key:0,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`transition-colors duration-150 hover:text-accent hover:underline`,title:A(Y)(`proxy.routes.openInTab`,{url:e.url})},O(e.route.host),9,r$)):(L(),R(I,{key:1},[H(O(e.route.host.trim().length>0?e.route.host:A(Y)(`proxy.routes.noHostname`)),1)],64)),e.route.path.length>0?(L(),R(`span`,i$,O(e.route.path),1)):U(``,!0)]),B(`p`,a$,O(e.route.id),1)]),B(`td`,o$,O(e.target),1),B(`td`,s$,O(e.view?.upstream??`—`),1),B(`td`,c$,[H(O(e.tls)+` `,1),e.certificate?(L(),R(`div`,l$,[V(hG,{tone:e.certificate.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.certificate.labelKey)),1)]),_:2},1032,[`tone`]),e.certificate.message?(L(),R(`p`,{key:0,class:D([`mt-0.5 text-2xs`,e.certificate.tone===`danger`?`text-danger`:`text-faint`])},O(e.certificate.message),3)):U(``,!0),i(e.view?.certificate?.state)?(L(),R(`div`,u$,[V(BQ,{host:e.route.host,"retry-in":A(sZ)(e.certificate?.retryInMinutes??null),busy:n.disabled,onConfirm:t=>r(`retry`,e.route)},null,8,[`host`,`retry-in`,`busy`,`onConfirm`])])):U(``,!0)])):U(``,!0)]),B(`td`,d$,[e.meta?(L(),z(hG,{key:0,tone:e.meta.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.meta.labelKey)),1)]),_:2},1032,[`tone`])):(L(),z(hG,{key:1,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`proxy.status.unapplied`)),1)]),_:1})),e.view?.message?(L(),R(`p`,{key:2,class:D([`mt-0.5 text-2xs`,e.view.status===`error`?`text-danger`:`text-warn`])},O(e.view.message),3)):U(``,!0)]),B(`td`,f$,[V(sV,{"model-value":e.route.enabled,label:A(Y)(`proxy.routes.toggle`,{name:e.route.host||e.route.id}),"sr-only":``,disabled:n.disabled,"onUpdate:modelValue":t=>r(`toggle`,e.route,t)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])]),B(`td`,p$,[B(`span`,m$,[V($,{size:`xs`,variant:`ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.edit`,{name:e.route.host||e.route.id}),onClick:t=>r(`edit`,e.route)},{default:j(()=>[V(A(Ny),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.remove`,{name:e.route.host||e.route.id}),onClick:t=>r(`remove`,e.route)},{default:j(()=>[V(A($y),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`])])])]))),128))])])]))]),_:1},8,[`title`,`description`]))}}),g$={class:`min-h-full`},_$={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},v$={class:`mb-5`},y$={class:`text-xl font-semibold tracking-tight text-ink`},b$={class:`mt-1 text-xs text-muted`},x$={class:`mt-1 text-2xs leading-4 text-faint`},S$={key:2,class:`space-y-6`},C$={key:0,class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},w$={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},T$={class:`min-w-0 flex-1`},E$={class:`text-xs text-muted`},D$={class:`font-mono tabular-nums text-ink`},O$={key:0,class:`mt-0.5 text-xs text-danger`},k$={key:1,class:`mt-0.5 text-xs text-danger`},A$={key:2,class:`mt-0.5 text-xs text-ok`},j$={class:`flex shrink-0 items-center gap-2`},M$=N({__name:`ProxyView`,setup(e){let t=tI(),n=fP(),r=k(null),i=k(null),a=k(null),o=k(!1),s=k(null),c=k({enabled:!1,httpPort:80,httpsPort:443,email:``,staging:!1,dns01:!1,resolvers:``}),l=k([]),u=k(!1),d=k(null),f=W(()=>t.proxy.value??r.value),p=W(()=>f.value?.config??null),m=W(()=>f.value?.engine.path??null),h=W(()=>t.workspaces.value.map(e=>({id:e.id,label:e.label,servers:e.servers.map(e=>({id:e.id}))}))),g=W(()=>DX(c.value,l.value)?vX(l.value):null),_=W(()=>p.value!==null&&jX(p.value.routes,l.value,C())!==null),v=W(()=>{if(p.value===null)return 0;let e=EX(p.value,c.value,l.value,C());return e===null?0:Object.keys(e).filter(e=>e!==`routes`).length+(e.routes===void 0?0:1)}),y=W(()=>(f.value?.routes??[]).filter(e=>e.status===`error`)),b=W(()=>_.value?[]:y.value.map(e=>e.message??Y(`proxy.routes.cannotRoute`,{host:e.route.host}))),x={},S;function C(){return S}function w(){let e=p.value;if(e===null)return;fB(x.listener,{...c.value})||(Object.assign(c.value,eZ(e)),x.listener={...c.value});let t=RX(l.value);fB(x.routes,t)||(l.value=tZ(e.routes),x.routes=RX(l.value),S=e.routes.map(e=>({...e})))}M(f,w,{immediate:!0});async function T(){i.value=null;try{r.value=await UM()}catch(e){i.value=CM(e)}}ia(()=>{t.proxy.value===null&&T()});let ee={install:()=>KM(),start:rN,stop:iN,apply:MM,revert:eN},te={install:`proxy.view.engineInstalled`,start:`proxy.view.engineStarting`,stop:`proxy.view.engineStopping`,apply:`proxy.view.configApplied`,revert:`proxy.view.configReverted`};async function ne(e){if(s.value===null){s.value=e,a.value=null;try{r.value=await ee[e](),n.success(Y(te[e])),await t.refresh()}catch(e){a.value=CM(e)}finally{s.value=null}}}let re=k(null),ie=k(null);async function ae(){let e=p.value,i=e===null?null:EX(e,c.value,l.value,C());if(i===null||o.value||b.value.length>0)return;let a=e===null?[]:MX(e.routes,l.value,C());if(a.length>0)ie.value=null,re.value=Y(`proxy.view.concurrentEdit`,{ids:a.join(`, `)});else{o.value=!0,re.value=null,ie.value=null;try{r.value=await YM(i),await t.refresh(),ie.value=Y(`proxy.view.settingsSaved`),n.success(Y(`proxy.view.settingsSavedToast`)),delete x.listener,delete x.routes,w()}catch(e){re.value=CM(e)}finally{o.value=!1}}}function oe(){re.value=null,ie.value=null,delete x.listener,delete x.routes,w()}function se(){d.value=null,u.value=!0}function ce(e){d.value=e,u.value=!0}function le(e){l.value=nZ(l.value,d.value,e),d.value=null}function E(e){l.value=l.value.filter(t=>t.key!==e.key)}async function ue(e){s.value=`apply`;try{r.value=await $M(e.id),await t.refresh(),n.success(Y(`proxy.view.retryAsked`,{host:e.host}))}catch(e){n.failure(Y(`proxy.view.retryFailed`),CM(e))}finally{s.value=null}}function de(e,t){e.enabled=t}async function fe(e){r.value=e,await t.refresh()}return(e,t)=>(L(),R(`div`,g$,[B(`div`,_$,[B(`header`,v$,[B(`h1`,y$,O(A(Y)(`proxy.view.title`)),1),B(`p`,b$,O(A(Y)(`proxy.view.description`)),1),B(`p`,x$,O(A(Y)(`proxy.view.dnsNote`)),1)]),i.value?(L(),z(YU,{key:0,tone:`danger`,title:A(Y)(`proxy.view.readFailed`),class:`mb-4`},{default:j(()=>[H(O(i.value),1)]),_:1},8,[`title`])):U(``,!0),f.value===null&&i.value===null?(L(),z(YU,{key:1,tone:`info`,class:`mb-4`},{default:j(()=>[H(O(A(Y)(`proxy.view.reading`)),1)]),_:1})):U(``,!0),f.value===null?U(``,!0):(L(),R(`div`,S$,[V(yQ,{view:f.value,busy:s.value,onAct:ne},null,8,[`view`,`busy`]),a.value?(L(),z(YU,{key:0,tone:`danger`},{default:j(()=>[H(O(a.value),1)]),_:1})):U(``,!0),V(AQ,{form:c.value,"onUpdate:form":t[0]||=e=>c.value=e,"engine-path":m.value,"email-host":g.value,"dns-accounts":f.value?.dnsAccounts??[]},null,8,[`form`,`engine-path`,`email-host`,`dns-accounts`]),V(h$,{routes:l.value,views:f.value.routes,workspaces:h.value,"http-port":f.value.config.httpPort,"https-port":f.value.config.httpsPort,disabled:o.value,onAdd:se,onEdit:ce,onRemove:E,onRetry:ue,onToggle:de},null,8,[`routes`,`views`,`workspaces`,`http-port`,`https-port`,`disabled`]),V(RZ,{certificates:f.value.certificates,disabled:o.value,onChanged:fe},null,8,[`certificates`,`disabled`])]))]),f.value===null?U(``,!0):(L(),R(`div`,C$,[B(`div`,w$,[B(`div`,T$,[B(`p`,E$,[v.value>0?(L(),R(I,{key:0},[B(`span`,D$,O(v.value),1),H(` `+O(A(bF)(`proxy.view.fieldChanged`,v.value)),1)],64)):(L(),R(I,{key:1},[H(O(A(Y)(`proxy.view.noChanges`)),1)],64))]),b.value.length>0?(L(),R(`p`,O$,O(b.value.join(` · `)),1)):re.value?(L(),R(`p`,k$,O(re.value),1)):ie.value?(L(),R(`p`,A$,O(ie.value),1)):U(``,!0)]),B(`div`,j$,[V($,{variant:`ghost`,disabled:v.value===0||o.value,onClick:oe},{default:j(()=>[H(O(A(Y)(`proxy.view.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:v.value===0||b.value.length>0,loading:o.value,onClick:ae},{default:j(()=>[H(O(A(Y)(`proxy.view.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])),V(FQ,{open:u.value,"onUpdate:open":t[1]||=e=>u.value=e,draft:d.value,others:l.value.filter(e=>e.key!==d.value?.key),workspaces:h.value,"dns-accounts":f.value?.dnsAccounts??[],onSave:le},null,8,[`open`,`draft`,`others`,`workspaces`,`dns-accounts`])]))}}),N$={class:`mb-4 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},P$={class:`min-w-0`},F$={class:`text-sm font-semibold text-ink`},I$={class:`mt-0.5 text-2xs leading-4 text-muted`},L$={class:`flex items-center gap-2`},R$={class:`font-mono tabular-nums`},z$={key:1,class:`text-2xs text-faint`},B$={class:`flex flex-col gap-3`},V$={key:0,class:`mt-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},H$={class:`mt-4 flex items-center justify-end gap-2 border-t border-line pt-3.5`},U$={class:`max-h-[60dvh] overflow-auto`},W$={key:0,class:`divide-y divide-line-soft`},G$={class:`font-mono text-xs text-ink`},K$={class:`ml-auto font-mono text-xs text-muted line-through`},q$={class:`font-mono text-xs text-accent`},J$={key:1,class:`text-xs text-muted`},Y$=N({__name:`ServerConfigEditor`,props:{serverId:{},workspaceId:{},config:{}},emits:[`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=[`restart`,`health`,`stop`],a=tI(),o=k(!1),s=k(null);function c(e){return e>0?Math.round(e/1024/1024):null}function l(e){return{label:e.label??``,command:e.command,cwd:e.cwd,args:e.args.join(`
47
- `),env:bB(e.env),dataEnvs:bB(e.dataEnvs),backupPaths:e.backupPaths.join(`
45
+ `)}}var DV=[`type`,`disabled`,`aria-busy`],$=N({inheritAttrs:!1,__name:`AppButton`,props:{variant:{default:`secondary`},size:{default:`sm`},type:{default:`button`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},block:{type:Boolean,default:!1}},setup(e){let t=e,n=La(),r={primary:`bg-accent text-accent-ink border-transparent hover:brightness-110 active:brightness-95 shadow-[inset_0_1px_0_rgb(255_255_255/0.14)]`,secondary:`bg-raise text-ink border-line hover:bg-hover`,ghost:`bg-transparent text-muted border-transparent hover:bg-hover hover:text-ink`,danger:`bg-danger text-white border-transparent hover:brightness-110 active:brightness-95`,"danger-ghost":`bg-transparent text-danger border-danger/30 hover:bg-danger-soft`},i={xs:`h-6 gap-1 px-1.5 text-2xs`,sm:`h-8 gap-1.5 px-2.5 text-xs`,md:`h-9 gap-2 px-3.5 text-sm`,icon:`h-9 w-9 justify-center`,"icon-sm":`h-8 w-8 justify-center`},a=W(()=>Q(`inline-flex select-none items-center rounded-control border font-medium whitespace-nowrap`,`transition-[background-color,border-color,color,filter,opacity] duration-150 ease-out`,`disabled:pointer-events-none disabled:opacity-45`,r[t.variant],i[t.size],t.block&&`w-full`,tV,n.class));return(e,r)=>(L(),R(`button`,Ps({...A(n),class:void 0},{type:t.type,class:a.value,disabled:t.disabled||t.loading,"aria-busy":t.loading||void 0}),[t.loading?(L(),z(A(wy),{key:0,class:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`})):U(``,!0),F(e.$slots,`default`)],16,DV))}}),OV=[`open`],kV={class:`flex cursor-pointer list-none select-none items-center gap-1.5 px-3 py-2 text-xs font-semibold text-ink [&::-webkit-details-marker]:hidden`},AV={key:0,class:`ml-1 truncate text-2xs font-normal text-faint`},jV={class:`grid gap-3 border-t border-line-soft px-3 py-3`},MV=N({__name:`Disclosure`,props:{title:{},hint:{default:void 0},open:{type:Boolean,default:!1}},setup(e){let t=e;return(e,n)=>(L(),R(`details`,{class:`group rounded-panel border border-line bg-panel-2/40`,open:t.open},[B(`summary`,kV,[V(A(ty),{class:`size-3.5 shrink-0 text-muted transition-transform duration-150 group-open:rotate-90`,"aria-hidden":`true`}),H(` `+O(t.title)+` `,1),t.hint?(L(),R(`span`,AV,O(t.hint),1)):U(``,!0)]),B(`div`,jV,[F(e.$slots,`default`)])],8,OV))}}),NV={class:`flex shrink-0 items-start justify-between gap-4 border-b border-line px-4 py-3`},PV={class:`min-w-0`},FV={class:`min-h-0 flex-1 overflow-y-auto px-4 py-3.5`},IV={key:0,class:`flex shrink-0 items-center justify-end gap-2 border-t border-line bg-panel-2 px-4 py-3`},LV=N({__name:`Modal`,props:Va({title:{},description:{default:void 0},width:{default:`w-[min(92vw,34rem)]`}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=lo(e,`open`);return(e,r)=>(L(),z(A(yf),{open:n.value,"onUpdate:open":r[0]||=e=>n.value=e},{default:j(()=>[V(A(lp),null,{default:j(()=>[V(A(sp),{class:`fixed inset-0 z-50 bg-black/45 backdrop-blur-[1px] data-[state=closed]:animate-[hh-fade-out_120ms_ease-in] data-[state=open]:animate-[hh-fade-in_150ms_ease-out]`}),V(A(ip),{class:D(A(Q)(`fixed left-1/2 top-1/2 z-50 flex max-h-[88dvh] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-panel border border-line bg-panel shadow-float`,`data-[state=closed]:animate-[hh-pop-out_120ms_ease-in] data-[state=open]:animate-[hh-pop-in_160ms_var(--ease-out-quick)]`,t.width))},{default:j(()=>[B(`header`,NV,[B(`div`,PV,[V(A(up),{class:`text-sm font-semibold text-ink`},{default:j(()=>[H(O(t.title),1)]),_:1}),t.description?(L(),z(A(ap),{key:0,class:`mt-0.5 text-xs text-muted`},{default:j(()=>[H(O(t.description),1)]),_:1})):U(``,!0)]),V(A(bf),{class:D(A(Q)(`-mr-1 -mt-0.5 grid size-7 shrink-0 place-items-center rounded-control text-muted transition-colors duration-150 hover:bg-hover hover:text-ink`,A(tV))),"aria-label":A(Y)(`common.close`)},{default:j(()=>[V(A(nb),{class:`size-4`})]),_:1},8,[`class`,`aria-label`])]),B(`div`,FV,[F(e.$slots,`default`)]),e.$slots.footer?(L(),R(`footer`,IV,[F(e.$slots,`footer`)])):U(``,!0)]),_:3},8,[`class`])]),_:3})]),_:3},8,[`open`]))}}),RV=[`for`],zV=[`id`,`rows`,`placeholder`],BV={key:1,class:`text-2xs text-danger`},VV=N({inheritAttrs:!1,__name:`TextAreaField`,props:Va({label:{default:void 0},hint:{default:void 0},error:{default:null},rows:{default:3},placeholder:{default:void 0},wide:{type:Boolean,default:!0},mono:{type:Boolean,default:!0}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`),r=fi();return(e,i)=>(L(),R(`div`,{class:D(A(Q)(`flex min-w-0 flex-col gap-1`,t.wide&&`sm:col-span-2`))},[t.label?(L(),R(`label`,{key:0,for:A(r),class:D(A(nV))},O(t.label),11,RV)):U(``,!0),wr(B(`textarea`,Ps({id:A(r),"onUpdate:modelValue":i[0]||=e=>n.value=e,rows:t.rows,placeholder:t.placeholder,spellcheck:`false`,class:A(Q)(t.mono?A(aV):`font-sans`,`resize-y leading-relaxed`,t.error&&`border-danger`)},e.$attrs),null,16,zV),[[nu,n.value]]),t.error?(L(),R(`p`,BV,O(t.error),1)):t.hint?(L(),R(`p`,{key:2,class:D(A(rV))},O(t.hint),3)):U(``,!0)],2))}}),HV=N({__name:`TransText`,props:{k:{},params:{}},setup(e){let t=e,n=Ia(),r=W(()=>Object.keys(n)),i=W(()=>{let e={...t.params};for(let t of r.value)delete e[t];let n=Y(t.k,e),i=[],a=/\{(\w+)\}/g,o=0,s=a.exec(n);for(;s!==null;){s.index>o&&i.push({text:n.slice(o,s.index)});let e=s[1];i.push(r.value.includes(e)?{slot:e}:{text:s[0]}),o=s.index+s[0].length,s=a.exec(n)}return o<n.length&&i.push({text:n.slice(o)}),i});return(e,t)=>(L(),R(`span`,null,[(L(!0),R(I,null,P(i.value,(t,n)=>(L(),R(I,{key:n},[t.slot?F(e.$slots,t.slot,{},void 0,void 0,0):(L(),R(I,{key:1},[H(O(t.text),1)],64))],64))),128))]))}}),UV={key:0,role:`alert`,class:`sticky top-0 z-10 mb-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},WV={key:1,class:`flex flex-col gap-3`},GV={class:`text-sm font-medium text-ink`},KV={class:`mt-0.5 text-2xs text-muted`},qV={class:`grid grid-cols-1 gap-2 sm:grid-cols-2`},JV=[`onClick`],YV={class:`text-xs font-medium text-ink`},XV={class:`text-2xs leading-4 text-muted`},ZV={"data-field":`id`},QV={"data-field":`command`},$V={class:`text-2xs leading-4 text-faint`},eH={class:`font-mono`},tH={class:`rounded-panel border border-line-soft bg-panel-2/40 p-3`},nH={class:`text-2xs font-medium text-muted`},rH={class:`mt-1.5 flex flex-wrap gap-1`},iH=N({__name:`AddServerDialog`,props:Va({workspaceId:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=gI(),o=k(!1),s=k(null),c=k(null),l=k(null),u=k(!0),d=[`{port}`,`{host}`,`{home}`,`{projectDir}`,`{dataRoot}`,`{id}`,`{label}`,`{cwd}`,`{bind}`,`{lanIp}`],f=W(()=>a.workspaceById(n.workspaceId)?.defaults),p=W(()=>a.workspaceById(n.workspaceId)?.label??Y(`addServer.thisWorkspace`)),m=tn(BB(f.value));function h(e){Object.assign(m,EV(e,{...f.value===void 0?{}:{defaults:f.value},id:m.id,label:m.label})),u.value=!1,s.value=null,c.value=null}function g(){u.value=!1}let _=W(()=>{let e=WB(m.port);return e===null?null:Y(e)});function v(){Object.assign(m,BB(f.value)),s.value=null,c.value=null,u.value=!0}function y(e,t){if(s.value=e,c.value=t,t===null)return;let n=l.value?.querySelector(`[data-field="${t}"] input, [data-field="${t}"] textarea`);n?.scrollIntoView({block:`center`,behavior:`smooth`}),n?.focus()}M(i,e=>{e&&v()});async function b(){s.value=null,c.value=null;let e=KB(m);if(e!==null){y(Y(e.key),e.field);return}let t=zj(GB(m,f.value));if(t instanceof J.errors)y(t.summary,null);else{o.value=!0;try{if(await a.create(n.workspaceId,t),a.lastError.value!==null){y(a.lastError.value,null);return}r(`created`),i.value=!1,v()}finally{o.value=!1}}}return(e,t)=>(L(),z(LV,{open:i.value,"onUpdate:open":t[29]||=e=>i.value=e,title:A(Y)(`addServer.title`),description:A(Y)(`addServer.description`,{workspace:p.value}),width:`w-[min(94vw,40rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[28]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),u.value?U(``,!0):(L(),z($,{key:0,type:`submit`,form:`add-server-form`,variant:`primary`,loading:o.value},{default:j(()=>[H(O(A(Y)(`addServer.submit`)),1)]),_:1},8,[`loading`]))]),default:j(()=>[s.value?(L(),R(`p`,UV,O(s.value),1)):U(``,!0),u.value?(L(),R(`div`,WV,[B(`div`,null,[B(`p`,GV,O(A(Y)(`presets.pickTitle`)),1),B(`p`,KV,O(A(Y)(`presets.pickDescription`)),1)]),B(`ul`,qV,[(L(!0),R(I,null,P(A(TV),e=>(L(),R(`li`,{key:e.id},[B(`button`,{type:`button`,class:`flex h-full w-full flex-col items-start gap-1 rounded-panel border border-line bg-raise px-3 py-2.5 text-left transition-colors hover:bg-hover`,onClick:t=>h(e)},[B(`span`,YV,O(A(Y)(e.nameKey)),1),B(`span`,XV,O(A(Y)(e.descriptionKey)),1)],8,JV)]))),128))]),V($,{variant:`ghost`,size:`xs`,class:`self-start`,onClick:g},{default:j(()=>[H(O(A(Y)(`presets.startFromScratch`)),1)]),_:1})])):U(``,!0),wr(B(`form`,{id:`add-server-form`,ref_key:`formEl`,ref:l,class:`flex flex-col gap-3`,onSubmit:_u(b,[`prevent`])},[V(QB,{title:A(Y)(`addServer.identity`),columns:2,dense:``},{default:j(()=>[B(`div`,ZV,[V(bV,{modelValue:m.id,"onUpdate:modelValue":t[0]||=e=>m.id=e,label:A(Y)(`addServer.id`),placeholder:`my-server`,hint:A(Y)(`addServer.idHint`),error:c.value===`id`?s.value:null,class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`,`error`])]),V(bV,{modelValue:m.label,"onUpdate:modelValue":t[1]||=e=>m.label=e,label:A(Y)(`common.label`),placeholder:`My server`,hint:A(Y)(`addServer.labelHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(QB,{title:A(Y)(`addServer.process`),columns:2,dense:``},{default:j(()=>[B(`div`,QV,[V(bV,{modelValue:m.command,"onUpdate:modelValue":t[2]||=e=>m.command=e,label:A(Y)(`common.command`),placeholder:`node`,hint:A(Y)(`addServer.commandHint`),error:c.value===`command`?s.value:null,class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`,`error`])]),V(bV,{modelValue:m.cwd,"onUpdate:modelValue":t[3]||=e=>m.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(VV,{modelValue:m.args,"onUpdate:modelValue":t[4]||=e=>m.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`addServer.argumentsHint`),placeholder:`-p
46
+ {port}`},null,8,[`modelValue`,`label`,`hint`]),V(QB,{title:A(Y)(`addServer.portLifecycle`),columns:2,dense:``},{default:j(()=>[V(lV,{modelValue:m.port,"onUpdate:modelValue":t[5]||=e=>m.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,error:_.value,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`error`,`hint`]),V(hV,{modelValue:m.bind,"onUpdate:modelValue":t[6]||=e=>m.bind=e,label:A(Y)(`serverForm.bindAddress`),options:[{value:`local`,label:A(Y)(`bind.local`)},{value:`lan`,label:A(Y)(`bind.lan`)}],hint:A(Y)(`addServer.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(CV,{modelValue:m.autostart,"onUpdate:modelValue":t[7]||=e=>m.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:m.persistent,"onUpdate:modelValue":t[8]||=e=>m.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(MV,{title:A(Y)(`addServer.advanced`),hint:A(Y)(`addServer.advancedHint`)},{default:j(()=>[V(QB,{title:A(Y)(`common.environment`),columns:2,dense:``},{default:j(()=>[V(VV,{modelValue:m.env,"onUpdate:modelValue":t[9]||=e=>m.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:m.dataEnvs,"onUpdate:modelValue":t[10]||=e=>m.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(bV,{modelValue:m.envFile,"onUpdate:modelValue":t[11]||=e=>m.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(bV,{modelValue:m.dependsOn,"onUpdate:modelValue":t[12]||=e=>m.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(QB,{title:A(Y)(`addServer.backups`),columns:2,dense:``},{default:j(()=>[V(VV,{modelValue:m.backupPaths,"onUpdate:modelValue":t[13]||=e=>m.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:m.backupIgnoreGenerated,"onUpdate:modelValue":t[14]||=e=>m.backupIgnoreGenerated=e,label:A(Y)(`addServer.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),V(wV,{restart:m.restart,"onUpdate:restart":t[15]||=e=>m.restart=e,health:m.health,"onUpdate:health":t[16]||=e=>m.health=e,stop:m.stop,"onUpdate:stop":t[17]||=e=>m.stop=e},null,8,[`restart`,`health`,`stop`]),V(QB,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`addServer.bootstrapDescription`),columns:2,dense:``},{default:j(()=>[V(CV,{modelValue:m.bootstrapEnabled,"onUpdate:modelValue":t[18]||=e=>m.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`addServer.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),m.bootstrapEnabled?(L(),R(I,{key:0},[V(bV,{modelValue:m.bootstrapCommand,"onUpdate:modelValue":t[19]||=e=>m.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(lV,{modelValue:m.bootstrapTimeoutMs,"onUpdate:modelValue":t[20]||=e=>m.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(CV,{modelValue:m.bootstrapRunOnce,"onUpdate:modelValue":t[21]||=e=>m.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:m.bootstrapArgs,"onUpdate:modelValue":t[22]||=e=>m.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:m.bootstrapEnv,"onUpdate:modelValue":t[23]||=e=>m.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0)]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`addServer.policyResources`),columns:2,dense:``},{default:j(()=>[V(hV,{modelValue:m.onPortConflict,"onUpdate:modelValue":t[24]||=e=>m.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(lV,{modelValue:m.logBufferLines,"onUpdate:modelValue":t[25]||=e=>m.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50,hint:A(Y)(`addServer.logBufferHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:m.maxRssMb,"onUpdate:modelValue":t[26]||=e=>m.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:m.enabled,"onUpdate:modelValue":t[27]||=e=>m.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`]),B(`p`,$V,[V(HV,{k:`addServer.inheritNote`},{settings:j(()=>[B(`span`,eH,O(A(Y)(`addServer.serverDefaults`)),1)]),_:1})])]),_:1},8,[`title`,`hint`]),B(`div`,tH,[B(`p`,nH,O(A(Y)(`addServer.placeholdersTitle`)),1),B(`div`,rH,[(L(),R(I,null,P(d,e=>B(`code`,{key:e,class:`rounded-control border border-line bg-raise px-1.5 py-0.5 font-mono text-2xs text-ink`},O(e),1)),64))])])],544),[[Jc,!u.value]])]),_:1},8,[`open`,`title`,`description`]))}});function aH(e){return Math.max(100,(typeof e==`number`&&Number.isFinite(e)&&e>0?e:1)*100)}function oH(e){let t=e.trim().toLowerCase();return t===`localhost`||t===`::1`||t===`[::1]`||t.endsWith(`.localhost`)?!0:/^127(?:\.\d{1,3}){3}$/.test(t)}function sH(e,t){let{url:n,bindHost:r}=e,i=t.trim();if(n===null||r.trim()!==`0.0.0.0`||i===``||oH(i))return n;try{let e=new URL(n),t=i.includes(`:`)&&!i.startsWith(`[`)?`[${i}]`:i,r=e.port.length>0?`:${e.port}`:``,a=e.pathname===`/`?``:e.pathname;return`${e.protocol}//${t}${r}${a}${e.search}${e.hash}`}catch{return n}}function cH(){return globalThis.location?.hostname??``}var lH={class:`text-xs font-semibold text-ink`},uH={class:`mt-1 text-2xs leading-4 text-muted`},dH={class:`mt-2.5 flex justify-end gap-1.5`},fH=N({__name:`KillPortButton`,props:{port:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{variant:`danger-ghost`,size:`xs`,loading:n.busy},{default:j(()=>[H(O(A(Y)(`killPort.trigger`,{port:n.port})),1)]),_:1},8,[`loading`])]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`start`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,lH,O(A(Y)(`killPort.title`,{port:n.port})),1),B(`p`,uH,O(A(Y)(`killPort.body`)),1),B(`div`,dH,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`killPort.confirm`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),pH=[`viewBox`],mH=[`id`],hH=[`stop-color`],gH=[`stop-color`],_H=[`d`,`fill`],vH=[`d`,`stroke`,`stroke-width`],yH=[`x1`,`x2`,`y2`,`stroke`],bH=[`cx`,`cy`,`fill`],xH={key:0,class:`absolute inset-x-0 top-1/2 border-t border-dashed border-line`},SH=100,CH=N({__name:`Sparkline`,props:Va({values:{},height:{default:34},max:{default:null},min:{default:null},fill:{type:Boolean,default:!0},strokeWidth:{default:1.5},color:{default:void 0},class:{default:void 0},interactive:{type:Boolean,default:!1}},{hoverIndex:{default:null},hoverIndexModifiers:{}}),emits:[`update:hoverIndex`],setup(e){let t=e,n=lo(e,`hoverIndex`),r=fi(),i=k(null),a=W(()=>{let e=t.values.filter(e=>e!==null&&Number.isFinite(e)),n=t.max??(e.length>0?Math.max(...e):1),r=t.min??0;return{bottom:r,ceiling:n===r?r+1:n}}),o=W(()=>{let e=t.values,{bottom:n,ceiling:r}=a.value,i=r-n,o=e.length>1?SH/(e.length-1):SH,s=e=>t.height-(e-n)/i*t.height,c=[],l=[],u=()=>{if(l.length===0)return;let e=l.map((e,t)=>`${t===0?`M`:`L`}${e.x.toFixed(2)} ${e.y.toFixed(2)}`).join(` `),n=l[0],r=`${e} L${l[l.length-1].x.toFixed(2)} ${t.height} L${n.x.toFixed(2)} ${t.height} Z`;c.push({line:e,area:r}),l=[]};return e.forEach((e,t)=>{e===null||!Number.isFinite(e)?u():l.push({x:t*o,y:s(e)})}),u(),c}),s=W(()=>n.value===null||t.values.length<2?null:n.value/(t.values.length-1)*SH),c=W(()=>{let e=n.value;if(e===null)return null;let r=t.values[e];if(r==null||!Number.isFinite(r))return null;let{bottom:i,ceiling:o}=a.value;return t.height-(r-i)/(o-i)*t.height});function l(e){if(!t.interactive||!i.value||t.values.length===0)return;let r=i.value.getBoundingClientRect();if(r.width===0)return;let a=Math.min(1,Math.max(0,(e.clientX-r.left)/r.width));n.value=Math.round(a*(t.values.length-1))}function u(){n.value=null}return(e,n)=>(L(),R(`div`,{ref_key:`track`,ref:i,class:D(A(Q)(`relative w-full`,t.class)),style:_e({height:`${t.height}px`}),onMousemove:l,onMouseleave:u},[(L(),R(`svg`,{viewBox:`0 0 ${SH} ${t.height}`,preserveAspectRatio:`none`,class:`block size-full overflow-visible`,role:`img`,"aria-hidden":`true`},[B(`defs`,null,[B(`linearGradient`,{id:A(r),x1:`0`,y1:`0`,x2:`0`,y2:`1`},[B(`stop`,{offset:`0%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0.26`},null,8,hH),B(`stop`,{offset:`100%`,"stop-color":t.color??`currentColor`,"stop-opacity":`0`},null,8,gH)],8,mH)]),(L(!0),R(I,null,P(o.value,(e,n)=>(L(),R(I,{key:n},[t.fill?(L(),R(`path`,{key:0,d:e.area,fill:`url(#${A(r)})`,stroke:`none`},null,8,_H)):U(``,!0),B(`path`,{d:e.line,fill:`none`,stroke:t.color??`currentColor`,"stroke-width":t.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`,"vector-effect":`non-scaling-stroke`},null,8,vH)],64))),128)),s.value===null?U(``,!0):(L(),R(`line`,{key:0,x1:s.value,x2:s.value,y1:`0`,y2:t.height,stroke:t.color??`currentColor`,"stroke-width":`1`,"stroke-dasharray":`2 2`,"vector-effect":`non-scaling-stroke`,opacity:`0.5`},null,8,yH)),s.value!==null&&c.value!==null?(L(),R(`circle`,{key:1,cx:s.value,cy:c.value,r:`2`,fill:t.color??`currentColor`,"vector-effect":`non-scaling-stroke`},null,8,bH)):U(``,!0)],8,pH)),o.value.length===0?(L(),R(`div`,xH)):U(``,!0)],38))}}),wH={class:`min-w-0`},TH={class:`flex items-baseline justify-between gap-2`},EH={class:`truncate text-2xs font-medium text-faint`},DH={class:`flex shrink-0 items-baseline gap-1.5`},OH={key:0,class:`font-mono text-2xs text-faint`},kH=N({__name:`MetricSpark`,props:{label:{},values:{},format:{},max:{default:null},colorClass:{default:`text-accent`},height:{default:30},sampleMs:{default:5e3},emptyHint:{default:void 0}},setup(e){let t=e,n=k(null),r=W(()=>WF(t.values)),i=W(()=>t.values.some(e=>e!==null)),a=W(()=>{let e=n.value;return e!==null&&t.values[e]!==void 0?t.values[e]??null:r.value}),o=W(()=>{let e=n.value;if(e===null)return null;let r=t.values.length-1-e;if(r<=0)return null;let i=Math.round(r*t.sampleMs/1e3);return i<60?`−${i}s`:`−${Math.round(i/60)}m`});return(e,r)=>(L(),R(`div`,wH,[B(`div`,TH,[B(`span`,EH,O(t.label),1),B(`span`,DH,[o.value?(L(),R(`span`,OH,O(o.value),1)):U(``,!0),B(`span`,{class:D(A(Q)(`font-mono text-xs font-medium tabular-nums`,i.value?`text-ink`:`text-faint`))},O(i.value?t.format(a.value):t.emptyHint??A(Y)(`metric.emptyHint`)),3)])]),V(CH,{"hover-index":n.value,"onUpdate:hoverIndex":r[0]||=e=>n.value=e,values:t.values,height:t.height,max:t.max,interactive:``,class:D(A(Q)(`mt-1`,t.colorClass))},null,8,[`hover-index`,`values`,`height`,`max`,`class`])]))}}),AH={class:`inline-flex flex-wrap items-center gap-1.5`},jH={class:`relative flex size-1.5`},MH={key:0,class:`absolute inset-0 rounded-full bg-current opacity-60`,style:{animation:`hh-pulse-ring 1.6s ease-out infinite`}},NH=N({__name:`StatusPill`,props:{status:{},health:{default:null},showHealth:{type:Boolean,default:!0}},setup(e){let t=e,n=W(()=>oR[t.status]),r=W(()=>t.health?sR[t.health]:null),i=W(()=>t.showHealth&&r.value!==null&&t.health!==`disabled`&&t.health!==`unknown`&&(r.value.tone===`danger`||r.value.tone===`warn`)),a=W(()=>n.value.transitional);return(e,t)=>(L(),R(`span`,AH,[B(`span`,{class:D(A(Q)(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(lR)[n.value.tone]))},[B(`span`,jH,[a.value?(L(),R(`span`,MH)):U(``,!0),B(`span`,{class:D(A(Q)(`relative size-1.5 rounded-full`,A(uR)[n.value.tone]))},null,2)]),H(` `+O(A(Y)(n.value.labelKey)),1)],2),i.value&&r.value?(L(),R(`span`,{key:0,class:D(A(Q)(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium`,A(lR)[r.value.tone]))},O(A(Y)(r.value.labelKey)),3)):U(``,!0)]))}}),PH=N({__name:`Tip`,props:{label:{},side:{default:`top`},disabled:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),z(A(kg),{"delay-duration":350},{default:j(()=>[V(A(Pg),{"as-child":``},{default:j(()=>[F(t.$slots,`default`)]),_:3}),e.disabled?U(``,!0):(L(),z(A(Ng),{key:0},{default:j(()=>[V(A(Mg),{side:e.side,"side-offset":6,class:`z-50 max-w-64 rounded-control border border-line bg-raise px-2 py-1 text-2xs text-ink shadow-float data-[state=delayed-open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[H(O(e.label),1)]),_:1},8,[`side`])]),_:1}))]),_:3}))}}),FH={class:`flex items-start justify-between gap-3 px-4 pb-2.5 pt-3.5`},IH={class:`min-w-0`},LH={class:`flex items-center gap-2`},RH=[`href`,`title`,`aria-label`],zH={class:`mt-0.5 flex items-center gap-1.5 truncate font-mono text-2xs text-faint`},BH={class:`text-muted`},VH={key:1,class:`rounded bg-hover px-1 py-px text-muted`},HH={key:2,class:`rounded bg-accent-soft px-1 py-px text-accent`},UH={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},WH={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},GH=[`title`],KH={key:0,class:`space-y-2.5 border-y border-line-soft px-4 py-3`},qH={class:`grid grid-cols-2 gap-x-4 gap-y-2`},JH={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-1 px-4 pt-2.5`},YH={class:`text-muted`},XH={class:`text-faint`},ZH={key:2,class:`flex flex-col gap-1 px-4 pt-2.5`},QH={key:0,class:`flex items-start gap-1.5 text-2xs leading-4 text-danger`},$H={class:`min-w-0 break-words`},eU={key:2,class:`text-2xs leading-4 text-warn`},tU={key:3,class:`text-2xs leading-4 text-warn`},nU={class:`grid grid-cols-2 gap-x-4 gap-y-1 px-4 py-3 sm:grid-cols-4`},rU={class:`truncate text-2xs text-faint`},iU={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},aU={class:`mt-auto flex flex-wrap items-center gap-1.5 border-t border-line-soft px-4 py-2.5`},oU={class:`grid grid-cols-2 gap-2 text-xs`},sU={class:`text-faint`},cU={class:`font-mono text-ink`},lU={class:`text-faint`},uU={class:`text-ink capitalize`},dU=N({__name:`ServerCard`,props:{server:{},workspaceId:{},series:{},now:{},variant:{default:`default`}},setup(e){let t=e,n={start:Py,exit:Jy,crash:iy,"forced-restart":zy,unhealthy:eb,recovered:ay},r=gI(),i=jI(),a=k(!1),o=k(!1),s=W(()=>t.server.config),c=W(()=>s.value.label&&s.value.label.length>0?s.value.label:t.server.id),l=W(()=>`${s.value.command} ${s.value.args.join(` `)}`.trim()),u=W(()=>dR(t.server.status,t.server.health)),d=W(()=>sH(t.server,cH())),f=W(()=>t.server.status===`running`),p=W(()=>s.value.enabled&&[`stopped`,`crashed`,`conflict`].includes(t.server.status)),m=W(()=>[`running`,`starting`,`backoff`].includes(t.server.status)),h=W(()=>t.server.startedAt===null||!f.value?`—`:YR(t.now-t.server.startedAt)),g=W(()=>t.server.nextRetryAt===null?null:XR(t.server.nextRetryAt,t.now)),_=W(()=>t.server.health!==`unhealthy`||t.server.unhealthySince===null?null:YR(t.now-t.server.unhealthySince)),v=W(()=>t.series?.cpu??[]),y=W(()=>t.series?.rss??[]),b=W(()=>t.series?.probe??[]),x=W(()=>aH(r.host.value?.cpus)),S=W(()=>[...t.server.history.events].slice(-3).reverse()),C={unknown:`common.unknown`,free:`serverCard.portFree`,"in-use":`serverCard.portInUse`},w=W(()=>{let e=t.server,n=LF(e),r=[{key:`pid`,label:Y(`serverCard.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:h.value},{key:`restarts`,label:Y(`serverCard.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`port`,label:Y(`common.port`),value:Y(C[e.portState]??`common.unknown`)},{key:`uptime24`,label:Y(`serverCard.uptime24h`),value:jR(e.history.uptimeRatio)},{key:`probe`,label:Y(`serverCard.probe`),value:n.responseMs===null?`—`:`${n.responseMs} ms`},{key:`rss`,label:Y(`serverCard.rss`),value:tz(n.rssBytes)},{key:`procs`,label:Y(`serverCard.procs`),value:n.processes===null?`—`:String(n.processes)}];return e.history.crashes>0&&r.splice(5,0,{key:`crashes`,label:Y(`serverCard.crashes24h`),value:String(e.history.crashes)}),e.history.lastCrashAt!==null&&r.push({key:`lastcrash`,label:Y(`serverCard.lastCrash`),value:ZR(e.history.lastCrashAt,t.now)}),r});async function T(e){a.value=!0;try{await r[e](t.workspaceId,t.server.id)}finally{a.value=!1}}async function ee(){a.value=!0;try{await r.freePort(t.workspaceId,t.server.id)}finally{a.value=!1}}async function te(e){let n=!(e===`enabled`?s.value.enabled:s.value.autostart);e===`enabled`?await r.setEnabled(t.workspaceId,t.server.id,n):await r.setAutostart(t.workspaceId,t.server.id,n)}async function ne(){o.value=!1,await r.remove(t.workspaceId,t.server.id)}let re=W(()=>J2(t.workspaceId,`servers`,t.server.id));function ie(){i.select(t.workspaceId)}return(i,h)=>{let C=ha(`RouterLink`);return L(),R(`article`,{class:D(A(Q)(`group relative flex flex-col rounded-panel border bg-panel shadow-card transition-colors duration-150`,`hover:border-line/90`,t.server.status===`crashed`||t.server.status===`conflict`?`border-danger/30`:`border-line`,!s.value.enabled&&`opacity-70`))},[B(`span`,{class:D(A(Q)(`absolute inset-y-3 left-0 w-0.5 rounded-full`,{"bg-ok":u.value===`ok`,"bg-warn":u.value===`warn`,"bg-danger":u.value===`danger`,"bg-faint/50":u.value===`neutral`,"bg-accent":u.value===`accent`||u.value===`info`}))},null,2),B(`header`,FH,[B(`div`,IH,[B(`div`,LH,[V(C,{to:re.value,class:`truncate text-sm font-semibold tracking-tight text-ink hover:text-accent`,onClick:ie},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`to`]),d.value?(L(),R(`a`,{key:0,href:d.value,target:`_blank`,rel:`noreferrer`,class:`-my-1 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-accent`,title:d.value,"aria-label":A(Y)(`serverCard.open`,{url:d.value})},[V(A(my),{class:`size-3.5`})],8,RH)):U(``,!0)]),B(`p`,zH,[B(`span`,null,O(e.server.id),1),s.value.port===null?U(``,!0):(L(),R(I,{key:0},[h[9]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,BH,`:`+O(s.value.port),1)],64)),h[10]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(e.server.bindHost),1),s.value.enabled?U(``,!0):(L(),R(`span`,VH,O(A(Y)(`serverCard.disabled`)),1)),s.value.autostart?(L(),R(`span`,HH,O(A(Y)(`serverCard.autostart`)),1)):U(``,!0)])]),V(NH,{status:e.server.status,health:e.server.health},null,8,[`status`,`health`]),e.server.adopted?(L(),z(PH,{key:0,label:A(Y)(`serverCard.adoptedHint`)},{default:j(()=>[B(`span`,UH,O(A(Y)(`serverCard.detached`)),1)]),_:1},8,[`label`])):U(``,!0),s.value.persistent?(L(),z(PH,{key:1,label:A(Y)(`serverCard.persistentHint`)},{default:j(()=>[B(`span`,WH,O(A(Y)(`serverCard.persistent`)),1)]),_:1},8,[`label`])):U(``,!0)]),B(`p`,{class:`truncate px-4 pb-3 font-mono text-2xs text-muted`,title:l.value},O(l.value),9,GH),t.variant===`compact`?U(``,!0):(L(),R(`div`,KH,[B(`div`,qH,[V(kH,{label:A(Y)(`common.cpu`),values:v.value,format:A(nz),max:x.value,"empty-hint":f.value?void 0:A(Y)(`metric.notRunning`),"color-class":`text-cpu`},null,8,[`label`,`values`,`format`,`max`,`empty-hint`]),V(kH,{label:A(Y)(`common.memory`),values:y.value,format:A(tz),"empty-hint":f.value?void 0:A(Y)(`metric.notRunning`),"color-class":`text-mem`},null,8,[`label`,`values`,`format`,`empty-hint`])]),V(kH,{label:A(Y)(`serverCard.healthProbe`),values:b.value,format:e=>e===null?`—`:`${e} ms`,height:22,"color-class":`text-probe`,"empty-hint":A(Y)(`serverCard.notProbed`)},null,8,[`label`,`values`,`format`,`empty-hint`])])),S.value.length>0?(L(),R(`div`,JH,[(L(!0),R(I,null,P(S.value,e=>(L(),R(`span`,{key:`${e.ts}`,class:`inline-flex items-center gap-1 text-2xs`},[(L(),z(_a(n[e.type]),{class:D(A(Q)(`size-3`,A(cR)[A(pR)[e.type]]))},null,8,[`class`])),B(`span`,YH,O(A(Y)(A(fR)[e.type])),1),B(`span`,XH,O(A(ZR)(e.ts,t.now)),1)]))),128))])):U(``,!0),e.server.lastError||_.value||g.value?(L(),R(`div`,ZH,[e.server.lastError?(L(),R(`p`,QH,[V(A(iy),{class:`mt-0.5 size-3 shrink-0`}),B(`span`,$H,O(e.server.lastError),1)])):U(``,!0),e.server.status===`conflict`&&s.value.port!==null?(L(),z(fH,{key:1,port:s.value.port,busy:a.value,class:`self-start`,onConfirm:ee},null,8,[`port`,`busy`])):U(``,!0),_.value?(L(),R(`p`,eU,O(A(Y)(`serverCard.unhealthyFor`,{duration:_.value})),1)):U(``,!0),g.value?(L(),R(`p`,tU,O(A(Y)(`serverCard.nextAttempt`,{when:g.value})),1)):U(``,!0)])):U(``,!0),B(`dl`,nU,[(L(!0),R(I,null,P(w.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,rU,O(e.label),1),B(`dd`,iU,O(e.value),1)]))),128))]),B(`div`,aU,[V($,{variant:`primary`,size:`xs`,disabled:a.value||!p.value,onClick:h[0]||=e=>T(`start`)},{default:j(()=>[V(A(Py),{class:`size-3`}),H(O(A(Y)(`serverCard.start`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!m.value,onClick:h[1]||=e=>T(`stop`)},{default:j(()=>[V(A(Jy),{class:`size-3`}),H(O(A(Y)(`serverCard.stop`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,disabled:a.value||!s.value.enabled,onClick:h[2]||=e=>T(`restart`)},{default:j(()=>[V(A(zy),{class:`size-3`}),H(O(A(Y)(`serverCard.restart`)),1)]),_:1},8,[`disabled`]),V(PH,{label:A(Y)(`serverCard.detailsHint`)},{default:j(()=>[V(C,{to:re.value,onClick:ie},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[V(A(By),{class:`size-3`}),H(O(A(Y)(`common.details`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`label`]),V(A(pg),null,{default:j(()=>[V(A(vg),{"as-child":``},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,class:`ml-auto`,"aria-label":A(Y)(`serverCard.moreActions`,{label:c.value})},{default:j(()=>[V(A(py),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(gg),null,{default:j(()=>[V(A(mg),{"side-offset":4,align:`end`,class:`z-50 min-w-52 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:h[3]||=e=>te(`enabled`)},{default:j(()=>[V(A(Iy),{class:`size-3.5`}),H(` `+O(s.value.enabled?A(Y)(`serverCard.disable`):A(Y)(`serverCard.enable`)),1)]),_:1}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:h[4]||=e=>te(`autostart`)},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(` `+O(s.value.autostart?A(Y)(`serverCard.removeFromAutostart`):A(Y)(`serverCard.autostartWithPanel`)),1)]),_:1}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:h[5]||=t=>A(r).clearLogs(e.workspaceId,e.server.id)},{default:j(()=>[V(A(By),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.clearLogBuffer`)),1)]),_:1}),V(A(_g),{class:`my-1 h-px bg-line`}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:h[6]||=e=>o.value=!0},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`serverCard.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),V(LV,{open:o.value,"onUpdate:open":h[8]||=e=>o.value=e,title:A(Y)(`serverCard.removeTitle`),description:A(Y)(`serverCard.removeDescription`,{label:c.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:h[7]||=e=>o.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ne},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`dl`,oU,[B(`div`,null,[B(`dt`,sU,O(A(Y)(`serverCard.idField`)),1),B(`dd`,cU,O(e.server.id),1)]),B(`div`,null,[B(`dt`,lU,O(A(Y)(`serverCard.statusField`)),1),B(`dd`,uU,O(e.server.status),1)])])]),_:1},8,[`open`,`title`,`description`])],2)}}}),fU={class:`flex flex-wrap items-start justify-between gap-3`},pU={class:`min-w-0`},mU={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},hU={class:`text-2xl font-semibold tracking-tight text-ink`},gU={key:1,class:`mt-1 max-w-2xl text-xs leading-relaxed text-muted`},_U={class:`flex min-w-0 flex-wrap items-center gap-2`},vU=N({__name:`PageHeader`,props:{title:{},description:{default:void 0},backTo:{default:void 0},backLabel:{default:`Back`}},setup(e){return(e,t)=>{let n=ha(`RouterLink`);return L(),R(`header`,fU,[B(`div`,pU,[e.$props.backTo?(L(),z(n,{key:0,to:e.$props.backTo,class:`mb-1 inline-flex items-center gap-1 text-2xs text-muted transition-colors duration-150 hover:text-ink`},{default:j(()=>[V(A(ey),{class:`size-3`}),H(` `+O(e.$props.backLabel),1)]),_:1},8,[`to`])):U(``,!0),B(`div`,mU,[B(`h1`,hU,O(e.$props.title),1),F(e.$slots,`badges`)]),e.$props.description?(L(),R(`p`,gU,O(e.$props.description),1)):U(``,!0)]),B(`div`,_U,[F(e.$slots,`actions`)])])}}}),yU={key:0,class:`mb-3 flex items-start justify-between gap-3`},bU={class:`min-w-0`},xU={class:`flex shrink-0 items-center gap-1.5`},SU=N({__name:`Panel`,props:{padded:{type:Boolean,default:!0},class:{}},setup(e){return(e,t)=>(L(),R(`section`,{class:D(A(Q)(`rounded-panel border border-line bg-panel shadow-card`,e.$props.padded&&`p-4`,e.$props.class))},[e.$slots.header||e.$slots.actions?(L(),R(`header`,yU,[B(`div`,bU,[F(e.$slots,`header`)]),B(`div`,xU,[F(e.$slots,`actions`)])])):U(``,!0),F(e.$slots,`default`)],2))}}),CU=N({__name:`Skeleton`,props:{class:{default:`h-4 w-24`},rounded:{default:`rounded`}},setup(e){return(t,n)=>(L(),R(`span`,{class:D(A(Q)(`block animate-pulse bg-line-soft`,e.rounded,t.$props.class)),style:{"animation-duration":`1.4s`},"aria-hidden":`true`},null,2))}}),wU={class:`min-w-0`},TU={class:`truncate text-2xs font-medium text-faint`},EU={key:0,class:`mt-0.5 truncate text-2xs text-muted`},DU=N({__name:`StatTile`,props:{label:{},value:{},hint:{default:void 0},tone:{default:`neutral`},mono:{type:Boolean,default:!0}},setup(e){return(e,t)=>(L(),R(`div`,wU,[B(`p`,TU,O(e.$props.label),1),B(`p`,{class:D(A(Q)(`mt-0.5 truncate text-xl font-semibold tracking-tight`,e.$props.mono&&`font-mono tabular-nums`,e.$props.tone===`neutral`?`text-ink`:A(cR)[e.$props.tone]))},O(e.$props.value),3),e.$props.hint?(L(),R(`p`,EU,O(e.$props.hint),1)):U(``,!0)]))}}),OU=k(null),kU=k(`unknown`),AU=null;async function jU(){try{let e=await(await fetch(`/healthz`,{cache:`no-store`})).json();typeof e.uptimeMs==`number`&&(OU.value=Date.now()-e.uptimeMs),kU.value=e.status===`degraded`?`degraded`:`ok`}catch{kU.value=`unknown`}}function MU(){return AU??=jU().finally(()=>{AU=null}),{startedAt:OU,status:kU,refresh:jU}}var NU={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},PU={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},FU={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},IU={class:`p-4`},LU={class:`p-4`},RU={class:`p-4`},zU={class:`p-4`},BU={class:`p-4`},VU={key:2,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},HU={class:`min-w-0`},UU={class:`text-xs font-medium text-danger`},WU={class:`mt-0.5 flex flex-wrap gap-x-3 gap-y-1 text-2xs text-danger`},GU=[`onClick`],KU={class:`grid grid-cols-1 gap-4 lg:grid-cols-3`},qU={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},JU={class:`text-2xs text-muted`},YU={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},XU={class:`flex flex-wrap items-center gap-x-3 gap-y-1.5`},ZU={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},QU={class:`font-mono text-2xs font-normal text-faint`},$U={class:`text-2xs text-muted`},eW={class:`ml-auto flex items-center gap-1.5`},tW={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-3 py-2 text-2xs leading-4 text-danger`},nW={key:2,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},rW={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},iW={class:`font-mono`},aW=N({__name:`GlobalOverviewView`,setup(e){let t=gI(),n=jI(),r=MU(),i=Qg(),a=k(!1),o=k(``),s=W(()=>t.appState.value===null),c=W(()=>t.workspaces.value),l=W(()=>t.allServers.value.map(e=>e.server)),u=W(()=>l.value.filter(e=>e.status===`running`)),d=W(()=>l.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),f=W(()=>t.host.value),p=W(()=>r.startedAt.value===null?`—`:YR(t.now.value-r.startedAt.value)),m=W(()=>f.value?.enabled?YR(f.value.uptimeMs):`—`),h=W(()=>c.value[0]?.id??n.activeId.value);function g(e){o.value=e,a.value=!0}function _(e,t){n.select(e),i.push(J2(e,`servers`,t))}return ia(async()=>{await r.refresh()}),(e,v)=>(L(),R(`div`,NU,[V(vU,{title:A(Y)(`nav.globalOverview`),description:A(Y)(`views.globalOverview.description`)},null,8,[`title`,`description`]),!s.value&&l.value.length===0?(L(),z(AR,{key:0,title:A(Y)(`views.globalOverview.emptyTitle`),description:A(Y)(`views.globalOverview.emptyDescription`)},{icon:j(()=>[V(A(Hy),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:v[0]||=e=>g(h.value)},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):U(``,!0),l.value.length>0||s.value?(L(),z(SU,{key:1,class:`p-0`},{default:j(()=>[s.value?(L(),R(`div`,PU,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(CU,{class:`h-2.5 w-16`}),V(CU,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,FU,[B(`div`,IU,[V(DU,{label:A(Y)(`views.globalOverview.workspaces`),value:String(c.value.length),hint:A(PF)(`views.globalOverview.serversTotal`,l.value.length)},null,8,[`label`,`value`,`hint`])]),B(`div`,LU,[V(DU,{label:A(Y)(`views.overview.running`),value:`${u.value.length}/${l.value.length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:l.value.length-u.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,RU,[V(DU,{label:A(Y)(`views.overview.needsAttention`),value:String(d.value.length),tone:d.value.length>0?`danger`:`ok`,hint:d.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,zU,[V(DU,{label:A(Y)(`views.globalOverview.panelUptime`),value:p.value,hint:A(r).status.value===`degraded`?A(Y)(`views.globalOverview.degraded`):A(Y)(`views.globalOverview.serving`)},null,8,[`label`,`value`,`hint`])]),B(`div`,BU,[V(DU,{label:A(Y)(`views.globalOverview.hostUptime`),value:m.value,hint:f.value?.enabled?A(Y)(`views.globalOverview.samplingOn`):A(Y)(`views.globalOverview.samplingOff`)},null,8,[`label`,`value`,`hint`])])]))]),_:1})):U(``,!0),d.value.length>0?(L(),R(`div`,VU,[V(A(iy),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,HU,[B(`p`,UU,O(A(PF)(`views.globalOverview.needLook`,d.value.length)),1),B(`p`,WU,[(L(!0),R(I,null,P(A(t).allServers.value.filter(e=>e.server.status===`crashed`||e.server.status===`conflict`||e.server.health===`unhealthy`),e=>(L(),R(`button`,{key:`${e.workspace.id}:${e.server.id}`,type:`button`,class:`font-mono underline decoration-danger/40 underline-offset-2 hover:decoration-danger`,onClick:t=>_(e.workspace.id,e.server.id)},O(e.workspace.label)+`/`+O(e.server.id),9,GU))),128))])])])):U(``,!0),B(`div`,KU,[V(SU,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,qU,[V(A(dy),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.globalOverview.hostVitals`)),1)]),B(`p`,JU,O(A(Y)(`views.globalOverview.hostVitalsNote`)),1)]),default:j(()=>[V(Cz,{host:f.value,now:A(t).now.value},null,8,[`host`,`now`])]),_:1}),V(SU,null,{header:j(()=>[B(`h2`,YU,[V(A(Jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),default:j(()=>[V(Mz,{servers:l.value,now:A(t).now.value,limit:12,qualify:``},null,8,[`servers`,`now`])]),_:1})]),(L(!0),R(I,null,P(c.value,e=>(L(),R(`section`,{key:e.id,class:`space-y-3`},[B(`div`,XU,[B(`h2`,ZU,[V(A(Sy),{class:`size-3.5 text-faint`}),H(` `+O(e.label)+` `,1),B(`span`,QU,O(e.id),1)]),B(`span`,$U,O(A(Y)(`views.globalOverview.groupRunning`,{running:e.runningCount,total:e.serverCount})),1),B(`div`,eW,[V($,{size:`xs`,variant:`ghost`,onClick:t=>g(e.id)},{default:j(()=>[V(A(Fy),{class:`size-3`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`ghost`,onClick:t=>{A(n).select(e.id),A(i).push(A(J2)(e.id,`overview`))}},{default:j(()=>[H(O(A(Y)(`views.globalOverview.openWorkspace`)),1)]),_:1},8,[`onClick`])])]),e.configError?(L(),R(`p`,tW,O(A(Y)(`views.globalOverview.configError`,{error:e.configError})),1)):U(``,!0),e.servers.length===0?(L(),z(AR,{key:1,compact:``,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.globalOverview.groupEmptyDescription`)},{action:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t=>g(e.id)},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1},8,[`onClick`])]),_:2},1032,[`title`,`description`])):(L(),R(`div`,nW,[(L(!0),R(I,null,P(e.servers,n=>(L(),z(dU,{key:n.id,server:n,"workspace-id":e.id,series:A(t).seriesOf(e.id,n.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]))),128)),B(`p`,rW,[B(`span`,null,O(A(Y)(`views.overview.sampling`)),1),B(`span`,iW,O(A(t).appState.value?.control.url),1)]),V(iH,{open:a.value,"onUpdate:open":v[1]||=e=>a.value=e,"workspace-id":o.value},null,8,[`open`,`workspace-id`])]))}}),oW={class:`text-xs font-semibold text-ink`},sW={key:0,class:`mt-1 text-2xs leading-4 text-muted`},cW={class:`mt-2.5 flex justify-end gap-1.5`},lW=N({__name:`ConfirmButton`,props:{label:{},confirmLabel:{default:void 0},variant:{default:`danger-ghost`},confirmVariant:{default:`danger`},size:{default:`sm`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{default:void 0},hint:{default:void 0},alternativeLabel:{default:void 0}},emits:[`confirm`,`alternative`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=W(()=>n.confirmLabel??Y(`common.confirm`)),o=W(()=>n.title??Y(`common.confirmQuestion`,{label:a.value}));function s(){i.value=!1,r(`confirm`)}function c(){i.value=!1,r(`alternative`)}return(e,t)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{variant:n.variant,size:n.size,disabled:n.disabled,loading:n.loading},{default:j(()=>[H(O(n.label),1)]),_:1},8,[`variant`,`size`,`disabled`,`loading`])]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,oW,O(o.value),1),n.hint?(L(),R(`p`,sW,O(n.hint),1)):U(``,!0),B(`div`,cW,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`ghost`,loading:n.loading,onClick:s},{default:j(()=>[H(O(a.value),1)]),_:1},8,[`loading`]),n.alternativeLabel?(L(),z($,{key:0,size:`xs`,variant:n.confirmVariant,loading:n.loading,onClick:c},{default:j(()=>[H(O(n.alternativeLabel),1)]),_:1},8,[`variant`,`loading`])):U(``,!0)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),uW={class:`min-w-0 flex-1`},dW={key:0,class:`text-xs font-semibold`},fW=N({__name:`Notice`,props:{tone:{default:`info`},title:{default:void 0},class:{default:void 0}},setup(e){let t=e,n={ok:ay,warn:eb,danger:jy,info:by,neutral:by,accent:Wy},r=W(()=>n[t.tone]);return(e,n)=>(L(),R(`div`,{class:D(A(Q)(`flex items-start gap-2 rounded-panel border px-3 py-2`,A(lR)[t.tone],t.class))},[(L(),z(_a(r.value),{class:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`})),B(`div`,uW,[t.title?(L(),R(`p`,dW,O(t.title),1)):U(``,!0),B(`div`,{class:D(A(Q)(`text-xs leading-relaxed text-ink/85`,t.title&&`mt-0.5`))},[F(e.$slots,`default`)],2)])],2))}}),pW={class:`space-y-2`},mW={key:2,class:`mt-1`},hW={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},gW=N({__name:`AuthenticationSection`,props:Va({view:{},dirty:{type:Boolean}},{auth:{required:!0},authModifiers:{}}),emits:Va([`reset`],[`update:auth`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`auth`),a=MB(()=>i.value.sessionTtlMs,e=>i.value.sessionTtlMs=e,6048e5),o=NB(()=>i.value.maxLoginAttempts,e=>i.value.maxLoginAttempts=e,5),s=MB(()=>i.value.lockoutMs,e=>i.value.lockoutMs=e,6e4),c=W(()=>n.view?.auth.passwordSet===!0),l=W(()=>n.view?.auth.apiTokenSet===!0),u=W(()=>n.view?.auth.blockedReason??null),d=W(()=>n.view?.auth.exposed===!0),f=W(()=>n.view?.auth.usingDefaultPassword===!0),p=W(()=>i.value.enabled&&!c.value),{setPassword:m,clearPassword:h}=xP(),g=k(``),_=k(``),v=k(``),y=k(null),b=k(null),x=k(!1),S=W(()=>v.value.length>0&&v.value!==_.value),C=W(()=>_.value.length>0&&_.value.length<8),w=W(()=>_.value.length>0&&!S.value&&(!c.value||g.value.length>0));async function T(){if(w.value&&!x.value){x.value=!0,b.value=null,y.value=null;try{let e=await m(c.value?g.value:void 0,_.value);if(e!==null){b.value=e;return}g.value=``,_.value=``,v.value=``,y.value=Y(`settings.auth.passwordUpdated`)}finally{x.value=!1}}}async function ee(){b.value=null,y.value=null;let e=await h();e===null?y.value=Y(`settings.auth.passwordCleared`):b.value=e}return(e,t)=>(L(),R(I,null,[V(QB,{title:A(Y)(`settings.auth.policyTitle`),description:A(Y)(`settings.auth.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(CV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.auth.requirePassword`),hint:A(Y)(`settings.auth.requirePasswordHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.auth.sessionLifetime`),min:60,hint:A(Y)(`settings.auth.sessionLifetimeHint`)},null,8,[`modelValue`,`label`,`hint`]),V(hV,{modelValue:i.value.cookieSecure,"onUpdate:modelValue":t[3]||=e=>i.value.cookieSecure=e,label:A(Y)(`settings.auth.cookieSecure`),options:[{value:`auto`,label:A(Y)(`settings.auth.cookieSecureAuto`)},{value:`always`,label:A(Y)(`settings.auth.cookieSecureAlways`)},{value:`never`,label:A(Y)(`settings.auth.cookieSecureNever`)}]},null,8,[`modelValue`,`label`,`options`]),V(hV,{modelValue:i.value.trustProxy,"onUpdate:modelValue":t[4]||=e=>i.value.trustProxy=e,label:A(Y)(`settings.auth.trustProxy`),options:[{value:`off`,label:A(Y)(`settings.auth.trustProxyOff`)},{value:`loopback`,label:A(Y)(`settings.auth.trustProxyLoopback`)},{value:`any`,label:A(Y)(`settings.auth.trustProxyAny`)}],hint:A(Y)(`settings.auth.trustProxyHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`options`,`hint`]),V(lV,{modelValue:A(o),"onUpdate:modelValue":t[5]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.auth.maxLoginAttempts`),min:1,hint:A(Y)(`settings.auth.maxLoginAttemptsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(s),"onUpdate:modelValue":t[6]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.auth.lockout`),min:1},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),B(`div`,pW,[V(fW,{tone:l.value?`info`:`neutral`,title:l.value?A(Y)(`settings.auth.apiTokenSet`):A(Y)(`settings.auth.apiTokenMissing`)},{default:j(()=>[l.value?(L(),z(HV,{key:0,k:`settings.auth.apiTokenNote`},{code:j(()=>[...t[10]||=[B(`code`,null,`Authorization: Bearer …`,-1)]]),_:1})):(L(),z(HV,{key:1,k:`settings.auth.noTokenNote`},{command:j(()=>[...t[11]||=[B(`code`,null,`home-hosted set-token --generate`,-1)]]),_:1})),l.value?(L(),R(`p`,mW,[V(HV,{k:`settings.auth.apiTokenRotation`},{command:j(()=>[...t[12]||=[B(`code`,null,`home-hosted set-token --generate`,-1)]]),_:1})])):U(``,!0)]),_:1},8,[`tone`,`title`]),f.value?(L(),z(fW,{key:0,tone:`warn`,title:A(Y)(`settings.auth.defaultPasswordTitle`)},{default:j(()=>[V(HV,{k:`settings.auth.defaultPasswordText`},{address:j(()=>[...t[13]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):U(``,!0),u.value?(L(),z(fW,{key:1,tone:`danger`,title:A(Y)(`settings.auth.blockedTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):p.value?(L(),z(fW,{key:2,tone:`warn`,title:A(Y)(`settings.auth.noPasswordTitle`)},{default:j(()=>[V(HV,{k:`settings.auth.noPasswordText`},{address:j(()=>[...t[14]||=[B(`code`,null,`127.0.0.1`,-1)]]),_:1})]),_:1},8,[`title`])):d.value?(L(),z(fW,{key:3,tone:`warn`,title:A(Y)(`settings.auth.exposedTitle`)},{default:j(()=>[H(O(A(Y)(`settings.auth.exposedText`)),1)]),_:1},8,[`title`])):U(``,!0)]),B(`form`,{class:`mt-3`,onSubmit:_u(T,[`prevent`])},[V(QB,{title:c.value?A(Y)(`settings.auth.changePassword`):A(Y)(`settings.auth.setPassword`),description:A(Y)(`settings.auth.passwordDescription`)},{default:j(()=>[c.value?(L(),z(bV,{key:0,modelValue:g.value,"onUpdate:modelValue":t[7]||=e=>g.value=e,type:`password`,autocomplete:`current-password`,label:A(Y)(`settings.auth.currentPassword`)},null,8,[`modelValue`,`label`])):U(``,!0),V(bV,{modelValue:_.value,"onUpdate:modelValue":t[8]||=e=>_.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.newPassword`)},null,8,[`modelValue`,`label`]),V(bV,{modelValue:v.value,"onUpdate:modelValue":t[9]||=e=>v.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.auth.repeatPassword`),error:S.value?A(Y)(`settings.auth.passwordMismatch`):null},null,8,[`modelValue`,`label`,`error`]),B(`div`,hW,[V($,{type:`submit`,variant:`primary`,disabled:!w.value,loading:x.value},{default:j(()=>[H(O(c.value?A(Y)(`settings.auth.updatePassword`):A(Y)(`settings.auth.setPasswordAndEnable`)),1)]),_:1},8,[`disabled`,`loading`]),c.value?(L(),z(lW,{key:0,label:A(Y)(`settings.auth.clearPassword`),"confirm-label":A(Y)(`settings.auth.clearPasswordConfirm`),"confirm-variant":`danger`,title:A(Y)(`settings.auth.clearPasswordTitle`),hint:A(Y)(`settings.auth.clearPasswordHint`),disabled:x.value,onConfirm:ee},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),C.value||b.value||y.value?(L(),R(I,{key:1},[C.value?(L(),z(fW,{key:0,tone:`warn`,title:A(Y)(`settings.auth.shortPasswordTitle`),class:`sm:col-span-2`},{default:j(()=>[H(O(A(Y)(`settings.auth.shortPasswordText`)),1)]),_:1},8,[`title`])):U(``,!0),b.value?(L(),z(fW,{key:1,tone:`danger`,class:`sm:col-span-2`},{default:j(()=>[H(O(b.value),1)]),_:1})):U(``,!0),y.value?(L(),z(fW,{key:2,tone:`ok`,class:`sm:col-span-2`},{default:j(()=>[H(O(y.value),1)]),_:1})):U(``,!0)],64)):U(``,!0)]),_:1},8,[`title`,`description`])],32)],64))}});function _W(e){return e.labelKey===void 0?e.label:Y(e.labelKey,e.labelParams,e.label)}function vW(e){return e.note===null?null:e.noteKey===void 0?e.note:Y(e.noteKey,e.noteParams,e.note)}var yW={settings:`settings.backups.kindSettings`,servers:`settings.backups.kindServers`,secrets:`settings.backups.kindSecrets`,tls:`settings.backups.kindTls`,data:`settings.backups.kindData`,workspace:`settings.backups.kindWorkspace`};function bW(e){let t=yW[e];return t===void 0?e:Y(t)}var xW={password:`settings.backup.secretPasswordHint`,apiToken:`settings.backup.secretApiTokenHint`,telegram:`settings.backup.secretTelegramHint`,ddns:`settings.backup.secretDdnsHint`};function SW(e){let t=vW(e);if(t!==null&&t.length>0)return t;if(e.kind===`settings`)return Y(`settings.backup.leafSettingsHint`);if(e.kind===`servers`)return Y(`settings.backup.leafServersHint`);if(e.kind===`secrets`){let t=e.secret===void 0?void 0:xW[e.secret];return Y(t===void 0?`settings.backup.leafSecretsHint`:t)}return e.path===void 0?Y(`settings.backup.leafDataHint`):e.origin===void 0?e.path:Y(`settings.backup.pathFromOrigin`,{path:e.path,origin:e.origin})}function CW(e){let t=vW(e);return t!==null&&t.length>0?t:e.kind===`settings`?Y(`settings.backup.entrySettingsHint`):e.kind===`secrets`?Y(`settings.backup.entrySecretsHint`):e.kind===`tls`?Y(`settings.backup.entryTlsHint`):Y(`settings.backup.entryWorkspaceHint`)}function wW(e,t=[]){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.id);return{id:e.id,label:_W(e),hint:CW(e),kind:e.kind,...e.workspaceId===void 0?{}:{workspaceId:e.workspaceId},selected:t?.selected??!0,leaves:e.items.map(e=>({id:e.id,label:_W(e),hint:SW(e),kind:e.kind,selected:t?.leaves.find(t=>t.id===e.id)?.selected??!0}))}})}function TW(e){return e.leaves.length===0?e.selected:e.selected&&e.leaves.some(e=>e.selected)}function EW(e){let t=qz(e,`only`);if(t.kind!==`everything`)return t.kind===`nothing`?[]:t.scope.ids}function DW(e){let t=0,n=0;for(let r of e)TW(r)&&(n+=1,t+=r.leaves.length===0?1:r.leaves.filter(e=>e.selected).length);return{entries:n,leaves:t}}var OW=[`disabled`],kW={class:`min-w-0`},AW={class:`text-ink`},jW=N({__name:`CheckField`,props:Va({label:{},hint:{default:void 0},disabled:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`);return(e,r)=>(L(),R(`label`,{class:D(A(Q)(`flex cursor-pointer select-none items-start gap-2 rounded-control px-2 py-1.5 text-xs transition-colors duration-150`,`hover:bg-hover`,t.disabled&&`cursor-not-allowed opacity-50 hover:bg-transparent`))},[wr(B(`input`,{"onUpdate:modelValue":r[0]||=e=>n.value=e,type:`checkbox`,disabled:t.disabled,class:`mt-0.5 size-3.5 shrink-0 cursor-pointer appearance-none rounded-[4px] border border-line bg-page checked:border-accent checked:bg-accent checked:bg-[length:9px] checked:bg-center checked:bg-no-repeat checked:[background-image:url('data:image/svg+xml;utf8,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22white%22 stroke-width=%224%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22><path d=%22M20 6 9 17l-5-5%22/></svg>')] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:cursor-not-allowed`},null,8,OW),[[ru,n.value]]),B(`span`,kW,[B(`span`,AW,O(t.label),1),t.hint?(L(),R(`span`,{key:0,class:D([`mt-0.5 block`,[A(rV)]])},O(t.hint),3)):U(``,!0),F(e.$slots,`default`)])],2))}}),MW={class:`space-y-3`},NW={class:`flex items-center justify-between gap-2`},PW={key:0,class:`text-xs font-medium text-muted`},FW={class:`ml-auto flex items-center gap-1.5`},IW={class:`space-y-1.5`},LW={class:`flex items-start gap-2.5`},RW={class:`min-w-0 flex-1`},zW={key:0,class:`flex shrink-0 items-center gap-1.5 pt-0.5`},BW={class:`font-mono text-2xs text-faint`},VW={key:1,class:`shrink-0 rounded-control border border-line px-1.5 py-0.5 text-2xs text-faint`},HW={key:0,class:`mt-1 flex items-center gap-1 pl-6 text-2xs text-warn`},UW={class:`space-y-3`},WW={class:`flex items-center justify-between gap-2`},GW={class:`text-xs font-medium text-muted`},KW={class:`flex items-center gap-1.5`},qW={class:`max-h-72 space-y-1 overflow-auto`},JW={key:0,class:`text-xs text-muted`},YW=N({__name:`CaptureTree`,props:{choices:{},disabled:{type:Boolean,default:!1},showCount:{type:Boolean,default:!1}},setup(e){let t=e,n=W(()=>{let e=0,n=0;for(let r of t.choices)!r.selected||r.leaves.length>0&&!r.leaves.some(e=>e.selected)||(e+=1,n+=r.leaves.length===0?1:r.leaves.filter(e=>e.selected).length);return{entries:e,leaves:n}});function r(e){for(let n of t.choices){n.selected=e;for(let t of n.leaves)t.selected=e}}let i=k(!1),a=k(null),o=k({}),s=W(()=>a.value===null?0:a.value.leaves.filter(e=>o.value[e.id]===!0).length);function c(e){a.value=e,o.value=Object.fromEntries(e.leaves.map(e=>[e.id,e.selected])),i.value=!0}function l(){let e=a.value;if(e!==null){for(let t of e.leaves)t.selected=o.value[t.id]===!0;e.leaves.some(e=>e.selected)&&(e.selected=!0),i.value=!1,a.value=null}}function u(e){let t=a.value;t!==null&&(o.value=Object.fromEntries(t.leaves.map(t=>[t.id,e])))}function d(e){return e.selected&&e.leaves.length>0&&e.leaves.some(e=>e.selected)&&e.leaves.some(e=>!e.selected)}return(e,f)=>(L(),R(`div`,MW,[B(`div`,NW,[t.showCount?(L(),R(`span`,PW,O(A(PF)(`settings.backup.entriesCount`,n.value.entries))+` · `+O(A(PF)(`settings.backup.itemsSelected`,n.value.leaves)),1)):U(``,!0),B(`div`,FW,[V($,{size:`xs`,variant:`ghost`,disabled:t.disabled,onClick:f[0]||=e=>r(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:t.disabled,onClick:f[1]||=e=>r(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])])]),B(`ul`,IW,[(L(!0),R(I,null,P(t.choices,e=>(L(),R(`li`,{key:e.id,class:`rounded-control border border-line-soft bg-panel-2/30 px-2.5 py-2`},[B(`div`,LW,[B(`div`,RW,[V(jW,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:e.label,hint:e.hint,disabled:t.disabled},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]),e.leaves.length>0?(L(),R(`div`,zW,[B(`span`,BW,O(e.leaves.filter(e=>e.selected).length)+`/`+O(e.leaves.length),1),V($,{size:`xs`,variant:`secondary`,disabled:t.disabled,onClick:t=>c(e)},{default:j(()=>[V(A(Zv),{class:`size-3`}),H(O(A(Y)(`settings.backup.chooseItems`)),1)]),_:1},8,[`disabled`,`onClick`])])):(L(),R(`span`,VW,O(A(bW)(e.kind)),1))]),d(e)?(L(),R(`p`,HW,[V(A(Sy),{class:`size-3`}),H(` `+O(A(Y)(`settings.backup.partialCapture`)),1)])):U(``,!0)]))),128))]),V(LV,{open:i.value,"onUpdate:open":f[5]||=e=>i.value=e,title:a.value===null?A(Y)(`settings.backup.chooseItems`):A(Y)(`settings.backup.chooseItemsFor`,{label:a.value.label}),description:A(Y)(`settings.backup.subDescription`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:f[4]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:l},{default:j(()=>[H(O(A(Y)(`settings.backup.apply`)),1)]),_:1})]),default:j(()=>[B(`div`,UW,[B(`div`,WW,[B(`span`,GW,O(A(Y)(`settings.backup.selectedOf`,{selected:s.value,total:a.value?.leaves.length??0})),1),B(`div`,KW,[V($,{size:`xs`,variant:`ghost`,onClick:f[2]||=e=>u(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:f[3]||=e=>u(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1})])]),B(`ul`,qW,[(L(!0),R(I,null,P(a.value?.leaves??[],e=>(L(),R(`li`,{key:e.id,class:`rounded-control px-2 py-1.5 hover:bg-hover`},[V(jW,{"model-value":o.value[e.id]===!0,label:e.label,hint:e.hint,"onUpdate:modelValue":t=>o.value[e.id]=t===!0},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`])]))),128))]),a.value?.leaves.length===0?(L(),R(`p`,JW,O(A(Y)(`settings.backup.nothingSelectable`)),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])]))}}),XW={class:`space-y-3`},ZW={class:`max-h-80 overflow-auto`},QW=N({__name:`BackupDialog`,props:Va({selection:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`created`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(!1),o=k(null),s=k(``),c=k([]);function l(e){c.value=wW(n.selection?.entries??[],e?c.value:[])}let u=W(()=>DW(c.value)),d=W(()=>c.value.some(e=>e.id===`global:settings`&&e.selected)),f=W(()=>n.selection!==null&&u.value.leaves>0&&!a.value);M(i,e=>{e&&(s.value=``,o.value=null,l(!1))},{immediate:!0}),M(()=>n.selection,()=>{i.value&&l(!0)});async function p(){if(f.value){a.value=!0,o.value=null;try{await YM({password:s.value,include:EW(c.value)}),i.value=!1,r(`created`,Y(`settings.backup.created`))}catch(e){o.value=IM(e)}finally{a.value=!1}}}return(e,t)=>(L(),z(LV,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,title:A(Y)(`settings.backup.createTitle`),description:A(Y)(`settings.backup.createDescription`),width:`w-[min(92vw,40rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,disabled:!f.value,loading:a.value,onClick:p},{default:j(()=>[H(O(A(Y)(`settings.backup.create`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,XW,[B(`div`,ZW,[V(YW,{choices:c.value,disabled:a.value,"show-count":``},null,8,[`choices`,`disabled`])]),d.value?U(``,!0):(L(),z(fW,{key:0,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.backup.withoutGlobalSettings`)),1)]),_:1})),V(bV,{modelValue:s.value,"onUpdate:modelValue":t[0]||=e=>s.value=e,type:`password`,autocomplete:`new-password`,label:A(Y)(`settings.backup.password`),hint:A(Y)(`settings.backup.passwordHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),o.value?(L(),z(fW,{key:1,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),$W={class:`space-y-3`},eG={key:0,class:`flex min-w-0 flex-col gap-1`},tG=[`disabled`],nG={key:0,class:`font-mono text-2xs text-muted`},rG={class:`mt-2`},iG={class:`mt-2 max-w-sm`},aG={class:`mt-2`},oG={class:`mt-2`},sG={class:`mt-1 max-h-64 space-y-0.5 overflow-auto`},cG={class:`mt-2 flex flex-wrap items-center gap-2`},lG={class:`mt-2`},uG=`__upload__`,dG=N({__name:`RestoreDialog`,props:Va({files:{},initial:{default:null}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`applied`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(``),u=k({kind:`upload`}),d=k(uG),f=W(()=>s.value?.items.filter(e=>e.selected).length??0),p=W(()=>{let e=s.value;return e===null?[]:e.appliedIds===void 0?e.applied:e.appliedIds.map(t=>_W(e.items.find(e=>e.id===t)??{label:t}))}),m=W(()=>{let e=s.value;return e===null?[]:e.skippedItems===void 0?e.skipped:e.skippedItems.map(e=>{let t=_W(e);return e.reasonKey===void 0?t:`${t} (${Y(e.reasonKey,e.reasonParams)})`})}),h=W(()=>s.value?.items.some(e=>e.id===`global:settings`&&e.selected)??!1),g=W(()=>s.value?.needsPassword===!0),_=W(()=>s.value!==null&&!g.value&&f.value>0&&!a.value),v=W(()=>[...n.files.map(e=>({value:e.name,label:e.encrypted?Y(`settings.restore.encryptedName`,{name:e.name}):e.name})),{value:uG,label:Y(`settings.restore.uploadOption`)}]),y=Q(iV,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);function b(e){return IM(e)}function x(){return l.value.length>0?{password:l.value}:{}}async function S(){let e=u.value;if(e.kind===`upload`&&c.value===null)s.value=null;else{a.value=!0,o.value=null,s.value=null;try{s.value=e.kind===`stored`?await uN(e.name,!1,x()):await dN(c.value,!1,x())}catch(e){o.value=b(e)}finally{a.value=!1}}}function C(e){d.value=e,c.value=null,u.value=e===uG?{kind:`upload`}:{kind:`stored`,name:e},S()}function w(e){c.value=e.target.files?.[0]??null,S()}function T(e){for(let t of s.value?.items??[])t.restorable&&(t.selected=e)}async function ee(){let e=s.value,t=u.value;if(e===null||!_.value)return;a.value=!0,o.value=null;let n={...x(),include:e.items.filter(e=>e.restorable&&e.selected).map(e=>e.id)};try{let e=t.kind===`stored`?await uN(t.name,!0,n):await dN(c.value,!0,n);i.value=!1,s.value=null,c.value=null,l.value=``;let a=[];if(e.reloaded&&a.push(Y(`settings.restore.noteReloaded`)),e.restartRequired&&a.push(Y(`settings.restore.noteRestart`)),e.createdWorkspaces!==void 0&&e.createdWorkspaces.length>0&&a.push(Y(`settings.restore.createdWorkspaces`,{items:e.createdWorkspaces.join(`, `)})),e.replacedUnderRunning!==void 0&&e.replacedUnderRunning.length>0){let t=[...new Set(e.replacedUnderRunning.map(e=>`${e.workspaceId}/${e.serverId}`))];a.push(Y(`settings.restore.replacedUnderRunning`,{items:t.join(`, `)}))}let o=e.applied.length;r(`applied`,a.length===0?Y(`settings.restore.restored`,{count:o}):Y(`settings.restore.restoredWithNotes`,{count:o,notes:a.join(`; `)}))}catch(e){o.value=b(e)}finally{a.value=!1}}return M(i,e=>{if(!e){s.value=null,c.value=null,l.value=``,o.value=null;return}let t=n.files[0];u.value=n.initial??(t===void 0?{kind:`upload`}:{kind:`stored`,name:t.name}),d.value=u.value.kind===`stored`?u.value.name:uG,S()},{immediate:!0}),(e,t)=>(L(),z(LV,{open:i.value,"onUpdate:open":t[4]||=e=>i.value=e,title:A(Y)(`settings.restore.title`),description:A(Y)(`settings.restore.description`),width:`w-[min(92vw,38rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,disabled:a.value,onClick:t[3]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),s.value&&!g.value?(L(),z($,{key:0,size:`sm`,variant:`danger`,disabled:!_.value,loading:a.value,onClick:ee},{default:j(()=>[H(O(u.value.kind===`stored`?A(Y)(`settings.restore.applyStored`):A(Y)(`settings.restore.applyUpload`)),1)]),_:1},8,[`disabled`,`loading`])):U(``,!0)]),default:j(()=>[B(`div`,$W,[V(hV,{"model-value":d.value,label:A(Y)(`settings.restore.archive`),hint:A(Y)(`settings.restore.archiveHint`),options:v.value,disabled:a.value,wide:``,"onUpdate:modelValue":C},null,8,[`model-value`,`label`,`hint`,`options`,`disabled`]),u.value.kind===`upload`?(L(),R(`div`,eG,[B(`label`,{class:D(A(nV)),for:`restore-upload`},O(A(Y)(`settings.restore.archiveFile`)),3),B(`input`,{id:`restore-upload`,type:`file`,accept:`.zip,application/zip`,class:D(A(y)),disabled:a.value,onChange:w},null,42,tG),c.value?(L(),R(`p`,nG,O(c.value.name),1)):U(``,!0)])):U(``,!0),a.value?(L(),z(CU,{key:1,class:`h-20 w-full`})):s.value?(L(),z(fW,{key:2,tone:`warn`,title:A(Y)(`settings.restore.unchangedTitle`)},{default:j(()=>[B(`p`,null,[u.value.kind===`stored`?(L(),z(HV,{key:0,k:`settings.restore.archiveLine`},{name:j(()=>[B(`code`,null,O(u.value.name),1)]),_:1})):(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.uploadedArchive`)),1)],64))]),s.value.needsPassword?(L(),R(I,{key:0},[B(`p`,rG,O(s.value.error??A(Y)(`settings.restore.passwordProtected`)),1),B(`div`,iG,[V(bV,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,type:`password`,autocomplete:`off`,label:A(Y)(`settings.restore.password`)},null,8,[`modelValue`,`label`])]),B(`div`,aG,[V($,{size:`sm`,variant:`secondary`,disabled:a.value,onClick:S},{default:j(()=>[H(O(A(Y)(`settings.restore.checkAgain`)),1)]),_:1},8,[`disabled`])])],64)):(L(),R(I,{key:1},[B(`p`,oG,O(A(Y)(`settings.restore.choosePrompt`,{selected:f.value,total:s.value.items.length})),1),B(`ul`,sG,[(L(!0),R(I,null,P(s.value.items,e=>(L(),R(`li`,{key:e.id},[V(jW,{modelValue:e.selected,"onUpdate:modelValue":t=>e.selected=t,label:A(_W)(e),hint:[A(bW)(e.kind),e.workspaceId,A(vW)(e)].filter(Boolean).join(` · `),disabled:!e.restorable||a.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`disabled`])]))),128))]),B(`div`,cG,[V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[1]||=e=>T(!0)},{default:j(()=>[H(O(A(Y)(`common.selectAll`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`ghost`,disabled:a.value,onClick:t[2]||=e=>T(!1)},{default:j(()=>[H(O(A(Y)(`common.selectNone`)),1)]),_:1},8,[`disabled`])]),B(`p`,lG,[H(O(A(Y)(`settings.restore.willRestore`,{items:p.value.join(`, `)||A(Y)(`settings.restore.nothing`)}))+` `,1),m.value.length>0?(L(),R(I,{key:0},[H(O(A(Y)(`settings.restore.skipped`,{items:m.value.join(`, `)})),1)],64)):U(``,!0),s.value.restartRequired?(L(),R(I,{key:1},[H(O(A(Y)(`settings.restore.restartNote`)),1)],64)):h.value?(L(),R(I,{key:2},[H(O(A(Y)(`settings.restore.reloadedNote`)),1)],64)):U(``,!0)])],64))]),_:1},8,[`title`])):U(``,!0),o.value?(L(),z(fW,{key:3,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),fG={class:`inline-flex items-center gap-0.5 rounded-control border border-line bg-panel-2 p-0.5`},pG=[`aria-pressed`,`onClick`],mG=N({__name:`SegmentedControl`,props:Va({options:{},size:{default:`sm`}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=lo(e,`modelValue`);return(e,r)=>(L(),R(`div`,fG,[(L(!0),R(I,null,P(t.options,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D(A(Q)(`rounded-[5px] font-medium transition-colors duration-150`,t.size===`sm`?`h-6 px-2 text-2xs`:`h-7 px-2.5 text-xs`,n.value===e.value?`bg-raise text-ink shadow-card`:`text-muted hover:text-ink`)),"aria-pressed":n.value===e.value,onClick:t=>n.value=e.value},O(e.label),11,pG))),128))]))}}),hG={class:`flex flex-col gap-2 sm:col-span-2`},gG={class:`flex flex-wrap items-center justify-between gap-2`},_G={class:`min-w-0`},vG={class:`text-xs font-medium text-ink`},yG={class:`mt-0.5 text-2xs leading-4 text-muted`},bG={class:`text-2xs leading-4 text-faint`},xG={class:`space-y-3`},SG={class:`flex flex-wrap items-center gap-2`},CG={class:`text-xs font-medium text-muted`},wG={class:`text-2xs leading-4 text-faint`},TG={class:`max-h-80 overflow-auto`},EG=N({__name:`ScheduleScope`,props:Va({selection:{}},{scope:{required:!0},scopeModifiers:{}}),emits:[`update:scope`],setup(e){let t=e,n=lo(e,`scope`),r=k(!1),i=k([]),a=k(`only`);function o(e){let n=wW(t.selection?.entries??[]);if(e===null)return n;let r=t=>e.ids.some(e=>t===e||t.startsWith(`${e}:`)),i=e.mode===`only`;for(let t of n){t.selected=i?r(t.id)||e.ids.some(e=>e.startsWith(`${t.id}:`)):!r(t.id);for(let e of t.leaves)e.selected=i?r(e.id):!r(e.id)}return n}M(r,e=>{e&&(i.value=o(n.value),a.value=n.value?.mode??`only`)},{immediate:!0});let s=W(()=>qz(i.value,a.value)),c=W(()=>s.value.kind===`nothing`),l=W(()=>{let e=n.value;return e===null?Y(`settings.backups.scopeSummaryAll`):e.mode===`only`?Y(`settings.backups.scopeSummaryOnly`,{count:e.ids.length}):Y(`settings.backups.scopeSummaryExcept`,{count:e.ids.length})});function u(){c.value||(n.value=s.value.kind===`scope`?s.value.scope:null,r.value=!1)}return(e,n)=>(L(),R(`div`,hG,[B(`div`,gG,[B(`div`,_G,[B(`p`,vG,O(A(Y)(`settings.backups.scopeTitle`)),1),B(`p`,yG,O(l.value),1)]),V($,{size:`xs`,variant:`secondary`,disabled:t.selection===null,onClick:n[0]||=e=>r.value=!0},{default:j(()=>[H(O(A(Y)(`settings.backups.scopeChoose`)),1)]),_:1},8,[`disabled`])]),B(`p`,bG,O(A(Y)(`settings.backups.scopeHint`)),1),V(LV,{open:r.value,"onUpdate:open":n[3]||=e=>r.value=e,title:A(Y)(`settings.backups.scopeDialogTitle`),description:A(Y)(`settings.backups.scopeDialogDescription`),width:`w-[min(92vw,40rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:n[2]||=e=>r.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:c.value,onClick:u},{default:j(()=>[H(O(A(Y)(`settings.backup.apply`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[B(`div`,xG,[B(`div`,SG,[B(`span`,CG,O(A(Y)(`settings.backups.scopeMode`)),1),V(mG,{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e,options:[{value:`only`,label:A(Y)(`settings.backups.scopeOnly`)},{value:`except`,label:A(Y)(`settings.backups.scopeExcept`)}]},null,8,[`modelValue`,`options`])]),B(`p`,wG,O(a.value===`only`?A(Y)(`settings.backups.scopeOnlyHint`):A(Y)(`settings.backups.scopeExceptHint`)),1),B(`div`,TG,[V(YW,{choices:i.value,"show-count":``},null,8,[`choices`])]),c.value?(L(),z(fW,{key:0,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.backups.scopeNothing`)),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])]))}});async function DG(e){let t=navigator.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return OG(e)}function OG(e){if(typeof document>`u`||typeof document.execCommand!=`function`)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`-1000px`,t.style.opacity=`0`,document.body.appendChild(t);try{return t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}var kG=[`aria-label`],AG=N({__name:`CopyButton`,props:{value:{},label:{default:void 0},class:{default:void 0}},setup(e){let t=e,n=EP(),r=k(!1),i=k(!1),a=null;function o(){a&&clearTimeout(a),a=setTimeout(()=>{r.value=!1,i.value=!1},1400)}async function s(){await DG(t.value)?(i.value=!1,r.value=!0,o()):(r.value=!1,i.value=!0,o(),n.failure(Y(`common.copyFailed`)))}return ze(()=>{a&&clearTimeout(a)}),(e,n)=>(L(),R(`button`,{type:`button`,class:D(A(Q)(`inline-grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,A(tV),t.class)),"aria-label":r.value?A(Y)(`common.copied`):i.value?A(Y)(`common.copyFailed`):t.label??A(Y)(`common.copy`),onClick:s},[r.value?(L(),z(A(Qv),{key:0,class:`size-3.5 text-ok`})):i.value?(L(),z(A(eb),{key:1,class:`size-3.5 text-warn`})):(L(),z(A(uy),{key:2,class:`size-3.5`}))],10,kG))}}),jG={key:0,class:`size-1.5 shrink-0 rounded-full bg-current`},MG=N({__name:`ToneBadge`,props:{tone:{default:`neutral`},dot:{type:Boolean,default:!1},mono:{type:Boolean,default:!1},plain:{type:Boolean,default:!1}},setup(e){let t=e,n=W(()=>Q(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-2xs font-medium whitespace-nowrap`,t.plain?Q(`border-transparent bg-transparent`,lR[t.tone].split(` `).filter(e=>e.startsWith(`text-`)).join(` `)):lR[t.tone],t.mono&&`font-mono`));return(e,r)=>(L(),R(`span`,{class:D(n.value)},[t.dot?(L(),R(`span`,jG)):U(``,!0),F(e.$slots,`default`)],2))}});function NG(){let e=k(null),t=k(null),n=k(!1),r=null;function i(){return r??=(async()=>{n.value=!0;try{e.value=await XN(),t.value=null}catch(e){t.value=IM(e)}finally{n.value=!1,r=null}})(),r}function a(){e.value=null}return ze(()=>{r=null}),{selection:e,error:t,loading:n,load:i,invalidate:a}}var PG={class:`space-y-3`},FG={key:0,class:`sm:col-span-2`},IG={key:0,class:`text-2xs text-muted sm:col-span-2`},LG={key:1,class:`text-2xs text-danger sm:col-span-2`,role:`status`},RG={key:2,class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},zG={class:`text-xs font-medium text-muted`},BG={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},VG={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},HG={class:`text-2xs leading-4 text-faint`},UG={key:0,class:`space-y-2 sm:col-span-2`},WG={key:1,class:`text-xs text-muted sm:col-span-2`},GG={key:2,class:`divide-y divide-line-soft sm:col-span-2`},KG={class:`flex items-center gap-2`},qG={class:`min-w-0 flex-1 truncate text-xs font-medium text-ink`},JG={key:0,class:`font-mono text-2xs text-faint`},YG={key:0,class:`mt-0.5 text-2xs leading-4 text-muted`},XG={key:1,class:`mt-1 space-y-1`},ZG={class:`min-w-0`},QG={class:`truncate font-mono text-2xs text-ink`},$G={class:`mt-0.5 text-2xs leading-4 text-faint`},eK={key:3,class:`text-2xs leading-4 text-faint sm:col-span-2`},tK={key:0,class:`space-y-2 sm:col-span-2`},nK={key:1,class:`sm:col-span-2`},rK={key:2,class:`divide-y divide-line-soft sm:col-span-2`},iK={class:`min-w-0 flex-1`},aK={class:`flex items-center gap-2`},oK={class:`truncate font-mono text-xs text-ink`},sK={class:`mt-0.5 font-mono text-2xs tabular-nums text-muted`},cK={class:`flex items-center gap-1.5`},lK=[`href`],uK={key:3,class:`space-y-2 sm:col-span-2`},dK=N({__name:`BackupsSection`,props:Va({state:{},policy:{},configPath:{},workspaces:{},dirty:{type:Boolean}},{form:{required:!0},formModifiers:{}}),emits:Va([`reset`],[`update:form`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`form`),a=gI(),o=NG();ia(()=>{o.load()});let s=NB(()=>i.value.keep,e=>i.value.keep=e,5),c=NB(()=>i.value.scheduleHours,e=>i.value.scheduleHours=e,24),l=NB(()=>i.value.scheduleKeep,e=>i.value.scheduleKeep=e,7),u=W(()=>{let e=n.state?.lastAutomaticAt??null;return e===null?null:$R(e)}),d=W(()=>n.state?.scheduleError??null),f=k(!1),p=k(null),m=k(null),h=k(!1),g=k(!1),_=k(null),v=W(()=>o.selection.value?.files??[]),y=W(()=>o.selection.value?.entries??[]),b=Q(`inline-flex h-6 shrink-0 items-center gap-1 rounded-control border border-line bg-raise px-2 text-2xs font-medium text-ink`,`transition-colors duration-150 hover:bg-hover`,tV);function x(e){_.value=e===void 0?null:{kind:`stored`,name:e},g.value=!0}function S(e){m.value=null,p.value=e,o.invalidate(),a.refresh()}function C(){o.load(),h.value=!0}function w(e){m.value=null,p.value=e,a.refresh()}async function T(e){f.value=!0,m.value=null,p.value=null;try{await QM(e),p.value=Y(`settings.backups.deleted`,{name:e}),await o.load(),await a.refresh()}catch(e){m.value=IM(e)}finally{f.value=!1}}return(e,t)=>(L(),R(`div`,PG,[V(QB,{title:A(Y)(`settings.backups.policyTitle`),description:A(Y)(`settings.backups.policyDescription`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(CV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.backups.allow`),hint:A(Y)(`settings.backups.allowHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),i.value.enabled?U(``,!0):(L(),R(`div`,FG,[V(fW,{tone:`warn`,title:A(Y)(`settings.backups.offTitle`)},{default:j(()=>[H(O(A(Y)(`settings.backups.offText`)),1)]),_:1},8,[`title`])])),V(lV,{modelValue:A(s),"onUpdate:modelValue":t[2]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.backups.keep`),min:1,hint:A(Y)(`settings.backups.keepHint`)},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:i.value.scheduleEnabled,"onUpdate:modelValue":t[3]||=e=>i.value.scheduleEnabled=e,label:A(Y)(`settings.backups.schedule`),hint:A(Y)(`settings.backups.scheduleHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),i.value.scheduleEnabled?(L(),R(I,{key:1},[V(lV,{modelValue:A(c),"onUpdate:modelValue":t[4]||=e=>hn(c)?c.value=e:null,label:A(Y)(`settings.backups.scheduleHours`),min:1,hint:A(Y)(`settings.backups.scheduleHoursHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(l),"onUpdate:modelValue":t[5]||=e=>hn(l)?l.value=e:null,label:A(Y)(`settings.backups.scheduleKeep`),min:1,hint:A(Y)(`settings.backups.scheduleKeepHint`)},null,8,[`modelValue`,`label`,`hint`]),u.value===null?U(``,!0):(L(),R(`p`,IG,O(A(Y)(`settings.backups.scheduleLast`,{when:u.value})),1)),d.value===null?U(``,!0):(L(),R(`p`,LG,O(A(Y)(`settings.backups.scheduleFailed`,{when:A($R)(d.value.at),message:d.value.message})),1)),V(EG,{scope:i.value.scheduleScope,"onUpdate:scope":t[6]||=e=>i.value.scheduleScope=e,selection:A(o).selection.value},null,8,[`scope`,`selection`])],64)):U(``,!0),V(bV,{modelValue:i.value.includePaths,"onUpdate:modelValue":t[7]||=e=>i.value.includePaths=e,label:A(Y)(`settings.backups.extraPaths`),hint:A(Y)(`settings.backups.extraPathsHint`),placeholder:A(Y)(`settings.backups.extraPathsPlaceholder`)},null,8,[`modelValue`,`label`,`hint`,`placeholder`]),n.policy===null?U(``,!0):(L(),R(`div`,RG,[B(`span`,zG,O(A(Y)(`settings.backups.archiveDirectory`)),1),B(`div`,BG,[B(`span`,VG,O(n.policy.dir),1),V(AG,{value:n.policy.dir,label:A(Y)(`settings.backups.copyArchiveDirectory`)},null,8,[`value`,`label`])]),B(`p`,HG,[V(HV,{k:`settings.backups.changeDirectory`},{path:j(()=>[B(`code`,null,O(n.configPath??A(Y)(`settings.backups.theSettingsFile`)),1)]),_:1})])]))]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`settings.backups.capturesTitle`),description:A(Y)(`settings.backups.capturesDescription`)},{default:j(()=>[n.state===null?(L(),R(`div`,UG,[V(CU,{class:`h-4 w-full`}),V(CU,{class:`h-4 w-2/3`})])):y.value.length===0?(L(),R(`p`,WG,O(A(Y)(`settings.backups.nothingSelectable`)),1)):(L(),R(`ul`,GG,[(L(!0),R(I,null,P(y.value,e=>(L(),R(`li`,{key:e.id,class:`py-2 first:pt-0`},[B(`div`,KG,[B(`p`,qG,O(A(_W)(e)),1),V(MG,{tone:`neutral`,plain:``},{default:j(()=>[H(O(A(bW)(e.kind)),1)]),_:2},1024),e.workspaceId?(L(),R(`span`,JG,O(e.workspaceId),1)):U(``,!0)]),A(vW)(e)?(L(),R(`p`,YG,O(A(vW)(e)),1)):U(``,!0),e.items.length>0?(L(),R(`ul`,XG,[(L(!0),R(I,null,P(e.items,e=>(L(),R(`li`,{key:e.id,class:`flex items-start justify-between gap-3 rounded-control bg-panel-2/40 px-2 py-1`},[B(`div`,ZG,[B(`p`,QG,O(e.path??A(_W)(e)),1),B(`p`,$G,[H(O(e.included?e.origin?A(Y)(`settings.backups.fromOrigin`,{origin:e.origin}):A(vW)(e)??A(Y)(`settings.backups.included`):A(vW)(e)??A(Y)(`settings.backups.notCaptured`))+` `,1),e.included&&e.ignoreGenerated?(L(),R(I,{key:0},[H(` · `+O(A(Y)(`settings.backups.generatedSkipped`)),1)],64)):U(``,!0)])]),V(MG,{tone:e.included?`ok`:`neutral`,plain:``},{default:j(()=>[H(O(e.included?A(Y)(`settings.backups.included`):A(Y)(`settings.backups.skipped`)),1)]),_:2},1032,[`tone`])]))),128))])):U(``,!0)]))),128))])),n.workspaces.length>1?(L(),R(`p`,eK,O(A(Y)(`settings.backups.workspacesNote`,{count:n.workspaces.length})),1)):U(``,!0)]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`settings.backups.archivesTitle`),description:A(Y)(`settings.backups.archivesDescription`)},{actions:j(()=>[i.value.enabled?(L(),z($,{key:0,size:`xs`,variant:`primary`,disabled:n.state===null,onClick:t[8]||=e=>C()},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1},8,[`disabled`])):U(``,!0),V($,{size:`xs`,variant:`secondary`,disabled:n.state===null,onClick:t[9]||=e=>x()},{default:j(()=>[H(O(A(Y)(`settings.backups.restore`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.state===null?(L(),R(`div`,tK,[V(CU,{class:`h-4 w-full`}),V(CU,{class:`h-4 w-2/3`})])):v.value.length===0?(L(),R(`div`,nK,[V(AR,{compact:``,title:A(Y)(`settings.backups.noArchives`),description:i.value.enabled?A(Y)(`settings.backups.noArchivesEnabled`):A(Y)(`settings.backups.noArchivesDisabled`)},xa({icon:j(()=>[V(A(Yv),{class:`size-4`})]),_:2},[i.value.enabled?{name:`action`,fn:j(()=>[V($,{size:`sm`,variant:`primary`,onClick:t[10]||=e=>C()},{default:j(()=>[H(O(A(Y)(`settings.backups.create`)),1)]),_:1})]),key:`0`}:void 0]),1032,[`title`,`description`])])):(L(),R(`ul`,rK,[(L(!0),R(I,null,P(v.value,e=>(L(),R(`li`,{key:e.name,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0 last:pb-0`},[B(`div`,iK,[B(`div`,aK,[B(`span`,oK,O(e.name),1),e.encrypted?(L(),z(MG,{key:0,tone:`warn`,plain:``},{default:j(()=>[H(O(A(Y)(`settings.backups.encrypted`)),1)]),_:1})):U(``,!0)]),B(`p`,sK,O(A(ez)(e.sizeBytes))+` · `+O(A($R)(e.createdAt)),1)]),B(`div`,cK,[B(`a`,{href:KM(e.name),class:D(A(b))},[V(A(fy),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.download`)),1)],10,lK),V($,{size:`xs`,variant:`secondary`,onClick:t=>x(e.name)},{default:j(()=>[V(A(Ry),{class:`size-3`,"aria-hidden":`true`}),H(` `+O(A(Y)(`settings.backups.restoreAction`)),1)]),_:1},8,[`onClick`]),V(lW,{label:A(Y)(`common.delete`),"confirm-label":A(Y)(`settings.backups.confirmDelete`),size:`xs`,variant:`ghost`,"confirm-variant":`danger`,disabled:f.value,onConfirm:t=>T(e.name)},null,8,[`label`,`confirm-label`,`disabled`,`onConfirm`])])]))),128))])),m.value||p.value?(L(),R(`div`,uK,[m.value?(L(),z(fW,{key:0,tone:`danger`},{default:j(()=>[H(O(m.value),1)]),_:1})):U(``,!0),p.value?(L(),z(fW,{key:1,tone:`ok`},{default:j(()=>[H(O(p.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`]),V(QW,{open:h.value,"onUpdate:open":t[11]||=e=>h.value=e,selection:A(o).selection.value,onCreated:S},null,8,[`open`,`selection`]),V(dG,{open:g.value,"onUpdate:open":t[12]||=e=>g.value=e,files:v.value,initial:_.value,onApplied:w},null,8,[`open`,`files`,`initial`])]))}}),fK={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},pK={key:3,class:`text-2xs font-medium text-ok`},mK={key:0,class:`text-2xs text-danger sm:col-span-2`,role:`status`},hK={key:1,class:`text-2xs text-warn sm:col-span-2`},gK={key:1,class:`mt-3 flex flex-wrap items-center gap-1.5`},_K={class:`text-xs text-muted`},vK={key:2,class:`mt-3 text-xs text-muted`},yK=N({__name:`HostSection`,props:Va({config:{},alerts:{},dirty:{type:Boolean}},{host:{required:!0},hostModifiers:{}}),emits:Va([`reset`],[`update:host`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`host`),a=MB(()=>i.value.intervalMs,e=>i.value.intervalMs=e,15e3),o=NB(()=>i.value.diskUsedPercent,e=>i.value.diskUsedPercent=e,90),s=NB(()=>i.value.memoryUsedPercent,e=>i.value.memoryUsedPercent=e,90),c=NB(()=>i.value.swapUsedPercent,e=>i.value.swapUsedPercent=e,50),l=NB(()=>i.value.loadPerCpu,e=>i.value.loadPerCpu=e,2),u=NB(()=>i.value.tempCelsius,e=>i.value.tempCelsius=e,85),d=NB(()=>i.value.tempCommandTimeoutMs,e=>i.value.tempCommandTimeoutMs=e,5e3),f=k(null),p=k(!1),m=k(null),h=W(()=>f.value?.supported===!0);ia(async()=>{try{let e=await $M();f.value=e}catch{f.value=null}});async function g(){p.value=!0,m.value=null;try{let e=await eN();f.value=e,e.configured&&e.tempCommand!==null&&e.tempCommand!==void 0&&(i.value.tempCommand=e.tempCommand)}catch(e){m.value=IM(e)}finally{p.value=!1}}async function _(){p.value=!0,m.value=null;try{let e=await eN({download:!0});f.value=e,e.configured&&e.tempCommand!==null&&e.tempCommand!==void 0&&(i.value.tempCommand=e.tempCommand)}catch(e){m.value=IM(e)}finally{p.value=!1}}async function v(){p.value=!0,m.value=null;try{f.value=await tN(),i.value.tempCommand=``}catch(e){m.value=IM(e)}finally{p.value=!1}}return(e,t)=>(L(),R(I,null,[V(QB,{title:A(Y)(`settings.host.title`),description:A(Y)(`settings.host.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(CV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`settings.host.enabled`),hint:A(Y)(`settings.host.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(a),"onUpdate:modelValue":t[2]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.host.interval`),min:5,hint:A(Y)(`settings.host.intervalHint`)},null,8,[`modelValue`,`label`,`hint`]),V(bV,{modelValue:i.value.diskPaths,"onUpdate:modelValue":t[3]||=e=>i.value.diskPaths=e,label:A(Y)(`settings.host.diskPaths`),hint:A(Y)(`settings.host.diskPathsHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(o),"onUpdate:modelValue":t[4]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.host.diskUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(s),"onUpdate:modelValue":t[5]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.host.memoryUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(c),"onUpdate:modelValue":t[6]||=e=>hn(c)?c.value=e:null,label:A(Y)(`settings.host.swapUsed`),min:0,max:100,hint:A(Y)(`settings.host.zeroDisables`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(l),"onUpdate:modelValue":t[7]||=e=>hn(l)?l.value=e:null,label:A(Y)(`settings.host.loadPerCpu`),min:0,hint:A(Y)(`settings.host.loadPerCpuHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(u),"onUpdate:modelValue":t[8]||=e=>hn(u)?u.value=e:null,label:A(Y)(`settings.host.tempCelsius`),min:0,hint:A(Y)(`settings.host.tempCelsiusHint`)},null,8,[`modelValue`,`label`,`hint`]),V(bV,{modelValue:i.value.tempCommand,"onUpdate:modelValue":t[9]||=e=>i.value.tempCommand=e,label:A(Y)(`settings.host.tempCommand`),hint:A(Y)(`settings.host.tempCommandHint`),placeholder:A(Y)(`settings.host.tempCommandPlaceholder`),wide:``},null,8,[`modelValue`,`label`,`hint`,`placeholder`]),i.value.tempCommand.trim().length>0?(L(),z(lV,{key:0,modelValue:A(d),"onUpdate:modelValue":t[10]||=e=>hn(d)?d.value=e:null,label:A(Y)(`settings.host.tempCommandTimeout`),min:100,max:3e4,hint:A(Y)(`settings.host.tempCommandTimeoutHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0)]),_:1},8,[`title`,`description`]),h.value?(L(),z(QB,{key:0,title:A(Y)(`settings.host.wslTitle`),description:A(Y)(`settings.host.wslDescription`)},{default:j(()=>[B(`div`,fK,[!f.value?.configured&&f.value?.needsDownload?(L(),z(lW,{key:0,label:A(Y)(`settings.host.wslDownloadNow`),"confirm-label":A(Y)(`settings.host.wslDownloadConfirm`),title:A(Y)(`settings.host.wslDownloadTitle`),hint:A(Y)(`settings.host.wslDownloadHint`),variant:`primary`,"confirm-variant":`primary`,size:`xs`,loading:p.value,onConfirm:t[11]||=e=>_()},null,8,[`label`,`confirm-label`,`title`,`hint`,`loading`])):f.value?.configured?(L(),z($,{key:2,size:`xs`,variant:`secondary`,loading:p.value,onClick:t[13]||=e=>v()},{default:j(()=>[H(O(A(Y)(`settings.host.wslRemove`)),1)]),_:1},8,[`loading`])):(L(),z($,{key:1,size:`xs`,variant:`primary`,loading:p.value,onClick:t[12]||=e=>g()},{default:j(()=>[H(O(A(Y)(`settings.host.wslSetup`)),1)]),_:1},8,[`loading`])),f.value?.lastReadingCelsius!==null&&f.value?.lastReadingCelsius!==void 0?(L(),R(`span`,pK,O(A(Y)(`settings.host.wslReading`,{celsius:f.value.lastReadingCelsius})),1)):U(``,!0)]),f.value?.lastError?(L(),R(`p`,mK,O(A(Y)(`settings.host.wslFailed`,{reason:f.value.lastError})),1)):f.value?.configured&&!f.value?.libraryPresent?(L(),R(`p`,hK,O(A(Y)(`settings.host.wslNeedsLibrary`)),1)):U(``,!0),m.value?(L(),z(fW,{key:2,tone:`danger`},{default:j(()=>[H(O(m.value),1)]),_:1})):U(``,!0)]),_:1},8,[`title`,`description`])):U(``,!0),n.alerts.length>0?(L(),R(`div`,gK,[B(`span`,_K,O(A(Y)(`settings.host.breachingNow`)),1),(L(!0),R(I,null,P(n.alerts,e=>(L(),z(MG,{key:e,tone:`danger`,dot:``},{default:j(()=>[H(O(e),1)]),_:2},1024))),128))])):i.value.enabled?(L(),R(`p`,vK,O(A(Y)(`settings.host.nothingBreaching`)),1)):U(``,!0)],64))}}),bK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},xK={class:`text-xs font-medium text-muted`},SK={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},CK={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},wK={class:`text-2xs leading-4 text-faint`},TK={key:0},EK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},DK={class:`text-xs font-medium text-muted`},OK={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},kK={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},AK={class:`text-2xs leading-4 text-faint`},jK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},MK={class:`text-xs font-medium text-muted`},NK=[`disabled`],PK={class:`text-2xs leading-4 text-faint sm:col-span-2`},FK=N({__name:`InterfaceSection`,props:Va({ui:{},panelVersion:{},labelDirty:{type:Boolean}},{label:{required:!0},labelModifiers:{}}),emits:Va([`changed`,`resetLabel`],[`update:label`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`label`),a=k(null),o=k(!1),s=k(null),c=k(null),l=W(()=>{let e=n.ui;if(e===null)return Y(`common.unknown`);if(!e.custom)return Y(`settings.interface.sourceStock`);let t=e.meta;return t===null?Y(`settings.interface.sourceCustom`):`${Y(`settings.interface.sourceCustom`)} · ${t.name??Y(`settings.interface.unnamed`)}${t.version==null?``:` ${t.version}`}`}),u=W(()=>{let e=n.ui?.meta;if(e==null)return null;let t=e.uploadedAt===void 0?null:$R(e.uploadedAt);return`${Y(`settings.interface.fileCount`,{count:e.files??0})}${t===null?``:` · ${t}`}`});function d(e){a.value=e.target.files?.[0]??null,s.value=null,c.value=null}async function f(){if(a.value!==null){o.value=!0,c.value=null,s.value=null;try{let e=await yN(a.value);s.value=Y(`settings.interface.installed`,{name:e.meta?.name??Y(`settings.interface.yourBuild`)}),a.value=null,r(`changed`)}catch(e){c.value=IM(e)}finally{o.value=!1}}}async function p(){o.value=!0,c.value=null;try{let e=await mN();s.value=e.removed?Y(`settings.interface.restored`):Y(`settings.interface.nothingInstalled`),r(`changed`)}catch(e){c.value=IM(e)}finally{o.value=!1}}return(t,m)=>(L(),z(QB,{title:A(Y)(`settings.interface.title`),description:A(Y)(`settings.interface.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.labelDirty,onClick:m[1]||=e=>r(`resetLabel`)},{default:j(()=>[H(O(A(Y)(`settings.interface.resetName`)),1)]),_:1},8,[`disabled`]),e.ui?.custom?(L(),z(lW,{key:0,label:A(Y)(`settings.interface.revertToStock`),"confirm-label":A(Y)(`settings.interface.confirmRevert`),title:A(Y)(`settings.interface.revertTitle`),hint:A(Y)(`settings.interface.revertHint`),size:`xs`,variant:`ghost`,"confirm-variant":`danger`,disabled:o.value,onConfirm:p},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0),V($,{size:`xs`,variant:`primary`,disabled:o.value||a.value===null,onClick:f},{default:j(()=>[H(O(A(Y)(`settings.interface.install`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[B(`div`,bK,[B(`span`,xK,O(A(Y)(`settings.interface.currentlyServing`)),1),B(`div`,SK,[B(`span`,CK,O(l.value),1),V(AG,{value:e.ui?.dir??``,label:A(Y)(`settings.interface.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,wK,[u.value?(L(),R(`span`,TK,O(u.value)+` · `,1)):U(``,!0),B(`code`,null,O(e.ui?.dir??`—`),1)])]),B(`div`,EK,[B(`span`,DK,O(A(Y)(`settings.interface.panelVersion`)),1),B(`div`,OK,[B(`span`,kK,O(A(Y)(`app.name`))+` `+O(n.panelVersion??A(Y)(`common.unknown`)),1),n.panelVersion?(L(),z(AG,{key:0,value:n.panelVersion,label:A(Y)(`settings.interface.copyPanelVersion`)},null,8,[`value`,`label`])):U(``,!0)]),B(`p`,AK,[V(HV,{k:`settings.interface.panelVersionHint`},{command:j(()=>[...m[2]||=[B(`code`,null,`home-hosted status`,-1)]]),_:1})])]),V(bV,{modelValue:i.value,"onUpdate:modelValue":m[0]||=e=>i.value=e,label:A(Y)(`settings.interface.panelName`),hint:A(Y)(`settings.interface.panelNameHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),B(`label`,jK,[B(`span`,MK,O(A(Y)(`settings.interface.uploadLabel`)),1),B(`input`,{type:`file`,accept:`.zip,application/zip`,class:`rounded-control border border-line bg-page/60 px-2.5 py-1.5 text-xs text-ink file:mr-2 file:rounded file:border-0 file:bg-line file:px-2 file:py-1 file:text-xs`,disabled:o.value,onChange:d},null,40,NK)]),c.value?(L(),z(fW,{key:0,tone:`warn`,title:c.value},null,8,[`title`])):s.value?(L(),z(fW,{key:1,tone:`ok`,title:s.value},null,8,[`title`])):U(``,!0),B(`p`,PK,[V(HV,{k:`settings.interface.docsHint`},{docs:j(()=>[...m[3]||=[B(`code`,null,`docs/UI_CREATION.md`,-1)]]),command:j(()=>[...m[4]||=[B(`code`,null,`home-hosted ui-revert`,-1)]]),_:1})])]),_:1},8,[`title`,`description`]))}}),IK={class:`flex min-w-0 flex-col gap-1`},LK={class:`text-xs font-medium text-muted`},RK={class:`text-2xs leading-4 text-faint`},zK={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},BK={class:`text-xs font-medium text-muted`},VK={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},HK={class:`min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-ink`},UK={class:`text-2xs leading-4 text-faint`},WK=N({__name:`ListenerSection`,props:Va({view:{},dirty:{type:Boolean}},{control:{required:!0},controlModifiers:{}}),emits:Va([`reset`],[`update:control`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`control`),a=NB(()=>i.value.port,e=>i.value.port=e,3999),o=[`local`,`lan`],s=W({get:()=>o.includes(i.value.host)?i.value.host:`custom`,set:e=>{if(e!==`custom`){i.value.host=e;return}if(!o.includes(i.value.host))return;let t=n.view?.bindHost??``,r=t!==``&&t!==`0.0.0.0`&&t!==`127.0.0.1`&&IA(t)!==null;i.value.host=r?t:`127.0.0.1`}}),c=W(()=>{if(s.value===`custom`&&IA(i.value.host)===null)return Y(`settings.listener.ipv4Error`)}),l=W(()=>n.view?.url??`—`),u=W(()=>s.value===`lan`?Y(`settings.listener.bindLanHint`):s.value===`local`?Y(`settings.listener.bindLocalHint`):Y(`settings.listener.bindCustomHint`));return(e,t)=>(L(),z(QB,{title:A(Y)(`settings.listener.title`),description:A(Y)(`settings.listener.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(lV,{modelValue:A(a),"onUpdate:modelValue":t[1]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.listener.port`),min:1,max:65535,hint:A(Y)(`settings.listener.portHint`)},null,8,[`modelValue`,`label`,`hint`]),B(`div`,IK,[B(`span`,LK,O(A(Y)(`settings.listener.bind`)),1),V(mG,{modelValue:s.value,"onUpdate:modelValue":t[2]||=e=>s.value=e,options:[{value:`local`,label:A(Y)(`settings.listener.bindLocal`)},{value:`lan`,label:A(Y)(`settings.listener.bindLan`)},{value:`custom`,label:A(Y)(`settings.listener.bindCustom`)}]},null,8,[`modelValue`,`options`]),B(`p`,RK,O(u.value),1)]),s.value===`custom`?(L(),z(bV,{key:0,modelValue:i.value.host,"onUpdate:modelValue":t[3]||=e=>i.value.host=e,label:A(Y)(`settings.listener.ipv4`),placeholder:A(Y)(`settings.listener.ipv4Placeholder`),error:c.value,hint:A(Y)(`settings.listener.ipv4Hint`)},null,8,[`modelValue`,`label`,`placeholder`,`error`,`hint`])):U(``,!0),V(CV,{modelValue:i.value.openBrowser,"onUpdate:modelValue":t[4]||=e=>i.value.openBrowser=e,label:A(Y)(`settings.listener.openBrowser`),wide:``},null,8,[`modelValue`,`label`]),B(`div`,zK,[B(`span`,BK,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,VK,[B(`span`,HK,O(l.value),1),n.view?.restartRequired?(L(),z(MG,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.listener.restartRequired`)),1)]),_:1})):U(``,!0),V(AG,{value:l.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])]),B(`p`,UK,O(A(Y)(`settings.listener.liveAddressHint`)),1)])]),_:1},8,[`title`,`description`]))}}),GK={class:`space-y-3`},KK={class:`divide-y divide-line-soft sm:col-span-2`},qK={class:`min-w-0`},JK={class:`text-xs font-medium text-ink`},YK={class:`mt-0.5 text-2xs leading-4 text-faint`},XK={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},ZK={class:`min-w-0 truncate font-mono text-xs text-ink`},QK={class:`flex items-center gap-2 text-xs font-medium text-ink`},$K={class:`font-mono text-2xs font-normal text-faint`},eq={class:`divide-y divide-line-soft`},tq={class:`min-w-0`},nq={class:`text-2xs font-medium text-ink`},rq={class:`mt-0.5 text-2xs leading-4 text-faint`},iq={class:`flex min-w-0 flex-1 items-center justify-end gap-1.5`},aq={class:`min-w-0 truncate font-mono text-2xs text-ink`},oq=N({__name:`PathsSection`,props:{dataRoot:{},projectDir:{},panelUrl:{},workspaces:{}},setup(e){let t=e,n=W(()=>t.dataRoot===null?null:`${t.dataRoot}/settings.json`),r=W(()=>[{key:`data`,label:Y(`settings.paths.dataRoot`),hint:Y(`settings.paths.dataRootHint`),copyLabel:Y(`settings.paths.dataRoot`),value:t.dataRoot??`—`},{key:`settings`,label:Y(`settings.paths.globalSettings`),hint:Y(`settings.paths.globalSettingsHint`),copyLabel:Y(`settings.paths.globalSettings`),value:n.value??`—`},{key:`project`,label:Y(`settings.paths.projectDir`),hint:Y(`settings.paths.projectDirHint`),copyLabel:Y(`settings.paths.projectDir`),value:t.projectDir??`—`},{key:`panel`,label:Y(`settings.paths.panelAddress`),hint:Y(`settings.paths.panelAddressHint`),copyLabel:Y(`settings.paths.panelAddress`),value:t.panelUrl??`—`}]);function i(e){return[{key:`${e.id}:config`,label:Y(`settings.paths.serversConfig`),hint:Y(`settings.paths.serversConfigHint`,{label:e.label}),copyLabel:Y(`settings.paths.serversConfig`),value:e.configPath},{key:`${e.id}:settings`,label:Y(`settings.paths.workspaceSettings`),hint:Y(`settings.paths.workspaceSettingsHint`),copyLabel:Y(`settings.paths.workspaceSettings`),value:e.settingsPath},{key:`${e.id}:logs`,label:Y(`settings.paths.logs`),hint:Y(`settings.paths.logsHint`),copyLabel:Y(`settings.paths.logs`),value:e.logsDir}]}return(t,n)=>(L(),R(`div`,GK,[V(QB,{title:A(Y)(`settings.paths.whereThingsLive`),description:A(Y)(`settings.paths.whereThingsLiveDescription`)},{default:j(()=>[B(`ul`,KK,[(L(!0),R(I,null,P(r.value,e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-2 first:pt-0 last:pb-0`},[B(`div`,qK,[B(`p`,JK,O(e.label),1),B(`p`,YK,O(e.hint),1)]),B(`div`,XK,[B(`span`,ZK,O(e.value),1),V(AG,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`settings.paths.workspaceFiles`),description:A(Y)(`settings.paths.workspaceFilesDescription`)},{default:j(()=>[(L(!0),R(I,null,P(e.workspaces,e=>(L(),R(`div`,{key:e.id,class:`space-y-2 sm:col-span-2`},[B(`p`,QK,[H(O(e.label)+` `,1),B(`span`,$K,O(e.id),1)]),B(`ul`,eq,[(L(!0),R(I,null,P(i(e),e=>(L(),R(`li`,{key:e.key,class:`flex items-start justify-between gap-3 py-1.5`},[B(`div`,tq,[B(`p`,nq,O(e.label),1),B(`p`,rq,O(e.hint),1)]),B(`div`,iq,[B(`span`,aq,O(e.value),1),V(AG,{value:e.value,label:A(Y)(`settings.paths.copyPath`,{label:e.copyLabel.toLowerCase()})},null,8,[`value`,`label`])])]))),128))])]))),128))]),_:1},8,[`title`,`description`])]))}}),sq=[`id`],cq={class:`mb-3`},lq={class:`text-lg font-semibold text-ink`},uq={class:`mt-0.5 text-xs text-muted`},dq={class:`space-y-3`},fq=N({__name:`SettingsSection`,props:{id:{},title:{},description:{}},setup(e){return(t,n)=>(L(),R(`section`,{id:e.id,class:`scroll-mt-5`},[B(`header`,cq,[B(`h2`,lq,O(e.title),1),B(`p`,uq,O(e.description),1)]),B(`div`,dq,[F(t.$slots,`default`)])],8,sq))}}),pq={class:`min-h-full`},mq={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},hq={class:`lg:grid lg:grid-cols-[11rem_minmax(0,1fr)] lg:gap-8`},gq=[`aria-label`],_q={class:`sticky top-6 space-y-0.5 border-l border-line`},vq=[`aria-current`,`onClick`],yq={class:`space-y-6`},bq={class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},xq={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},Sq={class:`min-w-0 flex-1`},Cq={class:`text-xs text-muted`},wq={class:`font-mono tabular-nums text-ink`},Tq={key:0,class:`mt-0.5 text-xs text-danger`},Eq={key:1,class:`mt-0.5 text-xs text-ok`},Dq={class:`flex shrink-0 items-center gap-2`},Oq={class:`max-h-[60dvh] overflow-auto px-4 py-3`},kq={key:0,class:`divide-y divide-line-soft`},Aq={class:`font-mono text-xs text-ink`},jq={class:`ml-auto font-mono text-xs text-muted line-through`},Mq={class:`font-mono text-xs text-accent`},Nq={key:1,class:`text-xs text-muted`},Pq={class:`flex items-center justify-end gap-2 border-t border-line px-4 py-3`},Fq=N({__name:`SettingsShell`,props:{sections:{},navLabel:{},changesDescription:{},changedCount:{},changes:{},saveError:{},saveMessage:{},saving:{type:Boolean}},emits:[`save`,`discard`],setup(e,{emit:t}){let n=e,r=t,i=$g(),a=Qg(),o=k(n.sections[0]?.id??``),s=k(!1);function c(e){ir(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function l(e){o.value=e,i.query.section!==e&&a.replace({query:{...i.query,section:e}}),c(e)}M(()=>i.query.section,e=>{let t=typeof e==`string`?e:``;n.sections.some(e=>e.id===t)&&(o.value=t,c(t))},{immediate:!0});let u=null;ia(()=>{u=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0];t!==void 0&&t.target.id.length>0&&(o.value=t.target.id)},{rootMargin:`-72px 0px -62% 0px`,threshold:0});for(let e of n.sections){let t=document.getElementById(e.id);t&&u.observe(t)}}),sa(()=>u?.disconnect());function d(){r(`save`),s.value=!1}return(e,t)=>(L(),R(I,null,[B(`div`,pq,[B(`div`,mq,[F(e.$slots,`header`),B(`div`,hq,[B(`nav`,{"aria-label":n.navLabel,class:`hidden lg:block`},[B(`ul`,_q,[(L(!0),R(I,null,P(n.sections,e=>(L(),R(`li`,{key:e.id},[B(`button`,{type:`button`,"aria-current":o.value===e.id?`true`:void 0,class:D(A(Q)(`-ml-px block w-full border-l-2 py-1.5 pl-3 text-left text-xs transition-colors duration-150`,o.value===e.id?`border-accent font-medium text-accent`:`border-transparent text-muted hover:border-line hover:text-ink`)),onClick:t=>l(e.id)},O(e.title),11,vq)]))),128))])],8,gq),B(`div`,yq,[F(e.$slots,`default`)])])]),B(`div`,bq,[B(`div`,xq,[B(`div`,Sq,[B(`p`,Cq,[n.changedCount>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-xs text-muted underline decoration-line underline-offset-2 hover:text-ink`,onClick:t[0]||=e=>s.value=!0},[B(`span`,wq,O(n.changedCount),1),H(` `+O(A(PF)(`settings.shell.fieldsChanged`,n.changedCount)),1)])):(L(),R(I,{key:1},[H(O(A(Y)(`settings.shell.noUnsavedChanges`)),1)],64))]),n.saveError?(L(),R(`p`,Tq,O(n.saveError),1)):n.saveMessage?(L(),R(`p`,Eq,O(n.saveMessage),1)):U(``,!0)]),B(`div`,Dq,[V($,{variant:`ghost`,disabled:n.changedCount===0||n.saving,onClick:t[1]||=e=>r(`discard`)},{default:j(()=>[H(O(A(Y)(`settings.shell.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:n.changedCount===0,loading:n.saving,onClick:t[2]||=e=>r(`save`)},{default:j(()=>[H(O(A(Y)(`settings.shell.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])]),V(LV,{open:s.value,"onUpdate:open":t[4]||=e=>s.value=e,title:A(Y)(`settings.shell.unsavedTitle`),description:n.changesDescription,width:`w-[min(92vw,42rem)]`},{default:j(()=>[B(`div`,Oq,[n.changes.length>0?(L(),R(`ul`,kq,[(L(!0),R(I,null,P(n.changes,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,Aq,O(e.path),1),B(`span`,jq,O(A(rz)(e.from)),1),t[5]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,Mq,O(A(rz)(e.to)),1)]))),128))])):(L(),R(`p`,Nq,O(A(Y)(`settings.shell.nothingToSave`)),1))]),B(`footer`,Pq,[V($,{size:`sm`,variant:`ghost`,onClick:t[3]||=e=>s.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:n.changes.length===0||n.saving,loading:n.saving,onClick:d},{default:j(()=>[H(O(A(PF)(`settings.shell.saveChanges`,n.changes.length)),1)]),_:1},8,[`disabled`,`loading`])])]),_:1},8,[`open`,`title`,`description`])],64))}}),Iq={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},Lq={class:`text-xs font-medium text-muted`},Rq={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},zq={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},Bq={key:0,class:`sm:col-span-2`},Vq={key:1,class:`space-y-3 sm:col-span-2`},Hq={class:`divide-y divide-line-soft text-xs`},Uq={class:`flex items-start justify-between gap-4 py-1.5`},Wq={class:`text-muted`},Gq={class:`min-w-0 text-right font-mono text-xs text-ink`},Kq={class:`flex items-start justify-between gap-4 py-1.5`},qq={class:`text-muted`},Jq={class:`min-w-0 text-right font-mono text-xs text-ink`},Yq={class:`flex items-start justify-between gap-4 py-1.5`},Xq={class:`text-muted`},Zq={class:`font-mono text-xs tabular-nums text-ink`},Qq={class:`flex items-center justify-between gap-4 py-1.5`},$q={class:`text-muted`},eJ={class:`flex items-start justify-between gap-4 py-1.5`},tJ={class:`text-muted`},nJ={class:`flex min-w-0 items-center gap-1.5`},rJ={class:`min-w-0 truncate font-mono text-2xs text-ink`},iJ={key:2,class:`sm:col-span-2`},aJ={class:`flex min-w-0 flex-col gap-1`},oJ={class:`flex min-w-0 flex-col gap-1`},sJ={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},cJ={key:3,class:`space-y-2 sm:col-span-2`},lJ=N({__name:`TlsSection`,props:Va({view:{},dirty:{type:Boolean}},{tlsEnabled:{type:Boolean,required:!0},tlsEnabledModifiers:{}}),emits:Va([`reset`],[`update:tlsEnabled`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`tlsEnabled`),a=gI(),o=k(``),s=k(``),c=k(null),l=k(null),u=k(!1),d=W(()=>n.view?.tls??null),f=W(()=>n.view?`${n.view.protocol}://${n.view.bindHost}:${n.view.port}`:`—`),p=W(()=>o.value.trim().length>0&&s.value.trim().length>0&&!u.value),m=Q(iV,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`);async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?o.value=r:s.value=r}async function g(){u.value=!0,l.value=null,c.value=null;try{let e=await sP(o.value,s.value);o.value=``,s.value=``,c.value=Y(`settings.tls.stored`),await a.refresh();let t=await PB(e);t!==null&&(l.value=t)}catch(e){l.value=IM(e)}finally{u.value=!1}}async function _(){u.value=!0,l.value=null,c.value=null;try{let e=await cP();c.value=Y(`settings.tls.removed`),await a.refresh();let t=await PB(e);t!==null&&(l.value=t)}catch(e){l.value=IM(e)}finally{u.value=!1}}return(e,t)=>(L(),R(I,null,[V(QB,{title:A(Y)(`settings.tls.title`),description:A(Y)(`settings.tls.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(CV,{modelValue:i.value,"onUpdate:modelValue":t[1]||=e=>i.value=e,label:A(Y)(`settings.tls.serve`),hint:A(Y)(`settings.tls.serveHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),B(`div`,Iq,[B(`span`,Lq,O(A(Y)(`settings.listener.liveAddress`)),1),B(`div`,Rq,[B(`span`,zq,O(f.value),1),V(AG,{value:f.value,label:A(Y)(`settings.listener.copyLiveAddress`)},null,8,[`value`,`label`])])])]),_:1},8,[`title`,`description`]),V(QB,{class:`mt-3`,title:A(Y)(`settings.tls.certificateTitle`),description:A(Y)(`settings.tls.certificateDescription`)},{default:j(()=>[d.value?.error?(L(),R(`div`,Bq,[V(fW,{tone:`danger`,title:A(Y)(`settings.tls.unusableTitle`)},{default:j(()=>[H(O(d.value.error),1)]),_:1},8,[`title`])])):d.value?.certPresent?(L(),R(`div`,Vq,[B(`dl`,Hq,[B(`div`,Uq,[B(`dt`,Wq,O(A(Y)(`settings.tls.subject`)),1),B(`dd`,Gq,O(d.value.subject??`—`),1)]),B(`div`,Kq,[B(`dt`,qq,O(A(Y)(`settings.tls.issuer`)),1),B(`dd`,Jq,O(d.value.issuer??`—`),1)]),B(`div`,Yq,[B(`dt`,Xq,O(A(Y)(`settings.tls.validUntil`)),1),B(`dd`,Zq,[H(O(d.value.validTo?d.value.validTo.slice(0,10):`—`)+` `,1),d.value.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D(A(Q)(`ml-1.5`,d.value.daysRemaining<14?`text-warn`:`text-faint`))},` (`+O(A(Y)(`settings.tls.days`,{count:d.value.daysRemaining}))+`) `,3))])]),B(`div`,Qq,[B(`dt`,$q,O(A(Y)(`settings.tls.privateKey`)),1),B(`dd`,null,[V(MG,{tone:d.value.keyMatches?`ok`:`danger`,dot:``},{default:j(()=>[H(O(d.value.keyMatches?A(Y)(`settings.tls.keyMatches`):A(Y)(`settings.tls.keyMismatch`)),1)]),_:1},8,[`tone`])])]),B(`div`,eJ,[B(`dt`,tJ,O(A(Y)(`settings.tls.fingerprint`)),1),B(`dd`,nJ,[B(`span`,rJ,O(d.value.fingerprint??`—`),1),d.value.fingerprint?(L(),z(AG,{key:0,value:d.value.fingerprint,label:A(Y)(`settings.tls.copyFingerprint`)},null,8,[`value`,`label`])):U(``,!0)])])])])):(L(),R(`div`,iJ,[V(fW,{tone:`info`,title:A(Y)(`settings.tls.noCertificateTitle`)},{default:j(()=>[H(O(A(Y)(`settings.tls.noCertificateText`)),1)]),_:1},8,[`title`])])),B(`div`,aJ,[B(`label`,{class:D(A(nV)),for:`tls-cert-file`},O(A(Y)(`settings.tls.certFile`)),3),B(`input`,{id:`tls-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(m)),onChange:t[2]||=e=>h(e,`cert`)},null,34)]),B(`div`,oJ,[B(`label`,{class:D(A(nV)),for:`tls-key-file`},O(A(Y)(`settings.tls.keyFile`)),3),B(`input`,{id:`tls-key-file`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(m)),onChange:t[3]||=e=>h(e,`key`)},null,34)]),V(VV,{modelValue:o.value,"onUpdate:modelValue":t[4]||=e=>o.value=e,label:A(Y)(`settings.tls.pasteCertificate`),rows:4,placeholder:`-----BEGIN CERTIFICATE-----`},null,8,[`modelValue`,`label`]),V(VV,{modelValue:s.value,"onUpdate:modelValue":t[5]||=e=>s.value=e,label:A(Y)(`settings.tls.pasteKey`),rows:4,placeholder:`-----BEGIN PRIVATE KEY-----`},null,8,[`modelValue`,`label`]),B(`div`,sJ,[V($,{variant:`primary`,disabled:!p.value,loading:u.value,onClick:g},{default:j(()=>[H(O(A(Y)(`settings.tls.saveCertificate`)),1)]),_:1},8,[`disabled`,`loading`]),d.value?.certPresent?(L(),z(lW,{key:0,label:A(Y)(`settings.tls.removeCertificate`),"confirm-label":A(Y)(`settings.tls.confirmRemove`),"confirm-variant":`danger`,title:A(Y)(`settings.tls.removeTitle`),hint:A(Y)(`settings.tls.removeHint`),disabled:u.value,onConfirm:_},null,8,[`label`,`confirm-label`,`title`,`hint`,`disabled`])):U(``,!0)]),l.value||c.value?(L(),R(`div`,cJ,[l.value?(L(),z(fW,{key:0,tone:`danger`},{default:j(()=>[H(O(l.value),1)]),_:1})):U(``,!0),c.value?(L(),z(fW,{key:1,tone:`ok`},{default:j(()=>[H(O(c.value),1)]),_:1})):U(``,!0)])):U(``,!0)]),_:1},8,[`title`,`description`])],64))}}),uJ=N({__name:`LanguageSelect`,props:{labelled:{type:Boolean,default:!0},wide:{type:Boolean,default:!1}},setup(e){let t=e,n=k(!1),r=W(()=>cF.map(e=>({value:e.code,label:e.name}))),i=k(null),a=W({get:()=>i.value??FF(),set:e=>{e!==FF()&&(i.value=e,n.value=!0,MF(e).finally(()=>{i.value=null,n.value=!1}))}});return(e,i)=>(L(),z(hV,{modelValue:a.value,"onUpdate:modelValue":i[0]||=e=>a.value=e,label:t.labelled?A(Y)(`language.label`):void 0,options:r.value,wide:t.wide,disabled:n.value,"aria-label":t.labelled?void 0:A(Y)(`language.select`),"data-testid":`language-select`},null,8,[`modelValue`,`label`,`options`,`wide`,`disabled`,`aria-label`]))}}),dJ={class:`mb-5`},fJ={class:`text-xl font-semibold tracking-tight text-ink`},pJ={class:`mt-1 text-xs text-muted`},mJ={class:`text-2xs leading-4 text-faint sm:col-span-2`},hJ=N({__name:`GlobalSettingsView`,setup(e){let t=W(()=>[{id:`listener`,title:Y(`views.globalSettings.sectionListener`)},{id:`authentication`,title:Y(`views.globalSettings.sectionAuthentication`)},{id:`host`,title:Y(`views.globalSettings.sectionHost`)},{id:`backups`,title:Y(`views.globalSettings.sectionBackups`)},{id:`tls`,title:Y(`views.globalSettings.sectionTls`)},{id:`language`,title:Y(`language.label`)},{id:`interface`,title:Y(`views.globalSettings.sectionInterface`)},{id:`paths`,title:Y(`views.globalSettings.sectionPaths`)}]),n=gI(),r=EP(),i=tn(tB()),a=k(!1),o=k(null),s=k(null),c=k(null),l=k(null),u=W(()=>n.control.value),d=W(()=>n.host.value?.alerts??[]),f=W(()=>l.value?.host??null),p=W(()=>l.value?.backups??null),m=W(()=>n.backups.value),h=W(()=>l.value?.ui??null),g=W(()=>n.version.value),_=W(()=>n.dataRoot.value),v=W(()=>n.projectDir.value),y=W(()=>_.value===null?null:`${_.value}/settings.json`),b=W(()=>{let e={},t=u.value;if(t!==null){let n=pB(t,i);Object.keys(n).length>0&&(e.control=n)}let n=f.value;if(n!==null){let t=dB(n,i.host);Object.keys(t).length>0&&(e.host=t)}let r=p.value;if(r!==null){let t=fB(r,i.backups);Object.keys(t).length>0&&(e.backups=t)}return e}),x=W(()=>Hz(b.value)),S=W(()=>{let e=u.value,t=f.value,n=p.value;return{control:e===null?{}:{...oB(e),auth:aB(e.auth)},host:t??{},backups:n===null?{}:{enabled:n.enabled,keep:n.keep,includePaths:n.includePaths,schedule:n.schedule??{}}}}),C=W(()=>Vz(b.value,S.value)),w=W(()=>u.value!==null&&kB(u.value,i)),T=W(()=>u.value!==null&&AB(u.value,i)),ee=W(()=>u.value!==null&&jB(u.value,i)),te=W(()=>f.value!==null&&Object.keys(dB(f.value,i.host)).length>0),ne=W(()=>p.value!==null&&Object.keys(fB(p.value,i.backups)).length>0),re={};function ie(){let e=(e,t)=>{OB(re[e],SB(i,e))||(t(),re[e]=SB(i,e))},t=u.value;t!==null&&(wB(i,re.control,`listener`)||(Object.assign(i.control,oB(t)),TB(i,re,`listener`)),wB(i,re.control,`auth`)||(Object.assign(i.auth,aB(t.auth)),TB(i,re,`auth`)),wB(i,re.control,`tls`)||(i.control.tlsEnabled=t.tls.enabled,TB(i,re,`tls`)));let n=f.value;n!==null&&e(`host`,()=>Object.assign(i.host,cB(n)));let r=p.value;r!==null&&e(`backups`,()=>Object.assign(i.backups,uB(r)))}function ae(){for(let e of Object.keys(re))delete re[e]}function oe(e){re[e]=SB(i,e)}M([u,l],()=>{ie()},{immediate:!0});async function se(){c.value=null;try{l.value=await iN()}catch(e){c.value=IM(e)}}ia(()=>{se()});async function ce(){let e=b.value;if(!(Object.keys(e).length===0||a.value)){a.value=!0,o.value=null,s.value=null;try{let t=await n.saveGlobalSettings(e);if(!t){o.value=n.lastError.value??Y(`views.globalSettings.saveFailed`);return}s.value=Y(`views.globalSettings.saved`),r.success(Y(`views.globalSettings.savedToast`)),await se(),ae(),ie();let i=await PB(t);i===null?t.rebinding&&(s.value=Y(`views.globalSettings.savedRebinding`)):(s.value=null,o.value=i)}finally{a.value=!1}}}function le(){o.value=null,s.value=null,ae(),ie()}function E(){f.value!==null&&Object.assign(i.host,cB(f.value)),oe(`host`)}function ue(){p.value!==null&&Object.assign(i.backups,uB(p.value)),oe(`backups`)}function de(){if(u.value!==null){let e=oB(u.value);i.control.label=e.label,i.control.port=e.port,i.control.host=e.host,i.control.openBrowser=e.openBrowser}TB(i,re,`listener`)}function fe(){u.value!==null&&Object.assign(i.auth,aB(u.value.auth)),TB(i,re,`auth`)}function pe(){u.value!==null&&(i.control.tlsEnabled=u.value.tls.enabled),TB(i,re,`tls`)}return(e,r)=>(L(),z(Fq,{sections:t.value,"nav-label":A(Y)(`views.globalSettings.navLabel`),"changes-description":A(Y)(`views.globalSettings.changesDescription`),"changed-count":x.value,changes:C.value,"save-error":o.value,"save-message":s.value,saving:a.value,onSave:ce,onDiscard:le},{header:j(()=>[B(`header`,dJ,[B(`h1`,fJ,O(A(Y)(`views.globalSettings.title`)),1),B(`p`,pJ,O(A(Y)(`views.globalSettings.description`)),1)]),c.value?(L(),z(fW,{key:0,tone:`warn`,title:A(Y)(`views.globalSettings.loadErrorTitle`),class:`mb-4`},{default:j(()=>[H(O(c.value),1)]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(fq,{id:`listener`,title:A(Y)(`views.globalSettings.sectionListener`),description:A(Y)(`views.globalSettings.listenerDescription`)},{default:j(()=>[V(WK,{control:i.control,"onUpdate:control":r[0]||=e=>i.control=e,view:u.value,dirty:w.value,onReset:de},null,8,[`control`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`authentication`,title:A(Y)(`views.globalSettings.sectionAuthentication`),description:A(Y)(`views.globalSettings.authenticationDescription`)},{default:j(()=>[V(gW,{auth:i.auth,"onUpdate:auth":r[1]||=e=>i.auth=e,view:u.value,dirty:ee.value,onReset:fe},null,8,[`auth`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`host`,title:A(Y)(`views.globalSettings.sectionHost`),description:A(Y)(`views.globalSettings.hostDescription`)},{default:j(()=>[V(yK,{host:i.host,"onUpdate:host":r[2]||=e=>i.host=e,config:f.value,alerts:d.value,dirty:te.value,onReset:E},null,8,[`host`,`config`,`alerts`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`backups`,title:A(Y)(`views.globalSettings.sectionBackups`),description:A(Y)(`views.globalSettings.backupsDescription`)},{default:j(()=>[V(dK,{form:i.backups,"onUpdate:form":r[3]||=e=>i.backups=e,state:m.value,policy:p.value,"config-path":y.value,workspaces:A(n).workspaces.value,dirty:ne.value,onReset:ue},null,8,[`form`,`state`,`policy`,`config-path`,`workspaces`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`tls`,title:A(Y)(`views.globalSettings.sectionTls`),description:A(Y)(`views.globalSettings.tlsDescription`)},{default:j(()=>[V(lJ,{"tls-enabled":i.control.tlsEnabled,"onUpdate:tlsEnabled":r[4]||=e=>i.control.tlsEnabled=e,view:u.value,dirty:T.value,onReset:pe},null,8,[`tls-enabled`,`view`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`language`,title:A(Y)(`language.label`),description:A(Y)(`views.globalSettings.languageDescription`)},{default:j(()=>[V(uJ,{wide:!0}),B(`p`,mJ,O(A(Y)(`views.globalSettings.languageNote`)),1)]),_:1},8,[`title`,`description`]),V(fq,{id:`interface`,title:A(Y)(`views.globalSettings.sectionInterface`),description:A(Y)(`views.globalSettings.interfaceDescription`)},{default:j(()=>[V(FK,{label:i.control.label,"onUpdate:label":r[5]||=e=>i.control.label=e,ui:h.value,"panel-version":g.value,"label-dirty":w.value,onChanged:se,onResetLabel:de},null,8,[`label`,`ui`,`panel-version`,`label-dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`paths`,title:A(Y)(`views.globalSettings.sectionPaths`),description:A(Y)(`views.globalSettings.pathsDescription`)},{default:j(()=>[V(oq,{"data-root":_.value,"project-dir":v.value,"panel-url":u.value?.url??null,workspaces:A(n).workspaces.value},null,8,[`data-root`,`project-dir`,`panel-url`,`workspaces`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),gJ={class:`relative flex min-h-dvh items-center justify-center overflow-hidden bg-page px-4 py-10`},_J={class:`hh-enter relative w-full max-w-md`},vJ={class:`mb-6 flex items-center gap-3`},yJ={class:`text-lg font-semibold tracking-tight text-ink`},bJ={class:`text-xs text-muted`},xJ={class:`rounded-panel border border-line bg-panel/95 p-5 shadow-float backdrop-blur-sm`},SJ={class:`flex items-start justify-between gap-3`},CJ={class:`min-w-0`},wJ={class:`text-base font-semibold text-ink`},TJ={class:`mt-1 text-xs leading-relaxed text-muted`},EJ={class:`flex shrink-0 items-center gap-2`},DJ={class:`w-36`},OJ={class:`flex flex-col gap-1.5`},kJ={class:`relative`},AJ=[`type`],jJ=[`aria-label`],MJ={key:0,class:`rounded-control border border-danger/25 bg-danger-soft px-2.5 py-2 text-xs text-danger`},NJ={key:1,class:`mt-5`},PJ={class:`mt-4 space-y-2`},FJ={key:0,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},IJ={class:`text-2xs leading-4 text-warn`},LJ={class:`mx-1 rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},RJ={key:1,class:`flex items-start gap-2 rounded-control border border-warn/25 bg-warn-soft px-2.5 py-2`},zJ={class:`text-2xs leading-4 text-warn`},BJ={key:2,class:`flex items-start gap-2 rounded-control border border-line-soft bg-panel-2 px-2.5 py-2`},VJ={class:`text-2xs leading-4 text-muted`},HJ={class:`mt-4 flex items-center justify-center gap-2 text-2xs text-faint`},UJ={class:`font-mono`},WJ=N({__name:`LoginView`,setup(e){let t=$g(),n=Qg(),r=gI(),{session:i,error:a,login:o,refresh:s}=xP(),c=k(``),l=k(!1),u=k(!1),d=W(()=>i.value?.passwordSet===!1),f=W(()=>i.value!==null&&!i.value.authRequired),p=W(()=>i.value?.usingDefaultPassword===!0&&i.value.defaultPassword!==null),m=W(()=>r.control.value?.auth.exposed===!0),h=W(()=>r.control.value?.url??`—`),g=W(()=>YR(i.value?.sessionTtlMs??0)),_=W(()=>d.value?Y(`login.firstRunTitle`):f.value?Y(`login.authOffTitle`):Y(`login.title`)),v=W(()=>d.value?Y(`login.firstRunSubtitle`):f.value?Y(`login.authOffSubtitle`):Y(`login.subtitle`));async function y(){l.value=!0;try{if(await o(c.value)){c.value=``;let e=typeof t.query.next==`string`?t.query.next:`/`;await n.push(e)}}finally{l.value=!1}}async function b(){await s(),await n.push(`/`)}return ia(async()=>{i.value===null&&await s()}),(e,t)=>(L(),R(`div`,gJ,[t[5]||=B(`div`,{class:`bg-instrument pointer-events-none absolute inset-0 opacity-60`},null,-1),t[6]||=B(`div`,{class:`pointer-events-none absolute inset-0 bg-[radial-gradient(ellipse_at_center,transparent_15%,var(--page)_78%)]`},null,-1),B(`div`,_J,[B(`div`,vJ,[t[2]||=As(`<span class="grid size-11 shrink-0 place-items-center rounded-panel border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,null,[B(`p`,yJ,O(A(Y)(`app.name`)),1),B(`p`,bJ,O(A(Y)(`app.tagline`)),1)])]),B(`section`,xJ,[B(`div`,SJ,[B(`div`,CJ,[B(`h1`,wJ,O(_.value),1),B(`p`,TJ,O(v.value),1)]),B(`div`,EJ,[m.value?(L(),z(MG,{key:0,tone:`warn`,dot:``},{default:j(()=>[H(O(A(Y)(`login.exposed`)),1)]),_:1})):U(``,!0),B(`div`,DJ,[V(uJ,{labelled:!1})])])]),f.value?(L(),R(`div`,NJ,[V($,{variant:`primary`,size:`md`,block:``,onClick:b},{default:j(()=>[H(O(A(Y)(`login.openDashboard`)),1)]),_:1})])):(L(),R(`form`,{key:0,class:`mt-5 space-y-3`,onSubmit:_u(y,[`prevent`])},[B(`div`,OJ,[B(`label`,{for:`hh-password`,class:D(A(nV))},O(A(Y)(`login.password`)),3),B(`div`,kJ,[wr(B(`input`,{id:`hh-password`,"onUpdate:modelValue":t[0]||=e=>c.value=e,type:u.value?`text`:`password`,autocomplete:`current-password`,autofocus:``,required:``,class:D(A(Q)(A(iV),`pr-9`))},null,10,AJ),[[du,c.value]]),B(`button`,{type:`button`,class:`absolute right-1 top-1/2 grid size-7 -translate-y-1/2 place-items-center rounded-control text-faint transition-colors duration-150 hover:text-ink`,"aria-label":u.value?A(Y)(`login.hidePassword`):A(Y)(`login.showPassword`),onClick:t[1]||=e=>u.value=!u.value},[u.value?(L(),z(A(hy),{key:0,class:`size-3.5`})):(L(),z(A(gy),{key:1,class:`size-3.5`}))],8,jJ)])]),A(a)?(L(),R(`p`,MJ,O(A(a)),1)):U(``,!0),V($,{type:`submit`,variant:`primary`,size:`md`,block:``,loading:l.value},{default:j(()=>[V(A(Ty),{class:`size-3.5`}),H(` `+O(A(Y)(`login.signIn`)),1)]),_:1},8,[`loading`])],32)),B(`div`,PJ,[p.value?(L(),R(`div`,FJ,[V(A(Wy),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,IJ,[V(HV,{k:`login.defaultPasswordWarning`},{password:j(()=>[B(`code`,LJ,O(A(i)?.defaultPassword),1)]),_:1})])])):d.value?(L(),R(`div`,RJ,[V(A(Ky),{class:`mt-0.5 size-3.5 shrink-0 text-warn`}),B(`p`,zJ,[V(HV,{k:`login.noPasswordWarning`},{command:j(()=>[...t[3]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`home-hosted set-password`,-1)]]),_:1})])])):(L(),R(`div`,BJ,[V(A(Gy),{class:`mt-0.5 size-3.5 shrink-0 text-ok`}),B(`p`,VJ,O(A(Y)(`login.sessionNote`,{duration:g.value})),1)]))])]),B(`p`,HJ,[B(`span`,UJ,O(h.value),1),t[4]||=B(`span`,{"aria-hidden":`true`},`·`,-1),B(`span`,null,O(A(Y)(`login.servedFromThisMachine`)),1)])])]))}}),GJ=[`#3f4a5c`,`#f07178`,`#7fd88f`,`#e6b673`,`#82aaff`,`#c792ea`,`#7fdbca`,`#c7d2e3`,`#5a6779`,`#ff8b92`,`#9ae6a8`,`#f2c98a`,`#9dbaff`,`#d7aef0`,`#9ce9dc`,`#eef3fb`],KJ=[`#4b5563`,`#c0392b`,`#1c7c3f`,`#9a6700`,`#2f5fe0`,`#7c3aed`,`#0b6f89`,`#334155`,`#6b7280`,`#d64535`,`#22854a`,`#a8620d`,`#3f6bff`,`#8b5cf6`,`#0e7d9c`,`#0f1722`],qJ=/\u001B\[([0-9;]*)m/g,JJ=/\u001B(?:\[[0-9;?]*[A-HJKSTfhilmnprsu]|\][^\u0007\u001B]*(?:\u0007|\u001B\\)?|[()][0-9A-Z])/g;function YJ(e){return Math.max(0,Math.min(255,e))}function XJ(e){return e===0?0:55+e*40}function ZJ(e,t){let n=t?GJ:KJ;if(e<16)return n[e]??n[7];if(e<232){let t=e-16;return`rgb(${XJ(Math.floor(t/36))} ${XJ(Math.floor(t%36/6))} ${XJ(t%6)})`}let r=8+(e-232)*10;return`rgb(${r} ${r} ${r})`}function QJ(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function $J(e,t,n){let r=t.length===0?[0]:t.split(`;`).map(e=>e.length===0?0:Number(e));for(let t=0;t<r.length;t+=1){let i=r[t];if(i===0)Object.assign(e,QJ());else if(i===1)e.bold=!0;else if(i===2)e.dim=!0;else if(i===3)e.italic=!0;else if(i===4)e.underline=!0;else if(i===22)e.bold=!1,e.dim=!1;else if(i===23)e.italic=!1;else if(i===24)e.underline=!1;else if(i===39)e.fg=null;else if(i===49)e.bg=null;else if(i>=30&&i<=37)e.fg=(n?GJ:KJ)[i-30]??null;else if(i>=90&&i<=97)e.fg=(n?GJ:KJ)[i-90+8]??null;else if(i>=40&&i<=47)e.bg=(n?GJ:KJ)[i-40]??null;else if(i>=100&&i<=107)e.bg=(n?GJ:KJ)[i-100+8]??null;else if(i===38||i===48){let a=i===38?`fg`:`bg`,o=r[t+1];o===5&&r[t+2]!==void 0?(e[a]=ZJ(YJ(r[t+2]),n),t+=2):o===2&&(e[a]=`rgb(${YJ(r[t+2]??0)} ${YJ(r[t+3]??0)} ${YJ(r[t+4]??0)})`,t+=4)}}}function eY(e,t,n){if(t.length===0)return;let r=e[e.length-1];r&&r.fg===n.fg&&r.bg===n.bg&&r.bold===n.bold&&r.dim===n.dim&&r.italic===n.italic&&r.underline===n.underline?r.text+=t:e.push({text:t,...n})}function tY(e){return e.includes(`\x1B`)}function nY(e,t=!0){if(!tY(e))return[{text:e,fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}];let n=[],r=QJ(),i=0;qJ.lastIndex=0;let a=qJ.exec(e);for(;a!==null;)eY(n,e.slice(i,a.index).replace(JJ,``),r),$J(r,a[1]??``,t),i=a.index+a[0].length,a=qJ.exec(e);return eY(n,e.slice(i).replace(JJ,``),r),n}var rY={class:`flex h-5 w-max min-w-full items-center gap-2 whitespace-pre px-2 font-mono text-xs leading-5`},iY={key:0,class:`shrink-0 select-none text-faint`},aY={class:`min-w-0`},oY=N({__name:`LogRow`,props:{line:{},query:{},dark:{type:Boolean},showTime:{type:Boolean}},setup(e){let t=e,n=W(()=>nY(t.line.text,t.dark)),r=W(()=>{let e=t.query.trim().toLowerCase(),r=[];for(let t of n.value){if(e.length===0){r.push({text:t.text,hit:!1,span:t});continue}let n=t.text.toLowerCase(),i=0,a=n.indexOf(e);for(;a!==-1;)a>i&&r.push({text:t.text.slice(i,a),hit:!1,span:t}),r.push({text:t.text.slice(a,a+e.length),hit:!0,span:t}),i=a+e.length,a=n.indexOf(e,i);i<t.text.length&&r.push({text:t.text.slice(i),hit:!1,span:t})}return r}),i={stdout:`bg-transparent`,stderr:`bg-danger`,system:`bg-info`};function a(e){let t={};return e.span.fg&&(t.color=e.span.fg),e.span.bg&&(t.backgroundColor=e.span.bg),e.span.bold&&(t.fontWeight=`600`),e.span.dim&&(t.opacity=`0.62`),e.span.italic&&(t.fontStyle=`italic`),e.span.underline&&(t.textDecoration=`underline`),e.hit&&(t.backgroundColor=`var(--warn)`,t.color=`var(--accent-ink)`,t.borderRadius=`2px`),t}return(e,n)=>(L(),R(`div`,rY,[t.showTime?(L(),R(`span`,iY,O(A(QR)(t.line.ts)),1)):U(``,!0),B(`span`,{class:D([`h-3.5 w-0.5 shrink-0 rounded-full`,[i[t.line.stream]]]),"aria-hidden":`true`},null,2),B(`span`,aY,[(L(!0),R(I,null,P(r.value,(e,t)=>(L(),R(`span`,{key:t,style:_e(a(e))},O(e.text),5))),128))])]))}}),sY={class:`flex min-h-0 flex-col overflow-hidden rounded-panel border border-line bg-panel`},cY={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel-2/60 px-2.5 py-2`},lY={class:`relative min-w-40 flex-1 sm:max-w-72`},uY=[`placeholder`,`aria-label`],dY={class:`absolute right-1 top-1/2 flex -translate-y-1/2 items-center gap-0.5`},fY={key:0,class:`px-1 font-mono text-2xs tabular-nums text-faint`},pY=[`aria-label`],mY=[`aria-label`],hY=[`aria-label`],gY={class:`ml-auto flex items-center gap-1.5`},_Y=[`href`,`download`],vY={class:`relative min-h-0 flex-1`},yY=[`aria-label`],bY={key:0,class:`px-3 py-6 text-center text-xs text-faint`},xY={class:`flex items-center gap-3 border-t border-line bg-panel-2/60 px-2.5 py-1.5 text-2xs text-faint`},SY={class:`flex items-center gap-1.5`},CY={class:`font-mono tabular-nums`},wY={key:0,class:`font-mono tabular-nums`},TY={class:`ml-auto hidden font-mono tabular-nums sm:inline`},EY=20,DY=12,OY=N({__name:`LogViewer`,props:{lines:{},version:{default:0},live:{type:Boolean,default:!1},emptyHint:{default:void 0},clearable:{type:Boolean,default:!1},downloadUrl:{default:void 0},downloadName:{default:void 0},minHeight:{default:`16rem`}},emits:[`clear`],setup(e,{emit:t}){let n=e,r=t,i=TI(),a=k(null),o=k(0),s=k(320),c=k(!0),l=k(`all`),u=k(``),d=k(!0),f=k(0),p=W(()=>{n.version;let e=u.value.trim().toLowerCase(),t=l.value;return e.length===0&&t===`all`?n.lines:n.lines.filter(n=>!(t!==`all`&&n.stream!==t||e.length>0&&!n.text.toLowerCase().includes(e)))}),m=W(()=>p.value.length),h=W(()=>{let e=u.value.trim().toLowerCase();if(e.length===0)return[];let t=[],n=p.value;for(let r=0;r<n.length;r+=1)n[r].text.toLowerCase().includes(e)&&t.push(r);return t}),g=W(()=>Math.max(0,Math.floor(o.value/EY)-DY)),_=W(()=>Math.min(m.value,Math.ceil((o.value+s.value)/EY)+DY)),v=W(()=>p.value.slice(g.value,_.value)),y=W(()=>h.value[f.value]??-1);function b(){let e=a.value;if(!e)return;o.value=e.scrollTop;let t=e.scrollHeight-e.scrollTop-e.clientHeight;c.value=t<12}function x(){let e=a.value;e&&(e.scrollTop=e.scrollHeight,o.value=e.scrollTop,c.value=!0)}function S(e){let t=a.value;t&&(t.scrollTop=Math.max(0,e*EY-t.clientHeight/2),o.value=t.scrollTop,c.value=!1)}function C(e){let t=h.value.length;t!==0&&(f.value=(f.value+e+t)%t,S(h.value[f.value]))}M(()=>[n.version,m.value],()=>{c.value&&(f.value=0,requestAnimationFrame(x))}),M(h,()=>{f.value=0,h.value.length>0&&u.value.trim().length>0&&requestAnimationFrame(()=>S(h.value[0]))}),M(l,()=>{c.value=!0,requestAnimationFrame(x)});let w=null;ia(()=>{let e=a.value;e&&(s.value=e.clientHeight,w=new ResizeObserver(()=>{a.value&&(s.value=a.value.clientHeight)}),w.observe(e),x())}),ze(()=>{w?.disconnect(),w=null});let T=W(()=>[{value:`all`,label:Y(`logs.streamAll`)},{value:`stdout`,label:Y(`logs.streamOut`)},{value:`stderr`,label:Y(`logs.streamErr`)},{value:`system`,label:Y(`logs.streamSys`)}]);return(e,t)=>(L(),R(`div`,sY,[B(`header`,cY,[V(mG,{modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,options:T.value},null,8,[`modelValue`,`options`]),B(`div`,lY,[V(A(Vy),{class:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),wr(B(`input`,{"onUpdate:modelValue":t[1]||=e=>u.value=e,type:`search`,placeholder:A(Y)(`logs.searchPlaceholder`),class:D([`h-7 py-0 pl-7 text-xs`,[A(iV)]]),"aria-label":A(Y)(`logs.searchLabel`),onKeydown:t[2]||=yu(_u(e=>C(e.shiftKey?-1:1),[`prevent`]),[`enter`])},null,42,uY),[[nu,u.value]]),B(`div`,dY,[u.value.trim().length>0?(L(),R(`span`,fY,O(h.value.length===0?`0`:`${f.value+1}/${h.value.length}`),1)):U(``,!0),u.value.length>0?(L(),R(`button`,{key:1,type:`button`,class:`grid size-6 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.clearSearch`),onClick:t[3]||=e=>u.value=``},[V(A(nb),{class:`size-3`})],8,pY)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:2,type:`button`,class:`grid size-6 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.prevMatch`),onClick:t[4]||=e=>C(-1)},[V(A(ny),{class:`size-3`})],8,mY)):U(``,!0),h.value.length>0?(L(),R(`button`,{key:3,type:`button`,class:`grid size-6 place-items-center rounded text-faint hover:text-ink`,"aria-label":A(Y)(`logs.nextMatch`),onClick:t[5]||=e=>C(1)},[V(A($v),{class:`size-3`})],8,hY)):U(``,!0)])]),B(`div`,gY,[V(PH,{label:d.value?A(Y)(`logs.hideTimestamps`):A(Y)(`logs.showTimestamps`)},{default:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[6]||=e=>d.value=!d.value},{default:j(()=>[V(A(sy),{class:D(A(Q)(`size-3`,d.value?`fill-accent text-accent`:`text-faint`))},null,8,[`class`]),H(` `+O(A(Y)(`logs.timestampsShort`)),1)]),_:1})]),_:1},8,[`label`]),V($,{size:`xs`,variant:c.value?`secondary`:`primary`,onClick:t[7]||=e=>c.value?c.value=!1:x()},{default:j(()=>[(L(),z(_a(c.value?A(My):A(Py)),{class:`size-3`})),H(` `+O(c.value?A(Y)(`logs.pause`):A(Y)(`logs.follow`)),1)]),_:1},8,[`variant`]),n.clearable?(L(),z(PH,{key:0,label:A(Y)(`logs.clearHint`)},{default:j(()=>[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.clearLabel`),onClick:t[8]||=e=>r(`clear`)},{default:j(()=>[V(A($y),{class:`size-3.5`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`])):U(``,!0),n.downloadUrl?(L(),z(PH,{key:1,label:A(Y)(`logs.downloadHint`)},{default:j(()=>[B(`a`,{href:n.downloadUrl,download:n.downloadName},[V($,{size:`icon-sm`,variant:`ghost`,"aria-label":A(Y)(`logs.downloadLabel`)},{default:j(()=>[V(A(Xv),{class:`size-3.5`})]),_:1},8,[`aria-label`])],8,_Y)]),_:1},8,[`label`])):U(``,!0)])]),B(`div`,vY,[B(`div`,{ref_key:`scroller`,ref:a,class:`h-full overflow-auto overscroll-contain bg-page/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/50`,style:_e({minHeight:n.minHeight}),tabindex:`0`,role:`log`,"aria-label":A(Y)(`logs.outputLabel`),onScrollPassive:b},[m.value===0?(L(),R(`p`,bY,O(n.lines.length===0?n.emptyHint??A(Y)(`logs.emptyHint`):A(Y)(`logs.noMatches`)),1)):(L(),R(`div`,{key:1,class:`relative w-full`,style:_e({height:`${m.value*EY}px`})},[(L(!0),R(I,null,P(v.value,(e,t)=>(L(),R(`div`,{key:g.value+t,class:D([`absolute left-0 top-0`,g.value+t===y.value&&`bg-warn/10`]),style:_e({transform:`translateY(${(g.value+t)*EY}px)`})},[V(oY,{line:e,query:u.value,dark:A(i).isDark.value,"show-time":d.value},null,8,[`line`,`query`,`dark`,`show-time`])],6))),128))],4))],44,yY),V(Ac,{"enter-active-class":`transition duration-150`,"leave-active-class":`transition duration-100`,"enter-from-class":`opacity-0 translate-y-1`,"leave-to-class":`opacity-0 translate-y-1`},{default:j(()=>[!c.value&&m.value>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-line bg-raise px-2.5 py-1 text-2xs text-muted shadow-float transition-colors duration-150 hover:text-ink`,onClick:x},[V(A(Xv),{class:`size-3`}),H(` `+O(A(Y)(`logs.jumpToLatest`)),1)])):U(``,!0)]),_:1})]),B(`footer`,xY,[B(`span`,SY,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,n.live?c.value?`bg-ok`:`bg-warn`:`bg-faint`))},null,2),H(` `+O(n.live?c.value?A(Y)(`logs.streaming`):A(Y)(`logs.paused`):A(Y)(`logs.snapshot`)),1)]),B(`span`,CY,O(m.value===n.lines.length?A(PF)(`logs.lines`,m.value):A(Y)(`logs.linesOf`,{count:m.value,total:n.lines.length})),1),u.value.trim().length>0?(L(),R(`span`,wY,O(A(Y)(`logs.matches`,{count:h.value.length})),1)):U(``,!0),B(`span`,TY,O(A(Y)(`logs.rowHeight`,{height:EY})),1)])]))}}),kY={class:`flex h-full min-h-0`},AY={class:`hidden w-64 shrink-0 flex-col border-r border-line bg-panel/40 md:flex`},jY={class:`border-b border-line px-3 py-2.5`},MY={class:`text-xs font-semibold text-ink`},NY={class:`mt-0.5 text-2xs text-faint`},PY={class:`min-h-0 flex-1 overflow-y-auto p-1.5`},FY={key:0,class:`space-y-1.5 p-1.5`},IY=[`onClick`],LY={class:`min-w-0 flex-1`},RY={key:0,class:`block truncate font-mono text-2xs text-faint`},zY={key:1,class:`block truncate font-mono text-2xs text-faint`},BY={class:`border-t border-line p-2.5`},VY={class:`text-2xs leading-4 text-faint`},HY={class:`flex min-w-0 flex-1 flex-col`},UY={class:`flex flex-wrap items-center gap-2 border-b border-line bg-panel/40 px-3 py-2.5`},WY={class:`min-w-0`},GY={class:`truncate text-sm font-semibold text-ink`},KY={key:0,class:`ml-1.5 font-mono text-2xs font-normal text-faint`},qY=[`aria-label`,`placeholder`],JY={key:0,class:`flex flex-wrap items-center gap-1.5 border-b border-line-soft bg-panel-2/40 px-3 py-2`},YY=[`href`,`download`],XY={class:`text-faint`},ZY={key:1,class:`text-2xs text-faint`},QY={key:2,class:`ml-auto font-mono text-2xs text-faint`},$Y={key:3,class:`font-mono text-2xs text-faint`},eX={key:1,class:`flex items-center gap-1.5 border-b border-danger/25 bg-danger-soft px-3 py-2 text-2xs text-danger`},tX={class:`min-h-0 flex-1 p-3`},nX={class:`text-xs text-muted`},rX=N({__name:`LogsView`,setup(e){let t=$g(),n=Qg(),r=jI(),i=k([]),a=k(null),o=k(`disk`),s=k(`2000`),c=k(``),l=k(``),u=k(null),d=k(!1),f=k(null),p=k([]),m=k(0),h=k(!1),g=k(!0),_=W(()=>i.value.find(e=>e.serverId===a.value)??null),v=hI(r.activeId,()=>o.value===`live`?a.value:null),y=v.version,b=W(()=>(y.value,v.lines())),x=W(()=>o.value===`live`?b.value:p.value),S=W(()=>o.value===`live`?y.value:m.value),C=[200,500,2e3,5e3].map(e=>({value:String(e),label:PF(`logs.lines`,e,{count:e})})),w=[{value:``,label:Y(`views.logs.allStreams`)},{value:`stdout`,label:`stdout`},{value:`stderr`,label:`stderr`},{value:`system`,label:`system`}],T=W(()=>i.value.reduce((e,t)=>e+t.sizeBytes,0)),ee=W(()=>i.value.filter(e=>e.files.length>0).length);async function te(){g.value=!0;try{i.value=await KN(r.activeId.value);let e=typeof t.query.server==`string`?t.query.server:null,n=e&&i.value.some(t=>t.serverId===e)?e:a.value&&i.value.some(e=>e.serverId===a.value)?a.value:i.value[0]?.serverId??null;a.value=n}catch(e){f.value=IM(e)}finally{g.value=!1}}let ne=0;async function re(){let e=a.value;if(e===null||o.value===`live`)return;let t=++ne;d.value=!0,f.value=null;try{let n=await qN(r.activeId.value,e,{tail:Number(s.value),...c.value.length>0?{stream:c.value}:{},...l.value.trim().length>0?{search:l.value.trim()}:{}});if(t!==ne)return;p.value=n.lines,u.value=n.searched??null,m.value+=1}catch(e){if(t!==ne)return;f.value=IM(e)}finally{t===ne&&(d.value=!1)}}async function ie(){let e=a.value;if(e!==null){h.value=!1;try{await JN(r.activeId.value,e),p.value=[],m.value+=1,await te()}catch(e){f.value=IM(e)}}}function ae(e){a.value=e,o.value===`live`&&(p.value=[]),n.replace({query:{...t.query,server:e}})}M([a,s,c,o],()=>{o.value===`disk`?re():u.value=null},{immediate:!1});let oe=null;return M(l,()=>{oe!==null&&clearTimeout(oe),oe=setTimeout(()=>{oe=null,o.value===`disk`&&re()},300)}),ze(()=>{oe!==null&&clearTimeout(oe)}),M(()=>r.activeId.value,()=>{a.value=null,p.value=[],o.value=`disk`,te().then(()=>re())}),ia(async()=>{await te(),o.value===`disk`&&await re()}),(e,t)=>(L(),R(`div`,kY,[B(`aside`,AY,[B(`div`,jY,[B(`p`,MY,O(A(Y)(`views.logs.persistedTitle`)),1),B(`p`,NY,O(A(Y)(`views.logs.persistedSummary`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`),persisted:ee.value,total:i.value.length,size:A(ez)(T.value)})),1)]),B(`div`,PY,[g.value?(L(),R(`div`,FY,[(L(),R(I,null,P(5,e=>V(CU,{key:e,class:`h-10 w-full`,rounded:`rounded-control`})),64))])):(L(!0),R(I,{key:1},P(i.value,e=>(L(),R(`button`,{key:e.serverId,type:`button`,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors duration-150`,e.serverId===a.value?`bg-accent-soft`:`hover:bg-hover`)),onClick:t=>ae(e.serverId)},[B(`span`,{class:D(A(Q)(`size-1.5 shrink-0 rounded-full`,A(uR)[A(oR)[e.status].tone]))},null,2),B(`span`,LY,[B(`span`,{class:D(A(Q)(`block truncate text-xs`,e.serverId===a.value?`font-medium text-accent`:`text-ink`))},O(e.label),3),e.files.length>0?(L(),R(`span`,RY,O(A(PF)(`views.logs.filesOnDisk`,e.files.length))+` · `+O(A(ez)(e.sizeBytes)),1)):(L(),R(`span`,zY,O(A(Y)(`views.logs.nothingPersisted`)),1))])],10,IY))),128)),!g.value&&i.value.length===0?(L(),z(AR,{key:2,compact:``,title:A(Y)(`views.logs.noServersTitle`),description:A(Y)(`views.logs.noServersDescription`)},null,8,[`title`,`description`])):U(``,!0)]),B(`div`,BY,[B(`p`,VY,O(A(Y)(`views.logs.retentionNote`)),1)])]),B(`div`,HY,[B(`header`,UY,[B(`div`,WY,[B(`h1`,GY,[H(O(_.value?.label??A(Y)(`nav.logs`))+` `,1),_.value?(L(),R(`span`,KY,O(_.value.serverId),1)):U(``,!0)])]),V(mG,{modelValue:o.value,"onUpdate:modelValue":t[0]||=e=>o.value=e,class:`ml-auto`,options:[{value:`disk`,label:A(Y)(`views.logs.modePersisted`)},{value:`live`,label:A(Y)(`views.logs.modeLive`)}]},null,8,[`modelValue`,`options`]),o.value===`disk`?(L(),z(hV,{key:0,modelValue:s.value,"onUpdate:modelValue":t[1]||=e=>s.value=e,options:A(C),class:`w-32`,"aria-label":A(Y)(`views.logs.tailAria`)},null,8,[`modelValue`,`options`,`aria-label`])):U(``,!0),o.value===`disk`?(L(),z(hV,{key:1,modelValue:c.value,"onUpdate:modelValue":t[2]||=e=>c.value=e,options:w,class:`w-32`,"aria-label":A(Y)(`views.logs.streamAria`)},null,8,[`modelValue`,`aria-label`])):U(``,!0),o.value===`disk`?wr((L(),R(`input`,{key:2,"onUpdate:modelValue":t[3]||=e=>l.value=e,type:`search`,class:`w-44 min-w-0 rounded-control border border-line bg-panel px-2.5 py-1.5 text-xs text-ink outline-none transition-colors placeholder:text-faint focus:border-accent/50`,"aria-label":A(Y)(`views.logs.searchAria`),placeholder:A(Y)(`views.logs.searchPlaceholder`)},null,8,qY)),[[nu,l.value]]):U(``,!0),o.value===`disk`?(L(),z($,{key:3,size:`sm`,loading:d.value,onClick:re},{default:j(()=>[V(A(Ly),{class:`size-3.5`}),H(O(A(Y)(`views.logs.reload`)),1)]),_:1},8,[`loading`])):U(``,!0),o.value===`disk`?(L(),z($,{key:4,size:`sm`,variant:`ghost`,disabled:!_.value||_.value.files.length===0,onClick:t[4]||=e=>h.value=!0},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clearFile`)),1)]),_:1},8,[`disabled`])):U(``,!0)]),_.value?(L(),R(`div`,JY,[V(A(_y),{class:`size-3.5 shrink-0 text-faint`}),_.value.files.length>0?(L(!0),R(I,{key:0},P(_.value.files,e=>(L(),R(`a`,{key:e.name,href:YN(A(r).activeId.value,_.value.serverId,e.name),download:e.name,class:`inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},[H(O(e.name)+` `,1),B(`span`,XY,O(A(ez)(e.sizeBytes)),1),V(A(Xv),{class:`size-3`})],8,YY))),128)):(L(),R(`span`,ZY,O(A(Y)(`views.logs.nothingOnDisk`)),1)),o.value===`disk`&&p.value.length>0?(L(),R(`span`,QY,O(A(Y)(`views.logs.loadedLines`,{count:p.value.length})),1)):U(``,!0),u.value===null?U(``,!0):(L(),R(`span`,$Y,` · `+O(A(Y)(`views.logs.searchedLines`,{count:u.value})),1))])):U(``,!0),f.value?(L(),R(`p`,eX,[V(A(iy),{class:`size-3.5`}),H(` `+O(f.value),1)])):U(``,!0),B(`div`,tX,[_.value?d.value&&x.value.length===0?(L(),z(CU,{key:1,class:`h-full w-full`,rounded:`rounded-panel`})):(L(),z(OY,{key:2,lines:x.value,version:S.value,live:o.value===`live`,class:`h-full`,"empty-hint":o.value===`live`?A(Y)(`views.logs.waitingOutput`):A(Y)(`views.logs.fileEmpty`),"min-height":`100%`},null,8,[`lines`,`version`,`live`,`empty-hint`])):(L(),z(AR,{key:0,title:A(Y)(`views.logs.pickServerTitle`),description:A(Y)(`views.logs.pickServerDescription`)},{icon:j(()=>[V(A(By),{class:`size-4`})]),_:1},8,[`title`,`description`]))])]),V(LV,{open:h.value,"onUpdate:open":t[6]||=e=>h.value=e,title:A(Y)(`views.logs.clearTitle`),description:A(Y)(`views.logs.clearDescription`,{server:_.value?.serverId??``}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[5]||=e=>h.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ie},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`views.logs.clear`)),1)]),_:1})]),default:j(()=>[B(`p`,nX,O(A(Y)(`views.logs.clearNote`)),1)]),_:1},8,[`open`,`title`,`description`])]))}}),iX={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},aX={key:0,class:`grid grid-cols-2 gap-4 p-4 sm:grid-cols-3 lg:grid-cols-5`},oX={key:1,class:`grid grid-cols-2 divide-line-soft sm:grid-cols-3 sm:divide-x lg:grid-cols-5`},sX={class:`p-4`},cX={class:`p-4`},lX={class:`p-4`},uX={class:`p-4`},dX={class:`p-4`},fX={key:0,class:`flex items-start gap-2.5 rounded-panel border border-danger/25 bg-danger-soft px-3.5 py-3`},pX={class:`min-w-0`},mX={class:`text-xs font-medium text-danger`},hX={class:`mt-0.5 flex flex-wrap gap-x-2 text-2xs text-danger`},gX={class:`space-y-3`},_X={class:`flex items-center justify-between`},vX={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},yX={key:0,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},bX={key:2,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},xX={class:`flex items-center gap-1.5 text-sm font-semibold text-ink`},SX={class:`flex flex-wrap items-center gap-x-3 gap-y-1 text-2xs text-faint`},CX={class:`flex items-center gap-1`},wX={class:`font-mono`},TX=N({__name:`OverviewView`,setup(e){let t=gI(),n=jI(),r=k(!1),i=W(()=>t.appState.value===null),a=n.servers,o=W(()=>n.selected.value?.label??Y(`nav.workspace`)),s=W(()=>a.value.filter(e=>e.status===`running`)),c=W(()=>a.value.filter(e=>[`stopped`,`stopping`].includes(e.status))),l=W(()=>a.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`)),u=W(()=>RF(s.value,`rssBytes`)),d=W(()=>{let e=0;for(let t of a.value){let r=UF(n.seriesOf(t.id).rss);r>e&&(e=r)}return e}),f=W(()=>RF(s.value,`cpuPercent`)),p=W(()=>{let e=a.value.map(e=>e.startedAt).filter(e=>typeof e==`number`);return e.length===0?`—`:YR(t.now.value-Math.min(...e))});return(e,m)=>{let h=ha(`RouterLink`);return L(),R(`div`,iX,[V(vU,{title:o.value,description:A(Y)(`views.overview.description`)},{actions:j(()=>[V($,{variant:`ghost`,onClick:m[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V(lW,{label:A(Y)(`views.actions.stopAll`),"confirm-label":A(Y)(`views.actions.stopAllIgnore`),"alternative-label":A(Y)(`views.actions.stopAllWithPersistent`),title:A(Y)(`views.actions.stopAllQuestion`),hint:A(Y)(`views.actions.stopAllHint`),variant:`ghost`,"confirm-variant":`danger`,onConfirm:m[1]||=e=>A(n).stopAll(),onAlternative:m[2]||=e=>A(n).stopAll({withPersistent:!0})},null,8,[`label`,`confirm-label`,`alternative-label`,`title`,`hint`]),V($,{variant:`primary`,onClick:m[3]||=e=>r.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),V(SU,{class:`p-0`},{default:j(()=>[i.value?(L(),R(`div`,aX,[(L(),R(I,null,P(5,e=>B(`div`,{key:e,class:`space-y-2`},[V(CU,{class:`h-2.5 w-16`}),V(CU,{class:`h-6 w-20`})])),64))])):(L(),R(`div`,oX,[B(`div`,sX,[V(DU,{label:A(Y)(`views.overview.running`),value:`${s.value.length}/${A(a).length}`,tone:`ok`,hint:A(Y)(`views.overview.notUp`,{count:A(a).length-s.value.length})},null,8,[`label`,`value`,`hint`])]),B(`div`,cX,[V(DU,{label:A(Y)(`views.overview.stopped`),value:String(c.value.length),hint:A(Y)(`views.overview.enabled`,{count:A(a).filter(e=>e.config.enabled).length})},null,8,[`label`,`value`,`hint`])]),B(`div`,lX,[V(DU,{label:A(Y)(`views.overview.needsAttention`),value:String(l.value.length),tone:l.value.length>0?`danger`:`ok`,hint:l.value.length===0?A(Y)(`views.overview.nothingBroken`):A(Y)(`views.overview.crashedOrUnhealthy`)},null,8,[`label`,`value`,`tone`,`hint`])]),B(`div`,uX,[V(DU,{label:A(Y)(`views.overview.processMemory`),value:A(tz)(u.value),hint:d.value>0?A(Y)(`views.overview.peak`,{value:A(tz)(d.value)}):A(Y)(`views.overview.acrossTree`)},null,8,[`label`,`value`,`hint`])]),B(`div`,dX,[V(DU,{label:A(Y)(`views.overview.longestUptime`),value:p.value,hint:s.value.length===0?A(Y)(`views.overview.nothingRunning`):f.value===null?A(Y)(`metric.emptyHint`):A(Y)(`views.overview.cpuNow`,{value:f.value.toFixed(1)})},null,8,[`label`,`value`,`hint`])])]))]),_:1}),l.value.length>0?(L(),R(`div`,fX,[V(A(iy),{class:`mt-0.5 size-4 shrink-0 text-danger`}),B(`div`,pX,[B(`p`,mX,O(A(PF)(`views.overview.needLook`,l.value.length)),1),B(`p`,hX,[(L(!0),R(I,null,P(l.value,e=>(L(),z(h,{key:e.id,to:A(J2)(A(n).activeId.value,`servers`,e.id),class:`font-mono underline-offset-2 hover:underline`},{default:j(()=>[H(O(e.id),1)]),_:2},1032,[`to`]))),128))])])])):U(``,!0),B(`section`,gX,[B(`div`,_X,[B(`h2`,vX,[V(A(Hy),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`nav.servers`)),1)]),V(h,{to:A(J2)(A(n).activeId.value,`servers`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`views.overview.openFullList`)),1)]),_:1},8,[`to`])]),i.value?(L(),R(`div`,yX,[(L(),R(I,null,P(4,e=>V(CU,{key:e,class:`h-64 w-full`,rounded:`rounded-panel`})),64))])):A(a).length===0?(L(),z(AR,{key:1,title:A(Y)(`views.overview.emptyTitle`),description:A(Y)(`views.overview.emptyDescription`)},{icon:j(()=>[V(A(Hy),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:m[4]||=e=>r.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,bX,[(L(!0),R(I,null,P(A(a),e=>(L(),z(dU,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))]))]),V(SU,null,{header:j(()=>[B(`h2`,xX,[V(A(Jv),{class:`size-3.5 text-faint`}),H(` `+O(A(Y)(`views.overview.recentActivity`)),1)])]),actions:j(()=>[V(h,{to:A(J2)(A(n).activeId.value,`logs`),class:`text-2xs text-muted transition-colors duration-150 hover:text-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),default:j(()=>[V(Mz,{servers:A(a),now:A(t).now.value,limit:10},null,8,[`servers`,`now`])]),_:1}),B(`p`,SX,[B(`span`,CX,[V(A(Qy),{class:`size-3`}),H(O(A(Y)(`views.overview.sampling`)),1)]),B(`span`,wX,O(A(n).selected.value?.configPath),1),B(`span`,{class:D(A(Q)(`flex items-center gap-1`))},[m[6]||=B(`span`,{class:`size-1.5 rounded-full bg-ok`},null,-1),H(` `+O(A(Y)(`views.overview.workspaceLabel`,{id:A(n).activeId.value})),1)],2)]),V(iH,{open:r.value,"onUpdate:open":m[5]||=e=>r.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])])}}});function EX(e){return DX(e)}function DX(e){if(Array.isArray(e))return e.map(e=>DX(e));if(e instanceof Date)return new Date(e.getTime());if(RM(e)){let t={};for(let[n,r]of Object.entries(e))t[n]=DX(r);return t}return e}var OX=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*$/i,kX=/^(?:[a-z][a-z0-9+.-]*:\/\/)?(?<authority>[^/?#]+)/i,AX=[`.localhost`,`.local`,`.internal`,`.home.arpa`,`.lan`,`.home`,`.test`,`.invalid`,`.example`],jX=/^[a-z0-9][a-z0-9_-]*$/,MX={hostRequired:()=>`a hostname is required`,hostInvalid:()=>`a hostname of letters, digits, dots and dashes, e.g. home.example.com`,hostDuplicate:e=>`"${e}" is already routed for this path`,pathNeedsSlash:()=>`a path prefix starts with /`,pathHasSpace:()=>`a path prefix cannot contain a space`,idInvalid:()=>`the id must start with a letter or digit, then letters, digits, dash or underscore`,idDuplicate:e=>`route id "${e}" is used twice`,workspaceRequired:()=>`pick the workspace that owns the server`,serverRequired:()=>`pick a server in that workspace`,urlInvalid:()=>`an upstream like http://10.0.0.5:8080`},NX={controlPanel:()=>`control panel`,noUpstream:()=>`no upstream`,noServerPicked:()=>`no server picked`,fallbackRetry:()=>`~8 hours`,retryOne:(e,t)=>`~${e} ${t}`,retryMany:(e,t)=>`~${e} ${t}s`},PX=4443,FX=4480;function IX(e){return e.label.trim().length>0?e.label:e.id}var LX=0;function RX(e){return e.find(e=>e.tls!==`off`&&VX(e.host))?.host??null}function zX(e){if(e===null||e<0)return`—`;let t=[`B`,`KiB`,`MiB`,`GiB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function BX(e){return e>0&&e<1024}function VX(e){let t=e.trim().toLowerCase();return t.length===0||t===`localhost`||!t.includes(`.`)||AX.some(e=>t.endsWith(e))?!1:!/^\d{1,3}(?:\.\d{1,3}){3,}$/.test(t)}function HX(e,t){let n={};e.enabled!==t.enabled&&(n.enabled=t.enabled),e.httpPort!==t.httpPort&&(n.httpPort=t.httpPort),e.httpsPort!==t.httpsPort&&(n.httpsPort=t.httpsPort),e.email!==t.email&&(n.email=t.email),e.staging!==t.staging&&(n.staging=t.staging);let r=qX(t.resolvers);return(e.dns01.enabled!==t.dns01||e.dns01.resolvers.join(`,`)!==r.join(`,`))&&(n.dns01={enabled:t.dns01,resolvers:r}),n}function UX(){return{key:WX(),id:`route`,host:``,enabled:!0,target:`server`,workspace:``,server:``,url:``,path:``,tls:`auto`,dnsAccount:``}}function WX(){return LX+=1,`proxy-route-${LX}`}function GX(e){return EX(e).map(e=>({...e,key:WX()}))}function KX(e,t,n){return t===null?[...e,n]:e.map(e=>e.id===t.id?n:e)}function qX(e){return e.split(/[\s,]+/).map(e=>e.trim()).filter(e=>e.length>0)}function JX(e,t,n,r){let i=HX(e,t),a=$X(e.routes,n,r);return a!==null&&(i.routes=a),Object.keys(i).length===0?null:i}function YX(e,t){return e.staging||e.email.trim().length>0?!1:t.some(e=>e.tls!==`off`&&VX(e.host))}function XX(e,t=NX){if(e===null)return t.fallbackRetry();if(e<60)return e===1?t.retryOne(e,`minute`):t.retryMany(e,`minute`);let n=Math.max(1,Math.round(e/60));return n===1?t.retryOne(n,`hour`):t.retryMany(n,`hour`)}function ZX(e,t,n){let r=e.host.trim();if(r.length===0)return null;let i=e.tls===`off`,a=i?t:n,o=i?80:443,s=e.path.length===0||e.path.startsWith(`/`)?e.path:`/${e.path}`;return`${i?`http`:`https`}://${r}${a===o?``:`:${a}`}${s}`}function QX(e,t){return e.length===t.length&&e.every((e,n)=>tZ(e,t[n]))}function $X(e,t,n){return n===void 0?QX(e,t)?null:oZ(t):Rz({filled:n.map(sZ),draft:oZ(t),live:e.map(sZ),key:e=>e.id})}function eZ(e,t,n){return n===void 0?[]:Lz({filled:n.map(sZ),draft:oZ(t),live:e.map(sZ),key:e=>e.id})}function tZ(e,t){return JSON.stringify(sZ(e))===JSON.stringify(sZ(t))}function nZ(e){return rZ(e,`certificate`)}function rZ(e,t){let n=e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40).replace(/-+$/,``);return n.length===0?t:/^[a-z0-9]/.test(n)?n:`r-${n}`}function iZ(e){return rZ(e,`route`)}function aZ(e,t,n=NX){return e.target===`panel`?n.controlPanel():e.target===`external`?e.url.trim().length>0?e.url.trim():n.noUpstream():e.workspace.length===0||e.server.length===0?n.noServerPicked():`${t.find(t=>t.id===e.workspace)?.label??e.workspace} / ${e.server}`}function oZ(e){return e.map(sZ)}function sZ(e){return{id:e.id,host:e.host,enabled:e.enabled,target:e.target,workspace:e.workspace,server:e.server,url:e.url,path:e.path,tls:e.tls,dnsAccount:e.dnsAccount}}function cZ(e,t){return lZ(e,t)}function lZ(e,t){let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}-${r}`);)r+=1;return`${e}-${r}`}function uZ(e,t){return lZ(e,t)}function dZ(e){return e.httpPort===4480&&e.httpsPort===4443}function fZ(e,t){let n={...MX,...t.messages},r={},i=e.host.trim();if(i.length===0?r.host=n.hostRequired():OX.test(i)?t.others.some(t=>t.host.trim().toLowerCase()===i.toLowerCase()&&t.path.replace(/\/+$/,``)===e.path.replace(/\/+$/,``))&&(r.host=n.hostDuplicate(i)):r.host=n.hostInvalid(),e.path.length>0&&!e.path.startsWith(`/`)?r.path=n.pathNeedsSlash():/\s/.test(e.path)&&(r.path=n.pathHasSpace()),jX.test(e.id)?t.others.some(t=>t.id===e.id)&&(r.id=n.idDuplicate(e.id)):r.id=n.idInvalid(),e.target===`server`){let i=t.workspaces.find(t=>t.id===e.workspace);e.workspace.length===0||i===void 0?r.workspace=n.workspaceRequired():(e.server.length===0||!i.servers.some(t=>t.id===e.server))&&(r.server=n.serverRequired())}e.target===`external`&&pZ(e.url)===null&&(r.url=n.urlInvalid());let a=qj({...sZ(e),host:i});return a instanceof J.errors&&Object.keys(r).length===0&&(r.form=a.summary),r}function pZ(e){let t=e.trim();if(t.length===0)return null;let n=kX.exec(t)?.groups?.authority;if(n===void 0||n.length===0||n.endsWith(`:`)||/\s/.test(n))return null;let r=t.slice(0,t.indexOf(`:`)).toLowerCase(),i=n.lastIndexOf(`:`);if(i<=0)return{host:n,port:r===`https`?`443`:`80`};let a=n.slice(i+1);return/^\d{1,5}$/.test(a)?{host:n.slice(0,i),port:a}:null}var mZ=[{value:`server`,labelKey:`proxy.target.server`},{value:`panel`,labelKey:`proxy.target.panel`},{value:`external`,labelKey:`proxy.target.external`}],hZ=[{value:`auto`,labelKey:`proxy.tls.auto`},{value:`off`,labelKey:`proxy.tls.off`},{value:`manual`,labelKey:`proxy.tls.manual`}],gZ={off:{labelKey:`proxy.status.off`,tone:`neutral`,transitional:!1},stopped:{labelKey:`proxy.status.stopped`,tone:`neutral`,transitional:!1},starting:{labelKey:`proxy.status.starting`,tone:`warn`,transitional:!0},running:{labelKey:`proxy.status.running`,tone:`ok`,transitional:!1},error:{labelKey:`proxy.status.error`,tone:`danger`,transitional:!1},unsupported:{labelKey:`proxy.status.unsupported`,tone:`warn`,transitional:!1}},_Z={ok:{labelKey:`proxy.status.serving`,tone:`ok`},disabled:{labelKey:`proxy.status.disabled`,tone:`neutral`},"no-upstream":{labelKey:`proxy.status.noUpstream`,tone:`warn`},error:{labelKey:`proxy.status.error`,tone:`danger`}},vZ={off:null,local:{labelKey:`proxy.status.localCa`,tone:`neutral`},uploaded:{labelKey:`proxy.status.uploaded`,tone:`info`},issued:{labelKey:`proxy.status.certified`,tone:`ok`},pending:{labelKey:`proxy.status.awaitingCa`,tone:`warn`},failed:{labelKey:`proxy.status.failed`,tone:`danger`},fallback:{labelKey:`proxy.status.fellBack`,tone:`warn`}};function yZ(e){let t=e.certificate;if(t===void 0)return null;let n=vZ[t.state]??null;return n===null?null:{...n,message:t.message,retryInMinutes:t.retryInMinutes??null}}function bZ(e){return{enabled:e.enabled,httpPort:e.httpPort,httpsPort:e.httpsPort,email:e.email,staging:e.staging,dns01:e.dns01.enabled,resolvers:e.dns01.resolvers.join(`, `)}}function xZ(e){let t=[{value:``,label:Y(`proxy.account.automatic`)}];for(let n of e){let e=n.label.length>0?n.label:n.account,r=[n.writesTxt?null:Y(`proxy.account.noTxt`),n.writesTxt&&!n.hasCredentials?Y(`proxy.account.noCredentials`):null].filter(e=>e!==null);t.push({value:`${n.workspace}/${n.account}`,label:`${e} · ${n.provider} · ${n.workspace}${r.length>0?` (${r.join(`, `)})`:``}`})}return t}function SZ(e){return{...bZ(e)}}function CZ(e){return e.tls===`off`?Y(`proxy.tls.plain`):e.tls===`manual`?Y(`proxy.tls.uploaded`):VX(e.host)?Y(`proxy.tls.letsEncrypt`):Y(`proxy.tls.engineCa`)}var wZ={controlPanel:()=>Y(`proxy.target.controlPanel`),noUpstream:()=>Y(`proxy.target.noUpstream`),noServerPicked:()=>Y(`proxy.target.noServer`),fallbackRetry:()=>Y(`proxy.retry.inFallback`),retryOne:(e,t)=>PF(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e),retryMany:(e,t)=>PF(`proxy.retry.in${t===`minute`?`Minutes`:`Hours`}`,e)},TZ={hostRequired:()=>Y(`proxy.validation.hostRequired`),hostInvalid:()=>Y(`proxy.validation.hostPattern`),hostDuplicate:e=>Y(`proxy.validation.hostTaken`,{host:e}),pathNeedsSlash:()=>Y(`proxy.validation.pathSlash`),pathHasSpace:()=>Y(`proxy.validation.pathSpace`),idInvalid:()=>Y(`proxy.validation.idPattern`),idDuplicate:e=>Y(`proxy.validation.idTaken`,{id:e}),workspaceRequired:()=>Y(`proxy.validation.workspaceRequired`),serverRequired:()=>Y(`proxy.validation.serverRequired`),urlInvalid:()=>Y(`proxy.validation.url`)};function EZ(e,t){return aZ(e,t,wZ)}function DZ(e){return XX(e,wZ)}var OZ={class:`grid grid-cols-1 gap-3 sm:grid-cols-2`},kZ={class:`grid grid-cols-1 gap-3 sm:grid-cols-2`},AZ={class:`flex min-w-0 flex-col gap-1`},jZ={class:`flex min-w-0 flex-col gap-1`},MZ=N({__name:`CertificateDialog`,props:Va({taken:{},busy:{type:Boolean},error:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`submit`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(``),o=k(``),s=k(``),c=k(``),l=k({}),u=k(!1),d=Q(iV,`cursor-pointer text-xs`,`file:mr-2 file:cursor-pointer file:rounded-control file:border-0 file:bg-panel-2 file:px-2 file:py-1 file:text-xs file:text-ink`),f=W(()=>cZ(nZ(a.value),n.taken)),p=W(()=>!n.busy&&a.value.trim().length>0&&s.value.trim().length>0&&c.value.trim().length>0);function m(e){o.value=e,u.value=e.trim().length>0}M([a,()=>n.taken],()=>{u.value||(o.value=f.value)},{immediate:!0}),M(i,e=>{e&&(a.value=``,o.value=``,s.value=``,c.value=``,l.value={},u.value=!1)});async function h(e,t){let n=e.target.files?.[0];if(!n)return;let r=await n.text();t===`cert`?s.value=r:c.value=r}function g(){let e=a.value.trim(),t=o.value.trim(),i={};e.length===0&&(i.label=Y(`proxy.certificateDialog.errorLabel`)),jX.test(t)?n.taken.includes(t)&&(i.id=Y(`proxy.certificateDialog.errorTaken`,{id:t})):i.id=Y(`proxy.certificateDialog.errorId`),s.value.trim().length===0&&(i.certificate=Y(`proxy.certificateDialog.errorCertificate`)),c.value.trim().length===0&&(i.privateKey=Y(`proxy.certificateDialog.errorPrivateKey`)),l.value=i,!(Object.keys(i).length>0)&&r(`submit`,{id:t,label:e,certificate:s.value,privateKey:c.value})}return(e,t)=>(L(),z(LV,{open:i.value,"onUpdate:open":t[6]||=e=>i.value=e,title:A(Y)(`proxy.certificateDialog.title`),description:A(Y)(`proxy.certificateDialog.description`)},{footer:j(()=>[V($,{variant:`ghost`,disabled:n.busy,onClick:t[5]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:!p.value,loading:n.busy,onClick:g},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.store`)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`form`,{class:`space-y-3`,onSubmit:_u(g,[`prevent`])},[B(`div`,OZ,[V(bV,{modelValue:a.value,"onUpdate:modelValue":t[0]||=e=>a.value=e,label:A(Y)(`proxy.certificateDialog.label`),placeholder:A(Y)(`proxy.certificateDialog.labelPlaceholder`),error:l.value.label},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(bV,{"model-value":o.value,label:A(Y)(`proxy.certificateDialog.id`),hint:A(Y)(`proxy.certificateDialog.idHint`),error:l.value.id,"onUpdate:modelValue":m},null,8,[`model-value`,`label`,`hint`,`error`])]),B(`div`,kZ,[B(`div`,AZ,[B(`label`,{class:D(A(nV)),for:`proxy-cert-file`},O(A(Y)(`proxy.certificateDialog.certFile`)),3),B(`input`,{id:`proxy-cert-file`,type:`file`,accept:`.pem,.crt,.cer,text/plain`,class:D(A(d)),onChange:t[1]||=e=>h(e,`cert`)},null,34)]),B(`div`,jZ,[B(`label`,{class:D(A(nV)),for:`proxy-cert-key`},O(A(Y)(`proxy.certificateDialog.keyFile`)),3),B(`input`,{id:`proxy-cert-key`,type:`file`,accept:`.pem,.key,text/plain`,class:D(A(d)),onChange:t[2]||=e=>h(e,`key`)},null,34)])]),V(VV,{modelValue:s.value,"onUpdate:modelValue":t[3]||=e=>s.value=e,label:A(Y)(`proxy.certificateDialog.pasteCert`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.certPlaceholder`),error:l.value.certificate},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(VV,{modelValue:c.value,"onUpdate:modelValue":t[4]||=e=>c.value=e,label:A(Y)(`proxy.certificateDialog.pasteKey`),rows:4,placeholder:A(Y)(`proxy.certificateDialog.keyPlaceholder`),error:l.value.privateKey},null,8,[`modelValue`,`label`,`placeholder`,`error`]),n.error?(L(),z(fW,{key:0,tone:`danger`},{default:j(()=>[H(O(n.error),1)]),_:1})):U(``,!0)],32)]),_:1},8,[`open`,`title`,`description`]))}}),NZ={key:0,class:`sm:col-span-2`},PZ={key:1,class:`space-y-2 sm:col-span-2`},FZ={class:`flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},IZ={class:`min-w-0 text-xs font-medium text-ink`},LZ={class:`ml-1.5 font-mono text-2xs text-faint`},RZ={key:0,class:`mt-2`},zZ={key:1,class:`mt-2 divide-y divide-line-soft text-2xs`},BZ={class:`flex items-start justify-between gap-4 py-1`},VZ={class:`text-muted`},HZ={class:`min-w-0 text-right font-mono text-ink`},UZ={class:`flex items-start justify-between gap-4 py-1`},WZ={class:`text-muted`},GZ={class:`min-w-0 text-right font-mono text-ink`},KZ={class:`flex items-start justify-between gap-4 py-1`},qZ={class:`text-muted`},JZ={class:`font-mono text-ink`},YZ={class:`flex items-start justify-between gap-4 py-1`},XZ={class:`shrink-0 text-muted`},ZZ={class:`min-w-0 text-right font-mono text-ink`},QZ={key:1,class:`text-faint`},$Z={class:`mt-2 flex justify-end`},eQ={class:`text-xs font-semibold text-ink`},tQ={class:`mt-1 text-2xs leading-4 text-muted`},nQ={class:`mt-2.5 flex justify-end gap-1.5`},rQ={key:2,class:`space-y-2 sm:col-span-2`},iQ=N({__name:`CertificatePanel`,props:{certificates:{},disabled:{type:Boolean}},emits:[`changed`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=k(null),s=k(null),c=k(null),l=W(()=>n.certificates.map(e=>e.id));async function u(e,t){a.value=!0,o.value=null,s.value=null;try{return r(`changed`,await e()),s.value=t,!0}catch(e){return o.value=IM(e),!1}finally{a.value=!1}}async function d(e){await u(()=>vN(e.id,e.label,e.certificate,e.privateKey),Y(`proxy.certificate.stored`,{label:e.label}))&&(i.value=!1)}function f(e){c.value=null,u(()=>ZM(e.id),Y(`proxy.certificate.removed`,{name:IX(e)}))}return(e,t)=>(L(),z(QB,{title:A(Y)(`proxy.certificate.title`),description:A(Y)(`proxy.certificate.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled||a.value,onClick:t[0]||=e=>i.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.certificate.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[n.certificates.length===0?(L(),R(`div`,NZ,[V(AR,{compact:``,title:A(Y)(`proxy.certificate.emptyTitle`),description:A(Y)(`proxy.certificate.emptyDescription`)},{icon:j(()=>[V(A(xy),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled||a.value,onClick:t[1]||=e=>i.value=!0},{default:j(()=>[H(O(A(Y)(`proxy.certificateDialog.title`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`ul`,PZ,[(L(!0),R(I,null,P(n.certificates,e=>(L(),R(`li`,{key:e.id,class:`rounded-panel border border-line bg-page/40 p-3`},[B(`div`,FZ,[B(`p`,IZ,[H(O(A(IX)(e))+` `,1),B(`span`,LZ,O(e.id),1)]),e.daysRemaining===null?U(``,!0):(L(),R(`span`,{key:0,class:D([`text-2xs tabular-nums`,e.daysRemaining<14?`text-warn`:`text-faint`])},O(A(Y)(`proxy.certificate.daysLeft`,{days:e.daysRemaining})),3))]),e.error?(L(),R(`div`,RZ,[V(fW,{tone:`danger`},{default:j(()=>[H(O(e.error),1)]),_:2},1024)])):(L(),R(`dl`,zZ,[B(`div`,BZ,[B(`dt`,VZ,O(A(Y)(`proxy.certificate.subject`)),1),B(`dd`,HZ,O(e.subject??`—`),1)]),B(`div`,UZ,[B(`dt`,WZ,O(A(Y)(`proxy.certificate.issuer`)),1),B(`dd`,GZ,O(e.issuer??`—`),1)]),B(`div`,KZ,[B(`dt`,qZ,O(A(Y)(`proxy.certificate.validUntil`)),1),B(`dd`,JZ,O(e.validTo?e.validTo.slice(0,10):`—`),1)]),B(`div`,YZ,[B(`dt`,XZ,O(A(Y)(`proxy.certificate.covers`)),1),B(`dd`,ZZ,[e.hosts.length>0?(L(),R(I,{key:0},[H(O(e.hosts.join(`, `)),1)],64)):(L(),R(`span`,QZ,O(A(Y)(`proxy.certificate.noSans`)),1))])])])),B(`div`,$Z,[V(A(rg),{open:c.value===e.id,"onUpdate:open":t=>c.value=t?e.id:null},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`danger-ghost`,disabled:a.value,"aria-label":A(Y)(`proxy.certificate.removeAria`,{name:A(IX)(e)})},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`aria-label`])]),_:2},1024),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:D(A(Q)(`z-50 w-64 rounded-panel border border-line bg-raise p-3 shadow-float`,`focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`))},{default:j(()=>[B(`p`,eQ,O(A(Y)(`proxy.certificate.removeQuestion`,{name:A(IX)(e)})),1),B(`p`,tQ,O(A(Y)(`proxy.certificate.removeBody`)),1),B(`div`,nQ,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`danger`,loading:a.value,onClick:t=>f(e)},{default:j(()=>[H(O(A(Y)(`proxy.certificate.removeIt`)),1)]),_:1},8,[`loading`,`onClick`])])]),_:2},1032,[`class`])]),_:2},1024)]),_:2},1032,[`open`,`onUpdate:open`])])]))),128))])),o.value||s.value?(L(),R(`div`,rQ,[o.value?(L(),z(fW,{key:0,tone:`danger`},{default:j(()=>[H(O(o.value),1)]),_:1})):U(``,!0),s.value?(L(),z(fW,{key:1,tone:`ok`},{default:j(()=>[H(O(s.value),1)]),_:1})):U(``,!0)])):U(``,!0),V(MZ,{open:i.value,"onUpdate:open":t[2]||=e=>i.value=e,taken:l.value,busy:a.value,error:o.value,onSubmit:d},null,8,[`open`,`taken`,`busy`,`error`])]),_:1},8,[`title`,`description`]))}}),aQ={key:0,class:`sm:col-span-2`},oQ={key:0,class:`sm:col-span-2`},sQ={key:1,class:`sm:col-span-2`},cQ={class:`divide-y divide-line-soft text-xs sm:col-span-2`},lQ={class:`flex items-start justify-between gap-4 py-1.5`},uQ={class:`text-muted`},dQ={class:`font-mono text-xs text-ink`},fQ={class:`flex items-start justify-between gap-4 py-1.5`},pQ={class:`text-muted`},mQ={class:`text-right text-xs text-ink`},hQ={key:0,class:`flex items-start justify-between gap-4 py-1.5`},gQ={class:`text-muted`},_Q={class:`font-mono text-xs tabular-nums text-ink`},vQ={key:1,class:`flex items-start justify-between gap-4 py-1.5`},yQ={class:`text-muted`},bQ={class:`flex min-w-0 items-center gap-1.5`},xQ={class:`min-w-0 truncate font-mono text-2xs text-ink`},SQ={class:`flex items-start justify-between gap-4 py-1.5`},CQ={class:`text-muted`},wQ={class:`flex flex-wrap items-center justify-end gap-x-2 gap-y-1 text-right font-mono text-xs`},TQ=[`href`],EQ={key:0,class:`text-ink`},DQ={class:`flex items-start justify-between gap-4 py-1.5`},OQ={class:`text-muted`},kQ={class:`font-mono text-xs tabular-nums text-ink`},AQ={class:`flex items-start justify-between gap-4 py-1.5`},jQ={class:`text-muted`},MQ={class:`text-xs text-ink`},NQ={class:`flex flex-wrap gap-1.5 sm:col-span-2`},PQ=[`href`],FQ={key:3,class:`sm:col-span-2`},IQ={key:4,class:`text-2xs leading-4 text-faint sm:col-span-2`},LQ={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},RQ={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},zQ=N({__name:`EnginePanel`,props:{view:{},busy:{}},emits:[`act`],setup(e,{emit:t}){let n=e,r=t,i=W(()=>n.view?.engine??null),a=W(()=>n.view?.status??null),o=W(()=>n.view?.engines[0]??null),s=W(()=>a.value===null?null:gZ[a.value.state]),c=W(()=>i.value?.installed===!0),l=W(()=>i.value?.path??null),u=W(()=>l.value===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${l.value}`),d=[{key:`acme`,labelKey:`proxy.engine.acme`},{key:`internalCa`,labelKey:`proxy.engine.localCa`},{key:`dns01`,labelKey:`proxy.engine.dns01`},{key:`tcp`,labelKey:`proxy.engine.tcpUdp`}];return(e,t)=>(L(),z(QB,{title:A(Y)(`proxy.engine.title`),description:A(Y)(`proxy.engine.description`)},{actions:j(()=>[s.value?(L(),z(MG,{key:0,tone:s.value.tone,dot:``},{default:j(()=>[H(O(A(Y)(s.value.labelKey)),1)]),_:1},8,[`tone`])):U(``,!0)]),default:j(()=>[i.value===null?(L(),R(`div`,aQ,[V(fW,{tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.engine.notInFrame`)),1)]),_:1})])):(L(),R(I,{key:1},[i.value.error?(L(),R(`div`,oQ,[V(fW,{tone:`danger`,title:A(Y)(`proxy.engine.readFailed`)},{default:j(()=>[H(O(i.value.error),1)]),_:1},8,[`title`])])):U(``,!0),c.value?(L(),R(I,{key:2},[B(`dl`,cQ,[B(`div`,lQ,[B(`dt`,uQ,O(A(Y)(`proxy.engine.version`)),1),B(`dd`,dQ,O(i.value.version??A(Y)(`proxy.engine.notProbed`)),1)]),B(`div`,fQ,[B(`dt`,pQ,O(A(Y)(`proxy.engine.source`)),1),B(`dd`,mQ,O(i.value.source===`custom`?A(Y)(`proxy.engine.sourceCustom`):A(Y)(`proxy.engine.sourceDownloaded`)),1)]),i.value.bytes===null?U(``,!0):(L(),R(`div`,hQ,[B(`dt`,gQ,O(A(Y)(`proxy.engine.size`)),1),B(`dd`,_Q,O(A(zX)(i.value.bytes)),1)])),l.value?(L(),R(`div`,vQ,[B(`dt`,yQ,O(A(Y)(`proxy.engine.binary`)),1),B(`dd`,bQ,[B(`span`,xQ,O(l.value),1),V(AG,{value:l.value,label:A(Y)(`proxy.engine.copyPath`)},null,8,[`value`,`label`])])])):U(``,!0),B(`div`,SQ,[B(`dt`,CQ,O(A(Y)(`proxy.engine.address`)),1),B(`dd`,wQ,[(L(!0),R(I,null,P(a.value?.urls??[],e=>(L(),R(`a`,{key:e,href:e,target:`_blank`,rel:`noreferrer`,class:`text-accent underline decoration-line underline-offset-2 hover:decoration-accent`},O(e),9,TQ))),128)),!a.value||a.value.urls.length===0?(L(),R(`span`,EQ,`—`)):U(``,!0)])]),B(`div`,DQ,[B(`dt`,OQ,O(A(Y)(`proxy.engine.process`)),1),B(`dd`,kQ,O(a.value?.pid??`—`),1)]),B(`div`,AQ,[B(`dt`,jQ,O(A(Y)(`proxy.engine.certificates`)),1),B(`dd`,MQ,O(a.value?.certExpiryDays===null||a.value?.certExpiryDays===void 0?A(Y)(`proxy.engine.noCert`):A(Y)(`proxy.engine.expiresSoon`,{days:a.value.certExpiryDays})),1)])]),B(`div`,NQ,[(L(),R(I,null,P(d,e=>V(MG,{key:e.key,tone:o.value?.[e.key]?`ok`:`neutral`},{default:j(()=>[H(O(o.value?.[e.key]?`✓`:`✗`)+` `+O(A(Y)(e.labelKey)),1)]),_:2},1032,[`tone`])),64)),o.value?(L(),R(`a`,{key:0,class:`ml-1 self-center text-2xs text-accent underline decoration-line underline-offset-2`,href:o.value.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`proxy.engine.documentation`,{engine:o.value.label})),9,PQ)):U(``,!0)])],64)):(L(),R(`div`,sQ,[V(fW,{tone:`info`,title:A(Y)(`proxy.engine.notInstalled`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.installNote`,{engine:o.value?.label??i.value.id})),1)]),_:1},8,[`title`])])),a.value?.lastError?(L(),R(`div`,FQ,[V(fW,{tone:`danger`,title:A(Y)(`proxy.engine.failed`)},{default:j(()=>[H(O(a.value.lastError),1)]),_:1},8,[`title`])])):U(``,!0),c.value&&u.value?(L(),R(`p`,IQ,[H(O(A(Y)(`proxy.engine.setcapHint`))+` `,1),B(`code`,LQ,O(u.value),1),V(AG,{value:u.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])])):U(``,!0)],64)),B(`div`,RQ,[c.value?(L(),R(I,{key:1},[V($,{variant:`primary`,disabled:n.busy!==null||a.value?.state===`running`,loading:n.busy===`start`,onClick:t[1]||=e=>r(`act`,`start`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.start`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state===`off`||a.value?.state===`stopped`,loading:n.busy===`stop`,onClick:t[2]||=e=>r(`act`,`stop`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.stop`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`secondary`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`apply`,onClick:t[3]||=e=>r(`act`,`apply`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.apply`)),1)]),_:1},8,[`disabled`,`loading`]),V($,{variant:`ghost`,disabled:n.busy!==null||a.value?.state!==`running`,loading:n.busy===`revert`,title:A(Y)(`proxy.engine.revertHint`),onClick:t[4]||=e=>r(`act`,`revert`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.revert`)),1)]),_:1},8,[`disabled`,`loading`,`title`]),V($,{variant:`ghost`,disabled:n.busy!==null,loading:n.busy===`install`,onClick:t[5]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.update`)),1)]),_:1},8,[`disabled`,`loading`])],64)):(L(),z($,{key:0,variant:`primary`,loading:n.busy===`install`,disabled:n.busy!==null,onClick:t[0]||=e=>r(`act`,`install`)},{default:j(()=>[H(O(A(Y)(`proxy.engine.install`)),1)]),_:1},8,[`loading`,`disabled`]))])]),_:1},8,[`title`,`description`]))}}),BQ={class:`flex flex-wrap items-center gap-2 sm:col-span-2`},VQ={key:0,class:`text-2xs text-faint`},HQ={key:0,class:`sm:col-span-2`},UQ={class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},WQ={key:1},GQ={key:1,class:`sm:col-span-2`},KQ={key:3,class:`sm:col-span-2`},qQ={key:4,class:`sm:col-span-2`},JQ={key:5,class:`text-2xs leading-4 text-faint sm:col-span-2`},YQ={class:`text-2xs leading-4 text-faint sm:col-span-2`},XQ=N({__name:`ListenerPanel`,props:Va({emailHost:{},enginePath:{},dnsAccounts:{}},{form:{required:!0},formModifiers:{}}),emits:[`update:form`],setup(e){let t=e,n=lo(e,`form`),r=W(()=>t.dnsAccounts.filter(e=>e.writesTxt&&e.hasCredentials)),i=W(()=>dZ(n.value)),a=W(()=>t.enginePath===null?null:`sudo setcap 'cap_net_bind_service=+ep' ${t.enginePath}`),o=W(()=>BX(n.value.httpPort)||BX(n.value.httpsPort));function s(){n.value.httpPort=FX,n.value.httpsPort=PX}function c(){n.value.httpPort=80,n.value.httpsPort=443}function l(e,t){e===null||Number.isNaN(e)||e>=1&&e<=65535&&(n.value[t]=Math.trunc(e))}return(e,u)=>(L(),z(QB,{title:A(Y)(`proxy.listener.title`),description:A(Y)(`proxy.listener.description`)},{actions:j(()=>[i.value?(L(),z(MG,{key:0,tone:`info`},{default:j(()=>[H(O(A(Y)(`proxy.listener.unprivilegedPorts`)),1)]),_:1})):U(``,!0)]),default:j(()=>[V(CV,{modelValue:n.value.enabled,"onUpdate:modelValue":u[0]||=e=>n.value.enabled=e,label:A(Y)(`proxy.listener.run`),hint:A(Y)(`proxy.listener.runHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(lV,{"model-value":n.value.httpPort,label:A(Y)(`proxy.listener.httpPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpPortHint`),"onUpdate:modelValue":u[1]||=e=>l(e,`httpPort`)},null,8,[`model-value`,`label`,`hint`]),V(lV,{"model-value":n.value.httpsPort,label:A(Y)(`proxy.listener.httpsPort`),min:1,max:65535,hint:A(Y)(`proxy.listener.httpsPortHint`),"onUpdate:modelValue":u[2]||=e=>l(e,`httpsPort`)},null,8,[`model-value`,`label`,`hint`]),B(`div`,BQ,[V($,{size:`xs`,variant:`secondary`,onClick:s},{default:j(()=>[H(O(A(Y)(`proxy.listener.useFallback`,{http:A(FX),https:A(PX)})),1)]),_:1}),V($,{size:`xs`,variant:`ghost`,onClick:c},{default:j(()=>[H(O(A(Y)(`proxy.listener.useStandard`)),1)]),_:1}),i.value?(L(),R(`span`,VQ,O(A(Y)(`proxy.listener.forwardHint`)),1)):U(``,!0)]),o.value?(L(),R(`div`,HQ,[V(fW,{tone:`warn`,title:A(Y)(`proxy.listener.privilegedTitle`)},{default:j(()=>[V(HV,{k:`proxy.listener.privilegedBody`,params:{http:A(FX),https:A(PX)}},{how:j(()=>[a.value?(L(),R(I,{key:0},[B(`code`,UQ,O(a.value),1),V(AG,{value:a.value,label:A(Y)(`proxy.engine.copyCommand`),class:`ml-1 align-middle`},null,8,[`value`,`label`])],64)):(L(),R(`span`,WQ,[V(HV,{k:`proxy.listener.privilegedWithSetcap`},{command:j(()=>[...u[7]||=[B(`code`,{class:`rounded bg-black/10 px-1 py-0.5 font-mono dark:bg-white/10`},`setcap`,-1)]]),_:1})]))]),_:1},8,[`params`])]),_:1},8,[`title`])])):U(``,!0),V(bV,{modelValue:n.value.email,"onUpdate:modelValue":u[3]||=e=>n.value.email=e,label:A(Y)(`proxy.listener.email`),placeholder:A(Y)(`proxy.listener.emailPlaceholder`),hint:A(Y)(`proxy.listener.emailHint`),wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),t.emailHost===null?U(``,!0):(L(),R(`div`,GQ,[V(fW,{tone:`warn`,title:A(Y)(`proxy.listener.emailNeededTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.emailNeededBody`,{host:t.emailHost})),1)]),_:1},8,[`title`])])),V(CV,{modelValue:n.value.staging,"onUpdate:modelValue":u[4]||=e=>n.value.staging=e,label:A(Y)(`proxy.listener.staging`),hint:A(Y)(`proxy.listener.stagingHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:n.value.dns01,"onUpdate:modelValue":u[5]||=e=>n.value.dns01=e,label:A(Y)(`proxy.listener.dns01`),hint:A(Y)(`proxy.listener.dns01Hint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),n.value.dns01?(L(),z(bV,{key:2,modelValue:n.value.resolvers,"onUpdate:modelValue":u[6]||=e=>n.value.resolvers=e,label:A(Y)(`proxy.listener.resolvers`),placeholder:A(Y)(`proxy.listener.resolversPlaceholder`),hint:A(Y)(`proxy.listener.resolversHint`),spellcheck:`false`,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`])):U(``,!0),n.value.dns01&&r.value.length===0?(L(),R(`div`,KQ,[V(fW,{tone:`warn`,title:A(Y)(`proxy.listener.noAccountTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.noAccountBody`)),1)]),_:1},8,[`title`])])):n.value.dns01&&r.value.length>1?(L(),R(`div`,qQ,[V(fW,{tone:`info`,title:A(Y)(`proxy.listener.manyAccountsTitle`)},{default:j(()=>[H(O(A(Y)(`proxy.listener.manyAccountsBody`)),1)]),_:1},8,[`title`])])):U(``,!0),n.value.dns01?(L(),R(`p`,JQ,O(A(Y)(`proxy.listener.accountNote`)),1)):U(``,!0),B(`p`,YQ,O(A(Y)(`proxy.listener.pendingNote`)),1)]),_:1},8,[`title`,`description`]))}}),ZQ={class:`space-y-3`},QQ={key:1,class:`text-2xs leading-4 text-faint sm:col-span-2`},$Q={class:`text-2xs leading-4 text-faint sm:col-span-2`},e$={key:4,class:`text-2xs leading-4 text-warn sm:col-span-2`},t$=N({__name:`RouteDialog`,props:Va({draft:{},others:{},workspaces:{},dnsAccounts:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:Va([`save`],[`update:open`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`open`),a=k(UX()),o=k({}),s=W(()=>n.draft!==null),c=W(()=>(n.workspaces.find(e=>e.id===a.value.workspace)?.servers??[]).map(e=>({value:e.id,label:e.id}))),l=W(()=>mZ.map(e=>({value:e.value,label:Y(e.labelKey)}))),u=W(()=>hZ.map(e=>({value:e.value,label:Y(e.labelKey)}))),d=W(()=>a.value.tls===`off`?Y(`proxy.tls.hintOff`):a.value.tls===`manual`?Y(`proxy.tls.hintManual`):a.value.host.trim().length===0?Y(`proxy.tls.hintEmpty`):VX(a.value.host)?Y(`proxy.tls.hintPublic`):Y(`proxy.tls.hintLocal`)),f=W(()=>a.value.tls===`auto`&&VX(a.value.host)),p=W(()=>xZ(n.dnsAccounts)),m=W(()=>n.dnsAccounts.find(e=>`${e.workspace}/${e.account}`===a.value.dnsAccount)),h=W(()=>m.value===void 0?a.value.dnsAccount.length>0?Y(`proxy.account.gone`):Y(`proxy.account.emptyHint`):m.value.writesTxt?m.value.hasCredentials?Y(`proxy.account.through`,{provider:m.value.provider}):Y(`proxy.account.noCredentialsYet`,{provider:m.value.provider}):Y(`proxy.account.cannotWrite`,{provider:m.value.provider}));M(i,e=>{e&&(a.value=n.draft===null?UX():EX(n.draft),a.value.workspace.length===0&&(a.value.workspace=n.workspaces[0]?.id??``),o.value={})}),M(()=>a.value.workspace,()=>{c.value.some(e=>e.value===a.value.server)||(a.value.server=c.value[0]?.value??``)});function g(){let e=a.value.host.trim().toLowerCase(),t={...a.value,host:e,id:uZ(iZ(e),n.others.map(e=>e.id)),workspace:a.value.target===`server`?a.value.workspace:``,server:a.value.target===`server`?a.value.server:``,url:a.value.target===`external`?a.value.url.trim():``},s=fZ(t,{others:n.others,workspaces:n.workspaces,messages:TZ});o.value=s,!(Object.keys(s).length>0)&&(r(`save`,t),i.value=!1)}return(e,t)=>(L(),z(LV,{open:i.value,"onUpdate:open":t[9]||=e=>i.value=e,title:s.value?A(Y)(`proxy.routeDialog.titleEdit`):A(Y)(`proxy.routeDialog.titleAdd`),description:A(Y)(`proxy.routeDialog.description`),width:`w-[min(92vw,34rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[8]||=e=>i.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,onClick:g},{default:j(()=>[H(O(s.value?A(Y)(`proxy.routeDialog.save`):A(Y)(`proxy.routes.add`)),1)]),_:1})]),default:j(()=>[B(`div`,ZQ,[V(bV,{modelValue:a.value.host,"onUpdate:modelValue":t[0]||=e=>a.value.host=e,label:A(Y)(`proxy.routeDialog.hostname`),placeholder:A(Y)(`proxy.routeDialog.hostnamePlaceholder`),autocomplete:`off`,spellcheck:`false`,error:o.value.host,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`error`]),V(bV,{modelValue:a.value.path,"onUpdate:modelValue":t[1]||=e=>a.value.path=e,label:A(Y)(`proxy.routeDialog.path`),placeholder:A(Y)(`proxy.routeDialog.pathPlaceholder`),hint:A(Y)(`proxy.routeDialog.pathHint`),spellcheck:`false`,error:o.value.path,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`]),V(hV,{modelValue:a.value.target,"onUpdate:modelValue":t[2]||=e=>a.value.target=e,label:A(Y)(`proxy.routeDialog.target`),options:l.value},null,8,[`modelValue`,`label`,`options`]),V(hV,{modelValue:a.value.tls,"onUpdate:modelValue":t[3]||=e=>a.value.tls=e,label:A(Y)(`proxy.routeDialog.tls`),options:u.value,hint:d.value},null,8,[`modelValue`,`label`,`options`,`hint`]),f.value?(L(),z(hV,{key:0,modelValue:a.value.dnsAccount,"onUpdate:modelValue":t[4]||=e=>a.value.dnsAccount=e,label:A(Y)(`proxy.routeDialog.dnsAccount`),options:p.value,hint:h.value},null,8,[`modelValue`,`label`,`options`,`hint`])):a.value.tls===`auto`?(L(),R(`p`,QQ,O(A(Y)(`proxy.routeDialog.localNote`)),1)):U(``,!0),a.value.target===`server`?(L(),R(I,{key:2},[V(hV,{modelValue:a.value.workspace,"onUpdate:modelValue":t[5]||=e=>a.value.workspace=e,label:A(Y)(`proxy.routeDialog.workspace`),options:n.workspaces.map(e=>({value:e.id,label:e.label})),error:o.value.workspace},null,8,[`modelValue`,`label`,`options`,`error`]),V(hV,{modelValue:a.value.server,"onUpdate:modelValue":t[6]||=e=>a.value.server=e,label:A(Y)(`proxy.routeDialog.server`),options:c.value,disabled:c.value.length===0,error:o.value.server??(c.value.length===0?A(Y)(`proxy.routeDialog.noServers`):null)},null,8,[`modelValue`,`label`,`options`,`disabled`,`error`]),B(`p`,$Q,O(A(Y)(`proxy.routeDialog.stoppedNote`)),1)],64)):U(``,!0),a.value.target===`external`?(L(),z(bV,{key:3,modelValue:a.value.url,"onUpdate:modelValue":t[7]||=e=>a.value.url=e,label:A(Y)(`proxy.routeDialog.upstream`),placeholder:A(Y)(`proxy.routeDialog.upstreamPlaceholder`),hint:A(Y)(`proxy.routeDialog.upstreamHint`),spellcheck:`false`,error:o.value.url,wide:``},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`error`])):U(``,!0),a.value.target===`panel`?(L(),R(`p`,e$,O(A(Y)(`proxy.routeDialog.panelNote`)),1)):U(``,!0),o.value.form?(L(),z(fW,{key:5,tone:`danger`},{default:j(()=>[H(O(o.value.form),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),n$={class:`text-xs font-semibold text-ink`},r$={class:`mt-1 text-2xs leading-4 text-muted`},i$={class:`mt-1 text-2xs leading-4 text-warn`},a$={class:`mt-2.5 flex justify-end gap-1.5`},o$=N({__name:`RetryCertificateButton`,props:{host:{},retryIn:{},busy:{type:Boolean,default:!1}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,i=k(!1);function a(){i.value=!1,r(`confirm`)}return(e,t)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":t[0]||=e=>i.value=e},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`secondary`,loading:n.busy,disabled:n.busy},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.force`)),1)]),_:1},8,[`loading`,`disabled`])]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-3 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`p`,n$,O(A(Y)(`proxy.retryButton.question`,{host:n.host})),1),B(`p`,r$,O(A(Y)(`proxy.retryButton.body`,{retryIn:n.retryIn})),1),B(`p`,i$,O(A(Y)(`proxy.retryButton.warning`)),1),B(`div`,a$,[V(A(ig),{"as-child":``},{default:j(()=>[V($,{size:`xs`,variant:`ghost`},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.leave`)),1)]),_:1})]),_:1}),V($,{size:`xs`,variant:`primary`,loading:n.busy,onClick:a},{default:j(()=>[H(O(A(Y)(`proxy.retryButton.now`)),1)]),_:1},8,[`loading`])])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),s$={key:0,class:`sm:col-span-2`},c$={class:`list-disc space-y-0.5 pl-4`},l$={key:1,class:`sm:col-span-2`},u$={key:2,class:`overflow-x-auto sm:col-span-2`},d$={class:`w-full text-left text-xs`},f$={class:`text-2xs text-faint`},p$={class:`py-1 pr-3 font-medium`},m$={class:`py-1 pr-3 font-medium`},h$={class:`py-1 pr-3 font-medium`},g$={class:`py-1 pr-3 font-medium`},_$={class:`py-1 pr-3 font-medium`},v$={class:`py-1 pr-3 font-medium`},y$={class:`py-1 font-medium`},b$={class:`sr-only`},x$={class:`py-1.5 pr-3`},S$={class:`font-mono text-xs text-ink`},C$=[`href`,`title`],w$={key:2,class:`text-accent`},T$={class:`font-mono text-2xs text-faint`},E$={class:`py-1.5 pr-3 text-2xs text-muted`},D$={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},O$={class:`py-1.5 pr-3 text-2xs text-muted`},k$={key:0,class:`mt-0.5`},A$={key:1,class:`mt-1`},j$={class:`py-1.5 pr-3`},M$={class:`py-1.5 pr-3`},N$={class:`py-1.5`},P$={class:`flex items-center justify-end gap-1`},F$=N({__name:`RouteTable`,props:{routes:{},views:{},workspaces:{},httpPort:{},httpsPort:{},disabled:{type:Boolean}},emits:[`add`,`edit`,`remove`,`retry`,`toggle`],setup(e,{emit:t}){let n=e,r=t;function i(e){return e===`fallback`}let a=W(()=>n.routes.map(e=>{let t=n.views.find(t=>t.route.id===e.id)??null;return{route:e,view:t,meta:t===null?null:_Z[t.status],target:EZ(e,n.workspaces),tls:CZ(e),certificate:t===null?null:yZ(t),url:ZX(e,n.httpPort,n.httpsPort)}})),o=W(()=>a.value.filter(e=>e.view?.status===`error`));return(e,t)=>(L(),z(QB,{title:A(Y)(`proxy.routes.title`),description:A(Y)(`proxy.routes.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`secondary`,disabled:n.disabled,onClick:t[0]||=e=>r(`add`)},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(` `+O(A(Y)(`proxy.routes.add`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[o.value.length>0?(L(),R(`div`,s$,[V(fW,{tone:`danger`,title:A(Y)(`proxy.routes.cannotSaveTitle`)},{default:j(()=>[B(`ul`,c$,[(L(!0),R(I,null,P(o.value,e=>(L(),R(`li`,{key:e.route.id},O(e.view?.message??A(Y)(`proxy.routes.cannotRoute`,{host:e.route.host})),1))),128))])]),_:1},8,[`title`])])):U(``,!0),a.value.length===0?(L(),R(`div`,l$,[V(AR,{compact:``,title:A(Y)(`proxy.routes.emptyTitle`),description:A(Y)(`proxy.routes.emptyDescription`)},{icon:j(()=>[V(A(tb),{class:`size-5`})]),action:j(()=>[V($,{variant:`primary`,disabled:n.disabled,onClick:t[1]||=e=>r(`add`)},{default:j(()=>[H(O(A(Y)(`proxy.routes.addFirst`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`title`,`description`])])):(L(),R(`div`,u$,[B(`table`,d$,[B(`thead`,null,[B(`tr`,f$,[B(`th`,p$,O(A(Y)(`proxy.routes.columnHostname`)),1),B(`th`,m$,O(A(Y)(`proxy.routes.columnTarget`)),1),B(`th`,h$,O(A(Y)(`proxy.routes.columnUpstream`)),1),B(`th`,g$,O(A(Y)(`proxy.routes.columnTls`)),1),B(`th`,_$,O(A(Y)(`proxy.routes.columnState`)),1),B(`th`,v$,O(A(Y)(`proxy.routes.columnOn`)),1),B(`th`,y$,[B(`span`,b$,O(A(Y)(`common.actions`)),1)])])]),B(`tbody`,null,[(L(!0),R(I,null,P(a.value,e=>(L(),R(`tr`,{key:e.route.key,class:`border-t border-line-soft align-top`},[B(`td`,x$,[B(`p`,S$,[e.url!==null&&e.route.enabled?(L(),R(`a`,{key:0,href:e.url,target:`_blank`,rel:`noopener noreferrer`,class:`transition-colors duration-150 hover:text-accent hover:underline`,title:A(Y)(`proxy.routes.openInTab`,{url:e.url})},O(e.route.host),9,C$)):(L(),R(I,{key:1},[H(O(e.route.host.trim().length>0?e.route.host:A(Y)(`proxy.routes.noHostname`)),1)],64)),e.route.path.length>0?(L(),R(`span`,w$,O(e.route.path),1)):U(``,!0)]),B(`p`,T$,O(e.route.id),1)]),B(`td`,E$,O(e.target),1),B(`td`,D$,O(e.view?.upstream??`—`),1),B(`td`,O$,[H(O(e.tls)+` `,1),e.certificate?(L(),R(`div`,k$,[V(MG,{tone:e.certificate.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.certificate.labelKey)),1)]),_:2},1032,[`tone`]),e.certificate.message?(L(),R(`p`,{key:0,class:D([`mt-0.5 text-2xs`,e.certificate.tone===`danger`?`text-danger`:`text-faint`])},O(e.certificate.message),3)):U(``,!0),i(e.view?.certificate?.state)?(L(),R(`div`,A$,[V(o$,{host:e.route.host,"retry-in":A(DZ)(e.certificate?.retryInMinutes??null),busy:n.disabled,onConfirm:t=>r(`retry`,e.route)},null,8,[`host`,`retry-in`,`busy`,`onConfirm`])])):U(``,!0)])):U(``,!0)]),B(`td`,j$,[e.meta?(L(),z(MG,{key:0,tone:e.meta.tone,dot:``},{default:j(()=>[H(O(A(Y)(e.meta.labelKey)),1)]),_:2},1032,[`tone`])):(L(),z(MG,{key:1,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`proxy.status.unapplied`)),1)]),_:1})),e.view?.message?(L(),R(`p`,{key:2,class:D([`mt-0.5 text-2xs`,e.view.status===`error`?`text-danger`:`text-warn`])},O(e.view.message),3)):U(``,!0)]),B(`td`,M$,[V(CV,{"model-value":e.route.enabled,label:A(Y)(`proxy.routes.toggle`,{name:e.route.host||e.route.id}),"sr-only":``,disabled:n.disabled,"onUpdate:modelValue":t=>r(`toggle`,e.route,t)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])]),B(`td`,N$,[B(`span`,P$,[V($,{size:`xs`,variant:`ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.edit`,{name:e.route.host||e.route.id}),onClick:t=>r(`edit`,e.route)},{default:j(()=>[V(A(Ny),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:n.disabled,"aria-label":A(Y)(`proxy.routes.remove`,{name:e.route.host||e.route.id}),onClick:t=>r(`remove`,e.route)},{default:j(()=>[V(A($y),{class:`size-3.5`})]),_:1},8,[`disabled`,`aria-label`,`onClick`])])])]))),128))])])]))]),_:1},8,[`title`,`description`]))}}),I$={class:`min-h-full`},L$={class:`mx-auto w-full max-w-5xl px-4 pb-6 pt-5 sm:px-6`},R$={class:`mb-5`},z$={class:`text-xl font-semibold tracking-tight text-ink`},B$={class:`mt-1 text-xs text-muted`},V$={class:`mt-1 text-2xs leading-4 text-faint`},H$={key:2,class:`space-y-6`},U$={key:0,class:`sticky bottom-0 z-30 border-t border-line bg-panel/95 backdrop-blur`},W$={class:`mx-auto flex w-full max-w-5xl flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3 sm:px-6`},G$={class:`min-w-0 flex-1`},K$={class:`text-xs text-muted`},q$={class:`font-mono tabular-nums text-ink`},J$={key:0,class:`mt-0.5 text-xs text-danger`},Y$={key:1,class:`mt-0.5 text-xs text-danger`},X$={key:2,class:`mt-0.5 text-xs text-ok`},Z$={class:`flex shrink-0 items-center gap-2`},Q$=N({__name:`ProxyView`,setup(e){let t=gI(),n=EP(),r=k(null),i=k(null),a=k(null),o=k(!1),s=k(null),c=k({enabled:!1,httpPort:80,httpsPort:443,email:``,staging:!1,dns01:!1,resolvers:``}),l=k([]),u=k(!1),d=k(null),f=W(()=>t.proxy.value??r.value),p=W(()=>f.value?.config??null),m=W(()=>f.value?.engine.path??null),h=W(()=>t.workspaces.value.map(e=>({id:e.id,label:e.label,servers:e.servers.map(e=>({id:e.id}))}))),g=W(()=>YX(c.value,l.value)?RX(l.value):null),_=W(()=>p.value!==null&&$X(p.value.routes,l.value,C())!==null),v=W(()=>{if(p.value===null)return 0;let e=JX(p.value,c.value,l.value,C());return e===null?0:Object.keys(e).filter(e=>e!==`routes`).length+(e.routes===void 0?0:1)}),y=W(()=>(f.value?.routes??[]).filter(e=>e.status===`error`)),b=W(()=>_.value?[]:y.value.map(e=>e.message??Y(`proxy.routes.cannotRoute`,{host:e.route.host}))),x={},S;function C(){return S}function w(){let e=p.value;if(e===null)return;OB(x.listener,{...c.value})||(Object.assign(c.value,SZ(e)),x.listener={...c.value});let t=oZ(l.value);OB(x.routes,t)||(l.value=GX(e.routes),x.routes=oZ(l.value),S=e.routes.map(e=>({...e})))}M(f,w,{immediate:!0});async function T(){i.value=null;try{r.value=await nN()}catch(e){i.value=IM(e)}}ia(()=>{t.proxy.value===null&&T()});let ee={install:()=>aN(),start:gN,stop:_N,apply:GM,revert:pN},te={install:`proxy.view.engineInstalled`,start:`proxy.view.engineStarting`,stop:`proxy.view.engineStopping`,apply:`proxy.view.configApplied`,revert:`proxy.view.configReverted`};async function ne(e){if(s.value===null){s.value=e,a.value=null;try{r.value=await ee[e](),n.success(Y(te[e])),await t.refresh()}catch(e){a.value=IM(e)}finally{s.value=null}}}let re=k(null),ie=k(null);async function ae(){let e=p.value,i=e===null?null:JX(e,c.value,l.value,C());if(i===null||o.value||b.value.length>0)return;let a=e===null?[]:eZ(e.routes,l.value,C());if(a.length>0)ie.value=null,re.value=Y(`proxy.view.concurrentEdit`,{ids:a.join(`, `)});else{o.value=!0,re.value=null,ie.value=null;try{r.value=await cN(i),await t.refresh(),ie.value=Y(`proxy.view.settingsSaved`),n.success(Y(`proxy.view.settingsSavedToast`)),delete x.listener,delete x.routes,w()}catch(e){re.value=IM(e)}finally{o.value=!1}}}function oe(){re.value=null,ie.value=null,delete x.listener,delete x.routes,w()}function se(){d.value=null,u.value=!0}function ce(e){d.value=e,u.value=!0}function le(e){l.value=KX(l.value,d.value,e),d.value=null}function E(e){l.value=l.value.filter(t=>t.key!==e.key)}async function ue(e){s.value=`apply`;try{r.value=await fN(e.id),await t.refresh(),n.success(Y(`proxy.view.retryAsked`,{host:e.host}))}catch(e){n.failure(Y(`proxy.view.retryFailed`),IM(e))}finally{s.value=null}}function de(e,t){e.enabled=t}async function fe(e){r.value=e,await t.refresh()}return(e,t)=>(L(),R(`div`,I$,[B(`div`,L$,[B(`header`,R$,[B(`h1`,z$,O(A(Y)(`proxy.view.title`)),1),B(`p`,B$,O(A(Y)(`proxy.view.description`)),1),B(`p`,V$,O(A(Y)(`proxy.view.dnsNote`)),1)]),i.value?(L(),z(fW,{key:0,tone:`danger`,title:A(Y)(`proxy.view.readFailed`),class:`mb-4`},{default:j(()=>[H(O(i.value),1)]),_:1},8,[`title`])):U(``,!0),f.value===null&&i.value===null?(L(),z(fW,{key:1,tone:`info`,class:`mb-4`},{default:j(()=>[H(O(A(Y)(`proxy.view.reading`)),1)]),_:1})):U(``,!0),f.value===null?U(``,!0):(L(),R(`div`,H$,[V(zQ,{view:f.value,busy:s.value,onAct:ne},null,8,[`view`,`busy`]),a.value?(L(),z(fW,{key:0,tone:`danger`},{default:j(()=>[H(O(a.value),1)]),_:1})):U(``,!0),V(XQ,{form:c.value,"onUpdate:form":t[0]||=e=>c.value=e,"engine-path":m.value,"email-host":g.value,"dns-accounts":f.value?.dnsAccounts??[]},null,8,[`form`,`engine-path`,`email-host`,`dns-accounts`]),V(F$,{routes:l.value,views:f.value.routes,workspaces:h.value,"http-port":f.value.config.httpPort,"https-port":f.value.config.httpsPort,disabled:o.value,onAdd:se,onEdit:ce,onRemove:E,onRetry:ue,onToggle:de},null,8,[`routes`,`views`,`workspaces`,`http-port`,`https-port`,`disabled`]),V(iQ,{certificates:f.value.certificates,disabled:o.value,onChanged:fe},null,8,[`certificates`,`disabled`])]))]),f.value===null?U(``,!0):(L(),R(`div`,U$,[B(`div`,W$,[B(`div`,G$,[B(`p`,K$,[v.value>0?(L(),R(I,{key:0},[B(`span`,q$,O(v.value),1),H(` `+O(A(PF)(`proxy.view.fieldChanged`,v.value)),1)],64)):(L(),R(I,{key:1},[H(O(A(Y)(`proxy.view.noChanges`)),1)],64))]),b.value.length>0?(L(),R(`p`,J$,O(b.value.join(` · `)),1)):re.value?(L(),R(`p`,Y$,O(re.value),1)):ie.value?(L(),R(`p`,X$,O(ie.value),1)):U(``,!0)]),B(`div`,Z$,[V($,{variant:`ghost`,disabled:v.value===0||o.value,onClick:oe},{default:j(()=>[H(O(A(Y)(`proxy.view.discard`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,disabled:v.value===0||b.value.length>0,loading:o.value,onClick:ae},{default:j(()=>[H(O(A(Y)(`proxy.view.save`)),1)]),_:1},8,[`disabled`,`loading`])])])])),V(t$,{open:u.value,"onUpdate:open":t[1]||=e=>u.value=e,draft:d.value,others:l.value.filter(e=>e.key!==d.value?.key),workspaces:h.value,"dns-accounts":f.value?.dnsAccounts??[],onSave:le},null,8,[`open`,`draft`,`others`,`workspaces`,`dns-accounts`])]))}}),$$={class:`mb-4 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`},e1={class:`min-w-0`},t1={class:`text-sm font-semibold text-ink`},n1={class:`mt-0.5 text-2xs leading-4 text-muted`},r1={class:`flex items-center gap-2`},i1={class:`font-mono tabular-nums`},a1={key:1,class:`text-2xs text-faint`},o1={class:`flex flex-col gap-3`},s1={key:0,class:`mt-3 rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 font-mono text-2xs leading-4 text-danger`},c1={class:`mt-4 flex items-center justify-end gap-2 border-t border-line pt-3.5`},l1={class:`max-h-[60dvh] overflow-auto`},u1={key:0,class:`divide-y divide-line-soft`},d1={class:`font-mono text-xs text-ink`},f1={class:`ml-auto font-mono text-xs text-muted line-through`},p1={class:`font-mono text-xs text-accent`},m1={key:1,class:`text-xs text-muted`},h1=N({__name:`ServerConfigEditor`,props:{serverId:{},workspaceId:{},config:{}},emits:[`saved`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=[`restart`,`health`,`stop`],a=gI(),o=k(!1),s=k(null);function c(e){return e>0?Math.round(e/1024/1024):null}function l(e){return{label:e.label??``,command:e.command,cwd:e.cwd,args:e.args.join(`
47
+ `),env:IB(e.env),dataEnvs:IB(e.dataEnvs),backupPaths:e.backupPaths.join(`
48
48
  `),backupIgnoreGenerated:e.backupIgnoreGenerated!==!1,dependsOn:e.dependsOn.join(`, `),envFile:e.envFile,maxRssMb:c(e.resources.maxRssBytes),port:e.port,bind:e.bind,onPortConflict:e.onPortConflict,logBufferLines:e.logBufferLines,enabled:e.enabled,autostart:e.autostart,persistent:e.persistent===!0,bootstrapEnabled:e.bootstrap!==null&&e.bootstrap!==void 0,bootstrapCommand:e.bootstrap?.command??``,bootstrapArgs:(e.bootstrap?.args??[]).join(`
49
- `),bootstrapEnv:bB(e.bootstrap?.env??{}),bootstrapTimeoutMs:e.bootstrap?.timeoutMs??12e4,bootstrapRunOnce:e.bootstrap?.runOnce??!0,dumpEnabled:e.dump!==null&&e.dump!==void 0,dumpCommand:e.dump?.command??``,dumpArgs:(e.dump?.args??[]).join(`
50
- `),dumpEnv:bB(e.dump?.env??{}),dumpTimeoutMs:e.dump?.timeoutMs??6e5,loadEnabled:e.load!==null&&e.load!==void 0,loadCommand:e.load?.command??``,loadArgs:(e.load?.args??[]).join(`
51
- `),loadEnv:bB(e.load?.env??{}),loadTimeoutMs:e.load?.timeoutMs??6e5}}let u=tn(l(n.config)),d=k({...n.config.restart}),f=k(Rz(n.config.health)),p=k({...n.config.stop}),m=W(()=>{let e=[{value:`local`,label:Y(`bind.local`)},{value:`lan`,label:Y(`bind.lan`)}];return/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n.config.bind)&&e.push({value:n.config.bind,label:Y(`bind.explicit`,{bind:n.config.bind})}),e});function h(){let e=Number.isFinite(u.maxRssMb)?u.maxRssMb:0,t=Number.isFinite(u.logBufferLines)&&u.logBufferLines>=50?u.logBufferLines:50,n=Number.isFinite(u.bootstrapTimeoutMs)?u.bootstrapTimeoutMs:0,r=Number.isFinite(u.dumpTimeoutMs)?u.dumpTimeoutMs:0,i=Number.isFinite(u.loadTimeoutMs)?u.loadTimeoutMs:0;return{label:u.label.trim().length===0?null:u.label.trim(),command:u.command.trim(),cwd:u.cwd.trim()===``?`.`:u.cwd.trim(),args:yB(u.args),env:xB(u.env),dataEnvs:xB(u.dataEnvs),backupPaths:yB(u.backupPaths),backupIgnoreGenerated:u.backupIgnoreGenerated,dependsOn:SB(u.dependsOn),envFile:u.envFile.trim(),resources:{maxRssBytes:e>0?Math.round(e*1024*1024):0},port:u.port===null||Number.isNaN(u.port)?null:u.port,bind:u.bind,onPortConflict:u.onPortConflict,logBufferLines:t,enabled:u.enabled,autostart:u.autostart,persistent:u.persistent,restart:{...d.value},health:Rz(f.value),stop:{...p.value},bootstrap:u.bootstrapEnabled?{command:u.bootstrapCommand.trim(),args:yB(u.bootstrapArgs),env:xB(u.bootstrapEnv),timeoutMs:n,runOnce:u.bootstrapRunOnce}:null,dump:u.dumpEnabled?{command:u.dumpCommand.trim(),args:yB(u.dumpArgs),env:xB(u.dumpEnv),timeoutMs:r}:null,load:u.loadEnabled?{command:u.loadCommand.trim(),args:yB(u.loadArgs),env:xB(u.loadEnv),timeoutMs:i}:null}}function g(e,t){let r=n.config[t]??{},i=e[t]??{},a={};for(let[e,t]of Object.entries(i))r[e]!==t&&(a[e]=t);return Object.keys(a).length>0?a:null}function _(e){for(let t of i)g(e,t)===null&&delete e[t];return Cz(n.config,e)}function v(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}let y=W(()=>_(h())),b=W(()=>Ez(y.value)),x=W(()=>b.value>0),S=W(()=>Tz(y.value,n.config)),C=k(!1),w=T(n.config);function T(e){return JSON.parse(JSON.stringify(e))}function ee(e){Object.assign(u,l(e)),d.value={...e.restart},f.value=Rz(e.health),p.value={...e.stop},w=T(e),s.value=null}M(()=>n.config,e=>{v(e,w)||ee(e)});async function te(){s.value=null,o.value=!0;try{let e=h(),t=Tj(e);if(t instanceof J.errors){s.value=t.summary;return}let i=_(e);if(Object.keys(i).length===0){r(`saved`);return}if(await a.saveConfig(n.workspaceId,n.serverId,i),a.lastError.value!==null){s.value=a.lastError.value;return}r(`saved`)}finally{o.value=!1}}return(e,t)=>(L(),R(I,null,[B(`form`,{class:`border-t border-line bg-page/40 px-4 py-4`,onSubmit:_u(te,[`prevent`])},[B(`header`,N$,[B(`div`,P$,[B(`h2`,F$,O(A(Y)(`editor.title`)),1),B(`p`,I$,[V(EV,{k:`editor.description`},{file:j(()=>[...t[42]||=[B(`span`,{class:`font-mono`},`servers.config.json`,-1)]]),_:1})])]),B(`div`,L$,[b.value>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-2xs text-warn underline decoration-warn/40 underline-offset-2 transition-colors duration-150 hover:text-ink`,onClick:t[0]||=e=>C.value=!0},[B(`span`,R$,O(b.value),1),H(` `+O(A(bF)(`editor.unsaved`,b.value)),1)])):(L(),R(`span`,z$,O(A(Y)(`editor.inSync`)),1))])]),B(`div`,B$,[V(IB,{title:A(Y)(`editor.process`),description:A(Y)(`editor.processDescription`),columns:2},{default:j(()=>[V(iV,{modelValue:u.label,"onUpdate:modelValue":t[1]||=e=>u.label=e,label:A(Y)(`common.label`),placeholder:A(Y)(`editor.labelPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(iV,{modelValue:u.command,"onUpdate:modelValue":t[2]||=e=>u.command=e,label:A(Y)(`common.command`),placeholder:`node`,required:``,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(iV,{modelValue:u.cwd,"onUpdate:modelValue":t[3]||=e=>u.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(iV,{modelValue:u.envFile,"onUpdate:modelValue":t[4]||=e=>u.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(TV,{modelValue:u.args,"onUpdate:modelValue":t[5]||=e=>u.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`editor.argumentsHint`),placeholder:`-p
52
- {port}`},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:u.env,"onUpdate:modelValue":t[6]||=e=>u.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:u.dataEnvs,"onUpdate:modelValue":t[7]||=e=>u.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:u.backupPaths,"onUpdate:modelValue":t[8]||=e=>u.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:u.backupIgnoreGenerated,"onUpdate:modelValue":t[9]||=e=>u.backupIgnoreGenerated=e,label:A(Y)(`serverForm.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(iV,{modelValue:u.dependsOn,"onUpdate:modelValue":t[10]||=e=>u.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:u.maxRssMb,"onUpdate:modelValue":t[11]||=e=>u.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`editor.portTitle`),description:A(Y)(`editor.portDescription`),columns:2},{default:j(()=>[V(qB,{modelValue:u.port,"onUpdate:modelValue":t[12]||=e=>u.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`hint`]),V($B,{modelValue:u.bind,"onUpdate:modelValue":t[13]||=e=>u.bind=e,label:A(Y)(`serverForm.bindAddress`),options:m.value,hint:A(Y)(`editor.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V($B,{modelValue:u.onPortConflict,"onUpdate:modelValue":t[14]||=e=>u.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(qB,{modelValue:u.logBufferLines,"onUpdate:modelValue":t[15]||=e=>u.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`editor.lifecycle`),description:A(Y)(`editor.lifecycleDescription`),columns:3},{default:j(()=>[V(sV,{modelValue:u.enabled,"onUpdate:modelValue":t[16]||=e=>u.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`)},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:u.autostart,"onUpdate:modelValue":t[17]||=e=>u.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`)},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:u.persistent,"onUpdate:modelValue":t[18]||=e=>u.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(cV,{restart:d.value,"onUpdate:restart":t[19]||=e=>d.value=e,health:f.value,"onUpdate:health":t[20]||=e=>f.value=e,stop:p.value,"onUpdate:stop":t[21]||=e=>p.value=e},null,8,[`restart`,`health`,`stop`]),V(IB,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`serverForm.bootstrapDescription`),columns:2},{default:j(()=>[V(sV,{modelValue:u.bootstrapEnabled,"onUpdate:modelValue":t[22]||=e=>u.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`serverForm.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.bootstrapEnabled?(L(),R(I,{key:0},[V(iV,{modelValue:u.bootstrapCommand,"onUpdate:modelValue":t[23]||=e=>u.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(qB,{modelValue:u.bootstrapTimeoutMs,"onUpdate:modelValue":t[24]||=e=>u.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(sV,{modelValue:u.bootstrapRunOnce,"onUpdate:modelValue":t[25]||=e=>u.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0),u.bootstrapEnabled?(L(),z(TV,{key:1,modelValue:u.bootstrapArgs,"onUpdate:modelValue":t[26]||=e=>u.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0),u.bootstrapEnabled?(L(),z(TV,{key:2,modelValue:u.bootstrapEnv,"onUpdate:modelValue":t[27]||=e=>u.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0)]),_:1},8,[`title`,`description`]),V(IB,{title:A(Y)(`serverForm.backupHooks`),description:A(Y)(`serverForm.backupHooksDescription`),columns:2},{default:j(()=>[V(sV,{modelValue:u.dumpEnabled,"onUpdate:modelValue":t[28]||=e=>u.dumpEnabled=e,label:A(Y)(`serverForm.dumpEnabled`),hint:A(Y)(`serverForm.dumpEnabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.dumpEnabled?(L(),R(I,{key:0},[V(iV,{modelValue:u.dumpCommand,"onUpdate:modelValue":t[29]||=e=>u.dumpCommand=e,label:A(Y)(`serverForm.dumpCommand`),placeholder:`mongodump`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(qB,{modelValue:u.dumpTimeoutMs,"onUpdate:modelValue":t[30]||=e=>u.dumpTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(TV,{modelValue:u.dumpArgs,"onUpdate:modelValue":t[31]||=e=>u.dumpArgs=e,label:A(Y)(`serverForm.dumpArgs`),rows:2,hint:A(Y)(`serverForm.dumpArgsHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:u.dumpEnv,"onUpdate:modelValue":t[32]||=e=>u.dumpEnv=e,label:A(Y)(`serverForm.hookEnv`),rows:2,wide:``},null,8,[`modelValue`,`label`])],64)):U(``,!0),V(sV,{modelValue:u.loadEnabled,"onUpdate:modelValue":t[33]||=e=>u.loadEnabled=e,label:A(Y)(`serverForm.loadEnabled`),hint:A(Y)(`serverForm.loadEnabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.loadEnabled?(L(),R(I,{key:1},[V(iV,{modelValue:u.loadCommand,"onUpdate:modelValue":t[34]||=e=>u.loadCommand=e,label:A(Y)(`serverForm.loadCommand`),placeholder:`mongorestore`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(qB,{modelValue:u.loadTimeoutMs,"onUpdate:modelValue":t[35]||=e=>u.loadTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(TV,{modelValue:u.loadArgs,"onUpdate:modelValue":t[36]||=e=>u.loadArgs=e,label:A(Y)(`serverForm.loadArgs`),rows:2,hint:A(Y)(`serverForm.loadArgsHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(TV,{modelValue:u.loadEnv,"onUpdate:modelValue":t[37]||=e=>u.loadEnv=e,label:A(Y)(`serverForm.hookEnv`),rows:2,wide:``},null,8,[`modelValue`,`label`])],64)):U(``,!0)]),_:1},8,[`title`,`description`])]),s.value?(L(),R(`p`,V$,O(s.value),1)):U(``,!0),B(`div`,H$,[V($,{variant:`ghost`,onClick:t[38]||=e=>r(`cancel`)},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{type:`submit`,variant:`primary`,disabled:o.value||!x.value,loading:o.value},{default:j(()=>[H(O(A(Y)(`editor.save`)),1)]),_:1},8,[`disabled`,`loading`])])],32),V(xV,{open:C.value,"onUpdate:open":t[41]||=e=>C.value=e,title:A(Y)(`editor.changesTitle`),description:A(Y)(`editor.changesDescription`),width:`w-[min(92vw,42rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[39]||=e=>C.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:S.value.length===0||o.value,loading:o.value,onClick:t[40]||=e=>{te(),C.value=!1}},{default:j(()=>[H(O(A(bF)(`editor.saveChanges`,S.value.length)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,U$,[S.value.length>0?(L(),R(`ul`,W$,[(L(!0),R(I,null,P(S.value,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,G$,O(e.path),1),B(`span`,K$,O(A(VR)(e.from)),1),t[43]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,q$,O(A(VR)(e.to)),1)]))),128))])):(L(),R(`p`,J$,O(A(Y)(`editor.nothingToSave`)),1))])]),_:1},8,[`open`,`title`,`description`])],64))}}),X$={key:0,class:`mx-auto max-w-3xl p-4 sm:p-5`},Z$={key:1,class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},Q$={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},$$={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},e1={class:`font-mono text-xs text-faint`},t1=[`href`],n1={class:`px-2 py-1.5`},r1={class:`mb-1 text-2xs text-faint`},i1={class:`flex flex-col gap-0.5`},a1=[`onClick`],o1={class:`space-y-2`},s1={key:0,class:`rounded-control border border-line bg-hover px-3 py-2 text-2xs leading-4 text-muted`},c1={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-control border border-danger/25 bg-danger-soft px-3 py-2`},l1={class:`min-w-0 flex-1 text-2xs leading-4 text-danger`},u1={key:2,class:`rounded-control border border-warn/25 bg-warn-soft px-3 py-2 text-2xs leading-4 text-warn`},d1={class:`grid grid-cols-2 gap-x-4 gap-y-3 p-4 sm:grid-cols-4 lg:grid-cols-6`},f1={class:`truncate text-2xs text-faint`},p1={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},m1={class:`text-sm font-semibold text-ink`},h1={class:`text-2xs text-muted`},g1={class:`grid grid-cols-1 gap-4 sm:grid-cols-3`},_1={class:`flex items-center justify-between gap-3`},v1=[`title`],y1={key:1,class:`space-y-4`},b1={class:`text-sm font-semibold text-ink`},x1={class:`text-2xs text-muted`},S1={key:0,class:`max-h-96 overflow-auto rounded-control border border-line bg-page/60 p-3 font-mono text-2xs leading-5 text-muted`},C1={key:1,class:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`},w1={class:`text-2xs text-faint`},T1=[`title`],E1={key:2,class:`grid grid-cols-1 gap-4 lg:grid-cols-3`},D1={class:`text-sm font-semibold text-ink`},O1={class:`text-2xs text-muted`},k1={class:`text-sm font-semibold text-ink`},A1={key:0,class:`flex flex-wrap gap-1.5`},j1={key:1,class:`text-xs text-muted`},M1={class:`text-xs text-muted`},N1=N({__name:`ServerDetailView`,setup(e){let t=$g(),n=tI(),r=gI(),i=W(()=>String(t.params.id??``));M([i,()=>n.appState.value],()=>{let e=i.value;if(e.length===0||r.serverById(e)!==void 0)return;let t=n.workspaces.value.filter(t=>t.servers.some(t=>t.id===e));t.length===1&&r.select(t[0].id)},{immediate:!0});let a=W(()=>r.serverById(i.value)),o=W(()=>a.value?.config),s=W(()=>{let e=o.value;return e?.label&&e.label.length>0?e.label:i.value}),c=k(`output`),l=k(!1),u=k(!1),d=k(!1),f=k(!1),p=eI(r.activeId,()=>a.value?i.value:null),m=p.version,h=W(()=>(m.value,p.lines())),g=W(()=>r.seriesOf(i.value)),_=n.now,v=W(()=>a.value?WV(a.value,GV()):null),y=W(()=>g.value.cpu),b=W(()=>g.value.rss),x=W(()=>g.value.probe),S=W(()=>Math.max(100,(n.host.value?.cpus??1)*100)),C=W(()=>{let e=a.value;return!e||e.startedAt===null||e.status!==`running`?`—`:NR(_.value-e.startedAt)}),w=W(()=>a.value?.status===`running`),T={unknown:`common.unknown`,free:`views.serverDetail.portFree`,"in-use":`views.serverDetail.portInUse`},ee=W(()=>{let e=a.value;if(!e)return[];let t=CF(e),n=[{key:`pid`,label:Y(`views.serverDetail.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:C.value},{key:`status`,label:Y(`common.status`),value:Y(GL[e.status].labelKey)},{key:`health`,label:Y(`views.serverDetail.health`),value:Y(KL[e.health].labelKey)},{key:`port`,label:Y(`views.serverDetail.portState`),value:Y(T[e.portState]??`common.unknown`)},{key:`probe`,label:Y(`views.serverDetail.lastProbe`),value:t.responseMs===null?`—`:`${t.responseMs} ms`},{key:`rss`,label:`RSS`,value:zR(t.rssBytes)},{key:`procs`,label:Y(`views.serverDetail.processes`),value:t.processes===null?`—`:String(t.processes)},{key:`restarts`,label:Y(`views.serverDetail.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`up24`,label:Y(`views.serverDetail.uptime24`),value:gR(e.history.uptimeRatio)},{key:`crashes`,label:Y(`views.serverDetail.crashes24`),value:String(e.history.crashes)},{key:`lastcrash`,label:Y(`views.serverDetail.lastCrash`),value:FR(e.history.lastCrashAt,_.value)}];return e.nextRetryAt!==null&&n.push({key:`retry`,label:Y(`views.serverDetail.nextAttempt`),value:PR(e.nextRetryAt,_.value)}),e.health===`unhealthy`&&e.unhealthySince!==null&&n.push({key:`unhealthy`,label:Y(`views.serverDetail.unhealthyFor`),value:NR(_.value-e.unhealthySince)}),n}),te=W(()=>JSON.stringify(o.value??{},null,2)),ne=W(()=>o.value?`${o.value.command} ${o.value.args.join(` `)}`.trim():``),re=W(()=>{let e=o.value?.bind??`local`,t=[{value:`local`,label:Y(`views.serverDetail.bindLocal`)},{value:`lan`,label:Y(`views.serverDetail.bindLan`)}];return e!==`local`&&e!==`lan`&&t.push({value:e,label:Y(`views.serverDetail.bindCustom`,{bind:e})}),t});async function ie(e){f.value=!0;try{await n[e](r.activeId.value,i.value)}finally{f.value=!1}}async function ae(){d.value=!1,await r.removeServer(i.value)}async function oe(){let e=a.value;if(e){f.value=!0;try{await r.freePort(e.id)}finally{f.value=!1}}}let se=W(()=>IN(r.activeId.value,i.value,`${i.value}.log`)),ce=[{value:`output`,labelKey:`views.serverDetail.sectionOutput`},{value:`config`,labelKey:`views.serverDetail.sectionConfig`},{value:`history`,labelKey:`views.serverDetail.sectionHistory`}].map(e=>({value:e.value,label:Y(e.labelKey)}));return(e,t)=>{let n=ha(`RouterLink`);return a.value?(L(),R(`div`,Z$,[V(tU,{title:s.value,"back-to":A(D2)(A(r).activeId.value,`servers`),"back-label":A(Y)(`views.serverDetail.allServers`)},{badges:j(()=>[V(gH,{status:a.value.status,health:a.value.health},null,8,[`status`,`health`]),a.value.adopted?(L(),z(_H,{key:0,label:A(Y)(`views.serverDetail.detachedHint`)},{default:j(()=>[B(`span`,Q$,O(A(Y)(`views.serverDetail.detached`)),1)]),_:1},8,[`label`])):U(``,!0),a.value.config.persistent?(L(),z(_H,{key:1,label:A(Y)(`views.serverDetail.persistentHint`)},{default:j(()=>[B(`span`,$$,O(A(Y)(`views.serverDetail.persistent`)),1)]),_:1},8,[`label`])):U(``,!0),B(`span`,e1,O(a.value.id),1),v.value?(L(),R(`a`,{key:2,href:v.value,target:`_blank`,rel:`noreferrer`,class:`inline-flex items-center gap-1 font-mono text-xs text-accent hover:underline`},[H(O(v.value)+` `,1),V(A(my),{class:`size-3`})],8,t1)):U(``,!0)]),actions:j(()=>[V($,{variant:`primary`,disabled:f.value||!o.value?.enabled||[`running`,`starting`].includes(a.value.status),onClick:t[0]||=e=>ie(`start`)},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.start`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||a.value.status===`stopped`,onClick:t[1]||=e=>ie(`stop`)},{default:j(()=>[V(A(Jy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.stop`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||!o.value?.enabled,onClick:t[2]||=e=>ie(`restart`)},{default:j(()=>[V(A(zy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.restart`)),1)]),_:1},8,[`disabled`]),V(_H,{label:A(Y)(`views.serverDetail.editHint`)},{default:j(()=>[V($,{variant:l.value?`secondary`:`ghost`,onClick:t[3]||=e=>{l.value=!l.value,c.value=`config`}},{default:j(()=>[V(A(Ny),{class:`size-3.5`}),H(O(l.value?A(Y)(`views.serverDetail.closeEditor`):A(Y)(`common.edit`)),1)]),_:1},8,[`variant`])]),_:1},8,[`label`]),V(A(pg),null,{default:j(()=>[V(A(vg),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`views.serverDetail.moreActions`,{label:s.value})},{default:j(()=>[V(A(py),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(gg),null,{default:j(()=>[V(A(mg),{"side-offset":4,align:`end`,class:`z-50 min-w-56 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[4]||=e=>A(r).setEnabled(a.value.id,!a.value.config.enabled)},{default:j(()=>[H(O(o.value?.enabled?A(Y)(`views.serverDetail.disableServer`):A(Y)(`views.serverDetail.enableServer`)),1)]),_:1}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[5]||=e=>A(r).setAutostart(a.value.id,!a.value.config.autostart)},{default:j(()=>[H(O(o.value?.autostart?A(Y)(`views.serverDetail.removeAutostart`):A(Y)(`views.serverDetail.autostart`)),1)]),_:1}),V(A(_g),{class:`my-1 h-px bg-line`}),B(`div`,n1,[B(`p`,r1,O(A(Y)(`views.serverDetail.bind`)),1),B(`div`,i1,[(L(!0),R(I,null,P(re.value,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D([`rounded-control px-2 py-1 text-left font-mono text-2xs transition-colors duration-150 hover:bg-hover`,e.value===o.value?.bind?`text-accent`:`text-muted`]),onClick:t=>A(r).setBind(a.value.id,e.value)},O(e.label),11,a1))),128))])]),V(A(_g),{class:`my-1 h-px bg-line`}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:t[6]||=e=>d.value=!0},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`views.serverDetail.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,[`title`,`back-to`,`back-label`]),B(`div`,o1,[o.value&&!o.value.enabled?(L(),R(`p`,s1,O(A(Y)(`views.serverDetail.disabledNote`)),1)):U(``,!0),a.value.lastError?(L(),R(`div`,c1,[B(`p`,l1,O(a.value.lastError),1),a.value.status===`conflict`&&a.value.config.port!==null?(L(),z(YV,{key:0,port:a.value.config.port,busy:f.value,onConfirm:oe},null,8,[`port`,`busy`])):U(``,!0)])):U(``,!0),a.value.health===`unhealthy`?(L(),R(`p`,u1,[a.value.unhealthySince===null?(L(),R(I,{key:1},[H(O(A(Y)(`views.serverDetail.probeFailed`)),1)],64)):(L(),R(I,{key:0},[H(O(A(Y)(`views.serverDetail.probeFailedFor`,{duration:A(NR)(A(_)-a.value.unhealthySince)})),1)],64))])):U(``,!0)]),V(aU,{class:`p-0`},{default:j(()=>[B(`dl`,d1,[(L(!0),R(I,null,P(ee.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,f1,O(e.label),1),B(`dd`,p1,O(e.value),1)]))),128))])]),_:1}),V(aU,null,{header:j(()=>[B(`h2`,m1,O(A(Y)(`views.serverDetail.telemetry`)),1),B(`p`,h1,O(A(Y)(`views.serverDetail.telemetryNote`)),1)]),default:j(()=>[B(`div`,g1,[V(fH,{label:A(Y)(`common.cpu`),values:y.value,format:A(BR),max:S.value,"color-class":`text-cpu`,height:40,"empty-hint":w.value?void 0:A(Y)(`metric.notRunning`)},null,8,[`label`,`values`,`format`,`max`,`empty-hint`]),V(fH,{label:A(Y)(`views.serverDetail.memoryRss`),values:b.value,format:A(zR),"color-class":`text-mem`,height:40,"empty-hint":w.value?void 0:A(Y)(`metric.notRunning`)},null,8,[`label`,`values`,`format`,`empty-hint`]),V(fH,{label:A(Y)(`views.serverDetail.healthProbe`),values:x.value,format:e=>e===null?`—`:`${e} ms`,"color-class":`text-probe`,height:40,"empty-hint":A(Y)(`serverCard.notProbed`)},null,8,[`label`,`values`,`format`,`empty-hint`])])]),_:1}),B(`div`,_1,[V(ZW,{modelValue:c.value,"onUpdate:modelValue":t[7]||=e=>c.value=e,options:A(ce),size:`md`},null,8,[`modelValue`,`options`]),B(`p`,{class:`hidden font-mono text-2xs text-faint sm:block`,title:ne.value},O(ne.value),9,v1)]),c.value===`output`?(L(),z(uY,{key:0,lines:h.value,version:A(m),live:``,clearable:``,"download-url":a.value.config.logBufferLines>0?se.value:void 0,"download-name":`${a.value.id}.log`,"empty-hint":w.value?A(Y)(`views.serverDetail.waitingFirstLine`):A(Y)(`views.serverDetail.neverWritten`),"min-height":`22rem`,onClear:t[8]||=e=>A(r).clearLogs(a.value.id)},null,8,[`lines`,`version`,`download-url`,`download-name`,`empty-hint`])):c.value===`config`?(L(),R(`div`,y1,[l.value?(L(),z(Y$,{key:0,"server-id":a.value.id,"workspace-id":A(r).activeId.value,config:a.value.config,onSaved:t[9]||=e=>l.value=!1,onCancel:t[10]||=e=>l.value=!1},null,8,[`server-id`,`workspace-id`,`config`])):(L(),z(aU,{key:1},{header:j(()=>[B(`h2`,b1,O(A(Y)(`views.serverDetail.effectiveConfig`)),1),B(`p`,x1,O(A(Y)(`views.serverDetail.effectiveConfigNote`)),1)]),actions:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[11]||=e=>u.value=!u.value},{default:j(()=>[V(A(cy),{class:`size-3`}),H(O(u.value?A(Y)(`views.serverDetail.fields`):A(Y)(`views.serverDetail.rawJson`)),1)]),_:1}),V(pG,{value:te.value,label:A(Y)(`views.serverDetail.copyJson`)},null,8,[`value`,`label`]),V($,{size:`xs`,variant:`primary`,onClick:t[12]||=e=>l.value=!0},{default:j(()=>[V(A(Ny),{class:`size-3`}),H(O(A(Y)(`common.edit`)),1)]),_:1})]),default:j(()=>[u.value?(L(),R(`pre`,S1,O(te.value),1)):(L(),R(`dl`,C1,[(L(!0),R(I,null,P([{label:A(Y)(`views.serverDetail.fieldCommand`),value:o.value?.command},{label:A(Y)(`views.serverDetail.fieldArgs`),value:o.value?.args.join(` `)||`—`},{label:A(Y)(`views.serverDetail.fieldCwd`),value:o.value?.cwd},{label:A(Y)(`views.serverDetail.fieldEnv`),value:Object.keys(o.value?.env??{}).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDataEnvs`),value:Object.entries(o.value?.dataEnvs??{}).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldEnvFile`),value:o.value?.envFile||`—`},{label:A(Y)(`views.serverDetail.fieldPortBind`),value:`${o.value?.port??A(Y)(`common.none`)} · ${o.value?.bind}`},{label:A(Y)(`views.serverDetail.fieldOnPortConflict`),value:o.value?.onPortConflict},{label:A(Y)(`views.serverDetail.fieldLogBuffer`),value:A(bF)(`logs.lines`,o.value?.logBufferLines??0)},{label:A(Y)(`views.serverDetail.fieldRssLimit`),value:o.value?.resources.maxRssBytes?A(zR)(o.value.resources.maxRssBytes):A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldHealth`),value:o.value?.health.enabled?`${o.value.health.mode} every ${o.value.health.intervalMs} ms`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldRestart`),value:o.value?.restart.enabled?`${o.value.restart.maxRetries} retries, ×${o.value.restart.factor}`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldStop`),value:o.value?`${o.value.stop.signal} after ${o.value.stop.graceMs} ms`:`—`},{label:A(Y)(`views.serverDetail.fieldBootstrap`),value:o.value?.bootstrap?`${o.value.bootstrap.command} ${o.value.bootstrap.args.join(` `)}`:A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldBackupPaths`),value:o.value?.backupPaths.join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDependsOn`),value:o.value?.dependsOn.join(`, `)||`—`}],e=>(L(),R(`div`,{key:e.label,class:`min-w-0 border-b border-line-soft pb-1.5 last:border-0`},[B(`dt`,w1,O(e.label),1),B(`dd`,{class:`truncate font-mono text-xs text-ink`,title:String(e.value)},O(e.value),9,T1)]))),128))]))]),_:1}))])):(L(),R(`div`,E1,[V(aU,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,D1,O(A(Y)(`views.serverDetail.eventHistory`)),1),B(`p`,O1,O(A(Y)(`views.serverDetail.eventHistoryNote`)),1)]),default:j(()=>[V(gz,{servers:[a.value],now:A(_),limit:30},null,8,[`servers`,`now`])]),_:1}),V(aU,null,{header:j(()=>[B(`h2`,k1,O(A(Y)(`views.serverDetail.dependencies`)),1)]),default:j(()=>[o.value&&o.value.dependsOn.length>0?(L(),R(`div`,A1,[(L(!0),R(I,null,P(o.value.dependsOn,e=>(L(),z(n,{key:e,to:A(D2)(A(r).activeId.value,`servers`,e),class:`rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},{default:j(()=>[H(O(e),1)]),_:2},1032,[`to`]))),128))])):(L(),R(`p`,j1,[V(EV,{k:`views.serverDetail.startsOnItsOwn`},{code:j(()=>[...t[15]||=[B(`code`,null,`dependsOn`,-1)]]),_:1})]))]),_:1})])),V(xV,{open:d.value,"onUpdate:open":t[14]||=e=>d.value=e,title:A(Y)(`views.serverDetail.removeTitle`),description:A(Y)(`views.serverDetail.removeDescription`,{label:s.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[13]||=e=>d.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ae},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`p`,M1,O(A(Y)(`views.serverDetail.removeNote`)),1)]),_:1},8,[`open`,`title`,`description`])])):(L(),R(`div`,X$,[V(hR,{title:A(Y)(`views.serverDetail.goneTitle`),description:A(Y)(`views.serverDetail.goneDescription`,{id:i.value})},{action:j(()=>[V(n,{to:A(D2)(A(r).activeId.value,`servers`)},{default:j(()=>[V($,{variant:`primary`},{default:j(()=>[H(O(A(Y)(`views.serverDetail.backToServers`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`title`,`description`])]))}}}),P1={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},F1={class:`flex flex-wrap items-center gap-2`},I1={class:`relative ml-auto w-full sm:w-64`},L1=[`placeholder`,`aria-label`],R1=[`aria-label`],z1={class:`mt-0.5`},B1={class:`mt-2 space-y-1`},V1={class:`rounded-control bg-black/10 px-1.5 py-0.5 font-mono text-2xs dark:bg-white/10`},H1={class:`font-mono text-2xs text-muted`},U1={key:0,class:`text-2xs text-faint`},W1={key:1,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},G1={key:4,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},K1=N({__name:`ServersView`,setup(e){let t=tI(),n=gI(),{servers:r}=n,i=W(()=>n.selected.value?.orphans??[]),a=k(!1),o=k(``),s=k(`all`),c=[{value:`all`,labelKey:`views.servers.filterAll`},{value:`running`,labelKey:`views.servers.filterRunning`},{value:`stopped`,labelKey:`views.servers.filterStopped`},{value:`attention`,labelKey:`views.servers.filterAttention`},{value:`disabled`,labelKey:`views.servers.filterDisabled`}],l=W(()=>t.appState.value===null),u=W(()=>{let e=o.value.trim().toLowerCase();return r.value.filter(t=>s.value===`running`&&t.status!==`running`||s.value===`stopped`&&![`stopped`,`stopping`].includes(t.status)||s.value===`disabled`&&t.config.enabled||s.value===`attention`&&t.status!==`crashed`&&t.status!==`conflict`&&t.health!==`unhealthy`?!1:e.length===0||`${t.id} ${t.config.label??``} ${t.config.command} ${t.config.port??``}`.toLowerCase().includes(e))}),d=W(()=>({all:r.value.length,running:r.value.filter(e=>e.status===`running`).length,attention:r.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`).length})),f=W(()=>c.map(e=>({value:e.value,label:`${Y(e.labelKey)}${e.value===`all`?` ${d.value.all}`:e.value===`running`?` ${d.value.running}`:e.value===`attention`&&d.value.attention>0?` ${d.value.attention}`:``}`})));return(e,c)=>(L(),R(`div`,P1,[V(tU,{title:A(Y)(`nav.servers`),description:A(Y)(`views.servers.description`,{workspace:A(n).selected.value?.label??A(Y)(`nav.workspace`)})},{actions:j(()=>[V($,{variant:`ghost`,onClick:c[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V(KU,{label:A(Y)(`views.actions.stopAll`),"confirm-label":A(Y)(`views.actions.stopAllIgnore`),"alternative-label":A(Y)(`views.actions.stopAllWithPersistent`),title:A(Y)(`views.actions.stopAllQuestion`),hint:A(Y)(`views.actions.stopAllHint`),variant:`ghost`,"confirm-variant":`danger`,onConfirm:c[1]||=e=>A(n).stopAll(),onAlternative:c[2]||=e=>A(n).stopAll({withPersistent:!0})},null,8,[`label`,`confirm-label`,`alternative-label`,`title`,`hint`]),V($,{variant:`primary`,onClick:c[3]||=e=>a.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),B(`div`,F1,[V(ZW,{modelValue:s.value,"onUpdate:modelValue":c[4]||=e=>s.value=e,options:f.value},null,8,[`modelValue`,`options`]),B(`div`,I1,[V(A(Vy),{class:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),wr(B(`input`,{"onUpdate:modelValue":c[5]||=e=>o.value=e,type:`search`,placeholder:A(Y)(`views.servers.filterPlaceholder`),class:D([`pl-8`,[A(HB)]]),"aria-label":A(Y)(`views.servers.filterAria`)},null,10,L1),[[nu,o.value]]),o.value.length>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute right-1.5 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-control text-faint hover:text-ink`,"aria-label":A(Y)(`views.servers.clearFilter`),onClick:c[6]||=e=>o.value=``},[V(A(nb),{class:`size-3.5`})],8,R1)):U(``,!0)])]),i.value.length>0?(L(),z(YU,{key:0,tone:`warn`,title:A(Y)(`views.servers.orphansTitle`)},{default:j(()=>[B(`p`,z1,O(A(Y)(`views.servers.orphansDescription`)),1),B(`ul`,B1,[(L(!0),R(I,null,P(i.value,e=>(L(),R(`li`,{key:e.serverId,class:`flex flex-wrap items-center gap-2`},[B(`code`,V1,O(e.serverId),1),B(`span`,H1,O(A(Y)(`views.servers.orphanPid`,{pid:e.pid})),1),e.startedAt===null?U(``,!0):(L(),R(`span`,U1,O(A(Y)(`views.servers.orphanStartedAt`,{when:A(LR)(e.startedAt)})),1)),V($,{size:`xs`,variant:`ghost`,class:`ml-auto`,onClick:r=>A(t).stopOrphan(A(n).activeId.value,e.serverId)},{default:j(()=>[H(O(A(Y)(`views.servers.stopOrphan`)),1)]),_:1},8,[`onClick`])]))),128))])]),_:1},8,[`title`])):U(``,!0),l.value?(L(),R(`div`,W1,[(L(),R(I,null,P(4,e=>V(oU,{key:e,class:`h-72 w-full`,rounded:`rounded-panel`})),64))])):A(r).length===0?(L(),z(hR,{key:2,title:A(Y)(`views.servers.emptyTitle`),description:A(Y)(`views.servers.emptyDescription`)},{icon:j(()=>[V(A(Hy),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:c[7]||=e=>a.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):u.value.length===0?(L(),z(hR,{key:3,compact:``,title:A(Y)(`views.servers.noMatchTitle`),description:A(Y)(`views.servers.noMatchDescription`)},{action:j(()=>[V($,{onClick:c[8]||=e=>{o.value=``,s.value=`all`}},{default:j(()=>[H(O(A(Y)(`views.servers.clearFilters`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,G1,[(L(!0),R(I,null,P(u.value,e=>(L(),z(JH,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))])),V(HV,{open:a.value,"onUpdate:open":c[9]||=e=>a.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])]))}}),q1=0;function J1(){return q1+=1,`ddns-row-${q1}`}function Y1(){return J1()}function X1(e){let t=structuredClone(dn(e));return t.domains=(t.domains??[]).map(e=>({...e,key:e.key??J1()})),t}function Z1(e){let t=structuredClone(dn(e));return{...t,domains:t.domains.map(({key:e,...t})=>t)}}function Q1(e,t){return e===null||t===null?e===t:JSON.stringify(Z1(e))===JSON.stringify(Z1(t))}var $1={intervalMs:3e5,ttl:1};function e0(e,t){return e===null||Number.isNaN(e)?$1[t]:e}var t0={class:`space-y-3`},n0={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},r0={class:`mb-3`},i0={class:`text-xs font-semibold text-ink`},a0={class:`mt-0.5 text-2xs leading-4 text-muted`},o0={key:0,class:`divide-y divide-line-soft`},s0={class:`min-w-0`},c0={class:`font-mono text-xs text-ink`},l0={class:`text-2xs text-faint`},u0={key:0},d0={class:`ml-auto flex items-center gap-2`},f0={key:1,class:`text-2xs text-muted`},p0={class:`mt-3 grid grid-cols-1 gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},m0={class:`mt-1.5 text-2xs text-faint`},h0={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},g0={class:`mb-3`},_0={class:`text-xs font-semibold text-ink`},v0={class:`mt-0.5 text-2xs leading-4 text-muted`},y0={key:0,class:`space-y-2`},b0={class:`flex flex-wrap items-end gap-2`},x0={class:`min-w-40 flex-1`},S0={class:`w-44 shrink-0`},C0={class:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1`},w0={key:1,class:`text-2xs text-muted`},T0={class:`mt-3 grid grid-cols-1 gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},E0={key:1,class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},D0={class:`mb-2 flex flex-wrap items-center gap-x-3 gap-y-1`},O0={class:`text-xs font-semibold text-ink`},k0={key:0,class:`text-2xs text-muted`},A0={key:1,class:`font-mono text-2xs text-faint`},j0={key:2,class:`font-mono text-2xs text-faint`},M0={key:3,class:`ml-auto text-2xs text-faint`},N0={class:`overflow-x-auto`},P0={class:`w-full text-left text-xs`},F0={class:`text-2xs text-faint`},I0={class:`py-1 pr-3 font-medium`},L0={class:`py-1 pr-3 font-medium`},R0={class:`py-1 pr-3 font-medium`},z0={class:`py-1 pr-3 font-medium`},B0={class:`py-1 font-medium`},V0={class:`py-1.5 pr-3 font-mono text-2xs text-ink`},H0={class:`py-1.5 pr-3 text-2xs text-muted`},U0={class:`py-1.5 pr-3`},W0={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},G0={class:`py-1.5 text-2xs text-faint`},K0={class:`space-y-3`},q0={class:`text-2xs leading-4 text-muted`},J0=[`href`],Y0=N({__name:`DdnsSection`,props:{patch:{default:null},patchModifiers:{},baseline:{default:null},baselineModifiers:{}},emits:[`update:patch`,`update:baseline`],setup(e,{expose:t}){let n=lo(e,`patch`),r=lo(e,`baseline`),i={pending:{labelKey:`settings.ddns.statePending`,tone:`neutral`},ok:{labelKey:`settings.ddns.stateOk`,tone:`ok`},unchanged:{labelKey:`settings.ddns.stateUnchanged`,tone:`neutral`},skipped:{labelKey:`settings.ddns.stateSkipped`,tone:`warn`},error:{labelKey:`settings.ddns.stateError`,tone:`danger`}},a=tI(),o=gI(),s=fP(),c=k(null),l=k(null),u=k(null),d=k(null),f=k(!1),p=tn({id:``,provider:`cloudflare`}),m=tn({host:``,account:``}),h=k(null),g=k({}),_=k(!1),v=k(null),y=W(()=>c.value?.providers??[]),b=W(()=>l.value?.accounts??[]),x=W(()=>l.value?.domains??[]),S=W(()=>b.value.map(e=>e.id).join(`,`)),C=W(()=>y.value.map(e=>({value:e.id,label:e.label}))),w=W(()=>b.value.map(e=>({value:e.id,label:e.id}))),T=W(()=>o.selected.value?.ddns??c.value?.status??null),ee=W(()=>l.value!==null&&r.value!==null&&!Q1(l.value,r.value)),te=W(()=>/^[a-z0-9][a-z0-9_-]*$/.test(p.id)&&!b.value.some(e=>e.id===p.id)),ne=W(()=>m.host.includes(`.`)&&m.account.length>0&&!x.value.some(e=>e.host.toLowerCase()===m.host.trim().toLowerCase())),re=W({get:()=>h.value!==null,set:e=>{e||(h.value=null)}}),ie=W(()=>h.value===null?[]:ae(h.value.provider)?.fields??[]);function ae(e){return y.value.find(t=>t.id===e)??null}function oe(e){let t=b.value.find(t=>t.id===e.account);return t===void 0?null:ae(t.provider)}function se(e){return ae(e.provider)?.label??e.provider}function ce(e){return c.value?.credentials.includes(e)===!0}function le(e){return x.value.filter(t=>t.account===e).length}function E(e,t,n){let r=n?[...new Set([...e.types,t])]:e.types.filter(e=>e!==t);e.types=r.length>0?r:e.types}function ue(e,t,n){n==null||n===``?delete e[t]:e[t]=n}function de(e,t,n){e!==null&&(e[t]=e0(n,t))}function fe(){n.value=l.value===null||r.value===null||Q1(l.value,r.value)?null:Z1(l.value)}function pe(e,t=!1){c.value=e,r.value=X1(e.config),t||(l.value=X1(e.config)),fe()}async function me(){u.value=null;try{pe(await HN(o.activeId.value)),p.provider=C.value[0]?.value??`cloudflare`,m.account=b.value[0]?.id??``}catch(e){u.value=CM(e)}}ia(()=>{me()}),M(()=>o.activeId.value,(e,t)=>{e!==t&&e.length>0&&me()}),M(l,fe,{deep:!0}),M(S,()=>{b.value.some(e=>e.id===m.account)||(m.account=b.value[0]?.id??``)});function he(){te.value&&l.value!==null&&(l.value.accounts.push({id:p.id,provider:p.provider,label:``}),p.id=``)}function ge(e){l.value===null||le(e.id)>0||(l.value.accounts=l.value.accounts.filter(t=>t.id!==e.id))}function _e(){ne.value&&l.value!==null&&(l.value.domains.push({host:m.host.trim().toLowerCase(),account:m.account,types:[`A`],proxied:!1,enabled:!0,key:Y1()}),m.host=``)}function ve(e){l.value!==null&&(l.value.domains=l.value.domains.filter(t=>t!==e))}function ye(){r.value!==null&&(l.value=X1(r.value)),d.value=null}async function be(){if(!f.value){f.value=!0,d.value=null;try{pe(await KN(o.activeId.value),!0),s.success(T.value?.lastResult??Y(`settings.ddns.passFinished`))}catch(e){d.value=CM(e)}finally{f.value=!1}}}function xe(e){h.value=e,g.value=Object.fromEntries((ae(e.provider)?.fields??[]).map(e=>[e.key,``])),v.value=null}async function D(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await WN(o.activeId.value,e.id,e.provider,g.value),!0),s.success(Y(`settings.ddns.credentialsSaved`,{account:e.id})),h.value=null}catch(e){v.value=CM(e)}finally{_.value=!1}}}async function Se(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await GN(o.activeId.value,e.id),!0),s.success(Y(`settings.ddns.credentialsRemoved`,{account:e.id})),h.value=null}catch(e){v.value=CM(e)}finally{_.value=!1}}}return t({reload:me}),(e,t)=>(L(),R(I,null,[B(`div`,t0,[u.value?(L(),z(YU,{key:0,tone:`danger`,title:A(Y)(`settings.ddns.loadErrorTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):U(``,!0),l.value===null?U(``,!0):(L(),R(I,{key:1},[V(IB,{title:A(Y)(`settings.ddns.title`),description:A(Y)(`settings.ddns.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!ee.value,onClick:ye},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`]),T.value?.running?(L(),z(hG,{key:0,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.ddns.checking`)),1)]),_:1})):T.value?.enabled?(L(),z(hG,{key:1,tone:T.value.records.some(e=>e.state===`error`)?`danger`:`ok`,dot:``},{default:j(()=>[H(O(T.value.records.some(e=>e.state===`error`)?A(Y)(`settings.ddns.needsAttention`):A(Y)(`settings.ddns.watching`)),1)]),_:1},8,[`tone`])):U(``,!0),V($,{size:`xs`,variant:`ghost`,loading:f.value,onClick:be},{default:j(()=>[H(O(A(Y)(`settings.ddns.updateNow`)),1)]),_:1},8,[`loading`])]),default:j(()=>[V(sV,{modelValue:l.value.enabled,"onUpdate:modelValue":t[0]||=e=>l.value.enabled=e,label:A(Y)(`settings.ddns.enabled`),hint:A(Y)(`settings.ddns.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(qB,{"model-value":A(SR)(l.value.intervalMs),label:A(Y)(`settings.ddns.interval`),min:60,hint:A(Y)(`settings.ddns.intervalHint`),"onUpdate:modelValue":t[1]||=e=>de(l.value,`intervalMs`,e===null?null:A(CR)(e))},null,8,[`model-value`,`label`,`hint`]),V(qB,{"model-value":l.value.ttl,label:A(Y)(`settings.ddns.ttl`),min:1,hint:A(Y)(`settings.ddns.ttlHint`),"onUpdate:modelValue":t[2]||=e=>de(l.value,`ttl`,e)},null,8,[`model-value`,`label`,`hint`]),V(sV,{modelValue:l.value.ipv4.enabled,"onUpdate:modelValue":t[3]||=e=>l.value.ipv4.enabled=e,label:A(Y)(`settings.ddns.detectIpv4`),hint:A(Y)(`settings.ddns.detectIpv4Hint`)},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:l.value.ipv6.enabled,"onUpdate:modelValue":t[4]||=e=>l.value.ipv6.enabled=e,label:A(Y)(`settings.ddns.detectIpv6`),hint:A(Y)(`settings.ddns.detectIpv6Hint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),d.value?(L(),z(YU,{key:0,tone:`danger`},{default:j(()=>[H(O(d.value),1)]),_:1})):U(``,!0),B(`section`,n0,[B(`header`,r0,[B(`h3`,i0,O(A(Y)(`settings.ddns.accountsTitle`)),1),B(`p`,a0,O(A(Y)(`settings.ddns.accountsDescription`)),1)]),b.value.length>0?(L(),R(`ul`,o0,[(L(!0),R(I,null,P(b.value,e=>(L(),R(`li`,{key:e.id,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0`},[B(`div`,s0,[B(`p`,c0,O(e.id),1),B(`p`,l0,[H(O(se(e))+` `,1),le(e.id)>0?(L(),R(`span`,u0,` · `+O(A(bF)(`settings.ddns.hostnameCount`,le(e.id))),1)):U(``,!0)])]),B(`div`,d0,[V(hG,{tone:ce(e.id)?`ok`:`warn`,dot:``},{default:j(()=>[H(O(ce(e.id)?A(Y)(`settings.ddns.credentialsSet`):A(Y)(`settings.ddns.noCredentials`)),1)]),_:2},1032,[`tone`]),V($,{size:`xs`,variant:`secondary`,onClick:t=>xe(e)},{default:j(()=>[H(O(A(Y)(`settings.ddns.credentials`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:le(e.id)>0,title:le(e.id)>0?A(Y)(`settings.ddns.removeAccountBlocked`):void 0,onClick:t=>ge(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`title`,`onClick`])])]))),128))])):(L(),R(`p`,f0,O(A(Y)(`settings.ddns.noAccounts`)),1)),B(`div`,p0,[V($B,{modelValue:p.provider,"onUpdate:modelValue":t[5]||=e=>p.provider=e,label:A(Y)(`settings.ddns.provider`),options:C.value},null,8,[`modelValue`,`label`,`options`]),V(iV,{modelValue:p.id,"onUpdate:modelValue":t[6]||=e=>p.id=e,label:A(Y)(`settings.ddns.accountId`),placeholder:A(Y)(`settings.ddns.accountIdPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V($,{variant:`secondary`,disabled:!te.value,onClick:he},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])]),B(`p`,m0,O(A(Y)(`settings.ddns.accountIdHint`)),1)]),B(`section`,h0,[B(`header`,g0,[B(`h3`,_0,O(A(Y)(`settings.ddns.hostnamesTitle`)),1),B(`p`,v0,O(A(Y)(`settings.ddns.hostnamesDescription`)),1)]),x.value.length>0?(L(),R(`ul`,y0,[(L(!0),R(I,null,P(x.value,e=>(L(),R(`li`,{key:e.key,class:`rounded-control border border-line-soft bg-panel/50 p-2.5`},[B(`div`,b0,[B(`div`,x0,[V(iV,{modelValue:e.host,"onUpdate:modelValue":t=>e.host=t,label:A(Y)(`common.hostname`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`])]),B(`div`,S0,[V($B,{modelValue:e.account,"onUpdate:modelValue":t=>e.account=t,label:A(Y)(`settings.ddns.account`),options:w.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`])]),V(mW,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:A(Y)(`common.enabled`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),V($,{size:`xs`,variant:`danger-ghost`,onClick:t=>ve(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`onClick`])]),B(`div`,C0,[V(mW,{"model-value":e.types.includes(`A`),label:A(Y)(`settings.ddns.recordA`),"onUpdate:modelValue":t=>E(e,`A`,t===!0)},null,8,[`model-value`,`label`,`onUpdate:modelValue`]),V(mW,{"model-value":e.types.includes(`AAAA`),label:A(Y)(`settings.ddns.recordAaaa`),disabled:oe(e)?.families.includes(`AAAA`)===!1,hint:oe(e)?.families.includes(`AAAA`)===!1?A(Y)(`settings.ddns.aaaaUnsupported`):void 0,"onUpdate:modelValue":t=>E(e,`AAAA`,t===!0)},null,8,[`model-value`,`label`,`disabled`,`hint`,`onUpdate:modelValue`]),oe(e)?.proxied===!0?(L(),z(mW,{key:0,modelValue:e.proxied,"onUpdate:modelValue":t=>e.proxied=t,label:A(Y)(`settings.ddns.proxied`),hint:A(Y)(`settings.ddns.proxiedHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`])):U(``,!0),e.types.includes(`AAAA`)&&!l.value.ipv6.enabled?(L(),z(hG,{key:1,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.ddns.ipv6Off`)),1)]),_:1})):U(``,!0)]),V(gV,{title:A(Y)(`settings.ddns.advanced`),hint:A(Y)(`settings.ddns.advancedHint`),class:`mt-2`},{default:j(()=>[V(iV,{"model-value":e.zone??``,label:A(Y)(`settings.ddns.registeredDomain`),placeholder:A(Y)(`settings.ddns.registeredDomainPlaceholder`),hint:A(Y)(`settings.ddns.registeredDomainHint`),"onUpdate:modelValue":t=>ue(e,`zone`,t)},null,8,[`model-value`,`label`,`placeholder`,`hint`,`onUpdate:modelValue`]),oe(e)?.ttl===!1?U(``,!0):(L(),z(qB,{key:0,"model-value":e.ttl??null,min:1,nullable:``,label:A(Y)(`settings.ddns.ttlOverride`),hint:A(Y)(`settings.ddns.ttlOverrideHint`),"onUpdate:modelValue":t=>ue(e,`ttl`,t)},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`]))]),_:2},1032,[`title`,`hint`])]))),128))])):(L(),R(`p`,w0,O(A(Y)(`settings.ddns.noHostnames`)),1)),B(`div`,T0,[V(iV,{modelValue:m.host,"onUpdate:modelValue":t[7]||=e=>m.host=e,label:A(Y)(`common.hostname`),placeholder:A(Y)(`settings.ddns.hostnamePlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V($B,{modelValue:m.account,"onUpdate:modelValue":t[8]||=e=>m.account=e,label:A(Y)(`settings.ddns.account`),options:w.value,disabled:b.value.length===0},null,8,[`modelValue`,`label`,`options`,`disabled`]),V($,{variant:`secondary`,disabled:!ne.value,onClick:_e},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])])]),T.value!==null&&T.value.records.length>0?(L(),R(`section`,E0,[B(`header`,D0,[B(`h3`,O0,O(A(Y)(`settings.ddns.lastPass`)),1),T.value.lastResult?(L(),R(`span`,k0,O(T.value.lastResult),1)):U(``,!0),T.value.ipv4?(L(),R(`span`,A0,O(A(Y)(`settings.ddns.ipv4Value`,{address:T.value.ipv4})),1)):U(``,!0),T.value.ipv6?(L(),R(`span`,j0,O(A(Y)(`settings.ddns.ipv6Value`,{address:T.value.ipv6})),1)):U(``,!0),T.value.lastRunAt?(L(),R(`span`,M0,O(A(FR)(T.value.lastRunAt,A(a).now.value)),1)):U(``,!0)]),B(`div`,N0,[B(`table`,P0,[B(`thead`,null,[B(`tr`,F0,[B(`th`,I0,O(A(Y)(`common.hostname`)),1),B(`th`,L0,O(A(Y)(`settings.ddns.type`)),1),B(`th`,R0,O(A(Y)(`settings.ddns.state`)),1),B(`th`,z0,O(A(Y)(`settings.ddns.address`)),1),B(`th`,B0,O(A(Y)(`settings.ddns.detail`)),1)])]),B(`tbody`,null,[(L(!0),R(I,null,P(T.value.records,e=>(L(),R(`tr`,{key:`${e.host}|${e.type}`,class:`border-t border-line-soft align-top`},[B(`td`,V0,O(e.host),1),B(`td`,H0,O(e.type),1),B(`td`,U0,[V(hG,{tone:i[e.state].tone,dot:``},{default:j(()=>[H(O(A(Y)(i[e.state].labelKey)),1)]),_:2},1032,[`tone`])]),B(`td`,W0,O(e.ip??`—`),1),B(`td`,G0,O(e.message??`—`),1)]))),128))])])])])):U(``,!0)],64))]),V(xV,{open:re.value,"onUpdate:open":t[10]||=e=>re.value=e,title:A(Y)(`settings.ddns.credentialsTitle`),description:h.value===null?``:`${se(h.value)} — ${h.value.id}`,width:`w-[min(92vw,32rem)]`},{footer:j(()=>[h.value!==null&&ce(h.value.id)?(L(),z(KU,{key:0,label:A(Y)(`settings.ddns.forget`),"confirm-label":A(Y)(`settings.ddns.forgetConfirm`),title:A(Y)(`settings.ddns.forgetTitle`),hint:A(Y)(`settings.ddns.forgetHint`),loading:_.value,disabled:_.value,onConfirm:Se},null,8,[`label`,`confirm-label`,`title`,`hint`,`loading`,`disabled`])):U(``,!0),V($,{size:`sm`,variant:`ghost`,disabled:_.value,onClick:t[9]||=e=>re.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,loading:_.value,disabled:Object.values(g.value).every(e=>e.trim().length===0),onClick:D},{default:j(()=>[H(O(A(Y)(`settings.ddns.saveCredentials`)),1)]),_:1},8,[`loading`,`disabled`])]),default:j(()=>[B(`div`,K0,[B(`p`,q0,O(A(Y)(`settings.ddns.credentialsDescription`)),1),(L(!0),R(I,null,P(ie.value,e=>(L(),z(iV,{key:e.key,modelValue:g.value[e.key],"onUpdate:modelValue":t=>g.value[e.key]=t,type:`password`,autocomplete:`off`,label:e.label,hint:`${e.hint}${e.optional?` ${A(Y)(`settings.ddns.optional`)}`:``}`,wide:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),h.value===null?U(``,!0):(L(),R(`a`,{key:0,class:`inline-block text-2xs text-accent underline decoration-line underline-offset-2`,href:ae(h.value.provider)?.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`settings.ddns.whereToGet`)),9,J0)),v.value?(L(),z(YU,{key:1,tone:`danger`},{default:j(()=>[H(O(v.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64))}}),X0={class:`mt-3 space-y-3`},Z0=N({__name:`DefaultsSection`,props:Va({dirty:{type:Boolean}},{defaults:{required:!0},defaultsModifiers:{}}),emits:Va([`reset`],[`update:defaults`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`defaults`),a=_B(()=>i.value.logBufferLines,e=>i.value.logBufferLines=e,500);return(e,t)=>(L(),R(I,null,[V(IB,{title:A(Y)(`settings.defaults.title`),description:A(Y)(`settings.defaults.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(sV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`settings.defaults.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(sV,{modelValue:i.value.autostart,"onUpdate:modelValue":t[2]||=e=>i.value.autostart=e,label:A(Y)(`settings.defaults.autostart`)},null,8,[`modelValue`,`label`]),V($B,{modelValue:i.value.bind,"onUpdate:modelValue":t[3]||=e=>i.value.bind=e,label:A(Y)(`settings.defaults.bind`),options:[{value:`local`,label:A(Y)(`settings.defaults.bindLocal`)},{value:`lan`,label:A(Y)(`settings.defaults.bindLan`)}]},null,8,[`modelValue`,`label`,`options`]),V($B,{modelValue:i.value.onPortConflict,"onUpdate:modelValue":t[4]||=e=>i.value.onPortConflict=e,label:A(Y)(`settings.defaults.onPortConflict`),options:[{value:`block`,label:A(Y)(`settings.defaults.conflictBlock`)},{value:`warn`,label:A(Y)(`settings.defaults.conflictWarn`)},{value:`follow`,label:A(Y)(`settings.defaults.conflictFollow`)},{value:`reclaim`,label:A(Y)(`settings.defaults.conflictReclaim`)},{value:`kill`,label:A(Y)(`settings.defaults.conflictKill`)}]},null,8,[`modelValue`,`label`,`options`]),V(qB,{modelValue:A(a),"onUpdate:modelValue":t[5]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.defaults.logBufferLines`),min:50,max:1e5,hint:A(Y)(`settings.defaults.logBufferLinesHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),B(`div`,X0,[V(cV,{restart:i.value.restart,"onUpdate:restart":t[6]||=e=>i.value.restart=e,health:i.value.health,"onUpdate:health":t[7]||=e=>i.value.health=e,stop:i.value.stop,"onUpdate:stop":t[8]||=e=>i.value.stop=e},null,8,[`restart`,`health`,`stop`])])],64))}}),Q0={class:`contents`},$0=N({__name:`NotificationPolicyFields`,props:{modelValue:{required:!0},modelModifiers:{}},emits:[`update:modelValue`],setup(e){let t=lo(e,`modelValue`),n=W(()=>[{key:`onCrash`,label:Y(`settings.telegram.onCrash`)},{key:`onUnhealthy`,label:Y(`settings.telegram.onUnhealthy`)},{key:`onForcedRestart`,label:Y(`settings.telegram.onForcedRestart`)},{key:`onRecovered`,label:Y(`settings.telegram.onRecovered`)},{key:`onHost`,label:Y(`settings.telegram.onHost`),hint:Y(`settings.telegram.onHostHint`)},{key:`onDdns`,label:Y(`settings.telegram.onDdns`),hint:Y(`settings.telegram.onDdnsHint`)}]);return(e,r)=>(L(),R(`div`,Q0,[(L(!0),R(I,null,P(n.value,e=>(L(),z(sV,{key:e.key,modelValue:t.value[e.key],"onUpdate:modelValue":n=>t.value[e.key]=n,label:e.label,hint:e.hint},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),V(qB,{"model-value":A(SR)(t.value.cooldownMs),label:A(Y)(`settings.telegram.cooldown`),min:0,hint:A(Y)(`settings.telegram.cooldownHint`),"onUpdate:modelValue":r[0]||=e=>t.value.cooldownMs=e===null?0:A(CR)(e)},null,8,[`model-value`,`label`,`hint`])]))}}),e2={class:`flex flex-wrap items-center gap-1.5`},t2={key:0,class:`text-xs text-muted`},n2={class:`flex items-center gap-2`},r2={class:`min-w-0 flex-1 truncate font-mono text-2xs text-muted`},i2={class:`grid grid-cols-1 gap-2 sm:grid-cols-2`},a2={class:`flex items-end gap-1.5`},o2={class:`grid grid-cols-1 gap-2 sm:grid-cols-2`},s2={class:`flex items-end gap-1.5`},c2={class:`text-2xs text-muted`},l2={class:`grid grid-cols-1 gap-2 sm:grid-cols-3`},u2={class:`flex flex-wrap items-center gap-1.5`},d2={class:`text-2xs font-medium uppercase tracking-wide text-muted`},f2={key:2,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`},p2={class:`flex flex-wrap items-center gap-1.5`},m2={key:0,class:`text-2xs text-ok`},h2={key:1,class:`text-2xs text-muted`},g2=N({__name:`DestinationsSection`,props:Va({statuses:{},dirty:{type:Boolean}},{destinations:{required:!0},destinationsModifiers:{}}),emits:Va([`reset`],[`update:destinations`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`destinations`),a=tI(),o=gI(),s=k({}),c=k({}),l=k(null),u=k(null),d=W(()=>new Map(n.statuses.map(e=>[e.id,e])));function f(e,t){let n=new Set(i.value.map(e=>e.id)),r=e.length>0?e:t;if(!n.has(r))return r;let a=2;for(;n.has(`${r}-${a}`);)a+=1;return`${r}-${a}`}function p(e){return{id:f(e,e),kind:e,enabled:!0,useOwnSettings:!1,chatId:``,tokenSet:!1,url:``,method:`POST`,format:`json`,headers:``,policy:{onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0,cooldownMs:12e4}}}function m(e){i.value=[...i.value,p(e)]}function h(e){i.value=i.value.filter(t=>t.id!==e)}function g(e){return e===void 0||e.lastResult===null||e.lastResult===void 0?``:Y(`settings.destination.lastSend`,{result:e.lastResult,when:e.lastResultAt===null||e.lastResultAt===void 0?``:FR(e.lastResultAt,Date.now())})}let _=W(()=>[{id:`ntfy`,label:Y(`settings.webhook.presetNtfy`),apply:e=>{e.format=`text`,e.headers=`Title: home-hosted
53
- Priority: default`}},{id:`discord`,label:Y(`settings.webhook.presetDiscord`),apply:e=>{e.format=`json`,e.headers=``}},{id:`slack`,label:Y(`settings.webhook.presetSlack`),apply:e=>{e.format=`json`,e.headers=``}}]);async function v(e){let t=(s.value[e.id]??``).trim();if(t.length!==0){l.value=e.id,u.value=null;try{let n=await LN(o.activeId.value,e.id,t);s.value[e.id]=``,c.value[e.id]=n.username===null?Y(`settings.telegram.tokenSaved`):Y(`settings.telegram.tokenSavedFor`,{username:n.username}),a.refresh()}catch(e){u.value=CM(e)}finally{l.value=null}}}async function y(e){l.value=e.id,u.value=null;try{await RN(o.activeId.value,e.id),c.value[e.id]=Y(`settings.telegram.tokenRemoved`),a.refresh()}catch(e){u.value=CM(e)}finally{l.value=null}}async function b(e){l.value=e.id,u.value=null;try{let{chats:t}=await BN(o.activeId.value,e.id,{botToken:(s.value[e.id]??``).trim()||void 0});t.length===0?c.value[e.id]=Y(`settings.telegram.noChats`):e.chatId=String(t[0].id)}catch(e){u.value=CM(e)}finally{l.value=null}}async function x(e){l.value=e.id,u.value=null;try{e.kind===`telegram`?await zN(o.activeId.value,e.id,{chatId:e.chatId||void 0}):await VN(o.activeId.value,{target:{url:e.url,method:e.method,format:e.format,headers:e.headers,enabled:e.enabled,cooldownMs:e.policy.cooldownMs,onCrash:e.policy.onCrash,onUnhealthy:e.policy.onUnhealthy,onForcedRestart:e.policy.onForcedRestart,onRecovered:e.policy.onRecovered,onHost:e.policy.onHost,onDdns:e.policy.onDdns},id:e.id}),c.value[e.id]=Y(`settings.destination.testSent`),a.refresh()}catch(e){u.value=CM(e)}finally{l.value=null}}function S(e){return e.tokenSet?Y(`settings.telegram.tokenSavedPlaceholder`):Y(`settings.telegram.tokenPlaceholder`)}return(e,t)=>(L(),z(IB,{title:A(Y)(`settings.destination.title`),description:A(Y)(`settings.destination.description`),columns:1},{actions:j(()=>[B(`div`,e2,[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`secondary`,onClick:t[1]||=e=>m(`telegram`)},{default:j(()=>[H(O(A(Y)(`settings.destination.addTelegram`)),1)]),_:1}),V($,{size:`xs`,variant:`primary`,onClick:t[2]||=e=>m(`webhook`)},{default:j(()=>[H(O(A(Y)(`settings.destination.addWebhook`)),1)]),_:1})])]),default:j(()=>[i.value.length===0?(L(),R(`p`,t2,O(A(Y)(`settings.destination.empty`)),1)):U(``,!0),(L(!0),R(I,null,P(i.value,e=>(L(),R(`div`,{key:e.id,class:`flex min-w-0 flex-col gap-2 rounded-control border border-line bg-page/60 p-2.5`},[B(`div`,n2,[V(sV,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:e.kind===`telegram`?A(Y)(`settings.telegram.title`):A(Y)(`settings.webhook.title`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),B(`span`,r2,O(e.id),1),V(KU,{label:A(Y)(`settings.destination.remove`),question:A(Y)(`settings.destination.removeQuestion`,{name:e.id}),body:A(Y)(`settings.destination.removeBody`),onConfirm:t=>h(e.id)},null,8,[`label`,`question`,`body`,`onConfirm`])]),e.kind===`telegram`?(L(),R(I,{key:0},[B(`div`,i2,[V(iV,{modelValue:e.chatId,"onUpdate:modelValue":t=>e.chatId=t,label:A(Y)(`settings.destination.chatId`),hint:A(Y)(`settings.destination.chatIdHint`),placeholder:A(Y)(`settings.telegram.chatIdPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`placeholder`]),B(`div`,a2,[V($,{size:`xs`,variant:`ghost`,disabled:l.value===e.id,onClick:t=>b(e)},{default:j(()=>[H(O(A(Y)(`settings.destination.detectChats`)),1)]),_:1},8,[`disabled`,`onClick`])])]),B(`div`,o2,[V(iV,{modelValue:s.value[e.id],"onUpdate:modelValue":t=>s.value[e.id]=t,label:A(Y)(`settings.destination.botToken`),placeholder:S(e),hint:A(Y)(`settings.telegram.tokenNote`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`placeholder`,`hint`]),B(`div`,s2,[V($,{size:`xs`,disabled:l.value===e.id||(s.value[e.id]??``).trim().length===0,onClick:t=>v(e)},{default:j(()=>[H(O(A(Y)(`settings.destination.saveToken`)),1)]),_:1},8,[`disabled`,`onClick`]),e.tokenSet?(L(),z(KU,{key:0,label:A(Y)(`settings.telegram.removeToken`),question:A(Y)(`settings.telegram.removeTokenTitle`),body:A(Y)(`settings.telegram.removeTokenHint`),onConfirm:t=>y(e)},null,8,[`label`,`question`,`body`,`onConfirm`])):U(``,!0)])]),B(`span`,c2,O(e.tokenSet?A(Y)(`settings.destination.tokenSet`):A(Y)(`settings.destination.noToken`)),1)],64)):(L(),R(I,{key:1},[B(`div`,l2,[V(iV,{modelValue:e.url,"onUpdate:modelValue":t=>e.url=t,class:`sm:col-span-2`,label:A(Y)(`settings.webhook.url`),placeholder:A(Y)(`settings.webhook.urlPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`placeholder`]),V($B,{modelValue:e.method,"onUpdate:modelValue":t=>e.method=t,label:A(Y)(`settings.webhook.method`),options:[{value:`POST`,label:`POST`},{value:`PUT`,label:`PUT`}]},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),V($B,{modelValue:e.format,"onUpdate:modelValue":t=>e.format=t,label:A(Y)(`settings.webhook.format`),options:[{value:`json`,label:A(Y)(`settings.webhook.formatJson`)},{value:`text`,label:A(Y)(`settings.webhook.formatText`)}],hint:A(Y)(`settings.webhook.formatHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`,`hint`])]),V(TV,{modelValue:e.headers,"onUpdate:modelValue":t=>e.headers=t,label:A(Y)(`settings.webhook.headers`),hint:A(Y)(`settings.webhook.headersHint`),placeholder:`Authorization: Bearer …`,rows:2,mono:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]),B(`div`,u2,[B(`span`,d2,O(A(Y)(`settings.webhook.presets`)),1),(L(!0),R(I,null,P(_.value,t=>(L(),z($,{key:t.id,size:`xs`,variant:`ghost`,onClick:n=>t.apply(e)},{default:j(()=>[H(O(t.label),1)]),_:2},1032,[`onClick`]))),128))])],64)),V(sV,{modelValue:e.useOwnSettings,"onUpdate:modelValue":t=>e.useOwnSettings=t,label:A(Y)(`settings.destination.ownSettings`),hint:A(Y)(`settings.destination.ownSettingsHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]),e.useOwnSettings?(L(),R(`div`,f2,[V($0,{modelValue:e.policy,"onUpdate:modelValue":t=>e.policy=t},null,8,[`modelValue`,`onUpdate:modelValue`])])):U(``,!0),B(`div`,p2,[V($,{size:`xs`,disabled:l.value===e.id,onClick:t=>x(e)},{default:j(()=>[H(O(l.value===e.id?A(Y)(`common.sending`):A(Y)(`settings.destination.sendTest`)),1)]),_:2},1032,[`disabled`,`onClick`]),c.value[e.id]?(L(),R(`span`,m2,O(c.value[e.id]),1)):U(``,!0),g(d.value.get(e.id))?(L(),R(`span`,h2,O(g(d.value.get(e.id))),1)):U(``,!0)])]))),128)),u.value===null?U(``,!0):(L(),z(YU,{key:1,tone:`danger`,title:A(Y)(`views.settings.saveFailed`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`]))]),_:1},8,[`title`,`description`]))}}),_2={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},v2={class:`text-xs font-medium text-muted`},y2={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},b2={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},x2={class:`text-2xs leading-4 text-faint`},S2=N({__name:`LogsSection`,props:Va({logsDir:{},dirty:{type:Boolean}},{logs:{required:!0},logsModifiers:{}}),emits:Va([`reset`],[`update:logs`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`logs`),a=gI(),o=_B(()=>i.value.maxBytes,e=>i.value.maxBytes=e,2e6),s=_B(()=>i.value.keep,e=>i.value.keep=e,3),c=W(()=>n.logsDir??`—`);return(e,t)=>{let l=ha(`RouterLink`);return L(),z(IB,{title:A(Y)(`settings.logs.title`),description:A(Y)(`settings.logs.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(sV,{modelValue:i.value.persist,"onUpdate:modelValue":t[1]||=e=>i.value.persist=e,label:A(Y)(`settings.logs.persist`),hint:A(Y)(`settings.logs.persistHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.logs.maxBytes`),min:1e4,max:1e8,hint:A(Y)(`settings.logs.maxBytesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(qB,{modelValue:A(s),"onUpdate:modelValue":t[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.logs.keep`),min:1,max:10},null,8,[`modelValue`,`label`]),B(`div`,_2,[B(`span`,v2,O(A(Y)(`settings.logs.directory`)),1),B(`div`,y2,[B(`span`,b2,O(c.value),1),V(pG,{value:c.value,label:A(Y)(`settings.logs.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,x2,[V(EV,{k:`settings.logs.browseHint`},{logs:j(()=>[V(l,{to:A(D2)(A(a).activeId.value,`logs`),class:`text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),_:1})])])]),_:1},8,[`title`,`description`])}}}),C2={class:`mt-1`},w2=N({__name:`SettingsView`,setup(e){let t=W(()=>[{id:`defaults`,title:Y(`views.settings.sectionDefaults`)},{id:`logs`,title:Y(`views.settings.sectionLogs`)},{id:`notifications`,title:Y(`views.settings.sectionNotifications`)},{id:`ddns`,title:Y(`views.settings.sectionDdns`)}]),n=tI(),r=gI(),i=fP(),a=tn(Bz()),o=k(!1),s=k(null),c=k(null),l=k(null),u=k(null),d=k(null),f=W(()=>r.defaults.value),p=W(()=>r.logsConfig.value),m=W(()=>r.notifications.value?.defaults??null),h=W(()=>r.notifications.value?.destinations??[]),g=W(()=>r.logsDir.value),_={},v=W(()=>{let e={},t=f.value,n=p.value;if(t!==null){let n=Qz(t,a.defaults);Object.keys(n).length>0&&(e.defaults=n)}if(n!==null){let t=$z(n,a.logs);Object.keys(t).length>0&&(e.logs=t)}let r=m.value,i={};if(r!==null){let e=nB(r,a.policy);e!==null&&Object.assign(i,e)}let o=iB(h.value,a.destinations,dB(_.notifications));return o!==null&&Object.assign(i,o),Object.keys(i).length>0&&(e.notifications=i),e}),y=W(()=>Ez(v.value)+(l.value===null?0:Ez(l.value))),b=W(()=>{let e=m.value;return{defaults:f.value??{},logs:p.value??{},notifications:e===null?{}:{defaults:eB(e),destinations:h.value.map(tB)},ddns:u.value??{}}}),x=W(()=>Tz({...v.value,...l.value===null?{}:{ddns:l.value}},b.value)),S=W(()=>f.value!==null&&Object.keys(Qz(f.value,a.defaults)).length>0),C=W(()=>p.value!==null&&Object.keys($z(p.value,a.logs)).length>0),w=W(()=>m.value!==null&&(nB(m.value,a.policy)!==null||iB(h.value,a.destinations,dB(_.notifications))!==null));function T(){let e=(e,t)=>{fB(_[e],uB(a,e))||(t(),_[e]=uB(a,e))},t=f.value;t!==null&&e(`defaults`,()=>{a.defaults.enabled=t.enabled,a.defaults.autostart=t.autostart,a.defaults.bind=t.bind,a.defaults.onPortConflict=t.onPortConflict,a.defaults.logBufferLines=t.logBufferLines,a.defaults.restart={...t.restart},a.defaults.health=Rz(t.health),a.defaults.stop={...t.stop}});let n=p.value;n!==null&&e(`logs`,()=>Object.assign(a.logs,n));let r=m.value;r!==null&&e(`notifications`,()=>{Object.assign(a.policy,eB(r)),a.destinations=h.value.map(tB)})}function ee(){for(let e of Object.keys(_))delete _[e]}M([f,p,m],()=>{T()},{immediate:!0});async function te(){let e=v.value,t=l.value,u=Object.keys(e).length>0;if(!u&&t===null||o.value||r.activeId.value.length===0)return;let f=aB(h.value,a.destinations,dB(_.notifications));if(f.length>0)c.value=null,s.value=Y(`views.settings.concurrentEdit`,{ids:f.join(`, `)});else{o.value=!0,s.value=null,c.value=null;try{if(u&&!await n.saveWorkspaceSettings(r.activeId.value,e)){s.value=n.lastError.value??Y(`views.settings.saveFailed`);return}t!==null&&(await UN(r.activeId.value,t),await d.value?.reload()),c.value=Y(`views.settings.saved`),i.success(Y(`views.settings.savedToast`)),ee(),T()}catch(e){s.value=CM(e)}finally{o.value=!1}}}function ne(){s.value=null,c.value=null,ee(),T(),d.value?.reload()}function re(){let e=f.value;e!==null&&(a.defaults.enabled=e.enabled,a.defaults.autostart=e.autostart,a.defaults.bind=e.bind,a.defaults.onPortConflict=e.onPortConflict,a.defaults.logBufferLines=e.logBufferLines,a.defaults.restart={...e.restart},a.defaults.health=Rz(e.health),a.defaults.stop={...e.stop},oe(`defaults`))}function ie(){p.value!==null&&Object.assign(a.logs,p.value),oe(`logs`)}function ae(){m.value!==null&&(Object.assign(a.policy,eB(m.value)),a.destinations=h.value.map(tB)),oe(`notifications`)}function oe(e){_[e]=uB(a,e)}return M(()=>r.activeId.value,()=>{ee(),T(),s.value=null,c.value=null}),(e,n)=>(L(),z(_q,{sections:t.value,"nav-label":A(Y)(`views.settings.navLabel`),"changes-description":A(Y)(`views.settings.changesDescription`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)}),"changed-count":y.value,changes:x.value,"save-error":s.value,"save-message":c.value,saving:o.value,onSave:te,onDiscard:ne},{header:j(()=>[V(tU,{title:A(Y)(`nav.workspaceSettings`),description:A(Y)(`views.settings.description`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)})},null,8,[`title`,`description`]),A(r).configError.value?(L(),z(YU,{key:0,tone:`danger`,title:A(Y)(`views.settings.configErrorTitle`),class:`mb-4`},{default:j(()=>[B(`p`,null,O(A(r).configError.value),1),B(`p`,C2,O(A(Y)(`views.settings.configErrorNote`)),1)]),_:1},8,[`title`])):A(r).configWarnings.value.length>0?(L(),z(YU,{key:1,tone:`warn`,title:A(Y)(`views.settings.configWarningTitle`),class:`mb-4`},{default:j(()=>[(L(!0),R(I,null,P(A(r).configWarnings.value,e=>(L(),R(`p`,{key:e,class:`font-mono`},O(e),1))),128))]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(JK,{id:`defaults`,title:A(Y)(`views.settings.sectionDefaults`),description:A(Y)(`views.settings.defaultsDescription`)},{default:j(()=>[V(Z0,{defaults:a.defaults,"onUpdate:defaults":n[0]||=e=>a.defaults=e,dirty:S.value,onReset:re},null,8,[`defaults`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`logs`,title:A(Y)(`views.settings.sectionLogs`),description:A(Y)(`views.settings.logsDescription`)},{default:j(()=>[V(S2,{logs:a.logs,"onUpdate:logs":n[1]||=e=>a.logs=e,"logs-dir":g.value,dirty:C.value,onReset:ie},null,8,[`logs`,`logs-dir`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`notifications`,title:A(Y)(`views.settings.sectionNotifications`),description:A(Y)(`views.settings.notificationsDescription`)},{default:j(()=>[V(IB,{title:A(Y)(`settings.destination.generalTitle`),description:A(Y)(`settings.destination.generalDescription`),columns:1},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!w.value,onClick:ae},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V($0,{modelValue:a.policy,"onUpdate:modelValue":n[2]||=e=>a.policy=e},null,8,[`modelValue`])]),_:1},8,[`title`,`description`]),V(g2,{destinations:a.destinations,"onUpdate:destinations":n[3]||=e=>a.destinations=e,statuses:h.value,dirty:w.value,onReset:ae},null,8,[`destinations`,`statuses`,`dirty`])]),_:1},8,[`title`,`description`]),V(JK,{id:`ddns`,title:A(Y)(`views.settings.sectionDdns`),description:A(Y)(`views.settings.ddnsDescription`)},{default:j(()=>[V(Y0,{ref_key:`ddnsSection`,ref:d,patch:l.value,"onUpdate:patch":n[4]||=e=>l.value=e,baseline:u.value,"onUpdate:baseline":n[5]||=e=>u.value=e},null,8,[`patch`,`baseline`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),T2=new Set([`overview`,`servers`,`server-detail`,`logs`,`settings`]),E2=Lv({history:av(),routes:[{path:`/w/:workspaceId`,name:`overview`,component:sX,meta:{titleKey:`nav.overview`}},{path:`/w/:workspaceId/servers`,name:`servers`,component:K1,meta:{titleKey:`nav.servers`}},{path:`/w/:workspaceId/servers/:id`,name:`server-detail`,component:N1,meta:{titleKey:`views.route.server`}},{path:`/w/:workspaceId/logs`,name:`logs`,component:zY,meta:{titleKey:`nav.logs`}},{path:`/w/:workspaceId/settings`,name:`settings`,component:w2,meta:{titleKey:`nav.workspaceSettings`}},{path:`/global/overview`,name:`global-overview`,component:HU,meta:{titleKey:`nav.globalOverview`}},{path:`/global/settings`,name:`global-settings`,component:Zq,meta:{titleKey:`nav.globalSettings`}},{path:`/proxy`,name:`proxy`,component:M$,meta:{titleKey:`nav.reverseProxy`}},{path:`/login`,name:`login`,component:EJ,meta:{titleKey:`login.signIn`}},{path:`/`,name:`home`,component:sX},{path:`/:pathMatch(.*)*`,name:`not-found`,component:sX}]});function D2(e,t=`overview`,n){let r=`/w/${encodeURIComponent(e)}`;return t===`overview`?r:t===`servers`?n===void 0?`${r}/servers`:`${r}/servers/${encodeURIComponent(n)}`:`${r}/${t}`}E2.beforeEach(async e=>{let{session:t,refresh:n}=sP();t.value===null&&await n();let r=$L(e,t.value);if(r!==null)return r;if(e.name===`login`||e.name===`global-overview`||e.name===`global-settings`||e.name===`proxy`)return!0;if(e.name===`home`||e.name===`not-found`)return{name:`global-overview`,replace:!0};await tI().ensureState();let i=gI(),a=i.workspaces.value;if(a.length===0)return!0;let o=typeof e.params.workspaceId==`string`?e.params.workspaceId:``;if(o.length>0&&a.some(e=>e.id===o)&&(i.select(o),T2.has(String(e.name))))return!0;let s=i.activeId.value||a[0].id,c=String(e.name??``),l={...e.params,workspaceId:s};return c===`server-detail`&&l.id===void 0?{name:`servers`,params:{workspaceId:s},query:e.query,replace:!0}:{name:c,params:l,query:e.query,replace:!0}});var O2={class:`flex items-center gap-2.5 border-b border-line px-3.5`},k2=[`placeholder`],A2={key:0,class:`px-3 py-8 text-center text-xs text-muted`},j2={class:`px-2.5 pb-1 pt-2.5 text-2xs font-medium text-faint`},M2=[`data-active`,`onMousemove`,`onClick`],N2={class:`min-w-0 flex-1 truncate text-sm`},P2={key:0,class:`min-w-0 max-w-[45%] shrink truncate font-mono text-2xs text-faint`},F2={class:`flex items-center gap-3 border-t border-line bg-panel-2 px-3.5 py-2 text-2xs text-faint`},I2={class:`ml-auto font-mono`},L2=N({__name:`CommandPalette`,props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:[`update:open`],setup(e){let t=lo(e,`open`),n=Qg(),r=tI(),i=gI(),a=uI(),o=k(``),s=k(0),c=k(null),l=k(null);function u(e){n.push(e)}function d(e){i.select(e);let t=String(n.currentRoute.value.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?u(D2(e,t)):t===`server-detail`&&u(D2(e,`servers`))}function f(e){e(),t.value=!1}let p=[`stopped`,`crashed`,`conflict`],m=[`running`,`starting`,`backoff`],h=W(()=>{let e=[],t=r.allServers.value;function n(e,t){i.select(e),u(t)}let o=e=>D2(i.activeId.value,e);for(let{workspace:i,server:a}of t){let t=a.config.label??a.id,o=Y(GL[a.status].labelKey);e.push({id:`open:${i.id}:${a.id}`,title:Y(`palette.openServer`,{label:t}),group:Y(`palette.groupServers`),icon:Hy,detail:`${i.label} · ${a.id} · ${o}`,keywords:`server detail ${a.id} ${i.label} show`,run:()=>n(i.id,D2(i.id,`servers`,a.id))}),e.push({id:`logs:${i.id}:${a.id}`,title:Y(`palette.serverLogs`,{label:t}),group:Y(`palette.groupServers`),icon:Xy,detail:`${i.label} · ${a.id}`,keywords:`log tail output ${a.id} ${i.label}`,run:()=>n(i.id,`${D2(i.id,`logs`)}?server=${encodeURIComponent(a.id)}`)}),p.includes(a.status)&&a.config.enabled&&e.push({id:`start:${i.id}:${a.id}`,title:Y(`palette.startServer`,{label:t}),group:Y(`palette.groupActions`),icon:Py,detail:`${i.label} · ${a.id}`,keywords:`run launch ${a.id} ${i.label}`,run:()=>f(()=>void r.start(i.id,a.id))}),m.includes(a.status)&&e.push({id:`stop:${i.id}:${a.id}`,title:Y(`palette.stopServer`,{label:t}),group:Y(`palette.groupActions`),icon:Jy,detail:`${i.label} · ${a.id}`,keywords:`halt kill ${a.id} ${i.label}`,run:()=>f(()=>void r.stop(i.id,a.id))}),a.config.enabled&&e.push({id:`restart:${i.id}:${a.id}`,title:Y(`palette.restartServer`,{label:t}),group:Y(`palette.groupActions`),icon:zy,detail:`${i.label} · ${a.id}`,keywords:`bounce reload ${a.id} ${i.label}`,run:()=>f(()=>void r.restart(i.id,a.id))})}e.push({id:`nav:overview`,title:Y(`palette.goOverview`),group:Y(`palette.groupNavigate`),icon:Cy,keywords:`dashboard home workspace`,run:()=>u(o(`overview`))},{id:`nav:global`,title:Y(`palette.goGlobalOverview`),group:Y(`palette.groupNavigate`),icon:vy,keywords:`dashboard home host vitals every workspace`,run:()=>u(`/global/overview`)},{id:`nav:global-settings`,title:Y(`palette.goGlobalSettings`),group:Y(`palette.groupNavigate`),icon:qy,keywords:`panel listener auth tls backups host`,run:()=>u(`/global/settings`)},{id:`nav:proxy`,title:Y(`palette.goProxy`),group:Y(`palette.groupNavigate`),icon:tb,keywords:`caddy domain route acme certificate https expose`,run:()=>u(`/proxy`)},{id:`nav:servers`,title:Y(`palette.goServers`),group:Y(`palette.groupNavigate`),icon:Hy,keywords:`processes list workspace`,run:()=>u(o(`servers`))},{id:`nav:logs`,title:Y(`palette.goLogs`),group:Y(`palette.groupNavigate`),icon:By,keywords:`output files tail workspace`,run:()=>u(o(`logs`))},{id:`nav:settings`,title:Y(`palette.goWorkspaceSettings`),group:Y(`palette.groupNavigate`),icon:Uy,keywords:`defaults notifications ddns config workspace`,run:()=>u(o(`settings`))},{id:`act:start-all`,title:Y(`palette.startAll`),group:Y(`palette.groupActions`),icon:Py,keywords:`boot all workspace`,run:()=>f(()=>void r.startAll(i.activeId.value))},{id:`act:stop-all`,title:Y(`palette.stopAll`),group:Y(`palette.groupActions`),icon:Jy,keywords:`halt all workspace`,run:()=>f(()=>void r.stopAll(i.activeId.value))});for(let t of i.workspaces.value)e.push({id:`ws:${t.id}`,title:Y(`palette.switchWorkspace`,{label:t.label}),group:Y(`palette.groupWorkspaces`),icon:Sy,detail:t.id,keywords:`workspace switch scope ${t.label}`,run:()=>f(()=>d(t.id))});for(let[t,n]of[[`listener`,`views.globalSettings.sectionListener`],[`authentication`,`views.globalSettings.sectionAuthentication`],[`host`,`views.globalSettings.sectionHost`],[`backups`,`views.globalSettings.sectionBackups`],[`tls`,`views.globalSettings.sectionTls`],[`language`,`language.label`],[`interface`,`views.globalSettings.sectionInterface`],[`paths`,`views.globalSettings.sectionPaths`]])e.push({id:`gset:${t}`,title:Y(`palette.globalSetting`,{label:Y(n)}),group:Y(`nav.globalSettings`),icon:vy,keywords:`configure panel ${t}`,run:()=>u(`/global/settings?section=${t}`)});for(let[t,n]of[[`defaults`,`views.settings.sectionDefaults`],[`logs`,`views.settings.sectionLogs`],[`notifications`,`views.settings.sectionNotifications`],[`ddns`,`views.settings.sectionDdns`]])e.push({id:`wset:${t}`,title:Y(`palette.workspaceSetting`,{label:Y(n)}),group:Y(`nav.workspaceSettings`),icon:Uy,keywords:`configure workspace ${t}`,run:()=>u(`${D2(i.activeId.value,`settings`)}?section=${t}`)});let s=[[`light`,`theme.light`,Yy],[`dark`,`theme.dark`,Ay],[`system`,`theme.system`,ky]];for(let[t,n,r]of s)e.push({id:`theme:${t}`,title:Y(`palette.theme`,{theme:Y(n)}),group:Y(`palette.groupAppearance`),icon:r,keywords:`colour color dark light mode appearance`,run:()=>f(()=>a.setPreference(t))});return e}),g=W(()=>{let e=o.value.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.length===0?h.value.slice(0,40):h.value.map(t=>{let n=`${t.title} ${t.detail??``} ${t.keywords??``} ${t.group}`.toLowerCase(),r=0;for(let t of e){let e=n.indexOf(t);if(e===-1)return null;r+=e===0?0:e}return{command:t,score:r}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score).slice(0,40).map(e=>e.command)}),_=W(()=>{let e=new Map;for(let t of g.value){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]}),v=W(()=>_.value.flatMap(([,e])=>e));M(g,()=>{s.value=0}),M(t,async e=>{e&&(o.value=``,s.value=0,await ir(),c.value?.focus())});function y(e){let t=v.value.length;t!==0&&(s.value=(s.value+e+t)%t,ir(()=>{l.value?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})}))}function b(e){e.key===`ArrowDown`?(e.preventDefault(),y(1)):e.key===`ArrowUp`?(e.preventDefault(),y(-1)):e.key===`Enter`&&(e.preventDefault(),v.value[s.value]?.run())}function x(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t.value=!t.value)}return ia(()=>window.addEventListener(`keydown`,x)),ze(()=>window.removeEventListener(`keydown`,x)),(e,n)=>(L(),z(A(yf),{open:t.value,"onUpdate:open":n[2]||=e=>t.value=e},{default:j(()=>[V(A(lp),null,{default:j(()=>[V(A(sp),{class:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px] data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`}),V(A(ip),{class:`fixed left-1/2 top-[10vh] z-50 w-[min(94vw,38rem)] -translate-x-1/2 overflow-hidden rounded-panel border border-line bg-panel shadow-float data-[state=open]:animate-[hh-pop-in_150ms_var(--ease-out-quick)]`,onOpenAutoFocus:n[1]||=_u(()=>{},[`prevent`]),onKeydown:b},{default:j(()=>[V(A(up),{class:`sr-only`},{default:j(()=>[H(O(A(Y)(`topbar.commandPalette`)),1)]),_:1}),B(`div`,O2,[V(A(Vy),{class:`size-4 shrink-0 text-faint`}),wr(B(`input`,{ref_key:`input`,ref:c,"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`text`,placeholder:A(Y)(`palette.placeholder`),class:`h-12 w-full bg-transparent text-sm text-ink outline-none placeholder:text-faint`,autocomplete:`off`,spellcheck:`false`},null,8,k2),[[nu,o.value]]),n[3]||=B(`kbd`,{class:`shrink-0 rounded border border-line bg-page px-1.5 py-0.5 font-mono text-2xs text-faint`},`esc`,-1)]),B(`div`,{ref_key:`list`,ref:l,class:`max-h-[min(60vh,26rem)] overflow-y-auto p-1.5`},[v.value.length===0?(L(),R(`p`,A2,O(A(Y)(`palette.noMatches`,{query:o.value})),1)):U(``,!0),(L(!0),R(I,null,P(_.value,([e,t])=>(L(),R(I,{key:e},[B(`p`,j2,O(e),1),(L(!0),R(I,null,P(t,e=>(L(),R(`button`,{key:e.id,type:`button`,"data-active":v.value[s.value]?.id===e.id,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2.5 py-2 text-left transition-colors duration-100`,v.value[s.value]?.id===e.id?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onMousemove:t=>s.value=v.value.findIndex(t=>t.id===e.id),onClick:t=>e.run()},[(L(),z(_a(e.icon),{class:D([`size-4 shrink-0`,v.value[s.value]?.id===e.id?`text-accent`:`text-faint`])},null,8,[`class`])),B(`span`,N2,O(e.title),1),e.detail?(L(),R(`span`,P2,O(e.detail),1)):U(``,!0),V(A(ty),{class:D([`size-3.5 shrink-0 text-faint opacity-0 transition-opacity duration-100`,{"opacity-100":v.value[s.value]?.id===e.id}])},null,8,[`class`])],42,M2))),128))],64))),128))],512),B(`div`,F2,[B(`span`,null,[n[4]||=B(`kbd`,{class:`font-mono`},`↑↓`,-1),H(` `+O(A(Y)(`palette.navigate`)),1)]),B(`span`,null,[n[5]||=B(`kbd`,{class:`font-mono`},`↵`,-1),H(` `+O(A(Y)(`palette.run`)),1)]),B(`span`,I2,O(A(bF)(`palette.results`,v.value.length)),1)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),R2={class:`rounded-panel border border-line bg-panel-2/70 p-3`},z2={class:`mb-2 flex items-center justify-between`},B2={class:`text-2xs font-medium text-faint`},V2={key:0,class:`text-2xs text-faint`},H2={key:0,class:`grid grid-cols-2 gap-x-1 gap-y-2`},U2={key:1,class:`mt-2 flex items-baseline justify-between border-t border-line-soft pt-2 text-2xs`},W2=[`title`],G2={class:`font-mono tabular-nums text-ink`},K2={key:2,class:`py-3 text-center text-2xs text-faint`},q2={key:3,class:`mt-2 flex items-start gap-1.5 rounded-control bg-danger-soft px-2 py-1.5`},J2={class:`text-2xs leading-4 text-danger`},Y2=85,X2=N({__name:`InstrumentCluster`,props:{host:{}},setup(e){let t=e,n=W(()=>t.host?.cpuUsedPercent??null),r=W(()=>{let e=t.host;return e?(e.loadAvg[0]??0)/Math.max(1,e.cpus):null}),i=W(()=>r.value===null?`—`:r.value.toFixed(2)),a=W(()=>{let e=t.host?.disks??[];return e.length===0?null:Math.max(...e.map(e=>e.usedPercent))}),o=W(()=>{let e=t.host?.tempCelsius??null;return e===null?null:e/Y2*100}),s=W(()=>{let e=t.host?.tempCelsius??null;return e===null?Y(`common.notAvailable`):`${Math.round(e)}°`});return(e,r)=>(L(),R(`div`,R2,[B(`div`,z2,[B(`span`,B2,O(A(Y)(`nav.hostVitals`)),1),t.host?.enabled===!1?(L(),R(`span`,V2,O(A(Y)(`host.statusOff`)),1)):U(``,!0)]),t.host?.enabled?(L(),R(`div`,H2,[V(cR,{value:n.value,label:A(Y)(`host.cpuUsage`),size:58,"warn-at":80,"danger-at":95},null,8,[`value`,`label`]),V(cR,{value:t.host?.memoryUsedPercent??null,label:A(Y)(`common.memory`),size:58},null,8,[`value`,`label`]),V(cR,{value:a.value,label:A(Y)(`common.disk`),size:58},null,8,[`value`,`label`]),V(cR,{value:o.value,label:A(Y)(`host.cpuTemp`),display:s.value,size:58},null,8,[`value`,`label`,`display`])])):U(``,!0),t.host?.enabled?(L(),R(`p`,U2,[B(`span`,{class:`text-faint`,title:A(Y)(`host.loadHint`)},O(A(Y)(`host.loadPerCpu`)),9,W2),B(`span`,G2,O(i.value),1)])):(L(),R(`p`,K2,O(A(Y)(`host.samplingOffCompact`)),1)),t.host&&t.host.alerts.length>0?(L(),R(`div`,q2,[r[0]||=B(`span`,{class:`mt-1 size-1.5 shrink-0 rounded-full bg-danger`},null,-1),B(`span`,J2,O(t.host.alerts.join(` · `)),1)])):U(``,!0)]))}}),Z2={class:`flex h-full min-h-0 flex-col gap-3 overflow-y-auto p-3`},Q2={class:`flex items-center gap-2 px-1 pt-1`},$2={class:`min-w-0`},e4={class:`truncate text-sm font-semibold tracking-tight text-ink`},t4=[`title`],n4=[`aria-label`],r4=[`aria-label`],i4={class:`flex items-center gap-1 truncate px-2.5 pb-1 text-2xs font-medium text-faint`},a4={key:1,class:`text-muted`},o4={class:`mt-auto flex flex-col gap-3`},s4={class:`flex items-center gap-2 rounded-control border border-line bg-panel-2/70 px-2.5 py-2`},c4={class:`relative flex size-2 shrink-0`},l4={class:`text-2xs text-muted`},u4=[`title`],d4=N({__name:`SideNav`,props:{host:{},connection:{},panelLabel:{},panelVersion:{},planLabel:{},workspaceId:{},workspaceLabel:{},running:{},total:{}},emits:[`navigate`,`close`],setup(e,{emit:t}){let n=e,r=t,i=$g(),a=W(()=>[{to:D2(n.workspaceId,`overview`),labelKey:`nav.overview`,icon:Cy,exact:!0,servers:!1},{to:D2(n.workspaceId,`servers`),labelKey:`nav.servers`,icon:Hy,exact:!1,servers:!0},{to:D2(n.workspaceId,`logs`),labelKey:`nav.logs`,icon:By,exact:!1,servers:!1},{to:D2(n.workspaceId,`settings`),labelKey:`nav.workspaceSettings`,icon:Uy,exact:!1,servers:!1}]),o=[{to:`/global/overview`,labelKey:`nav.globalOverview`,icon:vy,exact:!0,servers:!1},{to:`/global/settings`,labelKey:`nav.globalSettings`,icon:qy,exact:!1,servers:!1}],s=[{to:`/proxy`,labelKey:`nav.reverseProxy`,icon:tb,exact:!1,servers:!1}],c=W(()=>[{titleKey:`nav.global`,label:``,icon:vy,items:o},{titleKey:`nav.workspace`,label:n.workspaceLabel,icon:void 0,items:a.value},{titleKey:`nav.others`,label:``,icon:Zv,items:s}]);function l(e){return e.exact?i.path===e.to:i.path===e.to||i.path.startsWith(`${e.to}/`)}let u=W(()=>n.panelVersion===null?n.panelLabel:`${n.panelLabel} · v${n.panelVersion}`),d=W(()=>({open:{labelKey:`connection.live`,dot:`bg-ok`},connecting:{labelKey:`connection.connecting`,dot:`bg-warn`},closed:{labelKey:`connection.reconnecting`,dot:`bg-danger`}})[n.connection]);return(e,t)=>{let i=ha(`RouterLink`);return L(),R(`div`,Z2,[B(`div`,Q2,[t[2]||=As(`<span class="grid size-8 shrink-0 place-items-center rounded-[9px] border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,$2,[B(`p`,e4,O(A(Y)(`app.name`)),1),B(`p`,{class:`truncate text-2xs text-faint`,title:u.value},O(u.value),9,t4)]),B(`button`,{type:`button`,class:`ml-auto grid size-7 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`nav.closeNavigation`),onClick:t[0]||=e=>r(`close`)},[V(A(nb),{class:`size-4`})],8,n4)]),B(`nav`,{class:`flex flex-col gap-3`,"aria-label":A(Y)(`nav.navigation`)},[(L(!0),R(I,null,P(c.value,e=>(L(),R(`div`,{key:e.titleKey,class:`flex min-h-0 flex-col gap-0.5`},[B(`p`,i4,[e.icon?(L(),z(_a(e.icon),{key:0,class:`size-3 shrink-0`})):U(``,!0),H(` `+O(e.label?`${A(Y)(e.titleKey)} · `:A(Y)(e.titleKey)),1),e.label?(L(),R(`span`,a4,O(e.label),1)):U(``,!0)]),(L(!0),R(I,null,P(e.items,e=>(L(),z(i,{key:e.to,to:e.to,class:D(A(Q)(`group flex items-center gap-2.5 rounded-control px-2.5 py-1.5 text-sm transition-colors duration-150`,l(e)?`bg-accent-soft font-medium text-accent`:`text-muted hover:bg-hover hover:text-ink`)),onClick:t[1]||=e=>r(`navigate`)},{default:j(()=>[(L(),z(_a(e.icon),{class:`size-4 shrink-0`,"stroke-width":l(e)?2.1:1.8},null,8,[`stroke-width`])),H(` `+O(A(Y)(e.labelKey))+` `,1),e.servers?(L(),R(`span`,{key:0,class:D([`ml-auto font-mono text-2xs tabular-nums`,l(e)?`text-accent`:`text-faint`])},O(n.running)+`/`+O(n.total),3)):U(``,!0)]),_:2},1032,[`to`,`class`]))),128))]))),128))],8,r4),B(`div`,o4,[V(X2,{host:n.host},null,8,[`host`]),B(`div`,s4,[B(`span`,c4,[B(`span`,{class:D(A(Q)(`absolute inset-0 rounded-full`,d.value.dot,n.connection!==`open`&&`animate-ping opacity-60`))},null,2),B(`span`,{class:D(A(Q)(`relative size-2 rounded-full`,d.value.dot))},null,2)]),B(`span`,l4,O(A(Y)(d.value.labelKey)),1),B(`span`,{class:`ml-auto truncate font-mono text-2xs text-faint`,title:n.planLabel},O(n.planLabel),9,u4)])])])}}}),f4={key:0,class:`flex flex-col gap-px border-b border-line bg-panel/60`},p4={class:`text-2xs leading-4`},m4={class:`font-medium`},h4={key:0,class:`opacity-80`},g4=N({__name:`SystemNotices`,props:{control:{},configError:{},configPath:{}},setup(e){let t=e,n=W(()=>{let e=[],n=t.control?.auth;return t.configError&&e.push({id:`config`,tone:`danger`,text:Y(`notice.configError`,{error:t.configError}),hint:Y(`notice.configErrorHint`,{path:t.configPath??`servers.config.json`})}),n&&(n.blockedReason&&e.push({id:`blocked`,tone:`danger`,text:n.blockedReason}),n.usingDefaultPassword?e.push({id:`default-password`,tone:`warn`,text:Y(`notice.defaultPassword`),hint:Y(`notice.defaultPasswordHint`)}):n.enabled&&!n.passwordSet&&e.push({id:`no-password`,tone:`warn`,text:Y(`notice.noPassword`),hint:Y(`notice.noPasswordHint`)}),n.exposed&&e.push({id:`exposed`,tone:`warn`,text:Y(`notice.exposed`),hint:Y(`notice.exposedHint`)}),!n.enabled&&!n.exposed&&e.push({id:`auth-off`,tone:`info`,text:Y(`notice.authOff`)})),e}),r={warn:{wrap:`border-warn/25 bg-warn-soft text-warn`,icon:eb},danger:{wrap:`border-danger/25 bg-danger-soft text-danger`,icon:iy},info:{wrap:`border-line bg-panel-2 text-muted`,icon:iy}};return(e,t)=>n.value.length>0?(L(),R(`div`,f4,[(L(!0),R(I,null,P(n.value,e=>(L(),R(`div`,{key:e.id,class:D([`flex items-start gap-2 px-3 py-1.5 sm:px-4`,r[e.tone].wrap])},[(L(),z(_a(r[e.tone].icon),{class:`mt-0.5 size-3.5 shrink-0`})),B(`p`,p4,[B(`span`,m4,O(e.text),1),e.hint?(L(),R(`span`,h4,O(e.hint),1)):U(``,!0)])],2))),128))])):U(``,!0)}}),_4={class:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-[min(92vw,22rem)] flex-col gap-2`,role:`status`,"aria-live":`polite`},v4={class:`min-w-0 flex-1`},y4={class:`text-xs font-medium text-ink`},b4={key:0,class:`mt-0.5 break-words text-2xs leading-4 text-muted`},x4=[`aria-label`,`onClick`],S4=N({__name:`ToastStack`,setup(e){let{toasts:t,dismiss:n}=fP(),r={ok:ay,danger:oy,warn:eb,info:by,accent:by,neutral:by},i={ok:`text-ok`,danger:`text-danger`,warn:`text-warn`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},a=W(()=>t.value);return(e,t)=>(L(),R(`div`,_4,[V(Bl,{"enter-active-class":`transition duration-150 ease-out`,"enter-from-class":`translate-x-2 opacity-0`,"leave-active-class":`transition duration-100 ease-in`,"leave-to-class":`translate-x-2 opacity-0`},{default:j(()=>[(L(!0),R(I,null,P(a.value,e=>(L(),R(`div`,{key:e.id,class:`pointer-events-auto flex items-start gap-2.5 rounded-panel border border-line bg-raise p-3 shadow-float`},[(L(),z(_a(r[e.tone]),{class:D(A(Q)(`mt-0.5 size-4 shrink-0`,i[e.tone]))},null,8,[`class`])),B(`div`,v4,[B(`p`,y4,O(e.title),1),e.description?(L(),R(`p`,b4,O(e.description),1)):U(``,!0)]),B(`button`,{type:`button`,class:`-mr-1 -mt-0.5 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,"aria-label":A(Y)(`common.dismiss`),onClick:t=>A(n)(e.id)},[V(A(nb),{class:`size-3.5`})],8,x4)]))),128))]),_:1})]))}}),C4={class:`space-y-3`},w4={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 text-2xs leading-4 text-danger`},T4=N({__name:`WorkspaceDialog`,props:Va({mode:{},initial:{default:``},submit:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=lo(e,`open`),r=k(t.initial),i=k(!1),a=k(null),o=W(()=>t.mode===`create`?Y(`workspace.new`):Y(`workspace.rename`)),s=W(()=>t.mode===`create`?Y(`workspace.create`):Y(`workspace.renameAction`)),c=W(()=>r.value.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40));M(n,e=>{e&&(r.value=t.initial,a.value=null)});async function l(){let e=r.value.trim();if(e.length===0)a.value=Y(`workspace.nameRequired`);else{i.value=!0,a.value=null;try{await t.submit(e)&&(n.value=!1)}finally{i.value=!1}}}return(t,u)=>(L(),z(xV,{open:n.value,"onUpdate:open":u[2]||=e=>n.value=e,title:o.value,description:e.mode===`create`?A(Y)(`workspace.createHint`):A(Y)(`workspace.renameHint`),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,disabled:i.value,onClick:u[1]||=e=>n.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,loading:i.value,onClick:l},{default:j(()=>[H(O(s.value),1)]),_:1},8,[`loading`])]),default:j(()=>[B(`div`,C4,[V(iV,{modelValue:r.value,"onUpdate:modelValue":u[0]||=e=>r.value=e,label:A(Y)(`common.name`),placeholder:A(Y)(`workspace.namePlaceholder`),hint:e.mode===`create`&&c.value.length>0?A(Y)(`workspace.nameHintId`,{id:c.value}):A(Y)(`workspace.nameHint`),wide:``,onKeydown:yu(_u(l,[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`onKeydown`]),a.value?(L(),R(`p`,w4,O(a.value),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),E4=[`aria-label`],D4={class:`hidden min-w-0 truncate font-medium text-ink min-[360px]:inline`},O4={class:`hidden shrink-0 font-mono text-2xs text-faint sm:inline`},k4={class:`px-2 pb-1 pt-1.5 text-2xs font-medium text-faint`},A4={key:0,class:`max-h-64 overflow-y-auto`},j4=[`onClick`],M4={class:`min-w-0 flex-1`},N4={class:`block truncate text-xs`},P4={class:`block truncate font-mono text-2xs text-faint`},F4={class:`shrink-0 font-mono text-2xs text-faint`},I4={key:1,class:`px-2 py-2 text-xs text-muted`},L4={class:`px-2 pt-1.5 text-xs font-semibold text-ink`},R4={class:`mt-1 px-2 text-2xs leading-4 text-muted`},z4={class:`mt-2 flex justify-end gap-1.5 px-1 pb-1`},B4=N({__name:`WorkspacePicker`,props:{workspaces:{},selectedId:{}},emits:[`select`,`create`,`rename`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=W(()=>n.workspaces.find(e=>e.id===n.selectedId)??null);function s(e){r(`select`,e),i.value=!1}function c(){a.value=!0}function l(){a.value=!1}function u(){let e=o.value;a.value=!1,i.value=!1,e!==null&&r(`remove`,e)}function d(){i.value=!1,r(`create`)}function f(){i.value=!1,o.value!==null&&r(`rename`,o.value)}async function p(e){i.value=e,e&&(a.value=!1,await ir())}return(t,n)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":p},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[B(`button`,{type:`button`,class:D(A(Q)(`flex h-8 min-w-0 max-w-36 items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 text-xs transition-colors duration-150 hover:border-line hover:text-ink sm:max-w-52`,A(zB))),"aria-label":A(Y)(`topbar.workspaceLabel`,{name:o.value?.label??A(Y)(`common.none`)})},[V(A(Sy),{class:`size-3.5 shrink-0 text-faint`}),B(`span`,D4,O(o.value?.label??A(Y)(`workspace.none`)),1),B(`span`,O4,O(o.value?.runningCount??0)+`/`+O(o.value?.serverCount??0),1),V(A(ry),{class:`size-3 shrink-0 text-faint`})],10,E4)]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-1 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[a.value?(L(),R(I,{key:1},[B(`p`,L4,O(A(Y)(`workspace.deleteTitle`,{name:o.value?.label??``})),1),B(`p`,R4,O(A(Y)(`workspace.deleteBody`)),1),B(`div`,z4,[V($,{size:`xs`,variant:`ghost`,onClick:l},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{size:`xs`,variant:`danger`,onClick:u},{default:j(()=>[V(A($y),{class:`size-3`}),H(O(A(Y)(`workspace.delete`)),1)]),_:1})])],64)):(L(),R(I,{key:0},[B(`p`,k4,O(A(Y)(`workspace.listHeading`)),1),e.workspaces.length>0?(L(),R(`ul`,A4,[(L(!0),R(I,null,P(e.workspaces,t=>(L(),R(`li`,{key:t.id},[B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left transition-colors duration-100`,t.id===e.selectedId?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`,A(zB))),onClick:e=>s(t.id)},[V(A(Qv),{class:D([`size-3.5 shrink-0`,t.id===e.selectedId?`text-accent`:`opacity-0`])},null,8,[`class`]),B(`span`,M4,[B(`span`,N4,O(t.label),1),B(`span`,P4,O(t.id),1)]),B(`span`,F4,O(t.runningCount)+`/`+O(t.serverCount),1)],10,j4)]))),128))])):(L(),R(`p`,I4,O(A(Y)(`workspace.emptyList`)),1)),n[0]||=B(`div`,{class:`my-1 h-px bg-line`},null,-1),B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted transition-colors duration-100 hover:bg-hover hover:text-ink`,A(zB))),onClick:d},[V(A(Fy),{class:`size-3.5`}),H(` `+O(A(Y)(`workspace.newAction`)),1)],2),o.value?(L(),R(I,{key:2},[B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted transition-colors duration-100 hover:bg-hover hover:text-ink`,A(zB))),onClick:f},[V(A(Ny),{class:`size-3.5`}),H(` `+O(A(Y)(`workspace.renameActionFor`,{name:o.value.label})),1)],2),B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-danger transition-colors duration-100 hover:bg-danger-soft`,A(zB))),onClick:c},[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`workspace.deleteActionFor`,{name:o.value.label})),1)],2)],64)):U(``,!0)],64))]),_:1})]),_:1})]),_:1},8,[`open`]))}}),V4=N({__name:`WorkspaceSwitcher`,setup(e){let{workspaces:t,activeId:n,select:r,create:i,rename:a,remove:o}=gI(),s=$g(),c=Qg(),l=k(!1),u=k(`create`),d=k(null);function f(e){r(e);let t=String(s.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?c.push(D2(e,t)):t===`server-detail`&&c.push(D2(e,`servers`))}function p(){u.value=`create`,d.value=null,l.value=!0}function m(e){u.value=`rename`,d.value=e,l.value=!0}async function h(e){if(u.value===`create`)return await i(e)!==void 0;let t=d.value;return t!==null&&a(t.id,e)}async function g(e){let t=String(s.params.workspaceId??``)||n.value;if(!await o(e.id)||t!==e.id)return;let r=String(s.name??``);(r===`overview`||r===`servers`||r===`logs`||r===`settings`)&&c.push(D2(n.value,r))}return(e,r)=>(L(),R(I,null,[V(B4,{workspaces:A(t),"selected-id":A(n),onSelect:f,onCreate:p,onRename:m,onRemove:g},null,8,[`workspaces`,`selected-id`]),V(T4,{open:l.value,"onUpdate:open":r[0]||=e=>l.value=e,mode:u.value,initial:d.value?.label??``,submit:h},null,8,[`open`,`mode`,`initial`])],64))}}),H4={class:`flex h-13 shrink-0 items-center gap-3 border-b border-line bg-panel/80 px-3 backdrop-blur-sm sm:px-4`},U4=[`aria-label`],W4={class:`min-w-0 flex-1 truncate text-sm font-semibold tracking-tight text-ink`},G4={class:`flex min-w-0 shrink items-center gap-1.5`},K4={class:`pr-6`},q4={class:`hidden items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 py-1.5 md:flex`},J4={class:`font-mono text-2xs text-muted`},Y4={class:`px-2 py-1.5`},X4={class:`text-2xs text-faint`},Z4={class:`truncate font-mono text-2xs text-muted`},Q4=N({__name:`TopBar`,props:{panelUrl:{},connection:{},authenticated:{type:Boolean}},emits:[`menu`,`palette`,`signOut`],setup(e,{emit:t}){let n=e,r=t,i=$g(),a=uI(),o=W(()=>{if(i.name===`server-detail`)return`${Y(`nav.servers`)} / ${String(i.params.id??``)}`;let e=i.meta.titleKey;return typeof e==`string`?Y(e):String(i.meta.title??Y(`app.name`))}),s=W(()=>a.preference.value===`dark`?Ay:a.preference.value===`light`?Yy:ky),c=W(()=>Y(`theme.label`,{theme:Y(`theme.${a.preference.value}`)})),l=W(()=>({open:`bg-ok`,connecting:`bg-warn`,closed:`bg-danger`})[n.connection]),u=W(()=>({open:`connection.liveUpdates`,connecting:`connection.connecting`,closed:`connection.reconnecting`})[n.connection]);return(t,i)=>(L(),R(`header`,H4,[B(`button`,{type:`button`,class:`grid size-8 shrink-0 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`topbar.openNavigation`),onClick:i[0]||=e=>r(`menu`)},[V(A(Oy),{class:`size-4`})],8,U4),B(`h1`,W4,O(o.value),1),B(`div`,G4,[B(`button`,{type:`button`,class:D(A(Q)(`hidden h-8 items-center gap-2 rounded-control border border-line bg-panel-2 px-2.5 text-xs text-faint transition-colors duration-150 hover:border-line hover:text-muted sm:flex`,A(zB))),onClick:i[1]||=e=>r(`palette`)},[V(A(Vy),{class:`size-3.5`}),B(`span`,K4,O(A(Y)(`topbar.search`)),1),i[5]||=B(`kbd`,{class:`rounded border border-line bg-page px-1 py-0.5 font-mono text-2xs text-faint`},`⌘K`,-1)],2),V(_H,{label:A(Y)(u.value)},{default:j(()=>[B(`span`,q4,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,l.value))},null,2),B(`span`,J4,O(e.panelUrl),1)])]),_:1},8,[`label`]),V(_H,{label:c.value},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":c.value,onClick:i[2]||=e=>A(a).cycle()},{default:j(()=>[(L(),z(_a(s.value),{class:`size-4`}))]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),n.authenticated?(L(),z(A(pg),{key:0},{default:j(()=>[V(A(vg),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`topbar.account`)},{default:j(()=>[...i[6]||=[B(`span`,{class:`grid size-5 place-items-center rounded-full bg-accent-soft font-mono text-2xs font-semibold text-accent`},`hh`,-1)]]),_:1},8,[`aria-label`])]),_:1}),V(A(gg),null,{default:j(()=>[V(A(mg),{"side-offset":6,align:`end`,class:`z-50 min-w-44 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`div`,Y4,[B(`p`,X4,O(A(Y)(`topbar.signedIn`)),1),B(`p`,Z4,O(n.panelUrl),1)]),V(A(_g),{class:`my-1 h-px bg-line`}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:i[3]||=e=>r(`signOut`)},{default:j(()=>[V(A(Ey),{class:`size-3.5`}),H(` `+O(A(Y)(`topbar.signOut`)),1)]),_:1})]),_:1})]),_:1})]),_:1})):U(``,!0),V(_H,{label:A(Y)(`topbar.commandPalette`)},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,class:`sm:hidden`,"aria-label":A(Y)(`topbar.commandPalette`),onClick:i[4]||=e=>r(`palette`)},{default:j(()=>[V(A(ly),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),V(V4)])]))}}),$4={key:1,class:`flex h-dvh overflow-hidden bg-page`},e3={class:`hidden w-60 shrink-0 border-r border-line bg-panel/50 lg:block`},t3={key:0,class:`fixed inset-y-0 left-0 z-40 w-64 border-r border-line bg-panel lg:hidden`},n3={class:`flex min-w-0 flex-1 flex-col`},r3=N({__name:`App`,setup(e){let t=$g(),n=Qg(),r=tI(),i=gI(),{session:a,logout:o}=sP(),s=k(!1),c=k(!1),l=W(()=>a.value?.authenticated===!0),u=W(()=>a.value?.authRequired===!0),d=W(()=>t.name===`login`),f=W(()=>t.name===`logs`),p=W(()=>i.runningCount.value),m=W(()=>i.serverCount.value),h=W(()=>r.control.value?.url??`—`),g=W(()=>r.host.value),_=W(()=>r.control.value?.label??`home-hosted`),v=W(()=>r.version.value),y=W(()=>i.selected.value?.label??`none`),b=W(()=>i.activeId.value);return M(W(()=>oP(a.value)),e=>{e!==`wait`&&(e===`login`?($F(),n.push({name:`login`})):QF())},{immediate:!0}),M(()=>t.fullPath,()=>{c.value=!1}),ia(async()=>{(!u.value||l.value)&&await r.refresh()}),ze(()=>$F()),(e,t)=>{let n=ha(`RouterView`);return L(),z(A(Tg),{"delay-duration":300},{default:j(()=>[d.value?(L(),z(n,{key:0})):(L(),R(`div`,$4,[B(`aside`,e3,[V(d4,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])]),V(Ac,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:j(()=>[c.value?(L(),R(`div`,{key:0,class:`fixed inset-0 z-40 bg-black/45 lg:hidden`,onClick:t[0]||=e=>c.value=!1})):U(``,!0)]),_:1}),V(Ac,{"enter-active-class":`transition-transform duration-150 ease-out`,"leave-active-class":`transition-transform duration-100 ease-in`,"enter-from-class":`-translate-x-full`,"leave-to-class":`-translate-x-full`},{default:j(()=>[c.value?(L(),R(`aside`,t3,[V(d4,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value,onNavigate:t[1]||=e=>c.value=!1,onClose:t[2]||=e=>c.value=!1},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])])):U(``,!0)]),_:1}),B(`div`,n3,[V(Q4,{"panel-url":h.value,connection:A(r).connection.value,authenticated:l.value,onMenu:t[3]||=e=>c.value=!0,onPalette:t[4]||=e=>s.value=!0,onSignOut:t[5]||=e=>A(o)()},null,8,[`panel-url`,`connection`,`authenticated`]),d.value?U(``,!0):(L(),z(g4,{key:0,control:A(r).control.value,"config-error":A(i).configError.value,"config-path":A(i).selected.value?.configPath},null,8,[`control`,`config-error`,`config-path`])),B(`main`,{class:D(A(Q)(`relative min-h-0 flex-1`,f.value?`overflow-hidden`:`overflow-y-auto`))},[V(n)],2)])])),V(L2,{open:s.value,"onUpdate:open":t[6]||=e=>s.value=e},null,8,[`open`]),V(S4)]),_:1})}}});yF().catch(()=>{}).finally(()=>{Du(r3).use(E2).mount(`#app`)});
49
+ `),bootstrapEnv:IB(e.bootstrap?.env??{}),bootstrapTimeoutMs:e.bootstrap?.timeoutMs??12e4,bootstrapRunOnce:e.bootstrap?.runOnce??!0,dumpEnabled:e.dump!==null&&e.dump!==void 0,dumpCommand:e.dump?.command??``,dumpArgs:(e.dump?.args??[]).join(`
50
+ `),dumpEnv:IB(e.dump?.env??{}),dumpTimeoutMs:e.dump?.timeoutMs??6e5,loadEnabled:e.load!==null&&e.load!==void 0,loadCommand:e.load?.command??``,loadArgs:(e.load?.args??[]).join(`
51
+ `),loadEnv:IB(e.load?.env??{}),loadTimeoutMs:e.load?.timeoutMs??6e5}}let u=tn(l(n.config)),d=k({...n.config.restart}),f=k(eB(n.config.health)),p=k({...n.config.stop}),m=W(()=>{let e=[{value:`local`,label:Y(`bind.local`)},{value:`lan`,label:Y(`bind.lan`)}];return/^\d{1,3}(?:\.\d{1,3}){3}$/.test(n.config.bind)&&e.push({value:n.config.bind,label:Y(`bind.explicit`,{bind:n.config.bind})}),e});function h(){let e=Number.isFinite(u.maxRssMb)?u.maxRssMb:0,t=Number.isFinite(u.logBufferLines)&&u.logBufferLines>=50?u.logBufferLines:50,n=Number.isFinite(u.bootstrapTimeoutMs)?u.bootstrapTimeoutMs:0,r=Number.isFinite(u.dumpTimeoutMs)?u.dumpTimeoutMs:0,i=Number.isFinite(u.loadTimeoutMs)?u.loadTimeoutMs:0;return{label:u.label.trim().length===0?null:u.label.trim(),command:u.command.trim(),cwd:u.cwd.trim()===``?`.`:u.cwd.trim(),args:FB(u.args),env:LB(u.env),dataEnvs:LB(u.dataEnvs),backupPaths:FB(u.backupPaths),backupIgnoreGenerated:u.backupIgnoreGenerated,dependsOn:RB(u.dependsOn),envFile:u.envFile.trim(),resources:{maxRssBytes:e>0?Math.round(e*1024*1024):0},port:u.port===null||Number.isNaN(u.port)?null:u.port,bind:u.bind,onPortConflict:u.onPortConflict,logBufferLines:t,enabled:u.enabled,autostart:u.autostart,persistent:u.persistent,restart:{...d.value},health:eB(f.value),stop:{...p.value},bootstrap:u.bootstrapEnabled?{command:u.bootstrapCommand.trim(),args:FB(u.bootstrapArgs),env:LB(u.bootstrapEnv),timeoutMs:n,runOnce:u.bootstrapRunOnce}:null,dump:u.dumpEnabled?{command:u.dumpCommand.trim(),args:FB(u.dumpArgs),env:LB(u.dumpEnv),timeoutMs:r}:null,load:u.loadEnabled?{command:u.loadCommand.trim(),args:FB(u.loadArgs),env:LB(u.loadEnv),timeoutMs:i}:null}}function g(e,t){let r=n.config[t]??{},i=e[t]??{},a={};for(let[e,t]of Object.entries(i))r[e]!==t&&(a[e]=t);return Object.keys(a).length>0?a:null}function _(e){for(let t of i)g(e,t)===null&&delete e[t];return zz(n.config,e)}function v(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}let y=W(()=>_(h())),b=W(()=>Hz(y.value)),x=W(()=>b.value>0),S=W(()=>Vz(y.value,n.config)),C=k(!1),w=EX(n.config);function T(e){Object.assign(u,l(e)),d.value={...e.restart},f.value=eB(e.health),p.value={...e.stop},w=EX(e),s.value=null}M(()=>n.config,e=>{v(e,w)||T(e)});async function ee(){s.value=null,o.value=!0;try{let e=h(),t=Rj(e);if(t instanceof J.errors){s.value=t.summary;return}let i=_(e);if(Object.keys(i).length===0){r(`saved`);return}if(await a.saveConfig(n.workspaceId,n.serverId,i),a.lastError.value!==null){s.value=a.lastError.value;return}r(`saved`)}finally{o.value=!1}}return(e,t)=>(L(),R(I,null,[B(`form`,{class:`border-t border-line bg-page/40 px-4 py-4`,onSubmit:_u(ee,[`prevent`])},[B(`header`,$$,[B(`div`,e1,[B(`h2`,t1,O(A(Y)(`editor.title`)),1),B(`p`,n1,[V(HV,{k:`editor.description`},{file:j(()=>[...t[42]||=[B(`span`,{class:`font-mono`},`servers.config.json`,-1)]]),_:1})])]),B(`div`,r1,[b.value>0?(L(),R(`button`,{key:0,type:`button`,class:`rounded-control px-1 py-0.5 text-2xs text-warn underline decoration-warn/40 underline-offset-2 transition-colors duration-150 hover:text-ink`,onClick:t[0]||=e=>C.value=!0},[B(`span`,i1,O(b.value),1),H(` `+O(A(PF)(`editor.unsaved`,b.value)),1)])):(L(),R(`span`,a1,O(A(Y)(`editor.inSync`)),1))])]),B(`div`,o1,[V(QB,{title:A(Y)(`editor.process`),description:A(Y)(`editor.processDescription`),columns:2},{default:j(()=>[V(bV,{modelValue:u.label,"onUpdate:modelValue":t[1]||=e=>u.label=e,label:A(Y)(`common.label`),placeholder:A(Y)(`editor.labelPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(bV,{modelValue:u.command,"onUpdate:modelValue":t[2]||=e=>u.command=e,label:A(Y)(`common.command`),placeholder:`node`,required:``,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(bV,{modelValue:u.cwd,"onUpdate:modelValue":t[3]||=e=>u.cwd=e,label:A(Y)(`serverForm.workingDirectory`),placeholder:`.`,hint:A(Y)(`serverForm.cwdHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(bV,{modelValue:u.envFile,"onUpdate:modelValue":t[4]||=e=>u.envFile=e,label:A(Y)(`serverForm.envFile`),placeholder:A(Y)(`serverForm.envFilePlaceholder`),hint:A(Y)(`serverForm.envFileHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`placeholder`,`hint`]),V(VV,{modelValue:u.args,"onUpdate:modelValue":t[5]||=e=>u.args=e,label:A(Y)(`serverForm.arguments`),rows:3,hint:A(Y)(`editor.argumentsHint`),placeholder:`-p
52
+ {port}`},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:u.env,"onUpdate:modelValue":t[6]||=e=>u.env=e,label:A(Y)(`common.environment`),rows:3,hint:A(Y)(`serverForm.envHint`),placeholder:`NODE_ENV=production`},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:u.dataEnvs,"onUpdate:modelValue":t[7]||=e=>u.dataEnvs=e,label:A(Y)(`serverForm.dataEnvs`),rows:3,hint:A(Y)(`serverForm.dataEnvsHint`),placeholder:`DATA_DIR={home}/.app`},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:u.backupPaths,"onUpdate:modelValue":t[8]||=e=>u.backupPaths=e,label:A(Y)(`serverForm.backupPaths`),rows:2,hint:A(Y)(`serverForm.backupPathsHint`),placeholder:`{home}/.app/uploads`},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:u.backupIgnoreGenerated,"onUpdate:modelValue":t[9]||=e=>u.backupIgnoreGenerated=e,label:A(Y)(`serverForm.backupIgnore`),hint:A(Y)(`serverForm.backupIgnoreHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(bV,{modelValue:u.dependsOn,"onUpdate:modelValue":t[10]||=e=>u.dependsOn=e,label:A(Y)(`serverForm.dependsOn`),placeholder:`postgres, redis`,hint:A(Y)(`serverForm.dependsOnHint`),class:`font-mono text-xs`},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:u.maxRssMb,"onUpdate:modelValue":t[11]||=e=>u.maxRssMb=e,label:A(Y)(`serverForm.maxRssMb`),min:0,hint:A(Y)(`serverForm.maxRssHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`editor.portTitle`),description:A(Y)(`editor.portDescription`),columns:2},{default:j(()=>[V(lV,{modelValue:u.port,"onUpdate:modelValue":t[12]||=e=>u.port=e,label:A(Y)(`common.port`),nullable:``,min:1,max:65535,hint:A(Y)(`serverForm.portHint`)},null,8,[`modelValue`,`label`,`hint`]),V(hV,{modelValue:u.bind,"onUpdate:modelValue":t[13]||=e=>u.bind=e,label:A(Y)(`serverForm.bindAddress`),options:m.value,hint:A(Y)(`editor.bindHint`)},null,8,[`modelValue`,`label`,`options`,`hint`]),V(hV,{modelValue:u.onPortConflict,"onUpdate:modelValue":t[14]||=e=>u.onPortConflict=e,label:A(Y)(`serverForm.onPortConflict`),options:[{value:`block`,label:A(Y)(`onPortConflict.block`)},{value:`warn`,label:A(Y)(`onPortConflict.warn`)},{value:`follow`,label:A(Y)(`onPortConflict.follow`)},{value:`reclaim`,label:A(Y)(`onPortConflict.reclaim`)},{value:`kill`,label:A(Y)(`onPortConflict.kill`)}]},null,8,[`modelValue`,`label`,`options`]),V(lV,{modelValue:u.logBufferLines,"onUpdate:modelValue":t[15]||=e=>u.logBufferLines=e,label:A(Y)(`serverForm.logBufferLines`),min:50,max:1e5,step:50},null,8,[`modelValue`,`label`])]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`editor.lifecycle`),description:A(Y)(`editor.lifecycleDescription`),columns:3},{default:j(()=>[V(CV,{modelValue:u.enabled,"onUpdate:modelValue":t[16]||=e=>u.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`serverForm.enabledHint`)},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:u.autostart,"onUpdate:modelValue":t[17]||=e=>u.autostart=e,label:A(Y)(`serverForm.autostart`),hint:A(Y)(`serverForm.autostartHint`)},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:u.persistent,"onUpdate:modelValue":t[18]||=e=>u.persistent=e,label:A(Y)(`serverForm.persistent`),hint:A(Y)(`serverForm.persistentHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),V(wV,{restart:d.value,"onUpdate:restart":t[19]||=e=>d.value=e,health:f.value,"onUpdate:health":t[20]||=e=>f.value=e,stop:p.value,"onUpdate:stop":t[21]||=e=>p.value=e},null,8,[`restart`,`health`,`stop`]),V(QB,{title:A(Y)(`serverForm.bootstrap`),description:A(Y)(`serverForm.bootstrapDescription`),columns:2},{default:j(()=>[V(CV,{modelValue:u.bootstrapEnabled,"onUpdate:modelValue":t[22]||=e=>u.bootstrapEnabled=e,label:A(Y)(`serverForm.runBootstrap`),hint:A(Y)(`serverForm.bootstrapHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.bootstrapEnabled?(L(),R(I,{key:0},[V(bV,{modelValue:u.bootstrapCommand,"onUpdate:modelValue":t[23]||=e=>u.bootstrapCommand=e,label:A(Y)(`common.command`),placeholder:`./scripts/install.sh`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(lV,{modelValue:u.bootstrapTimeoutMs,"onUpdate:modelValue":t[24]||=e=>u.bootstrapTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(CV,{modelValue:u.bootstrapRunOnce,"onUpdate:modelValue":t[25]||=e=>u.bootstrapRunOnce=e,label:A(Y)(`serverForm.runOnce`),hint:A(Y)(`serverForm.runOnceHint`)},null,8,[`modelValue`,`label`,`hint`])],64)):U(``,!0),u.bootstrapEnabled?(L(),z(VV,{key:1,modelValue:u.bootstrapArgs,"onUpdate:modelValue":t[26]||=e=>u.bootstrapArgs=e,label:A(Y)(`serverForm.bootstrapArgs`),rows:2,hint:A(Y)(`serverForm.bootstrapArgsHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0),u.bootstrapEnabled?(L(),z(VV,{key:2,modelValue:u.bootstrapEnv,"onUpdate:modelValue":t[27]||=e=>u.bootstrapEnv=e,label:A(Y)(`serverForm.bootstrapEnv`),rows:2,hint:A(Y)(`serverForm.bootstrapEnvHint`)},null,8,[`modelValue`,`label`,`hint`])):U(``,!0)]),_:1},8,[`title`,`description`]),V(QB,{title:A(Y)(`serverForm.backupHooks`),description:A(Y)(`serverForm.backupHooksDescription`),columns:2},{default:j(()=>[V(CV,{modelValue:u.dumpEnabled,"onUpdate:modelValue":t[28]||=e=>u.dumpEnabled=e,label:A(Y)(`serverForm.dumpEnabled`),hint:A(Y)(`serverForm.dumpEnabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.dumpEnabled?(L(),R(I,{key:0},[V(bV,{modelValue:u.dumpCommand,"onUpdate:modelValue":t[29]||=e=>u.dumpCommand=e,label:A(Y)(`serverForm.dumpCommand`),placeholder:`mongodump`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(lV,{modelValue:u.dumpTimeoutMs,"onUpdate:modelValue":t[30]||=e=>u.dumpTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(VV,{modelValue:u.dumpArgs,"onUpdate:modelValue":t[31]||=e=>u.dumpArgs=e,label:A(Y)(`serverForm.dumpArgs`),rows:2,hint:A(Y)(`serverForm.dumpArgsHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:u.dumpEnv,"onUpdate:modelValue":t[32]||=e=>u.dumpEnv=e,label:A(Y)(`serverForm.hookEnv`),rows:2,wide:``},null,8,[`modelValue`,`label`])],64)):U(``,!0),V(CV,{modelValue:u.loadEnabled,"onUpdate:modelValue":t[33]||=e=>u.loadEnabled=e,label:A(Y)(`serverForm.loadEnabled`),hint:A(Y)(`serverForm.loadEnabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),u.loadEnabled?(L(),R(I,{key:1},[V(bV,{modelValue:u.loadCommand,"onUpdate:modelValue":t[34]||=e=>u.loadCommand=e,label:A(Y)(`serverForm.loadCommand`),placeholder:`mongorestore`,class:`font-mono text-xs`},null,8,[`modelValue`,`label`]),V(lV,{modelValue:u.loadTimeoutMs,"onUpdate:modelValue":t[35]||=e=>u.loadTimeoutMs=e,label:A(Y)(`serverForm.timeoutMs`),min:1e3,step:1e3},null,8,[`modelValue`,`label`]),V(VV,{modelValue:u.loadArgs,"onUpdate:modelValue":t[36]||=e=>u.loadArgs=e,label:A(Y)(`serverForm.loadArgs`),rows:2,hint:A(Y)(`serverForm.loadArgsHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(VV,{modelValue:u.loadEnv,"onUpdate:modelValue":t[37]||=e=>u.loadEnv=e,label:A(Y)(`serverForm.hookEnv`),rows:2,wide:``},null,8,[`modelValue`,`label`])],64)):U(``,!0)]),_:1},8,[`title`,`description`])]),s.value?(L(),R(`p`,s1,O(s.value),1)):U(``,!0),B(`div`,c1,[V($,{variant:`ghost`,onClick:t[38]||=e=>r(`cancel`)},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1}),V($,{type:`submit`,variant:`primary`,disabled:o.value||!x.value,loading:o.value},{default:j(()=>[H(O(A(Y)(`editor.save`)),1)]),_:1},8,[`disabled`,`loading`])])],32),V(LV,{open:C.value,"onUpdate:open":t[41]||=e=>C.value=e,title:A(Y)(`editor.changesTitle`),description:A(Y)(`editor.changesDescription`),width:`w-[min(92vw,42rem)]`},{footer:j(()=>[V($,{size:`sm`,variant:`ghost`,onClick:t[39]||=e=>C.value=!1},{default:j(()=>[H(O(A(Y)(`common.close`)),1)]),_:1}),V($,{size:`sm`,variant:`primary`,disabled:S.value.length===0||o.value,loading:o.value,onClick:t[40]||=e=>{ee(),C.value=!1}},{default:j(()=>[H(O(A(PF)(`editor.saveChanges`,S.value.length)),1)]),_:1},8,[`disabled`,`loading`])]),default:j(()=>[B(`div`,l1,[S.value.length>0?(L(),R(`ul`,u1,[(L(!0),R(I,null,P(S.value,e=>(L(),R(`li`,{key:e.path,class:`flex flex-wrap items-baseline gap-x-3 gap-y-1 py-2 first:pt-0`},[B(`code`,d1,O(e.path),1),B(`span`,f1,O(A(rz)(e.from)),1),t[43]||=B(`span`,{class:`text-2xs text-faint`},`→`,-1),B(`span`,p1,O(A(rz)(e.to)),1)]))),128))])):(L(),R(`p`,m1,O(A(Y)(`editor.nothingToSave`)),1))])]),_:1},8,[`open`,`title`,`description`])],64))}}),g1={key:0,class:`mx-auto max-w-3xl p-4 sm:p-5`},_1={key:1,class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},v1={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},y1={class:`rounded-full border border-line px-2 py-0.5 text-2xs text-muted`},b1={class:`font-mono text-xs text-faint`},x1=[`href`],S1={class:`px-2 py-1.5`},C1={class:`mb-1 text-2xs text-faint`},w1={class:`flex flex-col gap-0.5`},T1=[`onClick`],E1={class:`space-y-2`},D1={key:0,class:`rounded-control border border-line bg-hover px-3 py-2 text-2xs leading-4 text-muted`},O1={key:1,class:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-control border border-danger/25 bg-danger-soft px-3 py-2`},k1={class:`min-w-0 flex-1 text-2xs leading-4 text-danger`},A1={key:2,class:`rounded-control border border-warn/25 bg-warn-soft px-3 py-2 text-2xs leading-4 text-warn`},j1={class:`grid grid-cols-2 gap-x-4 gap-y-3 p-4 sm:grid-cols-4 lg:grid-cols-6`},M1={class:`truncate text-2xs text-faint`},N1={class:`truncate font-mono text-xs tabular-nums text-ink capitalize`},P1={class:`text-sm font-semibold text-ink`},F1={class:`text-2xs text-muted`},I1={class:`grid grid-cols-1 gap-4 sm:grid-cols-3`},L1={class:`flex items-center justify-between gap-3`},R1=[`title`],z1={key:1,class:`space-y-4`},B1={class:`text-sm font-semibold text-ink`},V1={class:`text-2xs text-muted`},H1={key:0,class:`max-h-96 overflow-auto rounded-control border border-line bg-page/60 p-3 font-mono text-2xs leading-5 text-muted`},U1={key:1,class:`grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2`},W1={class:`text-2xs text-faint`},G1=[`title`],K1={key:2,class:`grid grid-cols-1 gap-4 lg:grid-cols-3`},q1={class:`text-sm font-semibold text-ink`},J1={class:`text-2xs text-muted`},Y1={class:`text-sm font-semibold text-ink`},X1={key:0,class:`flex flex-wrap gap-1.5`},Z1={key:1,class:`text-xs text-muted`},Q1={class:`text-xs text-muted`},$1=N({__name:`ServerDetailView`,setup(e){let t=$g(),n=gI(),r=jI(),i=W(()=>String(t.params.id??``));M([i,()=>n.appState.value],()=>{let e=i.value;if(e.length===0||r.serverById(e)!==void 0)return;let t=n.workspaces.value.filter(t=>t.servers.some(t=>t.id===e));t.length===1&&r.select(t[0].id)},{immediate:!0});let a=W(()=>r.serverById(i.value)),o=W(()=>a.value?.config),s=W(()=>{let e=o.value;return e?.label&&e.label.length>0?e.label:i.value}),c=k(`output`),l=k(!1),u=k(!1),d=k(!1),f=k(!1),p=hI(r.activeId,()=>a.value?i.value:null),m=p.version,h=W(()=>(m.value,p.lines())),g=W(()=>r.seriesOf(i.value)),_=n.now,v=W(()=>a.value?sH(a.value,cH()):null),y=W(()=>g.value.cpu),b=W(()=>g.value.rss),x=W(()=>g.value.probe),S=W(()=>aH(n.host.value?.cpus)),C=W(()=>{let e=a.value;return!e||e.startedAt===null||e.status!==`running`?`—`:YR(_.value-e.startedAt)}),w=W(()=>a.value?.status===`running`),T={unknown:`common.unknown`,free:`views.serverDetail.portFree`,"in-use":`views.serverDetail.portInUse`},ee=W(()=>{let e=a.value;if(!e)return[];let t=LF(e),n=[{key:`pid`,label:Y(`views.serverDetail.pid`),value:e.pid===null?`—`:String(e.pid)},{key:`uptime`,label:Y(`common.uptime`),value:C.value},{key:`status`,label:Y(`common.status`),value:Y(oR[e.status].labelKey)},{key:`health`,label:Y(`views.serverDetail.health`),value:Y(sR[e.health].labelKey)},{key:`port`,label:Y(`views.serverDetail.portState`),value:Y(T[e.portState]??`common.unknown`)},{key:`probe`,label:Y(`views.serverDetail.lastProbe`),value:t.responseMs===null?`—`:`${t.responseMs} ms`},{key:`rss`,label:`RSS`,value:tz(t.rssBytes)},{key:`procs`,label:Y(`views.serverDetail.processes`),value:t.processes===null?`—`:String(t.processes)},{key:`restarts`,label:Y(`views.serverDetail.restarts`),value:`${e.restarts}/${e.maxRetries}`},{key:`up24`,label:Y(`views.serverDetail.uptime24`),value:jR(e.history.uptimeRatio)},{key:`crashes`,label:Y(`views.serverDetail.crashes24`),value:String(e.history.crashes)},{key:`lastcrash`,label:Y(`views.serverDetail.lastCrash`),value:ZR(e.history.lastCrashAt,_.value)}];return e.nextRetryAt!==null&&n.push({key:`retry`,label:Y(`views.serverDetail.nextAttempt`),value:XR(e.nextRetryAt,_.value)}),e.health===`unhealthy`&&e.unhealthySince!==null&&n.push({key:`unhealthy`,label:Y(`views.serverDetail.unhealthyFor`),value:YR(_.value-e.unhealthySince)}),n}),te=W(()=>JSON.stringify(o.value??{},null,2)),ne=W(()=>o.value?`${o.value.command} ${o.value.args.join(` `)}`.trim():``),re=W(()=>{let e=o.value?.bind??`local`,t=[{value:`local`,label:Y(`views.serverDetail.bindLocal`)},{value:`lan`,label:Y(`views.serverDetail.bindLan`)}];return e!==`local`&&e!==`lan`&&t.push({value:e,label:Y(`views.serverDetail.bindCustom`,{bind:e})}),t});async function ie(e){f.value=!0;try{await n[e](r.activeId.value,i.value)}finally{f.value=!1}}async function ae(){d.value=!1,await r.removeServer(i.value)}async function oe(){let e=a.value;if(e){f.value=!0;try{await r.freePort(e.id)}finally{f.value=!1}}}let se=W(()=>YN(r.activeId.value,i.value,`${i.value}.log`)),ce=[{value:`output`,labelKey:`views.serverDetail.sectionOutput`},{value:`config`,labelKey:`views.serverDetail.sectionConfig`},{value:`history`,labelKey:`views.serverDetail.sectionHistory`}].map(e=>({value:e.value,label:Y(e.labelKey)}));return(e,t)=>{let n=ha(`RouterLink`);return a.value?(L(),R(`div`,_1,[V(vU,{title:s.value,"back-to":A(J2)(A(r).activeId.value,`servers`),"back-label":A(Y)(`views.serverDetail.allServers`)},{badges:j(()=>[V(NH,{status:a.value.status,health:a.value.health},null,8,[`status`,`health`]),a.value.adopted?(L(),z(PH,{key:0,label:A(Y)(`views.serverDetail.detachedHint`)},{default:j(()=>[B(`span`,v1,O(A(Y)(`views.serverDetail.detached`)),1)]),_:1},8,[`label`])):U(``,!0),a.value.config.persistent?(L(),z(PH,{key:1,label:A(Y)(`views.serverDetail.persistentHint`)},{default:j(()=>[B(`span`,y1,O(A(Y)(`views.serverDetail.persistent`)),1)]),_:1},8,[`label`])):U(``,!0),B(`span`,b1,O(a.value.id),1),v.value?(L(),R(`a`,{key:2,href:v.value,target:`_blank`,rel:`noreferrer`,class:`inline-flex items-center gap-1 font-mono text-xs text-accent hover:underline`},[H(O(v.value)+` `,1),V(A(my),{class:`size-3`})],8,x1)):U(``,!0)]),actions:j(()=>[V($,{variant:`primary`,disabled:f.value||!o.value?.enabled||[`running`,`starting`].includes(a.value.status),onClick:t[0]||=e=>ie(`start`)},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.start`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||a.value.status===`stopped`,onClick:t[1]||=e=>ie(`stop`)},{default:j(()=>[V(A(Jy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.stop`)),1)]),_:1},8,[`disabled`]),V($,{disabled:f.value||!o.value?.enabled,onClick:t[2]||=e=>ie(`restart`)},{default:j(()=>[V(A(zy),{class:`size-3.5`}),H(O(A(Y)(`views.serverDetail.restart`)),1)]),_:1},8,[`disabled`]),V(PH,{label:A(Y)(`views.serverDetail.editHint`)},{default:j(()=>[V($,{variant:l.value?`secondary`:`ghost`,onClick:t[3]||=e=>{l.value=!l.value,c.value=`config`}},{default:j(()=>[V(A(Ny),{class:`size-3.5`}),H(O(l.value?A(Y)(`views.serverDetail.closeEditor`):A(Y)(`common.edit`)),1)]),_:1},8,[`variant`])]),_:1},8,[`label`]),V(A(pg),null,{default:j(()=>[V(A(vg),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`views.serverDetail.moreActions`,{label:s.value})},{default:j(()=>[V(A(py),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1}),V(A(gg),null,{default:j(()=>[V(A(mg),{"side-offset":4,align:`end`,class:`z-50 min-w-56 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[4]||=e=>A(r).setEnabled(a.value.id,!a.value.config.enabled)},{default:j(()=>[H(O(o.value?.enabled?A(Y)(`views.serverDetail.disableServer`):A(Y)(`views.serverDetail.enableServer`)),1)]),_:1}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:t[5]||=e=>A(r).setAutostart(a.value.id,!a.value.config.autostart)},{default:j(()=>[H(O(o.value?.autostart?A(Y)(`views.serverDetail.removeAutostart`):A(Y)(`views.serverDetail.autostart`)),1)]),_:1}),V(A(_g),{class:`my-1 h-px bg-line`}),B(`div`,S1,[B(`p`,C1,O(A(Y)(`views.serverDetail.bind`)),1),B(`div`,w1,[(L(!0),R(I,null,P(re.value,e=>(L(),R(`button`,{key:e.value,type:`button`,class:D([`rounded-control px-2 py-1 text-left font-mono text-2xs transition-colors duration-150 hover:bg-hover`,e.value===o.value?.bind?`text-accent`:`text-muted`]),onClick:t=>A(r).setBind(a.value.id,e.value)},O(e.label),11,T1))),128))])]),V(A(_g),{class:`my-1 h-px bg-line`}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-danger outline-none data-[highlighted]:bg-danger-soft`,onSelect:t[6]||=e=>d.value=!0},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`views.serverDetail.removeServer`)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,[`title`,`back-to`,`back-label`]),B(`div`,E1,[o.value&&!o.value.enabled?(L(),R(`p`,D1,O(A(Y)(`views.serverDetail.disabledNote`)),1)):U(``,!0),a.value.lastError?(L(),R(`div`,O1,[B(`p`,k1,O(a.value.lastError),1),a.value.status===`conflict`&&a.value.config.port!==null?(L(),z(fH,{key:0,port:a.value.config.port,busy:f.value,onConfirm:oe},null,8,[`port`,`busy`])):U(``,!0)])):U(``,!0),a.value.health===`unhealthy`?(L(),R(`p`,A1,[a.value.unhealthySince===null?(L(),R(I,{key:1},[H(O(A(Y)(`views.serverDetail.probeFailed`)),1)],64)):(L(),R(I,{key:0},[H(O(A(Y)(`views.serverDetail.probeFailedFor`,{duration:A(YR)(A(_)-a.value.unhealthySince)})),1)],64))])):U(``,!0)]),V(SU,{class:`p-0`},{default:j(()=>[B(`dl`,j1,[(L(!0),R(I,null,P(ee.value,e=>(L(),R(`div`,{key:e.key,class:`min-w-0`},[B(`dt`,M1,O(e.label),1),B(`dd`,N1,O(e.value),1)]))),128))])]),_:1}),V(SU,null,{header:j(()=>[B(`h2`,P1,O(A(Y)(`views.serverDetail.telemetry`)),1),B(`p`,F1,O(A(Y)(`views.serverDetail.telemetryNote`)),1)]),default:j(()=>[B(`div`,I1,[V(kH,{label:A(Y)(`common.cpu`),values:y.value,format:A(nz),max:S.value,"color-class":`text-cpu`,height:40,"empty-hint":w.value?void 0:A(Y)(`metric.notRunning`)},null,8,[`label`,`values`,`format`,`max`,`empty-hint`]),V(kH,{label:A(Y)(`views.serverDetail.memoryRss`),values:b.value,format:A(tz),"color-class":`text-mem`,height:40,"empty-hint":w.value?void 0:A(Y)(`metric.notRunning`)},null,8,[`label`,`values`,`format`,`empty-hint`]),V(kH,{label:A(Y)(`views.serverDetail.healthProbe`),values:x.value,format:e=>e===null?`—`:`${e} ms`,"color-class":`text-probe`,height:40,"empty-hint":A(Y)(`serverCard.notProbed`)},null,8,[`label`,`values`,`format`,`empty-hint`])])]),_:1}),B(`div`,L1,[V(mG,{modelValue:c.value,"onUpdate:modelValue":t[7]||=e=>c.value=e,options:A(ce),size:`md`},null,8,[`modelValue`,`options`]),B(`p`,{class:`hidden font-mono text-2xs text-faint sm:block`,title:ne.value},O(ne.value),9,R1)]),c.value===`output`?(L(),z(OY,{key:0,lines:h.value,version:A(m),live:``,clearable:``,"download-url":a.value.config.logBufferLines>0?se.value:void 0,"download-name":`${a.value.id}.log`,"empty-hint":w.value?A(Y)(`views.serverDetail.waitingFirstLine`):A(Y)(`views.serverDetail.neverWritten`),"min-height":`22rem`,onClear:t[8]||=e=>A(r).clearLogs(a.value.id)},null,8,[`lines`,`version`,`download-url`,`download-name`,`empty-hint`])):c.value===`config`?(L(),R(`div`,z1,[l.value?(L(),z(h1,{key:0,"server-id":a.value.id,"workspace-id":A(r).activeId.value,config:a.value.config,onSaved:t[9]||=e=>l.value=!1,onCancel:t[10]||=e=>l.value=!1},null,8,[`server-id`,`workspace-id`,`config`])):(L(),z(SU,{key:1},{header:j(()=>[B(`h2`,B1,O(A(Y)(`views.serverDetail.effectiveConfig`)),1),B(`p`,V1,O(A(Y)(`views.serverDetail.effectiveConfigNote`)),1)]),actions:j(()=>[V($,{size:`xs`,variant:`ghost`,onClick:t[11]||=e=>u.value=!u.value},{default:j(()=>[V(A(cy),{class:`size-3`}),H(O(u.value?A(Y)(`views.serverDetail.fields`):A(Y)(`views.serverDetail.rawJson`)),1)]),_:1}),V(AG,{value:te.value,label:A(Y)(`views.serverDetail.copyJson`)},null,8,[`value`,`label`]),V($,{size:`xs`,variant:`primary`,onClick:t[12]||=e=>l.value=!0},{default:j(()=>[V(A(Ny),{class:`size-3`}),H(O(A(Y)(`common.edit`)),1)]),_:1})]),default:j(()=>[u.value?(L(),R(`pre`,H1,O(te.value),1)):(L(),R(`dl`,U1,[(L(!0),R(I,null,P([{label:A(Y)(`views.serverDetail.fieldCommand`),value:o.value?.command},{label:A(Y)(`views.serverDetail.fieldArgs`),value:o.value?.args.join(` `)||`—`},{label:A(Y)(`views.serverDetail.fieldCwd`),value:o.value?.cwd},{label:A(Y)(`views.serverDetail.fieldEnv`),value:Object.keys(o.value?.env??{}).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDataEnvs`),value:Object.entries(o.value?.dataEnvs??{}).map(([e,t])=>`${e}=${t}`).join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldEnvFile`),value:o.value?.envFile||`—`},{label:A(Y)(`views.serverDetail.fieldPortBind`),value:`${o.value?.port??A(Y)(`common.none`)} · ${o.value?.bind}`},{label:A(Y)(`views.serverDetail.fieldOnPortConflict`),value:o.value?.onPortConflict},{label:A(Y)(`views.serverDetail.fieldLogBuffer`),value:A(PF)(`logs.lines`,o.value?.logBufferLines??0)},{label:A(Y)(`views.serverDetail.fieldRssLimit`),value:o.value?.resources.maxRssBytes?A(tz)(o.value.resources.maxRssBytes):A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldHealth`),value:o.value?.health.enabled?`${o.value.health.mode} every ${o.value.health.intervalMs} ms`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldRestart`),value:o.value?.restart.enabled?`${o.value.restart.maxRetries} retries, ×${o.value.restart.factor}`:A(Y)(`common.disabled`)},{label:A(Y)(`views.serverDetail.fieldStop`),value:o.value?`${o.value.stop.signal} after ${o.value.stop.graceMs} ms`:`—`},{label:A(Y)(`views.serverDetail.fieldBootstrap`),value:o.value?.bootstrap?`${o.value.bootstrap.command} ${o.value.bootstrap.args.join(` `)}`:A(Y)(`common.none`)},{label:A(Y)(`views.serverDetail.fieldBackupPaths`),value:o.value?.backupPaths.join(`, `)||`—`},{label:A(Y)(`views.serverDetail.fieldDependsOn`),value:o.value?.dependsOn.join(`, `)||`—`}],e=>(L(),R(`div`,{key:e.label,class:`min-w-0 border-b border-line-soft pb-1.5 last:border-0`},[B(`dt`,W1,O(e.label),1),B(`dd`,{class:`truncate font-mono text-xs text-ink`,title:String(e.value)},O(e.value),9,G1)]))),128))]))]),_:1}))])):(L(),R(`div`,K1,[V(SU,{class:`lg:col-span-2`},{header:j(()=>[B(`h2`,q1,O(A(Y)(`views.serverDetail.eventHistory`)),1),B(`p`,J1,O(A(Y)(`views.serverDetail.eventHistoryNote`)),1)]),default:j(()=>[V(Mz,{servers:[a.value],now:A(_),limit:30},null,8,[`servers`,`now`])]),_:1}),V(SU,null,{header:j(()=>[B(`h2`,Y1,O(A(Y)(`views.serverDetail.dependencies`)),1)]),default:j(()=>[o.value&&o.value.dependsOn.length>0?(L(),R(`div`,X1,[(L(!0),R(I,null,P(o.value.dependsOn,e=>(L(),z(n,{key:e,to:A(J2)(A(r).activeId.value,`servers`,e),class:`rounded-full border border-line px-2 py-0.5 font-mono text-2xs text-muted transition-colors duration-150 hover:border-accent/40 hover:text-accent`},{default:j(()=>[H(O(e),1)]),_:2},1032,[`to`]))),128))])):(L(),R(`p`,Z1,[V(HV,{k:`views.serverDetail.startsOnItsOwn`},{code:j(()=>[...t[15]||=[B(`code`,null,`dependsOn`,-1)]]),_:1})]))]),_:1})])),V(LV,{open:d.value,"onUpdate:open":t[14]||=e=>d.value=e,title:A(Y)(`views.serverDetail.removeTitle`),description:A(Y)(`views.serverDetail.removeDescription`,{label:s.value}),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,onClick:t[13]||=e=>d.value=!1},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{variant:`danger`,onClick:ae},{default:j(()=>[V(A($y),{class:`size-3.5`}),H(O(A(Y)(`common.remove`)),1)]),_:1})]),default:j(()=>[B(`p`,Q1,O(A(Y)(`views.serverDetail.removeNote`)),1)]),_:1},8,[`open`,`title`,`description`])])):(L(),R(`div`,g1,[V(AR,{title:A(Y)(`views.serverDetail.goneTitle`),description:A(Y)(`views.serverDetail.goneDescription`,{id:i.value})},{action:j(()=>[V(n,{to:A(J2)(A(r).activeId.value,`servers`)},{default:j(()=>[V($,{variant:`primary`},{default:j(()=>[H(O(A(Y)(`views.serverDetail.backToServers`)),1)]),_:1})]),_:1},8,[`to`])]),_:1},8,[`title`,`description`])]))}}}),e0={class:`mx-auto max-w-7xl space-y-5 p-4 sm:p-5`},t0={class:`flex flex-wrap items-center gap-2`},n0={class:`relative ml-auto w-full sm:w-64`},r0=[`placeholder`,`aria-label`],i0=[`aria-label`],a0={class:`mt-0.5`},o0={class:`mt-2 space-y-1`},s0={class:`rounded-control bg-black/10 px-1.5 py-0.5 font-mono text-2xs dark:bg-white/10`},c0={class:`font-mono text-2xs text-muted`},l0={key:0,class:`text-2xs text-faint`},u0={key:1,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},d0={key:4,class:`grid grid-cols-1 gap-4 lg:grid-cols-2`},f0=N({__name:`ServersView`,setup(e){let t=gI(),n=jI(),{servers:r}=n,i=W(()=>n.selected.value?.orphans??[]),a=k(!1),o=k(``),s=k(`all`),c=[{value:`all`,labelKey:`views.servers.filterAll`},{value:`running`,labelKey:`views.servers.filterRunning`},{value:`stopped`,labelKey:`views.servers.filterStopped`},{value:`attention`,labelKey:`views.servers.filterAttention`},{value:`disabled`,labelKey:`views.servers.filterDisabled`}],l=W(()=>t.appState.value===null),u=W(()=>{let e=o.value.trim().toLowerCase();return r.value.filter(t=>s.value===`running`&&t.status!==`running`||s.value===`stopped`&&![`stopped`,`stopping`].includes(t.status)||s.value===`disabled`&&t.config.enabled||s.value===`attention`&&t.status!==`crashed`&&t.status!==`conflict`&&t.health!==`unhealthy`?!1:e.length===0||`${t.id} ${t.config.label??``} ${t.config.command} ${t.config.port??``}`.toLowerCase().includes(e))}),d=W(()=>({all:r.value.length,running:r.value.filter(e=>e.status===`running`).length,attention:r.value.filter(e=>e.status===`crashed`||e.status===`conflict`||e.health===`unhealthy`).length})),f=W(()=>c.map(e=>({value:e.value,label:`${Y(e.labelKey)}${e.value===`all`?` ${d.value.all}`:e.value===`running`?` ${d.value.running}`:e.value===`attention`&&d.value.attention>0?` ${d.value.attention}`:``}`})));return(e,c)=>(L(),R(`div`,e0,[V(vU,{title:A(Y)(`nav.servers`),description:A(Y)(`views.servers.description`,{workspace:A(n).selected.value?.label??A(Y)(`nav.workspace`)})},{actions:j(()=>[V($,{variant:`ghost`,onClick:c[0]||=e=>A(n).startAll()},{default:j(()=>[V(A(Py),{class:`size-3.5`}),H(O(A(Y)(`views.actions.startAll`)),1)]),_:1}),V(lW,{label:A(Y)(`views.actions.stopAll`),"confirm-label":A(Y)(`views.actions.stopAllIgnore`),"alternative-label":A(Y)(`views.actions.stopAllWithPersistent`),title:A(Y)(`views.actions.stopAllQuestion`),hint:A(Y)(`views.actions.stopAllHint`),variant:`ghost`,"confirm-variant":`danger`,onConfirm:c[1]||=e=>A(n).stopAll(),onAlternative:c[2]||=e=>A(n).stopAll({withPersistent:!0})},null,8,[`label`,`confirm-label`,`alternative-label`,`title`,`hint`]),V($,{variant:`primary`,onClick:c[3]||=e=>a.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addServer`)),1)]),_:1})]),_:1},8,[`title`,`description`]),B(`div`,t0,[V(mG,{modelValue:s.value,"onUpdate:modelValue":c[4]||=e=>s.value=e,options:f.value},null,8,[`modelValue`,`options`]),B(`div`,n0,[V(A(Vy),{class:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),wr(B(`input`,{"onUpdate:modelValue":c[5]||=e=>o.value=e,type:`search`,placeholder:A(Y)(`views.servers.filterPlaceholder`),class:D([`pl-8`,[A(iV)]]),"aria-label":A(Y)(`views.servers.filterAria`)},null,10,r0),[[nu,o.value]]),o.value.length>0?(L(),R(`button`,{key:0,type:`button`,class:`absolute right-1.5 top-1/2 grid size-6 -translate-y-1/2 place-items-center rounded-control text-faint hover:text-ink`,"aria-label":A(Y)(`views.servers.clearFilter`),onClick:c[6]||=e=>o.value=``},[V(A(nb),{class:`size-3.5`})],8,i0)):U(``,!0)])]),i.value.length>0?(L(),z(fW,{key:0,tone:`warn`,title:A(Y)(`views.servers.orphansTitle`)},{default:j(()=>[B(`p`,a0,O(A(Y)(`views.servers.orphansDescription`)),1),B(`ul`,o0,[(L(!0),R(I,null,P(i.value,e=>(L(),R(`li`,{key:e.serverId,class:`flex flex-wrap items-center gap-2`},[B(`code`,s0,O(e.serverId),1),B(`span`,c0,O(A(Y)(`views.servers.orphanPid`,{pid:e.pid})),1),e.startedAt===null?U(``,!0):(L(),R(`span`,l0,O(A(Y)(`views.servers.orphanStartedAt`,{when:A($R)(e.startedAt)})),1)),V($,{size:`xs`,variant:`ghost`,class:`ml-auto`,onClick:r=>A(t).stopOrphan(A(n).activeId.value,e.serverId)},{default:j(()=>[H(O(A(Y)(`views.servers.stopOrphan`)),1)]),_:1},8,[`onClick`])]))),128))])]),_:1},8,[`title`])):U(``,!0),l.value?(L(),R(`div`,u0,[(L(),R(I,null,P(4,e=>V(CU,{key:e,class:`h-72 w-full`,rounded:`rounded-panel`})),64))])):A(r).length===0?(L(),z(AR,{key:2,title:A(Y)(`views.servers.emptyTitle`),description:A(Y)(`views.servers.emptyDescription`)},{icon:j(()=>[V(A(Hy),{class:`size-4`})]),action:j(()=>[V($,{variant:`primary`,onClick:c[7]||=e=>a.value=!0},{default:j(()=>[V(A(Fy),{class:`size-3.5`}),H(O(A(Y)(`views.actions.addAServer`)),1)]),_:1})]),_:1},8,[`title`,`description`])):u.value.length===0?(L(),z(AR,{key:3,compact:``,title:A(Y)(`views.servers.noMatchTitle`),description:A(Y)(`views.servers.noMatchDescription`)},{action:j(()=>[V($,{onClick:c[8]||=e=>{o.value=``,s.value=`all`}},{default:j(()=>[H(O(A(Y)(`views.servers.clearFilters`)),1)]),_:1})]),_:1},8,[`title`,`description`])):(L(),R(`div`,d0,[(L(!0),R(I,null,P(u.value,e=>(L(),z(dU,{key:e.id,server:e,"workspace-id":A(n).activeId.value,series:A(n).seriesOf(e.id),now:A(t).now.value},null,8,[`server`,`workspace-id`,`series`,`now`]))),128))])),V(iH,{open:a.value,"onUpdate:open":c[9]||=e=>a.value=e,"workspace-id":A(n).activeId.value},null,8,[`open`,`workspace-id`])]))}}),p0=0;function m0(){return p0+=1,`ddns-row-${p0}`}function h0(){return m0()}function g0(e){let t=EX(e);return t.domains=t.domains.map(e=>({...e,key:e.key??m0()})),t}function _0(e){let t=EX(e);return{...t,domains:t.domains.map(({key:e,...t})=>t)}}function v0(e,t){return e===null||t===null?e===t:JSON.stringify(_0(e))===JSON.stringify(_0(t))}function y0(e,t){let n=Iz(_0(e),_0(t),[`ipv4`,`ipv6`]);return Object.keys(n).length===0?null:n}var b0={intervalMs:3e5,ttl:1};function x0(e,t){return e===null||Number.isNaN(e)?b0[t]:e}var S0={class:`space-y-3`},C0={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},w0={class:`mb-3`},T0={class:`text-xs font-semibold text-ink`},E0={class:`mt-0.5 text-2xs leading-4 text-muted`},D0={key:0,class:`divide-y divide-line-soft`},O0={class:`min-w-0`},k0={class:`font-mono text-xs text-ink`},A0={class:`text-2xs text-faint`},j0={key:0},M0={class:`ml-auto flex items-center gap-2`},N0={key:1,class:`text-2xs text-muted`},P0={class:`mt-3 grid grid-cols-1 gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},F0={class:`mt-1.5 text-2xs text-faint`},I0={class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},L0={class:`mb-3`},R0={class:`text-xs font-semibold text-ink`},z0={class:`mt-0.5 text-2xs leading-4 text-muted`},B0={key:0,class:`space-y-2`},V0={class:`flex flex-wrap items-end gap-2`},H0={class:`min-w-40 flex-1`},U0={class:`w-44 shrink-0`},W0={class:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1`},G0={key:1,class:`text-2xs text-muted`},K0={class:`mt-3 grid grid-cols-1 gap-2 border-t border-line-soft pt-3 sm:grid-cols-[1fr_1fr_auto] sm:items-end`},q0={key:1,class:`rounded-panel border border-line bg-panel-2/40 p-3.5`},J0={class:`mb-2 flex flex-wrap items-center gap-x-3 gap-y-1`},Y0={class:`text-xs font-semibold text-ink`},X0={key:0,class:`text-2xs text-muted`},Z0={key:1,class:`font-mono text-2xs text-faint`},Q0={key:2,class:`font-mono text-2xs text-faint`},$0={key:3,class:`ml-auto text-2xs text-faint`},e2={class:`overflow-x-auto`},t2={class:`w-full text-left text-xs`},n2={class:`text-2xs text-faint`},r2={class:`py-1 pr-3 font-medium`},i2={class:`py-1 pr-3 font-medium`},a2={class:`py-1 pr-3 font-medium`},o2={class:`py-1 pr-3 font-medium`},s2={class:`py-1 font-medium`},c2={class:`py-1.5 pr-3 font-mono text-2xs text-ink`},l2={class:`py-1.5 pr-3 text-2xs text-muted`},u2={class:`py-1.5 pr-3`},d2={class:`py-1.5 pr-3 font-mono text-2xs text-muted`},f2={class:`py-1.5 text-2xs text-faint`},p2={class:`space-y-3`},m2={class:`text-2xs leading-4 text-muted`},h2=[`href`],g2=N({__name:`DdnsSection`,props:{patch:{default:null},patchModifiers:{},baseline:{default:null},baselineModifiers:{}},emits:[`update:patch`,`update:baseline`],setup(e,{expose:t}){let n=lo(e,`patch`),r=lo(e,`baseline`),i={pending:{labelKey:`settings.ddns.statePending`,tone:`neutral`},ok:{labelKey:`settings.ddns.stateOk`,tone:`ok`},unchanged:{labelKey:`settings.ddns.stateUnchanged`,tone:`neutral`},skipped:{labelKey:`settings.ddns.stateSkipped`,tone:`warn`},error:{labelKey:`settings.ddns.stateError`,tone:`danger`}},a=gI(),o=jI(),s=EP(),c=k(null),l=k(null),u=k(null),d=k(null),f=k(!1),p=tn({id:``,provider:`cloudflare`}),m=tn({host:``,account:``}),h=k(null),g=k({}),_=k(!1),v=k(null),y=W(()=>c.value?.providers??[]),b=W(()=>l.value?.accounts??[]),x=W(()=>l.value?.domains??[]),S=W(()=>b.value.map(e=>e.id).join(`,`)),C=W(()=>y.value.map(e=>({value:e.id,label:e.label}))),w=W(()=>b.value.map(e=>({value:e.id,label:e.id}))),T=W(()=>o.selected.value?.ddns??c.value?.status??null),ee=W(()=>l.value!==null&&r.value!==null&&!v0(l.value,r.value)),te=W(()=>/^[a-z0-9][a-z0-9_-]*$/.test(p.id)&&!b.value.some(e=>e.id===p.id)),ne=W(()=>m.host.includes(`.`)&&m.account.length>0&&!x.value.some(e=>e.host.toLowerCase()===m.host.trim().toLowerCase())),re=W({get:()=>h.value!==null,set:e=>{e||(h.value=null)}}),ie=W(()=>h.value===null?[]:ae(h.value.provider)?.fields??[]);function ae(e){return y.value.find(t=>t.id===e)??null}function oe(e){let t=b.value.find(t=>t.id===e.account);return t===void 0?null:ae(t.provider)}function se(e){return ae(e.provider)?.label??e.provider}function ce(e){return c.value?.credentials.includes(e)===!0}function le(e){return x.value.filter(t=>t.account===e).length}function E(e,t,n){let r=n?[...new Set([...e.types,t])]:e.types.filter(e=>e!==t);e.types=r.length>0?r:e.types}function ue(e,t,n){n==null||n===``?delete e[t]:e[t]=n}function de(e,t,n){e!==null&&(e[t]=x0(n,t))}function fe(){n.value=l.value===null||r.value===null||v0(l.value,r.value)?null:_0(l.value)}function pe(e,t=!1){c.value=e,r.value=g0(e.config),t||(l.value=g0(e.config)),fe()}async function me(){u.value=null;try{pe(await nP(o.activeId.value)),p.provider=C.value[0]?.value??`cloudflare`,m.account=b.value[0]?.id??``}catch(e){u.value=IM(e)}}ia(()=>{me()}),M(()=>o.activeId.value,(e,t)=>{e!==t&&e.length>0&&me()}),M(l,fe,{deep:!0}),M(S,()=>{b.value.some(e=>e.id===m.account)||(m.account=b.value[0]?.id??``)});function he(){te.value&&l.value!==null&&(l.value.accounts.push({id:p.id,provider:p.provider,label:``}),p.id=``)}function ge(e){l.value===null||le(e.id)>0||(l.value.accounts=l.value.accounts.filter(t=>t.id!==e.id))}function _e(){ne.value&&l.value!==null&&(l.value.domains.push({host:m.host.trim().toLowerCase(),account:m.account,types:[`A`],proxied:!1,enabled:!0,key:h0()}),m.host=``)}function ve(e){l.value!==null&&(l.value.domains=l.value.domains.filter(t=>t!==e))}function ye(){r.value!==null&&(l.value=g0(r.value)),d.value=null}async function be(){if(!f.value){f.value=!0,d.value=null;try{pe(await oP(o.activeId.value),!0),s.success(T.value?.lastResult??Y(`settings.ddns.passFinished`))}catch(e){d.value=IM(e)}finally{f.value=!1}}}function xe(e){h.value=e,g.value=Object.fromEntries((ae(e.provider)?.fields??[]).map(e=>[e.key,``])),v.value=null}async function D(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await iP(o.activeId.value,e.id,e.provider,g.value),!0),s.success(Y(`settings.ddns.credentialsSaved`,{account:e.id})),h.value=null}catch(e){v.value=IM(e)}finally{_.value=!1}}}async function Se(){let e=h.value;if(!(e===null||_.value)){_.value=!0,v.value=null;try{pe(await aP(o.activeId.value,e.id),!0),s.success(Y(`settings.ddns.credentialsRemoved`,{account:e.id})),h.value=null}catch(e){v.value=IM(e)}finally{_.value=!1}}}return t({reload:me}),(e,t)=>(L(),R(I,null,[B(`div`,S0,[u.value?(L(),z(fW,{key:0,tone:`danger`,title:A(Y)(`settings.ddns.loadErrorTitle`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`])):U(``,!0),l.value===null?U(``,!0):(L(),R(I,{key:1},[V(QB,{title:A(Y)(`settings.ddns.title`),description:A(Y)(`settings.ddns.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!ee.value,onClick:ye},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`]),T.value?.running?(L(),z(MG,{key:0,tone:`info`,dot:``},{default:j(()=>[H(O(A(Y)(`settings.ddns.checking`)),1)]),_:1})):T.value?.enabled?(L(),z(MG,{key:1,tone:T.value.records.some(e=>e.state===`error`)?`danger`:`ok`,dot:``},{default:j(()=>[H(O(T.value.records.some(e=>e.state===`error`)?A(Y)(`settings.ddns.needsAttention`):A(Y)(`settings.ddns.watching`)),1)]),_:1},8,[`tone`])):U(``,!0),V($,{size:`xs`,variant:`ghost`,loading:f.value,onClick:be},{default:j(()=>[H(O(A(Y)(`settings.ddns.updateNow`)),1)]),_:1},8,[`loading`])]),default:j(()=>[V(CV,{modelValue:l.value.enabled,"onUpdate:modelValue":t[0]||=e=>l.value.enabled=e,label:A(Y)(`settings.ddns.enabled`),hint:A(Y)(`settings.ddns.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(lV,{"model-value":A(LR)(l.value.intervalMs),label:A(Y)(`settings.ddns.interval`),min:60,hint:A(Y)(`settings.ddns.intervalHint`),"onUpdate:modelValue":t[1]||=e=>de(l.value,`intervalMs`,e===null?null:A(RR)(e))},null,8,[`model-value`,`label`,`hint`]),V(lV,{"model-value":l.value.ttl,label:A(Y)(`settings.ddns.ttl`),min:1,hint:A(Y)(`settings.ddns.ttlHint`),"onUpdate:modelValue":t[2]||=e=>de(l.value,`ttl`,e)},null,8,[`model-value`,`label`,`hint`]),V(CV,{modelValue:l.value.ipv4.enabled,"onUpdate:modelValue":t[3]||=e=>l.value.ipv4.enabled=e,label:A(Y)(`settings.ddns.detectIpv4`),hint:A(Y)(`settings.ddns.detectIpv4Hint`)},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:l.value.ipv6.enabled,"onUpdate:modelValue":t[4]||=e=>l.value.ipv6.enabled=e,label:A(Y)(`settings.ddns.detectIpv6`),hint:A(Y)(`settings.ddns.detectIpv6Hint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),d.value?(L(),z(fW,{key:0,tone:`danger`},{default:j(()=>[H(O(d.value),1)]),_:1})):U(``,!0),B(`section`,C0,[B(`header`,w0,[B(`h3`,T0,O(A(Y)(`settings.ddns.accountsTitle`)),1),B(`p`,E0,O(A(Y)(`settings.ddns.accountsDescription`)),1)]),b.value.length>0?(L(),R(`ul`,D0,[(L(!0),R(I,null,P(b.value,e=>(L(),R(`li`,{key:e.id,class:`flex flex-wrap items-center gap-x-3 gap-y-2 py-2 first:pt-0`},[B(`div`,O0,[B(`p`,k0,O(e.id),1),B(`p`,A0,[H(O(se(e))+` `,1),le(e.id)>0?(L(),R(`span`,j0,` · `+O(A(PF)(`settings.ddns.hostnameCount`,le(e.id))),1)):U(``,!0)])]),B(`div`,M0,[V(MG,{tone:ce(e.id)?`ok`:`warn`,dot:``},{default:j(()=>[H(O(ce(e.id)?A(Y)(`settings.ddns.credentialsSet`):A(Y)(`settings.ddns.noCredentials`)),1)]),_:2},1032,[`tone`]),V($,{size:`xs`,variant:`secondary`,onClick:t=>xe(e)},{default:j(()=>[H(O(A(Y)(`settings.ddns.credentials`)),1)]),_:1},8,[`onClick`]),V($,{size:`xs`,variant:`danger-ghost`,disabled:le(e.id)>0,title:le(e.id)>0?A(Y)(`settings.ddns.removeAccountBlocked`):void 0,onClick:t=>ge(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`disabled`,`title`,`onClick`])])]))),128))])):(L(),R(`p`,N0,O(A(Y)(`settings.ddns.noAccounts`)),1)),B(`div`,P0,[V(hV,{modelValue:p.provider,"onUpdate:modelValue":t[5]||=e=>p.provider=e,label:A(Y)(`settings.ddns.provider`),options:C.value},null,8,[`modelValue`,`label`,`options`]),V(bV,{modelValue:p.id,"onUpdate:modelValue":t[6]||=e=>p.id=e,label:A(Y)(`settings.ddns.accountId`),placeholder:A(Y)(`settings.ddns.accountIdPlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V($,{variant:`secondary`,disabled:!te.value,onClick:he},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])]),B(`p`,F0,O(A(Y)(`settings.ddns.accountIdHint`)),1)]),B(`section`,I0,[B(`header`,L0,[B(`h3`,R0,O(A(Y)(`settings.ddns.hostnamesTitle`)),1),B(`p`,z0,O(A(Y)(`settings.ddns.hostnamesDescription`)),1)]),x.value.length>0?(L(),R(`ul`,B0,[(L(!0),R(I,null,P(x.value,e=>(L(),R(`li`,{key:e.key,class:`rounded-control border border-line-soft bg-panel/50 p-2.5`},[B(`div`,V0,[B(`div`,H0,[V(bV,{modelValue:e.host,"onUpdate:modelValue":t=>e.host=t,label:A(Y)(`common.hostname`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`])]),B(`div`,U0,[V(hV,{modelValue:e.account,"onUpdate:modelValue":t=>e.account=t,label:A(Y)(`settings.ddns.account`),options:w.value},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`])]),V(jW,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:A(Y)(`common.enabled`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),V($,{size:`xs`,variant:`danger-ghost`,onClick:t=>ve(e)},{default:j(()=>[H(O(A(Y)(`common.remove`)),1)]),_:1},8,[`onClick`])]),B(`div`,W0,[V(jW,{"model-value":e.types.includes(`A`),label:A(Y)(`settings.ddns.recordA`),"onUpdate:modelValue":t=>E(e,`A`,t===!0)},null,8,[`model-value`,`label`,`onUpdate:modelValue`]),V(jW,{"model-value":e.types.includes(`AAAA`),label:A(Y)(`settings.ddns.recordAaaa`),disabled:oe(e)?.families.includes(`AAAA`)===!1,hint:oe(e)?.families.includes(`AAAA`)===!1?A(Y)(`settings.ddns.aaaaUnsupported`):void 0,"onUpdate:modelValue":t=>E(e,`AAAA`,t===!0)},null,8,[`model-value`,`label`,`disabled`,`hint`,`onUpdate:modelValue`]),oe(e)?.proxied===!0?(L(),z(jW,{key:0,modelValue:e.proxied,"onUpdate:modelValue":t=>e.proxied=t,label:A(Y)(`settings.ddns.proxied`),hint:A(Y)(`settings.ddns.proxiedHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`])):U(``,!0),e.types.includes(`AAAA`)&&!l.value.ipv6.enabled?(L(),z(MG,{key:1,tone:`warn`},{default:j(()=>[H(O(A(Y)(`settings.ddns.ipv6Off`)),1)]),_:1})):U(``,!0)]),V(MV,{title:A(Y)(`settings.ddns.advanced`),hint:A(Y)(`settings.ddns.advancedHint`),class:`mt-2`},{default:j(()=>[V(bV,{"model-value":e.zone??``,label:A(Y)(`settings.ddns.registeredDomain`),placeholder:A(Y)(`settings.ddns.registeredDomainPlaceholder`),hint:A(Y)(`settings.ddns.registeredDomainHint`),"onUpdate:modelValue":t=>ue(e,`zone`,t)},null,8,[`model-value`,`label`,`placeholder`,`hint`,`onUpdate:modelValue`]),oe(e)?.ttl===!1?U(``,!0):(L(),z(lV,{key:0,"model-value":e.ttl??null,min:1,nullable:``,label:A(Y)(`settings.ddns.ttlOverride`),hint:A(Y)(`settings.ddns.ttlOverrideHint`),"onUpdate:modelValue":t=>ue(e,`ttl`,t)},null,8,[`model-value`,`label`,`hint`,`onUpdate:modelValue`]))]),_:2},1032,[`title`,`hint`])]))),128))])):(L(),R(`p`,G0,O(A(Y)(`settings.ddns.noHostnames`)),1)),B(`div`,K0,[V(bV,{modelValue:m.host,"onUpdate:modelValue":t[7]||=e=>m.host=e,label:A(Y)(`common.hostname`),placeholder:A(Y)(`settings.ddns.hostnamePlaceholder`)},null,8,[`modelValue`,`label`,`placeholder`]),V(hV,{modelValue:m.account,"onUpdate:modelValue":t[8]||=e=>m.account=e,label:A(Y)(`settings.ddns.account`),options:w.value,disabled:b.value.length===0},null,8,[`modelValue`,`label`,`options`,`disabled`]),V($,{variant:`secondary`,disabled:!ne.value,onClick:_e},{default:j(()=>[H(O(A(Y)(`common.add`)),1)]),_:1},8,[`disabled`])])]),T.value!==null&&T.value.records.length>0?(L(),R(`section`,q0,[B(`header`,J0,[B(`h3`,Y0,O(A(Y)(`settings.ddns.lastPass`)),1),T.value.lastResult?(L(),R(`span`,X0,O(T.value.lastResult),1)):U(``,!0),T.value.ipv4?(L(),R(`span`,Z0,O(A(Y)(`settings.ddns.ipv4Value`,{address:T.value.ipv4})),1)):U(``,!0),T.value.ipv6?(L(),R(`span`,Q0,O(A(Y)(`settings.ddns.ipv6Value`,{address:T.value.ipv6})),1)):U(``,!0),T.value.lastRunAt?(L(),R(`span`,$0,O(A(ZR)(T.value.lastRunAt,A(a).now.value)),1)):U(``,!0)]),B(`div`,e2,[B(`table`,t2,[B(`thead`,null,[B(`tr`,n2,[B(`th`,r2,O(A(Y)(`common.hostname`)),1),B(`th`,i2,O(A(Y)(`settings.ddns.type`)),1),B(`th`,a2,O(A(Y)(`settings.ddns.state`)),1),B(`th`,o2,O(A(Y)(`settings.ddns.address`)),1),B(`th`,s2,O(A(Y)(`settings.ddns.detail`)),1)])]),B(`tbody`,null,[(L(!0),R(I,null,P(T.value.records,e=>(L(),R(`tr`,{key:`${e.host}|${e.type}`,class:`border-t border-line-soft align-top`},[B(`td`,c2,O(e.host),1),B(`td`,l2,O(e.type),1),B(`td`,u2,[V(MG,{tone:i[e.state].tone,dot:``},{default:j(()=>[H(O(A(Y)(i[e.state].labelKey)),1)]),_:2},1032,[`tone`])]),B(`td`,d2,O(e.ip??`—`),1),B(`td`,f2,O(e.message??`—`),1)]))),128))])])])])):U(``,!0)],64))]),V(LV,{open:re.value,"onUpdate:open":t[10]||=e=>re.value=e,title:A(Y)(`settings.ddns.credentialsTitle`),description:h.value===null?``:`${se(h.value)} — ${h.value.id}`,width:`w-[min(92vw,32rem)]`},{footer:j(()=>[h.value!==null&&ce(h.value.id)?(L(),z(lW,{key:0,label:A(Y)(`settings.ddns.forget`),"confirm-label":A(Y)(`settings.ddns.forgetConfirm`),title:A(Y)(`settings.ddns.forgetTitle`),hint:A(Y)(`settings.ddns.forgetHint`),loading:_.value,disabled:_.value,onConfirm:Se},null,8,[`label`,`confirm-label`,`title`,`hint`,`loading`,`disabled`])):U(``,!0),V($,{size:`sm`,variant:`ghost`,disabled:_.value,onClick:t[9]||=e=>re.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{size:`sm`,variant:`primary`,loading:_.value,disabled:Object.values(g.value).every(e=>e.trim().length===0),onClick:D},{default:j(()=>[H(O(A(Y)(`settings.ddns.saveCredentials`)),1)]),_:1},8,[`loading`,`disabled`])]),default:j(()=>[B(`div`,p2,[B(`p`,m2,O(A(Y)(`settings.ddns.credentialsDescription`)),1),(L(!0),R(I,null,P(ie.value,e=>(L(),z(bV,{key:e.key,modelValue:g.value[e.key],"onUpdate:modelValue":t=>g.value[e.key]=t,type:`password`,autocomplete:`off`,label:e.label,hint:`${e.hint}${e.optional?` ${A(Y)(`settings.ddns.optional`)}`:``}`,wide:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),h.value===null?U(``,!0):(L(),R(`a`,{key:0,class:`inline-block text-2xs text-accent underline decoration-line underline-offset-2`,href:ae(h.value.provider)?.docsUrl,target:`_blank`,rel:`noreferrer`},O(A(Y)(`settings.ddns.whereToGet`)),9,h2)),v.value?(L(),z(fW,{key:1,tone:`danger`},{default:j(()=>[H(O(v.value),1)]),_:1})):U(``,!0)])]),_:1},8,[`open`,`title`,`description`])],64))}}),_2={class:`mt-3 space-y-3`},v2=N({__name:`DefaultsSection`,props:Va({dirty:{type:Boolean}},{defaults:{required:!0},defaultsModifiers:{}}),emits:Va([`reset`],[`update:defaults`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`defaults`),a=NB(()=>i.value.logBufferLines,e=>i.value.logBufferLines=e,500);return(e,t)=>(L(),R(I,null,[V(QB,{title:A(Y)(`settings.defaults.title`),description:A(Y)(`settings.defaults.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(CV,{modelValue:i.value.enabled,"onUpdate:modelValue":t[1]||=e=>i.value.enabled=e,label:A(Y)(`common.enabled`),hint:A(Y)(`settings.defaults.enabledHint`),wide:``},null,8,[`modelValue`,`label`,`hint`]),V(CV,{modelValue:i.value.autostart,"onUpdate:modelValue":t[2]||=e=>i.value.autostart=e,label:A(Y)(`settings.defaults.autostart`)},null,8,[`modelValue`,`label`]),V(hV,{modelValue:i.value.bind,"onUpdate:modelValue":t[3]||=e=>i.value.bind=e,label:A(Y)(`settings.defaults.bind`),options:[{value:`local`,label:A(Y)(`settings.defaults.bindLocal`)},{value:`lan`,label:A(Y)(`settings.defaults.bindLan`)}]},null,8,[`modelValue`,`label`,`options`]),V(hV,{modelValue:i.value.onPortConflict,"onUpdate:modelValue":t[4]||=e=>i.value.onPortConflict=e,label:A(Y)(`settings.defaults.onPortConflict`),options:[{value:`block`,label:A(Y)(`settings.defaults.conflictBlock`)},{value:`warn`,label:A(Y)(`settings.defaults.conflictWarn`)},{value:`follow`,label:A(Y)(`settings.defaults.conflictFollow`)},{value:`reclaim`,label:A(Y)(`settings.defaults.conflictReclaim`)},{value:`kill`,label:A(Y)(`settings.defaults.conflictKill`)}]},null,8,[`modelValue`,`label`,`options`]),V(lV,{modelValue:A(a),"onUpdate:modelValue":t[5]||=e=>hn(a)?a.value=e:null,label:A(Y)(`settings.defaults.logBufferLines`),min:50,max:1e5,hint:A(Y)(`settings.defaults.logBufferLinesHint`)},null,8,[`modelValue`,`label`,`hint`])]),_:1},8,[`title`,`description`]),B(`div`,_2,[V(wV,{restart:i.value.restart,"onUpdate:restart":t[6]||=e=>i.value.restart=e,health:i.value.health,"onUpdate:health":t[7]||=e=>i.value.health=e,stop:i.value.stop,"onUpdate:stop":t[8]||=e=>i.value.stop=e},null,8,[`restart`,`health`,`stop`])])],64))}}),y2={class:`contents`},b2=N({__name:`NotificationPolicyFields`,props:{modelValue:{required:!0},modelModifiers:{}},emits:[`update:modelValue`],setup(e){let t=lo(e,`modelValue`),n=W(()=>[{key:`onCrash`,label:Y(`settings.telegram.onCrash`)},{key:`onUnhealthy`,label:Y(`settings.telegram.onUnhealthy`)},{key:`onForcedRestart`,label:Y(`settings.telegram.onForcedRestart`)},{key:`onRecovered`,label:Y(`settings.telegram.onRecovered`)},{key:`onHost`,label:Y(`settings.telegram.onHost`),hint:Y(`settings.telegram.onHostHint`)},{key:`onDdns`,label:Y(`settings.telegram.onDdns`),hint:Y(`settings.telegram.onDdnsHint`)}]);return(e,r)=>(L(),R(`div`,y2,[(L(!0),R(I,null,P(n.value,e=>(L(),z(CV,{key:e.key,modelValue:t.value[e.key],"onUpdate:modelValue":n=>t.value[e.key]=n,label:e.label,hint:e.hint},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]))),128)),V(lV,{"model-value":A(LR)(t.value.cooldownMs),label:A(Y)(`settings.telegram.cooldown`),min:0,hint:A(Y)(`settings.telegram.cooldownHint`),"onUpdate:modelValue":r[0]||=e=>t.value.cooldownMs=A(zR)(e,t.value.cooldownMs)},null,8,[`model-value`,`label`,`hint`])]))}}),x2={class:`flex flex-wrap items-center gap-1.5`},S2={key:0,class:`text-xs text-muted`},C2={class:`flex items-center gap-2`},w2={class:`min-w-0 flex-1 truncate font-mono text-2xs text-muted`},T2={class:`grid grid-cols-1 gap-2 sm:grid-cols-2`},E2={class:`flex items-end gap-1.5`},D2={class:`grid grid-cols-1 gap-2 sm:grid-cols-2`},O2={class:`flex items-end gap-1.5`},k2={class:`text-2xs text-muted`},A2={class:`grid grid-cols-1 gap-2 sm:grid-cols-3`},j2={class:`flex flex-wrap items-center gap-1.5`},M2={class:`text-2xs font-medium uppercase tracking-wide text-muted`},N2={key:2,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`},P2={class:`flex flex-wrap items-center gap-1.5`},F2={key:0,class:`text-2xs text-ok`},I2={key:1,class:`text-2xs text-muted`},L2=N({__name:`DestinationsSection`,props:Va({statuses:{},dirty:{type:Boolean}},{destinations:{required:!0},destinationsModifiers:{}}),emits:Va([`reset`],[`update:destinations`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`destinations`),a=gI(),o=jI(),s=k({}),c=k({}),l=k(null),u=k(null),d=W(()=>new Map(n.statuses.map(e=>[e.id,e])));function f(e,t){let n=new Set(i.value.map(e=>e.id)),r=e.length>0?e:t;if(!n.has(r))return r;let a=2;for(;n.has(`${r}-${a}`);)a+=1;return`${r}-${a}`}function p(e){return{id:f(e,e),kind:e,enabled:!0,useOwnSettings:!1,chatId:``,tokenSet:!1,url:``,method:`POST`,format:`json`,headers:``,policy:{onCrash:!0,onUnhealthy:!0,onForcedRestart:!0,onRecovered:!1,onHost:!0,onDdns:!0,cooldownMs:12e4}}}function m(e){i.value=[...i.value,p(e)]}function h(e){i.value=i.value.filter(t=>t.id!==e)}function g(e){return e===void 0||e.lastResult===null||e.lastResult===void 0?``:Y(`settings.destination.lastSend`,{result:e.lastResult,when:e.lastResultAt===null||e.lastResultAt===void 0?``:ZR(e.lastResultAt,Date.now())})}let _=W(()=>[{id:`ntfy`,label:Y(`settings.webhook.presetNtfy`),apply:e=>{e.format=`text`,e.headers=`Title: home-hosted
53
+ Priority: default`}},{id:`discord`,label:Y(`settings.webhook.presetDiscord`),apply:e=>{e.format=`json`,e.headers=``}},{id:`slack`,label:Y(`settings.webhook.presetSlack`),apply:e=>{e.format=`json`,e.headers=``}}]);async function v(e){let t=(s.value[e.id]??``).trim();if(t.length!==0){l.value=e.id,u.value=null;try{let n=await ZN(o.activeId.value,e.id,t);s.value[e.id]=``,c.value[e.id]=n.username===null?Y(`settings.telegram.tokenSaved`):Y(`settings.telegram.tokenSavedFor`,{username:n.username}),a.refresh()}catch(e){u.value=IM(e)}finally{l.value=null}}}async function y(e){l.value=e.id,u.value=null;try{await QN(o.activeId.value,e.id),c.value[e.id]=Y(`settings.telegram.tokenRemoved`),a.refresh()}catch(e){u.value=IM(e)}finally{l.value=null}}async function b(e){l.value=e.id,u.value=null;try{let{chats:t}=await eP(o.activeId.value,e.id,{botToken:(s.value[e.id]??``).trim()||void 0});t.length===0?c.value[e.id]=Y(`settings.telegram.noChats`):e.chatId=String(t[0].id)}catch(e){u.value=IM(e)}finally{l.value=null}}async function x(e){l.value=e.id,u.value=null;try{e.kind===`telegram`?await $N(o.activeId.value,e.id,{chatId:e.chatId||void 0}):await tP(o.activeId.value,{target:{url:e.url,method:e.method,format:e.format,headers:e.headers,enabled:e.enabled,cooldownMs:e.policy.cooldownMs,onCrash:e.policy.onCrash,onUnhealthy:e.policy.onUnhealthy,onForcedRestart:e.policy.onForcedRestart,onRecovered:e.policy.onRecovered,onHost:e.policy.onHost,onDdns:e.policy.onDdns},id:e.id}),c.value[e.id]=Y(`settings.destination.testSent`),a.refresh()}catch(e){u.value=IM(e)}finally{l.value=null}}function S(e){return e.tokenSet?Y(`settings.telegram.tokenSavedPlaceholder`):Y(`settings.telegram.tokenPlaceholder`)}return(e,t)=>(L(),z(QB,{title:A(Y)(`settings.destination.title`),description:A(Y)(`settings.destination.description`),columns:1},{actions:j(()=>[B(`div`,x2,[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`]),V($,{size:`xs`,variant:`secondary`,onClick:t[1]||=e=>m(`telegram`)},{default:j(()=>[H(O(A(Y)(`settings.destination.addTelegram`)),1)]),_:1}),V($,{size:`xs`,variant:`primary`,onClick:t[2]||=e=>m(`webhook`)},{default:j(()=>[H(O(A(Y)(`settings.destination.addWebhook`)),1)]),_:1})])]),default:j(()=>[i.value.length===0?(L(),R(`p`,S2,O(A(Y)(`settings.destination.empty`)),1)):U(``,!0),(L(!0),R(I,null,P(i.value,e=>(L(),R(`div`,{key:e.id,class:`flex min-w-0 flex-col gap-2 rounded-control border border-line bg-page/60 p-2.5`},[B(`div`,C2,[V(CV,{modelValue:e.enabled,"onUpdate:modelValue":t=>e.enabled=t,label:e.kind===`telegram`?A(Y)(`settings.telegram.title`):A(Y)(`settings.webhook.title`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),B(`span`,w2,O(e.id),1),V(lW,{label:A(Y)(`settings.destination.remove`),title:e.kind===`webhook`?A(Y)(`settings.webhook.removeQuestion`,{name:e.id}):A(Y)(`settings.destination.removeQuestion`,{name:e.id}),hint:e.kind===`webhook`?A(Y)(`settings.webhook.removeBody`):A(Y)(`settings.destination.removeBody`),onConfirm:t=>h(e.id)},null,8,[`label`,`title`,`hint`,`onConfirm`])]),e.kind===`telegram`?(L(),R(I,{key:0},[B(`div`,T2,[V(bV,{modelValue:e.chatId,"onUpdate:modelValue":t=>e.chatId=t,label:A(Y)(`settings.destination.chatId`),hint:A(Y)(`settings.destination.chatIdHint`),placeholder:A(Y)(`settings.telegram.chatIdPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`,`placeholder`]),B(`div`,E2,[V($,{size:`xs`,variant:`ghost`,disabled:l.value===e.id,onClick:t=>b(e)},{default:j(()=>[H(O(A(Y)(`settings.destination.detectChats`)),1)]),_:1},8,[`disabled`,`onClick`])])]),B(`div`,D2,[V(bV,{modelValue:s.value[e.id],"onUpdate:modelValue":t=>s.value[e.id]=t,label:A(Y)(`settings.destination.botToken`),placeholder:S(e),hint:A(Y)(`settings.telegram.tokenNote`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`placeholder`,`hint`]),B(`div`,O2,[V($,{size:`xs`,disabled:l.value===e.id||(s.value[e.id]??``).trim().length===0,onClick:t=>v(e)},{default:j(()=>[H(O(A(Y)(`settings.destination.saveToken`)),1)]),_:1},8,[`disabled`,`onClick`]),e.tokenSet?(L(),z(lW,{key:0,label:A(Y)(`settings.telegram.removeToken`),title:A(Y)(`settings.telegram.removeTokenTitle`),hint:A(Y)(`settings.telegram.removeTokenHint`),onConfirm:t=>y(e)},null,8,[`label`,`title`,`hint`,`onConfirm`])):U(``,!0)])]),B(`span`,k2,O(e.tokenSet?A(Y)(`settings.destination.tokenSet`):A(Y)(`settings.destination.noToken`)),1)],64)):(L(),R(I,{key:1},[B(`div`,A2,[V(bV,{modelValue:e.url,"onUpdate:modelValue":t=>e.url=t,class:`sm:col-span-2`,label:A(Y)(`settings.webhook.url`),placeholder:A(Y)(`settings.webhook.urlPlaceholder`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`placeholder`]),V(hV,{modelValue:e.method,"onUpdate:modelValue":t=>e.method=t,label:A(Y)(`settings.webhook.method`),options:[{value:`POST`,label:`POST`},{value:`PUT`,label:`PUT`}]},null,8,[`modelValue`,`onUpdate:modelValue`,`label`]),V(hV,{modelValue:e.format,"onUpdate:modelValue":t=>e.format=t,label:A(Y)(`settings.webhook.format`),options:[{value:`json`,label:A(Y)(`settings.webhook.formatJson`)},{value:`text`,label:A(Y)(`settings.webhook.formatText`)}],hint:A(Y)(`settings.webhook.formatHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`options`,`hint`])]),V(VV,{modelValue:e.headers,"onUpdate:modelValue":t=>e.headers=t,label:A(Y)(`settings.webhook.headers`),hint:A(Y)(`settings.webhook.headersHint`),placeholder:`Authorization: Bearer …`,rows:2,mono:``},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]),B(`div`,j2,[B(`span`,M2,O(A(Y)(`settings.webhook.presets`)),1),(L(!0),R(I,null,P(_.value,t=>(L(),z($,{key:t.id,size:`xs`,variant:`ghost`,onClick:n=>t.apply(e)},{default:j(()=>[H(O(t.label),1)]),_:2},1032,[`onClick`]))),128))])],64)),V(CV,{modelValue:e.useOwnSettings,"onUpdate:modelValue":t=>e.useOwnSettings=t,label:A(Y)(`settings.destination.ownSettings`),hint:A(Y)(`settings.destination.ownSettingsHint`)},null,8,[`modelValue`,`onUpdate:modelValue`,`label`,`hint`]),e.useOwnSettings?(L(),R(`div`,N2,[V(b2,{modelValue:e.policy,"onUpdate:modelValue":t=>e.policy=t},null,8,[`modelValue`,`onUpdate:modelValue`])])):U(``,!0),B(`div`,P2,[V($,{size:`xs`,disabled:l.value===e.id,onClick:t=>x(e)},{default:j(()=>[H(O(l.value===e.id?A(Y)(`common.sending`):A(Y)(`settings.destination.sendTest`)),1)]),_:2},1032,[`disabled`,`onClick`]),c.value[e.id]?(L(),R(`span`,F2,O(c.value[e.id]),1)):U(``,!0),g(d.value.get(e.id))?(L(),R(`span`,I2,O(g(d.value.get(e.id))),1)):U(``,!0)])]))),128)),u.value===null?U(``,!0):(L(),z(fW,{key:1,tone:`danger`,title:A(Y)(`views.settings.saveFailed`)},{default:j(()=>[H(O(u.value),1)]),_:1},8,[`title`]))]),_:1},8,[`title`,`description`]))}}),R2={class:`flex min-w-0 flex-col gap-1 sm:col-span-2`},z2={class:`text-xs font-medium text-muted`},B2={class:`flex items-center gap-1.5 rounded-control border border-line bg-page/60 px-2.5 py-1.5`},V2={class:`min-w-0 flex-1 truncate font-mono text-xs text-ink`},H2={class:`text-2xs leading-4 text-faint`},U2=N({__name:`LogsSection`,props:Va({logsDir:{},dirty:{type:Boolean}},{logs:{required:!0},logsModifiers:{}}),emits:Va([`reset`],[`update:logs`]),setup(e,{emit:t}){let n=e,r=t,i=lo(e,`logs`),a=jI(),o=NB(()=>i.value.maxBytes,e=>i.value.maxBytes=e,2e6),s=NB(()=>i.value.keep,e=>i.value.keep=e,3),c=W(()=>n.logsDir??`—`);return(e,t)=>{let l=ha(`RouterLink`);return L(),z(QB,{title:A(Y)(`settings.logs.title`),description:A(Y)(`settings.logs.description`)},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!n.dirty,onClick:t[0]||=e=>r(`reset`)},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(CV,{modelValue:i.value.persist,"onUpdate:modelValue":t[1]||=e=>i.value.persist=e,label:A(Y)(`settings.logs.persist`),hint:A(Y)(`settings.logs.persistHint`),class:`sm:col-span-2`},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(o),"onUpdate:modelValue":t[2]||=e=>hn(o)?o.value=e:null,label:A(Y)(`settings.logs.maxBytes`),min:1e4,max:1e8,hint:A(Y)(`settings.logs.maxBytesHint`)},null,8,[`modelValue`,`label`,`hint`]),V(lV,{modelValue:A(s),"onUpdate:modelValue":t[3]||=e=>hn(s)?s.value=e:null,label:A(Y)(`settings.logs.keep`),min:1,max:10},null,8,[`modelValue`,`label`]),B(`div`,R2,[B(`span`,z2,O(A(Y)(`settings.logs.directory`)),1),B(`div`,B2,[B(`span`,V2,O(c.value),1),V(AG,{value:c.value,label:A(Y)(`settings.logs.copyDirectory`)},null,8,[`value`,`label`])]),B(`p`,H2,[V(HV,{k:`settings.logs.browseHint`},{logs:j(()=>[V(l,{to:A(J2)(A(a).activeId.value,`logs`),class:`text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`},{default:j(()=>[H(O(A(Y)(`nav.logs`)),1)]),_:1},8,[`to`])]),_:1})])])]),_:1},8,[`title`,`description`])}}}),W2={class:`mt-1`},G2=N({__name:`SettingsView`,setup(e){let t=W(()=>[{id:`defaults`,title:Y(`views.settings.sectionDefaults`)},{id:`logs`,title:Y(`views.settings.sectionLogs`)},{id:`notifications`,title:Y(`views.settings.sectionNotifications`)},{id:`ddns`,title:Y(`views.settings.sectionDdns`)}]),n=gI(),r=jI(),i=EP(),a=tn(nB()),o=k(!1),s=k(null),c=k(null),l=k(null),u=k(null),d=k(null),f=W(()=>r.defaults.value),p=W(()=>r.logsConfig.value),m=W(()=>r.notifications.value?.defaults??null),h=W(()=>r.notifications.value?.destinations??[]),g=W(()=>r.logsDir.value),_={},v=W(()=>{let e={},t=f.value,n=p.value;if(t!==null){let n=mB(t,a.defaults);Object.keys(n).length>0&&(e.defaults=n)}if(n!==null){let t=hB(n,a.logs);Object.keys(t).length>0&&(e.logs=t)}let r=m.value,i={};if(r!==null){let e=vB(r,a.policy);e!==null&&Object.assign(i,e)}let o=bB(h.value,a.destinations,DB(_.notifications));return o!==null&&Object.assign(i,o),Object.keys(i).length>0&&(e.notifications=i),e}),y=W(()=>l.value===null||u.value===null?null:y0(u.value,l.value)),b=W(()=>Hz(v.value)+(y.value===null?0:Hz(y.value))),x=W(()=>{let e=m.value;return{defaults:f.value??{},logs:p.value??{},notifications:e===null?{}:{defaults:gB(e),destinations:h.value.map(_B)},ddns:u.value===null?{}:_0(u.value)}}),S=W(()=>Vz({...v.value,...y.value===null?{}:{ddns:y.value}},x.value)),C=W(()=>f.value!==null&&Object.keys(mB(f.value,a.defaults)).length>0),w=W(()=>p.value!==null&&Object.keys(hB(p.value,a.logs)).length>0),T=W(()=>m.value!==null&&(vB(m.value,a.policy)!==null||bB(h.value,a.destinations,DB(_.notifications))!==null));function ee(){let e=(e,t)=>{OB(_[e],EB(a,e))||(t(),_[e]=EB(a,e))},t=f.value;t!==null&&e(`defaults`,()=>{a.defaults.enabled=t.enabled,a.defaults.autostart=t.autostart,a.defaults.bind=t.bind,a.defaults.onPortConflict=t.onPortConflict,a.defaults.logBufferLines=t.logBufferLines,a.defaults.restart={...t.restart},a.defaults.health=eB(t.health),a.defaults.stop={...t.stop}});let n=p.value;n!==null&&e(`logs`,()=>Object.assign(a.logs,n));let r=m.value;r!==null&&e(`notifications`,()=>{Object.assign(a.policy,gB(r)),a.destinations=h.value.map(_B)})}function te(){for(let e of Object.keys(_))delete _[e]}M([f,p,m],()=>{ee()},{immediate:!0});async function ne(){let e=v.value,t=l.value,u=Object.keys(e).length>0;if(!u&&t===null||o.value||r.activeId.value.length===0)return;let f=xB(h.value,a.destinations,DB(_.notifications));if(f.length>0)c.value=null,s.value=Y(`views.settings.concurrentEdit`,{ids:f.join(`, `)});else{o.value=!0,s.value=null,c.value=null;try{if(u&&!await n.saveWorkspaceSettings(r.activeId.value,e)){s.value=n.lastError.value??Y(`views.settings.saveFailed`);return}t!==null&&(await rP(r.activeId.value,t),await d.value?.reload()),c.value=Y(`views.settings.saved`),i.success(Y(`views.settings.savedToast`)),te(),ee()}catch(e){s.value=IM(e)}finally{o.value=!1}}}function re(){s.value=null,c.value=null,te(),ee(),d.value?.reload()}function ie(){let e=f.value;e!==null&&(a.defaults.enabled=e.enabled,a.defaults.autostart=e.autostart,a.defaults.bind=e.bind,a.defaults.onPortConflict=e.onPortConflict,a.defaults.logBufferLines=e.logBufferLines,a.defaults.restart={...e.restart},a.defaults.health=eB(e.health),a.defaults.stop={...e.stop},se(`defaults`))}function ae(){p.value!==null&&Object.assign(a.logs,p.value),se(`logs`)}function oe(){m.value!==null&&(Object.assign(a.policy,gB(m.value)),a.destinations=h.value.map(_B)),se(`notifications`)}function se(e){_[e]=EB(a,e)}return M(()=>r.activeId.value,()=>{te(),ee(),s.value=null,c.value=null}),(e,n)=>(L(),z(Fq,{sections:t.value,"nav-label":A(Y)(`views.settings.navLabel`),"changes-description":A(Y)(`views.settings.changesDescription`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)}),"changed-count":b.value,changes:S.value,"save-error":s.value,"save-message":c.value,saving:o.value,onSave:ne,onDiscard:re},{header:j(()=>[V(vU,{title:A(Y)(`nav.workspaceSettings`),description:A(Y)(`views.settings.description`,{workspace:A(r).selected.value?.label??A(Y)(`nav.workspace`)})},null,8,[`title`,`description`]),A(r).configError.value?(L(),z(fW,{key:0,tone:`danger`,title:A(Y)(`views.settings.configErrorTitle`),class:`mb-4`},{default:j(()=>[B(`p`,null,O(A(r).configError.value),1),B(`p`,W2,O(A(Y)(`views.settings.configErrorNote`)),1)]),_:1},8,[`title`])):A(r).configWarnings.value.length>0?(L(),z(fW,{key:1,tone:`warn`,title:A(Y)(`views.settings.configWarningTitle`),class:`mb-4`},{default:j(()=>[(L(!0),R(I,null,P(A(r).configWarnings.value,e=>(L(),R(`p`,{key:e,class:`font-mono`},O(e),1))),128))]),_:1},8,[`title`])):U(``,!0)]),default:j(()=>[V(fq,{id:`defaults`,title:A(Y)(`views.settings.sectionDefaults`),description:A(Y)(`views.settings.defaultsDescription`)},{default:j(()=>[V(v2,{defaults:a.defaults,"onUpdate:defaults":n[0]||=e=>a.defaults=e,dirty:C.value,onReset:ie},null,8,[`defaults`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`logs`,title:A(Y)(`views.settings.sectionLogs`),description:A(Y)(`views.settings.logsDescription`)},{default:j(()=>[V(U2,{logs:a.logs,"onUpdate:logs":n[1]||=e=>a.logs=e,"logs-dir":g.value,dirty:w.value,onReset:ae},null,8,[`logs`,`logs-dir`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`notifications`,title:A(Y)(`views.settings.sectionNotifications`),description:A(Y)(`views.settings.notificationsDescription`)},{default:j(()=>[V(QB,{title:A(Y)(`settings.destination.generalTitle`),description:A(Y)(`settings.destination.generalDescription`),columns:1},{actions:j(()=>[V($,{size:`xs`,variant:`ghost`,disabled:!T.value,onClick:oe},{default:j(()=>[H(O(A(Y)(`common.reset`)),1)]),_:1},8,[`disabled`])]),default:j(()=>[V(b2,{modelValue:a.policy,"onUpdate:modelValue":n[2]||=e=>a.policy=e},null,8,[`modelValue`])]),_:1},8,[`title`,`description`]),V(L2,{destinations:a.destinations,"onUpdate:destinations":n[3]||=e=>a.destinations=e,statuses:h.value,dirty:T.value,onReset:oe},null,8,[`destinations`,`statuses`,`dirty`])]),_:1},8,[`title`,`description`]),V(fq,{id:`ddns`,title:A(Y)(`views.settings.sectionDdns`),description:A(Y)(`views.settings.ddnsDescription`)},{default:j(()=>[V(g2,{ref_key:`ddnsSection`,ref:d,patch:l.value,"onUpdate:patch":n[4]||=e=>l.value=e,baseline:u.value,"onUpdate:baseline":n[5]||=e=>u.value=e},null,8,[`patch`,`baseline`])]),_:1},8,[`title`,`description`])]),_:1},8,[`sections`,`nav-label`,`changes-description`,`changed-count`,`changes`,`save-error`,`save-message`,`saving`]))}}),K2=new Set([`overview`,`servers`,`server-detail`,`logs`,`settings`]),q2=Lv({history:av(),routes:[{path:`/w/:workspaceId`,name:`overview`,component:TX,meta:{titleKey:`nav.overview`}},{path:`/w/:workspaceId/servers`,name:`servers`,component:f0,meta:{titleKey:`nav.servers`}},{path:`/w/:workspaceId/servers/:id`,name:`server-detail`,component:$1,meta:{titleKey:`views.route.server`}},{path:`/w/:workspaceId/logs`,name:`logs`,component:rX,meta:{titleKey:`nav.logs`}},{path:`/w/:workspaceId/settings`,name:`settings`,component:G2,meta:{titleKey:`nav.workspaceSettings`}},{path:`/global/overview`,name:`global-overview`,component:aW,meta:{titleKey:`nav.globalOverview`}},{path:`/global/settings`,name:`global-settings`,component:hJ,meta:{titleKey:`nav.globalSettings`}},{path:`/proxy`,name:`proxy`,component:Q$,meta:{titleKey:`nav.reverseProxy`}},{path:`/login`,name:`login`,component:WJ,meta:{titleKey:`login.signIn`}},{path:`/`,name:`home`,component:TX},{path:`/:pathMatch(.*)*`,name:`not-found`,component:TX}]});function J2(e,t=`overview`,n){let r=`/w/${encodeURIComponent(e)}`;return t===`overview`?r:t===`servers`?n===void 0?`${r}/servers`:`${r}/servers/${encodeURIComponent(n)}`:`${r}/${t}`}q2.beforeEach(async e=>{let{session:t,refresh:n}=xP();t.value===null&&await n();let r=mR(e,t.value);if(r!==null)return r;if(e.name===`login`||e.name===`global-overview`||e.name===`global-settings`||e.name===`proxy`)return!0;if(e.name===`home`||e.name===`not-found`)return{name:`global-overview`,replace:!0};await gI().ensureState();let i=jI(),a=i.workspaces.value;if(a.length===0)return!0;let o=typeof e.params.workspaceId==`string`?e.params.workspaceId:``;if(o.length>0&&a.some(e=>e.id===o)&&(i.select(o),K2.has(String(e.name))))return!0;let s=i.activeId.value||a[0].id,c=String(e.name??``),l={...e.params,workspaceId:s};return c===`server-detail`&&l.id===void 0?{name:`servers`,params:{workspaceId:s},query:e.query,replace:!0}:{name:c,params:l,query:e.query,replace:!0}});var Y2={class:`flex items-center gap-2.5 border-b border-line px-3.5`},X2=[`placeholder`],Z2={key:0,class:`px-3 py-8 text-center text-xs text-muted`},Q2={class:`px-2.5 pb-1 pt-2.5 text-2xs font-medium text-faint`},$2=[`data-active`,`onMousemove`,`onClick`],e4={class:`min-w-0 flex-1 truncate text-sm`},t4={key:0,class:`min-w-0 max-w-[45%] shrink truncate font-mono text-2xs text-faint`},n4={class:`flex items-center gap-3 border-t border-line bg-panel-2 px-3.5 py-2 text-2xs text-faint`},r4={class:`ml-auto font-mono`},i4=N({__name:`CommandPalette`,props:{open:{type:Boolean,default:!1},openModifiers:{}},emits:[`update:open`],setup(e){let t=lo(e,`open`),n=Qg(),r=gI(),i=jI(),a=TI(),o=k(``),s=k(0),c=k(null),l=k(null);function u(e){n.push(e)}function d(e){i.select(e);let t=String(n.currentRoute.value.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?u(J2(e,t)):t===`server-detail`&&u(J2(e,`servers`))}function f(e){e(),t.value=!1}let p=[`stopped`,`crashed`,`conflict`],m=[`running`,`starting`,`backoff`],h=W(()=>{let e=[],t=r.allServers.value;function n(e,t){i.select(e),u(t)}let o=e=>J2(i.activeId.value,e);for(let{workspace:i,server:a}of t){let t=a.config.label??a.id,o=Y(oR[a.status].labelKey);e.push({id:`open:${i.id}:${a.id}`,title:Y(`palette.openServer`,{label:t}),group:Y(`palette.groupServers`),icon:Hy,detail:`${i.label} · ${a.id} · ${o}`,keywords:`server detail ${a.id} ${i.label} show`,run:()=>n(i.id,J2(i.id,`servers`,a.id))}),e.push({id:`logs:${i.id}:${a.id}`,title:Y(`palette.serverLogs`,{label:t}),group:Y(`palette.groupServers`),icon:Xy,detail:`${i.label} · ${a.id}`,keywords:`log tail output ${a.id} ${i.label}`,run:()=>n(i.id,`${J2(i.id,`logs`)}?server=${encodeURIComponent(a.id)}`)}),p.includes(a.status)&&a.config.enabled&&e.push({id:`start:${i.id}:${a.id}`,title:Y(`palette.startServer`,{label:t}),group:Y(`palette.groupActions`),icon:Py,detail:`${i.label} · ${a.id}`,keywords:`run launch ${a.id} ${i.label}`,run:()=>f(()=>void r.start(i.id,a.id))}),m.includes(a.status)&&e.push({id:`stop:${i.id}:${a.id}`,title:Y(`palette.stopServer`,{label:t}),group:Y(`palette.groupActions`),icon:Jy,detail:`${i.label} · ${a.id}`,keywords:`halt kill ${a.id} ${i.label}`,run:()=>f(()=>void r.stop(i.id,a.id))}),a.config.enabled&&e.push({id:`restart:${i.id}:${a.id}`,title:Y(`palette.restartServer`,{label:t}),group:Y(`palette.groupActions`),icon:zy,detail:`${i.label} · ${a.id}`,keywords:`bounce reload ${a.id} ${i.label}`,run:()=>f(()=>void r.restart(i.id,a.id))})}e.push({id:`nav:overview`,title:Y(`palette.goOverview`),group:Y(`palette.groupNavigate`),icon:Cy,keywords:`dashboard home workspace`,run:()=>u(o(`overview`))},{id:`nav:global`,title:Y(`palette.goGlobalOverview`),group:Y(`palette.groupNavigate`),icon:vy,keywords:`dashboard home host vitals every workspace`,run:()=>u(`/global/overview`)},{id:`nav:global-settings`,title:Y(`palette.goGlobalSettings`),group:Y(`palette.groupNavigate`),icon:qy,keywords:`panel listener auth tls backups host`,run:()=>u(`/global/settings`)},{id:`nav:proxy`,title:Y(`palette.goProxy`),group:Y(`palette.groupNavigate`),icon:tb,keywords:`caddy domain route acme certificate https expose`,run:()=>u(`/proxy`)},{id:`nav:servers`,title:Y(`palette.goServers`),group:Y(`palette.groupNavigate`),icon:Hy,keywords:`processes list workspace`,run:()=>u(o(`servers`))},{id:`nav:logs`,title:Y(`palette.goLogs`),group:Y(`palette.groupNavigate`),icon:By,keywords:`output files tail workspace`,run:()=>u(o(`logs`))},{id:`nav:settings`,title:Y(`palette.goWorkspaceSettings`),group:Y(`palette.groupNavigate`),icon:Uy,keywords:`defaults notifications ddns config workspace`,run:()=>u(o(`settings`))},{id:`act:start-all`,title:Y(`palette.startAll`),group:Y(`palette.groupActions`),icon:Py,keywords:`boot all workspace`,run:()=>f(()=>void r.startAll(i.activeId.value))},{id:`act:stop-all`,title:Y(`palette.stopAll`),group:Y(`palette.groupActions`),icon:Jy,keywords:`halt all workspace`,run:()=>f(()=>void r.stopAll(i.activeId.value))});for(let t of i.workspaces.value)e.push({id:`ws:${t.id}`,title:Y(`palette.switchWorkspace`,{label:t.label}),group:Y(`palette.groupWorkspaces`),icon:Sy,detail:t.id,keywords:`workspace switch scope ${t.label}`,run:()=>f(()=>d(t.id))});for(let[t,n]of[[`listener`,`views.globalSettings.sectionListener`],[`authentication`,`views.globalSettings.sectionAuthentication`],[`host`,`views.globalSettings.sectionHost`],[`backups`,`views.globalSettings.sectionBackups`],[`tls`,`views.globalSettings.sectionTls`],[`language`,`language.label`],[`interface`,`views.globalSettings.sectionInterface`],[`paths`,`views.globalSettings.sectionPaths`]])e.push({id:`gset:${t}`,title:Y(`palette.globalSetting`,{label:Y(n)}),group:Y(`nav.globalSettings`),icon:vy,keywords:`configure panel ${t}`,run:()=>u(`/global/settings?section=${t}`)});for(let[t,n]of[[`defaults`,`views.settings.sectionDefaults`],[`logs`,`views.settings.sectionLogs`],[`notifications`,`views.settings.sectionNotifications`],[`ddns`,`views.settings.sectionDdns`]])e.push({id:`wset:${t}`,title:Y(`palette.workspaceSetting`,{label:Y(n)}),group:Y(`nav.workspaceSettings`),icon:Uy,keywords:`configure workspace ${t}`,run:()=>u(`${J2(i.activeId.value,`settings`)}?section=${t}`)});let s=[[`light`,`theme.light`,Yy],[`dark`,`theme.dark`,Ay],[`system`,`theme.system`,ky]];for(let[t,n,r]of s)e.push({id:`theme:${t}`,title:Y(`palette.theme`,{theme:Y(n)}),group:Y(`palette.groupAppearance`),icon:r,keywords:`colour color dark light mode appearance`,run:()=>f(()=>a.setPreference(t))});return e}),g=W(()=>{let e=o.value.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.length===0?h.value.slice(0,40):h.value.map(t=>{let n=`${t.title} ${t.detail??``} ${t.keywords??``} ${t.group}`.toLowerCase(),r=0;for(let t of e){let e=n.indexOf(t);if(e===-1)return null;r+=e===0?0:e}return{command:t,score:r}}).filter(e=>e!==null).sort((e,t)=>e.score-t.score).slice(0,40).map(e=>e.command)}),_=W(()=>{let e=new Map;for(let t of g.value){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]}),v=W(()=>_.value.flatMap(([,e])=>e));M(g,()=>{s.value=0}),M(t,async e=>{e&&(o.value=``,s.value=0,await ir(),c.value?.focus())});function y(e){let t=v.value.length;t!==0&&(s.value=(s.value+e+t)%t,ir(()=>{l.value?.querySelector(`[data-active="true"]`)?.scrollIntoView({block:`nearest`})}))}function b(e){e.key===`ArrowDown`?(e.preventDefault(),y(1)):e.key===`ArrowUp`?(e.preventDefault(),y(-1)):e.key===`Enter`&&(e.preventDefault(),v.value[s.value]?.run())}function x(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t.value=!t.value)}return ia(()=>window.addEventListener(`keydown`,x)),ze(()=>window.removeEventListener(`keydown`,x)),(e,n)=>(L(),z(A(yf),{open:t.value,"onUpdate:open":n[2]||=e=>t.value=e},{default:j(()=>[V(A(lp),null,{default:j(()=>[V(A(sp),{class:`fixed inset-0 z-50 bg-black/40 backdrop-blur-[1px] data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`}),V(A(ip),{class:`fixed left-1/2 top-[10vh] z-50 w-[min(94vw,38rem)] -translate-x-1/2 overflow-hidden rounded-panel border border-line bg-panel shadow-float data-[state=open]:animate-[hh-pop-in_150ms_var(--ease-out-quick)]`,onOpenAutoFocus:n[1]||=_u(()=>{},[`prevent`]),onKeydown:b},{default:j(()=>[V(A(up),{class:`sr-only`},{default:j(()=>[H(O(A(Y)(`topbar.commandPalette`)),1)]),_:1}),B(`div`,Y2,[V(A(Vy),{class:`size-4 shrink-0 text-faint`}),wr(B(`input`,{ref_key:`input`,ref:c,"onUpdate:modelValue":n[0]||=e=>o.value=e,type:`text`,placeholder:A(Y)(`palette.placeholder`),class:`h-12 w-full bg-transparent text-sm text-ink outline-none placeholder:text-faint`,autocomplete:`off`,spellcheck:`false`},null,8,X2),[[nu,o.value]]),n[3]||=B(`kbd`,{class:`shrink-0 rounded border border-line bg-page px-1.5 py-0.5 font-mono text-2xs text-faint`},`esc`,-1)]),B(`div`,{ref_key:`list`,ref:l,class:`max-h-[min(60vh,26rem)] overflow-y-auto p-1.5`},[v.value.length===0?(L(),R(`p`,Z2,O(A(Y)(`palette.noMatches`,{query:o.value})),1)):U(``,!0),(L(!0),R(I,null,P(_.value,([e,t])=>(L(),R(I,{key:e},[B(`p`,Q2,O(e),1),(L(!0),R(I,null,P(t,e=>(L(),R(`button`,{key:e.id,type:`button`,"data-active":v.value[s.value]?.id===e.id,class:D(A(Q)(`flex w-full items-center gap-2.5 rounded-control px-2.5 py-2 text-left transition-colors duration-100`,v.value[s.value]?.id===e.id?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`)),onMousemove:t=>s.value=v.value.findIndex(t=>t.id===e.id),onClick:t=>e.run()},[(L(),z(_a(e.icon),{class:D([`size-4 shrink-0`,v.value[s.value]?.id===e.id?`text-accent`:`text-faint`])},null,8,[`class`])),B(`span`,e4,O(e.title),1),e.detail?(L(),R(`span`,t4,O(e.detail),1)):U(``,!0),V(A(ty),{class:D([`size-3.5 shrink-0 text-faint opacity-0 transition-opacity duration-100`,{"opacity-100":v.value[s.value]?.id===e.id}])},null,8,[`class`])],42,$2))),128))],64))),128))],512),B(`div`,n4,[B(`span`,null,[n[4]||=B(`kbd`,{class:`font-mono`},`↑↓`,-1),H(` `+O(A(Y)(`palette.navigate`)),1)]),B(`span`,null,[n[5]||=B(`kbd`,{class:`font-mono`},`↵`,-1),H(` `+O(A(Y)(`palette.run`)),1)]),B(`span`,r4,O(A(PF)(`palette.results`,v.value.length)),1)])]),_:1})]),_:1})]),_:1},8,[`open`]))}}),a4={class:`rounded-panel border border-line bg-panel-2/70 p-3`},o4={class:`mb-2 flex items-center justify-between`},s4={class:`text-2xs font-medium text-faint`},c4={key:0,class:`text-2xs text-faint`},l4={key:0,class:`grid grid-cols-2 gap-x-1 gap-y-2`},u4={key:1,class:`mt-2 flex items-baseline justify-between border-t border-line-soft pt-2 text-2xs`},d4=[`title`],f4={class:`font-mono tabular-nums text-ink`},p4={key:2,class:`py-3 text-center text-2xs text-faint`},m4={key:3,class:`mt-2 flex items-start gap-1.5 rounded-control bg-danger-soft px-2 py-1.5`},h4={class:`text-2xs leading-4 text-danger`},g4=N({__name:`InstrumentCluster`,props:{host:{}},setup(e){let t=e,n=W(()=>NA(t.host)),r=W(()=>n.value.cpuUsedPercent),i=W(()=>OA(r.value)??`ok`),a=W(()=>n.value.loadPerCpu===null?`—`:n.value.loadPerCpu.toFixed(2)),o=W(()=>{let e=n.value.disks;return e.length===0?null:Math.max(...e.map(e=>e.usedPercent))}),s=W(()=>{let e=n.value.disks.map(e=>e.band);return e.includes(`danger`)?`danger`:e.includes(`warn`)?`warn`:e.includes(`ok`)?`ok`:`neutral`}),c=W(()=>n.value.memoryBand??`neutral`),l=W(()=>n.value.tempBand??`neutral`),u=W(()=>jA(n.value.tempCelsius,t.host?.tempCelsiusAlert)),d=W(()=>{let e=n.value.tempCelsius;return e===null?Y(`common.notAvailable`):`${Math.round(e)}°`});return(e,f)=>(L(),R(`div`,a4,[B(`div`,o4,[B(`span`,s4,O(A(Y)(`nav.hostVitals`)),1),t.host?.enabled===!1?(L(),R(`span`,c4,O(A(Y)(`host.statusOff`)),1)):U(``,!0)]),t.host?.enabled?(L(),R(`div`,l4,[V(CR,{value:r.value,label:A(Y)(`host.cpuUsage`),size:58,tone:i.value},null,8,[`value`,`label`,`tone`]),V(CR,{value:n.value.memoryUsedPercent,label:A(Y)(`common.memory`),size:58,tone:c.value},null,8,[`value`,`label`,`tone`]),V(CR,{value:o.value,label:A(Y)(`common.disk`),size:58,tone:s.value},null,8,[`value`,`label`,`tone`]),V(CR,{value:u.value,label:A(Y)(`host.cpuTemp`),display:d.value,size:58,tone:l.value},null,8,[`value`,`label`,`display`,`tone`])])):U(``,!0),t.host?.enabled?(L(),R(`p`,u4,[B(`span`,{class:`text-faint`,title:A(Y)(`host.loadHint`)},O(A(Y)(`host.loadPerCpu`)),9,d4),B(`span`,f4,O(a.value),1)])):(L(),R(`p`,p4,O(A(Y)(`host.samplingOffCompact`)),1)),t.host&&t.host.alerts.length>0?(L(),R(`div`,m4,[f[0]||=B(`span`,{class:`mt-1 size-1.5 shrink-0 rounded-full bg-danger`},null,-1),B(`span`,h4,O(t.host.alerts.join(` · `)),1)])):U(``,!0)]))}}),_4={class:`flex h-full min-h-0 flex-col gap-3 overflow-y-auto p-3`},v4={class:`flex items-center gap-2 px-1 pt-1`},y4={class:`min-w-0`},b4={class:`truncate text-sm font-semibold tracking-tight text-ink`},x4=[`title`],S4=[`aria-label`],C4=[`aria-label`],w4={class:`flex items-center gap-1 truncate px-2.5 pb-1 text-2xs font-medium text-faint`},T4={key:1,class:`text-muted`},E4={class:`mt-auto flex flex-col gap-3`},D4={class:`flex items-center gap-2 rounded-control border border-line bg-panel-2/70 px-2.5 py-2`},O4={class:`relative flex size-2 shrink-0`},k4={class:`text-2xs text-muted`},A4=[`title`],j4=N({__name:`SideNav`,props:{host:{},connection:{},panelLabel:{},panelVersion:{},planLabel:{},workspaceId:{},workspaceLabel:{},running:{},total:{}},emits:[`navigate`,`close`],setup(e,{emit:t}){let n=e,r=t,i=$g(),a=W(()=>[{to:J2(n.workspaceId,`overview`),labelKey:`nav.overview`,icon:Cy,exact:!0,servers:!1},{to:J2(n.workspaceId,`servers`),labelKey:`nav.servers`,icon:Hy,exact:!1,servers:!0},{to:J2(n.workspaceId,`logs`),labelKey:`nav.logs`,icon:By,exact:!1,servers:!1},{to:J2(n.workspaceId,`settings`),labelKey:`nav.workspaceSettings`,icon:Uy,exact:!1,servers:!1}]),o=[{to:`/global/overview`,labelKey:`nav.globalOverview`,icon:vy,exact:!0,servers:!1},{to:`/global/settings`,labelKey:`nav.globalSettings`,icon:qy,exact:!1,servers:!1}],s=[{to:`/proxy`,labelKey:`nav.reverseProxy`,icon:tb,exact:!1,servers:!1}],c=W(()=>[{titleKey:`nav.global`,label:``,icon:vy,items:o},{titleKey:`nav.workspace`,label:n.workspaceLabel,icon:void 0,items:a.value},{titleKey:`nav.others`,label:``,icon:Zv,items:s}]);function l(e){return e.exact?i.path===e.to:i.path===e.to||i.path.startsWith(`${e.to}/`)}let u=W(()=>n.panelVersion===null?n.panelLabel:`${n.panelLabel} · v${n.panelVersion}`),d=W(()=>({open:{labelKey:`connection.live`,dot:`bg-ok`},connecting:{labelKey:`connection.connecting`,dot:`bg-warn`},closed:{labelKey:`connection.reconnecting`,dot:`bg-danger`}})[n.connection]);return(e,t)=>{let i=ha(`RouterLink`);return L(),R(`div`,_4,[B(`div`,v4,[t[2]||=As(`<span class="grid size-8 shrink-0 place-items-center rounded-[9px] border border-accent/30 bg-accent-soft text-accent"><svg viewBox="0 0 24 24" class="size-4.5" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M4 15.5a8 8 0 1 1 16 0"></path><path d="M12 15.5 15.6 10.2"></path><circle cx="12" cy="15.5" r="1.3" fill="currentColor" stroke="none"></circle></svg></span>`,1),B(`div`,y4,[B(`p`,b4,O(A(Y)(`app.name`)),1),B(`p`,{class:`truncate text-2xs text-faint`,title:u.value},O(u.value),9,x4)]),B(`button`,{type:`button`,class:`ml-auto grid size-7 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`nav.closeNavigation`),onClick:t[0]||=e=>r(`close`)},[V(A(nb),{class:`size-4`})],8,S4)]),B(`nav`,{class:`flex flex-col gap-3`,"aria-label":A(Y)(`nav.navigation`)},[(L(!0),R(I,null,P(c.value,e=>(L(),R(`div`,{key:e.titleKey,class:`flex min-h-0 flex-col gap-0.5`},[B(`p`,w4,[e.icon?(L(),z(_a(e.icon),{key:0,class:`size-3 shrink-0`})):U(``,!0),H(` `+O(e.label?`${A(Y)(e.titleKey)} · `:A(Y)(e.titleKey)),1),e.label?(L(),R(`span`,T4,O(e.label),1)):U(``,!0)]),(L(!0),R(I,null,P(e.items,e=>(L(),z(i,{key:e.to,to:e.to,class:D(A(Q)(`group flex items-center gap-2.5 rounded-control px-2.5 py-1.5 text-sm transition-colors duration-150`,l(e)?`bg-accent-soft font-medium text-accent`:`text-muted hover:bg-hover hover:text-ink`)),onClick:t[1]||=e=>r(`navigate`)},{default:j(()=>[(L(),z(_a(e.icon),{class:`size-4 shrink-0`,"stroke-width":l(e)?2.1:1.8},null,8,[`stroke-width`])),H(` `+O(A(Y)(e.labelKey))+` `,1),e.servers?(L(),R(`span`,{key:0,class:D([`ml-auto font-mono text-2xs tabular-nums`,l(e)?`text-accent`:`text-faint`])},O(n.running)+`/`+O(n.total),3)):U(``,!0)]),_:2},1032,[`to`,`class`]))),128))]))),128))],8,C4),B(`div`,E4,[V(g4,{host:n.host},null,8,[`host`]),B(`div`,D4,[B(`span`,O4,[B(`span`,{class:D(A(Q)(`absolute inset-0 rounded-full`,d.value.dot,n.connection!==`open`&&`animate-ping opacity-60`))},null,2),B(`span`,{class:D(A(Q)(`relative size-2 rounded-full`,d.value.dot))},null,2)]),B(`span`,k4,O(A(Y)(d.value.labelKey)),1),B(`span`,{class:`ml-auto truncate font-mono text-2xs text-faint`,title:n.planLabel},O(n.planLabel),9,A4)])])])}}}),M4={key:0,class:`flex flex-col gap-px border-b border-line bg-panel/60`},N4={class:`text-2xs leading-4`},P4={class:`font-medium`},F4={key:0,class:`opacity-80`},I4=N({__name:`SystemNotices`,props:{control:{},configError:{},configPath:{}},setup(e){let t=e,n=W(()=>{let e=[],n=t.control?.auth;return t.configError&&e.push({id:`config`,tone:`danger`,text:Y(`notice.configError`,{error:t.configError}),hint:Y(`notice.configErrorHint`,{path:t.configPath??`servers.config.json`})}),n&&(n.blockedReason&&e.push({id:`blocked`,tone:`danger`,text:n.blockedReason}),n.usingDefaultPassword?e.push({id:`default-password`,tone:`warn`,text:Y(`notice.defaultPassword`),hint:Y(`notice.defaultPasswordHint`)}):n.enabled&&!n.passwordSet&&e.push({id:`no-password`,tone:`warn`,text:Y(`notice.noPassword`),hint:Y(`notice.noPasswordHint`)}),n.exposed&&e.push({id:`exposed`,tone:`warn`,text:Y(`notice.exposed`),hint:Y(`notice.exposedHint`)}),!n.enabled&&!n.exposed&&e.push({id:`auth-off`,tone:`info`,text:Y(`notice.authOff`)})),e}),r={warn:{wrap:`border-warn/25 bg-warn-soft text-warn`,icon:eb},danger:{wrap:`border-danger/25 bg-danger-soft text-danger`,icon:iy},info:{wrap:`border-line bg-panel-2 text-muted`,icon:iy}};return(e,t)=>n.value.length>0?(L(),R(`div`,M4,[(L(!0),R(I,null,P(n.value,e=>(L(),R(`div`,{key:e.id,class:D([`flex items-start gap-2 px-3 py-1.5 sm:px-4`,r[e.tone].wrap])},[(L(),z(_a(r[e.tone].icon),{class:`mt-0.5 size-3.5 shrink-0`})),B(`p`,N4,[B(`span`,P4,O(e.text),1),e.hint?(L(),R(`span`,F4,O(e.hint),1)):U(``,!0)])],2))),128))])):U(``,!0)}}),L4={class:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-[min(92vw,22rem)] flex-col gap-2`,role:`status`,"aria-live":`polite`},R4={class:`min-w-0 flex-1`},z4={class:`text-xs font-medium text-ink`},B4={key:0,class:`mt-0.5 break-words text-2xs leading-4 text-muted`},V4=[`aria-label`,`onClick`],H4=N({__name:`ToastStack`,setup(e){let{toasts:t,dismiss:n}=EP(),r={ok:ay,danger:oy,warn:eb,info:by,accent:by,neutral:by},i={ok:`text-ok`,danger:`text-danger`,warn:`text-warn`,info:`text-info`,neutral:`text-muted`,accent:`text-accent`},a=W(()=>t.value);return(e,t)=>(L(),R(`div`,L4,[V(Bl,{"enter-active-class":`transition duration-150 ease-out`,"enter-from-class":`translate-x-2 opacity-0`,"leave-active-class":`transition duration-100 ease-in`,"leave-to-class":`translate-x-2 opacity-0`},{default:j(()=>[(L(!0),R(I,null,P(a.value,e=>(L(),R(`div`,{key:e.id,class:`pointer-events-auto flex items-start gap-2.5 rounded-panel border border-line bg-raise p-3 shadow-float`},[(L(),z(_a(r[e.tone]),{class:D(A(Q)(`mt-0.5 size-4 shrink-0`,i[e.tone]))},null,8,[`class`])),B(`div`,R4,[B(`p`,z4,O(e.title),1),e.description?(L(),R(`p`,B4,O(e.description),1)):U(``,!0)]),B(`button`,{type:`button`,class:`-mr-1 -mt-0.5 grid size-6 shrink-0 place-items-center rounded-control text-faint transition-colors duration-150 hover:bg-hover hover:text-ink`,"aria-label":A(Y)(`common.dismiss`),onClick:t=>A(n)(e.id)},[V(A(nb),{class:`size-3.5`})],8,V4)]))),128))]),_:1})]))}}),U4={class:`space-y-3`},W4={key:0,class:`rounded-control border border-danger/40 bg-danger-soft px-2.5 py-1.5 text-2xs leading-4 text-danger`},G4=N({__name:`WorkspaceDialog`,props:Va({mode:{},initial:{default:``},submit:{}},{open:{type:Boolean,default:!1},openModifiers:{}}),emits:[`update:open`],setup(e){let t=e,n=lo(e,`open`),r=k(t.initial),i=k(!1),a=k(null),o=W(()=>t.mode===`create`?Y(`workspace.new`):Y(`workspace.rename`)),s=W(()=>t.mode===`create`?Y(`workspace.create`):Y(`workspace.renameAction`)),c=W(()=>r.value.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40));M(n,e=>{e&&(r.value=t.initial,a.value=null)});async function l(){let e=r.value.trim();if(e.length===0)a.value=Y(`workspace.nameRequired`);else{i.value=!0,a.value=null;try{await t.submit(e)&&(n.value=!1)}finally{i.value=!1}}}return(t,u)=>(L(),z(LV,{open:n.value,"onUpdate:open":u[2]||=e=>n.value=e,title:o.value,description:e.mode===`create`?A(Y)(`workspace.createHint`):A(Y)(`workspace.renameHint`),width:`w-[min(92vw,26rem)]`},{footer:j(()=>[V($,{variant:`ghost`,disabled:i.value,onClick:u[1]||=e=>n.value=!1},{default:j(()=>[H(O(A(Y)(`common.cancel`)),1)]),_:1},8,[`disabled`]),V($,{variant:`primary`,loading:i.value,onClick:l},{default:j(()=>[H(O(s.value),1)]),_:1},8,[`loading`])]),default:j(()=>[B(`div`,U4,[V(bV,{modelValue:r.value,"onUpdate:modelValue":u[0]||=e=>r.value=e,label:A(Y)(`common.name`),placeholder:A(Y)(`workspace.namePlaceholder`),hint:e.mode===`create`&&c.value.length>0?A(Y)(`workspace.nameHintId`,{id:c.value}):A(Y)(`workspace.nameHint`),wide:``,onKeydown:yu(_u(l,[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`placeholder`,`hint`,`onKeydown`]),a.value?(L(),R(`p`,W4,O(a.value),1)):U(``,!0)])]),_:1},8,[`open`,`title`,`description`]))}}),K4=[`aria-label`],q4={class:`hidden min-w-0 truncate font-medium text-ink min-[360px]:inline`},J4={class:`hidden shrink-0 font-mono text-2xs text-faint sm:inline`},Y4={class:`px-2 pb-1 pt-1.5 text-2xs font-medium text-faint`},X4={key:0,class:`max-h-64 overflow-y-auto`},Z4=[`onClick`],Q4={class:`min-w-0 flex-1`},$4={class:`block truncate text-xs`},e3={class:`block truncate font-mono text-2xs text-faint`},t3={class:`shrink-0 font-mono text-2xs text-faint`},n3={key:1,class:`px-2 py-2 text-xs text-muted`},r3={class:`px-2 pt-1.5 text-xs font-semibold text-ink`},i3={class:`mt-1 px-2 text-2xs leading-4 text-muted`},a3={class:`mt-2 flex justify-end gap-1.5 px-1 pb-1`},o3=N({__name:`WorkspacePicker`,props:{workspaces:{},selectedId:{}},emits:[`select`,`create`,`rename`,`remove`],setup(e,{emit:t}){let n=e,r=t,i=k(!1),a=k(!1),o=W(()=>n.workspaces.find(e=>e.id===n.selectedId)??null);function s(e){r(`select`,e),i.value=!1}function c(){a.value=!0}function l(){a.value=!1}function u(){let e=o.value;a.value=!1,i.value=!1,e!==null&&r(`remove`,e)}function d(){i.value=!1,r(`create`)}function f(){i.value=!1,o.value!==null&&r(`rename`,o.value)}async function p(e){i.value=e,e&&(a.value=!1,await ir())}return(t,n)=>(L(),z(A(rg),{open:i.value,"onUpdate:open":p},{default:j(()=>[V(A(ug),{"as-child":``},{default:j(()=>[B(`button`,{type:`button`,class:D(A(Q)(`flex h-8 min-w-0 max-w-36 items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 text-xs transition-colors duration-150 hover:border-line hover:text-ink sm:max-w-52`,A(tV))),"aria-label":A(Y)(`topbar.workspaceLabel`,{name:o.value?.label??A(Y)(`common.none`)})},[V(A(Sy),{class:`size-3.5 shrink-0 text-faint`}),B(`span`,q4,O(o.value?.label??A(Y)(`workspace.none`)),1),B(`span`,J4,O(o.value?.runningCount??0)+`/`+O(o.value?.serverCount??0),1),V(A(ry),{class:`size-3 shrink-0 text-faint`})],10,K4)]),_:1}),V(A(lg),null,{default:j(()=>[V(A(cg),{"side-offset":6,align:`end`,class:`z-50 w-72 rounded-panel border border-line bg-raise p-1 shadow-float focus-visible:outline-none data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[a.value?(L(),R(I,{key:1},[B(`p`,r3,O(A(Y)(`workspace.deleteTitle`,{name:o.value?.label??``})),1),B(`p`,i3,O(A(Y)(`workspace.deleteBody`)),1),B(`div`,a3,[V($,{size:`xs`,variant:`ghost`,onClick:l},{default:j(()=>[H(O(A(Y)(`common.keepIt`)),1)]),_:1}),V($,{size:`xs`,variant:`danger`,onClick:u},{default:j(()=>[V(A($y),{class:`size-3`}),H(O(A(Y)(`workspace.delete`)),1)]),_:1})])],64)):(L(),R(I,{key:0},[B(`p`,Y4,O(A(Y)(`workspace.listHeading`)),1),e.workspaces.length>0?(L(),R(`ul`,X4,[(L(!0),R(I,null,P(e.workspaces,t=>(L(),R(`li`,{key:t.id},[B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left transition-colors duration-100`,t.id===e.selectedId?`bg-accent-soft text-ink`:`text-muted hover:bg-hover`,A(tV))),onClick:e=>s(t.id)},[V(A(Qv),{class:D([`size-3.5 shrink-0`,t.id===e.selectedId?`text-accent`:`opacity-0`])},null,8,[`class`]),B(`span`,Q4,[B(`span`,$4,O(t.label),1),B(`span`,e3,O(t.id),1)]),B(`span`,t3,O(t.runningCount)+`/`+O(t.serverCount),1)],10,Z4)]))),128))])):(L(),R(`p`,n3,O(A(Y)(`workspace.emptyList`)),1)),n[0]||=B(`div`,{class:`my-1 h-px bg-line`},null,-1),B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted transition-colors duration-100 hover:bg-hover hover:text-ink`,A(tV))),onClick:d},[V(A(Fy),{class:`size-3.5`}),H(` `+O(A(Y)(`workspace.newAction`)),1)],2),o.value?(L(),R(I,{key:2},[B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-muted transition-colors duration-100 hover:bg-hover hover:text-ink`,A(tV))),onClick:f},[V(A(Ny),{class:`size-3.5`}),H(` `+O(A(Y)(`workspace.renameActionFor`,{name:o.value.label})),1)],2),B(`button`,{type:`button`,class:D(A(Q)(`flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs text-danger transition-colors duration-100 hover:bg-danger-soft`,A(tV))),onClick:c},[V(A($y),{class:`size-3.5`}),H(` `+O(A(Y)(`workspace.deleteActionFor`,{name:o.value.label})),1)],2)],64)):U(``,!0)],64))]),_:1})]),_:1})]),_:1},8,[`open`]))}}),s3=N({__name:`WorkspaceSwitcher`,setup(e){let{workspaces:t,activeId:n,select:r,create:i,rename:a,remove:o}=jI(),s=$g(),c=Qg(),l=k(!1),u=k(`create`),d=k(null);function f(e){r(e);let t=String(s.name??``);t===`overview`||t===`servers`||t===`logs`||t===`settings`?c.push(J2(e,t)):t===`server-detail`&&c.push(J2(e,`servers`))}function p(){u.value=`create`,d.value=null,l.value=!0}function m(e){u.value=`rename`,d.value=e,l.value=!0}async function h(e){if(u.value===`create`)return await i(e)!==void 0;let t=d.value;return t!==null&&a(t.id,e)}async function g(e){let t=String(s.params.workspaceId??``)||n.value;if(!await o(e.id)||t!==e.id)return;let r=String(s.name??``);(r===`overview`||r===`servers`||r===`logs`||r===`settings`)&&c.push(J2(n.value,r))}return(e,r)=>(L(),R(I,null,[V(o3,{workspaces:A(t),"selected-id":A(n),onSelect:f,onCreate:p,onRename:m,onRemove:g},null,8,[`workspaces`,`selected-id`]),V(G4,{open:l.value,"onUpdate:open":r[0]||=e=>l.value=e,mode:u.value,initial:d.value?.label??``,submit:h},null,8,[`open`,`mode`,`initial`])],64))}}),c3={class:`flex h-13 shrink-0 items-center gap-3 border-b border-line bg-panel/80 px-3 backdrop-blur-sm sm:px-4`},l3=[`aria-label`],u3={class:`min-w-0 flex-1 truncate text-sm font-semibold tracking-tight text-ink`},d3={class:`flex min-w-0 shrink items-center gap-1.5`},f3={class:`pr-6`},p3={class:`hidden items-center gap-1.5 rounded-control border border-line bg-panel-2 px-2 py-1.5 md:flex`},m3={class:`font-mono text-2xs text-muted`},h3={class:`px-2 py-1.5`},g3={class:`text-2xs text-faint`},_3={class:`truncate font-mono text-2xs text-muted`},v3=N({__name:`TopBar`,props:{panelUrl:{},connection:{},authenticated:{type:Boolean}},emits:[`menu`,`palette`,`signOut`],setup(e,{emit:t}){let n=e,r=t,i=$g(),a=TI(),o=W(()=>{if(i.name===`server-detail`)return`${Y(`nav.servers`)} / ${String(i.params.id??``)}`;let e=i.meta.titleKey;return typeof e==`string`?Y(e):String(i.meta.title??Y(`app.name`))}),s=W(()=>a.preference.value===`dark`?Ay:a.preference.value===`light`?Yy:ky),c=W(()=>Y(`theme.label`,{theme:Y(`theme.${a.preference.value}`)})),l=W(()=>({open:`bg-ok`,connecting:`bg-warn`,closed:`bg-danger`})[n.connection]),u=W(()=>({open:`connection.liveUpdates`,connecting:`connection.connecting`,closed:`connection.reconnecting`})[n.connection]);return(t,i)=>(L(),R(`header`,c3,[B(`button`,{type:`button`,class:`grid size-8 shrink-0 place-items-center rounded-control text-muted hover:bg-hover hover:text-ink lg:hidden`,"aria-label":A(Y)(`topbar.openNavigation`),onClick:i[0]||=e=>r(`menu`)},[V(A(Oy),{class:`size-4`})],8,l3),B(`h1`,u3,O(o.value),1),B(`div`,d3,[B(`button`,{type:`button`,class:D(A(Q)(`hidden h-8 items-center gap-2 rounded-control border border-line bg-panel-2 px-2.5 text-xs text-faint transition-colors duration-150 hover:border-line hover:text-muted sm:flex`,A(tV))),onClick:i[1]||=e=>r(`palette`)},[V(A(Vy),{class:`size-3.5`}),B(`span`,f3,O(A(Y)(`topbar.search`)),1),i[5]||=B(`kbd`,{class:`rounded border border-line bg-page px-1 py-0.5 font-mono text-2xs text-faint`},`⌘K`,-1)],2),V(PH,{label:A(Y)(u.value)},{default:j(()=>[B(`span`,p3,[B(`span`,{class:D(A(Q)(`size-1.5 rounded-full`,l.value))},null,2),B(`span`,m3,O(e.panelUrl),1)])]),_:1},8,[`label`]),V(PH,{label:c.value},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":c.value,onClick:i[2]||=e=>A(a).cycle()},{default:j(()=>[(L(),z(_a(s.value),{class:`size-4`}))]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),n.authenticated?(L(),z(A(pg),{key:0},{default:j(()=>[V(A(vg),{"as-child":``},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,"aria-label":A(Y)(`topbar.account`)},{default:j(()=>[...i[6]||=[B(`span`,{class:`grid size-5 place-items-center rounded-full bg-accent-soft font-mono text-2xs font-semibold text-accent`},`hh`,-1)]]),_:1},8,[`aria-label`])]),_:1}),V(A(gg),null,{default:j(()=>[V(A(mg),{"side-offset":6,align:`end`,class:`z-50 min-w-44 rounded-panel border border-line bg-raise p-1 shadow-float data-[state=open]:animate-[hh-fade-in_120ms_ease-out]`},{default:j(()=>[B(`div`,h3,[B(`p`,g3,O(A(Y)(`topbar.signedIn`)),1),B(`p`,_3,O(n.panelUrl),1)]),V(A(_g),{class:`my-1 h-px bg-line`}),V(A(hg),{class:`flex cursor-pointer items-center gap-2 rounded-control px-2 py-1.5 text-xs text-muted outline-none data-[highlighted]:bg-hover data-[highlighted]:text-ink`,onSelect:i[3]||=e=>r(`signOut`)},{default:j(()=>[V(A(Ey),{class:`size-3.5`}),H(` `+O(A(Y)(`topbar.signOut`)),1)]),_:1})]),_:1})]),_:1})]),_:1})):U(``,!0),V(PH,{label:A(Y)(`topbar.commandPalette`)},{default:j(()=>[V($,{variant:`ghost`,size:`icon-sm`,class:`sm:hidden`,"aria-label":A(Y)(`topbar.commandPalette`),onClick:i[4]||=e=>r(`palette`)},{default:j(()=>[V(A(ly),{class:`size-4`})]),_:1},8,[`aria-label`])]),_:1},8,[`label`]),V(s3)])]))}}),y3={key:1,class:`flex h-dvh overflow-hidden bg-page`},b3={class:`hidden w-60 shrink-0 border-r border-line bg-panel/50 lg:block`},x3={key:0,class:`fixed inset-y-0 left-0 z-40 w-64 border-r border-line bg-panel lg:hidden`},S3={class:`flex min-w-0 flex-1 flex-col`},C3=N({__name:`App`,setup(e){let t=$g(),n=Qg(),r=gI(),i=jI(),{session:a,logout:o}=xP(),s=k(!1),c=k(!1),l=W(()=>a.value?.authenticated===!0),u=W(()=>a.value?.authRequired===!0),d=W(()=>t.name===`login`),f=W(()=>t.name===`logs`),p=W(()=>i.runningCount.value),m=W(()=>i.serverCount.value),h=W(()=>r.control.value?.url??`—`),g=W(()=>r.host.value),_=W(()=>r.control.value?.label??`home-hosted`),v=W(()=>r.version.value),y=W(()=>i.selected.value?.label??`none`),b=W(()=>i.activeId.value);return M(W(()=>bP(a.value)),e=>{e!==`wait`&&(e===`login`?(mI(),n.push({name:`login`})):pI())},{immediate:!0}),M(()=>t.fullPath,()=>{c.value=!1}),ia(async()=>{(!u.value||l.value)&&await r.refresh()}),ze(()=>mI()),(e,t)=>{let n=ha(`RouterView`);return L(),z(A(Tg),{"delay-duration":300},{default:j(()=>[d.value?(L(),z(n,{key:0})):(L(),R(`div`,y3,[B(`aside`,b3,[V(j4,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])]),V(Ac,{"enter-active-class":`transition-opacity duration-150`,"leave-active-class":`transition-opacity duration-100`,"enter-from-class":`opacity-0`,"leave-to-class":`opacity-0`},{default:j(()=>[c.value?(L(),R(`div`,{key:0,class:`fixed inset-0 z-40 bg-black/45 lg:hidden`,onClick:t[0]||=e=>c.value=!1})):U(``,!0)]),_:1}),V(Ac,{"enter-active-class":`transition-transform duration-150 ease-out`,"leave-active-class":`transition-transform duration-100 ease-in`,"enter-from-class":`-translate-x-full`,"leave-to-class":`-translate-x-full`},{default:j(()=>[c.value?(L(),R(`aside`,x3,[V(j4,{host:g.value,connection:A(r).connection.value,"panel-label":_.value,"panel-version":v.value,"plan-label":h.value,"workspace-id":b.value,"workspace-label":y.value,running:p.value,total:m.value,onNavigate:t[1]||=e=>c.value=!1,onClose:t[2]||=e=>c.value=!1},null,8,[`host`,`connection`,`panel-label`,`panel-version`,`plan-label`,`workspace-id`,`workspace-label`,`running`,`total`])])):U(``,!0)]),_:1}),B(`div`,S3,[V(v3,{"panel-url":h.value,connection:A(r).connection.value,authenticated:l.value,onMenu:t[3]||=e=>c.value=!0,onPalette:t[4]||=e=>s.value=!0,onSignOut:t[5]||=e=>A(o)()},null,8,[`panel-url`,`connection`,`authenticated`]),d.value?U(``,!0):(L(),z(I4,{key:0,control:A(r).control.value,"config-error":A(i).configError.value,"config-path":A(i).selected.value?.configPath},null,8,[`control`,`config-error`,`config-path`])),B(`main`,{class:D(A(Q)(`relative min-h-0 flex-1`,f.value?`overflow-hidden`:`overflow-y-auto`))},[V(n)],2)])])),V(i4,{open:s.value,"onUpdate:open":t[6]||=e=>s.value=e},null,8,[`open`]),V(H4)]),_:1})}}});NF().catch(()=>{}).finally(()=>{Du(C3).use(q2).mount(`#app`)});