@logicplanes/kaeso-ui 0.4.2 → 0.4.3
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/NOTICE.md +1 -1
- package/ai/component-guides.md +283 -21
- package/ai/component-registry.json +528 -25
- package/ai/component-registry.md +135 -25
- package/ai/icons.md +3 -3
- package/ai/tokens.md +1 -1
- package/dist/blocks/delete-resource.js +15 -14
- package/dist/blocks/delete-resource.js.map +1 -1
- package/dist/blocks/pages.js +2 -2
- package/dist/blocks/resource-list.js +41 -40
- package/dist/blocks/resource-list.js.map +1 -1
- package/dist/chunks/agent-avatar-0pdBTWkR.js +171 -0
- package/dist/chunks/agent-avatar-0pdBTWkR.js.map +1 -0
- package/dist/chunks/{app-frame-C8csevkL.js → app-frame-DogGRmsu.js} +22 -21
- package/dist/chunks/app-frame-DogGRmsu.js.map +1 -0
- package/dist/chunks/{banner-Cb8OWnqJ.js → banner-BA2ALw9M.js} +2 -2
- package/dist/chunks/{banner-Cb8OWnqJ.js.map → banner-BA2ALw9M.js.map} +1 -1
- package/dist/chunks/{button-Dzu7_csE.js → button-CzuxqawA.js} +3 -3
- package/dist/chunks/{button-Dzu7_csE.js.map → button-CzuxqawA.js.map} +1 -1
- package/dist/chunks/{calendar--YemJsv4.js → calendar-BWaf2MXc.js} +57 -41
- package/dist/chunks/calendar-BWaf2MXc.js.map +1 -0
- package/dist/chunks/{checkbox-CDfC6E-M.js → checkbox-CQjwCPkc.js} +11 -9
- package/dist/chunks/checkbox-CQjwCPkc.js.map +1 -0
- package/dist/chunks/{code-block-U5fCqwgC.js → code-block-D5A-CGXG.js} +2 -2
- package/dist/chunks/{code-block-U5fCqwgC.js.map → code-block-D5A-CGXG.js.map} +1 -1
- package/dist/chunks/combobox-DjDI7SUC.js +319 -0
- package/dist/chunks/combobox-DjDI7SUC.js.map +1 -0
- package/dist/chunks/{command-list-0RR4DpUe.js → command-list-C2Y7V_lt.js} +2 -2
- package/dist/chunks/{command-list-0RR4DpUe.js.map → command-list-C2Y7V_lt.js.map} +1 -1
- package/dist/chunks/{copy-button-7-irieJw.js → copy-button-FJvPJn72.js} +3 -3
- package/dist/chunks/{copy-button-7-irieJw.js.map → copy-button-FJvPJn72.js.map} +1 -1
- package/dist/chunks/{core-Bl9NrBLS.js → core-BYns5ytV.js} +145 -139
- package/dist/chunks/core-BYns5ytV.js.map +1 -0
- package/dist/chunks/{date-popup-RQkqhko4.js → date-popup-CPA_zt6o.js} +4 -4
- package/dist/chunks/{date-popup-RQkqhko4.js.map → date-popup-CPA_zt6o.js.map} +1 -1
- package/dist/chunks/{de-BnNQtBSV.js → de-CPXJh9cq.js} +3 -1
- package/dist/chunks/de-CPXJh9cq.js.map +1 -0
- package/dist/chunks/dialog-Cg9A_6SF.js +383 -0
- package/dist/chunks/dialog-Cg9A_6SF.js.map +1 -0
- package/dist/chunks/icon-DVooQfk4.js +94 -0
- package/dist/chunks/icon-DVooQfk4.js.map +1 -0
- package/dist/chunks/{icon-button-CPYR21Sz.js → icon-button-CrdF_eMG.js} +3 -3
- package/dist/chunks/{icon-button-CPYR21Sz.js.map → icon-button-CrdF_eMG.js.map} +1 -1
- package/dist/chunks/{identity-DPuTkMsa.js → identity-BmhQ6BQ-.js} +15 -15
- package/dist/chunks/identity-BmhQ6BQ-.js.map +1 -0
- package/dist/chunks/{input-TyLIaQ5k.js → input-2VJuj_M4.js} +10 -5
- package/dist/chunks/input-2VJuj_M4.js.map +1 -0
- package/dist/chunks/{input-group-CUSNsQjQ.js → input-group-DQ_4DoXg.js} +2 -2
- package/dist/chunks/{input-group-CUSNsQjQ.js.map → input-group-DQ_4DoXg.js.map} +1 -1
- package/dist/chunks/{inset-BnBj8NJV.js → inset-BUzyXLK4.js} +14 -4
- package/dist/chunks/inset-BUzyXLK4.js.map +1 -0
- package/dist/chunks/{iso-field-CWbxlll-.js → iso-field-B2rTwiBo.js} +2 -2
- package/dist/chunks/{iso-field-CWbxlll-.js.map → iso-field-B2rTwiBo.js.map} +1 -1
- package/dist/chunks/{link-B2I55xg9.js → link-KWI7PevW.js} +2 -2
- package/dist/chunks/{link-B2I55xg9.js.map → link-KWI7PevW.js.map} +1 -1
- package/dist/chunks/link-provider-cvl8lSTT.js +29 -0
- package/dist/chunks/link-provider-cvl8lSTT.js.map +1 -0
- package/dist/chunks/{list-CkOozrVY.js → list-M1csq-d4.js} +18 -16
- package/dist/chunks/{list-CkOozrVY.js.map → list-M1csq-d4.js.map} +1 -1
- package/dist/chunks/{markdown-BEgwZFlu.js → markdown-DULktoTK.js} +5 -5
- package/dist/chunks/{markdown-BEgwZFlu.js.map → markdown-DULktoTK.js.map} +1 -1
- package/dist/chunks/{menu-fl_QQb38.js → menu-DEmBfdPm.js} +29 -26
- package/dist/chunks/menu-DEmBfdPm.js.map +1 -0
- package/dist/chunks/nav-sheet-CzgIwgAm.js +60 -0
- package/dist/chunks/nav-sheet-CzgIwgAm.js.map +1 -0
- package/dist/chunks/{page-header-DjUMDG69.js → page-header-DL2y2iZp.js} +2 -2
- package/dist/chunks/{page-header-DjUMDG69.js.map → page-header-DL2y2iZp.js.map} +1 -1
- package/dist/chunks/{pagination-BaY8jdli.js → pagination-Cn_qF4cg.js} +3 -3
- package/dist/chunks/{pagination-BaY8jdli.js.map → pagination-Cn_qF4cg.js.map} +1 -1
- package/dist/chunks/{picker-popover-DShea4b8.js → picker-popover-BxyU1U9F.js} +14 -13
- package/dist/chunks/{picker-popover-DShea4b8.js.map → picker-popover-BxyU1U9F.js.map} +1 -1
- package/dist/chunks/{popover-CFMwaeIP.js → popover-DNN4S47w.js} +2 -2
- package/dist/chunks/{popover-CFMwaeIP.js.map → popover-DNN4S47w.js.map} +1 -1
- package/dist/chunks/portal-context-BBbzDKmY.js.map +1 -1
- package/dist/chunks/{radio-Yl0nO-Sj.js → radio-CDDFpdtL.js} +4 -4
- package/dist/chunks/{radio-Yl0nO-Sj.js.map → radio-CDDFpdtL.js.map} +1 -1
- package/dist/chunks/{range-popup-CkhsK3wI.js → range-popup-CRyWYUB1.js} +5 -5
- package/dist/chunks/{range-popup-CkhsK3wI.js.map → range-popup-CRyWYUB1.js.map} +1 -1
- package/dist/chunks/{rights-BlQx9C_j.js → rights-Cyp0Pzp-.js} +5 -5
- package/dist/chunks/{rights-BlQx9C_j.js.map → rights-Cyp0Pzp-.js.map} +1 -1
- package/dist/chunks/{segmented-C97zvDR1.js → segmented-CErcoxwi.js} +2 -2
- package/dist/chunks/{segmented-C97zvDR1.js.map → segmented-CErcoxwi.js.map} +1 -1
- package/dist/chunks/{sidebar-DtFlejU7.js → sidebar-3r1ZRXlN.js} +253 -235
- package/dist/chunks/sidebar-3r1ZRXlN.js.map +1 -0
- package/dist/chunks/{sidebar-menu-CxQbGwyj.js → sidebar-menu-BN3jkTlK.js} +2 -2
- package/dist/chunks/{sidebar-menu-CxQbGwyj.js.map → sidebar-menu-BN3jkTlK.js.map} +1 -1
- package/dist/chunks/{switch-b-VkStWj.js → switch-BNMq_kGt.js} +2 -2
- package/dist/chunks/{switch-b-VkStWj.js.map → switch-BNMq_kGt.js.map} +1 -1
- package/dist/chunks/{tag-DNdX1XRR.js → tag-D_M1s2qS.js} +2 -2
- package/dist/chunks/{tag-DNdX1XRR.js.map → tag-D_M1s2qS.js.map} +1 -1
- package/dist/chunks/{text-DCGGNqTM.js → text-CIXH8rmT.js} +2 -2
- package/dist/chunks/{text-DCGGNqTM.js.map → text-CIXH8rmT.js.map} +1 -1
- package/dist/chunks/{textarea-CT2S2JVM.js → textarea--4FRL3Pb.js} +3 -3
- package/dist/chunks/{textarea-CT2S2JVM.js.map → textarea--4FRL3Pb.js.map} +1 -1
- package/dist/chunks/theme-provider-DJhORMlc.js.map +1 -1
- package/dist/chunks/{timeseries-B-8OfeZm.js → timeseries-D1xjRXfk.js} +2 -2
- package/dist/chunks/{timeseries-B-8OfeZm.js.map → timeseries-D1xjRXfk.js.map} +1 -1
- package/dist/chunks/{toolbar-DL6zVrzU.js → toolbar-WA_oZgu-.js} +5 -4
- package/dist/chunks/{toolbar-DL6zVrzU.js.map → toolbar-WA_oZgu-.js.map} +1 -1
- package/dist/chunks/tooltip-OcwO0VUT.js +154 -0
- package/dist/chunks/tooltip-OcwO0VUT.js.map +1 -0
- package/dist/chunks/{tooltip-root-BeAMXzxU.js → tooltip-root-DzahJDVj.js} +2 -2
- package/dist/chunks/{tooltip-root-BeAMXzxU.js.map → tooltip-root-DzahJDVj.js.map} +1 -1
- package/dist/chunks/{use-scroll-margin-DfdTc_5D.js → use-scroll-margin-atRtf0v_.js} +14 -10
- package/dist/chunks/use-scroll-margin-atRtf0v_.js.map +1 -0
- package/dist/chunks/{virtual-rows-yAMjeAwj.js → virtual-rows-CC_kc2PR.js} +2 -2
- package/dist/chunks/{virtual-rows-yAMjeAwj.js.map → virtual-rows-CC_kc2PR.js.map} +1 -1
- package/dist/chunks/{zh-CN-CKffAT7j.js → zh-CN-29X4CDLE.js} +3 -1
- package/dist/chunks/zh-CN-29X4CDLE.js.map +1 -0
- package/dist/components/agent-avatar.js +2 -0
- package/dist/components/app-frame.js +2 -2
- package/dist/components/banner.js +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/charts/bar.js +1 -1
- package/dist/components/charts/donut.js +1 -1
- package/dist/components/charts/gauge.js +1 -1
- package/dist/components/charts/sankey.js +1 -1
- package/dist/components/charts/timeseries.js +1 -1
- package/dist/components/charts.js +2 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code-block.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-list.js +2 -2
- package/dist/components/command-palette.js +85 -81
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.js +191 -187
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.js +6 -4
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/dialog.js +125 -91
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/display-options.js +49 -46
- package/dist/components/display-options.js.map +1 -1
- package/dist/components/filter-chip.js +3 -3
- package/dist/components/filter-chip.js.map +1 -1
- package/dist/components/filter-row.js +1 -1
- package/dist/components/icon-button.js +1 -1
- package/dist/components/icon.js +1 -1
- package/dist/components/input.js +49 -49
- package/dist/components/input.js.map +1 -1
- package/dist/components/kaeso/conversation.js +3 -3
- package/dist/components/kaeso/identity.js +1 -1
- package/dist/components/kaeso/moments.js +3 -3
- package/dist/components/kaeso/rights.js +1 -1
- package/dist/components/kaeso/usage.js +8 -8
- package/dist/components/kaeso/usage.js.map +1 -1
- package/dist/components/kaeso.js +263 -95
- package/dist/components/kaeso.js.map +1 -1
- package/dist/components/key-value.js +2 -2
- package/dist/components/link.js +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/markdown.js +1 -1
- package/dist/components/menu.js +2 -2
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/playground.js +27 -26
- package/dist/components/playground.js.map +1 -1
- package/dist/components/popover.js +12 -11
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/segmented.js +1 -1
- package/dist/components/settings.js +8 -8
- package/dist/components/settings.js.map +1 -1
- package/dist/components/sheet.js +2 -2
- package/dist/components/sidebar.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/tabs.js +22 -22
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/theme-menu.js +33 -30
- package/dist/components/theme-menu.js.map +1 -1
- package/dist/components/thumbnail.js +41 -0
- package/dist/components/thumbnail.js.map +1 -0
- package/dist/components/toast.js +96 -87
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toolbar.js +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/format.js.map +1 -1
- package/dist/i18n-provider.js +1 -1
- package/dist/index.js +89 -87
- package/dist/kaeso.css +3 -0
- package/dist/styles.css +1 -1
- package/dist/types/blocks/delete-resource/delete-resource.d.ts +2 -5
- package/dist/types/blocks/resource-list/resource-list.d.ts +1 -4
- package/dist/types/component-docs.d.ts +1 -1
- package/dist/types/components/agent-avatar/agent-avatar.d.ts +94 -0
- package/dist/types/components/agent-avatar/docs.d.ts +19 -0
- package/dist/types/components/agent-avatar/index.d.ts +3 -0
- package/dist/types/components/agent-avatar/model-name.d.ts +9 -0
- package/dist/types/components/agent-avatar/models.d.ts +4 -0
- package/dist/types/components/app-frame/app-frame.d.ts +3 -8
- package/dist/types/components/app-frame/nav-sheet.d.ts +2 -4
- package/dist/types/components/calendar/calendar.d.ts +1 -4
- package/dist/types/components/charts/core.d.ts +11 -18
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/combobox/combobox.d.ts +26 -2
- package/dist/types/components/command-list/picker-popover.d.ts +1 -4
- package/dist/types/components/command-palette/command-palette.d.ts +1 -4
- package/dist/types/components/data-table/data-table.d.ts +2 -1
- package/dist/types/components/data-table/docs.d.ts +1 -0
- package/dist/types/components/dialog/dialog.d.ts +7 -9
- package/dist/types/components/dialog/docs.d.ts +2 -0
- package/dist/types/components/dialog/scope.d.ts +2 -0
- package/dist/types/components/dialog/step-dialog.d.ts +38 -5
- package/dist/types/components/display-options/display-options.d.ts +2 -5
- package/dist/types/components/input/input.d.ts +23 -0
- package/dist/types/components/kaeso/client-button.d.ts +17 -0
- package/dist/types/components/kaeso/docs.d.ts +18 -0
- package/dist/types/components/kaeso/grant-summary.d.ts +12 -0
- package/dist/types/components/kaeso/identity.d.ts +2 -0
- package/dist/types/components/kaeso/index.d.ts +2 -0
- package/dist/types/components/kaeso/provider-picker.d.ts +5 -0
- package/dist/types/components/kaeso/usage.d.ts +2 -0
- package/dist/types/components/list/list.d.ts +4 -8
- package/dist/types/components/menu/docs.d.ts +8 -1
- package/dist/types/components/menu/menu.d.ts +19 -31
- package/dist/types/components/playground/parameter-panel.d.ts +1 -4
- package/dist/types/components/popover/hover-card.d.ts +2 -0
- package/dist/types/components/radio/docs.d.ts +15 -0
- package/dist/types/components/radio/radio.d.ts +2 -4
- package/dist/types/components/settings/settings.d.ts +2 -0
- package/dist/types/components/sidebar/sidebar.d.ts +13 -35
- package/dist/types/components/tabs/tabs.d.ts +15 -0
- package/dist/types/components/theme-menu/docs.d.ts +2 -0
- package/dist/types/components/theme-menu/theme-menu.d.ts +6 -5
- package/dist/types/components/thumbnail/docs.d.ts +10 -0
- package/dist/types/components/thumbnail/index.d.ts +1 -0
- package/dist/types/components/thumbnail/thumbnail.d.ts +26 -0
- package/dist/types/components/toast/toast.d.ts +5 -12
- package/dist/types/components/toolbar/toolbar.d.ts +1 -6
- package/dist/types/components/tooltip/tooltip.d.ts +2 -4
- package/dist/types/components/tooltip/trigger-props.d.ts +0 -1
- package/dist/types/format/index.d.ts +5 -5
- package/dist/types/hooks/use-scroll-margin.d.ts +1 -1
- package/dist/types/icons/groups.d.ts +2 -2
- package/dist/types/icons/vocabulary.d.ts +15 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/utils/inset.d.ts +4 -0
- package/dist/types/utils/link-provider.d.ts +1 -1
- package/dist/types/utils/merge-refs.d.ts +3 -0
- package/dist/types/utils/portal-context.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/foundations/shape.md +1 -1
- package/package.json +2 -2
- package/dist/chunks/app-frame-C8csevkL.js.map +0 -1
- package/dist/chunks/calendar--YemJsv4.js.map +0 -1
- package/dist/chunks/checkbox-CDfC6E-M.js.map +0 -1
- package/dist/chunks/combobox-BARyrpXH.js +0 -314
- package/dist/chunks/combobox-BARyrpXH.js.map +0 -1
- package/dist/chunks/core-Bl9NrBLS.js.map +0 -1
- package/dist/chunks/de-BnNQtBSV.js.map +0 -1
- package/dist/chunks/dialog-DQ9vZ7vr.js +0 -353
- package/dist/chunks/dialog-DQ9vZ7vr.js.map +0 -1
- package/dist/chunks/icon-CBzvyEqC.js +0 -91
- package/dist/chunks/icon-CBzvyEqC.js.map +0 -1
- package/dist/chunks/identity-DPuTkMsa.js.map +0 -1
- package/dist/chunks/input-TyLIaQ5k.js.map +0 -1
- package/dist/chunks/inset-BnBj8NJV.js.map +0 -1
- package/dist/chunks/link-provider-BsUxhZKG.js +0 -27
- package/dist/chunks/link-provider-BsUxhZKG.js.map +0 -1
- package/dist/chunks/menu-fl_QQb38.js.map +0 -1
- package/dist/chunks/nav-sheet-B2rNb8GB.js +0 -60
- package/dist/chunks/nav-sheet-B2rNb8GB.js.map +0 -1
- package/dist/chunks/sidebar-DtFlejU7.js.map +0 -1
- package/dist/chunks/tooltip-BMQ9BtPp.js +0 -151
- package/dist/chunks/tooltip-BMQ9BtPp.js.map +0 -1
- package/dist/chunks/use-scroll-margin-DfdTc_5D.js.map +0 -1
- package/dist/chunks/zh-CN-CKffAT7j.js.map +0 -1
package/dist/components/toast.js
CHANGED
|
@@ -6,26 +6,26 @@ import { t as r } from "../chunks/icon-D7ja-_Yk.js";
|
|
|
6
6
|
import { t as i } from "../chunks/observe-resize-DhxhmoyB.js";
|
|
7
7
|
import { r as a } from "../chunks/loader-DCfPndXa.js";
|
|
8
8
|
import { r as o } from "../chunks/swap-text-Dr0Irxz6.js";
|
|
9
|
-
import {
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { Alert02Icon as
|
|
12
|
-
import { Toast as
|
|
9
|
+
import { forwardRef as s, useLayoutEffect as c, useRef as l, useState as u } from "react";
|
|
10
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { Alert02Icon as m, AlertCircleIcon as h, Cancel01Icon as g, CheckmarkCircle02Icon as _, InformationCircleIcon as v } from "@hugeicons/core-free-icons";
|
|
12
|
+
import { Toast as y } from "@base-ui/react/toast";
|
|
13
13
|
//#region src/components/toast/toast.tsx
|
|
14
|
-
var
|
|
14
|
+
var b = { tone: {
|
|
15
15
|
neutral: { classes: "" },
|
|
16
16
|
success: { classes: "text-success" },
|
|
17
17
|
error: { classes: "text-danger" },
|
|
18
18
|
warning: { classes: "text-warning" },
|
|
19
19
|
info: { classes: "text-info" },
|
|
20
20
|
loading: { classes: "text-toast-fg-secondary" }
|
|
21
|
-
} },
|
|
22
|
-
success:
|
|
23
|
-
error:
|
|
24
|
-
warning:
|
|
25
|
-
info:
|
|
26
|
-
},
|
|
27
|
-
function
|
|
28
|
-
return
|
|
21
|
+
} }, x = { tone: "neutral" }, S = {
|
|
22
|
+
success: _,
|
|
23
|
+
error: h,
|
|
24
|
+
warning: m,
|
|
25
|
+
info: v
|
|
26
|
+
}, C = /* @__PURE__ */ y.createToastManager();
|
|
27
|
+
function w(e, t, n = {}) {
|
|
28
|
+
return C.add({
|
|
29
29
|
title: t,
|
|
30
30
|
type: e,
|
|
31
31
|
...n.description === void 0 ? {} : { description: n.description },
|
|
@@ -38,19 +38,19 @@ function C(e, t, n = {}) {
|
|
|
38
38
|
} } : {}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
var
|
|
42
|
-
success: (e, t) =>
|
|
43
|
-
error: (e, t) =>
|
|
44
|
-
warning: (e, t) =>
|
|
45
|
-
info: (e, t) =>
|
|
46
|
-
dismiss: (e) =>
|
|
41
|
+
var T = /* @__PURE__ */ Object.assign((e, t) => w("neutral", e, t), {
|
|
42
|
+
success: (e, t) => w("success", e, t),
|
|
43
|
+
error: (e, t) => w("error", e, t),
|
|
44
|
+
warning: (e, t) => w("warning", e, t),
|
|
45
|
+
info: (e, t) => w("info", e, t),
|
|
46
|
+
dismiss: (e) => C.close(e),
|
|
47
47
|
promise: (e, t) => {
|
|
48
48
|
let n = [
|
|
49
49
|
t.loading,
|
|
50
50
|
...typeof t.success == "string" ? [t.success] : [],
|
|
51
51
|
...typeof t.error == "string" ? [t.error] : []
|
|
52
52
|
];
|
|
53
|
-
return
|
|
53
|
+
return C.promise(e, {
|
|
54
54
|
loading: {
|
|
55
55
|
title: t.loading,
|
|
56
56
|
type: "loading",
|
|
@@ -71,63 +71,64 @@ var w = /* @__PURE__ */ Object.assign((e, t) => C("neutral", e, t), {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
function
|
|
75
|
-
return t === "neutral" ? null : /* @__PURE__ */
|
|
76
|
-
className: e("flex shrink-0",
|
|
77
|
-
children: t === "loading" ? /* @__PURE__ */
|
|
78
|
-
icon:
|
|
74
|
+
function E({ tone: t }) {
|
|
75
|
+
return t === "neutral" ? null : /* @__PURE__ */ f("span", {
|
|
76
|
+
className: e("flex shrink-0", b.tone[t].classes),
|
|
77
|
+
children: t === "loading" ? /* @__PURE__ */ f(a, { size: "sm" }) : /* @__PURE__ */ f(r, {
|
|
78
|
+
icon: S[t],
|
|
79
79
|
size: "sm"
|
|
80
80
|
})
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
var
|
|
84
|
-
function
|
|
85
|
-
let n =
|
|
86
|
-
return
|
|
83
|
+
var D = "relative flex min-h-44 max-w-560 items-center gap-10 bg-toast py-8 text-body font-medium text-toast-fg shadow-toast", O = "inline-flex h-32 shrink-0 cursor-pointer items-center rounded-pill bg-toast-action px-12 text-body font-medium text-toast-fg transition-control hover:bg-toast-action-hover focus-ring", k = "k-toast-close absolute -top-6 -left-6 inline-flex size-20 cursor-pointer items-center justify-center rounded-pill bg-toast text-toast-fg-secondary shadow-toast hover:text-toast-fg focus-ring";
|
|
84
|
+
function A(e, t) {
|
|
85
|
+
let n = l(null), [r, i] = u(!1);
|
|
86
|
+
return c(() => {
|
|
87
87
|
let e = n.current;
|
|
88
88
|
e && i(e.offsetHeight > 46);
|
|
89
89
|
}, [e, t]), [n, r];
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
let [
|
|
93
|
-
return /* @__PURE__ */
|
|
91
|
+
var j = /* @__PURE__ */ s(function({ tone: t = "neutral", title: i, description: a, action: o, closable: s, "data-force": c }, l) {
|
|
92
|
+
let [u, d] = A(i, a), m = n();
|
|
93
|
+
return /* @__PURE__ */ p("div", {
|
|
94
|
+
ref: l,
|
|
94
95
|
role: "status",
|
|
95
96
|
className: "k-toast-static relative w-max",
|
|
96
|
-
children: [/* @__PURE__ */
|
|
97
|
-
ref:
|
|
98
|
-
className: e(
|
|
97
|
+
children: [/* @__PURE__ */ p("div", {
|
|
98
|
+
ref: u,
|
|
99
|
+
className: e(D, d ? "rounded-toast" : "rounded-pill", t === "neutral" ? "pl-16" : "pl-14", o ? "pr-6" : "pr-16"),
|
|
99
100
|
children: [
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ f(E, { tone: t }),
|
|
102
|
+
/* @__PURE__ */ p("span", {
|
|
102
103
|
className: "min-w-0 text-pretty",
|
|
103
|
-
children: [i, a && /* @__PURE__ */
|
|
104
|
+
children: [i, a && /* @__PURE__ */ p("span", {
|
|
104
105
|
className: "font-regular text-toast-fg-secondary",
|
|
105
106
|
children: [" ", a]
|
|
106
107
|
})]
|
|
107
108
|
}),
|
|
108
|
-
o && /* @__PURE__ */
|
|
109
|
+
o && /* @__PURE__ */ f("button", {
|
|
109
110
|
type: "button",
|
|
110
|
-
className:
|
|
111
|
+
className: O,
|
|
111
112
|
children: o
|
|
112
113
|
})
|
|
113
114
|
]
|
|
114
|
-
}), s && /* @__PURE__ */
|
|
115
|
+
}), s && /* @__PURE__ */ f("button", {
|
|
115
116
|
type: "button",
|
|
116
|
-
"aria-label":
|
|
117
|
-
className:
|
|
117
|
+
"aria-label": m("toast.dismiss", "Dismiss"),
|
|
118
|
+
className: k,
|
|
118
119
|
"data-force": c ? `visible ${c}` : "visible",
|
|
119
|
-
children: /* @__PURE__ */
|
|
120
|
-
icon:
|
|
120
|
+
children: /* @__PURE__ */ f(r, {
|
|
121
|
+
icon: g,
|
|
121
122
|
size: "xs",
|
|
122
123
|
className: "size-12"
|
|
123
124
|
})
|
|
124
125
|
})]
|
|
125
126
|
});
|
|
126
|
-
}
|
|
127
|
-
process.env.NODE_ENV !== "production" && (
|
|
128
|
-
function
|
|
129
|
-
let
|
|
130
|
-
return
|
|
127
|
+
});
|
|
128
|
+
process.env.NODE_ENV !== "production" && (j.displayName = "ToastCapsule");
|
|
129
|
+
function M({ item: t, index: a, limit: s, onFrontWidth: l }) {
|
|
130
|
+
let u = n(), m = t.type ?? "neutral", h = t.data?.reserve, [_, v] = A(t.title, t.description);
|
|
131
|
+
return c(() => {
|
|
131
132
|
let e = _.current;
|
|
132
133
|
if (a !== 0 || !e) return;
|
|
133
134
|
let t = () => l(Math.round(e.offsetWidth));
|
|
@@ -136,7 +137,7 @@ function j({ item: t, index: a, limit: c, onFrontWidth: l }) {
|
|
|
136
137
|
a,
|
|
137
138
|
l,
|
|
138
139
|
_
|
|
139
|
-
]), /* @__PURE__ */
|
|
140
|
+
]), /* @__PURE__ */ p(y.Root, {
|
|
140
141
|
toast: t,
|
|
141
142
|
swipeDirection: [
|
|
142
143
|
"down",
|
|
@@ -145,69 +146,77 @@ function j({ item: t, index: a, limit: c, onFrontWidth: l }) {
|
|
|
145
146
|
],
|
|
146
147
|
className: "k-toast outline-none",
|
|
147
148
|
...a > 0 ? { "data-behind": "" } : {},
|
|
148
|
-
...a >=
|
|
149
|
-
children: [/* @__PURE__ */
|
|
149
|
+
...a >= s ? { "data-index-hidden": "" } : {},
|
|
150
|
+
children: [/* @__PURE__ */ f("div", {
|
|
150
151
|
ref: _,
|
|
151
|
-
className: e("k-toast-surface",
|
|
152
|
-
children: /* @__PURE__ */
|
|
152
|
+
className: e("k-toast-surface", D, v ? "rounded-toast" : "rounded-pill", m === "neutral" ? "pl-16" : "pl-14", t.actionProps ? "pr-6" : "pr-16"),
|
|
153
|
+
children: /* @__PURE__ */ p("div", {
|
|
153
154
|
className: "k-toast-content flex min-w-0 items-center gap-10",
|
|
154
155
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ f(E, { tone: m }),
|
|
157
|
+
/* @__PURE__ */ p("span", {
|
|
157
158
|
className: "min-w-0 text-pretty",
|
|
158
|
-
children: [
|
|
159
|
-
reserve:
|
|
159
|
+
children: [h ? /* @__PURE__ */ f(o, {
|
|
160
|
+
reserve: h,
|
|
160
161
|
align: "start",
|
|
161
|
-
children: /* @__PURE__ */
|
|
162
|
-
}) : /* @__PURE__ */
|
|
163
|
-
render: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ f(y.Title, { render: /* @__PURE__ */ f("span", {}) })
|
|
163
|
+
}) : /* @__PURE__ */ f(y.Title, { render: /* @__PURE__ */ f("span", {}) }), t.description && /* @__PURE__ */ p(d, { children: [" ", /* @__PURE__ */ f(y.Description, {
|
|
164
|
+
render: /* @__PURE__ */ f("span", {}),
|
|
164
165
|
className: "font-regular text-toast-fg-secondary"
|
|
165
166
|
})] })]
|
|
166
167
|
}),
|
|
167
|
-
t.actionProps && /* @__PURE__ */
|
|
168
|
+
t.actionProps && /* @__PURE__ */ f(y.Action, { className: O })
|
|
168
169
|
]
|
|
169
170
|
})
|
|
170
|
-
}), /* @__PURE__ */
|
|
171
|
-
"aria-label":
|
|
172
|
-
className:
|
|
173
|
-
children: /* @__PURE__ */
|
|
174
|
-
icon:
|
|
171
|
+
}), /* @__PURE__ */ f(y.Close, {
|
|
172
|
+
"aria-label": u("toast.dismiss", "Dismiss"),
|
|
173
|
+
className: k,
|
|
174
|
+
children: /* @__PURE__ */ f(r, {
|
|
175
|
+
icon: g,
|
|
175
176
|
size: "xs",
|
|
176
177
|
className: "size-12"
|
|
177
178
|
})
|
|
178
179
|
})]
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
-
let { toasts:
|
|
183
|
-
return /* @__PURE__ */
|
|
182
|
+
function N({ limit: e, viewportRef: r }) {
|
|
183
|
+
let { toasts: i } = y.useToastManager(), a = i.filter((e) => e.transitionStatus !== "ending"), [o, s] = u(0), c = n();
|
|
184
|
+
return /* @__PURE__ */ f(y.Portal, {
|
|
184
185
|
container: t(),
|
|
185
|
-
children: /* @__PURE__ */
|
|
186
|
-
|
|
186
|
+
children: /* @__PURE__ */ f(y.Viewport, {
|
|
187
|
+
ref: r,
|
|
188
|
+
"aria-label": c("toast.notifications", "Notifications"),
|
|
187
189
|
className: "fixed right-0 bottom-24 left-0 z-60 mx-auto h-0 w-full toast-viewport-width outline-none",
|
|
188
|
-
style: { "--k-front-width":
|
|
189
|
-
children:
|
|
190
|
+
style: { "--k-front-width": o ? `${o}px` : "auto" },
|
|
191
|
+
children: i.map((t) => /* @__PURE__ */ f(M, {
|
|
190
192
|
item: t,
|
|
191
|
-
index: Math.max(0,
|
|
193
|
+
index: Math.max(0, a.indexOf(t)),
|
|
192
194
|
limit: e,
|
|
193
|
-
onFrontWidth:
|
|
195
|
+
onFrontWidth: s
|
|
194
196
|
}, t.id))
|
|
195
197
|
})
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
|
-
|
|
199
|
-
return /* @__PURE__ */
|
|
200
|
-
toastManager:
|
|
200
|
+
var P = /* @__PURE__ */ s(function({ limit: e = 3, timeout: t = 5e3 }, n) {
|
|
201
|
+
return /* @__PURE__ */ f(y.Provider, {
|
|
202
|
+
toastManager: C,
|
|
201
203
|
limit: e,
|
|
202
204
|
timeout: t,
|
|
203
|
-
children: /* @__PURE__ */
|
|
205
|
+
children: /* @__PURE__ */ f(N, {
|
|
206
|
+
limit: e,
|
|
207
|
+
viewportRef: n
|
|
208
|
+
})
|
|
204
209
|
});
|
|
205
|
-
}
|
|
206
|
-
process.env.NODE_ENV !== "production" && (
|
|
207
|
-
var
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
|
|
210
|
+
});
|
|
211
|
+
process.env.NODE_ENV !== "production" && (P.displayName = "Toaster");
|
|
212
|
+
var F = /* @__PURE__ */ Object.assign(/* @__PURE__ */ s(function(e, t) {
|
|
213
|
+
return /* @__PURE__ */ f(P, {
|
|
214
|
+
ref: t,
|
|
215
|
+
...e
|
|
216
|
+
});
|
|
217
|
+
}), { add: T });
|
|
218
|
+
process.env.NODE_ENV !== "production" && (F.displayName = "Toast");
|
|
210
219
|
//#endregion
|
|
211
|
-
export {
|
|
220
|
+
export { x as KAESO_TOAST_DEFAULT_VARIANTS, b as KAESO_TOAST_VARIANTS, F as Toast, j as ToastCapsule, P as Toaster, T as toast, C as toastManager };
|
|
212
221
|
|
|
213
222
|
//# sourceMappingURL=toast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["__icon_CheckmarkCircle02Icon","__icon_AlertCircleIcon","__icon_Alert02Icon","__icon_InformationCircleIcon","__icon_Cancel01Icon","BaseToast","_Fragment","cn","usePortalContainer","useUiText","Icon","observeResize","Spinner","SwapText","Fragment$1","Toast$1","KAESO_TOAST_VARIANTS","KAESO_TOAST_DEFAULT_VARIANTS","ICON","CheckmarkCircle02Icon","AlertCircleIcon","Alert02Icon","InformationCircleIcon","toastManager","add","tone","o","toast","title","id","reserve","m","p","v","ToneIcon","SURFACE","ACTION","CLOSE","useMultiline","ref","useRef","multi","setMulti","useState","useLayoutEffect","el","description","ToastCapsule","force","t","action","closable","Cancel01Icon","ToastItem","item","index","report","onFrontWidth","limit","List","live","toasts","frontWidth","setFrontWidth","Toaster","Toast","props"],"sources":["../../src/components/toast/toast.tsx"],"sourcesContent":["import { useLayoutEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { usePortalContainer } from \"../../utils/portal-context.js\";\nimport { observeResize } from \"../../utils/observe-resize.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { CheckmarkCircle02Icon as __icon_CheckmarkCircle02Icon, AlertCircleIcon as __icon_AlertCircleIcon, Alert02Icon as __icon_Alert02Icon, InformationCircleIcon as __icon_InformationCircleIcon, Cancel01Icon as __icon_Cancel01Icon } from \"@hugeicons/core-free-icons\";\nimport { Icon } from \"../icon/icon.js\";\nimport { Spinner } from \"../loader/loader.js\";\nimport { SwapText } from \"../swap-text/swap-text.js\";\nimport { useUiText } from \"../../i18n/context.js\";\n\nexport const KAESO_TOAST_VARIANTS = {\n tone: {\n neutral: { classes: \"\" },\n success: { classes: \"text-success\" },\n error: { classes: \"text-danger\" },\n warning: { classes: \"text-warning\" },\n info: { classes: \"text-info\" },\n loading: { classes: \"text-toast-fg-secondary\" },\n },\n} as const;\nexport const KAESO_TOAST_DEFAULT_VARIANTS = { tone: \"neutral\" } as const;\ntype Tone = keyof typeof KAESO_TOAST_VARIANTS.tone;\n\nconst ICON = { success: __icon_CheckmarkCircle02Icon, error: __icon_AlertCircleIcon, warning: __icon_Alert02Icon, info: __icon_InformationCircleIcon } as const;\n\nexport const toastManager = /* @__PURE__ */ BaseToast.createToastManager();\n\nexport interface ToastOptions {\n description?: ReactNode | undefined;\n action?: { label: string; onClick: () => void } | undefined;\n timeout?: number | undefined;\n id?: string | undefined;\n}\n\ninterface ToastData {\n reserve?: ReactNode[] | undefined;\n}\n\nfunction add(tone: Tone, title: ReactNode, o: ToastOptions = {}) {\n return toastManager.add({\n title,\n type: tone,\n ...(o.description !== undefined ? { description: o.description } : {}),\n ...(o.timeout !== undefined ? { timeout: o.timeout } : {}),\n ...(o.id ? { id: o.id } : {}),\n ...(tone === \"error\" ? { priority: \"high\" as const } : {}),\n ...(o.action ? { actionProps: { children: o.action.label, onClick: o.action.onClick } } : {}),\n });\n}\n\nexport const toast = /* @__PURE__ */ Object.assign((title: ReactNode, o?: ToastOptions) => add(\"neutral\", title, o), {\n success: (title: ReactNode, o?: ToastOptions) => add(\"success\", title, o),\n error: (title: ReactNode, o?: ToastOptions) => add(\"error\", title, o),\n warning: (title: ReactNode, o?: ToastOptions) => add(\"warning\", title, o),\n info: (title: ReactNode, o?: ToastOptions) => add(\"info\", title, o),\n dismiss: (id?: string) => toastManager.close(id),\n promise: <T,>(p: Promise<T>, m: { loading: string; success: string | ((v: T) => string); error: string | ((e: unknown) => string) }) => {\n const reserve = [m.loading, ...(typeof m.success === \"string\" ? [m.success] : []), ...(typeof m.error === \"string\" ? [m.error] : [])];\n return toastManager.promise(p, {\n loading: { title: m.loading, type: \"loading\", timeout: 0, data: { reserve } },\n success: (v: T) => ({ title: typeof m.success === \"function\" ? m.success(v) : m.success, type: \"success\", data: { reserve } }),\n error: (e: unknown) => ({ title: typeof m.error === \"function\" ? m.error(e) : m.error, type: \"error\", priority: \"high\", data: { reserve } }),\n });\n },\n});\n\nfunction ToneIcon({ tone }: { tone: Tone }) {\n if (tone === \"neutral\") return null;\n return (\n <span className={cn(\"flex shrink-0\", KAESO_TOAST_VARIANTS.tone[tone].classes)}>\n {tone === \"loading\" ? <Spinner size=\"sm\" /> : <Icon icon={ICON[tone]} size=\"sm\" />}\n </span>\n );\n}\n\nconst SURFACE = \"relative flex min-h-44 max-w-560 items-center gap-10 bg-toast py-8 text-body font-medium text-toast-fg shadow-toast\";\nconst ACTION =\n \"inline-flex h-32 shrink-0 cursor-pointer items-center rounded-pill bg-toast-action px-12 text-body font-medium text-toast-fg transition-control hover:bg-toast-action-hover focus-ring\";\nconst CLOSE =\n \"k-toast-close absolute -top-6 -left-6 inline-flex size-20 cursor-pointer items-center justify-center rounded-pill bg-toast text-toast-fg-secondary shadow-toast hover:text-toast-fg focus-ring\";\n\nfunction useMultiline(title: ReactNode, description: ReactNode) {\n const ref = useRef<HTMLDivElement>(null);\n const [multi, setMulti] = useState(false);\n useLayoutEffect(() => {\n const el = ref.current;\n if (el) setMulti(el.offsetHeight > 46);\n }, [title, description]);\n return [ref, multi] as const;\n}\n\nexport function ToastCapsule({\n tone = \"neutral\",\n title,\n description,\n action,\n closable,\n \"data-force\": force,\n}: {\n tone?: Tone | undefined;\n title: ReactNode;\n description?: ReactNode | undefined;\n action?: string | undefined;\n closable?: boolean | undefined;\n \"data-force\"?: string | undefined;\n}) {\n const [ref, multi] = useMultiline(title, description);\n const t = useUiText();\n return (\n <div role=\"status\" className=\"k-toast-static relative w-max\">\n <div ref={ref} className={cn(SURFACE, multi ? \"rounded-toast\" : \"rounded-pill\", tone === \"neutral\" ? \"pl-16\" : \"pl-14\", action ? \"pr-6\" : \"pr-16\")}>\n <ToneIcon tone={tone} />\n <span className=\"min-w-0 text-pretty\">\n {title}\n {description && <span className=\"font-regular text-toast-fg-secondary\"> {description}</span>}\n </span>\n {action && (\n <button type=\"button\" className={ACTION}>\n {action}\n </button>\n )}\n </div>\n {closable && (\n <button type=\"button\" aria-label={t(\"toast.dismiss\", \"Dismiss\")} className={CLOSE} data-force={force ? `visible ${force}` : \"visible\"}>\n <Icon icon={__icon_Cancel01Icon} size=\"xs\" className=\"size-12\" />\n </button>\n )}\n </div>\n );\n}\nif (process.env.NODE_ENV !== \"production\") ToastCapsule.displayName = \"ToastCapsule\";\n\ntype ManagedToast = ReturnType<typeof BaseToast.useToastManager>[\"toasts\"][number];\n\nfunction ToastItem({ item, index, limit, onFrontWidth }: { item: ManagedToast; index: number; limit: number; onFrontWidth: (w: number) => void }) {\n const t = useUiText();\n const tone = ((item.type as Tone) ?? \"neutral\") as Tone;\n const reserve = (item.data as ToastData | undefined)?.reserve;\n const [ref, multi] = useMultiline(item.title, item.description);\n useLayoutEffect(() => {\n const el = ref.current;\n if (index !== 0 || !el) return;\n const report = () => onFrontWidth(Math.round(el.offsetWidth));\n report();\n return observeResize([el], report);\n }, [index, onFrontWidth, ref]);\n return (\n <BaseToast.Root\n toast={item}\n swipeDirection={[\"down\", \"left\", \"right\"]}\n className=\"k-toast outline-none\"\n {...(index > 0 ? { \"data-behind\": \"\" } : {})}\n {...(index >= limit ? { \"data-index-hidden\": \"\" } : {})}\n >\n <div\n ref={ref}\n className={cn(\n \"k-toast-surface\",\n SURFACE,\n multi ? \"rounded-toast\" : \"rounded-pill\",\n tone === \"neutral\" ? \"pl-16\" : \"pl-14\",\n item.actionProps ? \"pr-6\" : \"pr-16\",\n )}\n >\n <div className=\"k-toast-content flex min-w-0 items-center gap-10\">\n <ToneIcon tone={tone} />\n <span className=\"min-w-0 text-pretty\">\n {reserve ? (\n <SwapText reserve={reserve} align=\"start\">\n <BaseToast.Title render={<span />} />\n </SwapText>\n ) : (\n <BaseToast.Title render={<span />} />\n )}\n {item.description && (\n <>\n {\" \"}\n <BaseToast.Description render={<span />} className=\"font-regular text-toast-fg-secondary\" />\n </>\n )}\n </span>\n {item.actionProps && <BaseToast.Action className={ACTION} />}\n </div>\n </div>\n <BaseToast.Close aria-label={t(\"toast.dismiss\", \"Dismiss\")} className={CLOSE}>\n <Icon icon={__icon_Cancel01Icon} size=\"xs\" className=\"size-12\" />\n </BaseToast.Close>\n </BaseToast.Root>\n );\n}\n\nfunction List({ limit }: { limit: number }) {\n const { toasts } = BaseToast.useToastManager();\n const live = toasts.filter((item) => item.transitionStatus !== \"ending\");\n const [frontWidth, setFrontWidth] = useState(0);\n const t = useUiText();\n return (\n <BaseToast.Portal container={usePortalContainer()}>\n <BaseToast.Viewport\n aria-label={t(\"toast.notifications\", \"Notifications\")}\n className=\"fixed right-0 bottom-24 left-0 z-60 mx-auto h-0 w-full toast-viewport-width outline-none\"\n style={{ [\"--k-front-width\" as string]: frontWidth ? `${frontWidth}px` : \"auto\" }}\n >\n {toasts.map((item) => (\n <ToastItem key={item.id} item={item} index={Math.max(0, live.indexOf(item))} limit={limit} onFrontWidth={setFrontWidth} />\n ))}\n </BaseToast.Viewport>\n </BaseToast.Portal>\n );\n}\n\nexport function Toaster({ limit = 3, timeout = 5000 }: { limit?: number | undefined; timeout?: number | undefined }) {\n return (\n <BaseToast.Provider toastManager={toastManager} limit={limit} timeout={timeout}>\n <List limit={limit} />\n </BaseToast.Provider>\n );\n}\nif (process.env.NODE_ENV !== \"production\") Toaster.displayName = \"Toaster\";\n\nexport const Toast = /* @__PURE__ */ Object.assign(\n function Toast(props: { limit?: number | undefined; timeout?: number | undefined }) {\n return <Toaster {...props} />;\n },\n { add: toast },\n);\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAagB,IAAuB,EAClC,MAAM;CACJ,SAAS,EAAE,SAAS,GAAG;CACvB,SAAS,EAAE,SAAS,eAAe;CACnC,OAAO,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qB,QAAQ,GACjE,CAACQ,GAAYC,KAAiBpB,EAAS,CAAC,GACxCM,IAAIxC,EAAU;CACpB,OACE,kBAACJ,EAAU,QAAX;EAAkB,WAAWG,EAAmB;EAC9C,UAAA,kBAACH,EAAU,UAAX;GACE,cAAY4C,EAAE,uBAAuB,eAAe;GACpD,WAAU;GACV,OAAO,EAAG,mBAA8Ba,IAAa,GAAGA,EAAW,MAAM,OAAO;GAE/E,UAAAD,EAAO,KAAK,MACX,kBAACR,GAAD;IAA+B;IAAM,OAAO,KAAK,IAAI,GAAGO,EAAK,QAAQN,CAAI,CAAC;IAAU;IAAO,cAAcS;GAAgB,GAAzGT,EAAK,EAAoG,CAC1H;EACiB,CAAA;CACJ,CAAA;AAEtB;AAEA,SAAgBU,EAAQ,EAAE,WAAQ,GAAG,aAAU,OAAsE;CACnH,OACE,kBAAC3D,EAAU,UAAX;EAAkC;EAAqB;EAAgB;EACrE,UAAA,kBAACsD,GAAD,EAAa,SAAQ,CAAA;CACH,CAAA;AAExB;AACA,QAAA,IAAA,aAA6B,iBAAc,EAAQ,cAAc;AAEjE,IAAaM,IAAwB,uBAAO,OAC1C,SAAe,GAAqE;CAClF,OAAO,kBAACD,GAAD,EAAS,GAAIE,EAAQ,CAAA;AAC9B,GACA,EAAE,KAAKvC,EAAM,CACf"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["__icon_CheckmarkCircle02Icon","__icon_AlertCircleIcon","__icon_Alert02Icon","__icon_InformationCircleIcon","__icon_Cancel01Icon","BaseToast","_Fragment","cn","usePortalContainer","useUiText","Icon","observeResize","Spinner","SwapText","Fragment$1","Toast$1","KAESO_TOAST_VARIANTS","KAESO_TOAST_DEFAULT_VARIANTS","ICON","CheckmarkCircle02Icon","AlertCircleIcon","Alert02Icon","InformationCircleIcon","toastManager","add","tone","o","toast","title","id","reserve","m","p","v","ToneIcon","SURFACE","ACTION","CLOSE","useMultiline","ref","useRef","multi","setMulti","useState","useLayoutEffect","el","description","ToastCapsule","force","surface","t","action","closable","Cancel01Icon","ToastItem","item","index","report","onFrontWidth","limit","List","live","toasts","frontWidth","setFrontWidth","viewportRef","Toaster","Toast","props"],"sources":["../../src/components/toast/toast.tsx"],"sourcesContent":["import { forwardRef, useLayoutEffect, useRef, useState, type ReactNode, type Ref } from \"react\";\nimport { Toast as BaseToast } from \"@base-ui/react/toast\";\nimport { usePortalContainer } from \"../../utils/portal-context.js\";\nimport { observeResize } from \"../../utils/observe-resize.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { CheckmarkCircle02Icon as __icon_CheckmarkCircle02Icon, AlertCircleIcon as __icon_AlertCircleIcon, Alert02Icon as __icon_Alert02Icon, InformationCircleIcon as __icon_InformationCircleIcon, Cancel01Icon as __icon_Cancel01Icon } from \"@hugeicons/core-free-icons\";\nimport { Icon } from \"../icon/icon.js\";\nimport { Spinner } from \"../loader/loader.js\";\nimport { SwapText } from \"../swap-text/swap-text.js\";\nimport { useUiText } from \"../../i18n/context.js\";\n\nexport const KAESO_TOAST_VARIANTS = {\n tone: {\n neutral: { classes: \"\" },\n success: { classes: \"text-success\" },\n error: { classes: \"text-danger\" },\n warning: { classes: \"text-warning\" },\n info: { classes: \"text-info\" },\n loading: { classes: \"text-toast-fg-secondary\" },\n },\n} as const;\nexport const KAESO_TOAST_DEFAULT_VARIANTS = { tone: \"neutral\" } as const;\ntype Tone = keyof typeof KAESO_TOAST_VARIANTS.tone;\n\nconst ICON = { success: __icon_CheckmarkCircle02Icon, error: __icon_AlertCircleIcon, warning: __icon_Alert02Icon, info: __icon_InformationCircleIcon } as const;\n\nexport const toastManager = /* @__PURE__ */ BaseToast.createToastManager();\n\nexport interface ToastOptions {\n description?: ReactNode | undefined;\n action?: { label: string; onClick: () => void } | undefined;\n timeout?: number | undefined;\n id?: string | undefined;\n}\n\ninterface ToastData {\n reserve?: ReactNode[] | undefined;\n}\n\nfunction add(tone: Tone, title: ReactNode, o: ToastOptions = {}) {\n return toastManager.add({\n title,\n type: tone,\n ...(o.description !== undefined ? { description: o.description } : {}),\n ...(o.timeout !== undefined ? { timeout: o.timeout } : {}),\n ...(o.id ? { id: o.id } : {}),\n ...(tone === \"error\" ? { priority: \"high\" as const } : {}),\n ...(o.action ? { actionProps: { children: o.action.label, onClick: o.action.onClick } } : {}),\n });\n}\n\nexport const toast = /* @__PURE__ */ Object.assign((title: ReactNode, o?: ToastOptions) => add(\"neutral\", title, o), {\n success: (title: ReactNode, o?: ToastOptions) => add(\"success\", title, o),\n error: (title: ReactNode, o?: ToastOptions) => add(\"error\", title, o),\n warning: (title: ReactNode, o?: ToastOptions) => add(\"warning\", title, o),\n info: (title: ReactNode, o?: ToastOptions) => add(\"info\", title, o),\n dismiss: (id?: string) => toastManager.close(id),\n promise: <T,>(p: Promise<T>, m: { loading: string; success: string | ((v: T) => string); error: string | ((e: unknown) => string) }) => {\n const reserve = [m.loading, ...(typeof m.success === \"string\" ? [m.success] : []), ...(typeof m.error === \"string\" ? [m.error] : [])];\n return toastManager.promise(p, {\n loading: { title: m.loading, type: \"loading\", timeout: 0, data: { reserve } },\n success: (v: T) => ({ title: typeof m.success === \"function\" ? m.success(v) : m.success, type: \"success\", data: { reserve } }),\n error: (e: unknown) => ({ title: typeof m.error === \"function\" ? m.error(e) : m.error, type: \"error\", priority: \"high\", data: { reserve } }),\n });\n },\n});\n\nfunction ToneIcon({ tone }: { tone: Tone }) {\n if (tone === \"neutral\") return null;\n return (\n <span className={cn(\"flex shrink-0\", KAESO_TOAST_VARIANTS.tone[tone].classes)}>\n {tone === \"loading\" ? <Spinner size=\"sm\" /> : <Icon icon={ICON[tone]} size=\"sm\" />}\n </span>\n );\n}\n\nconst SURFACE = \"relative flex min-h-44 max-w-560 items-center gap-10 bg-toast py-8 text-body font-medium text-toast-fg shadow-toast\";\nconst ACTION =\n \"inline-flex h-32 shrink-0 cursor-pointer items-center rounded-pill bg-toast-action px-12 text-body font-medium text-toast-fg transition-control hover:bg-toast-action-hover focus-ring\";\nconst CLOSE =\n \"k-toast-close absolute -top-6 -left-6 inline-flex size-20 cursor-pointer items-center justify-center rounded-pill bg-toast text-toast-fg-secondary shadow-toast hover:text-toast-fg focus-ring\";\n\nfunction useMultiline(title: ReactNode, description: ReactNode) {\n const ref = useRef<HTMLDivElement>(null);\n const [multi, setMulti] = useState(false);\n useLayoutEffect(() => {\n const el = ref.current;\n if (el) setMulti(el.offsetHeight > 46);\n }, [title, description]);\n return [ref, multi] as const;\n}\n\nexport interface ToastCapsuleProps {\n tone?: Tone | undefined;\n title: ReactNode;\n description?: ReactNode | undefined;\n action?: string | undefined;\n closable?: boolean | undefined;\n \"data-force\"?: string | undefined;\n}\n\nexport const ToastCapsule = /* @__PURE__ */ forwardRef<HTMLDivElement, ToastCapsuleProps>(function ToastCapsule(\n { tone = \"neutral\", title, description, action, closable, \"data-force\": force },\n ref,\n) {\n const [surface, multi] = useMultiline(title, description);\n const t = useUiText();\n return (\n <div ref={ref} role=\"status\" className=\"k-toast-static relative w-max\">\n <div ref={surface} className={cn(SURFACE, multi ? \"rounded-toast\" : \"rounded-pill\", tone === \"neutral\" ? \"pl-16\" : \"pl-14\", action ? \"pr-6\" : \"pr-16\")}>\n <ToneIcon tone={tone} />\n <span className=\"min-w-0 text-pretty\">\n {title}\n {description && <span className=\"font-regular text-toast-fg-secondary\"> {description}</span>}\n </span>\n {action && (\n <button type=\"button\" className={ACTION}>\n {action}\n </button>\n )}\n </div>\n {closable && (\n <button type=\"button\" aria-label={t(\"toast.dismiss\", \"Dismiss\")} className={CLOSE} data-force={force ? `visible ${force}` : \"visible\"}>\n <Icon icon={__icon_Cancel01Icon} size=\"xs\" className=\"size-12\" />\n </button>\n )}\n </div>\n );\n});\nif (process.env.NODE_ENV !== \"production\") ToastCapsule.displayName = \"ToastCapsule\";\n\ntype ManagedToast = ReturnType<typeof BaseToast.useToastManager>[\"toasts\"][number];\n\nfunction ToastItem({ item, index, limit, onFrontWidth }: { item: ManagedToast; index: number; limit: number; onFrontWidth: (w: number) => void }) {\n const t = useUiText();\n const tone = ((item.type as Tone) ?? \"neutral\") as Tone;\n const reserve = (item.data as ToastData | undefined)?.reserve;\n const [ref, multi] = useMultiline(item.title, item.description);\n useLayoutEffect(() => {\n const el = ref.current;\n if (index !== 0 || !el) return;\n const report = () => onFrontWidth(Math.round(el.offsetWidth));\n report();\n return observeResize([el], report);\n }, [index, onFrontWidth, ref]);\n return (\n <BaseToast.Root\n toast={item}\n swipeDirection={[\"down\", \"left\", \"right\"]}\n className=\"k-toast outline-none\"\n {...(index > 0 ? { \"data-behind\": \"\" } : {})}\n {...(index >= limit ? { \"data-index-hidden\": \"\" } : {})}\n >\n <div\n ref={ref}\n className={cn(\n \"k-toast-surface\",\n SURFACE,\n multi ? \"rounded-toast\" : \"rounded-pill\",\n tone === \"neutral\" ? \"pl-16\" : \"pl-14\",\n item.actionProps ? \"pr-6\" : \"pr-16\",\n )}\n >\n <div className=\"k-toast-content flex min-w-0 items-center gap-10\">\n <ToneIcon tone={tone} />\n <span className=\"min-w-0 text-pretty\">\n {reserve ? (\n <SwapText reserve={reserve} align=\"start\">\n <BaseToast.Title render={<span />} />\n </SwapText>\n ) : (\n <BaseToast.Title render={<span />} />\n )}\n {item.description && (\n <>\n {\" \"}\n <BaseToast.Description render={<span />} className=\"font-regular text-toast-fg-secondary\" />\n </>\n )}\n </span>\n {item.actionProps && <BaseToast.Action className={ACTION} />}\n </div>\n </div>\n <BaseToast.Close aria-label={t(\"toast.dismiss\", \"Dismiss\")} className={CLOSE}>\n <Icon icon={__icon_Cancel01Icon} size=\"xs\" className=\"size-12\" />\n </BaseToast.Close>\n </BaseToast.Root>\n );\n}\n\nfunction List({ limit, viewportRef }: { limit: number; viewportRef: Ref<HTMLDivElement> }) {\n const { toasts } = BaseToast.useToastManager();\n const live = toasts.filter((item) => item.transitionStatus !== \"ending\");\n const [frontWidth, setFrontWidth] = useState(0);\n const t = useUiText();\n return (\n <BaseToast.Portal container={usePortalContainer()}>\n <BaseToast.Viewport\n ref={viewportRef}\n aria-label={t(\"toast.notifications\", \"Notifications\")}\n className=\"fixed right-0 bottom-24 left-0 z-60 mx-auto h-0 w-full toast-viewport-width outline-none\"\n style={{ [\"--k-front-width\" as string]: frontWidth ? `${frontWidth}px` : \"auto\" }}\n >\n {toasts.map((item) => (\n <ToastItem key={item.id} item={item} index={Math.max(0, live.indexOf(item))} limit={limit} onFrontWidth={setFrontWidth} />\n ))}\n </BaseToast.Viewport>\n </BaseToast.Portal>\n );\n}\n\nexport interface ToasterProps {\n limit?: number | undefined;\n timeout?: number | undefined;\n}\n\nexport const Toaster = /* @__PURE__ */ forwardRef<HTMLDivElement, ToasterProps>(function Toaster({ limit = 3, timeout = 5000 }, ref) {\n return (\n <BaseToast.Provider toastManager={toastManager} limit={limit} timeout={timeout}>\n <List limit={limit} viewportRef={ref} />\n </BaseToast.Provider>\n );\n});\nif (process.env.NODE_ENV !== \"production\") Toaster.displayName = \"Toaster\";\n\nexport const Toast = /* @__PURE__ */ Object.assign(\n /* @__PURE__ */ forwardRef<HTMLDivElement, ToasterProps>(function Toast(props, ref) {\n return <Toaster ref={ref} {...props} />;\n }),\n { add: toast },\n);\nif (process.env.NODE_ENV !== \"production\") Toast.displayName = \"Toast\";\n"],"mappings":";;;;;;;;;;;;;AAWA,IAAagB,IAAuB,EAClC,MAAM;CACJ,SAAS,EAAE,SAAS,GAAG;CACvB,SAAS,EAAE,SAAS,eAAe;CACnC,OAAO,EAAE,SAAS,cAAc;CAChC,SAAS,EAAE,SAAS,eAAe;CACnC,MAAM,EAAE,SAAS,YAAY;CAC7B,SAAS,EAAE,SAAS,0BAA0B;AAChD,EACF,GACaC,IAA+B,EAAE,MAAM,UAAU,GAGxDC,IAAO;CAAE,SAASlB;CAA8B,OAAOC;CAAwB,SAASC;CAAoB,MAAMC;AAA6B,GAExIoB,IAA+B,kBAAU,mBAAmB;AAazE,SAASC,EAAI,GAAY,GAAkB,IAAkB,CAAC,GAAG;CAC/D,OAAOD,EAAa,IAAI;EACtB;EACA,MA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,MACX,kBAACR,GAAD;IAA+B;IAAM,OAAO,KAAK,IAAI,GAAGO,EAAK,QAAQN,CAAI,CAAC;IAAU;IAAO,cAAcS;GAAgB,GAAzGT,EAAK,EAAoG,CAC1H;EACiB,CAAA;CACJ,CAAA;AAEtB;AAOA,IAAaW,IAA0B,kBAAyC,SAAiB,EAAE,WAAQ,GAAG,aAAU,OAAQ,GAAK;CACnI,OACE,kBAAC7D,EAAU,UAAX;EAAkC;EAAqB;EAAgB;EACrE,UAAA,kBAACuD,GAAD;GAAa;GAAO,aAAarB;EAAM,CAAA;CACrB,CAAA;AAExB,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAQ,cAAc;AAEjE,IAAa4B,IAAwB,uBAAO,OAC1B,kBAAyC,SAAe,GAAO,GAAK;CAClF,OAAO,kBAACD,GAAD;EAAc;EAAK,GAAIE;CAAQ,CAAA;AACxC,CAAC,GACD,EAAE,KAAKzC,EAAM,CACf;AACA,QAAA,IAAA,aAA6B,iBAAc,EAAM,cAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { t as KAESO_TOOLBAR_DEFAULT_VARIANTS, n as KAESO_TOOLBAR_VARIANTS, r as Toolbar } from "../chunks/toolbar-
|
|
2
|
+
export { t as KAESO_TOOLBAR_DEFAULT_VARIANTS, n as KAESO_TOOLBAR_VARIANTS, r as Toolbar } from "../chunks/toolbar-WA_oZgu-.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { i as e, n as t, r as n, t as r } from "../chunks/tooltip-
|
|
2
|
+
import { i as e, n as t, r as n, t as r } from "../chunks/tooltip-OcwO0VUT.js";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
import { Tooltip as a } from "@base-ui/react/tooltip";
|
|
5
5
|
//#region src/components/tooltip/tooltip-provider.tsx
|
package/dist/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","names":["formatMessage","current","words","zone","setFormatLocale","locale","messages","t","key","english","values","formatLocale","setFormatTimeZone","timeZone","formatTimeZone","inZone","numberLocale","formatNumber","options","value","COMPACT","nativeCompact","abbreviated","text","formatTokens","compact","thousands","promoted","formatContext","binary","tokens","k","unit","formatBytes","units","v","bytes","i","digits","formatPercent","ratio","groupThousands","int","formatUSD","writeUSD","amount","localUSD","smallest","formatPrice","frac","m","parts","part","p","type","at","before","gap","space","number","symbol","significant","match","negative","intPart","sign","n","scaled","str","whole","lead","take","kept","cents","two","formatDuration","ms","places","secondsTo","seconds","total","min","s","minutes","toDate","d","dateFormats","dateFormatter","zoned","format","day","month","f","formatDate","formatDateRange","a","from","b","to","withYear","start","pad2","formatISODate","parseISODate","y","mo","formatRelative","diff","now","abs","future","count","year"],"sources":["../src/format/index.ts"],"sourcesContent":["import { formatMessage, type MessageValues } from \"../i18n/message.js\";\n\nlet current = \"en\";\nlet words: Readonly<Record<string, string>> = {};\nlet zone: string | undefined;\n\nexport function setFormatLocale(locale: string, messages: Readonly<Record<string, string>> = {}): void {\n current = locale;\n words = messages;\n}\n\nconst t = (key: string, english: string, values?: MessageValues) => formatMessage(words[key] ?? english, values, current);\n\nexport function formatLocale(): string {\n return current;\n}\n\nexport function setFormatTimeZone(timeZone: string | undefined): void {\n if (!timeZone) {\n zone = undefined;\n return;\n }\n try {\n new Intl.DateTimeFormat(\"en\", { timeZone });\n zone = timeZone;\n } catch {\n zone = undefined;\n }\n}\n\nexport function formatTimeZone(): string | undefined {\n return zone;\n}\n\nconst inZone = (): { timeZone?: string } => (zone ? { timeZone: zone } : {});\n\nconst numberLocale = () => (current === \"en\" ? \"en-US\" : current);\n\n// CLDR's en-GB writes September alone with four letters (\"Sept\"), which breaks a column of three-letter months.\nexport function formatNumber(value: number, options: Intl.NumberFormatOptions = {}): string {\n return new Intl.NumberFormat(numberLocale(), { maximumFractionDigits: 2, ...options }).format(value);\n}\n\nconst COMPACT = { maximumFractionDigits: 1, maximumSignificantDigits: 3, roundingPriority: \"morePrecision\" } as const;\n\nconst nativeCompact = (value: number) => new Intl.NumberFormat(numberLocale(), { notation: \"compact\", ...COMPACT }).format(value);\nconst abbreviated = (text: string) => /\\p{L}/u.test(text);\n\nexport function formatTokens(value: number): string {\n if (Math.abs(value) < 1000) return formatNumber(value, { maximumFractionDigits: 0 });\n const compact = nativeCompact(value);\n // German and Chinese have no short form below a million and ten thousand, so 793,640 would stand in full beside 2.89 million.\n if (abbreviated(compact)) return compact;\n const thousands = Number(new Intl.NumberFormat(\"en-US\", { ...COMPACT, useGrouping: false }).format(value / 1000));\n const promoted = nativeCompact(thousands * 1000);\n if (abbreviated(promoted)) return promoted;\n return t(\"format.thousands\", \"{value}K\", { value: formatNumber(thousands, COMPACT) });\n}\n\n/** A model's context or output limit as models are named: a multiple of 1,024 in binary thousands (\"128K\" for 131,072, \"1M\" for 1,048,576), anything else in decimal ones (\"128K\" for 128,000, \"200K\"). */\nexport function formatContext(tokens: number): string {\n const binary = tokens % 1000 !== 0 && tokens % 1024 === 0;\n const k = binary ? tokens / 1024 : tokens / 1000;\n const unit = binary ? 1024 : 1000;\n if (tokens < 1000) return formatNumber(tokens, { maximumFractionDigits: 0 });\n if (k >= unit) return `${formatNumber(k / unit, { maximumFractionDigits: 1 })}M`;\n return `${formatNumber(k, { maximumFractionDigits: k < 10 ? 1 : 0 })}K`;\n}\n\nexport function formatBytes(bytes: number): string {\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n let v = bytes;\n let i = 0;\n while (Math.abs(v) >= 1024 && i < units.length - 1) {\n v /= 1024;\n i++;\n }\n const digits = i === 0 || v >= 100 ? 0 : 1;\n return `${formatNumber(v, { minimumFractionDigits: digits, maximumFractionDigits: digits, useGrouping: false })} ${units[i]}`;\n}\n\nexport function formatPercent(ratio: number, digits = 1): string {\n return new Intl.NumberFormat(numberLocale(), { style: \"percent\", maximumFractionDigits: digits }).format(ratio);\n}\n\nfunction groupThousands(int: string): string {\n return int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n}\n\nexport function formatUSD(amount: string, options: { significant?: number; decimals?: number } = {}): string {\n const text = writeUSD(amount, options);\n if (options.decimals === undefined || !/^\\s*-?\\d*\\.?\\d*[1-9]/.test(amount) || /[1-9]/.test(text)) return localUSD(text);\n const smallest = localUSD(`$${options.decimals ? `0.${\"1\".padStart(options.decimals, \"0\")}` : \"1\"}`);\n return /^\\s*-/.test(amount) ? `>\\u00a0−${smallest}` : `<\\u00a0${smallest}`;\n}\n\n/** A price per million tokens, exactly as set: at least two decimals and up to six (\"$0.075\", \"$4.00\", \"$1.25\"). */\nexport function formatPrice(amount: string): string {\n const frac = /\\.(\\d*?)0*\\s*$/.exec(amount)?.[1] ?? \"\";\n return formatUSD(amount, { decimals: Math.min(6, Math.max(2, frac.length)) });\n}\n\nfunction localUSD(text: string): string {\n const m = /^(−?)\\$([\\d,]+)(?:\\.(\\d+))?$/.exec(text);\n if (current === \"en\" || current.startsWith(\"zh\") || !m) return text;\n const parts = new Intl.NumberFormat(numberLocale(), { style: \"currency\", currency: \"USD\" }).formatToParts(1000.5);\n const part = (type: string) => parts.find((p) => p.type === type)?.value;\n const at = parts.findIndex((p) => p.type === \"currency\");\n const before = at < parts.findIndex((p) => p.type === \"integer\");\n const gap = parts[before ? at + 1 : at - 1];\n const space = gap?.type === \"literal\" ? gap.value : \"\";\n const number = (m[2] ?? \"\").replace(/,/g, part(\"group\") ?? \",\") + (m[3] ? `${part(\"decimal\") ?? \".\"}${m[3]}` : \"\");\n const symbol = part(\"currency\") ?? \"$\";\n return before ? `${m[1]}${symbol}${space}${number}` : `${m[1]}${number}${space}${symbol}`;\n}\n\nfunction writeUSD(amount: string, options: { significant?: number; decimals?: number }): string {\n const significant = options.significant ?? 3;\n const match = /^\\s*(-)?(\\d*)(?:\\.(\\d*))?\\s*$/.exec(amount);\n if (!match) return amount;\n const negative = match[1] === \"-\";\n const intPart = (match[2] ?? \"\").replace(/^0+(?=\\d)/, \"\") || \"0\";\n const frac = match[3] ?? \"\";\n const sign = negative ? \"−\" : \"\";\n if (options.decimals !== undefined) {\n const n = options.decimals;\n const digits = (intPart + frac.padEnd(n + 1, \"0\").slice(0, n + 1)).replace(/^0+(?=\\d)/, \"\");\n let scaled = BigInt(digits.slice(0, -1) || \"0\");\n if (Number(digits.slice(-1)) >= 5) scaled += 1n;\n const str = scaled.toString().padStart(n + 1, \"0\");\n const whole = str.slice(0, str.length - n) || \"0\";\n const isZero = scaled === 0n;\n return `${negative && !isZero ? sign : \"\"}$${groupThousands(whole)}${n ? `.${str.slice(-n)}` : \"\"}`;\n }\n if (intPart === \"0\" && /^0{2}/.test(frac.padEnd(2, \"0\")) && /[1-9]/.test(frac)) {\n let lead = frac.match(/^0*/)?.[0].length ?? 0;\n const take = frac.slice(lead, lead + significant + 1).padEnd(significant + 1, \"0\");\n let kept = BigInt(take.slice(0, significant));\n if (Number(take[significant]) >= 5) kept += 1n;\n let digits = kept.toString().padStart(significant, \"0\");\n if (digits.length > significant) {\n lead -= 1;\n digits = digits.slice(0, significant);\n }\n if (lead < 2) return `${sign}$0.${\"0\".repeat(Math.max(0, lead))}${digits}`.replace(/^(−?\\$0\\.\\d{2})\\d*$/, \"$1\");\n return `${sign}$0.${\"0\".repeat(lead)}${digits}`;\n }\n const cents = frac.padEnd(3, \"0\");\n let whole = BigInt(intPart);\n let two = Number(cents.slice(0, 2));\n if (Number(cents[2]) >= 5) two += 1;\n if (two === 100) {\n two = 0;\n whole += 1n;\n }\n const isZero = whole === 0n && two === 0;\n return `${negative && !isZero ? sign : \"\"}$${groupThousands(whole.toString())}.${String(two).padStart(2, \"0\")}`;\n}\n\nexport function formatDuration(ms: number, options: { precise?: boolean | undefined } = {}): string {\n const whole = Math.round(ms);\n if (whole < 1000) return t(\"format.milliseconds\", \"{ms} ms\", { ms: String(whole) });\n const places = options.precise ? 2 : 1;\n const secondsTo = (digits: number) => Math.round(ms / 10 ** (3 - digits)) / 10 ** digits;\n const seconds = (digits: number) =>\n t(\"format.seconds\", \"{s} s\", {\n s: formatNumber(secondsTo(digits), { minimumFractionDigits: options.precise ? digits : 0, maximumFractionDigits: digits }),\n });\n if (secondsTo(places) < 10) return seconds(places);\n if (secondsTo(places - 1) < 60) return seconds(places - 1);\n const total = secondsTo(0);\n if (total < 3600) {\n const min = Math.floor(total / 60);\n const s = total % 60;\n return s ? t(\"format.minutesSeconds\", \"{min} min {s} s\", { min: String(min), s: String(s) }) : t(\"format.minutes\", \"{min} min\", { min: String(min) });\n }\n const minutes = Math.round(ms / 60_000);\n return t(\"format.hoursMinutes\", \"{h} h {min} min\", { h: String(Math.floor(minutes / 60)), min: String(minutes % 60) });\n}\n\ntype DateInput = Date | string | number;\nconst toDate = (d: DateInput) => (d instanceof Date ? d : new Date(d));\n\nconst dateFormats = new Map<string, (d: Date) => string>();\n\n/** A cached date formatter in the format locale. English writes the day first with three-letter months (\"20 Sep 2026\", \"Mon 21 Sep\"), the console's English everywhere. */\nexport function dateFormatter(options: Intl.DateTimeFormatOptions, locale: string = current): (value: DateInput) => string {\n // A cached formatter keeps the zone it was made in, so the viewer's zone is part of the key.\n const zoned = options.timeZone ? options : { ...options, timeZone: new Intl.DateTimeFormat().resolvedOptions().timeZone };\n const key = `${locale}|${JSON.stringify(zoned)}`;\n let format = dateFormats.get(key);\n if (!format) {\n if (locale === \"en\") {\n const day = new Intl.DateTimeFormat(\"en-GB\", zoned);\n const month = zoned.month === \"short\" ? new Intl.DateTimeFormat(\"en-US\", { month: \"short\", timeZone: zoned.timeZone }) : null;\n format = (d) =>\n day\n .formatToParts(d)\n .map((p) => (p.type === \"month\" && month ? month.format(d) : p.type === \"weekday\" ? p.value.replace(/,$/, \"\") : p.value))\n .join(\"\");\n } else {\n const f = new Intl.DateTimeFormat(locale, zoned);\n format = (d) => f.format(d);\n }\n dateFormats.set(key, format);\n }\n return (value) => format(toDate(value));\n}\n\nexport function formatDate(value: DateInput, options: { time?: boolean; utc?: boolean; seconds?: boolean } = {}): string {\n const f = dateFormatter({\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n ...(options.time ? { hour: \"2-digit\", minute: \"2-digit\", ...(options.seconds ? { second: \"2-digit\" } : {}), hourCycle: \"h23\" } : {}),\n ...(options.utc ? { timeZone: \"UTC\" } : inZone()),\n });\n return `${f(value)}${options.utc ? \" UTC\" : \"\"}`;\n}\n\nexport function formatDateRange(from: DateInput, to: DateInput): string {\n const a = toDate(from);\n const b = toDate(to);\n const f = dateFormatter({ day: \"numeric\", month: \"short\" });\n const withYear = dateFormatter({ day: \"numeric\", month: \"short\", year: \"numeric\" });\n if (a.getFullYear() !== b.getFullYear()) return `${withYear(a)} – ${withYear(b)}`;\n const start = f(a);\n return a.toDateString() === b.toDateString() ? start : `${start} – ${f(b)}`;\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, \"0\");\n\nexport function formatISODate(value: DateInput, options: { utc?: boolean | undefined } = {}): string {\n const d = toDate(value);\n if (options.utc) return d.toISOString().slice(0, 10);\n return `${String(d.getFullYear()).padStart(4, \"0\")}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n}\n\nexport function parseISODate(text: string): Date | null {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text.trim());\n if (!m) return null;\n const [y, mo, day] = [Number(m[1]), Number(m[2]) - 1, Number(m[3])];\n const d = new Date(2000, 0, 1);\n d.setFullYear(y, mo, day);\n return d.getFullYear() === y && d.getMonth() === mo && d.getDate() === day ? d : null;\n}\n\nexport function formatRelative(value: DateInput, now: DateInput = Date.now()): string {\n const d = toDate(value);\n const diff = toDate(now).getTime() - d.getTime();\n const abs = Math.abs(diff);\n const future = diff < 0;\n if (abs < 45_000) return t(\"format.justNow\", \"just now\");\n if (abs < 3_600_000) {\n const count = Math.round(abs / 60_000);\n return future ? t(\"format.inMinutes\", \"in {count} min\", { count }) : t(\"format.minutesAgo\", \"{count} min ago\", { count });\n }\n if (abs < 86_400_000) {\n const count = Math.round(abs / 3_600_000);\n return future ? t(\"format.inHours\", \"in {count} h\", { count }) : t(\"format.hoursAgo\", \"{count} h ago\", { count });\n }\n if (abs < 172_800_000 && !future) return t(\"format.yesterday\", \"yesterday\");\n if (abs < 7 * 86_400_000) {\n const count = Math.round(abs / 86_400_000);\n return future\n ? t(\"format.inDays\", \"{count, plural, one {in # day} other {in # days}}\", { count })\n : t(\"format.daysAgo\", \"{count, plural, one {# day ago} other {# days ago}}\", { count });\n }\n const year = dateFormatter({ year: \"numeric\", ...inZone() }, \"en\");\n return dateFormatter({\n day: \"numeric\",\n month: \"short\",\n ...inZone(),\n ...(year(d) !== year(toDate(now)) ? { year: \"numeric\" } : {}),\n })(d);\n}\n"],"mappings":";;AAEA,IAAIC,IAAU,MACVC,IAA0C,CAAC,GAC3CC;AAEJ,SAAgBC,EAAgB,GAAgB,IAA6C,CAAC,GAAS;CAErG,AADA,IAAUC,GACV,IAAQC;AACV;AAEA,IAAMC,KAAK,GAAa,GAAiB,MAA2BP,EAAcE,EAAMM,MAAQC,GAASC,GAAQT,CAAO;AAExH,SAAgBU,IAAuB;CACrC,OAAOV;AACT;AAEA,SAAgBW,EAAkB,GAAoC;CACpE,IAAI,CAACC,GACH,IAAO,KAAA;MAGT,IAAI;EAEF,AADA,IAAI,KAAK,eAAe,MAAM,EAAE,YAAS,CAAC,GAC1C,IAAOA;CACT,QAAQ;EACN,IAAO,KAAA;CACT;AACF;AAEA,SAAgBC,IAAqC;CACnD,OAAOX;AACT;AAEA,IAAMY,UAAuCZ,IAAO,EAAE,UAAUA,EAAK,IAAI,CAAC,GAEpEa,UAAsBf,MAAY,OAAO,UAAUA;AAGzD,SAAgBgB,EAAa,GAAe,IAAoC,CAAC,GAAW;CAC1F,OAAO,IAAI,KAAK,aAAaD,EAAa,GAAG;EAAE,uBAAuB;EAAG,GAAGE;CAAQ,CAAC,CAAC,CAAC,OAAOC,CAAK;AACrG;AAEA,IAAMC,IAAU;CAAE,uBAAuB;CAAG,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3,"file":"format.js","names":["formatMessage","current","words","zone","setFormatLocale","locale","messages","t","key","english","values","formatLocale","setFormatTimeZone","timeZone","formatTimeZone","inZone","numberLocale","formatNumber","options","value","COMPACT","nativeCompact","abbreviated","text","formatTokens","compact","thousands","promoted","formatContext","binary","tokens","k","unit","formatBytes","units","v","bytes","i","digits","formatPercent","ratio","groupThousands","int","formatUSD","writeUSD","amount","localUSD","smallest","formatPrice","frac","m","parts","part","p","type","at","before","gap","space","number","symbol","significant","match","negative","intPart","sign","n","scaled","str","whole","lead","take","kept","cents","two","formatDuration","ms","places","secondsTo","seconds","total","min","s","minutes","toDate","d","dateFormats","dateFormatter","zoned","format","day","month","f","formatDate","formatDateRange","a","from","b","to","withYear","start","pad2","formatISODate","parseISODate","y","mo","formatRelative","diff","now","abs","future","count","year"],"sources":["../src/format/index.ts"],"sourcesContent":["import { formatMessage, type MessageValues } from \"../i18n/message.js\";\n\nlet current = \"en\";\nlet words: Readonly<Record<string, string>> = {};\nlet zone: string | undefined;\n\nexport function setFormatLocale(locale: string, messages: Readonly<Record<string, string>> = {}): void {\n current = locale;\n words = messages;\n}\n\nconst t = (key: string, english: string, values?: MessageValues) => formatMessage(words[key] ?? english, values, current);\n\nexport function formatLocale(): string {\n return current;\n}\n\nexport function setFormatTimeZone(timeZone: string | undefined): void {\n if (!timeZone) {\n zone = undefined;\n return;\n }\n try {\n new Intl.DateTimeFormat(\"en\", { timeZone });\n zone = timeZone;\n } catch {\n zone = undefined;\n }\n}\n\nexport function formatTimeZone(): string | undefined {\n return zone;\n}\n\nconst inZone = (): { timeZone?: string | undefined } => (zone ? { timeZone: zone } : {});\n\nconst numberLocale = () => (current === \"en\" ? \"en-US\" : current);\n\n// CLDR's en-GB writes September alone with four letters (\"Sept\"), which breaks a column of three-letter months.\nexport function formatNumber(value: number, options: Intl.NumberFormatOptions = {}): string {\n return new Intl.NumberFormat(numberLocale(), { maximumFractionDigits: 2, ...options }).format(value);\n}\n\nconst COMPACT = { maximumFractionDigits: 1, maximumSignificantDigits: 3, roundingPriority: \"morePrecision\" } as const;\n\nconst nativeCompact = (value: number) => new Intl.NumberFormat(numberLocale(), { notation: \"compact\", ...COMPACT }).format(value);\nconst abbreviated = (text: string) => /\\p{L}/u.test(text);\n\nexport function formatTokens(value: number): string {\n if (Math.abs(value) < 1000) return formatNumber(value, { maximumFractionDigits: 0 });\n const compact = nativeCompact(value);\n // German and Chinese have no short form below a million and ten thousand, so 793,640 would stand in full beside 2.89 million.\n if (abbreviated(compact)) return compact;\n const thousands = Number(new Intl.NumberFormat(\"en-US\", { ...COMPACT, useGrouping: false }).format(value / 1000));\n const promoted = nativeCompact(thousands * 1000);\n if (abbreviated(promoted)) return promoted;\n return t(\"format.thousands\", \"{value}K\", { value: formatNumber(thousands, COMPACT) });\n}\n\n/** A model's context or output limit as models are named: a multiple of 1,024 in binary thousands (\"128K\" for 131,072, \"1M\" for 1,048,576), anything else in decimal ones (\"128K\" for 128,000, \"200K\"). */\nexport function formatContext(tokens: number): string {\n const binary = tokens % 1000 !== 0 && tokens % 1024 === 0;\n const k = binary ? tokens / 1024 : tokens / 1000;\n const unit = binary ? 1024 : 1000;\n if (tokens < 1000) return formatNumber(tokens, { maximumFractionDigits: 0 });\n if (k >= unit) return `${formatNumber(k / unit, { maximumFractionDigits: 1 })}M`;\n return `${formatNumber(k, { maximumFractionDigits: k < 10 ? 1 : 0 })}K`;\n}\n\nexport function formatBytes(bytes: number): string {\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n let v = bytes;\n let i = 0;\n while (Math.abs(v) >= 1024 && i < units.length - 1) {\n v /= 1024;\n i++;\n }\n const digits = i === 0 || v >= 100 ? 0 : 1;\n return `${formatNumber(v, { minimumFractionDigits: digits, maximumFractionDigits: digits, useGrouping: false })} ${units[i]}`;\n}\n\nexport function formatPercent(ratio: number, digits = 1): string {\n return new Intl.NumberFormat(numberLocale(), { style: \"percent\", maximumFractionDigits: digits }).format(ratio);\n}\n\nfunction groupThousands(int: string): string {\n return int.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n}\n\nexport function formatUSD(amount: string, options: { significant?: number | undefined; decimals?: number | undefined } = {}): string {\n const text = writeUSD(amount, options);\n if (options.decimals === undefined || !/^\\s*-?\\d*\\.?\\d*[1-9]/.test(amount) || /[1-9]/.test(text)) return localUSD(text);\n const smallest = localUSD(`$${options.decimals ? `0.${\"1\".padStart(options.decimals, \"0\")}` : \"1\"}`);\n return /^\\s*-/.test(amount) ? `>\\u00a0−${smallest}` : `<\\u00a0${smallest}`;\n}\n\n/** A price per million tokens, exactly as set: at least two decimals and up to six (\"$0.075\", \"$4.00\", \"$1.25\"). */\nexport function formatPrice(amount: string): string {\n const frac = /\\.(\\d*?)0*\\s*$/.exec(amount)?.[1] ?? \"\";\n return formatUSD(amount, { decimals: Math.min(6, Math.max(2, frac.length)) });\n}\n\nfunction localUSD(text: string): string {\n const m = /^(−?)\\$([\\d,]+)(?:\\.(\\d+))?$/.exec(text);\n if (current === \"en\" || current.startsWith(\"zh\") || !m) return text;\n const parts = new Intl.NumberFormat(numberLocale(), { style: \"currency\", currency: \"USD\" }).formatToParts(1000.5);\n const part = (type: string) => parts.find((p) => p.type === type)?.value;\n const at = parts.findIndex((p) => p.type === \"currency\");\n const before = at < parts.findIndex((p) => p.type === \"integer\");\n const gap = parts[before ? at + 1 : at - 1];\n const space = gap?.type === \"literal\" ? gap.value : \"\";\n const number = (m[2] ?? \"\").replace(/,/g, part(\"group\") ?? \",\") + (m[3] ? `${part(\"decimal\") ?? \".\"}${m[3]}` : \"\");\n const symbol = part(\"currency\") ?? \"$\";\n return before ? `${m[1]}${symbol}${space}${number}` : `${m[1]}${number}${space}${symbol}`;\n}\n\nfunction writeUSD(amount: string, options: { significant?: number | undefined; decimals?: number | undefined }): string {\n const significant = options.significant ?? 3;\n const match = /^\\s*(-)?(\\d*)(?:\\.(\\d*))?\\s*$/.exec(amount);\n if (!match) return amount;\n const negative = match[1] === \"-\";\n const intPart = (match[2] ?? \"\").replace(/^0+(?=\\d)/, \"\") || \"0\";\n const frac = match[3] ?? \"\";\n const sign = negative ? \"−\" : \"\";\n if (options.decimals !== undefined) {\n const n = options.decimals;\n const digits = (intPart + frac.padEnd(n + 1, \"0\").slice(0, n + 1)).replace(/^0+(?=\\d)/, \"\");\n let scaled = BigInt(digits.slice(0, -1) || \"0\");\n if (Number(digits.slice(-1)) >= 5) scaled += 1n;\n const str = scaled.toString().padStart(n + 1, \"0\");\n const whole = str.slice(0, str.length - n) || \"0\";\n const isZero = scaled === 0n;\n return `${negative && !isZero ? sign : \"\"}$${groupThousands(whole)}${n ? `.${str.slice(-n)}` : \"\"}`;\n }\n if (intPart === \"0\" && /^0{2}/.test(frac.padEnd(2, \"0\")) && /[1-9]/.test(frac)) {\n let lead = frac.match(/^0*/)?.[0].length ?? 0;\n const take = frac.slice(lead, lead + significant + 1).padEnd(significant + 1, \"0\");\n let kept = BigInt(take.slice(0, significant));\n if (Number(take[significant]) >= 5) kept += 1n;\n let digits = kept.toString().padStart(significant, \"0\");\n if (digits.length > significant) {\n lead -= 1;\n digits = digits.slice(0, significant);\n }\n if (lead < 2) return `${sign}$0.${\"0\".repeat(Math.max(0, lead))}${digits}`.replace(/^(−?\\$0\\.\\d{2})\\d*$/, \"$1\");\n return `${sign}$0.${\"0\".repeat(lead)}${digits}`;\n }\n const cents = frac.padEnd(3, \"0\");\n let whole = BigInt(intPart);\n let two = Number(cents.slice(0, 2));\n if (Number(cents[2]) >= 5) two += 1;\n if (two === 100) {\n two = 0;\n whole += 1n;\n }\n const isZero = whole === 0n && two === 0;\n return `${negative && !isZero ? sign : \"\"}$${groupThousands(whole.toString())}.${String(two).padStart(2, \"0\")}`;\n}\n\nexport function formatDuration(ms: number, options: { precise?: boolean | undefined } = {}): string {\n const whole = Math.round(ms);\n if (whole < 1000) return t(\"format.milliseconds\", \"{ms} ms\", { ms: String(whole) });\n const places = options.precise ? 2 : 1;\n const secondsTo = (digits: number) => Math.round(ms / 10 ** (3 - digits)) / 10 ** digits;\n const seconds = (digits: number) =>\n t(\"format.seconds\", \"{s} s\", {\n s: formatNumber(secondsTo(digits), { minimumFractionDigits: options.precise ? digits : 0, maximumFractionDigits: digits }),\n });\n if (secondsTo(places) < 10) return seconds(places);\n if (secondsTo(places - 1) < 60) return seconds(places - 1);\n const total = secondsTo(0);\n if (total < 3600) {\n const min = Math.floor(total / 60);\n const s = total % 60;\n return s ? t(\"format.minutesSeconds\", \"{min} min {s} s\", { min: String(min), s: String(s) }) : t(\"format.minutes\", \"{min} min\", { min: String(min) });\n }\n const minutes = Math.round(ms / 60_000);\n return t(\"format.hoursMinutes\", \"{h} h {min} min\", { h: String(Math.floor(minutes / 60)), min: String(minutes % 60) });\n}\n\ntype DateInput = Date | string | number;\nconst toDate = (d: DateInput) => (d instanceof Date ? d : new Date(d));\n\nconst dateFormats = new Map<string, (d: Date) => string>();\n\n/** A cached date formatter in the format locale. English writes the day first with three-letter months (\"20 Sep 2026\", \"Mon 21 Sep\"), the console's English everywhere. */\nexport function dateFormatter(options: Intl.DateTimeFormatOptions, locale: string = current): (value: DateInput) => string {\n // A cached formatter keeps the zone it was made in, so the viewer's zone is part of the key.\n const zoned = options.timeZone ? options : { ...options, timeZone: new Intl.DateTimeFormat().resolvedOptions().timeZone };\n const key = `${locale}|${JSON.stringify(zoned)}`;\n let format = dateFormats.get(key);\n if (!format) {\n if (locale === \"en\") {\n const day = new Intl.DateTimeFormat(\"en-GB\", zoned);\n const month = zoned.month === \"short\" ? new Intl.DateTimeFormat(\"en-US\", { month: \"short\", timeZone: zoned.timeZone }) : null;\n format = (d) =>\n day\n .formatToParts(d)\n .map((p) => (p.type === \"month\" && month ? month.format(d) : p.type === \"weekday\" ? p.value.replace(/,$/, \"\") : p.value))\n .join(\"\");\n } else {\n const f = new Intl.DateTimeFormat(locale, zoned);\n format = (d) => f.format(d);\n }\n dateFormats.set(key, format);\n }\n return (value) => format(toDate(value));\n}\n\nexport function formatDate(value: DateInput, options: { time?: boolean | undefined; utc?: boolean | undefined; seconds?: boolean | undefined } = {}): string {\n const f = dateFormatter({\n day: \"numeric\",\n month: \"short\",\n year: \"numeric\",\n ...(options.time ? { hour: \"2-digit\", minute: \"2-digit\", ...(options.seconds ? { second: \"2-digit\" } : {}), hourCycle: \"h23\" } : {}),\n ...(options.utc ? { timeZone: \"UTC\" } : inZone()),\n });\n return `${f(value)}${options.utc ? \" UTC\" : \"\"}`;\n}\n\nexport function formatDateRange(from: DateInput, to: DateInput): string {\n const a = toDate(from);\n const b = toDate(to);\n const f = dateFormatter({ day: \"numeric\", month: \"short\" });\n const withYear = dateFormatter({ day: \"numeric\", month: \"short\", year: \"numeric\" });\n if (a.getFullYear() !== b.getFullYear()) return `${withYear(a)} – ${withYear(b)}`;\n const start = f(a);\n return a.toDateString() === b.toDateString() ? start : `${start} – ${f(b)}`;\n}\n\nconst pad2 = (n: number) => String(n).padStart(2, \"0\");\n\nexport function formatISODate(value: DateInput, options: { utc?: boolean | undefined } = {}): string {\n const d = toDate(value);\n if (options.utc) return d.toISOString().slice(0, 10);\n return `${String(d.getFullYear()).padStart(4, \"0\")}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}`;\n}\n\nexport function parseISODate(text: string): Date | null {\n const m = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text.trim());\n if (!m) return null;\n const [y, mo, day] = [Number(m[1]), Number(m[2]) - 1, Number(m[3])];\n const d = new Date(2000, 0, 1);\n d.setFullYear(y, mo, day);\n return d.getFullYear() === y && d.getMonth() === mo && d.getDate() === day ? d : null;\n}\n\nexport function formatRelative(value: DateInput, now: DateInput = Date.now()): string {\n const d = toDate(value);\n const diff = toDate(now).getTime() - d.getTime();\n const abs = Math.abs(diff);\n const future = diff < 0;\n if (abs < 45_000) return t(\"format.justNow\", \"just now\");\n if (abs < 3_600_000) {\n const count = Math.round(abs / 60_000);\n return future ? t(\"format.inMinutes\", \"in {count} min\", { count }) : t(\"format.minutesAgo\", \"{count} min ago\", { count });\n }\n if (abs < 86_400_000) {\n const count = Math.round(abs / 3_600_000);\n return future ? t(\"format.inHours\", \"in {count} h\", { count }) : t(\"format.hoursAgo\", \"{count} h ago\", { count });\n }\n if (abs < 172_800_000 && !future) return t(\"format.yesterday\", \"yesterday\");\n if (abs < 7 * 86_400_000) {\n const count = Math.round(abs / 86_400_000);\n return future\n ? t(\"format.inDays\", \"{count, plural, one {in # day} other {in # days}}\", { count })\n : t(\"format.daysAgo\", \"{count, plural, one {# day ago} other {# days ago}}\", { count });\n }\n const year = dateFormatter({ year: \"numeric\", ...inZone() }, \"en\");\n return dateFormatter({\n day: \"numeric\",\n month: \"short\",\n ...inZone(),\n ...(year(d) !== year(toDate(now)) ? { year: \"numeric\" } : {}),\n })(d);\n}\n"],"mappings":";;AAEA,IAAIC,IAAU,MACVC,IAA0C,CAAC,GAC3CC;AAEJ,SAAgBC,EAAgB,GAAgB,IAA6C,CAAC,GAAS;CAErG,AADA,IAAUC,GACV,IAAQC;AACV;AAEA,IAAMC,KAAK,GAAa,GAAiB,MAA2BP,EAAcE,EAAMM,MAAQC,GAASC,GAAQT,CAAO;AAExH,SAAgBU,IAAuB;CACrC,OAAOV;AACT;AAEA,SAAgBW,EAAkB,GAAoC;CACpE,IAAI,CAACC,GACH,IAAO,KAAA;MAGT,IAAI;EAEF,AADA,IAAI,KAAK,eAAe,MAAM,EAAE,YAAS,CAAC,GAC1C,IAAOA;CACT,QAAQ;EACN,IAAO,KAAA;CACT;AACF;AAEA,SAAgBC,IAAqC;CACnD,OAAOX;AACT;AAEA,IAAMY,UAAmDZ,IAAO,EAAE,UAAUA,EAAK,IAAI,CAAC,GAEhFa,UAAsBf,MAAY,OAAO,UAAUA;AAGzD,SAAgBgB,EAAa,GAAe,IAAoC,CAAC,GAAW;CAC1F,OAAO,IAAI,KAAK,aAAaD,EAAa,GAAG;EAAE,uBAAuB;EAAG,GAAGE;CAAQ,CAAC,CAAC,CAAC,OAAOC,CAAK;AACrG;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,CAACvB,CAAC;AACN"}
|
package/dist/i18n-provider.js
CHANGED
|
@@ -22,7 +22,7 @@ function s(e) {
|
|
|
22
22
|
}
|
|
23
23
|
async function c(e) {
|
|
24
24
|
let t = s(e);
|
|
25
|
-
return t === "de" ? (await import("./chunks/de-
|
|
25
|
+
return t === "de" ? (await import("./chunks/de-CPXJh9cq.js")).default : t === "zh-CN" ? (await import("./chunks/zh-CN-29X4CDLE.js")).default : {};
|
|
26
26
|
}
|
|
27
27
|
//#endregion
|
|
28
28
|
export { o as LocaleProvider, c as loadUiMessages, s as resolveUiLocale };
|