import{_ as N}from"./Manager.vue_vue_type_script_setup_true_lang-wylN1Ol-.js";import{V as S}from"./VDialog-Dr29crN8.js";import{c as E}from"./VCard-DptrO3GI.js";import{d as B,F as P,f as D,h as m,i as a,c as l,H as R,r as y,C as p,x as d,G as C,y as _,v as s,V as f,S as v,O as g,L as U,R as $}from"./index-C5GbdPxY.js";import{V as h}from"./VTooltip-DPhSY2Qe.js";import{_ as G}from"./_plugin-vue_export-helper-DlAUqK2U.js";const H=B({__name:"MediaDialog",props:{modelValue:{type:Boolean},mime:{},multiple:{type:Boolean}},emits:["update:modelValue","callback"],setup(V,{emit:b}){const k=V,r=b,i=P({get:()=>k.modelValue,set:o=>r("update:modelValue",o)}),t=o=>{r("callback",o)};return(o,c)=>(m(),D(S,{modelValue:i.value,"onUpdate:modelValue":c[0]||(c[0]=u=>i.value=u),"max-width":"90%"},{default:a(()=>[l(E,null,{default:a(()=>[l(N,{"is-picker":!0,mime:o.mime,multiple:o.multiple,onCallback:t},null,8,["mime","multiple"])]),_:1})]),_:1},8,["modelValue"]))}}),L={class:"mb-3"},O={key:0,class:"mb-2 text-subtitle-1 font-weight-medium"},T={class:"single-picker"},j=["src"],q={key:0,class:"overlay gap-1"},A=B({__name:"SinglePicker",props:{modelValue:{},media:{},label:{},mime:{}},emits:["update:modelValue"],setup(V,{emit:b}){const k=V,r=b,{t:i}=R(),t=y(k.media),o=y(!1),c=()=>{o.value=!0},u=e=>{r("update:modelValue",e==null?null:e.id),t.value=e},x=()=>{u(null)},z=()=>{if(t.value){const e=document.createElement("a");e.href=t.value.download_url,e.download=t.value.download_name||"",document.body.append(e),e.click(),e.remove()}},I=e=>{o.value=!1,u(e)};return(e,w)=>{const M=H;return m(),p($,null,[d("div",L,[e.label?(m(),p("div",O,_(e.label),1)):C("",!0),d("div",T,[d("div",{class:"picker-holder",role:"button",onClick:c},[s(t)==null?(m(),D(f,{key:0,icon:"tabler-photo-plus"})):(m(),p("img",{key:1,alt:"",src:s(t).preview_image_url},null,8,j))]),s(t)!=null?(m(),p("div",q,[l(h,{location:"top"},{activator:a(({props:n})=>[l(v,g({color:"error",icon:"",rounded:"",size:"30"},n,{onClick:x}),{default:a(()=>[l(f,{icon:"tabler-trash"})]),_:2},1040)]),default:a(()=>[d("span",null,_(s(i)("admin::admin.buttons.delete")),1)]),_:1}),l(h,{location:"top"},{activator:a(({props:n})=>[l(v,g({color:"info",icon:"",rounded:"",size:"30"},n,{onClick:z}),{default:a(()=>[l(f,{icon:"tabler-cloud-download"})]),_:2},1040)]),default:a(()=>[d("span",null,_(s(i)("admin::admin.buttons.download")),1)]),_:1}),l(h,{location:"top"},{activator:a(({props:n})=>[l(v,g({color:"primary",icon:"",rounded:"",size:"30"},n,{onClick:c}),{default:a(()=>[l(f,{icon:"tabler-folder-open"})]),_:2},1040)]),default:a(()=>[d("span",null,_(s(i)("admin::admin.buttons.browse")),1)]),_:1})])):C("",!0)])]),l(M,{modelValue:s(o),"onUpdate:modelValue":w[0]||(w[0]=n=>U(o)?o.value=n:null),mime:e.mime,onCallback:I},null,8,["modelValue","mime"])],64)}}}),Y=G(A,[["__scopeId","data-v-3952fece"]]);export{Y as _};
