import{k as b,h as S,R as D,w as I,y as L,a as O,S as U,T as A,V as q,c as j,d as z,e as G,f as J,O as Q,P as W,g as X,i as B,j as Y,__tla as __tla_0}from"./index-bUuJUL5l.js";import{g as C,$ as Z,I as o,J as s,K as a,X as x,L as c,M as i,O as m,W as g,m as l,Y as F,a0 as K,a1 as N,F as E,a2 as ee,a3 as ae,a4 as oe,G as te,d as T,r as le,c as R,H as se,u as w,N as ne,P as re,Q as de}from"./vue-BSryv7ps.js";let ve,he;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})()]).then(async()=>{let ie,ue,me,ce;ie={class:"d-flex"};ue={key:2};me={key:3};ce=C({__name:"RightClickMenuEntry",props:{text:{},icon:{},action:{type:Function},hidden:{type:Boolean},disabled:{type:Boolean},disabledText:{},disabledIcon:{},children:{}},setup(f){const t=f,n=()=>{t.action&&t.action()};return(e,u)=>{const v=Z("RightClickMenuEntry",!0);return e.hidden?m("",!0):(o(),s(L,{key:0,class:"px-3",disabled:e.disabled,onClick:n},{default:a(()=>[x("div",ie,[e.disabled&&e.disabledIcon?(o(),s(b,{key:0,class:"mr-2"},{default:a(()=>[c(i(e.disabledIcon),1)]),_:1})):e.icon?(o(),s(b,{key:1,class:"mr-2"},{default:a(()=>[c(i(e.icon),1)]),_:1})):m("",!0),e.disabled&&e.disabledText?(o(),g("span",ue,i(e.disabledText),1)):(o(),g("span",me,i(e.text),1)),l(S),!e.disabled&&e.children?(o(),s(b,{key:4},{default:a(()=>[c("mdi-chevron-right")]),_:1})):m("",!0)]),e.children?(o(),s(D,{key:0,activator:"parent","open-on-hover":"","open-on-click":"","close-delay":"10","open-delay":"0",location:"right"},{default:a(()=>[l(I,null,{default:a(()=>[(o(!0),g(E,null,F(e.children,h=>(o(),s(v,K(N(h)),null,16))),256))]),_:1})]),_:1})):m("",!0)]),_:1},8,["disabled"]))}}});ve=C({__name:"RightClickMenu",props:ee({menuData:{}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(f){const t=ae(f,"modelValue");return(n,e)=>t.value?(o(),s(D,{key:0,modelValue:t.value,"onUpdate:modelValue":e[0]||(e[0]=u=>t.value=u),activator:"parent","close-on-content-click":!0,transition:"slide-y-transition","scroll-strategy":"none"},{default:a(()=>[l(I,null,{default:a(()=>[oe(n.$slots,"top"),(o(!0),g(E,null,F(n.menuData,u=>(o(),s(ce,K(N(u)),null,16))),256))]),_:3})]),_:3},8,["modelValue"])):m("",!0)}});he=C({__name:"MoveTorrentDialog",props:{guid:{},hashes:{},mode:{}},setup(f){const t=f,{isOpened:n}=O(t.guid),{t:e}=te(),u=U(),v=A(),h=T(),_=T(),V=T(!1),y=le({newPath:""}),H=[r=>!!r||e("dialogs.moveTorrent.required")],M=R(()=>t.hashes.map(v.getTorrentByHash)),k=R(()=>{switch(t.mode){case"dl":return M.value[0]?.download_path;case"save":return M.value[0]?.savePath}});async function P(){await h.value?.validate(),V.value&&(await u.toggleAutoTmm(t.hashes,!1),await v.moveTorrents(t.mode,t.hashes,y.newPath),_.value?.saveValueToHistory(),$())}const $=()=>{n.value=!1};return se(()=>{y.newPath=k.value||""}),(r,d)=>(o(),s(Y,{modelValue:w(n),"onUpdate:modelValue":d[3]||(d[3]=p=>de(n)?n.value=p:null)},{default:a(()=>[l(q,null,{default:a(()=>[l(j,null,{default:a(()=>[c(i(r.$t(`dialogs.moveTorrent.${r.mode}.title`)),1)]),_:1}),l(z,null,{default:a(()=>[l(w(G),{modelValue:V.value,"onUpdate:modelValue":d[1]||(d[1]=p=>V.value=p),ref_key:"form",ref:h,onSubmit:d[2]||(d[2]=ne(()=>{},["prevent"]))},{default:a(()=>[k.value?(o(),s(J,{key:0,"model-value":k.value,disabled:"",label:r.$t("dialogs.moveTorrent.oldPath")},null,8,["model-value","label"])):m("",!0),l(Q,{modelValue:y.newPath,"onUpdate:modelValue":d[0]||(d[0]=p=>y.newPath=p),historyKey:w(W).TORRENT_PATH,ref_key:"field",ref:_,rules:H,autofocus:"",label:r.$t("dialogs.moveTorrent.newPath"),onKeydown:re(P,["enter"])},null,8,["modelValue","historyKey","label"])]),_:1},8,["modelValue"])]),_:1}),l(X,null,{default:a(()=>[l(S),l(B,{color:"error",onClick:$},{default:a(()=>[c(i(r.$t("common.cancel")),1)]),_:1}),l(B,{color:"accent",disabled:!V.value,onClick:P},{default:a(()=>[c(i(r.$t("common.save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["modelValue"]))}})});export{ve as _,he as a,__tla};