import{r as b}from"./index-76fb7be0.js";import{P as n}from"./index-8d47fad6.js";import{g as L}from"./_baseAssignValue-4b27bc5d.js";import{f as x,s as w}from"./sanitizeFieldRestProps-fb2f7069.js";import{g as P}from"./genericMemo-8de5a1aa.js";import{T as g,c as j}from"./dataProvider-3f13e24d.js";import{u as E}from"./useRecordContext-3e1d0ecf.js";var s=globalThis&&globalThis.__assign||function(){return s=Object.assign||function(e){for(var a,o=1,t=arguments.length;o<t;o++){a=arguments[o];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},s.apply(this,arguments)},N=globalThis&&globalThis.__rest||function(e,a){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(e);r<t.length;r++)a.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(o[t[r]]=e[t[r]]);return o},u=function(e){var a=e.className,o=e.emptyText,t=e.locales,r=e.options,y=e.showTime,m=y===void 0?!1:y,d=e.showDate,f=d===void 0?!0:d,D=e.source,h=e.transform,O=h===void 0?F:h,T=N(e,["className","emptyText","locales","options","showTime","showDate","source","transform"]),S=j();if(!m&&!f)throw new Error("<DateField> cannot have showTime and showDate false at the same time");var v=E(e);if(!v)return null;var l=L(v,D);if(l==null||l==="")return o?b.createElement(g,s({component:"span",variant:"body2",className:a},w(T)),o&&S(o,{_:o})):null;var i=O(l),c="";if(m&&f)c=p?i.toLocaleString(t,r):i.toLocaleString();else if(f){var _=r??(typeof l=="string"&&l.length<=10?{timeZone:"UTC"}:void 0);c=p?i.toLocaleDateString(t,_):i.toLocaleDateString()}else m&&(c=p?i.toLocaleTimeString(t,r):i.toLocaleTimeString());return b.createElement(g,s({component:"span",variant:"body2",className:a},w(T)),c)};u.propTypes=s(s(s({},g.propTypes),x),{locales:n.oneOfType([n.string,n.arrayOf(n.string)]),options:n.object,showTime:n.bool,showDate:n.bool});u.displayName="DateFieldImpl";var k=P(u),F=function(e){return e instanceof Date?e:typeof e=="string"||typeof e=="number"?new Date(e):void 0},p=function(){try{new Date().toLocaleString("i")}catch(e){return e instanceof RangeError}return!1}();export{k as D};
