import{r as $,j as d}from"./app-DC5MhnUn.js";import{c as _}from"./compiler-runtime-x4HYykYJ.js";const I=$.forwardRef((s,a)=>{const e=_.c(39);let r,o,n,l,t,i,x,c;e[0]!==s?({label:n,error:r,helperText:o,value:c,onChange:l,className:x,required:i,...t}=s,e[0]=s,e[1]=r,e[2]=o,e[3]=n,e[4]=l,e[5]=t,e[6]=i,e[7]=x,e[8]=c):(r=e[1],o=e[2],n=e[3],l=e[4],t=e[5],i=e[6],x=e[7],c=e[8]);const M=x===void 0?"":x,D=R,T=V,[j,C]=$.useState(D(c));let h,b;e[9]!==c?(h=()=>{C(D(c))},b=[c],e[9]=c,e[10]=h,e[11]=b):(h=e[10],b=e[11]),$.useEffect(h,b);let k;e[12]!==l||e[13]!==t.name?(k=L=>{const S=L.target.value;if(C(S),l){const v=T(S);l(v)}if(t.name){const v=L.target.closest("form");if(v){const E=v.querySelector(`input[type="hidden"][name="${t.name}"]`);E&&(E.value=T(S).toString())}}},e[12]=l,e[13]=t.name,e[14]=k):k=e[14];const w=k,N=`
            block w-full rounded-lg border px-4 py-3 text-sm
            transition-all duration-200
            placeholder:text-gray-400
            focus:outline-none focus:ring-2 focus:ring-offset-0
            dark:placeholder:text-gray-500
            ${r?"border-red-300 bg-red-50 text-red-900 focus:border-red-500 focus:ring-red-500 dark:border-red-700 dark:bg-red-900/20 dark:text-red-200":"border-gray-300 bg-white text-gray-900 shadow-sm focus:border-[#d4af37] focus:ring-[#d4af37]/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:focus:border-[#b8941f] dark:focus:ring-[#b8941f]/20"}
            ${M}
        `;let m;e[15]!==n||e[16]!==t.id||e[17]!==i?(m=n&&d.jsxs("label",{htmlFor:t.id,className:"mb-2 block text-sm font-semibold text-gray-700 dark:text-gray-300",children:[n,i&&d.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),e[15]=n,e[16]=t.id,e[17]=i,e[18]=m):m=e[18];let u;e[19]!==t.name?(u=t.name?{name:void 0}:{},e[19]=t.name,e[20]=u):u=e[20];let f;e[21]!==w||e[22]!==N||e[23]!==j||e[24]!==t||e[25]!==a||e[26]!==i||e[27]!==u?(f=d.jsx("div",{className:"relative",children:d.jsx("input",{ref:a,type:"datetime-local",value:j,onChange:w,className:N,required:i,...u,...t})}),e[21]=w,e[22]=N,e[23]=j,e[24]=t,e[25]=a,e[26]=i,e[27]=u,e[28]=f):f=e[28];let g;e[29]!==r?(g=r&&d.jsxs("p",{className:"mt-2 flex items-center gap-1 text-sm font-medium text-red-600 dark:text-red-400",children:[d.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor",children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),r]}),e[29]=r,e[30]=g):g=e[30];let p;e[31]!==r||e[32]!==o?(p=o&&!r&&d.jsx("p",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400",children:o}),e[31]=r,e[32]=o,e[33]=p):p=e[33];let y;return e[34]!==m||e[35]!==f||e[36]!==g||e[37]!==p?(y=d.jsxs("div",{className:"w-full",children:[m,f,g,p]}),e[34]=m,e[35]=f,e[36]=g,e[37]=p,e[38]=y):y=e[38],y});I.displayName="DateTimeInput";function R(s){if(!s)return"";const a=new Date(s*1e3),e=a.getFullYear(),r=String(a.getMonth()+1).padStart(2,"0"),o=String(a.getDate()).padStart(2,"0"),n=String(a.getHours()).padStart(2,"0"),l=String(a.getMinutes()).padStart(2,"0");return`${e}-${r}-${o}T${n}:${l}`}function V(s){if(!s)return 0;const a=new Date(s);return Math.floor(a.getTime()/1e3)}export{I as D};
