1import{av as U,j as u,aw as _,ae as z,P as h,ax as $,S as G,ay as X,k as Z,e as q,r as s,g as J,az as K,L as Q,l as oo,m as to,ab as ro,T as eo,ac as no}from"./index.3bHSf9gi.js";import{h as x}from"./moment.C3j7ZXd7.js";import{u as ao,D as so,a as io}from"./useIntlLocale.DrzrdT6m.js";import{u as lo}from"./useBasicWidgetState.CSKMY_WY.js";import{S as co}from"./styled-components.-ywQNIcz.js";import{E as po}from"./ErrorOutline.esm.LtBTGAgi.js";import"./timepicker.BRg2LlYz.js";import"./possibleConstructorReturn.D2vivPxX.js";import"./createSuper.CXzRWZIx.js";import"./input.-I2c-pPm.js";import"./base-input.DYzkAUR7.js";import"./FormClearHelper.DyYuMYyM.js";const go=({theme:o,isInSidebar:t,step:r,minTime:c,maxTime:f,disabled:p,clearable:g,error:e})=>({Popover:{props:{ignoreBoundary:t,placement:_.bottomLeft,overrides:{Body:{style:{marginTop:o.spacing.px}}}}},CalendarContainer:{style:{fontSize:o.fontSizes.sm,paddingRight:o.spacing.sm,paddingLeft:o.spacing.sm,paddingBottom:o.spacing.none,paddingTop:o.spacing.sm}},Week:{style:{fontSize:o.fontSizes.sm}},Day:{style:({$pseudoHighlighted:i,$pseudoSelected:a,$selected:C,$isHovered:y})=>({fontSize:o.fontSizes.sm,lineHeight:o.lineHeights.base,"::before":{backgroundColor:C||a||i||y?`${o.colors.darkenedBgMix15} !important`:o.colors.transparent},"::after":{borderColor:o.colors.transparent},...Z(o)&&y&&a&&!C?{color:o.colors.secondaryBg}:{}})},PrevButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:o.colors.transparent},":focus":{backgroundColor:o.colors.transparent,outline:0}})},NextButton:{style:()=>({display:"flex",alignItems:"center",justifyContent:"center",":active":{backgroundColor:o.colors.transparent},":focus":{backgroundColor:o.colors.transparent,outline:0}})},Input:{props:{maskChar:null,endEnhancer:e&&u(X,{content:u(G,{source:e,allowHTML:!1}),placement:h.TOP_RIGHT,error:!0,children:u($,{content:po,size:"lg"})}),overrides:{EndEnhancer:{style:{color:e?o.colors.redTextColor:o.colors.grayTextColor,backgroundColor:o.colors.transparent}},Root:{style:({$isFocused:i})=>{const a=z(o.colors,i);return{borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,paddingRight:o.spacing.twoXS,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a,...e&&{backgroundColor:o.colors.redBackgroundColor}}}},ClearIcon:{props:{overrides:{Svg:{style:{color:o.colors.grayTextColor,padding:o.spacing.threeXS,height:o.sizes.clearIconSize,width:o.sizes.clearIconSize,":hover":{fill:o.colors.bodyText}}}}}},InputContainer:{style:{backgroundColor:"transparent"}},Input:{style:{fontWeight:o.fontWeights.normal,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm,lineHeight:o.lineHeights.inputWidget,"::placeholder":{color:o.colors.fadedText60},...e&&{color:o.colors.redTextColor}},props:{"data-testid":"stDateTimeInputField"}}}}},TimeSelectContainer:{style:{paddingTop:o.spacing.none,paddingBottom:o.spacing.none}},TimeSelectFormControl:{style:{marginBottom:o.spacing.none},props:{overrides:{Label:{component:()=>null}}}},TimeSelect:{props:{step:r,format:"24",disabled:p,nullable:g,minTime:c,maxTime:f,overrides:{Select:{props:{disabled:p,overrides:{ControlContainer:{style:({$isFocused:i})=>{const a=z(o.colors,i);return{height:o.sizes.minElementHeight,borderLeftWidth:o.sizes.borderWidth,borderRightWidth:o.sizes.borderWidth,borderTopWidth:o.sizes.borderWidth,borderBottomWidth:o.sizes.borderWidth,borderTopColor:a,borderRightColor:a,borderBottomColor:a,borderLeftColor:a}}},IconsContainer:{style:()=>({paddingRight:o.spacing.sm})},ValueContainer:{style:()=>({lineHeight:o.lineHeights.inputWidget,paddingRight:o.spacing.sm,paddingLeft:o.spacing.md,paddingBottom:o.spacing.sm,paddingTop:o.spacing.sm})},SingleValue:{style:{fontWeight:o.fontWeights.normal},props:{"data-testid":"stDateTimeInputTimeDisplay"}},Dropdown:{style:()=>({paddingTop:o.spacing.none,paddingBottom:o.spacing.none,boxShadow:"none",maxHeight:o.sizes.maxDropdownHeight})},DropdownListItem:{component:co},Popover:{props:{ignoreBoundary:t,overrides:{Body:{style:()=>({marginTop:o.spacing.px})}}}},Placeholder:{style:()=>({color:o.colors.fadedText60})},SelectArrow:{component:U,props:{overrides:{Svg:{style:()=>({width:o.iconSizes.xl,height:o.iconSizes.xl})}}}}}}}}}}}),k="YYYY/MM/DD, HH:mm",uo=(o,t)=>{const r=o.getStringArrayValue(t);return r&&r.length>0?r[0]:null},fo=o=>o.default?.length?o.default[0]:null,mo=o=>o.value?.length?o.value[0]:null,M=o=>{let t;if(Array.isArray(o)?t=o.find(c=>c instanceof Date):t=o,!t||Number.isNaN(t.getTime()))return null;const r=new Date(t.getTime());return r.setSeconds(0,0),r},b=o=>{if(q(o)||o==="")return null;const t=x(o,k,!0);return t.isValid()?M(t.toDate()):null},I=(o,t)=>o.getFullYear()===t.getFullYear()&&o.getMonth()===t.getMonth()&&o.getDate()===t.getDate(),B=(o,t)=>{const r=new Date(o.getTime());return r.setHours(t.getHours(),t.getMinutes(),0,0),r},bo=(o,t,r,c)=>{const f=b(o.min),p=b(o.max),g=e=>{t.setStringArrayValue(o,e?[e]:[],{fromUi:r.fromUi},c)};if(r.value){const e=b(r.value);if(e){f&&e<f||p&&e>p||g(r.value);return}}g(r.value)};function To({disabled:o,element:t,widgetMgr:r,fragmentId:c}){const f=J(),p=s.useContext(K),g=s.useRef(null),[e,i]=lo({getStateFromWi
1dgetMgr:uo,getDefaultStateFromProto:fo,getCurrStateFromProto:mo,updateWidgetMgrState:bo,element:t,widgetMgr:r,fragmentId:c}),{locale:a}=s.useContext(Q),C=ao(a),y=t.step?Number(t.step):900,l=s.useMemo(()=>b(t.min),[t.min]),d=s.useMemo(()=>b(t.max),[t.max]),T=s.useMemo(()=>b(e),[e]),[n,v]=s.useState(T),[H,L]=s.useState(T);T!==H&&(v(T),L(T));const P=l??void 0,V=d??void 0,E=s.useMemo(()=>{if(!(!n||!l))return I(n,l)?B(n,l):void 0},[n,l]),R=s.useMemo(()=>{if(!(!n||!d))return I(n,d)?B(n,d):void 0},[n,d]),w=t.format.replaceAll(/[a-zA-Z]/g,"9"),D=`${t.format.replaceAll("Y","y").replaceAll("D","d")}, HH:mm`,A=`${w}, 99:99`,F=`${t.format}, HH:MM`,W=(t.default&&t.default.length>0?t.default[0]:"").length===0&&!o,O=s.useMemo(()=>{if(!n)return null;if(l&&n<l||d&&n>d){const m=x(l).format(D),S=x(d).format(D);return`**Error**: Date and time set outside allowed range. Please select a date and time between ${m} and ${S}.`}return null},[n,l,d,D]),N=s.useCallback(({date:m})=>{const S=M(m);v(S),g.current?.open?.()},[]),Y=s.useCallback(()=>{const m=n?x(n).format(k):null;m!==e&&i({value:m,fromUi:!0})},[n,e,i]),j=go({theme:f,isInSidebar:p,step:y,minTime:E,maxTime:R,disabled:o,clearable:W,error:O});return oo("div",{className:"stDateTimeInput","data-testid":"stDateTimeInput",children:[u(no,{label:t.label,disabled:o,labelVisibility:to(t.labelVisibility?.value),children:t.help&&u(ro,{children:u(eo,{content:t.help,placement:h.TOP_RIGHT})})}),u(io,{ref:g,locale:C,density:so.high,value:n,onChange:N,onClose:Y,minDate:P,maxDate:V,disabled:o,timeSelectStart:!0,formatString:D,mask:A,placeholder:F,clearable:W,overrides:j,"aria-label":t.label})]})}const Lo=s.memo(To);export{Lo as default};
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.