import{I as V}from"./IdnodeGrid-U6EqXqja.js";import{I as E}from"./IdnodeConfigForm-BL6DOswR.js";import{M as P}from"./MasterDetailLayout-oilsSeUU.js";import{I as T}from"./IdnodePickClassDialog-CA1mKQhx.js";import{A as z}from"./ActionMenu-B3aKIJFu.js";import{M as B,d as g,j as u,x as N,y as U,o as c,e as f,P as h,E as $,U as j,q,k as w,_ as A,u as L,f as p,g as m,t as F,h as a,r as _,bj as G,bk as H}from"./index-D92x6h1h.js";import{C as J}from"./circle-check-DOOMuisf.js";import{C as K}from"./circle-dot-BCp4dfsV.js";import{C as O}from"./circle-CPRK1bie.js";import{u as Q,a as W,b as X}from"./useMasterDetailActions-7f-vDWd7.js";import{u as Y}from"./useIdnodeMove-BsPTueJd.js";import"./DataGrid-CbtTsx8d.js";import"./index-BG9mM10J.js";import"./index-7HNOjfAo.js";import"./localDay-CoEbUe3O.js";import"./SearchInput-DBHWpJgW.js";import"./useGridLayout-DCIiMD42.js";import"./CollapsibleSection.vue_vue_type_style_index_0_lang-Cq2AVc9p.js";import"./sliders-horizontal-Am8f4Xsv.js";import"./useStaleDataRecovery-BuNK-94T.js";/**
 * @license lucide-vue-next v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Z=B("CircleAlertIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),ee={key:0,class:"ca-status-wrap"},te=g({__name:"CaStatusCell",props:{value:{}},setup(v){const e=v,l={caclientNone:{icon:O,label:u("Idle"),cls:"ca-status--idle"},caclientReady:{icon:K,label:u("Ready"),cls:"ca-status--ready"},caclientConnected:{icon:J,label:u("Connected"),cls:"ca-status--connected"},caclientDisconnected:{icon:Z,label:u("Disconnected"),cls:"ca-status--disconnected"}},i=w(()=>typeof e.value!="string"?null:l[e.value]??null);return(r,d)=>{const s=N("tooltip");return i.value?U((c(),f("span",ee,[(c(),h(j(i.value.icon),{size:16,class:$(["ca-status",i.value.cls]),"aria-label":i.value.label},null,8,["class","aria-label"]))])),[[s,i.value.label,void 0,{bottom:!0}]]):q("",!0)}}}),le=A(te,[["__scopeId","data-v-13c5f1ba"]]),ie={class:"ca-clients"},oe={key:1,class:"ca-clients__empty"},ne=g({__name:"ConfigCasView",setup(v){const{t:e}=L(),l=_(null),i=Q({selected:l,createEndpoint:"caclient/create",successMessage:e("CA client created. Edit settings on the right."),noUuidErrorMessage:e("Server returned no client uuid.")}),r=W({selected:l,createEndpoint:"caclient/create"}),d=X({selected:l,confirmText:e("Do you really want to delete this CA client?")}),s=_(null),D=[{field:"status",label:e("Status"),sortable:!0,width:56,cellComponent:le,hiddenByDefault:!1},{field:"title",label:e("Name"),sortable:!0,filterType:"string",width:280,minVisible:"phone",phoneRole:"primary"}],{moveInflight:C,moveSelected:I,canMove:x}=Y(s);function b(){if(!l.value)return[];const o=(s.value?.store?.entries??[]).find(t=>t.uuid===l.value);return o?[o]:[]}async function y(n){return I(n,b())}function k(n){return x(b(),n)}function M(n,o){const t=n.uuid;o(typeof t=="string"?t:null)}const S=w(()=>[{id:"add",label:e("Add"),onClick:i.onAddClick},{id:"clone",label:r.inflight.value?e("Cloning…"):e("Clone"),disabled:!l.value||r.inflight.value,onClick:r.run},{id:"delete",label:d.inflight.value?e("Deleting…"):e("Delete"),disabled:!l.value||d.inflight.value,onClick:d.run},{id:"move-up",label:e("Move selected client up"),icon:G,disabled:C.value||!k("up"),onClick:()=>y("up")},{id:"move-down",label:e("Move selected client down"),icon:H,disabled:C.value||!k("down"),onClick:()=>y("down")}]);return(n,o)=>(c(),f("div",ie,[p(P,{"selected-uuid":l.value,"onUpdate:selectedUuid":o[0]||(o[0]=t=>l.value=t),"storage-key":"config-cas"},{master:m(({select:t})=>[p(V,{ref_key:"gridRef",ref:s,endpoint:"caclient/list","help-page":"class/caclient","entity-class":"caclient",columns:D,"store-key":"config-cas","default-sort":{key:"class",dir:"ASC"},"virtual-scroller-options":{itemSize:36,lazy:!1},"count-label":a(e)("clients"),"client-side-filter":"",selectable:"single",class:"ca-clients__grid",onRowClick:R=>M(R,t)},{toolbarActions:m(()=>[p(z,{actions:S.value},null,8,["actions"])]),_:1},8,["count-label","onRowClick"])]),detail:m(({selectedUuid:t})=>[t?(c(),h(E,{key:0,uuid:t,"lock-level":"expert"},null,8,["uuid"])):(c(),f("p",oe,F(a(e)("Select a CA client on the left to view and edit its configuration.")),1))]),_:1},8,["selected-uuid"]),p(T,{visible:a(i).pickerVisible.value,"builders-endpoint":"caclient/builders",title:a(e)("Add Conditional Access Client"),label:a(e)("Type"),onPick:a(i).onClassPicked,onClose:o[1]||(o[1]=t=>a(i).pickerVisible.value=!1)},null,8,["visible","title","label","onPick"])]))}}),Ie=A(ne,[["__scopeId","data-v-ba1e4900"]]);export{Ie as default};
