import{C as k}from"./Container-CLJQvqnD.js";import{P as E}from"./ProviderFilters-xxDNHjuL.js";import{d as B,r as p,O as w,v as o,cf as a,ae as S,c as y,a as P,b as n,t as l,u as x,$ as r,w as i,F as T,o as f,g as $,h as R,x as D,b4 as O,b5 as g,bJ as F,n as G,j as Y,bt as j,z as q,f as J}from"./index-BhOyEZK_.js";import{z as A}from"./index-CBho6rsP.js";import{V as Q,a as H}from"./VRow-CoIuIaw9.js";import{V as K}from"./VBtn-BOIOydWK.js";import{_ as W}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./VContainer-DKHNP7rI.js";/* empty css              */import"./VTextField-Sp-MxMBq.js";import"./VInput-CthlhD7f.js";const X={class:"filters"},Z={class:"pl-5 font-weight-medium"},ee=B({__name:"AddProvider",setup(te){const v=J(),_=p([]),d=p(""),c=p([]),h=w(()=>{let e=Object.values(o.providerManifests);return e=e.filter(t=>!t.builtin&&t.type!=="core"),c.value.length>0&&(e=e.filter(t=>c.value.includes(t.type))),e.filter(t=>t.multi_instance||!_.value.find(s=>s.domain==t.domain)).sort((t,s)=>{const m=C(t.type)-C(s.type);if(m!==0)return m;const z=(t.name||o.providerManifests[t.domain].name).toUpperCase(),N=(s.name||o.providerManifests[s.domain].name).toUpperCase();return z>N?1:-1})}),u=w(()=>{if(!d.value)return h.value;const e=d.value.toLowerCase();return h.value.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))}),V=async function(){_.value=await o.getProviderConfigs()},b=function(e){if(e.depends_on&&!o.getProvider(e.depends_on)){const t=o.getProviderName(e.depends_on);confirm(r("settings.provider_depends_on_confirm",[e.name,t]))&&v.push(`/settings/addprovider/${e.depends_on}`);return}v.push(`/settings/addprovider/${e.domain}`)},L=function(e){return e&&e.length>150},M=function(e){return{[a.MUSIC]:"mdi-music",[a.PLAYER]:"mdi-speaker",[a.METADATA]:"mdi-file-code",[a.PLUGIN]:"mdi-puzzle"}[e]||"mdi-help-circle"},I=function(e){return A(e).with(a.MUSIC,()=>r("settings.music")).with(a.PLAYER,()=>r("settings.player")).with(a.METADATA,()=>r("settings.metadata")).with(a.PLUGIN,()=>r("settings.plugin")).otherwise(()=>r("settings.player"))},U=function(e){return A(e).with("stable",()=>"green").with("beta",()=>"blue").with("alpha",()=>"purple").with("experimental",()=>"orange").with("unmaintained",()=>"grey").with("deprecated",()=>"red").otherwise(()=>"green")},C=function(e){return{[a.PLAYER]:1,[a.MUSIC]:2,[a.METADATA]:3,[a.PLUGIN]:4}[e]||999};return S(()=>o.providers,e=>{e&&V()},{immediate:!0}),(e,t)=>(f(),y(T,null,[P("div",X,[n(E,{"onUpdate:search":t[0]||(t[0]=s=>d.value=s),"onUpdate:types":t[1]||(t[1]=s=>c.value=s)})]),P("div",Z,l(x(r)("settings.providers_total",[u.value.length,u.value.length>1?"s":""])),1),n(k,{variant:"comfortable",class:"mt-4"},{default:i(()=>[n(Q,null,{default:i(()=>[(f(!0),y(T,null,$(u.value,s=>(f(),R(H,{key:s.domain,cols:"12",md:"6",lg:"4",class:"d-flex"},{default:i(()=>[n(D,{class:"flex-fill rounded-lg","min-height":"200px",onClick:m=>b(s)},{prepend:i(()=>[n(q,{domain:s.domain,size:50,class:"listitem-media-thumb",style:{"margin-top":"5px","margin-bottom":"5px"}},null,8,["domain"])]),append:i(()=>[n(K,{variant:"text",size:"small",icon:"",title:I(s.type)},{default:i(()=>[n(Y,{icon:M(s.type)},null,8,["icon"])]),_:2},1032,["title"]),n(j,{size:"x-small",variant:"flat",class:"mx-1 text-uppercase",color:U(s.stage)},{default:i(()=>[g(l(x(r)(String(s.stage||"").toLowerCase())),1)]),_:2},1032,["color"])]),default:i(()=>[n(O,{class:"text-truncate"},{default:i(()=>[g(l(s.name),1)]),_:2},1024),n(F,{class:G(["provider-description",{"truncated-text":L(s.description)}])},{default:i(()=>[g(l(s.description),1)]),_:2},1032,["class"])]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1})]),_:1})],64))}}),pe=W(ee,[["__scopeId","data-v-079e469f"]]);export{pe as default};
