@adecore/agents-react 0.31.11 → 0.32.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/agents/AccountDot.js +57 -6
- package/dist/agents/AgentIcon.js +88 -12
- package/dist/agents/ModelOptionControl.js +153 -18
- package/dist/agents/ProviderLogo.js +49 -4
- package/dist/agents/account-limits.js +17 -14
- package/dist/agents/accounts.js +99 -67
- package/dist/agents/agent-marks.js +5 -3
- package/dist/agents/model-name.js +42 -31
- package/dist/agents/model-options.js +8 -8
- package/dist/agents/model-requirement.js +17 -14
- package/dist/agents/option-words.d.ts +7 -0
- package/dist/agents/option-words.js +35 -0
- package/dist/agents/provider-paths.js +6 -6
- package/dist/agents/status-look.js +32 -12
- package/dist/chat/account-choice.d.ts +13 -0
- package/dist/chat/account-choice.js +90 -20
- package/dist/chat/actions.js +126 -59
- package/dist/chat/activity.js +5 -5
- package/dist/chat/attachments.js +74 -53
- package/dist/chat/bookmarks.js +58 -48
- package/dist/chat/chat-client.js +344 -263
- package/dist/chat/chat-references.js +3 -3
- package/dist/chat/composer-effort.d.ts +5 -0
- package/dist/chat/composer-effort.js +26 -0
- package/dist/chat/composer-send.js +13 -13
- package/dist/chat/drafts.js +115 -79
- package/dist/chat/forks.js +81 -24
- package/dist/chat/guards.js +15 -43
- package/dist/chat/index.d.ts +3 -1
- package/dist/chat/index.js +3 -2
- package/dist/chat/logic/ansi.js +170 -167
- package/dist/chat/logic/answers.js +2 -2
- package/dist/chat/logic/bookmarks.js +19 -19
- package/dist/chat/logic/command-looks.js +138 -96
- package/dist/chat/logic/context-usage.js +13 -9
- package/dist/chat/logic/continue-after-stop.js +15 -19
- package/dist/chat/logic/effort.d.ts +14 -0
- package/dist/chat/logic/effort.js +34 -0
- package/dist/chat/logic/embedded-code.js +387 -326
- package/dist/chat/logic/fork.js +134 -110
- package/dist/chat/logic/generated-image.js +54 -23
- package/dist/chat/logic/goal.js +28 -20
- package/dist/chat/logic/handback.js +6 -6
- package/dist/chat/logic/json.js +2 -2
- package/dist/chat/logic/limit.js +46 -30
- package/dist/chat/logic/picker-entries.d.ts +5 -3
- package/dist/chat/logic/picker-entries.js +83 -43
- package/dist/chat/logic/resume-compaction.d.ts +14 -1
- package/dist/chat/logic/resume-compaction.js +93 -24
- package/dist/chat/logic/scrubber.js +188 -136
- package/dist/chat/logic/thought.js +13 -16
- package/dist/chat/logic/thread-cards.js +60 -48
- package/dist/chat/logic/timeline-copy.js +30 -38
- package/dist/chat/logic/timeline-target.js +92 -63
- package/dist/chat/logic/timeline.js +499 -355
- package/dist/chat/logic/tool-catalog.js +54 -34
- package/dist/chat/logic/tools.js +106 -82
- package/dist/chat/logic/visual-height.js +18 -18
- package/dist/chat/logic/visual-viewport.js +6 -3
- package/dist/chat/logic/welcome.js +9 -9
- package/dist/chat/logic/workflow.js +45 -34
- package/dist/chat/mentions.js +149 -109
- package/dist/chat/persisted-json.js +51 -54
- package/dist/chat/preferences.d.ts +4 -0
- package/dist/chat/preferences.js +162 -84
- package/dist/chat/prompt-hold.js +9 -9
- package/dist/chat/quote.js +21 -30
- package/dist/chat/reading-width.js +12 -10
- package/dist/chat/recent-messages.js +34 -21
- package/dist/chat/resume-compaction-dismissals.js +25 -5
- package/dist/chat/runtime-modes.js +3 -3
- package/dist/chat/send-key.js +11 -7
- package/dist/chat/stash.js +89 -69
- package/dist/chat/subagent-conversation.js +181 -139
- package/dist/chat/subagent-list.js +65 -67
- package/dist/chat/subagent-support.js +12 -7
- package/dist/chat/subagent-view.js +132 -44
- package/dist/chat/thumbnails.js +88 -60
- package/dist/chat/timeline-flash.js +24 -12
- package/dist/chat/timeline-scroll.js +116 -86
- package/dist/chat/ui/AccountPill.js +126 -15
- package/dist/chat/ui/AnsiOutput.js +62 -6
- package/dist/chat/ui/BookmarkMarker.js +231 -41
- package/dist/chat/ui/BookmarkSubmenu.js +165 -18
- package/dist/chat/ui/ChatActivity.js +649 -70
- package/dist/chat/ui/ChatReferenceChip.js +104 -9
- package/dist/chat/ui/CodeBlock.js +132 -58
- package/dist/chat/ui/Composer.js +866 -132
- package/dist/chat/ui/ComposerInput.js +309 -120
- package/dist/chat/ui/DiffPool.js +75 -14
- package/dist/chat/ui/EditDiff.js +160 -21
- package/dist/chat/ui/FadingWords.js +32 -3
- package/dist/chat/ui/GoalDock.js +235 -42
- package/dist/chat/ui/ImageView.js +617 -61
- package/dist/chat/ui/LimitState.js +446 -72
- package/dist/chat/ui/Markdown.js +991 -173
- package/dist/chat/ui/MermaidBlock.js +238 -68
- package/dist/chat/ui/MessageActions.js +251 -39
- package/dist/chat/ui/ModelMarks.js +55 -5
- package/dist/chat/ui/Pickers.js +664 -113
- package/dist/chat/ui/PromptComposer.js +281 -51
- package/dist/chat/ui/QuoteButton.js +151 -57
- package/dist/chat/ui/ResumeCompactionDock.d.ts +6 -2
- package/dist/chat/ui/ResumeCompactionDock.js +141 -6
- package/dist/chat/ui/RowTime.js +59 -5
- package/dist/chat/ui/RunSettings.js +1744 -154
- package/dist/chat/ui/Scrubber.js +517 -88
- package/dist/chat/ui/ShellCommand.js +183 -107
- package/dist/chat/ui/SubagentControls.js +212 -24
- package/dist/chat/ui/SubagentInfo.js +170 -13
- package/dist/chat/ui/SubagentStopButton.js +115 -24
- package/dist/chat/ui/SubagentTimeline.js +357 -91
- package/dist/chat/ui/Timeline.js +988 -476
- package/dist/chat/ui/TimelineMenu.js +552 -37
- package/dist/chat/ui/UnifiedDiff.js +234 -27
- package/dist/chat/ui/UploadThumb.js +37 -7
- package/dist/chat/ui/VisualDialogs.js +251 -20
- package/dist/chat/ui/VisualFrame.js +321 -95
- package/dist/chat/ui/Welcome.js +72 -7
- package/dist/chat/ui/chips.js +1 -1
- package/dist/chat/ui/code-lines.js +36 -36
- package/dist/chat/ui/code-streaming.js +1 -1
- package/dist/chat/ui/code-theme.js +7 -7
- package/dist/chat/ui/composer/ComposerControls.js +329 -21
- package/dist/chat/ui/composer/ComposerMenu.js +358 -30
- package/dist/chat/ui/composer/DraftParts.js +185 -11
- package/dist/chat/ui/composer/QueuedMessages.js +138 -13
- package/dist/chat/ui/composer/chips.js +29 -19
- package/dist/chat/ui/composer/editor.js +79 -63
- package/dist/chat/ui/composer/insert.js +26 -12
- package/dist/chat/ui/composer/key-handler.js +180 -127
- package/dist/chat/ui/composer/keys.js +90 -73
- package/dist/chat/ui/composer/menu-aria.js +18 -9
- package/dist/chat/ui/composer/placeholder.js +78 -31
- package/dist/chat/ui/composer/surface.js +13 -37
- package/dist/chat/ui/composer/use-chat-controls.js +230 -90
- package/dist/chat/ui/composer/use-compaction-offer.js +50 -18
- package/dist/chat/ui/composer/use-composer-draft.js +65 -34
- package/dist/chat/ui/composer/use-composer-menus.js +478 -193
- package/dist/chat/ui/composer/use-composer-submit.js +251 -109
- package/dist/chat/ui/composer/use-continuable-turn.js +33 -6
- package/dist/chat/ui/composer/use-draft-files.js +245 -93
- package/dist/chat/ui/composer/use-effort-stepper.d.ts +13 -0
- package/dist/chat/ui/composer/use-effort-stepper.js +88 -0
- package/dist/chat/ui/composer/use-notice.js +61 -16
- package/dist/chat/ui/composer/use-pending-requests.js +38 -17
- package/dist/chat/ui/composer/use-prompt-history.js +117 -45
- package/dist/chat/ui/composer/use-prompt-hold.js +119 -35
- package/dist/chat/ui/composer/use-take-back.js +94 -72
- package/dist/chat/ui/diff/ApprovalReview.js +101 -23
- package/dist/chat/ui/diff/DiffFallbackBoundary.js +21 -13
- package/dist/chat/ui/diff/DiffOmitted.js +56 -6
- package/dist/chat/ui/diff/DiffStack.js +92 -8
- package/dist/chat/ui/diff/DiffUnavailable.js +56 -6
- package/dist/chat/ui/diff/EditorEditDiff.js +263 -51
- package/dist/chat/ui/diff/EditorPatchDiff.js +39 -14
- package/dist/chat/ui/diff/LegacyDiffPool.js +27 -10
- package/dist/chat/ui/diff/LegacyEditDiff.js +97 -20
- package/dist/chat/ui/diff/LegacyUnifiedDiff.js +172 -42
- package/dist/chat/ui/diff/RawDiff.js +65 -5
- package/dist/chat/ui/diff/ReviewDiff.js +77 -5
- package/dist/chat/ui/diff/diff-props.js +1 -1
- package/dist/chat/ui/diff/diff-source-budget.js +46 -35
- package/dist/chat/ui/diff/editor-edit-model.js +18 -14
- package/dist/chat/ui/diff/review-plan.js +63 -40
- package/dist/chat/ui/diff/review-settle.js +24 -9
- package/dist/chat/ui/diff/syntax-runtime.js +236 -201
- package/dist/chat/ui/diff/use-review-stack.js +146 -25
- package/dist/chat/ui/diff-syntax.js +70 -58
- package/dist/chat/ui/diff-theme.js +31 -12
- package/dist/chat/ui/file-links.js +39 -10
- package/dist/chat/ui/find-reveal.js +29 -8
- package/dist/chat/ui/full-diff.js +17 -12
- package/dist/chat/ui/highlighter.js +143 -113
- package/dist/chat/ui/icons.js +16 -7
- package/dist/chat/ui/index.js +1 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +556 -82
- package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +73 -5
- package/dist/chat/ui/intelligent-ui/UiReply.js +666 -262
- package/dist/chat/ui/intelligent-ui/block-local.js +59 -31
- package/dist/chat/ui/intelligent-ui/chart-data.js +77 -67
- package/dist/chat/ui/intelligent-ui/node-text.js +77 -91
- package/dist/chat/ui/intelligent-ui/registry.js +46 -46
- package/dist/chat/ui/intelligent-ui/render-context.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/base-land.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/binding.js +3 -3
- package/dist/chat/ui/intelligent-ui/renderers/chart.js +1223 -123
- package/dist/chat/ui/intelligent-ui/renderers/choices.js +312 -34
- package/dist/chat/ui/intelligent-ui/renderers/content.js +1241 -86
- package/dist/chat/ui/intelligent-ui/renderers/data.js +619 -54
- package/dist/chat/ui/intelligent-ui/renderers/inputs.js +868 -67
- package/dist/chat/ui/intelligent-ui/renderers/links.js +366 -62
- package/dist/chat/ui/intelligent-ui/renderers/map-slots.js +118 -60
- package/dist/chat/ui/intelligent-ui/renderers/map-style.js +85 -78
- package/dist/chat/ui/intelligent-ui/renderers/map-view.js +282 -217
- package/dist/chat/ui/intelligent-ui/renderers/map.js +621 -69
- package/dist/chat/ui/intelligent-ui/renderers/place-point.js +15 -8
- package/dist/chat/ui/intelligent-ui/renderers/structure.js +262 -20
- package/dist/chat/ui/intelligent-ui/renderers/text.js +674 -49
- package/dist/chat/ui/intelligent-ui/reply-parts.js +24 -15
- package/dist/chat/ui/intelligent-ui/table-data.js +97 -57
- package/dist/chat/ui/intelligent-ui/tones.js +31 -31
- package/dist/chat/ui/intelligent-ui/use-in-view.js +30 -12
- package/dist/chat/ui/intelligent-ui/use-later.js +28 -13
- package/dist/chat/ui/intelligent-ui/use-truncated.js +45 -21
- package/dist/chat/ui/intelligent-ui/use-ui-links.js +296 -109
- package/dist/chat/ui/intelligent-ui/use-ui-queries.js +256 -246
- package/dist/chat/ui/markdown-blocks.js +296 -262
- package/dist/chat/ui/mermaid.js +60 -72
- package/dist/chat/ui/quote-selection.js +32 -29
- package/dist/chat/ui/rehype-chips.js +35 -23
- package/dist/chat/ui/rehype-fade.js +28 -17
- package/dist/chat/ui/remark-html-as-text.js +22 -15
- package/dist/chat/ui/reply-context.js +1 -1
- package/dist/chat/ui/reveal.js +161 -72
- package/dist/chat/ui/rows/ForksRow.js +226 -24
- package/dist/chat/ui/rows/GeneratedImageRow.js +541 -87
- package/dist/chat/ui/rows/MessageRows.js +1706 -159
- package/dist/chat/ui/rows/RowContainer.js +57 -7
- package/dist/chat/ui/rows/Rows.js +463 -54
- package/dist/chat/ui/rows/SubagentRow.js +577 -60
- package/dist/chat/ui/rows/TaskRow.js +359 -40
- package/dist/chat/ui/rows/VisualRow.js +233 -11
- package/dist/chat/ui/rows/WorkRows.js +1946 -163
- package/dist/chat/ui/rows/WorkflowRow.js +293 -34
- package/dist/chat/ui/rows/row-rhythm.js +27 -17
- package/dist/chat/ui/theme-watch.js +26 -23
- package/dist/chat/ui/timestamp-format.js +4 -1
- package/dist/chat/ui/use-diff-source-tokens.js +70 -34
- package/dist/chat/ui/useToggleSet.js +51 -19
- package/dist/chat/ui/visual-theme.js +153 -128
- package/dist/chat/visual-bridge.js +123 -123
- package/dist/chat/visual-viewport.js +94 -83
- package/dist/chat/visuals.js +13 -5
- package/dist/host-hooks.d.ts +29 -0
- package/dist/host-hooks.js +78 -0
- package/dist/host.js +120 -48
- package/dist/index.js +1 -1
- package/dist/lazy.js +38 -32
- package/dist/locales/en/agent-chat.d.ts +35 -0
- package/dist/locales/en/agent-chat.js +747 -712
- package/dist/locales/en/agent-prompts.js +42 -42
- package/dist/locales/en/agent-providers.d.ts +1 -0
- package/dist/locales/en/agent-providers.js +166 -165
- package/dist/locales/en/agent-usage.d.ts +6 -0
- package/dist/locales/en/agent-usage.js +129 -123
- package/dist/locales/nl/agent-chat.d.ts +35 -0
- package/dist/locales/nl/agent-chat.js +747 -712
- package/dist/locales/nl/agent-prompts.js +42 -42
- package/dist/locales/nl/agent-providers.d.ts +1 -0
- package/dist/locales/nl/agent-providers.js +166 -165
- package/dist/locales/nl/agent-usage.d.ts +6 -0
- package/dist/locales/nl/agent-usage.js +129 -123
- package/dist/locales.js +14 -14
- package/dist/mounted-registry.js +31 -30
- package/dist/port-transport.js +122 -111
- package/dist/prompts/index.js +1 -1
- package/dist/prompts/logic/focus.js +15 -14
- package/dist/prompts/logic/keys.js +93 -59
- package/dist/prompts/logic/prompts.js +27 -14
- package/dist/prompts/logic/subjects.js +60 -46
- package/dist/prompts/logic/useFocusAfterAnswer.js +60 -20
- package/dist/prompts/logic/usePromptSession.js +88 -77
- package/dist/prompts/ui/ApprovalBody.js +246 -25
- package/dist/prompts/ui/PromptActions.js +215 -9
- package/dist/prompts/ui/PromptCard.js +215 -36
- package/dist/prompts/ui/PromptView.js +372 -34
- package/dist/prompts/ui/QuestionBody.js +269 -73
- package/dist/providers/AccountColors.js +36 -5
- package/dist/providers/AccountDetail.js +683 -50
- package/dist/providers/AccountVariables.js +139 -32
- package/dist/providers/AddAccountForm.js +125 -38
- package/dist/providers/CliDetail.js +343 -36
- package/dist/providers/InstallPage.js +644 -59
- package/dist/providers/ProviderList.d.ts +2 -1
- package/dist/providers/ProviderList.js +215 -23
- package/dist/providers/ProvidersPane.d.ts +4 -2
- package/dist/providers/ProvidersPane.js +244 -64
- package/dist/providers/account-actions.js +54 -30
- package/dist/providers/index.js +1 -1
- package/dist/providers/install-steps.js +12 -9
- package/dist/providers/pane-target.d.ts +3 -0
- package/dist/providers/pane-target.js +34 -13
- package/dist/providers/parts.js +62 -12
- package/dist/providers/provider-abilities.js +5 -5
- package/dist/providers/provider-groups.js +75 -40
- package/dist/providers/variables.js +73 -39
- package/dist/scope.js +6 -6
- package/dist/settings/sections.js +18 -18
- package/dist/state/chats.d.ts +1 -0
- package/dist/state/chats.js +408 -192
- package/dist/state/index.js +1 -1
- package/dist/state/provider-accounts.js +70 -47
- package/dist/state/providers.js +45 -16
- package/dist/state/usage.js +154 -77
- package/dist/storage.js +69 -68
- package/dist/testing/index.js +1 -1
- package/dist/testing/prompts.js +105 -67
- package/dist/transport.js +10 -10
- package/dist/ui/PlainTextarea.js +27 -3
- package/dist/usage/LimitsList.js +646 -40
- package/dist/usage/UsageBreakdown.js +879 -38
- package/dist/usage/UsageChart.js +311 -32
- package/dist/usage/UsageDialog.js +46 -4
- package/dist/usage/UsageLimits.js +467 -34
- package/dist/usage/UsageLimitsCard.js +95 -11
- package/dist/usage/UsagePage.js +817 -96
- package/dist/usage/UsagePane.js +164 -10
- package/dist/usage/UsageSummary.js +151 -6
- package/dist/usage/UsageTiles.js +164 -14
- package/dist/usage/format.js +32 -32
- package/dist/usage/index.d.ts +1 -1
- package/dist/usage/index.js +2 -1
- package/dist/usage/limit-groups.d.ts +2 -0
- package/dist/usage/limit-groups.js +77 -59
- package/dist/usage/limits.js +78 -43
- package/dist/usage/money.js +20 -4
- package/dist/usage/summary.js +85 -64
- package/package.json +8 -8
- package/src/agents/ModelOptionControl.tsx +3 -1
- package/src/agents/option-words.ts +27 -0
- package/src/chat/account-choice.ts +41 -1
- package/src/chat/composer-effort.ts +32 -0
- package/src/chat/forks.ts +4 -5
- package/src/chat/index.ts +3 -1
- package/src/chat/logic/effort.ts +32 -0
- package/src/chat/logic/picker-entries.ts +45 -10
- package/src/chat/logic/resume-compaction.ts +95 -17
- package/src/chat/logic/timeline.ts +11 -3
- package/src/chat/preferences.ts +35 -0
- package/src/chat/subagent-view.ts +2 -3
- package/src/chat/ui/AnsiOutput.tsx +1 -2
- package/src/chat/ui/BookmarkSubmenu.tsx +3 -3
- package/src/chat/ui/ChatActivity.tsx +14 -22
- package/src/chat/ui/ChatReferenceChip.tsx +2 -3
- package/src/chat/ui/Composer.tsx +15 -7
- package/src/chat/ui/EditDiff.tsx +2 -3
- package/src/chat/ui/LimitState.tsx +2 -2
- package/src/chat/ui/Markdown.tsx +10 -8
- package/src/chat/ui/MermaidBlock.tsx +2 -3
- package/src/chat/ui/Pickers.tsx +49 -29
- package/src/chat/ui/PromptComposer.tsx +7 -9
- package/src/chat/ui/ResumeCompactionDock.tsx +16 -4
- package/src/chat/ui/RunSettings.tsx +67 -28
- package/src/chat/ui/Scrubber.tsx +3 -3
- package/src/chat/ui/ShellCommand.tsx +2 -0
- package/src/chat/ui/SubagentInfo.tsx +2 -3
- package/src/chat/ui/SubagentTimeline.tsx +12 -16
- package/src/chat/ui/Timeline.tsx +6 -6
- package/src/chat/ui/UnifiedDiff.tsx +3 -4
- package/src/chat/ui/VisualFrame.tsx +5 -8
- package/src/chat/ui/code-theme.ts +4 -4
- package/src/chat/ui/composer/placeholder.ts +2 -2
- package/src/chat/ui/composer/use-compaction-offer.ts +36 -16
- package/src/chat/ui/composer/use-composer-menus.ts +4 -9
- package/src/chat/ui/composer/use-composer-submit.ts +2 -1
- package/src/chat/ui/composer/use-effort-stepper.ts +56 -0
- package/src/chat/ui/composer/use-notice.ts +2 -2
- package/src/chat/ui/diff/EditorEditDiff.tsx +9 -13
- package/src/chat/ui/diff/LegacyEditDiff.tsx +12 -17
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +13 -21
- package/src/chat/ui/diff/use-review-stack.ts +4 -4
- package/src/chat/ui/diff-theme.ts +3 -3
- package/src/chat/ui/file-links.ts +2 -2
- package/src/chat/ui/intelligent-ui/UiReply.tsx +2 -0
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +5 -6
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +2 -1
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +2 -1
- package/src/chat/ui/intelligent-ui/use-truncated.ts +16 -19
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +3 -3
- package/src/chat/ui/rows/ForksRow.tsx +3 -5
- package/src/chat/ui/rows/GeneratedImageRow.tsx +2 -1
- package/src/chat/ui/rows/MessageRows.tsx +12 -21
- package/src/chat/ui/rows/SubagentRow.tsx +3 -3
- package/src/chat/ui/rows/TaskRow.tsx +1 -1
- package/src/chat/ui/rows/WorkRows.tsx +20 -7
- package/src/chat/ui/useToggleSet.ts +15 -18
- package/src/chat/ui/visual-theme.ts +2 -3
- package/src/host-hooks.ts +113 -0
- package/src/lazy.tsx +2 -0
- package/src/locales/en/agent-chat.ts +135 -108
- package/src/locales/en/agent-prompts.ts +7 -7
- package/src/locales/en/agent-providers.ts +35 -34
- package/src/locales/en/agent-usage.ts +26 -20
- package/src/locales/nl/agent-chat.ts +127 -100
- package/src/locales/nl/agent-prompts.ts +5 -5
- package/src/locales/nl/agent-providers.ts +33 -32
- package/src/locales/nl/agent-usage.ts +25 -20
- package/src/prompts/ui/ApprovalBody.tsx +3 -1
- package/src/providers/CliDetail.tsx +2 -1
- package/src/providers/InstallPage.tsx +2 -4
- package/src/providers/ProviderList.tsx +12 -2
- package/src/providers/ProvidersPane.tsx +45 -15
- package/src/providers/pane-target.ts +20 -4
- package/src/state/chats.ts +7 -2
- package/src/usage/LimitsList.tsx +12 -13
- package/src/usage/UsageBreakdown.tsx +17 -6
- package/src/usage/UsageLimits.tsx +2 -1
- package/src/usage/UsagePage.tsx +3 -3
- package/src/usage/index.ts +1 -1
- package/src/usage/limit-groups.ts +12 -0
- package/src/usage/limits.ts +2 -2
- package/src/usage/money.ts +1 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Button, SegmentBar, Tooltip, useMeasuredWidth } from '@adecore/ui';
|
|
@@ -9,6 +9,7 @@ import { UI_CHART_CHARACTER, UI_CHART_ROWS, uiChartCharacter, uiChartAxis, uiCha
|
|
|
9
9
|
import { uiWithUnit } from '../node-text.js';
|
|
10
10
|
import { useTruncated } from '../use-truncated.js';
|
|
11
11
|
import { UiFallbackPart } from '../UiFallbackPart.js';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
const HEIGHT = 160;
|
|
13
14
|
const HBAR_ROW = 24;
|
|
14
15
|
const STACKED_ROW = 28;
|
|
@@ -22,166 +23,1265 @@ const LABEL_BAND = 56;
|
|
|
22
23
|
const DOTS_UP_TO = 30;
|
|
23
24
|
const GROW = 'transition-[scale,opacity] duration-400 ease-out motion-reduce:transition-none';
|
|
24
25
|
function seriesColor(index) {
|
|
25
|
-
|
|
26
|
+
return `var(--chart-${index + 1})`;
|
|
26
27
|
}
|
|
27
28
|
function valueText(value, unit) {
|
|
28
|
-
|
|
29
|
+
return value === null ? '' : uiWithUnit(formatRounded(value, 2), unit);
|
|
29
30
|
}
|
|
30
31
|
function unitApart(unit) {
|
|
31
|
-
|
|
32
|
+
return unit !== undefined && unit.length > UNIT_ON_TICKS;
|
|
32
33
|
}
|
|
33
34
|
/* Where a value axis stands and how much room its category labels get, from the labels it writes. */
|
|
34
35
|
function verticalLayout(chart, unit, width, character) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
// uiChartData only hands over data whose range is finite.
|
|
37
|
+
const {
|
|
38
|
+
low,
|
|
39
|
+
high
|
|
40
|
+
} = uiChartRange(chart.min, chart.max);
|
|
41
|
+
const ticks = low === 0 ? [0, high / 2, high] : [low, 0, high];
|
|
42
|
+
const tickUnit = unitApart(unit) ? undefined : unit;
|
|
43
|
+
const {
|
|
44
|
+
axisWidth,
|
|
45
|
+
tickTexts
|
|
46
|
+
} = uiChartAxis(ticks.map(tick => valueText(tick, tickUnit)), width, character);
|
|
47
|
+
const band = Math.max(0, width - axisWidth) / chart.labels.length;
|
|
48
|
+
const labelEvery = Math.max(1, Math.ceil(LABEL_BAND / Math.max(1, band)));
|
|
49
|
+
return {
|
|
50
|
+
low,
|
|
51
|
+
high,
|
|
52
|
+
ticks,
|
|
53
|
+
tickTexts,
|
|
54
|
+
axisWidth,
|
|
55
|
+
band,
|
|
56
|
+
labelEvery,
|
|
57
|
+
labelRoom: Math.min(band * labelEvery, Math.max(0, width - axisWidth))
|
|
58
|
+
};
|
|
43
59
|
}
|
|
44
60
|
/* Whether a drawing in SVG at this width cuts a category label short, which then offers the values to read it whole; HTML rows are measured where they stand. */
|
|
45
61
|
function labelsCut(chart, unit, width, character) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
if (width <= 0 || chart.kind === 'hbar' || chart.kind === 'stacked') {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const {
|
|
66
|
+
labelRoom
|
|
67
|
+
} = verticalLayout(chart, unit, width, character);
|
|
68
|
+
return chart.labels.some(label => uiChartTextWidth(label, character) > labelRoom);
|
|
51
69
|
}
|
|
52
70
|
/* The character width of chart type, which follows the root font size; a drawing depends on a measured width, so only a page reads it. */
|
|
53
71
|
function useChartCharacter() {
|
|
54
|
-
|
|
55
|
-
|
|
72
|
+
const [character] = useState(_temp);
|
|
73
|
+
return character;
|
|
56
74
|
}
|
|
57
75
|
/* The height a chart will take, which its place holds while the node streams. */
|
|
76
|
+
function _temp() {
|
|
77
|
+
return typeof document === "undefined" ? UI_CHART_CHARACTER : uiChartCharacter(Number.parseFloat(getComputedStyle(document.documentElement).fontSize));
|
|
78
|
+
}
|
|
58
79
|
function chartHeight(kind, rows) {
|
|
59
|
-
|
|
60
|
-
|
|
80
|
+
const count = Math.max(1, Math.min(rows, UI_CHART_ROWS));
|
|
81
|
+
return kind === 'hbar' ? count * HBAR_ROW : kind === 'stacked' ? count * STACKED_ROW : HEIGHT;
|
|
61
82
|
}
|
|
62
83
|
/* One sentence with the main point over all of the data, drawn or not, which a screen reader hears in place of the drawing. */
|
|
63
84
|
function chartSummary(values, unit, t) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
85
|
+
let top = null;
|
|
86
|
+
for (const series of values.series) {
|
|
87
|
+
for (let i = 0; i < series.values.length; i++) {
|
|
88
|
+
const value = series.values[i];
|
|
89
|
+
if (value !== null && value !== undefined && (top === null || value > top.value)) {
|
|
90
|
+
top = {
|
|
91
|
+
label: values.labels[i] ?? '',
|
|
92
|
+
series: series.key,
|
|
93
|
+
value
|
|
94
|
+
};
|
|
95
|
+
}
|
|
72
96
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
97
|
+
}
|
|
98
|
+
if (top === null) {
|
|
99
|
+
return t('blocks.chart.values');
|
|
100
|
+
}
|
|
101
|
+
return values.series.length > 1 ? t('blocks.chart.summarySeries', {
|
|
102
|
+
count: values.labels.length,
|
|
103
|
+
series: top.series,
|
|
104
|
+
label: top.label,
|
|
105
|
+
value: valueText(top.value, unit)
|
|
106
|
+
}) : t('blocks.chart.summary', {
|
|
107
|
+
count: values.labels.length,
|
|
108
|
+
label: top.label,
|
|
109
|
+
value: valueText(top.value, unit)
|
|
110
|
+
});
|
|
79
111
|
}
|
|
80
|
-
function Legend(
|
|
81
|
-
|
|
112
|
+
function Legend(t0) {
|
|
113
|
+
const $ = _c(4);
|
|
114
|
+
const {
|
|
115
|
+
chart
|
|
116
|
+
} = t0;
|
|
117
|
+
let t1;
|
|
118
|
+
if ($[0] !== chart.series) {
|
|
119
|
+
t1 = chart.series.map(_temp2);
|
|
120
|
+
$[0] = chart.series;
|
|
121
|
+
$[1] = t1;
|
|
122
|
+
} else {
|
|
123
|
+
t1 = $[1];
|
|
124
|
+
}
|
|
125
|
+
let t2;
|
|
126
|
+
if ($[2] !== t1) {
|
|
127
|
+
t2 = /*#__PURE__*/_jsx("div", {
|
|
128
|
+
"aria-hidden": true,
|
|
129
|
+
className: "flex flex-wrap gap-x-3 gap-y-1 text-xs text-text-muted",
|
|
130
|
+
children: t1
|
|
131
|
+
});
|
|
132
|
+
$[2] = t1;
|
|
133
|
+
$[3] = t2;
|
|
134
|
+
} else {
|
|
135
|
+
t2 = $[3];
|
|
136
|
+
}
|
|
137
|
+
return t2;
|
|
82
138
|
}
|
|
83
139
|
/* Every number of the data, for a screen reader, and on screen once a person opens it. */
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
140
|
+
function _temp2(series, index) {
|
|
141
|
+
return /*#__PURE__*/_jsxs("span", {
|
|
142
|
+
className: "flex items-center gap-1.5",
|
|
143
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
144
|
+
className: "size-2 rounded-sm",
|
|
145
|
+
style: {
|
|
146
|
+
backgroundColor: seriesColor(index)
|
|
147
|
+
}
|
|
148
|
+
}), series.key]
|
|
149
|
+
}, series.key);
|
|
150
|
+
}
|
|
151
|
+
function ValuesTable(t0) {
|
|
152
|
+
const $ = _c(35);
|
|
153
|
+
const {
|
|
154
|
+
values,
|
|
155
|
+
unit,
|
|
156
|
+
shown
|
|
157
|
+
} = t0;
|
|
158
|
+
const {
|
|
159
|
+
t
|
|
160
|
+
} = useTranslation("agent-chat");
|
|
161
|
+
const t1 = shown ? "w-full border-collapse text-xs tabular-nums" : undefined;
|
|
162
|
+
const t2 = shown ? "sr-only" : undefined;
|
|
163
|
+
let t3;
|
|
164
|
+
if ($[0] !== t) {
|
|
165
|
+
t3 = t("blocks.chart.values");
|
|
166
|
+
$[0] = t;
|
|
167
|
+
$[1] = t3;
|
|
168
|
+
} else {
|
|
169
|
+
t3 = $[1];
|
|
170
|
+
}
|
|
171
|
+
let t4;
|
|
172
|
+
if ($[2] !== t2 || $[3] !== t3) {
|
|
173
|
+
t4 = /*#__PURE__*/_jsx("caption", {
|
|
174
|
+
className: t2,
|
|
175
|
+
children: t3
|
|
176
|
+
});
|
|
177
|
+
$[2] = t2;
|
|
178
|
+
$[3] = t3;
|
|
179
|
+
$[4] = t4;
|
|
180
|
+
} else {
|
|
181
|
+
t4 = $[4];
|
|
182
|
+
}
|
|
183
|
+
const t5 = shown ? "sticky top-0 z-1 bg-surface-hover" : undefined;
|
|
184
|
+
let t6;
|
|
185
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
186
|
+
t6 = /*#__PURE__*/_jsx("td", {});
|
|
187
|
+
$[5] = t6;
|
|
188
|
+
} else {
|
|
189
|
+
t6 = $[5];
|
|
190
|
+
}
|
|
191
|
+
let t7;
|
|
192
|
+
if ($[6] !== shown || $[7] !== values.series) {
|
|
193
|
+
let t8;
|
|
194
|
+
if ($[9] !== shown) {
|
|
195
|
+
t8 = series => /*#__PURE__*/_jsx("th", {
|
|
196
|
+
scope: "col",
|
|
197
|
+
className: shown ? "h-8 px-2 text-right font-medium whitespace-nowrap text-text-muted" : undefined,
|
|
198
|
+
children: series.key
|
|
199
|
+
}, series.key);
|
|
200
|
+
$[9] = shown;
|
|
201
|
+
$[10] = t8;
|
|
202
|
+
} else {
|
|
203
|
+
t8 = $[10];
|
|
204
|
+
}
|
|
205
|
+
t7 = values.series.map(t8);
|
|
206
|
+
$[6] = shown;
|
|
207
|
+
$[7] = values.series;
|
|
208
|
+
$[8] = t7;
|
|
209
|
+
} else {
|
|
210
|
+
t7 = $[8];
|
|
211
|
+
}
|
|
212
|
+
let t8;
|
|
213
|
+
if ($[11] !== t7) {
|
|
214
|
+
t8 = /*#__PURE__*/_jsxs("tr", {
|
|
215
|
+
children: [t6, t7]
|
|
216
|
+
});
|
|
217
|
+
$[11] = t7;
|
|
218
|
+
$[12] = t8;
|
|
219
|
+
} else {
|
|
220
|
+
t8 = $[12];
|
|
221
|
+
}
|
|
222
|
+
let t9;
|
|
223
|
+
if ($[13] !== t5 || $[14] !== t8) {
|
|
224
|
+
t9 = /*#__PURE__*/_jsx("thead", {
|
|
225
|
+
className: t5,
|
|
226
|
+
children: t8
|
|
227
|
+
});
|
|
228
|
+
$[13] = t5;
|
|
229
|
+
$[14] = t8;
|
|
230
|
+
$[15] = t9;
|
|
231
|
+
} else {
|
|
232
|
+
t9 = $[15];
|
|
233
|
+
}
|
|
234
|
+
let t10;
|
|
235
|
+
if ($[16] !== shown || $[17] !== unit || $[18] !== values.labels || $[19] !== values.series) {
|
|
236
|
+
let t11;
|
|
237
|
+
if ($[21] !== shown || $[22] !== unit || $[23] !== values.series) {
|
|
238
|
+
t11 = (label, index) => /*#__PURE__*/_jsxs("tr", {
|
|
239
|
+
className: shown ? "border-t border-border-soft" : undefined,
|
|
240
|
+
children: [/*#__PURE__*/_jsx("th", {
|
|
241
|
+
scope: "row",
|
|
242
|
+
className: shown ? "h-8 px-2 text-left font-normal wrap-anywhere text-text-muted" : undefined,
|
|
243
|
+
children: label
|
|
244
|
+
}), values.series.map(series_0 => /*#__PURE__*/_jsx("td", {
|
|
245
|
+
className: shown ? "h-8 px-2 text-right whitespace-nowrap text-text" : undefined,
|
|
246
|
+
children: valueText(series_0.values[index] ?? null, unit)
|
|
247
|
+
}, series_0.key))]
|
|
248
|
+
}, index);
|
|
249
|
+
$[21] = shown;
|
|
250
|
+
$[22] = unit;
|
|
251
|
+
$[23] = values.series;
|
|
252
|
+
$[24] = t11;
|
|
253
|
+
} else {
|
|
254
|
+
t11 = $[24];
|
|
255
|
+
}
|
|
256
|
+
t10 = values.labels.map(t11);
|
|
257
|
+
$[16] = shown;
|
|
258
|
+
$[17] = unit;
|
|
259
|
+
$[18] = values.labels;
|
|
260
|
+
$[19] = values.series;
|
|
261
|
+
$[20] = t10;
|
|
262
|
+
} else {
|
|
263
|
+
t10 = $[20];
|
|
264
|
+
}
|
|
265
|
+
let t11;
|
|
266
|
+
if ($[25] !== t10) {
|
|
267
|
+
t11 = /*#__PURE__*/_jsx("tbody", {
|
|
268
|
+
children: t10
|
|
269
|
+
});
|
|
270
|
+
$[25] = t10;
|
|
271
|
+
$[26] = t11;
|
|
272
|
+
} else {
|
|
273
|
+
t11 = $[26];
|
|
274
|
+
}
|
|
275
|
+
let t12;
|
|
276
|
+
if ($[27] !== t1 || $[28] !== t11 || $[29] !== t4 || $[30] !== t9) {
|
|
277
|
+
t12 = /*#__PURE__*/_jsxs("table", {
|
|
278
|
+
className: t1,
|
|
279
|
+
children: [t4, t9, t11]
|
|
280
|
+
});
|
|
281
|
+
$[27] = t1;
|
|
282
|
+
$[28] = t11;
|
|
283
|
+
$[29] = t4;
|
|
284
|
+
$[30] = t9;
|
|
285
|
+
$[31] = t12;
|
|
286
|
+
} else {
|
|
287
|
+
t12 = $[31];
|
|
288
|
+
}
|
|
289
|
+
const table = t12;
|
|
290
|
+
const t13 = shown ? "max-h-80 w-full overflow-auto rounded-md border border-border-soft" : "sr-only";
|
|
291
|
+
let t14;
|
|
292
|
+
if ($[32] !== t13 || $[33] !== table) {
|
|
293
|
+
t14 = /*#__PURE__*/_jsx("div", {
|
|
294
|
+
className: t13,
|
|
295
|
+
children: table
|
|
296
|
+
});
|
|
297
|
+
$[32] = t13;
|
|
298
|
+
$[33] = table;
|
|
299
|
+
$[34] = t14;
|
|
300
|
+
} else {
|
|
301
|
+
t14 = $[34];
|
|
302
|
+
}
|
|
303
|
+
return t14;
|
|
89
304
|
}
|
|
90
305
|
/* The values of one category beside the pointer. */
|
|
91
|
-
function Readout(
|
|
92
|
-
|
|
306
|
+
function Readout(t0) {
|
|
307
|
+
const $ = _c(16);
|
|
308
|
+
const {
|
|
309
|
+
chart,
|
|
310
|
+
index,
|
|
311
|
+
left,
|
|
312
|
+
unit
|
|
313
|
+
} = t0;
|
|
314
|
+
let t1;
|
|
315
|
+
if ($[0] !== left) {
|
|
316
|
+
t1 = {
|
|
317
|
+
left
|
|
318
|
+
};
|
|
319
|
+
$[0] = left;
|
|
320
|
+
$[1] = t1;
|
|
321
|
+
} else {
|
|
322
|
+
t1 = $[1];
|
|
323
|
+
}
|
|
324
|
+
const t2 = chart.labels[index];
|
|
325
|
+
let t3;
|
|
326
|
+
if ($[2] !== t2) {
|
|
327
|
+
t3 = /*#__PURE__*/_jsx("span", {
|
|
328
|
+
className: "font-medium wrap-anywhere text-text",
|
|
329
|
+
children: t2
|
|
330
|
+
});
|
|
331
|
+
$[2] = t2;
|
|
332
|
+
$[3] = t3;
|
|
333
|
+
} else {
|
|
334
|
+
t3 = $[3];
|
|
335
|
+
}
|
|
336
|
+
let t4;
|
|
337
|
+
if ($[4] !== chart.series || $[5] !== index || $[6] !== unit) {
|
|
338
|
+
let t5;
|
|
339
|
+
if ($[8] !== chart.series.length || $[9] !== index || $[10] !== unit) {
|
|
340
|
+
t5 = (series, at) => /*#__PURE__*/_jsxs("span", {
|
|
341
|
+
className: "flex items-center gap-1.5 text-text-muted tabular-nums",
|
|
342
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
343
|
+
className: "size-2 rounded-sm",
|
|
344
|
+
style: {
|
|
345
|
+
backgroundColor: seriesColor(at)
|
|
346
|
+
}
|
|
347
|
+
}), chart.series.length > 1 && /*#__PURE__*/_jsx("span", {
|
|
348
|
+
children: series.key
|
|
349
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
350
|
+
className: "text-text",
|
|
351
|
+
children: valueText(series.values[index] ?? null, unit)
|
|
352
|
+
})]
|
|
353
|
+
}, series.key);
|
|
354
|
+
$[8] = chart.series.length;
|
|
355
|
+
$[9] = index;
|
|
356
|
+
$[10] = unit;
|
|
357
|
+
$[11] = t5;
|
|
358
|
+
} else {
|
|
359
|
+
t5 = $[11];
|
|
360
|
+
}
|
|
361
|
+
t4 = chart.series.map(t5);
|
|
362
|
+
$[4] = chart.series;
|
|
363
|
+
$[5] = index;
|
|
364
|
+
$[6] = unit;
|
|
365
|
+
$[7] = t4;
|
|
366
|
+
} else {
|
|
367
|
+
t4 = $[7];
|
|
368
|
+
}
|
|
369
|
+
let t5;
|
|
370
|
+
if ($[12] !== t1 || $[13] !== t3 || $[14] !== t4) {
|
|
371
|
+
t5 = /*#__PURE__*/_jsxs("div", {
|
|
372
|
+
"aria-hidden": true,
|
|
373
|
+
className: "pointer-events-none absolute top-0 z-1 flex w-max max-w-56 -translate-x-1/2 flex-col gap-0.5 rounded-md bg-surface-raised px-2 py-1 text-xs shadow-raised",
|
|
374
|
+
style: t1,
|
|
375
|
+
children: [t3, t4]
|
|
376
|
+
});
|
|
377
|
+
$[12] = t1;
|
|
378
|
+
$[13] = t3;
|
|
379
|
+
$[14] = t4;
|
|
380
|
+
$[15] = t5;
|
|
381
|
+
} else {
|
|
382
|
+
t5 = $[15];
|
|
383
|
+
}
|
|
384
|
+
return t5;
|
|
93
385
|
}
|
|
94
386
|
/* Bars and lines over a value axis, in SVG at the measured width. */
|
|
95
|
-
function VerticalChart(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
387
|
+
function VerticalChart(t0) {
|
|
388
|
+
const $ = _c(81);
|
|
389
|
+
const {
|
|
390
|
+
chart,
|
|
391
|
+
kind,
|
|
392
|
+
unit,
|
|
393
|
+
width,
|
|
394
|
+
character
|
|
395
|
+
} = t0;
|
|
396
|
+
const [hover, setHover] = useState(null);
|
|
397
|
+
let axisWidth;
|
|
398
|
+
let band;
|
|
399
|
+
let barWidth;
|
|
400
|
+
let baseline;
|
|
401
|
+
let center;
|
|
402
|
+
let gap;
|
|
403
|
+
let segments;
|
|
404
|
+
let t1;
|
|
405
|
+
let t2;
|
|
406
|
+
let t3;
|
|
407
|
+
let t4;
|
|
408
|
+
let t5;
|
|
409
|
+
let t6;
|
|
410
|
+
let t7;
|
|
411
|
+
let t8;
|
|
412
|
+
let y;
|
|
413
|
+
if ($[0] !== character || $[1] !== chart || $[2] !== hover || $[3] !== unit || $[4] !== width) {
|
|
414
|
+
const {
|
|
415
|
+
low,
|
|
416
|
+
high,
|
|
417
|
+
ticks,
|
|
418
|
+
tickTexts,
|
|
419
|
+
axisWidth: t9,
|
|
420
|
+
band: t10,
|
|
421
|
+
labelEvery,
|
|
422
|
+
labelRoom
|
|
423
|
+
} = verticalLayout(chart, unit, width, character);
|
|
424
|
+
axisWidth = t9;
|
|
425
|
+
band = t10;
|
|
426
|
+
const plotHeight = HEIGHT - PLOT_TOP - Math.round(LABEL_ROOM * character / UI_CHART_CHARACTER);
|
|
427
|
+
let t11;
|
|
428
|
+
if ($[21] !== high || $[22] !== low || $[23] !== plotHeight) {
|
|
429
|
+
t11 = value => Math.round(PLOT_TOP + (high - value) / (high - low) * plotHeight);
|
|
430
|
+
$[21] = high;
|
|
431
|
+
$[22] = low;
|
|
432
|
+
$[23] = plotHeight;
|
|
433
|
+
$[24] = t11;
|
|
434
|
+
} else {
|
|
435
|
+
t11 = $[24];
|
|
436
|
+
}
|
|
437
|
+
y = t11;
|
|
438
|
+
baseline = y(0);
|
|
439
|
+
let t12;
|
|
440
|
+
if ($[25] !== axisWidth || $[26] !== band) {
|
|
441
|
+
t12 = index => Math.round(axisWidth + band * index + band / 2);
|
|
442
|
+
$[25] = axisWidth;
|
|
443
|
+
$[26] = band;
|
|
444
|
+
$[27] = t12;
|
|
445
|
+
} else {
|
|
446
|
+
t12 = $[27];
|
|
447
|
+
}
|
|
448
|
+
center = t12;
|
|
449
|
+
gap = band * 0.2;
|
|
450
|
+
barWidth = Math.max(1, (band - gap) / chart.series.length);
|
|
451
|
+
let t13;
|
|
452
|
+
if ($[28] !== axisWidth || $[29] !== center || $[30] !== character || $[31] !== width) {
|
|
453
|
+
t13 = (index_0, text) => {
|
|
105
454
|
const half = uiChartTextWidth(text, character) / 2;
|
|
106
|
-
return Math.round(Math.min(Math.max(center(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
455
|
+
return Math.round(Math.min(Math.max(center(index_0), axisWidth + half), width - half));
|
|
456
|
+
};
|
|
457
|
+
$[28] = axisWidth;
|
|
458
|
+
$[29] = center;
|
|
459
|
+
$[30] = character;
|
|
460
|
+
$[31] = width;
|
|
461
|
+
$[32] = t13;
|
|
462
|
+
} else {
|
|
463
|
+
t13 = $[32];
|
|
464
|
+
}
|
|
465
|
+
const labelAt = t13;
|
|
466
|
+
let t14;
|
|
467
|
+
if ($[33] !== center || $[34] !== y) {
|
|
468
|
+
t14 = values => values.map((value_0, index_1) => value_0 === null ? null : `${center(index_1)} ${y(value_0)}`).reduce(_temp3, []).join(" ");
|
|
469
|
+
$[33] = center;
|
|
470
|
+
$[34] = y;
|
|
471
|
+
$[35] = t14;
|
|
472
|
+
} else {
|
|
473
|
+
t14 = $[35];
|
|
474
|
+
}
|
|
475
|
+
segments = t14;
|
|
476
|
+
t1 = width;
|
|
477
|
+
t2 = HEIGHT;
|
|
478
|
+
t3 = true;
|
|
479
|
+
t4 = "block overflow-visible";
|
|
480
|
+
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
|
481
|
+
t5 = () => setHover(null);
|
|
482
|
+
$[36] = t5;
|
|
483
|
+
} else {
|
|
484
|
+
t5 = $[36];
|
|
485
|
+
}
|
|
486
|
+
if ($[37] !== axisWidth || $[38] !== band || $[39] !== hover || $[40] !== plotHeight) {
|
|
487
|
+
t6 = hover !== null && /*#__PURE__*/_jsx("rect", {
|
|
488
|
+
x: Math.round(axisWidth + band * hover),
|
|
489
|
+
y: PLOT_TOP,
|
|
490
|
+
width: Math.round(band),
|
|
491
|
+
height: plotHeight,
|
|
492
|
+
className: "fill-surface-hover"
|
|
493
|
+
});
|
|
494
|
+
$[37] = axisWidth;
|
|
495
|
+
$[38] = band;
|
|
496
|
+
$[39] = hover;
|
|
497
|
+
$[40] = plotHeight;
|
|
498
|
+
$[41] = t6;
|
|
499
|
+
} else {
|
|
500
|
+
t6 = $[41];
|
|
501
|
+
}
|
|
502
|
+
t7 = ticks.map((tick, index_3) => /*#__PURE__*/_jsxs("g", {
|
|
503
|
+
children: [/*#__PURE__*/_jsx("line", {
|
|
504
|
+
x1: axisWidth,
|
|
505
|
+
x2: width,
|
|
506
|
+
y1: y(tick),
|
|
507
|
+
y2: y(tick),
|
|
508
|
+
className: tick === 0 ? "stroke-border" : "stroke-border-soft",
|
|
509
|
+
shapeRendering: "crispEdges"
|
|
510
|
+
}), /*#__PURE__*/_jsx("text", {
|
|
511
|
+
x: axisWidth - 6,
|
|
512
|
+
y: y(tick),
|
|
513
|
+
dy: "0.32em",
|
|
514
|
+
textAnchor: "end",
|
|
515
|
+
className: "fill-text-faint text-xs tabular-nums",
|
|
516
|
+
children: tickTexts[index_3]
|
|
517
|
+
})]
|
|
518
|
+
}, tick));
|
|
519
|
+
t8 = chart.labels.map((label, index_4) => {
|
|
520
|
+
if (index_4 % labelEvery !== 0) {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
const text_0 = uiChartText(label, labelRoom, character);
|
|
524
|
+
return /*#__PURE__*/_jsx("text", {
|
|
525
|
+
x: labelAt(index_4, text_0),
|
|
526
|
+
y: HEIGHT - 4,
|
|
527
|
+
textAnchor: "middle",
|
|
528
|
+
className: "fill-text-faint text-xs",
|
|
529
|
+
children: text_0
|
|
530
|
+
}, index_4);
|
|
531
|
+
});
|
|
532
|
+
$[0] = character;
|
|
533
|
+
$[1] = chart;
|
|
534
|
+
$[2] = hover;
|
|
535
|
+
$[3] = unit;
|
|
536
|
+
$[4] = width;
|
|
537
|
+
$[5] = axisWidth;
|
|
538
|
+
$[6] = band;
|
|
539
|
+
$[7] = barWidth;
|
|
540
|
+
$[8] = baseline;
|
|
541
|
+
$[9] = center;
|
|
542
|
+
$[10] = gap;
|
|
543
|
+
$[11] = segments;
|
|
544
|
+
$[12] = t1;
|
|
545
|
+
$[13] = t2;
|
|
546
|
+
$[14] = t3;
|
|
547
|
+
$[15] = t4;
|
|
548
|
+
$[16] = t5;
|
|
549
|
+
$[17] = t6;
|
|
550
|
+
$[18] = t7;
|
|
551
|
+
$[19] = t8;
|
|
552
|
+
$[20] = y;
|
|
553
|
+
} else {
|
|
554
|
+
axisWidth = $[5];
|
|
555
|
+
band = $[6];
|
|
556
|
+
barWidth = $[7];
|
|
557
|
+
baseline = $[8];
|
|
558
|
+
center = $[9];
|
|
559
|
+
gap = $[10];
|
|
560
|
+
segments = $[11];
|
|
561
|
+
t1 = $[12];
|
|
562
|
+
t2 = $[13];
|
|
563
|
+
t3 = $[14];
|
|
564
|
+
t4 = $[15];
|
|
565
|
+
t5 = $[16];
|
|
566
|
+
t6 = $[17];
|
|
567
|
+
t7 = $[18];
|
|
568
|
+
t8 = $[19];
|
|
569
|
+
y = $[20];
|
|
570
|
+
}
|
|
571
|
+
let t9;
|
|
572
|
+
if ($[42] !== axisWidth || $[43] !== band || $[44] !== barWidth || $[45] !== baseline || $[46] !== center || $[47] !== chart.labels.length || $[48] !== chart.series || $[49] !== gap || $[50] !== kind || $[51] !== segments || $[52] !== y) {
|
|
573
|
+
t9 = kind === "bar" ? /*#__PURE__*/_jsx("g", {
|
|
574
|
+
className: clsx(GROW, "starting:scale-y-0"),
|
|
575
|
+
style: {
|
|
576
|
+
transformOrigin: `0px ${baseline}px`
|
|
577
|
+
},
|
|
578
|
+
children: chart.series.map((series, at) => series.values.map((value_1, index_5) => value_1 === null ? null : /*#__PURE__*/_jsx("rect", {
|
|
579
|
+
x: Math.round(axisWidth + band * index_5 + gap / 2 + barWidth * at),
|
|
580
|
+
y: Math.min(y(value_1), baseline),
|
|
581
|
+
width: Math.max(1, Math.round(barWidth) - 1),
|
|
582
|
+
height: Math.abs(y(value_1) - baseline),
|
|
583
|
+
rx: 2,
|
|
584
|
+
style: {
|
|
585
|
+
fill: seriesColor(at)
|
|
113
586
|
}
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
587
|
+
}, `${series.key}:${index_5}`)))
|
|
588
|
+
}) : /*#__PURE__*/_jsx("g", {
|
|
589
|
+
className: clsx(GROW, "starting:opacity-0"),
|
|
590
|
+
children: chart.series.map((series_0, at_0) => /*#__PURE__*/_jsxs("g", {
|
|
591
|
+
style: {
|
|
592
|
+
color: seriesColor(at_0)
|
|
593
|
+
},
|
|
594
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
595
|
+
d: segments(series_0.values),
|
|
596
|
+
fill: "none",
|
|
597
|
+
stroke: "currentColor",
|
|
598
|
+
strokeWidth: 2,
|
|
599
|
+
strokeLinejoin: "round",
|
|
600
|
+
strokeLinecap: "round"
|
|
601
|
+
}), chart.labels.length <= DOTS_UP_TO && series_0.values.map((value_2, index_6) => value_2 === null ? null : /*#__PURE__*/_jsx("circle", {
|
|
602
|
+
cx: center(index_6),
|
|
603
|
+
cy: y(value_2),
|
|
604
|
+
r: 3,
|
|
605
|
+
fill: "currentColor"
|
|
606
|
+
}, index_6))]
|
|
607
|
+
}, series_0.key))
|
|
608
|
+
});
|
|
609
|
+
$[42] = axisWidth;
|
|
610
|
+
$[43] = band;
|
|
611
|
+
$[44] = barWidth;
|
|
612
|
+
$[45] = baseline;
|
|
613
|
+
$[46] = center;
|
|
614
|
+
$[47] = chart.labels.length;
|
|
615
|
+
$[48] = chart.series;
|
|
616
|
+
$[49] = gap;
|
|
617
|
+
$[50] = kind;
|
|
618
|
+
$[51] = segments;
|
|
619
|
+
$[52] = y;
|
|
620
|
+
$[53] = t9;
|
|
621
|
+
} else {
|
|
622
|
+
t9 = $[53];
|
|
623
|
+
}
|
|
624
|
+
let t10;
|
|
625
|
+
if ($[54] !== axisWidth || $[55] !== band || $[56] !== chart.labels) {
|
|
626
|
+
let t11;
|
|
627
|
+
if ($[58] !== axisWidth || $[59] !== band) {
|
|
628
|
+
t11 = (_, index_7) => /*#__PURE__*/_jsx("rect", {
|
|
629
|
+
x: Math.round(axisWidth + band * index_7),
|
|
630
|
+
y: 0,
|
|
631
|
+
width: Math.max(1, Math.round(band)),
|
|
632
|
+
height: HEIGHT,
|
|
633
|
+
fill: "transparent",
|
|
634
|
+
onPointerEnter: () => setHover(index_7)
|
|
635
|
+
}, index_7);
|
|
636
|
+
$[58] = axisWidth;
|
|
637
|
+
$[59] = band;
|
|
638
|
+
$[60] = t11;
|
|
639
|
+
} else {
|
|
640
|
+
t11 = $[60];
|
|
641
|
+
}
|
|
642
|
+
t10 = chart.labels.map(t11);
|
|
643
|
+
$[54] = axisWidth;
|
|
644
|
+
$[55] = band;
|
|
645
|
+
$[56] = chart.labels;
|
|
646
|
+
$[57] = t10;
|
|
647
|
+
} else {
|
|
648
|
+
t10 = $[57];
|
|
649
|
+
}
|
|
650
|
+
let t11;
|
|
651
|
+
if ($[61] !== t1 || $[62] !== t10 || $[63] !== t2 || $[64] !== t3 || $[65] !== t4 || $[66] !== t5 || $[67] !== t6 || $[68] !== t7 || $[69] !== t8 || $[70] !== t9) {
|
|
652
|
+
t11 = /*#__PURE__*/_jsxs("svg", {
|
|
653
|
+
width: t1,
|
|
654
|
+
height: t2,
|
|
655
|
+
"aria-hidden": t3,
|
|
656
|
+
className: t4,
|
|
657
|
+
onPointerLeave: t5,
|
|
658
|
+
children: [t6, t7, t8, t9, t10]
|
|
659
|
+
});
|
|
660
|
+
$[61] = t1;
|
|
661
|
+
$[62] = t10;
|
|
662
|
+
$[63] = t2;
|
|
663
|
+
$[64] = t3;
|
|
664
|
+
$[65] = t4;
|
|
665
|
+
$[66] = t5;
|
|
666
|
+
$[67] = t6;
|
|
667
|
+
$[68] = t7;
|
|
668
|
+
$[69] = t8;
|
|
669
|
+
$[70] = t9;
|
|
670
|
+
$[71] = t11;
|
|
671
|
+
} else {
|
|
672
|
+
t11 = $[71];
|
|
673
|
+
}
|
|
674
|
+
let t12;
|
|
675
|
+
if ($[72] !== center || $[73] !== chart || $[74] !== hover || $[75] !== unit || $[76] !== width) {
|
|
676
|
+
t12 = hover !== null && /*#__PURE__*/_jsx(Readout, {
|
|
677
|
+
chart: chart,
|
|
678
|
+
index: hover,
|
|
679
|
+
unit: unit,
|
|
680
|
+
left: Math.min(Math.max(center(hover), 64), Math.max(64, width - 64))
|
|
681
|
+
});
|
|
682
|
+
$[72] = center;
|
|
683
|
+
$[73] = chart;
|
|
684
|
+
$[74] = hover;
|
|
685
|
+
$[75] = unit;
|
|
686
|
+
$[76] = width;
|
|
687
|
+
$[77] = t12;
|
|
688
|
+
} else {
|
|
689
|
+
t12 = $[77];
|
|
690
|
+
}
|
|
691
|
+
let t13;
|
|
692
|
+
if ($[78] !== t11 || $[79] !== t12) {
|
|
693
|
+
t13 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
694
|
+
children: [t11, t12]
|
|
695
|
+
});
|
|
696
|
+
$[78] = t11;
|
|
697
|
+
$[79] = t12;
|
|
698
|
+
$[80] = t13;
|
|
699
|
+
} else {
|
|
700
|
+
t13 = $[80];
|
|
701
|
+
}
|
|
702
|
+
return t13;
|
|
125
703
|
}
|
|
126
704
|
/* A row of 24px per category, its label beside the bars, which grow from zero to either side. */
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
705
|
+
function _temp3(paths, point, index_2, all) {
|
|
706
|
+
if (point !== null) {
|
|
707
|
+
paths.push(`${index_2 === 0 || all[index_2 - 1] === null ? "M" : "L"}${point}`);
|
|
708
|
+
}
|
|
709
|
+
return paths;
|
|
710
|
+
}
|
|
711
|
+
function HorizontalChart(t0) {
|
|
712
|
+
const $ = _c(20);
|
|
713
|
+
const {
|
|
714
|
+
chart,
|
|
715
|
+
unit
|
|
716
|
+
} = t0;
|
|
717
|
+
const valueUnit = unitApart(unit) ? undefined : unit;
|
|
718
|
+
let t1;
|
|
719
|
+
if ($[0] !== chart.max || $[1] !== chart.min) {
|
|
720
|
+
t1 = uiChartRange(chart.min, chart.max);
|
|
721
|
+
$[0] = chart.max;
|
|
722
|
+
$[1] = chart.min;
|
|
723
|
+
$[2] = t1;
|
|
724
|
+
} else {
|
|
725
|
+
t1 = $[2];
|
|
726
|
+
}
|
|
727
|
+
const {
|
|
728
|
+
low,
|
|
729
|
+
high
|
|
730
|
+
} = t1;
|
|
731
|
+
const span = high - low;
|
|
732
|
+
const zero = -low / span * 100;
|
|
733
|
+
const single = chart.series.length === 1;
|
|
734
|
+
let t2;
|
|
735
|
+
if ($[3] !== chart.labels || $[4] !== chart.series || $[5] !== low || $[6] !== single || $[7] !== span || $[8] !== valueUnit || $[9] !== zero) {
|
|
736
|
+
let t3;
|
|
737
|
+
if ($[11] !== chart.series || $[12] !== low || $[13] !== single || $[14] !== span || $[15] !== valueUnit || $[16] !== zero) {
|
|
738
|
+
t3 = (label, index) => /*#__PURE__*/_jsxs("div", {
|
|
739
|
+
className: "flex h-6 items-center gap-2 text-xs",
|
|
740
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
741
|
+
className: "w-2/5 max-w-36 shrink-0 truncate text-text-muted",
|
|
742
|
+
children: label
|
|
743
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
744
|
+
className: "relative flex min-w-0 grow flex-col justify-center gap-px",
|
|
745
|
+
children: [low < 0 && /*#__PURE__*/_jsx("span", {
|
|
746
|
+
className: "absolute inset-y-0 w-px bg-border",
|
|
747
|
+
style: {
|
|
748
|
+
left: `${zero}%`
|
|
749
|
+
}
|
|
750
|
+
}), chart.series.map((series, at) => {
|
|
751
|
+
const value = series.values[index] ?? 0;
|
|
752
|
+
return /*#__PURE__*/_jsx("span", {
|
|
753
|
+
className: clsx("relative block", single ? "h-3" : "h-1"),
|
|
754
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
755
|
+
className: clsx(GROW, "absolute inset-y-0 rounded-sm starting:scale-x-0", value < 0 ? "origin-right" : "origin-left"),
|
|
756
|
+
style: {
|
|
757
|
+
left: `${(Math.min(value, 0) - low) / span * 100}%`,
|
|
758
|
+
width: `${Math.abs(value) / span * 100}%`,
|
|
759
|
+
backgroundColor: seriesColor(at)
|
|
760
|
+
}
|
|
761
|
+
})
|
|
762
|
+
}, series.key);
|
|
763
|
+
})]
|
|
764
|
+
}), single && /*#__PURE__*/_jsx("span", {
|
|
765
|
+
className: "max-w-1/3 min-w-12 shrink-0 truncate text-right text-text-faint tabular-nums",
|
|
766
|
+
children: valueText(chart.series[0].values[index] ?? null, valueUnit)
|
|
767
|
+
})]
|
|
768
|
+
}, index);
|
|
769
|
+
$[11] = chart.series;
|
|
770
|
+
$[12] = low;
|
|
771
|
+
$[13] = single;
|
|
772
|
+
$[14] = span;
|
|
773
|
+
$[15] = valueUnit;
|
|
774
|
+
$[16] = zero;
|
|
775
|
+
$[17] = t3;
|
|
776
|
+
} else {
|
|
777
|
+
t3 = $[17];
|
|
778
|
+
}
|
|
779
|
+
t2 = chart.labels.map(t3);
|
|
780
|
+
$[3] = chart.labels;
|
|
781
|
+
$[4] = chart.series;
|
|
782
|
+
$[5] = low;
|
|
783
|
+
$[6] = single;
|
|
784
|
+
$[7] = span;
|
|
785
|
+
$[8] = valueUnit;
|
|
786
|
+
$[9] = zero;
|
|
787
|
+
$[10] = t2;
|
|
788
|
+
} else {
|
|
789
|
+
t2 = $[10];
|
|
790
|
+
}
|
|
791
|
+
let t3;
|
|
792
|
+
if ($[18] !== t2) {
|
|
793
|
+
t3 = /*#__PURE__*/_jsx("div", {
|
|
794
|
+
"aria-hidden": true,
|
|
795
|
+
className: "flex flex-col",
|
|
796
|
+
children: t2
|
|
797
|
+
});
|
|
798
|
+
$[18] = t2;
|
|
799
|
+
$[19] = t3;
|
|
800
|
+
} else {
|
|
801
|
+
t3 = $[19];
|
|
802
|
+
}
|
|
803
|
+
return t3;
|
|
141
804
|
}
|
|
142
805
|
/* A bar per category split into its series, on one scale so the rows compare. */
|
|
143
|
-
function StackedChart(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
806
|
+
function StackedChart(t0) {
|
|
807
|
+
const $ = _c(12);
|
|
808
|
+
const {
|
|
809
|
+
chart,
|
|
810
|
+
unit
|
|
811
|
+
} = t0;
|
|
812
|
+
let t1;
|
|
813
|
+
if ($[0] !== chart.labels || $[1] !== chart.max || $[2] !== chart.series || $[3] !== unit) {
|
|
814
|
+
let t2;
|
|
815
|
+
if ($[5] !== chart.labels.length || $[6] !== chart.max || $[7] !== chart.series || $[8] !== unit) {
|
|
816
|
+
t2 = (label, index) => /*#__PURE__*/_jsxs("div", {
|
|
817
|
+
className: "flex items-center gap-2 text-xs",
|
|
818
|
+
children: [chart.labels.length > 1 && /*#__PURE__*/_jsx("span", {
|
|
819
|
+
className: "w-2/5 max-w-36 shrink-0 truncate text-text-muted",
|
|
820
|
+
children: label
|
|
821
|
+
}), /*#__PURE__*/_jsx(SegmentBar, {
|
|
822
|
+
size: "sm",
|
|
823
|
+
className: "grow",
|
|
824
|
+
label: label,
|
|
825
|
+
range: [0, chart.max],
|
|
826
|
+
parts: chart.series.map((series, at) => ({
|
|
827
|
+
value: series.values[index] ?? 0,
|
|
828
|
+
color: seriesColor(at),
|
|
829
|
+
label: `${series.key} ${valueText(series.values[index] ?? 0, unit)}`
|
|
830
|
+
}))
|
|
831
|
+
})]
|
|
832
|
+
}, index);
|
|
833
|
+
$[5] = chart.labels.length;
|
|
834
|
+
$[6] = chart.max;
|
|
835
|
+
$[7] = chart.series;
|
|
836
|
+
$[8] = unit;
|
|
837
|
+
$[9] = t2;
|
|
838
|
+
} else {
|
|
839
|
+
t2 = $[9];
|
|
840
|
+
}
|
|
841
|
+
t1 = chart.labels.map(t2);
|
|
842
|
+
$[0] = chart.labels;
|
|
843
|
+
$[1] = chart.max;
|
|
844
|
+
$[2] = chart.series;
|
|
845
|
+
$[3] = unit;
|
|
846
|
+
$[4] = t1;
|
|
847
|
+
} else {
|
|
848
|
+
t1 = $[4];
|
|
849
|
+
}
|
|
850
|
+
let t2;
|
|
851
|
+
if ($[10] !== t1) {
|
|
852
|
+
t2 = /*#__PURE__*/_jsx("div", {
|
|
853
|
+
className: "flex flex-col gap-2",
|
|
854
|
+
children: t1
|
|
855
|
+
});
|
|
856
|
+
$[10] = t1;
|
|
857
|
+
$[11] = t2;
|
|
858
|
+
} else {
|
|
859
|
+
t2 = $[11];
|
|
860
|
+
}
|
|
861
|
+
return t2;
|
|
149
862
|
}
|
|
150
863
|
/* What the drawing leaves out or draws otherwise, said in words, with every value a press away. */
|
|
151
|
-
function ChartNotes(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
864
|
+
function ChartNotes(t0) {
|
|
865
|
+
const $ = _c(36);
|
|
866
|
+
const {
|
|
867
|
+
chart,
|
|
868
|
+
requested,
|
|
869
|
+
cut,
|
|
870
|
+
values,
|
|
871
|
+
unit,
|
|
872
|
+
context,
|
|
873
|
+
nodeId
|
|
874
|
+
} = t0;
|
|
875
|
+
const {
|
|
876
|
+
t
|
|
877
|
+
} = useTranslation("agent-chat");
|
|
878
|
+
const [shown, setShown] = useBlockLocal(context, `${nodeId}:values`, _temp4);
|
|
879
|
+
let t1;
|
|
880
|
+
if ($[0] !== chart.labels || $[1] !== chart.total || $[2] !== chart.truncated || $[3] !== t) {
|
|
881
|
+
t1 = chart.truncated ? [t("blocks.chart.rowsLeftOut", {
|
|
882
|
+
shown: formatNumber(chart.labels.length),
|
|
883
|
+
total: formatNumber(chart.total)
|
|
884
|
+
})] : [];
|
|
885
|
+
$[0] = chart.labels;
|
|
886
|
+
$[1] = chart.total;
|
|
887
|
+
$[2] = chart.truncated;
|
|
888
|
+
$[3] = t;
|
|
889
|
+
$[4] = t1;
|
|
890
|
+
} else {
|
|
891
|
+
t1 = $[4];
|
|
892
|
+
}
|
|
893
|
+
let t2;
|
|
894
|
+
if ($[5] !== chart.omitted || $[6] !== t) {
|
|
895
|
+
t2 = chart.omitted.length > 0 ? [t("blocks.chart.seriesLeftOut", {
|
|
896
|
+
count: chart.omitted.length,
|
|
897
|
+
series: chart.omitted.join(", ")
|
|
898
|
+
})] : [];
|
|
899
|
+
$[5] = chart.omitted;
|
|
900
|
+
$[6] = t;
|
|
901
|
+
$[7] = t2;
|
|
902
|
+
} else {
|
|
903
|
+
t2 = $[7];
|
|
904
|
+
}
|
|
905
|
+
let t3;
|
|
906
|
+
if ($[8] !== chart.kind || $[9] !== requested || $[10] !== t) {
|
|
907
|
+
t3 = requested === "stacked" && chart.kind !== "stacked" ? [t("blocks.chart.sideBySide")] : [];
|
|
908
|
+
$[8] = chart.kind;
|
|
909
|
+
$[9] = requested;
|
|
910
|
+
$[10] = t;
|
|
911
|
+
$[11] = t3;
|
|
912
|
+
} else {
|
|
913
|
+
t3 = $[11];
|
|
914
|
+
}
|
|
915
|
+
let t4;
|
|
916
|
+
if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
917
|
+
t4 = [...t1, ...t2, ...t3];
|
|
918
|
+
$[12] = t1;
|
|
919
|
+
$[13] = t2;
|
|
920
|
+
$[14] = t3;
|
|
921
|
+
$[15] = t4;
|
|
922
|
+
} else {
|
|
923
|
+
t4 = $[15];
|
|
924
|
+
}
|
|
925
|
+
const notes = t4;
|
|
926
|
+
const partial = chart.truncated || chart.omitted.length > 0 || cut;
|
|
927
|
+
const [measure, truncated] = useTruncated();
|
|
928
|
+
let t5;
|
|
929
|
+
if ($[16] !== shown || $[17] !== t) {
|
|
930
|
+
t5 = shown ? t("blocks.chart.hideValues") : t("blocks.chart.showValues");
|
|
931
|
+
$[16] = shown;
|
|
932
|
+
$[17] = t;
|
|
933
|
+
$[18] = t5;
|
|
934
|
+
} else {
|
|
935
|
+
t5 = $[18];
|
|
936
|
+
}
|
|
937
|
+
const toggle = t5;
|
|
938
|
+
let t6;
|
|
939
|
+
if ($[19] !== notes) {
|
|
940
|
+
t6 = notes.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
941
|
+
className: "flex flex-col gap-0.5 text-xs text-text-muted",
|
|
942
|
+
children: notes.map(_temp5)
|
|
943
|
+
});
|
|
944
|
+
$[19] = notes;
|
|
945
|
+
$[20] = t6;
|
|
946
|
+
} else {
|
|
947
|
+
t6 = $[20];
|
|
948
|
+
}
|
|
949
|
+
let t7;
|
|
950
|
+
if ($[21] !== measure || $[22] !== partial || $[23] !== setShown || $[24] !== shown || $[25] !== toggle || $[26] !== truncated) {
|
|
951
|
+
t7 = partial && /*#__PURE__*/_jsx(Tooltip, {
|
|
952
|
+
label: toggle,
|
|
953
|
+
disabled: !truncated,
|
|
954
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
955
|
+
size: "xs",
|
|
956
|
+
variant: "secondary",
|
|
957
|
+
className: "max-w-full self-start",
|
|
958
|
+
"aria-expanded": shown,
|
|
959
|
+
onClick: () => setShown(!shown),
|
|
960
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
961
|
+
ref: measure,
|
|
962
|
+
className: "min-w-0 truncate",
|
|
963
|
+
children: toggle
|
|
964
|
+
})
|
|
965
|
+
})
|
|
966
|
+
});
|
|
967
|
+
$[21] = measure;
|
|
968
|
+
$[22] = partial;
|
|
969
|
+
$[23] = setShown;
|
|
970
|
+
$[24] = shown;
|
|
971
|
+
$[25] = toggle;
|
|
972
|
+
$[26] = truncated;
|
|
973
|
+
$[27] = t7;
|
|
974
|
+
} else {
|
|
975
|
+
t7 = $[27];
|
|
976
|
+
}
|
|
977
|
+
const t8 = partial && shown;
|
|
978
|
+
let t9;
|
|
979
|
+
if ($[28] !== t8 || $[29] !== unit || $[30] !== values) {
|
|
980
|
+
t9 = /*#__PURE__*/_jsx(ValuesTable, {
|
|
981
|
+
values: values,
|
|
982
|
+
unit: unit,
|
|
983
|
+
shown: t8
|
|
984
|
+
});
|
|
985
|
+
$[28] = t8;
|
|
986
|
+
$[29] = unit;
|
|
987
|
+
$[30] = values;
|
|
988
|
+
$[31] = t9;
|
|
989
|
+
} else {
|
|
990
|
+
t9 = $[31];
|
|
991
|
+
}
|
|
992
|
+
let t10;
|
|
993
|
+
if ($[32] !== t6 || $[33] !== t7 || $[34] !== t9) {
|
|
994
|
+
t10 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
995
|
+
children: [t6, t7, t9]
|
|
996
|
+
});
|
|
997
|
+
$[32] = t6;
|
|
998
|
+
$[33] = t7;
|
|
999
|
+
$[34] = t9;
|
|
1000
|
+
$[35] = t10;
|
|
1001
|
+
} else {
|
|
1002
|
+
t10 = $[35];
|
|
1003
|
+
}
|
|
1004
|
+
return t10;
|
|
1005
|
+
}
|
|
1006
|
+
function _temp5(note) {
|
|
1007
|
+
return /*#__PURE__*/_jsx("p", {
|
|
1008
|
+
children: note
|
|
1009
|
+
}, note);
|
|
1010
|
+
}
|
|
1011
|
+
function _temp4() {
|
|
1012
|
+
return false;
|
|
1013
|
+
}
|
|
1014
|
+
function DrawnChart(t0) {
|
|
1015
|
+
const $ = _c(50);
|
|
1016
|
+
const {
|
|
1017
|
+
chart,
|
|
1018
|
+
requested,
|
|
1019
|
+
data,
|
|
1020
|
+
unit,
|
|
1021
|
+
context,
|
|
1022
|
+
nodeId
|
|
1023
|
+
} = t0;
|
|
1024
|
+
const {
|
|
1025
|
+
t
|
|
1026
|
+
} = useTranslation("agent-chat");
|
|
1027
|
+
const [measure, width] = useMeasuredWidth();
|
|
1028
|
+
const character = useChartCharacter();
|
|
1029
|
+
const [measureRows, rowsCut] = useTruncated(true);
|
|
1030
|
+
let kind;
|
|
1031
|
+
let t1;
|
|
1032
|
+
let t2;
|
|
1033
|
+
let t3;
|
|
1034
|
+
let t4;
|
|
1035
|
+
let t5;
|
|
1036
|
+
let t6;
|
|
1037
|
+
let values;
|
|
1038
|
+
if ($[0] !== chart || $[1] !== data || $[2] !== measure || $[3] !== t || $[4] !== unit) {
|
|
1039
|
+
values = uiChartValues(data);
|
|
1040
|
+
({
|
|
1041
|
+
kind
|
|
1042
|
+
} = chart);
|
|
1043
|
+
t4 = "chat-ui-flat flex flex-col gap-2.5 rounded-xl bg-ui-tile p-3.5";
|
|
1044
|
+
if ($[13] !== chart) {
|
|
1045
|
+
t5 = chart.series.length > 1 && /*#__PURE__*/_jsx(Legend, {
|
|
1046
|
+
chart: chart
|
|
1047
|
+
});
|
|
1048
|
+
$[13] = chart;
|
|
1049
|
+
$[14] = t5;
|
|
1050
|
+
} else {
|
|
1051
|
+
t5 = $[14];
|
|
1052
|
+
}
|
|
1053
|
+
if ($[15] !== kind || $[16] !== unit) {
|
|
1054
|
+
t6 = kind !== "stacked" && unitApart(unit) && /*#__PURE__*/_jsx("p", {
|
|
1055
|
+
className: "text-xs text-text-faint",
|
|
1056
|
+
children: unit
|
|
1057
|
+
});
|
|
1058
|
+
$[15] = kind;
|
|
1059
|
+
$[16] = unit;
|
|
1060
|
+
$[17] = t6;
|
|
1061
|
+
} else {
|
|
1062
|
+
t6 = $[17];
|
|
1063
|
+
}
|
|
1064
|
+
t1 = measure;
|
|
1065
|
+
t2 = "img";
|
|
1066
|
+
t3 = chartSummary(values, unit, t);
|
|
1067
|
+
$[0] = chart;
|
|
1068
|
+
$[1] = data;
|
|
1069
|
+
$[2] = measure;
|
|
1070
|
+
$[3] = t;
|
|
1071
|
+
$[4] = unit;
|
|
1072
|
+
$[5] = kind;
|
|
1073
|
+
$[6] = t1;
|
|
1074
|
+
$[7] = t2;
|
|
1075
|
+
$[8] = t3;
|
|
1076
|
+
$[9] = t4;
|
|
1077
|
+
$[10] = t5;
|
|
1078
|
+
$[11] = t6;
|
|
1079
|
+
$[12] = values;
|
|
1080
|
+
} else {
|
|
1081
|
+
kind = $[5];
|
|
1082
|
+
t1 = $[6];
|
|
1083
|
+
t2 = $[7];
|
|
1084
|
+
t3 = $[8];
|
|
1085
|
+
t4 = $[9];
|
|
1086
|
+
t5 = $[10];
|
|
1087
|
+
t6 = $[11];
|
|
1088
|
+
values = $[12];
|
|
1089
|
+
}
|
|
1090
|
+
let t7;
|
|
1091
|
+
if ($[18] !== character || $[19] !== chart || $[20] !== kind || $[21] !== measureRows || $[22] !== unit || $[23] !== width) {
|
|
1092
|
+
t7 = kind === "hbar" || kind === "stacked" ? /*#__PURE__*/_jsx("div", {
|
|
1093
|
+
ref: measureRows,
|
|
1094
|
+
children: kind === "hbar" ? /*#__PURE__*/_jsx(HorizontalChart, {
|
|
1095
|
+
chart: chart,
|
|
1096
|
+
unit: unit
|
|
1097
|
+
}) : /*#__PURE__*/_jsx(StackedChart, {
|
|
1098
|
+
chart: chart,
|
|
1099
|
+
unit: unit
|
|
1100
|
+
})
|
|
1101
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
1102
|
+
style: {
|
|
1103
|
+
height: HEIGHT
|
|
1104
|
+
},
|
|
1105
|
+
children: width > 0 && /*#__PURE__*/_jsx(VerticalChart, {
|
|
1106
|
+
chart: chart,
|
|
1107
|
+
kind: kind,
|
|
1108
|
+
unit: unit,
|
|
1109
|
+
width: width,
|
|
1110
|
+
character: character
|
|
1111
|
+
})
|
|
1112
|
+
});
|
|
1113
|
+
$[18] = character;
|
|
1114
|
+
$[19] = chart;
|
|
1115
|
+
$[20] = kind;
|
|
1116
|
+
$[21] = measureRows;
|
|
1117
|
+
$[22] = unit;
|
|
1118
|
+
$[23] = width;
|
|
1119
|
+
$[24] = t7;
|
|
1120
|
+
} else {
|
|
1121
|
+
t7 = $[24];
|
|
1122
|
+
}
|
|
1123
|
+
let t8;
|
|
1124
|
+
if ($[25] !== t1 || $[26] !== t2 || $[27] !== t3 || $[28] !== t7) {
|
|
1125
|
+
t8 = /*#__PURE__*/_jsx("div", {
|
|
1126
|
+
ref: t1,
|
|
1127
|
+
role: t2,
|
|
1128
|
+
"aria-label": t3,
|
|
1129
|
+
className: "relative",
|
|
1130
|
+
children: t7
|
|
1131
|
+
});
|
|
1132
|
+
$[25] = t1;
|
|
1133
|
+
$[26] = t2;
|
|
1134
|
+
$[27] = t3;
|
|
1135
|
+
$[28] = t7;
|
|
1136
|
+
$[29] = t8;
|
|
1137
|
+
} else {
|
|
1138
|
+
t8 = $[29];
|
|
1139
|
+
}
|
|
1140
|
+
let t9;
|
|
1141
|
+
if ($[30] !== character || $[31] !== chart || $[32] !== rowsCut || $[33] !== unit || $[34] !== width) {
|
|
1142
|
+
t9 = rowsCut || labelsCut(chart, unit, width, character);
|
|
1143
|
+
$[30] = character;
|
|
1144
|
+
$[31] = chart;
|
|
1145
|
+
$[32] = rowsCut;
|
|
1146
|
+
$[33] = unit;
|
|
1147
|
+
$[34] = width;
|
|
1148
|
+
$[35] = t9;
|
|
1149
|
+
} else {
|
|
1150
|
+
t9 = $[35];
|
|
1151
|
+
}
|
|
1152
|
+
let t10;
|
|
1153
|
+
if ($[36] !== chart || $[37] !== context || $[38] !== nodeId || $[39] !== requested || $[40] !== t9 || $[41] !== unit || $[42] !== values) {
|
|
1154
|
+
t10 = /*#__PURE__*/_jsx(ChartNotes, {
|
|
1155
|
+
chart: chart,
|
|
1156
|
+
requested: requested,
|
|
1157
|
+
cut: t9,
|
|
1158
|
+
values: values,
|
|
1159
|
+
unit: unit,
|
|
1160
|
+
context: context,
|
|
1161
|
+
nodeId: nodeId
|
|
1162
|
+
});
|
|
1163
|
+
$[36] = chart;
|
|
1164
|
+
$[37] = context;
|
|
1165
|
+
$[38] = nodeId;
|
|
1166
|
+
$[39] = requested;
|
|
1167
|
+
$[40] = t9;
|
|
1168
|
+
$[41] = unit;
|
|
1169
|
+
$[42] = values;
|
|
1170
|
+
$[43] = t10;
|
|
1171
|
+
} else {
|
|
1172
|
+
t10 = $[43];
|
|
1173
|
+
}
|
|
1174
|
+
let t11;
|
|
1175
|
+
if ($[44] !== t10 || $[45] !== t4 || $[46] !== t5 || $[47] !== t6 || $[48] !== t8) {
|
|
1176
|
+
t11 = /*#__PURE__*/_jsxs("figure", {
|
|
1177
|
+
className: t4,
|
|
1178
|
+
children: [t5, t6, t8, t10]
|
|
1179
|
+
});
|
|
1180
|
+
$[44] = t10;
|
|
1181
|
+
$[45] = t4;
|
|
1182
|
+
$[46] = t5;
|
|
1183
|
+
$[47] = t6;
|
|
1184
|
+
$[48] = t8;
|
|
1185
|
+
$[49] = t11;
|
|
1186
|
+
} else {
|
|
1187
|
+
t11 = $[49];
|
|
1188
|
+
}
|
|
1189
|
+
return t11;
|
|
172
1190
|
}
|
|
173
1191
|
/*
|
|
174
1192
|
* Draws only once its node closed; until then a quiet surface of the height it will take holds its
|
|
175
1193
|
* place. It grows in once, and not at all for a person who asked for less motion.
|
|
176
1194
|
*/
|
|
177
|
-
export function ChartRenderer(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
1195
|
+
export function ChartRenderer(t0) {
|
|
1196
|
+
const $ = _c(19);
|
|
1197
|
+
const {
|
|
1198
|
+
node,
|
|
1199
|
+
context
|
|
1200
|
+
} = t0;
|
|
1201
|
+
const {
|
|
1202
|
+
kind,
|
|
1203
|
+
data,
|
|
1204
|
+
unit
|
|
1205
|
+
} = node.props;
|
|
1206
|
+
let t1;
|
|
1207
|
+
if ($[0] !== data || $[1] !== kind || $[2] !== node.complete) {
|
|
1208
|
+
t1 = node.complete ? uiChartData(data, kind) : null;
|
|
1209
|
+
$[0] = data;
|
|
1210
|
+
$[1] = kind;
|
|
1211
|
+
$[2] = node.complete;
|
|
1212
|
+
$[3] = t1;
|
|
1213
|
+
} else {
|
|
1214
|
+
t1 = $[3];
|
|
1215
|
+
}
|
|
1216
|
+
const chart = t1;
|
|
1217
|
+
if (!node.complete) {
|
|
1218
|
+
let t2;
|
|
1219
|
+
if ($[4] !== data.length || $[5] !== kind) {
|
|
1220
|
+
t2 = chartHeight(kind, data.length);
|
|
1221
|
+
$[4] = data.length;
|
|
1222
|
+
$[5] = kind;
|
|
1223
|
+
$[6] = t2;
|
|
1224
|
+
} else {
|
|
1225
|
+
t2 = $[6];
|
|
182
1226
|
}
|
|
183
|
-
|
|
184
|
-
|
|
1227
|
+
let t3;
|
|
1228
|
+
if ($[7] !== t2) {
|
|
1229
|
+
t3 = /*#__PURE__*/_jsx("div", {
|
|
1230
|
+
"aria-hidden": true,
|
|
1231
|
+
className: "rounded-xl bg-ui-tile",
|
|
1232
|
+
style: {
|
|
1233
|
+
height: t2
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
$[7] = t2;
|
|
1237
|
+
$[8] = t3;
|
|
1238
|
+
} else {
|
|
1239
|
+
t3 = $[8];
|
|
185
1240
|
}
|
|
186
|
-
return
|
|
187
|
-
}
|
|
1241
|
+
return t3;
|
|
1242
|
+
}
|
|
1243
|
+
if (chart === null) {
|
|
1244
|
+
let t2;
|
|
1245
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1246
|
+
t2 = {
|
|
1247
|
+
kind: "failed"
|
|
1248
|
+
};
|
|
1249
|
+
$[9] = t2;
|
|
1250
|
+
} else {
|
|
1251
|
+
t2 = $[9];
|
|
1252
|
+
}
|
|
1253
|
+
let t3;
|
|
1254
|
+
if ($[10] !== node.fallback) {
|
|
1255
|
+
t3 = /*#__PURE__*/_jsx(UiFallbackPart, {
|
|
1256
|
+
fallback: node.fallback,
|
|
1257
|
+
problem: t2
|
|
1258
|
+
});
|
|
1259
|
+
$[10] = node.fallback;
|
|
1260
|
+
$[11] = t3;
|
|
1261
|
+
} else {
|
|
1262
|
+
t3 = $[11];
|
|
1263
|
+
}
|
|
1264
|
+
return t3;
|
|
1265
|
+
}
|
|
1266
|
+
let t2;
|
|
1267
|
+
if ($[12] !== chart || $[13] !== context || $[14] !== data || $[15] !== kind || $[16] !== node.id || $[17] !== unit) {
|
|
1268
|
+
t2 = /*#__PURE__*/_jsx(DrawnChart, {
|
|
1269
|
+
chart: chart,
|
|
1270
|
+
requested: kind,
|
|
1271
|
+
data: data,
|
|
1272
|
+
unit: unit,
|
|
1273
|
+
context: context,
|
|
1274
|
+
nodeId: node.id
|
|
1275
|
+
});
|
|
1276
|
+
$[12] = chart;
|
|
1277
|
+
$[13] = context;
|
|
1278
|
+
$[14] = data;
|
|
1279
|
+
$[15] = kind;
|
|
1280
|
+
$[16] = node.id;
|
|
1281
|
+
$[17] = unit;
|
|
1282
|
+
$[18] = t2;
|
|
1283
|
+
} else {
|
|
1284
|
+
t2 = $[18];
|
|
1285
|
+
}
|
|
1286
|
+
return t2;
|
|
1287
|
+
}
|