"use strict";const n=require("react/jsx-runtime"),h=require("../lite.cjs"),c=require("react"),E=require("../tools/icons.cjs"),m=require("../tools/tools.cjs"),_=[new Date,new Date],r=x=>x.toString().padStart(2,"0"),b=function(k){const{as:M="div",className:y,dropOldClass:f,onDateClick:l,selectedDate:d,style:j,variables:C,...H}=k,a=d&&d.length>0?d:_,[i,D]=c.useState(a.map(e=>r(e.getHours()))),[u,S]=c.useState(a.map(e=>r(e.getMinutes()))),[p,N]=c.useState(a.map(e=>r(e.getSeconds()))),T=c.useMemo(()=>{const e=m.classx(!f&&"card card-body border-0 p-0",y),s=m.stylex((t,o)=>({tKey:m.convertBsKeyToVar(o)}),C,j);return{className:e,style:s}},[y,f,j,C]),v=c.useCallback(()=>{const e=(t,o)=>{const R=parseInt(i[o],10)||0,q=parseInt(u[o],10)||0,P=parseInt(p[o],10)||0;return h.setSeconds(h.setMinutes(h.setHours(t,R),q),P)},s=a.map((t,o)=>e(t,o));l==null||l({date:m.sortDates(s[0],s[1])})},[a,i,u,l,p]),w=(e,s)=>{const t=[...i];t[s]=e.target.value.trim(),D(t)},I=(e,s)=>{const t=[...u];t[s]=e.target.value.trim(),S(t)},K=(e,s)=>{const t=[...p];t[s]=e.target.value.trim(),N(t)},g=e=>{e.key==="Enter"&&v()};return c.useEffect(()=>{D(a.map(e=>r(e.getHours()))),S(a.map(e=>r(e.getMinutes()))),N(a.map(e=>r(e.getSeconds())))},[a]),n.jsxs(M,{...H,...T,children:[n.jsx("div",{className:"d-flex flex-column gap-2",children:["Start","End"].map((e,s)=>n.jsxs("div",{className:"input-group",children:[n.jsxs("span",{className:"input-group-text text-primary-emphasis",children:[e,"Time"]}),n.jsx("input",{className:"form-control",onChange:t=>w(t,s),onKeyDown:g,placeholder:"HH",type:"text",value:i[s]}),n.jsx("span",{className:"input-group-text text-secondary",children:":"}),n.jsx("input",{className:"form-control",onChange:t=>I(t,s),onKeyDown:g,placeholder:"MM",type:"text",value:u[s]}),n.jsx("span",{className:"input-group-text text-secondary",children:":"}),n.jsx("input",{className:"form-control",onChange:t=>K(t,s),onKeyDown:g,placeholder:"SS",type:"text",value:p[s]})]},s))}),n.jsxs("button",{className:"btn btn-outline-primary btn-sm mt-4 mb-1 d-flex justify-content-center align-items-center gap-1",onClick:v,type:"button",children:[n.jsx("span",{className:"d-inline-flex",children:n.jsx(E.BiClock,{})}),n.jsx("span",{children:"Confirm"})]})]})};b.displayName="BRL.DateRangePickerTime";exports.DateRangePickerTime=b;
//# sourceMappingURL=date-range-picker-time.cjs.map
