react-semaphor 0.1.424 → 0.1.425
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.
- package/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +243 -91
- package/dist/appearance/index.cjs +1 -1
- package/dist/appearance/index.js +1 -1
- package/dist/brand-studio/index.cjs +2 -2
- package/dist/brand-studio/index.js +8 -8
- package/dist/chunks/{analyze-result-contract-D7pjjYPy.js → analyze-result-contract-DnfF8kBb.js} +434 -427
- package/dist/chunks/analyze-result-contract-ege_u6Nl.js +1 -0
- package/dist/chunks/{braces-8TRlDwDw.js → braces-BdbUk_r9.js} +1 -1
- package/dist/chunks/{braces-D2tStQjF.js → braces-CbO-aIwH.js} +1 -1
- package/dist/chunks/calendar-preferences-dialog-BLaSWhLl.js +1 -0
- package/dist/chunks/{calendar-preferences-dialog-D5mABNDT.js → calendar-preferences-dialog-DJwV0aqn.js} +4 -4
- package/dist/chunks/{catalog-field-grounding-CJKAqtiC.js → catalog-field-grounding-DcxPLns0.js} +10 -10
- package/dist/chunks/{switch-2bh3Hka1.js → code-editor-Bkk7s8hI.js} +7382 -6809
- package/dist/chunks/code-editor-CkXyNgYc.js +138 -0
- package/dist/chunks/{common-types-4bjoIgvm.js → common-types-ClkOI-3O.js} +4 -4
- package/dist/chunks/comparison-document-migration-CQJ0DZlL.js +414 -0
- package/dist/chunks/comparison-document-migration-Db64RWYD.js +1 -0
- package/dist/chunks/{index-Dzz6jXSY.js → dashboard-5agU0G_D.js} +57458 -56183
- package/dist/chunks/dashboard-MKIqgGDp.js +1402 -0
- package/dist/chunks/{dashboard-briefing-launcher-DuWgwtxX.js → dashboard-briefing-launcher-CII8-4qo.js} +11 -6
- package/dist/chunks/{dashboard-briefing-launcher-BNDzMjjt.js → dashboard-briefing-launcher-qyEVfuOm.js} +226 -209
- package/dist/chunks/dashboard-controls-PJpeYZHw.js +36 -0
- package/dist/chunks/dashboard-controls-aJY0FNPP.js +2196 -0
- package/dist/chunks/dashboard-input-contract-BFpERluO.js +18 -0
- package/dist/chunks/dashboard-input-contract-DV3cshjz.js +1 -0
- package/dist/chunks/{dashboard-json-CkTEDNtH.js → dashboard-json-CzHSP6Fa.js} +16 -15
- package/dist/chunks/dashboard-json-DtmR5yCf.js +1 -0
- package/dist/chunks/date-formatter-BTTYdAik.js +1 -0
- package/dist/chunks/date-formatter-D-89jTjG.js +514 -0
- package/dist/chunks/{edit-dashboard-visual-CRjVRZLk.js → edit-dashboard-visual-AkZzwBCV.js} +8892 -8996
- package/dist/chunks/edit-dashboard-visual-Cif6uDqN.js +182 -0
- package/dist/chunks/{index-CjzRe2su.js → index-CnujJ3fa.js} +3 -3
- package/dist/chunks/{index-DRlMUglg.js → index-Dpm_VET4.js} +2 -2
- package/dist/chunks/{index-CJdxSyQq.js → index-If0wlXGi.js} +308 -308
- package/dist/chunks/index-jSrCwPQz.js +31 -0
- package/dist/chunks/{x-CXDkqdur.js → index-xHCrHprY.js} +59 -59
- package/dist/chunks/{layout-grid-C0OI-MRn.js → layout-grid-B08pP7v6.js} +1 -1
- package/dist/chunks/{layout-grid-CiubineE.js → layout-grid-D5tYJg1-.js} +1 -1
- package/dist/chunks/metric-comparison-4oA4ouU9.js +354 -0
- package/dist/chunks/metric-comparison-nQKquVnx.js +1 -0
- package/dist/chunks/{palette-C4KTXOug.js → palette-C0yjT5Tv.js} +1 -1
- package/dist/chunks/{palette-Cp1hqZtm.js → palette-jqaAcwiQ.js} +1 -1
- package/dist/chunks/{save-DgMfP0j8.js → save-HCJjjzdX.js} +1 -1
- package/dist/chunks/{save-C__QggEE.js → save-Xdc4pnys.js} +1 -1
- package/dist/chunks/{search-BHsQIWBV.js → search-DHZCro8B.js} +1 -1
- package/dist/chunks/{search-DNCejM7Z.js → search-Dcud9ajy.js} +1 -1
- package/dist/chunks/{update-policy-C1pmhLz9.js → update-policy-BgONreNd.js} +1 -1
- package/dist/chunks/{update-policy-BCJc0oI5.js → update-policy-CY2k-pJP.js} +9 -9
- package/dist/chunks/{use-create-flow-overlay-state-B9vArrvr.js → use-create-flow-overlay-state-ByOKVV2K.js} +62 -62
- package/dist/chunks/{use-create-flow-overlay-state-B-bYbtix.js → use-create-flow-overlay-state-DmuReEnk.js} +2 -2
- package/dist/chunks/validators-B4VMLX3_.js +1 -0
- package/dist/chunks/{validators-PXkij33j.js → validators-Cz-XuORM.js} +123 -119
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.cjs +2 -2
- package/dist/dashboard-authoring/index.js +6 -4
- package/dist/data-app-builder/index.cjs +6 -6
- package/dist/data-app-builder/index.js +5 -5
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +1 -1
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +65 -68
- package/dist/format-utils/index.cjs +2 -2
- package/dist/format-utils/index.js +59 -58
- package/dist/index.cjs +1 -1
- package/dist/index.js +19 -19
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +3 -3
- package/dist/types/analytics-protocol.d.ts +299 -3
- package/dist/types/brand-studio.d.ts +2 -2
- package/dist/types/briefings.d.ts +65 -41
- package/dist/types/dashboard-assistant.d.ts +28 -7
- package/dist/types/dashboard-authoring.d.ts +123 -43
- package/dist/types/dashboard.d.ts +97 -48
- package/dist/types/data-app-builder.d.ts +2 -2
- package/dist/types/data-app-sdk.d.ts +1 -1
- package/dist/types/format-utils.d.ts +98 -10
- package/dist/types/index.js +1 -1
- package/dist/types/main.d.ts +229 -95
- package/dist/types/shared.d.ts +84 -43
- package/dist/types/surfboard.d.ts +99 -49
- package/dist/types/types.d.ts +110 -50
- package/package.json +2 -1
- package/dist/chunks/analyze-result-contract-DpDcImgk.js +0 -1
- package/dist/chunks/calendar-preferences-dialog-iokD3HbE.js +0 -1
- package/dist/chunks/contracts-CoCOpd_i.js +0 -11
- package/dist/chunks/contracts-CtB2VONT.js +0 -1
- package/dist/chunks/dashboard-controls-bbEF-AbK.js +0 -52
- package/dist/chunks/dashboard-controls-id39vb7G.js +0 -2322
- package/dist/chunks/dashboard-json-DVoqS1ks.js +0 -1
- package/dist/chunks/date-formatter-B4EBSe9C.js +0 -1
- package/dist/chunks/date-formatter-BlhBftA9.js +0 -416
- package/dist/chunks/edit-dashboard-visual-CkrxZCcp.js +0 -178
- package/dist/chunks/index-S1CGUcSz.js +0 -1406
- package/dist/chunks/switch-DMT7qf_R.js +0 -138
- package/dist/chunks/validators-DMlVbd1p.js +0 -1
- package/dist/chunks/x-B6ghREd2.js +0 -31
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function o(t) {
|
|
2
|
+
return `compat-filter:${t}`;
|
|
3
|
+
}
|
|
4
|
+
function r(t) {
|
|
5
|
+
return `compat-control:${t}`;
|
|
6
|
+
}
|
|
7
|
+
function a(t, n) {
|
|
8
|
+
return `compat-inline-filter:${t}:${n}`;
|
|
9
|
+
}
|
|
10
|
+
function e(t, n) {
|
|
11
|
+
return `compat-card-control:${t}:${n}`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
a,
|
|
15
|
+
r as b,
|
|
16
|
+
o as c,
|
|
17
|
+
e as g
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function o(t){return`compat-filter:${t}`}function r(t){return`compat-control:${t}`}function a(t,n){return`compat-inline-filter:${t}:${n}`}function e(t,n){return`compat-card-control:${t}:${n}`}exports.getCardControlCompatInputId=e;exports.getCardInlineFilterCompatInputId=a;exports.getDashboardControlCompatInputId=r;exports.getDashboardFilterCompatInputId=o;
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { X as S } from "./
|
|
4
|
-
import { u as o,
|
|
5
|
-
import "./analyze-result-contract-
|
|
6
|
-
import "./
|
|
7
|
-
import "./index-
|
|
2
|
+
import { useMemo as u, useState as f, useRef as p, useEffect as b } from "react";
|
|
3
|
+
import { X as S } from "./index-xHCrHprY.js";
|
|
4
|
+
import { u as o, B as N, C as D, c as J } from "./code-editor-Bkk7s8hI.js";
|
|
5
|
+
import "./analyze-result-contract-DnfF8kBb.js";
|
|
6
|
+
import "./dashboard-5agU0G_D.js";
|
|
7
|
+
import "./index-If0wlXGi.js";
|
|
8
|
+
import "./comparison-document-migration-CQJ0DZlL.js";
|
|
8
9
|
import "react-dom";
|
|
9
10
|
import "../briefings/index.js";
|
|
10
|
-
function
|
|
11
|
+
function E() {
|
|
11
12
|
const r = o((s) => s.dashboard), c = o((s) => s.actions.setDashboard), h = o(
|
|
12
13
|
(s) => s.showDashboardJSON
|
|
13
14
|
), l = o(
|
|
14
15
|
(s) => s.actions.setShowDashboardJSON
|
|
15
|
-
), a =
|
|
16
|
+
), a = u(
|
|
16
17
|
() => r ? JSON.stringify(r, null, 2) : "",
|
|
17
18
|
[r]
|
|
18
|
-
), [
|
|
19
|
-
return
|
|
19
|
+
), [m, n] = f(a), e = p(a);
|
|
20
|
+
return b(() => {
|
|
20
21
|
a !== e.current && (n(a), e.current = a);
|
|
21
22
|
}, [a]), /* @__PURE__ */ d(
|
|
22
23
|
"div",
|
|
23
24
|
{
|
|
24
|
-
className:
|
|
25
|
+
className: J("relative p-2", {
|
|
25
26
|
hidden: !h
|
|
26
27
|
}),
|
|
27
28
|
children: [
|
|
28
29
|
/* @__PURE__ */ d(
|
|
29
|
-
|
|
30
|
+
N,
|
|
30
31
|
{
|
|
31
32
|
variant: "secondary",
|
|
32
33
|
size: "sm",
|
|
@@ -39,9 +40,9 @@ function z() {
|
|
|
39
40
|
}
|
|
40
41
|
),
|
|
41
42
|
/* @__PURE__ */ t("div", { className: "h-[550px] overflow-hidden", children: /* @__PURE__ */ t(
|
|
42
|
-
|
|
43
|
+
D,
|
|
43
44
|
{
|
|
44
|
-
value:
|
|
45
|
+
value: m,
|
|
45
46
|
onValueChange: (s) => {
|
|
46
47
|
n(s);
|
|
47
48
|
try {
|
|
@@ -62,5 +63,5 @@ function z() {
|
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
E as default
|
|
66
67
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./index-jSrCwPQz.js"),s=require("./code-editor-CkXyNgYc.js");require("./analyze-result-contract-ege_u6Nl.js");require("./dashboard-MKIqgGDp.js");require("./index-Dpm_VET4.js");require("./comparison-document-migration-Db64RWYD.js");require("react-dom");require("../briefings/index.cjs");function S(){const t=s.useDashboardStore(e=>e.dashboard),u=s.useDashboardStore(e=>e.actions.setDashboard),c=s.useDashboardStore(e=>e.showDashboardJSON),h=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),r=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,i]=o.useState(r),n=o.useRef(r);return o.useEffect(()=>{r!==n.current&&(i(r),n.current=r)},[r]),a.jsxs("div",{className:s.cn("relative p-2",{hidden:!c}),children:[a.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(b.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(s.CodeEditor,{value:l,onValueChange:e=>{i(e);try{const d=JSON.parse(e);n.current=JSON.stringify(d,null,2),u(d)}catch{}},language:"json"})})]})}exports.default=S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("./index-D7KJindZ.js");function y(t,e){const r=a.toDate(t),n=a.toDate(e),i=r.getTime()-n.getTime();return i<0?-1:i>0?1:i}function X(t){return a.constructFrom(t,Date.now())}function B(t,e){const r=a.toDate(t),n=a.toDate(e),i=r.getFullYear()-n.getFullYear(),c=r.getMonth()-n.getMonth();return i*12+c}function F(t){return e=>{const n=(t?Math[t]:Math.trunc)(e);return n===0?0:n}}function W(t,e){return+a.toDate(t)-+a.toDate(e)}function Y(t){const e=a.toDate(t);return e.setHours(23,59,59,999),e}function E(t){const e=a.toDate(t),r=e.getMonth();return e.setFullYear(e.getFullYear(),r+1,0),e.setHours(23,59,59,999),e}function k(t){const e=a.toDate(t);return+Y(e)==+E(e)}function v(t,e){const r=a.toDate(t),n=a.toDate(e),i=y(r,n),c=Math.abs(B(r,n));let f;if(c<1)f=0;else{r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-i*c);let u=y(r,n)===-i;k(a.toDate(t))&&c===1&&y(t,n)===1&&(u=!1),f=i*(c-Number(u))}return f===0?0:f}function j(t,e,r){const n=W(t,e)/1e3;return F(r==null?void 0:r.roundingMethod)(n)}function H(t,e,r){const n=a.getDefaultOptions(),i=(r==null?void 0:r.locale)??n.locale??a.enUS,c=2520,f=y(t,e);if(isNaN(f))throw new RangeError("Invalid time value");const u=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:f});let s,d;f>0?(s=a.toDate(e),d=a.toDate(t)):(s=a.toDate(t),d=a.toDate(e));const m=j(d,s),U=(a.getTimezoneOffsetInMilliseconds(d)-a.getTimezoneOffsetInMilliseconds(s))/1e3,l=Math.round((m-U)/60);let D;if(l<2)return r!=null&&r.includeSeconds?m<5?i.formatDistance("lessThanXSeconds",5,u):m<10?i.formatDistance("lessThanXSeconds",10,u):m<20?i.formatDistance("lessThanXSeconds",20,u):m<40?i.formatDistance("halfAMinute",0,u):m<60?i.formatDistance("lessThanXMinutes",1,u):i.formatDistance("xMinutes",1,u):l===0?i.formatDistance("lessThanXMinutes",1,u):i.formatDistance("xMinutes",l,u);if(l<45)return i.formatDistance("xMinutes",l,u);if(l<90)return i.formatDistance("aboutXHours",1,u);if(l<a.minutesInDay){const g=Math.round(l/60);return i.formatDistance("aboutXHours",g,u)}else{if(l<c)return i.formatDistance("xDays",1,u);if(l<a.minutesInMonth){const g=Math.round(l/a.minutesInDay);return i.formatDistance("xDays",g,u)}else if(l<a.minutesInMonth*2)return D=Math.round(l/a.minutesInMonth),i.formatDistance("aboutXMonths",D,u)}if(D=v(d,s),D<12){const g=Math.round(l/a.minutesInMonth);return i.formatDistance("xMonths",g,u)}else{const g=D%12,I=Math.trunc(D/12);return g<3?i.formatDistance("aboutXYears",I,u):g<9?i.formatDistance("overXYears",I,u):i.formatDistance("almostXYears",I+1,u)}}function _(t,e){return H(t,X(t),e)}function L(t){if(!t)return!1;const e=t.toLowerCase().replace("_","-");return e==="en-in"||e.startsWith("en-in-")}function C(t,e){const r=Math.abs(t);return r>=1e12?{divisor:1e12,suffix:"T"}:r>=1e9?{divisor:1e9,suffix:"B"}:L(e)&&r>=1e7?{divisor:1e7,suffix:"Cr"}:r>=1e6?{divisor:1e6,suffix:"M"}:L(e)&&r>=1e5?{divisor:1e5,suffix:"L"}:r>=1e3?{divisor:1e3,suffix:"K"}:{divisor:1,suffix:""}}function w(t,e){try{const r=h(e);return C(t,r)}catch{return C(t,"en-US")}}function q(t){try{return new Intl.NumberFormat(t),!0}catch{return!1}}function h(t){return t&&q(t)?t:"en-US"}function x(t,e){if(t==null||isNaN(t))return"";const r=h(e==null?void 0:e.locale);let n=t;if(e!=null&&e.multiplyBy&&(n*=e.multiplyBy),e!=null&&e.useSuffix){const{divisor:c,suffix:f}=w(n,r);n=n/c;const u=new Intl.NumberFormat(r,{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`${(e==null?void 0:e.prefix)??""}${u}${f}${(e==null?void 0:e.suffix)??""}`}const i=new Intl.NumberFormat(r,{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);if(e!=null&&e.negativeInParentheses&&n<0){const c=i.replace("-","");return`(${(e==null?void 0:e.prefix)??""}${c}${(e==null?void 0:e.suffix)??""})`}return`${(e==null?void 0:e.prefix)??""}${i}${(e==null?void 0:e.suffix)??""}`}function T(t,e){if(t==null||isNaN(t))return"";const r=h(e==null?void 0:e.locale),n=(e==null?void 0:e.currency)||"USD",i=t<0,c=!!(e!=null&&e.negativeInParentheses&&i),f=c?Math.abs(t):t;try{if(e!=null&&e.useSuffix){const{divisor:s,suffix:d}=w(f,r),m=f/s,l=`${new Intl.NumberFormat(r,{style:"currency",currency:n,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 c?`(${l})`:l}const u=new Intl.NumberFormat(r,{style:"currency",currency:n,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(f);return c?`(${u})`:u}catch{const u=Math.abs(t),s=e!=null&&e.useSuffix?w(u,r):{divisor:1,suffix:""},d=x(u/s.divisor,{locale:r,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=`${n} ${d}${s.suffix}`;return i?e!=null&&e.negativeInParentheses?`(${m})`:`-${m}`:m}}function M(t,e){if(t==null||isNaN(t))return"";const r=h(e==null?void 0:e.locale),i=(e==null?void 0:e.alreadyPercent)??(e==null?void 0:e.percentValueMode)==="whole"?t/100:t;return new Intl.NumberFormat(r,{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(i)}function N(t,e){if(t==null||isNaN(t))return"";const r=h(e==null?void 0:e.locale);return new Intl.NumberFormat(r,{notation:"scientific",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(t)}function K(t,e,r="en-US"){if(t==null||isNaN(t))return"";const n=h((e==null?void 0:e.locale)||r),i=(e==null?void 0:e.style)||"decimal";if(i==="percent"){const f=((e==null?void 0:e.percentValueMode)??"whole")==="whole"?t/100:t;return new Intl.NumberFormat(n,{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(f)}return i==="currency"?new Intl.NumberFormat(n,{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(t):i==="scientific"?N(t,{locale:n,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}):new Intl.NumberFormat(n,{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(t)}function z(t,e,r){const n={style:e==="currency"?"currency":e==="percent"?"percent":"decimal",locale:r==null?void 0:r.locale,currency:r==null?void 0:r.currency,minimumFractionDigits:r==null?void 0:r.decimalPlaces,maximumFractionDigits:r==null?void 0:r.decimalPlaces,useSuffix:r==null?void 0:r.useSuffix,prefix:r==null?void 0:r.prefix,suffix:r==null?void 0:r.suffix,negativeInParentheses:r==null?void 0:r.negativeInParentheses,multiplyBy:r==null?void 0:r.multiplyBy};switch(e){case"currency":return T(t,n);case"percent":return M(t,n);case"scientific":return N(t,n);default:return x(t,n)}}const V=["day","hour","minute","second","millisecond"],S={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},J={day:"d",hour:"hr",minute:"min",second:"s",millisecond:"ms"},Q={day:["day","days"],hour:["hour","hours"],minute:["minute","minutes"],second:["second","seconds"],millisecond:["millisecond","milliseconds"]};function b(t){return t==="day"||t==="hour"||t==="minute"||t==="second"||t==="millisecond"}function A(t,e){return b(t)?t:e}function G(t,e){return V.indexOf(A(t,e))}function o(t,e){const r=G(t,"day"),n=G(e,"second"),i=Math.min(r,n),c=Math.max(r,n);return V.slice(i,c+1)}function p(t,e){return t*S[A(e,"second")]}function ee(t,e){const r=o(e.largestUnit,e.smallestUnit),n=r[r.length-1],i=S[n];let c=Math.round(t/i)*i;return r.map(f=>{const u=S[f],s=Math.floor(c/u);return c-=s*u,{unit:f,value:s}})}function te(t,e){const r=t.filter(c=>c.value!==0),n=r.length>0?r:[t[t.length-1]],i=typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.trunc(e)):n.length;return n.slice(0,i).map(c=>`${c.value}${J[c.unit]}`).join(" ")}function re(t,e){const r=t.filter(c=>c.value!==0),n=r.length>0?r:[t[t.length-1]],i=typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.trunc(e)):n.length;return n.slice(0,i).map(c=>{const[f,u]=Q[c.unit];return`${c.value} ${c.value===1?f:u}`}).join(" ")}function ne(t){const e=t.some(s=>s.unit==="day"&&s.value!==0),r=t.some(s=>s.unit==="millisecond"),n=t.findIndex(s=>s.value!==0),i=Math.max(0,t.length-2),c=e?0:n===-1?i:Math.min(n,i),f=n===-1?t.slice(i):t.slice(c);if(f.length===0)return"0";const u=f.map((s,d)=>s.unit==="millisecond"?String(s.value).padStart(3,"0"):d===0?String(s.value):String(s.value).padStart(2,"0")).join(":");return r?u.replace(/:(\d{3})$/,".$1"):u}function ie(t,e,r){const n=`${r.prefix||""}${t}${r.suffix||""}`;return e?r.negativeInParentheses?`(${n})`:`-${n}`:n}function R(t,e={}){if(t==null)return"";const r=typeof t=="number"?t:typeof t=="string"&&t.trim()?Number(t):NaN;if(!Number.isFinite(r))return"";const n=e.inputUnit||"second",i=e.outputStyle==="digital"||e.outputStyle==="long"?e.outputStyle:"compact",c=r<0,f=Math.abs(p(r,n)),u=ee(f,e),s=i==="digital"?ne(u):i==="long"?re(u,e.maxUnits):te(u,e.maxUnits);return ie(s,c,e)}function ce(t,e,r){const n=t*(e.scale??1),i={style:e.type==="number"?"decimal":e.type,locale:e.locale??r,currency:e.currency,minimumFractionDigits:e.minimumFractionDigits,maximumFractionDigits:e.maximumFractionDigits,useGrouping:e.useGrouping,percentValueMode:e.percentValueMode,prefix:e.prefix,suffix:e.suffix,negativeInParentheses:e.negativeStyle==="parentheses",useSuffix:e.compact};if(e.type==="currency"){const c=T(n,i);return`${e.prefix??""}${c}${e.suffix??""}`}if(e.type==="percent"){const c=M(n,i);return`${e.prefix??""}${c}${e.suffix??""}`}if(e.type==="scientific"){const c=N(n,i);return`${e.prefix??""}${c}${e.suffix??""}`}return x(n,i)}function $(t,e,r){return t===null?{value:t,text:null}:!e||e.type==="date"||e.type==="string"?{value:t,text:x(t,{locale:r})}:e.type==="duration"?{value:t,text:R(t,{inputUnit:e.inputUnit,outputStyle:e.outputStyle,largestUnit:e.largestUnit,smallestUnit:e.smallestUnit,maxUnits:e.maxUnits,prefix:e.prefix,suffix:e.suffix,negativeInParentheses:e.negativeStyle==="parentheses"})}:{value:t,text:ce(t,e,r)}}function O(t,e,r,n){return t===null?{value:t,text:null}:n==="percent"?{value:t,text:M(t,{locale:r,minimumFractionDigits:e,maximumFractionDigits:e})}:{value:t,text:x(t,{locale:r,minimumFractionDigits:e,maximumFractionDigits:e,suffix:"×"})}}function Z(t,e){if(t===void 0)return e;if(!Number.isInteger(t)||t<0||t>6)throw new RangeError("Comparison precision must be an integer from 0 to 6.");return t}function ue(t,e){const r={mode:e.displayMode,current:$(t.currentValue,e.metricFormat,e.locale),comparison:$(t.comparisonValue,e.metricFormat,e.locale)};return(e.displayMode==="difference"||e.displayMode==="both")&&(r.difference=$(t.delta,e.metricFormat,e.locale)),(e.displayMode==="percent_change"||e.displayMode==="both")&&(r.percentChange=O(t.percentChange,Z(e.precision,1),e.locale,"percent")),e.displayMode==="ratio"&&(r.ratio=O(t.ratio,Z(e.precision,2),e.locale,"ratio")),r}function ae(t,e){return t&&t!=="auto"?t:e}function fe(t,e=new Date){try{const r={timeZone:t,timeZoneName:"short"},i=new Intl.DateTimeFormat("en-US",r).formatToParts(e).find(c=>c.type==="timeZoneName");return(i==null?void 0:i.value)||t}catch{return t}}function se(t){try{const e={timeZone:t,timeZoneName:"long"},n=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(i=>i.type==="timeZoneName");return(n==null?void 0:n.value)||t}catch{return t}}function P(t,e="auto"){if(!t)return new Date(NaN);const r=t.endsWith("Z"),n=/[+-]\d{2}:?\d{2}$/.test(t),i=/\([A-Z]{3,4}\)$/.test(t);if(e==="auto")return r||n||i?new Date(t):new Date(t+"Z");if(e==="local"){if(r||n){const c=t.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(c)}return new Date(t)}else return e==="UTC"?r?new Date(t):n?new Date(t):new Date(t+"Z"):r||n||i?new Date(t):a.fromZonedTime(t,e)}const le="MM/dd/yyyy",me=(t,e,r,n="auto")=>{if(!t)return"";try{const i=P(t,n);if(isNaN(i.getTime()))return t;const f=(e&&e.trim()?e:le).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return r&&r!=="auto"?a.formatInTimeZone(i,r,f):a.format(i,f)}catch(i){return console.error("Date formatting error:",i),t}},de=(t,e="auto")=>{if(!t)return"";try{const r=P(t,e);return isNaN(r.getTime())?t:_(r,{addSuffix:!0})}catch(r){return console.error("Relative time formatting error:",r),t}};exports.formatCurrency=T;exports.formatDate=me;exports.formatDistanceToNow=_;exports.formatDuration=R;exports.formatMetricComparison=ue;exports.formatNumber=x;exports.formatNumberCustom=z;exports.formatNumberWithColumnSettings=K;exports.formatPercent=M;exports.formatRelativeTime=de;exports.formatScientific=N;exports.getTimezoneAbbreviation=fe;exports.getTimezoneName=se;exports.parseWithSourceTimezone=P;exports.resolveTimezone=ae;
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { t as l, c as B, e as F, g as T, m as L, a as y, b as Y, f as E, d as W, h as k } from "./index-CnujJ3fa.js";
|
|
2
|
+
function M(t, e) {
|
|
3
|
+
const r = l(t), n = l(e), i = r.getTime() - n.getTime();
|
|
4
|
+
return i < 0 ? -1 : i > 0 ? 1 : i;
|
|
5
|
+
}
|
|
6
|
+
function j(t) {
|
|
7
|
+
return B(t, Date.now());
|
|
8
|
+
}
|
|
9
|
+
function H(t, e) {
|
|
10
|
+
const r = l(t), n = l(e), i = r.getFullYear() - n.getFullYear(), c = r.getMonth() - n.getMonth();
|
|
11
|
+
return i * 12 + c;
|
|
12
|
+
}
|
|
13
|
+
function v(t) {
|
|
14
|
+
return (e) => {
|
|
15
|
+
const n = (t ? Math[t] : Math.trunc)(e);
|
|
16
|
+
return n === 0 ? 0 : n;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function K(t, e) {
|
|
20
|
+
return +l(t) - +l(e);
|
|
21
|
+
}
|
|
22
|
+
function q(t) {
|
|
23
|
+
const e = l(t);
|
|
24
|
+
return e.setHours(23, 59, 59, 999), e;
|
|
25
|
+
}
|
|
26
|
+
function J(t) {
|
|
27
|
+
const e = l(t), r = e.getMonth();
|
|
28
|
+
return e.setFullYear(e.getFullYear(), r + 1, 0), e.setHours(23, 59, 59, 999), e;
|
|
29
|
+
}
|
|
30
|
+
function Q(t) {
|
|
31
|
+
const e = l(t);
|
|
32
|
+
return +q(e) == +J(e);
|
|
33
|
+
}
|
|
34
|
+
function z(t, e) {
|
|
35
|
+
const r = l(t), n = l(e), i = M(r, n), c = Math.abs(
|
|
36
|
+
H(r, n)
|
|
37
|
+
);
|
|
38
|
+
let a;
|
|
39
|
+
if (c < 1)
|
|
40
|
+
a = 0;
|
|
41
|
+
else {
|
|
42
|
+
r.getMonth() === 1 && r.getDate() > 27 && r.setDate(30), r.setMonth(r.getMonth() - i * c);
|
|
43
|
+
let u = M(r, n) === -i;
|
|
44
|
+
Q(l(t)) && c === 1 && M(t, n) === 1 && (u = !1), a = i * (c - Number(u));
|
|
45
|
+
}
|
|
46
|
+
return a === 0 ? 0 : a;
|
|
47
|
+
}
|
|
48
|
+
function b(t, e, r) {
|
|
49
|
+
const n = K(t, e) / 1e3;
|
|
50
|
+
return v(r == null ? void 0 : r.roundingMethod)(n);
|
|
51
|
+
}
|
|
52
|
+
function o(t, e, r) {
|
|
53
|
+
const n = Y(), i = (r == null ? void 0 : r.locale) ?? n.locale ?? F, c = 2520, a = M(t, e);
|
|
54
|
+
if (isNaN(a))
|
|
55
|
+
throw new RangeError("Invalid time value");
|
|
56
|
+
const u = Object.assign({}, r, {
|
|
57
|
+
addSuffix: r == null ? void 0 : r.addSuffix,
|
|
58
|
+
comparison: a
|
|
59
|
+
});
|
|
60
|
+
let f, d;
|
|
61
|
+
a > 0 ? (f = l(e), d = l(t)) : (f = l(t), d = l(e));
|
|
62
|
+
const m = b(d, f), U = (T(d) - T(f)) / 1e3, s = Math.round((m - U) / 60);
|
|
63
|
+
let h;
|
|
64
|
+
if (s < 2)
|
|
65
|
+
return r != null && r.includeSeconds ? m < 5 ? i.formatDistance("lessThanXSeconds", 5, u) : m < 10 ? i.formatDistance("lessThanXSeconds", 10, u) : m < 20 ? i.formatDistance("lessThanXSeconds", 20, u) : m < 40 ? i.formatDistance("halfAMinute", 0, u) : m < 60 ? i.formatDistance("lessThanXMinutes", 1, u) : i.formatDistance("xMinutes", 1, u) : s === 0 ? i.formatDistance("lessThanXMinutes", 1, u) : i.formatDistance("xMinutes", s, u);
|
|
66
|
+
if (s < 45)
|
|
67
|
+
return i.formatDistance("xMinutes", s, u);
|
|
68
|
+
if (s < 90)
|
|
69
|
+
return i.formatDistance("aboutXHours", 1, u);
|
|
70
|
+
if (s < L) {
|
|
71
|
+
const g = Math.round(s / 60);
|
|
72
|
+
return i.formatDistance("aboutXHours", g, u);
|
|
73
|
+
} else {
|
|
74
|
+
if (s < c)
|
|
75
|
+
return i.formatDistance("xDays", 1, u);
|
|
76
|
+
if (s < y) {
|
|
77
|
+
const g = Math.round(s / L);
|
|
78
|
+
return i.formatDistance("xDays", g, u);
|
|
79
|
+
} else if (s < y * 2)
|
|
80
|
+
return h = Math.round(s / y), i.formatDistance("aboutXMonths", h, u);
|
|
81
|
+
}
|
|
82
|
+
if (h = z(d, f), h < 12) {
|
|
83
|
+
const g = Math.round(s / y);
|
|
84
|
+
return i.formatDistance("xMonths", g, u);
|
|
85
|
+
} else {
|
|
86
|
+
const g = h % 12, N = Math.trunc(h / 12);
|
|
87
|
+
return g < 3 ? i.formatDistance("aboutXYears", N, u) : g < 9 ? i.formatDistance("overXYears", N, u) : i.formatDistance("almostXYears", N + 1, u);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function p(t, e) {
|
|
91
|
+
return o(t, j(t), e);
|
|
92
|
+
}
|
|
93
|
+
function G(t) {
|
|
94
|
+
if (!t) return !1;
|
|
95
|
+
const e = t.toLowerCase().replace("_", "-");
|
|
96
|
+
return e === "en-in" || e.startsWith("en-in-");
|
|
97
|
+
}
|
|
98
|
+
function Z(t, e) {
|
|
99
|
+
const r = Math.abs(t);
|
|
100
|
+
return r >= 1e12 ? { divisor: 1e12, suffix: "T" } : r >= 1e9 ? { divisor: 1e9, suffix: "B" } : G(e) && r >= 1e7 ? { divisor: 1e7, suffix: "Cr" } : r >= 1e6 ? { divisor: 1e6, suffix: "M" } : G(e) && r >= 1e5 ? { divisor: 1e5, suffix: "L" } : r >= 1e3 ? { divisor: 1e3, suffix: "K" } : { divisor: 1, suffix: "" };
|
|
101
|
+
}
|
|
102
|
+
function $(t, e) {
|
|
103
|
+
try {
|
|
104
|
+
const r = D(e);
|
|
105
|
+
return Z(t, r);
|
|
106
|
+
} catch {
|
|
107
|
+
return Z(t, "en-US");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function ee(t) {
|
|
111
|
+
try {
|
|
112
|
+
return new Intl.NumberFormat(t), !0;
|
|
113
|
+
} catch {
|
|
114
|
+
return !1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function D(t) {
|
|
118
|
+
return t && ee(t) ? t : "en-US";
|
|
119
|
+
}
|
|
120
|
+
function x(t, e) {
|
|
121
|
+
if (t == null || isNaN(t))
|
|
122
|
+
return "";
|
|
123
|
+
const r = D(e == null ? void 0 : e.locale);
|
|
124
|
+
let n = t;
|
|
125
|
+
if (e != null && e.multiplyBy && (n *= e.multiplyBy), e != null && e.useSuffix) {
|
|
126
|
+
const { divisor: c, suffix: a } = $(n, r);
|
|
127
|
+
n = n / c;
|
|
128
|
+
const u = new Intl.NumberFormat(r, {
|
|
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(n);
|
|
133
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}${u}${a}${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
134
|
+
}
|
|
135
|
+
const i = new Intl.NumberFormat(r, {
|
|
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(n);
|
|
140
|
+
if (e != null && e.negativeInParentheses && n < 0) {
|
|
141
|
+
const c = i.replace("-", "");
|
|
142
|
+
return `(${(e == null ? void 0 : e.prefix) ?? ""}${c}${(e == null ? void 0 : e.suffix) ?? ""})`;
|
|
143
|
+
}
|
|
144
|
+
return `${(e == null ? void 0 : e.prefix) ?? ""}${i}${(e == null ? void 0 : e.suffix) ?? ""}`;
|
|
145
|
+
}
|
|
146
|
+
function V(t, e) {
|
|
147
|
+
if (t == null || isNaN(t))
|
|
148
|
+
return "";
|
|
149
|
+
const r = D(e == null ? void 0 : e.locale), n = (e == null ? void 0 : e.currency) || "USD", i = t < 0, c = !!(e != null && e.negativeInParentheses && i), a = c ? Math.abs(t) : t;
|
|
150
|
+
try {
|
|
151
|
+
if (e != null && e.useSuffix) {
|
|
152
|
+
const { divisor: f, suffix: d } = $(a, r), m = a / f, s = `${new Intl.NumberFormat(r, {
|
|
153
|
+
style: "currency",
|
|
154
|
+
currency: n,
|
|
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(m)}${d}`;
|
|
159
|
+
return c ? `(${s})` : s;
|
|
160
|
+
}
|
|
161
|
+
const u = new Intl.NumberFormat(r, {
|
|
162
|
+
style: "currency",
|
|
163
|
+
currency: n,
|
|
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(a);
|
|
168
|
+
return c ? `(${u})` : u;
|
|
169
|
+
} catch {
|
|
170
|
+
const u = Math.abs(t), f = e != null && e.useSuffix ? $(u, r) : { divisor: 1, suffix: "" }, d = x(
|
|
171
|
+
u / f.divisor,
|
|
172
|
+
{
|
|
173
|
+
locale: r,
|
|
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
|
+
), m = `${n} ${d}${f.suffix}`;
|
|
179
|
+
return i ? e != null && e.negativeInParentheses ? `(${m})` : `-${m}` : m;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function S(t, e) {
|
|
183
|
+
if (t == null || isNaN(t))
|
|
184
|
+
return "";
|
|
185
|
+
const r = D(e == null ? void 0 : e.locale), i = (e == null ? void 0 : e.alreadyPercent) ?? (e == null ? void 0 : e.percentValueMode) === "whole" ? t / 100 : t;
|
|
186
|
+
return new Intl.NumberFormat(r, {
|
|
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(i);
|
|
192
|
+
}
|
|
193
|
+
function P(t, e) {
|
|
194
|
+
if (t == null || isNaN(t))
|
|
195
|
+
return "";
|
|
196
|
+
const r = D(e == null ? void 0 : e.locale);
|
|
197
|
+
return new Intl.NumberFormat(r, {
|
|
198
|
+
notation: "scientific",
|
|
199
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
200
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
201
|
+
}).format(t);
|
|
202
|
+
}
|
|
203
|
+
function De(t, e, r = "en-US") {
|
|
204
|
+
if (t == null || isNaN(t))
|
|
205
|
+
return "";
|
|
206
|
+
const n = D((e == null ? void 0 : e.locale) || r), i = (e == null ? void 0 : e.style) || "decimal";
|
|
207
|
+
if (i === "percent") {
|
|
208
|
+
const a = ((e == null ? void 0 : e.percentValueMode) ?? "whole") === "whole" ? t / 100 : t;
|
|
209
|
+
return new Intl.NumberFormat(n, {
|
|
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(a);
|
|
215
|
+
}
|
|
216
|
+
return i === "currency" ? new Intl.NumberFormat(n, {
|
|
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(t) : i === "scientific" ? P(t, {
|
|
223
|
+
locale: n,
|
|
224
|
+
minimumFractionDigits: (e == null ? void 0 : e.minimumFractionDigits) ?? 0,
|
|
225
|
+
maximumFractionDigits: (e == null ? void 0 : e.maximumFractionDigits) ?? 2
|
|
226
|
+
}) : new Intl.NumberFormat(n, {
|
|
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(t);
|
|
231
|
+
}
|
|
232
|
+
function xe(t, e, r) {
|
|
233
|
+
const n = {
|
|
234
|
+
style: e === "currency" ? "currency" : e === "percent" ? "percent" : "decimal",
|
|
235
|
+
locale: r == null ? void 0 : r.locale,
|
|
236
|
+
currency: r == null ? void 0 : r.currency,
|
|
237
|
+
minimumFractionDigits: r == null ? void 0 : r.decimalPlaces,
|
|
238
|
+
maximumFractionDigits: r == null ? void 0 : r.decimalPlaces,
|
|
239
|
+
useSuffix: r == null ? void 0 : r.useSuffix,
|
|
240
|
+
prefix: r == null ? void 0 : r.prefix,
|
|
241
|
+
suffix: r == null ? void 0 : r.suffix,
|
|
242
|
+
negativeInParentheses: r == null ? void 0 : r.negativeInParentheses,
|
|
243
|
+
multiplyBy: r == null ? void 0 : r.multiplyBy
|
|
244
|
+
};
|
|
245
|
+
switch (e) {
|
|
246
|
+
case "currency":
|
|
247
|
+
return V(t, n);
|
|
248
|
+
case "percent":
|
|
249
|
+
return S(t, n);
|
|
250
|
+
case "scientific":
|
|
251
|
+
return P(t, n);
|
|
252
|
+
default:
|
|
253
|
+
return x(t, n);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const A = [
|
|
257
|
+
"day",
|
|
258
|
+
"hour",
|
|
259
|
+
"minute",
|
|
260
|
+
"second",
|
|
261
|
+
"millisecond"
|
|
262
|
+
], w = {
|
|
263
|
+
day: 864e5,
|
|
264
|
+
hour: 36e5,
|
|
265
|
+
minute: 6e4,
|
|
266
|
+
second: 1e3,
|
|
267
|
+
millisecond: 1
|
|
268
|
+
}, te = {
|
|
269
|
+
day: "d",
|
|
270
|
+
hour: "hr",
|
|
271
|
+
minute: "min",
|
|
272
|
+
second: "s",
|
|
273
|
+
millisecond: "ms"
|
|
274
|
+
}, re = {
|
|
275
|
+
day: ["day", "days"],
|
|
276
|
+
hour: ["hour", "hours"],
|
|
277
|
+
minute: ["minute", "minutes"],
|
|
278
|
+
second: ["second", "seconds"],
|
|
279
|
+
millisecond: ["millisecond", "milliseconds"]
|
|
280
|
+
};
|
|
281
|
+
function ne(t) {
|
|
282
|
+
return t === "day" || t === "hour" || t === "minute" || t === "second" || t === "millisecond";
|
|
283
|
+
}
|
|
284
|
+
function R(t, e) {
|
|
285
|
+
return ne(t) ? t : e;
|
|
286
|
+
}
|
|
287
|
+
function _(t, e) {
|
|
288
|
+
return A.indexOf(R(t, e));
|
|
289
|
+
}
|
|
290
|
+
function ie(t, e) {
|
|
291
|
+
const r = _(t, "day"), n = _(e, "second"), i = Math.min(r, n), c = Math.max(r, n);
|
|
292
|
+
return A.slice(i, c + 1);
|
|
293
|
+
}
|
|
294
|
+
function ce(t, e) {
|
|
295
|
+
return t * w[R(e, "second")];
|
|
296
|
+
}
|
|
297
|
+
function ue(t, e) {
|
|
298
|
+
const r = ie(e.largestUnit, e.smallestUnit), n = r[r.length - 1], i = w[n];
|
|
299
|
+
let c = Math.round(t / i) * i;
|
|
300
|
+
return r.map((a) => {
|
|
301
|
+
const u = w[a], f = Math.floor(c / u);
|
|
302
|
+
return c -= f * u, { unit: a, value: f };
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function ae(t, e) {
|
|
306
|
+
const r = t.filter((c) => c.value !== 0), n = r.length > 0 ? r : [t[t.length - 1]], i = typeof e == "number" && Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : n.length;
|
|
307
|
+
return n.slice(0, i).map((c) => `${c.value}${te[c.unit]}`).join(" ");
|
|
308
|
+
}
|
|
309
|
+
function fe(t, e) {
|
|
310
|
+
const r = t.filter((c) => c.value !== 0), n = r.length > 0 ? r : [t[t.length - 1]], i = typeof e == "number" && Number.isFinite(e) ? Math.max(1, Math.trunc(e)) : n.length;
|
|
311
|
+
return n.slice(0, i).map((c) => {
|
|
312
|
+
const [a, u] = re[c.unit];
|
|
313
|
+
return `${c.value} ${c.value === 1 ? a : u}`;
|
|
314
|
+
}).join(" ");
|
|
315
|
+
}
|
|
316
|
+
function se(t) {
|
|
317
|
+
const e = t.some(
|
|
318
|
+
(f) => f.unit === "day" && f.value !== 0
|
|
319
|
+
), r = t.some((f) => f.unit === "millisecond"), n = t.findIndex((f) => f.value !== 0), i = Math.max(0, t.length - 2), c = e ? 0 : n === -1 ? i : Math.min(n, i), a = n === -1 ? t.slice(i) : t.slice(c);
|
|
320
|
+
if (a.length === 0)
|
|
321
|
+
return "0";
|
|
322
|
+
const u = a.map((f, d) => f.unit === "millisecond" ? String(f.value).padStart(3, "0") : d === 0 ? String(f.value) : String(f.value).padStart(2, "0")).join(":");
|
|
323
|
+
return r ? u.replace(/:(\d{3})$/, ".$1") : u;
|
|
324
|
+
}
|
|
325
|
+
function le(t, e, r) {
|
|
326
|
+
const n = `${r.prefix || ""}${t}${r.suffix || ""}`;
|
|
327
|
+
return e ? r.negativeInParentheses ? `(${n})` : `-${n}` : n;
|
|
328
|
+
}
|
|
329
|
+
function me(t, e = {}) {
|
|
330
|
+
if (t == null)
|
|
331
|
+
return "";
|
|
332
|
+
const r = typeof t == "number" ? t : typeof t == "string" && t.trim() ? Number(t) : NaN;
|
|
333
|
+
if (!Number.isFinite(r))
|
|
334
|
+
return "";
|
|
335
|
+
const n = e.inputUnit || "second", i = e.outputStyle === "digital" || e.outputStyle === "long" ? e.outputStyle : "compact", c = r < 0, a = Math.abs(ce(r, n)), u = ue(a, e), f = i === "digital" ? se(u) : i === "long" ? fe(u, e.maxUnits) : ae(u, e.maxUnits);
|
|
336
|
+
return le(f, c, e);
|
|
337
|
+
}
|
|
338
|
+
function de(t, e, r) {
|
|
339
|
+
const n = t * (e.scale ?? 1), i = {
|
|
340
|
+
style: e.type === "number" ? "decimal" : e.type,
|
|
341
|
+
locale: e.locale ?? r,
|
|
342
|
+
currency: e.currency,
|
|
343
|
+
minimumFractionDigits: e.minimumFractionDigits,
|
|
344
|
+
maximumFractionDigits: e.maximumFractionDigits,
|
|
345
|
+
useGrouping: e.useGrouping,
|
|
346
|
+
percentValueMode: e.percentValueMode,
|
|
347
|
+
prefix: e.prefix,
|
|
348
|
+
suffix: e.suffix,
|
|
349
|
+
negativeInParentheses: e.negativeStyle === "parentheses",
|
|
350
|
+
useSuffix: e.compact
|
|
351
|
+
};
|
|
352
|
+
if (e.type === "currency") {
|
|
353
|
+
const c = V(n, i);
|
|
354
|
+
return `${e.prefix ?? ""}${c}${e.suffix ?? ""}`;
|
|
355
|
+
}
|
|
356
|
+
if (e.type === "percent") {
|
|
357
|
+
const c = S(n, i);
|
|
358
|
+
return `${e.prefix ?? ""}${c}${e.suffix ?? ""}`;
|
|
359
|
+
}
|
|
360
|
+
if (e.type === "scientific") {
|
|
361
|
+
const c = P(n, i);
|
|
362
|
+
return `${e.prefix ?? ""}${c}${e.suffix ?? ""}`;
|
|
363
|
+
}
|
|
364
|
+
return x(n, i);
|
|
365
|
+
}
|
|
366
|
+
function I(t, e, r) {
|
|
367
|
+
return t === null ? { value: t, text: null } : !e || e.type === "date" || e.type === "string" ? { value: t, text: x(t, { locale: r }) } : e.type === "duration" ? {
|
|
368
|
+
value: t,
|
|
369
|
+
text: me(t, {
|
|
370
|
+
inputUnit: e.inputUnit,
|
|
371
|
+
outputStyle: e.outputStyle,
|
|
372
|
+
largestUnit: e.largestUnit,
|
|
373
|
+
smallestUnit: e.smallestUnit,
|
|
374
|
+
maxUnits: e.maxUnits,
|
|
375
|
+
prefix: e.prefix,
|
|
376
|
+
suffix: e.suffix,
|
|
377
|
+
negativeInParentheses: e.negativeStyle === "parentheses"
|
|
378
|
+
})
|
|
379
|
+
} : { value: t, text: de(t, e, r) };
|
|
380
|
+
}
|
|
381
|
+
function C(t, e, r, n) {
|
|
382
|
+
return t === null ? { value: t, text: null } : n === "percent" ? {
|
|
383
|
+
value: t,
|
|
384
|
+
text: S(t, {
|
|
385
|
+
locale: r,
|
|
386
|
+
minimumFractionDigits: e,
|
|
387
|
+
maximumFractionDigits: e
|
|
388
|
+
})
|
|
389
|
+
} : {
|
|
390
|
+
value: t,
|
|
391
|
+
text: x(t, {
|
|
392
|
+
locale: r,
|
|
393
|
+
minimumFractionDigits: e,
|
|
394
|
+
maximumFractionDigits: e,
|
|
395
|
+
suffix: "×"
|
|
396
|
+
})
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function O(t, e) {
|
|
400
|
+
if (t === void 0) return e;
|
|
401
|
+
if (!Number.isInteger(t) || t < 0 || t > 6)
|
|
402
|
+
throw new RangeError("Comparison precision must be an integer from 0 to 6.");
|
|
403
|
+
return t;
|
|
404
|
+
}
|
|
405
|
+
function ye(t, e) {
|
|
406
|
+
const r = {
|
|
407
|
+
mode: e.displayMode,
|
|
408
|
+
current: I(
|
|
409
|
+
t.currentValue,
|
|
410
|
+
e.metricFormat,
|
|
411
|
+
e.locale
|
|
412
|
+
),
|
|
413
|
+
comparison: I(
|
|
414
|
+
t.comparisonValue,
|
|
415
|
+
e.metricFormat,
|
|
416
|
+
e.locale
|
|
417
|
+
)
|
|
418
|
+
};
|
|
419
|
+
return (e.displayMode === "difference" || e.displayMode === "both") && (r.difference = I(
|
|
420
|
+
t.delta,
|
|
421
|
+
e.metricFormat,
|
|
422
|
+
e.locale
|
|
423
|
+
)), (e.displayMode === "percent_change" || e.displayMode === "both") && (r.percentChange = C(
|
|
424
|
+
t.percentChange,
|
|
425
|
+
O(e.precision, 1),
|
|
426
|
+
e.locale,
|
|
427
|
+
"percent"
|
|
428
|
+
)), e.displayMode === "ratio" && (r.ratio = C(
|
|
429
|
+
t.ratio,
|
|
430
|
+
O(e.precision, 2),
|
|
431
|
+
e.locale,
|
|
432
|
+
"ratio"
|
|
433
|
+
)), r;
|
|
434
|
+
}
|
|
435
|
+
function Me(t, e) {
|
|
436
|
+
return t && t !== "auto" ? t : e;
|
|
437
|
+
}
|
|
438
|
+
function Ne(t, e = /* @__PURE__ */ new Date()) {
|
|
439
|
+
try {
|
|
440
|
+
const r = {
|
|
441
|
+
timeZone: t,
|
|
442
|
+
timeZoneName: "short"
|
|
443
|
+
}, i = new Intl.DateTimeFormat("en-US", r).formatToParts(e).find((c) => c.type === "timeZoneName");
|
|
444
|
+
return (i == null ? void 0 : i.value) || t;
|
|
445
|
+
} catch {
|
|
446
|
+
return t;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function Ie(t) {
|
|
450
|
+
try {
|
|
451
|
+
const e = {
|
|
452
|
+
timeZone: t,
|
|
453
|
+
timeZoneName: "long"
|
|
454
|
+
}, n = new Intl.DateTimeFormat("en-US", e).formatToParts(
|
|
455
|
+
/* @__PURE__ */ new Date()
|
|
456
|
+
).find((i) => i.type === "timeZoneName");
|
|
457
|
+
return (n == null ? void 0 : n.value) || t;
|
|
458
|
+
} catch {
|
|
459
|
+
return t;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function X(t, e = "auto") {
|
|
463
|
+
if (!t)
|
|
464
|
+
return /* @__PURE__ */ new Date(NaN);
|
|
465
|
+
const r = t.endsWith("Z"), n = /[+-]\d{2}:?\d{2}$/.test(t), i = /\([A-Z]{3,4}\)$/.test(t);
|
|
466
|
+
if (e === "auto")
|
|
467
|
+
return r || n || i ? new Date(t) : /* @__PURE__ */ new Date(t + "Z");
|
|
468
|
+
if (e === "local") {
|
|
469
|
+
if (r || n) {
|
|
470
|
+
const c = t.replace(/Z$/, "").replace(/[+-]\d{2}:?\d{2}$/, "");
|
|
471
|
+
return new Date(c);
|
|
472
|
+
}
|
|
473
|
+
return new Date(t);
|
|
474
|
+
} else return e === "UTC" ? r ? new Date(t) : n ? new Date(t) : /* @__PURE__ */ new Date(t + "Z") : r || n || i ? new Date(t) : k(t, e);
|
|
475
|
+
}
|
|
476
|
+
const ge = "MM/dd/yyyy", $e = (t, e, r, n = "auto") => {
|
|
477
|
+
if (!t)
|
|
478
|
+
return "";
|
|
479
|
+
try {
|
|
480
|
+
const i = X(t, n);
|
|
481
|
+
if (isNaN(i.getTime()))
|
|
482
|
+
return t;
|
|
483
|
+
const a = (e && e.trim() ? e : ge).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
|
|
484
|
+
return r && r !== "auto" ? E(i, r, a) : W(i, a);
|
|
485
|
+
} catch (i) {
|
|
486
|
+
return console.error("Date formatting error:", i), t;
|
|
487
|
+
}
|
|
488
|
+
}, we = (t, e = "auto") => {
|
|
489
|
+
if (!t)
|
|
490
|
+
return "";
|
|
491
|
+
try {
|
|
492
|
+
const r = X(t, e);
|
|
493
|
+
return isNaN(r.getTime()) ? t : p(r, { addSuffix: !0 });
|
|
494
|
+
} catch (r) {
|
|
495
|
+
return console.error("Relative time formatting error:", r), t;
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
export {
|
|
499
|
+
we as a,
|
|
500
|
+
$e as b,
|
|
501
|
+
V as c,
|
|
502
|
+
me as d,
|
|
503
|
+
ye as e,
|
|
504
|
+
De as f,
|
|
505
|
+
x as g,
|
|
506
|
+
xe as h,
|
|
507
|
+
S as i,
|
|
508
|
+
P as j,
|
|
509
|
+
Ne as k,
|
|
510
|
+
Ie as l,
|
|
511
|
+
p as m,
|
|
512
|
+
X as p,
|
|
513
|
+
Me as r
|
|
514
|
+
};
|