import{r as g,j as e}from"./react-vendor-MPLM8hiW.js";import{a as v,$ as C,L as b,I as D,a0 as w,g as f}from"./index-saDuzM6I.js";import{L as E,C as A,a_ as N}from"./icons-vendor-H2PpUqT3.js";function I({open:a,onClose:i,onSubmit:h,isPending:l,errorMessage:c,initialName:m,title:j}){const{t:s}=v(),[n,t]=g.useState(""),d=!!m;g.useEffect(()=>{t(a?m??"":"")},[a,m]);const x=r=>{r.preventDefault();const u=n.trim();u&&h(u)},p=()=>{t(""),i()};return e.jsx(C,{open:a,onClose:p,title:j??s("media.createFolder"),className:"w-[min(90vw,24rem)]",children:e.jsxs("form",{onSubmit:x,children:[e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"folder-name",children:s("media.folderName")}),e.jsx(D,{id:"folder-name",value:n,onChange:r=>t(r.target.value),placeholder:s("media.folderNamePlaceholder"),autoFocus:!0})]}),c?e.jsx("p",{className:"text-sm text-error",children:c}):null]}),e.jsxs(w,{children:[e.jsx(f,{type:"button",variant:"outline",onClick:p,children:s("common.cancel")}),e.jsxs(f,{type:"submit",disabled:!n.trim()||l,children:[l?e.jsx(E,{className:"h-4 w-4 animate-spin"}):d?e.jsx(A,{className:"h-4 w-4"}):e.jsx(N,{className:"h-4 w-4"}),s(d?"common.save":"common.create")]})]})]})})}const o={audios:"audio/mpeg,audio/wav,.mp3,.wav",files:"application/pdf,.pdf",images:"image/jpeg,image/png,image/gif,image/webp,image/svg+xml,.jpg,.jpeg,.png,.gif,.webp,.svg",videos:"video/mp4,video/webm,.mp4,.webm"},_=[o.images,o.videos,o.audios,o.files].join(",");function U(a){return!a||a.length===0?_:a.map(i=>o[i]).join(",")}export{I as C,_ as D,U as g};
