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