import{_ as D,$ as Y,a0 as p,a1 as g,a2 as M}from"./index-Cc987VYg.js";function N(t,e){const n=()=>Y(e?.in,NaN),a=h(t);let s;if(a.date){const i=C(a.date,2);s=w(i.restDateString,i.year)}if(!s||isNaN(+s))return n();const u=+s;let o=0,c;if(a.time&&(o=x(a.time),isNaN(o)))return n();if(a.timezone){if(c=S(a.timezone),isNaN(c))return n()}else{const i=new Date(u+o),l=D(0,e?.in);return l.setFullYear(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()),l.setHours(i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()),l}return D(u+o+c,e?.in)}const f={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},U=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,I=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,F=/^([+-])(\d{2})(?::?(\d{2}))?$/;function h(t){const e={},n=t.split(f.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],f.timeZoneDelimiter.test(e.date)&&(e.date=t.split(f.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const a=f.timezone.exec(r);a?(e.time=r.replace(a[1],""),e.timezone=a[1]):e.time=r}return e}function C(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const a=r[1]?parseInt(r[1]):null,s=r[2]?parseInt(r[2]):null;return{year:s===null?a:s*100,restDateString:t.slice((r[1]||r[2]).length)}}function w(t,e){if(e===null)return new Date(NaN);const n=t.match(U);if(!n)return new Date(NaN);const r=!!n[4],a=m(n[1]),s=m(n[2])-1,u=m(n[3]),o=m(n[4]),c=m(n[5])-1;if(r)return R(e,o,c)?O(e,o,c):new Date(NaN);{const i=new Date(0);return!b(e,s,u)||!z(e,a)?new Date(NaN):(i.setUTCFullYear(e,s,Math.max(a,u)),i)}}function m(t){return t?parseInt(t):1}function x(t){const e=t.match(I);if(!e)return NaN;const n=d(e[1]),r=d(e[2]),a=d(e[3]);return Z(n,r,a)?n*p+r*g+a*1e3:NaN}function d(t){return t&&parseFloat(t.replace(",","."))||0}function S(t){if(t==="Z")return 0;const e=t.match(F);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return k(r,a)?n*(r*p+a*g):NaN}function O(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,s=(e-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+s),r}const $=[31,null,31,30,31,30,31,31,30,31,30,31];function T(t){return t%400===0||t%4===0&&t%100!==0}function b(t,e,n){return e>=0&&e<=11&&n>=1&&n<=($[e]||(T(t)?29:28))}function z(t,e){return e>=1&&e<=(T(t)?366:365)}function R(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function Z(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function k(t,e){return e>=0&&e<=59}const _=(t,e="INR",n="en-US")=>{try{return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(t)}catch{return`${new Intl.NumberFormat(n,{minimumFractionDigits:2,maximumFractionDigits:2}).format(t)} ${e}`}},v=(t,e=2)=>t.toLocaleString("en-US",{minimumFractionDigits:e,maximumFractionDigits:e}),y={"YYYY-MM-DD":"yyyy-MM-dd","MM/DD/YYYY":"MM/dd/yyyy","DD/MM/YYYY":"dd/MM/yyyy","DD-MM-YYYY":"dd-MM-yyyy"},H=()=>{const t=localStorage.getItem("user_date_format");return t&&y[t]?y[t]:"MMM dd, yyyy"},j=(t,e)=>{if(!t)return"-";const n=H();let r;return typeof t=="string"?r=t.includes("T")?N(t):new Date(t.replace(" ","T")):r=t,M(r,n)},L=(t,e)=>{if(!t)return"-";const n="MMM dd, yyyy HH:mm";let r;return typeof t=="string"?r=t.includes("T")?N(t):new Date(t.replace(" ","T")):r=t,M(r,n)};export{j as a,L as b,v as c,_ as f};
