react-semaphor 0.1.326 → 0.1.328

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +1 -1
  3. package/dist/brand-studio/index.cjs +5 -5
  4. package/dist/brand-studio/index.js +23 -24
  5. package/dist/chunks/_commonjsHelpers-BVfed4GL.js +28 -0
  6. package/dist/chunks/_commonjsHelpers-DwTZ_eVU.js +1 -0
  7. package/dist/chunks/{braces-DVaMJoCd.js → braces-CG8viaD2.js} +1 -1
  8. package/dist/chunks/{braces-dHeaioTd.js → braces-DSaa_4Oc.js} +1 -1
  9. package/dist/chunks/{calendar-preferences-dialog-mqU_uOmY.js → calendar-preferences-dialog-DD_qAthL.js} +1 -1
  10. package/dist/chunks/{calendar-preferences-dialog--2jD-eKu.js → calendar-preferences-dialog-JRmNJptJ.js} +3 -3
  11. package/dist/chunks/{chevrons-up-down-DNQE-uEp.js → chevrons-up-down-CBa0uh0X.js} +1 -1
  12. package/dist/chunks/{chevrons-up-down-CLbzBHoI.js → chevrons-up-down-ChDNqVP7.js} +1 -1
  13. package/dist/chunks/dashboard-briefing-launcher-BKdJFwH5.js +106 -0
  14. package/dist/chunks/{dashboard-briefing-launcher-DsjXUPFq.js → dashboard-briefing-launcher-BfyNkd8i.js} +1106 -1108
  15. package/dist/chunks/{dashboard-controls-DgNkM1yT.js → dashboard-controls-0pZDLvFL.js} +218 -218
  16. package/dist/chunks/{dashboard-controls-XCa9PZuU.js → dashboard-controls-C0xm1QMR.js} +10 -10
  17. package/dist/chunks/dashboard-json-BW5OVZ6m.js +1 -0
  18. package/dist/chunks/{dashboard-json-DkA6Bf0Y.js → dashboard-json-DsruhRPD.js} +14 -13
  19. package/dist/chunks/date-formatter-B4EBSe9C.js +1 -0
  20. package/dist/chunks/date-formatter-CzcPZx39.js +416 -0
  21. package/dist/chunks/edit-dashboard-visual-DQyJ7SSv.js +178 -0
  22. package/dist/chunks/{edit-dashboard-visual-Q5hW5MXk.js → edit-dashboard-visual-g5SZZahJ.js} +8242 -7784
  23. package/dist/chunks/index-1JWDPCun.js +1935 -0
  24. package/dist/chunks/index-BdjXTQt4.js +1444 -0
  25. package/dist/chunks/{index-DwfDwtv2.js → index-BmKr-K7J.js} +117670 -113627
  26. package/dist/chunks/index-C1l78BIx.js +3247 -0
  27. package/dist/chunks/lib-Ce3zosXY.js +38 -0
  28. package/dist/chunks/lib-DFvr9fM4.js +5500 -0
  29. package/dist/chunks/{palette-DtmNws9a.js → palette-D0YmAqBS.js} +1 -1
  30. package/dist/chunks/{palette-DpcvHAiY.js → palette-DQgq3edH.js} +1 -1
  31. package/dist/chunks/{resource-management-panel-CGwWKZOP.js → resource-management-panel-CIfBh46E.js} +1 -1
  32. package/dist/chunks/{resource-management-panel-D2oAQkKi.js → resource-management-panel-Cj19pw9M.js} +145 -145
  33. package/dist/chunks/switch-BvTzw2AW.js +173 -0
  34. package/dist/chunks/{switch-j3AThLFk.js → switch-De31SR3q.js} +2752 -2717
  35. package/dist/chunks/typescript-Cmizj1hi.js +446 -0
  36. package/dist/chunks/typescript-H1EwZsOb.js +159820 -0
  37. package/dist/chunks/use-create-flow-overlay-state-BTQiKRD1.js +26 -0
  38. package/dist/chunks/{use-create-flow-overlay-state-CP6GDQAX.js → use-create-flow-overlay-state-IcHP0l39.js} +150 -151
  39. package/dist/chunks/{use-visual-utils-CSXU-96k.js → use-visual-utils-DQ5zGYD2.js} +13 -13
  40. package/dist/chunks/{use-visual-utils-NpOW5uZ1.js → use-visual-utils-XF-AqV8o.js} +1 -1
  41. package/dist/chunks/{validators-DvTxl9i0.js → validators-DDAweCzB.js} +67 -48
  42. package/dist/chunks/validators-odlRJblR.js +2 -0
  43. package/dist/dashboard/index.cjs +1 -1
  44. package/dist/dashboard/index.js +1 -1
  45. package/dist/dashboard-authoring/index.cjs +3 -3
  46. package/dist/dashboard-authoring/index.js +907 -527
  47. package/dist/data-app-builder/index.cjs +1 -0
  48. package/dist/data-app-builder/index.js +4 -0
  49. package/dist/data-app-builder-browser-runtime/index.cjs +1 -0
  50. package/dist/data-app-builder-browser-runtime/index.js +10 -0
  51. package/dist/data-app-sdk/index.cjs +1 -1
  52. package/dist/data-app-sdk/index.js +208 -196
  53. package/dist/format-utils/index.cjs +4 -4
  54. package/dist/format-utils/index.js +22 -21
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.js +14 -14
  57. package/dist/style.css +1 -1
  58. package/dist/surfboard/index.cjs +1 -1
  59. package/dist/surfboard/index.js +2 -2
  60. package/dist/types/analytics-protocol.d.ts +1 -0
  61. package/dist/types/dashboard-authoring.d.ts +79 -2
  62. package/dist/types/dashboard.d.ts +17 -2
  63. package/dist/types/data-app-builder-browser-runtime.d.ts +185 -0
  64. package/dist/types/data-app-builder.d.ts +630 -0
  65. package/dist/types/data-app-sdk.d.ts +15 -1
  66. package/dist/types/format-utils.d.ts +25 -0
  67. package/dist/types/main.d.ts +67 -10
  68. package/dist/types/shared.d.ts +17 -2
  69. package/dist/types/surfboard.d.ts +17 -2
  70. package/dist/types/types.d.ts +32 -3
  71. package/package.json +11 -1
  72. package/dist/chunks/dashboard-briefing-launcher-DguNfFr8.js +0 -106
  73. package/dist/chunks/dashboard-json-DiBd65Xf.js +0 -1
  74. package/dist/chunks/date-formatter-D9Bvw5Qk.js +0 -1
  75. package/dist/chunks/date-formatter-DyIOb6uC.js +0 -333
  76. package/dist/chunks/edit-dashboard-visual-BC9eOc4U.js +0 -178
  77. package/dist/chunks/index-B1-46PoR.js +0 -1303
  78. package/dist/chunks/save-BY7WF62U.js +0 -21
  79. package/dist/chunks/save-Cv_XRb94.js +0 -6
  80. package/dist/chunks/switch-5aQ_jcLH.js +0 -168
  81. package/dist/chunks/use-create-flow-overlay-state-BQPXP0AM.js +0 -26
  82. package/dist/chunks/validators-DJUMR5An.js +0 -2
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),o=require("react");require("./index-BxM99sFL.js");const s=require("./switch-5aQ_jcLH.js");require("./index-B1-46PoR.js");require("./index-DRlMUglg.js");require("react-dom");function b(){const t=s.useDashboardStore(e=>e.dashboard),c=s.useDashboardStore(e=>e.actions.setDashboard),u=s.useDashboardStore(e=>e.showDashboardJSON),h=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),a=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,d]=o.useState(a),n=o.useRef(a);return o.useEffect(()=>{a!==n.current&&(d(a),n.current=a)},[a]),r.jsxs("div",{className:s.cn("relative p-2",{hidden:!u}),children:[r.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[r.jsx(s.X,{className:"mr-2 h-4 w-4"}),"Close"]}),r.jsx("div",{className:"h-[550px] overflow-hidden",children:r.jsx(s.CodeEditor,{value:l,onValueChange:e=>{d(e);try{const i=JSON.parse(e);n.current=JSON.stringify(i,null,2),c(i)}catch{}},language:"json"})})]})}exports.default=b;
@@ -1 +0,0 @@
1
- "use strict";const u=require("./index-D7KJindZ.js");function x(r,e){const t=u.toDate(r),a=u.toDate(e),c=t.getTime()-a.getTime();return c<0?-1:c>0?1:c}function Z(r){return u.constructFrom(r,Date.now())}function O(r,e){const t=u.toDate(r),a=u.toDate(e),c=t.getFullYear()-a.getFullYear(),f=t.getMonth()-a.getMonth();return c*12+f}function _(r){return e=>{const a=(r?Math[r]:Math.trunc)(e);return a===0?0:a}}function v(r,e){return+u.toDate(r)-+u.toDate(e)}function C(r){const e=u.toDate(r);return e.setHours(23,59,59,999),e}function X(r){const e=u.toDate(r),t=e.getMonth();return e.setFullYear(e.getFullYear(),t+1,0),e.setHours(23,59,59,999),e}function R(r){const e=u.toDate(r);return+C(e)==+X(e)}function U(r,e){const t=u.toDate(r),a=u.toDate(e),c=x(t,a),f=Math.abs(O(t,a));let n;if(f<1)n=0;else{t.getMonth()===1&&t.getDate()>27&&t.setDate(30),t.setMonth(t.getMonth()-c*f);let i=x(t,a)===-c;R(u.toDate(r))&&f===1&&x(r,a)===1&&(i=!1),n=c*(f-Number(i))}return n===0?0:n}function A(r,e,t){const a=v(r,e)/1e3;return _(t==null?void 0:t.roundingMethod)(a)}function W(r,e,t){const a=u.getDefaultOptions(),c=(t==null?void 0:t.locale)??a.locale??u.enUS,f=2520,n=x(r,e);if(isNaN(n))throw new RangeError("Invalid time value");const i=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:n});let s,D;n>0?(s=u.toDate(e),D=u.toDate(r)):(s=u.toDate(r),D=u.toDate(e));const m=A(D,s),T=(u.getTimezoneOffsetInMilliseconds(D)-u.getTimezoneOffsetInMilliseconds(s))/1e3,l=Math.round((m-T)/60);let d;if(l<2)return t!=null&&t.includeSeconds?m<5?c.formatDistance("lessThanXSeconds",5,i):m<10?c.formatDistance("lessThanXSeconds",10,i):m<20?c.formatDistance("lessThanXSeconds",20,i):m<40?c.formatDistance("halfAMinute",0,i):m<60?c.formatDistance("lessThanXMinutes",1,i):c.formatDistance("xMinutes",1,i):l===0?c.formatDistance("lessThanXMinutes",1,i):c.formatDistance("xMinutes",l,i);if(l<45)return c.formatDistance("xMinutes",l,i);if(l<90)return c.formatDistance("aboutXHours",1,i);if(l<u.minutesInDay){const g=Math.round(l/60);return c.formatDistance("aboutXHours",g,i)}else{if(l<f)return c.formatDistance("xDays",1,i);if(l<u.minutesInMonth){const g=Math.round(l/u.minutesInDay);return c.formatDistance("xDays",g,i)}else if(l<u.minutesInMonth*2)return d=Math.round(l/u.minutesInMonth),c.formatDistance("aboutXMonths",d,i)}if(d=U(D,s),d<12){const g=Math.round(l/u.minutesInMonth);return c.formatDistance("xMonths",g,i)}else{const g=d%12,M=Math.trunc(d/12);return g<3?c.formatDistance("aboutXYears",M,i):g<9?c.formatDistance("overXYears",M,i):c.formatDistance("almostXYears",M+1,i)}}function L(r,e){return W(r,Z(r),e)}function $(r){if(!r)return!1;const e=r.toLowerCase().replace("_","-");return e==="en-in"||e.startsWith("en-in-")}function G(r,e){const t=Math.abs(r);return t>=1e12?{divisor:1e12,suffix:"T"}:t>=1e9?{divisor:1e9,suffix:"B"}:$(e)&&t>=1e7?{divisor:1e7,suffix:"Cr"}:t>=1e6?{divisor:1e6,suffix:"M"}:$(e)&&t>=1e5?{divisor:1e5,suffix:"L"}:t>=1e3?{divisor:1e3,suffix:"K"}:{divisor:1,suffix:""}}function y(r,e){try{const t=h(e);return G(r,t)}catch{return G(r,"en-US")}}function V(r){try{return new Intl.NumberFormat(r),!0}catch{return!1}}function h(r){return r&&V(r)?r:"en-US"}function N(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale);let a=r;if(e!=null&&e.multiplyBy&&(a*=e.multiplyBy),e!=null&&e.useSuffix){const{divisor:f,suffix:n}=y(a,t);a=a/f;const i=new Intl.NumberFormat(t,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(a);return`${(e==null?void 0:e.prefix)??""}${i}${n}${(e==null?void 0:e.suffix)??""}`}const c=new Intl.NumberFormat(t,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(a);if(e!=null&&e.negativeInParentheses&&a<0){const f=c.replace("-","");return`(${(e==null?void 0:e.prefix)??""}${f}${(e==null?void 0:e.suffix)??""})`}return`${(e==null?void 0:e.prefix)??""}${c}${(e==null?void 0:e.suffix)??""}`}function P(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale),a=(e==null?void 0:e.currency)||"USD",c=r<0,f=!!(e!=null&&e.negativeInParentheses&&c),n=f?Math.abs(r):r;try{if(e!=null&&e.useSuffix){const{divisor:s,suffix:D}=y(n,t),m=n/s,l=`${new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(m)}${D}`;return f?`(${l})`:l}const i=new Intl.NumberFormat(t,{style:"currency",currency:a,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(n);return f?`(${i})`:i}catch{const i=Math.abs(r),s=e!=null&&e.useSuffix?y(i,t):{divisor:1,suffix:""},D=N(i/s.divisor,{locale:t,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}),m=`${a} ${D}${s.suffix}`;return c?e!=null&&e.negativeInParentheses?`(${m})`:`-${m}`:m}}function S(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale),c=(e==null?void 0:e.alreadyPercent)??(e==null?void 0:e.percentValueMode)==="whole"?r/100:r;return new Intl.NumberFormat(t,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(c)}function w(r,e){if(r==null||isNaN(r))return"";const t=h(e==null?void 0:e.locale);return new Intl.NumberFormat(t,{notation:"scientific",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(r)}function Y(r,e,t="en-US"){if(r==null||isNaN(r))return"";const a=h((e==null?void 0:e.locale)||t),c=(e==null?void 0:e.style)||"decimal";if(c==="percent"){const n=((e==null?void 0:e.percentValueMode)??"whole")==="whole"?r/100:r;return new Intl.NumberFormat(a,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(n)}return c==="currency"?new Intl.NumberFormat(a,{style:"currency",currency:(e==null?void 0:e.currency)||"USD",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(r):c==="scientific"?w(r,{locale:a,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}):new Intl.NumberFormat(a,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(r)}function B(r,e,t){const a={style:e==="currency"?"currency":e==="percent"?"percent":"decimal",locale:t==null?void 0:t.locale,currency:t==null?void 0:t.currency,minimumFractionDigits:t==null?void 0:t.decimalPlaces,maximumFractionDigits:t==null?void 0:t.decimalPlaces,useSuffix:t==null?void 0:t.useSuffix,prefix:t==null?void 0:t.prefix,suffix:t==null?void 0:t.suffix,negativeInParentheses:t==null?void 0:t.negativeInParentheses,multiplyBy:t==null?void 0:t.multiplyBy};switch(e){case"currency":return P(r,a);case"percent":return S(r,a);case"scientific":return w(r,a);default:return N(r,a)}}function k(r,e){return r&&r!=="auto"?r:e}function H(r,e=new Date){try{const t={timeZone:r,timeZoneName:"short"},c=new Intl.DateTimeFormat("en-US",t).formatToParts(e).find(f=>f.type==="timeZoneName");return(c==null?void 0:c.value)||r}catch{return r}}function E(r){try{const e={timeZone:r,timeZoneName:"long"},a=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(c=>c.type==="timeZoneName");return(a==null?void 0:a.value)||r}catch{return r}}function I(r,e="auto"){if(!r)return new Date(NaN);const t=r.endsWith("Z"),a=/[+-]\d{2}:?\d{2}$/.test(r),c=/\([A-Z]{3,4}\)$/.test(r);if(e==="auto")return t||a||c?new Date(r):new Date(r+"Z");if(e==="local"){if(t||a){const f=r.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(f)}return new Date(r)}else return e==="UTC"?t?new Date(r):a?new Date(r):new Date(r+"Z"):t||a||c?new Date(r):u.fromZonedTime(r,e)}const j="MM/dd/yyyy",q=(r,e,t,a="auto")=>{if(!r)return"";try{const c=I(r,a);if(isNaN(c.getTime()))return r;const n=(e&&e.trim()?e:j).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return t&&t!=="auto"?u.formatInTimeZone(c,t,n):u.format(c,n)}catch(c){return console.error("Date formatting error:",c),r}},K=(r,e="auto")=>{if(!r)return"";try{const t=I(r,e);return isNaN(t.getTime())?r:L(t,{addSuffix:!0})}catch(t){return console.error("Relative time formatting error:",t),r}};exports.formatCurrency=P;exports.formatDate=q;exports.formatDistanceToNow=L;exports.formatNumber=N;exports.formatNumberCustom=B;exports.formatNumberWithColumnSettings=Y;exports.formatPercent=S;exports.formatRelativeTime=K;exports.formatScientific=w;exports.getTimezoneAbbreviation=H;exports.getTimezoneName=E;exports.parseWithSourceTimezone=I;exports.resolveTimezone=k;
@@ -1,333 +0,0 @@
1
- import { t as l, c as O, g as S, e as _, a as I, m as $, b as x, f as X, d as U, h as R } from "./index-DFOb_6HB.js";
2
- function M(r, e) {
3
- const c = l(r), a = l(e), t = c.getTime() - a.getTime();
4
- return t < 0 ? -1 : t > 0 ? 1 : t;
5
- }
6
- function v(r) {
7
- return O(r, Date.now());
8
- }
9
- function A(r, e) {
10
- const c = l(r), a = l(e), t = c.getFullYear() - a.getFullYear(), f = c.getMonth() - a.getMonth();
11
- return t * 12 + f;
12
- }
13
- function C(r) {
14
- return (e) => {
15
- const a = (r ? Math[r] : Math.trunc)(e);
16
- return a === 0 ? 0 : a;
17
- };
18
- }
19
- function V(r, e) {
20
- return +l(r) - +l(e);
21
- }
22
- function Y(r) {
23
- const e = l(r);
24
- return e.setHours(23, 59, 59, 999), e;
25
- }
26
- function B(r) {
27
- const e = l(r), c = e.getMonth();
28
- return e.setFullYear(e.getFullYear(), c + 1, 0), e.setHours(23, 59, 59, 999), e;
29
- }
30
- function W(r) {
31
- const e = l(r);
32
- return +Y(e) == +B(e);
33
- }
34
- function k(r, e) {
35
- const c = l(r), a = l(e), t = M(c, a), f = Math.abs(
36
- A(c, a)
37
- );
38
- let i;
39
- if (f < 1)
40
- i = 0;
41
- else {
42
- c.getMonth() === 1 && c.getDate() > 27 && c.setDate(30), c.setMonth(c.getMonth() - t * f);
43
- let u = M(c, a) === -t;
44
- W(l(r)) && f === 1 && M(r, a) === 1 && (u = !1), i = t * (f - Number(u));
45
- }
46
- return i === 0 ? 0 : i;
47
- }
48
- function H(r, e, c) {
49
- const a = V(r, e) / 1e3;
50
- return C(c == null ? void 0 : c.roundingMethod)(a);
51
- }
52
- function E(r, e, c) {
53
- const a = S(), t = (c == null ? void 0 : c.locale) ?? a.locale ?? _, f = 2520, i = M(r, e);
54
- if (isNaN(i))
55
- throw new RangeError("Invalid time value");
56
- const u = Object.assign({}, c, {
57
- addSuffix: c == null ? void 0 : c.addSuffix,
58
- comparison: i
59
- });
60
- let m, D;
61
- i > 0 ? (m = l(e), D = l(r)) : (m = l(r), D = l(e));
62
- const s = H(D, m), w = (I(D) - I(m)) / 1e3, n = Math.round((s - w) / 60);
63
- let d;
64
- if (n < 2)
65
- return c != null && c.includeSeconds ? s < 5 ? t.formatDistance("lessThanXSeconds", 5, u) : s < 10 ? t.formatDistance("lessThanXSeconds", 10, u) : s < 20 ? t.formatDistance("lessThanXSeconds", 20, u) : s < 40 ? t.formatDistance("halfAMinute", 0, u) : s < 60 ? t.formatDistance("lessThanXMinutes", 1, u) : t.formatDistance("xMinutes", 1, u) : n === 0 ? t.formatDistance("lessThanXMinutes", 1, u) : t.formatDistance("xMinutes", n, u);
66
- if (n < 45)
67
- return t.formatDistance("xMinutes", n, u);
68
- if (n < 90)
69
- return t.formatDistance("aboutXHours", 1, u);
70
- if (n < $) {
71
- const g = Math.round(n / 60);
72
- return t.formatDistance("aboutXHours", g, u);
73
- } else {
74
- if (n < f)
75
- return t.formatDistance("xDays", 1, u);
76
- if (n < x) {
77
- const g = Math.round(n / $);
78
- return t.formatDistance("xDays", g, u);
79
- } else if (n < x * 2)
80
- return d = Math.round(n / x), t.formatDistance("aboutXMonths", d, u);
81
- }
82
- if (d = k(D, m), d < 12) {
83
- const g = Math.round(n / x);
84
- return t.formatDistance("xMonths", g, u);
85
- } else {
86
- const g = d % 12, y = Math.trunc(d / 12);
87
- return g < 3 ? t.formatDistance("aboutXYears", y, u) : g < 9 ? t.formatDistance("overXYears", y, u) : t.formatDistance("almostXYears", y + 1, u);
88
- }
89
- }
90
- function j(r, e) {
91
- return E(r, v(r), e);
92
- }
93
- function T(r) {
94
- if (!r) return !1;
95
- const e = r.toLowerCase().replace("_", "-");
96
- return e === "en-in" || e.startsWith("en-in-");
97
- }
98
- function G(r, e) {
99
- const c = Math.abs(r);
100
- return c >= 1e12 ? { divisor: 1e12, suffix: "T" } : c >= 1e9 ? { divisor: 1e9, suffix: "B" } : T(e) && c >= 1e7 ? { divisor: 1e7, suffix: "Cr" } : c >= 1e6 ? { divisor: 1e6, suffix: "M" } : T(e) && c >= 1e5 ? { divisor: 1e5, suffix: "L" } : c >= 1e3 ? { divisor: 1e3, suffix: "K" } : { divisor: 1, suffix: "" };
101
- }
102
- function N(r, e) {
103
- try {
104
- const c = h(e);
105
- return G(r, c);
106
- } catch {
107
- return G(r, "en-US");
108
- }
109
- }
110
- function K(r) {
111
- try {
112
- return new Intl.NumberFormat(r), !0;
113
- } catch {
114
- return !1;
115
- }
116
- }
117
- function h(r) {
118
- return r && K(r) ? r : "en-US";
119
- }
120
- function L(r, e) {
121
- if (r == null || isNaN(r))
122
- return "";
123
- const c = h(e == null ? void 0 : e.locale);
124
- let a = r;
125
- if (e != null && e.multiplyBy && (a *= e.multiplyBy), e != null && e.useSuffix) {
126
- const { divisor: f, suffix: i } = N(a, c);
127
- a = a / f;
128
- const u = new Intl.NumberFormat(c, {
129
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
130
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
131
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
132
- }).format(a);
133
- return `${(e == null ? void 0 : e.prefix) ?? ""}${u}${i}${(e == null ? void 0 : e.suffix) ?? ""}`;
134
- }
135
- const t = new Intl.NumberFormat(c, {
136
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
137
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
138
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
139
- }).format(a);
140
- if (e != null && e.negativeInParentheses && a < 0) {
141
- const f = t.replace("-", "");
142
- return `(${(e == null ? void 0 : e.prefix) ?? ""}${f}${(e == null ? void 0 : e.suffix) ?? ""})`;
143
- }
144
- return `${(e == null ? void 0 : e.prefix) ?? ""}${t}${(e == null ? void 0 : e.suffix) ?? ""}`;
145
- }
146
- function q(r, e) {
147
- if (r == null || isNaN(r))
148
- return "";
149
- const c = h(e == null ? void 0 : e.locale), a = (e == null ? void 0 : e.currency) || "USD", t = r < 0, f = !!(e != null && e.negativeInParentheses && t), i = f ? Math.abs(r) : r;
150
- try {
151
- if (e != null && e.useSuffix) {
152
- const { divisor: m, suffix: D } = N(i, c), s = i / m, n = `${new Intl.NumberFormat(c, {
153
- style: "currency",
154
- currency: a,
155
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
156
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
157
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
158
- }).format(s)}${D}`;
159
- return f ? `(${n})` : n;
160
- }
161
- const u = new Intl.NumberFormat(c, {
162
- style: "currency",
163
- currency: a,
164
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
165
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
166
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
167
- }).format(i);
168
- return f ? `(${u})` : u;
169
- } catch {
170
- const u = Math.abs(r), m = e != null && e.useSuffix ? N(u, c) : { divisor: 1, suffix: "" }, D = L(
171
- u / m.divisor,
172
- {
173
- locale: c,
174
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
175
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
176
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
177
- }
178
- ), s = `${a} ${D}${m.suffix}`;
179
- return t ? e != null && e.negativeInParentheses ? `(${s})` : `-${s}` : s;
180
- }
181
- }
182
- function J(r, e) {
183
- if (r == null || isNaN(r))
184
- return "";
185
- const c = h(e == null ? void 0 : e.locale), t = (e == null ? void 0 : e.alreadyPercent) ?? (e == null ? void 0 : e.percentValueMode) === "whole" ? r / 100 : r;
186
- return new Intl.NumberFormat(c, {
187
- style: "percent",
188
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
189
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
190
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
191
- }).format(t);
192
- }
193
- function P(r, e) {
194
- if (r == null || isNaN(r))
195
- return "";
196
- const c = h(e == null ? void 0 : e.locale);
197
- return new Intl.NumberFormat(c, {
198
- notation: "scientific",
199
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
200
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
201
- }).format(r);
202
- }
203
- function F(r, e, c = "en-US") {
204
- if (r == null || isNaN(r))
205
- return "";
206
- const a = h((e == null ? void 0 : e.locale) || c), t = (e == null ? void 0 : e.style) || "decimal";
207
- if (t === "percent") {
208
- const i = ((e == null ? void 0 : e.percentValueMode) ?? "whole") === "whole" ? r / 100 : r;
209
- return new Intl.NumberFormat(a, {
210
- style: "percent",
211
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
212
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
213
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
214
- }).format(i);
215
- }
216
- return t === "currency" ? new Intl.NumberFormat(a, {
217
- style: "currency",
218
- currency: (e == null ? void 0 : e.currency) || "USD",
219
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
220
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
221
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
222
- }).format(r) : t === "scientific" ? P(r, {
223
- locale: a,
224
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
225
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
226
- }) : new Intl.NumberFormat(a, {
227
- minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
228
- maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2,
229
- useGrouping: (e == null ? void 0 : e.useGrouping) ?? !0
230
- }).format(r);
231
- }
232
- function b(r, e, c) {
233
- const a = {
234
- style: e === "currency" ? "currency" : e === "percent" ? "percent" : "decimal",
235
- locale: c == null ? void 0 : c.locale,
236
- currency: c == null ? void 0 : c.currency,
237
- minimumFractionDigits: c == null ? void 0 : c.decimalPlaces,
238
- maximumFractionDigits: c == null ? void 0 : c.decimalPlaces,
239
- useSuffix: c == null ? void 0 : c.useSuffix,
240
- prefix: c == null ? void 0 : c.prefix,
241
- suffix: c == null ? void 0 : c.suffix,
242
- negativeInParentheses: c == null ? void 0 : c.negativeInParentheses,
243
- multiplyBy: c == null ? void 0 : c.multiplyBy
244
- };
245
- switch (e) {
246
- case "currency":
247
- return q(r, a);
248
- case "percent":
249
- return J(r, a);
250
- case "scientific":
251
- return P(r, a);
252
- default:
253
- return L(r, a);
254
- }
255
- }
256
- function p(r, e) {
257
- return r && r !== "auto" ? r : e;
258
- }
259
- function o(r, e = /* @__PURE__ */ new Date()) {
260
- try {
261
- const c = {
262
- timeZone: r,
263
- timeZoneName: "short"
264
- }, t = new Intl.DateTimeFormat("en-US", c).formatToParts(e).find((f) => f.type === "timeZoneName");
265
- return (t == null ? void 0 : t.value) || r;
266
- } catch {
267
- return r;
268
- }
269
- }
270
- function ee(r) {
271
- try {
272
- const e = {
273
- timeZone: r,
274
- timeZoneName: "long"
275
- }, a = new Intl.DateTimeFormat("en-US", e).formatToParts(
276
- /* @__PURE__ */ new Date()
277
- ).find((t) => t.type === "timeZoneName");
278
- return (a == null ? void 0 : a.value) || r;
279
- } catch {
280
- return r;
281
- }
282
- }
283
- function Z(r, e = "auto") {
284
- if (!r)
285
- return /* @__PURE__ */ new Date(NaN);
286
- const c = r.endsWith("Z"), a = /[+-]\d{2}:?\d{2}$/.test(r), t = /\([A-Z]{3,4}\)$/.test(r);
287
- if (e === "auto")
288
- return c || a || t ? new Date(r) : /* @__PURE__ */ new Date(r + "Z");
289
- if (e === "local") {
290
- if (c || a) {
291
- const f = r.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
292
- return new Date(f);
293
- }
294
- return new Date(r);
295
- } else return e === "UTC" ? c ? new Date(r) : a ? new Date(r) : /* @__PURE__ */ new Date(r + "Z") : c || a || t ? new Date(r) : R(r, e);
296
- }
297
- const Q = "MM/dd/yyyy", re = (r, e, c, a = "auto") => {
298
- if (!r)
299
- return "";
300
- try {
301
- const t = Z(r, a);
302
- if (isNaN(t.getTime()))
303
- return r;
304
- const i = (e && e.trim() ? e : Q).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
305
- return c && c !== "auto" ? X(t, c, i) : U(t, i);
306
- } catch (t) {
307
- return console.error("Date formatting error:", t), r;
308
- }
309
- }, ce = (r, e = "auto") => {
310
- if (!r)
311
- return "";
312
- try {
313
- const c = Z(r, e);
314
- return isNaN(c.getTime()) ? r : j(c, { addSuffix: !0 });
315
- } catch (c) {
316
- return console.error("Relative time formatting error:", c), r;
317
- }
318
- };
319
- export {
320
- ce as a,
321
- re as b,
322
- L as c,
323
- q as d,
324
- J as e,
325
- F as f,
326
- P as g,
327
- b as h,
328
- o as i,
329
- ee as j,
330
- j as k,
331
- Z as p,
332
- p as r
333
- };