@ngrok/mantle 0.80.0 → 0.81.0
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/accordion.d.ts +13 -31
- package/dist/accordion.js +1 -1
- package/dist/agent.json +5 -1
- package/dist/alert-dialog.d.ts +15 -48
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +8 -26
- package/dist/alert.js +1 -1
- package/dist/{anchor-_2meGDfj.js → anchor-DfeXTpKW.js} +1 -1
- package/dist/anchor.js +1 -1
- package/dist/area-chart.d.ts +504 -0
- package/dist/area-chart.js +1 -0
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +491 -0
- package/dist/bar-chart.js +1 -0
- package/dist/breadcrumb.d.ts +6 -24
- package/dist/breadcrumb.js +1 -1
- package/dist/button-BAno7KIU.js +1 -0
- package/dist/{index-C2jj8U4a.d.ts → button-C-gMbPso.d.ts} +2 -2
- package/dist/{icon-button-C1AfGnQx.d.ts → button-C7vAl6lS.d.ts} +16 -3
- package/dist/{button-BPMwa2jN.d.ts → button-DARFK2KJ.d.ts} +1 -1
- package/dist/{button-5WsvzIQ6.js → button-DjpEKt2X.js} +1 -1
- package/dist/button-DvHMWAPl.js +1 -0
- package/dist/button.d.ts +5 -5
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +5 -20
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +5 -20
- package/dist/centered-layout.js +1 -1
- package/dist/chart-BROa2gqt.js +2 -0
- package/dist/chart-BcOC6Qj0.d.ts +275 -0
- package/dist/checkbox-0EoxOyMA.js +1 -0
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/choice-BHwFSSyv.js +1 -0
- package/dist/{choice-Ct0KK8jw.d.ts → choice-BNRQXszu.d.ts} +5 -20
- package/dist/choice.d.ts +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +14 -44
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/combobox.d.ts +9 -33
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +3 -9
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +6 -12
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +4 -16
- package/dist/description-list.js +1 -1
- package/dist/{primitive-CJRIlrLz.d.ts → dialog-BM4wPCft.d.ts} +9 -16
- package/dist/dialog-DWZWd5Jt.js +1 -0
- package/dist/dialog.d.ts +13 -43
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-CoyozLzy.d.ts → dropdown-menu-DZg-Cd69.d.ts} +18 -54
- package/dist/dropdown-menu-Dw-OtXPm.d.ts +1 -0
- package/dist/dropdown-menu-RyDWoKHx.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +6 -21
- package/dist/empty.js +1 -1
- package/dist/field-B1wqeZr4.js +1 -0
- package/dist/field.d.ts +15 -45
- package/dist/field.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +3 -12
- package/dist/hover-card.js +1 -1
- package/dist/{svg-only-CdI_v82i.d.ts → icon-CX_gj6sW.d.ts} +1 -1
- package/dist/{icon-BDqpcZ-n.d.ts → icon-k4E9yNWD.d.ts} +1 -1
- package/dist/icon-lZ48P8Nn.js +1 -0
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons-DLCs1hLP.js +1 -0
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +1 -1
- package/dist/input-BnlpQF0c.js +1 -0
- package/dist/{input-DV9M6K4v.d.ts → input-BuYDU6CF.d.ts} +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.js +1 -1
- package/dist/line-chart.d.ts +490 -0
- package/dist/line-chart.js +1 -0
- package/dist/{virtual-UrzmaSQm.js → list-51KQvENW.js} +1 -1
- package/dist/list.d.ts +5 -20
- package/dist/list.js +1 -1
- package/dist/llms.txt +5 -1
- package/dist/mantle-dark-high-contrast.css +17 -0
- package/dist/mantle-dark.css +13 -0
- package/dist/mantle-light-high-contrast.css +15 -0
- package/dist/mantle.css +29 -0
- package/dist/media-object.d.ts +3 -12
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +14 -53
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +5 -17
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +5 -14
- package/dist/pagination.js +1 -1
- package/dist/{index-B8mIWKIU.d.ts → popover-CE4OlWkd.d.ts} +1 -4
- package/dist/popover-CQ9s7jG5.js +1 -0
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/primitive-trJDqIXJ.js +1 -0
- package/dist/progress.d.ts +2 -8
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +4 -16
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +10 -40
- package/dist/radio-group.js +1 -1
- package/dist/scatter-plot.d.ts +495 -0
- package/dist/scatter-plot.js +1 -0
- package/dist/{select-idm1jy7y.d.ts → select-0z7HVS6r.d.ts} +8 -29
- package/dist/select-BCHWvmyC.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +11 -38
- package/dist/selectable-list.js +1 -1
- package/dist/sheet.d.ts +12 -39
- package/dist/sheet.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/slot.d.ts +1 -1
- package/dist/split-button.d.ts +9 -24
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +1 -1
- package/dist/{table-DUSvU_Jw.d.ts → table-Bo0vNxIJ.d.ts} +9 -36
- package/dist/table-CGxJwtbL.js +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +21 -36
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-C26-Xolp.js +1 -0
- package/dist/theme-switcher.d.ts +6 -15
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +5 -17
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +26 -8
- package/dist/tooltip.js +1 -1
- package/package.json +7 -1
- package/dist/checkbox-Cq17y0-R.js +0 -1
- package/dist/choice-Cc8dA5r8.js +0 -1
- package/dist/dialog-CQ2C6vkE.js +0 -1
- package/dist/dropdown-menu-CSCDdA3K.js +0 -1
- package/dist/field-context-BR01g789.js +0 -1
- package/dist/icon-CGgMKpJg.js +0 -1
- package/dist/icon-button-DiOhreJD.js +0 -1
- package/dist/index-CdPXa9h1.d.ts +0 -1
- package/dist/input-CVyAVbim.js +0 -1
- package/dist/popover-CBMADtjV.js +0 -1
- package/dist/primitive-DCPHJsRs.js +0 -1
- package/dist/select-SR_9-bxA.js +0 -1
- package/dist/table-GDkapNFi.js +0 -1
- package/dist/theme-provider-BftkIiZn.js +0 -1
- package/dist/theme-wVnzzx2F.js +0 -1
- package/dist/toast-DKgMRv4F.js +0 -1
- /package/dist/{sizes-BCoI4bhP.d.ts → button-BCoI4bhP.d.ts} +0 -0
- /package/dist/{intents-DdSKSj1c.d.ts → button-DdSKSj1c.d.ts} +0 -0
- /package/dist/{resolve-pre-rendered-props-B6OlZrSI.d.ts → code-block-B6OlZrSI.d.ts} +0 -0
- /package/dist/{resolve-pre-rendered-props-C9uaM9-V.js → code-block-C9uaM9-V.js} +0 -0
- /package/dist/{validation-7QeiTFwl.d.ts → field-7QeiTFwl.d.ts} +0 -0
- /package/dist/{validation-Bpptk_9t.js → field-Bpptk_9t.js} +0 -0
- /package/dist/{types-D1RY5Tcj.d.ts → icon-D1RY5Tcj.d.ts} +0 -0
- /package/dist/{svg-only-d-nMCfAI.js → icon-d-nMCfAI.js} +0 -0
- /package/dist/{sort-B_DDQcVD.js → icons-B_DDQcVD.js} +0 -0
- /package/dist/{traffic-policy-file-CF1lbWtp.js → icons-CF1lbWtp.js} +0 -0
- /package/dist/{is-input-CXmS0OFN.js → input-CXmS0OFN.js} +0 -0
- /package/dist/{index-BtwKJTLq.d.ts → slot-BtwKJTLq.d.ts} +0 -0
- /package/dist/{themes-CYNpplwN.d.ts → theme-CYNpplwN.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{cva as t}from"class-variance-authority";const n=t(e(`icon-button`,`inline-flex shrink-0 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] border`,`focus:outline-hidden focus-visible:ring-4`,`disabled:cursor-default disabled:opacity-50`,`not-disabled:active:scale-97 ease-out transition-transform duration-150`),{variants:{appearance:{ghost:`text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700 border-transparent`,outlined:`border-accent-600 bg-form text-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-accent-700 not-disabled:hover:bg-accent-500/10 not-disabled:hover:text-accent-700`},intent:{accent:``,danger:``,neutral:``},isLoading:{false:``,true:`opacity-50`},size:{xs:`size-6`,sm:`size-7`,md:`size-9`,lg:`size-10`,xl:`size-12`}},defaultVariants:{intent:`neutral`,size:`md`},compoundVariants:[{appearance:`ghost`,intent:`danger`,class:`text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700 border-transparent`},{appearance:`outlined`,intent:`danger`,class:`border-danger-600 bg-form text-danger-600 focus-visible:ring-focus-danger not-disabled:hover:border-danger-700 not-disabled:hover:bg-danger-500/10 not-disabled:hover:text-danger-700`},{appearance:`ghost`,intent:`neutral`,class:`text-strong focus-visible:ring-focus-accent not-disabled:hover:bg-neutral-500/10 not-disabled:hover:text-strong border-transparent`},{appearance:`outlined`,intent:`neutral`,class:`border-form bg-form text-strong focus-visible:border-accent-600 focus-visible:ring-focus-accent not-disabled:hover:border-neutral-400 not-disabled:hover:bg-form-hover not-disabled:hover:text-strong focus-visible:not-disabled:hover:border-accent-600 focus-visible:not-disabled:active:border-accent-600`}]});export{n as t};
|
package/dist/button.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as ButtonIntent } from "./
|
|
2
|
-
import { n as ButtonAppearance, r as ButtonProps, t as Button } from "./button-
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as ButtonGroupProps, t as ButtonGroup } from "./
|
|
5
|
-
import { t as ButtonSize } from "./
|
|
1
|
+
import { t as ButtonIntent } from "./button-DdSKSj1c.js";
|
|
2
|
+
import { n as ButtonAppearance, r as ButtonProps, t as Button } from "./button-DARFK2KJ.js";
|
|
3
|
+
import { n as IconButtonProps, r as IconButtonAppearance, t as IconButton } from "./button-C7vAl6lS.js";
|
|
4
|
+
import { n as ButtonGroupProps, t as ButtonGroup } from "./button-C-gMbPso.js";
|
|
5
|
+
import { t as ButtonSize } from "./button-BCoI4bhP.js";
|
|
6
6
|
export { Button, type ButtonAppearance, ButtonGroup, type ButtonGroupProps, type ButtonIntent, type ButtonProps, type ButtonSize, IconButton, type IconButtonAppearance, type IconButtonProps };
|
package/dist/button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./button-BAno7KIU.js";import{t}from"./button-DjpEKt2X.js";import{t as n}from"./button-D9n09xUg.js";export{t as Button,n as ButtonGroup,e as IconButton};
|
package/dist/calendar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./icon-lZ48P8Nn.js";import{t as n}from"./button-DvHMWAPl.js";import{jsx as r}from"react/jsx-runtime";import{CaretRightIcon as i}from"@phosphor-icons/react/CaretRight";import{CaretLeftIcon as a}from"@phosphor-icons/react/CaretLeft";import{DayPicker as o}from"react-day-picker";const s=n({appearance:`ghost`,intent:`neutral`,size:`sm`});function c({className:n,classNames:c,showOutsideDays:l=!1,...u}){return r(o,{"data-slot":`calendar`,animate:!1,components:{Chevron:e=>r(t,{svg:e.orientation===`left`?r(a,{}):r(i,{}),className:`size-4`})},classNames:{root:e(`isolate`,n),button_next:e(s,`absolute right-0`),button_previous:e(s,`absolute left-0`),caption_label:`text-sm font-medium`,day:e(`overflow-hidden text-center text-sm p-0 relative focus-within:relative focus-within:z-20 size-7 rounded-md`,u.mode===`range`?`first:has-aria-selected:rounded-l-md last:has-aria-selected:rounded-r-md`:``),day_button:`day size-full rounded-md not-aria-selected:not-disabled:hover:bg-filled-accent/15`,disabled:`text-muted opacity-50`,hidden:`invisible`,month:`space-y-4`,month_caption:`flex justify-center pt-1 relative items-center`,month_grid:`w-full border-collapse space-y-1`,months:`flex flex-col sm:flex-row gap-y-4 sm:gap-x-4 sm:gap-y-0 relative max-w-min`,nav:`flex items-center absolute inset-x-0 top-1 h-5 justify-between z-10`,outside:`day-outside aria-selected:text-on-filled opacity-50 text-muted`,range_end:`day-range-end [&:not(.day-range-start)]:rounded-l-none`,range_middle:`day-range-middle not-disabled:aria-selected:bg-filled-accent/15 aria-selected:text-strong rounded-none not-disabled:aria-selected:hover:bg-filled-accent/25`,range_start:`day-range-start [&:not(.day-range-end)]:rounded-r-none`,selected:`not-disabled:bg-filled-accent text-on-filled not-disabled:hover:bg-filled-accent`,today:`not-aria-selected:not-disabled:text-accent-600 font-medium not-aria-selected:not-disabled:bg-filled-accent/10 rounded-md`,week:`flex w-full mt-1`,weekday:`text-body w-7 text-[0.8rem] text-center font-normal`,weekdays:`flex`,...c},showOutsideDays:l,...u})}export{c as Calendar};
|
package/dist/card.d.ts
CHANGED
|
@@ -30,10 +30,7 @@ type CardProps = ComponentProps<"div"> & WithAsChild;
|
|
|
30
30
|
* </Card.Root>
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
declare const Root: {
|
|
34
|
-
({ asChild, className, children, ref, ...rest }: CardProps): import("react").JSX.Element;
|
|
35
|
-
displayName: string;
|
|
36
|
-
};
|
|
33
|
+
declare const Root: ({ asChild, className, children, ref, ...rest }: CardProps) => import("react").JSX.Element;
|
|
37
34
|
/**
|
|
38
35
|
* The main content of a card. Usually composed as a direct child of a `Card` component.
|
|
39
36
|
*
|
|
@@ -60,10 +57,7 @@ declare const Root: {
|
|
|
60
57
|
* </Card.Root>
|
|
61
58
|
* ```
|
|
62
59
|
*/
|
|
63
|
-
declare const Body: {
|
|
64
|
-
({ asChild, className, children, ref, ...rest }: CardProps): import("react").JSX.Element;
|
|
65
|
-
displayName: string;
|
|
66
|
-
};
|
|
60
|
+
declare const Body: ({ asChild, className, children, ref, ...rest }: CardProps) => import("react").JSX.Element;
|
|
67
61
|
/**
|
|
68
62
|
* The footer container of a card. Usually composed as a direct child of a `Card` component.
|
|
69
63
|
*
|
|
@@ -84,10 +78,7 @@ declare const Body: {
|
|
|
84
78
|
* </Card.Root>
|
|
85
79
|
* ```
|
|
86
80
|
*/
|
|
87
|
-
declare const Footer: {
|
|
88
|
-
({ asChild, className, children, ref, ...rest }: CardProps): import("react").JSX.Element;
|
|
89
|
-
displayName: string;
|
|
90
|
-
};
|
|
81
|
+
declare const Footer: ({ asChild, className, children, ref, ...rest }: CardProps) => import("react").JSX.Element;
|
|
91
82
|
/**
|
|
92
83
|
* The header container of a card. Usually composed as a direct child of a `Card` component.
|
|
93
84
|
*
|
|
@@ -108,10 +99,7 @@ declare const Footer: {
|
|
|
108
99
|
* </Card.Root>
|
|
109
100
|
* ```
|
|
110
101
|
*/
|
|
111
|
-
declare const Header: {
|
|
112
|
-
({ asChild, className, children, ref, ...rest }: CardProps): import("react").JSX.Element;
|
|
113
|
-
displayName: string;
|
|
114
|
-
};
|
|
102
|
+
declare const Header: ({ asChild, className, children, ref, ...rest }: CardProps) => import("react").JSX.Element;
|
|
115
103
|
type CardTitleProps = ComponentProps<"h3"> & WithAsChild;
|
|
116
104
|
/**
|
|
117
105
|
* The title of a card. Usually composed as a direct child of a `Card.Header`
|
|
@@ -137,10 +125,7 @@ type CardTitleProps = ComponentProps<"h3"> & WithAsChild;
|
|
|
137
125
|
* </Card.Root>
|
|
138
126
|
* ```
|
|
139
127
|
*/
|
|
140
|
-
declare const Title: {
|
|
141
|
-
({ className, asChild, ref, ...props }: CardTitleProps): import("react").JSX.Element;
|
|
142
|
-
displayName: string;
|
|
143
|
-
};
|
|
128
|
+
declare const Title: ({ className, asChild, ref, ...props }: CardTitleProps) => import("react").JSX.Element;
|
|
144
129
|
/**
|
|
145
130
|
* A container that can be used to display content in a box resembling a
|
|
146
131
|
* physical card.
|
package/dist/card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CDk0Bb9z.js";import{jsx as n}from"react/jsx-runtime";const r=({asChild:r=!1,className:i,children:a,ref:o,...s})=>n(r?t:`div`,{ref:o,"data-slot":`card`,className:e(`border-card bg-card relative rounded-md border`,i),...s,children:a})
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CDk0Bb9z.js";import{jsx as n}from"react/jsx-runtime";const r={Root:({asChild:r=!1,className:i,children:a,ref:o,...s})=>n(r?t:`div`,{ref:o,"data-slot":`card`,className:e(`border-card bg-card relative rounded-md border`,i),...s,children:a}),Body:({asChild:r=!1,className:i,children:a,ref:o,...s})=>n(r?t:`div`,{ref:o,"data-slot":`card-body`,className:e(`p-6 border-t border-card-muted first:border-t-0`,i),...s,children:a}),Footer:({asChild:r=!1,className:i,children:a,ref:o,...s})=>n(r?t:`div`,{ref:o,"data-slot":`card-footer`,className:e(`px-6 py-3 border-t border-card-muted first:border-t-0`,i),...s,children:a}),Header:({asChild:r=!1,className:i,children:a,ref:o,...s})=>n(r?t:`div`,{ref:o,"data-slot":`card-header`,className:e(`px-6 py-3 border-t border-card-muted first:border-t-0`,i),...s,children:a}),Title:({className:r,asChild:i,ref:a,...o})=>n(i?t:`h3`,{ref:a,"data-slot":`card-title`,className:e(`text-strong text-base font-medium`,r),...o})};export{r as Card};
|
|
@@ -34,10 +34,7 @@ import { ComponentProps } from "react";
|
|
|
34
34
|
* </CenteredLayout.Root>
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
declare const Root: {
|
|
38
|
-
({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot): import("react").JSX.Element;
|
|
39
|
-
displayName: string;
|
|
40
|
-
};
|
|
37
|
+
declare const Root: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
41
38
|
/**
|
|
42
39
|
* A full-window-width strip pinned above everything else in the layout —
|
|
43
40
|
* including `CenteredLayout.Header` — for impersonation notices, environment
|
|
@@ -73,10 +70,7 @@ declare const Root: {
|
|
|
73
70
|
* </CenteredLayout.Root>
|
|
74
71
|
* ```
|
|
75
72
|
*/
|
|
76
|
-
declare const Notice: {
|
|
77
|
-
({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot): import("react").JSX.Element;
|
|
78
|
-
displayName: string;
|
|
79
|
-
};
|
|
73
|
+
declare const Notice: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
80
74
|
/**
|
|
81
75
|
* A utility strip at the top of the layout — an account chip, a close/dismiss
|
|
82
76
|
* button, and similar page furniture for focused flows (checkout, plan
|
|
@@ -108,10 +102,7 @@ declare const Notice: {
|
|
|
108
102
|
* </CenteredLayout.Root>
|
|
109
103
|
* ```
|
|
110
104
|
*/
|
|
111
|
-
declare const Header: {
|
|
112
|
-
({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"header"> & WithAsChild & WithDataSlot): import("react").JSX.Element;
|
|
113
|
-
displayName: string;
|
|
114
|
-
};
|
|
105
|
+
declare const Header: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"header"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
115
106
|
/**
|
|
116
107
|
* The growing, centered region of the layout. Renders a `<div>` with
|
|
117
108
|
* `flex flex-1 flex-col items-center justify-center gap-6 py-4` so its
|
|
@@ -148,10 +139,7 @@ declare const Header: {
|
|
|
148
139
|
* </CenteredLayout.Root>
|
|
149
140
|
* ```
|
|
150
141
|
*/
|
|
151
|
-
declare const Body: {
|
|
152
|
-
({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot): import("react").JSX.Element;
|
|
153
|
-
displayName: string;
|
|
154
|
-
};
|
|
142
|
+
declare const Body: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"div"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
155
143
|
/**
|
|
156
144
|
* A pinned utility strip at the bottom of the layout — a theme switcher,
|
|
157
145
|
* legal links, and similar page furniture. Renders a semantic `<footer>`
|
|
@@ -183,10 +171,7 @@ declare const Body: {
|
|
|
183
171
|
* </CenteredLayout.Root>
|
|
184
172
|
* ```
|
|
185
173
|
*/
|
|
186
|
-
declare const Footer: {
|
|
187
|
-
({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"footer"> & WithAsChild & WithDataSlot): import("react").JSX.Element;
|
|
188
|
-
displayName: string;
|
|
189
|
-
};
|
|
174
|
+
declare const Footer: ({ asChild, children, className, "data-slot": dataSlot, ...props }: ComponentProps<"footer"> & WithAsChild & WithDataSlot) => import("react").JSX.Element;
|
|
190
175
|
/**
|
|
191
176
|
* A viewport-filling centered page flow for sign-in, sign-up, onboarding,
|
|
192
177
|
* 404, checkout, and other focused full-page states. It owns structure only —
|
package/dist/centered-layout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-IiQEAKf5.js";import{n as t,t as n}from"./slot-CDk0Bb9z.js";import{jsx as r}from"react/jsx-runtime";const i=({asChild:i,children:a,className:o,"data-slot":s,...c})=>r(i?n:`div`,{"data-slot":t(s,`centered-layout`),className:e(`flex min-h-full flex-col`,o),...c,children:a})
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{n as t,t as n}from"./slot-CDk0Bb9z.js";import{jsx as r}from"react/jsx-runtime";const i={Root:({asChild:i,children:a,className:o,"data-slot":s,...c})=>r(i?n:`div`,{"data-slot":t(s,`centered-layout`),className:e(`flex min-h-full flex-col`,o),...c,children:a}),Notice:({asChild:i,children:a,className:o,"data-slot":s,...c})=>r(i?n:`div`,{"data-slot":t(s,`centered-layout-notice`),className:e(`w-full shrink-0`,o),...c,children:a}),Header:({asChild:i,children:a,className:o,"data-slot":s,...c})=>r(i?n:`header`,{"data-slot":t(s,`centered-layout-header`),className:e(`flex shrink-0 items-center px-4 py-4`,o),...c,children:a}),Body:({asChild:i,children:a,className:o,"data-slot":s,...c})=>r(i?n:`div`,{"data-slot":t(s,`centered-layout-body`),className:e(`flex flex-1 flex-col items-center justify-center gap-6 py-4`,o),...c,children:a}),Footer:({asChild:i,children:a,className:o,"data-slot":s,...c})=>r(i?n:`footer`,{"data-slot":t(s,`centered-layout-footer`),className:e(`flex shrink-0 items-center px-4 py-4`,o),...c,children:a})};export{i as CenteredLayout};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{n}from"./slot-CDk0Bb9z.js";import{t as r}from"./button-BAno7KIU.js";import{t as i}from"./use-copy-to-clipboard-DqQ0_N3E.js";import{createContext as a,useContext as o,useEffect as s,useId as c,useLayoutEffect as l,useMemo as u,useRef as d,useState as f,useSyncExternalStore as p}from"react";import m from"tiny-invariant";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{CheckIcon as v}from"@phosphor-icons/react/Check";import{CopyIcon as y}from"@phosphor-icons/react/Copy";import{scaleTime as b}from"d3-scale";import{area as x,curveLinear as S,curveMonotoneX as C,curveStep as w,line as T}from"d3-shape";const E=(e,t)=>Reflect.get(e,t),D=[`chart-1`,`chart-2`,`chart-3`,`chart-4`,`chart-5`,`chart-6`,`chart-7`,`chart-8`,`chart-other`],O=e=>D.includes(e),k=e=>`--color-${e}`,A=[`chart-1`,`chart-2`,`chart-3`,`chart-4`,`chart-5`,`chart-6`,`chart-7`,`chart-8`],j=e=>{let t=e.toLowerCase();return t.includes(`var(`)||t.includes(`currentcolor`)},M=(e,t)=>{let n=e.ownerDocument,r=n.createElement(`span`);r.style.display=`none`,r.style.color=t,e.appendChild(r);let i=n.defaultView?.getComputedStyle(r).color??``;return r.remove(),i},ee=(e,t)=>O(t)?M(e,`var(${k(t)})`):j(t)?M(e,t):t,te=e=>({grid:M(e,`var(--border-color-card-muted)`),baseline:M(e,`var(--border-color-card)`),tickText:M(e,`var(--text-color-muted)`),reference:M(e,`var(--color-neutral-500)`),surface:M(e,`var(--background-color-card)`)}),N=e=>`${e.className}|${e.getAttribute(`data-applied-theme`)??``}|${e.getAttribute(`data-theme`)??``}`,P=(e,t)=>{let n=new MutationObserver(t);return n.observe(e,{attributes:!0,attributeFilter:[`class`,`data-applied-theme`,`data-theme`]}),()=>n.disconnect()},F=1.5,I=1.6,ne=e=>`oklch(from ${e} calc(l - 0.18) c h)`,L=(e,t,n)=>{let r=F;if(n===`up`){e.moveTo(-1.5,t+r),e.lineTo(t+r,-1.5),e.moveTo(-1.5,r),e.lineTo(r,-1.5),e.moveTo(t-r,t+r),e.lineTo(t+r,t-r);return}e.moveTo(-1.5,-1.5),e.lineTo(t+r,t+r),e.moveTo(t-r,-1.5),e.lineTo(t+r,r),e.moveTo(-1.5,t-r),e.lineTo(r,t+r)},re=(e,t)=>{let{texture:n,color:r,ink:i,devicePixelRatio:a,orientation:o}=t,s=e.canvas.ownerDocument.createElement(`canvas`);s.width=Math.max(1,Math.round(8*a)),s.height=s.width;let c=s.getContext(`2d`);if(c==null)return null;let l=s.width/8;c.scale(l,l),c.fillStyle=r,c.fillRect(0,0,8,8),n===`perpendicular`?(c.fillStyle=i,o===`horizontal`?c.fillRect(8/2-2/2,0,2,8):c.fillRect(0,8/2-2/2,8,2)):n===`dots`?(c.fillStyle=i,c.beginPath(),c.arc(8/4,8/4,I,0,Math.PI*2),c.moveTo(7.6,24/4),c.arc(24/4,24/4,I,0,Math.PI*2),c.fill()):(c.strokeStyle=i,c.lineWidth=n===`crosshatch`?1:F,c.beginPath(),(n===`hatch`||n===`crosshatch`)&&L(c,8,`up`),(n===`hatch-reverse`||n===`crosshatch`)&&L(c,8,`down`),c.stroke());let u=e.createPattern(s,`repeat`);return u?.setTransform({a:1/l,b:0,c:0,d:1/l,e:0,f:0}),u},R=e=>{let{pointCount:t,columnCount:n,wasDecimated:r}=e;return n<=0?!1:r?t>=n*3:t>=n*4},ie=e=>{let{xs:t,values:n,startIndex:r,endIndex:i,positionK:a,positionB:o,columnCount:s}=e,c=new Uint8Array(s),l=new Float64Array(s),u=new Float64Array(s),d=new Float64Array(s),f=new Float64Array(s);for(let e=r;e<=i;e++){let r=n[e]??NaN;if(Number.isNaN(r))continue;let i=t[e]??NaN,p=Math.floor(i*a+o);if(p===s&&(p=s-1),!(p<0||p>=s)){if(c[p]===0){c[p]=1,l[p]=r,u[p]=r,d[p]=r,f[p]=r;continue}r<(l[p]??1/0)&&(l[p]=r),r>(u[p]??-1/0)&&(u[p]=r),f[p]=r}}return{columnCount:s,hasData:c,minValue:l,maxValue:u,inValue:d,outValue:f}},ae=new Intl.NumberFormat,oe=new Intl.NumberFormat(void 0,{maximumSignificantDigits:4}),z=new Map,B=(e,t)=>{let n=Object.is(e,-0)?0:e,r=t?.maximumFractionDigits;if(r!=null){let e=z.get(r);return e??(e=new Intl.NumberFormat(void 0,{maximumFractionDigits:r}),z.set(r,e)),e.format(n)}return n!==0&&Math.abs(n)<1?oe.format(n):ae.format(n)},V=e=>!Number.isFinite(e)||e<=0?0:Math.min(20,Math.max(0,-Math.floor(Math.log10(e)))),se=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}),H=new Intl.DateTimeFormat(void 0,{year:`numeric`,month:`short`,day:`numeric`}),ce=e=>e.getHours()!==0||e.getMinutes()!==0||e.getSeconds()!==0||e.getMilliseconds()!==0,U=(e,t)=>typeof e==`string`?e:typeof e==`number`?B(e):Number.isNaN(e.getTime())?`—`:t?.datasetHasTimeOfDay??ce(e)?se.format(e):H.format(e),le=(e,t,n)=>{if(t<=0)return null;let r=0,i=t-1,a=e[0]??0,o=e[i]??0;if(n<=a)return 0;if(n>=o)return i;for(;i-r>1;){let t=r+i>>1;(e[t]??0)<=n?r=t:i=t}let s=n-(e[r]??0);return(e[i]??0)-n<s?i:r},ue=Math.PI/2-.05,de=e=>({cosYaw:Math.cos(e.yaw),sinYaw:Math.sin(e.yaw),cosPitch:Math.cos(e.pitch),sinPitch:Math.sin(e.pitch)}),fe=(e,t,n,r)=>{let i=e*r.cosYaw+n*r.sinYaw,a=-e*r.sinYaw+n*r.cosYaw,o=t*r.cosPitch-a*r.sinPitch,s=t*r.sinPitch+a*r.cosPitch,c=4/(4+s);return{x:i*c,y:o*c,depth:s,scale:c}},pe=e=>Math.min(ue,Math.max(-ue,e)),me=(e,t)=>{let n=t[1]-t[0];return n===0?0:(e-t[0])/n*2-1},he=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]],ge=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[1,5],[2,6],[3,7]],_e=Math.sqrt(50),ve=Math.sqrt(10),ye=Math.sqrt(2),W=(e,t,n)=>{let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=_e?10:a>=ve?5:a>=ye?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&(s+=1),c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&(s+=1),c*l>t&&--c),c<s&&.5<=n&&n<2?W(e,t,n*2):[s,c,l]},be=(e,t,n)=>{if(!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?W(t,e,n):W(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=[];for(let e=0;e<s;e+=1){let t=r?a-e:i+e;c.push(o<0?t/-o:t*o)}return c},xe=(e,t,n)=>W(e,t,n)[2],G=(e,t)=>{let n=e[1]-e[0];if(n===0)return{k:0,b:(t[0]+t[1])/2};let r=(t[1]-t[0])/n;return{k:r,b:t[0]-e[0]*r}},Se=e=>{let{count:t,rangeStart:n,rangeEnd:r,paddingInner:i,paddingOuter:a}=e,o=r-n;if(t<=0||o<=0)return{count:Math.max(0,t),rangeStart:n,step:0,bandwidth:0,offset:0};let s=o/Math.max(1,t-i+a*2);return{count:t,rangeStart:n,step:s,bandwidth:s*(1-i),offset:s*a}},K=(e,t)=>e.rangeStart+e.offset+t*e.step,q=(e,t)=>K(e,t)+e.bandwidth/2,Ce=(e,t)=>{if(e.count===0||e.step===0)return null;let n=Math.floor((t-e.rangeStart-e.offset+e.step/2-e.bandwidth/2)/e.step);return Math.min(e.count-1,Math.max(0,n))},we=(e,t)=>be(e[0],e[1],t);let J=null,Te=null;const Ee=e=>{if(Te!=null&&J!=null&&J[0]===e[0]&&J[1]===e[1])return Te;let t=b().domain([new Date(e[0]),new Date(e[1])]);return J=[e[0],e[1]],Te=t,t},De=(e,t)=>Ee(e).ticks(t).map(e=>e.getTime()),Oe=e=>{let t=Ee(e).tickFormat();return e=>t(new Date(e))},Y=(e,t)=>{if(e[0]>e[1])return Y([e[1],e[0]],t);if(e[0]===e[1]){let n=e[0],r=n===0?1:Math.abs(n)*.5;return Y([n-r,n+r],t)}let n=e[0],r=e[1],i=NaN;for(let e=0;e<10;e++){let e=xe(n,r,t);if(e===i||e===0||!Number.isFinite(e))break;if(e>0)n=Math.floor(n/e)*e,r=Math.ceil(r/e)*e;else{let t=-e;n=Math.floor(n*t)/t,r=Math.ceil(r*t)/t}i=e}return[n,r]},ke=e=>e===`monotone`?C:e===`step`?w:S,X=e=>Math.round(e)+.5,Ae=(e,t)=>{let{plot:n,color:r,xLines:i,yLines:a}=t;e.save(),e.strokeStyle=r,e.lineWidth=1;for(let t of i)e.globalAlpha=t.alpha,e.beginPath(),e.moveTo(X(t.position),n.top),e.lineTo(X(t.position),n.top+n.height),e.stroke();for(let t of a)e.globalAlpha=t.alpha,e.beginPath(),e.moveTo(n.left,X(t.position)),e.lineTo(n.left+n.width,X(t.position)),e.stroke();e.restore()},je=(e,t)=>{let{plot:n,color:r,y:i}=t;e.strokeStyle=r,e.lineWidth=1,e.beginPath(),e.moveTo(n.left,X(i)),e.lineTo(n.left+n.width,X(i)),e.stroke()},Me=(e,t)=>{let{plot:n,color:r,x:i}=t;e.strokeStyle=r,e.lineWidth=1,e.beginPath(),e.moveTo(X(i),n.top),e.lineTo(X(i),n.top+n.height),e.stroke()},Ne=(e,t)=>{let{fill:n,rects:r}=t;e.fillStyle=n,e.beginPath();for(let t of r){let n=Math.max(.5,t.width),r=Math.min(t.valueY,t.baselineY),i=Math.abs(t.baselineY-t.valueY);if(i===0)continue;let a=t.rounded&&n>=8?Math.min(4,n/2,i):0;if(a===0){e.rect(t.x,r,n,i);continue}t.valueY<=t.baselineY?e.roundRect(t.x,r,n,i,[a,a,0,0]):e.roundRect(t.x,r,n,i,[0,0,a,a])}e.fill()},Pe=(e,t)=>{let{fill:n,rects:r}=t;e.fillStyle=n,e.beginPath();for(let t of r){let n=Math.max(.5,t.height),r=Math.min(t.valueX,t.baselineX),i=Math.abs(t.valueX-t.baselineX);if(i===0)continue;let a=t.rounded&&n>=8?Math.min(4,n/2,i):0;if(a===0){e.rect(r,t.y,i,n);continue}t.valueX>=t.baselineX?e.roundRect(r,t.y,i,n,[0,a,a,0]):e.roundRect(r,t.y,i,n,[a,0,0,a])}e.fill()},Fe=(e,t)=>{let{color:n,curve:r,indexes:i,xAt:a,yAt:o,definedAt:s}=t,c=T().x(a).y(o).defined(s).curve(ke(r)).context(e);e.strokeStyle=n,e.lineWidth=2,e.lineJoin=`round`,e.lineCap=`round`,e.beginPath(),c(i),e.stroke()},Ie=(e,t)=>{let{color:n,curve:r,indexes:i,xAt:a,y0At:o,y1At:s,definedAt:c}=t,l=x().x(a).y0(o).y1(s).defined(c).curve(ke(r)).context(e);e.beginPath(),l(i),e.save(),e.globalAlpha=.1,e.fillStyle=n,e.fill(),e.restore();let u=T().x(a).y(s).defined(c).curve(ke(r)).context(e);e.strokeStyle=n,e.lineWidth=2,e.lineJoin=`round`,e.lineCap=`round`,e.beginPath(),u(i),e.stroke()},Le=(e,t)=>{let{color:n,columns:r,columnToX:i,valueK:a,valueB:o}=t;e.strokeStyle=n,e.lineWidth=2,e.lineJoin=`round`,e.lineCap=`round`,e.beginPath();let s=!1;for(let t=0;t<r.columnCount;t++){if(r.hasData[t]===0){s=!1;continue}let n=i(t),c=(r.inValue[t]??0)*a+o,l=(r.minValue[t]??0)*a+o,u=(r.maxValue[t]??0)*a+o,d=(r.outValue[t]??0)*a+o;s?e.lineTo(n,c):(e.moveTo(n,c),s=!0),(l!==c||u!==c)&&(e.lineTo(n,l),e.lineTo(n,u)),d!==u&&e.lineTo(n,d)}e.stroke()},Re=(e,t)=>{let{color:n,lowerColumns:r,upperColumns:i,columnToX:a,valueK:o,valueB:s}=t;e.beginPath();let c=-1,l=t=>{if(c<0)return;let n=!1;for(let r=c;r<=t;r++){let t=a(r),c=(i.maxValue[r]??0)*o+s;n?e.lineTo(t,c):(e.moveTo(t,c),n=!0)}for(let n=t;n>=c;n--){let t=a(n),i=(r.minValue[n]??0)*o+s;e.lineTo(t,i)}e.closePath(),c=-1};for(let e=0;e<i.columnCount;e++){if(i.hasData[e]===0){l(e-1);continue}c<0&&(c=e)}l(i.columnCount-1),e.save(),e.globalAlpha=.1,e.fillStyle=n,e.fill(),e.restore(),Le(e,{color:n,columns:i,columnToX:a,valueK:o,valueB:s})},ze=(e,t,n,r,i)=>{if(i===`square`){let i=r*.886;e.moveTo(t-i,n-i),e.lineTo(t+i,n-i),e.lineTo(t+i,n+i),e.lineTo(t-i,n+i),e.closePath();return}if(i===`triangle`){let i=r*1.55;e.moveTo(t,n-i),e.lineTo(t+i*.866,n+i*.5),e.lineTo(t-i*.866,n+i*.5),e.closePath();return}if(i===`diamond`){let i=r*1.253;e.moveTo(t,n-i),e.lineTo(t+i,n),e.lineTo(t,n+i),e.lineTo(t-i,n),e.closePath();return}e.arc(t,n,r,0,Math.PI*2)},Be=(e,t)=>{let{color:n,surface:r,shape:i,indexes:a,xAt:o,yAt:s,definedAt:c}=t;e.fillStyle=n,e.strokeStyle=r,e.lineWidth=2;for(let t of a)c(t)&&(e.beginPath(),ze(e,o(t),s(t),4,i),e.fill(),e.stroke())},Ve=5e3,He=2e4,Ue=(e,t)=>{let{color:n,surface:r,shape:i,totalPointCount:a,indexes:o,xAt:s,yAt:c,radiusAt:l}=t;if(e.fillStyle=n,a>He){e.beginPath();for(let t of o)l(t)<=0||e.rect(s(t)-1,c(t)-1,2,2);e.fill();return}let u=a<=Ve;e.strokeStyle=r,e.lineWidth=2;for(let t of o){let n=l(t);n<=0||(e.beginPath(),ze(e,s(t),c(t),n,i),e.fill(),u&&e.stroke())}},We=(e,t)=>{let{count:n,order:r,screenX:i,screenY:a,radius:o,colorAt:s,shapeAt:c,alphaAt:l,surface:u}=t;if(e.save(),n>He){let t=``,n=-1;for(let c of r){let r=s(c);r!==t&&(e.fillStyle=r,t=r);let u=l(c);u!==n&&(e.globalAlpha=u,n=u);let d=Math.max(1,(o[c]??0)/2);e.fillRect((i[c]??0)-d/2,(a[c]??0)-d/2,d,d)}e.restore();return}let d=n<=Ve;e.strokeStyle=u,e.lineWidth=2;let f=``,p=-1;for(let t of r){let n=s(t);n!==f&&(e.fillStyle=n,f=n);let r=l(t);r!==p&&(e.globalAlpha=r,p=r),e.beginPath(),ze(e,i[t]??0,a[t]??0,o[t]??0,c(t)),e.fill(),d&&e.stroke()}e.restore()},Ge=(e,t)=>{let{gridColor:n,axisColor:r,corners:i,edges:a,cubeAlpha:o,axes:s}=t;if(e.save(),o>.01){e.globalAlpha=o,e.strokeStyle=n,e.lineWidth=1,e.beginPath();for(let[t,n]of a){let r=i[t],a=i[n];r!=null&&a!=null&&(e.moveTo(r.x,r.y),e.lineTo(a.x,a.y))}e.stroke()}e.strokeStyle=r;for(let{alpha:t,from:n,to:r}of s)t<=.01||(e.globalAlpha=t,e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(r.x,r.y),e.stroke());e.restore()},Ke=(e,t)=>{let{textColor:n,fontFamily:r,plot:i,center:a,axes:o}=t;e.save(),e.fillStyle=n,e.font=`11px ${r}`,e.textAlign=`center`,e.textBaseline=`middle`;for(let{label:t,alpha:n,from:r,to:s}of o){if(n<=.01)continue;let o=Math.hypot(r.x-a.x,r.y-a.y),c=Math.hypot(s.x-a.x,s.y-a.y),l=c>=o?s:r,u=c>=o?r:s,d=Math.max(1,Math.hypot(l.x-u.x,l.y-u.y)),f=(l.x-u.x)/d*16,p=(l.y-u.y)/d*16,m=Math.min(i.left+i.width-8,Math.max(i.left+8,l.x+f)),h=Math.min(i.top+i.height-6,Math.max(i.top+6,l.y+p));e.globalAlpha=n,e.fillText(t,m,h)}e.restore()},qe=(e,t)=>{let{plot:n,color:r,textColor:i,y:a,label:o,fontFamily:s}=t;e.strokeStyle=r,e.lineWidth=1,e.setLineDash([4,4]),e.beginPath(),e.moveTo(n.left,X(a)),e.lineTo(n.left+n.width,X(a)),e.stroke(),e.setLineDash([]),o!=null&&o.length>0&&(e.font=`11px ${s}`,e.fillStyle=i,e.textAlign=`right`,e.textBaseline=`bottom`,e.fillText(o,n.left+n.width-4,a-3))},Je=(e,t)=>{let{plot:n,color:r,textColor:i,x:a,label:o,fontFamily:s}=t;if(e.strokeStyle=r,e.lineWidth=1,e.setLineDash([4,4]),e.beginPath(),e.moveTo(X(a),n.top),e.lineTo(X(a),n.top+n.height),e.stroke(),e.setLineDash([]),o!=null&&o.length>0){e.font=`11px ${s}`,e.fillStyle=i;let t=e.measureText(o).width,r=a+4+t<=n.left+n.width;e.textAlign=r?`left`:`right`,e.textBaseline=`top`,e.fillText(o,r?a+4:a-4,n.top+3)}},Ye=(e,t)=>{let{plot:n,color:r,fontFamily:i,xLabels:a,yLabels:o}=t;e.save(),e.font=`11px ${i}`,e.fillStyle=r,e.textAlign=`right`,e.textBaseline=`middle`;for(let t of o)e.globalAlpha=t.alpha,e.fillText(t.text,n.left-8,t.position);e.textAlign=`center`,e.textBaseline=`top`;for(let t of a)e.globalAlpha=t.alpha,e.fillText(t.text,t.position,n.top+n.height+8);e.restore()},Xe=e=>{let t=e.length,n=e[0]?.length??0,r=[],i=[];for(let e=0;e<t;e++)r.push(new Float64Array(n)),i.push(new Float64Array(n));let a=0,o=0,s=new Float64Array(n),c=new Float64Array(n);for(let l=0;l<t;l++){let t=e[l],u=r[l],d=i[l];if(t!=null&&u!=null&&d!=null)for(let e=0;e<n;e++){let n=t[e]??NaN;if(Number.isNaN(n)){u[e]=NaN,d[e]=NaN;continue}if(n>=0){let t=s[e]??0,r=t+n;s[e]=r,u[e]=t,d[e]=r,r>o&&(o=r)}else{let t=c[e]??0,r=t+n;c[e]=r,u[e]=r,d[e]=t,r<a&&(a=r)}}}return{lower:r,upper:i,min:a,max:o}},Ze=e=>1-(1-e)**3;var Qe=class{#e=new Float64Array;#t=new Float64Array;#n=new Float64Array;#r=0;#i=0;#a=!1;get active(){return this.#a}values(){return this.#n}retarget(e,t){let{duration:n,now:r}=t,i=e.length,a=this.#n.length!==i;if(a&&(this.#e=new Float64Array(i),this.#t=new Float64Array(i),this.#n=new Float64Array(i)),a||n<=0){for(let t=0;t<i;t++){let n=e[t]??NaN;this.#e[t]=n,this.#t[t]=n,this.#n[t]=n}this.#a=!1;return}let o=!1;for(let t=0;t<i;t++){let n=e[t]??NaN,r=this.#n[t]??NaN;if(r!==n&&!(Number.isNaN(r)&&Number.isNaN(n))){o=!0;break}}if(!o){for(let t=0;t<i;t++)this.#t[t]=e[t]??NaN;this.#a=!1;return}for(let t=0;t<i;t++)this.#e[t]=this.#n[t]??NaN,this.#t[t]=e[t]??NaN;this.#r=r,this.#i=n,this.#a=!0}snap(){this.#n.set(this.#t),this.#a=!1}tick(e){if(!this.#a)return!1;let t=Math.min(1,(e-this.#r)/this.#i),n=Ze(t);for(let e=0;e<this.#n.length;e++){let t=this.#e[e]??NaN,r=this.#t[e]??NaN;if(Number.isNaN(t)||Number.isNaN(r)){this.#n[e]=r;continue}this.#n[e]=t+(r-t)*n}return t>=1&&(this.#a=!1),this.#a}},Z=class{#e=new Float64Array;#t=new Float64Array;#n=0;#r=!1;#i;#a;#o=0;constructor(e={}){this.#i=e.speed??.14,this.#a=e.epsilon??.001}get active(){return this.#r}values(){return this.#t}jump(e){this.#t.length!==e.length&&(this.#e=new Float64Array(e.length),this.#t=new Float64Array(e.length));for(let t=0;t<e.length;t++){let n=e[t]??NaN;this.#e[t]=n,this.#t[t]=n}this.#r=!1}aim(e,t){if(this.#t.length!==e.length){this.jump(e);return}let n=!1;for(let t=0;t<e.length;t++){let r=e[t]??NaN,i=this.#e[t]??NaN;if(i!==r&&!(Number.isNaN(i)&&Number.isNaN(r))){n=!0;break}}if(!n)return;let r=0;for(let t=0;t<e.length;t++){let n=e[t]??NaN;this.#e[t]=n;let i=Math.abs(n-(this.#t[t]??NaN));Number.isFinite(i)&&i>r&&(r=i)}this.#o=r,this.#r||(this.#r=!0,this.#n=t)}tick(e){if(!this.#r)return!1;let t=Math.min(50,Math.max(0,e-this.#n));this.#n=e;let n=1-(1-this.#i)**(t/16.67),r=Math.max(this.#o*this.#a,2**-52),i=!0;for(let e=0;e<this.#t.length;e++){let t=this.#e[e]??NaN,a=this.#t[e]??NaN;if(Number.isNaN(t)||Number.isNaN(a)){this.#t[e]=t;continue}let o=a+(t-a)*n;n>0&&o===a||Math.abs(t-o)<=r?this.#t[e]=t:(this.#t[e]=o,i=!1)}return this.#r=!i,this.#r}};const $e=e=>`${e.colorInput}|${e.texture}`,et={bar:`BarChart.Bar`,line:`LineChart.Line`,area:`AreaChart.Area`,scatter:`ScatterPlot.Point`},tt=1e3;var nt=class{#e;#t;#n;#r={xKey:``,xScale:`linear`,yDomain:[`auto`,`auto`],orientation:`vertical`,zKey:null,dimensions:3,stacked:!1,animate:!0};#i={onDatumActivate:null,onActiveIndexChange:null};#a;#o=null;#s=null;#c=null;#l=null;#u=0;#d=0;#f=1;#p=[];#m=0;#h=new Float64Array;#g=[];#_=null;#v=null;#y=!1;#b=!1;#x=new Map;#S=0;#C=0;#w=null;#T=new Z({speed:.16});#E=new Z({speed:.2});#D=new Map;#O=new Map;#k=!1;#A=new Map;#j=new Map;#M=0;#N=!1;#P=new Map;#F={alpha:0,target:0};#I=0;#L=null;#R=null;#z=null;#B={left:0,top:0,width:0,height:0};#V=null;#H=new Float64Array;#U=[0,1];#W={yaw:.65,pitch:-.35};#G=new Z({speed:.12});#K=new Z({speed:.16});#q=null;#J=!1;#Y=null;#X=new Int32Array;#Z=new Map;#Q=``;#$=null;#ee=null;#te=null;#ne=void 0;#re=null;#ie=!1;#ae=null;#oe=null;#se={width:0,height:0};#ce=!1;#le=!1;#ue=0;#de=!1;constructor(e){this.#e=e.kind,this.#t=e.elements,this.#n=e.store,this.#a=e.elements.canvas.getContext(`2d`),this.#n.onSeriesChange=()=>{this.#b=!0,this.#Ce()},this.#n.onPresentationChange=()=>{this.#Ce()},typeof ResizeObserver<`u`&&(this.#o=new ResizeObserver(e=>{let t=e[0];t!=null&&(this.#u=t.contentRect.width,this.#d=t.contentRect.height,this.#f=this.#De(),this.#P.clear(),this.#$=null,this.#Ce())}),this.#o.observe(e.elements.plot),this.#c=new ResizeObserver(()=>{this.#se={width:this.#t.tooltip.offsetWidth,height:this.#t.tooltip.offsetHeight},this.#we()}),this.#c.observe(e.elements.tooltip));let t=e.elements.root.ownerDocument.documentElement;this.#s=P(t,()=>{this.#z=null,this.#Ce()}),this.#fe(),this.#K.jump([1,1])}destroy(){this.#de=!0,this.#o?.disconnect(),this.#c?.disconnect(),this.#s?.(),this.#l?.(),this.#n.onSeriesChange=null,this.#n.onPresentationChange=null,this.#L!=null&&(clearTimeout(this.#L),this.#L=null),this.#ue!==0&&cancelAnimationFrame(this.#ue)}#fe(){if(typeof matchMedia>`u`||this.#de)return;this.#l?.();let e=matchMedia(`(resolution: ${this.#De()}dppx)`),t=()=>{this.#f=this.#De(),this.#P.clear(),this.#Ce(),this.#fe()};e.addEventListener(`change`,t,{once:!0}),this.#l=()=>e.removeEventListener(`change`,t)}setOptions(e){let t=this.#r;if(this.#r=e,t.xScale!==e.xScale&&this.#A.clear(),t.animate&&!e.animate&&this.#pe(),t.dimensions!==e.dimensions){let t=[+(e.dimensions>=2),+(e.dimensions>=3)],n=rt(e.dimensions);if(this.#ge()===0||!this.#k)this.#K.jump(t),this.#W=n,this.#G.jump([n.yaw,n.pitch]);else{let e=n.yaw+Math.round((this.#W.yaw-n.yaw)/(Math.PI*2))*Math.PI*2;this.#K.aim(t,performance.now()),this.#G.jump([this.#W.yaw,this.#W.pitch]),this.#G.aim([e,n.pitch],performance.now())}}(t.xKey!==e.xKey||t.xScale!==e.xScale||t.zKey!==e.zKey||t.stacked!==e.stacked||t.yDomain[0]!==e.yDomain[0]||t.yDomain[1]!==e.yDomain[1])&&(this.#b=!0),this.#Ce()}setCallbacks(e){this.#i=e}setRows(e){e!==this.#p&&(this.#p=e,this.#b=!0,this.#Ce())}flushIngest(){!this.#b||this.#de||(this.#b=!1,this.#me())}setControlledActiveIndex(e){let t=this.#re;this.#re=null;let n=this.#ne!==void 0;if(this.#ne=e,e!==void 0){let n=t!=null&&t.index===e&&t.viaKeyboard;this.#Qe(e==null?null:this.#Ye(e),{viaKeyboard:n,notify:!1})}else n&&this.#Qe(null,{viaKeyboard:!1,notify:!1});this.#we()}handlePointerMove(e,t){if(this.#q!=null){let n=e-this.#q.lastX,r=t-this.#q.lastY;(this.#q.moved||Math.abs(n)+Math.abs(r)>3)&&(this.#q.moved=!0,this.#W={yaw:this.#W.yaw+n*.008,pitch:pe(this.#W.pitch+r*.008)},this.#G.jump([this.#W.yaw,this.#W.pitch]),this.#q.lastX=e,this.#q.lastY=t,this.#Qe(null,{viaKeyboard:!1,notify:!1}),this.#Ce());return}if(this.#ae=e,this.#oe=t,this.#e===`scatter`){let n=this.#at(e,t);this.#ee=n?.seriesKey??null,this.#$=n==null?null:{x:n.screenX,y:n.screenY},this.#Qe(n?.index??null,{viaKeyboard:!1,notify:!0});return}let n=this.#Xe(e,t);this.#Qe(n,{viaKeyboard:!1,notify:!0})}handlePointerDown(e,t){if(this.#J=!0,this.#ye()){this.#q={lastX:e,lastY:t,moved:!1};return}this.handlePointerMove(e,t)}handlePointerUp(e,t){let n=this.#q;this.#q=null;let r=this.#J;if(this.#J=!1,n!=null){if(n.moved)return;this.handlePointerMove(e,t)}r&&this.handleActivate(e,t)}handlePointerLeave(){this.#ae=null,this.#oe=null,this.#q=null,this.#J=!1,this.#ee=null,this.#$=null,this.#Qe(null,{viaKeyboard:!1,notify:!0})}handleActivate(e,t){let n=this.#qe();if(n==null)return;let r=this.#Je(n),i=this.#p[r];if(i==null)return;let a=this.#e===`scatter`?this.#ee:e==null||t==null?null:this.#Ze(n,e,t);this.#i.onDatumActivate?.({index:r,xValue:this.#g[n]??``,datum:i,dataKey:a})}handleKeyDown(e){if(this.#m===0)return!1;let t=this.#m-1,n=this.#qe(),r=this.#N?Math.max(1,Math.floor(this.#m/Math.max(1,this.#B.width*this.#f))):1,i=Math.max(1,Math.floor(this.#m/10)),a=(()=>{switch(e){case`ArrowLeft`:return Math.max(0,(n??this.#m)-r);case`ArrowRight`:return Math.min(t,(n??-1)+r);case`PageUp`:return Math.min(t,(n??0)+i);case`PageDown`:return Math.max(0,(n??t)-i);case`Home`:return 0;case`End`:return t;case`Escape`:return null;default:return}})();return a===void 0?e===`Enter`||e===` `?(this.handleActivate(null,null),!0):!1:(this.#ae=null,this.#oe=null,this.#ee=null,this.#$=null,this.#Qe(a,{viaKeyboard:!0,notify:!0}),!0)}invalidateColors(){this.#z=null,this.#Ce()}#pe(){this.#T.jump(this.#_e()),this.#E.jump(this.#ve()),this.#K.jump([+(this.#r.dimensions>=2),+(this.#r.dimensions>=3)]);let e=rt(this.#r.dimensions);this.#W=e,this.#G.jump([e.yaw,e.pitch]);for(let e of this.#D.values())e.snap();for(let e of this.#O.values())e.snap();this.#F.alpha=this.#F.target,this.#Ce()}#me(){let e=this.#p,{xKey:t,xScale:n}=this.#r,r=this.#n.seriesSpecs();this.#P.clear();let i=this.#h;if(n===`band`||n===`point`){let n=e.length,r=new Float64Array(n),i=Array.from({length:n},()=>``),a=!1;for(let o=0;o<n;o++){let n=e[o],s=n==null?void 0:E(n,t);s!==void 0&&(a=!0),i[o]=typeof s==`string`||typeof s==`number`||s instanceof Date?s:String(s),r[o]=o}m(n===0||a,`${this.#xe()} xKey "${t}" does not match any key in the provided data. Available keys: ${Object.keys(e[0]??{}).join(`, `)}.`),this.#_=null,this.#v=null,this.#m=n,this.#h=r,this.#g=i}else{let r=[],i=!1,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e[s],l=c==null?void 0:E(c,t);l!==void 0&&(i=!0),l!=null&&(a=!0);let u=ct(l,n===`time`);Number.isFinite(u)&&(r.push({source:s,x:u}),o=!0)}m(e.length===0||i,`${this.#xe()} xKey "${t}" does not match any key in the provided data. Available keys: ${Object.keys(e[0]??{}).join(`, `)}.`),m(!a||o,`${this.#xe()} could not read any "${t}" values as ${n===`time`?`dates`:`numbers`} for the "${n}" x scale — check the xScale and the data types.`);let s=!0;for(let e=1;e<r.length;e++)if((r[e]?.x??0)<(r[e-1]?.x??0)){s=!1;break}let c=s?r:r.toSorted((e,t)=>e.x-t.x),l=c.length,u=new Float64Array(l),d=Array.from({length:l},()=>``),f=l===e.length,p=new Int32Array(l);for(let e=0;e<l;e++){let t=c[e];t!=null&&(u[e]=t.x,n===`time`?d[e]=new Date(t.x):d[e]=t.x,p[e]=t.source,t.source!==e&&(f=!1))}if(f)this.#_=null,this.#v=null;else{this.#_=p;let t=new Int32Array(e.length).fill(-1);for(let e=0;e<l;e++){let n=p[e];n!=null&&(t[n]=e)}this.#v=t}this.#m=l,this.#h=u,this.#g=d}let a=!1;for(let e of this.#g)if(e instanceof Date&&ce(e)){a=!0;break}this.#y=a;let o=this.#h[0],s=this.#h[this.#m-1],c=i[0],l=i[i.length-1];!this.#ye()&&(n===`linear`||n===`time`)&&o!=null&&s!=null&&c!=null&&l!=null&&o>c&&s>=l?(this.#F.target=1,this.#I=performance.now()):(o!==c||s!==l)&&(this.#F.target=0);let u=this.#m,d=i.length===u&&u<=2500;if(d){for(let e=0;e<u;e++)if(i[e]!==this.#h[e]){d=!1;break}}let f=this.#x;this.#x=new Map;let p=1/0,h=-1/0;for(let t of r){let n=new Float64Array(u),r=!1;for(let i=0;i<u;i++){let a=e[this.#_==null?i:this.#_[i]??i],o=a==null?void 0:E(a,t.dataKey);if(o===void 0){n[i]=NaN;continue}r=!0;let s=typeof o==`number`&&Number.isFinite(o)?o:NaN;n[i]=s,Number.isNaN(s)||(s<p&&(p=s),s>h&&(h=s))}m(u===0||r,`${et[t.mark]} dataKey "${t.dataKey}" does not match any key in the provided data. Available keys: ${Object.keys(e[0]??{}).join(`, `)}.`),this.#x.set(t.dataKey,n)}this.#S=p===1/0?0:p,this.#C=h===-1/0?0:h;let g=this.#r.zKey;if(this.#e===`scatter`&&g!=null){let t=new Float64Array(u),n=1/0,r=-1/0,i=!1;for(let a=0;a<u;a++){let o=e[this.#_==null?a:this.#_[a]??a],s=o==null?void 0:E(o,g);s!==void 0&&(i=!0);let c=typeof s==`number`&&Number.isFinite(s)?s:NaN;t[a]=c,Number.isNaN(c)||(c<n&&(n=c),c>r&&(r=c))}m(u===0||i,`ScatterPlot.Root zKey "${g}" does not match any key in the provided data. Available keys: ${Object.keys(e[0]??{}).join(`, `)}.`),this.#H=t,this.#U=n===1/0?[0,1]:Y([n,r],5)}else this.#H=new Float64Array;this.#Y=null,this.#$=null,this.#w=this.#r.stacked?Xe(r.map(e=>this.#x.get(e.dataKey)??new Float64Array)):null,this.#N=R({pointCount:u,columnCount:Math.max(1,Math.round(this.#B.width*this.#f)),wasDecimated:this.#N});let _=this.#z;if(_!=null){for(let e of this.#n.seriesMeta())if(_.inputs.get(e.dataKey)!==$e(e)){this.#z=null;break}}this.#he(r,f,d);let v=this.#qe();v!=null&&this.#Qe(Math.min(v,Math.max(0,u-1)),{viaKeyboard:this.#ie,notify:!1}),this.#nt({force:!0})}#he(e,t,n){let r=performance.now(),i=this.#ge(),a=!this.#k;this.#k=this.#k||this.#m>0,a||i===0?(this.#T.jump(this.#_e()),this.#E.jump(this.#ve())):(this.#T.aim(this.#_e(),r),this.#E.aim(this.#ve(),r));let o=this.#m>0&&this.#m<=2500&&n,s=new Set,c=(e,t,n)=>{s.add(e);let a=this.#D.get(e);a??(a=new Qe,this.#D.set(e,a));let c=o&&n&&a.values().length===t.length;a.retarget(t,{duration:c?i:0,now:r})};e.forEach((e,n)=>{let i=t.has(e.dataKey);if(this.#w==null?c(e.dataKey,this.#x.get(e.dataKey)??new Float64Array,i):(c(`${e.dataKey}:lower`,this.#w.lower[n]??new Float64Array,i),c(`${e.dataKey}:upper`,this.#w.upper[n]??new Float64Array,i)),!this.#O.has(e.dataKey)&&this.#m>0){let t=new Qe;t.retarget([0],{duration:0,now:r}),t.retarget([1],{duration:this.#ge(),now:r}),this.#O.set(e.dataKey,t)}});for(let e of this.#D.keys())s.has(e)||this.#D.delete(e)}#ge(){return!this.#r.animate||typeof matchMedia<`u`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:280}#_e(){let[e,t]=this.#r.yDomain,n,r;if(this.#w==null?this.#e===`line`||this.#e===`scatter`?(n=this.#S,r=this.#C):(n=Math.min(0,this.#S),r=Math.max(0,this.#C)):(n=Math.min(0,this.#w.min),r=Math.max(0,this.#w.max)),typeof e==`number`&&(n=e),typeof t==`number`&&(r=t),this.#m===0)return[0,1];let i=Y([n,r],5);return[typeof e==`number`?e:i[0],typeof t==`number`?t:i[1]]}#ve(){if(this.#m===0)return[0,1];let e=this.#h[0]??0,t=this.#h[this.#m-1]??0;return e===t?[e-.5,t+.5]:this.#e===`scatter`?Y([e,t],5):[e,t]}#ye(){return this.#e===`scatter`&&this.#r.zKey!=null}#be(){return this.#e===`bar`&&this.#r.orientation===`horizontal`}#xe(){return`${et[this.#e].split(`.`)[0]??`Chart`}.Root`}#Se(e,t){let n=this.#R;n??(n=this.#t.canvas.ownerDocument.createElement(`canvas`),this.#R=n),(n.width!==e||n.height!==t)&&(n.width=e,n.height=t);let r=n.getContext(`2d`);return r==null?null:{canvas:n,ctx:r}}#Ce(){this.#le=!0,this.#Te()}#we(){this.#Te()}#Te(){this.#ce||this.#de||(this.#ce=!0,this.#ue=requestAnimationFrame(()=>{this.#ce=!1,this.#ue=0,this.#Ee()}))}#Ee(){if(!this.#de){if(this.flushIngest(),this.#le){this.#le=!1;let e=performance.now(),t=!1;t=this.#T.tick(e)||t,t=this.#E.tick(e)||t;for(let n of this.#D.values())t=n.tick(e)||t;for(let n of this.#O.values())t=n.tick(e)||t;if(t=this.#K.tick(e)||t,this.#G.tick(e)){t=!0;let e=this.#G.values();this.#W={yaw:e[0]??this.#W.yaw,pitch:e[1]??this.#W.pitch}}this.#Oe(),this.#Ae(),t=this.#Le(e)||t,t&&this.#Ce()}this.#st()}}#De(){return typeof devicePixelRatio==`number`&&devicePixelRatio>0?Math.min(devicePixelRatio,3):1}#Oe(){let e=this.#t.root,t=`${N(e.ownerDocument.documentElement)}|${this.#f}|${this.#r.orientation}`;if(this.#z?.signature===t)return;let n=e.ownerDocument.defaultView;if(n==null)return;let r=this.#a,i=new Map,a=new Map,o=new Map;for(let t of this.#n.seriesMeta()){let n=ee(e,t.colorInput);if(i.set(t.dataKey,n),a.set(t.dataKey,$e(t)),r!=null&&t.mark===`bar`&&t.texture!==`solid`){let i=re(r,{texture:t.texture,color:n,ink:M(e,ne(n)),devicePixelRatio:this.#f,orientation:this.#r.orientation});i!=null&&o.set(t.dataKey,i)}}this.#z={signature:t,series:i,inputs:a,barTextures:o,chrome:te(e),fontFamily:n.getComputedStyle(e).fontFamily||`sans-serif`}}#ke(e){let t=this.#z?.signature??``;t!==this.#Q&&(this.#Z.clear(),this.#Q=t);let n=this.#Z.get(e);if(n!=null)return n;let r=ee(this.#t.root,e);return this.#Z.set(e,r),r}#Ae(){let e=this.#n.getSnapshot(),t=this.#ye(),n=this.#be(),r=!t&&e.xAxis!=null,i=!t&&e.yAxis!=null,a=n?r:i,o=(n?i:r)?24:8,s=Math.max(0,this.#d-8-o);this.#B={left:8,top:8,width:Math.max(0,this.#u-16),height:s};let c=8;if(a){c=40;let e=this.#a;if(e!=null&&this.#z!=null){e.font=`11px ${this.#z.fontFamily}`;let t=0,r=n?this.#Ie().map(e=>e.text):this.#Fe().map(e=>e.text);for(let n of r){let r=e.measureText(n).width;r>t&&(t=r)}c=Math.ceil(t)+14}}this.#B={left:c,top:8,width:Math.max(0,this.#u-c-8),height:s};let l=n?this.#B.top:this.#B.left,u=n?this.#B.top+this.#B.height:this.#B.left+this.#B.width;this.#r.xScale===`band`?this.#V=Se({count:this.#m,rangeStart:l,rangeEnd:u,paddingInner:.2,paddingOuter:.1}):this.#r.xScale===`point`?this.#V=Se({count:this.#m,rangeStart:l,rangeEnd:u,paddingInner:1,paddingOuter:.5}):this.#V=null,this.#N=R({pointCount:this.#m,columnCount:Math.max(1,Math.round(this.#B.width*this.#f)),wasDecimated:this.#N})}#je(){let e=this.#T.values();return G([e[0]??0,e[1]??1],[this.#B.top+this.#B.height,this.#B.top])}#Me(){let e=this.#T.values(),t=this.#be()?[this.#B.left,this.#B.left+this.#B.width]:[this.#B.top+this.#B.height,this.#B.top];return G([e[0]??0,e[1]??1],t)}#Ne(){let e=this.#E.values();return G([e[0]??0,e[1]??1],[this.#B.left,this.#B.left+this.#B.width])}#Pe(e){let t=this.#V;if(t!=null)return q(t,e);let{k:n,b:r}=this.#Ne();return(this.#h[e]??0)*n+r}#Fe(){let e=this.#n.getSnapshot(),t=this.#T.values(),n=we([t[0]??0,t[1]??1],e.yAxis?.tickCount??5),r=e.yAxis?.tickFormat,i=n.length>1?V(Math.abs((n[1]??0)-(n[0]??0))):void 0;return n.map(e=>({value:e,text:r==null?B(e,i==null?void 0:{maximumFractionDigits:i}):r(e)}))}#Ie(){let e=this.#n.getSnapshot(),t=e.xAxis?.tickFormat;if(this.#V!=null){let e=this.#be(),n=e?this.#B.height:this.#B.width,r=Math.max(1,Math.floor(n/(e?15:60))),i=Math.max(1,Math.ceil(this.#m/r)),a=[];for(let e=0;e<this.#m;e+=i){let n=this.#g[e]??``;a.push({index:e,value:e,text:t==null?U(n,{datasetHasTimeOfDay:this.#y}):t(n)})}return a}let n=this.#E.values(),r=[n[0]??0,n[1]??1],i=e.xAxis?.tickCount??Math.max(2,Math.floor(this.#B.width/90));if(this.#r.xScale===`time`){let e=Oe(r);return De(r,i).map(n=>({index:null,value:n,text:t==null?e(n):t(new Date(n))}))}let a=we(r,i),o=a.length>1?V(Math.abs((a[1]??0)-(a[0]??0))):void 0;return a.map(e=>({index:null,value:e,text:t==null?B(e,o==null?void 0:{maximumFractionDigits:o}):t(e)}))}#Le(e){let t=this.#a,n=this.#z;if(t==null||n==null||this.#u<=0||this.#d<=0)return!1;let r=Math.min(50,Math.max(0,e-this.#M));this.#M=e;let i=this.#t.canvas,a=Math.round(this.#u*this.#f),o=Math.round(this.#d*this.#f);(i.width!==a||i.height!==o)&&(i.width=a,i.height=o),t.setTransform(this.#f,0,0,this.#f,0,0),t.clearRect(0,0,this.#u,this.#d);let s=this.#n.getSnapshot(),c=this.#B;if(c.width<=0||c.height<=0)return!1;let l=this.#je(),u=this.#Ne(),d=this.#n.seriesSpecs(),f=this.#ye(),p=this.#ge()===0,m=f?[]:this.#Re(t,n.fontFamily),h=f?[]:this.#ze(t,n.fontFamily),g=it(this.#A,m,r,p);g=it(this.#j,h,r,p)||g;let _=this.#F;if(_.target===1){if(e-this.#I>tt)_.target=0;else if(this.#L==null){let t=tt-(e-this.#I)+17;this.#L=setTimeout(()=>{this.#L=null,this.#Ce()},t)}}if(p)_.alpha=_.target;else{let e=1-(1-(_.target>_.alpha?.16:.08))**(r/16.67);_.alpha+=(_.target-_.alpha)*e,Math.abs(_.target-_.alpha)<.02&&(_.alpha=_.target)}_.alpha!==_.target&&(g=!0);let v=this.#be(),y=v?this.#Me():l,b=e=>this.#V==null?e*u.k+u.b:q(this.#V,e),x=e=>e*y.k+y.b,S=[...this.#A.entries()].map(([e,t])=>({position:b(e),alpha:t.alpha})),C=[...this.#j.entries()].map(([e,t])=>({position:x(e),alpha:t.alpha}));if(s.grid!=null&&!f){let e=s.grid.lines??(v?`vertical`:`horizontal`),r=v?S:C,i=v?C:S;Ae(t,{plot:c,color:n.chrome.grid,xLines:e===`horizontal`?[]:i,yLines:e===`vertical`?[]:r})}let w=Math.min(40,c.width*.25),T=t,E=null;_.alpha>.01&&w>1&&(E=this.#Se(a,o),E!=null&&(E.ctx.setTransform(this.#f,0,0,this.#f,0,0),E.ctx.clearRect(0,0,this.#u,this.#d),T=E.ctx)),T.save(),T.beginPath(),T.rect(c.left,c.top,c.width,c.height+1),T.clip();let D=null;if(this.#e===`bar`?v?this.#Ue(T,d):this.#He(T,d,l):this.#e===`scatter`?D=this.#rt(T,d,l):this.#We(T,d,l),T.restore(),E!=null){T.save(),T.globalCompositeOperation=`destination-out`;let e=T.createLinearGradient(c.left,0,c.left+w,0);e.addColorStop(0,`rgba(0, 0, 0, ${_.alpha})`),e.addColorStop(1,`rgba(0, 0, 0, 0)`),T.fillStyle=e,T.fillRect(c.left,c.top,w,c.height+1),T.restore(),t.drawImage(E.canvas,0,0,this.#u,this.#d)}D!=null&&Ke(t,{textColor:n.chrome.tickText,fontFamily:n.fontFamily,plot:c,center:D.center,axes:D.axes}),this.#e===`bar`&&this.#m>0&&(v?Me(t,{plot:c,color:n.chrome.baseline,x:x(0)}):je(t,{plot:c,color:n.chrome.baseline,y:x(0)}));for(let e of f?[]:s.referenceLines){let r=x(e.y);if(v?r<c.left||r>c.left+c.width:r<c.top||r>c.top+c.height)continue;let i=e.color==null?n.chrome.reference:this.#ke(e.color);v?Je(t,{plot:c,color:i,textColor:n.chrome.tickText,x:r,label:e.label,fontFamily:n.fontFamily}):qe(t,{plot:c,color:i,textColor:n.chrome.tickText,y:r,label:e.label,fontFamily:n.fontFamily})}let O=s.xAxis==null||f?[]:[...this.#A.entries()].map(([e,t])=>({position:b(e),text:t.text,alpha:t.alpha})),k=s.yAxis==null||f?[]:[...this.#j.entries()].map(([e,t])=>({position:x(e),text:t.text,alpha:t.alpha})),A=v?k:O,j=v?O:k;return(A.length>0||j.length>0)&&Ye(t,{plot:c,color:n.chrome.tickText,fontFamily:n.fontFamily,xLabels:A,yLabels:j}),g}#Re(e,t){e.font=`11px ${t}`;let n=this.#be(),r=this.#Ne(),i=[],a=-1/0;for(let t of this.#Ie()){let o=t.index!=null&&this.#V!=null,s=o&&this.#V!=null?q(this.#V,t.index??0):t.value*r.k+r.b,c=n?15/2:e.measureText(t.text).width/2,l=n?2:8;s-c<a+l||(a=s+c,i.push({key:o?t.index??0:t.value,text:t.text}))}return i}#ze(e,t){let n=this.#Fe();if(!this.#be())return n.map(e=>({key:e.value,text:e.text}));e.font=`11px ${t}`;let r=this.#Me(),i=[],a=-1/0;for(let t of n){let n=t.value*r.k+r.b,o=e.measureText(t.text).width/2;n-o<a+8||(a=n+o,i.push({key:t.value,text:t.text}))}return i}#Be(e,t){let n=t===`value`?e.dataKey:`${e.dataKey}:${t}`;if(!this.#N&&this.#m<=2500){let e=this.#D.get(n);if(e!=null&&e.values().length===this.#m)return e.values()}if(t===`value`)return this.#x.get(e.dataKey)??new Float64Array;let r=this.#n.seriesSpecs().findIndex(t=>t.dataKey===e.dataKey);return(t===`lower`?this.#w?.lower:this.#w?.upper)?.[r]??new Float64Array}#Ve(e){return this.#O.get(e)?.values()[0]??1}#He(e,t,n){let r=this.#V,i=this.#z;if(r==null||i==null||this.#m===0||t.length===0)return;let a=0*n.k+n.b,o=this.#w!=null,s=o?1:t.length,c=r.bandwidth>=8*s?2:+(r.bandwidth>=3*s),l=(r.bandwidth-c*(s-1))/s,u=Math.min(24,l);t.forEach((d,f)=>{let p=this.#Ve(d.dataKey),m=[],h=o?this.#Be(d,`lower`):null,g=o?this.#Be(d,`upper`):this.#Be(d,`value`),_=f===t.length-1;for(let e=0;e<this.#m;e++){let t=g[e]??NaN;if(Number.isNaN(t))continue;let i=h==null?0:h[e]??0,d=o?K(r,e)+(r.bandwidth-u)/2:K(r,e)+(r.bandwidth-(l*s+c*(s-1)))/2+f*(l+c)+(l-u)/2,v=Number.isNaN(i)?a:i*n.k+n.b,y=t*n.k+n.b;y=v+(y-v)*p,o&&h!=null&&f>0&&!Number.isNaN(i)&&c>0&&(v-=Math.sign(v-y)*c),m.push({x:d,width:u,baselineY:v,valueY:y,rounded:!o||_})}Ne(e,{fill:i.barTextures.get(d.dataKey)??i.series.get(d.dataKey)??`currentColor`,rects:m})})}#Ue(e,t){let n=this.#V,r=this.#z;if(n==null||r==null||this.#m===0||t.length===0)return;let i=this.#Me(),a=0*i.k+i.b,o=this.#w!=null,s=o?1:t.length,c=n.bandwidth>=8*s?2:+(n.bandwidth>=3*s),l=(n.bandwidth-c*(s-1))/s,u=Math.min(24,l);t.forEach((d,f)=>{let p=this.#Ve(d.dataKey),m=[],h=o?this.#Be(d,`lower`):null,g=o?this.#Be(d,`upper`):this.#Be(d,`value`),_=f===t.length-1;for(let e=0;e<this.#m;e++){let t=g[e]??NaN;if(Number.isNaN(t))continue;let r=h==null?0:h[e]??0,d=o?K(n,e)+(n.bandwidth-u)/2:K(n,e)+(n.bandwidth-(l*s+c*(s-1)))/2+f*(l+c)+(l-u)/2,v=Number.isNaN(r)?a:r*i.k+i.b,y=t*i.k+i.b;y=v+(y-v)*p,o&&h!=null&&f>0&&!Number.isNaN(r)&&c>0&&(v-=Math.sign(v-y)*c),m.push({y:d,height:u,baselineX:v,valueX:y,rounded:!o||_})}Pe(e,{fill:r.barTextures.get(d.dataKey)??r.series.get(d.dataKey)??`currentColor`,rects:m})})}#We(e,t,n){let r=this.#z;if(r==null||this.#m===0)return;let i=this.#Ne(),a=this.#V,o=e=>a==null?(this.#h[e]??0)*i.k+i.b:q(a,e);t.forEach(t=>{let i=r.series.get(t.dataKey)??`currentColor`,a=this.#Ve(t.dataKey);if(e.save(),a<1&&(e.beginPath(),e.rect(this.#B.left,0,this.#B.width*a,this.#d),e.clip()),this.#N){this.#Ge(e,t,i,n),e.restore();return}let s=t.mark===`area`,c=this.#Be(t,this.#w==null?`value`:`upper`),l=this.#w==null?null:this.#Be(t,`lower`),u=e=>!Number.isNaN(c[e]??NaN),d=[];for(let e=0;e<this.#m;e++)(!t.connectNulls||u(e))&&d.push(e);let f=e=>(c[e]??0)*n.k+n.b;if(s){let r=l==null?()=>0*n.k+n.b:e=>(l[e]??0)*n.k+n.b;Ie(e,{color:i,curve:t.curve,indexes:d,xAt:o,y0At:r,y1At:f,definedAt:u})}else Fe(e,{color:i,curve:t.curve,indexes:d,xAt:o,yAt:f,definedAt:u}),t.markers&&this.#B.width/this.#m>=12&&Be(e,{color:i,surface:r.chrome.surface,shape:t.shape,indexes:d,xAt:o,yAt:f,definedAt:u});e.restore()})}#Ge(e,t,n,r){let i=Math.max(1,Math.round(this.#B.width*this.#f)),a=e=>this.#B.left+(e+.5)/this.#f;if(t.mark===`area`){let o=this.#Ke(`${t.dataKey}:upper`,this.#Be(t,this.#w==null?`value`:`upper`),i),s=this.#w==null?null:this.#Ke(`${t.dataKey}:lower`,this.#Be(t,`lower`),i);s==null?Re(e,{color:n,lowerColumns:lt(o,0),upperColumns:o,columnToX:a,valueK:r.k,valueB:r.b}):Re(e,{color:n,lowerColumns:s,upperColumns:o,columnToX:a,valueK:r.k,valueB:r.b});return}Le(e,{color:n,columns:this.#Ke(t.dataKey,this.#Be(t,`value`),i),columnToX:a,valueK:r.k,valueB:r.b})}#Ke(e,t,n){let r=this.#E.values(),i=`${r[0]??0}:${r[1]??1}:${n}`,a=this.#P.get(e);if(a!=null&&a.key===i)return a.columns;let o=G([r[0]??0,r[1]??1],[0,n]),s=ie({xs:this.#h,values:t,startIndex:0,endIndex:this.#m-1,positionK:o.k,positionB:o.b,columnCount:n});return this.#P.set(e,{key:i,columns:s}),s}#qe(){if(this.#m===0)return null;let e;return e=this.#ne===void 0?this.#te:this.#ne==null?null:this.#Ye(this.#ne),e==null?null:Math.min(Math.max(0,e),this.#m-1)}#Je(e){return this.#_==null?e:this.#_[e]??e}#Ye(e){if(this.#p.length===0)return null;let t=Math.min(Math.max(0,e),this.#p.length-1);if(this.#v==null)return t;let n=this.#v[t]??-1;return n===-1?null:n}#Xe(e,t){if(this.#m===0)return null;let n=this.#V;if(n!=null)return Ce(n,this.#be()?t:e);let{k:r,b:i}=this.#Ne();if(r===0)return 0;let a=e;if(this.#N){let t=Math.floor((e-this.#B.left)*this.#f);a=this.#B.left+(t+.5)/this.#f}return le(this.#h,this.#m,(a-i)/r)}#Ze(e,t,n){let r=this.#n.seriesSpecs(),i=this.#be(),a=this.#V;if(this.#e===`bar`&&this.#w==null&&a!=null&&r.length>1){let o=(i?n:t)-K(a,e),s=Math.floor(o/Math.max(1,a.bandwidth)*r.length);return r[Math.min(r.length-1,Math.max(0,s))]?.dataKey??null}let{k:o,b:s}=i?this.#Me():this.#je(),c=i?t:n,l=null,u=1/0;return r.forEach((t,n)=>{let r=(this.#w==null?this.#x.get(t.dataKey):this.#w.upper[n])?.[e]??NaN;if(Number.isNaN(r))return;let i=Math.abs(r*o+s-c);i<u&&(u=i,l=t.dataKey)}),l}#Qe(e,t){let n=e==null||this.#m===0?null:Math.min(Math.max(0,e),this.#m-1),r=this.#ne!==void 0;if(t.notify&&n!==this.#qe()){let e=n==null?null:this.#Je(n);if(this.#i.onActiveIndexChange?.(e),r){this.#re={index:e,viaKeyboard:t.viaKeyboard};return}}this.#ie=t.viaKeyboard,r||(this.#te=n),this.#nt(),this.#we()}#$e=null;#et=!1;#tt=null;#nt(e={force:!1}){let t=this.#qe();if(!e.force&&t===this.#$e&&this.#ie===this.#et&&this.#ee===this.#tt)return;if(this.#$e=t,this.#et=this.#ie,this.#tt=this.#ee,t==null||this.#m===0){this.#n.publishHover(null);return}let n=this.#Je(t),r=this.#p[n]??{},i=this.#n.seriesMeta().map(e=>{let n=this.#x.get(e.dataKey)?.[t]??NaN;return{dataKey:e.dataKey,label:e.label,value:Number.isNaN(n)?null:n,color:e.color}});this.#r.stacked&&i.reverse(),this.#e===`scatter`&&(i=this.#ee==null?i.filter(e=>e.value!=null):i.filter(e=>e.dataKey===this.#ee));let a={index:n,xValue:this.#g[t]??``,datum:r,points:i,viaKeyboard:this.#ie};if(this.#ye()){let e=this.#H[t]??NaN;a.zValue=Number.isNaN(e)?null:e}this.#n.publishHover(a)}#rt(e,t,n){let r=this.#z;if(r==null||this.#m===0||t.length===0)return null;if(this.#ye())return this.#it(e,t);let i=this.#Ne(),a=t.map(e=>{let t=this.#Be(e,`value`),n=[];for(let e=0;e<this.#m;e++)Number.isNaN(t[e]??NaN)||n.push(e);return n}),o=a.reduce((e,t)=>e+t.length,0);return t.forEach((t,s)=>{let c=this.#Be(t,`value`),l=a[s]??[];e.save(),e.globalAlpha=this.#Ve(t.dataKey),Ue(e,{color:r.series.get(t.dataKey)??`currentColor`,surface:r.chrome.surface,shape:t.shape,totalPointCount:o,indexes:l,xAt:e=>(this.#h[e]??0)*i.k+i.b,yAt:e=>(c[e]??0)*n.k+n.b,radiusAt:()=>4}),e.restore()}),null}#it(e,t){let n=this.#z;if(n==null)return null;let r=this.#B,i=de(this.#W),a=r.left+r.width/2,o=r.top+r.height/2,s=this.#K.values(),c=s[0]??1,l=s[1]??1,u=.85-.22*c-.11*l,d=Math.min(r.width,r.height)/2*u,f=this.#E.values(),p=[f[0]??0,f[1]??1],m=this.#T.values(),h=[m[0]??0,m[1]??1],g=this.#U,_=t.map(e=>this.#Ve(e.dataKey)),v=this.#K.values(),y=v[0]??1,b=v[1]??1,x=(e,t,n)=>{let r=fe(e,t,n,i);return{x:a+r.x*d,y:o-r.y*d}},S=he.map(([e,t,n])=>x(e,t,n)),C=t[0],w=t.length===1&&C!=null?C.dataKey:`y`,T=[{label:this.#r.xKey,alpha:1,from:x(-1,-y,-b),to:x(1,-y,-b)},{label:w,alpha:y,from:x(-1,-1,-b),to:x(-1,1,-b)},{label:this.#r.zKey??`z`,alpha:b,from:x(-1,-y,-1),to:x(-1,-y,1)}];Ge(e,{gridColor:n.chrome.grid,axisColor:n.chrome.baseline,corners:S,edges:ge,cubeAlpha:b,axes:T});let E=this.#m*t.length,D=this.#Y;(D==null||D.screenX.length<E)&&(D={screenX:new Float64Array(E),screenY:new Float64Array(E),radius:new Float64Array(E),seriesIndex:new Int32Array(E),pointIndex:new Int32Array(E),depths:new Float64Array(E),count:0});let O=D.depths,k=0;t.forEach((e,t)=>{let n=this.#Be(e,`value`);for(let e=0;e<this.#m;e++){let r=n[e]??NaN,s=this.#H[e]??NaN;if(Number.isNaN(r)||Number.isNaN(s))continue;let c=fe(me(this.#h[e]??0,p),me(r,h)*y,me(s,g)*b,i);D.screenX[k]=a+c.x*d,D.screenY[k]=o-c.y*d,D.radius[k]=4*c.scale,D.seriesIndex[k]=t,D.pointIndex[k]=e,O[k]=c.depth,k+=1}}),D.count=k,this.#Y=D,this.#X.length<k&&(this.#X=new Int32Array(E));let A=this.#X.subarray(0,k);for(let e=0;e<k;e++)A[e]=e;return A.sort((e,t)=>(O[t]??0)-(O[e]??0)),We(e,{count:k,order:A,screenX:D.screenX,screenY:D.screenY,radius:D.radius,colorAt:e=>{let r=t[D.seriesIndex[e]??0];return r==null?`currentColor`:n.series.get(r.dataKey)??`currentColor`},shapeAt:e=>t[D.seriesIndex[e]??0]?.shape??`circle`,alphaAt:e=>_[D.seriesIndex[e]??0]??1,surface:n.chrome.surface}),{center:{x:a,y:o},axes:T}}#at(e,t){let n=this.#n.seriesSpecs(),r=576,i=null;if(this.#ye()){let a=this.#Y;if(a==null)return null;for(let o=0;o<a.count;o++){let s=(a.screenX[o]??0)-e,c=(a.screenY[o]??0)-t,l=s*s+c*c;if(l<r){let e=n[a.seriesIndex[o]??0];if(e==null)continue;r=l,i={seriesKey:e.dataKey,index:a.pointIndex[o]??0,screenX:a.screenX[o]??0,screenY:a.screenY[o]??0}}}return i}let a=this.#Ne(),o=this.#je();for(let s of n){let n=this.#x.get(s.dataKey);if(n!=null)for(let c=0;c<this.#m;c++){let l=n[c]??NaN;if(Number.isNaN(l))continue;let u=(this.#h[c]??0)*a.k+a.b,d=l*o.k+o.b,f=u-e,p=d-t,m=f*f+p*p;m<r&&(r=m,i={seriesKey:s.dataKey,index:c,screenX:u,screenY:d})}}return i}#ot(e){let t=this.#n.seriesSpecs();if(this.#ye()){let t=this.#Y;if(t==null)return null;for(let n=0;n<t.count;n++)if((t.pointIndex[n]??-1)===e)return{x:t.screenX[n]??0,y:t.screenY[n]??0};return null}let n=this.#Ne(),r=this.#je();for(let i of t){let t=this.#x.get(i.dataKey)?.[e]??NaN;if(!Number.isNaN(t))return{x:(this.#h[e]??0)*n.k+n.b,y:t*r.k+r.b}}return null}#st(){let{crosshair:e,band:t,markers:n,tooltip:r}=this.#t,i=this.#qe(),a=i!=null&&this.#m>0,o=this.#e===`bar`,s=this.#e===`scatter`;if(e.style.opacity=a&&!o&&!s?`1`:`0`,t.style.opacity=a&&o?`1`:`0`,n.style.opacity=a&&!o?`1`:`0`,r.style.opacity=a?`1`:`0`,!a)return;let c=this.#B;if(s){let e=this.#$??this.#ot(i);if(e==null){n.style.opacity=`0`,r.style.opacity=`0`;return}for(;n.children.length>1;)n.lastElementChild?.remove();n.children.length===0&&n.appendChild(ot(n.ownerDocument));let t=n.children[0];if(t instanceof HTMLElement){let n=this.#n.seriesMeta(),r=this.#ee==null?n.find(e=>{let t=this.#x.get(e.dataKey)?.[i]??NaN;return!Number.isNaN(t)}):n.find(e=>e.dataKey===this.#ee);t.style.opacity=`1`,st(t,r?.shape??`circle`,r?.color??`currentColor`),t.style.transform=`translate3d(${e.x}px, ${e.y}px, 0)`}this.#ct(e.x,e.y);return}let l=this.#Pe(i),u=this.#be();if(o){let e=this.#V;if(e!=null){let n=K(e,i)-(e.step-e.bandwidth)/2;u?(t.style.transform=`translate3d(${c.left}px, ${n}px, 0)`,t.style.width=`${c.width}px`,t.style.height=`${Math.max(e.step,24)}px`):(t.style.transform=`translate3d(${n}px, ${c.top}px, 0)`,t.style.width=`${Math.max(e.step,24)}px`,t.style.height=`${c.height}px`)}}else{e.style.transform=`translate3d(${l}px, ${c.top}px, 0)`,e.style.height=`${c.height}px`;let t=this.#n.seriesMeta(),r=this.#n.seriesSpecs();for(;n.children.length>t.length;)n.lastElementChild?.remove();for(;n.children.length<t.length;)n.appendChild(ot(n.ownerDocument));let a=this.#je();t.forEach((e,t)=>{let o=n.children[t];if(!(o instanceof HTMLElement))return;let s=this.#x.get(e.dataKey)?.[i]??NaN,c=r[t],u=c==null?NaN:this.#Be(c,this.#w==null?`value`:`upper`)[i]??NaN;if(Number.isNaN(s)||Number.isNaN(u)){o.style.opacity=`0`;return}o.style.opacity=`1`,st(o,e.shape,e.color),o.style.transform=`translate3d(${l}px, ${u*a.k+a.b}px, 0)`})}o&&u&&this.#V!=null?this.#ct(this.#ae??c.left+c.width/2,q(this.#V,i)):this.#ct(l,this.#oe??c.top+8)}#ct(e,t){let n=this.#B,r=this.#t.tooltip,i=this.#se,a=e+12;a+i.width>n.left+n.width&&e-12-i.width>=n.left&&(a=e-12-i.width);let o=Math.min(Math.max(n.top,t-i.height/2),n.top+n.height-i.height);r.style.transform=`translate3d(${a}px, ${Math.max(n.top,o)}px, 0)`}};const rt=e=>e===3?{yaw:.65,pitch:-.35}:{yaw:0,pitch:0},it=(e,t,n,r)=>{for(let t of e.values())t.target=0;for(let n of t){let t=e.get(n.key);t==null?e.set(n.key,{alpha:+!!r,target:1,text:n.text}):(t.target=1,t.text=n.text)}let i=1-.84**(n/16.67),a=1-.88**(n/16.67),o=!1;for(let[t,n]of e){if(r)n.alpha=n.target;else{let e=n.target>n.alpha?i:a;n.alpha+=(n.target-n.alpha)*e}if(n.target===1&&n.alpha>.98&&(n.alpha=1),n.target===0&&n.alpha<.03){e.delete(t);continue}n.alpha!==n.target&&(o=!0)}return o},at={circle:`circle(50%)`,square:`inset(8%)`,triangle:`polygon(50% 0%, 100% 100%, 0% 100%)`,diamond:`polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)`},ot=e=>{let t=e.createElement(`div`);t.setAttribute(`data-slot`,`chart-active-point`),t.style.position=`absolute`,t.style.width=`12px`,t.style.height=`12px`,t.style.left=`-6px`,t.style.top=`-6px`;let n=e.createElement(`div`);n.style.position=`absolute`,n.style.inset=`0`,n.style.backgroundColor=`var(--background-color-card)`;let r=e.createElement(`div`);return r.style.position=`absolute`,r.style.inset=`2px`,t.appendChild(n),t.appendChild(r),t},st=(e,t,n)=>{let r=at[t];e.setAttribute(`data-shape`,t);let[i,a]=e.children;i instanceof HTMLElement&&(i.style.clipPath=r),a instanceof HTMLElement&&(a.style.clipPath=r,a.style.backgroundColor=n)},ct=(e,t)=>e instanceof Date?e.getTime():typeof e==`number`?e:t&&typeof e==`string`?new Date(e).getTime():NaN,lt=(e,t)=>({columnCount:e.columnCount,hasData:e.hasData,minValue:new Float64Array(e.columnCount).fill(t),maxValue:new Float64Array(e.columnCount).fill(t),inValue:new Float64Array(e.columnCount).fill(t),outValue:new Float64Array(e.columnCount).fill(t)}),ut=e=>e.replaceAll(`|`,`\\|`).replaceAll(/\s*\n\s*/g,` `),dt=e=>e instanceof Date?Number.isNaN(e.getTime())?`—`:e.toISOString():typeof e==`number`?Number.isFinite(e)?String(e):`—`:typeof e==`string`?ut(e):`—`,ft=e=>typeof e==`number`&&Number.isFinite(e)?String(e):`—`,pt=e=>`| ${e.join(` | `)} |`,mt=({data:e,xKey:t,series:n,zKey:r})=>{let i=[ut(t),...n.map(e=>ut(e.label)),...r==null?[]:[ut(r)]],a=e.map(e=>[dt(E(e,t)),...n.map(t=>ft(E(e,t.dataKey))),...r==null?[]:[ft(E(e,r))]]);return[pt(i),pt(i.map(()=>`---`)),...a.map(e=>pt(e))].join(`
|
|
2
|
+
`)},ht=(e,t)=>e==null?`var(${k(t)})`:O(e)?`var(${k(e)})`:e;var gt=class{#e=new Set;#t={series:[],hover:null,grid:null,xAxis:null,yAxis:null,referenceLines:[],tooltip:null,orientation:`vertical`};#n=new Map;#r=new Map;#i=new Map;#a=new Set;#o=0;#s=0;#c=null;#l=`vertical`;#u=null;#d=null;#f=new Map;#p=new Map;#m=null;#h=null;onSeriesChange=null;onPresentationChange=null;subscribe=e=>(this.#e.add(e),()=>{this.#e.delete(e)});getSnapshot=()=>this.#t;seriesSpecs(){return[...this.#n.values()].toSorted((e,t)=>e.sequence-t.sequence).map(e=>e.spec)}slotFor(e){let t=this.#i.get(e);if(t!=null)return t;for(;this.#s<A.length&&this.#a.has(A[this.#s]??`chart-other`);)this.#s+=1;let n=A[this.#s]??`chart-other`;return this.#s<A.length&&(this.#s+=1),this.#i.set(e,n),this.#a.add(n),n}#g({token:e,pinnedBy:t}){for(let[n,r]of this.#i)if(r===e&&n!==t&&this.#n.get(n)?.spec.color!==e){this.#i.delete(n),this.slotFor(n);return}}registerSeries(e){let t=this.#r.get(e.dataKey)??this.#o++;return this.#r.set(e.dataKey,t),e.color==null?this.slotFor(e.dataKey):O(e.color)&&e.color!==`chart-other`&&(this.#a.add(e.color),this.#g({token:e.color,pinnedBy:e.dataKey})),this.#n.set(e.dataKey,{spec:e,sequence:t}),this.#_({seriesChanged:!0}),()=>{this.#n.get(e.dataKey)?.spec===e&&(this.#n.delete(e.dataKey),this.#_({seriesChanged:!0}))}}setOrientation(e){this.#l!==e&&(this.#l=e,this.#_())}registerGrid(e){let t={lines:e};return this.#c=t,this.#_(),()=>{this.#c===t&&(this.#c=null,this.#_())}}registerXAxis(e){return this.#u=e,this.#_(),()=>{this.#u===e&&(this.#u=null,this.#_())}}registerYAxis(e){return this.#d=e,this.#_(),()=>{this.#d===e&&(this.#d=null,this.#_())}}registerReferenceLine(e,t){let n=this.#p.get(e)??this.#o++;return this.#p.set(e,n),this.#f.set(e,{spec:t,sequence:n}),this.#_(),()=>{this.#f.get(e)?.spec===t&&(this.#f.delete(e),this.#_())}}registerTooltip(e){return this.#m=e,this.#_(),()=>{this.#m===e&&(this.#m=null,this.#_())}}publishHover(e){this.#h!==e&&(this.#h=e,this.#t={...this.#t,hover:e},this.#v())}seriesMeta(){return this.seriesSpecs().map(e=>({dataKey:e.dataKey,label:e.label,mark:e.mark,color:ht(e.color,this.#i.get(e.dataKey)??`chart-other`),colorInput:e.color??this.#i.get(e.dataKey)??`chart-other`,shape:e.shape,texture:e.texture}))}#_(e={seriesChanged:!1}){this.#t={series:this.seriesMeta(),hover:this.#h,grid:this.#c,xAxis:this.#u,yAxis:this.#d,referenceLines:[...this.#f.values()].toSorted((e,t)=>e.sequence-t.sequence).map(e=>e.spec),tooltip:this.#m,orientation:this.#l},this.#v(),e.seriesChanged?this.onSeriesChange?.():this.onPresentationChange?.()}#v(){for(let e of this.#e)e()}};const _t=a(null),Q=e=>{let t=o(_t);return m(t,`${e} must be composed inside ${e.split(`.`)[0]}.Root — it registers into the chart it belongs to and renders nothing on its own.`),t},vt=e=>p(e.subscribe,e.getSnapshot,e.getSnapshot),yt=(e,t)=>{for(let n of e){let e=E(n,t);if(e!=null)return e instanceof Date?`time`:typeof e==`number`?`linear`:`point`}return`point`},bt=[`auto`,`auto`],xt=({kind:r,componentName:i,slotName:a,data:o,xKey:s,xScale:p,zKey:h,dimensions:v=3,yDomain:y=bt,stacked:b=!1,orientation:x=`vertical`,animate:S=!0,pending:C=!1,activeIndex:w,onActiveIndexChange:T,onDatumActivate:D,className:O,children:k,ref:A,"data-slot":j,"aria-label":M,"aria-labelledby":ee,...te})=>{let[N]=f(()=>new gt),P=d(null),[F]=f(()=>({kind:r,componentName:i,store:N,engineRef:P,dataRef:{current:{data:o,xKey:s,zKey:h}}}));l(()=>{F.dataRef.current={data:o,xKey:s,zKey:h}},[F,o,s,h]);let I=d(null),ne=e(I,A),L=d(null),re=d(null),R=d(null),ie=d(null),ae=d(null),oe=d(null),z=c(),B=r===`bar`?`band`:p??yt(o,s);m(r!==`scatter`||o.length===0||B!==`point`,`${i}.Root requires numeric or Date x values — the "${s}" values are not numbers or dates, so they have no position on a continuous scatter axis.`);let[V,se]=y,H=u(()=>{for(let e of o){let t=E(e,s);if(t instanceof Date&&ce(t))return!0}return!1},[o,s]);return l(()=>{let e=I.current,t=L.current,n=re.current,i=R.current,a=ie.current,o=ae.current,s=oe.current;if(e==null||t==null||n==null||i==null||a==null||o==null||s==null)return;let c=new nt({kind:r,store:N,elements:{root:e,plot:t,canvas:n,crosshair:i,band:a,markers:o,tooltip:s}});return P.current=c,()=>{P.current=null,c.destroy()}},[r,N]),l(()=>{P.current?.setOptions({xKey:s,xScale:B,yDomain:[V,se],zKey:h??null,dimensions:v,stacked:b,orientation:x,animate:S}),N.setOrientation(x)},[N,s,B,V,se,h,v,b,x,S]),l(()=>{P.current?.setRows(o)},[o]),l(()=>{P.current?.setCallbacks({onDatumActivate:D??null,onActiveIndexChange:T??null})}),l(()=>{P.current?.setControlledActiveIndex(w)},[w]),l(()=>{P.current?.flushIngest()}),g(`div`,{"data-slot":n(j,a),className:t(`relative flex aspect-video w-full flex-col`,O),ref:ne,...te,children:_(_t.Provider,{value:F,children:[_(`div`,{"data-slot":`${a}-plot`,className:t(`relative min-h-0 w-full flex-1`,C&&`opacity-60 transition-opacity duration-300`),ref:L,children:[g(`canvas`,{"data-slot":`${a}-canvas`,ref:re,"aria-hidden":!0,className:`absolute inset-0 size-full`}),g(`div`,{role:`application`,"aria-label":M,"aria-labelledby":ee,"aria-describedby":z,tabIndex:0,className:t(`focus-visible:ring-focus-accent absolute inset-0 rounded-sm outline-none focus-visible:ring-2`,(r===`line`||r===`area`)&&`cursor-crosshair`,r===`scatter`&&h!=null&&`touch-none cursor-grab active:cursor-grabbing`),onPointerDown:e=>{e.isTrusted&&r===`scatter`&&h!=null&&e.currentTarget.setPointerCapture(e.pointerId),P.current?.handlePointerDown(e.nativeEvent.offsetX,e.nativeEvent.offsetY)},onPointerMove:e=>{P.current?.handlePointerMove(e.nativeEvent.offsetX,e.nativeEvent.offsetY)},onPointerUp:e=>{P.current?.handlePointerUp(e.nativeEvent.offsetX,e.nativeEvent.offsetY)},onPointerLeave:()=>{P.current?.handlePointerLeave()},onPointerCancel:()=>{P.current?.handlePointerLeave()},onBlur:()=>{P.current?.handlePointerLeave()},onKeyDown:e=>{P.current?.handleKeyDown(e.key)&&e.preventDefault()}}),g(`span`,{id:z,className:`sr-only`,children:`Use the left and right arrow keys to move between data points, Home and End to jump to the first and last, and Enter to activate the current point.`}),g(`div`,{ref:R,"aria-hidden":!0,className:`bg-neutral-500 pointer-events-none absolute left-0 top-0 w-px opacity-0`}),g(`div`,{ref:ie,"aria-hidden":!0,className:`bg-neutral-500/10 pointer-events-none absolute left-0 top-0 rounded-sm opacity-0`}),g(`div`,{ref:ae,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 opacity-0`}),g(kt,{slotName:a,store:N,tooltipRef:oe,xHasTimeOfDay:H})]}),k,g(Ft,{store:N,xHasTimeOfDay:H}),g(It,{data:o,label:M,slotName:a,store:N,xHasTimeOfDay:H,xKey:s,zKey:h})]})})},St=(e,t,n)=>{let r=Q(e);m(r.kind===t,`${e} cannot be composed inside ${r.componentName}.Root — compose ${r.componentName} series parts instead.`);let{dataKey:i,label:a,color:o,curve:s=`linear`,markers:c=!1,connectNulls:u=!1,shape:d=`circle`,texture:f=`solid`}=n;return l(()=>r.store.registerSeries({dataKey:i,label:a??i,color:o,mark:t,curve:s,markers:c,connectNulls:u,shape:d,texture:f}),[r.store,i,a,o,t,s,c,u,d,f]),null},Ct=(e,t)=>{let n=Q(e),{lines:r}=t;return l(()=>n.store.registerGrid(r),[n.store,r]),null},wt=(e,t)=>{let n=Q(e),{tickFormat:r,tickCount:i}=t;return l(()=>n.store.registerXAxis({tickFormat:r,tickCount:i}),[n.store,r,i]),null},Tt=(e,t)=>{let n=Q(e),{tickFormat:r,tickCount:i}=t;return l(()=>n.store.registerYAxis({tickFormat:r,tickCount:i}),[n.store,r,i]),null},Et=(e,t)=>{let n=Q(e),r=c(),{y:i,label:a,color:o}=t;return l(()=>n.store.registerReferenceLine(r,{y:i,label:a,color:o}),[n.store,r,i,a,o]),null},Dt=(e,t)=>{let n=Q(e),{labelFormat:r,valueFormat:i,indicator:a=`line`,footer:o,children:s,...c}=t;return l(()=>n.store.registerTooltip({labelFormat:r,valueFormat:i,indicator:a,footer:o,children:s,divProps:c})),null},Ot=(e,t,n)=>e==null?`—`:n==null?B(e):n(e,t),kt=({slotName:n,store:r,tooltipRef:i,xHasTimeOfDay:a})=>{let o=vt(r),s=o.tooltip,c=o.hover,{className:u,ref:f,style:p,...m}=s?.divProps??{},v=d(null),y=e(i,v);l(()=>{if(f==null)return;let e=v.current;if(typeof f==`function`){let t=f(e);return()=>{typeof t==`function`?t():f(null)}}return f.current=e,()=>{f.current=null}},[f]);let b=s?.footer;return g(`div`,{"data-slot":`${n}-tooltip`,ref:y,className:t(`bg-popover border-popover text-strong pointer-events-none absolute left-0 top-0 z-10 min-w-32 rounded-md border px-2.5 py-1.5 text-xs shadow-md`,u),style:{opacity:0,...p},...m,children:c==null?null:s?.children==null?_(h,{children:[g(`div`,{className:`text-muted font-medium`,children:s?.labelFormat==null?U(c.xValue,{datasetHasTimeOfDay:a}):s.labelFormat(c.xValue)}),g(`div`,{className:`mt-1 grid gap-1`,children:c.points.map(e=>_(`div`,{className:`flex items-center gap-1.5`,children:[s?.indicator===`none`?null:g(`span`,{"aria-hidden":!0,className:`h-2.5 w-0.5 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),g(`span`,{className:`text-muted`,children:e.label}),g(`span`,{className:`text-strong ml-auto pl-3 font-medium tabular-nums`,children:Ot(e.value,e.dataKey,s?.valueFormat)})]},e.dataKey))}),c.zValue===void 0?null:_(`div`,{className:`mt-1 flex items-center gap-1.5`,children:[g(`span`,{className:`text-muted`,children:`z`}),g(`span`,{className:`text-strong ml-auto pl-3 font-medium tabular-nums`,children:c.zValue==null?`—`:B(c.zValue)})]}),b==null?null:g(`div`,{className:`text-muted mt-1`,children:typeof b==`function`?b(c):b})]}):s.children(c)})},$=(e,t,n=3)=>`repeating-linear-gradient(${e}, ${t} 0, ${t} 1px, transparent 1px, transparent ${n}px)`,At=`forced-color-adjust-none [print-color-adjust:exact] [-webkit-print-color-adjust:exact]`,jt=(e,t,n)=>{if(e===`solid`)return{};let r=ne(t);return e===`hatch`?{backgroundImage:$(`135deg`,r)}:e===`hatch-reverse`?{backgroundImage:$(`45deg`,r)}:e===`crosshatch`?{backgroundImage:`${$(`135deg`,r,4)}, ${$(`45deg`,r,4)}`}:e===`perpendicular`?{backgroundImage:$(n===`horizontal`?`90deg`:`0deg`,r)}:{backgroundImage:`radial-gradient(circle at 1px 1px, ${r} 0.75px, transparent 0.8px)`,backgroundSize:`3px 3px`}},Mt=({series:e,orientation:n})=>e.mark===`bar`?g(`span`,{"aria-hidden":!0,"data-texture":e.texture,className:t(`size-2 shrink-0 rounded-[2px]`,At),style:{backgroundColor:e.color,...jt(e.texture,e.color,n)}}):e.mark===`line`?_(`span`,{"aria-hidden":!0,className:`relative flex h-2 w-3 shrink-0 items-center justify-center`,children:[g(`span`,{className:t(`absolute inset-x-0 top-1/2 h-0.5 -translate-y-1/2 rounded-full`,At),style:{backgroundColor:e.color}}),g(`span`,{"data-shape":e.shape,className:t(`relative size-2`,At),style:{backgroundColor:e.color,clipPath:at[e.shape]}})]}):g(`span`,{"aria-hidden":!0,"data-shape":e.shape,className:t(`size-2 shrink-0`,At),style:{backgroundColor:e.color,clipPath:at[e.shape]}}),Nt=({partName:e,slotName:n,className:r,children:i,...a})=>{let o=Q(e),s=vt(o.store);return s.series.length<2?null:g(`div`,{"data-slot":`${n}-legend`,className:t(`text-muted flex flex-wrap items-center gap-x-4 gap-y-1 pt-3 text-xs`,r),...a,children:i==null?s.series.map(e=>_(`div`,{className:`flex items-center gap-1.5`,children:[g(Mt,{series:e,orientation:s.orientation}),e.label]},e.dataKey)):i(s.series)})},Pt=({partName:e,slotName:t,label:n=`Copy data as Markdown`,onCopy:a,onCopyError:o,onClick:c,ref:l,...u})=>{let p=Q(e),m=i(),[h,_]=f(!1),b=d(void 0);return s(()=>()=>{b.current!=null&&clearTimeout(b.current)},[]),g(r,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,"data-slot":`${t}-copy-button`,label:n,icon:g(h?v:y,{}),ref:l,onClick:async e=>{try{if(c?.(e),e.defaultPrevented){b.current!=null&&(clearTimeout(b.current),b.current=void 0),_(!1);return}let{data:t,xKey:n,zKey:r}=p.dataRef.current,i=mt({data:t,xKey:n,zKey:r,series:p.store.getSnapshot().series});await m(i),a?.(i),_(!0),b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{_(!1)},2e3)}catch(e){o?.(e)}},...u})},Ft=({store:e,xHasTimeOfDay:t})=>{let n=vt(e),[r,i]=f(``),a=n.hover;return s(()=>{if(a==null||!a.viaKeyboard){i(``);return}let e=a.points.map(e=>`${e.label}: ${e.value==null?`no data`:B(e.value)}`).join(`, `),n=a.zValue===void 0?``:`, z: ${a.zValue==null?`no data`:B(a.zValue)}`,r=setTimeout(()=>{i(`${U(a.xValue,{datasetHasTimeOfDay:t})}. ${e}${n}`)},120);return()=>clearTimeout(r)},[a,t]),g(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:r})},It=({data:e,label:t,slotName:n,store:r,xHasTimeOfDay:i,xKey:a,zKey:o})=>{let s=vt(r);if(e.length===0||s.series.length===0)return null;let c=e.slice(0,150);return g(`div`,{className:`sr-only`,"data-slot":`${n}-data-table`,children:_(`table`,{children:[g(`caption`,{children:`${t==null?`Chart data`:`${t} — chart data`}${e.length>150?`. Showing the first 150 of ${e.length} rows.`:`.`}`}),g(`thead`,{children:_(`tr`,{children:[g(`th`,{scope:`col`,children:a}),s.series.map(e=>g(`th`,{scope:`col`,children:e.label},e.dataKey)),o==null?null:g(`th`,{scope:`col`,children:o})]})}),g(`tbody`,{children:c.map((e,t)=>{let n=E(e,a),r=n instanceof Date&&!Number.isNaN(n.getTime()),c=typeof n==`string`||typeof n==`number`||n instanceof Date?U(n,{datasetHasTimeOfDay:i}):String(n);return _(`tr`,{children:[g(`th`,{scope:`row`,"data-value":typeof n==`number`&&Number.isFinite(n)?n:void 0,children:r?g(`time`,{dateTime:n.toISOString(),children:c}):c}),s.series.map(t=>{let n=E(e,t.dataKey),r=typeof n==`number`&&Number.isFinite(n);return g(`td`,{"data-value":r?n:void 0,children:r?B(n):`—`},t.dataKey)}),o==null?null:(()=>{let t=E(e,o),n=typeof t==`number`&&Number.isFinite(t);return g(`td`,{"data-value":n?t:void 0,children:n?B(t):`—`})})()]},t)})})]})})};export{Et as a,wt as c,Ct as i,Tt as l,Nt as n,St as o,xt as r,Dt as s,Pt as t};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { t as SelfClosingWithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
//#region src/components/chart/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Shared types for the internal canvas chart engine.
|
|
7
|
+
*
|
|
8
|
+
* This module is internal shared implementation — it is not exported from the
|
|
9
|
+
* package. The public components built on it are `BarChart` (../bar-chart),
|
|
10
|
+
* `LineChart` (../line-chart), `AreaChart` (../area-chart), and
|
|
11
|
+
* `ScatterPlot` (../scatter-plot), mirroring how `dialog/primitive` backs
|
|
12
|
+
* the dialog family.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The value of the x field in a chart datum: a category label, a number, or a
|
|
16
|
+
* point in time.
|
|
17
|
+
*/
|
|
18
|
+
type XValue = string | number | Date;
|
|
19
|
+
/**
|
|
20
|
+
* A single row of chart data — any object shape. Series read one numeric key
|
|
21
|
+
* per row; the x key identifies the row's position on the x axis. Missing
|
|
22
|
+
* keys and `null` values are rendered as gaps. Typed as `object` (not an
|
|
23
|
+
* index signature) so interface-typed rows compose without ceremony; reads
|
|
24
|
+
* happen through `datumValue` at the data boundary.
|
|
25
|
+
*/
|
|
26
|
+
type ChartDatum = object;
|
|
27
|
+
/**
|
|
28
|
+
* How x values map onto the x axis:
|
|
29
|
+
*
|
|
30
|
+
* - `"band"` — categorical bands with air between them (bar charts).
|
|
31
|
+
* - `"point"` — categorical positions with no band thickness (line/area over categories).
|
|
32
|
+
* - `"linear"` — continuous numeric axis.
|
|
33
|
+
* - `"time"` — continuous time axis with calendar-aware ticks.
|
|
34
|
+
*/
|
|
35
|
+
type XScaleKind = "band" | "point" | "linear" | "time";
|
|
36
|
+
/**
|
|
37
|
+
* The x scale kinds a consumer may request on line/area charts. Bar charts are
|
|
38
|
+
* always `"band"`.
|
|
39
|
+
*/
|
|
40
|
+
type ContinuousXScale = Exclude<XScaleKind, "band">;
|
|
41
|
+
/**
|
|
42
|
+
* The mark a registered series paints.
|
|
43
|
+
*/
|
|
44
|
+
type SeriesMark = "bar" | "line" | "area" | "scatter";
|
|
45
|
+
/**
|
|
46
|
+
* The ordered chart color tokens. Slots are assigned to series in registration
|
|
47
|
+
* order and stick to their `dataKey` for the chart's lifetime; series past the
|
|
48
|
+
* eighth slot use `"chart-other"`.
|
|
49
|
+
*/
|
|
50
|
+
type ChartColorToken = "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | "chart-6" | "chart-7" | "chart-8" | "chart-other";
|
|
51
|
+
/**
|
|
52
|
+
* A series color: one of the validated chart tokens (preferred — they adapt to
|
|
53
|
+
* light/dark/high-contrast themes) or any CSS color string as an escape hatch.
|
|
54
|
+
* Static colors (e.g. raw hex) do not adapt across themes; custom palettes
|
|
55
|
+
* must be validated for colorblind-safe adjacency and surface contrast. A
|
|
56
|
+
* series that carries good/bad meaning (error rate, pass/fail) should wear the
|
|
57
|
+
* semantic status colors, never a categorical chart slot.
|
|
58
|
+
*/
|
|
59
|
+
type SeriesColor = ChartColorToken | (string & {});
|
|
60
|
+
/**
|
|
61
|
+
* Line/area interpolation between points.
|
|
62
|
+
*/
|
|
63
|
+
type CurveKind = "linear" | "monotone" | "step";
|
|
64
|
+
/**
|
|
65
|
+
* The glyph a series' points wear: scatter marks, line canvas markers, and
|
|
66
|
+
* the hover dot on line/area charts. Shape is a redundant encoding alongside
|
|
67
|
+
* color, so series stay distinguishable without color vision.
|
|
68
|
+
*/
|
|
69
|
+
type PointShape = "circle" | "square" | "triangle" | "diamond";
|
|
70
|
+
/**
|
|
71
|
+
* The fill texture a bar series wears: solid color (the default), diagonal
|
|
72
|
+
* hatch lines at 45° (`"hatch"`), the 135° mirror (`"hatch-reverse"`), both
|
|
73
|
+
* (`"crosshatch"`), rungs perpendicular to the bar's length
|
|
74
|
+
* (`"perpendicular"` — horizontal lines on vertical bars), or an offset dot
|
|
75
|
+
* grid (`"dots"`). Texture is a redundant identity encoding alongside color —
|
|
76
|
+
* inked tone-on-tone at equal loudness across slots — so grouped and stacked
|
|
77
|
+
* series stay distinguishable without color vision, in grayscale print, and
|
|
78
|
+
* under forced colors.
|
|
79
|
+
*/
|
|
80
|
+
type BarTexture = "solid" | "hatch" | "hatch-reverse" | "crosshatch" | "perpendicular" | "dots";
|
|
81
|
+
/**
|
|
82
|
+
* The direction a bar chart's bars run: vertical columns rising from a bottom
|
|
83
|
+
* baseline (the default), or horizontal bars growing rightward from a left
|
|
84
|
+
* baseline — the layout for long category labels, which move into the left
|
|
85
|
+
* gutter at full width instead of colliding under the plot.
|
|
86
|
+
*/
|
|
87
|
+
type BarOrientation = "vertical" | "horizontal";
|
|
88
|
+
/**
|
|
89
|
+
* A series with its resolved presentation, exposed to the legend, tooltip, and
|
|
90
|
+
* data table.
|
|
91
|
+
*/
|
|
92
|
+
type SeriesMeta = {
|
|
93
|
+
dataKey: string;
|
|
94
|
+
label: string;
|
|
95
|
+
mark: SeriesMark;
|
|
96
|
+
/** The CSS color string the series paints with (token-resolved). */
|
|
97
|
+
color: string;
|
|
98
|
+
/** The color as authored (token name or custom string) before resolution. */
|
|
99
|
+
colorInput: SeriesColor;
|
|
100
|
+
/** The point glyph the series wears (scatter marks, legend keys, hover dots). */
|
|
101
|
+
shape: PointShape;
|
|
102
|
+
/** The fill texture the series wears (bar marks and their legend keys). */
|
|
103
|
+
texture: BarTexture;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Grid line orientation.
|
|
107
|
+
*/
|
|
108
|
+
type GridLines = "horizontal" | "vertical" | "both";
|
|
109
|
+
/**
|
|
110
|
+
* The hover/keyboard snapshot published by the engine. One snapshot describes
|
|
111
|
+
* the active x position and every series' value at it — the tooltip, the
|
|
112
|
+
* aria-live announcement, and `onDatumActivate` all read from it.
|
|
113
|
+
*/
|
|
114
|
+
type HoverSnapshot = {
|
|
115
|
+
/** The active row's index in the consumer's `data` array. */
|
|
116
|
+
index: number;
|
|
117
|
+
/** The x value at the active index. */
|
|
118
|
+
xValue: XValue;
|
|
119
|
+
/** The original consumer datum at the active index. */
|
|
120
|
+
datum: ChartDatum;
|
|
121
|
+
/** Every registered series' value at the active index, in visual order. */
|
|
122
|
+
points: Array<{
|
|
123
|
+
dataKey: string;
|
|
124
|
+
label: string;
|
|
125
|
+
/** `null` renders as a gap (an em dash in the tooltip). */
|
|
126
|
+
value: number | null;
|
|
127
|
+
color: string;
|
|
128
|
+
}>;
|
|
129
|
+
/** The depth value at the active index (3D scatter plots only). */
|
|
130
|
+
zValue?: number | null;
|
|
131
|
+
/** Whether the snapshot came from keyboard stepping (vs pointer hover). */
|
|
132
|
+
viaKeyboard: boolean;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Payload for datum activation (click / Enter / Space).
|
|
136
|
+
*/
|
|
137
|
+
type ChartDatumEvent<TDatum extends ChartDatum = ChartDatum> = {
|
|
138
|
+
/** The activated row's index in the consumer's `data` array. */
|
|
139
|
+
index: number;
|
|
140
|
+
/** The x value of the activated row. */
|
|
141
|
+
xValue: XValue;
|
|
142
|
+
/** The activated row itself. */
|
|
143
|
+
datum: TDatum;
|
|
144
|
+
/** The series nearest the pointer when activated by mouse; `null` for keyboard/whole-band activation. */
|
|
145
|
+
dataKey: string | null;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* The y domain for value axes. Bar and area charts anchor the baseline at
|
|
149
|
+
* zero, so their minimum is fixed at `0`; line charts may override both ends.
|
|
150
|
+
*/
|
|
151
|
+
type YDomain = [number | "auto", number | "auto"];
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/chart/primitive.d.ts
|
|
154
|
+
/**
|
|
155
|
+
* The shared React layer of the chart family. `BarChart`, `LineChart`,
|
|
156
|
+
* `AreaChart`, and `ScatterPlot` are thin public wrappers over these
|
|
157
|
+
* primitives, mirroring how `dialog/primitive` backs the dialog family and
|
|
158
|
+
* `list/primitive` backs the list family.
|
|
159
|
+
*
|
|
160
|
+
* Interaction is the Root's UNCONDITIONAL contract: the crosshair/hover band,
|
|
161
|
+
* tooltip, keyboard stepping (arrows / PageUp / PageDown / Home / End /
|
|
162
|
+
* Escape, Enter/Space to activate), aria-live announcements, and the sr-only
|
|
163
|
+
* data table all ship with Root itself. The composed Tooltip part customizes
|
|
164
|
+
* the readout; omitting it never removes the hover layer, and no part removal
|
|
165
|
+
* can strip keyboard access to the data.
|
|
166
|
+
*
|
|
167
|
+
* This module is internal shared implementation — it is not exported from the
|
|
168
|
+
* package.
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* Every chart must have an accessible name: either a direct `aria-label` or
|
|
172
|
+
* an `aria-labelledby` reference to a visible title (preferred when the chart
|
|
173
|
+
* sits under a heading — no drift-prone duplicated text). Enforced at the
|
|
174
|
+
* type level; the name lands on the interaction overlay (the chart's single
|
|
175
|
+
* named element — the canvas itself is aria-hidden so AT never announces the
|
|
176
|
+
* chart twice).
|
|
177
|
+
*/
|
|
178
|
+
type ChartAccessibleName = {
|
|
179
|
+
"aria-label": string;
|
|
180
|
+
"aria-labelledby"?: never;
|
|
181
|
+
} | {
|
|
182
|
+
"aria-labelledby": string;
|
|
183
|
+
"aria-label"?: never;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Root props shared by every chart kind, WITHOUT the accessible-name union or
|
|
187
|
+
* the data/x props. Public wrappers `Omit` from this base and re-intersect
|
|
188
|
+
* `ChartAccessibleName` — `Omit` over a union type flattens it, which would
|
|
189
|
+
* silently make the required accessible name optional.
|
|
190
|
+
*/
|
|
191
|
+
type ChartRootBaseProps = Omit<ComponentProps<"div">, "aria-label" | "aria-labelledby"> & WithDataSlot & {
|
|
192
|
+
/** Override the automatic y domain. */
|
|
193
|
+
yDomain?: YDomain;
|
|
194
|
+
/** Stack the composed series (bar/area charts). */
|
|
195
|
+
stacked?: boolean;
|
|
196
|
+
/** Animate enter/update transitions. `prefers-reduced-motion` always wins. */
|
|
197
|
+
animate?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Hold the previous render at reduced opacity while fresh data loads —
|
|
200
|
+
* never swap a chart that has rendered once for a skeleton.
|
|
201
|
+
*/
|
|
202
|
+
pending?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Controlled active datum index — an index into `data` (`null` = none).
|
|
205
|
+
* Omit for uncontrolled hover.
|
|
206
|
+
*/
|
|
207
|
+
activeIndex?: number | null;
|
|
208
|
+
/** Notified when hover/keyboard moves the active index (an index into `data`). */
|
|
209
|
+
onActiveIndexChange?: (index: number | null) => void;
|
|
210
|
+
/** Notified on datum activation: mark click, or Enter/Space on the focused chart. */
|
|
211
|
+
onDatumActivate?: (event: ChartDatumEvent) => void;
|
|
212
|
+
};
|
|
213
|
+
type GridPrimitiveProps = {
|
|
214
|
+
/** Which gridlines to draw. */
|
|
215
|
+
lines?: GridLines;
|
|
216
|
+
};
|
|
217
|
+
type XAxisPrimitiveProps = {
|
|
218
|
+
/**
|
|
219
|
+
* Format a tick label. Receives the chart's x values: the category value on
|
|
220
|
+
* band/point scales, a `Date` on time scales, and a number on linear scales.
|
|
221
|
+
*/
|
|
222
|
+
tickFormat?: (value: XValue) => string;
|
|
223
|
+
/** Target tick count (continuous scales only; a density-derived default otherwise). */
|
|
224
|
+
tickCount?: number;
|
|
225
|
+
};
|
|
226
|
+
type YAxisPrimitiveProps = {
|
|
227
|
+
/** Format a tick label. Defaults to thousands-separated numbers. */
|
|
228
|
+
tickFormat?: (value: number) => string;
|
|
229
|
+
/** Target tick count. */
|
|
230
|
+
tickCount?: number;
|
|
231
|
+
};
|
|
232
|
+
type ReferenceLinePrimitiveProps = {
|
|
233
|
+
/** The y value the line marks (an SLO threshold, a budget, a limit). */
|
|
234
|
+
y: number;
|
|
235
|
+
/** A short label painted above the line's right end. */
|
|
236
|
+
label?: string;
|
|
237
|
+
/** Line color; defaults to the neutral reference color. */
|
|
238
|
+
color?: SeriesColor;
|
|
239
|
+
};
|
|
240
|
+
type TooltipPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
|
|
241
|
+
/** Format the x/label row of the readout. */
|
|
242
|
+
labelFormat?: (value: XValue) => ReactNode;
|
|
243
|
+
/** Format each series value. */
|
|
244
|
+
valueFormat?: (value: number, dataKey: string) => ReactNode;
|
|
245
|
+
/** The per-series color key: a short stroke (default) or nothing. */
|
|
246
|
+
indicator?: "line" | "none";
|
|
247
|
+
/** Extra content appended below the series rows (e.g. a "view logs" hint). */
|
|
248
|
+
footer?: ReactNode | ((snapshot: HoverSnapshot) => ReactNode);
|
|
249
|
+
/** Replace the entire readout. */
|
|
250
|
+
children?: (snapshot: HoverSnapshot) => ReactNode;
|
|
251
|
+
};
|
|
252
|
+
type LegendPrimitiveProps = Omit<ComponentProps<"div">, "children"> & {
|
|
253
|
+
/** Replace the default legend items; receives the registered series. */
|
|
254
|
+
children?: (series: SeriesMeta[]) => ReactNode;
|
|
255
|
+
};
|
|
256
|
+
type CopyButtonPrimitiveProps = Omit<ComponentProps<"button">, "children" | "type" | "onCopy"> & SelfClosingWithAsChild & {
|
|
257
|
+
/**
|
|
258
|
+
* The accessible label for the copy button. This label will be visually
|
|
259
|
+
* hidden but announced to screen reader users, similar to alt text for
|
|
260
|
+
* img tags.
|
|
261
|
+
*
|
|
262
|
+
* @default "Copy data as Markdown"
|
|
263
|
+
*/
|
|
264
|
+
label?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Callback fired after a successful copy, passes the serialized markdown.
|
|
267
|
+
*/
|
|
268
|
+
onCopy?: (value: string) => void;
|
|
269
|
+
/**
|
|
270
|
+
* Callback fired when an error occurs during copying.
|
|
271
|
+
*/
|
|
272
|
+
onCopyError?: (error: unknown) => void;
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
export { SeriesColor as _, LegendPrimitiveProps as a, XAxisPrimitiveProps as c, BarTexture as d, ChartDatum as f, PointShape as g, CurveKind as h, GridPrimitiveProps as i, YAxisPrimitiveProps as l, ContinuousXScale as m, ChartRootBaseProps as n, ReferenceLinePrimitiveProps as o, ChartDatumEvent as p, CopyButtonPrimitiveProps as r, TooltipPrimitiveProps as s, ChartAccessibleName as t, BarOrientation as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./clsx-DUGZgXfJ.js";import{a as n,r}from"./field-Bpptk_9t.js";import{useEffect as i,useRef as a,useState as o}from"react";import{jsx as s}from"react/jsx-runtime";const c=e=>e===`indeterminate`,l=({"aria-invalid":l,className:u,checked:d,defaultChecked:f,defaultValue:p=`on`,onClick:m,readOnly:h,ref:g,validation:_,...v})=>{let y=a(null),[b]=o(f),x=n(),{ariaInvalid:S,validation:C}=r({"aria-invalid":l,validation:_??x}),w=d??b;i(()=>{y.current&&(y.current.indeterminate=c(w))},[w]);let T=d==null?{defaultChecked:c(b)?void 0:b}:{checked:!c(d)&&d};return s(`input`,{"aria-checked":c(d)?`mixed`:d,"aria-invalid":S,"data-slot":`checkbox`,className:t(`border-form bg-form shrink-0 cursor-pointer select-none appearance-none rounded border disabled:cursor-default disabled:opacity-50`,`bg-center bg-no-repeat focus:outline-hidden`,`focus-visible:border-accent-600 focus-visible:ring-focus-accent focus-visible:outline-hidden focus-visible:ring-4`,`checked:border-accent-600 checked:bg-accent-600 checked:bg-checked-icon`,`indeterminate:border-accent-600 indeterminate:bg-accent-600 indeterminate:bg-indeterminate-icon`,`data-validation-success:border-success-600 data-validation-success:checked:bg-success-600 data-validation-success:indeterminate:bg-success-600 focus-visible:data-validation-success:border-success-600 focus-visible:data-validation-success:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:checked:bg-warning-600 data-validation-warning:indeterminate:bg-warning-600 focus-visible:data-validation-warning:border-warning-600 focus-visible:data-validation-warning:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:checked:bg-danger-600 data-validation-error:indeterminate:bg-danger-600 focus-visible:data-validation-error:border-danger-600 focus-visible:data-validation-error:ring-focus-danger`,`where:block where:size-4 where:p-0`,u),...T,"data-validation":C||void 0,defaultValue:p,onClick:e=>{if(h){e.preventDefault();return}m?.(e)},readOnly:h,ref:e(y,g),type:`checkbox`,...v})};function u({allSelected:e,someSelected:t}){return e?!0:t?`indeterminate`:!1}export{u as n,l as t};
|
package/dist/checkbox.d.ts
CHANGED
package/dist/checkbox.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./checkbox-
|
|
1
|
+
import{n as e,t}from"./checkbox-0EoxOyMA.js";export{t as Checkbox,e as selectAllChecked};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CDk0Bb9z.js";import{t as n}from"./field-B1wqeZr4.js";import{t as r}from"./label-D-D11mlp.js";import{cloneElement as i,createContext as a,isValidElement as o,useContext as s,useId as c,useMemo as l}from"react";import u from"tiny-invariant";import{jsx as d}from"react/jsx-runtime";const f=a(null);function p(e){let t=s(f);return u(t,`Choice.${e} must be rendered inside Choice.Root.`),t}const m={Root:({"aria-describedby":t,"aria-errormessage":r,"aria-invalid":i,children:a,className:o,disabled:u=!1,id:p,name:m,ref:h,...g})=>{let _=s(n),v=_?.id,y=_?.name,b=_?.[`aria-describedby`],x=_?.[`aria-invalid`],S=_?.[`aria-errormessage`],C=c(),w=c(),T=v??p??C,E=[b??t,w].filter(Boolean).join(` `)||void 0,D=l(()=>({controlId:T,descriptionId:w,disabled:u,controlProps:{id:T,name:y??m,disabled:u,"aria-describedby":E,"aria-invalid":x??i,"aria-errormessage":S??r}}),[T,w,u,E,y,m,x,i,S,r]);return d(f.Provider,{value:D,children:d(`div`,{ref:h,"data-slot":`choice`,className:e(`flex w-full items-start gap-2`,o),...g,children:a})})},Indicator:({children:t,className:n,ref:r,...a})=>{let{controlProps:s}=p(`Indicator`),c=o(t)?i(t,{...s,disabled:s.disabled||t.props.disabled===!0,name:s.name??t.props.name,"aria-invalid":s[`aria-invalid`]??t.props[`aria-invalid`],"aria-errormessage":s[`aria-errormessage`]??t.props[`aria-errormessage`]}):t;return d(`span`,{ref:r,"data-slot":`choice-indicator`,className:e(`flex h-lh shrink-0 items-center text-sm`,n),...a,children:c})},Content:({asChild:n,className:r,ref:i,...a})=>d(n?t:`div`,{ref:i,"data-slot":`choice-content`,className:e(`flex min-w-0 flex-1 flex-col gap-0.5`,r),...a}),Label:({className:t,ref:n,...i})=>{let{controlId:a,disabled:o}=p(`Label`);return d(r,{ref:n,"data-slot":`choice-label`,className:e(o&&`opacity-50`,t),...i,htmlFor:a,disabled:o})},Title:({asChild:n,className:r,ref:i,...a})=>{let{disabled:o}=p(`Title`);return d(n?t:`p`,{ref:i,"data-slot":`choice-title`,className:e(`text-strong text-sm font-medium font-sans`,o&&`opacity-50`,r),...a})},Description:({asChild:n,className:r,ref:i,...a})=>{let{descriptionId:o,disabled:s}=p(`Description`);return d(n?t:`p`,{ref:i,id:o,"data-slot":`choice-description`,className:e(`text-body text-sm leading-4`,s&&`opacity-50`,r),...a})}};export{m as t};
|