1import{j as e,r as s}from"./chunk-XJI4KG32-DlXDHkdZ.js";import{c as b}from"./clsx-B-dksMZM.js";import{E}from"./EntityIcon-DgN6ScY5.js";import{H as k}from"./HintTooltip-D3UUlM3j.js";import{P as C,a as z,b as P}from"./popover-BAlydmIx.js";import{b as j,B as R}from"./button-DdFVlKxU.js";import{D as T,f as M}from"./index.esm-CTRGYIvZ.js";import{c as i}from"./utils-8aQHLVo-.js";import{b as H,c as L}from"./react-icons.esm-_ULKvi_1.js";import{D as B}from"./DateUtils-iJqYgHh8.js";import{I as O}from"./input-C58XllDn.js";import{u as $}from"./useTranslation-QMW_9Idl.js";import{c as A}from"./check-DNLVjQkV.js";/** 2 * @license lucide-react v0.482.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const F=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],U=A("Calendar",F);function Y({className:m,classNames:n,showOutsideDays:u=!0,...o}){return e.jsx(T,{showOutsideDays:u,className:i("p-3",m),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:i(j({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:i("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",o.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:i(j({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:({className:r,...d})=>e.jsx(L,{className:i("size-4",r),style:d.style}),IconRight:({className:r,...d})=>e.jsx(H,{className:i("size-4",r),style:d.style})},...o})}const G=({display:m="default",name:n,title:u,value:o,defaultValue:r,onChange:d,className:w,help:g,disabled:p=!1,readOnly:f=!1,required:x=!1,hint:_,icon:h,darkMode:N,autoFocus:y,classNameInput:I},D)=>{const{t:S}=$();s.useImperativeHandle(D,()=>({input:v}));const v=s.useRef(null),[t,l]=s.useState(void 0);return s.useEffect(()=>{r&&l(r)},[r]),s.useEffect(()=>{if(o){const a=new Date(o);a&&l(a)}},[o]),s.useEffect(()=>{if(r){const a=new Date(r);a&&l(a)}},[r]),s.useEffect(()=>{if(d&&t){let a=!1;try{o&&t&&(a=o.toISOString()!==t.toISOString())}catch{a=!0}if(a){const c=new Date(t);c&&d(c)}}},[t]),e.jsxs("div",{className:b(w,!N&&""),children:[e.jsxs("label",{htmlFor:n,className:"flex justify-between space-x-2 text-xs font-medium",children:[e.jsxs("div",{className:" flex items-center space-x-1",children:[e.jsxs("div",{className:"truncate",children:[u,x&&e.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),g&&e.jsx(k,{text:g})]}),_]}),e.jsxs("div",{className:"relative mt-1 flex w-full rounded-md",children:[h&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3",children:e.jsx(E,{className:"h-5 w-5",icon:h})}),m==="default"&&e.jsx(O,{ref:v,type:"date",id:n,name:n,required:x,value:t?.toISOString().split("T")[0],onChange:a=>{const c=new Date(a.target.value);c&&l(c)},disabled:p||f,readOnly:f,autoFocus:y,className:i((p||f)&&"bg-secondary/90 curs
6or-not-allowed",h&&"pl-10",I)}),m==="calendar"&&e.jsxs(s.Fragment,{children:[n&&e.jsx("input",{type:"hidden",name:n,value:t?.toISOString().split("T")[0],required:x,disabled:t===void 0,hidden:!0,readOnly:!0}),e.jsxs(C,{children:[e.jsx(z,{asChild:!0,children:e.jsxs(R,{variant:"outline",className:b("w-full justify-start text-left font-normal",!t&&"text-muted-foreground"),disabled:p||f,autoFocus:y,children:[e.jsx(U,{className:"mr-2 h-4 w-4"}),t?M(t,B.dateYMD(t)):S("components.date.pick")]})}),e.jsx(P,{className:"w-auto p-0",children:e.jsx(Y,{mode:"single",selected:t,onSelect:a=>l(a)})})]})]})]})]})},oe=s.forwardRef(G);export{oe as I};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.