import{r,b as y,j as a}from"./vendor-react-wBh_31cN.js";import{G as B}from"./index-dNe6i2rS.js";import{u as N,F as R}from"./fileUploader-Bkmyjd3t.js";import{U as g}from"./vendor-icons-BUUmD6ht.js";const p=y.forwardRef(({disabled:i,fromFile:c,isDisabledUploadButton:d,isMultiple:u,setIsOpenExplorerFromPopup:m,specifiedUploadPath:n,validExtensions:s,onCancel:t,...f},U)=>{const[j,o]=r.useState([]);r.useRef(null);const[F,{firstRef:l,handleClick:h}]=N({setIsOpenExplorerFromPopup:m,specifiedUploadPath:n}),x=r.useCallback(()=>{const e=Object.values(l.current.files);o(e)},[l]),b=s==null?void 0:s.map(e=>e.startsWith(".")?e:`.${e}`).join(",");return a.jsxs("div",{ref:U,children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("input",{ref:e=>{e&&(l.current=e)},type:"file",multiple:u,accept:b,className:"hidden",onChange:x}),a.jsxs(B,{type:"button",variant:"secondary",disabled:i||d,onClick:h,className:"max-w-[145px]",children:[a.jsx(g,{className:"mr-1.5 size-3.5"}),`Upload ${c?"new":"job"} file`]})]}),a.jsx(R,{validExtensions:s,...F,...f,arrayToUpload:j,onCancel:()=>{t==null||t(),o([])}})]})});p.displayName="FileUploaderButton";const z=r.memo(p);export{z as F};
