"use strict";const t=require("./Toggle-oSdnI-zd.cjs"),i=require("./jsx-runtime-evvPGacs.cjs"),n=require("./css-x0qKpJph.cjs"),j=require("react"),g=require("./Center-UNXZHbuA.cjs");require("./aggregator-_DqLetA1.cjs");const R=require("react-hook-form"),C=({className:e,variant:r="error",...s})=>i.jsxRuntimeExports.jsx(t.Text,{className:n.CSS(n.CSS.B("input-help-text"),n.CSS.BM("input-help-text",r),e),level:"small",...s}),E=({className:e,...r})=>i.jsxRuntimeExports.jsx("label",{className:n.CSS(n.CSS.B("input-label"),e),...r}),D=e=>e.replace(/([A-Z])/g," $1").replace(/^./,r=>r.toUpperCase()),O=(e,r="x")=>e??(n.direction$1.construct(r)==="y"?"stretch":"center"),h=({label:e,showLabel:r=!0,helpText:s,direction:x="y",className:a,children:S,align:o,size:d="small",padHelpText:u=!1,...f})=>{let l;return x==="x"?l=i.jsxRuntimeExports.jsxs(g.Space,{direction:"y",size:"small",children:[S,(u||s!=null&&s.length>0)&&i.jsxRuntimeExports.jsx(C,{children:s})]}):l=i.jsxRuntimeExports.jsxs(g.Space,{direction:"y",size:1/3,children:[S,(u||s!=null&&s.length>0)&&i.jsxRuntimeExports.jsx(C,{children:s})]}),i.jsxRuntimeExports.jsxs(g.Space,{className:n.CSS(n.CSS.B("input-item"),a),direction:x,size:d,align:O(o,x),...f,children:[r&&i.jsxRuntimeExports.jsx(E,{children:e}),l]})},y=t.componentRenderProp(t.Text$1),b=({name:e,rules:r,shouldUnregister:s,defaultValue:x,label:a,children:S=y,alsoValidate:o,padHelpText:d=!0,ref:u,...f})=>{var T;const{field:l,fieldState:p}=R.useController({rules:r,name:e}),{trigger:c}=R.useFormContext();a==null&&(a=D(e));const m=j.useCallback(()=>{l.onBlur(),o!=null&&c(o)},[l.onBlur,c,o,e]);return i.jsxRuntimeExports.jsx(h,{label:a,padHelpText:d,helpText:(T=p.error)==null?void 0:T.message,...f,children:S({onChange:l.onChange,value:l.value,onBlur:m})})},q=({value:e,onChange:r,onBlur:s,...x})=>{const a=new n.TimeStamp(e,"UTC"),[S,o]=j.useState(a.fString("ISO","local").slice(0,-1)),[d,u]=j.useState(!0),f=p=>{let c=p.toString();o(c);let m=new n.TimeStamp(p,"UTC");c.length<23&&(c+=".000"),m=m.add((n.TimeStamp.now().date().getTimezoneOffset()-m.date().getTimezoneOffset())*n.TimeSpan.MINUTE.valueOf());let T=!1;try{T=m.fString("ISO","local").slice(0,-1)===c}catch{console.error("e")}if(!T){u(!1);return}r(m.valueOf()),u(!0)},l=p=>{u(!0),o(new n.TimeStamp(e,"UTC").fString("ISO","local").slice(0,-1)),s==null||s(p)};return i.jsxRuntimeExports.jsx(t.Text$1,{type:"datetime-local",onBlur:l,required:!1,value:d?new n.TimeStamp(e,"UTC").fString("ISO","local").slice(0,-1):S,onChange:f,...x})},B=Object.freeze(Object.defineProperty({__proto__:null,Date:t.Date,DateTime:q,DragButton:t.DragButton,HFItem:b,HelpText:C,Item:h,Label:E,Numeric:t.Numeric,Switch:t.Switch$1,Text:t.Text$1,TextArea:t.TextArea,Time:t.Time,combineDateAndTimeValue:t.combineDateAndTimeValue,useDate:t.useDate,useTime:t.useTime},Symbol.toStringTag,{value:"Module"}));exports.Item=h;exports.external=B;
//# sourceMappingURL=external-yiFP74pM.cjs.map
