import{M as B,c as v,I as D,s as M}from"./index-CxiRlsCY.js";import{T as C}from"./Toolbar-MwYpbj3t.js";import{d as I,aS as U,aT as A,r,w as b,D as h,e as w,E as m,H as t,f as g,$ as y,a1 as c}from"./lucide-C2DU1LFb.js";import{a as N,e as S,m as f,Y as H,Z as L,n as T,p as R}from"./vuetify-RelkxOq-.js";const E={style:{padding:"15px"}},Y=I({__name:"AddManualLink",props:U({type:{}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const d=A(p,"modelValue"),$=p,u=r(""),n=r(""),s=r(""),i=r(!1),l=r();b(()=>d.value,e=>{e!=null&&(M.dialogActive=e),e==!1&&(u.value="",n.value="",s.value="",l.value=void 0)},{immediate:!0}),b(()=>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 V=()=>{!u.value||!["http","rtsp"].some(e=>u.value.startsWith(e))||(i.value=!0,$.type==B.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(){V(),l.value&&(l.value.name=n.value||l.value.name,delete l.value.sort_name,s.value&&(l.value.metadata.images=[{type:D.THUMB,path:s.value,provider:"builtin",remotely_accessible:!0}]),v.addItemToLibrary(l.value,!0).then(()=>{d.value=!1}))};return(e,a)=>(w(),h(R,{modelValue:d.value,"onUpdate:modelValue":a[4]||(a[4]=o=>d.value=o),transition:"dialog-bottom-transition"},{default:m(()=>[t(N,null,{default:m(()=>[t(C,{icon:"mdi-playlist-plus",title:e.$t("add_url_item")},null,8,["title"]),t(S),a[5]||(a[5]=g("br",null,null,-1)),g("div",E,[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:V},null,8,["modelValue","label","disabled"]),t(f,{modelValue:n.value,"onUpdate:modelValue":a[1]||(a[1]=o=>n.value=o),variant:"outlined",label:e.$t("enter_name"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(f,{modelValue:s.value,"onUpdate:modelValue":a[2]||(a[2]=o=>s.value=o),variant:"outlined",label:e.$t("image_url"),disabled:i.value},null,8,["modelValue","label","disabled"]),t(H,null,{default:m(()=>[t(L),t(T,{variant:"outlined",onClick:a[3]||(a[3]=o=>d.value=!1)},{default:m(()=>[y(c(e.$t("cancel")),1)]),_:1}),t(T,{variant:"flat",color:"primary",disabled:i.value,onClick:k},{default:m(()=>[y(c(e.$t("save")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1})]),_:1},8,["modelValue"]))}});export{Y as _};
