@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
|
@@ -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(`react/jsx-runtime`);var i=(e,t,n,r)=>{let i=(t+180)/360*n,a=e*Math.PI/180,o=Math.log(Math.tan(Math.PI/4+a/2)),s=r/2-o*r/(2*Math.PI);return{x:i,y:Math.max(0,Math.min(r,s))}},a=e=>e===void 0?`#6b7280`:e<50?`#22c55e`:e<100?`#eab308`:`#ef4444`,o={active:`#22c55e`,degraded:`#eab308`,offline:`#6b7280`},s={aws:`#ff9900`,gcp:`#4285f4`,azure:`#0078d4`,custom:`#8b5cf6`},c=({region:e,x:n,y:i,isSelected:c,isHovered:l,showLatency:u,animated:d,onClick:f,onMouseEnter:p,onMouseLeave:m})=>{let h=o[e.status],g=e.provider?s[e.provider]:`#6b7280`,_=a(e.latency),v=c?12:l?10:8;return(0,r.jsxs)(`g`,{transform:`translate(${n}, ${i})`,onClick:f,onMouseEnter:p,onMouseLeave:m,style:{cursor:`pointer`},role:`button`,"aria-label":`${e.name} - ${e.status}${e.latency?`, ${e.latency}ms`:``}`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f()},children:[d&&e.status===`active`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`circle`,{r:v+8,fill:`none`,stroke:h,strokeWidth:2,opacity:0,children:[(0,r.jsx)(`animate`,{attributeName:`r`,values:`${v};${v+20}`,dur:`2s`,repeatCount:`indefinite`}),(0,r.jsx)(`animate`,{attributeName:`opacity`,values:`0.6;0`,dur:`2s`,repeatCount:`indefinite`})]}),(0,r.jsxs)(`circle`,{r:v+4,fill:`none`,stroke:h,strokeWidth:1.5,opacity:0,children:[(0,r.jsx)(`animate`,{attributeName:`r`,values:`${v};${v+15}`,dur:`2s`,begin:`0.5s`,repeatCount:`indefinite`}),(0,r.jsx)(`animate`,{attributeName:`opacity`,values:`0.4;0`,dur:`2s`,begin:`0.5s`,repeatCount:`indefinite`})]})]}),c&&(0,r.jsx)(`circle`,{r:v+6,fill:`none`,stroke:`#3b82f6`,strokeWidth:2,strokeDasharray:`4 2`,className:`animate-spin`,style:{animationDuration:`8s`}}),(0,r.jsx)(`circle`,{r:v,fill:g,stroke:`white`,strokeWidth:2,opacity:.9,className:t.cn(`transition-all duration-200`,l&&`drop-shadow-lg`)}),(0,r.jsx)(`circle`,{r:v*.5,fill:h,stroke:`white`,strokeWidth:1}),u&&e.latency!==void 0&&(0,r.jsxs)(`g`,{transform:`translate(${v+4}, ${-v})`,children:[(0,r.jsx)(`rect`,{x:-2,y:-8,width:e.latency>=100?32:28,height:16,rx:4,fill:_,stroke:`white`,strokeWidth:1}),(0,r.jsxs)(`text`,{x:e.latency>=100?14:12,y:1,textAnchor:`middle`,dominantBaseline:`middle`,fill:`white`,fontSize:9,fontWeight:`bold`,children:[e.latency,`ms`]})]}),l&&(0,r.jsxs)(`g`,{transform:`translate(0, -30)`,children:[(0,r.jsx)(`rect`,{x:-60,y:-40,width:120,height:e.latency===void 0?38:52,rx:6,fill:`rgba(0,0,0,0.85)`,stroke:`rgba(255,255,255,0.2)`,strokeWidth:1}),(0,r.jsx)(`polygon`,{points:`-6,12 6,12 0,20`,fill:`rgba(0,0,0,0.85)`,transform:`translate(0, -40)`}),(0,r.jsx)(`text`,{y:-62,textAnchor:`middle`,fill:`white`,fontSize:11,fontWeight:`600`,children:e.name}),(0,r.jsx)(`text`,{y:-48,textAnchor:`middle`,fill:h,fontSize:10,children:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),e.latency!==void 0&&(0,r.jsxs)(`text`,{y:-34,textAnchor:`middle`,fill:_,fontSize:10,fontWeight:`500`,children:[`Latency: `,e.latency,`ms`]}),e.provider&&(0,r.jsx)(`text`,{y:e.latency===void 0?-34:-20,textAnchor:`middle`,fill:`#9ca3af`,fontSize:9,children:e.provider.toUpperCase()})]})]})},l=({userX:e,userY:t,regionX:n,regionY:i,latency:o,animated:s})=>{let c=a(o),l=`M ${e} ${t} Q ${(e+n)/2} ${(t+i)/2-20} ${n} ${i}`;return(0,r.jsxs)(`g`,{children:[(0,r.jsx)(`path`,{d:l,fill:`none`,stroke:c,strokeWidth:1.5,strokeOpacity:.6,strokeDasharray:s?`6 4`:void 0,children:s&&(0,r.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:`0`,to:`-20`,dur:`1s`,repeatCount:`indefinite`})}),s&&(0,r.jsx)(`circle`,{r:3,fill:c,children:(0,r.jsx)(`animateMotion`,{dur:`2s`,repeatCount:`indefinite`,path:l})})]})},u=({x:e,y:t,animated:n})=>(0,r.jsxs)(`g`,{transform:`translate(${e}, ${t})`,children:[n&&(0,r.jsxs)(`circle`,{r:8,fill:`none`,stroke:`#3b82f6`,strokeWidth:2,opacity:0,children:[(0,r.jsx)(`animate`,{attributeName:`r`,values:`8;25`,dur:`1.5s`,repeatCount:`indefinite`}),(0,r.jsx)(`animate`,{attributeName:`opacity`,values:`0.8;0`,dur:`1.5s`,repeatCount:`indefinite`})]}),(0,r.jsx)(`circle`,{r:10,fill:`#3b82f6`,stroke:`white`,strokeWidth:3}),(0,r.jsx)(`circle`,{r:4,fill:`white`}),(0,r.jsx)(`text`,{y:22,textAnchor:`middle`,fill:`#3b82f6`,fontSize:10,fontWeight:`600`,children:`You`})]}),d=({regions:e,userLocation:d,selectedRegion:f,onRegionSelect:p,showLatency:m=!0,showConnections:h=!1,animated:g=!0,className:_})=>{let v=n.useRef(null),[y,b]=n.useState(null),[x,S]=n.useState({width:800,height:400});n.useEffect(()=>{let e=()=>{if(v.current){let{width:e,height:t}=v.current.getBoundingClientRect();S({width:e||800,height:t||400})}};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let C=n.useMemo(()=>e.map(e=>({...e,...i(e.location.lat,e.location.lng,100,100)})),[e]),w=n.useMemo(()=>d?i(d.lat,d.lng,100,100):null,[d]);return(0,r.jsxs)(`div`,{ref:v,className:t.cn(`relative h-full w-full min-h-[300px] overflow-hidden rounded-lg border border-gray-200 bg-gradient-to-b from-slate-50 to-slate-100`,_),children:[(0,r.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`xMidYMid meet`,className:`h-full w-full`,"aria-label":`Cloud region map`,role:`img`,children:[(0,r.jsxs)(`defs`,{children:[(0,r.jsxs)(`linearGradient`,{id:`oceanGradient`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`#e0f2fe`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`#bae6fd`})]}),(0,r.jsxs)(`linearGradient`,{id:`landGradient`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`#f1f5f9`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`#e2e8f0`})]}),(0,r.jsx)(`filter`,{id:`dropShadow`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:(0,r.jsx)(`feDropShadow`,{dx:`0`,dy:`1`,stdDeviation:`1`,floodOpacity:`0.2`})}),(0,r.jsxs)(`filter`,{id:`glow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,r.jsx)(`feGaussianBlur`,{stdDeviation:`2`,result:`coloredBlur`}),(0,r.jsxs)(`feMerge`,{children:[(0,r.jsx)(`feMergeNode`,{in:`coloredBlur`}),(0,r.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,r.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,fill:`url(#oceanGradient)`}),(0,r.jsxs)(`g`,{stroke:`#cbd5e1`,strokeWidth:`0.1`,opacity:`0.5`,children:[[10,20,30,40,50,60,70,80,90].map(e=>(0,r.jsx)(`line`,{x1:e,y1:`0`,x2:e,y2:`100`},`v-${e}`)),[10,20,30,40,50,60,70,80,90].map(e=>(0,r.jsx)(`line`,{x1:`0`,y1:e,x2:`100`,y2:e},`h-${e}`))]}),(0,r.jsxs)(`g`,{filter:`url(#dropShadow)`,children:[(0,r.jsx)(`path`,{d:`M 5,22 L 8,18 L 12,16 L 18,15 L 24,17 L 28,20 L 30,25 L 30,32 L 27,38 L 22,42 L 16,44 L 12,42 L 10,38 L 8,32 L 6,26 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 22,48 L 26,46 L 30,48 L 32,54 L 30,62 L 26,70 L 22,72 L 20,68 L 20,58 L 21,52 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 45,20 L 48,18 L 52,18 L 56,20 L 58,24 L 56,28 L 52,30 L 48,30 L 45,28 L 44,24 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 45,32 L 50,30 L 56,32 L 58,38 L 56,48 L 52,56 L 46,58 L 42,54 L 42,44 L 44,36 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 58,18 L 65,16 L 75,15 L 85,18 L 90,24 L 88,32 L 82,38 L 74,40 L 66,38 L 60,32 L 58,24 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 78,52 L 84,50 L 90,52 L 92,58 L 88,64 L 82,66 L 76,62 L 76,56 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`})]}),h&&w&&(0,r.jsx)(`g`,{children:C.map(e=>(0,r.jsx)(l,{userX:w.x,userY:w.y,regionX:e.x,regionY:e.y,latency:e.latency,animated:g},`connection-${e.id}`))}),(0,r.jsx)(`g`,{children:C.map(e=>(0,r.jsx)(c,{region:e,x:e.x,y:e.y,isSelected:f===e.id,isHovered:y===e.id,showLatency:m,animated:g,onClick:()=>p?.(e.id),onMouseEnter:()=>b(e.id),onMouseLeave:()=>b(null)},e.id))}),w&&(0,r.jsx)(u,{x:w.x,y:w.y,animated:g})]}),(0,r.jsxs)(`div`,{className:`absolute bottom-3 left-3 rounded-lg border border-gray-200 bg-white/90 p-2.5 shadow-sm backdrop-blur-sm`,children:[(0,r.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold text-gray-700`,children:`Status`}),(0,r.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.entries(o).map(([e,t])=>(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:t}}),(0,r.jsx)(`span`,{className:`text-[10px] capitalize text-gray-600`,children:e})]},e))}),m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`mb-1.5 mt-2 text-[10px] font-semibold text-gray-700`,children:`Latency`}),(0,r.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-green-500`}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:`<50ms`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-yellow-500`}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:`<100ms`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-red-500`}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:`>100ms`})]})]})]})]}),(0,r.jsxs)(`div`,{className:`absolute bottom-3 right-3 rounded-lg border border-gray-200 bg-white/90 p-2.5 shadow-sm backdrop-blur-sm`,children:[(0,r.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold text-gray-700`,children:`Providers`}),(0,r.jsx)(`div`,{className:`flex flex-col gap-1`,children:Object.entries(s).map(([e,t])=>(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:t}}),(0,r.jsx)(`span`,{className:`text-[10px] uppercase text-gray-600`,children:e})]},e))})]}),f&&(0,r.jsx)(`div`,{className:`absolute right-3 top-3 rounded-lg border border-blue-200 bg-white/95 p-3 shadow-md backdrop-blur-sm`,children:(()=>{let t=e.find(e=>e.id===f);return t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`mb-1 text-sm font-semibold text-gray-800`,children:t.name}),(0,r.jsxs)(`div`,{className:`space-y-0.5 text-xs text-gray-600`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Status:`}),(0,r.jsx)(`span`,{className:`font-medium capitalize`,style:{color:o[t.status]},children:t.status})]}),t.latency!==void 0&&(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Latency:`}),(0,r.jsxs)(`span`,{className:`font-medium`,style:{color:a(t.latency)},children:[t.latency,`ms`]})]}),t.provider&&(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Provider:`}),(0,r.jsx)(`span`,{className:`font-medium uppercase`,style:{color:s[t.provider]},children:t.provider})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Coords:`}),(0,r.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[t.location.lat.toFixed(2),`, `,t.location.lng.toFixed(2)]})]})]})]}):null})()})]})};exports.default=d;
|
|
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("react/jsx-runtime");var i=(e,t,n,r)=>{let i=(t+180)/360*n,a=e*Math.PI/180,o=Math.log(Math.tan(Math.PI/4+a/2)),s=r/2-o*r/(2*Math.PI);return{x:i,y:Math.max(0,Math.min(r,s))}},a=e=>e===void 0?`#6b7280`:e<50?`#22c55e`:e<100?`#eab308`:`#ef4444`,o={active:`#22c55e`,degraded:`#eab308`,offline:`#6b7280`},s={aws:`#ff9900`,gcp:`#4285f4`,azure:`#0078d4`,custom:`#8b5cf6`},c=({region:e,x:n,y:i,isSelected:c,isHovered:l,showLatency:u,animated:d,onClick:f,onMouseEnter:p,onMouseLeave:m})=>{let h=o[e.status],g=e.provider?s[e.provider]:`#6b7280`,_=a(e.latency),v=c?12:l?10:8;return(0,r.jsxs)(`g`,{transform:`translate(${n}, ${i})`,onClick:f,onMouseEnter:p,onMouseLeave:m,style:{cursor:`pointer`},role:`button`,"aria-label":`${e.name} - ${e.status}${e.latency?`, ${e.latency}ms`:``}`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f()},children:[d&&e.status===`active`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`circle`,{r:v+8,fill:`none`,stroke:h,strokeWidth:2,opacity:0,children:[(0,r.jsx)(`animate`,{attributeName:`r`,values:`${v};${v+20}`,dur:`2s`,repeatCount:`indefinite`}),(0,r.jsx)(`animate`,{attributeName:`opacity`,values:`0.6;0`,dur:`2s`,repeatCount:`indefinite`})]}),(0,r.jsxs)(`circle`,{r:v+4,fill:`none`,stroke:h,strokeWidth:1.5,opacity:0,children:[(0,r.jsx)(`animate`,{attributeName:`r`,values:`${v};${v+15}`,dur:`2s`,begin:`0.5s`,repeatCount:`indefinite`}),(0,r.jsx)(`animate`,{attributeName:`opacity`,values:`0.4;0`,dur:`2s`,begin:`0.5s`,repeatCount:`indefinite`})]})]}),c&&(0,r.jsx)(`circle`,{r:v+6,fill:`none`,stroke:`#3b82f6`,strokeWidth:2,strokeDasharray:`4 2`,className:`animate-spin`,style:{animationDuration:`8s`}}),(0,r.jsx)(`circle`,{r:v,fill:g,stroke:`white`,strokeWidth:2,opacity:.9,className:t.cn(`transition-all duration-200`,l&&`drop-shadow-lg`)}),(0,r.jsx)(`circle`,{r:v*.5,fill:h,stroke:`white`,strokeWidth:1}),u&&e.latency!==void 0&&(0,r.jsxs)(`g`,{transform:`translate(${v+4}, ${-v})`,children:[(0,r.jsx)(`rect`,{x:-2,y:-8,width:e.latency>=100?32:28,height:16,rx:4,fill:_,stroke:`white`,strokeWidth:1}),(0,r.jsxs)(`text`,{x:e.latency>=100?14:12,y:1,textAnchor:`middle`,dominantBaseline:`middle`,fill:`white`,fontSize:9,fontWeight:`bold`,children:[e.latency,`ms`]})]}),l&&(0,r.jsxs)(`g`,{transform:`translate(0, -30)`,children:[(0,r.jsx)(`rect`,{x:-60,y:-40,width:120,height:e.latency===void 0?38:52,rx:6,fill:`rgba(0,0,0,0.85)`,stroke:`rgba(255,255,255,0.2)`,strokeWidth:1}),(0,r.jsx)(`polygon`,{points:`-6,12 6,12 0,20`,fill:`rgba(0,0,0,0.85)`,transform:`translate(0, -40)`}),(0,r.jsx)(`text`,{y:-62,textAnchor:`middle`,fill:`white`,fontSize:11,fontWeight:`600`,children:e.name}),(0,r.jsx)(`text`,{y:-48,textAnchor:`middle`,fill:h,fontSize:10,children:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),e.latency!==void 0&&(0,r.jsxs)(`text`,{y:-34,textAnchor:`middle`,fill:_,fontSize:10,fontWeight:`500`,children:[`Latency: `,e.latency,`ms`]}),e.provider&&(0,r.jsx)(`text`,{y:e.latency===void 0?-34:-20,textAnchor:`middle`,fill:`#9ca3af`,fontSize:9,children:e.provider.toUpperCase()})]})]})},l=({userX:e,userY:t,regionX:n,regionY:i,latency:o,animated:s})=>{let c=a(o),l=`M ${e} ${t} Q ${(e+n)/2} ${(t+i)/2-20} ${n} ${i}`;return(0,r.jsxs)(`g`,{children:[(0,r.jsx)(`path`,{d:l,fill:`none`,stroke:c,strokeWidth:1.5,strokeOpacity:.6,strokeDasharray:s?`6 4`:void 0,children:s&&(0,r.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:`0`,to:`-20`,dur:`1s`,repeatCount:`indefinite`})}),s&&(0,r.jsx)(`circle`,{r:3,fill:c,children:(0,r.jsx)(`animateMotion`,{dur:`2s`,repeatCount:`indefinite`,path:l})})]})},u=({x:e,y:t,animated:n})=>(0,r.jsxs)(`g`,{transform:`translate(${e}, ${t})`,children:[n&&(0,r.jsxs)(`circle`,{r:8,fill:`none`,stroke:`#3b82f6`,strokeWidth:2,opacity:0,children:[(0,r.jsx)(`animate`,{attributeName:`r`,values:`8;25`,dur:`1.5s`,repeatCount:`indefinite`}),(0,r.jsx)(`animate`,{attributeName:`opacity`,values:`0.8;0`,dur:`1.5s`,repeatCount:`indefinite`})]}),(0,r.jsx)(`circle`,{r:10,fill:`#3b82f6`,stroke:`white`,strokeWidth:3}),(0,r.jsx)(`circle`,{r:4,fill:`white`}),(0,r.jsx)(`text`,{y:22,textAnchor:`middle`,fill:`#3b82f6`,fontSize:10,fontWeight:`600`,children:`You`})]}),d=({regions:e,userLocation:d,selectedRegion:f,onRegionSelect:p,showLatency:m=!0,showConnections:h=!1,animated:g=!0,className:_})=>{let v=n.useRef(null),[y,b]=n.useState(null),[x,S]=n.useState({width:800,height:400});n.useEffect(()=>{let e=()=>{if(v.current){let{width:e,height:t}=v.current.getBoundingClientRect();S({width:e||800,height:t||400})}};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let C=n.useMemo(()=>e.map(e=>({...e,...i(e.location.lat,e.location.lng,100,100)})),[e]),w=n.useMemo(()=>d?i(d.lat,d.lng,100,100):null,[d]);return(0,r.jsxs)(`div`,{ref:v,className:t.cn(`relative h-full w-full min-h-[300px] overflow-hidden rounded-lg border border-gray-200 bg-gradient-to-b from-slate-50 to-slate-100`,_),children:[(0,r.jsxs)(`svg`,{viewBox:`0 0 100 100`,preserveAspectRatio:`xMidYMid meet`,className:`h-full w-full`,"aria-label":`Cloud region map`,role:`img`,children:[(0,r.jsxs)(`defs`,{children:[(0,r.jsxs)(`linearGradient`,{id:`oceanGradient`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`#e0f2fe`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`#bae6fd`})]}),(0,r.jsxs)(`linearGradient`,{id:`landGradient`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`#f1f5f9`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`#e2e8f0`})]}),(0,r.jsx)(`filter`,{id:`dropShadow`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:(0,r.jsx)(`feDropShadow`,{dx:`0`,dy:`1`,stdDeviation:`1`,floodOpacity:`0.2`})}),(0,r.jsxs)(`filter`,{id:`glow`,x:`-50%`,y:`-50%`,width:`200%`,height:`200%`,children:[(0,r.jsx)(`feGaussianBlur`,{stdDeviation:`2`,result:`coloredBlur`}),(0,r.jsxs)(`feMerge`,{children:[(0,r.jsx)(`feMergeNode`,{in:`coloredBlur`}),(0,r.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,r.jsx)(`rect`,{x:`0`,y:`0`,width:`100`,height:`100`,fill:`url(#oceanGradient)`}),(0,r.jsxs)(`g`,{stroke:`#cbd5e1`,strokeWidth:`0.1`,opacity:`0.5`,children:[[10,20,30,40,50,60,70,80,90].map(e=>(0,r.jsx)(`line`,{x1:e,y1:`0`,x2:e,y2:`100`},`v-${e}`)),[10,20,30,40,50,60,70,80,90].map(e=>(0,r.jsx)(`line`,{x1:`0`,y1:e,x2:`100`,y2:e},`h-${e}`))]}),(0,r.jsxs)(`g`,{filter:`url(#dropShadow)`,children:[(0,r.jsx)(`path`,{d:`M 5,22 L 8,18 L 12,16 L 18,15 L 24,17 L 28,20 L 30,25 L 30,32 L 27,38 L 22,42 L 16,44 L 12,42 L 10,38 L 8,32 L 6,26 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 22,48 L 26,46 L 30,48 L 32,54 L 30,62 L 26,70 L 22,72 L 20,68 L 20,58 L 21,52 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 45,20 L 48,18 L 52,18 L 56,20 L 58,24 L 56,28 L 52,30 L 48,30 L 45,28 L 44,24 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 45,32 L 50,30 L 56,32 L 58,38 L 56,48 L 52,56 L 46,58 L 42,54 L 42,44 L 44,36 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 58,18 L 65,16 L 75,15 L 85,18 L 90,24 L 88,32 L 82,38 L 74,40 L 66,38 L 60,32 L 58,24 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`}),(0,r.jsx)(`path`,{d:`M 78,52 L 84,50 L 90,52 L 92,58 L 88,64 L 82,66 L 76,62 L 76,56 Z`,fill:`url(#landGradient)`,stroke:`#94a3b8`,strokeWidth:`0.3`})]}),h&&w&&(0,r.jsx)(`g`,{children:C.map(e=>(0,r.jsx)(l,{userX:w.x,userY:w.y,regionX:e.x,regionY:e.y,latency:e.latency,animated:g},`connection-${e.id}`))}),(0,r.jsx)(`g`,{children:C.map(e=>(0,r.jsx)(c,{region:e,x:e.x,y:e.y,isSelected:f===e.id,isHovered:y===e.id,showLatency:m,animated:g,onClick:()=>p?.(e.id),onMouseEnter:()=>b(e.id),onMouseLeave:()=>b(null)},e.id))}),w&&(0,r.jsx)(u,{x:w.x,y:w.y,animated:g})]}),(0,r.jsxs)(`div`,{className:`absolute bottom-3 left-3 rounded-lg border border-gray-200 bg-white/90 p-2.5 shadow-sm backdrop-blur-sm`,children:[(0,r.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold text-gray-700`,children:`Status`}),(0,r.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Object.entries(o).map(([e,t])=>(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:t}}),(0,r.jsx)(`span`,{className:`text-[10px] capitalize text-gray-600`,children:e})]},e))}),m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`mb-1.5 mt-2 text-[10px] font-semibold text-gray-700`,children:`Latency`}),(0,r.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-green-500`}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:`<50ms`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-yellow-500`}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:`<100ms`})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full bg-red-500`}),(0,r.jsx)(`span`,{className:`text-[10px] text-gray-600`,children:`>100ms`})]})]})]})]}),(0,r.jsxs)(`div`,{className:`absolute bottom-3 right-3 rounded-lg border border-gray-200 bg-white/90 p-2.5 shadow-sm backdrop-blur-sm`,children:[(0,r.jsx)(`div`,{className:`mb-1.5 text-[10px] font-semibold text-gray-700`,children:`Providers`}),(0,r.jsx)(`div`,{className:`flex flex-col gap-1`,children:Object.entries(s).map(([e,t])=>(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-full`,style:{backgroundColor:t}}),(0,r.jsx)(`span`,{className:`text-[10px] uppercase text-gray-600`,children:e})]},e))})]}),f&&(0,r.jsx)(`div`,{className:`absolute right-3 top-3 rounded-lg border border-blue-200 bg-white/95 p-3 shadow-md backdrop-blur-sm`,children:(()=>{let t=e.find(e=>e.id===f);return t?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`div`,{className:`mb-1 text-sm font-semibold text-gray-800`,children:t.name}),(0,r.jsxs)(`div`,{className:`space-y-0.5 text-xs text-gray-600`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Status:`}),(0,r.jsx)(`span`,{className:`font-medium capitalize`,style:{color:o[t.status]},children:t.status})]}),t.latency!==void 0&&(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Latency:`}),(0,r.jsxs)(`span`,{className:`font-medium`,style:{color:a(t.latency)},children:[t.latency,`ms`]})]}),t.provider&&(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Provider:`}),(0,r.jsx)(`span`,{className:`font-medium uppercase`,style:{color:s[t.provider]},children:t.provider})]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{className:`text-gray-400`,children:`Coords:`}),(0,r.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[t.location.lat.toFixed(2),`, `,t.location.lng.toFixed(2)]})]})]})]}):null})()})]})};exports.WakaRegionMap=d,exports.default=d;
|
|
@@ -1,6 +1,6 @@
|
|
|
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("react/jsx-runtime");var i={warning:70,danger:85},a={sm:{size:80,strokeWidth:6,fontSize:`text-sm`,labelSize:`text-xs`,unitSize:`text-[10px]`,sparklineHeight:16},md:{size:120,strokeWidth:8,fontSize:`text-xl`,labelSize:`text-sm`,unitSize:`text-xs`,sparklineHeight:24},lg:{size:180,strokeWidth:12,fontSize:`text-3xl`,labelSize:`text-base`,unitSize:`text-sm`,sparklineHeight:32}},o={full:{startAngle:0,endAngle:360,rotation:-90},semi:{startAngle:0,endAngle:180,rotation:-90},quarter:{startAngle:0,endAngle:90,rotation:-90}};function s(e,t,n,r){let i=(r-90)*Math.PI/180;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function c(e,t,n,r,i){let a=s(e,t,n,i),o=s(e,t,n,r),c=i-r<=180?`0`:`1`;return[`M`,a.x,a.y,`A`,n,n,0,c,0,o.x,o.y].join(` `)}function l(e,t){return e>=t.danger?{color:`#ef4444`,glowColor:`rgba(239, 68, 68, 0.6)`,zone:`danger`}:e>=t.warning?{color:`#eab308`,glowColor:`rgba(234, 179, 8, 0.4)`,zone:`warning`}:{color:`#22c55e`,glowColor:`rgba(34, 197, 94, 0.3)`,zone:`safe`}}function u({data:e,width:n,height:i,color:a,className:o}){if(e.length<2)return null;let s=Math.max(...e,100),c=Math.min(...e,0),l=s-c||1,u=`M ${e.map((t,r)=>`${r/(e.length-1)*n},${i-(t-c)/l*i}`).join(` L `)}`,d=`${u} L ${n},${i} L 0,${i} Z`;return(0,r.jsxs)(`svg`,{width:n,height:i,className:t.cn(`overflow-visible`,o),viewBox:`0 0 ${n} ${i}`,"aria-hidden":`true`,focusable:`false`,children:[(0,r.jsx)(`defs`,{children:(0,r.jsxs)(`linearGradient`,{id:`sparkline-gradient-${a}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:a,stopOpacity:`0.3`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:a,stopOpacity:`0`})]})}),(0,r.jsx)(`path`,{d,fill:`url(#sparkline-gradient-${a})`}),(0,r.jsx)(`path`,{d:u,fill:`none`,stroke:a,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}function d(e=0,t=100){let[r,i]=n.useState(e),[a,o]=n.useState([e]),s=n.useCallback(e=>{let n=Math.max(0,Math.min(t,e));i(n),o(e=>[...e,n].slice(-20))},[t]);return{value:r,percentage:r/t*100,history:a,updateValue:s,setValue:i,setHistory:o}}function f({value:e,max:d=100,label:f,unit:p=`%`,size:m=`md`,variant:h=`full`,thresholds:g=i,showValue:_=!0,showLabel:v=!0,animated:y=!0,glowOnDanger:b=!0,history:x,className:S,onChange:C}){let[w,T]=n.useState(0),[E,D]=n.useState(!1),O=n.useRef(void 0),k=a[m],A=o[h],j=d>0?Math.min(100,Math.max(0,e/d*100)):0,M=d>0?Math.min(100,Math.max(0,w/d*100)):0,{color:N,glowColor:P,zone:F}=l(j,g),I=k.size,L=I/2,R=(I-k.strokeWidth)/2,z=2*Math.PI*R,B=A.endAngle/360*z;M/100*B,n.useEffect(()=>{if(!y){T(e);return}let t=w,n=e-t,r=Date.now();D(!0);let i=()=>{let e=Date.now()-r,a=Math.min(e/800,1),o=1-(1-a)**3;T(t+n*o),a<1?O.current=requestAnimationFrame(i):D(!1)};return O.current=requestAnimationFrame(i),()=>{O.current&&cancelAnimationFrame(O.current)}},[e,y]);let V=c(L,L,R,0,A.endAngle-.01),H=c(L,L,R,0,M/100*A.endAngle||.01),U=b&&F===`danger`,W=Math.round(p===`%`?M:w),G=h===`full`?I:h===`semi`?I/2+k.strokeWidth:I;return(0,r.jsxs)(`div`,{className:t.cn(`inline-flex flex-col items-center gap-1`,S),children:[(0,r.jsxs)(`div`,{className:`relative`,style:{width:I,height:G,overflow:`visible`},children:[U&&(0,r.jsx)(`div`,{className:t.cn(`absolute inset-0 rounded-full blur-xl transition-opacity duration-500`,E?`opacity-50`:`animate-pulse`),style:{background:`radial-gradient(circle, ${P} 0%, transparent 70%)`}}),(0,r.jsxs)(`svg`,{width:I,height:I,viewBox:`0 0 ${I} ${I}`,className:`overflow-visible`,style:{transform:`rotate(${A.rotation}deg)`},"aria-hidden":`true`,focusable:`false`,children:[(0,r.jsxs)(`defs`,{children:[(0,r.jsxs)(`linearGradient`,{id:`gauge-gradient-${m}-${h}`,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:N,stopOpacity:`0.8`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:N,stopOpacity:`1`})]}),(0,r.jsx)(`filter`,{id:`gauge-shadow-${m}-${h}`,x:`-20%`,y:`-20%`,width:`140%`,height:`140%`,children:(0,r.jsx)(`feDropShadow`,{dx:`0`,dy:`0`,stdDeviation:`3`,floodColor:N,floodOpacity:`0.5`})})]}),(0,r.jsx)(`path`,{d:V,fill:`none`,stroke:`currentColor`,strokeWidth:k.strokeWidth,strokeLinecap:`round`,className:`text-muted opacity-20`}),h===`full`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`path`,{d:c(L,L,R,g.warning/100*360,g.danger/100*360),fill:`none`,stroke:`#eab308`,strokeWidth:k.strokeWidth,strokeLinecap:`round`,className:`opacity-10`}),(0,r.jsx)(`path`,{d:c(L,L,R,g.danger/100*360,360),fill:`none`,stroke:`#ef4444`,strokeWidth:k.strokeWidth,strokeLinecap:`round`,className:`opacity-10`})]}),(0,r.jsx)(`path`,{d:H,fill:`none`,stroke:`url(#gauge-gradient-${m}-${h})`,strokeWidth:k.strokeWidth,strokeLinecap:`round`,filter:U?`url(#gauge-shadow-${m}-${h})`:void 0,className:t.cn(y&&`transition-all duration-300 ease-out`)}),M>0&&(0,r.jsx)(`circle`,{cx:s(L,L,R,M/100*A.endAngle).x,cy:s(L,L,R,M/100*A.endAngle).y,r:k.strokeWidth/3,fill:`white`,className:t.cn(`transition-all duration-300`,U&&`animate-pulse`)})]}),(_||v)&&(0,r.jsxs)(`div`,{className:t.cn(`absolute inset-0 flex flex-col items-center justify-center`,h===`semi`&&`top-auto bottom-0 pb-1`),style:{height:h===`semi`?I/2:void 0,top:h===`semi`?`auto`:void 0},children:[_&&(0,r.jsxs)(`div`,{className:`flex items-baseline gap-0.5`,children:[(0,r.jsx)(`span`,{className:t.cn(`font-bold tabular-nums transition-colors duration-300`,k.fontSize),style:{color:N},children:W}),p&&(0,r.jsx)(`span`,{className:t.cn(`font-medium text-muted-foreground`,k.unitSize),children:p})]}),v&&f&&h===`full`&&(0,r.jsx)(`span`,{className:t.cn(`text-muted-foreground mt-0.5`,k.labelSize),children:f})]})]}),v&&f&&h!==`full`&&(0,r.jsx)(`span`,{className:t.cn(`text-muted-foreground text-center`,k.labelSize),children:f}),x&&x.length>1&&(0,r.jsx)(`div`,{className:`mt-1`,children:(0,r.jsx)(u,{data:x,width:k.size*.8,height:k.sparklineHeight,color:N})}),(0,r.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes gauge-pulse {
|
|
3
3
|
0%, 100% { opacity: 0.6; }
|
|
4
4
|
50% { opacity: 1; }
|
|
5
5
|
}
|
|
6
|
-
`})]})}function p({label:e=`CPU`,...t}){return(0,r.jsx)(f,{label:e,unit:`%`,...t})}function m({label:e=`RAM`,max:t=100,unit:n=`GB`,...i}){return(0,r.jsx)(f,{label:e,max:t,unit:n,...i})}function h({label:e=`Storage`,max:t=100,unit:n=`GB`,...i}){return(0,r.jsx)(f,{label:e,max:t,unit:n,...i})}function g({label:e=`Network`,max:t=100,unit:n=`Mbps`,...i}){return(0,r.jsx)(f,{label:e,max:t,unit:n,thresholds:{warning:60,danger:80},...i})}function _({gauges:e,direction:n=`horizontal`,gap:i=`md`,className:a}){return(0,r.jsx)(`div`,{className:t.cn(`flex flex-wrap items-center justify-center`,n===`vertical`&&`flex-col`,{sm:`gap-2`,md:`gap-4`,lg:`gap-8`}[i],a),children:e.map(e=>(0,r.jsx)(f,{...e},e.id))})}exports.WakaCpuGauge=p,exports.WakaNetworkGauge=g,exports.WakaRamGauge=m,exports.WakaResourceGaugeGroup=_,exports.WakaStorageGauge=h,exports.
|
|
6
|
+
`})]})}function p({label:e=`CPU`,...t}){return(0,r.jsx)(f,{label:e,unit:`%`,...t})}function m({label:e=`RAM`,max:t=100,unit:n=`GB`,...i}){return(0,r.jsx)(f,{label:e,max:t,unit:n,...i})}function h({label:e=`Storage`,max:t=100,unit:n=`GB`,...i}){return(0,r.jsx)(f,{label:e,max:t,unit:n,...i})}function g({label:e=`Network`,max:t=100,unit:n=`Mbps`,...i}){return(0,r.jsx)(f,{label:e,max:t,unit:n,thresholds:{warning:60,danger:80},...i})}function _({gauges:e,direction:n=`horizontal`,gap:i=`md`,className:a}){return(0,r.jsx)(`div`,{className:t.cn(`flex flex-wrap items-center justify-center`,n===`vertical`&&`flex-col`,{sm:`gap-2`,md:`gap-4`,lg:`gap-8`}[i],a),children:e.map(e=>(0,r.jsx)(f,{...e},e.id))})}exports.WakaCpuGauge=p,exports.WakaNetworkGauge=g,exports.WakaRamGauge=m,exports.WakaResourceGauge=f,exports.default=f,exports.WakaResourceGaugeGroup=_,exports.WakaStorageGauge=h,exports.useResourceGauge=d;
|
|
@@ -153,8 +153,8 @@ function p({ value: f, max: p = 100, label: m, unit: h = "%", size: g = "md", va
|
|
|
153
153
|
let e = E, t = f - e, n = Date.now();
|
|
154
154
|
k(!0);
|
|
155
155
|
let r = () => {
|
|
156
|
-
let i = Date.now() - n, a = Math.min(i / 800, 1);
|
|
157
|
-
D(e + t *
|
|
156
|
+
let i = Date.now() - n, a = Math.min(i / 800, 1), o = 1 - (1 - a) ** 3;
|
|
157
|
+
D(e + t * o), a < 1 ? A.current = requestAnimationFrame(r) : k(!1);
|
|
158
158
|
};
|
|
159
159
|
return A.current = requestAnimationFrame(r), () => {
|
|
160
160
|
A.current && cancelAnimationFrame(A.current);
|
|
@@ -341,4 +341,4 @@ function v({ gauges: t, direction: n = "horizontal", gap: i = "md", className: a
|
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
//#endregion
|
|
344
|
-
export { m as WakaCpuGauge, _ as WakaNetworkGauge, h as WakaRamGauge,
|
|
344
|
+
export { m as WakaCpuGauge, _ as WakaNetworkGauge, h as WakaRamGauge, p as WakaResourceGauge, p as default, v as WakaResourceGaugeGroup, g as WakaStorageGauge, f as useResourceGauge };
|
|
@@ -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={compute:{color:`bg-blue-500`,lightColor:`bg-blue-100`,textColor:`text-blue-600`,borderColor:`border-blue-500`,gradient:`from-blue-500 to-blue-600`,icon:r.Cpu},memory:{color:`bg-purple-500`,lightColor:`bg-purple-100`,textColor:`text-purple-600`,borderColor:`border-purple-500`,gradient:`from-purple-500 to-purple-600`,icon:r.MemoryStick},storage:{color:`bg-amber-500`,lightColor:`bg-amber-100`,textColor:`text-amber-600`,borderColor:`border-amber-500`,gradient:`from-amber-500 to-amber-600`,icon:r.HardDrive},network:{color:`bg-emerald-500`,lightColor:`bg-emerald-100`,textColor:`text-emerald-600`,borderColor:`border-emerald-500`,gradient:`from-emerald-500 to-emerald-600`,icon:r.Network}};function o(e){return Math.min(100,(e.used+(e.reserved||0))/e.total*100)}function s(e){return Math.min(100,e.used/e.total*100)}function c(e){return Math.min(100,(e.reserved||0)/e.total*100)}function l(e,t=80){return o(e)>=t}function u(e,t=95){return o(e)>=t}function d({pool:e,animated:r=!0,onBlockClick:o,draggable:s}){let c=a[e.type||`compute`],l=Math.min(20,e.total),u=e.total/l,d=Math.round(e.used/u),f=Math.round((e.reserved||0)/u),p=l-d-f,[m,h]=n.useState(null),g=(t,n,r)=>{t.dataTransfer.setData(`blockIndex`,n.toString()),t.dataTransfer.setData(`blockType`,r),t.dataTransfer.setData(`poolId`,e.id)},_=(e,t)=>{e.preventDefault(),h(t)},v=()=>{h(null)},y=(t,n,r)=>{t.preventDefault(),h(null);let i=t.dataTransfer.getData(`blockType`);t.dataTransfer.getData(`poolId`)===e.id&&i!==r&&(i===`available`&&r===`used`?o?.(n,!1):i===`used`&&r===`available`&&o?.(n,!0))};return(0,i.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[Array.from({length:d}).map((e,n)=>(0,i.jsx)(`div`,{draggable:s,onDragStart:e=>g(e,n,`used`),onDragOver:e=>_(e,n),onDragLeave:v,onDrop:e=>y(e,n,`used`),onClick:()=>o?.(n,!0),className:t.cn(`h-6 w-6 rounded-sm cursor-pointer transition-all`,c.color,`hover:opacity-80 hover:scale-105`,r&&`animate-block-appear`,m===n&&`ring-2 ring-white ring-offset-2`,s&&`cursor-grab active:cursor-grabbing`),style:{animationDelay:r?`${n*30}ms`:void 0}},`used-${n}`)),Array.from({length:f}).map((e,n)=>(0,i.jsx)(`div`,{className:t.cn(`h-6 w-6 rounded-sm relative overflow-hidden`,c.lightColor,`border-2`,c.borderColor,r&&`animate-block-appear`),style:{animationDelay:r?`${(d+n)*30}ms`:void 0},children:(0,i.jsx)(`div`,{className:t.cn(`absolute inset-0 opacity-50`,c.color),style:{backgroundImage:`repeating-linear-gradient(
|
|
2
2
|
45deg,
|
|
3
3
|
transparent,
|
|
4
4
|
transparent 3px,
|
|
@@ -51,4 +51,4 @@
|
|
|
51
51
|
transparent 2px,
|
|
52
52
|
rgba(0,0,0,0.1) 2px,
|
|
53
53
|
rgba(0,0,0,0.1) 4px
|
|
54
|
-
)`}}),(0,i.jsx)(`span`,{children:`Reserved`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,i.jsx)(`div`,{className:`h-3 w-3 rounded-sm bg-muted border border-muted-foreground/20`}),(0,i.jsx)(`span`,{children:`Available`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground ml-auto`,children:[(0,i.jsx)(r.AlertTriangle,{className:`h-3 w-3 text-amber-500`}),(0,i.jsx)(`span`,{children:`Near Capacity (80%+)`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,i.jsx)(r.AlertTriangle,{className:`h-3 w-3 text-red-500`}),(0,i.jsx)(`span`,{children:`Critical (95%+)`})]})]})]})}function _({initialPools:e,onPoolChange:t}){let[r,i]=n.useState(e);return{pools:r,setPools:i,allocate:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=t.total-t.used-(t.reserved||0),i=Math.min(n,r);return{...t,used:t.used+i}});return t?.(i),i})},[t]),release:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=Math.min(n,t.used);return{...t,used:t.used-r}});return t?.(i),i})},[t]),reserve:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=t.total-t.used-(t.reserved||0),i=Math.min(n,r);return{...t,reserved:(t.reserved||0)+i}});return t?.(i),i})},[t]),unreserve:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=Math.min(n,t.reserved||0);return{...t,reserved:(t.reserved||0)-r}});return t?.(i),i})},[t]),getPool:n.useCallback(e=>r.find(t=>t.id===e),[r]),getPoolStats:n.useCallback(e=>{let t=r.find(t=>t.id===e);if(!t)return null;let n=e=>t.total>0?e/t.total*100:0;return{used:t.used,reserved:t.reserved||0,available:t.total-t.used-(t.reserved||0),total:t.total,usedPercent:n(t.used),reservedPercent:n(t.reserved||0),availablePercent:n(t.total-t.used-(t.reserved||0)),isNearCapacity:l(t),isCritical:u(t)}},[r]),getTotalStats:n.useCallback(()=>{let e=r.reduce((e,t)=>({used:e.used+t.used,reserved:e.reserved+(t.reserved||0),total:e.total+t.total}),{used:0,reserved:0,total:0});return{...e,available:e.total-e.used-e.reserved,usedPercent:e.used/e.total*100,reservedPercent:e.reserved/e.total*100,availablePercent:(e.total-e.used-e.reserved)/e.total*100}},[r])}}exports.
|
|
54
|
+
)`}}),(0,i.jsx)(`span`,{children:`Reserved`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,i.jsx)(`div`,{className:`h-3 w-3 rounded-sm bg-muted border border-muted-foreground/20`}),(0,i.jsx)(`span`,{children:`Available`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground ml-auto`,children:[(0,i.jsx)(r.AlertTriangle,{className:`h-3 w-3 text-amber-500`}),(0,i.jsx)(`span`,{children:`Near Capacity (80%+)`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,i.jsx)(r.AlertTriangle,{className:`h-3 w-3 text-red-500`}),(0,i.jsx)(`span`,{children:`Critical (95%+)`})]})]})]})}function _({initialPools:e,onPoolChange:t}){let[r,i]=n.useState(e);return{pools:r,setPools:i,allocate:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=t.total-t.used-(t.reserved||0),i=Math.min(n,r);return{...t,used:t.used+i}});return t?.(i),i})},[t]),release:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=Math.min(n,t.used);return{...t,used:t.used-r}});return t?.(i),i})},[t]),reserve:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=t.total-t.used-(t.reserved||0),i=Math.min(n,r);return{...t,reserved:(t.reserved||0)+i}});return t?.(i),i})},[t]),unreserve:n.useCallback((e,n)=>{i(r=>{let i=r.map(t=>{if(t.id!==e)return t;let r=Math.min(n,t.reserved||0);return{...t,reserved:(t.reserved||0)-r}});return t?.(i),i})},[t]),getPool:n.useCallback(e=>r.find(t=>t.id===e),[r]),getPoolStats:n.useCallback(e=>{let t=r.find(t=>t.id===e);if(!t)return null;let n=e=>t.total>0?e/t.total*100:0;return{used:t.used,reserved:t.reserved||0,available:t.total-t.used-(t.reserved||0),total:t.total,usedPercent:n(t.used),reservedPercent:n(t.reserved||0),availablePercent:n(t.total-t.used-(t.reserved||0)),isNearCapacity:l(t),isCritical:u(t)}},[r]),getTotalStats:n.useCallback(()=>{let e=r.reduce((e,t)=>({used:e.used+t.used,reserved:e.reserved+(t.reserved||0),total:e.total+t.total}),{used:0,reserved:0,total:0});return{...e,available:e.total-e.used-e.reserved,usedPercent:e.used/e.total*100,reservedPercent:e.reserved/e.total*100,availablePercent:(e.total-e.used-e.reserved)/e.total*100}},[r])}}exports.WakaResourcePool=h,exports.default=h,exports.WakaResourcePoolComparison=g,exports.useResourcePool=_;
|
|
@@ -601,4 +601,4 @@ function w({ initialPools: e, onPoolChange: n }) {
|
|
|
601
601
|
};
|
|
602
602
|
}
|
|
603
603
|
//#endregion
|
|
604
|
-
export {
|
|
604
|
+
export { S as WakaResourcePool, S as default, C as WakaResourcePoolComparison, w as useResourcePool };
|
|
@@ -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("../button/index.cjs.js"),r=require("../label/index.cjs.js"),i=require("../input/index.cjs.js"),a=require("../popover/index.cjs.js"),o=require("../separator/index.cjs.js"),s=require("../textarea/index.cjs.js");let c=require("react");c=e.__toESM(c);let l=require("lucide-react"),u=require("react/jsx-runtime");var d=[[`bold`,`italic`,`underline`,`strike`],[`h1`,`h2`,`h3`],[`bulletList`,`orderedList`,`blockquote`],[`link`,`code`],[`undo`,`redo`]],f=c.forwardRef(({value:e=``,onChange:t,toolbar:n=d,placeholder:r=`Écrivez ici...`,maxLength:i,showCharacterCount:a=!1,minHeight:o=200,disabled:s=!1,error:l,className:f,label:m,description:g,editable:_=!0,immediatelyRender:v=!1},y)=>{let[b,x]=c.useState(null),[S,C]=c.useState(null),[w,T]=c.useState(null),[E,D]=c.useState(``);return c.useEffect(()=>{(async()=>{try{let[{useEditor:e,EditorContent:t},{default:n},{default:r},{default:i},{default:a}]=await Promise.all([import(`@tiptap/react`),import(`@tiptap/starter-kit`),import(`@tiptap/extension-underline`),import(`@tiptap/extension-link`),import(`@tiptap/extension-text-align`)]);C({useEditor:e,EditorContent:t,StarterKit:n,Underline:r,Link:i,TextAlign:a}),x(!0)}catch{x(!1)}})()},[]),b&&S?(0,u.jsx)(p,{ref:y,components:S,value:e,onChange:t,toolbar:n,placeholder:r,maxLength:i,showCharacterCount:a,minHeight:o,disabled:s,error:l,className:f,label:m,description:g,editable:_,immediatelyRender:v,linkUrl:E,setLinkUrl:D,editor:w,setEditor:T}):(0,u.jsx)(h,{ref:y,value:e,onChange:t,placeholder:r,maxLength:i,showCharacterCount:a,minHeight:o,disabled:s,error:l,className:f,label:m,description:g,loading:b===null})});f.displayName=`WakaRichTextEditor`;var p=c.forwardRef(({components:e,value:n,onChange:i,toolbar:a,placeholder:s,maxLength:l,showCharacterCount:d,minHeight:f,disabled:p,error:h,className:g,label:_,description:v,editable:y,immediatelyRender:b=!1,linkUrl:x,setLinkUrl:S,setEditor:C},w)=>{let{useEditor:T,EditorContent:E,StarterKit:D,Underline:O,Link:k,TextAlign:A}=e,j=T({extensions:[D.configure({heading:{levels:[1,2,3]}}),O,k.configure({openOnClick:!1}),A.configure({types:[`heading`,`paragraph`]})],content:n,editable:y&&!p,immediatelyRender:b,onUpdate:({editor:e})=>{let t=e.getHTML();(!l||t.length<=l)&&i?.(t)}});c.useEffect(()=>{C(j)},[j,C]),c.useEffect(()=>{j&&n!==j.getHTML()&&j.commands?.setContent?.(n||``,!1)},[n,j]);let M=()=>{j&&(x?j.chain().focus().setLink({href:x}).run():j.chain().focus().unsetLink().run(),S(``))},N=j?.storage?.characterCount?.characters?.()??n?.replace(/<[^>]*>/g,``).length??0;return(0,u.jsxs)(`div`,{ref:w,className:t.cn(`space-y-1.5`,g),children:[_&&(0,u.jsx)(r.Label,{children:_}),v&&(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:v}),(0,u.jsxs)(`div`,{className:t.cn(`border rounded-lg overflow-hidden`,h&&`border-destructive`),children:[j&&a&&(0,u.jsx)(`div`,{className:`flex flex-wrap items-center gap-0.5 p-1 border-b bg-muted/30`,children:a.map((e,t)=>(0,u.jsxs)(c.Fragment,{children:[t>0&&(0,u.jsx)(o.Separator,{orientation:`vertical`,className:`mx-1 h-6`}),e.map(e=>(0,u.jsx)(m,{button:e,editor:j,linkUrl:x,setLinkUrl:S,handleSetLink:M},e))]},t))}),(0,u.jsx)(`div`,{style:{minHeight:f},children:(0,u.jsx)(E,{editor:j,className:t.cn(`prose prose-sm max-w-none p-3 focus-within:outline-none h-full`,`[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[inherit]`)})}),d&&(0,u.jsxs)(`div`,{className:`flex justify-end p-1.5 border-t bg-muted/30 text-xs text-muted-foreground`,children:[N,l&&` / ${l}`,` caractères`]})]}),h&&(0,u.jsx)(`p`,{className:`text-sm text-destructive`,children:h})]})});p.displayName=`TiptapEditorComponent`;function m({button:e,editor:t,linkUrl:r,setLinkUrl:o,handleSetLink:s}){let{icon:c,action:d,isActive:f}={bold:{icon:(0,u.jsx)(l.Bold,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleBold().run(),isActive:()=>t.isActive(`bold`)},italic:{icon:(0,u.jsx)(l.Italic,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleItalic().run(),isActive:()=>t.isActive(`italic`)},underline:{icon:(0,u.jsx)(l.Underline,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleUnderline().run(),isActive:()=>t.isActive(`underline`)},strike:{icon:(0,u.jsx)(l.Strikethrough,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleStrike().run(),isActive:()=>t.isActive(`strike`)},h1:{icon:(0,u.jsx)(l.Heading1,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleHeading({level:1}).run(),isActive:()=>t.isActive(`heading`,{level:1})},h2:{icon:(0,u.jsx)(l.Heading2,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleHeading({level:2}).run(),isActive:()=>t.isActive(`heading`,{level:2})},h3:{icon:(0,u.jsx)(l.Heading3,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleHeading({level:3}).run(),isActive:()=>t.isActive(`heading`,{level:3})},bulletList:{icon:(0,u.jsx)(l.List,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleBulletList().run(),isActive:()=>t.isActive(`bulletList`)},orderedList:{icon:(0,u.jsx)(l.ListOrdered,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleOrderedList().run(),isActive:()=>t.isActive(`orderedList`)},blockquote:{icon:(0,u.jsx)(l.Quote,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleBlockquote().run(),isActive:()=>t.isActive(`blockquote`)},code:{icon:(0,u.jsx)(l.Code,{className:`h-4 w-4`}),action:()=>t.chain().focus().toggleCodeBlock().run(),isActive:()=>t.isActive(`codeBlock`)},link:{icon:(0,u.jsx)(l.Link,{className:`h-4 w-4`}),action:()=>{},isActive:()=>t.isActive(`link`)},alignLeft:{icon:(0,u.jsx)(l.AlignLeft,{className:`h-4 w-4`}),action:()=>t.chain().focus().setTextAlign(`left`).run(),isActive:()=>t.isActive({textAlign:`left`})},alignCenter:{icon:(0,u.jsx)(l.AlignCenter,{className:`h-4 w-4`}),action:()=>t.chain().focus().setTextAlign(`center`).run(),isActive:()=>t.isActive({textAlign:`center`})},alignRight:{icon:(0,u.jsx)(l.AlignRight,{className:`h-4 w-4`}),action:()=>t.chain().focus().setTextAlign(`right`).run(),isActive:()=>t.isActive({textAlign:`right`})},undo:{icon:(0,u.jsx)(l.Undo,{className:`h-4 w-4`}),action:()=>t.chain().focus().undo().run()},redo:{icon:(0,u.jsx)(l.Redo,{className:`h-4 w-4`}),action:()=>t.chain().focus().redo().run()}}[e];return e===`link`?(0,u.jsxs)(a.Popover,{children:[(0,u.jsx)(a.PopoverTrigger,{asChild:!0,children:(0,u.jsx)(n.Button,{type:`button`,variant:f?.()?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,children:c})}),(0,u.jsx)(a.PopoverContent,{className:`w-64 p-2`,children:(0,u.jsxs)(`div`,{className:`flex gap-2`,children:[(0,u.jsx)(i.Input,{value:r,onChange:e=>o(e.target.value),placeholder:`https://...`,className:`h-8`}),(0,u.jsx)(n.Button,{size:`sm`,onClick:s,children:`OK`})]})})]}):(0,u.jsx)(n.Button,{type:`button`,variant:f?.()?`secondary`:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:d,children:c})}var h=c.forwardRef(({value:e,onChange:n,placeholder:i,maxLength:a,showCharacterCount:o,minHeight:c,disabled:l,error:d,className:f,label:p,description:m,loading:h},g)=>(0,u.jsxs)(`div`,{ref:g,className:t.cn(`space-y-1.5`,f),children:[p&&(0,u.jsx)(r.Label,{children:p}),m&&(0,u.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:m}),(0,u.jsxs)(`div`,{className:`relative`,children:[(0,u.jsx)(s.Textarea,{value:e,onChange:e=>n?.(e.target.value),placeholder:i,maxLength:a,disabled:l||h,style:{minHeight:c},className:t.cn(d&&`border-destructive`)}),h&&(0,u.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-background/50`,children:(0,u.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Chargement...`})})]}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between`,children:[d&&(0,u.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),o&&(0,u.jsxs)(`p`,{className:`text-xs text-muted-foreground ml-auto`,children:[e?.length||0,a&&` / ${a}`,` caractères`]})]})]}));h.displayName=`FallbackEditor`,exports.WakaRichTextEditor=f,exports.default=f;
|
|
@@ -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={healthy:{icon:r.CheckCircle2,color:`text-green-500`,bgColor:`bg-green-500/10`,borderColor:`border-green-500/50`,pulseColor:`bg-green-500`,label:`Healthy`},degraded:{icon:r.AlertTriangle,color:`text-amber-500`,bgColor:`bg-amber-500/10`,borderColor:`border-amber-500/50`,pulseColor:`bg-amber-500`,label:`Degraded`},unhealthy:{icon:r.XCircle,color:`text-red-500`,bgColor:`bg-red-500/10`,borderColor:`border-red-500/50`,pulseColor:`bg-red-500`,label:`Unhealthy`},unknown:{icon:r.Activity,color:`text-gray-500`,bgColor:`bg-gray-500/10`,borderColor:`border-gray-500/50`,pulseColor:`bg-gray-500`,label:`Unknown`}};function o(e){let t=Math.floor((new Date().getTime()-e.getTime())/1e3);if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<7?`${i}d ago`:e.toLocaleDateString()}function s(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}function c(e){return e.length>7?e.slice(0,7):e}function l({health:e,size:n=`md`,showPulse:r=!1}){let o=a[e],s={sm:`h-2 w-2`,md:`h-3 w-3`};return(0,i.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,i.jsx)(`div`,{className:t.cn(`rounded-full`,s[n],o.pulseColor)}),r&&e===`healthy`&&(0,i.jsx)(`div`,{className:t.cn(`absolute rounded-full animate-ping opacity-75`,s[n],o.pulseColor)})]})}function u({version:e,index:n,isSelected:r,isActive:o,totalVersions:s,onSelect:c,draggable:u}){let d=a[e.health],f=d.icon;return(0,i.jsxs)(`button`,{type:`button`,onClick:()=>c(n),className:t.cn(`relative flex flex-col items-center gap-1 transition-all duration-300`,`focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2`,`group`),"aria-label":`Version ${e.version}${o?` (current)`:``}`,children:[(0,i.jsxs)(`div`,{className:t.cn(`relative h-10 w-10 rounded-full flex items-center justify-center`,`border-2 transition-all duration-300`,r?`border-primary bg-primary/10 scale-125 shadow-lg`:o?`border-primary/50 bg-primary/5`:`border-border bg-card hover:border-primary/30 hover:bg-muted`,d.bgColor),children:[(0,i.jsx)(f,{className:t.cn(`h-4 w-4`,d.color)}),o&&(0,i.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-primary animate-pulse`}),r&&!o&&(0,i.jsx)(`div`,{className:`absolute -inset-1 rounded-full border-2 border-dashed border-primary/50 animate-spin-slow`})]}),(0,i.jsxs)(`span`,{className:t.cn(`text-xs font-mono transition-colors duration-200`,r?`text-primary font-semibold`:o?`text-foreground font-medium`:`text-muted-foreground group-hover:text-foreground`),children:[`v`,e.version]}),(0,i.jsx)(`div`,{className:`absolute -top-1 -right-1`,children:(0,i.jsx)(l,{health:e.health,size:`sm`,showPulse:o})}),o&&(0,i.jsx)(`span`,{className:`absolute -bottom-5 text-[10px] font-medium text-primary bg-primary/10 px-1.5 py-0.5 rounded`,children:`LIVE`})]})}function d({version:e,isActive:n}){let l=a[e.health],u=l.icon;return(0,i.jsxs)(`div`,{className:t.cn(`p-4 rounded-lg border bg-card transition-all duration-300`,`animate-in fade-in slide-in-from-bottom-2`),children:[(0,i.jsxs)(`div`,{className:`flex items-start justify-between mb-3`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsxs)(`h4`,{className:`font-semibold text-lg`,children:[`v`,e.version]}),n&&(0,i.jsx)(`span`,{className:`text-xs font-medium text-primary bg-primary/10 px-2 py-0.5 rounded-full`,children:`Current`})]}),e.commitMessage&&(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1 line-clamp-2`,children:e.commitMessage})]}),(0,i.jsxs)(`div`,{className:t.cn(`flex items-center gap-1.5 px-2 py-1 rounded-full text-xs font-medium`,l.bgColor,l.color),children:[(0,i.jsx)(u,{className:`h-3 w-3`}),l.label]})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-sm`,children:[e.commit&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,i.jsx)(r.GitCommit,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{className:`font-mono`,children:c(e.commit)})]}),e.deployedBy&&(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,i.jsx)(r.User,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:e.deployedBy})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground col-span-2`,children:[(0,i.jsx)(r.Clock,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:s(e.deployedAt)}),(0,i.jsxs)(`span`,{className:`text-xs`,children:[`(`,o(e.deployedAt),`)`]})]})]})]})}function f({version:e,onConfirm:n,onCancel:a}){return(0,i.jsx)(`div`,{className:t.cn(`fixed inset-0 z-50 flex items-center justify-center`,`bg-black/50 backdrop-blur-sm`,`animate-in fade-in duration-200`),onClick:a,children:(0,i.jsxs)(`div`,{className:t.cn(`relative bg-card border rounded-xl shadow-xl p-6 max-w-md w-full mx-4`,`animate-in zoom-in-95 duration-200`),onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`button`,{type:`button`,onClick:a,className:`absolute top-4 right-4 p-1 rounded-md hover:bg-muted transition-colors`,children:(0,i.jsx)(r.X,{className:`h-4 w-4`})}),(0,i.jsx)(`div`,{className:`flex items-center justify-center w-12 h-12 rounded-full bg-amber-500/10 mb-4`,children:(0,i.jsx)(r.AlertCircle,{className:`h-6 w-6 text-amber-500`})}),(0,i.jsx)(`h3`,{className:`text-lg font-semibold mb-2`,children:`Confirm Rollback`}),(0,i.jsxs)(`p`,{className:`text-muted-foreground mb-4`,children:[`Are you sure you want to rollback to version`,` `,(0,i.jsxs)(`span`,{className:`font-mono font-semibold text-foreground`,children:[`v`,e.version]}),`? This action will replace the current deployment.`]}),(0,i.jsxs)(`div`,{className:`bg-muted/50 rounded-lg p-3 mb-6`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,i.jsx)(r.GitCommit,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{className:`font-mono`,children:e.commit?c(e.commit):`N/A`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-sm mt-1`,children:[(0,i.jsx)(r.Clock,{className:`h-4 w-4 text-muted-foreground`}),(0,i.jsx)(`span`,{children:o(e.deployedAt)})]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:a,className:t.cn(`flex-1 px-4 py-2 rounded-lg border font-medium`,`hover:bg-muted transition-colors`),children:`Cancel`}),(0,i.jsxs)(`button`,{type:`button`,onClick:n,className:t.cn(`flex-1 px-4 py-2 rounded-lg font-medium`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`,`flex items-center justify-center gap-2`),children:[(0,i.jsx)(r.RotateCcw,{className:`h-4 w-4`}),`Rollback`]})]})]})})}function p(e={}){let{initialVersions:t=[],initialSelectedIndex:r,onSelectionChange:i}=e,[a,o]=n.useState(t),[s,c]=n.useState(()=>{if(r!==void 0)return r;let e=t.findIndex(e=>e.isActive);return e>=0?e:0}),[l,u]=n.useState(!1),d=a[s]||null,f=a.find(e=>e.isActive)||null,p=a.findIndex(e=>e.isActive),m=s!==p&&p>=0,h=n.useCallback(e=>{if(e>=0&&e<a.length){c(e);let t=a[e];t&&i?.(t,e)}},[a,i]),g=n.useCallback(()=>{let e=Math.min(s+1,a.length-1);h(e)},[s,a.length,h]),_=n.useCallback(()=>{let e=Math.max(s-1,0);h(e)},[s,h]),v=n.useCallback(()=>{m&&u(!0)},[m]),y=n.useCallback(()=>{u(!1)},[]),b=n.useCallback(()=>{p>=0&&h(p)},[p,h]);return n.useEffect(()=>{t.length>0&&a.length===0&&o(t)},[t,a.length]),{versions:a,setVersions:o,selectedIndex:s,selectedVersion:d,selectVersion:h,selectNext:g,selectPrevious:_,activeVersion:f,hasChanges:m,isConfirming:l,openConfirmation:v,closeConfirmation:y,resetSelection:b}}function m({versions:e,selectedIndex:a,onVersionSelect:o,onRollbackConfirm:s,onRollbackCancel:c,draggable:l=!0,showDetails:p=!0,className:m}){let h=n.useRef(null),g=n.useRef(null),[_,v]=n.useState(!1),[y,b]=n.useState(0),[x,S]=n.useState(0),C=e.findIndex(e=>e.isActive),[w,T]=n.useState(a??(C>=0?C:0)),[E,D]=n.useState(!1),O=a??w,k=e[O]||null,A=O!==C&&C>=0,j=t=>{a===void 0&&T(t);let n=e[t];n&&o?.(n,t)};return n.useEffect(()=>{if(g.current){let e=O*100-g.current.clientWidth/2+100/2;g.current.scrollTo({left:Math.max(0,e),behavior:`smooth`})}},[O]),e.length===0?(0,i.jsx)(`div`,{className:t.cn(`p-8 text-center text-muted-foreground`,m),children:`No deployment versions available`}):(0,i.jsxs)(`div`,{ref:h,className:t.cn(`w-full`,m),onKeyDown:t=>{switch(t.key){case`ArrowLeft`:t.preventDefault(),j(Math.max(O-1,0));break;case`ArrowRight`:t.preventDefault(),j(Math.min(O+1,e.length-1));break;case`Enter`:A&&D(!0);break;case`Escape`:E?D(!1):C>=0&&j(C);break}},tabIndex:0,role:`slider`,"aria-valuemin":0,"aria-valuemax":e.length-1,"aria-valuenow":O,"aria-label":`Deployment version selector`,children:[(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes spin-slow {
|
|
3
3
|
from {
|
|
4
4
|
transform: rotate(0deg);
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
.animate-spin-slow {
|
|
11
11
|
animation: spin-slow 3s linear infinite;
|
|
12
12
|
}
|
|
13
|
-
`}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.RotateCcw,{className:`h-5 w-5 text-muted-foreground`}),(0,i.jsx)(`h3`,{className:`font-semibold`,children:`Deployment History`}),(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded-full`,children:[e.length,` versions`]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>{j(Math.max(O-1,0))},disabled:O===0,className:t.cn(`p-1.5 rounded-md transition-colors`,`hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed`),"aria-label":`Previous version`,children:(0,i.jsx)(r.ChevronLeft,{className:`h-4 w-4`})}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>{j(Math.min(O+1,e.length-1))},disabled:O===e.length-1,className:t.cn(`p-1.5 rounded-md transition-colors`,`hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed`),"aria-label":`Next version`,children:(0,i.jsx)(r.ChevronRight,{className:`h-4 w-4`})})]})]}),(0,i.jsxs)(`div`,{className:`relative`,children:[l&&(0,i.jsx)(`div`,{className:`absolute top-0 left-1/2 -translate-x-1/2 -translate-y-2 z-10`,children:(0,i.jsx)(r.GripHorizontal,{className:`h-4 w-4 text-muted-foreground/50`})}),(0,i.jsxs)(`div`,{ref:g,className:t.cn(`relative overflow-x-auto scrollbar-hide py-8 px-4`,`bg-muted/30 rounded-lg border`,l&&`cursor-grab`,_&&`cursor-grabbing select-none`),onMouseDown:e=>{!l||!g.current||(v(!0),b(e.clientX),S(g.current.scrollLeft))},onMouseMove:e=>{if(!_||!g.current)return;e.preventDefault();let t=e.clientX-y;g.current.scrollLeft=x-t},onMouseUp:()=>{v(!1)},onMouseLeave:()=>{v(!1)},onTouchStart:e=>{!l||!g.current||(v(!0),b(e.touches[0].clientX),S(g.current.scrollLeft))},onTouchMove:e=>{if(!_||!g.current)return;let t=e.touches[0].clientX-y;g.current.scrollLeft=x-t},onTouchEnd:()=>{v(!1)},children:[(0,i.jsx)(`div`,{className:`absolute top-1/2 left-4 right-4 h-0.5 bg-border -translate-y-1/2`}),C>=0&&(0,i.jsx)(`div`,{className:`absolute top-1/2 left-4 h-0.5 bg-primary -translate-y-1/2 transition-all duration-300`,style:{width:`calc(${C/(e.length-1)*100}% - 16px)`}}),(0,i.jsx)(`div`,{className:`relative flex items-center justify-between min-w-max gap-8 px-4`,children:e.map((t,n)=>(0,i.jsx)(u,{version:t,index:n,isSelected:n===O,isActive:t.isActive===!0,totalVersions:e.length,onSelect:j,draggable:l},t.id))})]})]}),p&&k&&(0,i.jsx)(`div`,{className:`mt-4`,children:(0,i.jsx)(d,{version:k,isActive:k.isActive===!0})}),A&&(0,i.jsxs)(`div`,{className:`mt-4 flex items-center justify-between p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg animate-in slide-in-from-bottom-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-amber-600`,children:[(0,i.jsx)(r.AlertTriangle,{className:`h-4 w-4`}),(0,i.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Rolling back to v`,k?.version,` will replace the current deployment`]})]}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>D(!0),className:t.cn(`flex items-center gap-2 px-4 py-2 rounded-lg font-medium`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`),children:[(0,i.jsx)(r.RotateCcw,{className:`h-4 w-4`}),`Rollback`]})]}),E&&k&&(0,i.jsx)(f,{version:k,onConfirm:()=>{k&&s?.(k),D(!1)},onCancel:()=>{D(!1),c?.()}})]})}exports.default=m,exports.useRollbackSlider=p;
|
|
13
|
+
`}),(0,i.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(r.RotateCcw,{className:`h-5 w-5 text-muted-foreground`}),(0,i.jsx)(`h3`,{className:`font-semibold`,children:`Deployment History`}),(0,i.jsxs)(`span`,{className:`text-xs text-muted-foreground bg-muted px-2 py-0.5 rounded-full`,children:[e.length,` versions`]})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`button`,{type:`button`,onClick:()=>{j(Math.max(O-1,0))},disabled:O===0,className:t.cn(`p-1.5 rounded-md transition-colors`,`hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed`),"aria-label":`Previous version`,children:(0,i.jsx)(r.ChevronLeft,{className:`h-4 w-4`})}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>{j(Math.min(O+1,e.length-1))},disabled:O===e.length-1,className:t.cn(`p-1.5 rounded-md transition-colors`,`hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed`),"aria-label":`Next version`,children:(0,i.jsx)(r.ChevronRight,{className:`h-4 w-4`})})]})]}),(0,i.jsxs)(`div`,{className:`relative`,children:[l&&(0,i.jsx)(`div`,{className:`absolute top-0 left-1/2 -translate-x-1/2 -translate-y-2 z-10`,children:(0,i.jsx)(r.GripHorizontal,{className:`h-4 w-4 text-muted-foreground/50`})}),(0,i.jsxs)(`div`,{ref:g,className:t.cn(`relative overflow-x-auto scrollbar-hide py-8 px-4`,`bg-muted/30 rounded-lg border`,l&&`cursor-grab`,_&&`cursor-grabbing select-none`),onMouseDown:e=>{!l||!g.current||(v(!0),b(e.clientX),S(g.current.scrollLeft))},onMouseMove:e=>{if(!_||!g.current)return;e.preventDefault();let t=e.clientX-y;g.current.scrollLeft=x-t},onMouseUp:()=>{v(!1)},onMouseLeave:()=>{v(!1)},onTouchStart:e=>{!l||!g.current||(v(!0),b(e.touches[0].clientX),S(g.current.scrollLeft))},onTouchMove:e=>{if(!_||!g.current)return;let t=e.touches[0].clientX-y;g.current.scrollLeft=x-t},onTouchEnd:()=>{v(!1)},children:[(0,i.jsx)(`div`,{className:`absolute top-1/2 left-4 right-4 h-0.5 bg-border -translate-y-1/2`}),C>=0&&(0,i.jsx)(`div`,{className:`absolute top-1/2 left-4 h-0.5 bg-primary -translate-y-1/2 transition-all duration-300`,style:{width:`calc(${C/(e.length-1)*100}% - 16px)`}}),(0,i.jsx)(`div`,{className:`relative flex items-center justify-between min-w-max gap-8 px-4`,children:e.map((t,n)=>(0,i.jsx)(u,{version:t,index:n,isSelected:n===O,isActive:t.isActive===!0,totalVersions:e.length,onSelect:j,draggable:l},t.id))})]})]}),p&&k&&(0,i.jsx)(`div`,{className:`mt-4`,children:(0,i.jsx)(d,{version:k,isActive:k.isActive===!0})}),A&&(0,i.jsxs)(`div`,{className:`mt-4 flex items-center justify-between p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg animate-in slide-in-from-bottom-2`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-amber-600`,children:[(0,i.jsx)(r.AlertTriangle,{className:`h-4 w-4`}),(0,i.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Rolling back to v`,k?.version,` will replace the current deployment`]})]}),(0,i.jsxs)(`button`,{type:`button`,onClick:()=>D(!0),className:t.cn(`flex items-center gap-2 px-4 py-2 rounded-lg font-medium`,`bg-primary text-primary-foreground hover:bg-primary/90 transition-colors`),children:[(0,i.jsx)(r.RotateCcw,{className:`h-4 w-4`}),`Rollback`]})]}),E&&k&&(0,i.jsx)(f,{version:k,onConfirm:()=>{k&&s?.(k),D(!1)},onCancel:()=>{D(!1),c?.()}})]})}exports.WakaRollbackSlider=m,exports.default=m,exports.useRollbackSlider=p;
|
|
@@ -238,13 +238,15 @@ function T(e = {}) {
|
|
|
238
238
|
t && i?.(t, e);
|
|
239
239
|
}
|
|
240
240
|
}, [a, i]), g = t.useCallback(() => {
|
|
241
|
-
|
|
241
|
+
let e = Math.min(s + 1, a.length - 1);
|
|
242
|
+
h(e);
|
|
242
243
|
}, [
|
|
243
244
|
s,
|
|
244
245
|
a.length,
|
|
245
246
|
h
|
|
246
247
|
]), _ = t.useCallback(() => {
|
|
247
|
-
|
|
248
|
+
let e = Math.max(s - 1, 0);
|
|
249
|
+
h(e);
|
|
248
250
|
}, [s, h]), v = t.useCallback(() => {
|
|
249
251
|
m && u(!0);
|
|
250
252
|
}, [m]), y = t.useCallback(() => {
|
|
@@ -446,4 +448,4 @@ function E({ versions: n, selectedIndex: r, onVersionSelect: a, onRollbackConfir
|
|
|
446
448
|
});
|
|
447
449
|
}
|
|
448
450
|
//#endregion
|
|
449
|
-
export { E as default, T as useRollbackSlider };
|
|
451
|
+
export { E as WakaRollbackSlider, E as default, T as useRollbackSlider };
|
|
@@ -1,4 +1,4 @@
|
|
|
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={primary:`#3b82f6`,secondary:`#8b5cf6`,success:`#22c55e`,warning:`#f59e0b`,danger:`#ef4444`,info:`#06b6d4`,default:`#6b7280`};function o({nodes:e,links:t,width:r,height:i,nodeWidth:a,nodePadding:o,padding:s,orientation:c,categoryColors:l}){return n.useMemo(()=>{if(e.length===0)return{nodes:[],links:[],width:r,height:i};let n=new Map,u=new Map,d=new Map;e.forEach(e=>{n.set(e.id,{...e,x:0,y:0,width:a,height:0,inValue:0,outValue:0,column:-1,row:0}),u.set(e.id,[]),d.set(e.id,[])}),t.forEach(e=>{u.get(e.source)?.push(e),d.get(e.target)?.push(e);let t=n.get(e.source),r=n.get(e.target);t&&(t.outValue+=e.value),r&&(r.inValue+=e.value)});let f=new Set,p=[],m=e.filter(e=>(d.get(e.id)?.length||0)===0).map(e=>e.id),h=0;for(;m.length>0;){p.push([...m]),m.forEach(e=>{let t=n.get(e);t&&(t.column=h,f.add(e))});let e=[];m.forEach(t=>{(u.get(t)||[]).forEach(t=>{f.has(t.target)||(d.get(t.target)||[]).every(e=>f.has(e.source))&&!e.includes(t.target)&&e.push(t.target)})}),m=e,h++}e.forEach(e=>{if(!f.has(e.id)){let t=n.get(e.id);t&&(t.column=h,p[h]||(p[h]=[]),p[h].push(e.id))}});let g=c===`horizontal`,_=r-s*2,v=i-s*2,y=p.length,b=g?(_-a)/Math.max(y-1,1):(v-a)/Math.max(y-1,1),x=0;p.forEach(e=>{let t=e.reduce((e,t)=>{let r=n.get(t);return e+Math.max(r?.inValue||0,r?.outValue||0,r?.value||0)},0);x=Math.max(x,t)});let S=g?v:_,C=(S-o*Math.max(...p.map(e=>e.length-1),0))/x;p.forEach((e,t)=>{let r=0,i=[...e].sort((e,t)=>{let r=n.get(e),i=n.get(t);return i.inValue+i.outValue-(r.inValue+r.outValue)});i.forEach((e,i)=>{let c=n.get(e),l=Math.max(c.inValue,c.outValue,c.value||0),u=Math.max(l*C,10);c.row=i,g?(c.x=s+t*b,c.y=s+r,c.width=a,c.height=u):(c.x=s+r,c.y=s+t*b,c.width=u,c.height=a),r+=u+o});let c=(S-(r-o))/2;i.forEach(e=>{let t=n.get(e);g?t.y+=c:t.x+=c})});let w=[],T=new Map,E=new Map;return e.forEach(e=>{T.set(e.id,0),E.set(e.id,0)}),[...t].sort((e,t)=>t.value-e.value).forEach(e=>{let t=n.get(e.source),r=n.get(e.target);if(!t||!r)return;let i=Math.max(e.value*C,2),a=T.get(e.source)||0,o=E.get(e.target)||0,s,c,u;if(g){let e=t.x+t.width,n=t.y+a+i/2,l=r.x,d=r.y+o+i/2;c=n,u=d;let f=e+(l-e)*.5;s=`M ${e} ${n} C ${f} ${n}, ${f} ${d}, ${l} ${d}`}else{let e=t.x+a+i/2,n=t.y+t.height,l=r.x+o+i/2,d=r.y;c=n,u=d;let f=n+(d-n)*.5;s=`M ${e} ${n} C ${e} ${f}, ${l} ${f}, ${l} ${d}`}T.set(e.source,a+i),E.set(e.target,o+i);let d=e.color;!d&&t.category&&(d=l[t.category]||l.default),!d&&t.color&&(d=t.color),w.push({...e,sourceNode:t,targetNode:r,path:s,width:i,sourceY:c,targetY:u,color:d})}),{nodes:Array.from(n.values()),links:w,width:r,height:i}},[e,t,r,i,a,o,s,c,l])}function s({content:e,x:t,y:n,visible:r}){return r?(0,i.jsx)(`div`,{className:`pointer-events-none absolute z-50 rounded-lg border bg-popover px-3 py-2 text-sm shadow-lg animate-in fade-in-0 zoom-in-95`,style:{left:t+10,top:n-10,transform:`translateY(-100%)`},children:e}):null}function c({link:e,defaultColor:n,opacity:r,highlightedOpacity:a,isHighlighted:o,isDimmed:s,animated:c,animationDelay:l,showTooltips:u,onHover:d,onClick:f}){let p=e.color||n,m=s?.1:o?a:r;return(0,i.jsxs)(`g`,{className:`sankey-link`,onMouseEnter:t=>u&&d(e,t),onMouseLeave:e=>d(null,e),onClick:f,style:{cursor:`pointer`},children:[(0,i.jsx)(`path`,{d:e.path,fill:`none`,stroke:p,strokeWidth:e.width,strokeOpacity:m,strokeLinecap:`butt`,className:t.cn(`transition-all duration-300`,c&&`animate-flow-in`),style:c?{animationDelay:`${l}ms`}:void 0}),(0,i.jsx)(`path`,{d:e.path,fill:`none`,stroke:`transparent`,strokeWidth:Math.max(e.width,10)})]})}function l({node:e,color:n,showValues:r,isHighlighted:a,isDimmed:o,animated:s,animationDelay:c,draggable:l,orientation:u,onHover:d,onClick:f,onDragStart:p}){let m=Math.max(e.inValue,e.outValue,e.value||0),h=u===`horizontal`;return(0,i.jsxs)(`g`,{className:t.cn(`sankey-node transition-all duration-300`,l&&`cursor-grab active:cursor-grabbing`,a&&`filter drop-shadow-lg`),onMouseEnter:()=>d(e),onMouseLeave:()=>d(null),onClick:f,onMouseDown:l?t=>p(t,e):void 0,style:{opacity:o?.3:1},children:[(0,i.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,fill:n,rx:4,className:t.cn(`transition-all duration-300`,s&&`animate-node-in`,a&&`stroke-2 stroke-foreground`),style:s?{animationDelay:`${c}ms`}:void 0}),a&&(0,i.jsx)(`rect`,{x:e.x-2,y:e.y-2,width:e.width+4,height:e.height+4,fill:`none`,stroke:n,strokeWidth:2,rx:6,opacity:.5,className:`animate-pulse`}),(0,i.jsx)(`text`,{x:h?e.x+e.width+8:e.x+e.width/2,y:h?e.y+e.height/2:e.y-8,textAnchor:h?`start`:`middle`,dominantBaseline:h?`middle`:`auto`,className:`fill-foreground text-xs font-medium pointer-events-none`,children:e.label}),r&&(0,i.jsx)(`text`,{x:h?e.x+e.width+8:e.x+e.width/2,y:h?e.y+e.height/2+14:e.y+e.height+16,textAnchor:h?`start`:`middle`,dominantBaseline:h?`middle`:`auto`,className:`fill-muted-foreground text-xs pointer-events-none`,children:m.toLocaleString()})]})}function u({nodes:e,links:u,orientation:d=`horizontal`,width:f=800,height:p=500,nodeWidth:m=20,nodePadding:h=10,padding:g=40,draggable:_=!0,animated:v=!0,showValues:y=!0,showTooltips:b=!0,categoryColors:x=a,linkColor:S=`#94a3b8`,linkOpacity:C=.5,highlightedLinkOpacity:w=.8,onNodeClick:T,onLinkClick:E,onNodeReorder:D,className:O}){let k=n.useRef(null),[A,j]=n.useState(null),[M,N]=n.useState(null),[P,F]=n.useState({x:0,y:0}),[I,L]=n.useState(null),[R,z]=n.useState(new Map),[B,V]=n.useState(!1),H=o({nodes:e,links:u,width:f,height:p,nodeWidth:m,nodePadding:h,padding:g,orientation:d,categoryColors:x});n.useEffect(()=>{if(v&&!B){let e=setTimeout(()=>V(!0),50);return()=>clearTimeout(e)}},[v,B]);let U=n.useCallback(e=>{let t=new Set([e]);return u.forEach(n=>{n.source===e&&t.add(n.target),n.target===e&&t.add(n.source)}),t},[u]),W=e=>e.color?e.color:e.category&&x[e.category]?x[e.category]:x.default||`#6b7280`,G=e=>{j(e),N(null)},K=(e,t)=>{if(N(e),j(null),e&&k.current){let e=k.current.getBoundingClientRect();F({x:t.clientX-e.left,y:t.clientY-e.top})}},q=(e,t)=>{_&&(e.preventDefault(),L({node:t,startY:e.clientY,startNodeY:t.y+(R.get(t.id)||0)}))};n.useEffect(()=>{if(!I)return;let e=e=>{let t=e.clientY-I.startY,n=I.startNodeY+t;z(e=>{let t=new Map(e);return t.set(I.node.id,n-I.node.y),t})},t=()=>{D&&I&&D(H.nodes.map(e=>({...e,y:e.y+(R.get(e.id)||0)}))),L(null)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[I,H.nodes,R,D]);let J=n.useMemo(()=>A?U(A.id):M?new Set([M.source,M.target]):new Set,[A,M,U]),Y=J.size>0;return(0,i.jsxs)(`div`,{ref:k,className:t.cn(`relative overflow-hidden rounded-lg border bg-background`,O),style:{width:f,height:p},children:[(0,i.jsx)(`div`,{className:`absolute right-4 top-4 flex items-center gap-4 rounded-lg border bg-background/80 px-3 py-2 text-xs backdrop-blur-sm`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[d===`horizontal`?(0,i.jsx)(r.ArrowRight,{className:`h-4 w-4`}):(0,i.jsx)(r.ArrowDown,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:`Flow Direction`})]})}),(0,i.jsxs)(`svg`,{width:f,height:p,className:t.cn(I&&`cursor-grabbing`),"aria-hidden":`true`,focusable:`false`,children:[(0,i.jsx)(`defs`,{children:H.links.map((e,t)=>{let n=W(e.sourceNode),r=W(e.targetNode),a=`gradient-${e.source}-${e.target}-${t}`;return d===`horizontal`?(0,i.jsxs)(`linearGradient`,{id:a,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:n}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:r})]},a):(0,i.jsxs)(`linearGradient`,{id:a,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:n}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:r})]},a)})}),(0,i.jsx)(`g`,{className:`links`,children:H.links.map((e,t)=>{let n=M===e||J.has(e.source)||J.has(e.target),r=Y&&!n;return(0,i.jsx)(c,{link:{...e,color:`url(#gradient-${e.source}-${e.target}-${t})`},defaultColor:S,opacity:C,highlightedOpacity:w,isHighlighted:n,isDimmed:r,animated:v&&B,animationDelay:t*50,showTooltips:b,onHover:K,onClick:()=>E?.(e)},`${e.source}-${e.target}-${t}`)})}),(0,i.jsx)(`g`,{className:`nodes`,children:H.nodes.map((e,t)=>{let n=J.has(e.id),r=Y&&!n,a=R.get(e.id)||0;return(0,i.jsx)(l,{node:{...e,y:e.y+a},color:W(e),showValues:y,isHighlighted:n,isDimmed:r,animated:v&&B,animationDelay:t*30,draggable:_,orientation:d,onHover:G,onClick:()=>T?.(e),onDragStart:q},e.id)})})]}),b&&M&&(0,i.jsx)(s,{x:P.x,y:P.y,visible:!0,content:(0,i.jsxs)(`div`,{className:`space-y-1`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,i.jsx)(`span`,{children:M.sourceNode.label}),(0,i.jsx)(r.ArrowRight,{className:`h-3 w-3`}),(0,i.jsx)(`span`,{children:M.targetNode.label})]}),(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[`Value: `,(0,i.jsx)(`span`,{className:`font-medium text-foreground`,children:M.value.toLocaleString()})]}),M.data&&Object.keys(M.data).length>0&&(0,i.jsx)(`div`,{className:`border-t pt-1 mt-1`,children:Object.entries(M.data).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[e,`: `,(0,i.jsx)(`span`,{className:`text-foreground`,children:String(t)})]},e))})]})}),b&&A&&!M&&(0,i.jsx)(`div`,{className:`pointer-events-none absolute z-50 rounded-lg border bg-popover px-3 py-2 text-sm shadow-lg animate-in fade-in-0 zoom-in-95`,style:{left:d===`horizontal`?A.x+A.width+60:A.x+A.width/2,top:d===`horizontal`?A.y+(R.get(A.id)||0):A.y-10,transform:d===`horizontal`?`translateY(-50%)`:`translateX(-50%) translateY(-100%)`},children:(0,i.jsxs)(`div`,{className:`space-y-1`,children:[(0,i.jsx)(`div`,{className:`font-medium`,children:A.label}),A.category&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,i.jsx)(`div`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:W(A)}}),A.category]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-0.5 text-xs border-t pt-1 mt-1`,children:[(0,i.jsx)(`div`,{className:`text-muted-foreground`,children:`Incoming:`}),(0,i.jsx)(`div`,{className:`font-medium`,children:A.inValue.toLocaleString()}),(0,i.jsx)(`div`,{className:`text-muted-foreground`,children:`Outgoing:`}),(0,i.jsx)(`div`,{className:`font-medium`,children:A.outValue.toLocaleString()})]}),A.data&&Object.keys(A.data).length>0&&(0,i.jsx)(`div`,{className:`border-t pt-1 mt-1 text-xs`,children:Object.entries(A.data).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[e,`: `,(0,i.jsx)(`span`,{className:`text-foreground`,children:String(t)})]},e))})]})}),(0,i.jsx)(`style`,{children:`
|
|
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={primary:`#3b82f6`,secondary:`#8b5cf6`,success:`#22c55e`,warning:`#f59e0b`,danger:`#ef4444`,info:`#06b6d4`,default:`#6b7280`};function o({nodes:e,links:t,width:r,height:i,nodeWidth:a,nodePadding:o,padding:s,orientation:c,categoryColors:l}){return n.useMemo(()=>{if(e.length===0)return{nodes:[],links:[],width:r,height:i};let n=new Map,u=new Map,d=new Map;e.forEach(e=>{n.set(e.id,{...e,x:0,y:0,width:a,height:0,inValue:0,outValue:0,column:-1,row:0}),u.set(e.id,[]),d.set(e.id,[])}),t.forEach(e=>{u.get(e.source)?.push(e),d.get(e.target)?.push(e);let t=n.get(e.source),r=n.get(e.target);t&&(t.outValue+=e.value),r&&(r.inValue+=e.value)});let f=new Set,p=[],m=e.filter(e=>(d.get(e.id)?.length||0)===0).map(e=>e.id),h=0;for(;m.length>0;){p.push([...m]),m.forEach(e=>{let t=n.get(e);t&&(t.column=h,f.add(e))});let e=[];m.forEach(t=>{(u.get(t)||[]).forEach(t=>{f.has(t.target)||(d.get(t.target)||[]).every(e=>f.has(e.source))&&!e.includes(t.target)&&e.push(t.target)})}),m=e,h++}e.forEach(e=>{if(!f.has(e.id)){let t=n.get(e.id);t&&(t.column=h,p[h]||(p[h]=[]),p[h].push(e.id))}});let g=c===`horizontal`,_=r-s*2,v=i-s*2,y=p.length,b=g?(_-a)/Math.max(y-1,1):(v-a)/Math.max(y-1,1),x=0;p.forEach(e=>{let t=e.reduce((e,t)=>{let r=n.get(t);return e+Math.max(r?.inValue||0,r?.outValue||0,r?.value||0)},0);x=Math.max(x,t)});let S=g?v:_,C=(S-o*Math.max(...p.map(e=>e.length-1),0))/x;p.forEach((e,t)=>{let r=0,i=[...e].sort((e,t)=>{let r=n.get(e),i=n.get(t);return i.inValue+i.outValue-(r.inValue+r.outValue)});i.forEach((e,i)=>{let c=n.get(e),l=Math.max(c.inValue,c.outValue,c.value||0),u=Math.max(l*C,10);c.row=i,g?(c.x=s+t*b,c.y=s+r,c.width=a,c.height=u):(c.x=s+r,c.y=s+t*b,c.width=u,c.height=a),r+=u+o});let c=r-o,l=(S-c)/2;i.forEach(e=>{let t=n.get(e);g?t.y+=l:t.x+=l})});let w=[],T=new Map,E=new Map;return e.forEach(e=>{T.set(e.id,0),E.set(e.id,0)}),[...t].sort((e,t)=>t.value-e.value).forEach(e=>{let t=n.get(e.source),r=n.get(e.target);if(!t||!r)return;let i=Math.max(e.value*C,2),a=T.get(e.source)||0,o=E.get(e.target)||0,s,c,u;if(g){let e=t.x+t.width,n=t.y+a+i/2,l=r.x,d=r.y+o+i/2;c=n,u=d;let f=e+(l-e)*.5;s=`M ${e} ${n} C ${f} ${n}, ${f} ${d}, ${l} ${d}`}else{let e=t.x+a+i/2,n=t.y+t.height,l=r.x+o+i/2,d=r.y;c=n,u=d;let f=n+(d-n)*.5;s=`M ${e} ${n} C ${e} ${f}, ${l} ${f}, ${l} ${d}`}T.set(e.source,a+i),E.set(e.target,o+i);let d=e.color;!d&&t.category&&(d=l[t.category]||l.default),!d&&t.color&&(d=t.color),w.push({...e,sourceNode:t,targetNode:r,path:s,width:i,sourceY:c,targetY:u,color:d})}),{nodes:Array.from(n.values()),links:w,width:r,height:i}},[e,t,r,i,a,o,s,c,l])}function s({content:e,x:t,y:n,visible:r}){return r?(0,i.jsx)(`div`,{className:`pointer-events-none absolute z-50 rounded-lg border bg-popover px-3 py-2 text-sm shadow-lg animate-in fade-in-0 zoom-in-95`,style:{left:t+10,top:n-10,transform:`translateY(-100%)`},children:e}):null}function c({link:e,defaultColor:n,opacity:r,highlightedOpacity:a,isHighlighted:o,isDimmed:s,animated:c,animationDelay:l,showTooltips:u,onHover:d,onClick:f}){let p=e.color||n,m=s?.1:o?a:r;return(0,i.jsxs)(`g`,{className:`sankey-link`,onMouseEnter:t=>u&&d(e,t),onMouseLeave:e=>d(null,e),onClick:f,style:{cursor:`pointer`},children:[(0,i.jsx)(`path`,{d:e.path,fill:`none`,stroke:p,strokeWidth:e.width,strokeOpacity:m,strokeLinecap:`butt`,className:t.cn(`transition-all duration-300`,c&&`animate-flow-in`),style:c?{animationDelay:`${l}ms`}:void 0}),(0,i.jsx)(`path`,{d:e.path,fill:`none`,stroke:`transparent`,strokeWidth:Math.max(e.width,10)})]})}function l({node:e,color:n,showValues:r,isHighlighted:a,isDimmed:o,animated:s,animationDelay:c,draggable:l,orientation:u,onHover:d,onClick:f,onDragStart:p}){let m=Math.max(e.inValue,e.outValue,e.value||0),h=u===`horizontal`;return(0,i.jsxs)(`g`,{className:t.cn(`sankey-node transition-all duration-300`,l&&`cursor-grab active:cursor-grabbing`,a&&`filter drop-shadow-lg`),onMouseEnter:()=>d(e),onMouseLeave:()=>d(null),onClick:f,onMouseDown:l?t=>p(t,e):void 0,style:{opacity:o?.3:1},children:[(0,i.jsx)(`rect`,{x:e.x,y:e.y,width:e.width,height:e.height,fill:n,rx:4,className:t.cn(`transition-all duration-300`,s&&`animate-node-in`,a&&`stroke-2 stroke-foreground`),style:s?{animationDelay:`${c}ms`}:void 0}),a&&(0,i.jsx)(`rect`,{x:e.x-2,y:e.y-2,width:e.width+4,height:e.height+4,fill:`none`,stroke:n,strokeWidth:2,rx:6,opacity:.5,className:`animate-pulse`}),(0,i.jsx)(`text`,{x:h?e.x+e.width+8:e.x+e.width/2,y:h?e.y+e.height/2:e.y-8,textAnchor:h?`start`:`middle`,dominantBaseline:h?`middle`:`auto`,className:`fill-foreground text-xs font-medium pointer-events-none`,children:e.label}),r&&(0,i.jsx)(`text`,{x:h?e.x+e.width+8:e.x+e.width/2,y:h?e.y+e.height/2+14:e.y+e.height+16,textAnchor:h?`start`:`middle`,dominantBaseline:h?`middle`:`auto`,className:`fill-muted-foreground text-xs pointer-events-none`,children:m.toLocaleString()})]})}function u({nodes:e,links:u,orientation:d=`horizontal`,width:f=800,height:p=500,nodeWidth:m=20,nodePadding:h=10,padding:g=40,draggable:_=!0,animated:v=!0,showValues:y=!0,showTooltips:b=!0,categoryColors:x=a,linkColor:S=`#94a3b8`,linkOpacity:C=.5,highlightedLinkOpacity:w=.8,onNodeClick:T,onLinkClick:E,onNodeReorder:D,className:O}){let k=n.useRef(null),[A,j]=n.useState(null),[M,N]=n.useState(null),[P,F]=n.useState({x:0,y:0}),[I,L]=n.useState(null),[R,z]=n.useState(new Map),[B,V]=n.useState(!1),H=o({nodes:e,links:u,width:f,height:p,nodeWidth:m,nodePadding:h,padding:g,orientation:d,categoryColors:x});n.useEffect(()=>{if(v&&!B){let e=setTimeout(()=>V(!0),50);return()=>clearTimeout(e)}},[v,B]);let U=n.useCallback(e=>{let t=new Set([e]);return u.forEach(n=>{n.source===e&&t.add(n.target),n.target===e&&t.add(n.source)}),t},[u]),W=e=>e.color?e.color:e.category&&x[e.category]?x[e.category]:x.default||`#6b7280`,G=e=>{j(e),N(null)},K=(e,t)=>{if(N(e),j(null),e&&k.current){let e=k.current.getBoundingClientRect();F({x:t.clientX-e.left,y:t.clientY-e.top})}},q=(e,t)=>{_&&(e.preventDefault(),L({node:t,startY:e.clientY,startNodeY:t.y+(R.get(t.id)||0)}))};n.useEffect(()=>{if(!I)return;let e=e=>{let t=e.clientY-I.startY,n=I.startNodeY+t;z(e=>{let t=new Map(e);return t.set(I.node.id,n-I.node.y),t})},t=()=>{D&&I&&D(H.nodes.map(e=>({...e,y:e.y+(R.get(e.id)||0)}))),L(null)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[I,H.nodes,R,D]);let J=n.useMemo(()=>A?U(A.id):M?new Set([M.source,M.target]):new Set,[A,M,U]),Y=J.size>0;return(0,i.jsxs)(`div`,{ref:k,className:t.cn(`relative overflow-hidden rounded-lg border bg-background`,O),style:{width:f,height:p},children:[(0,i.jsx)(`div`,{className:`absolute right-4 top-4 flex items-center gap-4 rounded-lg border bg-background/80 px-3 py-2 text-xs backdrop-blur-sm`,children:(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[d===`horizontal`?(0,i.jsx)(r.ArrowRight,{className:`h-4 w-4`}):(0,i.jsx)(r.ArrowDown,{className:`h-4 w-4`}),(0,i.jsx)(`span`,{children:`Flow Direction`})]})}),(0,i.jsxs)(`svg`,{width:f,height:p,className:t.cn(I&&`cursor-grabbing`),"aria-hidden":`true`,focusable:`false`,children:[(0,i.jsx)(`defs`,{children:H.links.map((e,t)=>{let n=W(e.sourceNode),r=W(e.targetNode),a=`gradient-${e.source}-${e.target}-${t}`;return d===`horizontal`?(0,i.jsxs)(`linearGradient`,{id:a,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:n}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:r})]},a):(0,i.jsxs)(`linearGradient`,{id:a,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:n}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:r})]},a)})}),(0,i.jsx)(`g`,{className:`links`,children:H.links.map((e,t)=>{let n=M===e||J.has(e.source)||J.has(e.target),r=Y&&!n;return(0,i.jsx)(c,{link:{...e,color:`url(#gradient-${e.source}-${e.target}-${t})`},defaultColor:S,opacity:C,highlightedOpacity:w,isHighlighted:n,isDimmed:r,animated:v&&B,animationDelay:t*50,showTooltips:b,onHover:K,onClick:()=>E?.(e)},`${e.source}-${e.target}-${t}`)})}),(0,i.jsx)(`g`,{className:`nodes`,children:H.nodes.map((e,t)=>{let n=J.has(e.id),r=Y&&!n,a=R.get(e.id)||0;return(0,i.jsx)(l,{node:{...e,y:e.y+a},color:W(e),showValues:y,isHighlighted:n,isDimmed:r,animated:v&&B,animationDelay:t*30,draggable:_,orientation:d,onHover:G,onClick:()=>T?.(e),onDragStart:q},e.id)})})]}),b&&M&&(0,i.jsx)(s,{x:P.x,y:P.y,visible:!0,content:(0,i.jsxs)(`div`,{className:`space-y-1`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,i.jsx)(`span`,{children:M.sourceNode.label}),(0,i.jsx)(r.ArrowRight,{className:`h-3 w-3`}),(0,i.jsx)(`span`,{children:M.targetNode.label})]}),(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[`Value: `,(0,i.jsx)(`span`,{className:`font-medium text-foreground`,children:M.value.toLocaleString()})]}),M.data&&Object.keys(M.data).length>0&&(0,i.jsx)(`div`,{className:`border-t pt-1 mt-1`,children:Object.entries(M.data).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[e,`: `,(0,i.jsx)(`span`,{className:`text-foreground`,children:String(t)})]},e))})]})}),b&&A&&!M&&(0,i.jsx)(`div`,{className:`pointer-events-none absolute z-50 rounded-lg border bg-popover px-3 py-2 text-sm shadow-lg animate-in fade-in-0 zoom-in-95`,style:{left:d===`horizontal`?A.x+A.width+60:A.x+A.width/2,top:d===`horizontal`?A.y+(R.get(A.id)||0):A.y-10,transform:d===`horizontal`?`translateY(-50%)`:`translateX(-50%) translateY(-100%)`},children:(0,i.jsxs)(`div`,{className:`space-y-1`,children:[(0,i.jsx)(`div`,{className:`font-medium`,children:A.label}),A.category&&(0,i.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,i.jsx)(`div`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:W(A)}}),A.category]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-0.5 text-xs border-t pt-1 mt-1`,children:[(0,i.jsx)(`div`,{className:`text-muted-foreground`,children:`Incoming:`}),(0,i.jsx)(`div`,{className:`font-medium`,children:A.inValue.toLocaleString()}),(0,i.jsx)(`div`,{className:`text-muted-foreground`,children:`Outgoing:`}),(0,i.jsx)(`div`,{className:`font-medium`,children:A.outValue.toLocaleString()})]}),A.data&&Object.keys(A.data).length>0&&(0,i.jsx)(`div`,{className:`border-t pt-1 mt-1 text-xs`,children:Object.entries(A.data).map(([e,t])=>(0,i.jsxs)(`div`,{className:`text-muted-foreground`,children:[e,`: `,(0,i.jsx)(`span`,{className:`text-foreground`,children:String(t)})]},e))})]})}),(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes flow-in {
|
|
3
3
|
from {
|
|
4
4
|
stroke-dasharray: 1000;
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
.animate-node-in {
|
|
29
29
|
animation: node-in 0.4s ease-out forwards;
|
|
30
30
|
}
|
|
31
|
-
`})]})}exports.default=u,exports.useSankeyDiagram=o;
|
|
31
|
+
`})]})}exports.WakaSankeyDiagram=u,exports.default=u,exports.useSankeyDiagram=o;
|
|
@@ -77,10 +77,10 @@ function s({ nodes: e, links: n, width: r, height: i, nodeWidth: a, nodePadding:
|
|
|
77
77
|
let c = t.get(e), l = Math.max(c.inValue, c.outValue, c.value || 0), u = Math.max(l * C, 10);
|
|
78
78
|
c.row = i, g ? (c.x = s + n * b, c.y = s + r, c.width = a, c.height = u) : (c.x = s + r, c.y = s + n * b, c.width = u, c.height = a), r += u + o;
|
|
79
79
|
});
|
|
80
|
-
let c =
|
|
80
|
+
let c = r - o, l = (S - c) / 2;
|
|
81
81
|
i.forEach((e) => {
|
|
82
82
|
let n = t.get(e);
|
|
83
|
-
g ? n.y +=
|
|
83
|
+
g ? n.y += l : n.x += l;
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
let w = [], T = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map();
|
|
@@ -240,7 +240,7 @@ function d({ nodes: d, links: f, orientation: p = "horizontal", width: m = 800,
|
|
|
240
240
|
}
|
|
241
241
|
}, [b, H]);
|
|
242
242
|
let G = t.useCallback((e) => {
|
|
243
|
-
let t = new Set([e]);
|
|
243
|
+
let t = /* @__PURE__ */ new Set([e]);
|
|
244
244
|
return f.forEach((n) => {
|
|
245
245
|
n.source === e && t.add(n.target), n.target === e && t.add(n.source);
|
|
246
246
|
}), t;
|
|
@@ -284,7 +284,7 @@ function d({ nodes: d, links: f, orientation: p = "horizontal", width: m = 800,
|
|
|
284
284
|
B,
|
|
285
285
|
k
|
|
286
286
|
]);
|
|
287
|
-
let X = t.useMemo(() => M ? G(M.id) : P ? new Set([P.source, P.target]) : /* @__PURE__ */ new Set(), [
|
|
287
|
+
let X = t.useMemo(() => M ? G(M.id) : P ? /* @__PURE__ */ new Set([P.source, P.target]) : /* @__PURE__ */ new Set(), [
|
|
288
288
|
M,
|
|
289
289
|
P,
|
|
290
290
|
G
|
|
@@ -491,4 +491,4 @@ function d({ nodes: d, links: f, orientation: p = "horizontal", width: m = 800,
|
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
//#endregion
|
|
494
|
-
export { d as default, s as useSankeyDiagram };
|
|
494
|
+
export { d as WakaSankeyDiagram, d as default, s as useSankeyDiagram };
|
|
@@ -1 +1 @@
|
|
|
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(`../checkbox/index.cjs.js`),a=require(`../label/index.cjs.js`),o=require(`../select/index.cjs.js`),s=require(`../popover/index.cjs.js`),c=require(`../scroll-area/index.cjs.js`),l=require(`../../utils/local-date.cjs.js`);let u=require(`react`);u=e.__toESM(u);let d=require(`lucide-react`),f=require(`react/jsx-runtime`);var p=[15,30,45,60,90,120],m=[`UTC`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`Asia/Tokyo`,`Asia/Shanghai`,`Asia/Dubai`,`Australia/Sydney`],h=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],g=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function _(e,t){let[n,r]=e.split(`:`).map(Number);if(t===`12h`){let e=n>=12?`PM`:`AM`;return`${n%12||12}:${r.toString().padStart(2,`0`)} ${e}`}return`${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function v(e,t=`en-US`){return e.toLocaleDateString(t,{weekday:`short`,month:`short`,day:`numeric`})}function y(e,t=0){let n=new Date(e),r=n.getDay(),i=(r<t?7:0)+r-t;n.setDate(n.getDate()-i),n.setHours(0,0,0,0);let a=[];for(let e=0;e<7;e++){let t=new Date(n);t.setDate(n.getDate()+e),a.push(t)}return a}function b(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function x(e,t,n){if(!t)return!0;if(n!==void 0&&!t.daysOfWeek.includes(n))return!1;let[r,i]=e.split(`:`).map(Number),a=r*60+i,[o,s]=t.start.split(`:`).map(Number),[c,l]=t.end.split(`:`).map(Number),u=o*60+s,d=c*60+l;return a>=u&&a<d}function ee(e,t=30,n){let r=[],i=n?parseInt(n.start.split(`:`)[0]):8,a=n?parseInt(n.end.split(`:`)[0]):18;for(let o=i;o<a;o++)for(let i=0;i<60;i+=t){let a=`${o.toString().padStart(2,`0`)}:${i.toString().padStart(2,`0`)}`,s=i+t,c=s>=60?o+1:o,u=s>=60?s-60:s,d=`${c.toString().padStart(2,`0`)}:${u.toString().padStart(2,`0`)}`,f=x(a,n,e.getDay());r.push({id:`${l.localDateKey(e)}-${a}`,date:new Date(e),startTime:a,endTime:d,status:f?`available`:`unavailable`})}return r}function S(e={}){let{initialSlots:t=[],initialSelectedSlots:n=[],initialDuration:r=30,initialTimeZone:i=`UTC`,multiSelect:a=!1}=e,[o,s]=u.useState(t),[c,l]=u.useState(n),[d,f]=u.useState(r),[p,m]=u.useState(i),[h,g]=u.useState({enabled:!1,pattern:`weekly`});return{slots:o,setSlots:s,selectedSlots:c,setSelectedSlots:l,duration:d,setDuration:f,timeZone:p,setTimeZone:m,recurrence:h,setRecurrence:g,toggleSlot:u.useCallback(e=>{l(t=>t.includes(e)?t.filter(t=>t!==e):a?[...t,e]:[e])},[a]),clearSelection:u.useCallback(()=>{l([])},[]),getSelectedSlotDetails:u.useCallback(()=>o.filter(e=>c.includes(e.id)),[o,c]),isSlotSelected:u.useCallback(e=>c.includes(e),[c])}}function C({slot:e,isSelected:n,onClick:r,hourFormat:i,disabled:a,isBusinessHour:o=!0,renderSlot:s}){if(s)return(0,f.jsx)(`div`,{onClick:a?void 0:r,children:s(e,n)});let c=e.status===`available`,l=e.status===`booked`,u=e.status===`unavailable`;return(0,f.jsx)(`button`,{type:`button`,onClick:r,disabled:a||l||u,className:t.cn(`w-full px-2 py-1.5 text-xs rounded-md transition-all duration-200`,`border focus:outline-none focus:ring-2 focus:ring-primary/50`,n&&`bg-primary text-primary-foreground border-primary shadow-sm`,!n&&c&&`bg-card hover:bg-accent hover:border-primary/50 border-border`,!n&&c&&o&&`bg-primary/5`,l&&`bg-muted text-muted-foreground cursor-not-allowed border-transparent`,u&&`bg-muted/50 text-muted-foreground/50 cursor-not-allowed border-transparent`,`animate-in fade-in-0 zoom-in-95 duration-200`),children:(0,f.jsxs)(`span`,{className:`flex items-center justify-center gap-1`,children:[n&&(0,f.jsx)(d.Check,{className:`h-3 w-3`}),_(e.startTime,i)]})})}function w({durations:e,selected:t,onChange:n,disabled:r}){let i=e=>{if(e<60)return`${e} min`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`};return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Timer,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(o.Select,{value:t.toString(),onValueChange:e=>n(parseInt(e)),disabled:r,children:[(0,f.jsx)(o.SelectTrigger,{className:`w-[120px] h-8 text-xs`,children:(0,f.jsx)(o.SelectValue,{})}),(0,f.jsx)(o.SelectContent,{children:e.map(e=>(0,f.jsx)(o.SelectItem,{value:e.toString(),children:i(e)},e))})]})]})}function T({timeZones:e,selected:t,onChange:n,disabled:r}){return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Globe,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(o.Select,{value:t,onValueChange:n,disabled:r,children:[(0,f.jsx)(o.SelectTrigger,{className:`w-[180px] h-8 text-xs`,children:(0,f.jsx)(o.SelectValue,{})}),(0,f.jsx)(o.SelectContent,{children:e.map(e=>(0,f.jsx)(o.SelectItem,{value:e,children:e.replace(/_/g,` `)},e))})]})]})}function te({recurrence:e,onChange:t,disabled:n}){return(0,f.jsxs)(s.Popover,{children:[(0,f.jsx)(s.PopoverTrigger,{asChild:!0,children:(0,f.jsxs)(r.Button,{variant:e.enabled?`default`:`outline`,size:`sm`,disabled:n,className:`h-8 text-xs gap-1.5`,children:[(0,f.jsx)(d.Repeat,{className:`h-3.5 w-3.5`}),e.enabled?`Recurring`:`One-time`]})}),(0,f.jsx)(s.PopoverContent,{className:`w-80`,align:`start`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(a.Label,{htmlFor:`recurrence-enabled`,className:`text-sm font-medium`,children:`Enable recurrence`}),(0,f.jsx)(i.Checkbox,{id:`recurrence-enabled`,checked:e.enabled,onCheckedChange:n=>t({...e,enabled:n})})]}),e.enabled&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(a.Label,{className:`text-xs text-muted-foreground`,children:`Pattern`}),(0,f.jsxs)(o.Select,{value:e.pattern,onValueChange:n=>t({...e,pattern:n}),children:[(0,f.jsx)(o.SelectTrigger,{className:`h-8 text-xs`,children:(0,f.jsx)(o.SelectValue,{})}),(0,f.jsxs)(o.SelectContent,{children:[(0,f.jsx)(o.SelectItem,{value:`daily`,children:`Daily`}),(0,f.jsx)(o.SelectItem,{value:`weekly`,children:`Weekly`}),(0,f.jsx)(o.SelectItem,{value:`biweekly`,children:`Bi-weekly`}),(0,f.jsx)(o.SelectItem,{value:`monthly`,children:`Monthly`})]})]})]}),e.pattern===`weekly`&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(a.Label,{className:`text-xs text-muted-foreground`,children:`Days of week`}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:h.map((n,i)=>(0,f.jsx)(r.Button,{variant:e.daysOfWeek?.includes(i)?`default`:`outline`,size:`sm`,className:`h-7 w-9 text-xs p-0`,onClick:()=>{let n=e.daysOfWeek||[],r=n.includes(i)?n.filter(e=>e!==i):[...n,i];t({...e,daysOfWeek:r})},children:n.charAt(0)},n))})]})]})]})})]})}function ne({slots:e,onRemove:t,onClear:i,hourFormat:a,locale:o}){return e.length===0?null:(0,f.jsxs)(`div`,{className:`border-t pt-3 mt-3 space-y-2 animate-in slide-in-from-bottom-2 duration-200`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:[`Selected (`,e.length,`)`]}),(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 text-xs text-muted-foreground hover:text-destructive`,onClick:i,children:`Clear all`})]}),(0,f.jsx)(c.ScrollArea,{className:`max-h-[120px]`,children:(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,f.jsxs)(n.Badge,{variant:`secondary`,className:`pr-1 text-xs animate-in fade-in-0 zoom-in-95 duration-200`,children:[(0,f.jsxs)(`span`,{className:`mr-1`,children:[v(e.date,o),` `,_(e.startTime,a)]}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`ml-0.5 rounded-full hover:bg-muted-foreground/20 p-0.5`,children:(0,f.jsx)(d.X,{className:`h-3 w-3`})})]},e.id))})})]})}function E({slots:e,selectedSlots:i,onSlotsChange:a,multiSelect:o=!1,durations:s=p,selectedDuration:_,onDurationChange:S,timeZones:E=m,selectedTimeZone:D,onTimeZoneChange:re,businessHours:O,showRecurrence:k=!1,recurrence:A,onRecurrenceChange:ie,weekStartsOn:j=0,minDate:M,maxDate:N,hourFormat:P=`24h`,locale:F=`en-US`,disabled:I=!1,className:ae,slotInterval:L=30,showSummary:oe=!0,renderSlot:R}){let[z,B]=u.useState(()=>y(M||new Date,j)[0]),[V,H]=u.useState(i||[]),[U,W]=u.useState(_||30),[G,K]=u.useState(D||`UTC`),[se,ce]=u.useState(A||{enabled:!1,pattern:`weekly`}),q=i??V,le=_??U,ue=D??G,de=A??se,J=u.useMemo(()=>y(z,j),[z,j]),Y=u.useMemo(()=>{if(e&&e.length>0)return e;let t=[];return J.forEach(e=>{let n=ee(e,L,O);t.push(...n)}),t},[e,J,L,O]),X=u.useMemo(()=>{let e=new Map;return Y.forEach(t=>{let n=l.localDateKey(t.date);e.has(n)||e.set(n,[]),e.get(n).push(t)}),e},[Y]),fe=u.useMemo(()=>Y.filter(e=>q.includes(e.id)),[Y,q]),Z=e=>{if(I)return;let t=Y.find(t=>t.id===e);if(!t||t.status===`booked`||t.status===`unavailable`)return;let n;n=q.includes(e)?q.filter(t=>t!==e):o?[...q,e]:[e],i||H(n),a?.(n)},pe=e=>{let t=q.filter(t=>t!==e);i||H(t),a?.(t)},Q=()=>{i||H([]),a?.([])},me=e=>{_||W(e),S?.(e)},he=e=>{D||K(e),re?.(e)},ge=e=>{A||ce(e),ie?.(e)},_e=()=>{let e=new Date(z);e.setDate(e.getDate()-7),!(M&&e<M)&&B(e)},ve=()=>{let e=new Date(z);e.setDate(e.getDate()+7),!(N&&e>N)&&B(e)},ye=()=>{B(y(new Date,j)[0])},be=!M||z>M,xe=!N||J[6]<N,$=new Date,Se=J.some(e=>b(e,$));return(0,f.jsxs)(`div`,{className:t.cn(`rounded-lg border bg-card text-card-foreground shadow-sm`,I&&`opacity-60 pointer-events-none`,ae),children:[(0,f.jsxs)(`div`,{className:`p-3 border-b space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.Button,{variant:`outline`,size:`icon`,className:`h-8 w-8`,onClick:_e,disabled:!be,children:(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4`})}),(0,f.jsx)(r.Button,{variant:`outline`,size:`icon`,className:`h-8 w-8`,onClick:ve,disabled:!xe,children:(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4`})}),!Se&&(0,f.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 text-xs`,onClick:ye,children:[(0,f.jsx)(d.CalendarDays,{className:`h-3.5 w-3.5 mr-1`}),`Today`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium`,children:[(0,f.jsx)(d.Calendar,{className:`h-4 w-4 text-muted-foreground mr-1`}),(0,f.jsxs)(`span`,{children:[v(J[0],F),` - `,v(J[6],F)]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,f.jsx)(w,{durations:s,selected:le,onChange:me,disabled:I}),(0,f.jsx)(T,{timeZones:E,selected:ue,onChange:he,disabled:I}),k&&(0,f.jsx)(te,{recurrence:de,onChange:ge,disabled:I})]})]}),(0,f.jsxs)(`div`,{className:`p-3`,children:[(0,f.jsx)(`div`,{className:`hidden md:block overflow-x-auto`,children:(0,f.jsx)(`div`,{className:`grid grid-cols-7 gap-2 min-w-[700px]`,children:J.map((e,n)=>{let r=l.localDateKey(e),i=X.get(r)||[],a=b(e,$),o=e.getDay(),s=O?O.daysOfWeek.includes(o):!0;return(0,f.jsxs)(`div`,{className:t.cn(`flex flex-col rounded-lg border bg-card`,a&&`ring-2 ring-primary/50`,!s&&`opacity-60`),children:[(0,f.jsxs)(`div`,{className:t.cn(`px-2 py-2 text-center border-b`,a&&`bg-primary/10`),children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:h[o]}),(0,f.jsx)(`div`,{className:t.cn(`text-lg font-semibold`,a&&`text-primary`),children:e.getDate()})]}),(0,f.jsx)(c.ScrollArea,{className:`flex-1 max-h-[300px]`,children:(0,f.jsx)(`div`,{className:`p-1.5 space-y-1`,children:i.map(e=>(0,f.jsx)(C,{slot:e,isSelected:q.includes(e.id),onClick:()=>Z(e.id),hourFormat:P,disabled:I,isBusinessHour:x(e.startTime,O,o),renderSlot:R},e.id))})})]},r)})})}),(0,f.jsx)(`div`,{className:`md:hidden`,children:(0,f.jsx)(c.ScrollArea,{className:`h-[400px]`,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:J.map(e=>{let r=l.localDateKey(e),i=X.get(r)||[],a=b(e,$),o=e.getDay(),s=O?O.daysOfWeek.includes(o):!0;return(0,f.jsxs)(`div`,{className:t.cn(`rounded-lg border bg-card`,a&&`ring-2 ring-primary/50`,!s&&`opacity-60`),children:[(0,f.jsxs)(`div`,{className:t.cn(`px-3 py-2 border-b flex items-center justify-between`,a&&`bg-primary/10`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:t.cn(`text-lg font-semibold`,a&&`text-primary`),children:e.getDate()}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g[o]})]}),a&&(0,f.jsx)(n.Badge,{variant:`secondary`,className:`text-xs`,children:`Today`})]}),(0,f.jsx)(`div`,{className:`p-2`,children:(0,f.jsx)(`div`,{className:`flex gap-1.5 overflow-x-auto pb-1`,children:i.filter(e=>e.status!==`unavailable`).map(e=>(0,f.jsx)(C,{slot:e,isSelected:q.includes(e.id),onClick:()=>Z(e.id),hourFormat:P,disabled:I,isBusinessHour:x(e.startTime,O,o),renderSlot:R},e.id))})})]},r)})})})})]}),oe&&(0,f.jsx)(`div`,{className:`px-3 pb-3`,children:(0,f.jsx)(ne,{slots:fe,onRemove:pe,onClear:Q,hourFormat:P,locale:F})})]})}E.displayName=`WakaSchedulePicker`,exports.default=E,exports.useSchedulePicker=S;
|
|
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("../checkbox/index.cjs.js"),a=require("../label/index.cjs.js"),o=require("../select/index.cjs.js"),s=require("../popover/index.cjs.js"),c=require("../scroll-area/index.cjs.js"),l=require("../../utils/local-date.cjs.js");let u=require("react");u=e.__toESM(u);let d=require("lucide-react"),f=require("react/jsx-runtime");var p=[15,30,45,60,90,120],m=[`UTC`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`Asia/Tokyo`,`Asia/Shanghai`,`Asia/Dubai`,`Australia/Sydney`],h=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],g=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function _(e,t){let[n,r]=e.split(`:`).map(Number);if(t===`12h`){let e=n>=12?`PM`:`AM`;return`${n%12||12}:${r.toString().padStart(2,`0`)} ${e}`}return`${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function v(e,t=`en-US`){return e.toLocaleDateString(t,{weekday:`short`,month:`short`,day:`numeric`})}function y(e,t=0){let n=new Date(e),r=n.getDay(),i=(r<t?7:0)+r-t;n.setDate(n.getDate()-i),n.setHours(0,0,0,0);let a=[];for(let e=0;e<7;e++){let t=new Date(n);t.setDate(n.getDate()+e),a.push(t)}return a}function b(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function x(e,t,n){if(!t)return!0;if(n!==void 0&&!t.daysOfWeek.includes(n))return!1;let[r,i]=e.split(`:`).map(Number),a=r*60+i,[o,s]=t.start.split(`:`).map(Number),[c,l]=t.end.split(`:`).map(Number),u=o*60+s,d=c*60+l;return a>=u&&a<d}function ee(e,t=30,n){let r=[],i=n?parseInt(n.start.split(`:`)[0]):8,a=n?parseInt(n.end.split(`:`)[0]):18;for(let o=i;o<a;o++)for(let i=0;i<60;i+=t){let a=`${o.toString().padStart(2,`0`)}:${i.toString().padStart(2,`0`)}`,s=i+t,c=s>=60?o+1:o,u=s>=60?s-60:s,d=`${c.toString().padStart(2,`0`)}:${u.toString().padStart(2,`0`)}`,f=x(a,n,e.getDay());r.push({id:`${l.localDateKey(e)}-${a}`,date:new Date(e),startTime:a,endTime:d,status:f?`available`:`unavailable`})}return r}function S(e={}){let{initialSlots:t=[],initialSelectedSlots:n=[],initialDuration:r=30,initialTimeZone:i=`UTC`,multiSelect:a=!1}=e,[o,s]=u.useState(t),[c,l]=u.useState(n),[d,f]=u.useState(r),[p,m]=u.useState(i),[h,g]=u.useState({enabled:!1,pattern:`weekly`});return{slots:o,setSlots:s,selectedSlots:c,setSelectedSlots:l,duration:d,setDuration:f,timeZone:p,setTimeZone:m,recurrence:h,setRecurrence:g,toggleSlot:u.useCallback(e=>{l(t=>t.includes(e)?t.filter(t=>t!==e):a?[...t,e]:[e])},[a]),clearSelection:u.useCallback(()=>{l([])},[]),getSelectedSlotDetails:u.useCallback(()=>o.filter(e=>c.includes(e.id)),[o,c]),isSlotSelected:u.useCallback(e=>c.includes(e),[c])}}function C({slot:e,isSelected:n,onClick:r,hourFormat:i,disabled:a,isBusinessHour:o=!0,renderSlot:s}){if(s)return(0,f.jsx)(`div`,{onClick:a?void 0:r,children:s(e,n)});let c=e.status===`available`,l=e.status===`booked`,u=e.status===`unavailable`;return(0,f.jsx)(`button`,{type:`button`,onClick:r,disabled:a||l||u,className:t.cn(`w-full px-2 py-1.5 text-xs rounded-md transition-all duration-200`,`border focus:outline-none focus:ring-2 focus:ring-primary/50`,n&&`bg-primary text-primary-foreground border-primary shadow-sm`,!n&&c&&`bg-card hover:bg-accent hover:border-primary/50 border-border`,!n&&c&&o&&`bg-primary/5`,l&&`bg-muted text-muted-foreground cursor-not-allowed border-transparent`,u&&`bg-muted/50 text-muted-foreground/50 cursor-not-allowed border-transparent`,`animate-in fade-in-0 zoom-in-95 duration-200`),children:(0,f.jsxs)(`span`,{className:`flex items-center justify-center gap-1`,children:[n&&(0,f.jsx)(d.Check,{className:`h-3 w-3`}),_(e.startTime,i)]})})}function te({durations:e,selected:t,onChange:n,disabled:r}){let i=e=>{if(e<60)return`${e} min`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`};return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Timer,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(o.Select,{value:t.toString(),onValueChange:e=>n(parseInt(e)),disabled:r,children:[(0,f.jsx)(o.SelectTrigger,{className:`w-[120px] h-8 text-xs`,children:(0,f.jsx)(o.SelectValue,{})}),(0,f.jsx)(o.SelectContent,{children:e.map(e=>(0,f.jsx)(o.SelectItem,{value:e.toString(),children:i(e)},e))})]})]})}function w({timeZones:e,selected:t,onChange:n,disabled:r}){return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(d.Globe,{className:`h-4 w-4 text-muted-foreground`}),(0,f.jsxs)(o.Select,{value:t,onValueChange:n,disabled:r,children:[(0,f.jsx)(o.SelectTrigger,{className:`w-[180px] h-8 text-xs`,children:(0,f.jsx)(o.SelectValue,{})}),(0,f.jsx)(o.SelectContent,{children:e.map(e=>(0,f.jsx)(o.SelectItem,{value:e,children:e.replace(/_/g,` `)},e))})]})]})}function ne({recurrence:e,onChange:t,disabled:n}){return(0,f.jsxs)(s.Popover,{children:[(0,f.jsx)(s.PopoverTrigger,{asChild:!0,children:(0,f.jsxs)(r.Button,{variant:e.enabled?`default`:`outline`,size:`sm`,disabled:n,className:`h-8 text-xs gap-1.5`,children:[(0,f.jsx)(d.Repeat,{className:`h-3.5 w-3.5`}),e.enabled?`Recurring`:`One-time`]})}),(0,f.jsx)(s.PopoverContent,{className:`w-80`,align:`start`,children:(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(a.Label,{htmlFor:`recurrence-enabled`,className:`text-sm font-medium`,children:`Enable recurrence`}),(0,f.jsx)(i.Checkbox,{id:`recurrence-enabled`,checked:e.enabled,onCheckedChange:n=>t({...e,enabled:n})})]}),e.enabled&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(a.Label,{className:`text-xs text-muted-foreground`,children:`Pattern`}),(0,f.jsxs)(o.Select,{value:e.pattern,onValueChange:n=>t({...e,pattern:n}),children:[(0,f.jsx)(o.SelectTrigger,{className:`h-8 text-xs`,children:(0,f.jsx)(o.SelectValue,{})}),(0,f.jsxs)(o.SelectContent,{children:[(0,f.jsx)(o.SelectItem,{value:`daily`,children:`Daily`}),(0,f.jsx)(o.SelectItem,{value:`weekly`,children:`Weekly`}),(0,f.jsx)(o.SelectItem,{value:`biweekly`,children:`Bi-weekly`}),(0,f.jsx)(o.SelectItem,{value:`monthly`,children:`Monthly`})]})]})]}),e.pattern===`weekly`&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(a.Label,{className:`text-xs text-muted-foreground`,children:`Days of week`}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:h.map((n,i)=>(0,f.jsx)(r.Button,{variant:e.daysOfWeek?.includes(i)?`default`:`outline`,size:`sm`,className:`h-7 w-9 text-xs p-0`,onClick:()=>{let n=e.daysOfWeek||[],r=n.includes(i)?n.filter(e=>e!==i):[...n,i];t({...e,daysOfWeek:r})},children:n.charAt(0)},n))})]})]})]})})]})}function re({slots:e,onRemove:t,onClear:i,hourFormat:a,locale:o}){return e.length===0?null:(0,f.jsxs)(`div`,{className:`border-t pt-3 mt-3 space-y-2 animate-in slide-in-from-bottom-2 duration-200`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:[`Selected (`,e.length,`)`]}),(0,f.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 text-xs text-muted-foreground hover:text-destructive`,onClick:i,children:`Clear all`})]}),(0,f.jsx)(c.ScrollArea,{className:`max-h-[120px]`,children:(0,f.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map(e=>(0,f.jsxs)(n.Badge,{variant:`secondary`,className:`pr-1 text-xs animate-in fade-in-0 zoom-in-95 duration-200`,children:[(0,f.jsxs)(`span`,{className:`mr-1`,children:[v(e.date,o),` `,_(e.startTime,a)]}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`ml-0.5 rounded-full hover:bg-muted-foreground/20 p-0.5`,children:(0,f.jsx)(d.X,{className:`h-3 w-3`})})]},e.id))})})]})}function T({slots:e,selectedSlots:i,onSlotsChange:a,multiSelect:o=!1,durations:s=p,selectedDuration:_,onDurationChange:S,timeZones:T=m,selectedTimeZone:E,onTimeZoneChange:D,businessHours:O,showRecurrence:ie=!1,recurrence:k,onRecurrenceChange:A,weekStartsOn:j=0,minDate:M,maxDate:N,hourFormat:P=`24h`,locale:F=`en-US`,disabled:I=!1,className:ae,slotInterval:L=30,showSummary:oe=!0,renderSlot:R}){let[z,B]=u.useState(()=>y(M||new Date,j)[0]),[V,H]=u.useState(i||[]),[U,W]=u.useState(_||30),[G,K]=u.useState(E||`UTC`),[se,ce]=u.useState(k||{enabled:!1,pattern:`weekly`}),q=i??V,le=_??U,ue=E??G,de=k??se,J=u.useMemo(()=>y(z,j),[z,j]),Y=u.useMemo(()=>{if(e&&e.length>0)return e;let t=[];return J.forEach(e=>{let n=ee(e,L,O);t.push(...n)}),t},[e,J,L,O]),X=u.useMemo(()=>{let e=new Map;return Y.forEach(t=>{let n=l.localDateKey(t.date);e.has(n)||e.set(n,[]),e.get(n).push(t)}),e},[Y]),fe=u.useMemo(()=>Y.filter(e=>q.includes(e.id)),[Y,q]),Z=e=>{if(I)return;let t=Y.find(t=>t.id===e);if(!t||t.status===`booked`||t.status===`unavailable`)return;let n;n=q.includes(e)?q.filter(t=>t!==e):o?[...q,e]:[e],i||H(n),a?.(n)},pe=e=>{let t=q.filter(t=>t!==e);i||H(t),a?.(t)},me=()=>{i||H([]),a?.([])},Q=e=>{_||W(e),S?.(e)},he=e=>{E||K(e),D?.(e)},ge=e=>{k||ce(e),A?.(e)},_e=()=>{let e=new Date(z);e.setDate(e.getDate()-7),!(M&&e<M)&&B(e)},ve=()=>{let e=new Date(z);e.setDate(e.getDate()+7),!(N&&e>N)&&B(e)},ye=()=>{let e=y(new Date,j);B(e[0])},be=!M||z>M,xe=!N||J[6]<N,$=new Date,Se=J.some(e=>b(e,$));return(0,f.jsxs)(`div`,{className:t.cn(`rounded-lg border bg-card text-card-foreground shadow-sm`,I&&`opacity-60 pointer-events-none`,ae),children:[(0,f.jsxs)(`div`,{className:`p-3 border-b space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(r.Button,{variant:`outline`,size:`icon`,className:`h-8 w-8`,onClick:_e,disabled:!be,children:(0,f.jsx)(d.ChevronLeft,{className:`h-4 w-4`})}),(0,f.jsx)(r.Button,{variant:`outline`,size:`icon`,className:`h-8 w-8`,onClick:ve,disabled:!xe,children:(0,f.jsx)(d.ChevronRight,{className:`h-4 w-4`})}),!Se&&(0,f.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-8 text-xs`,onClick:ye,children:[(0,f.jsx)(d.CalendarDays,{className:`h-3.5 w-3.5 mr-1`}),`Today`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium`,children:[(0,f.jsx)(d.Calendar,{className:`h-4 w-4 text-muted-foreground mr-1`}),(0,f.jsxs)(`span`,{children:[v(J[0],F),` - `,v(J[6],F)]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,f.jsx)(te,{durations:s,selected:le,onChange:Q,disabled:I}),(0,f.jsx)(w,{timeZones:T,selected:ue,onChange:he,disabled:I}),ie&&(0,f.jsx)(ne,{recurrence:de,onChange:ge,disabled:I})]})]}),(0,f.jsxs)(`div`,{className:`p-3`,children:[(0,f.jsx)(`div`,{className:`hidden md:block overflow-x-auto`,children:(0,f.jsx)(`div`,{className:`grid grid-cols-7 gap-2 min-w-[700px]`,children:J.map((e,n)=>{let r=l.localDateKey(e),i=X.get(r)||[],a=b(e,$),o=e.getDay(),s=O?O.daysOfWeek.includes(o):!0;return(0,f.jsxs)(`div`,{className:t.cn(`flex flex-col rounded-lg border bg-card`,a&&`ring-2 ring-primary/50`,!s&&`opacity-60`),children:[(0,f.jsxs)(`div`,{className:t.cn(`px-2 py-2 text-center border-b`,a&&`bg-primary/10`),children:[(0,f.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:h[o]}),(0,f.jsx)(`div`,{className:t.cn(`text-lg font-semibold`,a&&`text-primary`),children:e.getDate()})]}),(0,f.jsx)(c.ScrollArea,{className:`flex-1 max-h-[300px]`,children:(0,f.jsx)(`div`,{className:`p-1.5 space-y-1`,children:i.map(e=>(0,f.jsx)(C,{slot:e,isSelected:q.includes(e.id),onClick:()=>Z(e.id),hourFormat:P,disabled:I,isBusinessHour:x(e.startTime,O,o),renderSlot:R},e.id))})})]},r)})})}),(0,f.jsx)(`div`,{className:`md:hidden`,children:(0,f.jsx)(c.ScrollArea,{className:`h-[400px]`,children:(0,f.jsx)(`div`,{className:`space-y-3`,children:J.map(e=>{let r=l.localDateKey(e),i=X.get(r)||[],a=b(e,$),o=e.getDay(),s=O?O.daysOfWeek.includes(o):!0;return(0,f.jsxs)(`div`,{className:t.cn(`rounded-lg border bg-card`,a&&`ring-2 ring-primary/50`,!s&&`opacity-60`),children:[(0,f.jsxs)(`div`,{className:t.cn(`px-3 py-2 border-b flex items-center justify-between`,a&&`bg-primary/10`),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:t.cn(`text-lg font-semibold`,a&&`text-primary`),children:e.getDate()}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:g[o]})]}),a&&(0,f.jsx)(n.Badge,{variant:`secondary`,className:`text-xs`,children:`Today`})]}),(0,f.jsx)(`div`,{className:`p-2`,children:(0,f.jsx)(`div`,{className:`flex gap-1.5 overflow-x-auto pb-1`,children:i.filter(e=>e.status!==`unavailable`).map(e=>(0,f.jsx)(C,{slot:e,isSelected:q.includes(e.id),onClick:()=>Z(e.id),hourFormat:P,disabled:I,isBusinessHour:x(e.startTime,O,o),renderSlot:R},e.id))})})]},r)})})})})]}),oe&&(0,f.jsx)(`div`,{className:`px-3 pb-3`,children:(0,f.jsx)(re,{slots:fe,onRemove:pe,onClear:me,hourFormat:P,locale:F})})]})}T.displayName=`WakaSchedulePicker`,exports.WakaSchedulePicker=T,exports.default=T,exports.useSchedulePicker=S;
|
|
@@ -357,7 +357,8 @@ function L({ slots: r, selectedSlots: i, onSlotsChange: a, multiSelect: o = !1,
|
|
|
357
357
|
let e = new Date(H);
|
|
358
358
|
e.setDate(e.getDate() + 7), !(O && e > O) && U(e);
|
|
359
359
|
}, Ce = () => {
|
|
360
|
-
|
|
360
|
+
let e = A(/* @__PURE__ */ new Date(), S);
|
|
361
|
+
U(e[0]);
|
|
361
362
|
}, we = !C || H > C, Te = !O || J[6] < O, $ = /* @__PURE__ */ new Date(), Ee = J.some((e) => j(e, $));
|
|
362
363
|
return /* @__PURE__ */ T("div", {
|
|
363
364
|
className: e("rounded-lg border bg-card text-card-foreground shadow-sm", R && "opacity-60 pointer-events-none", se),
|
|
@@ -523,4 +524,4 @@ function L({ slots: r, selectedSlots: i, onSlotsChange: a, multiSelect: o = !1,
|
|
|
523
524
|
}
|
|
524
525
|
L.displayName = "WakaSchedulePicker";
|
|
525
526
|
//#endregion
|
|
526
|
-
export { L as default, N as useSchedulePicker };
|
|
527
|
+
export { L as WakaSchedulePicker, L as default, N as useSchedulePicker };
|
|
@@ -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={common:{gradient:`from-slate-400 to-slate-600`,glowColor:`hsl(var(--muted-foreground))`,borderColor:`border-slate-400`,bgColor:`bg-slate-100`,textColor:`text-slate-600`,label:`Common`,icon:(0,i.jsx)(r.Star,{className:`w-6 h-6`})},rare:{gradient:`from-blue-400 to-blue-600`,glowColor:`hsl(var(--info))`,borderColor:`border-blue-400`,bgColor:`bg-blue-100`,textColor:`text-blue-600`,label:`Rare`,icon:(0,i.jsx)(r.Gem,{className:`w-6 h-6`})},epic:{gradient:`from-purple-400 to-purple-600`,glowColor:`hsl(var(--chart-3))`,borderColor:`border-purple-400`,bgColor:`bg-purple-100`,textColor:`text-purple-600`,label:`Epic`,icon:(0,i.jsx)(r.Crown,{className:`w-6 h-6`})},legendary:{gradient:`from-amber-400 via-orange-500 to-red-500`,glowColor:`hsl(var(--warning))`,borderColor:`border-amber-400`,bgColor:`bg-amber-100`,textColor:`text-amber-600`,label:`Legendary`,icon:(0,i.jsx)(r.Trophy,{className:`w-6 h-6`})}};function o({initialPercentage:e=0,threshold:t=60,onReveal:r}={}){let[i,a]=n.useState(e),[o,s]=n.useState(!1),[c,l]=n.useState(!1),u=n.useCallback(()=>{s(!0),a(100),r?.()},[r]),d=n.useCallback(()=>{a(0),s(!1),l(!1)},[]),f=n.useCallback(()=>{l(!0)},[]),p=n.useCallback(()=>{l(!1)},[]);return n.useEffect(()=>{!o&&i>=t&&u()},[i,t,o,u]),{percentage:i,isRevealed:o,isScratching:c,setPercentage:a,reveal:u,reset:d,startScratching:f,stopScratching:p}}function s(e,t){return Array.from({length:e},(e,n)=>({id:n,x:50+(Math.random()-.5)*40,y:50+(Math.random()-.5)*40,size:6+Math.random()*8,color:t[Math.floor(Math.random()*t.length)],delay:Math.random()*.3,duration:.8+Math.random()*.6,angle:Math.random()*360}))}function c({prize:e,revealed:o,width:c,height:l,renderPrize:u}){let d=a[e.rarity],f=n.useMemo(()=>s(20,[d.glowColor,`#ffffff`,d.glowColor+`80`]),[d.glowColor]);return u?(0,i.jsx)(i.Fragment,{children:u(e,o)}):(0,i.jsxs)(`div`,{className:t.cn(`relative w-full h-full flex flex-col items-center justify-center p-4`,`bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900`,`transition-all duration-500`,o&&`animate-scratch-card-prize-reveal`),style:{width:c,height:l},children:[(0,i.jsx)(`div`,{className:`absolute inset-0 opacity-10`,children:(0,i.jsxs)(`svg`,{width:`100%`,height:`100%`,"aria-hidden":`true`,focusable:`false`,children:[(0,i.jsx)(`pattern`,{id:`prize-pattern`,width:`20`,height:`20`,patternUnits:`userSpaceOnUse`,children:(0,i.jsx)(`circle`,{cx:`10`,cy:`10`,r:`1`,fill:`currentColor`})}),(0,i.jsx)(`rect`,{width:`100%`,height:`100%`,fill:`url(#prize-pattern)`})]})}),o&&(0,i.jsx)(`div`,{className:`absolute inset-0 overflow-hidden pointer-events-none`,children:f.map(e=>(0,i.jsx)(`div`,{className:`absolute animate-scratch-card-confetti`,style:{left:`${e.x}%`,top:`${e.y}%`,width:e.size,height:e.size,backgroundColor:e.color,borderRadius:Math.random()>.5?`50%`:`2px`,animationDelay:`${e.delay}s`,animationDuration:`${e.duration}s`,"--confetti-angle":`${e.angle}deg`}},e.id))}),o&&(0,i.jsx)(`div`,{className:`absolute inset-0 animate-scratch-card-glow`,style:{background:`radial-gradient(circle at center, ${d.glowColor}40 0%, transparent 70%)`}}),(0,i.jsx)(`div`,{className:t.cn(`absolute top-3 left-1/2 -translate-x-1/2 px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider`,d.bgColor,d.textColor,`transition-all duration-500`,o?`opacity-100 translate-y-0`:`opacity-0 -translate-y-4`),children:d.label}),(0,i.jsxs)(`div`,{className:t.cn(`relative flex items-center justify-center rounded-xl mb-3 transition-all duration-700`,`bg-gradient-to-br`,d.gradient,o?`scale-100 opacity-100`:`scale-50 opacity-0`),style:{width:Math.min(c,l)*.35,height:Math.min(c,l)*.35,boxShadow:o?`0 0 30px 10px ${d.glowColor}40`:`none`},children:[e.imageUrl?(0,i.jsx)(`img`,{src:e.imageUrl,alt:e.name,className:`w-full h-full object-contain rounded-xl`}):e.icon?(0,i.jsx)(`div`,{className:`text-white w-1/2 h-1/2 flex items-center justify-center`,children:e.icon}):(0,i.jsx)(`div`,{className:`text-white`,children:d.icon}),o&&(0,i.jsx)(`div`,{className:`absolute inset-0 rounded-xl overflow-hidden`,children:(0,i.jsx)(`div`,{className:`absolute inset-0 animate-scratch-card-shine`})})]}),(0,i.jsx)(`h3`,{className:t.cn(`text-lg font-bold text-white text-center mb-1 transition-all duration-500`,o?`opacity-100 translate-y-0`:`opacity-0 translate-y-4`),style:{transitionDelay:o?`0.2s`:`0s`},children:e.name}),e.value&&(0,i.jsx)(`div`,{className:t.cn(`text-2xl font-bold transition-all duration-500`,d.textColor.replace(`text-`,`text-`).replace(`-600`,`-400`),o?`opacity-100 translate-y-0`:`opacity-0 translate-y-4`),style:{transitionDelay:o?`0.3s`:`0s`,color:d.glowColor},children:e.value}),e.description&&(0,i.jsx)(`p`,{className:t.cn(`text-sm text-gray-400 text-center mt-2 transition-all duration-500`,o?`opacity-100 translate-y-0`:`opacity-0 translate-y-4`),style:{transitionDelay:o?`0.4s`:`0s`},children:e.description}),!o&&(0,i.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-gray-500`,children:[(0,i.jsx)(r.Gift,{className:`w-12 h-12 animate-pulse`}),(0,i.jsx)(`span`,{className:`text-sm`,children:`Scratch to reveal!`})]})]})}var l=n.forwardRef(({prize:e,width:o=300,height:s=200,revealThreshold:l=.6,brushSize:u=40,overlayImage:d,overlayPattern:f=`gradient`,overlayColor:p=`#c0c0c0`,enableSound:m=!1,scratchSoundSrc:h,revealSoundSrc:g,onScratchStart:_,onScratch:v,onReveal:y,onReset:b,disabled:x=!1,showProgress:S=!1,renderPrize:C,className:w,...T},E)=>{let D=n.useRef(null),[O,k]=n.useState(!1),[A,j]=n.useState(0),[M,N]=n.useState(!1),[P,F]=n.useState(!1),[I,L]=n.useState(m),R=n.useRef(null),z=n.useRef(null),B=n.useRef(null),V=a[e.rarity],H=n.useCallback(()=>{let e=D.current;if(!e)return;let t=e.getContext(`2d`);if(t){switch(e.width=o,e.height=s,f){case`solid`:t.fillStyle=p,t.fillRect(0,0,o,s);break;case`stripes`:t.fillStyle=p,t.fillRect(0,0,o,s),t.strokeStyle=U(p,-20),t.lineWidth=20/2;for(let e=-s;e<o+s;e+=20)t.beginPath(),t.moveTo(e,0),t.lineTo(e+s,s),t.stroke();break;case`dots`:t.fillStyle=p,t.fillRect(0,0,o,s),t.fillStyle=U(p,-15);for(let e=15;e<o;e+=15)for(let n=15;n<s;n+=15)t.beginPath(),t.arc(e,n,4,0,Math.PI*2),t.fill();break;default:let e=t.createLinearGradient(0,0,o,s);e.addColorStop(0,U(p,10)),e.addColorStop(.5,p),e.addColorStop(1,U(p,-10)),t.fillStyle=e,t.fillRect(0,0,o,s),t.fillStyle=`rgba(255, 255, 255, 0.1)`,t.beginPath(),t.moveTo(0,0),t.lineTo(o*.3,0),t.lineTo(0,s*.3),t.closePath(),t.fill();break}if(d){let e=new Image;e.crossOrigin=`anonymous`,e.onload=()=>{t.drawImage(e,0,0,o,s)},e.src=d}t.fillStyle=`rgba(0, 0, 0, 0.3)`,t.font=`bold 16px system-ui, sans-serif`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(`Scratch here!`,o/2,s/2),t.strokeStyle=`rgba(255, 255, 255, 0.3)`,t.lineWidth=2,t.setLineDash([5,5]),t.strokeRect(10,10,o-20,s-20)}},[o,s,p,f,d]);function U(e,t){let n=e.replace(`#`,``),r=Math.max(0,Math.min(255,parseInt(n.slice(0,2),16)+t)),i=Math.max(0,Math.min(255,parseInt(n.slice(2,4),16)+t)),a=Math.max(0,Math.min(255,parseInt(n.slice(4,6),16)+t));return`#${r.toString(16).padStart(2,`0`)}${i.toString(16).padStart(2,`0`)}${a.toString(16).padStart(2,`0`)}`}let W=n.useCallback(()=>{let e=D.current;if(!e)return 0;let t=e.getContext(`2d`);if(!t)return 0;let n=t.getImageData(0,0,e.width,e.height).data,r=0,i=n.length/4;for(let e=0;e<n.length;e+=4)n[e+3]<128&&r++;return r/i},[]),G=n.useCallback((t,n)=>{let r=D.current;if(!r||x||M)return;let i=r.getContext(`2d`);if(!i)return;let a=r.getBoundingClientRect(),o=r.width/a.width,s=r.height/a.height,c=(t-a.left)*o,d=(n-a.top)*s;i.globalCompositeOperation=`destination-out`,i.beginPath(),R.current?(i.moveTo(R.current.x,R.current.y),i.lineTo(c,d),i.lineWidth=u,i.lineCap=`round`,i.lineJoin=`round`,i.stroke()):(i.arc(c,d,u/2,0,Math.PI*2),i.fill()),R.current={x:c,y:d};let f=W();j(f),v?.(f*100),f>=l&&!M&&(N(!0),y?.(e),I&&g&&(B.current=new Audio(g),B.current.play().catch(()=>{})),setTimeout(()=>{i&&(i.globalCompositeOperation=`destination-out`,i.fillRect(0,0,r.width,r.height))},100))},[x,M,u,W,l,e,v,y,I,g]),K=n.useCallback(e=>{x||M||(k(!0),R.current=null,P||(F(!0),_?.()),I&&h&&(z.current=new Audio(h),z.current.loop=!0,z.current.volume=.5,z.current.play().catch(()=>{})),G(e.clientX,e.clientY),e.currentTarget.setPointerCapture(e.pointerId))},[x,M,P,I,h,_,G]),q=n.useCallback(e=>{O&&G(e.clientX,e.clientY)},[O,G]),J=n.useCallback(()=>{k(!1),R.current=null,z.current&&=(z.current.pause(),null)},[]),Y=n.useCallback(()=>{N(!1),j(0),F(!1),R.current=null,H(),b?.()},[H,b]);return n.useEffect(()=>{H()},[H]),n.useEffect(()=>()=>{z.current?.pause(),B.current?.pause()},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes scratch-card-prize-reveal {
|
|
3
3
|
0% { transform: scale(0.95); }
|
|
4
4
|
50% { transform: scale(1.02); }
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
.animate-scratch-card-pulse-border {
|
|
59
59
|
animation: scratch-card-pulse-border 2s ease-in-out infinite;
|
|
60
60
|
}
|
|
61
|
-
`}),(0,i.jsxs)(`div`,{ref:E,className:t.cn(`relative inline-block rounded-xl overflow-hidden shadow-xl select-none`,`transition-all duration-300`,x&&`opacity-50 cursor-not-allowed`,M&&`animate-scratch-card-pulse-border`,w),style:{width:o,height:s,"--glow-color":`${V.glowColor}60`},...T,children:[(0,i.jsx)(`div`,{className:`absolute inset-0`,children:(0,i.jsx)(c,{prize:e,revealed:M,width:o,height:s,renderPrize:C})}),(0,i.jsx)(`canvas`,{ref:D,className:t.cn(`absolute inset-0 touch-none`,x?`cursor-not-allowed`:`cursor-crosshair`,M&&`pointer-events-none opacity-0 transition-opacity duration-500`),style:{width:o,height:s},onPointerDown:K,onPointerMove:q,onPointerUp:J,onPointerLeave:J,onPointerCancel:J}),S&&!M&&P&&(0,i.jsxs)(`div`,{className:`absolute bottom-2 left-2 right-2`,children:[(0,i.jsx)(`div`,{className:`h-1 bg-black/30 rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:`h-full bg-white/80 rounded-full transition-all duration-100`,style:{width:`${Math.min(A/l*100,100)}%`}})}),(0,i.jsxs)(`p`,{className:`text-[10px] text-white/60 text-center mt-1`,children:[Math.round(A*100),`% scratched`]})]}),m&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>L(!I),className:t.cn(`absolute top-2 right-2 p-1.5 rounded-full`,`bg-black/30 hover:bg-black/50 transition-colors`,`text-white/80 hover:text-white`,`z-10`),"aria-label":I?`Mute sound`:`Unmute sound`,children:I?(0,i.jsx)(r.Volume2,{className:`w-4 h-4`}):(0,i.jsx)(r.VolumeX,{className:`w-4 h-4`})}),M&&(0,i.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,children:[...Array(8)].map((e,t)=>(0,i.jsx)(r.Sparkles,{className:`absolute text-yellow-400 animate-ping`,style:{width:16+Math.random()*16,height:16+Math.random()*16,left:`${10+Math.random()*80}%`,top:`${10+Math.random()*80}%`,animationDelay:`${Math.random()*.5}s`,animationDuration:`${1+Math.random()*.5}s`}},t))}),M&&(0,i.jsx)(`button`,{type:`button`,onClick:Y,className:t.cn(`absolute bottom-3 right-3 px-3 py-1.5 rounded-full text-xs font-medium`,`bg-white/20 hover:bg-white/30 backdrop-blur-sm`,`text-white transition-all duration-200`,`hover:scale-105 active:scale-95`),children:`Reset`})]})]})});l.displayName=`WakaScratchCard`,exports.default=l,exports.useScratchCard=o;
|
|
61
|
+
`}),(0,i.jsxs)(`div`,{ref:E,className:t.cn(`relative inline-block rounded-xl overflow-hidden shadow-xl select-none`,`transition-all duration-300`,x&&`opacity-50 cursor-not-allowed`,M&&`animate-scratch-card-pulse-border`,w),style:{width:o,height:s,"--glow-color":`${V.glowColor}60`},...T,children:[(0,i.jsx)(`div`,{className:`absolute inset-0`,children:(0,i.jsx)(c,{prize:e,revealed:M,width:o,height:s,renderPrize:C})}),(0,i.jsx)(`canvas`,{ref:D,className:t.cn(`absolute inset-0 touch-none`,x?`cursor-not-allowed`:`cursor-crosshair`,M&&`pointer-events-none opacity-0 transition-opacity duration-500`),style:{width:o,height:s},onPointerDown:K,onPointerMove:q,onPointerUp:J,onPointerLeave:J,onPointerCancel:J}),S&&!M&&P&&(0,i.jsxs)(`div`,{className:`absolute bottom-2 left-2 right-2`,children:[(0,i.jsx)(`div`,{className:`h-1 bg-black/30 rounded-full overflow-hidden`,children:(0,i.jsx)(`div`,{className:`h-full bg-white/80 rounded-full transition-all duration-100`,style:{width:`${Math.min(A/l*100,100)}%`}})}),(0,i.jsxs)(`p`,{className:`text-[10px] text-white/60 text-center mt-1`,children:[Math.round(A*100),`% scratched`]})]}),m&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>L(!I),className:t.cn(`absolute top-2 right-2 p-1.5 rounded-full`,`bg-black/30 hover:bg-black/50 transition-colors`,`text-white/80 hover:text-white`,`z-10`),"aria-label":I?`Mute sound`:`Unmute sound`,children:I?(0,i.jsx)(r.Volume2,{className:`w-4 h-4`}):(0,i.jsx)(r.VolumeX,{className:`w-4 h-4`})}),M&&(0,i.jsx)(`div`,{className:`absolute inset-0 pointer-events-none`,children:[...Array(8)].map((e,t)=>(0,i.jsx)(r.Sparkles,{className:`absolute text-yellow-400 animate-ping`,style:{width:16+Math.random()*16,height:16+Math.random()*16,left:`${10+Math.random()*80}%`,top:`${10+Math.random()*80}%`,animationDelay:`${Math.random()*.5}s`,animationDuration:`${1+Math.random()*.5}s`}},t))}),M&&(0,i.jsx)(`button`,{type:`button`,onClick:Y,className:t.cn(`absolute bottom-3 right-3 px-3 py-1.5 rounded-full text-xs font-medium`,`bg-white/20 hover:bg-white/30 backdrop-blur-sm`,`text-white transition-all duration-200`,`hover:scale-105 active:scale-95`),children:`Reset`})]})]})});l.displayName=`WakaScratchCard`,exports.WakaScratchCard=l,exports.default=l,exports.useScratchCard=o;
|
|
@@ -370,4 +370,4 @@ var _ = t.forwardRef(({ prize: n, width: r = 300, height: i = 200, revealThresho
|
|
|
370
370
|
});
|
|
371
371
|
_.displayName = "WakaScratchCard";
|
|
372
372
|
//#endregion
|
|
373
|
-
export { _ as default, m as useScratchCard };
|
|
373
|
+
export { _ as WakaScratchCard, _ as default, m as useScratchCard };
|
|
@@ -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){let t=new Date,n=e.getTime()-t.getTime();if(n<=0)return`Season ended`;let r=Math.floor(n/(1e3*60*60*24)),i=Math.floor(n%(1e3*60*60*24)/(1e3*60*60)),a=Math.floor(n%(1e3*60*60)/(1e3*60));return r>0?`${r}d ${i}h remaining`:i>0?`${i}h ${a}m remaining`:`${a}m remaining`}function o(e,t){return e.find(e=>e.level===t+1)?.xpRequired??0}function s(e,t){return e.find(e=>e.level===t)?.xpRequired??0}function c({active:e,onComplete:t}){let[a,o]=n.useState(!1);if(n.useEffect(()=>{if(e){o(!0);let e=setTimeout(()=>{o(!1),t?.()},1e3);return()=>clearTimeout(e)}},[e,t]),!a)return null;let s=[`#fbbf24`,`#f59e0b`,`#22c55e`,`#8b5cf6`,`#06b6d4`];return(0,i.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 overflow-hidden`,children:[[...Array(20)].map((e,t)=>{let n=t/20*360,r=40+Math.random()*30,a=4+Math.random()*4;return(0,i.jsx)(`div`,{className:`absolute left-1/2 top-1/2 rounded-full animate-claim-particle`,style:{width:a,height:a,backgroundColor:s[Math.floor(Math.random()*s.length)],"--angle":`${n}deg`,"--distance":`${r}px`,animationDelay:`${Math.random()*.1}s`}},t)}),[...[,,,,,,]].map((e,t)=>(0,i.jsx)(r.Sparkles,{className:`absolute animate-claim-sparkle`,style:{left:`${20+Math.random()*60}%`,top:`${20+Math.random()*60}%`,color:s[Math.floor(Math.random()*s.length)],animationDelay:`${t*.1}s`}},`sparkle-${t}`)),(0,i.jsx)(`style`,{children:`
|
|
2
2
|
@keyframes claim-particle {
|
|
3
3
|
0% {
|
|
4
4
|
transform: translate(-50%, -50%) rotate(var(--angle)) translateX(0) scale(1);
|