import{ay as M,bT as U,bU as $,J as r,L as V,aI as C,aA as D,aG as v,o as t,aS as A,E as y,aU as I,bH as m,bV as h,bW as N,M as g,bh as c,aN as T,aQ as L,aP as f,bu as S,ax as w}from"./index-BRUnowC8.js";import{T as H}from"./Toolbar-BEJzY0mB.js";import{V as P}from"./VDialog-Bh3mGVOy.js";const R={style:{padding:"15px"}},F=M({__name:"AddManualLink",props:U({type:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const d=$(p,"modelValue"),k=p,o=r(""),n=r(""),s=r(""),i=r(!1),l=r();V(()=>d.value,e=>{e!=null&&(w.dialogActive=e),e==!1&&(o.value="",n.value="",s.value="",l.value=void 0)},{immediate:!0}),V(()=>l.value,e=>{if(e){n.value||(n.value=e.name);for(const a of e.metadata.images||[])if(a.type=="thumb"){s.value=a.path;break}}});const b=()=>{!o.value||!["http","rtsp"].some(e=>o.value.startsWith(e))||(i.value=!0,k.type==L.RADIO?f.getRadio(o.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}):f.getTrack(o.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}))},B=function(){b(),l.value&&(l.value.name=n.value||l.value.name,delete l.value.sort_name,s.value&&(l.value.metadata.images=[{type:S.THUMB,path:s.value,provider:"builtin",remotely_accessible:!0}]),f.addItemToLibrary(l.value,!0).then(()=>{d.value=!1}))};return(e,a)=>(D(),C(P,{modelValue:d.value,"onUpdate:modelValue":a[4]||(a[4]=u=>d.value=u),transition:"dialog-bottom-transition"},{default:v(()=>[t(A,null,{default:v(()=>[t(H,{icon:"mdi-playlist-plus",title:e.$t("add_url_item")},null,8,["title"]),t(I),a[5]||(a[5]=y("br",null,null,-1)),y("div",R,[t(m,{modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=u=>o.value=u),variant:"outlined",label:e.$t("enter_url"),disabled:i.value,onBlur:b},null,8,["modelValue","label","disabled"]),t(m,{modelValue:n.value,"onUpdate:modelValue":a[1]||(a[1]=u=>n.value=u),variant:"outlined",label:e.$t("enter_name"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(m,{modelValue:s.value,"onUpdate:modelValue":a[2]||(a[2]=u=>s.value=u),variant:"outlined",label:e.$t("image_url"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(h,null,{default:v(()=>[t(N),t(g,{variant:"outlined",onClick:a[3]||(a[3]=u=>d.value=!1)},{default:v(()=>[c(T(e.$t("cancel")),1)]),_:1}),t(g,{variant:"flat",color:"primary",disabled:i.value,onClick:B},{default:v(()=>[c(T(e.$t("save")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1})]),_:1},8,["modelValue"]))}});export{F as _};
