import{d as C,bB as D,bC as M,r,ae as V,h as $,w as m,o as U,b as t,a as y,y as h,bD as A,b5 as g,t as c,x as I,M as w,v,bj as N,s as L}from"./index-CD7iYaFT.js";import{T as R}from"./Toolbar-B7AWyK9d.js";import{V as S}from"./VDialog-3VB6G7S5.js";import{V as f}from"./VTextField-CVfOZKc3.js";import{V as j}from"./VSpacer-B8t0Vh55.js";import{V as T}from"./VBtn-B0XatuYF.js";const x={style:{padding:"15px"}},q=C({__name:"AddManualLink",props:D({type:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const d=M(p,"modelValue"),B=p,u=r(""),s=r(""),n=r(""),i=r(!1),l=r();V(()=>d.value,e=>{e!=null&&(L.dialogActive=e),e==!1&&(u.value="",s.value="",n.value="",l.value=void 0)},{immediate:!0}),V(()=>l.value,e=>{if(e){s.value||(s.value=e.name);for(const a of e.metadata.images||[])if(a.type=="thumb"){n.value=a.path;break}}});const b=()=>{!u.value||!["http","rtsp"].some(e=>u.value.startsWith(e))||(i.value=!0,B.type==w.RADIO?v.getRadio(u.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}):v.getTrack(u.value,"builtin").then(e=>{l.value=e}).catch(e=>{console.error(e),l.value=void 0}).finally(()=>{i.value=!1}))},k=function(){b(),l.value&&(l.value.name=s.value||l.value.name,delete l.value.sort_name,n.value&&(l.value.metadata.images=[{type:N.THUMB,path:n.value,provider:"builtin",remotely_accessible:!0}]),v.addItemToLibrary(l.value,!0).then(()=>{d.value=!1}))};return(e,a)=>(U(),$(S,{modelValue:d.value,"onUpdate:modelValue":a[4]||(a[4]=o=>d.value=o),transition:"dialog-bottom-transition"},{default:m(()=>[t(I,null,{default:m(()=>[t(R,{icon:"mdi-playlist-plus",title:e.$t("add_url_item")},null,8,["title"]),t(h),a[5]||(a[5]=y("br",null,null,-1)),y("div",x,[t(f,{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=o=>u.value=o),variant:"outlined",label:e.$t("enter_url"),disabled:i.value,onBlur:b},null,8,["modelValue","label","disabled"]),t(f,{modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=o=>s.value=o),variant:"outlined",label:e.$t("enter_name"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(f,{modelValue:n.value,"onUpdate:modelValue":a[2]||(a[2]=o=>n.value=o),variant:"outlined",label:e.$t("image_url"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(A,null,{default:m(()=>[t(j),t(T,{variant:"outlined",onClick:a[3]||(a[3]=o=>d.value=!1)},{default:m(()=>[g(c(e.$t("cancel")),1)]),_:1}),t(T,{variant:"flat",color:"primary",disabled:i.value,onClick:k},{default:m(()=>[g(c(e.$t("save")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1})]),_:1},8,["modelValue"]))}});export{q as _};
