@wakastellar/ui 4.0.1 → 4.1.1
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/blocks/_shared/identity/InviteUserPanel.cjs.js +1 -1
- package/dist/blocks/_shared/identity/RoleSelect.cjs.js +1 -1
- package/dist/blocks/_shared/identity/SidePushLayout.cjs.js +1 -1
- package/dist/blocks/activity-timeline/index.cjs.js +1 -1
- package/dist/blocks/activity-timeline/index.es.js +1 -1
- package/dist/blocks/antivirus-dashboard/index.cjs.js +1 -1
- package/dist/blocks/antivirus-dashboard/index.es.js +1 -1
- package/dist/blocks/api-keys-manager/index.cjs.js +1 -1
- package/dist/blocks/apm-overview/index.cjs.js +1 -1
- package/dist/blocks/auth-2fa/index.cjs.js +2 -2
- package/dist/blocks/auth-2fa/index.es.js +1 -1
- package/dist/blocks/avatar-upload/index.cjs.js +1 -1
- package/dist/blocks/avatar-upload/index.es.js +13 -13
- package/dist/blocks/calendar-view/index.cjs.js +1 -1
- package/dist/blocks/calendar-view/index.es.js +1 -1
- package/dist/blocks/chat/index.cjs.js +1 -1
- package/dist/blocks/chat/index.es.js +162 -162
- package/dist/blocks/chat/widget.cjs.js +1 -1
- package/dist/blocks/chat/widget.es.js +19 -13
- package/dist/blocks/chat-interface/index.cjs.js +1 -1
- package/dist/blocks/chat-interface/index.es.js +1 -1
- package/dist/blocks/checkout-flow/index.cjs.js +1 -1
- package/dist/blocks/checkout-flow/index.es.js +1 -1
- package/dist/blocks/cicd-builder/index.cjs.js +1 -1
- package/dist/blocks/clamav-service-status/index.cjs.js +1 -1
- package/dist/blocks/cloud-cost-dashboard/index.cjs.js +1 -1
- package/dist/blocks/container-orchestrator/index.cjs.js +1 -1
- package/dist/blocks/container-orchestrator/index.es.js +2 -1
- package/dist/blocks/dashboard/index.cjs.js +1 -1
- package/dist/blocks/dashboard/index.es.js +2 -2
- package/dist/blocks/dashboard-kpi/index.cjs.js +1 -1
- package/dist/blocks/dashboard-kpi/index.es.js +1 -1
- package/dist/blocks/database-admin/index.cjs.js +1 -1
- package/dist/blocks/deployment-dashboard/index.cjs.js +1 -1
- package/dist/blocks/deployment-dashboard/index.es.js +1 -1
- package/dist/blocks/empty-states/index.cjs.js +1 -1
- package/dist/blocks/empty-states/index.es.js +1 -1
- package/dist/blocks/error-pages/index.cjs.js +1 -1
- package/dist/blocks/error-pages/index.es.js +1 -1
- package/dist/blocks/faq/index.cjs.js +1 -1
- package/dist/blocks/faq/index.es.js +1 -1
- package/dist/blocks/file-manager/index.cjs.js +1 -1
- package/dist/blocks/file-manager/index.es.js +1 -1
- package/dist/blocks/file-scan-uploader/index.cjs.js +1 -1
- package/dist/blocks/file-scan-uploader/index.es.js +2 -2
- package/dist/blocks/footer/index.cjs.js +1 -1
- package/dist/blocks/gitops-sync-status/index.cjs.js +1 -1
- package/dist/blocks/header/index.cjs.js +1 -1
- package/dist/blocks/header/index.es.js +1 -1
- package/dist/blocks/headtab/index.cjs.js +1 -1
- package/dist/blocks/i18n-editor/index.cjs.js +1 -1
- package/dist/blocks/i18n-editor/index.es.js +127 -127
- package/dist/blocks/incident-manager/index.cjs.js +1 -1
- package/dist/blocks/infrastructure-map/index.cjs.js +1 -1
- package/dist/blocks/kanban-board/index.cjs.js +1 -1
- package/dist/blocks/kanban-board/index.es.js +1 -1
- package/dist/blocks/landing/index.cjs.js +1 -1
- package/dist/blocks/landing/index.es.js +1 -1
- package/dist/blocks/language-selector/index.cjs.js +1 -1
- package/dist/blocks/layout/index.cjs.js +1 -1
- package/dist/blocks/login/index.cjs.js +1 -1
- package/dist/blocks/on-call-schedule/index.cjs.js +1 -1
- package/dist/blocks/player-profile/index.cjs.js +1 -1
- package/dist/blocks/player-profile/index.es.js +1 -1
- package/dist/blocks/pricing/index.cjs.js +1 -1
- package/dist/blocks/pricing/index.es.js +1 -1
- package/dist/blocks/profile/index.cjs.js +1 -1
- package/dist/blocks/profile/index.es.js +1 -1
- package/dist/blocks/profile-list/index.cjs.js +1 -1
- package/dist/blocks/quarantine-manager/index.cjs.js +1 -1
- package/dist/blocks/quarantine-manager/index.es.js +1 -1
- package/dist/blocks/release-notes/index.cjs.js +1 -1
- package/dist/blocks/scan-history-log/index.cjs.js +1 -1
- package/dist/blocks/scan-history-log/index.es.js +1 -1
- package/dist/blocks/scan-policy-editor/index.cjs.js +1 -1
- package/dist/blocks/scan-report-generator/index.cjs.js +1 -1
- package/dist/blocks/settings/index.cjs.js +1 -1
- package/dist/blocks/settings/index.es.js +1 -1
- package/dist/blocks/sidebar/index.cjs.js +1 -1
- package/dist/blocks/sidebar/index.es.js +1 -1
- package/dist/blocks/signature-database-manager/index.cjs.js +1 -1
- package/dist/blocks/team-form/index.cjs.js +1 -1
- package/dist/blocks/threat-alert-banner/index.cjs.js +1 -1
- package/dist/blocks/user-management/index.cjs.js +1 -1
- package/dist/blocks/waka-doc-shell/index.cjs.js +1 -1
- package/dist/blocks/wizard/index.cjs.js +1 -1
- package/dist/blocks/wizard/index.es.js +37 -37
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +8 -8
- package/dist/cli/index.cjs +5 -1
- package/dist/components/DataTable/DataTable.cjs.js +1 -1
- package/dist/components/DataTable/DataTable.es.js +68 -66
- package/dist/components/DataTable/DataTableAdvanced.cjs.js +1 -1
- package/dist/components/DataTable/DataTableColumnResizer.cjs.js +1 -1
- package/dist/components/DataTable/DataTableContextMenu.cjs.js +1 -1
- package/dist/components/DataTable/DataTableEditCell.cjs.js +1 -1
- package/dist/components/DataTable/DataTableFilters.cjs.js +1 -1
- package/dist/components/DataTable/DataTableGrouping.cjs.js +1 -1
- package/dist/components/DataTable/DataTablePagination.cjs.js +1 -1
- package/dist/components/DataTable/DataTablePagination.d.ts +3 -1
- package/dist/components/DataTable/DataTablePagination.es.js +38 -27
- package/dist/components/DataTable/DataTableSelection.cjs.js +1 -1
- package/dist/components/DataTable/DataTableToolbar.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTable.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTable.es.js +5 -1
- package/dist/components/DataTable/hooks/useDataTableAdvanced.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableEdit.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableExport.cjs.js +2 -2
- package/dist/components/DataTable/hooks/useDataTableImport.cjs.js +2 -2
- package/dist/components/DataTable/hooks/useDataTableImport.es.js +2 -1
- package/dist/components/DataTable/hooks/useDataTableTheme.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useDataTableVirtualization.cjs.js +1 -1
- package/dist/components/DataTable/hooks/useTableLayout.cjs.js +1 -1
- package/dist/components/DataTable/utils.cjs.js +1 -1
- package/dist/components/accordion/index.cjs.js +1 -1
- package/dist/components/alert/index.cjs.js +1 -1
- package/dist/components/alert-dialog/index.cjs.js +1 -1
- package/dist/components/aspect-ratio/index.cjs.js +1 -1
- package/dist/components/avatar/index.cjs.js +1 -1
- package/dist/components/badge/index.cjs.js +1 -1
- package/dist/components/button/index.cjs.js +1 -1
- package/dist/components/calendar/index.cjs.js +1 -1
- package/dist/components/card/index.cjs.js +1 -1
- package/dist/components/checkbox/index.cjs.js +1 -1
- package/dist/components/code/index.cjs.js +2 -2
- package/dist/components/code/index.es.js +3 -2
- package/dist/components/collapsible/index.cjs.js +1 -1
- package/dist/components/command/index.cjs.js +1 -1
- package/dist/components/context-menu/index.cjs.js +1 -1
- package/dist/components/dialog/index.cjs.js +1 -1
- package/dist/components/dropdown-menu/index.cjs.js +1 -1
- package/dist/components/editor/blocks/index.cjs.js +1 -1
- package/dist/components/editor/blocks/index.es.js +12 -12
- package/dist/components/editor/blocks/waka-acceptance-criteria-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-ai-assist-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-api-endpoint-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-code-playground-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-comment-thread-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-diagram-block.cjs.js +3 -3
- package/dist/components/editor/blocks/waka-diagram-block.es.js +21 -40
- package/dist/components/editor/blocks/waka-embed-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-slash-menu-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-user-story-block.cjs.js +1 -1
- package/dist/components/editor/blocks/waka-version-diff-block.cjs.js +1 -1
- package/dist/components/editor/waka-ai-writer.cjs.js +1 -1
- package/dist/components/editor/waka-collaborative-editor.cjs.js +1 -1
- package/dist/components/editor/waka-diff-viewer.cjs.js +1 -1
- package/dist/components/editor/waka-dnd-editor.cjs.js +1 -1
- package/dist/components/editor/waka-document-editor.cjs.js +1 -1
- package/dist/components/editor/waka-document-editor.es.js +1 -1
- package/dist/components/editor/waka-editor-elements.cjs.js +1 -1
- package/dist/components/editor/waka-editor-leaves.cjs.js +1 -1
- package/dist/components/editor/waka-editor-toolbar.cjs.js +1 -1
- package/dist/components/editor/waka-editor.cjs.js +1 -1
- package/dist/components/editor/waka-floating-toolbar.cjs.js +1 -1
- package/dist/components/editor/waka-markdown-editor.cjs.js +1 -1
- package/dist/components/editor/waka-mention-editor.cjs.js +1 -1
- package/dist/components/editor/waka-mention-editor.es.js +2 -2
- package/dist/components/editor/waka-slash-menu.cjs.js +1 -1
- package/dist/components/editor/waka-spec-editor.cjs.js +1 -1
- package/dist/components/form/index.cjs.js +1 -1
- package/dist/components/hover-card/index.cjs.js +1 -1
- package/dist/components/input/index.cjs.js +1 -1
- package/dist/components/input-otp/index.cjs.js +1 -1
- package/dist/components/input-otp/index.es.js +2 -1
- package/dist/components/label/index.cjs.js +1 -1
- package/dist/components/language-selector/index.cjs.js +1 -1
- package/dist/components/menubar/index.cjs.js +1 -1
- package/dist/components/navigation-menu/index.cjs.js +1 -1
- package/dist/components/popover/index.cjs.js +1 -1
- package/dist/components/progress/index.cjs.js +1 -1
- package/dist/components/radio-group/index.cjs.js +1 -1
- package/dist/components/resizable/index.cjs.js +1 -1
- package/dist/components/resizable/index.es.js +9 -9
- package/dist/components/scroll-area/index.cjs.js +1 -1
- package/dist/components/select/index.cjs.js +1 -1
- package/dist/components/separator/index.cjs.js +1 -1
- package/dist/components/sheet/index.cjs.js +1 -1
- package/dist/components/skeleton/index.cjs.js +1 -1
- package/dist/components/slider/index.cjs.js +1 -1
- package/dist/components/switch/index.cjs.js +1 -1
- package/dist/components/table/index.cjs.js +1 -1
- package/dist/components/tabs/index.cjs.js +1 -1
- package/dist/components/textarea/index.cjs.js +1 -1
- package/dist/components/theme-selector/index.cjs.js +1 -1
- package/dist/components/toast/index.cjs.js +1 -1
- package/dist/components/toaster/index.cjs.js +1 -1
- package/dist/components/toggle/index.cjs.js +1 -1
- package/dist/components/toggle-group/index.cjs.js +1 -1
- package/dist/components/tooltip/index.cjs.js +1 -1
- package/dist/components/typography/index.cjs.js +1 -1
- package/dist/components/waka-3d-pie-chart/index.cjs.js +1 -1
- package/dist/components/waka-3d-pie-chart/index.es.js +1 -1
- package/dist/components/waka-achievement-unlock/index.cjs.js +1 -1
- package/dist/components/waka-achievement-unlock/index.es.js +1 -1
- package/dist/components/waka-activity-feed/index.cjs.js +2 -2
- package/dist/components/waka-activity-feed/index.es.js +1 -1
- package/dist/components/waka-ad-banner/index.cjs.js +1 -1
- package/dist/components/waka-ad-banner/index.es.js +18 -15
- package/dist/components/waka-ad-fallback/index.cjs.js +1 -1
- package/dist/components/waka-ad-fallback/index.es.js +1 -1
- package/dist/components/waka-ad-inline/index.cjs.js +1 -1
- package/dist/components/waka-ad-inline/index.es.js +2 -2
- package/dist/components/waka-ad-interstitial/index.cjs.js +1 -1
- package/dist/components/waka-ad-interstitial/index.es.js +3 -3
- package/dist/components/waka-ad-placeholder/index.cjs.js +2 -2
- package/dist/components/waka-ad-placeholder/index.es.js +1 -1
- package/dist/components/waka-ad-provider/index.cjs.js +1 -1
- package/dist/components/waka-ad-provider/index.es.js +1 -1
- package/dist/components/waka-ad-sidebar/index.cjs.js +1 -1
- package/dist/components/waka-ad-sidebar/index.es.js +2 -2
- package/dist/components/waka-ad-sticky-footer/index.cjs.js +1 -1
- package/dist/components/waka-ad-sticky-footer/index.es.js +2 -2
- package/dist/components/waka-address-autocomplete/index.cjs.js +2 -2
- package/dist/components/waka-address-autocomplete/index.es.js +10 -6
- package/dist/components/waka-admincrumb/index.cjs.js +1 -1
- package/dist/components/waka-alert-panel/index.cjs.js +1 -1
- package/dist/components/waka-alert-stack/index.cjs.js +1 -1
- package/dist/components/waka-alert-stack/index.es.js +1 -1
- package/dist/components/waka-allocation-matrix/index.cjs.js +2 -2
- package/dist/components/waka-allocation-matrix/index.es.js +1 -1
- package/dist/components/waka-approval-chain/index.cjs.js +1 -1
- package/dist/components/waka-approval-chain/index.es.js +1 -1
- package/dist/components/waka-artifact-list/index.cjs.js +1 -1
- package/dist/components/waka-artifact-list/index.es.js +1 -1
- package/dist/components/waka-audit-log/index.cjs.js +2 -2
- package/dist/components/waka-audit-log/index.es.js +1 -1
- package/dist/components/waka-autocomplete/index.cjs.js +1 -1
- package/dist/components/waka-autocomplete/index.es.js +3 -2
- package/dist/components/waka-badge-showcase/index.cjs.js +1 -1
- package/dist/components/waka-barcode/index.cjs.js +1 -1
- package/dist/components/waka-barcode/index.es.js +1 -1
- package/dist/components/waka-biometric-prompt/index.cjs.js +2 -2
- package/dist/components/waka-biometric-prompt/index.es.js +1 -1
- package/dist/components/waka-bottom-sheet/index.cjs.js +1 -1
- package/dist/components/waka-bottom-sheet/index.es.js +12 -7
- package/dist/components/waka-breadcrumb/index.cjs.js +1 -1
- package/dist/components/waka-breadcrumb/index.es.js +1 -1
- package/dist/components/waka-breadcrumb-path/index.cjs.js +1 -1
- package/dist/components/waka-breadcrumb-path/index.es.js +1 -1
- package/dist/components/waka-budget-burn/index.cjs.js +2 -2
- package/dist/components/waka-budget-burn/index.es.js +3 -3
- package/dist/components/waka-build-matrix/index.cjs.js +1 -1
- package/dist/components/waka-capacity-planner/index.cjs.js +2 -2
- package/dist/components/waka-capacity-planner/index.es.js +1 -1
- package/dist/components/waka-carousel/index.cjs.js +1 -1
- package/dist/components/waka-carousel/index.es.js +2 -2
- package/dist/components/waka-cart-summary/index.cjs.js +1 -1
- package/dist/components/waka-cart-summary/index.es.js +2 -2
- package/dist/components/waka-challenge-timer/index.cjs.js +1 -1
- package/dist/components/waka-charts/WakaAreaChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaAreaChart.es.js +2 -2
- package/dist/components/waka-charts/WakaBarChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaBarChart.es.js +2 -2
- package/dist/components/waka-charts/WakaChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaChart.es.js +1 -1
- package/dist/components/waka-charts/WakaLineChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaLineChart.es.js +2 -2
- package/dist/components/waka-charts/WakaMiniChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaMiniChart.es.js +2 -2
- package/dist/components/waka-charts/WakaPieChart.cjs.js +1 -1
- package/dist/components/waka-charts/WakaPieChart.es.js +2 -2
- package/dist/components/waka-charts/WakaSparkline.cjs.js +1 -1
- package/dist/components/waka-charts/WakaSparkline.es.js +1 -1
- package/dist/components/waka-charts/dataTableHelpers.cjs.js +1 -1
- package/dist/components/waka-charts/dataTableHelpers.es.js +1 -1
- package/dist/components/waka-charts/hooks/useChartTheme.cjs.js +1 -1
- package/dist/components/waka-charts/hooks/useChartTheme.es.js +1 -1
- package/dist/components/waka-charts/hooks/useRechartsLoader.cjs.js +1 -1
- package/dist/components/waka-charts/hooks/useRechartsLoader.es.js +1 -1
- package/dist/components/waka-chat-bubble/index.cjs.js +1 -1
- package/dist/components/waka-checklist/index.cjs.js +2 -2
- package/dist/components/waka-checklist/index.es.js +1 -1
- package/dist/components/waka-checkout-stepper/index.cjs.js +1 -1
- package/dist/components/waka-checkout-stepper/index.es.js +1 -1
- package/dist/components/waka-cohort-table/index.cjs.js +2 -2
- package/dist/components/waka-cohort-table/index.es.js +1 -1
- package/dist/components/waka-color-picker/index.cjs.js +2 -2
- package/dist/components/waka-color-picker/index.es.js +1 -1
- package/dist/components/waka-combo-counter/index.cjs.js +1 -1
- package/dist/components/waka-combobox/index.cjs.js +1 -1
- package/dist/components/waka-combobox/index.es.js +3 -2
- package/dist/components/waka-command-bar/index.cjs.js +1 -1
- package/dist/components/waka-compare-period/index.cjs.js +2 -2
- package/dist/components/waka-compare-period/index.es.js +7 -5
- package/dist/components/waka-config-comparator/index.cjs.js +1 -1
- package/dist/components/waka-config-comparator/index.es.js +1 -1
- package/dist/components/waka-connection-matrix/index.cjs.js +1 -1
- package/dist/components/waka-connection-matrix/index.es.js +1 -1
- package/dist/components/waka-container-list/index.cjs.js +1 -1
- package/dist/components/waka-container-list/index.es.js +1 -1
- package/dist/components/waka-content-recommendation/index.cjs.js +1 -1
- package/dist/components/waka-content-recommendation/index.es.js +2 -2
- package/dist/components/waka-contribution-graph/index.cjs.js +1 -1
- package/dist/components/waka-contribution-graph/index.es.js +4 -4
- package/dist/components/waka-cost-breakdown/index.cjs.js +1 -1
- package/dist/components/waka-cost-breakdown/index.es.js +7 -7
- package/dist/components/waka-coupon-input/index.cjs.js +2 -2
- package/dist/components/waka-coupon-input/index.es.js +1 -1
- package/dist/components/waka-credit-activity-feed/index.cjs.js +2 -2
- package/dist/components/waka-credit-activity-feed/index.es.js +1 -1
- package/dist/components/waka-credit-alert/index.cjs.js +1 -1
- package/dist/components/waka-credit-alert/index.es.js +1 -1
- package/dist/components/waka-credit-balance/index.cjs.js +1 -1
- package/dist/components/waka-credit-balance/index.es.js +3 -3
- package/dist/components/waka-credit-breakdown/index.cjs.js +1 -1
- package/dist/components/waka-credit-breakdown/index.es.js +1 -1
- package/dist/components/waka-credit-burn-rate/index.cjs.js +1 -1
- package/dist/components/waka-credit-burn-rate/index.es.js +1 -1
- package/dist/components/waka-credit-card-input/index.cjs.js +1 -1
- package/dist/components/waka-credit-card-input/index.es.js +1 -1
- package/dist/components/waka-credit-history/index.cjs.js +1 -1
- package/dist/components/waka-credit-history/index.es.js +1 -1
- package/dist/components/waka-credit-meter/index.cjs.js +2 -2
- package/dist/components/waka-credit-meter/index.es.js +3 -3
- package/dist/components/waka-credit-pricing-pack/index.cjs.js +1 -1
- package/dist/components/waka-credit-pricing-pack/index.es.js +1 -1
- package/dist/components/waka-credit-projection/index.cjs.js +1 -1
- package/dist/components/waka-credit-projection/index.es.js +1 -1
- package/dist/components/waka-credit-quota/index.cjs.js +1 -1
- package/dist/components/waka-credit-quota/index.es.js +3 -3
- package/dist/components/waka-credit-receipt/index.cjs.js +1 -1
- package/dist/components/waka-credit-receipt/index.es.js +1 -1
- package/dist/components/waka-credit-top-up/index.cjs.js +1 -1
- package/dist/components/waka-credit-top-up/index.es.js +1 -1
- package/dist/components/waka-credit-transaction/index.cjs.js +1 -1
- package/dist/components/waka-credit-transaction/index.es.js +1 -1
- package/dist/components/waka-credit-transfer-form/index.cjs.js +1 -1
- package/dist/components/waka-credit-transfer-form/index.es.js +1 -1
- package/dist/components/waka-credit-usage-chart/index.cjs.js +1 -1
- package/dist/components/waka-credit-usage-chart/index.es.js +1 -1
- package/dist/components/waka-daily-reward/index.cjs.js +1 -1
- package/dist/components/waka-database-card/index.cjs.js +1 -1
- package/dist/components/waka-database-card/index.es.js +1 -1
- package/dist/components/waka-date-range-picker/index.cjs.js +1 -1
- package/dist/components/waka-date-range-picker/index.es.js +3 -2
- package/dist/components/waka-datetime-picker/index.cjs.js +1 -1
- package/dist/components/waka-datetime-picker/index.es.js +4 -1
- package/dist/components/waka-datetime-picker.form-integration/index.cjs.js +1 -1
- package/dist/components/waka-dependency-tree/index.cjs.js +1 -1
- package/dist/components/waka-dependency-tree/index.es.js +1 -1
- package/dist/components/waka-deployment-lane/index.cjs.js +1 -1
- package/dist/components/waka-deployment-lane/index.es.js +1 -1
- package/dist/components/waka-device-trust/index.cjs.js +2 -2
- package/dist/components/waka-device-trust/index.es.js +1 -1
- package/dist/components/waka-doc-breadcrumb/index.cjs.js +1 -1
- package/dist/components/waka-doc-callout/index.cjs.js +1 -1
- package/dist/components/waka-doc-code-block/index.cjs.js +1 -1
- package/dist/components/waka-doc-nav/index.cjs.js +1 -1
- package/dist/components/waka-doc-renderer/index.cjs.js +1 -1
- package/dist/components/waka-doc-search/index.cjs.js +1 -1
- package/dist/components/waka-doc-table/index.cjs.js +1 -1
- package/dist/components/waka-doc-toc/index.cjs.js +1 -1
- package/dist/components/waka-doc-toolbar/index.cjs.js +1 -1
- package/dist/components/waka-doc-version/index.cjs.js +1 -1
- package/dist/components/waka-dock/index.cjs.js +1 -1
- package/dist/components/waka-dock/index.es.js +2 -2
- package/dist/components/waka-drawer/index.cjs.js +1 -1
- package/dist/components/waka-drawer/index.es.js +1 -1
- package/dist/components/waka-empty-state/index.cjs.js +1 -1
- package/dist/components/waka-env-var-editor/index.cjs.js +1 -1
- package/dist/components/waka-error-shake/index.cjs.js +1 -1
- package/dist/components/waka-feature-announcement/index.cjs.js +2 -2
- package/dist/components/waka-feature-announcement/index.es.js +1 -1
- package/dist/components/waka-feature-flag-row/index.cjs.js +1 -1
- package/dist/components/waka-file-upload/index.cjs.js +1 -1
- package/dist/components/waka-file-upload/index.es.js +2 -2
- package/dist/components/waka-floating-nav/index.cjs.js +1 -1
- package/dist/components/waka-floating-nav/index.es.js +1 -1
- package/dist/components/waka-flow-diagram/index.cjs.js +1 -1
- package/dist/components/waka-funnel-chart/index.cjs.js +2 -2
- package/dist/components/waka-funnel-chart/index.es.js +1 -1
- package/dist/components/waka-glow-card/index.cjs.js +1 -1
- package/dist/components/waka-glow-card/index.es.js +3 -3
- package/dist/components/waka-goal-progress/index.cjs.js +3 -3
- package/dist/components/waka-goal-progress/index.es.js +3 -3
- package/dist/components/waka-haptic-button/index.cjs.js +1 -1
- package/dist/components/waka-health-pulse/index.cjs.js +2 -2
- package/dist/components/waka-health-pulse/index.es.js +1 -1
- package/dist/components/waka-heatmap/index.cjs.js +1 -1
- package/dist/components/waka-heatmap/index.es.js +3 -3
- package/dist/components/waka-hotspot/index.cjs.js +1 -1
- package/dist/components/waka-image/index.cjs.js +1 -1
- package/dist/components/waka-image/index.es.js +1 -1
- package/dist/components/waka-incident-timeline/index.cjs.js +1 -1
- package/dist/components/waka-incident-timeline/index.es.js +3 -2
- package/dist/components/waka-invoice-preview/index.cjs.js +1 -1
- package/dist/components/waka-invoice-preview/index.es.js +1 -1
- package/dist/components/waka-kanban/index.cjs.js +1 -1
- package/dist/components/waka-kanban/index.es.js +1 -1
- package/dist/components/waka-kpi-dashboard/index.cjs.js +1 -1
- package/dist/components/waka-kpi-dashboard/index.es.js +6 -4
- package/dist/components/waka-kubernetes-overview/index.cjs.js +1 -1
- package/dist/components/waka-kubernetes-overview/index.es.js +1 -1
- package/dist/components/waka-leaderboard/index.cjs.js +1 -1
- package/dist/components/waka-level-progress/index.cjs.js +2 -2
- package/dist/components/waka-level-progress/index.es.js +2 -2
- package/dist/components/waka-liquid-button/index.cjs.js +1 -1
- package/dist/components/waka-loading-orbit/index.cjs.js +1 -1
- package/dist/components/waka-log-viewer/index.cjs.js +1 -1
- package/dist/components/waka-loot-box/index.cjs.js +2 -2
- package/dist/components/waka-loot-box/index.es.js +1 -1
- package/dist/components/waka-magic-link/index.cjs.js +2 -2
- package/dist/components/waka-magnetic-button/index.cjs.js +1 -1
- package/dist/components/waka-mention-input/index.cjs.js +1 -1
- package/dist/components/waka-mention-input/index.es.js +52 -40
- package/dist/components/waka-metric-sparkline/index.cjs.js +1 -1
- package/dist/components/waka-metric-sparkline/index.es.js +1 -1
- package/dist/components/waka-migration-list/index.cjs.js +1 -1
- package/dist/components/waka-milestone-road/index.cjs.js +2 -2
- package/dist/components/waka-milestone-road/index.es.js +5 -5
- package/dist/components/waka-modal/index.cjs.js +1 -1
- package/dist/components/waka-modal/index.es.js +1 -1
- package/dist/components/waka-morph-button/index.cjs.js +2 -2
- package/dist/components/waka-morph-button/index.es.js +6 -2
- package/dist/components/waka-network-topology/index.cjs.js +1 -1
- package/dist/components/waka-network-topology/index.es.js +4 -2
- package/dist/components/waka-notifications/index.cjs.js +1 -1
- package/dist/components/waka-number-input/index.cjs.js +1 -1
- package/dist/components/waka-number-input/index.es.js +1 -1
- package/dist/components/waka-orbital-menu/index.cjs.js +1 -1
- package/dist/components/waka-orbital-menu/index.es.js +1 -1
- package/dist/components/waka-order-tracker/index.cjs.js +1 -1
- package/dist/components/waka-order-tracker/index.es.js +3 -2
- package/dist/components/waka-outstream-video/index.cjs.js +1 -1
- package/dist/components/waka-outstream-video/index.es.js +2 -2
- package/dist/components/waka-pagination/index.cjs.js +1 -1
- package/dist/components/waka-pagination/index.es.js +1 -1
- package/dist/components/waka-password-strength/index.cjs.js +2 -2
- package/dist/components/waka-password-strength/index.es.js +3 -3
- package/dist/components/waka-payment-method-picker/index.cjs.js +1 -1
- package/dist/components/waka-payment-method-picker/index.es.js +1 -1
- package/dist/components/waka-permission-matrix/index.cjs.js +2 -2
- package/dist/components/waka-permission-matrix/index.es.js +3 -2
- package/dist/components/waka-phone-input/index.cjs.js +1 -1
- package/dist/components/waka-phone-input/index.es.js +5 -3
- package/dist/components/waka-pipeline-view/index.cjs.js +2 -2
- package/dist/components/waka-pipeline-view/index.es.js +1 -1
- package/dist/components/waka-player-card/index.cjs.js +2 -2
- package/dist/components/waka-player-card/index.es.js +4 -4
- package/dist/components/waka-pod-card/index.cjs.js +1 -1
- package/dist/components/waka-pod-card/index.es.js +1 -1
- package/dist/components/waka-points-popup/index.cjs.js +1 -1
- package/dist/components/waka-points-popup/index.es.js +5 -1
- package/dist/components/waka-power-up/index.cjs.js +1 -1
- package/dist/components/waka-presence-indicator/index.cjs.js +2 -2
- package/dist/components/waka-presence-indicator/index.es.js +1 -1
- package/dist/components/waka-pricing-table/index.cjs.js +2 -2
- package/dist/components/waka-pricing-table/index.es.js +1 -1
- package/dist/components/waka-product-card/index.cjs.js +1 -1
- package/dist/components/waka-progress-onboarding/index.cjs.js +3 -3
- package/dist/components/waka-progress-onboarding/index.es.js +1 -1
- package/dist/components/waka-pull-to-refresh/index.cjs.js +1 -1
- package/dist/components/waka-qrcode/index.cjs.js +1 -1
- package/dist/components/waka-qrcode/index.es.js +1 -1
- package/dist/components/waka-query-explain/index.cjs.js +1 -1
- package/dist/components/waka-quest-card/index.cjs.js +2 -2
- package/dist/components/waka-quest-card/index.es.js +4 -1
- package/dist/components/waka-quota-bar/index.cjs.js +2 -2
- package/dist/components/waka-quota-bar/index.es.js +11 -4
- package/dist/components/waka-radar-score/index.cjs.js +1 -1
- package/dist/components/waka-radar-score/index.es.js +6 -6
- package/dist/components/waka-rank-badge/index.cjs.js +2 -2
- package/dist/components/waka-rank-badge/index.es.js +1 -1
- package/dist/components/waka-rating-input/index.cjs.js +2 -2
- package/dist/components/waka-rating-input/index.es.js +1 -1
- package/dist/components/waka-reaction-picker/index.cjs.js +1 -1
- package/dist/components/waka-reaction-picker/index.es.js +7 -4
- package/dist/components/waka-region-map/index.cjs.js +1 -1
- package/dist/components/waka-region-map/index.es.js +1 -1
- package/dist/components/waka-resource-gauge/index.cjs.js +2 -2
- package/dist/components/waka-resource-gauge/index.es.js +3 -3
- package/dist/components/waka-resource-pool/index.cjs.js +2 -2
- package/dist/components/waka-resource-pool/index.es.js +1 -1
- package/dist/components/waka-rich-text-editor/index.cjs.js +1 -1
- package/dist/components/waka-rich-text-editor/index.es.js +1 -1
- package/dist/components/waka-rollback-slider/index.cjs.js +2 -2
- package/dist/components/waka-rollback-slider/index.es.js +5 -3
- package/dist/components/waka-sankey-diagram/index.cjs.js +2 -2
- package/dist/components/waka-sankey-diagram/index.es.js +5 -5
- package/dist/components/waka-schedule-picker/index.cjs.js +1 -1
- package/dist/components/waka-schedule-picker/index.es.js +3 -2
- package/dist/components/waka-scratch-card/index.cjs.js +2 -2
- package/dist/components/waka-scratch-card/index.es.js +1 -1
- package/dist/components/waka-season-pass/index.cjs.js +1 -1
- package/dist/components/waka-secret-card/index.cjs.js +1 -1
- package/dist/components/waka-security-scan-result/index.cjs.js +1 -1
- package/dist/components/waka-security-score/index.cjs.js +2 -2
- package/dist/components/waka-security-score/index.es.js +5 -5
- package/dist/components/waka-segmented-control/index.cjs.js +1 -1
- package/dist/components/waka-segmented-control/index.es.js +1 -1
- package/dist/components/waka-server-rack/index.cjs.js +1 -1
- package/dist/components/waka-service-graph/index.cjs.js +1 -1
- package/dist/components/waka-session-manager/index.cjs.js +1 -1
- package/dist/components/waka-session-manager/index.es.js +3 -2
- package/dist/components/waka-signature-pad/index.cjs.js +1 -1
- package/dist/components/waka-signature-pad/index.es.js +1 -1
- package/dist/components/waka-skeleton-wave/index.cjs.js +1 -1
- package/dist/components/waka-skill-tree/index.cjs.js +2 -2
- package/dist/components/waka-skill-tree/index.es.js +32 -32
- package/dist/components/waka-sla-tracker/index.cjs.js +1 -1
- package/dist/components/waka-sla-tracker/index.es.js +1 -1
- package/dist/components/waka-slider-range/index.cjs.js +1 -1
- package/dist/components/waka-slider-range/index.es.js +3 -3
- package/dist/components/waka-spin-wheel/index.cjs.js +2 -2
- package/dist/components/waka-spin-wheel/index.es.js +6 -6
- package/dist/components/waka-spinner/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-badge/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-badge/index.es.js +1 -1
- package/dist/components/waka-sponsored-card/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-card/index.es.js +2 -2
- package/dist/components/waka-sponsored-feed/index.cjs.js +1 -1
- package/dist/components/waka-sponsored-feed/index.es.js +2 -2
- package/dist/components/waka-spotlight/index.cjs.js +1 -1
- package/dist/components/waka-spotlight/index.es.js +2 -1
- package/dist/components/waka-stat/index.cjs.js +1 -1
- package/dist/components/waka-stat/index.es.js +1 -1
- package/dist/components/waka-stats-hexagon/index.cjs.js +1 -1
- package/dist/components/waka-stats-hexagon/index.es.js +9 -9
- package/dist/components/waka-status-matrix/index.cjs.js +1 -1
- package/dist/components/waka-status-matrix/index.es.js +1 -1
- package/dist/components/waka-stepper/index.cjs.js +1 -1
- package/dist/components/waka-stepper/index.es.js +1 -1
- package/dist/components/waka-streak-counter/index.cjs.js +1 -1
- package/dist/components/waka-success-explosion/index.cjs.js +1 -1
- package/dist/components/waka-swipe-card/index.cjs.js +1 -1
- package/dist/components/waka-swipe-card/index.es.js +2 -2
- package/dist/components/waka-tabs-morph/index.cjs.js +1 -1
- package/dist/components/waka-tabs-morph/index.es.js +1 -1
- package/dist/components/waka-tag-input/index.cjs.js +1 -1
- package/dist/components/waka-tag-input/index.es.js +3 -2
- package/dist/components/waka-team-banner/index.cjs.js +2 -2
- package/dist/components/waka-team-banner/index.es.js +1 -1
- package/dist/components/waka-terminal-output/index.cjs.js +2 -2
- package/dist/components/waka-terminal-output/index.es.js +5 -3
- package/dist/components/waka-test-report/index.cjs.js +1 -1
- package/dist/components/waka-theme-creator/index.cjs.js +1 -1
- package/dist/components/waka-theme-manager/index.cjs.js +1 -1
- package/dist/components/waka-theme-manager/index.es.js +5 -2
- package/dist/components/waka-thread-view/index.cjs.js +2 -2
- package/dist/components/waka-thread-view/index.es.js +1 -1
- package/dist/components/waka-tilt-card/index.cjs.js +1 -1
- package/dist/components/waka-tilt-card/index.es.js +8 -6
- package/dist/components/waka-time-picker/index.cjs.js +1 -1
- package/dist/components/waka-time-picker/index.es.js +10 -6
- package/dist/components/waka-timeline/index.cjs.js +1 -1
- package/dist/components/waka-timeline/index.es.js +1 -1
- package/dist/components/waka-tooltip-tour/index.cjs.js +3 -3
- package/dist/components/waka-tooltip-tour/index.es.js +53 -51
- package/dist/components/waka-tour-guide/index.cjs.js +2 -2
- package/dist/components/waka-tour-guide/index.es.js +1 -1
- package/dist/components/waka-tournament-bracket/index.cjs.js +2 -2
- package/dist/components/waka-tournament-bracket/index.es.js +1 -1
- package/dist/components/waka-trace-viewer/index.cjs.js +1 -1
- package/dist/components/waka-tree/index.cjs.js +1 -1
- package/dist/components/waka-tree/index.es.js +1 -1
- package/dist/components/waka-treemap-chart/index.cjs.js +1 -1
- package/dist/components/waka-treemap-chart/index.es.js +1 -1
- package/dist/components/waka-two-factor-setup/index.cjs.js +2 -2
- package/dist/components/waka-two-factor-setup/index.es.js +5 -4
- package/dist/components/waka-typewriter/index.cjs.js +1 -1
- package/dist/components/waka-typewriter/index.es.js +7 -2
- package/dist/components/waka-typing-indicator/index.cjs.js +2 -2
- package/dist/components/waka-typing-indicator/index.es.js +1 -1
- package/dist/components/waka-versus-card/index.cjs.js +3 -3
- package/dist/components/waka-versus-card/index.es.js +5 -4
- package/dist/components/waka-video/index.cjs.js +1 -1
- package/dist/components/waka-video/index.es.js +1 -1
- package/dist/components/waka-video-ad/index.cjs.js +1 -1
- package/dist/components/waka-video-ad/index.es.js +3 -3
- package/dist/components/waka-video-call/index.cjs.js +2 -2
- package/dist/components/waka-video-call/index.es.js +1 -1
- package/dist/components/waka-video-overlay/index.cjs.js +1 -1
- package/dist/components/waka-video-overlay/index.es.js +2 -2
- package/dist/components/waka-virtual-list/index.cjs.js +1 -1
- package/dist/components/waka-virtual-list/index.es.js +1 -1
- package/dist/components/waka-voice-message/index.cjs.js +1 -1
- package/dist/components/waka-voice-message/index.es.js +6 -5
- package/dist/components/waka-welcome-modal/index.cjs.js +2 -2
- package/dist/components/waka-welcome-modal/index.es.js +1 -1
- package/dist/components/waka-xp-bar/index.cjs.js +1 -1
- package/dist/components/waka-xp-bar/index.es.js +2 -2
- package/dist/context/admincrumb-context.cjs.js +1 -1
- package/dist/context/language-context.cjs.js +1 -1
- package/dist/context/language-context.es.js +2 -2
- package/dist/context/theme-context.cjs.js +1 -1
- package/dist/context/theme-provider.cjs.js +1 -1
- package/dist/context/theme-provider.es.js +9 -6
- package/dist/context/waka-provider.cjs.js +1 -1
- package/dist/context/waka-provider.es.js +57 -53
- package/dist/doc.cjs.js +1 -1
- package/dist/editor.cjs.js +1 -1
- package/dist/export.cjs.js +1 -1
- package/dist/hooks/use-toast.cjs.js +1 -1
- package/dist/hooks/use-translation.cjs.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +279 -278
- package/dist/lib/i18n.cjs.js +1 -1
- package/dist/lib/i18n.es.js +11 -9
- package/dist/locales/default-resources.cjs.js +1 -0
- package/dist/locales/default-resources.d.ts +155 -0
- package/dist/locales/default-resources.es.js +150 -0
- package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.cjs.js +13 -13
- package/dist/node_modules/.pnpm/exceljs@4.4.0/node_modules/exceljs/dist/exceljs.min.es.js +13 -13
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-docker.es.js +19 -19
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.cjs.js +1 -1
- package/dist/node_modules/.pnpm/prismjs@1.30.0/node_modules/prismjs/components/prism-markdown.es.js +24 -25
- package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-resizable-panels@4.11.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-resizable-panels/dist/react-resizable-panels.es.js +26 -23
- package/dist/rich-text.cjs.js +1 -1
- package/dist/ui.css +1 -1
- package/dist/utils/cn.cjs.js +1 -1
- package/dist/utils/datetime-helpers.cjs.js +1 -1
- package/dist/utils/theme-loader.cjs.js +1 -1
- package/dist/utils/tweak.cjs.js +1 -1
- package/package.json +28 -27
- package/src/components/DataTable/DataTable.tsx +2 -0
- package/src/components/DataTable/DataTablePagination.tsx +28 -8
- package/src/components/DataTable/hooks/useDataTable.ts +13 -0
- package/src/components/editor/blocks/waka-diagram-block.tsx +7 -36
|
@@ -5,86 +5,86 @@ import * as t from "react";
|
|
|
5
5
|
import { ChevronLeft as n, ChevronRight as r, SkipForward as i, X as a } from "lucide-react";
|
|
6
6
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/waka-tooltip-tour/index.tsx
|
|
8
|
-
var l = "waka-tour-completed-", u = 8
|
|
9
|
-
function
|
|
8
|
+
var l = "waka-tour-completed-", u = 8;
|
|
9
|
+
function d(e) {
|
|
10
10
|
return `${l}${e}`;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function f(e) {
|
|
13
13
|
if (typeof window > "u") return !1;
|
|
14
14
|
try {
|
|
15
|
-
return localStorage.getItem(
|
|
15
|
+
return localStorage.getItem(d(e)) === "true";
|
|
16
16
|
} catch {
|
|
17
17
|
return !1;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function p(e) {
|
|
21
21
|
if (!(typeof window > "u")) try {
|
|
22
|
-
localStorage.setItem(
|
|
22
|
+
localStorage.setItem(d(e), "true");
|
|
23
23
|
} catch {}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function m(e) {
|
|
26
26
|
if (!(typeof window > "u")) try {
|
|
27
|
-
localStorage.removeItem(
|
|
27
|
+
localStorage.removeItem(d(e));
|
|
28
28
|
} catch {}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function h(e) {
|
|
31
31
|
return typeof e == "string" ? document.querySelector(e) : e.current;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function g(e) {
|
|
34
34
|
return e.getBoundingClientRect();
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
let a =
|
|
36
|
+
function _(e, t, n, r, i) {
|
|
37
|
+
let a = 0, o = 0, s = 0, c = 0, l = 0, d = n, f = {
|
|
38
38
|
top: () => {
|
|
39
|
-
|
|
39
|
+
a = e.top - t.height - 20, o = e.left + (e.width - t.width) / 2, s = t.height, c = t.width / 2 - u, l = 180;
|
|
40
40
|
},
|
|
41
41
|
"top-start": () => {
|
|
42
|
-
|
|
42
|
+
a = e.top - t.height - 20, o = e.left, s = t.height, c = Math.min(e.width / 2, t.width / 4), l = 180;
|
|
43
43
|
},
|
|
44
44
|
"top-end": () => {
|
|
45
|
-
|
|
45
|
+
a = e.top - t.height - 20, o = e.right - t.width, s = t.height, c = t.width - Math.min(e.width / 2, t.width / 4) - u * 2, l = 180;
|
|
46
46
|
},
|
|
47
47
|
bottom: () => {
|
|
48
|
-
|
|
48
|
+
a = e.bottom + 20, o = e.left + (e.width - t.width) / 2, s = -16, c = t.width / 2 - u, l = 0;
|
|
49
49
|
},
|
|
50
50
|
"bottom-start": () => {
|
|
51
|
-
|
|
51
|
+
a = e.bottom + 20, o = e.left, s = -16, c = Math.min(e.width / 2, t.width / 4), l = 0;
|
|
52
52
|
},
|
|
53
53
|
"bottom-end": () => {
|
|
54
|
-
|
|
54
|
+
a = e.bottom + 20, o = e.right - t.width, s = -16, c = t.width - Math.min(e.width / 2, t.width / 4) - u * 2, l = 0;
|
|
55
55
|
},
|
|
56
56
|
left: () => {
|
|
57
|
-
|
|
57
|
+
a = e.top + (e.height - t.height) / 2, o = e.left - t.width - 20, s = t.height / 2 - u, c = t.width, l = 90;
|
|
58
58
|
},
|
|
59
59
|
"left-start": () => {
|
|
60
|
-
|
|
60
|
+
a = e.top, o = e.left - t.width - 20, s = Math.min(e.height / 2, t.height / 4), c = t.width, l = 90;
|
|
61
61
|
},
|
|
62
62
|
"left-end": () => {
|
|
63
|
-
|
|
63
|
+
a = e.bottom - t.height, o = e.left - t.width - 20, s = t.height - Math.min(e.height / 2, t.height / 4) - u * 2, c = t.width, l = 90;
|
|
64
64
|
},
|
|
65
65
|
right: () => {
|
|
66
|
-
|
|
66
|
+
a = e.top + (e.height - t.height) / 2, o = e.right + 20, s = t.height / 2 - u, c = -16, l = -90;
|
|
67
67
|
},
|
|
68
68
|
"right-start": () => {
|
|
69
|
-
|
|
69
|
+
a = e.top, o = e.right + 20, s = Math.min(e.height / 2, t.height / 4), c = -16, l = -90;
|
|
70
70
|
},
|
|
71
71
|
"right-end": () => {
|
|
72
|
-
|
|
72
|
+
a = e.bottom - t.height, o = e.right + 20, s = t.height - Math.min(e.height / 2, t.height / 4) - u * 2, c = -16, l = -90;
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
return
|
|
76
|
-
top:
|
|
77
|
-
left:
|
|
78
|
-
arrowTop:
|
|
79
|
-
arrowLeft:
|
|
80
|
-
arrowRotation:
|
|
81
|
-
actualPlacement:
|
|
75
|
+
return f[n](), o < 16 ? o = 16 : o + t.width > r - 16 && (o = r - t.width - 16), a < 16 && n.startsWith("top") ? (d = n.replace("top", "bottom"), f[d]()) : a + t.height > i - 16 && n.startsWith("bottom") && (d = n.replace("bottom", "top"), f[d]()), {
|
|
76
|
+
top: a,
|
|
77
|
+
left: o,
|
|
78
|
+
arrowTop: s,
|
|
79
|
+
arrowLeft: c,
|
|
80
|
+
arrowRotation: l,
|
|
81
|
+
actualPlacement: d
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function v({ tourId: e, persistCompletion: n = !0, autoStart: r = !1, autoStartDelay: i = 500 }) {
|
|
85
85
|
let [a, o] = t.useState(!1), [s, c] = t.useState(0), [l, u] = t.useState(!1);
|
|
86
86
|
t.useEffect(() => {
|
|
87
|
-
n && u(
|
|
87
|
+
n && u(f(e));
|
|
88
88
|
}, [e, n]), t.useEffect(() => {
|
|
89
89
|
if (r && !l && !a) {
|
|
90
90
|
let e = setTimeout(() => {
|
|
@@ -100,7 +100,7 @@ function y({ tourId: e, persistCompletion: n = !0, autoStart: r = !1, autoStartD
|
|
|
100
100
|
]);
|
|
101
101
|
let d = t.useCallback((e = 0) => {
|
|
102
102
|
c(e), o(!0);
|
|
103
|
-
}, []),
|
|
103
|
+
}, []), h = t.useCallback(() => {
|
|
104
104
|
o(!1);
|
|
105
105
|
}, []), g = t.useCallback(() => {
|
|
106
106
|
c((e) => e + 1);
|
|
@@ -109,7 +109,7 @@ function y({ tourId: e, persistCompletion: n = !0, autoStart: r = !1, autoStartD
|
|
|
109
109
|
}, []), v = t.useCallback((e) => {
|
|
110
110
|
c(e);
|
|
111
111
|
}, []), y = t.useCallback(() => {
|
|
112
|
-
o(!1), n && (
|
|
112
|
+
o(!1), n && (p(e), u(!0));
|
|
113
113
|
}, [e, n]), b = t.useCallback(() => {
|
|
114
114
|
o(!1);
|
|
115
115
|
}, []);
|
|
@@ -117,14 +117,14 @@ function y({ tourId: e, persistCompletion: n = !0, autoStart: r = !1, autoStartD
|
|
|
117
117
|
isActive: a,
|
|
118
118
|
currentStep: s,
|
|
119
119
|
start: d,
|
|
120
|
-
stop:
|
|
120
|
+
stop: h,
|
|
121
121
|
next: g,
|
|
122
122
|
prev: _,
|
|
123
123
|
goTo: v,
|
|
124
124
|
complete: y,
|
|
125
125
|
skip: b,
|
|
126
126
|
reset: t.useCallback(() => {
|
|
127
|
-
|
|
127
|
+
m(e), u(!1), c(0);
|
|
128
128
|
}, [e]),
|
|
129
129
|
hasCompleted: l,
|
|
130
130
|
tourProps: {
|
|
@@ -139,7 +139,7 @@ function y({ tourId: e, persistCompletion: n = !0, autoStart: r = !1, autoStartD
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function y({ targetRect: t, padding: n, onClick: r, className: i }) {
|
|
143
143
|
if (!t) return /* @__PURE__ */ s("div", {
|
|
144
144
|
className: e("fixed inset-0 z-[9998] bg-black/60 transition-opacity duration-300", i),
|
|
145
145
|
onClick: r
|
|
@@ -169,7 +169,7 @@ function b({ targetRect: t, padding: n, onClick: r, className: i }) {
|
|
|
169
169
|
}
|
|
170
170
|
})] });
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function b({ top: e, left: t, rotation: n }) {
|
|
173
173
|
return /* @__PURE__ */ s("div", {
|
|
174
174
|
className: "absolute w-0 h-0",
|
|
175
175
|
style: {
|
|
@@ -182,7 +182,7 @@ function x({ top: e, left: t, rotation: n }) {
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function x({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: m, onSkip: v, onStepChange: x, startAt: S = 0, autoAdvance: C, showSkip: w = !0, showProgress: T = !0, showNavigation: E = !0, persistCompletion: D = !0, className: O, overlayClassName: k, scrollToTarget: A = !0, scrollBehavior: j = "smooth", closeOnOverlayClick: M = !1, closeOnEscape: N = !0, skipText: P = "Skip tour", nextText: F = "Next", prevText: I = "Back", finishText: L = "Finish" }) {
|
|
186
186
|
let [R, z] = t.useState(S), [B, V] = t.useState(null), [H, U] = t.useState(null), [W, G] = t.useState(!1), K = t.useRef(null), q = t.useRef(void 0), J = u[R], Y = R === 0, X = R === u.length - 1;
|
|
187
187
|
t.useEffect(() => {
|
|
188
188
|
z(S);
|
|
@@ -195,15 +195,15 @@ function S({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: p,
|
|
|
195
195
|
}, [d, N]), t.useEffect(() => {
|
|
196
196
|
if (!d || !J) return;
|
|
197
197
|
let e = () => {
|
|
198
|
-
let e =
|
|
198
|
+
let e = h(J.target);
|
|
199
199
|
if (e) {
|
|
200
|
-
let t =
|
|
200
|
+
let t = g(e);
|
|
201
201
|
V(t), A && (t.top >= 0 && t.left >= 0 && t.bottom <= window.innerHeight && t.right <= window.innerWidth || (e.scrollIntoView({
|
|
202
202
|
behavior: j,
|
|
203
203
|
block: "center",
|
|
204
204
|
inline: "center"
|
|
205
205
|
}), requestAnimationFrame(() => {
|
|
206
|
-
V(
|
|
206
|
+
V(g(e));
|
|
207
207
|
})));
|
|
208
208
|
} else V(null);
|
|
209
209
|
};
|
|
@@ -221,7 +221,9 @@ function S({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: p,
|
|
|
221
221
|
A,
|
|
222
222
|
j
|
|
223
223
|
]), t.useEffect(() => {
|
|
224
|
-
!B || !K.current || !J
|
|
224
|
+
if (!B || !K.current || !J) return;
|
|
225
|
+
let e = K.current.getBoundingClientRect(), t = _(B, e, J.placement || "bottom", window.innerWidth, window.innerHeight);
|
|
226
|
+
U(t);
|
|
225
227
|
}, [B, J]), t.useEffect(() => {
|
|
226
228
|
if (!(!d || !C || X)) return q.current = setTimeout(() => {
|
|
227
229
|
Z();
|
|
@@ -238,17 +240,17 @@ function S({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: p,
|
|
|
238
240
|
if (X) ee();
|
|
239
241
|
else {
|
|
240
242
|
let e = R + 1;
|
|
241
|
-
z(e),
|
|
243
|
+
z(e), x?.(e);
|
|
242
244
|
}
|
|
243
245
|
}, Q = () => {
|
|
244
246
|
if (!Y) {
|
|
245
247
|
let e = R - 1;
|
|
246
|
-
z(e),
|
|
248
|
+
z(e), x?.(e);
|
|
247
249
|
}
|
|
248
250
|
}, ee = () => {
|
|
249
|
-
D &&
|
|
251
|
+
D && p(l), f?.(!1), m?.();
|
|
250
252
|
}, $ = () => {
|
|
251
|
-
f?.(!1),
|
|
253
|
+
f?.(!1), v?.();
|
|
252
254
|
}, te = () => {
|
|
253
255
|
M && $();
|
|
254
256
|
}, ne = () => {
|
|
@@ -256,7 +258,7 @@ function S({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: p,
|
|
|
256
258
|
};
|
|
257
259
|
if (!d || !J) return null;
|
|
258
260
|
let re = J.spotlightPadding ?? 8;
|
|
259
|
-
return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(
|
|
261
|
+
return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(y, {
|
|
260
262
|
targetRect: J.highlight === !1 ? null : B,
|
|
261
263
|
padding: re,
|
|
262
264
|
onClick: te,
|
|
@@ -273,7 +275,7 @@ function S({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: p,
|
|
|
273
275
|
left: H?.left ?? 0
|
|
274
276
|
},
|
|
275
277
|
children: [
|
|
276
|
-
H && /* @__PURE__ */ s(
|
|
278
|
+
H && /* @__PURE__ */ s(b, {
|
|
277
279
|
top: H.arrowTop,
|
|
278
280
|
left: H.arrowLeft,
|
|
279
281
|
rotation: H.arrowRotation
|
|
@@ -343,4 +345,4 @@ function S({ tourId: l, steps: u, isActive: d, onActiveChange: f, onComplete: p,
|
|
|
343
345
|
})] });
|
|
344
346
|
}
|
|
345
347
|
//#endregion
|
|
346
|
-
export {
|
|
348
|
+
export { x as WakaTooltipTour, x as default, v as useTooltipTour };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");function a(e,t={}){let{initialStep:r=0,autoStart:i=!1,storageKey:a,onComplete:o}=t,[s,c]=n.useState(i),[l,u]=n.useState(r),[d,f]=n.useState(!1);n.useEffect(()=>{if(a&&typeof window<`u`){let e=localStorage.getItem(a)===`true`;f(e),i&&!e&&c(!0)}},[a,i]);let p=n.useCallback(()=>{u(0),c(!0)},[]),m=n.useCallback(()=>{c(!1)},[]),h=n.useCallback(()=>{l<e.length-1&&u(e=>e+1)},[l,e.length]),g=n.useCallback(()=>{l>0&&u(e=>e-1)},[l]),_=n.useCallback(t=>{t>=0&&t<e.length&&u(t)},[e.length]),v=n.useCallback(()=>{c(!1)},[]),y=n.useCallback(()=>{c(!1),f(!0),a&&typeof window<`u`&&localStorage.setItem(a,`true`),o?.()},[a,o]),b=n.useCallback(()=>{u(0),f(!1),a&&typeof window<`u`&&localStorage.removeItem(a)},[a]),x=n.useCallback(e=>{c(e)},[]),S=n.useCallback(e=>{u(e)},[]);return{isOpen:s,currentStep:l,totalSteps:e.length,start:p,stop:m,next:h,previous:g,goToStep:_,skip:v,complete:y,reset:b,hasCompleted:d,tourProps:{isOpen:s,onOpenChange:x,currentStep:l,onStepChange:S,onComplete:y,onSkip:v}}}function o(e){return typeof e==`string`?document.querySelector(e):e.current}function s(e,t,n,r){let i=window.innerWidth,a=window.innerHeight,o=window.scrollY,s=window.scrollX,c=n,l=0,u=0;if(n===`auto`){let t=e.top,n=a-e.bottom,r=e.left,o=i-e.right;c=[{placement:`bottom`,space:n},{placement:`top`,space:t},{placement:`right`,space:o},{placement:`left`,space:r}].sort((e,t)=>t.space-e.space)[0].placement}switch(c){case`top`:l=e.top+o-t.height-r-12,u=e.left+s+e.width/2-t.width/2;break;case`bottom`:l=e.bottom+o+r+12,u=e.left+s+e.width/2-t.width/2;break;case`left`:l=e.top+o+e.height/2-t.height/2,u=e.left+s-t.width-r-12;break;case`right`:l=e.top+o+e.height/2-t.height/2,u=e.right+s+r+12;break}return u=Math.max(16,Math.min(u,i-t.width-16)),l=Math.max(o+16,Math.min(l,o+a-t.height-16)),{top:l,left:u,actualPlacement:c}}function c({targetRect:e,padding:n,color:r,opacity:a,pulseAnimation:o}){if(!e)return(0,i.jsx)(`div`,{className:`fixed inset-0 z-[9998] pointer-events-auto`,style:{backgroundColor:r,opacity:a}});let s=window.scrollY,c=window.scrollX,l={top:e.top+s-n,left:e.left+c-n,width:e.width+n*2,height:e.height+n*2};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`fixed inset-0 z-[9998] pointer-events-auto transition-all duration-300`,style:{backgroundColor:r,opacity:a,clipPath:`polygon(
|
|
2
2
|
0% 0%,
|
|
3
3
|
0% 100%,
|
|
4
4
|
${l.left}px 100%,
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
.animate-tour-pulse {
|
|
22
22
|
animation: tour-pulse 2s ease-in-out infinite;
|
|
23
23
|
}
|
|
24
|
-
`})]})}var l=n.forwardRef(({step:e,stepIndex:n,totalSteps:a,position:o,placement:s,onNext:c,onPrevious:l,onSkip:u,onClose:d,showSkip:f,showProgress:p,showStepCounter:m,isFirstStep:h,isLastStep:g,labels:_,className:v},y)=>(0,i.jsxs)(`div`,{ref:y,className:t.cn(`absolute z-[10000] w-80 max-w-[calc(100vw-32px)]`,`bg-popover text-popover-foreground rounded-xl shadow-2xl border`,`animate-in fade-in-0 zoom-in-95 duration-200`,v),style:{top:o.top,left:o.left},role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tour-step-${e.id}-title`,"aria-describedby":`tour-step-${e.id}-content`,children:[(0,i.jsx)(`div`,{className:t.cn(`absolute w-0 h-0 border-8`,{top:`bottom-0 left-1/2 -translate-x-1/2 translate-y-full border-l-transparent border-r-transparent border-b-transparent border-t-popover`,bottom:`top-0 left-1/2 -translate-x-1/2 -translate-y-full border-l-transparent border-r-transparent border-t-transparent border-b-popover`,left:`right-0 top-1/2 -translate-y-1/2 translate-x-full border-t-transparent border-b-transparent border-r-transparent border-l-popover`,right:`left-0 top-1/2 -translate-y-1/2 -translate-x-full border-t-transparent border-b-transparent border-l-transparent border-r-popover`,auto:`hidden`}[s])}),(0,i.jsxs)(`div`,{className:`flex items-start justify-between gap-2 p-4 pb-2`,children:[(0,i.jsx)(`h3`,{id:`tour-step-${e.id}-title`,className:`font-semibold text-base leading-tight`,children:e.title}),(0,i.jsx)(`button`,{onClick:d,className:`shrink-0 rounded-md p-1 hover:bg-muted transition-colors -mt-1 -mr-1`,"aria-label":`Close tour`,children:(0,i.jsx)(r.X,{className:`h-4 w-4 text-muted-foreground`})})]}),(0,i.jsx)(`div`,{id:`tour-step-${e.id}-content`,className:`px-4 pb-4 text-sm text-muted-foreground`,children:e.content}),p&&a>1&&(0,i.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 px-4 pb-3`,children:Array.from({length:a}).map((e,a)=>(0,i.jsx)(r.Circle,{className:t.cn(`h-2 w-2 transition-colors`,a===n?`fill-primary text-primary`:a<n?`fill-primary/50 text-primary/50`:`fill-muted text-muted`)},a))}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-4 pt-2 border-t bg-muted/30 rounded-b-xl`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f&&!g&&(0,i.jsx)(`button`,{onClick:u,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:_.skip}),m&&(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n+1,` / `,a]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!h&&(0,i.jsxs)(`button`,{onClick:l,className:t.cn(`flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg`,`border hover:bg-muted transition-colors`),children:[(0,i.jsx)(r.ChevronLeft,{className:`h-4 w-4`}),_.previous]}),e.action?(0,i.jsx)(`button`,{onClick:e.action.onClick,className:t.cn(`flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`),children:e.action.label}):(0,i.jsxs)(`button`,{onClick:c,className:t.cn(`flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`),children:[g?_.finish:_.next,!g&&(0,i.jsx)(r.ChevronRight,{className:`h-4 w-4`})]})]})]})]}));l.displayName=`TourTooltip`;function u({steps:e,isOpen:t,onOpenChange:r,variant:a=`modal`,currentStep:u,onStepChange:d,onComplete:f,onSkip:p,showSkip:m=!0,showProgress:h=!0,showStepCounter:g=!1,keyboardNavigation:_=!0,scrollBehavior:v=`smooth`,scrollOffset:y=100,overlayColor:b=`rgba(0, 0, 0, 0.75)`,overlayOpacity:x=1,pulseAnimation:S=!0,tooltipClassName:C,labels:w={}}){let T=a===`modal`,[E,D]=n.useState(0),[O,k]=n.useState(null),[A,j]=n.useState({top:0,left:0}),[M,N]=n.useState(`bottom`),P=n.useRef(null),F=u??E,I=e[F],L=F===0,R=F===e.length-1,z={next:w.next??`Next`,previous:w.previous??`Back`,skip:w.skip??`Skip`,finish:w.finish??`Done`},B=n.useCallback(()=>{if(!t||!I)return;let e=o(I.target);if(!e){k(null);return}let n=e.getBoundingClientRect();k(n),requestAnimationFrame(()=>{if(P.current){let e=P.current.getBoundingClientRect(),t=I.spotlightPadding??8,{top:r,left:i,actualPlacement:a}=s(n,e,I.placement??`auto`,t);j({top:r,left:i}),N(a)}})},[t,I]),V=n.useCallback(async()=>{if(!I)return;let e=o(I.target);if(!e)return;let t=e.getBoundingClientRect();t.top>=y&&t.bottom<=window.innerHeight-y||(e.scrollIntoView({behavior:v,block:`center`}),await new Promise(e=>setTimeout(e,300)))},[I,v,y]),H=n.useCallback(()=>{let t=(u??E)+1;if(t>=e.length)f?.(),r(!1);else{let n=e[u??E];n?.beforeLeave&&n.beforeLeave(),e[t]?.beforeEnter&&e[t].beforeEnter(),d?d(t):D(t)}},[u,E,e,f,r,d]),U=n.useCallback(()=>{let t=(u??E)-1;if(t<0)return;let n=e[u??E];n?.beforeLeave&&n.beforeLeave(),e[t]?.beforeEnter&&e[t].beforeEnter(),d?d(t):D(t)},[u,E,e,d]),W=n.useCallback(()=>{p?.(),r(!1)},[p,r]),G=n.useCallback(()=>{r(!1)},[r]);if(n.useEffect(()=>{t&&(async()=>{I?.beforeEnter&&await I.beforeEnter(),await V(),B()})()},[t]),n.useEffect(()=>{t&&(async()=>{await V(),requestAnimationFrame(()=>{B()})})()},[F]),n.useEffect(()=>{if(!t)return;let e=()=>{B()};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[t,B]),n.useEffect(()=>{if(!t||!_)return;let e=e=>{switch(e.key){case`ArrowRight`:case`Enter`:e.preventDefault(),H();break;case`ArrowLeft`:e.preventDefault(),U();break;case`Escape`:e.preventDefault(),G();break}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,_,H,U,G]),n.useEffect(()=>{if(t&&T){let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}}},[t,T]),!t||!I)return null;let K=I.spotlightPadding??8;return(0,i.jsxs)(`div`,{className:`tour-guide-container`,children:[T&&(0,i.jsx)(c,{targetRect:O,padding:K,color:b,opacity:x,pulseAnimation:S}),T&&I.disableInteraction&&O&&(0,i.jsx)(`div`,{className:`fixed z-[9999] pointer-events-auto`,style:{top:O.top+window.scrollY-K,left:O.left+window.scrollX-K,width:O.width+K*2,height:O.height+K*2}}),(0,i.jsx)(l,{ref:P,step:I,stepIndex:F,totalSteps:e.length,position:A,placement:M,onNext:H,onPrevious:U,onSkip:W,onClose:G,showSkip:m,showProgress:h,showStepCounter:g,isFirstStep:L,isLastStep:R,labels:z,className:C})]})}exports.default=u,exports.useTourGuide=a;
|
|
24
|
+
`})]})}var l=n.forwardRef(({step:e,stepIndex:n,totalSteps:a,position:o,placement:s,onNext:c,onPrevious:l,onSkip:u,onClose:d,showSkip:f,showProgress:p,showStepCounter:m,isFirstStep:h,isLastStep:g,labels:_,className:v},y)=>(0,i.jsxs)(`div`,{ref:y,className:t.cn(`absolute z-[10000] w-80 max-w-[calc(100vw-32px)]`,`bg-popover text-popover-foreground rounded-xl shadow-2xl border`,`animate-in fade-in-0 zoom-in-95 duration-200`,v),style:{top:o.top,left:o.left},role:`dialog`,"aria-modal":`true`,"aria-labelledby":`tour-step-${e.id}-title`,"aria-describedby":`tour-step-${e.id}-content`,children:[(0,i.jsx)(`div`,{className:t.cn(`absolute w-0 h-0 border-8`,{top:`bottom-0 left-1/2 -translate-x-1/2 translate-y-full border-l-transparent border-r-transparent border-b-transparent border-t-popover`,bottom:`top-0 left-1/2 -translate-x-1/2 -translate-y-full border-l-transparent border-r-transparent border-t-transparent border-b-popover`,left:`right-0 top-1/2 -translate-y-1/2 translate-x-full border-t-transparent border-b-transparent border-r-transparent border-l-popover`,right:`left-0 top-1/2 -translate-y-1/2 -translate-x-full border-t-transparent border-b-transparent border-l-transparent border-r-popover`,auto:`hidden`}[s])}),(0,i.jsxs)(`div`,{className:`flex items-start justify-between gap-2 p-4 pb-2`,children:[(0,i.jsx)(`h3`,{id:`tour-step-${e.id}-title`,className:`font-semibold text-base leading-tight`,children:e.title}),(0,i.jsx)(`button`,{onClick:d,className:`shrink-0 rounded-md p-1 hover:bg-muted transition-colors -mt-1 -mr-1`,"aria-label":`Close tour`,children:(0,i.jsx)(r.X,{className:`h-4 w-4 text-muted-foreground`})})]}),(0,i.jsx)(`div`,{id:`tour-step-${e.id}-content`,className:`px-4 pb-4 text-sm text-muted-foreground`,children:e.content}),p&&a>1&&(0,i.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 px-4 pb-3`,children:Array.from({length:a}).map((e,a)=>(0,i.jsx)(r.Circle,{className:t.cn(`h-2 w-2 transition-colors`,a===n?`fill-primary text-primary`:a<n?`fill-primary/50 text-primary/50`:`fill-muted text-muted`)},a))}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between gap-2 p-4 pt-2 border-t bg-muted/30 rounded-b-xl`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f&&!g&&(0,i.jsx)(`button`,{onClick:u,className:`text-sm text-muted-foreground hover:text-foreground transition-colors`,children:_.skip}),m&&(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[n+1,` / `,a]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!h&&(0,i.jsxs)(`button`,{onClick:l,className:t.cn(`flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg`,`border hover:bg-muted transition-colors`),children:[(0,i.jsx)(r.ChevronLeft,{className:`h-4 w-4`}),_.previous]}),e.action?(0,i.jsx)(`button`,{onClick:e.action.onClick,className:t.cn(`flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`),children:e.action.label}):(0,i.jsxs)(`button`,{onClick:c,className:t.cn(`flex items-center gap-1 px-3 py-1.5 text-sm font-medium rounded-lg`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`),children:[g?_.finish:_.next,!g&&(0,i.jsx)(r.ChevronRight,{className:`h-4 w-4`})]})]})]})]}));l.displayName=`TourTooltip`;function u({steps:e,isOpen:t,onOpenChange:r,variant:a=`modal`,currentStep:u,onStepChange:d,onComplete:f,onSkip:p,showSkip:m=!0,showProgress:h=!0,showStepCounter:g=!1,keyboardNavigation:_=!0,scrollBehavior:v=`smooth`,scrollOffset:y=100,overlayColor:b=`rgba(0, 0, 0, 0.75)`,overlayOpacity:x=1,pulseAnimation:S=!0,tooltipClassName:C,labels:w={}}){let T=a===`modal`,[E,D]=n.useState(0),[O,k]=n.useState(null),[A,j]=n.useState({top:0,left:0}),[M,N]=n.useState(`bottom`),P=n.useRef(null),F=u??E,I=e[F],L=F===0,R=F===e.length-1,z={next:w.next??`Next`,previous:w.previous??`Back`,skip:w.skip??`Skip`,finish:w.finish??`Done`},B=n.useCallback(()=>{if(!t||!I)return;let e=o(I.target);if(!e){k(null);return}let n=e.getBoundingClientRect();k(n),requestAnimationFrame(()=>{if(P.current){let e=P.current.getBoundingClientRect(),t=I.spotlightPadding??8,{top:r,left:i,actualPlacement:a}=s(n,e,I.placement??`auto`,t);j({top:r,left:i}),N(a)}})},[t,I]),V=n.useCallback(async()=>{if(!I)return;let e=o(I.target);if(!e)return;let t=e.getBoundingClientRect();t.top>=y&&t.bottom<=window.innerHeight-y||(e.scrollIntoView({behavior:v,block:`center`}),await new Promise(e=>setTimeout(e,300)))},[I,v,y]),H=n.useCallback(()=>{let t=(u??E)+1;if(t>=e.length)f?.(),r(!1);else{let n=e[u??E];n?.beforeLeave&&n.beforeLeave(),e[t]?.beforeEnter&&e[t].beforeEnter(),d?d(t):D(t)}},[u,E,e,f,r,d]),U=n.useCallback(()=>{let t=(u??E)-1;if(t<0)return;let n=e[u??E];n?.beforeLeave&&n.beforeLeave(),e[t]?.beforeEnter&&e[t].beforeEnter(),d?d(t):D(t)},[u,E,e,d]),W=n.useCallback(()=>{p?.(),r(!1)},[p,r]),G=n.useCallback(()=>{r(!1)},[r]);if(n.useEffect(()=>{t&&(async()=>{I?.beforeEnter&&await I.beforeEnter(),await V(),B()})()},[t]),n.useEffect(()=>{t&&(async()=>{await V(),requestAnimationFrame(()=>{B()})})()},[F]),n.useEffect(()=>{if(!t)return;let e=()=>{B()};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[t,B]),n.useEffect(()=>{if(!t||!_)return;let e=e=>{switch(e.key){case`ArrowRight`:case`Enter`:e.preventDefault(),H();break;case`ArrowLeft`:e.preventDefault(),U();break;case`Escape`:e.preventDefault(),G();break}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,_,H,U,G]),n.useEffect(()=>{if(t&&T){let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}}},[t,T]),!t||!I)return null;let K=I.spotlightPadding??8;return(0,i.jsxs)(`div`,{className:`tour-guide-container`,children:[T&&(0,i.jsx)(c,{targetRect:O,padding:K,color:b,opacity:x,pulseAnimation:S}),T&&I.disableInteraction&&O&&(0,i.jsx)(`div`,{className:`fixed z-[9999] pointer-events-auto`,style:{top:O.top+window.scrollY-K,left:O.left+window.scrollX-K,width:O.width+K*2,height:O.height+K*2}}),(0,i.jsx)(l,{ref:P,step:I,stepIndex:F,totalSteps:e.length,position:A,placement:M,onNext:H,onPrevious:U,onSkip:W,onClose:G,showSkip:m,showProgress:h,showStepCounter:g,isFirstStep:L,isLastStep:R,labels:z,className:C})]})}exports.WakaTourGuide=u,exports.default=u,exports.useTourGuide=a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={sm:{matchWidth:160,matchHeight:56,verticalGap:16,horizontalGap:40,nameSize:`text-xs`,scoreSize:`text-xs`,avatarSize:`h-5 w-5`},default:{matchWidth:200,matchHeight:64,verticalGap:24,horizontalGap:60,nameSize:`text-sm`,scoreSize:`text-sm`,avatarSize:`h-6 w-6`},lg:{matchWidth:240,matchHeight:80,verticalGap:32,horizontalGap:80,nameSize:`text-base`,scoreSize:`text-base`,avatarSize:`h-8 w-8`}};function o(e,t,n,r){let i=a[r],o=i.matchHeight,s=i.verticalGap,c=e*(i.matchWidth+i.horizontalGap),l=2**(n-e-1);l*(o+s)-s;let u=(2**(n-1)*(o+s)-s)/l;return{x:c,y:t*u+(u-o)/2}}function s(e,t){let n=t-e;return n===1?`Finals`:n===2?`Semi Finals`:n===3?`Quarter Finals`:`Round of ${2**n}`}function c(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function l({participant:e,size:n,isWinner:o,className:s}){let l=a[n];return(0,i.jsxs)(`div`,{className:t.cn(`relative flex items-center justify-center rounded-full bg-muted text-muted-foreground font-semibold overflow-hidden`,l.avatarSize,o&&`ring-2 ring-yellow-400`,s),children:[e.avatar?(0,i.jsx)(`img`,{src:e.avatar,alt:e.name,className:`h-full w-full object-cover`}):(0,i.jsx)(`span`,{className:`text-[10px]`,children:c(e.name)}),o&&(0,i.jsx)(`div`,{className:`absolute -bottom-0.5 -right-0.5 flex h-3 w-3 items-center justify-center rounded-full bg-yellow-400 text-yellow-900`,children:(0,i.jsx)(r.Crown,{className:`h-2 w-2`})})]})}function u({match:e,size:o,showTime:s,animated:c,onClick:u,onHover:d,selected:f}){let p=a[o],[m,h]=n.useState(!c);n.useEffect(()=>{if(c&&e.status===`completed`){let e=setTimeout(()=>h(!0),500);return()=>clearTimeout(e)}else h(!0)},[c,e.status]);let g=e.status===`in_progress`,_=e.status===`completed`,v=e.status===`bye`,y=_&&e.winnerId===e.participant1?.id,b=_&&e.winnerId===e.participant2?.id,x=(e,n,r,a)=>e?(0,i.jsxs)(`div`,{className:t.cn(`flex items-center justify-between px-2 py-1.5 transition-all duration-300`,a?`rounded-t-lg border-b`:`rounded-b-lg`,r&&m&&`bg-green-50 dark:bg-green-950/30`,!r&&_&&m&&`bg-muted/50 opacity-60`,g&&`bg-primary/5`,`border-border`),children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,i.jsx)(l,{participant:e,size:o,isWinner:r&&m}),(0,i.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.seed&&(0,i.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[`[`,e.seed,`]`]}),(0,i.jsx)(`span`,{className:t.cn(`truncate font-medium`,p.nameSize,r&&m&&`text-green-700 dark:text-green-400`),children:e.name})]})})]}),(0,i.jsx)(`div`,{className:t.cn(`flex-shrink-0 font-mono font-bold tabular-nums`,p.scoreSize,r&&m?`text-green-600 dark:text-green-400`:`text-muted-foreground`),children:m&&n!==void 0?n:`-`})]}):(0,i.jsx)(`div`,{className:t.cn(`flex items-center justify-between px-2 py-1.5`,a?`rounded-t-lg border-b`:`rounded-b-lg`,`bg-muted/50 border-border`),children:(0,i.jsx)(`span`,{className:t.cn(`text-muted-foreground italic`,p.nameSize),children:v?`BYE`:`TBD`})});return(0,i.jsxs)(`div`,{onClick:u,onMouseEnter:()=>d?.(!0),onMouseLeave:()=>d?.(!1),className:t.cn(`relative rounded-lg border bg-card shadow-sm transition-all duration-200`,u&&`cursor-pointer hover:shadow-md hover:border-primary/50`,f&&`ring-2 ring-primary`,g&&`border-primary shadow-lg shadow-primary/20`,c&&_&&!m&&`animate-pulse`),style:{width:p.matchWidth,minHeight:p.matchHeight},children:[g&&(0,i.jsxs)(`div`,{className:`absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center`,children:[(0,i.jsx)(`span`,{className:`absolute inline-flex h-full w-full animate-ping rounded-full bg-primary opacity-75`}),(0,i.jsx)(`span`,{className:`relative inline-flex h-2 w-2 rounded-full bg-primary`})]}),(0,i.jsxs)(`div`,{className:`divide-y divide-border`,children:[x(e.participant1,e.score1,y,!0),x(e.participant2,e.score2,b,!1)]}),s&&e.scheduledAt&&(0,i.jsxs)(`div`,{className:`absolute -bottom-5 left-0 right-0 flex items-center justify-center gap-1 text-[10px] text-muted-foreground`,children:[(0,i.jsx)(r.Clock,{className:`h-3 w-3`}),(0,i.jsx)(`span`,{children:e.scheduledAt.toLocaleTimeString(`en-US`,{hour:`numeric`,minute:`2-digit`})})]})]})}function d({from:e,to:n,matchWidth:r,matchHeight:a,isWinnerPath:o,animated:s}){let c=e.x+r,l=e.y+a/2,u=n.x,d=n.y+a/2;return(0,i.jsx)(`path`,{d:`
|
|
2
2
|
M ${c} ${l}
|
|
3
3
|
H ${(c+u)/2}
|
|
4
4
|
V ${d}
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
.animate-draw-line {
|
|
18
18
|
animation: draw-line 1s ease-out forwards;
|
|
19
19
|
}
|
|
20
|
-
`})]})}function g({initialRounds:e,type:t=`single_elimination`,participants:r}={}){let i=n.useCallback(e=>{let t=e.length,n=Math.ceil(Math.log2(t)),r=2**n,i=[...e];for(;i.length<r;)i.push(void 0);i.forEach((e,t)=>{e&&(e.seed=t+1)});let a=[],o=[];for(let e=0;e<r/2;e++){let t=i[e],n=i[r-1-e],a=!t||!n;o.push({id:`r0-m${e}`,round:0,position:e,participant1:t,participant2:n,status:a?`bye`:`pending`,winnerId:a?t?.id||n?.id:void 0})}a.push({name:s(0,n),matches:o});for(let e=1;e<n;e++){let t=a[e-1].matches,r=[];for(let n=0;n<t.length/2;n++)r.push({id:`r${e}-m${n}`,round:e,position:n,status:`pending`});a.push({name:s(e,n),matches:r})}return a},[]),[a,o]=n.useState(()=>e||(r?i(r):[])),[c,l]=n.useState([]),u=n.useCallback((e,t)=>{o(n=>{let r=null;for(let i of n){let n=i.matches.find(t=>t.id===e);if(!n)continue;let a={...n,...t};a.status===`completed`&&a.winnerId&&(r={nextRoundIdx:n.round+1,nextMatchIdx:Math.floor(n.position/2),isFirstSlot:n.position%2==0,winner:a.winnerId===n.participant1?.id?n.participant1:n.participant2});break}return n.map((n,i)=>({...n,matches:n.matches.map((n,a)=>n.id===e?{...n,...t}:r&&i===r.nextRoundIdx&&a===r.nextMatchIdx?{...n,[r.isFirstSlot?`participant1`:`participant2`]:r.winner}:n)}))})},[]),d=n.useCallback(e=>{u(e,{status:`in_progress`})},[u]),f=n.useCallback((e,t,n)=>{o(r=>{let i=r.flatMap(e=>e.matches).find(t=>t.id===e);if(!i)return r;let a=t>n?i.participant1?.id:i.participant2?.id;return r.map(r=>({...r,matches:r.matches.map(r=>r.id===e?{...r,score1:t,score2:n,winnerId:a,status:`completed`}:r)}))}),setTimeout(()=>{let r=a.flatMap(e=>e.matches).find(t=>t.id===e);if(!r)return;let i=(t>n?r.participant1?.id:r.participant2?.id)===r.participant1?.id?r.participant1:r.participant2;if(!i)return;let s=r.round+1,c=Math.floor(r.position/2),l=r.position%2==0;o(e=>e.map((e,t)=>t===s?{...e,matches:e.matches.map((e,t)=>t===c?{...e,[l?`participant1`:`participant2`]:i}:e)}:e))},0)},[a]),p=n.useCallback(e=>{e?o(i(e)):r&&o(i(r))},[i,r]),m=n.useMemo(()=>{for(let e of a){let t=e.matches.find(e=>e.status===`in_progress`);if(t)return t}for(let e of a){let t=e.matches.find(e=>e.status===`pending`&&e.participant1&&e.participant2);if(t)return t}return null},[a]),h=n.useMemo(()=>{if(a.length===0)return null;let e=a[a.length-1]?.matches[0];return!e||e.status!==`completed`?null:e.winnerId===e.participant1?.id?e.participant1:e.participant2},[a]),g=n.useMemo(()=>a.flatMap(e=>e.matches),[a]);return{rounds:a,losersRounds:c,setRounds:o,setLosersRounds:l,updateMatch:u,startMatch:d,completeMatch:f,resetBracket:p,currentMatch:m,winner:h,allMatches:g,getMatch:n.useCallback(e=>g.find(t=>t.id===e),[g]),generateBracket:i,type:t}}exports.default=h,exports.useTournamentBracket=g;
|
|
20
|
+
`})]})}function g({initialRounds:e,type:t=`single_elimination`,participants:r}={}){let i=n.useCallback(e=>{let t=e.length,n=Math.ceil(Math.log2(t)),r=2**n,i=[...e];for(;i.length<r;)i.push(void 0);i.forEach((e,t)=>{e&&(e.seed=t+1)});let a=[],o=[];for(let e=0;e<r/2;e++){let t=i[e],n=i[r-1-e],a=!t||!n;o.push({id:`r0-m${e}`,round:0,position:e,participant1:t,participant2:n,status:a?`bye`:`pending`,winnerId:a?t?.id||n?.id:void 0})}a.push({name:s(0,n),matches:o});for(let e=1;e<n;e++){let t=a[e-1].matches,r=[];for(let n=0;n<t.length/2;n++)r.push({id:`r${e}-m${n}`,round:e,position:n,status:`pending`});a.push({name:s(e,n),matches:r})}return a},[]),[a,o]=n.useState(()=>e||(r?i(r):[])),[c,l]=n.useState([]),u=n.useCallback((e,t)=>{o(n=>{let r=null;for(let i of n){let n=i.matches.find(t=>t.id===e);if(!n)continue;let a={...n,...t};a.status===`completed`&&a.winnerId&&(r={nextRoundIdx:n.round+1,nextMatchIdx:Math.floor(n.position/2),isFirstSlot:n.position%2==0,winner:a.winnerId===n.participant1?.id?n.participant1:n.participant2});break}return n.map((n,i)=>({...n,matches:n.matches.map((n,a)=>n.id===e?{...n,...t}:r&&i===r.nextRoundIdx&&a===r.nextMatchIdx?{...n,[r.isFirstSlot?`participant1`:`participant2`]:r.winner}:n)}))})},[]),d=n.useCallback(e=>{u(e,{status:`in_progress`})},[u]),f=n.useCallback((e,t,n)=>{o(r=>{let i=r.flatMap(e=>e.matches).find(t=>t.id===e);if(!i)return r;let a=t>n?i.participant1?.id:i.participant2?.id;return r.map(r=>({...r,matches:r.matches.map(r=>r.id===e?{...r,score1:t,score2:n,winnerId:a,status:`completed`}:r)}))}),setTimeout(()=>{let r=a.flatMap(e=>e.matches).find(t=>t.id===e);if(!r)return;let i=(t>n?r.participant1?.id:r.participant2?.id)===r.participant1?.id?r.participant1:r.participant2;if(!i)return;let s=r.round+1,c=Math.floor(r.position/2),l=r.position%2==0;o(e=>e.map((e,t)=>t===s?{...e,matches:e.matches.map((e,t)=>t===c?{...e,[l?`participant1`:`participant2`]:i}:e)}:e))},0)},[a]),p=n.useCallback(e=>{e?o(i(e)):r&&o(i(r))},[i,r]),m=n.useMemo(()=>{for(let e of a){let t=e.matches.find(e=>e.status===`in_progress`);if(t)return t}for(let e of a){let t=e.matches.find(e=>e.status===`pending`&&e.participant1&&e.participant2);if(t)return t}return null},[a]),h=n.useMemo(()=>{if(a.length===0)return null;let e=a[a.length-1]?.matches[0];return!e||e.status!==`completed`?null:e.winnerId===e.participant1?.id?e.participant1:e.participant2},[a]),g=n.useMemo(()=>a.flatMap(e=>e.matches),[a]);return{rounds:a,losersRounds:c,setRounds:o,setLosersRounds:l,updateMatch:u,startMatch:d,completeMatch:f,resetBracket:p,currentMatch:m,winner:h,allMatches:g,getMatch:n.useCallback(e=>g.find(t=>t.id===e),[g]),generateBracket:i,type:t}}exports.WakaTournamentBracket=h,exports.default=h,exports.useTournamentBracket=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../badge/index.cjs.js"),r=require("../button/index.cjs.js"),i=require("../scroll-area/index.cjs.js"),a=require("../tooltip/index.cjs.js");let o=require("react");o=e.__toESM(o);let s=require("lucide-react"),c=require("react/jsx-runtime");var l=[`bg-blue-500`,`bg-green-500`,`bg-purple-500`,`bg-orange-500`,`bg-pink-500`,`bg-cyan-500`,`bg-yellow-500`,`bg-red-500`];function u(e,t){return t.has(e)||t.set(e,l[t.size%l.length]),t.get(e)}function d({span:e,depth:n,totalDuration:r,minTime:i,serviceMap:o,isExpanded:l,onToggle:d,onSpanClick:f}){let p=e.children&&e.children.length>0,m=u(e.serviceName,o),h=(e.startTime-i)/r*100,g=Math.max(e.duration/r*100,.5),_={ok:(0,c.jsx)(s.CheckCircle2,{className:`h-4 w-4 text-green-500`}),error:(0,c.jsx)(s.AlertCircle,{className:`h-4 w-4 text-red-500`}),unset:(0,c.jsx)(s.Clock,{className:`h-4 w-4 text-muted-foreground`})};return(0,c.jsx)(`div`,{className:`group`,children:(0,c.jsxs)(`div`,{className:t.cn(`flex items-center gap-2 px-2 py-1.5 hover:bg-muted/50 cursor-pointer border-b border-border/30`,e.status===`error`&&`bg-red-500/5`),onClick:()=>f?.(e),children:[(0,c.jsx)(`div`,{style:{width:n*20}}),(0,c.jsx)(`button`,{onClick:e=>{e.stopPropagation(),d()},className:`w-5 h-5 flex items-center justify-center`,disabled:!p,children:p?l?(0,c.jsx)(s.ChevronDown,{className:`h-4 w-4`}):(0,c.jsx)(s.ChevronRight,{className:`h-4 w-4`}):(0,c.jsx)(`span`,{className:`w-4`})}),(0,c.jsx)(`div`,{className:t.cn(`w-3 h-3 rounded-full shrink-0`,m)}),(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground w-24 truncate shrink-0`,children:e.serviceName}),(0,c.jsx)(`span`,{className:`text-sm font-medium truncate w-48 shrink-0`,children:e.operationName}),(0,c.jsx)(`div`,{className:`shrink-0`,children:_[e.status]}),(0,c.jsx)(`div`,{className:`flex-1 h-6 bg-muted/30 rounded relative min-w-[200px]`,children:(0,c.jsx)(a.TooltipProvider,{children:(0,c.jsxs)(a.Tooltip,{children:[(0,c.jsx)(a.TooltipTrigger,{asChild:!0,children:(0,c.jsx)(`div`,{className:t.cn(`absolute h-full rounded transition-all`,e.status===`error`?`bg-red-500`:m,`opacity-80 hover:opacity-100`),style:{left:`${h}%`,width:`${g}%`,minWidth:`4px`}})}),(0,c.jsx)(a.TooltipContent,{children:(0,c.jsxs)(`div`,{className:`text-xs space-y-1`,children:[(0,c.jsx)(`div`,{className:`font-semibold`,children:e.operationName}),(0,c.jsxs)(`div`,{children:[`Service: `,e.serviceName]}),(0,c.jsxs)(`div`,{children:[`Duration: `,e.duration.toFixed(2),`ms`]}),(0,c.jsxs)(`div`,{children:[`Start: +`,(e.startTime-i).toFixed(2),`ms`]})]})})]})})}),(0,c.jsxs)(`span`,{className:`text-xs text-muted-foreground w-20 text-right shrink-0`,children:[e.duration.toFixed(2),`ms`]})]})})}function f({spans:e,depth:t,totalDuration:n,minTime:r,serviceMap:i,expandedIds:a,onToggle:s,onSpanClick:l}){return(0,c.jsx)(c.Fragment,{children:e.map(e=>{let u=a.has(e.id);return(0,c.jsxs)(o.Fragment,{children:[(0,c.jsx)(d,{span:e,depth:t,totalDuration:n,minTime:r,serviceMap:i,isExpanded:u,onToggle:()=>s(e.id),onSpanClick:l}),u&&e.children&&(0,c.jsx)(f,{spans:e.children,depth:t+1,totalDuration:n,minTime:r,serviceMap:i,expandedIds:a,onToggle:s,onSpanClick:l})]},e.id)})})}function p({spans:e,traceId:a,totalDuration:l,onSpanClick:d,onCopyTraceId:p,showServiceColors:m=!0,className:h}){let[g,_]=o.useState(new Set),v=o.useMemo(()=>new Map,[]),{minTime:y,totalDuration:b}=o.useMemo(()=>{let t=[],n=e=>{e.forEach(e=>{t.push(e),e.children&&n(e.children)})};if(n(e),t.length===0)return{minTime:0,totalDuration:1};let r=Math.min(...t.map(e=>e.startTime)),i=Math.max(...t.map(e=>e.startTime+e.duration));return{minTime:r,totalDuration:l||i-r||1}},[e,l]),x=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},S=()=>{let t=new Set,n=e=>{e.forEach(e=>{t.add(e.id),e.children&&n(e.children)})};n(e),_(t)},C=()=>{_(new Set)},w=o.useMemo(()=>{let t=new Set,n=e=>{e.forEach(e=>{t.add(e.serviceName),e.children&&n(e.children)})};return n(e),Array.from(t)},[e]),T=o.useMemo(()=>{let t=0,n=e=>{e.forEach(e=>{t++,e.children&&n(e.children)})};return n(e),t},[e]);return(0,c.jsxs)(`div`,{className:t.cn(`flex flex-col border rounded-lg bg-background`,h),children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-3 border-b`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,c.jsx)(`h3`,{className:`font-semibold`,children:`Trace`}),a&&(0,c.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,c.jsxs)(`code`,{className:`text-xs bg-muted px-2 py-0.5 rounded font-mono`,children:[a.slice(0,16),`...`]}),(0,c.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:()=>p?.(a),children:(0,c.jsx)(s.Copy,{className:`h-3 w-3`})})]}),(0,c.jsxs)(n.Badge,{variant:`secondary`,children:[T,` spans`]}),(0,c.jsxs)(n.Badge,{variant:`outline`,children:[b.toFixed(2),`ms`]})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,children:`Expand All`}),(0,c.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:C,children:`Collapse All`})]})]}),m&&w.length>0&&(0,c.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2 border-b bg-muted/30 flex-wrap`,children:[(0,c.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Services:`}),w.map(e=>(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,c.jsx)(`div`,{className:t.cn(`w-2.5 h-2.5 rounded-full`,u(e,v))}),(0,c.jsx)(`span`,{className:`text-xs`,children:e})]},e))]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 border-b bg-muted/20 text-xs text-muted-foreground`,children:[(0,c.jsx)(`div`,{className:`w-5`}),(0,c.jsx)(`div`,{className:`w-5`}),(0,c.jsx)(`div`,{className:`w-3`}),(0,c.jsx)(`div`,{className:`w-24`,children:`Service`}),(0,c.jsx)(`div`,{className:`w-48`,children:`Operation`}),(0,c.jsx)(`div`,{className:`w-4`}),(0,c.jsxs)(`div`,{className:`flex-1 flex justify-between min-w-[200px]`,children:[(0,c.jsx)(`span`,{children:`0ms`}),(0,c.jsxs)(`span`,{children:[(b/2).toFixed(0),`ms`]}),(0,c.jsxs)(`span`,{children:[b.toFixed(0),`ms`]})]}),(0,c.jsx)(`div`,{className:`w-20 text-right`,children:`Duration`})]}),(0,c.jsx)(i.ScrollArea,{className:`flex-1`,children:e.length===0?(0,c.jsx)(`div`,{className:`flex items-center justify-center h-32 text-muted-foreground`,children:`No spans to display`}):(0,c.jsx)(f,{spans:e,depth:0,totalDuration:b,minTime:y,serviceMap:v,expandedIds:g,onToggle:x,onSpanClick:d})})]})}var m=[{id:`span-1`,traceId:`abc123def456`,operationName:`HTTP GET /api/users`,serviceName:`api-gateway`,startTime:0,duration:245,status:`ok`,children:[{id:`span-2`,traceId:`abc123def456`,parentId:`span-1`,operationName:`authenticate`,serviceName:`auth-service`,startTime:5,duration:35,status:`ok`},{id:`span-3`,traceId:`abc123def456`,parentId:`span-1`,operationName:`SELECT * FROM users`,serviceName:`user-service`,startTime:45,duration:120,status:`ok`,children:[{id:`span-4`,traceId:`abc123def456`,parentId:`span-3`,operationName:`PostgreSQL Query`,serviceName:`postgres`,startTime:50,duration:95,status:`ok`}]},{id:`span-5`,traceId:`abc123def456`,parentId:`span-1`,operationName:`cache.get`,serviceName:`redis`,startTime:170,duration:8,status:`ok`},{id:`span-6`,traceId:`abc123def456`,parentId:`span-1`,operationName:`serialize response`,serviceName:`api-gateway`,startTime:185,duration:55,status:`ok`}]}];exports.WakaTraceViewer=p,exports.defaultTraceSpans=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js"),n=require("../checkbox/index.cjs.js");let r=require("react");r=e.__toESM(r);let i=require("lucide-react"),a=require("react/jsx-runtime");var o=r.createContext(null);function s(){let e=r.useContext(o);if(!e)throw Error(`useTreeContext must be used within a WakaTree`);return e}function c(e){let t=[];function n(e){for(let r of e)t.push(r.id),r.children&&n(r.children)}return n(e),t}function l({node:e,level:r}){let{selectedIds:o,selectionMode:c,showCheckboxes:u,showIcons:d,draggable:f,size:p,toggleSelect:m,toggleExpand:h,isSelected:g,isExpanded:_,onDragStart:v,onDragOver:y,onDragLeave:b,onDrop:x,dragOverId:S,dragPosition:C}=s(),w=e.children&&e.children.length>0,T=_(e.id),E=g(e.id),D={sm:`py-0.5 text-xs`,md:`py-1 text-sm`,lg:`py-1.5 text-base`},O={sm:`h-3 w-3`,md:`h-4 w-4`,lg:`h-5 w-5`},k=r*(p===`sm`?12:p===`md`?16:20),A=t=>{t.stopPropagation(),c!==`none`&&e.selectable!==!1&&!e.disabled&&m(e.id)},j=t=>{t.stopPropagation(),h(e.id)},M=t=>{f&&v(t,e.id)},N=t=>{f&&(t.preventDefault(),y(t,e.id))},P=e=>{f&&b(e)},F=t=>{if(!f)return;t.preventDefault();let n=t.currentTarget.getBoundingClientRect(),r=t.clientY-n.top,i=n.height,a=`inside`;r<i*.25?a=`before`:r>i*.75&&(a=`after`),x(t,e.id,a)},I=()=>e.icon?e.icon:d?w?T?(0,a.jsx)(i.FolderOpen,{className:t.cn(O[p],`text-amber-500`)}):(0,a.jsx)(i.Folder,{className:t.cn(O[p],`text-amber-500`)}):(0,a.jsx)(i.File,{className:t.cn(O[p],`text-muted-foreground`)}):null,L=S===e.id;return(0,a.jsxs)(`li`,{role:`treeitem`,"aria-expanded":w?T:void 0,"aria-selected":E,children:[(0,a.jsxs)(`div`,{className:t.cn(`flex items-center gap-1 rounded-md cursor-pointer transition-colors group`,D[p],E&&`bg-primary/10 text-primary`,!E&&`hover:bg-muted`,e.disabled&&`opacity-50 cursor-not-allowed`,L&&C===`before`&&`border-t-2 border-primary`,L&&C===`after`&&`border-b-2 border-primary`,L&&C===`inside`&&`bg-primary/20`),style:{paddingLeft:k},onClick:A,draggable:f&&!e.disabled,onDragStart:M,onDragOver:N,onDragLeave:P,onDrop:F,children:[f&&(0,a.jsx)(i.GripVertical,{className:t.cn(O[p],`text-muted-foreground opacity-0 group-hover:opacity-100 cursor-grab`)}),(0,a.jsx)(`button`,{type:`button`,onClick:j,className:t.cn(`flex items-center justify-center rounded hover:bg-muted-foreground/10`,!w&&`invisible`),tabIndex:-1,children:T?(0,a.jsx)(i.ChevronDown,{className:O[p]}):(0,a.jsx)(i.ChevronRight,{className:O[p]})}),u&&c!==`none`&&(0,a.jsx)(n.Checkbox,{checked:E,onCheckedChange:()=>m(e.id),disabled:e.disabled||e.selectable===!1,className:p===`sm`?`h-3 w-3`:p===`lg`?`h-5 w-5`:`h-4 w-4`}),I(),(0,a.jsx)(`span`,{className:`truncate flex-1`,children:e.label})]}),w&&T&&(0,a.jsx)(`ul`,{role:`group`,className:`list-none`,children:e.children.map(e=>(0,a.jsx)(l,{node:e,level:r+1},e.id))})]})}function u({data:e,selectedIds:n,onSelect:i,expandedIds:s,onExpand:u,selectionMode:d=`single`,showCheckboxes:f=!1,showIcons:p=!0,draggable:m=!1,onDrop:h,size:g=`md`,className:_,defaultExpandAll:v=!1}){let[y,b]=r.useState([]),[x,S]=r.useState(()=>v?c(e):[]),[C,w]=r.useState(null),[T,E]=r.useState(null),[D,O]=r.useState(null),k=n??y,A=s??x,j={selectedIds:k,expandedIds:A,selectionMode:d,showCheckboxes:f,showIcons:p,draggable:m,size:g,toggleSelect:r.useCallback(e=>{let t;t=d===`single`?k.includes(e)?[]:[e]:k.includes(e)?k.filter(t=>t!==e):[...k,e],i?i(t):b(t)},[k,d,i]),toggleExpand:r.useCallback(e=>{let t=A.includes(e)?A.filter(t=>t!==e):[...A,e];u?u(t):S(t)},[A,u]),isSelected:r.useCallback(e=>k.includes(e),[k]),isExpanded:r.useCallback(e=>A.includes(e),[A]),onDragStart:r.useCallback((e,t)=>{w(t),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t)},[]),onDragOver:r.useCallback((e,t)=>{if(C===t)return;let n=e.currentTarget.getBoundingClientRect(),r=e.clientY-n.top,i=n.height,a=`inside`;r<i*.25?a=`before`:r>i*.75&&(a=`after`),E(t),O(a)},[C]),onDragLeave:r.useCallback(()=>{E(null),O(null)},[]),onDrop:r.useCallback((e,t,n)=>{e.preventDefault(),C&&C!==t&&h&&h(C,t,n),w(null),E(null),O(null)},[C,h]),dragOverId:T,dragPosition:D};return(0,a.jsx)(o.Provider,{value:j,children:(0,a.jsx)(`ul`,{role:`tree`,"aria-multiselectable":d===`multiple`,className:t.cn(`list-none`,_),children:e.map(e=>(0,a.jsx)(l,{node:e,level:0},e.id))})})}function d(e,t){for(let n of e){if(n.id===t)return n;if(n.children){let e=d(n.children,t);if(e)return e}}return null}function f(e,t,n){return e.map(e=>e.id===t?{...e,...n}:e.children?{...e,children:f(e.children,t,n)}:e)}function p(e,t){return e.filter(e=>e.id!==t).map(e=>e.children?{...e,children:p(e.children,t)}:e)}function m(e,t,n){return e.map(e=>e.id===t?{...e,children:[...e.children||[],n]}:e.children?{...e,children:m(e.children,t,n)}:e)}function h(e,t,n,r){let i=d(e,t);if(!i)return e;let a=p(e,t);if(r===`inside`)a=m(a,n,i);else{let e=t=>{let a=[];for(let o of t)o.id===n?r===`before`?(a.push(i),a.push(o)):(a.push(o),a.push(i)):a.push({...o,children:o.children?e(o.children):void 0});return a};a=e(a)}return a}exports.WakaTree=u,exports.default=u,exports.addChildNode=m,exports.findNodeById=d,exports.moveNode=h,exports.removeNode=p,exports.updateNode=f;
|
|
@@ -194,4 +194,4 @@ function b(e, t, n, r) {
|
|
|
194
194
|
return a;
|
|
195
195
|
}
|
|
196
196
|
//#endregion
|
|
197
|
-
export {
|
|
197
|
+
export { h as WakaTree, h as default, y as addChildNode, g as findNodeById, b as moveNode, v as removeNode, _ as updateNode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs.js`),t=require(`../../utils/cn.cjs.js`);let n=require(`react`);n=e.__toESM(n);let r=require(`lucide-react`),i=require(`react/jsx-runtime`);var a={default:[`#3b82f6`,`#ef4444`,`#22c55e`,`#f59e0b`,`#8b5cf6`,`#ec4899`,`#14b8a6`,`#f97316`,`#6366f1`,`#84cc16`],cool:[`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#6366f1`,`#0ea5e9`,`#a855f7`,`#14b8a6`,`#22d3ee`,`#7c3aed`,`#2dd4bf`],warm:[`#f97316`,`#ef4444`,`#f59e0b`,`#ec4899`,`#f43f5e`,`#fb923c`,`#fbbf24`,`#e11d48`,`#dc2626`,`#ea580c`],neon:[`#00ff87`,`#00d4ff`,`#ff00ff`,`#ffff00`,`#ff6b35`,`#00ffff`,`#ff1493`,`#7fff00`,`#ff00aa`,`#00ff00`],pastel:[`#a5b4fc`,`#fca5a5`,`#86efac`,`#fcd34d`,`#c4b5fd`,`#f9a8d4`,`#5eead4`,`#fdba74`,`#93c5fd`,`#bef264`]};function o(e){let{width:t,height:r,padding:i=2,innerPadding:o=4,aspectRatio:s=1}=e,[c,l]=n.useState([]),u=n.useCallback(e=>e.reduce((e,t)=>t.children&&t.children.length>0?e+u(t.children):e+t.value,0),[]),d=n.useCallback((e,t)=>{for(let n of e){if(n.id===t)return n;if(n.children){let e=d(n.children,t);if(e)return e}}return null},[]),f=n.useCallback((e,t,n=[])=>{for(let r of e){if(r.id===t)return[...n,r];if(r.children){let e=f(r.children,t,[...n,r]);if(e.length>0)return e}}return[]},[]),p=n.useCallback((e,t,n,r,a,s,c,l,d,f,m,h)=>{if(e.length===0||r<=0||a<=0)return[];let g=[],_=[...e],v=t,y=n,b=r,x=a,S=(e,t)=>{if(e.color)return e.color;if(f===`value`){let t=h>0?e.value/h:0;return`hsl(${200-t*150}, 70%, ${50+(1-t)*20}%)`}if(e.category){if(!m.has(e.category)){let t=m.size%d.length;m.set(e.category,d[t])}return m.get(e.category)}return d[t%d.length]},C=(e,t,n)=>{if(e.length===0)return 1/0;let i=e.reduce((e,t)=>e+t.value/s*(r*a),0),o=Math.min(...e.map(e=>e.value/s*(r*a))),c=Math.max(...e.map(e=>e.value/s*(r*a)));return Math.max(n*n*c/(i*i),i*i/(n*n*o))},w=(e,t,n,_,v,y)=>{let b=s>0?e.reduce((e,t)=>e+t.value/s*(r*a),0):0,x=_>0?b/_:0,C=0;e.forEach((e,_)=>{let b=s>0?e.value/s*(r*a):0,w=x>0?b/x:0,T=v?t:t+C,E=v?n+C:n,D=v?x:w,O=v?w:x,k=T+i,A=E+i,j=Math.max(0,D-i*2),M=Math.max(0,O-i*2),N=S(e,y+_);if(g.push({...e,x:k,y:A,width:j,height:M,depth:c,parentId:l,computedColor:N}),e.children&&e.children.length>0&&j>o*2&&M>o*2){let t=u(e.children),n=p(e.children,k+o,A+o,j-o*2,M-o*2,t,c+1,e.id,d,f,m,h);g.push(...n)}C+=w})},T=[],E=0;for(;_.length>0;){let e=b>=x,t=e?x:b,n=_[0],r=C([...T,n],t,t),i=C(T,t,t);if(T.length===0||r<=i)T.push(_.shift());else{let n=T.reduce((e,t)=>e+t.value/s*(b*x),0)/t;w(T,v,y,t,e,E),E+=T.length,e?(v+=n,b-=n):(y+=n,x-=n),T.length=0}}if(T.length>0){let e=b>=x;w(T,v,y,e?x:b,e,E)}return g},[i,o,u]);return{layoutNodes:c,computeLayout:n.useCallback((e,n=null,i=a.default,o=`category`)=>{let s=e;if(n){let t=d(e,n);t?.children&&(s=t.children)}if(s.length===0)return l([]),[];let c=[...s].sort((e,t)=>{let n=e.children?u(e.children):e.value;return(t.children?u(t.children):t.value)-n}),f=u(c),m=Math.max(...c.map(e=>e.children?u(e.children):e.value)),h=p(c,0,0,t,r,f,0,n||void 0,i,o,new Map,m);return l(h),h},[t,r,p,d,u]),getTotalValue:u,findNode:d,getPathToNode:f}}function s({node:e,x:n,y:r,showValues:a}){return(0,i.jsxs)(`div`,{className:t.cn(`absolute z-50 px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-popover text-popover-foreground border`,`pointer-events-none whitespace-nowrap`,`animate-in fade-in-0 zoom-in-95 duration-100`),style:{left:n,top:r,transform:`translate(-50%, -100%)`,marginTop:-8},children:[(0,i.jsx)(`div`,{className:`font-semibold`,children:e.label}),e.category&&(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.category}),a&&(0,i.jsxs)(`div`,{className:`text-xs mt-1`,children:[`Value: `,(0,i.jsx)(`span`,{className:`font-medium`,children:e.value.toLocaleString()})]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2 h-2 rotate-45 -translate-x-1/2 translate-y-1/2 bg-popover border-r border-b`})]})}function c({items:e,position:n,onItemClick:r,highlightedCategory:a}){return(0,i.jsx)(`div`,{className:t.cn(`flex gap-2`,n===`right`&&`flex-col`,n===`bottom`&&`flex-wrap justify-center`),children:e.map(e=>(0,i.jsxs)(`button`,{className:t.cn(`flex items-center gap-2 px-2 py-1 text-sm rounded transition-all duration-200`,`hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary`,a===e.label&&`bg-muted ring-2 ring-primary`),onClick:()=>r?.(e.label),children:[(0,i.jsx)(`span`,{className:`w-3 h-3 rounded-sm flex-shrink-0`,style:{backgroundColor:e.color}}),(0,i.jsx)(`span`,{className:`text-muted-foreground truncate max-w-[100px]`,children:e.label})]},e.label))})}function l({path:e,onNavigate:a}){return(0,i.jsxs)(`nav`,{className:`flex items-center gap-1 text-sm overflow-x-auto pb-2`,children:[(0,i.jsxs)(`button`,{className:t.cn(`flex items-center gap-1 px-2 py-1 rounded transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted`,e.length===0&&`text-foreground font-medium`),onClick:()=>a(null),children:[(0,i.jsx)(r.Home,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:`Root`})]}),e.map((o,s)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(r.ChevronRight,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,i.jsx)(`button`,{className:t.cn(`px-2 py-1 rounded transition-colors truncate max-w-[120px]`,`text-muted-foreground hover:text-foreground hover:bg-muted`,s===e.length-1&&`text-foreground font-medium`),onClick:()=>a(o.id),children:o.label})]},o.id))]})}function u({onZoomIn:e,onZoomOut:t,onZoomToFit:n,showZoomToFit:a,zoom:o}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-1 bg-background/80 backdrop-blur-sm rounded-lg border p-1`,children:[(0,i.jsx)(`button`,{className:`p-1.5 rounded hover:bg-muted transition-colors disabled:opacity-50`,onClick:t,disabled:o<=.5,"aria-label":`Zoom out`,children:(0,i.jsx)(r.ZoomOut,{className:`h-4 w-4`})}),(0,i.jsxs)(`span`,{className:`text-xs font-medium min-w-[40px] text-center`,children:[Math.round(o*100),`%`]}),(0,i.jsx)(`button`,{className:`p-1.5 rounded hover:bg-muted transition-colors disabled:opacity-50`,onClick:e,disabled:o>=3,"aria-label":`Zoom in`,children:(0,i.jsx)(r.ZoomIn,{className:`h-4 w-4`})}),a&&(0,i.jsx)(`button`,{className:`p-1.5 rounded hover:bg-muted transition-colors`,onClick:n,"aria-label":`Zoom to fit`,children:(0,i.jsx)(r.Maximize2,{className:`h-4 w-4`})})]})}function d({node:e,isHovered:n,isHighlighted:r,showLabel:a,showValue:o,minLabelSize:s,animationDuration:c,onClick:l,onMouseEnter:u,onMouseLeave:d}){let f=e.width>=s&&e.height>=s/2,p=e.children&&e.children.length>0,m=Math.min(Math.max(10,e.width/10),Math.max(10,e.height/3),14),h=(e=>{let t=e.replace(`#`,``),n,r,i;return t.length===3?(n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16)):(n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)),isNaN(n)||isNaN(r)||isNaN(i)||(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`})(e.computedColor);return(0,i.jsxs)(`g`,{className:t.cn(`cursor-pointer`,`transition-all`,p&&`hover:opacity-90`),style:{transitionDuration:`${c}ms`},onClick:l,onMouseEnter:u,onMouseLeave:d,children:[(0,i.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,fill:e.computedColor,stroke:n||r?`#ffffff`:`rgba(255,255,255,0.3)`,strokeWidth:n||r?2:1,rx:2,className:`transition-all`,style:{transitionDuration:`${c}ms`,filter:n?`brightness(1.1)`:r?`brightness(1.05)`:`brightness(1)`,opacity:r===!1?.5:1}}),a&&f&&(0,i.jsx)(`foreignObject`,{x:e.x+4,y:e.y+4,width:e.width-8,height:e.height-8,className:`pointer-events-none overflow-hidden`,children:(0,i.jsxs)(`div`,{className:`flex flex-col justify-center h-full`,style:{color:h,fontSize:`${m}px`},children:[(0,i.jsx)(`span`,{className:`font-medium truncate leading-tight`,children:e.label}),o&&e.height>s*.75&&(0,i.jsx)(`span`,{className:`text-xs opacity-80 truncate`,children:e.value.toLocaleString()})]})})]})}function f({data:e,width:r=600,height:f=400,padding:p=2,innerPadding:m=4,colorScheme:h=`default`,colors:g,colorBy:_=`category`,showLabels:v=!0,minLabelSize:y=50,showValues:b=!0,showTooltip:x=!0,showLegend:S=!0,legendPosition:C=`right`,enableDrillDown:w=!0,showBreadcrumb:T=!0,showZoomControls:E=!1,enableZoomToFit:D=!0,animationDuration:O=300,aspectRatio:k=1,className:A,onNodeClick:j,onNodeHover:M,onNavigate:N}){let P=n.useRef(null),[F,I]=n.useState(null),[L,R]=n.useState(null),[z,B]=n.useState(null),[V,H]=n.useState([]),[U,W]=n.useState(1),[G,K]=n.useState(null),q=g||a[h]||a.default,{layoutNodes:J,computeLayout:Y,findNode:ee,getPathToNode:X,getTotalValue:te}=o({width:r,height:f,padding:p,innerPadding:m,aspectRatio:k});n.useEffect(()=>{Y(e,z,q,_)},[e,z,q,_,Y]);let Z=n.useMemo(()=>z?J.filter(e=>e.parentId===z&&e.depth===0):J.filter(e=>e.depth===0),[J,z]),Q=n.useMemo(()=>{let e=new Map;return Z.forEach(t=>{let n=t.category||t.label;e.has(n)||e.set(n,t.computedColor)}),Array.from(e.entries()).map(([e,t])=>({label:e,color:t}))},[Z]),$=t=>{if(j?.(t),w&&t.children&&t.children.length>0){B(t.id);let n=X(e,t.id);H(n),N?.(n)}},ne=t=>{if(B(t),t===null)H([]),N?.([]);else{let n=X(e,t).slice(0,-1);H(n),N?.(n)}},re=(e,t)=>{if(I(e),M?.(e),x&&P.current){P.current.getBoundingClientRect();let t=e.x+e.width/2,n=e.y;R({x:t*U,y:n*U})}},ie=()=>{I(null),R(null),M?.(null)};return(0,i.jsxs)(`div`,{className:t.cn(`flex gap-4`,C===`bottom`&&`flex-col`,A),children:[(0,i.jsxs)(`div`,{className:`flex flex-col gap-2 flex-1`,children:[T&&w&&(0,i.jsx)(l,{path:V,onNavigate:ne}),(0,i.jsxs)(`div`,{ref:P,className:`relative overflow-hidden rounded-lg border bg-muted/20`,children:[E&&(0,i.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,i.jsx)(u,{zoom:U,onZoomIn:()=>W(e=>Math.min(e+.25,3)),onZoomOut:()=>W(e=>Math.max(e-.25,.5)),onZoomToFit:()=>W(1),showZoomToFit:D})}),(0,i.jsxs)(`svg`,{width:r*U,height:f*U,viewBox:`0 0 ${r} ${f}`,className:`transition-all duration-300`,style:{transformOrigin:`top left`},children:[(0,i.jsx)(`rect`,{x:0,y:0,width:r,height:f,fill:`transparent`}),Z.map(e=>{let t=G===null?void 0:(e.category||e.label)===G;return(0,i.jsx)(d,{node:e,isHovered:F?.id===e.id,isHighlighted:t!==!1,showLabel:v,showValue:b,minLabelSize:y,animationDuration:O,onClick:()=>$(e),onMouseEnter:t=>re(e,t),onMouseLeave:ie},e.id)})]}),x&&F&&L&&(0,i.jsx)(s,{node:F,x:L.x,y:L.y,showValues:b})]})]}),S&&Q.length>0&&(0,i.jsx)(`div`,{className:t.cn(C===`right`&&`min-w-[120px]`,C===`bottom`&&`w-full`),children:(0,i.jsx)(c,{items:Q,position:C,onItemClick:e=>{K(t=>t===e?null:e)},highlightedCategory:G})})]})}exports.default=f,exports.useTreemapChart=o;
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a={default:[`#3b82f6`,`#ef4444`,`#22c55e`,`#f59e0b`,`#8b5cf6`,`#ec4899`,`#14b8a6`,`#f97316`,`#6366f1`,`#84cc16`],cool:[`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#6366f1`,`#0ea5e9`,`#a855f7`,`#14b8a6`,`#22d3ee`,`#7c3aed`,`#2dd4bf`],warm:[`#f97316`,`#ef4444`,`#f59e0b`,`#ec4899`,`#f43f5e`,`#fb923c`,`#fbbf24`,`#e11d48`,`#dc2626`,`#ea580c`],neon:[`#00ff87`,`#00d4ff`,`#ff00ff`,`#ffff00`,`#ff6b35`,`#00ffff`,`#ff1493`,`#7fff00`,`#ff00aa`,`#00ff00`],pastel:[`#a5b4fc`,`#fca5a5`,`#86efac`,`#fcd34d`,`#c4b5fd`,`#f9a8d4`,`#5eead4`,`#fdba74`,`#93c5fd`,`#bef264`]};function o(e){let{width:t,height:r,padding:i=2,innerPadding:o=4,aspectRatio:s=1}=e,[c,l]=n.useState([]),u=n.useCallback(e=>e.reduce((e,t)=>t.children&&t.children.length>0?e+u(t.children):e+t.value,0),[]),d=n.useCallback((e,t)=>{for(let n of e){if(n.id===t)return n;if(n.children){let e=d(n.children,t);if(e)return e}}return null},[]),f=n.useCallback((e,t,n=[])=>{for(let r of e){if(r.id===t)return[...n,r];if(r.children){let e=f(r.children,t,[...n,r]);if(e.length>0)return e}}return[]},[]),p=n.useCallback((e,t,n,r,a,s,c,l,d,f,m,h)=>{if(e.length===0||r<=0||a<=0)return[];let g=[],_=[...e],v=t,y=n,b=r,x=a,S=(e,t)=>{if(e.color)return e.color;if(f===`value`){let t=h>0?e.value/h:0;return`hsl(${200-t*150}, 70%, ${50+(1-t)*20}%)`}if(e.category){if(!m.has(e.category)){let t=m.size%d.length;m.set(e.category,d[t])}return m.get(e.category)}return d[t%d.length]},C=(e,t,n)=>{if(e.length===0)return 1/0;let i=e.reduce((e,t)=>e+t.value/s*(r*a),0),o=Math.min(...e.map(e=>e.value/s*(r*a))),c=Math.max(...e.map(e=>e.value/s*(r*a)));return Math.max(n*n*c/(i*i),i*i/(n*n*o))},w=(e,t,n,_,v,y)=>{let b=s>0?e.reduce((e,t)=>e+t.value/s*(r*a),0):0,x=_>0?b/_:0,C=0;e.forEach((e,_)=>{let b=s>0?e.value/s*(r*a):0,w=x>0?b/x:0,T=v?t:t+C,E=v?n+C:n,D=v?x:w,O=v?w:x,k=T+i,A=E+i,j=Math.max(0,D-i*2),M=Math.max(0,O-i*2),N=S(e,y+_);if(g.push({...e,x:k,y:A,width:j,height:M,depth:c,parentId:l,computedColor:N}),e.children&&e.children.length>0&&j>o*2&&M>o*2){let t=u(e.children),n=p(e.children,k+o,A+o,j-o*2,M-o*2,t,c+1,e.id,d,f,m,h);g.push(...n)}C+=w})},T=[],E=0;for(;_.length>0;){let e=b>=x,t=e?x:b,n=_[0],r=C([...T,n],t,t),i=C(T,t,t);if(T.length===0||r<=i)T.push(_.shift());else{let n=T.reduce((e,t)=>e+t.value/s*(b*x),0)/t;w(T,v,y,t,e,E),E+=T.length,e?(v+=n,b-=n):(y+=n,x-=n),T.length=0}}if(T.length>0){let e=b>=x;w(T,v,y,e?x:b,e,E)}return g},[i,o,u]);return{layoutNodes:c,computeLayout:n.useCallback((e,n=null,i=a.default,o=`category`)=>{let s=e;if(n){let t=d(e,n);t?.children&&(s=t.children)}if(s.length===0)return l([]),[];let c=[...s].sort((e,t)=>{let n=e.children?u(e.children):e.value;return(t.children?u(t.children):t.value)-n}),f=u(c),m=Math.max(...c.map(e=>e.children?u(e.children):e.value)),h=p(c,0,0,t,r,f,0,n||void 0,i,o,new Map,m);return l(h),h},[t,r,p,d,u]),getTotalValue:u,findNode:d,getPathToNode:f}}function s({node:e,x:n,y:r,showValues:a}){return(0,i.jsxs)(`div`,{className:t.cn(`absolute z-50 px-3 py-2 text-sm rounded-lg shadow-lg`,`bg-popover text-popover-foreground border`,`pointer-events-none whitespace-nowrap`,`animate-in fade-in-0 zoom-in-95 duration-100`),style:{left:n,top:r,transform:`translate(-50%, -100%)`,marginTop:-8},children:[(0,i.jsx)(`div`,{className:`font-semibold`,children:e.label}),e.category&&(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e.category}),a&&(0,i.jsxs)(`div`,{className:`text-xs mt-1`,children:[`Value: `,(0,i.jsx)(`span`,{className:`font-medium`,children:e.value.toLocaleString()})]}),(0,i.jsx)(`div`,{className:`absolute left-1/2 bottom-0 w-2 h-2 rotate-45 -translate-x-1/2 translate-y-1/2 bg-popover border-r border-b`})]})}function c({items:e,position:n,onItemClick:r,highlightedCategory:a}){return(0,i.jsx)(`div`,{className:t.cn(`flex gap-2`,n===`right`&&`flex-col`,n===`bottom`&&`flex-wrap justify-center`),children:e.map(e=>(0,i.jsxs)(`button`,{className:t.cn(`flex items-center gap-2 px-2 py-1 text-sm rounded transition-all duration-200`,`hover:bg-muted focus:outline-none focus:ring-2 focus:ring-primary`,a===e.label&&`bg-muted ring-2 ring-primary`),onClick:()=>r?.(e.label),children:[(0,i.jsx)(`span`,{className:`w-3 h-3 rounded-sm flex-shrink-0`,style:{backgroundColor:e.color}}),(0,i.jsx)(`span`,{className:`text-muted-foreground truncate max-w-[100px]`,children:e.label})]},e.label))})}function l({path:e,onNavigate:a}){return(0,i.jsxs)(`nav`,{className:`flex items-center gap-1 text-sm overflow-x-auto pb-2`,children:[(0,i.jsxs)(`button`,{className:t.cn(`flex items-center gap-1 px-2 py-1 rounded transition-colors`,`text-muted-foreground hover:text-foreground hover:bg-muted`,e.length===0&&`text-foreground font-medium`),onClick:()=>a(null),children:[(0,i.jsx)(r.Home,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:`Root`})]}),e.map((o,s)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)(r.ChevronRight,{className:`h-4 w-4 text-muted-foreground flex-shrink-0`}),(0,i.jsx)(`button`,{className:t.cn(`px-2 py-1 rounded transition-colors truncate max-w-[120px]`,`text-muted-foreground hover:text-foreground hover:bg-muted`,s===e.length-1&&`text-foreground font-medium`),onClick:()=>a(o.id),children:o.label})]},o.id))]})}function u({onZoomIn:e,onZoomOut:t,onZoomToFit:n,showZoomToFit:a,zoom:o}){return(0,i.jsxs)(`div`,{className:`flex items-center gap-1 bg-background/80 backdrop-blur-sm rounded-lg border p-1`,children:[(0,i.jsx)(`button`,{className:`p-1.5 rounded hover:bg-muted transition-colors disabled:opacity-50`,onClick:t,disabled:o<=.5,"aria-label":`Zoom out`,children:(0,i.jsx)(r.ZoomOut,{className:`h-4 w-4`})}),(0,i.jsxs)(`span`,{className:`text-xs font-medium min-w-[40px] text-center`,children:[Math.round(o*100),`%`]}),(0,i.jsx)(`button`,{className:`p-1.5 rounded hover:bg-muted transition-colors disabled:opacity-50`,onClick:e,disabled:o>=3,"aria-label":`Zoom in`,children:(0,i.jsx)(r.ZoomIn,{className:`h-4 w-4`})}),a&&(0,i.jsx)(`button`,{className:`p-1.5 rounded hover:bg-muted transition-colors`,onClick:n,"aria-label":`Zoom to fit`,children:(0,i.jsx)(r.Maximize2,{className:`h-4 w-4`})})]})}function d({node:e,isHovered:n,isHighlighted:r,showLabel:a,showValue:o,minLabelSize:s,animationDuration:c,onClick:l,onMouseEnter:u,onMouseLeave:d}){let f=e.width>=s&&e.height>=s/2,p=e.children&&e.children.length>0,m=Math.min(Math.max(10,e.width/10),Math.max(10,e.height/3),14),h=(e=>{let t=e.replace(`#`,``),n,r,i;return t.length===3?(n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16)):(n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)),isNaN(n)||isNaN(r)||isNaN(i)||(.299*n+.587*r+.114*i)/255>.5?`#000000`:`#ffffff`})(e.computedColor);return(0,i.jsxs)(`g`,{className:t.cn(`cursor-pointer`,`transition-all`,p&&`hover:opacity-90`),style:{transitionDuration:`${c}ms`},onClick:l,onMouseEnter:u,onMouseLeave:d,children:[(0,i.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,fill:e.computedColor,stroke:n||r?`#ffffff`:`rgba(255,255,255,0.3)`,strokeWidth:n||r?2:1,rx:2,className:`transition-all`,style:{transitionDuration:`${c}ms`,filter:n?`brightness(1.1)`:r?`brightness(1.05)`:`brightness(1)`,opacity:r===!1?.5:1}}),a&&f&&(0,i.jsx)(`foreignObject`,{x:e.x+4,y:e.y+4,width:e.width-8,height:e.height-8,className:`pointer-events-none overflow-hidden`,children:(0,i.jsxs)(`div`,{className:`flex flex-col justify-center h-full`,style:{color:h,fontSize:`${m}px`},children:[(0,i.jsx)(`span`,{className:`font-medium truncate leading-tight`,children:e.label}),o&&e.height>s*.75&&(0,i.jsx)(`span`,{className:`text-xs opacity-80 truncate`,children:e.value.toLocaleString()})]})})]})}function f({data:e,width:r=600,height:f=400,padding:p=2,innerPadding:m=4,colorScheme:h=`default`,colors:g,colorBy:_=`category`,showLabels:v=!0,minLabelSize:y=50,showValues:b=!0,showTooltip:x=!0,showLegend:S=!0,legendPosition:C=`right`,enableDrillDown:w=!0,showBreadcrumb:T=!0,showZoomControls:E=!1,enableZoomToFit:D=!0,animationDuration:O=300,aspectRatio:k=1,className:A,onNodeClick:j,onNodeHover:M,onNavigate:N}){let P=n.useRef(null),[F,I]=n.useState(null),[L,R]=n.useState(null),[z,B]=n.useState(null),[V,H]=n.useState([]),[U,W]=n.useState(1),[G,K]=n.useState(null),q=g||a[h]||a.default,{layoutNodes:J,computeLayout:Y,findNode:ee,getPathToNode:X,getTotalValue:te}=o({width:r,height:f,padding:p,innerPadding:m,aspectRatio:k});n.useEffect(()=>{Y(e,z,q,_)},[e,z,q,_,Y]);let Z=n.useMemo(()=>z?J.filter(e=>e.parentId===z&&e.depth===0):J.filter(e=>e.depth===0),[J,z]),Q=n.useMemo(()=>{let e=new Map;return Z.forEach(t=>{let n=t.category||t.label;e.has(n)||e.set(n,t.computedColor)}),Array.from(e.entries()).map(([e,t])=>({label:e,color:t}))},[Z]),$=t=>{if(j?.(t),w&&t.children&&t.children.length>0){B(t.id);let n=X(e,t.id);H(n),N?.(n)}},ne=t=>{if(B(t),t===null)H([]),N?.([]);else{let n=X(e,t).slice(0,-1);H(n),N?.(n)}},re=(e,t)=>{if(I(e),M?.(e),x&&P.current){P.current.getBoundingClientRect();let t=e.x+e.width/2,n=e.y;R({x:t*U,y:n*U})}},ie=()=>{I(null),R(null),M?.(null)};return(0,i.jsxs)(`div`,{className:t.cn(`flex gap-4`,C===`bottom`&&`flex-col`,A),children:[(0,i.jsxs)(`div`,{className:`flex flex-col gap-2 flex-1`,children:[T&&w&&(0,i.jsx)(l,{path:V,onNavigate:ne}),(0,i.jsxs)(`div`,{ref:P,className:`relative overflow-hidden rounded-lg border bg-muted/20`,children:[E&&(0,i.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,i.jsx)(u,{zoom:U,onZoomIn:()=>W(e=>Math.min(e+.25,3)),onZoomOut:()=>W(e=>Math.max(e-.25,.5)),onZoomToFit:()=>W(1),showZoomToFit:D})}),(0,i.jsxs)(`svg`,{width:r*U,height:f*U,viewBox:`0 0 ${r} ${f}`,className:`transition-all duration-300`,style:{transformOrigin:`top left`},children:[(0,i.jsx)(`rect`,{x:0,y:0,width:r,height:f,fill:`transparent`}),Z.map(e=>{let t=G===null?void 0:(e.category||e.label)===G;return(0,i.jsx)(d,{node:e,isHovered:F?.id===e.id,isHighlighted:t!==!1,showLabel:v,showValue:b,minLabelSize:y,animationDuration:O,onClick:()=>$(e),onMouseEnter:t=>re(e,t),onMouseLeave:ie},e.id)})]}),x&&F&&L&&(0,i.jsx)(s,{node:F,x:L.x,y:L.y,showValues:b})]})]}),S&&Q.length>0&&(0,i.jsx)(`div`,{className:t.cn(C===`right`&&`min-w-[120px]`,C===`bottom`&&`w-full`),children:(0,i.jsx)(c,{items:Q,position:C,onItemClick:e=>{K(t=>t===e?null:e)},highlightedCategory:G})})]})}exports.WakaTreemapChart=f,exports.default=f,exports.useTreemapChart=o;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";"use client";const e=require(
|
|
1
|
+
"use client";"use client";const e=require("../../_virtual/_rolldown/runtime.cjs.js"),t=require("../../utils/cn.cjs.js");let n=require("react");n=e.__toESM(n);let r=require("lucide-react"),i=require("react/jsx-runtime");var a=[{name:`Google Authenticator`,iosUrl:`https://apps.apple.com/app/google-authenticator/id388497605`,androidUrl:`https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2`},{name:`Authy`,iosUrl:`https://apps.apple.com/app/authy/id494168017`,androidUrl:`https://play.google.com/store/apps/details?id=com.authy.authy`},{name:`1Password`,iosUrl:`https://apps.apple.com/app/1password-password-manager/id568903335`,androidUrl:`https://play.google.com/store/apps/details?id=com.onepassword.android`}],o=[`intro`,`qr-code`,`backup-codes`,`verify`,`success`];function s(e){let{config:t,onVerify:r,onRegenerateBackupCodes:i,onRegenerateSecret:a,onComplete:s,initialStep:c=`intro`}=e,[l,u]=n.useState(c),[d,f]=n.useState(``),[p,m]=n.useState(!1),[h,g]=n.useState(null),[_,v]=n.useState(!1),[y,b]=n.useState(!1),[x,S]=n.useState(!1),[C,w]=n.useState(!1),[T,E]=n.useState(t.backupCodes),[D,O]=n.useState(t.secretKey),[k,A]=n.useState(t.qrCodeUrl),[j,M]=n.useState(!1),N=n.useCallback(e=>{u(e),g(null)},[]);return{currentStep:l,setStep:N,nextStep:n.useCallback(()=>{let e=o.indexOf(l);e<o.length-1&&N(o[e+1])},[l,N]),prevStep:n.useCallback(()=>{let e=o.indexOf(l);e>0&&N(o[e-1])},[l,N]),verificationCode:d,setVerificationCode:f,isVerifying:p,verifyError:h,handleVerify:n.useCallback(async()=>{if(d.length!==6){g(`Please enter a 6-digit code`);return}m(!0),g(null);try{await r(d)?(M(!0),N(`success`),s?.()):g(`Invalid verification code. Please try again.`)}catch(e){g(e instanceof Error?e.message:`Verification failed`)}finally{m(!1)}},[d,r,s,N]),secretKeyCopied:_,copySecretKey:n.useCallback(()=>{navigator.clipboard.writeText(D),v(!0),setTimeout(()=>v(!1),2e3)},[D]),backupCodesCopied:y,copyBackupCodes:n.useCallback(()=>{let e=T.map(e=>e.code).join(`
|
|
2
2
|
`);navigator.clipboard.writeText(e),b(!0),setTimeout(()=>b(!1),2e3)},[T]),downloadBackupCodes:n.useCallback(()=>{let e=[`${t.issuer} - Backup Codes`,`Account: ${t.accountName}`,`Generated: ${new Date().toISOString()}`,``,`Keep these codes safe. Each code can only be used once.`,``,...T.map((e,t)=>`${t+1}. ${e.code}`)].join(`
|
|
3
|
-
`),n=new Blob([e],{type:`text/plain`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t.issuer.toLowerCase().replace(/\s+/g,`-`)}-backup-codes.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},[T,t.issuer,t.accountName]),isRegeneratingCodes:x,regenerateBackupCodes:n.useCallback(async()=>{if(i){S(!0);try{E(await i())}catch(e){console.error(`Failed to regenerate backup codes:`,e)}finally{S(!1)}}},[i]),isRegeneratingSecret:C,regenerateSecret:n.useCallback(async()=>{if(a){w(!0);try{let e=await a();O(e.secretKey),A(e.qrCodeUrl)}catch(e){console.error(`Failed to regenerate secret:`,e)}finally{w(!1)}}},[a]),backupCodes:T,secretKey:D,qrCodeUrl:k,isComplete:j}}function c({currentStep:e,className:a}){let s=[{key:`intro`,label:`Start`},{key:`qr-code`,label:`Scan`},{key:`backup-codes`,label:`Backup`},{key:`verify`,label:`Verify`},{key:`success`,label:`Done`}],c=o.indexOf(e);return(0,i.jsx)(`div`,{className:t.cn(`flex items-center justify-center gap-2`,a),children:s.map((e,a)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,i.jsx)(`div`,{className:t.cn(`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all duration-300`,a<c&&`bg-primary text-primary-foreground`,a===c&&`bg-primary text-primary-foreground ring-4 ring-primary/20`,a>c&&`bg-muted text-muted-foreground`),children:a<c?(0,i.jsx)(r.Check,{className:`w-4 h-4`}):a+1}),(0,i.jsx)(`span`,{className:t.cn(`text-xs hidden sm:block`,a<=c?`text-foreground`:`text-muted-foreground`),children:e.label})]}),a<s.length-1&&(0,i.jsx)(`div`,{className:t.cn(`w-8 sm:w-12 h-0.5 transition-colors duration-300`,a<c?`bg-primary`:`bg-muted`)})]},e.key))})}function l({authenticatorApps:e,onNext:t,onCancel:n}){return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Shield,{className:`w-8 h-8 text-primary`})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Enable Two-Factor Authentication`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Add an extra layer of security to your account by requiring a verification code in addition to your password.`})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsx)(`h4`,{className:`text-sm font-medium`,children:`You will need an authenticator app:`}),(0,i.jsx)(`div`,{className:`grid gap-2`,children:e.map(e=>(0,i.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-muted/50 rounded-lg`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(r.Smartphone,{className:`w-5 h-5 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[(0,i.jsxs)(`a`,{href:e.iosUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-primary hover:underline flex items-center gap-1`,children:[`iOS `,(0,i.jsx)(r.ExternalLink,{className:`w-3 h-3`})]}),(0,i.jsxs)(`a`,{href:e.androidUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-primary hover:underline flex items-center gap-1`,children:[`Android `,(0,i.jsx)(r.ExternalLink,{className:`w-3 h-3`})]})]})]},e.name))})]}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[n&&(0,i.jsx)(`button`,{onClick:n,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors`,children:`Cancel`}),(0,i.jsxs)(`button`,{onClick:t,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2`,children:[`Get Started`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})]})]})}function u({qrCodeUrl:e,secretKey:a,issuer:o,secretKeyCopied:s,onCopySecret:c,onRegenerateSecret:l,isRegeneratingSecret:u,onNext:d,onBack:f}){let[p,m]=n.useState(!1);return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Scan QR Code`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Open your authenticator app and scan this QR code to add your account.`})]}),(0,i.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,i.jsxs)(`div`,{className:`relative p-4 bg-white rounded-xl shadow-sm`,children:[e?(0,i.jsx)(`img`,{src:e,alt:`2FA QR Code`,className:t.cn(`w-48 h-48 transition-opacity`,u&&`opacity-50`)}):(0,i.jsx)(`div`,{className:`w-48 h-48 flex items-center justify-center bg-muted rounded-lg`,children:(0,i.jsx)(r.QrCode,{className:`w-16 h-16 text-muted-foreground`})}),u&&(0,i.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,i.jsx)(r.Loader2,{className:`w-8 h-8 animate-spin text-primary`})})]}),l&&(0,i.jsxs)(`button`,{onClick:l,disabled:u,className:`text-sm text-primary hover:underline flex items-center gap-1 disabled:opacity-50`,children:[(0,i.jsx)(r.RefreshCw,{className:t.cn(`w-4 h-4`,u&&`animate-spin`)}),`Generate new code`]})]}),(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,i.jsx)(r.Key,{className:`w-4 h-4`}),`Manual entry key`]}),(0,i.jsxs)(`button`,{onClick:()=>m(!p),className:`text-sm text-muted-foreground hover:text-foreground flex items-center gap-1`,children:[p?(0,i.jsx)(r.EyeOff,{className:`w-4 h-4`}):(0,i.jsx)(r.Eye,{className:`w-4 h-4`}),p?`Hide`:`Show`]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`code`,{className:t.cn(`flex-1 px-3 py-2 bg-muted rounded-lg text-sm font-mono break-all`,!p&&`tracking-[0.5em] select-none`),children:p?a:`••••••••••••••••`}),(0,i.jsx)(`button`,{onClick:c,className:`p-2 rounded-lg border border-input hover:bg-accent transition-colors`,title:`Copy to clipboard`,children:s?(0,i.jsx)(r.Check,{className:`w-4 h-4 text-green-500`}):(0,i.jsx)(r.Copy,{className:`w-4 h-4`})})]}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Account: `,o,` (`,a.substring(0,4),`...)`]})]}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,i.jsxs)(`button`,{onClick:f,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2`,children:[(0,i.jsx)(r.ChevronLeft,{className:`w-4 h-4`}),`Back`]}),(0,i.jsxs)(`button`,{onClick:d,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2`,children:[`Continue`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})]})]})}function d({backupCodes:e,backupCodesCopied:n,onCopyBackupCodes:a,onDownloadBackupCodes:o,onRegenerateBackupCodes:s,isRegeneratingCodes:c,onNext:l,onBack:u}){return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-16 h-16 bg-amber-500/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Key,{className:`w-8 h-8 text-amber-500`})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Save Backup Codes`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Save these codes in a safe place. You can use them to access your account if you lose your authenticator device.`})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsx)(`div`,{className:t.cn(`grid grid-cols-2 gap-2 p-4 bg-muted/50 rounded-lg font-mono text-sm`,c&&`opacity-50`),children:e.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`px-3 py-2 bg-background rounded border text-center`,e.used&&`line-through text-muted-foreground`),children:e.code},n))}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[(0,i.jsx)(`button`,{onClick:a,disabled:c,className:`flex-1 px-3 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Check,{className:`w-4 h-4 text-green-500`}),`Copied!`]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Copy,{className:`w-4 h-4`}),`Copy All`]})}),(0,i.jsxs)(`button`,{onClick:o,disabled:c,className:`flex-1 px-3 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:[(0,i.jsx)(r.Download,{className:`w-4 h-4`}),`Download`]})]}),s&&(0,i.jsxs)(`button`,{onClick:s,disabled:c,className:`w-full text-sm text-primary hover:underline flex items-center justify-center gap-1 disabled:opacity-50`,children:[(0,i.jsx)(r.RefreshCw,{className:t.cn(`w-4 h-4`,c&&`animate-spin`)}),`Generate new codes`]})]}),(0,i.jsx)(`div`,{className:`p-3 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg`,children:(0,i.jsxs)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200 flex items-start gap-2`,children:[(0,i.jsx)(r.AlertCircle,{className:`w-4 h-4 mt-0.5 flex-shrink-0`}),(0,i.jsxs)(`span`,{children:[(0,i.jsx)(`strong`,{children:`Important:`}),` Each code can only be used once. Store them securely and do not share them with anyone.`]})]})}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,i.jsxs)(`button`,{onClick:u,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2`,children:[(0,i.jsx)(r.ChevronLeft,{className:`w-4 h-4`}),`Back`]}),(0,i.jsxs)(`button`,{onClick:l,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2`,children:[`I have saved these codes`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})]})]})}function f({verificationCode:e,onCodeChange:a,onVerify:o,isVerifying:s,error:c,onBack:l}){let u=n.useRef([]),[d,f]=n.useState(e.split(``).concat(Array(6-e.length).fill(``))),p=(e,t)=>{if(!/^\d*$/.test(t))return;let n=[...d];n[e]=t.slice(-1),f(n),a(n.join(``)),t&&e<5&&u.current[e+1]?.focus()},m=(t,n)=>{n.key===`Backspace`&&!d[t]&&t>0&&u.current[t-1]?.focus(),n.key===`Enter`&&e.length===6&&o()},h=e=>{e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);f(t.split(``).concat(Array(6-t.length).fill(``))),a(t),u.current[Math.min(t.length,5)]?.focus()};return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Smartphone,{className:`w-8 h-8 text-primary`})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Verify Your Code`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Enter the 6-digit code from your authenticator app to complete the setup.`})]}),(0,i.jsxs)(`div`,{className:`space-y-4`,children:[(0,i.jsx)(`div`,{className:`flex justify-center gap-2`,children:d.map((e,n)=>(0,i.jsx)(`input`,{ref:e=>{u.current[n]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>p(n,e.target.value),onKeyDown:e=>m(n,e),onPaste:h,className:t.cn(`w-12 h-14 text-center text-xl font-semibold rounded-lg border bg-background`,`focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent`,`transition-all duration-200`,c&&`border-destructive focus:ring-destructive`),disabled:s},n))}),c&&(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-destructive animate-in fade-in slide-in-from-top-2`,children:[(0,i.jsx)(r.AlertCircle,{className:`w-4 h-4`}),c]})]}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,i.jsxs)(`button`,{onClick:l,disabled:s,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:[(0,i.jsx)(r.ChevronLeft,{className:`w-4 h-4`}),`Back`]}),(0,i.jsx)(`button`,{onClick:o,disabled:s||e.length!==6,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Loader2,{className:`w-4 h-4 animate-spin`}),`Verifying...`]}):(0,i.jsxs)(i.Fragment,{children:[`Verify`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})})]})]})}function p({onComplete:e}){return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in zoom-in-95 duration-500`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-4`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-20 h-20 bg-green-500/10 rounded-full flex items-center justify-center animate-in zoom-in duration-500`,children:(0,i.jsx)(`div`,{className:`w-16 h-16 bg-green-500 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Check,{className:`w-8 h-8 text-white`})})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Two-Factor Authentication Enabled!`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Your account is now protected with two-factor authentication. You will need to enter a verification code each time you sign in.`})]}),(0,i.jsxs)(`div`,{className:`p-4 bg-muted/50 rounded-lg space-y-2`,children:[(0,i.jsxs)(`h4`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,i.jsx)(r.Shield,{className:`w-4 h-4 text-green-500`}),`What happens next?`]}),(0,i.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-1 list-disc list-inside`,children:[(0,i.jsx)(`li`,{children:`You will be prompted for a code when signing in`}),(0,i.jsx)(`li`,{children:`Use your authenticator app to generate codes`}),(0,i.jsx)(`li`,{children:`Keep your backup codes safe for emergencies`})]})]}),e&&(0,i.jsx)(`button`,{onClick:e,className:`w-full px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:`Done`})]})}function m({config:e,onComplete:n,onCancel:o,onVerify:m,onRegenerateBackupCodes:h,onRegenerateSecret:g,initialStep:_=`intro`,showStepIndicator:v=!0,allowSkipBackupCodes:y=!1,className:b,isLoading:x=!1,error:S}){let C=s({config:e,onVerify:m,onRegenerateBackupCodes:h,onRegenerateSecret:g,onComplete:n,initialStep:_}),w=e.authenticatorApps||a;return x?(0,i.jsx)(`div`,{className:t.cn(`w-full max-w-md mx-auto p-6`,b),children:(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-4`,children:[(0,i.jsx)(r.Loader2,{className:`w-8 h-8 animate-spin text-primary`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Setting up two-factor authentication...`})]})}):S?(0,i.jsx)(`div`,{className:t.cn(`w-full max-w-md mx-auto p-6`,b),children:(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-4 text-center`,children:[(0,i.jsx)(`div`,{className:`w-16 h-16 bg-destructive/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.AlertCircle,{className:`w-8 h-8 text-destructive`})}),(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Setup Failed`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:S})]}),o&&(0,i.jsx)(`button`,{onClick:o,className:`px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors`,children:`Go Back`})]})}):(0,i.jsxs)(`div`,{className:t.cn(`w-full max-w-md mx-auto p-6`,b),children:[v&&C.currentStep!==`success`&&(0,i.jsx)(c,{currentStep:C.currentStep,className:`mb-8`}),C.currentStep===`intro`&&(0,i.jsx)(l,{authenticatorApps:w,onNext:C.nextStep,onCancel:o}),C.currentStep===`qr-code`&&(0,i.jsx)(u,{qrCodeUrl:C.qrCodeUrl,secretKey:C.secretKey,issuer:e.issuer,accountName:e.accountName,secretKeyCopied:C.secretKeyCopied,onCopySecret:C.copySecretKey,onRegenerateSecret:g?C.regenerateSecret:void 0,isRegeneratingSecret:C.isRegeneratingSecret,onNext:C.nextStep,onBack:C.prevStep}),C.currentStep===`backup-codes`&&(0,i.jsx)(d,{backupCodes:C.backupCodes,issuer:e.issuer,backupCodesCopied:C.backupCodesCopied,onCopyBackupCodes:C.copyBackupCodes,onDownloadBackupCodes:C.downloadBackupCodes,onRegenerateBackupCodes:h?C.regenerateBackupCodes:void 0,isRegeneratingCodes:C.isRegeneratingCodes,onNext:C.nextStep,onBack:C.prevStep,allowSkip:y}),C.currentStep===`verify`&&(0,i.jsx)(f,{verificationCode:C.verificationCode,onCodeChange:C.setVerificationCode,onVerify:C.handleVerify,isVerifying:C.isVerifying,error:C.verifyError,onBack:C.prevStep}),C.currentStep===`success`&&(0,i.jsx)(p,{onComplete:n})]})}exports.default=m,exports.useTwoFactorSetup=s;
|
|
3
|
+
`),n=new Blob([e],{type:`text/plain`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t.issuer.toLowerCase().replace(/\s+/g,`-`)}-backup-codes.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)},[T,t.issuer,t.accountName]),isRegeneratingCodes:x,regenerateBackupCodes:n.useCallback(async()=>{if(i){S(!0);try{let e=await i();E(e)}catch(e){console.error(`Failed to regenerate backup codes:`,e)}finally{S(!1)}}},[i]),isRegeneratingSecret:C,regenerateSecret:n.useCallback(async()=>{if(a){w(!0);try{let e=await a();O(e.secretKey),A(e.qrCodeUrl)}catch(e){console.error(`Failed to regenerate secret:`,e)}finally{w(!1)}}},[a]),backupCodes:T,secretKey:D,qrCodeUrl:k,isComplete:j}}function c({currentStep:e,className:a}){let s=[{key:`intro`,label:`Start`},{key:`qr-code`,label:`Scan`},{key:`backup-codes`,label:`Backup`},{key:`verify`,label:`Verify`},{key:`success`,label:`Done`}],c=o.indexOf(e);return(0,i.jsx)(`div`,{className:t.cn(`flex items-center justify-center gap-2`,a),children:s.map((e,a)=>(0,i.jsxs)(n.Fragment,{children:[(0,i.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,i.jsx)(`div`,{className:t.cn(`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-all duration-300`,a<c&&`bg-primary text-primary-foreground`,a===c&&`bg-primary text-primary-foreground ring-4 ring-primary/20`,a>c&&`bg-muted text-muted-foreground`),children:a<c?(0,i.jsx)(r.Check,{className:`w-4 h-4`}):a+1}),(0,i.jsx)(`span`,{className:t.cn(`text-xs hidden sm:block`,a<=c?`text-foreground`:`text-muted-foreground`),children:e.label})]}),a<s.length-1&&(0,i.jsx)(`div`,{className:t.cn(`w-8 sm:w-12 h-0.5 transition-colors duration-300`,a<c?`bg-primary`:`bg-muted`)})]},e.key))})}function l({authenticatorApps:e,onNext:t,onCancel:n}){return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Shield,{className:`w-8 h-8 text-primary`})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Enable Two-Factor Authentication`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Add an extra layer of security to your account by requiring a verification code in addition to your password.`})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsx)(`h4`,{className:`text-sm font-medium`,children:`You will need an authenticator app:`}),(0,i.jsx)(`div`,{className:`grid gap-2`,children:e.map(e=>(0,i.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-muted/50 rounded-lg`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(r.Smartphone,{className:`w-5 h-5 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`text-sm font-medium`,children:e.name})]}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[(0,i.jsxs)(`a`,{href:e.iosUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-primary hover:underline flex items-center gap-1`,children:[`iOS `,(0,i.jsx)(r.ExternalLink,{className:`w-3 h-3`})]}),(0,i.jsxs)(`a`,{href:e.androidUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-primary hover:underline flex items-center gap-1`,children:[`Android `,(0,i.jsx)(r.ExternalLink,{className:`w-3 h-3`})]})]})]},e.name))})]}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[n&&(0,i.jsx)(`button`,{onClick:n,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors`,children:`Cancel`}),(0,i.jsxs)(`button`,{onClick:t,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2`,children:[`Get Started`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})]})]})}function u({qrCodeUrl:e,secretKey:a,issuer:o,secretKeyCopied:s,onCopySecret:c,onRegenerateSecret:l,isRegeneratingSecret:u,onNext:d,onBack:f}){let[p,m]=n.useState(!1);return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Scan QR Code`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Open your authenticator app and scan this QR code to add your account.`})]}),(0,i.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,i.jsxs)(`div`,{className:`relative p-4 bg-white rounded-xl shadow-sm`,children:[e?(0,i.jsx)(`img`,{src:e,alt:`2FA QR Code`,className:t.cn(`w-48 h-48 transition-opacity`,u&&`opacity-50`)}):(0,i.jsx)(`div`,{className:`w-48 h-48 flex items-center justify-center bg-muted rounded-lg`,children:(0,i.jsx)(r.QrCode,{className:`w-16 h-16 text-muted-foreground`})}),u&&(0,i.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,i.jsx)(r.Loader2,{className:`w-8 h-8 animate-spin text-primary`})})]}),l&&(0,i.jsxs)(`button`,{onClick:l,disabled:u,className:`text-sm text-primary hover:underline flex items-center gap-1 disabled:opacity-50`,children:[(0,i.jsx)(r.RefreshCw,{className:t.cn(`w-4 h-4`,u&&`animate-spin`)}),`Generate new code`]})]}),(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,i.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,i.jsx)(r.Key,{className:`w-4 h-4`}),`Manual entry key`]}),(0,i.jsxs)(`button`,{onClick:()=>m(!p),className:`text-sm text-muted-foreground hover:text-foreground flex items-center gap-1`,children:[p?(0,i.jsx)(r.EyeOff,{className:`w-4 h-4`}):(0,i.jsx)(r.Eye,{className:`w-4 h-4`}),p?`Hide`:`Show`]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`code`,{className:t.cn(`flex-1 px-3 py-2 bg-muted rounded-lg text-sm font-mono break-all`,!p&&`tracking-[0.5em] select-none`),children:p?a:`••••••••••••••••`}),(0,i.jsx)(`button`,{onClick:c,className:`p-2 rounded-lg border border-input hover:bg-accent transition-colors`,title:`Copy to clipboard`,children:s?(0,i.jsx)(r.Check,{className:`w-4 h-4 text-green-500`}):(0,i.jsx)(r.Copy,{className:`w-4 h-4`})})]}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Account: `,o,` (`,a.substring(0,4),`...)`]})]}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,i.jsxs)(`button`,{onClick:f,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2`,children:[(0,i.jsx)(r.ChevronLeft,{className:`w-4 h-4`}),`Back`]}),(0,i.jsxs)(`button`,{onClick:d,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2`,children:[`Continue`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})]})]})}function d({backupCodes:e,backupCodesCopied:n,onCopyBackupCodes:a,onDownloadBackupCodes:o,onRegenerateBackupCodes:s,isRegeneratingCodes:c,onNext:l,onBack:u}){return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-16 h-16 bg-amber-500/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Key,{className:`w-8 h-8 text-amber-500`})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Save Backup Codes`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Save these codes in a safe place. You can use them to access your account if you lose your authenticator device.`})]}),(0,i.jsxs)(`div`,{className:`space-y-3`,children:[(0,i.jsx)(`div`,{className:t.cn(`grid grid-cols-2 gap-2 p-4 bg-muted/50 rounded-lg font-mono text-sm`,c&&`opacity-50`),children:e.map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`px-3 py-2 bg-background rounded border text-center`,e.used&&`line-through text-muted-foreground`),children:e.code},n))}),(0,i.jsxs)(`div`,{className:`flex gap-2`,children:[(0,i.jsx)(`button`,{onClick:a,disabled:c,className:`flex-1 px-3 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Check,{className:`w-4 h-4 text-green-500`}),`Copied!`]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Copy,{className:`w-4 h-4`}),`Copy All`]})}),(0,i.jsxs)(`button`,{onClick:o,disabled:c,className:`flex-1 px-3 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:[(0,i.jsx)(r.Download,{className:`w-4 h-4`}),`Download`]})]}),s&&(0,i.jsxs)(`button`,{onClick:s,disabled:c,className:`w-full text-sm text-primary hover:underline flex items-center justify-center gap-1 disabled:opacity-50`,children:[(0,i.jsx)(r.RefreshCw,{className:t.cn(`w-4 h-4`,c&&`animate-spin`)}),`Generate new codes`]})]}),(0,i.jsx)(`div`,{className:`p-3 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg`,children:(0,i.jsxs)(`p`,{className:`text-sm text-amber-800 dark:text-amber-200 flex items-start gap-2`,children:[(0,i.jsx)(r.AlertCircle,{className:`w-4 h-4 mt-0.5 flex-shrink-0`}),(0,i.jsxs)(`span`,{children:[(0,i.jsx)(`strong`,{children:`Important:`}),` Each code can only be used once. Store them securely and do not share them with anyone.`]})]})}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,i.jsxs)(`button`,{onClick:u,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2`,children:[(0,i.jsx)(r.ChevronLeft,{className:`w-4 h-4`}),`Back`]}),(0,i.jsxs)(`button`,{onClick:l,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2`,children:[`I have saved these codes`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})]})]})}function f({verificationCode:e,onCodeChange:a,onVerify:o,isVerifying:s,error:c,onBack:l}){let u=n.useRef([]),[d,f]=n.useState(e.split(``).concat(Array(6-e.length).fill(``))),p=(e,t)=>{if(!/^\d*$/.test(t))return;let n=[...d];n[e]=t.slice(-1),f(n),a(n.join(``)),t&&e<5&&u.current[e+1]?.focus()},m=(t,n)=>{n.key===`Backspace`&&!d[t]&&t>0&&u.current[t-1]?.focus(),n.key===`Enter`&&e.length===6&&o()},h=e=>{e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6),n=t.split(``).concat(Array(6-t.length).fill(``));f(n),a(t),u.current[Math.min(t.length,5)]?.focus()};return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in slide-in-from-right-4 duration-300`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Smartphone,{className:`w-8 h-8 text-primary`})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Verify Your Code`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Enter the 6-digit code from your authenticator app to complete the setup.`})]}),(0,i.jsxs)(`div`,{className:`space-y-4`,children:[(0,i.jsx)(`div`,{className:`flex justify-center gap-2`,children:d.map((e,n)=>(0,i.jsx)(`input`,{ref:e=>{u.current[n]=e},type:`text`,inputMode:`numeric`,maxLength:1,value:e,onChange:e=>p(n,e.target.value),onKeyDown:e=>m(n,e),onPaste:h,className:t.cn(`w-12 h-14 text-center text-xl font-semibold rounded-lg border bg-background`,`focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent`,`transition-all duration-200`,c&&`border-destructive focus:ring-destructive`),disabled:s},n))}),c&&(0,i.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm text-destructive animate-in fade-in slide-in-from-top-2`,children:[(0,i.jsx)(r.AlertCircle,{className:`w-4 h-4`}),c]})]}),(0,i.jsxs)(`div`,{className:`flex gap-3 pt-4`,children:[(0,i.jsxs)(`button`,{onClick:l,disabled:s,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:[(0,i.jsx)(r.ChevronLeft,{className:`w-4 h-4`}),`Back`]}),(0,i.jsx)(`button`,{onClick:o,disabled:s||e.length!==6,className:`flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 disabled:opacity-50`,children:s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Loader2,{className:`w-4 h-4 animate-spin`}),`Verifying...`]}):(0,i.jsxs)(i.Fragment,{children:[`Verify`,(0,i.jsx)(r.ChevronRight,{className:`w-4 h-4`})]})})]})]})}function p({onComplete:e}){return(0,i.jsxs)(`div`,{className:`space-y-6 animate-in fade-in zoom-in-95 duration-500`,children:[(0,i.jsxs)(`div`,{className:`text-center space-y-4`,children:[(0,i.jsx)(`div`,{className:`mx-auto w-20 h-20 bg-green-500/10 rounded-full flex items-center justify-center animate-in zoom-in duration-500`,children:(0,i.jsx)(`div`,{className:`w-16 h-16 bg-green-500 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.Check,{className:`w-8 h-8 text-white`})})}),(0,i.jsx)(`h3`,{className:`text-xl font-semibold`,children:`Two-Factor Authentication Enabled!`}),(0,i.jsx)(`p`,{className:`text-muted-foreground text-sm max-w-md mx-auto`,children:`Your account is now protected with two-factor authentication. You will need to enter a verification code each time you sign in.`})]}),(0,i.jsxs)(`div`,{className:`p-4 bg-muted/50 rounded-lg space-y-2`,children:[(0,i.jsxs)(`h4`,{className:`text-sm font-medium flex items-center gap-2`,children:[(0,i.jsx)(r.Shield,{className:`w-4 h-4 text-green-500`}),`What happens next?`]}),(0,i.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-1 list-disc list-inside`,children:[(0,i.jsx)(`li`,{children:`You will be prompted for a code when signing in`}),(0,i.jsx)(`li`,{children:`Use your authenticator app to generate codes`}),(0,i.jsx)(`li`,{children:`Keep your backup codes safe for emergencies`})]})]}),e&&(0,i.jsx)(`button`,{onClick:e,className:`w-full px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,children:`Done`})]})}function m({config:e,onComplete:n,onCancel:o,onVerify:m,onRegenerateBackupCodes:h,onRegenerateSecret:g,initialStep:_=`intro`,showStepIndicator:v=!0,allowSkipBackupCodes:y=!1,className:b,isLoading:x=!1,error:S}){let C=s({config:e,onVerify:m,onRegenerateBackupCodes:h,onRegenerateSecret:g,onComplete:n,initialStep:_}),w=e.authenticatorApps||a;return x?(0,i.jsx)(`div`,{className:t.cn(`w-full max-w-md mx-auto p-6`,b),children:(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-4`,children:[(0,i.jsx)(r.Loader2,{className:`w-8 h-8 animate-spin text-primary`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Setting up two-factor authentication...`})]})}):S?(0,i.jsx)(`div`,{className:t.cn(`w-full max-w-md mx-auto p-6`,b),children:(0,i.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-4 text-center`,children:[(0,i.jsx)(`div`,{className:`w-16 h-16 bg-destructive/10 rounded-full flex items-center justify-center`,children:(0,i.jsx)(r.AlertCircle,{className:`w-8 h-8 text-destructive`})}),(0,i.jsxs)(`div`,{className:`space-y-2`,children:[(0,i.jsx)(`h3`,{className:`text-lg font-semibold`,children:`Setup Failed`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-sm`,children:S})]}),o&&(0,i.jsx)(`button`,{onClick:o,className:`px-4 py-2 text-sm font-medium rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors`,children:`Go Back`})]})}):(0,i.jsxs)(`div`,{className:t.cn(`w-full max-w-md mx-auto p-6`,b),children:[v&&C.currentStep!==`success`&&(0,i.jsx)(c,{currentStep:C.currentStep,className:`mb-8`}),C.currentStep===`intro`&&(0,i.jsx)(l,{authenticatorApps:w,onNext:C.nextStep,onCancel:o}),C.currentStep===`qr-code`&&(0,i.jsx)(u,{qrCodeUrl:C.qrCodeUrl,secretKey:C.secretKey,issuer:e.issuer,accountName:e.accountName,secretKeyCopied:C.secretKeyCopied,onCopySecret:C.copySecretKey,onRegenerateSecret:g?C.regenerateSecret:void 0,isRegeneratingSecret:C.isRegeneratingSecret,onNext:C.nextStep,onBack:C.prevStep}),C.currentStep===`backup-codes`&&(0,i.jsx)(d,{backupCodes:C.backupCodes,issuer:e.issuer,backupCodesCopied:C.backupCodesCopied,onCopyBackupCodes:C.copyBackupCodes,onDownloadBackupCodes:C.downloadBackupCodes,onRegenerateBackupCodes:h?C.regenerateBackupCodes:void 0,isRegeneratingCodes:C.isRegeneratingCodes,onNext:C.nextStep,onBack:C.prevStep,allowSkip:y}),C.currentStep===`verify`&&(0,i.jsx)(f,{verificationCode:C.verificationCode,onCodeChange:C.setVerificationCode,onVerify:C.handleVerify,isVerifying:C.isVerifying,error:C.verifyError,onBack:C.prevStep}),C.currentStep===`success`&&(0,i.jsx)(p,{onComplete:n})]})}exports.WakaTwoFactorSetup=m,exports.default=m,exports.useTwoFactorSetup=s;
|