@vertesia/ui 1.5.0-dev.20260717.131047Z → 1.5.0-dev.20260722.120446Z
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/lib/core/components/SidePanel.js +1 -1
- package/lib/core/components/SidePanel.js.map +1 -1
- package/lib/core/components/shadcn/button.d.ts +10 -3
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +41 -9
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/modal/dialog.js +1 -1
- package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
- package/lib/core/components/shadcn/theme/ThemeSwitcher.js +1 -1
- package/lib/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -1
- package/lib/features/agent/chat/AgentChatPlaybackControls.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentChatPlaybackControls.js +2 -2
- package/lib/features/agent/chat/AgentChatPlaybackControls.js.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentRequestInputOverlay.js +2 -2
- package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
- package/lib/features/agent/chat/ArtifactsTab.js +5 -2
- package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
- package/lib/features/agent/chat/ImageLightbox.d.ts.map +1 -1
- package/lib/features/agent/chat/ImageLightbox.js +1 -1
- package/lib/features/agent/chat/ImageLightbox.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +5 -5
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.js +4 -2
- package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +2 -2
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +2 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts +6 -0
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js +15 -1
- package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js.map +1 -1
- package/lib/features/environment/SelectEnvironment.d.ts +28 -0
- package/lib/features/environment/SelectEnvironment.d.ts.map +1 -0
- package/lib/features/environment/SelectEnvironment.js +97 -0
- package/lib/features/environment/SelectEnvironment.js.map +1 -0
- package/lib/features/environment/index.d.ts +2 -0
- package/lib/features/environment/index.d.ts.map +1 -0
- package/lib/features/environment/index.js +2 -0
- package/lib/features/environment/index.js.map +1 -0
- package/lib/features/index.d.ts +2 -0
- package/lib/features/index.d.ts.map +1 -1
- package/lib/features/index.js +2 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.js +12 -12
- package/lib/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
- package/lib/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
- package/lib/features/magic-pdf/DownloadPopover.js +3 -17
- package/lib/features/magic-pdf/DownloadPopover.js.map +1 -1
- package/lib/features/magic-pdf/ExtractedContentView.js +2 -6
- package/lib/features/magic-pdf/ExtractedContentView.js.map +1 -1
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts +25 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js +42 -0
- package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionView.d.ts +27 -0
- package/lib/features/magic-pdf/GroundedExtractionView.d.ts.map +1 -0
- package/lib/features/magic-pdf/GroundedExtractionView.js +377 -0
- package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -0
- package/lib/features/magic-pdf/MagicPdfProvider.d.ts +0 -2
- package/lib/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -1
- package/lib/features/magic-pdf/MagicPdfProvider.js +15 -42
- package/lib/features/magic-pdf/MagicPdfProvider.js.map +1 -1
- package/lib/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
- package/lib/features/magic-pdf/MagicPdfView.js +2 -19
- package/lib/features/magic-pdf/MagicPdfView.js.map +1 -1
- package/lib/features/magic-pdf/index.d.ts +1 -0
- package/lib/features/magic-pdf/index.d.ts.map +1 -1
- package/lib/features/magic-pdf/index.js +1 -0
- package/lib/features/magic-pdf/index.js.map +1 -1
- package/lib/features/magic-pdf/types.d.ts +1 -1
- package/lib/features/magic-pdf/types.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsButton.js +2 -2
- package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
- package/lib/features/oauth/McpConnectionsDialog.d.ts.map +1 -1
- package/lib/features/oauth/McpConnectionsDialog.js +1 -1
- package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.d.ts.map +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.js +1 -1
- package/lib/features/oauth/RemoteMcpConnectionButton.js.map +1 -1
- package/lib/features/pdf-viewer/PdfPageSlider.js +2 -2
- package/lib/features/pdf-viewer/PdfPageSlider.js.map +1 -1
- package/lib/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -1
- package/lib/features/pdf-viewer/SimplePdfViewer.js +3 -3
- package/lib/features/pdf-viewer/SimplePdfViewer.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/DocumentQuickFilter.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentQuickFilter.js +5 -5
- package/lib/features/store/objects/DocumentQuickFilter.js.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.js +2 -2
- package/lib/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.js +1 -1
- package/lib/features/store/objects/components/ContentDispositionButton.js.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.js +78 -21
- package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/features/store/objects/components/DocumentIcon.js +1 -1
- package/lib/features/store/objects/components/VectorSearchWidget.js +1 -1
- package/lib/features/store/objects/components/VectorSearchWidget.js.map +1 -1
- package/lib/features/store/objects/components/useContentPanelHooks.d.ts +1 -2
- package/lib/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -1
- package/lib/features/store/objects/components/useContentPanelHooks.js +4 -8
- package/lib/features/store/objects/components/useContentPanelHooks.js.map +1 -1
- package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
- package/lib/features/store/objects/layout/renderers.js +2 -2
- package/lib/features/store/objects/layout/renderers.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.js +4 -4
- package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
- package/lib/features/store/types/IntakePolicyEditor.d.ts +15 -0
- package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -0
- package/lib/features/store/types/IntakePolicyEditor.js +455 -0
- package/lib/features/store/types/IntakePolicyEditor.js.map +1 -0
- package/lib/features/store/types/IntakePolicyForm.d.ts +11 -0
- package/lib/features/store/types/IntakePolicyForm.d.ts.map +1 -0
- package/lib/features/store/types/IntakePolicyForm.js +91 -0
- package/lib/features/store/types/IntakePolicyForm.js.map +1 -0
- package/lib/features/store/types/SelectContentTypeModal.js +1 -1
- package/lib/features/store/types/SelectContentTypeModal.js.map +1 -1
- package/lib/features/store/types/index.d.ts +2 -0
- package/lib/features/store/types/index.d.ts.map +1 -1
- package/lib/features/store/types/index.js +2 -0
- package/lib/features/store/types/index.js.map +1 -1
- package/lib/features/store/types/intake-policy-editor.logic.d.ts +7 -0
- package/lib/features/store/types/intake-policy-editor.logic.d.ts.map +1 -0
- package/lib/features/store/types/intake-policy-editor.logic.js +60 -0
- package/lib/features/store/types/intake-policy-editor.logic.js.map +1 -0
- package/lib/features/store/types/typeCatalogCache.d.ts +5 -0
- package/lib/features/store/types/typeCatalogCache.d.ts.map +1 -0
- package/lib/features/store/types/typeCatalogCache.js +40 -0
- package/lib/features/store/types/typeCatalogCache.js.map +1 -0
- package/lib/features/user/UserInfo.js +7 -3
- package/lib/features/user/UserInfo.js.map +1 -1
- package/lib/features/views/ViewExperience.d.ts +20 -0
- package/lib/features/views/ViewExperience.d.ts.map +1 -0
- package/lib/features/views/ViewExperience.js +188 -0
- package/lib/features/views/ViewExperience.js.map +1 -0
- package/lib/features/views/ViewNavigation.d.ts +3 -0
- package/lib/features/views/ViewNavigation.d.ts.map +1 -0
- package/lib/features/views/ViewNavigation.js +36 -0
- package/lib/features/views/ViewNavigation.js.map +1 -0
- package/lib/features/views/ViewResults.d.ts +9 -0
- package/lib/features/views/ViewResults.d.ts.map +1 -0
- package/lib/features/views/ViewResults.js +229 -0
- package/lib/features/views/ViewResults.js.map +1 -0
- package/lib/features/views/ViewSearch.d.ts +3 -0
- package/lib/features/views/ViewSearch.d.ts.map +1 -0
- package/lib/features/views/ViewSearch.js +74 -0
- package/lib/features/views/ViewSearch.js.map +1 -0
- package/lib/features/views/index.d.ts +7 -0
- package/lib/features/views/index.d.ts.map +1 -0
- package/lib/features/views/index.js +7 -0
- package/lib/features/views/index.js.map +1 -0
- package/lib/features/views/types.d.ts +39 -0
- package/lib/features/views/types.d.ts.map +1 -0
- package/lib/features/views/types.js +2 -0
- package/lib/features/views/types.js.map +1 -0
- package/lib/features/views/viewState.d.ts +14 -0
- package/lib/features/views/viewState.d.ts.map +1 -0
- package/lib/features/views/viewState.js +117 -0
- package/lib/features/views/viewState.js.map +1 -0
- package/lib/i18n/locales/ar.json +16 -0
- package/lib/i18n/locales/de.json +12 -0
- package/lib/i18n/locales/en.json +245 -33
- package/lib/i18n/locales/es.json +13 -0
- package/lib/i18n/locales/fr.json +13 -0
- package/lib/i18n/locales/it.json +13 -0
- package/lib/i18n/locales/ja.json +11 -0
- package/lib/i18n/locales/ko.json +11 -0
- package/lib/i18n/locales/pt.json +13 -0
- package/lib/i18n/locales/ru.json +14 -0
- package/lib/i18n/locales/tr.json +12 -0
- package/lib/i18n/locales/zh-TW.json +11 -0
- package/lib/i18n/locales/zh.json +11 -0
- package/lib/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/router/HistoryNavigator.js +23 -13
- package/lib/router/HistoryNavigator.js.map +1 -1
- package/lib/router/Nav.d.ts.map +1 -1
- package/lib/router/Nav.js +15 -6
- package/lib/router/Nav.js.map +1 -1
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +5 -3
- package/lib/session/UserSession.js.map +1 -1
- package/lib/vertesia-ui-core.js +4 -4
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-features.js +34 -27
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.js +15 -15
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +7 -7
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/form/Form.js +1 -1
- package/lib/widgets/form/Form.js.map +1 -1
- package/lib/widgets/json-view/JSONSwitcher.js +1 -1
- package/lib/widgets/json-view/JSONSwitcher.js.map +1 -1
- package/lib/widgets/json-view/JSONView.js +6 -6
- package/lib/widgets/json-view/JSONView.js.map +1 -1
- package/lib/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
- package/lib/widgets/monacoEditor/MonacoEditor.js +29 -0
- package/lib/widgets/monacoEditor/MonacoEditor.js.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.d.ts +8 -0
- package/lib/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.js +16 -0
- package/lib/widgets/schema-editor/ManagedSchema.js.map +1 -1
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +2 -0
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js +1 -0
- package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.js +4 -1
- package/lib/widgets/schema-editor/editor/PropertyViewer.js.map +1 -1
- package/lib/widgets/schema-editor/editor/SchemaEditor.d.ts.map +1 -1
- package/lib/widgets/schema-editor/editor/SchemaEditor.js +22 -11
- package/lib/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
- package/package.json +32 -32
- package/src/__tests__/a11y.test.tsx +73 -0
- package/src/core/components/SidePanel.tsx +1 -1
- package/src/core/components/shadcn/button.tsx +67 -12
- package/src/core/components/shadcn/modal/dialog.tsx +1 -1
- package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +1 -1
- package/src/features/agent/chat/AgentChatPlaybackControls.tsx +0 -5
- package/src/features/agent/chat/AgentRequestInputOverlay.test.tsx +31 -0
- package/src/features/agent/chat/AgentRequestInputOverlay.tsx +6 -2
- package/src/features/agent/chat/ArtifactsTab.tsx +19 -9
- package/src/features/agent/chat/ImageLightbox.tsx +0 -1
- package/src/features/agent/chat/ModernAgentConversation.test.tsx +48 -0
- package/src/features/agent/chat/ModernAgentConversation.tsx +0 -2
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +6 -1
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +21 -15
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +3 -3
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +0 -2
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +4 -1
- package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.test.ts +80 -0
- package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.ts +21 -1
- package/src/features/environment/SelectEnvironment.tsx +186 -0
- package/src/features/environment/index.ts +1 -0
- package/src/features/index.ts +2 -0
- package/src/features/magic-pdf/AnnotatedImageSlider.tsx +62 -66
- package/src/features/magic-pdf/DownloadPopover.tsx +5 -48
- package/src/features/magic-pdf/ExtractedContentView.tsx +2 -14
- package/src/features/magic-pdf/GroundedExtractionAssistantPanel.tsx +86 -0
- package/src/features/magic-pdf/GroundedExtractionView.test.tsx +65 -0
- package/src/features/magic-pdf/GroundedExtractionView.tsx +1055 -0
- package/src/features/magic-pdf/MagicPdfProvider.tsx +17 -47
- package/src/features/magic-pdf/MagicPdfView.tsx +3 -51
- package/src/features/magic-pdf/index.ts +1 -0
- package/src/features/magic-pdf/types.ts +1 -1
- package/src/features/oauth/McpConnectionsButton.tsx +0 -2
- package/src/features/oauth/McpConnectionsDialog.tsx +0 -1
- package/src/features/oauth/RemoteMcpConnectionButton.tsx +0 -1
- package/src/features/pdf-viewer/PdfPageSlider.tsx +5 -5
- package/src/features/pdf-viewer/SimplePdfViewer.tsx +11 -12
- package/src/features/permissions/UserPermissionsProvider.tsx +1 -1
- package/src/features/store/objects/DocumentQuickFilter.tsx +13 -15
- package/src/features/store/objects/DocumentSearchResults.tsx +3 -6
- package/src/features/store/objects/components/ContentDispositionButton.tsx +5 -1
- package/src/features/store/objects/components/ContentOverview.tsx +144 -44
- package/src/features/store/objects/components/DocumentIcon.tsx +1 -1
- package/src/features/store/objects/components/VectorSearchWidget.tsx +2 -2
- package/src/features/store/objects/components/useContentPanelHooks.ts +3 -15
- package/src/features/store/objects/layout/renderers.tsx +1 -2
- package/src/features/store/objects/selection/SelectionActions.tsx +1 -1
- package/src/features/store/types/ContentObjectTypesTable.tsx +12 -14
- package/src/features/store/types/IntakePolicyEditor.tsx +679 -0
- package/src/features/store/types/IntakePolicyForm.tsx +838 -0
- package/src/features/store/types/SelectContentTypeModal.tsx +2 -2
- package/src/features/store/types/index.ts +2 -0
- package/src/features/store/types/intake-policy-editor.logic.test.ts +109 -0
- package/src/features/store/types/intake-policy-editor.logic.ts +87 -0
- package/src/features/store/types/typeCatalogCache.ts +45 -0
- package/src/features/user/UserInfo.tsx +7 -7
- package/src/features/views/ViewExperience.test.tsx +273 -0
- package/src/features/views/ViewExperience.tsx +408 -0
- package/src/features/views/ViewNavigation.test.tsx +86 -0
- package/src/features/views/ViewNavigation.tsx +187 -0
- package/src/features/views/ViewResults.test.ts +82 -0
- package/src/features/views/ViewResults.tsx +609 -0
- package/src/features/views/ViewSearch.test.tsx +147 -0
- package/src/features/views/ViewSearch.tsx +205 -0
- package/src/features/views/index.ts +6 -0
- package/src/features/views/types.ts +57 -0
- package/src/features/views/viewState.test.ts +111 -0
- package/src/features/views/viewState.ts +132 -0
- package/src/i18n/locales/ar.json +16 -0
- package/src/i18n/locales/de.json +12 -0
- package/src/i18n/locales/en.json +965 -753
- package/src/i18n/locales/es.json +13 -0
- package/src/i18n/locales/fr.json +13 -0
- package/src/i18n/locales/it.json +13 -0
- package/src/i18n/locales/ja.json +11 -0
- package/src/i18n/locales/ko.json +11 -0
- package/src/i18n/locales/pt.json +13 -0
- package/src/i18n/locales/ru.json +14 -0
- package/src/i18n/locales/tr.json +12 -0
- package/src/i18n/locales/zh-TW.json +11 -0
- package/src/i18n/locales/zh.json +11 -0
- package/src/router/HistoryNavigator.test.ts +48 -0
- package/src/router/HistoryNavigator.ts +24 -13
- package/src/router/Nav.tsx +18 -8
- package/src/session/UserSession.test.ts +39 -0
- package/src/session/UserSession.ts +5 -3
- package/src/widgets/form/Form.tsx +1 -1
- package/src/widgets/json-view/JSONSwitcher.tsx +2 -2
- package/src/widgets/json-view/JSONView.tsx +7 -7
- package/src/widgets/monacoEditor/MonacoEditor.tsx +29 -0
- package/src/widgets/schema-editor/ManagedSchema.ts +22 -0
- package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +3 -0
- package/src/widgets/schema-editor/editor/PropertyViewer.tsx +14 -3
- package/src/widgets/schema-editor/editor/SchemaEditor.tsx +80 -29
package/lib/vertesia-ui-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx as i}from"clsx";import{AlertTriangle as a,Check as o,CheckIcon as s,ChevronDown as c,ChevronDownIcon as l,ChevronRight as u,ChevronRightIcon as d,ChevronUp as f,ChevronUpIcon as p,ChevronsUpDown as m,CircleCheck as h,CircleX as g,Computer as _,CopyIcon as v,Info as y,ListFilter as b,Loader2 as x,LoaderCircle as S,Minus as C,Moon as w,MoreHorizontal as T,Plus as E,Search as D,SearchIcon as O,SquarePlus as k,Sun as A,TriangleAlert as ee,X as j,XIcon as te}from"lucide-react";import*as M from"react";import N,{Children as ne,Fragment as re,cloneElement as ie,createContext as ae,forwardRef as oe,isValidElement as se,useCallback as ce,useContext as P,useEffect as F,useId as le,useLayoutEffect as ue,useMemo as de,useRef as I,useState as L}from"react";import{createPortal as fe}from"react-dom";import{Slot as pe}from"@radix-ui/react-slot";import{SUPPORTED_LANGUAGES as me,useLanguage as he,useUITranslation as R}from"@vertesia/ui/i18n";import{cva as z}from"class-variance-authority";import{twMerge as ge}from"tailwind-merge";import*as B from"@radix-ui/react-tooltip";import{Env as _e}from"@vertesia/ui/env";import{AnimatePresence as ve,motion as ye}from"framer-motion";import*as be from"@radix-ui/react-checkbox";import*as xe from"@radix-ui/react-collapsible";import{Command as V}from"cmdk";import*as H from"@radix-ui/react-dialog";import*as U from"@radix-ui/react-dropdown-menu";import W from"dayjs";import Se from"react-calendar";import*as G from"@radix-ui/react-popover";import{isEqual as Ce}from"lodash-es";import*as we from"@radix-ui/react-label";import*as Te from"@radix-ui/react-radio-group";import*as Ee from"react-resizable-panels";import*as De from"@radix-ui/react-separator";import*as Oe from"@radix-ui/react-slider";import*as ke from"@radix-ui/react-switch";import*as K from"@radix-ui/react-tabs";function Ae(e){switch(e){case`xs`:return`size-4`;case`sm`:return`size-6`;case`md`:return`size-8`;case`lg`:return`size-10`;case`xl`:return`size-12`;case`2xl`:return`size-14`;default:throw Error(`Unexpected size: ${e}`)}}function je({size:e,src:n,name:r,shape:i=`circle`,color:a=`bg-gray-500`,className:o}){let s=i===`circle`?`rounded-full`:`rounded-md`,c=Ae(e||`md`);if(n)return t(`img`,{className:`inline-block ${c} ${s} ${a} ${o}`,src:n,alt:r||n,title:r});if(r){let[n,i]=r.split(` `),l=i?`${n[0]}${i[0]}`:`${n[0]}${n[1]}`;return t(`span`,{className:`inline-flex ${c} items-center justify-center ${s} ${a} ${o}`,title:r,children:t(`span`,{className:`${e===`xs`?`text-[0.6rem]`:`text-xs`} font-medium leading-none text-white`,children:l})})}return t(`span`,{className:`inline-block ${c} overflow-hidden ${s} ${a}`,children:t(`svg`,{className:`h-full w-full text-gray-300`,fill:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:t(`path`,{d:`M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z`})})})}function Me({size:e,shape:n=`circle`,color:r=`bg-gray-500`,className:i,children:a}){let o=n===`circle`?`rounded-full`:`rounded-md`;return t(`span`,{className:`inline-block ${Ae(e||`md`)} overflow-hidden ${o} ${r} ${i}`,children:a})}function Ne({className:e,children:n}){return t(`div`,{className:r(`flex items-center justify-center`,e),children:n})}function Pe(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;case`ne`:return`sw`;case`nw`:return`se`;case`se`:return`nw`;case`sw`:return`ne`;default:return e}}function Fe(e){switch(e){case`start`:return`end`;case`end`:return`start`;default:return e}}var Ie=class{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case`top`:this.top=t.top-n.height-this.gap,this.alignAxis=`x`;break;case`bottom`:this.top=t.bottom+this.gap,this.alignAxis=`x`;break;case`left`:this.left=t.left-n.width-this.gap,this.alignAxis=`y`;break;case`right`:this.left=t.right+this.gap,this.alignAxis=`y`;break;case`ne`:this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case`nw`:this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case`se`:this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case`sw`:this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap;break}}align(e,t,n){if(this.alignAxis)switch(e){case`start`:this.alignAxis===`x`?this.left=t.left:this.top=t.top;break;case`end`:this.alignAxis===`x`?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case`center`:this.alignAxis===`x`?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case`fill`:this.alignAxis===`x`?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top);break}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw Error(`Invalid position. Cannot compute x,y coordinates`);let r=this.width!=null,i=this.height!=null,a=this.width??t.width,o=this.height??t.height;return{rect:new DOMRect(this.left??0,this.top??0,a,o),constrainWidth:r,constrainHeight:i,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){let t=Fe(e.align);if(t!==e.align)return{...e,align:t}}}else{let t=Pe(e.position);if(t!==e.position)return{...e,position:t}}return null}};function Le(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n){return n===`x`?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function ze(e,t,n,r){let i=new Ie(e.gap),a=i.computePosition(e,t,n),o=Re(a.rect,r,`x`),s=Re(a.rect,r,`y`);if(o&&s)return a;let c=null;return o||(c=i.flipAxis(e,`x`)),s||(c=i.flipAxis(c||e,`y`)),c?(a=new Ie(i.gap).computePosition(c,t,n),Le(a.rect,r)?a:null):null}function Be(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return i<=n||a<=r?null:new DOMRect(n,r,i-n,a-r)}function Ve(e){if(e.length===0)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Be(e[n].getBoundingClientRect(),t),!t)return null;return t}function He(e){let t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){let r=getComputedStyle(e);if(t&&r.overflowY!==`visible`||n&&r.overflowX!==`visible`)return!0}return!1}function Ue(e,t=document.documentElement){let n=[],r=e.parentElement;for(;r&&r!==t;)He(r)&&n.push(r),r=r.parentElement;return n.push(t),n}var We=class{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=Ue(this.anchor,this.root),this.visibleClientRect=Ve(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){let t=this.scrollableParents,n=()=>{this.update()};window.addEventListener(`resize`,n);for(let e of t)e.addEventListener(`scroll`,n);let r;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener(`click`,r)},0));let i;this.options.closeOnEsc&&(i=e=>{e.key===`Escape`&&this.tryClose()},window.setTimeout(()=>{i&&document.addEventListener(`keydown`,i)},0));let a=this.options.blockPageScroll;return a&&(document.body.style.overflow=`hidden`,document.body.style.height=`100%`),()=>{window.removeEventListener(`resize`,n);for(let e of t)e.removeEventListener(`scroll`,n);r&&document.removeEventListener(`click`,r),i&&document.removeEventListener(`keydown`,i),a&&(document.body.style.overflow=``,document.body.style.height=``)}}open(e,t){if(this.context)throw Error(`The popup controller is already bound to an element`);this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display=``,e.style.visibility=`hidden`,this.update(),this.options.onOpen?.(this))}close(){if(!this.context)throw Error(`The popup controller is not bound to an element`);this.tryClose()}tryClose(){this.context&&=(this.options.onClose?.(this),this.context.cleanup(),this.context.element.style.display=`none`,void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;let e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),i=this.visibleClientRect;if(!i)return;let a=ze(t,n,r,i);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=`${a.rect.height}px`),a.constrainWidth&&(e.style.width=`${a.rect.width}px`),e.style.left=`${a.rect.left}px`,e.style.top=`${a.rect.top}px`,e.style.visibility=`visible`)}createPopupElement(){let e=document.createElement(`div`);return e.style.margin=`0`,e.style.padding=`0`,e.style.border=`none`,e.style.background=`transparent`,e.className=`composable-Popup`,e}};const Ge=ae(void 0);function Ke(){let e=P(Ge);if(!e)throw Error(`usePopupController must be used inside a Popup component`);return e}function qe({ctrlRef:e,id:n,constraints:r,isOpen:i,children:a,className:o,onClose:s,onOpen:c,zIndex:l,position:u,anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h}){let g=I(null),[_,v]=L(),y=I(s),b=I(c);return y.current=s,b.current=c,F(()=>{if(!d)throw Error(`Anchor element is required`);let e=new We({anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h,onClose:()=>y.current?.(),onOpen:()=>b.current?.()});return v(e),()=>{e.tryClose()}},[d,h,p,m,f]),F(()=>{e&&(e.current=_)},[_,e]),F(()=>{_&&g.current?_.isOpen!==i&&(i?_.open(g.current,r):_.close()):_?.isOpen&&!i&&_.close()},[r,i,_]),t(Ge.Provider,{value:_,children:i&&fe(t(`div`,{id:n,style:{visibility:`hidden`,position:u||`absolute`,zIndex:l||100},ref:g,className:o,children:a}),document.body)})}function Je({anchor:e,root:n,children:r,...i}){let a=e.current;return a&&(!n||n.current)?t(qe,{anchor:a,root:n?.current||void 0,...i,children:r}):null}function Ye(){return`combobox-popup-${Math.floor(Math.random()*1e6)}`}var Xe=class{filter(e,t){let n=t.toLowerCase();return e.filter(e=>this.valueOf(e).toLowerCase().includes(n))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find(e=>this.idOf(e)===t)}createItem(e){return null}},Ze=class e extends Xe{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new e},Qe=class e extends Ze{createItem(e){return e}static instance=new e};function $e(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:`w-72 mt-1 border-popover bg-popover text-popover-foreground shadow-md overflow-auto p-0 z-10`,inputClass:r(t?`block m-0 p-0 border-0 focus:outline-none focus:ring-0`:`block sm:text-sm sm:leading-6 bg-muted rounded-md border-0 shadow-sm ring-1 ring-inset ring-muted placeholder:text-muted focus:ring-2 focus:ring-inset focus:ring-primary py-1.5`,e?`w-full`:`!w-auto`),optionClass:`py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300`,Input:tt,Menu:rt,Toggle:nt}}function et({menuAlign:r=`fill`,menuGap:i,focusOnMount:a,onSelect:o,value:s,zIndex:c,unstyledInput:l,fullWidth:u,api:d,layout:f,adapter:p,items:m,placeholder:h,clearable:g,noMatchMessage:_,openOnFocus:v}){let[y]=L(Ye()),b=I(void 0),x=I(null),S=f?Object.assign($e(u,l),f):$e(u,l),C=N.useRef(null),w=it({adapter:p,items:m,value:s,popupId:y});F(()=>{x.current&&a&&x.current.focus()},[a]),F(()=>{w.onSelect=o,w.popupCtrl=b.current},[w,o]),F(()=>{if(d&&w&&x.current)return d.current={open:()=>w.openMenu(),close:()=>w.closeMenu(),toggle:()=>w.toggleMenu(),setInputValue:e=>w.inputText=e,inputValue:w.inputText||``,selectedItem:w.selectedItem,focus:()=>x.current?.focus()},()=>{d.current=null}},[d,w]);let T=w.isMenuOpen&&(w.filteredItems.length>0||!!_);return n(e,{children:[t(S.Input,{boxRef:C,inputRef:x,ctrl:w,layout:S,placeholder:h,clearable:g,openOnFocus:v}),t(Je,{id:y,ctrlRef:b,className:`combobox-popup`,closeOnClick:!0,closeOnEsc:!0,onClose:()=>w.closeMenu(),isOpen:T,anchor:C,zIndex:c,constraints:{position:`bottom`,align:r,gap:i??4},children:t(S.Menu,{fillWidth:r===`fill`,items:w.filteredItems,ctrl:w,layout:S,adapter:p,noMatchMessage:_})})]})}function tt({inputRef:e,placeholder:r,boxRef:i,ctrl:a,layout:o,clearable:s,openOnFocus:c}){let l=o.Toggle,u=s&&a.selectedItem!=null,d=+!!l+ +!!u,f=d>0?{paddingRight:`${o.buttonWidth*d+o.buttonRight}px`}:void 0;return n(`div`,{className:`relative`,ref:i,children:[t(`input`,{ref:e,placeholder:r,...a.getInputProps(),onFocus:c?()=>a.openMenu():void 0,style:f,className:o.inputClass}),n(`div`,{style:{position:`absolute`,right:`${o.buttonRight}px`,top:0,bottom:0,display:`flex`,alignItems:`center`,gap:`2px`},children:[u&&t(`button`,{type:`button`,style:{border:`none`,padding:0,margin:0,backgroundColor:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,width:`${o.buttonWidth}px`},onClick:()=>{a.selectedItem=null},children:t(te,{className:`w-4 h-4`})}),l&&t(`button`,{type:`button`,style:{width:`${o.buttonWidth}px`,border:`none`,padding:0,margin:0,backgroundColor:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`},...a.getToggleButtonProps(),children:t(l,{ctrl:a,layout:o})})]})]})}function nt({ctrl:e}){return e.isMenuOpen?t(p,{className:`w-4 h-4`}):t(l,{className:`w-4 h-4`})}function rt({fillWidth:e,items:n,layout:i,ctrl:a,adapter:o,noMatchMessage:s}){let{highlightedIndex:c,selectedItem:l}=a;return n.length===0?s?t(`div`,{style:{width:e?`100%`:void 0},className:i.menuClass,children:s}):null:t(`ul`,{style:{width:e?`100%`:void 0,maxHeight:i.maxMenuHeight?`${i.maxMenuHeight}px`:`240px`},className:i.menuClass,...a.getMenuProps(),children:n.map((e,n)=>t(`li`,{"data-index":n,className:r(i.optionClass,c===n&&`option-highlighted`,l===e&&`option-selected`),...a.getItemProps(e,n),children:o.renderOption(e)},o.idOf(e)))})}function it(e){let[t,n]=L(new at(e));return F(()=>{t?.withState(n)},[t]),t}var at=class e{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText=``;_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,typeof n==`string`?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){let t=new e({adapter:this.adapter,items:this.items,popupId:this.popupId});return t.setState=this.setState,t.onSelect=this.onSelect,t._inputText=this._inputText,t._highlightedIndex=this._highlightedIndex,t._selectedItem=this._selectedItem,t._isMenuOpen=this._isMenuOpen,t._filteredItems=this._filteredItems,t.popupCtrl=this.popupCtrl,t}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):``,this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,e?this._filteredItems=this.adapter.filter(this.items,e):this._filteredItems=this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){let e=this.popupCtrl,t=e.context?.position?.position;t&&t===`top`&&window.setTimeout(()=>{e.update()},100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;let n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){let e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{let t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{let n=t.key;if(n===`Enter`){if(this.highlightedIndex!=null)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){let e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else n===`ArrowDown`?this.isMenuOpen?this.highlightIndex(this.highlightedIndex===null?0:ot(this.highlightedIndex,e.length),!1):this.openMenu():n===`ArrowUp`&&this.isMenuOpen&&this.highlightIndex(this.highlightedIndex===null?0:st(this.highlightedIndex,e.length),!0)}}}};function ot(e,t){return(e+1)%t}function st(e,t){return(e-1+t)%t}function ct({options:e,creatable:n,...r}){return t(et,{adapter:n?Qe.instance:Ze.instance,items:e,...r})}function lt({className:e}){return t(`hr`,{className:r(`w-full h-0.5 border-t-0 bg-border`,e)})}function q(...e){return ge(i(e))}const ut=N.createContext(void 0);function dt(e,t=`plugin-portal-container`){let n=e instanceof Document?e.body:e;for(let e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;let r=document.createElement(`div`);return r.id=t,n.appendChild(r),r}function ft({children:e,id:n=`plugin-portal-container`}){let r=N.useContext(ut),i=N.useRef(null),[a,o]=N.useState(r||void 0);return N.useEffect(()=>{if(r){o(r);return}if(i.current){let e=i.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){let t=dt(e,n);o(t)}else o(null)}},[n,r]),a===void 0?t(`div`,{ref:i,style:{display:`none`}}):t(ut.Provider,{value:a||void 0,children:e})}function pt(){return N.useContext(ut)}const mt=B.Provider,ht=B.Root,gt=B.Trigger,_t=M.forwardRef(({className:e,sideOffset:n=4,side:r=`top`,...i},a)=>{let o=pt();return t(B.Portal,{container:o,children:t(B.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:q(`max-w-[90vw]`,`z-50 overflow-hidden rounded-md bg-tooltips border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});_t.displayName=B.Content.displayName;function vt({description:e,children:r,size:i=`sm`,placement:a=`top`,className:o,asChild:s}){let[c,l]=M.useState(!1),u=M.useRef(!1);return M.useEffect(()=>{let e=()=>{l(!1),u.current=!0,requestAnimationFrame(()=>{u.current=!1})};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]),t(mt,{delayDuration:0,children:n(ht,{open:c,onOpenChange:e=>{u.current||l(e)},children:[t(gt,{className:`cursor-pointer`,asChild:s,children:r}),t(_t,{side:a,className:`px-3 py-1.5 max-w-${i} text-${i} px-3 ${o}`,children:e})]})})}const yt=new Set;function bt(e,t,n){F(()=>{t&&!yt.has(e)&&(yt.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}const xt=z(`hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{destructive:`bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50`,outline:`border border-input bg-background shadow-xs hover:bg-muted ring-inset`,secondary:`bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset`,ghost:`hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset`,link:`text-foreground underline-offset-4 hover:underline ring-inset`,primary:`bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset`,unstyled:``},size:{xs:`h-7 rounded px-2 py-1 text-xs gap-x-1`,sm:`h-8 rounded px-3 text-xs`,md:`h-9 rounded-md px-4 py-2`,lg:`h-10 rounded-md px-3`,xl:`rounded-md px-3.5 py-2.5 text-sm gap-x-2`,icon:`p-0 m-0 rounded-full`,none:``}},defaultVariants:{variant:`primary`,size:`md`}}),J=M.forwardRef(({className:i,variant:a,size:o,asChild:s=!1,alt:c,isDisabled:l,isLoading:u,title:d,onClick:f,type:p,...m},h)=>{bt(`Button.alt`,c!==void 0,"use aria-label for the accessible name and wrap in <VTooltip> for a visual tooltip. `alt` is forwarded to both for one release.");let g=s?pe:`button`,_=s?p:p??`button`,v=m[`aria-label`]??c,y=s?m.children:n(e,{children:[u&&t(x,{className:`animate-spin`}),m.children]}),b=t(g,{className:r(q(xt({variant:a,size:o})),i),disabled:l||u||m.disabled,ref:h,onClick:f,type:_,autoFocus:!1,...m,"aria-label":v,children:y});return c||d?t(vt,{description:c||d,asChild:!0,className:`cursor-pointer`,size:`xs`,placement:`top`,children:b}):b});J.displayName=`Button`;const St=M.forwardRef(({size:e,content:n,toast:r,className:i,alt:a,"aria-label":s,...c},l)=>{let[u,d]=L(!1),{t:f}=R();bt(`CopyButton.alt`,a!==void 0,"use aria-label for the accessible name. `alt` is forwarded for one release.");let p=e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{d(!0),setTimeout(()=>d(!1),2e3),r?.toast&&r.toast({status:`success`,title:r.message||f(`misc.copiedToClipboard`),duration:2e3})}).catch(e=>{console.error(`Failed to copy text: `,e),r?.toast&&r.toast({status:`error`,title:f(`misc.failedToCopy`),duration:2e3})})},m=s??a??f(`misc.copy`);return t(J,{ref:l,className:q(i),variant:`unstyled`,size:e||`sm`,onClick:p,...c,"aria-label":m,title:m,children:u?t(o,{className:`text-success`}):t(v,{className:`size-4`})})});St.displayName=`CopyButton`;function Ct({buttonLabel:e,title:r,children:i,onClick:a}){return t(`div`,{className:`flex items-center justify-center h-full text-center`,children:n(`div`,{className:`py-12`,children:[t(`svg`,{className:`mx-auto size-12`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z`})}),t(`h3`,{className:`mt-2 text-sm font-semibold`,children:r}),t(`p`,{className:`mt-1 text-sm text-muted`,children:i}),t(`div`,{className:`mt-6`,children:n(J,{onClick:a,children:[t(E,{className:`-ms-0.5 me-1.5 size-5`,"aria-hidden":`true`}),e]})})]})})}function wt(e){return e.isFile}function Tt(e){return e.isDirectory}function Et(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function Dt({children:e,onUpload:r}){let i=I(null);return n(`label`,{style:{cursor:`pointer`},children:[e,t(`input`,{ref:i,type:`file`,style:{display:`none`},onChange:()=>{i.current?.files&&r(Et(i.current.files))}})]})}function Ot({onUpload:e}){return t(`div`,{...Mt({onUpload:e}),className:`flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600`,children:n(`label`,{htmlFor:`dropzone-file`,className:`flex flex-col items-center justify-center w-full h-full`,children:[n(`div`,{className:`flex flex-col items-center justify-center pt-5 pb-6`,children:[t(`svg`,{className:`w-8 h-8 mb-4 text-gray-500 dark:text-gray-400`,"aria-hidden":`true`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 16`,children:t(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2`})}),n(`p`,{className:`mb-2 text-sm text-gray-500 dark:text-gray-400`,children:[t(`span`,{className:`font-semibold`,children:`Click to upload`}),` or drag and drop`]}),t(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`SVG, PNG, JPG or GIF (MAX. 800x400px)`})]}),t(`input`,{id:`dropzone-file`,type:`file`,className:`hidden`})]})})}function kt(e){if(!e)return!1;let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t}function At(e){if(!e)return!1;let t=e.__dragOver_cnt__;return t?(e.__dragOver_cnt__=t-1,t===1):!1}function jt(e){e&&delete e.__dragOver_cnt__}function Mt({onUpload:e,dragOverClass:t=`is-drag-over-on`,dropEffect:n=`copy`}){let r=I(null);return{onDrop:n=>{n.preventDefault(),jt(r.current),r.current?.classList.remove(t);let i=n.dataTransfer.items;if(i){let t=[],n=(e,t=``)=>new Promise(r=>{if(wt(e))e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(Tt(e)){let i=e.createReader(),a=[],o=()=>{i.readEntries(i=>{if(!i.length)Promise.all(a).then(e=>r(e.flat()));else{for(let r of i)a.push(n(r,`${t+e.name}/`));o()}})};o()}});for(let e=0;e<i.length;e++){let r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{let n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{kt(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{At(r.current)&&r.current?.classList.remove(t)},ref:r}}function Nt(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` `):void 0}function Pt(){try{return _e.isDev}catch{return!1}}function Ft({description:e,helpText:i,error:a,required:o,label:s,className:c,direction:l=`column`,children:u,disabled:d=!1,fullWidthLabel:f=!1,childrenId:p}){let m=le(),h=le(),g=le(),_=p??m,v=I(!1),b=ne.toArray(u).filter(se),x=b.length===1?b[0]:void 0,S=x?.type===re,C=!!x&&!S,w=!1,T=u;if(C&&x){let e=x,t=e.props??{},n=Nt(t[`aria-describedby`],i?h:void 0,a?g:void 0),r=t[`aria-invalid`]??(a?!0:void 0);T=ie(e,{id:t.id??_,"aria-describedby":n,"aria-invalid":r}),w=!0}else Pt()&&!v.current&&(i||a||p===void 0)&&(v.current=!0,console.warn("[@vertesia/ui] FormItem received zero, multiple, or a fragment as element children. ARIA wiring skipped. Pass `childrenId` and set `id` / `aria-describedby` / `aria-invalid` on your input manually, or wrap the input in a single non-fragment element."));let E=w||p?_:void 0;return n(`div`,{className:r(`flex w-full space-y-1`,c,l===`row`?`flex-row justify-between items-center gap-2`:l===`row-reverse`?`flex-row-reverse justify-between items-center gap-2`:`flex-col`),children:[n(`div`,{className:r(`flex items-center gap-1 mb-0`,f&&`w-full`),children:[n(`label`,{htmlFor:E,className:`text-sm font-medium mb-1 ${d?`text-muted`:``} ${f&&`flex-1`}`,children:[s,o?t(`span`,{className:`text-destructive -mt-4 ms-1`,children:`*`}):``]}),e&&t(`div`,{className:`mx-2 flex w-4 items-center`,children:t(vt,{description:e,children:t(y,{className:`size-3 text-muted`})})})]}),T,i&&t(`p`,{id:h,className:`text-xs text-muted`,children:i}),a&&t(`p`,{id:g,className:`text-xs text-destructive`,children:a})]})}function It(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e(t))}}const Lt=z(`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium`,{variants:{variant:{default:`text-foreground bg-muted`,secondary:`bg-secondary text-primary`,destructive:`bg-destructive text-destructive`,attention:`bg-attention text-attention`,success:`bg-success text-success`,info:`bg-info text-info`,done:`bg-done text-done`,outline:`bg-transparent border border-border text-foreground`}},defaultVariants:{variant:`default`}});function Rt({className:e,variant:n,children:r,onClick:i,...a}){let o=i?{role:`button`,tabIndex:0,onClick:i,onKeyDown:It(i)}:{};return t(`span`,{className:q(Lt({variant:n}),e),...o,...a,children:r})}const zt=z(`inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border`,{variants:{variant:{default:``,success:``,destructive:``,attention:``,done:``,info:``,outline:``}},defaultVariants:{variant:`default`}}),Bt=z(`h-1.5 w-1.5`,{variants:{variant:{default:`fill-foreground`,success:`fill-success`,destructive:`fill-destructive`,attention:`fill-attention`,done:`fill-done`,info:`fill-info`,outline:`fill-foreground`}},defaultVariants:{variant:`default`}});function Vt({variant:e,className:r,dotClassName:i,children:a,...o}){return n(`span`,{className:q(zt({variant:e}),r),...o,children:[t(`div`,{className:`flex-shrink-0`,children:t(`svg`,{className:q(Bt({variant:e}),i),viewBox:`0 0 6 6`,"aria-hidden":`true`,children:t(`circle`,{cx:3,cy:3,r:3})})}),t(`span`,{className:`truncate`,children:a})]})}function Ht({value:e=[],onChange:i,className:a,delimiters:o=`, `,placeholder:s,autoFocus:c,disabled:l=!1}){let[u,d]=L(``),f=t=>{if(l)return;let n=t.currentTarget.value;n?.trim()&&(i([...e,n.trim()]),d(``))},p=t=>{if(l)return;let n=t.currentTarget.value,r=!n.trim(),a=t.key;a===`Enter`||o.indexOf(a)>-1?(t.preventDefault(),e&&!r&&(i([...e,n.trim()]),d(``))):a===`Backspace`&&r&&e&&e.length>0&&(e.pop(),i([...e]))},m=t=>{if(l)return;let n=t.clipboardData.getData(`text`);if(n){t.preventDefault();let r=o.split(``).map(e=>e===` `?`\\s`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),a=RegExp(`[${r}]+`),s=n.split(a).map(e=>e.trim()).filter(e=>e.length>0);s.length>0&&i([...e,...s]),d(``)}},h=t=>{l||e&&e.length>0&&(e.splice(t,1),i([...e]))};return n(`div`,{className:r(a,`w-full flex flex-wrap items-center gap-1 p-2 py-1.5`,`rounded-md text-sm rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,l&&`opacity-50 cursor-not-allowed`),children:[e&&e.length>0&&e.map((e,n)=>t(vt,{description:`click to remove`,children:t(Rt,{variant:`secondary`,onClick:()=>h(n),className:r(`flex-shrink-0 transition-colors`,l?`cursor-not-allowed`:`cursor-pointer hover:bg-destructive hover:text-destructive`),title:e,children:t(`span`,{className:`break-all`,children:e})})},`item-${n}`)),t(`input`,{className:`flex-1 min-w-[80px] m-0 p-0 px-1 border-0 bg-transparent text-sm placeholder:text-muted focus:outline-none focus:ring-0 disabled:cursor-not-allowed`,type:`text`,value:u,onBlur:f,onKeyDown:p,onPaste:m,onChange:e=>d(e.currentTarget.value),placeholder:!e||e.length===0?s:``,autoFocus:c,disabled:l})]})}function Ut({underline:e=`always`,className:n,children:i,...a}){let o;return e===`always`?o=`underline`:e===`hover`&&(o=`hover:underline`),t(`a`,{className:r(`text-indigo-800 dark:text-indigo-300`,n,o),...a,children:i})}function Wt({className:e,children:n}){return t(`ul`,{className:`${e} space-y-1 flex flex-col items-start`,children:n})}Wt.Item=oe(function(e,n){let{current:i,children:a,className:o,href:s=`#`,onClick:c,...l}=e;return t(`li`,{className:r(o,i?`bg-muted`:``,`w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted`),children:t(`a`,{ref:n,href:s,onClick:e=>{c?(e.preventDefault(),c(e)):s===`#`&&e.preventDefault()},className:`w-full flex items-center gap-x-3`,...l,children:a})})});const Gt=`rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,Kt={INPUT_UNSTYLED:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,INPUT_NO_PADDING:Gt,INPUT:`${Gt} py-1.5`};function qt(e){return e==null||Number.isNaN(e)?``:e.toString()}const Jt=N.forwardRef(({value:e,onChange:n,className:i,noScroll:a=!1,noSpinners:o=!1,...s},c)=>{let[l,u]=N.useState(qt(e));return F(()=>{if(e==null||!Number.isNaN(e)){let t=qt(e);u(t)}},[e]),t(`input`,{onWheel:a?e=>{e.currentTarget.blur()}:s.onWheel,type:`number`,value:l,onChange:e=>{let t=e.target.value;u(t),t===``?n?.(void 0,t):n?.(parseFloat(t),t)},className:r(i,Kt.INPUT,{"no-spinners":o},o&&`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`),ref:c,...s})});function Yt({children:e,overlayContent:r,className:i=``,overlayClassName:a=``,position:o=`right`,width:s,height:c,showCloseButton:l=!0,onOpen:u,onClose:d,triggerClassName:f=``,backdropClassName:p=``,animationConfig:m={type:`spring`,stiffness:300,damping:30}}){let[h,g]=L(!1),_=()=>{g(!0),u?.()},v=()=>{g(!1),d?.()},y=Xt(o),b=Zt(o,s,c);return n(`div`,{className:`flex items-center justify-center w-full ${i}`,children:[t(J,{variant:`unstyled`,size:`none`,onClick:_,className:`w-full align-left cursor-pointer ${f}`,children:e}),h&&t(`div`,{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${p}`,children:n(ye.div,{...y,transition:m,className:`${b} ${a}`,children:[l&&t(`div`,{className:`absolute top-2 end-2 z-10`,children:t(J,{onClick:v,variant:`primary`,children:t(j,{})})}),t(`div`,{className:l?`mt-8`:``,children:r})]})})]})}function Xt(e){switch(e){case`left`:return{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`}};case`right`:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}};case`top`:return{initial:{y:`-100%`},animate:{y:0},exit:{y:`-100%`}};case`bottom`:return{initial:{y:`100%`},animate:{y:0},exit:{y:`100%`}};case`center`:return{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}};default:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}}}}function Zt(e,t,n){let r=`fixed bg-white shadow-lg p-4 relative`;switch(e){case`left`:return`${r} left-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`right`:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`top`:return`${r} top-[var(--header-height)] start-0 end-0 ${n||`h-80`}`;case`bottom`:return`${r} bottom-0 start-0 end-0 ${n||`h-80`}`;case`center`:return`${r} top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${t||`w-96`} ${n||`max-h-96`}`;default:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`}}const Qt=`--tailwind-portal`;function $t({children:e}){let n=I(null),[r,i]=L(null);return F(()=>{if(n.current){let e=n.current.ownerDocument,t=e.getElementById(Qt);t||(t=e.createElement(`DIV`),t.id=Qt,e.body.appendChild(t)),i(t)}},[]),r?fe(e,r):t(`span`,{ref:n})}function en({path:e,maxItems:r=3,className:i,separator:a}){let o=e||[],s=e=>{let n=typeof e.label==`string`&&e.label.length>20?`${e.label.slice(0,17)}...`:e.label;return e.onClick?t(on,{onClick:e.onClick,href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):e.href?t(on,{href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):t(sn,{children:n})};if(o.length<=r)return t(tn,{className:q(`w-full flex items-center`,i),children:t(nn,{children:o.map((e,r)=>n(M.Fragment,{children:[t(rn,{children:s(e)}),r<o.length-1&&t(cn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))})});let c=o.slice(-(r-1));return t(tn,{className:q(`w-full flex items-center`,i),children:n(nn,{children:[t(rn,{children:t(ln,{})}),t(cn,{children:a??t(u,{className:`cn-rtl-flip`})}),c.map((e,r)=>n(M.Fragment,{children:[t(rn,{children:s(e)}),r<c.length-1&&t(cn,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))]})})}const tn=M.forwardRef(({...e},n)=>t(`nav`,{ref:n,"aria-label":`breadcrumb`,...e}));tn.displayName=`Breadcrumb`;const nn=M.forwardRef(({className:e,...n},r)=>t(`ol`,{ref:r,className:q(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5`,e),...n}));nn.displayName=`BreadcrumbList`;const rn=M.forwardRef(({className:e,...n},r)=>t(`li`,{ref:r,className:q(`inline-flex items-center gap-1.5 text-muted`,e),...n}));rn.displayName=`BreadcrumbItem`;const an=M.forwardRef(({asChild:e,className:n,...r},i)=>t(`a`,{ref:i,className:q(`transition-colors hover:text-muted`,n),...r}));an.displayName=`BreadcrumbLink`;const on=M.forwardRef(({className:e,href:n,onClick:r,...i},a)=>t(J,{variant:`ghost`,size:`md`,ref:a,className:q(`p-0! hover:underline! hover:bg-background!`,e),onClick:e=>{e.preventDefault(),r&&r(e)},...i}));on.displayName=`BreadcrumbButton`;const sn=M.forwardRef(({className:e,...n},r)=>t(`span`,{ref:r,"aria-current":`page`,className:q(`font-normal text-foreground`,e),...n}));sn.displayName=`BreadcrumbPage`;const cn=({children:e,className:n,...r})=>t(`li`,{role:`presentation`,"aria-hidden":`true`,className:q(`[&>svg]:w-3.5 [&>svg]:h-3.5`,n),...r,children:e??t(u,{className:`cn-rtl-flip`})});cn.displayName=`BreadcrumbSeparator`;const ln=({className:e,...r})=>n(`span`,{role:`presentation`,"aria-hidden":`true`,className:q(`flex h-9 w-9 items-center justify-center`,e),...r,children:[t(T,{className:`h-4 w-4`}),t(`span`,{className:`sr-only`,children:`More`})]});ln.displayName=`BreadcrumbEllipsis`;const un=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`rounded-xl border bg-card text-card-foreground shadow`,e),...n}));un.displayName=`Card`;const dn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex flex-col p-6`,e),...n}));dn.displayName=`CardHeader`;const fn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`font-semibold leading-none tracking-tight`,e),...n}));fn.displayName=`CardTitle`;const pn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`text-sm text-muted-foreground`,e),...n}));pn.displayName=`CardDescription`;const mn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`p-6 pt-0`,e),...n}));mn.displayName=`CardContent`;const hn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex items-center p-6 pt-0`,e),...n}));hn.displayName=`CardFooter`;const gn=M.forwardRef(({className:e,...n},r)=>t(be.Root,{ref:r,className:q(`peer size-4 shrink-0 rounded-sm border border-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-white`,e),...n,children:t(be.Indicator,{className:q(`flex items-center justify-center text-current`),children:t(o,{className:`size-4`})})}));gn.displayName=be.Root.displayName;function _n({...e}){return t(xe.Root,{"data-slot":`collapsible`,...e})}function vn({...e}){return t(xe.Trigger,{"data-slot":`collapsible-trigger`,...e})}function yn({...e}){return t(xe.Content,{"data-slot":`collapsible-content`,...e})}function bn({children:e}){return t(`span`,{style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`},children:e})}const xn=ae(!1);function Sn(){return!!P(xn)}function Cn({children:e}){return t(xn.Provider,{value:!0,children:e})}function wn({className:e,children:r,isOpen:i,onClose:a,description:o=`Modal Description`,noCloseButton:s=!1,allowOverflow:c=!1,disableCloseOnClickOutside:l=!1,size:u=`md`,action:d}){let f=e=>{e||a()};function p(){switch(u){case`sm`:return`max-w-[20vw]`;case`md`:return`max-w-[60vw] lg:max-w-[40vw]`;case`lg`:return`max-w-[80vw] md:max-w-[60vw]`;case`xl`:return`max-w-[95vw] lg:max-w-[80vw]`;default:return`max-w-[60vw] lg:max-w-[40vw]`}}return n(On,{open:i,onOpenChange:e=>{(!l||e)&&f(e)},children:[c&&t(Mn,{className:`z-50 fixed inset-0 bg-black/80`}),t(bn,{children:t(Pn,{children:o})}),n(Nn,{className:q(`min-h-20 p-4`,`fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg`,p(),e),children:[t(`div`,{className:`top-4 end-4 absolute`,children:n(`div`,{className:`flex gap-2`,children:[d&&d,!s&&t(jn,{onClick:()=>f(!1),asChild:!0,autoFocus:!1,children:t(J,{variant:`outline`,alt:`Close`,className:`data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none`,children:t(j,{className:`size-4`})})})]})}),t(Cn,{children:r})]})]})}const Tn=({children:e,show:r=!0,className:i,description:a,showDivider:o=!1,...s})=>r?n(Fn,{className:q(o?`border-b-solid border-b border-b-1 pb-2 mb-4`:``,`text-lg font-semibold leading-6 tracking-tight`,{"py-2":!a},i),...s,children:[e,a&&t(Pn,{className:`text-sm !font-normal text-muted-foreground pb-2`,children:a})]}):n(bn,{children:[t(Fn,{children:e}),a&&t(Pn,{children:a})]}),En=({children:e,className:n,...r})=>t(`div`,{className:q(`text-sm max-h-[80vh] overflow-y-auto`,n),...r,children:e}),Dn=({align:e=`right`,children:n,className:r,...i})=>t(`div`,{className:q(`w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end gap-2`,{left:`justify-start`,center:`justify-center`,right:`justify-end`}[e],r),...i,children:n}),On=H.Root,kn=H.Trigger,An=H.Portal,jn=H.Close,Mn=M.forwardRef(({className:e,...n},r)=>t(H.Overlay,{ref:r,className:q(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));Mn.displayName=H.Overlay.displayName;const Nn=M.forwardRef(({className:e,children:r,...i},a)=>{let o=pt();return n(An,{container:o,children:[t(Mn,{}),t(H.Content,{ref:a,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:q(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...i,children:r})]})});Nn.displayName=H.Content.displayName;const Pn=M.forwardRef(({className:e,...n},r)=>t(H.Description,{ref:r,className:q(`text-sm text-muted`,e),...n}));Pn.displayName=H.Description.displayName;const Fn=M.forwardRef(({className:e,...n},r)=>t(H.Title,{ref:r,className:q(`text-lg font-semibold leading-none tracking-tight`,e),...n}));Fn.displayName=H.Title.displayName;const In=M.forwardRef(({className:e,...n},r)=>t(V,{ref:r,className:q(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...n}));In.displayName=V.displayName;const Ln=({children:e,...n})=>t(On,{...n,children:t(Nn,{className:`shadow-lg p-0 overflow-hidden`,children:t(In,{className:`[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,children:e})})}),Rn=M.forwardRef(({className:e,...r},i)=>n(`div`,{className:`flex items-center px-3 border-b`,"cmdk-input-wrapper":``,children:[t(D,{className:`opacity-50 size-4 shrink-0`}),t(V.Input,{ref:i,className:q(`focus:ring-0`,`border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...r})]}));Rn.displayName=V.Input.displayName;const zn=M.forwardRef(({className:e,...n},r)=>t(V.List,{ref:r,className:q(`overflow-y-auto overflow-x-hidden`,e),...n}));zn.displayName=V.List.displayName;const Bn=M.forwardRef((e,n)=>t(V.Empty,{ref:n,className:`py-2 text-sm text-center`,...e}));Bn.displayName=V.Empty.displayName;const Y=M.forwardRef(({className:e,...n},r)=>t(V.Group,{ref:r,className:q(`overflow-y-auto overflow-x-hidden p-1 text-foreground`,`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...n}));Y.displayName=V.Group.displayName;const Vn=M.forwardRef(({className:e,...n},r)=>t(V.Separator,{ref:r,className:q(`-mx-1 h-px bg-border`,e),...n}));Vn.displayName=V.Separator.displayName;const X=M.forwardRef(({className:e,...n},r)=>t(V.Item,{ref:r,className:q(`hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...n}));X.displayName=V.Item.displayName;const Hn=({className:e,...n})=>t(`span`,{className:q(`ms-auto text-xs tracking-widest text-muted-foreground`,e),...n});Hn.displayName=`CommandShortcut`;const Un=M.createContext(!1);function Wn({...e}){return t(U.Root,{"data-slot":`dropdown-menu`,...e})}function Gn({...e}){return t(U.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function Kn({...e}){return t(U.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function qn({className:e,align:n=`start`,sideOffset:r=4,...i}){return t(U.Portal,{children:t(U.Content,{"data-slot":`dropdown-menu-content`,sideOffset:r,align:n,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden`,e),...i})})}function Jn({...e}){return t(U.Group,{"data-slot":`dropdown-menu-group`,...e})}function Yn({className:e,inset:n,variant:r=`default`,...i}){return t(U.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:q(`hover:bg-muted focus:bg-muted data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...i})}function Xn({className:e,children:r,checked:i,inset:a,...o}){return n(U.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),checked:i,...o,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function Zn({...e}){return t(U.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function Qn({className:e,children:r,inset:i,...a}){return n(U.RadioItem,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-radio-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function $n({className:e,inset:n,...r}){return t(U.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:q(`text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7`,e),...r})}function er({className:e,...n}){return t(U.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`bg-border -mx-1 my-1 h-px`,e),...n})}function tr({className:e,...n}){return t(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest`,e),...n})}function nr({...e}){return t(U.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function rr({className:e,inset:r,children:i,...a}){return n(U.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":r,className:q(`focus:bg-muted focus:text-muted data-open:bg-muted data-open:text-muted not-data-[variant=destructive]:focus:**:text-muted gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[i,t(d,{className:`cn-rtl-flip ms-auto`})]})}function ir({className:e,...n}){return t(U.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden`,e),...n})}const ar={left:`start`,center:`center`,right:`end`};function or({trigger:e,children:r,align:i=`right`,hover:a}){let[o,s]=M.useState(!1),c=M.useRef(null);return a?n(`div`,{className:`relative inline-flex`,onMouseEnter:()=>{c.current&&clearTimeout(c.current),s(!0)},onMouseLeave:()=>{c.current=setTimeout(()=>s(!1),80)},children:[e,o&&t(`div`,{className:q(`absolute top-full pt-1 z-50`,i===`right`?`end-0`:i===`center`?`left-1/2 -translate-x-1/2`:`start-0`),children:t(`div`,{className:`min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground`,children:t(Un.Provider,{value:!0,children:r})})})]}):n(Wn,{children:[t(Kn,{asChild:!0,children:t(`span`,{className:`-m-1.5 flex items-center p-1.5`,children:e})}),t(qn,{align:ar[i],className:`w-max`,children:r})]})}function sr({children:e,label:r}){return n(Jn,{children:[r&&t($n,{children:r}),e]})}function cr({children:e,href:n,onClick:r,isDisabled:i=!1,variant:a=`default`,className:o}){let s=M.useContext(Un),c=q(`w-full gap-2 rounded-md px-1.5 py-1 text-sm text-nowrap [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,a===`destructive`?`text-destructive`:``,i?`pointer-events-none opacity-50`:`hover:bg-muted focus:bg-muted`,o);return s?n?t(`a`,{href:n,className:c,children:e}):t(`button`,{type:`button`,className:c,disabled:i,onClick:e=>{e.stopPropagation(),r?.(e)},children:e}):t(Yn,{className:q(`data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap`,o),disabled:i,variant:a,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?t(`a`,{href:n,children:e}):e})}const lr=({children:e,className:n})=>{let r=I(null),[i,a]=L(`auto`);return F(()=>{if(r.current){let e=new ResizeObserver(e=>{let t=e[0].contentRect.height;a(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),t(`div`,{className:q(n,`overflow-hidden transition-all duration-100 ease-in`),style:{height:i},children:t(`div`,{ref:r,children:e})})},ur=M.createContext(null),Z=({hover:e=!1,click:n=!1,modal:r,children:i,_open:a,onOpenChange:o})=>{let[s,c]=M.useState(a||!1);return t(ur.Provider,{value:{open:s,setOpen:c,hover:e,click:n},children:t(G.Root,{open:s,onOpenChange:e=>{c(e),o&&o(e)},modal:r,children:i})})};function dr(e=!1,t=()=>{},n){e&&t(n===`enter`)}const Q=M.forwardRef(({children:e,...n},r)=>{let i=M.useContext(ur);if(!i)throw Error(`PopoverTrigger must be used within a Popover`);let{setOpen:a,hover:o,click:s}=i;return t(G.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>dr(o,a,`enter`),onMouseLeave:()=>dr(o,a,`leave`),onClick:()=>{s&&a(e=>!e)},...n,children:e})});Q.displayName=G.Trigger.displayName;const fr=G.Anchor,$=M.forwardRef(({className:e,align:n=`center`,side:r=`bottom`,...i},a)=>{let o=M.useContext(ur);if(!o)throw Error(`PopoverContent must be used within a Popover`);let{setOpen:s,hover:c}=o,l=pt();return t(G.Portal,{container:l,children:t(G.Content,{ref:a,align:n,side:r,onMouseEnter:()=>dr(c,s,`enter`),onMouseLeave:()=>dr(c,s,`leave`),className:q(`z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});$.displayName=G.Content.displayName;const pr=G.Close;pr.displayName=G.Close.displayName;function mr(){let e=M.useContext(ur);if(!e)throw Error(`usePopoverContext must be used within a Popover`);return{...e,close:()=>e.setOpen(!1)}}const hr=`
|
|
1
|
+
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx as i}from"clsx";import{AlertTriangle as a,Check as o,CheckIcon as s,ChevronDown as c,ChevronDownIcon as l,ChevronRight as u,ChevronRightIcon as d,ChevronUp as f,ChevronUpIcon as p,ChevronsUpDown as m,CircleCheck as h,CircleX as g,Computer as _,CopyIcon as v,Info as y,ListFilter as b,Loader2 as x,LoaderCircle as S,Minus as C,Moon as w,MoreHorizontal as T,Plus as E,Search as D,SearchIcon as O,SquarePlus as k,Sun as A,TriangleAlert as ee,X as j,XIcon as te}from"lucide-react";import*as M from"react";import N,{Children as ne,Fragment as re,cloneElement as ie,createContext as ae,forwardRef as oe,isValidElement as se,useCallback as ce,useContext as P,useEffect as F,useId as le,useLayoutEffect as ue,useMemo as de,useRef as I,useState as L}from"react";import{createPortal as fe}from"react-dom";import{Slot as pe}from"@radix-ui/react-slot";import{SUPPORTED_LANGUAGES as me,useLanguage as he,useUITranslation as R}from"@vertesia/ui/i18n";import{cva as z}from"class-variance-authority";import{twMerge as ge}from"tailwind-merge";import*as B from"@radix-ui/react-tooltip";import{Env as _e}from"@vertesia/ui/env";import{AnimatePresence as ve,motion as ye}from"framer-motion";import*as be from"@radix-ui/react-checkbox";import*as xe from"@radix-ui/react-collapsible";import{Command as V}from"cmdk";import*as H from"@radix-ui/react-dialog";import*as U from"@radix-ui/react-dropdown-menu";import W from"dayjs";import Se from"react-calendar";import*as G from"@radix-ui/react-popover";import{isEqual as Ce}from"lodash-es";import*as we from"@radix-ui/react-label";import*as Te from"@radix-ui/react-radio-group";import*as Ee from"react-resizable-panels";import*as De from"@radix-ui/react-separator";import*as Oe from"@radix-ui/react-slider";import*as ke from"@radix-ui/react-switch";import*as K from"@radix-ui/react-tabs";function Ae(e){switch(e){case`xs`:return`size-4`;case`sm`:return`size-6`;case`md`:return`size-8`;case`lg`:return`size-10`;case`xl`:return`size-12`;case`2xl`:return`size-14`;default:throw Error(`Unexpected size: ${e}`)}}function je({size:e,src:n,name:r,shape:i=`circle`,color:a=`bg-gray-500`,className:o}){let s=i===`circle`?`rounded-full`:`rounded-md`,c=Ae(e||`md`);if(n)return t(`img`,{className:`inline-block ${c} ${s} ${a} ${o}`,src:n,alt:r||n,title:r});if(r){let[n,i]=r.split(` `),l=i?`${n[0]}${i[0]}`:`${n[0]}${n[1]}`;return t(`span`,{className:`inline-flex ${c} items-center justify-center ${s} ${a} ${o}`,title:r,children:t(`span`,{className:`${e===`xs`?`text-[0.6rem]`:`text-xs`} font-medium leading-none text-white`,children:l})})}return t(`span`,{className:`inline-block ${c} overflow-hidden ${s} ${a}`,children:t(`svg`,{className:`h-full w-full text-gray-300`,fill:`currentColor`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:t(`path`,{d:`M24 20.993V24H0v-2.996A14.977 14.977 0 0112.004 15c4.904 0 9.26 2.354 11.996 5.993zM16.002 8.999a4 4 0 11-8 0 4 4 0 018 0z`})})})}function Me({size:e,shape:n=`circle`,color:r=`bg-gray-500`,className:i,children:a}){let o=n===`circle`?`rounded-full`:`rounded-md`;return t(`span`,{className:`inline-block ${Ae(e||`md`)} overflow-hidden ${o} ${r} ${i}`,children:a})}function Ne({className:e,children:n}){return t(`div`,{className:r(`flex items-center justify-center`,e),children:n})}function Pe(e){switch(e){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;case`ne`:return`sw`;case`nw`:return`se`;case`se`:return`nw`;case`sw`:return`ne`;default:return e}}function Fe(e){switch(e){case`start`:return`end`;case`end`:return`start`;default:return e}}var Ie=class{left;top;width;height;alignAxis;gap;constructor(e=0){this.gap=e}position(e,t,n){switch(e){case`top`:this.top=t.top-n.height-this.gap,this.alignAxis=`x`;break;case`bottom`:this.top=t.bottom+this.gap,this.alignAxis=`x`;break;case`left`:this.left=t.left-n.width-this.gap,this.alignAxis=`y`;break;case`right`:this.left=t.right+this.gap,this.alignAxis=`y`;break;case`ne`:this.top=t.top-n.height-this.gap,this.left=t.right+this.gap;break;case`nw`:this.top=t.top-n.height-this.gap,this.left=t.left-n.width-this.gap;break;case`se`:this.top=t.bottom+this.gap,this.left=t.right+this.gap;break;case`sw`:this.top=t.bottom+this.gap,this.left=t.left-n.width-this.gap;break}}align(e,t,n){if(this.alignAxis)switch(e){case`start`:this.alignAxis===`x`?this.left=t.left:this.top=t.top;break;case`end`:this.alignAxis===`x`?this.left=t.right-n.width:this.top=t.bottom-n.height;break;case`center`:this.alignAxis===`x`?this.left=t.left+t.width/2-n.width/2:this.top=t.top+t.height/2-n.height/2;break;case`fill`:this.alignAxis===`x`?(this.left=t.left,this.width=t.right-t.left):(this.top=t.top,this.height=t.bottom-t.top);break}}computePosition(e,t,n){if(this.position(e.position,n,t),e.align&&this.align(e.align,n,t),!this.left&&!this.top)throw Error(`Invalid position. Cannot compute x,y coordinates`);let r=this.width!=null,i=this.height!=null,a=this.width??t.width,o=this.height??t.height;return{rect:new DOMRect(this.left??0,this.top??0,a,o),constrainWidth:r,constrainHeight:i,position:e.position,align:e.align}}flipAxis(e,t){if(this.alignAxis===t){if(e.align){let t=Fe(e.align);if(t!==e.align)return{...e,align:t}}}else{let t=Pe(e.position);if(t!==e.position)return{...e,position:t}}return null}};function Le(e,t){return e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom}function Re(e,t,n){return n===`x`?e.left>=t.left&&e.right<=t.right:e.top>=t.top&&e.bottom<=t.bottom}function ze(e,t,n,r){let i=new Ie(e.gap),a=i.computePosition(e,t,n),o=Re(a.rect,r,`x`),s=Re(a.rect,r,`y`);if(o&&s)return a;let c=null;return o||(c=i.flipAxis(e,`x`)),s||(c=i.flipAxis(c||e,`y`)),c?(a=new Ie(i.gap).computePosition(c,t,n),Le(a.rect,r)?a:null):null}function Be(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return i<=n||a<=r?null:new DOMRect(n,r,i-n,a-r)}function Ve(e){if(e.length===0)return null;let t=e[0].getBoundingClientRect();for(let n=1,r=e.length;n<r;n++)if(t=Be(e[n].getBoundingClientRect(),t),!t)return null;return t}function He(e){let t=e.scrollHeight>e.clientHeight,n=e.scrollWidth>e.clientWidth;if(t||n){let r=getComputedStyle(e);if(t&&r.overflowY!==`visible`||n&&r.overflowX!==`visible`)return!0}return!1}function Ue(e,t=document.documentElement){let n=[],r=e.parentElement;for(;r&&r!==t;)He(r)&&n.push(r),r=r.parentElement;return n.push(t),n}var We=class{options;root;scrollableParents;visibleClientRect;context;constructor(e){this.options=e,this.root=e.root||document.documentElement,this.scrollableParents=Ue(this.anchor,this.root),this.visibleClientRect=Ve(this.scrollableParents)}get anchor(){return this.options.anchor}registerListeners(e){let t=this.scrollableParents,n=()=>{this.update()};window.addEventListener(`resize`,n);for(let e of t)e.addEventListener(`scroll`,n);let r;this.options.closeOnClick&&(r=t=>{e.contains(t.target)||this.tryClose()},window.setTimeout(()=>{r&&document.addEventListener(`click`,r)},0));let i;this.options.closeOnEsc&&(i=e=>{e.key===`Escape`&&this.tryClose()},window.setTimeout(()=>{i&&document.addEventListener(`keydown`,i)},0));let a=this.options.blockPageScroll;return a&&(document.body.style.overflow=`hidden`,document.body.style.height=`100%`),()=>{window.removeEventListener(`resize`,n);for(let e of t)e.removeEventListener(`scroll`,n);r&&document.removeEventListener(`click`,r),i&&document.removeEventListener(`keydown`,i),a&&(document.body.style.overflow=``,document.body.style.height=``)}}open(e,t){if(this.context)throw Error(`The popup controller is already bound to an element`);this.tryOpen(e,t)}tryOpen(e,t){this.context||(this.context={element:e,constraints:t,cleanup:this.registerListeners(e)},e.style.display=``,e.style.visibility=`hidden`,this.update(),this.options.onOpen?.(this))}close(){if(!this.context)throw Error(`The popup controller is not bound to an element`);this.tryClose()}tryClose(){this.context&&=(this.options.onClose?.(this),this.context.cleanup(),this.context.element.style.display=`none`,void 0)}get isOpen(){return!!this.context}update(){if(!this.context)return;let e=this.context.element,t=this.context.constraints,n=e.getBoundingClientRect(),r=this.anchor.getBoundingClientRect(),i=this.visibleClientRect;if(!i)return;let a=ze(t,n,r,i);this.context.position=a||void 0,a&&(a.constrainHeight&&(e.style.height=`${a.rect.height}px`),a.constrainWidth&&(e.style.width=`${a.rect.width}px`),e.style.left=`${a.rect.left}px`,e.style.top=`${a.rect.top}px`,e.style.visibility=`visible`)}createPopupElement(){let e=document.createElement(`div`);return e.style.margin=`0`,e.style.padding=`0`,e.style.border=`none`,e.style.background=`transparent`,e.className=`composable-Popup`,e}};const Ge=ae(void 0);function Ke(){let e=P(Ge);if(!e)throw Error(`usePopupController must be used inside a Popup component`);return e}function qe({ctrlRef:e,id:n,constraints:r,isOpen:i,children:a,className:o,onClose:s,onOpen:c,zIndex:l,position:u,anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h}){let g=I(null),[_,v]=L(),y=I(s),b=I(c);return y.current=s,b.current=c,F(()=>{if(!d)throw Error(`Anchor element is required`);let e=new We({anchor:d,root:f,closeOnClick:p,closeOnEsc:m,blockPageScroll:h,onClose:()=>y.current?.(),onOpen:()=>b.current?.()});return v(e),()=>{e.tryClose()}},[d,h,p,m,f]),F(()=>{e&&(e.current=_)},[_,e]),F(()=>{_&&g.current?_.isOpen!==i&&(i?_.open(g.current,r):_.close()):_?.isOpen&&!i&&_.close()},[r,i,_]),t(Ge.Provider,{value:_,children:i&&fe(t(`div`,{id:n,style:{visibility:`hidden`,position:u||`absolute`,zIndex:l||100},ref:g,className:o,children:a}),document.body)})}function Je({anchor:e,root:n,children:r,...i}){let a=e.current;return a&&(!n||n.current)?t(qe,{anchor:a,root:n?.current||void 0,...i,children:r}):null}function Ye(){return`combobox-popup-${Math.floor(Math.random()*1e6)}`}var Xe=class{filter(e,t){let n=t.toLowerCase();return e.filter(e=>this.valueOf(e).toLowerCase().includes(n))}renderOption(e){return this.valueOf(e)}findById(e,t){return e.find(e=>this.idOf(e)===t)}createItem(e){return null}},Ze=class e extends Xe{valueOf(e){return String(e)}idOf(e){return String(e)}static instance=new e},Qe=class e extends Ze{createItem(e){return e}static instance=new e};function $e(e,t){return{buttonRight:4,buttonWidth:24,maxMenuHeight:240,menuClass:`w-72 mt-1 border-popover bg-popover text-popover-foreground shadow-md overflow-auto p-0 z-10`,inputClass:r(t?`block m-0 p-0 border-0 focus:outline-none focus:ring-0`:`block sm:text-sm sm:leading-6 bg-muted rounded-md border-0 shadow-sm ring-1 ring-inset ring-muted placeholder:text-muted focus:ring-2 focus:ring-inset focus:ring-primary py-1.5`,e?`w-full`:`!w-auto`),optionClass:`py-2 px-3 shadow-sm flex flex-col [&.option-selected]:font-semibold [&.option-highlighted]:bg-blue-300`,Input:tt,Menu:rt,Toggle:nt}}function et({menuAlign:r=`fill`,menuGap:i,focusOnMount:a,onSelect:o,value:s,zIndex:c,unstyledInput:l,fullWidth:u,api:d,layout:f,adapter:p,items:m,placeholder:h,clearable:g,noMatchMessage:_,openOnFocus:v}){let[y]=L(Ye()),b=I(void 0),x=I(null),S=f?Object.assign($e(u,l),f):$e(u,l),C=N.useRef(null),w=it({adapter:p,items:m,value:s,popupId:y});F(()=>{x.current&&a&&x.current.focus()},[a]),F(()=>{w.onSelect=o,w.popupCtrl=b.current},[w,o]),F(()=>{if(d&&w&&x.current)return d.current={open:()=>w.openMenu(),close:()=>w.closeMenu(),toggle:()=>w.toggleMenu(),setInputValue:e=>w.inputText=e,inputValue:w.inputText||``,selectedItem:w.selectedItem,focus:()=>x.current?.focus()},()=>{d.current=null}},[d,w]);let T=w.isMenuOpen&&(w.filteredItems.length>0||!!_);return n(e,{children:[t(S.Input,{boxRef:C,inputRef:x,ctrl:w,layout:S,placeholder:h,clearable:g,openOnFocus:v}),t(Je,{id:y,ctrlRef:b,className:`combobox-popup`,closeOnClick:!0,closeOnEsc:!0,onClose:()=>w.closeMenu(),isOpen:T,anchor:C,zIndex:c,constraints:{position:`bottom`,align:r,gap:i??4},children:t(S.Menu,{fillWidth:r===`fill`,items:w.filteredItems,ctrl:w,layout:S,adapter:p,noMatchMessage:_})})]})}function tt({inputRef:e,placeholder:r,boxRef:i,ctrl:a,layout:o,clearable:s,openOnFocus:c}){let l=o.Toggle,u=s&&a.selectedItem!=null,d=+!!l+ +!!u,f=d>0?{paddingRight:`${o.buttonWidth*d+o.buttonRight}px`}:void 0;return n(`div`,{className:`relative`,ref:i,children:[t(`input`,{ref:e,placeholder:r,...a.getInputProps(),onFocus:c?()=>a.openMenu():void 0,style:f,className:o.inputClass}),n(`div`,{style:{position:`absolute`,right:`${o.buttonRight}px`,top:0,bottom:0,display:`flex`,alignItems:`center`,gap:`2px`},children:[u&&t(`button`,{type:`button`,style:{border:`none`,padding:0,margin:0,backgroundColor:`transparent`,cursor:`pointer`,display:`flex`,alignItems:`center`,width:`${o.buttonWidth}px`},onClick:()=>{a.selectedItem=null},children:t(te,{className:`w-4 h-4`})}),l&&t(`button`,{type:`button`,style:{width:`${o.buttonWidth}px`,border:`none`,padding:0,margin:0,backgroundColor:`transparent`,display:`flex`,alignItems:`center`,justifyContent:`center`},...a.getToggleButtonProps(),children:t(l,{ctrl:a,layout:o})})]})]})}function nt({ctrl:e}){return e.isMenuOpen?t(p,{className:`w-4 h-4`}):t(l,{className:`w-4 h-4`})}function rt({fillWidth:e,items:n,layout:i,ctrl:a,adapter:o,noMatchMessage:s}){let{highlightedIndex:c,selectedItem:l}=a;return n.length===0?s?t(`div`,{style:{width:e?`100%`:void 0},className:i.menuClass,children:s}):null:t(`ul`,{style:{width:e?`100%`:void 0,maxHeight:i.maxMenuHeight?`${i.maxMenuHeight}px`:`240px`},className:i.menuClass,...a.getMenuProps(),children:n.map((e,n)=>t(`li`,{"data-index":n,className:r(i.optionClass,c===n&&`option-highlighted`,l===e&&`option-selected`),...a.getItemProps(e,n),children:o.renderOption(e)},o.idOf(e)))})}function it(e){let[t,n]=L(new at(e));return F(()=>{t?.withState(n)},[t]),t}var at=class e{popupId;items;adapter;onSelect;setState;_selectedItem=null;_filteredItems;_inputText=``;_highlightedIndex=null;_isMenuOpen=!1;popupCtrl;constructor({adapter:e,items:t,value:n,popupId:r}){this.adapter=e,this.items=t,this.popupId=r,typeof n==`string`?this._inputText=n:n&&(this._selectedItem=e.findById(t,e.idOf(n))||null,this._selectedItem&&(this._inputText=e.valueOf(n))),this._inputText?this._filteredItems=this.adapter.filter(this.items,this._inputText):this._filteredItems=this.items}withState(e){return this.setState=e,this}clone(){let t=new e({adapter:this.adapter,items:this.items,popupId:this.popupId});return t.setState=this.setState,t.onSelect=this.onSelect,t._inputText=this._inputText,t._highlightedIndex=this._highlightedIndex,t._selectedItem=this._selectedItem,t._isMenuOpen=this._isMenuOpen,t._filteredItems=this._filteredItems,t.popupCtrl=this.popupCtrl,t}updateState(){this.setState?.(this.clone())}get filteredItems(){return this._inputText?this.adapter.filter(this.items,this._inputText):this.items}get selectedItem(){return this._selectedItem}set selectedItem(e){this._selectedItem=e,this._inputText=e?this.adapter.valueOf(e):``,this._filteredItems=this._inputText?this.adapter.filter(this.items,this._inputText):this.items,this.updateState(),this.onSelect?.(e)}get isMenuOpen(){return this._isMenuOpen}set inputText(e){if(this._inputText=e,e?this._filteredItems=this.adapter.filter(this.items,e):this._filteredItems=this.items,this._highlightedIndex=null,this._selectedItem=null,this.updateState(),this.isMenuOpen&&this.popupCtrl){let e=this.popupCtrl,t=e.context?.position?.position;t&&t===`top`&&window.setTimeout(()=>{e.update()},100)}}get inputText(){return this._inputText}set highlightedIndex(e){this._highlightedIndex=e,this.updateState()}get highlightedIndex(){return this._highlightedIndex}openMenu(){this._filteredItems.length>0&&(this._isMenuOpen=!0,this.updateState())}closeMenu(e){this._isMenuOpen&&(this._highlightedIndex=null,this._isMenuOpen=!1,this.updateState())}toggleMenu(){this._isMenuOpen?this.closeMenu():this.openMenu()}highlightIndex(e,t=!1){this.highlightedIndex=e;let n=document.getElementById(this.popupId);n&&n.querySelector(`li[data-index="${e}"]`)?.scrollIntoView(t)}getMenuProps(){return{}}getToggleButtonProps(){return{onClick:()=>{this._isMenuOpen=!this._isMenuOpen,this.updateState()}}}getItemProps(e,t){return{"aria-selected":this._highlightedIndex===t,onClick:()=>{this.selectedItem=e,this.closeMenu()},onMouseEnter:()=>{this.highlightedIndex!==t&&(this.highlightedIndex=t)},onMouseLeave:()=>{this.highlightedIndex===t&&(this.highlightedIndex=null)}}}getInputProps(){let e=this._filteredItems;return{onClick:()=>{this.openMenu()},onChange:e=>{let t=e.target.value;this.inputText=t,this.openMenu()},value:this.inputText,onKeyDown:t=>{let n=t.key;if(n===`Enter`){if(this.highlightedIndex!=null)this.selectedItem=e[this.highlightedIndex||0];else if(this.inputText){let e=this.adapter.createItem(this.inputText);e&&(this.items.push(e),this.selectedItem=e)}this.closeMenu()}else n===`ArrowDown`?this.isMenuOpen?this.highlightIndex(this.highlightedIndex===null?0:ot(this.highlightedIndex,e.length),!1):this.openMenu():n===`ArrowUp`&&this.isMenuOpen&&this.highlightIndex(this.highlightedIndex===null?0:st(this.highlightedIndex,e.length),!0)}}}};function ot(e,t){return(e+1)%t}function st(e,t){return(e-1+t)%t}function ct({options:e,creatable:n,...r}){return t(et,{adapter:n?Qe.instance:Ze.instance,items:e,...r})}function lt({className:e}){return t(`hr`,{className:r(`w-full h-0.5 border-t-0 bg-border`,e)})}function q(...e){return ge(i(e))}const ut=N.createContext(void 0);function dt(e,t=`plugin-portal-container`){let n=e instanceof Document?e.body:e;for(let e of Array.from(n.children))if(e instanceof HTMLElement&&e.id===t)return e;let r=document.createElement(`div`);return r.id=t,n.appendChild(r),r}function ft({children:e,id:n=`plugin-portal-container`}){let r=N.useContext(ut),i=N.useRef(null),[a,o]=N.useState(r||void 0);return N.useEffect(()=>{if(r){o(r);return}if(i.current){let e=i.current.getRootNode();if(e instanceof ShadowRoot||e instanceof Document){let t=dt(e,n);o(t)}else o(null)}},[n,r]),a===void 0?t(`div`,{ref:i,style:{display:`none`}}):t(ut.Provider,{value:a||void 0,children:e})}function pt(){return N.useContext(ut)}const mt=B.Provider,ht=B.Root,gt=B.Trigger,_t=M.forwardRef(({className:e,sideOffset:n=4,side:r=`top`,...i},a)=>{let o=pt();return t(B.Portal,{container:o,children:t(B.Content,{ref:a,sideOffset:n,side:r,style:{zIndex:100},className:q(`max-w-[90vw]`,`z-50 overflow-hidden rounded-md bg-tooltips border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});_t.displayName=B.Content.displayName;function vt({description:e,children:r,size:i=`sm`,placement:a=`top`,className:o,asChild:s}){let[c,l]=M.useState(!1),u=M.useRef(!1);return M.useEffect(()=>{let e=()=>{l(!1),u.current=!0,requestAnimationFrame(()=>{u.current=!1})};return window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},[]),t(mt,{delayDuration:0,children:n(ht,{open:c,onOpenChange:e=>{u.current||l(e)},children:[t(gt,{className:`cursor-pointer`,asChild:s,children:r}),t(_t,{side:a,className:`px-3 py-1.5 max-w-${i} text-${i} px-3 ${o}`,children:e})]})})}const yt=new Set;function bt(e,t,n){F(()=>{t&&!yt.has(e)&&(yt.add(e),console.warn(`[@vertesia/ui] ${e} is deprecated: ${n}`))},[t,n,e])}function xt(e){return M.Children.toArray(e).some(e=>{if(typeof e==`string`)return e.trim().length>0;if(typeof e==`number`)return!0;if(M.isValidElement(e)){let t=e.props;return t[`aria-hidden`]===!0||t[`aria-hidden`]===`true`?!1:xt(t.children)}return!1})}const St=z(`hover:cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{destructive:`bg-destructive dark:bg-destructive/10 text-destructive ring-1 ring-inset ring-destructive-muted/50 dark:ring-destructive-muted/50 shadow-xs hover:bg-destructive/50`,outline:`border border-input bg-background shadow-xs hover:bg-muted ring-inset`,secondary:`bg-primary/5 dark:bg-primary/10 text-primary shadow-xs hover:bg-primary/10 dark:hover:bg-primary/20 ring-inset`,ghost:`hover:bg-muted/50 dark:hover:bg-muted/20 ring-inset`,link:`text-foreground underline-offset-4 hover:underline ring-inset`,primary:`bg-primary text-white shadow-xs hover:bg-primary/90 ring-inset`,unstyled:``},size:{xs:`h-7 rounded px-2 py-1 text-xs gap-x-1`,sm:`h-8 rounded px-3 text-xs`,md:`h-9 rounded-md px-4 py-2`,lg:`h-10 rounded-md px-3`,xl:`rounded-md px-3.5 py-2.5 text-sm gap-x-2`,icon:`p-0 m-0 rounded-full`,none:``}},defaultVariants:{variant:`primary`,size:`md`}}),J=M.forwardRef(({className:i,variant:a,size:o,asChild:s=!1,alt:c,isDisabled:l,isLoading:u,title:d,tooltipPlacement:f=`top`,onClick:p,type:m,...h},g)=>{bt(`Button.alt`,c!==void 0,"use `title` instead — it drives the same tooltip and the accessible name. `alt` remains an alias for one release.");let _=s?pe:`button`,v=s?m:m??`button`,y=d??c,b=h[`aria-label`]??c??(xt(h.children)?void 0:d),S=s?h.children:n(e,{children:[u&&t(x,{className:`animate-spin`}),h.children]}),C=t(_,{className:r(q(St({variant:a,size:o})),i),disabled:l||u||h.disabled,ref:g,onClick:p,type:v,autoFocus:!1,...h,"aria-label":b,children:S});return y?t(vt,{description:y,asChild:!0,className:`cursor-pointer`,size:`xs`,placement:f,children:C}):C});J.displayName=`Button`;const Ct=M.forwardRef(({size:e,content:n,toast:r,className:i,alt:a,"aria-label":s,...c},l)=>{let[u,d]=L(!1),{t:f}=R();bt(`CopyButton.alt`,a!==void 0,"use aria-label for the accessible name. `alt` is forwarded for one release.");let p=e=>{e.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{d(!0),setTimeout(()=>d(!1),2e3),r?.toast&&r.toast({status:`success`,title:r.message||f(`misc.copiedToClipboard`),duration:2e3})}).catch(e=>{console.error(`Failed to copy text: `,e),r?.toast&&r.toast({status:`error`,title:f(`misc.failedToCopy`),duration:2e3})})},m=s??a??f(`misc.copy`);return t(J,{ref:l,className:q(i),variant:`unstyled`,size:e||`sm`,onClick:p,...c,title:m,children:u?t(o,{className:`text-success`}):t(v,{className:`size-4`})})});Ct.displayName=`CopyButton`;function wt({buttonLabel:e,title:r,children:i,onClick:a}){return t(`div`,{className:`flex items-center justify-center h-full text-center`,children:n(`div`,{className:`py-12`,children:[t(`svg`,{className:`mx-auto size-12`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,"aria-hidden":`true`,children:t(`path`,{vectorEffect:`non-scaling-stroke`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z`})}),t(`h3`,{className:`mt-2 text-sm font-semibold`,children:r}),t(`p`,{className:`mt-1 text-sm text-muted`,children:i}),t(`div`,{className:`mt-6`,children:n(J,{onClick:a,children:[t(E,{className:`-ms-0.5 me-1.5 size-5`,"aria-hidden":`true`}),e]})})]})})}function Tt(e){return e.isFile}function Et(e){return e.isDirectory}function Dt(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}function Ot({children:e,onUpload:r}){let i=I(null);return n(`label`,{style:{cursor:`pointer`},children:[e,t(`input`,{ref:i,type:`file`,style:{display:`none`},onChange:()=>{i.current?.files&&r(Dt(i.current.files))}})]})}function kt({onUpload:e}){return t(`div`,{...Nt({onUpload:e}),className:`flex items-center justify-center w-full h-64 border-2 border-dashed rounded-lg cursor-pointer bg-gray-50 dark:hover:bg-bray-800 dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600 dark:hover:border-gray-500 dark:hover:bg-gray-600`,children:n(`label`,{htmlFor:`dropzone-file`,className:`flex flex-col items-center justify-center w-full h-full`,children:[n(`div`,{className:`flex flex-col items-center justify-center pt-5 pb-6`,children:[t(`svg`,{className:`w-8 h-8 mb-4 text-gray-500 dark:text-gray-400`,"aria-hidden":`true`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 16`,children:t(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2`})}),n(`p`,{className:`mb-2 text-sm text-gray-500 dark:text-gray-400`,children:[t(`span`,{className:`font-semibold`,children:`Click to upload`}),` or drag and drop`]}),t(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:`SVG, PNG, JPG or GIF (MAX. 800x400px)`})]}),t(`input`,{id:`dropzone-file`,type:`file`,className:`hidden`})]})})}function At(e){if(!e)return!1;let t=e.__dragOver_cnt__||0;return e.__dragOver_cnt__=t+1,!t}function jt(e){if(!e)return!1;let t=e.__dragOver_cnt__;return t?(e.__dragOver_cnt__=t-1,t===1):!1}function Mt(e){e&&delete e.__dragOver_cnt__}function Nt({onUpload:e,dragOverClass:t=`is-drag-over-on`,dropEffect:n=`copy`}){let r=I(null);return{onDrop:n=>{n.preventDefault(),Mt(r.current),r.current?.classList.remove(t);let i=n.dataTransfer.items;if(i){let t=[],n=(e,t=``)=>new Promise(r=>{if(Tt(e))e.file(e=>{Object.defineProperty(e,"webkitRelativePath",{value:t+e.name}),r([e])});else if(Et(e)){let i=e.createReader(),a=[],o=()=>{i.readEntries(i=>{if(!i.length)Promise.all(a).then(e=>r(e.flat()));else{for(let r of i)a.push(n(r,`${t+e.name}/`));o()}})};o()}});for(let e=0;e<i.length;e++){let r=i[e].webkitGetAsEntry();r&&t.push(n(r))}Promise.all(t).then(t=>{let n=t.flat();n.length&&e(n)})}},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect=n},onDragEnter:()=>{At(r.current)&&r.current?.classList.add(t)},onDragLeave:()=>{jt(r.current)&&r.current?.classList.remove(t)},ref:r}}function Pt(...e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` `):void 0}function Ft(){try{return _e.isDev}catch{return!1}}function It({description:e,helpText:i,error:a,required:o,label:s,className:c,direction:l=`column`,children:u,disabled:d=!1,fullWidthLabel:f=!1,childrenId:p}){let m=le(),h=le(),g=le(),_=p??m,v=I(!1),b=ne.toArray(u).filter(se),x=b.length===1?b[0]:void 0,S=x?.type===re,C=!!x&&!S,w=!1,T=u;if(C&&x){let e=x,t=e.props??{},n=Pt(t[`aria-describedby`],i?h:void 0,a?g:void 0),r=t[`aria-invalid`]??(a?!0:void 0);T=ie(e,{id:t.id??_,"aria-describedby":n,"aria-invalid":r}),w=!0}else Ft()&&!v.current&&(i||a||p===void 0)&&(v.current=!0,console.warn("[@vertesia/ui] FormItem received zero, multiple, or a fragment as element children. ARIA wiring skipped. Pass `childrenId` and set `id` / `aria-describedby` / `aria-invalid` on your input manually, or wrap the input in a single non-fragment element."));let E=w||p?_:void 0;return n(`div`,{className:r(`flex w-full space-y-1`,c,l===`row`?`flex-row justify-between items-center gap-2`:l===`row-reverse`?`flex-row-reverse justify-between items-center gap-2`:`flex-col`),children:[n(`div`,{className:r(`flex items-center gap-1 mb-0`,f&&`w-full`),children:[n(`label`,{htmlFor:E,className:`text-sm font-medium mb-1 ${d?`text-muted`:``} ${f&&`flex-1`}`,children:[s,o?t(`span`,{className:`text-destructive -mt-4 ms-1`,children:`*`}):``]}),e&&t(`div`,{className:`mx-2 flex w-4 items-center`,children:t(vt,{description:e,children:t(y,{className:`size-3 text-muted`})})})]}),T,i&&t(`p`,{id:h,className:`text-xs text-muted`,children:i}),a&&t(`p`,{id:g,className:`text-xs text-destructive`,children:a})]})}function Lt(e){return t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e(t))}}const Rt=z(`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium`,{variants:{variant:{default:`text-foreground bg-muted`,secondary:`bg-secondary text-primary`,destructive:`bg-destructive text-destructive`,attention:`bg-attention text-attention`,success:`bg-success text-success`,info:`bg-info text-info`,done:`bg-done text-done`,outline:`bg-transparent border border-border text-foreground`}},defaultVariants:{variant:`default`}});function zt({className:e,variant:n,children:r,onClick:i,...a}){let o=i?{role:`button`,tabIndex:0,onClick:i,onKeyDown:Lt(i)}:{};return t(`span`,{className:q(Rt({variant:n}),e),...o,...a,children:r})}const Bt=z(`inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium ring-1 ring-inset ring-border`,{variants:{variant:{default:``,success:``,destructive:``,attention:``,done:``,info:``,outline:``}},defaultVariants:{variant:`default`}}),Vt=z(`h-1.5 w-1.5`,{variants:{variant:{default:`fill-foreground`,success:`fill-success`,destructive:`fill-destructive`,attention:`fill-attention`,done:`fill-done`,info:`fill-info`,outline:`fill-foreground`}},defaultVariants:{variant:`default`}});function Ht({variant:e,className:r,dotClassName:i,children:a,...o}){return n(`span`,{className:q(Bt({variant:e}),r),...o,children:[t(`div`,{className:`flex-shrink-0`,children:t(`svg`,{className:q(Vt({variant:e}),i),viewBox:`0 0 6 6`,"aria-hidden":`true`,children:t(`circle`,{cx:3,cy:3,r:3})})}),t(`span`,{className:`truncate`,children:a})]})}function Ut({value:e=[],onChange:i,className:a,delimiters:o=`, `,placeholder:s,autoFocus:c,disabled:l=!1}){let[u,d]=L(``),f=t=>{if(l)return;let n=t.currentTarget.value;n?.trim()&&(i([...e,n.trim()]),d(``))},p=t=>{if(l)return;let n=t.currentTarget.value,r=!n.trim(),a=t.key;a===`Enter`||o.indexOf(a)>-1?(t.preventDefault(),e&&!r&&(i([...e,n.trim()]),d(``))):a===`Backspace`&&r&&e&&e.length>0&&(e.pop(),i([...e]))},m=t=>{if(l)return;let n=t.clipboardData.getData(`text`);if(n){t.preventDefault();let r=o.split(``).map(e=>e===` `?`\\s`:e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),a=RegExp(`[${r}]+`),s=n.split(a).map(e=>e.trim()).filter(e=>e.length>0);s.length>0&&i([...e,...s]),d(``)}},h=t=>{l||e&&e.length>0&&(e.splice(t,1),i([...e]))};return n(`div`,{className:r(a,`w-full flex flex-wrap items-center gap-1 p-2 py-1.5`,`rounded-md text-sm rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,l&&`opacity-50 cursor-not-allowed`),children:[e&&e.length>0&&e.map((e,n)=>t(vt,{description:`click to remove`,children:t(zt,{variant:`secondary`,onClick:()=>h(n),className:r(`flex-shrink-0 transition-colors`,l?`cursor-not-allowed`:`cursor-pointer hover:bg-destructive hover:text-destructive`),title:e,children:t(`span`,{className:`break-all`,children:e})})},`item-${n}`)),t(`input`,{className:`flex-1 min-w-[80px] m-0 p-0 px-1 border-0 bg-transparent text-sm placeholder:text-muted focus:outline-none focus:ring-0 disabled:cursor-not-allowed`,type:`text`,value:u,onBlur:f,onKeyDown:p,onPaste:m,onChange:e=>d(e.currentTarget.value),placeholder:!e||e.length===0?s:``,autoFocus:c,disabled:l})]})}function Wt({underline:e=`always`,className:n,children:i,...a}){let o;return e===`always`?o=`underline`:e===`hover`&&(o=`hover:underline`),t(`a`,{className:r(`text-indigo-800 dark:text-indigo-300`,n,o),...a,children:i})}function Gt({className:e,children:n}){return t(`ul`,{className:`${e} space-y-1 flex flex-col items-start`,children:n})}Gt.Item=oe(function(e,n){let{current:i,children:a,className:o,href:s=`#`,onClick:c,...l}=e;return t(`li`,{className:r(o,i?`bg-muted`:``,`w-full p-2 ps-3 text-sm leading-6 font-semibold hover:bg-muted`),children:t(`a`,{ref:n,href:s,onClick:e=>{c?(e.preventDefault(),c(e)):s===`#`&&e.preventDefault()},className:`w-full flex items-center gap-x-3`,...l,children:a})})});const Kt=`rounded-md text-sm flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,qt={INPUT_UNSTYLED:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,INPUT_NO_PADDING:Kt,INPUT:`${Kt} py-1.5`};function Jt(e){return e==null||Number.isNaN(e)?``:e.toString()}const Yt=N.forwardRef(({value:e,onChange:n,className:i,noScroll:a=!1,noSpinners:o=!1,...s},c)=>{let[l,u]=N.useState(Jt(e));return F(()=>{if(e==null||!Number.isNaN(e)){let t=Jt(e);u(t)}},[e]),t(`input`,{onWheel:a?e=>{e.currentTarget.blur()}:s.onWheel,type:`number`,value:l,onChange:e=>{let t=e.target.value;u(t),t===``?n?.(void 0,t):n?.(parseFloat(t),t)},className:r(i,qt.INPUT,{"no-spinners":o},o&&`[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`),ref:c,...s})});function Xt({children:e,overlayContent:r,className:i=``,overlayClassName:a=``,position:o=`right`,width:s,height:c,showCloseButton:l=!0,onOpen:u,onClose:d,triggerClassName:f=``,backdropClassName:p=``,animationConfig:m={type:`spring`,stiffness:300,damping:30}}){let[h,g]=L(!1),_=()=>{g(!0),u?.()},v=()=>{g(!1),d?.()},y=Zt(o),b=Qt(o,s,c);return n(`div`,{className:`flex items-center justify-center w-full ${i}`,children:[t(J,{variant:`unstyled`,size:`none`,onClick:_,className:`w-full align-left cursor-pointer ${f}`,children:e}),h&&t(`div`,{className:`z-45 fixed inset-0 bg-black bg-opacity-50 ${p}`,children:n(ye.div,{...y,transition:m,className:`${b} ${a}`,children:[l&&t(`div`,{className:`absolute top-2 end-2 z-10`,children:t(J,{onClick:v,variant:`primary`,children:t(j,{})})}),t(`div`,{className:l?`mt-8`:``,children:r})]})})]})}function Zt(e){switch(e){case`left`:return{initial:{x:`-100%`},animate:{x:0},exit:{x:`-100%`}};case`right`:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}};case`top`:return{initial:{y:`-100%`},animate:{y:0},exit:{y:`-100%`}};case`bottom`:return{initial:{y:`100%`},animate:{y:0},exit:{y:`100%`}};case`center`:return{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8}};default:return{initial:{x:`100%`},animate:{x:0},exit:{x:`100%`}}}}function Qt(e,t,n){let r=`fixed bg-white shadow-lg p-4 relative`;switch(e){case`left`:return`${r} left-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`right`:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`;case`top`:return`${r} top-[var(--header-height)] start-0 end-0 ${n||`h-80`}`;case`bottom`:return`${r} bottom-0 start-0 end-0 ${n||`h-80`}`;case`center`:return`${r} top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 ${t||`w-96`} ${n||`max-h-96`}`;default:return`${r} right-0 top-[var(--header-height)] h-full ${t||`w-80`}`}}const $t=`--tailwind-portal`;function en({children:e}){let n=I(null),[r,i]=L(null);return F(()=>{if(n.current){let e=n.current.ownerDocument,t=e.getElementById($t);t||(t=e.createElement(`DIV`),t.id=$t,e.body.appendChild(t)),i(t)}},[]),r?fe(e,r):t(`span`,{ref:n})}function tn({path:e,maxItems:r=3,className:i,separator:a}){let o=e||[],s=e=>{let n=typeof e.label==`string`&&e.label.length>20?`${e.label.slice(0,17)}...`:e.label;return e.onClick?t(sn,{onClick:e.onClick,href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):e.href?t(sn,{href:e.href,title:typeof e.label==`string`?e.label:void 0,children:n}):t(cn,{children:n})};if(o.length<=r)return t(nn,{className:q(`w-full flex items-center`,i),children:t(rn,{children:o.map((e,r)=>n(M.Fragment,{children:[t(an,{children:s(e)}),r<o.length-1&&t(ln,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))})});let c=o.slice(-(r-1));return t(nn,{className:q(`w-full flex items-center`,i),children:n(rn,{children:[t(an,{children:t(un,{})}),t(ln,{children:a??t(u,{className:`cn-rtl-flip`})}),c.map((e,r)=>n(M.Fragment,{children:[t(an,{children:s(e)}),r<c.length-1&&t(ln,{children:a??t(u,{className:`cn-rtl-flip`})})]},`crumb-${r}`))]})})}const nn=M.forwardRef(({...e},n)=>t(`nav`,{ref:n,"aria-label":`breadcrumb`,...e}));nn.displayName=`Breadcrumb`;const rn=M.forwardRef(({className:e,...n},r)=>t(`ol`,{ref:r,className:q(`flex flex-wrap items-center gap-1.5 break-words text-sm text-muted sm:gap-2.5`,e),...n}));rn.displayName=`BreadcrumbList`;const an=M.forwardRef(({className:e,...n},r)=>t(`li`,{ref:r,className:q(`inline-flex items-center gap-1.5 text-muted`,e),...n}));an.displayName=`BreadcrumbItem`;const on=M.forwardRef(({asChild:e,className:n,...r},i)=>t(`a`,{ref:i,className:q(`transition-colors hover:text-muted`,n),...r}));on.displayName=`BreadcrumbLink`;const sn=M.forwardRef(({className:e,href:n,onClick:r,...i},a)=>t(J,{variant:`ghost`,size:`md`,ref:a,className:q(`p-0! hover:underline! hover:bg-background!`,e),onClick:e=>{e.preventDefault(),r&&r(e)},...i}));sn.displayName=`BreadcrumbButton`;const cn=M.forwardRef(({className:e,...n},r)=>t(`span`,{ref:r,"aria-current":`page`,className:q(`font-normal text-foreground`,e),...n}));cn.displayName=`BreadcrumbPage`;const ln=({children:e,className:n,...r})=>t(`li`,{role:`presentation`,"aria-hidden":`true`,className:q(`[&>svg]:w-3.5 [&>svg]:h-3.5`,n),...r,children:e??t(u,{className:`cn-rtl-flip`})});ln.displayName=`BreadcrumbSeparator`;const un=({className:e,...r})=>n(`span`,{role:`presentation`,"aria-hidden":`true`,className:q(`flex h-9 w-9 items-center justify-center`,e),...r,children:[t(T,{className:`h-4 w-4`}),t(`span`,{className:`sr-only`,children:`More`})]});un.displayName=`BreadcrumbEllipsis`;const dn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`rounded-xl border bg-card text-card-foreground shadow`,e),...n}));dn.displayName=`Card`;const fn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex flex-col p-6`,e),...n}));fn.displayName=`CardHeader`;const pn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`font-semibold leading-none tracking-tight`,e),...n}));pn.displayName=`CardTitle`;const mn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`text-sm text-muted-foreground`,e),...n}));mn.displayName=`CardDescription`;const hn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`p-6 pt-0`,e),...n}));hn.displayName=`CardContent`;const gn=M.forwardRef(({className:e,...n},r)=>t(`div`,{ref:r,className:q(`flex items-center p-6 pt-0`,e),...n}));gn.displayName=`CardFooter`;const _n=M.forwardRef(({className:e,...n},r)=>t(be.Root,{ref:r,className:q(`peer size-4 shrink-0 rounded-sm border border-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-white`,e),...n,children:t(be.Indicator,{className:q(`flex items-center justify-center text-current`),children:t(o,{className:`size-4`})})}));_n.displayName=be.Root.displayName;function vn({...e}){return t(xe.Root,{"data-slot":`collapsible`,...e})}function yn({...e}){return t(xe.Trigger,{"data-slot":`collapsible-trigger`,...e})}function bn({...e}){return t(xe.Content,{"data-slot":`collapsible-content`,...e})}function xn({children:e}){return t(`span`,{style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`},children:e})}const Sn=ae(!1);function Cn(){return!!P(Sn)}function wn({children:e}){return t(Sn.Provider,{value:!0,children:e})}function Tn({className:e,children:r,isOpen:i,onClose:a,description:o=`Modal Description`,noCloseButton:s=!1,allowOverflow:c=!1,disableCloseOnClickOutside:l=!1,size:u=`md`,action:d}){let f=e=>{e||a()};function p(){switch(u){case`sm`:return`max-w-[20vw]`;case`md`:return`max-w-[60vw] lg:max-w-[40vw]`;case`lg`:return`max-w-[80vw] md:max-w-[60vw]`;case`xl`:return`max-w-[95vw] lg:max-w-[80vw]`;default:return`max-w-[60vw] lg:max-w-[40vw]`}}return n(kn,{open:i,onOpenChange:e=>{(!l||e)&&f(e)},children:[c&&t(Nn,{className:`z-50 fixed inset-0 bg-black/80`}),t(xn,{children:t(Fn,{children:o})}),n(Pn,{className:q(`min-h-20 p-4`,`fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 sm:rounded-lg`,p(),e),children:[t(`div`,{className:`top-4 end-4 absolute`,children:n(`div`,{className:`flex gap-2`,children:[d&&d,!s&&t(Mn,{onClick:()=>f(!1),asChild:!0,autoFocus:!1,children:t(J,{variant:`outline`,title:`Close`,className:`data-[state=open]:bg-accent opacity-70 hover:opacity-100 rounded-sm focus:outline-none focus:ring-2 focus:ring-ring ring-offset-background focus:ring-offset-2 data-[state=open]:text-muted-foreground transition-opacity disabled:pointer-events-none`,children:t(j,{className:`size-4`})})})]})}),t(wn,{children:r})]})]})}const En=({children:e,show:r=!0,className:i,description:a,showDivider:o=!1,...s})=>r?n(In,{className:q(o?`border-b-solid border-b border-b-1 pb-2 mb-4`:``,`text-lg font-semibold leading-6 tracking-tight`,{"py-2":!a},i),...s,children:[e,a&&t(Fn,{className:`text-sm !font-normal text-muted-foreground pb-2`,children:a})]}):n(xn,{children:[t(In,{children:e}),a&&t(Fn,{children:a})]}),Dn=({children:e,className:n,...r})=>t(`div`,{className:q(`text-sm max-h-[80vh] overflow-y-auto`,n),...r,children:e}),On=({align:e=`right`,children:n,className:r,...i})=>t(`div`,{className:q(`w-full flex py-3 sm:py-2 sm:flex sm:flex-row-reverse sm:flex-row sm:justify-end gap-2`,{left:`justify-start`,center:`justify-center`,right:`justify-end`}[e],r),...i,children:n}),kn=H.Root,An=H.Trigger,jn=H.Portal,Mn=H.Close,Nn=M.forwardRef(({className:e,...n},r)=>t(H.Overlay,{ref:r,className:q(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...n}));Nn.displayName=H.Overlay.displayName;const Pn=M.forwardRef(({className:e,children:r,...i},a)=>{let o=pt();return n(jn,{container:o,children:[t(Nn,{}),t(H.Content,{ref:a,autoFocus:!1,onOpenAutoFocus:e=>{e.preventDefault()},className:q(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...i,children:r})]})});Pn.displayName=H.Content.displayName;const Fn=M.forwardRef(({className:e,...n},r)=>t(H.Description,{ref:r,className:q(`text-sm text-muted`,e),...n}));Fn.displayName=H.Description.displayName;const In=M.forwardRef(({className:e,...n},r)=>t(H.Title,{ref:r,className:q(`text-lg font-semibold leading-none tracking-tight`,e),...n}));In.displayName=H.Title.displayName;const Ln=M.forwardRef(({className:e,...n},r)=>t(V,{ref:r,className:q(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...n}));Ln.displayName=V.displayName;const Rn=({children:e,...n})=>t(kn,{...n,children:t(Pn,{className:`shadow-lg p-0 overflow-hidden`,children:t(Ln,{className:`[&_[cmdk-group]]:px-2 [&_[cmdk-item]]:px-2 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:w-5 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,children:e})})}),zn=M.forwardRef(({className:e,...r},i)=>n(`div`,{className:`flex items-center px-3 border-b`,"cmdk-input-wrapper":``,children:[t(D,{className:`opacity-50 size-4 shrink-0`}),t(V.Input,{ref:i,className:q(`focus:ring-0`,`border-0 flex h-8 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...r})]}));zn.displayName=V.Input.displayName;const Bn=M.forwardRef(({className:e,...n},r)=>t(V.List,{ref:r,className:q(`overflow-y-auto overflow-x-hidden`,e),...n}));Bn.displayName=V.List.displayName;const Vn=M.forwardRef((e,n)=>t(V.Empty,{ref:n,className:`py-2 text-sm text-center`,...e}));Vn.displayName=V.Empty.displayName;const Y=M.forwardRef(({className:e,...n},r)=>t(V.Group,{ref:r,className:q(`overflow-y-auto overflow-x-hidden p-1 text-foreground`,`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...n}));Y.displayName=V.Group.displayName;const Hn=M.forwardRef(({className:e,...n},r)=>t(V.Separator,{ref:r,className:q(`-mx-1 h-px bg-border`,e),...n}));Hn.displayName=V.Separator.displayName;const X=M.forwardRef(({className:e,...n},r)=>t(V.Item,{ref:r,className:q(`hover:bg-muted cursor-pointer relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,e),...n}));X.displayName=V.Item.displayName;const Un=({className:e,...n})=>t(`span`,{className:q(`ms-auto text-xs tracking-widest text-muted-foreground`,e),...n});Un.displayName=`CommandShortcut`;const Wn=M.createContext(!1);function Gn({...e}){return t(U.Root,{"data-slot":`dropdown-menu`,...e})}function Kn({...e}){return t(U.Portal,{"data-slot":`dropdown-menu-portal`,...e})}function qn({...e}){return t(U.Trigger,{"data-slot":`dropdown-menu-trigger`,...e})}function Jn({className:e,align:n=`start`,sideOffset:r=4,...i}){return t(U.Portal,{children:t(U.Content,{"data-slot":`dropdown-menu-content`,sideOffset:r,align:n,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden`,e),...i})})}function Yn({...e}){return t(U.Group,{"data-slot":`dropdown-menu-group`,...e})}function Xn({className:e,inset:n,variant:r=`default`,...i}){return t(U.Item,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:q(`hover:bg-muted focus:bg-muted data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...i})}function Zn({className:e,children:r,checked:i,inset:a,...o}){return n(U.CheckboxItem,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":a,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),checked:i,...o,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function Qn({...e}){return t(U.RadioGroup,{"data-slot":`dropdown-menu-radio-group`,...e})}function $n({className:e,children:r,inset:i,...a}){return n(U.RadioItem,{"data-slot":`dropdown-menu-radio-item`,"data-inset":i,className:q(`focus:bg-muted focus:text-muted focus:**:text-muted gap-2 rounded-md py-1 pe-8 ps-1.5 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[t(`span`,{className:`absolute end-2 flex items-center justify-center pointer-events-none`,"data-slot":`dropdown-menu-radio-item-indicator`,children:t(U.ItemIndicator,{children:t(s,{})})}),r]})}function er({className:e,inset:n,...r}){return t(U.Label,{"data-slot":`dropdown-menu-label`,"data-inset":n,className:q(`text-muted px-1.5 py-1 text-xs font-medium data-inset:ps-7`,e),...r})}function tr({className:e,...n}){return t(U.Separator,{"data-slot":`dropdown-menu-separator`,className:q(`bg-border -mx-1 my-1 h-px`,e),...n})}function nr({className:e,...n}){return t(`span`,{"data-slot":`dropdown-menu-shortcut`,className:q(`text-muted group-focus/dropdown-menu-item:text-muted ms-auto text-xs tracking-widest`,e),...n})}function rr({...e}){return t(U.Sub,{"data-slot":`dropdown-menu-sub`,...e})}function ir({className:e,inset:r,children:i,...a}){return n(U.SubTrigger,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":r,className:q(`focus:bg-muted focus:text-muted data-open:bg-muted data-open:text-muted not-data-[variant=destructive]:focus:**:text-muted gap-2 rounded-md px-1.5 py-1 text-sm data-inset:ps-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,e),...a,children:[i,t(d,{className:`cn-rtl-flip ms-auto`})]})}function ar({className:e,...n}){return t(U.SubContent,{"data-slot":`dropdown-menu-sub-content`,className:q(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden`,e),...n})}const or={left:`start`,center:`center`,right:`end`};function sr({trigger:e,children:r,align:i=`right`,hover:a}){let[o,s]=M.useState(!1),c=M.useRef(null);return a?n(`div`,{className:`relative inline-flex`,onMouseEnter:()=>{c.current&&clearTimeout(c.current),s(!0)},onMouseLeave:()=>{c.current=setTimeout(()=>s(!1),80)},children:[e,o&&t(`div`,{className:q(`absolute top-full pt-1 z-50`,i===`right`?`end-0`:i===`center`?`left-1/2 -translate-x-1/2`:`start-0`),children:t(`div`,{className:`min-w-32 rounded-lg p-1 shadow-md ring-1 ring-foreground/10 bg-popover text-popover-foreground`,children:t(Wn.Provider,{value:!0,children:r})})})]}):n(Gn,{children:[t(qn,{asChild:!0,children:t(`span`,{className:`-m-1.5 flex items-center p-1.5`,children:e})}),t(Jn,{align:or[i],className:`w-max`,children:r})]})}function cr({children:e,label:r}){return n(Yn,{children:[r&&t(er,{children:r}),e]})}function lr({children:e,href:n,onClick:r,isDisabled:i=!1,variant:a=`default`,className:o}){let s=M.useContext(Wn),c=q(`w-full gap-2 rounded-md px-1.5 py-1 text-sm text-nowrap [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,a===`destructive`?`text-destructive`:``,i?`pointer-events-none opacity-50`:`hover:bg-muted focus:bg-muted`,o);return s?n?t(`a`,{href:n,className:c,children:e}):t(`button`,{type:`button`,className:c,disabled:i,onClick:e=>{e.stopPropagation(),r?.(e)},children:e}):t(Xn,{className:q(`data-[disabled]:pointer-events-none data-[disabled]:opacity-50 text-nowrap`,o),disabled:i,variant:a,onClick:e=>{e.stopPropagation(),r?.(e)},asChild:!!n,children:n?t(`a`,{href:n,children:e}):e})}const ur=({children:e,className:n})=>{let r=I(null),[i,a]=L(`auto`);return F(()=>{if(r.current){let e=new ResizeObserver(e=>{let t=e[0].contentRect.height;a(t)});return e.observe(r.current),()=>{e.disconnect()}}},[]),t(`div`,{className:q(n,`overflow-hidden transition-all duration-100 ease-in`),style:{height:i},children:t(`div`,{ref:r,children:e})})},dr=M.createContext(null),Z=({hover:e=!1,click:n=!1,modal:r,children:i,_open:a,onOpenChange:o})=>{let[s,c]=M.useState(a||!1);return t(dr.Provider,{value:{open:s,setOpen:c,hover:e,click:n},children:t(G.Root,{open:s,onOpenChange:e=>{c(e),o&&o(e)},modal:r,children:i})})};function fr(e=!1,t=()=>{},n){e&&t(n===`enter`)}const Q=M.forwardRef(({children:e,...n},r)=>{let i=M.useContext(dr);if(!i)throw Error(`PopoverTrigger must be used within a Popover`);let{setOpen:a,hover:o,click:s}=i;return t(G.Trigger,{ref:r,asChild:!0,onMouseEnter:()=>fr(o,a,`enter`),onMouseLeave:()=>fr(o,a,`leave`),onClick:()=>{s&&a(e=>!e)},...n,children:e})});Q.displayName=G.Trigger.displayName;const pr=G.Anchor,$=M.forwardRef(({className:e,align:n=`center`,side:r=`bottom`,...i},a)=>{let o=M.useContext(dr);if(!o)throw Error(`PopoverContent must be used within a Popover`);let{setOpen:s,hover:c}=o,l=pt();return t(G.Portal,{container:l,children:t(G.Content,{ref:a,align:n,side:r,onMouseEnter:()=>fr(c,s,`enter`),onMouseLeave:()=>fr(c,s,`leave`),className:q(`z-50 w-72 rounded-md border-popover bg-popover text-popover-foreground ring-1 ring-gray-200 dark:ring-slate-700 shadow-md focus:outline-none animate-in`,`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...i})})});$.displayName=G.Content.displayName;const mr=G.Close;mr.displayName=G.Close.displayName;function hr(){let e=M.useContext(dr);if(!e)throw Error(`usePopoverContext must be used within a Popover`);return{...e,close:()=>e.setOpen(!1)}}const gr=`
|
|
2
2
|
.calendar-wrapper .react-calendar__navigation {
|
|
3
3
|
display: flex !important;
|
|
4
4
|
justify-content: space-between !important;
|
|
@@ -84,12 +84,12 @@ import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import r,{clsx a
|
|
|
84
84
|
text-align: center !important;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
`,
|
|
87
|
+
`,_r=({filterValues:r,setFilterValues:i,isRange:a=!1})=>{let[o,s]=L(!1),[c,l]=L([null,null]),{t:u}=R(),d=r[0]?W(r[0]).toDate():void 0,f=a?[c[0]||(r[0]?W(r[0]).toDate():null),c[1]||(r[1]?W(r[1]).toDate():null)]:[null,null];F(()=>{a&&l([r[0]?W(r[0]).toDate():null,r[1]?W(r[1]).toDate():null])},[r,a]);let p=()=>a?f[0]&&f[1]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`-`}),t(`span`,{className:`font-medium`,children:W(f[1]).format(`MMMM DD, YYYY`)})]}):f[0]?n(`span`,{className:`flex items-center gap-1.5`,children:[t(`span`,{className:`font-medium`,children:W(f[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted-foreground`,children:`- Select end`})]}):t(`span`,{className:`text-muted-foreground`,children:u(`filter.selectRange`)}):d?W(d).format(`MMMM DD, YYYY`):`Pick a date`,m=e=>{if(a)Array.isArray(e)&&(l([e[0],e[1]]),e[0]&&e[1]?i([W(e[0]).format(`YYYY-MM-DD`),W(e[1]).format(`YYYY-MM-DD`)]):e[0]&&i([W(e[0]).format(`YYYY-MM-DD`)]));else if(e){let t=Array.isArray(e)?e[0]:e;t&&(i([W(t).format(`YYYY-MM-DD`)]),s(!1))}};return n(Z,{_open:o,onOpenChange:s,children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center min-h-[20px]`,children:p()})}),t($,{className:`w-auto p-0`,align:`start`,side:`bottom`,alignOffset:-4,sideOffset:6,children:t(`div`,{className:`p-2`,children:a?n(e,{children:[n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:f,onChange:m,selectRange:!0,returnValue:`range`,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(f[0]){let e=f[0].getTime();if(f[1]){let n=f[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}})]}),f[0]&&f[1]&&t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>s(!1),children:`Cancel`}),t(J,{size:`sm`,onClick:()=>s(!1),children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:d,onChange:m,selectRange:!1,maxDate:(()=>{let e=new Date;return e.setHours(23,59,59,999),e})(),className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(d&&t===d.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})})]})};function vr({value:n,labelRenderer:r,fallbackLabel:i}){let[a,o]=L(i||n),[s,c]=L(!1);return F(()=>{if(!r){o(i||n);return}(async()=>{c(!0);try{let e=r(n);if(e instanceof Promise){let t=await e;o(t)}else o(e)}catch(e){console.error(`Error rendering label:`,e),o(i||n)}finally{c(!1)}})()},[n,r,i]),s?t(`span`,{className:`text-muted-foreground`,children:`Loading...`}):t(e,{children:a})}const yr=({filterType:r,filterValues:i,setFilterValues:a,options:o,labelRenderer:s,multiple:c=!0})=>{let[l,u]=L(!1),[d,f]=L(``),p=I(null),{t:m}=R(),h=o?.filter(e=>!i.some(t=>t.value===e.value));return n(Z,{_open:l,onOpenChange:e=>{u(e),e||setTimeout(()=>{f(``)},200)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 transition text-muted hover:text-primary shrink-0`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:i?.length===1?(()=>{let e=i[0];return t(vr,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})})():`${i?.length} selected`})}),t($,{className:`w-[300px] p-0`,children:t(ur,{children:n(Ln,{children:[t(zn,{placeholder:r,className:`h-9`,value:d,onInputCapture:e=>{f(e.currentTarget.value)},ref:p}),n(Bn,{children:[t(Vn,{children:m(`filter.noResultsFound`)}),t(Y,{children:i.map(e=>n(X,{className:`group flex gap-2 items-center`,onSelect:()=>{a(i.filter(t=>t.value!==e.value)),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(`input`,{type:`checkbox`,checked:!0,onChange:()=>{}}),t(vr,{value:e.value||``,labelRenderer:s,fallbackLabel:e.label})]},e.value))}),h?.length>0&&n(e,{children:[t(Hn,{}),t(Y,{children:h.filter(e=>String(e.label||e.value).toLowerCase().includes(d.toLowerCase())).map(e=>n(X,{className:`group flex gap-2 items-center`,value:String(e.label||e.value),onSelect:()=>{let t={value:e.value,label:e.label};a(c?[...i,t]:[t]),setTimeout(()=>{f(``)},200),u(!1)},children:[c&&t(_n,{checked:!1,className:`opacity-0 group-data-[selected=true]:opacity-100`}),t(`span`,{className:`text-muted`,children:t(vr,{value:e.value||``,labelRenderer:e.labelRenderer||s,fallbackLabel:e.label})})]},e.value))})]})]})]})})})]})},br=({filterType:e,filterValues:r,setFilterValues:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&JSON.stringify(s)!==JSON.stringify(r)&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r.length>0?r.length===1?r[0]:`${r.length} tags`:`Add tags...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-3`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(Ut,{value:s,onChange:c,placeholder:`Add ${e.toLowerCase()}...`}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{size:`sm`,variant:`ghost`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})]})})]})},xr=z(``,{variants:{size:{xs:`rounded py-1 text-xs rounded-xs`,sm:`rounded text-xs rounded-sm`,md:`rounded-md py-2 text-sm`,lg:`rounded-md text-base`,xl:`rounded-md py-2.5 text-lg`},variant:{default:`flex w-full rounded-md border border-input bg-background ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,unstyled:`block m-0 p-0 w-full border-0 focus:outline-hidden focus:ring-0 bg-transparent`,noPadding:`block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`,legacy:`py-1.5 block rounded-md border-0 bg-background shadow-2xs ring-1 ring-inset ring-ring placeholder:text-muted-foreground focus:ring-2 focus:ring-inset focus:ring-ring ring-offset-background`}},defaultVariants:{size:`md`,variant:`default`}}),Sr=M.forwardRef(({className:e,type:r,size:i=`md`,variant:a=`default`,clearable:o=!0,onChange:s,value:c,invalid:l,...u},d)=>{let f=()=>{s?.(``)},p=e=>{s?.(e.target.value)},m=u[`aria-invalid`]??(l?!0:void 0);return n(`div`,{className:`w-full relative inline-block [&:hover_.clear-button]:opacity-100`,children:[t(`input`,{type:r,className:q(xr({size:i,variant:a}),e,o&&c?`pe-8`:``),ref:d,value:c??``,onChange:p,...u,"aria-invalid":m}),o&&c&&!u.readOnly&&!u.disabled&&t(J,{variant:`link`,size:`icon`,type:`button`,onClick:f,className:`clear-button opacity-0 transition-opacity duration-200
|
|
88
88
|
absolute top-1/2 -translate-y-1/2 text-muted !hover:text-destructive cursor-pointer
|
|
89
|
-
flex items-center justify-center size-6 rounded end-2`,"aria-label":`Clear input`,children:t(j,{size:16})})]})});xr.displayName=`Input`;const Sr=({filterType:e,filterValue:r,setFilterValue:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&s!==r&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r||`Enter text...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(xr,{autoFocus:!0,type:`text`,size:`sm`,value:s,onChange:c,onKeyDown:e=>{e.key===`Enter`&&(i(s),o(!1))},placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})})]})})]})};function Cr({selectedView:r,selectedDate:i,setSelectedDate:a,setFilters:o,filters:s,handleClose:c,filterGroups:l}){let{t:u}=R(),[d,f]=L([null,null]),[p,m]=L([null,null]),h=l.find(e=>e.name===r),g=h?.multiple,_=new Date;_.setHours(23,59,59,999);let v=[p[0]||d[0],p[1]||d[1]],y=e=>{if(g)Array.isArray(e)?(m([e[0],e[1]]),f([e[0],e[1]])):(m([e,null]),f([e,null]));else{let t=Array.isArray(e)?e[0]:e;if(a(t||void 0),t){let e=new Date(t);e.setHours(0,0,0,0),o([...s,{name:r||``,placeholder:h?.placeholder,value:[{value:e.toISOString(),label:W(e).format(`LLL dd, y`)}],type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}}};return t(`div`,{className:`p-2`,children:g?n(e,{children:[t(`div`,{children:g?v[0]&&v[1]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:u(`filter.to`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[1]).format(`MMMM DD, YYYY`)})]}):v[0]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:`→ Select end date`})]}):t(`span`,{className:`text-muted text-xs`,children:h?.placeholder||h?.name||r||`Select date range`}):i?W(i).format(`MMMM DD, YYYY`):`Pick a date`}),n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:v,onChange:y,selectRange:!0,returnValue:`range`,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(v[0]){let e=v[0].getTime();if(v[1]){let n=v[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}},`${v[0]?.getTime()}-${v[1]?.getTime()}`)]}),t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{if(d[0]){let e=new Date(d[0]),t=d[1]?new Date(d[1]):new Date(d[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);let n=[];n.push({value:e.toISOString(),label:W(e).format(`LLL dd, y`)}),d[1]&&d[0].getTime()!==d[1].getTime()&&n.push({value:t.toISOString(),label:W(t).format(`LLL dd, y`)}),o([...s,{name:r||``,placeholder:h?.placeholder,value:n,type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}},disabled:!v[0],children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:hr}),t(Se,{value:i,onChange:y,selectRange:!1,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(i&&t===i.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})}function wr({selectedView:e,commandInput:r,setFilters:i,handleClose:a,filterGroups:o}){let[s,c]=L([]),l=e=>{let t=o.find(t=>t.name===e);if(!t)return[];let n=t.options||[];if(!r.trim())return n;if(t.filterBy){let e=r.toLowerCase();return n.filter(n=>n.value===void 0?!1:t.filterBy?.(n.value,e))}let i=r.toLowerCase();return n.filter(e=>String(e.value||``).toLowerCase().includes(i))};if(!e)return null;let u=l(e),d=o.find(t=>t.name===e),f=d?.placeholder||d?.name,p=()=>{s.length>0&&i(t=>[...t.filter(t=>t.name!==e),{name:e||``,placeholder:d?.placeholder||``,value:s,type:d?.type||`select`,multiple:d?.multiple||!1}]),a()},m=t=>{let n={value:t.value,label:t.label};d?.multiple?s.some(e=>e.value===t.value)?c(e=>e.filter(e=>e.value!==t.value)):c(e=>[...e,n]):(i(t=>{let r=t.findIndex(t=>t.name===e);if(r>=0){let e=[...t];return e[r]={...e[r],value:[n]},e}else return[...t,{name:e||``,placeholder:d?.placeholder||``,value:[n],type:d?.type||`select`,multiple:d?.multiple||!1}]}),a())};return n(`div`,{className:`flex flex-col h-full`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted shrink-0`,children:t(`span`,{children:f})}),t(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:t(`div`,{className:`max-h-[200px] overflow-y-auto`,children:u.length>0&&u.map(e=>{let r=s.some(t=>t.value===e.value);return n(X,{className:`group flex gap-2 items-center w-full hover:bg-muted ${d?.multiple&&r?`bg-muted`:``}`,onSelect:()=>m(e),children:[t(_r,{value:e.value||``,labelRenderer:e.labelRenderer||d?.labelRenderer,fallbackLabel:e.label}),d?.multiple&&r&&t(`span`,{className:`ms-auto text-xs text-success`,children:`✓`})]},e.value||`option-${Math.random()}`)})})}),d?.multiple&&t(`div`,{className:`p-2 border-t shrink-0`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),t(J,{size:`sm`,onClick:p,disabled:s.length===0,children:`Apply`})]})})]})}function Tr({selectedView:e,setFilters:r,handleClose:i,filterGroups:a}){let[o,s]=L([]),c=a.find(t=>t.name===e);return n(`div`,{className:`p-2 space-y-3`,children:[t(`div`,{className:`space-y-2`,children:t(Ht,{value:o,onChange:s,placeholder:c?.placeholder||`Add ${e}...`,autoFocus:!0})}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{o.length>0&&r(t=>[...t.filter(t=>t.name!==e),{name:e,placeholder:c?.placeholder,value:o,type:`stringList`}]),i()},disabled:o.length===0,children:`Apply`})]})]})}function Er({selectedView:e,textValue:r,setTextValue:i,setFilters:a,handleClose:o,filterGroups:s}){let c=()=>{a(t=>[...t,{name:e||``,placeholder:s.find(t=>t.name===e)?.placeholder,value:[{value:r,label:r}],type:`text`}]),o()};return n(`div`,{className:`p-2 flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:s.find(t=>t.name===e)?.placeholder})}),t(xr,{autoFocus:!0,type:`text`,size:`sm`,value:r,onChange:i,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`}),t(J,{size:`sm`,onClick:c,disabled:!r.trim(),children:`Apply`})]})})]})}function Dr(e,n,r){switch(e.type){case`date`:return t(gr,{filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value.map(e=>e.value||``):[],isRange:e.multiple,setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t.length>0?t.map(e=>({value:e,label:W(e).format(`LLL dd, y`)})):[]}:n))}});case`text`:return t(Sr,{filterType:e.placeholder||e.name,filterValue:Array.isArray(e.value)&&e.value[0]&&typeof e.value[0]==`object`&&e.value[0].value||``,setFilterValue:t=>{n(n=>n.map(n=>n===e?{...n,value:[{value:t,label:t}]}:n))}});case`stringList`:return t(yr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`string`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))}});default:{let i=r.find(t=>t.name===e.name);return t(vr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))},options:i?.options||[],labelRenderer:i?.labelRenderer,multiple:e.multiple??i?.multiple})}}}function Or({filters:e,setFilters:r,filterGroups:i}){return t(`div`,{className:`flex gap-2 flex-wrap justify-start`,children:e.filter(e=>e.value?.length>0).map(e=>n(`div`,{className:`flex gap-[1px] items-center text-sm`,children:[t(`div`,{className:`flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center`,children:e.placeholder||e.name}),Dr(e,r,i),t(J,{variant:`ghost`,size:`icon`,onClick:()=>{r(t=>t.filter(t=>t!==e))},className:`bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0`,children:t(j,{className:`size-6`})})]},`${e.name}-${e.type===`date`?`date`:e.type===`stringList`&&typeof e.value[0]==`string`?e.value.join(`,`):Array.isArray(e.value)?e.value.map(e=>e.value).join(`,`):``}`))})}const kr=N.createContext({filters:[],setFilters:()=>void 0,filterGroups:[]}),Ar=({filters:e,setFilters:n,filterGroups:r,children:i,inModal:a})=>{let o=new URL(window.location.href).searchParams.toString(),[s]=N.useState(()=>new URLSearchParams(window.location.search).get(`filters`)),c=N.useRef(new Set),l=N.useRef(a||!s);return F(()=>{if(!a&&l.current)try{let t=new URLSearchParams(o);if(e.length>0){let n=e.map(e=>{let t;if(e.type===`stringList`&&Array.isArray(e.value)&&typeof e.value[0]==`string`)t=`[${e.value.map(e=>encodeURIComponent(e)).join(`,`)}]`;else if(Array.isArray(e.value))if(e.multiple)t=`[${e.value.map(e=>encodeURIComponent(Pr(e))).join(`,`)}]`;else if(e.value.length>1)t=`[${e.value.map(e=>encodeURIComponent(Pr(e))).join(`,`)}]`;else{let n=e.value[0];t=typeof n==`string`?encodeURIComponent(n):typeof n==`object`&&n?.value!==void 0?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||``))}else t=encodeURIComponent(e.value||``);return`${encodeURIComponent(e.name)}:${t}`}).join(`;`);t.set(`filters`,n)}else t.delete(`filters`);let n=`${window.location.pathname}?${t.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},``,n)}catch(e){console.error(`Failed to update URL with filters:`,e)}},[e,a,o]),F(()=>{if(!(a||!s||r.length===0))try{let e=s.split(`;`),t=[];for(let n of e){let e=n.indexOf(`:`);if(e===-1)continue;let i=n.slice(0,e),a=n.slice(e+1),o=decodeURIComponent(i);if(c.current.has(o))continue;let s=r.find(e=>e.name===o);if(!s)continue;c.current.add(o);let l;if(a.startsWith(`[`)&&a.endsWith(`]`)){let e=a.slice(1,-1);l=e?e.split(`,`).map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];let u;u=s.type===`stringList`?l:s.type===`text`?l.length===1?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{let t=s.options?.find(t=>t.value===e),n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):s.labelRenderer&&(n=String(s.labelRenderer(e))),{value:e,label:n}}),s.multiple&&!a.startsWith(`[`)&&!a.endsWith(`]`)&&(s.type===`stringList`?u=l:Array.isArray(u)||(u=[u])),t.push({name:o,type:s.type,placeholder:s.placeholder,value:u,multiple:s.multiple})}t.length>0&&n(e=>{let n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),l.current=!0}catch{}},[r,a,s,n]),t(kr.Provider,{value:{filters:e,setFilters:n,filterGroups:r},children:i})},jr=({className:e})=>{let{filters:r,setFilters:i,filterGroups:a}=N.useContext(kr),{t:o}=R(),[s,c]=N.useState(!1),[l,u]=N.useState(null),[d,f]=N.useState(``),p=N.useRef(null),[m,h]=N.useState(),[g,_]=N.useState(``),v=e=>{u(e),f(``),p.current?.focus()},y=()=>{let e=a.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>n.type===`date`?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&typeof n.value[0]==`string`?n.value.some(e=>e===t.value):n.value.some(e=>Pr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||e.type===`date`&&!r.some(t=>t.name===e.name)||e.type===`text`&&!r.some(t=>t.name===e.name)||e.type===`stringList`&&!r.some(t=>t.name===e.name));return e.length===0?t(Bn,{children:o(`filter.noAvailableFilters`)}):e.map(e=>t(X,{onSelect:()=>v(e.name),className:`group flex gap-2 items-center hover:bg-muted`,children:t(`span`,{children:e.placeholder??e.name})},e.name))},x=()=>{c(!1),setTimeout(()=>{u(null),f(``),h(void 0)},200)};return n(Z,{_open:s,onOpenChange:e=>{c(e),e||setTimeout(()=>{u(null),f(``),_(``)},200)},children:[t(Q,{asChild:!0,children:n(J,{variant:`outline`,role:`combobox`,"aria-expanded":s,size:`md`,className:q(`transition group flex gap-1.5`,e),children:[t(b,{className:`size-4 shrink-0 transition-all text-muted`}),o(`filter.filter`)]})}),t($,{className:`w-[300px] p-0`,align:`start`,sideOffset:4,children:n(In,{children:[a.find(e=>e.name===l)?.type===`select`&&t(Rn,{placeholder:l?o(`filter.filterBy`,{view:l}):o(`filter.filterPlaceholder`),className:`h-9 ring-0`,value:d,onValueChange:e=>{f(e)},ref:p,autoFocus:!0}),t(zn,{children:t(Y,{children:l?(()=>{if(!l)return null;switch(a.find(e=>e.name===l)?.type){case`date`:return t(Cr,{selectedView:l,selectedDate:m,setSelectedDate:h,setFilters:i,filters:r,handleClose:x,filterGroups:a});case`text`:return t(Er,{selectedView:l,textValue:g,setTextValue:_,setFilters:i,handleClose:x,filterGroups:a});case`stringList`:return t(Tr,{selectedView:l,setFilters:i,handleClose:x,filterGroups:a});default:return t(wr,{selectedView:l,commandInput:d,setFilters:i,handleClose:x,filterGroups:a})}})():y()})})]})})]})},Mr=({className:e})=>{let{filters:n,setFilters:r,filterGroups:i}=N.useContext(kr);return t(`div`,{className:q(e),children:t(Or,{filters:n,setFilters:r,filterGroups:i})})},Nr=({className:e})=>{let{filters:n,setFilters:r}=N.useContext(kr),{t:i}=R();return n.filter(e=>e.value?.length>0).length>0?t(J,{variant:`outline`,size:`md`,className:q(`transition group`,e),onClick:()=>r([]),children:i(`filter.clearAll`)}):null};function Pr(e){return typeof e==`string`?e:e.value||``}var Fr;(function(e){e.IS=`is`,e.IS_NOT=`is_not`,e.CONTAINS=`contains`,e.BEFORE=`before`,e.AFTER=`after`,e.IS_ANY_OF=`is_any_of`})(Fr||={});const Ir=oe(({className:e,level:n=3,...r},i)=>t(`h${n}`,{ref:i,className:q({h1:`text-2xl font-medium tracking-tight`,h2:`text-xl font-medium tracking-tight`,h3:`text-lg font-medium`,h4:`text-base font-medium`,h5:`text-sm font-medium`,h6:`text-xs font-medium`}[`h${n}`],`mb-2`,e),...r}));Ir.displayName=`Heading`;function Lr({options:i,optionLabel:s,groupBy:c,value:l,onChange:u,addNew:d,addNewLabel:f,disabled:p,filterBy:h,label:g,placeholder:_,className:v,popupClass:y,isClearable:b,border:x=!0,multiple:C=!1,by:w,inline:T=!1,isLoading:E=!1,warnOnMissingValue:D=!0,missingValueWarning:A=`Value not in options list, may not be valid`,clearIcon:ee,clearTitle:te,"aria-label":M,"aria-labelledby":N,id:ne,"aria-describedby":re,"aria-invalid":ie}){let ae=I(null),[oe,se]=L(!1),[ce,P]=L(0),[ue,fe]=L(``),pe=le(),me=le(),he=de(()=>!D||C||l==null||!i?!1:!i.some(e=>typeof w==`string`?Rr(e,w)===Rr(l,w):typeof w==`function`?w(e,l):Ce(e,l)),[D,C,l,i,w]);F(()=>{let e=ae.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;P(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let R=e=>{if(C){let t=Array.isArray(l)?l:[];z(e,t)?u(t.filter(t=>!ge(t,e))):u([...t,e])}else u(e)},z=(e,t)=>!t||t.length===0?!1:t.some(t=>ge(t,e)),ge=(e,t)=>e==null||t==null?e===t:typeof w==`string`?Rr(e,w)===Rr(t,w):typeof w==`function`?w(e,t):Ce(e,t),B=i||[];function _e(e){return e?typeof e==`string`?t=>String(Rr(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}let ve=ue.toLowerCase(),ye=_e(h);B=B.filter(e=>ye(e).includes(ve));let be=()=>{if(!l||Array.isArray(l)&&l.length===0)return t(`span`,{className:`text-muted`,children:_});let e=Array.isArray(l)?l[0]:l;return s?s(e):e},xe=()=>{let e=Array.isArray(l)?l:l?[l]:[];return e.length===0?t(`span`,{className:`text-muted`,children:_}):e.length===1?s?s(e[0]):e[0]:n(`div`,{className:`flex flex-wrap gap-1`,children:[e.slice(0,1).map((e,n)=>t(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded`,children:s?s(e):e},`chip-${n}`)),e.length>1&&n(`span`,{className:`inline-flex items-center px-2 py-1 text-xs bg-muted rounded`,children:[`+`,e.length-1,` more`]})]})},V=(e,r)=>{let i=C?z(e,Array.isArray(l)?l:[]):l==null?!1:ge(l,e);return t(X,{onSelect:()=>R(e),className:`w-full`,children:C||T?n(`div`,{className:`w-full flex justify-between items-center cursor-pointer`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]}):n(pr,{className:`w-full flex justify-between items-center`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]})},`option-${r}`)},H=(()=>{if(!c)return null;let e=[],t=new Map;for(let n of B){let r=c(n),i=t.get(r);i||(i=[],t.set(r,i),e.push({key:r,items:i})),i.push(n)}return e})(),U=()=>n(e,{children:[h&&n(`div`,{className:`flex justify-start items-center mb-1`,children:[t(`div`,{className:`mx-2`,children:t(O,{className:`size-4`})}),t(xr,{variant:`unstyled`,value:ue,onChange:fe,className:`w-full p-1 rounded-md`,placeholder:`Search...`})]}),t(In,{className:`overflow-hidden`,children:n(zn,{className:T?`max-h-full overflow-y-auto`:`max-h-[200px] overflow-y-auto`,onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[t(Bn,{children:`No result found.`}),H?H.map(e=>t(Y,{heading:e.key,className:`[&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:border-b [&_[cmdk-group-heading]]:border-border [&_[cmdk-group-heading]]:ml-[-0.5rem] [&_[cmdk-group-heading]]:text-xs`,children:e.items.map((t,n)=>V(t,`${e.key}-${n}`))},e.key)):t(Y,{children:B?.map((e,t)=>V(e,t))})]})}),d&&t(`div`,{className:`p-1`,children:n(`button`,{type:`button`,onClick:d,className:r(`w-full text-start gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent bg-transparent border-0`),children:[t(k,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),f]})})]});if(T)return t(`div`,{className:r(v,x&&`border border-border rounded-md`,`bg-popover p-1`,y),children:E?t(`div`,{className:`flex justify-center items-center p-2 text-muted text-sm`,children:t(S,{className:`size-4 animate-spin`})}):U()});let W=!!g,Se=M??(W?void 0:typeof _==`string`?_:void 0),G=N??(W?me:void 0),we=!!b&&!!l&&(Array.isArray(l)?l.length>0:!0),Te=ie===!0||ie===`true`||he?!0:ie===!1||ie===`false`?!1:void 0;return n(Z,{onOpenChange:se,children:[n(`div`,{ref:ae,className:r(`relative`,v),children:[t(Q,{asChild:!0,children:t(`button`,{type:`button`,id:ne,disabled:p||E,"aria-haspopup":`dialog`,"aria-expanded":oe,"aria-controls":pe,"aria-label":Se,"aria-labelledby":G,"aria-describedby":re,"aria-invalid":Te,className:r(E?`flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent`:r(x&&(he||Te?`border border-destructive`:`border border-border`),`flex w-full flex-row gap-2 items-center justify-between p-2 rounded-md group bg-transparent text-inherit text-start`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,p?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-muted`,we&&`pe-10`)),children:E?t(S,{className:`size-4 animate-spin`}):n(e,{children:[n(`div`,{className:r(`flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate`),children:[g&&t(`div`,{id:me,className:`w-full text-start text-xs font-semibold`,children:g}),n(`div`,{className:r(`w-full text-start `,he&&`text-destructive`),children:[he&&t(vt,{description:A,placement:`top`,asChild:!0,children:t(a,{className:`inline-block size-4 me-1 -mt-0.5 cursor-help`})}),C?xe():be()]})]}),!p&&t(m,{className:`size-4 opacity-50 shrink-0`,"aria-hidden":`true`})]})})}),we&&!E&&t(J,{variant:`link`,size:`icon`,disabled:p,"aria-label":te||`Clear selection`,onClick:e=>{e.stopPropagation(),u(C?[]:void 0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1`,children:ee||t(j,{className:`size-4`})})]}),t($,{id:pe,style:{width:`${ce}px`,zIndex:1e6},className:r(`min-w-[8rem] w-64 bg-popover p-1 border shadow`,`divide-y divide-border`,y),children:U()})]})}function Rr(e,t){return typeof e==`object`&&e?e[t]:void 0}const zr={ar:`العربية`,de:`Deutsch`,en:`English`,es:`Español`,fr:`Français`,it:`Italiano`,ja:`日本語`,ko:`한국어`,pt:`Português`,ru:`Русский`,tr:`Türkçe`,zh:`中文`,"zh-TW":`繁體中文`};function Br({label:e,className:r}={}){let{language:i,setLanguage:a}=he(),{t:o}=R(),s=e===!1?!1:e??o(`language.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center gap-3`:`flex items-center`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),t(Lr,{options:me,value:i,onChange:e=>a(e),optionLabel:e=>zr[e],placeholder:o(`language.placeholder`),isClearable:!1,warnOnMissingValue:!1,className:`min-w-40`})]})}const Vr=z(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Hr=M.forwardRef(({className:e,required:r,...i},a)=>n(we.Root,{ref:a,className:q(Vr(),e),...i,children:[i.children,r&&t(`span`,{className:`text-destructive-foreground ms-1`,children:`*`})]}));Hr.displayName=we.Root.displayName;function Ur({icon:e,status:r,title:i,children:o,className:s}){let c,l,u,d;switch(r){case`error`:c=t(g,{className:`size-5 text-destructive`,"aria-hidden":`true`}),l=`text-destructive`,u=`text-foreground`,d=`bg-destructive border border-destructive`;break;case`warning`:c=t(a,{className:`size-5 text-attention`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-attention border border-attention`;break;case`success`:c=t(h,{className:`size-5 text-success`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-success border border-success`;break;case`info`:c=t(y,{className:`size-5 text-info`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-info border border-info`;break;case`default`:c=t(y,{className:`size-5 text-muted`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-muted border border-muted`;break;case`done`:c=t(y,{className:`size-5 text-done`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-done border border-done`;break}return t(`div`,{className:`rounded-md p-4 ${d} ${s}`,children:n(`div`,{className:`flex`,children:[t(`div`,{className:`shrink-0`,children:e??c}),n(`div`,{className:`w-full ms-2 px-1`,children:[i&&t(`h3`,{className:`text-md font-medium mb-2 ${l}`,children:i}),t(`div`,{className:`text-sm ${u} break-words`,children:o})]})]})})}function Wr({title:e,className:r,children:i,action:a,actionLabel:o}){return n(Ur,{status:`error`,title:e,className:`${r} flex flex-col items-center justify-center text-center`,children:[t(`pre`,{className:`whitespace-pre-wrap break-words`,children:i}),a&&o&&t(J,{onClick:a,variant:`ghost`,size:`sm`,className:`mt-4`,children:o})]})}function Gr({title:e,className:n,children:r}){return t(Ur,{status:`info`,title:e,className:n,children:r})}function Kr({title:e,className:n,children:r}){return t(Ur,{status:`warning`,title:e,className:n,children:r})}function qr({title:e,className:n,children:r}){return t(Ur,{status:`success`,title:e,className:n,children:r})}function Jr({title:e,className:n,children:r}){return t(Ur,{status:`default`,title:e,className:n,children:r})}function Yr({title:e,content:r,onConfirm:i,onCancel:a,isOpen:o,isLoading:s,confirmationValue:c,confirmationLabel:l,confirmationPlaceholder:u}){let{t:d}=R(),f=I(null),[p,m]=L(``);F(()=>{o||m(``)},[o]);let h=!!c,g=!c||p.trim()===c.trim(),_=()=>{!g||s||i()};return n(wn,{isOpen:o,onClose:a,description:`Confirm Modal`,children:[n(`div`,{className:`sm:flex sm:items-start p-2`,children:[t(`div`,{className:`mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:t(ee,{className:`size-6 text-red-600`,"aria-hidden":`true`})}),n(`div`,{className:`mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start`,children:[t(Tn,{className:`leading-6`,show:!0,children:e}),t(`div`,{className:`mt-2`,children:t(`div`,{className:`prose text-sm text-gray-500`,children:r})})]})]}),h&&t(`div`,{className:`px-2 pb-2 text-start`,children:t(Ft,{label:l??u,children:t(xr,{autoFocus:!0,value:p,onChange:m,placeholder:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())}})})}),n(Dn,{align:`right`,children:[t(J,{variant:`destructive`,onClick:_,isLoading:s,disabled:!g,children:d(`modal.confirm`)}),t(J,{variant:`outline`,onClick:a,ref:f,children:d(`modal.cancel`)})]})]})}function Xr(){return P(Zr)}const Zr=ae(()=>{}),Qr={success:h,error:g,warning:a,info:y},$r={success:`text-success`,error:`text-destructive`,warning:`text-attention`,info:`text-info`};function ei({data:e,onClose:r}){let[i,a]=L(!0),o=I(null),s=ce(()=>{o.current&&=(globalThis.clearTimeout(o.current),null)},[]),c=ce(()=>{s(),e.duration&&(o.current=setTimeout(()=>a(!1),e.duration))},[s,e.duration]);F(()=>(c(),s),[s,c]);let l=Qr[e.status]||y,u=$r[e.status]||`text-info`;return t(`div`,{"aria-live":`assertive`,className:`pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100`,children:t(`div`,{className:`flex w-full flex-col items-center space-y-4 sm:items-end`,children:t(ve,{onExitComplete:r,children:i&&t(ye.div,{className:`pointer-events-auto w-full max-w-md overflow-hidden rounded-lg bg-muted shadow-lg ring-1 ring-border`,initial:{opacity:0,x:8},animate:{opacity:1,x:0,transition:{ease:`easeOut`,duration:.7}},exit:{opacity:0,transition:{ease:`easeIn`,duration:.3}},onMouseEnter:s,onMouseLeave:c,children:t(`div`,{className:`p-5`,children:n(`div`,{className:`flex items-start`,children:[t(`div`,{className:`shrink-0`,children:t(l,{className:`size-6 ${u}`,"aria-hidden":`true`})}),n(`div`,{className:`ms-3 flex-1 pt-0.5 min-w-0`,children:[t(`p`,{className:`text-sm font-semibold text-foreground break-words`,children:e.title}),e.description&&t(`p`,{className:`mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed`,children:e.description})]}),t(`div`,{className:`ms-4 flex shrink-0`,children:n(`button`,{type:`button`,className:`inline-flex rounded-md bg-muted text-muted hover:text-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background`,onClick:()=>a(!1),children:[t(`span`,{className:`sr-only`,children:`Close`}),t(j,{className:`size-5`,"aria-hidden":`true`})]})})]})})})})})})}function ti({children:r}){let[i,a]=L(null),o=ce(e=>{a(e)},[]);return n(e,{children:[t(Zr.Provider,{value:o,children:r}),i&&t($t,{children:t(ei,{data:i,onClose:()=>o(null)})})]})}function ni({idToDelete:e,title:n,content:r,setIdToDelete:i,deleteApi:a}){let{t:o}=R(),s=Xr();return t(Yr,{title:n,content:r,isOpen:!!e,onConfirm:async()=>{if(e)return a(e).then(()=>{s({title:o(`modal.delete.succeeded`),status:`success`})}).catch(e=>{s({title:o(`modal.delete.failed`),description:e instanceof Error?e.message:o(`modal.delete.error`),status:`error`})}).finally(()=>{i(void 0)})},onCancel:()=>{i(void 0)}})}function ri({children:r,action:i,title:a,description:o,footer:s,className:l,collapsible:u,defaultCollapsed:d=!1,size:p=`md`,clickableHeader:m=!1}){let[h,g]=L(d),_=u&&m,v=p===`sm`,b=v||_,x=t(h?c:f,{className:`size-4 text-muted`}),S=n(e,{children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`div`,{className:`font-semibold ${v?`text-sm`:`text-lg`}`,children:a}),o&&t(vt,{description:o,children:t(y,{className:`size-4 text-muted`})})]}),n(`div`,{className:`flex gap-2 items-center`,children:[i,u&&(_?x:t(J,{variant:`ghost`,size:`icon`,onClick:()=>g(!h),children:x}))]})]}),C=v?`px-4 py-2`:`px-4 py-3`,w=v?`px-4 pt-3 pb-3`:`p-4`,T=v?`px-4 pb-3`:`px-4 pb-4`;return n(`div`,{className:`flex flex-col ${b?``:`p-4 gap-2`} rounded-sm border bg-card ${_?`overflow-hidden`:``} ${l??``}`,children:[_?t(`button`,{type:`button`,className:`w-full flex items-center justify-between ${C} hover:bg-muted/50 transition-colors`,onClick:()=>g(!h),children:S}):t(`div`,{className:`flex items-center justify-between ${b?C:``}`,children:S}),!h&&(b?t(`div`,{className:w,children:r}):r),s&&t(`div`,{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${b?T:``}`,children:s})]})}function ii({className:e,...n}){return t(Te.Item,{"data-slot":`radio-group-item`,className:q(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t(Te.Indicator,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:t(`span`,{className:`bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full`})})})}var ai=class{descriptionOf(e){}selectedClassName(e){return`border-accent-foreground`}};function oi({onSelect:e,selected:r,options:i,adapter:a}){let o=e=>a?a.idOf(e):e.id,s=e=>a?a.labelOf(e):e.label,c=e=>a?a.descriptionOf(e):e.description,l=e=>a?a.selectedClassName(e):`border-primary`;return t(Te.Root,{"data-slot":`radio-group`,value:r?o(r):void 0,onValueChange:t=>{let n=i.find(e=>o(e)===t);n&&e(n)},className:`space-y-4`,children:i.map(e=>{let i=r?o(r)===o(e):!1;return t(Te.Item,{value:o(e),className:q(`relative block w-full cursor-pointer rounded-lg border border-border bg-accent px-6 py-4 shadow-2xs text-start`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`sm:flex sm:justify-between`,i&&l(e)),children:t(`span`,{className:`flex items-center`,children:n(`span`,{className:`flex flex-col text-sm`,children:[t(`span`,{className:`font-medium text-text`,children:s(e)}),c(e)&&t(`span`,{className:`text-muted-foreground`,children:c(e)})]})})},o(e))})})}function si({className:e,direction:n=`horizontal`,orientation:r,...i}){let a=r??n;return t(Ee.Group,{"data-slot":`resizable-panel-group`,"data-panel-group-direction":a,orientation:a,className:q(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...i})}function ci(e){return typeof e==`number`?`${e}%`:e}function li({defaultSize:e,minSize:n,maxSize:r,collapsedSize:i,...a}){return t(Ee.Panel,{"data-slot":`resizable-panel`,defaultSize:ci(e),minSize:ci(n),maxSize:ci(r),collapsedSize:ci(i),...a})}function ui({withHandle:e,className:n,...r}){return t(Ee.Separator,{"data-slot":`resizable-handle`,className:q(`bg-muted focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:start-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),...r,children:e&&t(`div`,{className:`z-10 flex size-4 items-center justify-center rounded-xs font-semibold`,children:t(C,{className:`size-4 rotate-90`})})})}const di=M.forwardRef(({className:e,orientation:n=`horizontal`,decorative:r=!0,...i},a)=>t(De.Root,{ref:a,decorative:r,orientation:n,className:q(`shrink-0 bg-border`,n===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...i}));di.displayName=De.Root.displayName;const fi=M.forwardRef(({className:e,trackClassName:r,rangeClassName:i,thumbClassName:a,value:o,defaultValue:s,min:c=0,max:l=100,"aria-label":u,...d},f)=>{let p=M.useId(),m=Array.isArray(o)?o.length:Array.isArray(s)?s.length:1,h=M.useMemo(()=>Array.from({length:Math.max(1,m)},(e,t)=>`${p}-thumb-${t}`),[p,m]);return n(Oe.Root,{ref:f,"data-slot":`slider`,value:o,defaultValue:s,min:c,max:l,...d,className:q(`relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),children:[t(Oe.Track,{"data-slot":`slider-track`,className:q(`relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`,r),children:t(Oe.Range,{"data-slot":`slider-range`,className:q(`absolute h-full bg-primary data-[orientation=vertical]:w-full`,i)})}),h.map(e=>t(Oe.Thumb,{"data-slot":`slider-thumb`,"aria-label":u,className:q(`block size-3.5 rounded-full border border-primary bg-background shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,a)},e))]})});fi.displayName=Oe.Root.displayName;const pi={sm:[`h-5 w-8`,`size-3`,`translate-x-4 rtl:-translate-x-4`],md:[`h-6 w-11`,`size-4`,`translate-x-6 rtl:-translate-x-6`],lg:[`h-8 w-16`,`size-6`,`translate-x-9 rtl:-translate-x-9`]};function mi({className:e,size:r=`md`,value:i,onChange:a,children:o,disabled:s,...c}){let[l,u,d]=pi[r],f=t(ke.Root,{"data-slot":`switch`,checked:i,onCheckedChange:a,disabled:s,...c,className:q(`data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 shrink-0 rounded-full border focus-visible:ring-3 aria-invalid:ring-3 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,l,!o&&e),children:t(ke.Thumb,{"data-slot":`switch-thumb`,className:q(`bg-white rounded-full pointer-events-none block ring-0 transition-transform`,u,i?d:`translate-x-1 rtl:-translate-x-1`)})});return o?n(`div`,{className:q(`flex items-center`,e),children:[f,t(`span`,{className:`px-2`,children:o})]}):f}const hi=M.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:`tabs`,updateHash:!0}),gi=({tabs:e,defaultValue:n,current:r,className:i,fullWidth:a,fullHeight:o,children:s,onTabChange:c,responsive:l=!1,variant:u=`tabs`,updateHash:d=!0})=>{let f=M.useMemo(()=>e.filter(e=>e.is_allowed===void 0||e.is_allowed===!0),[e]),[p,m]=M.useState(()=>{let e=typeof r==`function`?r():r;if(e)return e;let t=window.location.hash,i=t?t.substring(1):void 0;return i&&f.some(e=>e.name===i)?i:n||f[0]?.name});M.useEffect(()=>{let e=typeof r==`function`?r():r;e&&e!==p&&m(e)},[r,p]),M.useEffect(()=>{if(r)return;let e=()=>{let e=window.location.hash,t=e?e.substring(1):void 0;t&&f.some(e=>e.name===t)?m(t):!e&&n&&m(n)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[r,f,n]);let h=M.useCallback(e=>{if(m(e),d&&!r){let t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,``,n)}c&&c(e)},[r,c,d]),g=M.useCallback(e=>{h(e)},[h]);return t(hi.Provider,{value:{tabs:f,size:a?f.length:0,current:p,setTab:g,responsive:l,variant:u,updateHash:d},children:t(K.Root,{defaultValue:p||f[0]?.name,value:p,onValueChange:h,className:q(`flex-1 flex flex-col min-h-0 px-2`,o&&`h-full`,i),children:s})})},_i=({className:r,sticky:i,direction:a})=>{let{tabs:o,size:s,current:c,setTab:l,responsive:u,variant:d,updateHash:f}=M.useContext(hi),p=s!==0,m=M.useCallback(e=>{if(!o||!l)return;let t=o.find(t=>t.name===e);if(t?.href&&f){let e=window.history.state;window.history.pushState(e,``,t.href)}l(e)},[o,l,f]);return!o||!l?(console.warn(`TabsBar: No tabs provided or setTab not available`),null):n(e,{children:[u&&t(`div`,{className:`px-2 block lg:hidden`,children:t(Lr,{label:`Tab`,className:q(i&&`sticky top-0 bg-background z-10`,r),options:o,optionLabel:e=>typeof e.label==`string`?e.label:String(e.label),value:o.find(e=>e.name===c),onChange:e=>{m(e.name)}})}),t(yi,{size:s,variant:d,className:q(p?`w-full`:``,i&&`sticky top-0 bg-background z-10`,a===`vertical`?`flex-col items-start`:`flex-row`,u?`hidden lg:flex`:``,r),children:o.map(e=>t(bi,{className:q(a===`vertical`?`w-full text-start`:``),value:e.name,disabled:e.disabled,href:e.href,variant:d,onClick:()=>m(e.name),children:e.label},e.name))})]})},vi=({className:n})=>{let{tabs:r}=M.useContext(hi);return r?t(e,{children:r.map(e=>t(xi,{value:e.name,className:n,children:e.content},e.name))}):null},yi=M.forwardRef(({className:e,size:n,variant:r=`tabs`,...i},a)=>t(hi.Provider,{value:{size:n,variant:r},children:t(K.List,{ref:a,className:q(r===`tabs`?`border-b -mb-px flex gap-4`:`flex gap-2 p-1 rounded-md`,e),...i})}));yi.displayName=K.List.displayName;const bi=M.forwardRef(({className:e,href:n,variant:r=`tabs`,...i},a)=>{let{size:o}=M.useContext(hi),s=M.useCallback(e=>{if(n){e.preventDefault();let t=window.history.state;window.history.pushState(t,``,n)}i.onClick&&i.onClick(e)},[n,i.onClick]);return t(K.Trigger,{ref:a,className:q(r===`tabs`?q(`border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer`,`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,`data-[state=active]:border-primary data-[state=active]:text-primary`,`disabled:pointer-events-none disabled:opacity-50`):q(`px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors`,`tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset`,`data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm`,`disabled:pointer-events-none disabled:opacity-50`),e,o?`w-1/${o}`:``),onClick:s,...i})});bi.displayName=K.Trigger.displayName;const xi=M.forwardRef(({className:e,...n},r)=>t(K.Content,{ref:r,className:q(`focus-visible:outline-none`,`flex-1 overflow-y-auto min-h-0 pt-2 pb-4`,e),...n}));xi.displayName=K.Content.displayName;const Si=z(`text-foreground`,{variants:{size:{xl:`text-base md:text-lg leading-relaxed`,lg:`text-base leading-relaxed`,default:`text-sm leading-normal`,sm:`text-sm leading-normal`,xs:`text-xs leading-normal`},weight:{normal:`font-normal`,medium:`font-medium`,semibold:`font-semibold`}},defaultVariants:{size:`default`,weight:`normal`}}),Ci=oe(({className:e,size:n,weight:r,...i},a)=>t(`p`,{ref:a,className:q(Si({size:n,weight:r,className:e})),...i}));Ci.displayName=`Text`;function wi({className:e,minLines:n,maxLines:r,value:i,...a}){let o=I(null),s=n!==void 0||r!==void 0,c=ce(()=>{let e=o.current;if(!e)return;let t=getComputedStyle(e),i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.5,a=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),s=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),c=n??1,l=r??1/0,u=c*i+a+s,d=l===1/0?1/0:l*i+a+s;e.style.height=`auto`;let f=Math.min(Math.max(e.scrollHeight,u),d);e.style.height=`${f}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?`auto`:`hidden`},[n,r]);return ue(()=>{s&&c()}),t(`textarea`,{ref:o,"data-slot":`textarea`,value:i,className:q(`py-2 text-sm`,`flex w-full rounded-md border border-input bg-background ring-offset-background`,`placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,s&&`resize-none`,e),...a})}const Ti=ae({theme:`system`,setTheme:()=>null});function Ei({children:e,defaultTheme:n=`system`,storageKey:r=`vite-ui-theme`,...i}){let[a,o]=L(()=>localStorage.getItem(r)||n);F(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),a===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(a)},[a]);let s={theme:a,setTheme:e=>{localStorage.setItem(r,e),o(e)}};return t(Ti.Provider,{...i,value:s,children:e})}const Di=()=>{let e=P(Ti);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e};function Oi({option:e,current:n,setTheme:r,icon:i,alt:a}){return t(J,{variant:n===e?`secondary`:`outline`,size:`sm`,onClick:()=>r(e),alt:a,children:i})}function ki({label:e,className:r}={}){let{setTheme:i,theme:a}=Di(),{t:o}=R(),s=e===!1?!1:e??o(`theme.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center`:`flex items-center gap-1`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),n(`div`,{className:`flex gap-2`,children:[t(Oi,{current:a,option:`system`,setTheme:i,icon:t(_,{}),alt:o(`theme.system`)}),t(Oi,{current:a,option:`light`,setTheme:i,icon:t(A,{}),alt:o(`theme.light`)}),t(Oi,{current:a,option:`dark`,setTheme:i,icon:t(w,{}),alt:o(`theme.dark`)})]})]})}function Ai(e,n){return{label:String(e),check:t(n?o:`div`,{className:`size-4`}),reverse:!1,className:`flex-1 px-2 py-2 hover:bg-accent nowrap`}}function ji({value:e,options:i,onChange:a,className:o,optionLayout:s,by:c,noCheck:l,filterBy:u}){let{t:d}=R(),[f,p]=L(e),[m,h]=L(``),g=e=>{p(e),a(e)},_=de(()=>typeof c==`string`?(e,t)=>e[c]===t[c]:c||((e,t)=>e===t),[c]);return n(`div`,{className:r(``,o),children:[u&&t(xr,{type:`text`,placeholder:d(`form.filter`),value:m,onChange:e=>h(e)}),i.map((e,n)=>{if(u&&!u(m)(e))return null;let r=f?_(f,e):!1,i;return s?(i=s(e,r),i=Object.assign(Ai(e,r),i)):i=Ai(e,r),t(Mi,{option:e,onSelect:g,layout:i,noCheck:l},`option-${n}`)})]})}function Mi({option:e,onSelect:i,layout:a,noCheck:o}){return n(J,{variant:`unstyled`,size:`none`,className:r(`group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted`,a.reverse&&`flex-row-reverse`,a.className),onClick:()=>i(e),children:[o?null:t(`div`,{className:``,children:a.check}),t(`div`,{className:`flex-1`,children:a.label})]})}function Ni({isOpen:e,title:r,onClose:i,children:a,panelWidth:o=768,backdrop:s=!1,side:c=`right`,resizable:l=!0,className:u,contentClassName:d}){let[f,p]=L(o),m=e=>{e.preventDefault();let t=!0,n=e.pageX,r=f,i=e=>{if(t){let t=n-e.pageX,i=Math.max(r+t,480);p(i)}},a=()=>{t=!1,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},h=c===`left`,g=h?`left-0`:`right-0`,_=h?`pr-10 sm:pr-16`:`pl-10 sm:pl-16`,v=h?`border-r`:`border-l`,y=h?`-right-1`:`-left-1`,b=h?`-100%`:`100%`;return t(ve,{children:e&&n(`div`,{className:`relative z-20`,children:[s&&t(ye.div,{className:`fixed inset-0 bg-black/70`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i}),t(`div`,{className:`fixed inset-y-0 ${g} overflow-hidden`,children:t(`div`,{className:`absolute inset-0 overflow-hidden`,children:t(`div`,{className:`pointer-events-none fixed inset-y-0 ${g} flex max-w-full ${_}`,children:t(ye.div,{className:`pointer-events-auto ${v}`,style:{width:`${f}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:`spring`,stiffness:300,damping:30},children:n(`div`,{className:`relative flex h-full`,children:[l&&t(`div`,{"aria-label":`Resize panel`,className:`absolute ${y} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:m,children:t(C,{className:`rotate-90 font-semibold`,strokeWidth:4})}),n(`div`,{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${u}`,children:[r&&t(`div`,{className:`sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b`,children:n(`div`,{className:`flex items-start justify-between`,children:[t(`h2`,{className:`w-full text-base font-semibold leading-6`,children:t(`div`,{className:`text-2xl`,children:r??``})}),t(`div`,{className:`ms-3 flex h-7 items-center`,children:t(Pi,{onClose:i})})]})}),t(`div`,{className:d??`flex-1 overflow-auto px-2 sm:px-4 py-4`,children:t(`div`,{className:`w-full h-full flex-1 flex flex-col`,children:a})})]})]})})})})})]})})}function Pi({onClose:e}){return t(J,{alt:`Close panel`,variant:`ghost`,onClick:e,children:t(j,{className:`size-6`,"aria-hidden":`true`})})}function Fi(e){switch(e){case`xs`:return`size-2`;case`sm`:return`size-3`;case`md`:return`size-4`;case`lg`:return`size-5`;case`xl`:return`size-7`;case`2xl`:return`size-10`;default:throw Error(`Unexpected size: ${e}`)}}function Ii({size:e,className:i}){return n(`svg`,{className:r(`animate-[spin_0.8s_linear_infinite] text-indigo-500`,Fi(e||`md`),i),xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),t(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function Li({options:i,value:a,onChange:o,onOptionsChange:s,placeholder:c,className:l,disabled:u,layout:d=`horizontal`,creatable:f=!1,createText:p=`Create "%value%"`,maxDropdownHeight:m=200}){let h=P(ur),[g,_]=L(``),[v,y]=L(0),[b,x]=L(0),[S,C]=L(null),w=I(null),T=I(null),E=I(null),D=I(null),O=h?.open??!1,k=h?.setOpen??(()=>{});F(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;x(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let A=i.filter(e=>!a.includes(e)&&e.toLowerCase().includes(g.toLowerCase())),ee=f&&g&&!a.includes(g)&&!i.includes(g),te=A.length+ +!!ee;F(()=>{g!==``&&C(null)},[g]),F(()=>{O&&v>=0&&D.current&&E.current&&D.current.scrollIntoView({block:`nearest`,behavior:`smooth`})},[v,O]),F(()=>{O?w.current?.focus():_(``)},[O]),F(()=>{if(!O)return;let e=e=>e instanceof Node&&(T.current?.contains(e)===!0||E.current?.contains(e)===!0),t=t=>{e(t.target)||k(!1)},n=t=>{e(t.target)||k(!1)},r=()=>{k(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,n,!0),window.addEventListener(`blur`,r),document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,n,!0),window.removeEventListener(`blur`,r),document.removeEventListener(`visibilitychange`,r)}},[O,k]);let M=e=>{o([...a,e]),_(``),k(!1),y(0),C(null)},N=e=>{o([...a,e]),s&&!i.includes(e)&&s([...i,e]),_(``),k(!1),y(0),C(null)},ne=(e,t)=>{t.stopPropagation(),o(a.filter(t=>t!==e)),C(null)};return n(`div`,{className:r(`relative`,l),children:[t(Q,{asChild:!0,children:n(`div`,{ref:T,className:r(`min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2`,`flex items-center gap-1`,d===`horizontal`?`flex-wrap`:`flex-col items-stretch`,`cursor-text`,`ring-offset-background`,u&&`opacity-50 cursor-not-allowed`,O?`ring-1 ring-inset ring-ring`:``),onClick:()=>{u||w.current?.focus()},children:[d===`vertical`&&a.length>0&&t(`div`,{className:`flex flex-col gap-1 w-full`,children:a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md w-full transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[t(`span`,{className:`truncate`,children:e}),t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors flex-shrink-0`,children:t(j,{className:`h-3 w-3`})})]},e))}),d===`horizontal`&&a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[e,t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors`,children:t(j,{className:`h-3 w-3`})})]},e)),t(`input`,{ref:w,type:`text`,value:g,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{if(e.key===`Enter`&&O&&te>0){e.preventDefault(),e.stopPropagation(),v===A.length&&ee?N(g):v<A.length&&M(A[v]);return}if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),O?y(e=>e<te-1?e+1:e):k(!0);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),O?y(e=>e>0?e-1:0):k(!0);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),k(!1);return}if(e.key===`Backspace`&&g===``&&a.length>0){e.stopPropagation();let t=a.length-1;S===t?(o(a.slice(0,-1)),C(null)):C(t);return}!O&&e.key.length===1&&k(!0)},onClick:e=>{e.stopPropagation(),u||k(!0)},onFocus:()=>{u||k(!0)},disabled:u,placeholder:a.length===0?c:``,className:r(`flex-1 min-w-[120px] bg-transparent text-sm`,`placeholder:text-muted-foreground`,`border-none outline-none focus:outline-none focus:ring-0 p-0 m-0`,d===`vertical`&&`w-full`)})]})}),t($,{style:{width:`${b}px`},className:`p-0 bg-popover border border-border shadow-lg`,align:`start`,side:`bottom`,onOpenAutoFocus:e=>{e.preventDefault()},children:t(`div`,{ref:E,className:`overflow-y-auto`,style:{maxHeight:`${m}px`},children:A.length===0&&!ee?t(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:g?`No options found`:`No more options available`}):n(e,{children:[A.length>0&&t(`ul`,{className:`py-1`,children:A.map((e,n)=>t(`li`,{ref:e=>{n===v&&(D.current=e)},role:`option`,"aria-selected":n===v,tabIndex:0,onClick:()=>M(e),onKeyDown:It(()=>M(e)),onMouseEnter:()=>y(n),className:r(`px-3 py-2 text-sm cursor-pointer transition-colors`,n===v?`bg-blue-500/20 text-foreground`:`hover:bg-accent/50`),children:e},e))}),ee&&n(e,{children:[A.length>0&&t(`div`,{className:`border-t border-border`}),t(J,{ref:e=>{v===A.length&&(D.current=e)},variant:`unstyled`,size:`none`,onClick:()=>N(g),onMouseEnter:()=>y(A.length),className:r(`!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary`,v===A.length?`bg-blue-500/20`:`hover:bg-accent/50`),children:p.replace(`%value%`,g)})]})]})})})]})}function Ri(e){return t(Z,{click:!0,children:t(Li,{...e})})}function zi({className:e,children:n,...i}){return t(`table`,{className:r(`
|
|
89
|
+
flex items-center justify-center size-6 rounded end-2`,"aria-label":`Clear input`,children:t(j,{size:16})})]})});Sr.displayName=`Input`;const Cr=({filterType:e,filterValue:r,setFilterValue:i})=>{let[a,o]=L(!1),[s,c]=L(r);return n(Z,{_open:a,onOpenChange:e=>{o(e),!e&&s!==r&&c(r)},children:[t(Q,{className:`rounded-none p-1 h-8 bg-muted hover:bg-muted/50 text-muted hover:text-primary shrink-0 transition`,children:t(`div`,{className:`flex gap-1.5 items-center`,children:r||`Enter text...`})}),t($,{className:`w-[300px] p-3`,children:n(`div`,{className:`flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:e})}),t(Sr,{autoFocus:!0,type:`text`,size:`sm`,value:s,onChange:c,onKeyDown:e=>{e.key===`Enter`&&(i(s),o(!1))},placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:()=>{c(r),o(!1)},children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{i(s),o(!1)},children:`Apply`})]})})]})})]})};function wr({selectedView:r,selectedDate:i,setSelectedDate:a,setFilters:o,filters:s,handleClose:c,filterGroups:l}){let{t:u}=R(),[d,f]=L([null,null]),[p,m]=L([null,null]),h=l.find(e=>e.name===r),g=h?.multiple,_=new Date;_.setHours(23,59,59,999);let v=[p[0]||d[0],p[1]||d[1]],y=e=>{if(g)Array.isArray(e)?(m([e[0],e[1]]),f([e[0],e[1]])):(m([e,null]),f([e,null]));else{let t=Array.isArray(e)?e[0]:e;if(a(t||void 0),t){let e=new Date(t);e.setHours(0,0,0,0),o([...s,{name:r||``,placeholder:h?.placeholder,value:[{value:e.toISOString(),label:W(e).format(`LLL dd, y`)}],type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}}};return t(`div`,{className:`p-2`,children:g?n(e,{children:[t(`div`,{children:g?v[0]&&v[1]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:u(`filter.to`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[1]).format(`MMMM DD, YYYY`)})]}):v[0]?n(`span`,{className:`flex items-center gap-2`,children:[t(`span`,{className:`text-xs text-muted`,children:u(`filter.from`)}),t(`span`,{className:`text-xs font-medium`,children:W(v[0]).format(`MMMM DD, YYYY`)}),t(`span`,{className:`text-xs text-muted`,children:`→ Select end date`})]}):t(`span`,{className:`text-muted text-xs`,children:h?.placeholder||h?.name||r||`Select date range`}):i?W(i).format(`MMMM DD, YYYY`):`Pick a date`}),n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:v,onChange:y,selectRange:!0,returnValue:`range`,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(v[0]){let e=v[0].getTime();if(v[1]){let n=v[1].getTime();if(t===e)return`bg-primary text-primary-foreground rounded-s-md font-semibold`;if(t===n)return`bg-primary text-primary-foreground rounded-e-md font-semibold`;if(t>e&&t<n)return`bg-primary/20 text-primary font-medium`}else if(t===e)return`bg-primary text-primary-foreground rounded-md font-semibold`}}return``}},`${v[0]?.getTime()}-${v[1]?.getTime()}`)]}),t(`div`,{className:`border-t pt-2`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:c,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{if(d[0]){let e=new Date(d[0]),t=d[1]?new Date(d[1]):new Date(d[0]);e.setHours(0,0,0,0),t.setHours(23,59,59,999);let n=[];n.push({value:e.toISOString(),label:W(e).format(`LLL dd, y`)}),d[1]&&d[0].getTime()!==d[1].getTime()&&n.push({value:t.toISOString(),label:W(t).format(`LLL dd, y`)}),o([...s,{name:r||``,placeholder:h?.placeholder,value:n,type:h?.type||`date`,multiple:h?.multiple||!1}]),c()}},disabled:!v[0],children:`Apply`})]})})]}):n(`div`,{className:`calendar-wrapper`,children:[t(`style`,{children:gr}),t(Se,{value:i,onChange:y,selectRange:!1,maxDate:_,className:`mb-2 border-0`,tileClassName:({date:e,view:t})=>{if(t===`month`){let t=e.getTime(),n=new Date;if(n.setHours(23,59,59,999),t>n.getTime())return`text-muted/20 cursor-not-allowed`;if(i&&t===i.getTime())return`bg-primary text-primary-foreground rounded-md font-semibold`}return``}})]})})}function Tr({selectedView:e,commandInput:r,setFilters:i,handleClose:a,filterGroups:o}){let[s,c]=L([]),l=e=>{let t=o.find(t=>t.name===e);if(!t)return[];let n=t.options||[];if(!r.trim())return n;if(t.filterBy){let e=r.toLowerCase();return n.filter(n=>n.value!==void 0&&t.filterBy?.(n.value,e))}let i=r.toLowerCase();return n.filter(e=>String(e.value||``).toLowerCase().includes(i))};if(!e)return null;let u=l(e),d=o.find(t=>t.name===e),f=d?.placeholder||d?.name,p=()=>{s.length>0&&i(t=>[...t.filter(t=>t.name!==e),{name:e||``,placeholder:d?.placeholder||``,value:s,type:d?.type||`select`,multiple:d?.multiple||!1}]),a()},m=t=>{let n={value:t.value,label:t.label};d?.multiple?s.some(e=>e.value===t.value)?c(e=>e.filter(e=>e.value!==t.value)):c(e=>[...e,n]):(i(t=>{let r=t.findIndex(t=>t.name===e);if(r>=0){let e=[...t];return e[r]={...e[r],value:[n]},e}else return[...t,{name:e||``,placeholder:d?.placeholder||``,value:[n],type:d?.type||`select`,multiple:d?.multiple||!1}]}),a())};return n(`div`,{className:`flex flex-col h-full`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted shrink-0`,children:t(`span`,{children:f})}),t(`div`,{className:`flex-1 overflow-hidden min-h-0`,children:t(`div`,{className:`max-h-[200px] overflow-y-auto`,children:u.length>0&&u.map(e=>{let r=s.some(t=>t.value===e.value);return n(X,{className:`group flex gap-2 items-center w-full hover:bg-muted ${d?.multiple&&r?`bg-muted`:``}`,onSelect:()=>m(e),children:[t(vr,{value:e.value||``,labelRenderer:e.labelRenderer||d?.labelRenderer,fallbackLabel:e.label}),d?.multiple&&r&&t(`span`,{className:`ms-auto text-xs text-success`,children:`✓`})]},e.value||`option-${Math.random()}`)})})}),d?.multiple&&t(`div`,{className:`p-2 border-t shrink-0`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),t(J,{size:`sm`,onClick:p,disabled:s.length===0,children:`Apply`})]})})]})}function Er({selectedView:e,setFilters:r,handleClose:i,filterGroups:a}){let[o,s]=L([]),c=a.find(t=>t.name===e);return n(`div`,{className:`p-2 space-y-3`,children:[t(`div`,{className:`space-y-2`,children:t(Ut,{value:o,onChange:s,placeholder:c?.placeholder||`Add ${e}...`,autoFocus:!0})}),n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`}),t(J,{size:`sm`,onClick:()=>{o.length>0&&r(t=>[...t.filter(t=>t.name!==e),{name:e,placeholder:c?.placeholder,value:o,type:`stringList`}]),i()},disabled:o.length===0,children:`Apply`})]})]})}function Dr({selectedView:e,textValue:r,setTextValue:i,setFilters:a,handleClose:o,filterGroups:s}){let c=()=>{a(t=>[...t,{name:e||``,placeholder:s.find(t=>t.name===e)?.placeholder,value:[{value:r,label:r}],type:`text`}]),o()};return n(`div`,{className:`p-2 flex flex-col gap-1`,children:[t(`div`,{className:`flex items-center p-1.5 text-xs text-muted`,children:t(`span`,{children:s.find(t=>t.name===e)?.placeholder})}),t(Sr,{autoFocus:!0,type:`text`,size:`sm`,value:r,onChange:i,onKeyDown:e=>e.key===`Enter`&&c(),placeholder:`Enter text...`}),t(`div`,{className:`mt-2 p-2 border-t`,children:n(`div`,{className:`flex gap-2 justify-end`,children:[t(J,{variant:`ghost`,size:`sm`,onClick:o,children:`Cancel`}),t(J,{size:`sm`,onClick:c,disabled:!r.trim(),children:`Apply`})]})})]})}function Or(e,n,r){switch(e.type){case`date`:return t(_r,{filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value.map(e=>e.value||``):[],isRange:e.multiple,setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t.length>0?t.map(e=>({value:e,label:W(e).format(`LLL dd, y`)})):[]}:n))}});case`text`:return t(Cr,{filterType:e.placeholder||e.name,filterValue:Array.isArray(e.value)&&e.value[0]&&typeof e.value[0]==`object`&&e.value[0].value||``,setFilterValue:t=>{n(n=>n.map(n=>n===e?{...n,value:[{value:t,label:t}]}:n))}});case`stringList`:return t(br,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`string`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))}});default:{let i=r.find(t=>t.name===e.name);return t(yr,{filterType:e.placeholder||e.name,filterValues:Array.isArray(e.value)&&typeof e.value[0]==`object`?e.value:[],setFilterValues:t=>{n(n=>n.map(n=>n===e?{...n,value:t}:n))},options:i?.options||[],labelRenderer:i?.labelRenderer,multiple:e.multiple??i?.multiple})}}}function kr({filters:e,setFilters:r,filterGroups:i}){return t(`div`,{className:`flex gap-2 flex-wrap justify-start`,children:e.filter(e=>e.value?.length>0).map(e=>n(`div`,{className:`flex gap-[1px] items-center text-sm`,children:[t(`div`,{className:`flex gap-1.5 shrink-0 rounded-s bg-muted p-1.5 h-8 items-center`,children:e.placeholder||e.name}),Or(e,r,i),t(J,{variant:`ghost`,size:`icon`,onClick:()=>{r(t=>t.filter(t=>t!==e))},className:`bg-muted rounded-s-none rounded-e-sm size-8 hover:text-primary hover:bg-muted/50 transition shrink-0`,children:t(j,{className:`size-6`})})]},`${e.name}-${e.type===`date`?`date`:e.type===`stringList`&&typeof e.value[0]==`string`?e.value.join(`,`):Array.isArray(e.value)?e.value.map(e=>e.value).join(`,`):``}`))})}const Ar=N.createContext({filters:[],setFilters:()=>void 0,filterGroups:[]}),jr=({filters:e,setFilters:n,filterGroups:r,children:i,inModal:a})=>{let o=new URL(window.location.href).searchParams.toString(),[s]=N.useState(()=>new URLSearchParams(window.location.search).get(`filters`)),c=N.useRef(new Set),l=N.useRef(a||!s);return F(()=>{if(!a&&l.current)try{let t=new URLSearchParams(o);if(e.length>0){let n=e.map(e=>{let t;if(e.type===`stringList`&&Array.isArray(e.value)&&typeof e.value[0]==`string`)t=`[${e.value.map(e=>encodeURIComponent(e)).join(`,`)}]`;else if(Array.isArray(e.value))if(e.multiple)t=`[${e.value.map(e=>encodeURIComponent(Fr(e))).join(`,`)}]`;else if(e.value.length>1)t=`[${e.value.map(e=>encodeURIComponent(Fr(e))).join(`,`)}]`;else{let n=e.value[0];t=typeof n==`string`?encodeURIComponent(n):typeof n==`object`&&n?.value!==void 0?encodeURIComponent(String(n.value)):encodeURIComponent(String(n||``))}else t=encodeURIComponent(e.value||``);return`${encodeURIComponent(e.name)}:${t}`}).join(`;`);t.set(`filters`,n)}else t.delete(`filters`);let n=`${window.location.pathname}?${t.toString()}${window.location.hash}`;window.history.replaceState(window.history.state||{},``,n)}catch(e){console.error(`Failed to update URL with filters:`,e)}},[e,a,o]),F(()=>{if(!(a||!s||r.length===0))try{let e=s.split(`;`),t=[];for(let n of e){let e=n.indexOf(`:`);if(e===-1)continue;let i=n.slice(0,e),a=n.slice(e+1),o=decodeURIComponent(i);if(c.current.has(o))continue;let s=r.find(e=>e.name===o);if(!s)continue;c.current.add(o);let l;if(a.startsWith(`[`)&&a.endsWith(`]`)){let e=a.slice(1,-1);l=e?e.split(`,`).map(e=>decodeURIComponent(e)):[]}else l=[decodeURIComponent(a)];let u;u=s.type===`stringList`?l:s.type===`text`?l.length===1?[{value:l[0],label:l[0]}]:l.map(e=>({value:e,label:e})):l.map(e=>{let t=s.options?.find(t=>t.value===e),n=e;return t?.label?n=String(t.label):t?.labelRenderer?n=String(t.labelRenderer(e)):s.labelRenderer&&(n=String(s.labelRenderer(e))),{value:e,label:n}}),s.multiple&&!a.startsWith(`[`)&&!a.endsWith(`]`)&&(s.type===`stringList`?u=l:Array.isArray(u)||(u=[u])),t.push({name:o,type:s.type,placeholder:s.placeholder,value:u,multiple:s.multiple})}t.length>0&&n(e=>{let n=new Set(t.map(e=>e.name));return[...e.filter(e=>!n.has(e.name)),...t]}),l.current=!0}catch{}},[r,a,s,n]),t(Ar.Provider,{value:{filters:e,setFilters:n,filterGroups:r},children:i})},Mr=({className:e})=>{let{filters:r,setFilters:i,filterGroups:a}=N.useContext(Ar),{t:o}=R(),[s,c]=N.useState(!1),[l,u]=N.useState(null),[d,f]=N.useState(``),p=N.useRef(null),[m,h]=N.useState(),[g,_]=N.useState(``),v=e=>{u(e),f(``),p.current?.focus()},y=()=>{let e=a.map(e=>({...e,options:(e.options??[]).filter(t=>!r.some(n=>n.type===`date`?n.name===e.name:n.name===e.name&&(Array.isArray(n.value)&&typeof n.value[0]==`string`?n.value.some(e=>e===t.value):n.value.some(e=>Fr(e)===t.value))))})).filter(e=>(e.options??[]).length>0||e.type===`date`&&!r.some(t=>t.name===e.name)||e.type===`text`&&!r.some(t=>t.name===e.name)||e.type===`stringList`&&!r.some(t=>t.name===e.name));return e.length===0?t(Vn,{children:o(`filter.noAvailableFilters`)}):e.map(e=>t(X,{onSelect:()=>v(e.name),className:`group flex gap-2 items-center hover:bg-muted`,children:t(`span`,{children:e.placeholder??e.name})},e.name))},x=()=>{c(!1),setTimeout(()=>{u(null),f(``),h(void 0)},200)};return n(Z,{_open:s,onOpenChange:e=>{c(e),e||setTimeout(()=>{u(null),f(``),_(``)},200)},children:[t(Q,{asChild:!0,children:n(J,{variant:`outline`,role:`combobox`,"aria-expanded":s,size:`md`,className:q(`transition group flex gap-1.5`,e),children:[t(b,{className:`size-4 shrink-0 transition-all text-muted`}),o(`filter.filter`)]})}),t($,{className:`w-[300px] p-0`,align:`start`,sideOffset:4,children:n(Ln,{children:[a.find(e=>e.name===l)?.type===`select`&&t(zn,{placeholder:l?o(`filter.filterBy`,{view:l}):o(`filter.filterPlaceholder`),className:`h-9 ring-0`,value:d,onValueChange:e=>{f(e)},ref:p,autoFocus:!0}),t(Bn,{children:t(Y,{children:l?(()=>{if(!l)return null;switch(a.find(e=>e.name===l)?.type){case`date`:return t(wr,{selectedView:l,selectedDate:m,setSelectedDate:h,setFilters:i,filters:r,handleClose:x,filterGroups:a});case`text`:return t(Dr,{selectedView:l,textValue:g,setTextValue:_,setFilters:i,handleClose:x,filterGroups:a});case`stringList`:return t(Er,{selectedView:l,setFilters:i,handleClose:x,filterGroups:a});default:return t(Tr,{selectedView:l,commandInput:d,setFilters:i,handleClose:x,filterGroups:a})}})():y()})})]})})]})},Nr=({className:e})=>{let{filters:n,setFilters:r,filterGroups:i}=N.useContext(Ar);return t(`div`,{className:q(e),children:t(kr,{filters:n,setFilters:r,filterGroups:i})})},Pr=({className:e})=>{let{filters:n,setFilters:r}=N.useContext(Ar),{t:i}=R();return n.filter(e=>e.value?.length>0).length>0?t(J,{variant:`outline`,size:`md`,className:q(`transition group`,e),onClick:()=>r([]),children:i(`filter.clearAll`)}):null};function Fr(e){return typeof e==`string`?e:e.value||``}var Ir;(function(e){e.IS=`is`,e.IS_NOT=`is_not`,e.CONTAINS=`contains`,e.BEFORE=`before`,e.AFTER=`after`,e.IS_ANY_OF=`is_any_of`})(Ir||={});const Lr=oe(({className:e,level:n=3,...r},i)=>t(`h${n}`,{ref:i,className:q({h1:`text-2xl font-medium tracking-tight`,h2:`text-xl font-medium tracking-tight`,h3:`text-lg font-medium`,h4:`text-base font-medium`,h5:`text-sm font-medium`,h6:`text-xs font-medium`}[`h${n}`],`mb-2`,e),...r}));Lr.displayName=`Heading`;function Rr({options:i,optionLabel:s,groupBy:c,value:l,onChange:u,addNew:d,addNewLabel:f,disabled:p,filterBy:h,label:g,placeholder:_,className:v,popupClass:y,isClearable:b,border:x=!0,multiple:C=!1,by:w,inline:T=!1,isLoading:E=!1,warnOnMissingValue:D=!0,missingValueWarning:A=`Value not in options list, may not be valid`,clearIcon:ee,clearTitle:te,"aria-label":M,"aria-labelledby":N,id:ne,"aria-describedby":re,"aria-invalid":ie}){let ae=I(null),[oe,se]=L(!1),[ce,P]=L(0),[ue,fe]=L(``),pe=le(),me=le(),he=de(()=>!D||C||l==null||!i?!1:!i.some(e=>typeof w==`string`?zr(e,w)===zr(l,w):typeof w==`function`?w(e,l):Ce(e,l)),[D,C,l,i,w]);F(()=>{let e=ae.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;P(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let R=e=>{if(C){let t=Array.isArray(l)?l:[];z(e,t)?u(t.filter(t=>!ge(t,e))):u([...t,e])}else u(e)},z=(e,t)=>!t||t.length===0?!1:t.some(t=>ge(t,e)),ge=(e,t)=>e==null||t==null?e===t:typeof w==`string`?zr(e,w)===zr(t,w):typeof w==`function`?w(e,t):Ce(e,t),B=i||[];function _e(e){return e?typeof e==`string`?t=>String(zr(t,e)).toLowerCase():e:e=>String(e).toLowerCase()}let ve=ue.toLowerCase(),ye=_e(h);B=B.filter(e=>ye(e).includes(ve));let be=()=>{if(!l||Array.isArray(l)&&l.length===0)return t(`span`,{className:`text-muted`,children:_});let e=Array.isArray(l)?l[0]:l;return s?s(e):e},xe=()=>{let e=Array.isArray(l)?l:l?[l]:[];return e.length===0?t(`span`,{className:`text-muted`,children:_}):e.length===1?s?s(e[0]):e[0]:n(`div`,{className:`flex flex-wrap gap-1`,children:[e.slice(0,1).map((e,n)=>t(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 text-xs bg-muted rounded`,children:s?s(e):e},`chip-${n}`)),e.length>1&&n(`span`,{className:`inline-flex items-center px-2 py-1 text-xs bg-muted rounded`,children:[`+`,e.length-1,` more`]})]})},V=(e,r)=>{let i=C?z(e,Array.isArray(l)?l:[]):l!=null&&ge(l,e);return t(X,{onSelect:()=>R(e),className:`w-full`,children:C||T?n(`div`,{className:`w-full flex justify-between items-center cursor-pointer`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]}):n(mr,{className:`w-full flex justify-between items-center`,children:[t(`div`,{className:`w-full truncate text-start`,children:s?s(e):e}),i&&t(o,{className:`size-4`})]})},`option-${r}`)},H=(()=>{if(!c)return null;let e=[],t=new Map;for(let n of B){let r=c(n),i=t.get(r);i||(i=[],t.set(r,i),e.push({key:r,items:i})),i.push(n)}return e})(),U=()=>n(e,{children:[h&&n(`div`,{className:`flex justify-start items-center mb-1`,children:[t(`div`,{className:`mx-2`,children:t(O,{className:`size-4`})}),t(Sr,{variant:`unstyled`,value:ue,onChange:fe,className:`w-full p-1 rounded-md`,placeholder:`Search...`})]}),t(Ln,{className:`overflow-hidden`,children:n(Bn,{className:T?`max-h-full overflow-y-auto`:`max-h-[200px] overflow-y-auto`,onWheel:e=>{e.currentTarget.scrollTop+=e.deltaY},children:[t(Vn,{children:`No result found.`}),H?H.map(e=>t(Y,{heading:e.key,className:`[&_[cmdk-group-heading]]:text-muted [&_[cmdk-group-heading]]:border-b [&_[cmdk-group-heading]]:border-border [&_[cmdk-group-heading]]:ml-[-0.5rem] [&_[cmdk-group-heading]]:text-xs`,children:e.items.map((t,n)=>V(t,`${e.key}-${n}`))},e.key)):t(Y,{children:B?.map((e,t)=>V(e,t))})]})}),d&&t(`div`,{className:`p-1`,children:n(`button`,{type:`button`,onClick:d,className:r(`w-full text-start gap-x-2 px-2 py-1.5 truncate group flex rounded-md items-center text-sm cursor-pointer hover:bg-accent bg-transparent border-0`),children:[t(k,{size:16,strokeWidth:1.25,absoluteStrokeWidth:!0}),f]})})]});if(T)return t(`div`,{className:r(v,x&&`border border-border rounded-md`,`bg-popover p-1`,y),children:E?t(`div`,{className:`flex justify-center items-center p-2 text-muted text-sm`,children:t(S,{className:`size-4 animate-spin`})}):U()});let W=!!g,Se=M??(W?void 0:typeof _==`string`?_:void 0),G=N??(W?me:void 0),we=!!b&&!!l&&(!Array.isArray(l)||l.length>0),Te=ie===!0||ie===`true`||he?!0:ie===!1||ie===`false`?!1:void 0;return n(Z,{onOpenChange:se,children:[n(`div`,{ref:ae,className:r(`relative`,v),children:[t(Q,{asChild:!0,children:t(`button`,{type:`button`,id:ne,disabled:p||E,"aria-haspopup":`dialog`,"aria-expanded":oe,"aria-controls":pe,"aria-label":Se,"aria-labelledby":G,"aria-describedby":re,"aria-invalid":Te,className:r(E?`flex w-full justify-center items-center gap-2 border border-border rounded-md p-2 text-muted text-sm bg-transparent`:r(x&&(he||Te?`border border-destructive`:`border border-border`),`flex w-full flex-row gap-2 items-center justify-between p-2 rounded-md group bg-transparent text-inherit text-start`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,p?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-muted`,we&&`pe-10`)),children:E?t(S,{className:`size-4 animate-spin`}):n(e,{children:[n(`div`,{className:r(`flex flex-col w-full rounded-md text-sm min-h-6 items-center justify-center truncate`),children:[g&&t(`div`,{id:me,className:`w-full text-start text-xs font-semibold`,children:g}),n(`div`,{className:r(`w-full text-start `,he&&`text-destructive`),children:[he&&t(vt,{description:A,placement:`top`,asChild:!0,children:t(a,{className:`inline-block size-4 me-1 -mt-0.5 cursor-help`})}),C?xe():be()]})]}),!p&&t(m,{className:`size-4 opacity-50 shrink-0`,"aria-hidden":`true`})]})})}),we&&!E&&t(J,{variant:`link`,size:`icon`,disabled:p,"aria-label":te||`Clear selection`,onClick:e=>{e.stopPropagation(),u(C?[]:void 0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`absolute end-8 top-1/2 -translate-y-1/2 hover:bg-muted/20 rounded p-1`,children:ee||t(j,{className:`size-4`})})]}),t($,{id:pe,style:{width:`${ce}px`,zIndex:1e6},className:r(`min-w-[8rem] w-64 bg-popover p-1 border shadow`,`divide-y divide-border`,y),children:U()})]})}function zr(e,t){return typeof e==`object`&&e?e[t]:void 0}const Br={ar:`العربية`,de:`Deutsch`,en:`English`,es:`Español`,fr:`Français`,it:`Italiano`,ja:`日本語`,ko:`한국어`,pt:`Português`,ru:`Русский`,tr:`Türkçe`,zh:`中文`,"zh-TW":`繁體中文`};function Vr({label:e,className:r}={}){let{language:i,setLanguage:a}=he(),{t:o}=R(),s=e===!1?!1:e??o(`language.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center gap-3`:`flex items-center`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),t(Rr,{options:me,value:i,onChange:e=>a(e),optionLabel:e=>Br[e],placeholder:o(`language.placeholder`),isClearable:!1,warnOnMissingValue:!1,className:`min-w-40`})]})}const Hr=z(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),Ur=M.forwardRef(({className:e,required:r,...i},a)=>n(we.Root,{ref:a,className:q(Hr(),e),...i,children:[i.children,r&&t(`span`,{className:`text-destructive-foreground ms-1`,children:`*`})]}));Ur.displayName=we.Root.displayName;function Wr({icon:e,status:r,title:i,children:o,className:s}){let c,l,u,d;switch(r){case`error`:c=t(g,{className:`size-5 text-destructive`,"aria-hidden":`true`}),l=`text-destructive`,u=`text-foreground`,d=`bg-destructive border border-destructive`;break;case`warning`:c=t(a,{className:`size-5 text-attention`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-attention border border-attention`;break;case`success`:c=t(h,{className:`size-5 text-success`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-success border border-success`;break;case`info`:c=t(y,{className:`size-5 text-info`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-info border border-info`;break;case`default`:c=t(y,{className:`size-5 text-muted`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-muted border border-muted`;break;case`done`:c=t(y,{className:`size-5 text-done`,"aria-hidden":`true`}),l=``,u=`text-foreground`,d=`bg-done border border-done`;break}return t(`div`,{className:`rounded-md p-4 ${d} ${s}`,children:n(`div`,{className:`flex`,children:[t(`div`,{className:`shrink-0`,children:e??c}),n(`div`,{className:`w-full ms-2 px-1`,children:[i&&t(`h3`,{className:`text-md font-medium mb-2 ${l}`,children:i}),t(`div`,{className:`text-sm ${u} break-words`,children:o})]})]})})}function Gr({title:e,className:r,children:i,action:a,actionLabel:o}){return n(Wr,{status:`error`,title:e,className:`${r} flex flex-col items-center justify-center text-center`,children:[t(`pre`,{className:`whitespace-pre-wrap break-words`,children:i}),a&&o&&t(J,{onClick:a,variant:`ghost`,size:`sm`,className:`mt-4`,children:o})]})}function Kr({title:e,className:n,children:r}){return t(Wr,{status:`info`,title:e,className:n,children:r})}function qr({title:e,className:n,children:r}){return t(Wr,{status:`warning`,title:e,className:n,children:r})}function Jr({title:e,className:n,children:r}){return t(Wr,{status:`success`,title:e,className:n,children:r})}function Yr({title:e,className:n,children:r}){return t(Wr,{status:`default`,title:e,className:n,children:r})}function Xr({title:e,content:r,onConfirm:i,onCancel:a,isOpen:o,isLoading:s,confirmationValue:c,confirmationLabel:l,confirmationPlaceholder:u}){let{t:d}=R(),f=I(null),[p,m]=L(``);F(()=>{o||m(``)},[o]);let h=!!c,g=!c||p.trim()===c.trim(),_=()=>{!g||s||i()};return n(Tn,{isOpen:o,onClose:a,description:`Confirm Modal`,children:[n(`div`,{className:`sm:flex sm:items-start p-2`,children:[t(`div`,{className:`mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10`,children:t(ee,{className:`size-6 text-red-600`,"aria-hidden":`true`})}),n(`div`,{className:`mt-3 text-center sm:ms-4 sm:mt-0 sm:text-start`,children:[t(En,{className:`leading-6`,show:!0,children:e}),t(`div`,{className:`mt-2`,children:t(`div`,{className:`prose text-sm text-gray-500`,children:r})})]})]}),h&&t(`div`,{className:`px-2 pb-2 text-start`,children:t(It,{label:l??u,children:t(Sr,{autoFocus:!0,value:p,onChange:m,placeholder:u,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),_())}})})}),n(On,{align:`right`,children:[t(J,{variant:`destructive`,onClick:_,isLoading:s,disabled:!g,children:d(`modal.confirm`)}),t(J,{variant:`outline`,onClick:a,ref:f,children:d(`modal.cancel`)})]})]})}function Zr(){return P(Qr)}const Qr=ae(()=>{}),$r={success:h,error:g,warning:a,info:y},ei={success:`text-success`,error:`text-destructive`,warning:`text-attention`,info:`text-info`};function ti({data:e,onClose:r}){let[i,a]=L(!0),o=I(null),s=ce(()=>{o.current&&=(globalThis.clearTimeout(o.current),null)},[]),c=ce(()=>{s(),e.duration&&(o.current=setTimeout(()=>a(!1),e.duration))},[s,e.duration]);F(()=>(c(),s),[s,c]);let l=$r[e.status]||y,u=ei[e.status]||`text-info`;return t(`div`,{"aria-live":`assertive`,className:`pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6 z-100`,children:t(`div`,{className:`flex w-full flex-col items-center space-y-4 sm:items-end`,children:t(ve,{onExitComplete:r,children:i&&t(ye.div,{className:`pointer-events-auto w-full max-w-md overflow-hidden rounded-lg bg-muted shadow-lg ring-1 ring-border`,initial:{opacity:0,x:8},animate:{opacity:1,x:0,transition:{ease:`easeOut`,duration:.7}},exit:{opacity:0,transition:{ease:`easeIn`,duration:.3}},onMouseEnter:s,onMouseLeave:c,children:t(`div`,{className:`p-5`,children:n(`div`,{className:`flex items-start`,children:[t(`div`,{className:`shrink-0`,children:t(l,{className:`size-6 ${u}`,"aria-hidden":`true`})}),n(`div`,{className:`ms-3 flex-1 pt-0.5 min-w-0`,children:[t(`p`,{className:`text-sm font-semibold text-foreground break-words`,children:e.title}),e.description&&t(`p`,{className:`mt-2 text-sm text-muted break-words whitespace-pre-wrap leading-relaxed`,children:e.description})]}),t(`div`,{className:`ms-4 flex shrink-0`,children:n(`button`,{type:`button`,className:`inline-flex rounded-md bg-muted text-muted hover:text-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background`,onClick:()=>a(!1),children:[t(`span`,{className:`sr-only`,children:`Close`}),t(j,{className:`size-5`,"aria-hidden":`true`})]})})]})})})})})})}function ni({children:r}){let[i,a]=L(null),o=ce(e=>{a(e)},[]);return n(e,{children:[t(Qr.Provider,{value:o,children:r}),i&&t(en,{children:t(ti,{data:i,onClose:()=>o(null)})})]})}function ri({idToDelete:e,title:n,content:r,setIdToDelete:i,deleteApi:a}){let{t:o}=R(),s=Zr();return t(Xr,{title:n,content:r,isOpen:!!e,onConfirm:async()=>{if(e)return a(e).then(()=>{s({title:o(`modal.delete.succeeded`),status:`success`})}).catch(e=>{s({title:o(`modal.delete.failed`),description:e instanceof Error?e.message:o(`modal.delete.error`),status:`error`})}).finally(()=>{i(void 0)})},onCancel:()=>{i(void 0)}})}function ii({children:r,action:i,title:a,description:o,footer:s,className:l,collapsible:u,defaultCollapsed:d=!1,size:p=`md`,clickableHeader:m=!1}){let[h,g]=L(d),_=u&&m,v=p===`sm`,b=v||_,x=t(h?c:f,{className:`size-4 text-muted`}),S=n(e,{children:[n(`div`,{className:`flex items-center gap-2`,children:[t(`div`,{className:`font-semibold ${v?`text-sm`:`text-lg`}`,children:a}),o&&t(vt,{description:o,children:t(y,{className:`size-4 text-muted`})})]}),n(`div`,{className:`flex gap-2 items-center`,children:[i,u&&(_?x:t(J,{variant:`ghost`,size:`icon`,onClick:()=>g(!h),children:x}))]})]}),C=v?`px-4 py-2`:`px-4 py-3`,w=v?`px-4 pt-3 pb-3`:`p-4`,T=v?`px-4 pb-3`:`px-4 pb-4`;return n(`div`,{className:`flex flex-col ${b?``:`p-4 gap-2`} rounded-sm border bg-card ${_?`overflow-hidden`:``} ${l??``}`,children:[_?t(`button`,{type:`button`,className:`w-full flex items-center justify-between ${C} hover:bg-muted/50 transition-colors`,onClick:()=>g(!h),children:S}):t(`div`,{className:`flex items-center justify-between ${b?C:``}`,children:S}),!h&&(b?t(`div`,{className:w,children:r}):r),s&&t(`div`,{className:`border-t border-muted flex flex-col-2 text-sm pt-4 ${b?T:``}`,children:s})]})}function ai({className:e,...n}){return t(Te.Item,{"data-slot":`radio-group-item`,className:q(`border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50`,e),...n,children:t(Te.Indicator,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:t(`span`,{className:`bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full`})})})}var oi=class{descriptionOf(e){}selectedClassName(e){return`border-accent-foreground`}};function si({onSelect:e,selected:r,options:i,adapter:a}){let o=e=>a?a.idOf(e):e.id,s=e=>a?a.labelOf(e):e.label,c=e=>a?a.descriptionOf(e):e.description,l=e=>a?a.selectedClassName(e):`border-primary`;return t(Te.Root,{"data-slot":`radio-group`,value:r?o(r):void 0,onValueChange:t=>{let n=i.find(e=>o(e)===t);n&&e(n)},className:`space-y-4`,children:i.map(e=>{let i=r?o(r)===o(e):!1;return t(Te.Item,{value:o(e),className:q(`relative block w-full cursor-pointer rounded-lg border border-border bg-accent px-6 py-4 shadow-2xs text-start`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`sm:flex sm:justify-between`,i&&l(e)),children:t(`span`,{className:`flex items-center`,children:n(`span`,{className:`flex flex-col text-sm`,children:[t(`span`,{className:`font-medium text-text`,children:s(e)}),c(e)&&t(`span`,{className:`text-muted-foreground`,children:c(e)})]})})},o(e))})})}function ci({className:e,direction:n=`horizontal`,orientation:r,...i}){let a=r??n;return t(Ee.Group,{"data-slot":`resizable-panel-group`,"data-panel-group-direction":a,orientation:a,className:q(`flex h-full w-full data-[panel-group-direction=vertical]:flex-col`,e),...i})}function li(e){return typeof e==`number`?`${e}%`:e}function ui({defaultSize:e,minSize:n,maxSize:r,collapsedSize:i,...a}){return t(Ee.Panel,{"data-slot":`resizable-panel`,defaultSize:li(e),minSize:li(n),maxSize:li(r),collapsedSize:li(i),...a})}function di({withHandle:e,className:n,...r}){return t(Ee.Separator,{"data-slot":`resizable-handle`,className:q(`bg-muted focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:start-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),...r,children:e&&t(`div`,{className:`z-10 flex size-4 items-center justify-center rounded-xs font-semibold`,children:t(C,{className:`size-4 rotate-90`})})})}const fi=M.forwardRef(({className:e,orientation:n=`horizontal`,decorative:r=!0,...i},a)=>t(De.Root,{ref:a,decorative:r,orientation:n,className:q(`shrink-0 bg-border`,n===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...i}));fi.displayName=De.Root.displayName;const pi=M.forwardRef(({className:e,trackClassName:r,rangeClassName:i,thumbClassName:a,value:o,defaultValue:s,min:c=0,max:l=100,"aria-label":u,...d},f)=>{let p=M.useId(),m=Array.isArray(o)?o.length:Array.isArray(s)?s.length:1,h=M.useMemo(()=>Array.from({length:Math.max(1,m)},(e,t)=>`${p}-thumb-${t}`),[p,m]);return n(Oe.Root,{ref:f,"data-slot":`slider`,value:o,defaultValue:s,min:c,max:l,...d,className:q(`relative flex w-full touch-none select-none items-center data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col`,e),children:[t(Oe.Track,{"data-slot":`slider-track`,className:q(`relative h-1.5 w-full grow overflow-hidden rounded-full bg-muted data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5`,r),children:t(Oe.Range,{"data-slot":`slider-range`,className:q(`absolute h-full bg-primary data-[orientation=vertical]:w-full`,i)})}),h.map(e=>t(Oe.Thumb,{"data-slot":`slider-thumb`,"aria-label":u,className:q(`block size-3.5 rounded-full border border-primary bg-background shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,a)},e))]})});pi.displayName=Oe.Root.displayName;const mi={sm:[`h-5 w-8`,`size-3`,`translate-x-4 rtl:-translate-x-4`],md:[`h-6 w-11`,`size-4`,`translate-x-6 rtl:-translate-x-6`],lg:[`h-8 w-16`,`size-6`,`translate-x-9 rtl:-translate-x-9`]};function hi({className:e,size:r=`md`,value:i,onChange:a,children:o,disabled:s,...c}){let[l,u,d]=mi[r],f=t(ke.Root,{"data-slot":`switch`,checked:i,onCheckedChange:a,disabled:s,...c,className:q(`data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 shrink-0 rounded-full border focus-visible:ring-3 aria-invalid:ring-3 peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,l,!o&&e),children:t(ke.Thumb,{"data-slot":`switch-thumb`,className:q(`bg-white rounded-full pointer-events-none block ring-0 transition-transform`,u,i?d:`translate-x-1 rtl:-translate-x-1`)})});return o?n(`div`,{className:q(`flex items-center`,e),children:[f,t(`span`,{className:`px-2`,children:o})]}):f}const gi=M.createContext({size:void 0,tabs:void 0,current:void 0,setTab:void 0,responsive:!1,variant:`tabs`,updateHash:!0}),_i=({tabs:e,defaultValue:n,current:r,className:i,fullWidth:a,fullHeight:o,children:s,onTabChange:c,responsive:l=!1,variant:u=`tabs`,updateHash:d=!0})=>{let f=M.useMemo(()=>e.filter(e=>e.is_allowed===void 0||e.is_allowed===!0),[e]),[p,m]=M.useState(()=>{let e=typeof r==`function`?r():r;if(e)return e;let t=window.location.hash,i=t?t.substring(1):void 0;return i&&f.some(e=>e.name===i)?i:n||f[0]?.name});M.useEffect(()=>{let e=typeof r==`function`?r():r;e&&e!==p&&m(e)},[r,p]),M.useEffect(()=>{if(r)return;let e=()=>{let e=window.location.hash,t=e?e.substring(1):void 0;t&&f.some(e=>e.name===t)?m(t):!e&&n&&m(n)};return e(),window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[r,f,n]);let h=M.useCallback(e=>{if(m(e),d&&!r){let t=window.history.state,n=`${window.location.pathname+window.location.search}#${e}`;window.history.pushState(t,``,n)}c&&c(e)},[r,c,d]),g=M.useCallback(e=>{h(e)},[h]);return t(gi.Provider,{value:{tabs:f,size:a?f.length:0,current:p,setTab:g,responsive:l,variant:u,updateHash:d},children:t(K.Root,{defaultValue:p||f[0]?.name,value:p,onValueChange:h,className:q(`flex-1 flex flex-col min-h-0 px-2`,o&&`h-full`,i),children:s})})},vi=({className:r,sticky:i,direction:a})=>{let{tabs:o,size:s,current:c,setTab:l,responsive:u,variant:d,updateHash:f}=M.useContext(gi),p=s!==0,m=M.useCallback(e=>{if(!o||!l)return;let t=o.find(t=>t.name===e);if(t?.href&&f){let e=window.history.state;window.history.pushState(e,``,t.href)}l(e)},[o,l,f]);return!o||!l?(console.warn(`TabsBar: No tabs provided or setTab not available`),null):n(e,{children:[u&&t(`div`,{className:`px-2 block lg:hidden`,children:t(Rr,{label:`Tab`,className:q(i&&`sticky top-0 bg-background z-10`,r),options:o,optionLabel:e=>typeof e.label==`string`?e.label:String(e.label),value:o.find(e=>e.name===c),onChange:e=>{m(e.name)}})}),t(bi,{size:s,variant:d,className:q(p?`w-full`:``,i&&`sticky top-0 bg-background z-10`,a===`vertical`?`flex-col items-start`:`flex-row`,u?`hidden lg:flex`:``,r),children:o.map(e=>t(xi,{className:q(a===`vertical`?`w-full text-start`:``),value:e.name,disabled:e.disabled,href:e.href,variant:d,onClick:()=>m(e.name),children:e.label},e.name))})]})},yi=({className:n})=>{let{tabs:r}=M.useContext(gi);return r?t(e,{children:r.map(e=>t(Si,{value:e.name,className:n,children:e.content},e.name))}):null},bi=M.forwardRef(({className:e,size:n,variant:r=`tabs`,...i},a)=>t(gi.Provider,{value:{size:n,variant:r},children:t(K.List,{ref:a,className:q(r===`tabs`?`border-b -mb-px flex gap-4`:`flex gap-2 p-1 rounded-md`,e),...i})}));bi.displayName=K.List.displayName;const xi=M.forwardRef(({className:e,href:n,variant:r=`tabs`,...i},a)=>{let{size:o}=M.useContext(gi),s=M.useCallback(e=>{if(n){e.preventDefault();let t=window.history.state;window.history.pushState(t,``,n)}i.onClick&&i.onClick(e)},[n,i.onClick]);return t(K.Trigger,{ref:a,className:q(r===`tabs`?q(`border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer`,`border-transparent text-muted-foreground hover:border-border hover:text-foreground`,`data-[state=active]:border-primary data-[state=active]:text-primary`,`disabled:pointer-events-none disabled:opacity-50`):q(`px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors`,`tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset`,`data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm`,`disabled:pointer-events-none disabled:opacity-50`),e,o?`w-1/${o}`:``),onClick:s,...i})});xi.displayName=K.Trigger.displayName;const Si=M.forwardRef(({className:e,...n},r)=>t(K.Content,{ref:r,className:q(`focus-visible:outline-none`,`flex-1 overflow-y-auto min-h-0 pt-2 pb-4`,e),...n}));Si.displayName=K.Content.displayName;const Ci=z(`text-foreground`,{variants:{size:{xl:`text-base md:text-lg leading-relaxed`,lg:`text-base leading-relaxed`,default:`text-sm leading-normal`,sm:`text-sm leading-normal`,xs:`text-xs leading-normal`},weight:{normal:`font-normal`,medium:`font-medium`,semibold:`font-semibold`}},defaultVariants:{size:`default`,weight:`normal`}}),wi=oe(({className:e,size:n,weight:r,...i},a)=>t(`p`,{ref:a,className:q(Ci({size:n,weight:r,className:e})),...i}));wi.displayName=`Text`;function Ti({className:e,minLines:n,maxLines:r,value:i,...a}){let o=I(null),s=n!==void 0||r!==void 0,c=ce(()=>{let e=o.current;if(!e)return;let t=getComputedStyle(e),i=parseFloat(t.lineHeight)||parseFloat(t.fontSize)*1.5,a=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),s=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0),c=n??1,l=r??1/0,u=c*i+a+s,d=l===1/0?1/0:l*i+a+s;e.style.height=`auto`;let f=Math.min(Math.max(e.scrollHeight,u),d);e.style.height=`${f}px`,e.style.overflowY=d!==1/0&&e.scrollHeight>d?`auto`:`hidden`},[n,r]);return ue(()=>{s&&c()}),t(`textarea`,{ref:o,"data-slot":`textarea`,value:i,className:q(`py-2 text-sm`,`flex w-full rounded-md border border-input bg-background ring-offset-background`,`placeholder:text-muted focus-visible:outline-none focus-visible:ring-1 ring-inset focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,s&&`resize-none`,e),...a})}const Ei=ae({theme:`system`,setTheme:()=>null});function Di({children:e,defaultTheme:n=`system`,storageKey:r=`vite-ui-theme`,...i}){let[a,o]=L(()=>localStorage.getItem(r)||n);F(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),a===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(a)},[a]);let s={theme:a,setTheme:e=>{localStorage.setItem(r,e),o(e)}};return t(Ei.Provider,{...i,value:s,children:e})}const Oi=()=>{let e=P(Ei);if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e};function ki({option:e,current:n,setTheme:r,icon:i,alt:a}){return t(J,{variant:n===e?`secondary`:`outline`,size:`sm`,onClick:()=>r(e),title:a,children:i})}function Ai({label:e,className:r}={}){let{setTheme:i,theme:a}=Oi(),{t:o}=R(),s=e===!1?!1:e??o(`theme.label`);return n(`div`,{className:r??(s?`flex justify-between px-2 items-center`:`flex items-center gap-1`),children:[s&&t(`p`,{className:`text-sm font-semibold`,children:s}),n(`div`,{className:`flex gap-2`,children:[t(ki,{current:a,option:`system`,setTheme:i,icon:t(_,{}),alt:o(`theme.system`)}),t(ki,{current:a,option:`light`,setTheme:i,icon:t(A,{}),alt:o(`theme.light`)}),t(ki,{current:a,option:`dark`,setTheme:i,icon:t(w,{}),alt:o(`theme.dark`)})]})]})}function ji(e,n){return{label:String(e),check:t(n?o:`div`,{className:`size-4`}),reverse:!1,className:`flex-1 px-2 py-2 hover:bg-accent nowrap`}}function Mi({value:e,options:i,onChange:a,className:o,optionLayout:s,by:c,noCheck:l,filterBy:u}){let{t:d}=R(),[f,p]=L(e),[m,h]=L(``),g=e=>{p(e),a(e)},_=de(()=>typeof c==`string`?(e,t)=>e[c]===t[c]:c||((e,t)=>e===t),[c]);return n(`div`,{className:r(``,o),children:[u&&t(Sr,{type:`text`,placeholder:d(`form.filter`),value:m,onChange:e=>h(e)}),i.map((e,n)=>{if(u&&!u(m)(e))return null;let r=f?_(f,e):!1,i;return s?(i=s(e,r),i=Object.assign(ji(e,r),i)):i=ji(e,r),t(Ni,{option:e,onSelect:g,layout:i,noCheck:l},`option-${n}`)})]})}function Ni({option:e,onSelect:i,layout:a,noCheck:o}){return n(J,{variant:`unstyled`,size:`none`,className:r(`group !flex w-full items-center cursor-pointer gap-x-2 hover:bg-muted`,a.reverse&&`flex-row-reverse`,a.className),onClick:()=>i(e),children:[o?null:t(`div`,{className:``,children:a.check}),t(`div`,{className:`flex-1`,children:a.label})]})}function Pi({isOpen:e,title:r,onClose:i,children:a,panelWidth:o=768,backdrop:s=!1,side:c=`right`,resizable:l=!0,className:u,contentClassName:d}){let[f,p]=L(o),m=e=>{e.preventDefault();let t=!0,n=e.pageX,r=f,i=e=>{if(t){let t=n-e.pageX,i=Math.max(r+t,480);p(i)}},a=()=>{t=!1,document.removeEventListener(`mousemove`,i),document.removeEventListener(`mouseup`,a)};document.addEventListener(`mousemove`,i),document.addEventListener(`mouseup`,a)},h=c===`left`,g=h?`left-0`:`right-0`,_=h?`pr-10 sm:pr-16`:`pl-10 sm:pl-16`,v=h?`border-r`:`border-l`,y=h?`-right-1`:`-left-1`,b=h?`-100%`:`100%`;return t(ve,{children:e&&n(`div`,{className:`relative z-20`,children:[s&&t(ye.div,{className:`fixed inset-0 bg-black/70`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:i}),t(`div`,{className:`fixed inset-y-0 ${g} overflow-hidden`,children:t(`div`,{className:`absolute inset-0 overflow-hidden`,children:t(`div`,{className:`pointer-events-none fixed inset-y-0 ${g} flex max-w-full ${_}`,children:t(ye.div,{className:`pointer-events-auto ${v}`,style:{width:`${f}px`},initial:{x:b},animate:{x:0},exit:{x:b},transition:{type:`spring`,stiffness:300,damping:30},children:n(`div`,{className:`relative flex h-full`,children:[l&&t(`div`,{"aria-label":`Resize panel`,className:`absolute ${y} top-0 bottom-0 w-3 z-25 cursor-ew-resize hover:bg-indigo-500 transition-colors flex items-center justify-center`,onMouseDown:m,children:t(C,{className:`rotate-90 font-semibold`,strokeWidth:4})}),n(`div`,{className:`flex-1 min-w-0 flex flex-col bg-background shadow-xl ${u}`,children:[r&&t(`div`,{className:`sticky top-0 z-10 bg-background px-2 sm:px-4 py-2 border-b`,children:n(`div`,{className:`flex items-start justify-between`,children:[t(`h2`,{className:`w-full text-base font-semibold leading-6`,children:t(`div`,{className:`text-2xl`,children:r??``})}),t(`div`,{className:`ms-3 flex h-7 items-center`,children:t(Fi,{onClose:i})})]})}),t(`div`,{className:d??`flex-1 overflow-auto px-2 sm:px-4 py-4`,children:t(`div`,{className:`w-full h-full flex-1 flex flex-col`,children:a})})]})]})})})})})]})})}function Fi({onClose:e}){return t(J,{title:`Close panel`,variant:`ghost`,onClick:e,children:t(j,{className:`size-6`,"aria-hidden":`true`})})}function Ii(e){switch(e){case`xs`:return`size-2`;case`sm`:return`size-3`;case`md`:return`size-4`;case`lg`:return`size-5`;case`xl`:return`size-7`;case`2xl`:return`size-10`;default:throw Error(`Unexpected size: ${e}`)}}function Li({size:e,className:i}){return n(`svg`,{className:r(`animate-[spin_0.8s_linear_infinite] text-indigo-500`,Ii(e||`md`),i),xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),t(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z`})]})}function Ri({options:i,value:a,onChange:o,onOptionsChange:s,placeholder:c,className:l,disabled:u,layout:d=`horizontal`,creatable:f=!1,createText:p=`Create "%value%"`,maxDropdownHeight:m=200}){let h=P(dr),[g,_]=L(``),[v,y]=L(0),[b,x]=L(0),[S,C]=L(null),w=I(null),T=I(null),E=I(null),D=I(null),O=h?.open??!1,k=h?.setOpen??(()=>{});F(()=>{let e=T.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect().width;x(t)},n=new ResizeObserver(()=>{t()});return t(),n.observe(e),()=>{n.disconnect()}},[]);let A=i.filter(e=>!a.includes(e)&&e.toLowerCase().includes(g.toLowerCase())),ee=f&&g&&!a.includes(g)&&!i.includes(g),te=A.length+ +!!ee;F(()=>{g!==``&&C(null)},[g]),F(()=>{O&&v>=0&&D.current&&E.current&&D.current.scrollIntoView({block:`nearest`,behavior:`smooth`})},[v,O]),F(()=>{O?w.current?.focus():_(``)},[O]),F(()=>{if(!O)return;let e=e=>e instanceof Node&&(T.current?.contains(e)===!0||E.current?.contains(e)===!0),t=t=>{e(t.target)||k(!1)},n=t=>{e(t.target)||k(!1)},r=()=>{k(!1)};return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,n,!0),window.addEventListener(`blur`,r),document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,n,!0),window.removeEventListener(`blur`,r),document.removeEventListener(`visibilitychange`,r)}},[O,k]);let M=e=>{o([...a,e]),_(``),k(!1),y(0),C(null)},N=e=>{o([...a,e]),s&&!i.includes(e)&&s([...i,e]),_(``),k(!1),y(0),C(null)},ne=(e,t)=>{t.stopPropagation(),o(a.filter(t=>t!==e)),C(null)};return n(`div`,{className:r(`relative`,l),children:[t(Q,{asChild:!0,children:n(`div`,{ref:T,className:r(`min-h-[40px] w-full rounded-md border border-input bg-background px-3 py-2`,`flex items-center gap-1`,d===`horizontal`?`flex-wrap`:`flex-col items-stretch`,`cursor-text`,`ring-offset-background`,u&&`opacity-50 cursor-not-allowed`,O?`ring-1 ring-inset ring-ring`:``),onClick:()=>{u||w.current?.focus()},children:[d===`vertical`&&a.length>0&&t(`div`,{className:`flex flex-col gap-1 w-full`,children:a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center justify-between gap-2 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md w-full transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[t(`span`,{className:`truncate`,children:e}),t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors flex-shrink-0`,children:t(j,{className:`h-3 w-3`})})]},e))}),d===`horizontal`&&a.map((e,i)=>n(`span`,{className:r(`inline-flex items-center gap-1 px-2 py-1 text-sm bg-primary/20 text-foreground ring-1 ring-primary/30 rounded-md transition-all`,S===i&&`ring-2 ring-red-300 shadow-[0_0_8px_rgba(252,165,165,0.5)]`),children:[e,t(`button`,{type:`button`,onClick:t=>ne(e,t),disabled:u,className:`hover:bg-primary/30 rounded-sm transition-colors`,children:t(j,{className:`h-3 w-3`})})]},e)),t(`input`,{ref:w,type:`text`,value:g,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{if(e.key===`Enter`&&O&&te>0){e.preventDefault(),e.stopPropagation(),v===A.length&&ee?N(g):v<A.length&&M(A[v]);return}if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),O?y(e=>e<te-1?e+1:e):k(!0);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),O?y(e=>e>0?e-1:0):k(!0);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),k(!1);return}if(e.key===`Backspace`&&g===``&&a.length>0){e.stopPropagation();let t=a.length-1;S===t?(o(a.slice(0,-1)),C(null)):C(t);return}!O&&e.key.length===1&&k(!0)},onClick:e=>{e.stopPropagation(),u||k(!0)},onFocus:()=>{u||k(!0)},disabled:u,placeholder:a.length===0?c:``,className:r(`flex-1 min-w-[120px] bg-transparent text-sm`,`placeholder:text-muted-foreground`,`border-none outline-none focus:outline-none focus:ring-0 p-0 m-0`,d===`vertical`&&`w-full`)})]})}),t($,{style:{width:`${b}px`},className:`p-0 bg-popover border border-border shadow-lg`,align:`start`,side:`bottom`,onOpenAutoFocus:e=>{e.preventDefault()},children:t(`div`,{ref:E,className:`overflow-y-auto`,style:{maxHeight:`${m}px`},children:A.length===0&&!ee?t(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:g?`No options found`:`No more options available`}):n(e,{children:[A.length>0&&t(`ul`,{className:`py-1`,children:A.map((e,n)=>t(`li`,{ref:e=>{n===v&&(D.current=e)},role:`option`,"aria-selected":n===v,tabIndex:0,onClick:()=>M(e),onKeyDown:Lt(()=>M(e)),onMouseEnter:()=>y(n),className:r(`px-3 py-2 text-sm cursor-pointer transition-colors`,n===v?`bg-blue-500/20 text-foreground`:`hover:bg-accent/50`),children:e},e))}),ee&&n(e,{children:[A.length>0&&t(`div`,{className:`border-t border-border`}),t(J,{ref:e=>{v===A.length&&(D.current=e)},variant:`unstyled`,size:`none`,onClick:()=>N(g),onMouseEnter:()=>y(A.length),className:r(`!flex w-full justify-start px-3 py-2 text-sm cursor-pointer transition-colors text-primary`,v===A.length?`bg-blue-500/20`:`hover:bg-accent/50`),children:p.replace(`%value%`,g)})]})]})})})]})}function zi(e){return t(Z,{click:!0,children:t(Ri,{...e})})}function Bi({className:e,children:n,...i}){return t(`table`,{className:r(`
|
|
90
90
|
divide-y divide-border
|
|
91
91
|
[&>tbody]:divide-y [&>tbody]:divide-border
|
|
92
92
|
[&_th]:text-start [&_th]:px-3 [&_th]:py-3.5 [&_th]:text-sm [&_th]:font-normal [&_th]:text-muted-foreground
|
|
93
93
|
[&_td]:px-3 [&_td]:py-4 [&_td]:text-sm
|
|
94
|
-
`,e),...i,children:n})}function Bi({children:e}){return t(`thead`,{className:`sticky top-0 bg-background z-10 after:absolute after:bottom-0 after:start-0 after:w-full after:h-px after:bg-muted/20`,children:e})}function Vi({columns:e}){return t(`tr`,{className:`hover:bg-muted`,children:Array(e).fill(0).map((e,n)=>t(`td`,{children:t(`div`,{className:`animate-pulse rounded-xs h-5 bg-muted`})},`skeleton-cell-${n}`))})}function Hi({isLoading:e=!1,columns:n,rows:r=3,children:i}){let a=Array.from({length:r},(e,t)=>`skeleton-row-${t}`);return t(`tbody`,{children:e?a.map(e=>t(Vi,{columns:n},e)):i})}function Ui({className:e,children:n,...i}){return t(`tr`,{className:r(`hover:bg-muted hover:cursor-pointer`,e),...i,children:n})}function Wi({scope:e=`col`,children:n,...r}){return t(`th`,{scope:e,...r,children:n})}function Gi({sortDirection:e=`none`,onSort:r,sortIndicator:i,disabled:a=!1,children:o,className:s,scope:c=`col`,...l}){return t(`th`,{scope:c,"aria-sort":e,className:s,...l,children:a?n(`span`,{className:`inline-flex items-center gap-1`,children:[o,i?.(e)]}):n(`button`,{type:`button`,onClick:r,className:`inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 text-inherit font-inherit cursor-pointer hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm`,children:[o,i?.(e)]})})}var Ki=class{_value;watchers=[];name;constructor(e,t){this._value=e,this.name=t}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function qi(e){let t=N.createContext(void 0);return e.Context=t,t.Provider}var Ji=class{consume=void 0;_current;constructor(e){this._current=e}set current(e){e!==this._current&&(this._current=e,this.consume?.(e))}get current(){return this._current}withConsumer(e){return this.consume=e,e?.(this.current),this}};function Yi(e){let t=e.Context;if(!t)throw Error(`Context not defined for ${e.name}`);return P(t)}function Xi(e){let[t,n]=L(e.value);return F(()=>e.watch(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function Zi(e,t){return F(()=>(e.value=t,()=>{e.value=void 0}),[e,t]),t}function Qi(e,t){F(()=>e.watch(t),[e,t])}function $i(e){let[t,n]=L(e.current);return F(()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)}),[e]),t}function ea(e,t){F(()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)}),[e,t])}function ta(e,t){F(()=>(e.current=t,()=>{e.current=void 0}),[e,t])}var na=class{compute;_value;watchers=[];unsubscribers=[];name;constructor(e,t,n){this.compute=e,this.name=n,this.recalculate();for(let e of t)this.unsubscribers.push(e.watch(()=>this.recalculate()))}recalculate(){let e=this.compute();if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}get value(){return this._value}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}dispose(){for(let e of this.unsubscribers)e();this.watchers=[]}},ra=class{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function ia(e){let[t,n]=L(e.value);return F(()=>e.addWatcher(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function aa(e,t){let n=I(null);return F(()=>{let r=r=>{n.current&&!n.current.contains(r.target)&&(t?.(r)||e(r))},i=window.setTimeout(()=>{document.addEventListener(`click`,r)},0);return()=>{window.clearTimeout(i),document.removeEventListener(`click`,r)}},[e,t]),n}function oa(){let[e,t]=L(null);return[e,async e=>{if(!navigator?.clipboard)return console.warn(`Clipboard not supported`),!1;try{return await navigator.clipboard.writeText(e),t(e),!0}catch(e){return console.warn(`Copy failed`,e),t(null),!1}}]}function sa(e){F(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=t=>e(t.matches);return t.addEventListener(`change`,n),e(t.matches),()=>t.removeEventListener(`change`,n)},[e])}function ca(e,t){let[n,r]=L(e);return F(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function la(e,t,n){let r=[],i=new EventSource(e);return i.addEventListener(`message`,e=>{let n=JSON.parse(e.data);n&&(r.push(n),t(r.join(``)))}),i.addEventListener(`close`,e=>{i.close(),n(JSON.parse(e.data))}),()=>{i.close()}}function ua(e,t,n){let r=I(t),i=I(n);r.current=t,i.current=n,F(()=>{let t,n=!1,a=e=>r.current(e),o=e=>i.current(e);return typeof e==`function`?e().then(e=>{n||(t=la(e,a,o))}):t=la(e,a,o),()=>{n=!0,t?.()}},[e])}function da(e){return e instanceof Error?e:Error(String(e))}function fa(e,t){Array.isArray(t)&&(t={deps:t});let n=t||{},[r,i]=L(void 0),[a,o]=L(!1),[s,c]=L(n.defaultValue),l=I(e);l.current=e;let u=I(n);u.current=n;let d=ce(()=>{let e=u.current;return e.start?.(),o(!0),l.current().then(t=>{c(t),e.onSuccess?.(t)}).catch(t=>{let n=da(t);i(n),e.onError?.(n)}).finally(()=>{o(!1),e.end?.()})},[]);return F(()=>{let e=u.current;(!e.condition||e.condition())&&d()},[d,...n.deps??[]]),{data:s,isLoading:a,error:r,setData:c,refetch:d}}function pa(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),fa(e,t)}function ma(e=!1){let[t,n]=L(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function ha(e,t,n={}){let r=I(t);r.current=t;let i=I(n);i.current=n;let a=n.threshold||1;F(()=>{let t=e.current,n=new IntersectionObserver(e=>{let t=e[0].isIntersecting;i.current.leave?t||r.current(e[0]):t&&r.current(e[0])},{threshold:a});return t&&n.observe(t),()=>{t&&n.unobserve(t)}},[e,a,...n.deps??[]])}function ga(){let e=I(!0);return F(t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0}),[]),e.current}const _a=typeof window<`u`?ue:F;function va(e,t=[]){let n=e.pageSize||50,[r,i]=L(null),[a,o]=L(e.payload),[s,c]=L(null),[l,u]=L([]),[d,f]=L(null),[p,m]=L(!1),h=I(0),g=e=>{i(null),u([]),f(null),o(e)},_=()=>{d!==null&&i(d)};return F(()=>{h.current+=1;let t=h.current;m(!0),e.search(a,r,n).then(e=>{t===h.current&&(u(r===null?e.result:t=>[...t,...e.result]),f(e.nextPage),c(null))}).catch(e=>{t===h.current&&c(e)}).finally(()=>{t===h.current&&m(!1)})},[...t,a,e.search,r,n]),ha(e.nextPageTrigger,()=>{!p&&d&&_()},{threshold:.1,deps:[d,p]}),{search:g,refresh:()=>g(a),searchMore:_,result:l,page:r,hasMore:d!==null,error:s,isSearching:p}}function ya(e,t=[]){return va({...e,async search(t,n,r){let i=n??0,a=i*r,o=await e.search(t,a,r);return{result:o,nextPage:o.length===0?null:i+1}}},t)}var ba=class{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}};function xa(e){return new ba(L(e))}function Sa(...e){return ge(i(e))}function Ca(e){return typeof e==`object`&&!!e&&`message`in e}function wa(e,t=`An error occurred`){return e instanceof Error?e.message:typeof e==`string`?e:Ca(e)&&typeof e.message==`string`?e.message:t}function Ta(e,t){let n=e.selectionStart,r=e.selectionEnd,i=e.value,a=`${i.slice(0,n)}\n${i.slice(r)}`;t?.(a),requestAnimationFrame(()=>{e.selectionStart=e.selectionEnd=n+1})}export{lr as AnimateChangeInHeight,je as Avatar,Rt as Badge,en as Breadcrumbs,J as Button,un as Card,mn as CardContent,pn as CardDescription,hn as CardFooter,dn as CardHeader,fn as CardTitle,Ne as Center,gn as Checkbox,_n as Collapsible,yn as CollapsibleContent,vn as CollapsibleTrigger,et as ComboBox,In as Command,Ln as CommandDialog,Bn as CommandEmpty,Y as CommandGroup,Rn as CommandInput,X as CommandItem,zn as CommandList,Vn as CommandSeparator,Hn as CommandShortcut,na as ComputedProperty,Yr as ConfirmModal,St as CopyButton,qe as DOMPopup,gr as DateCombobox,Jr as DefaultBox,ni as DeleteModal,On as Dialog,jn as DialogClose,Nn as DialogContent,Pn as DialogDescription,Mn as DialogOverlay,An as DialogPortal,Fn as DialogTitle,kn as DialogTrigger,lt as Divider,Vt as DotBadge,Ot as DropZone,or as Dropdown,Wn as DropdownMenu,Xn as DropdownMenuCheckboxItem,qn as DropdownMenuContent,Jn as DropdownMenuGroup,Yn as DropdownMenuItem,$n as DropdownMenuLabel,Gn as DropdownMenuPortal,Zn as DropdownMenuRadioGroup,Qn as DropdownMenuRadioItem,er as DropdownMenuSeparator,tr as DropdownMenuShortcut,nr as DropdownMenuSub,ir as DropdownMenuSubContent,rr as DropdownMenuSubTrigger,Kn as DropdownMenuTrigger,Ct as EmptyCollection,Wr as ErrorBox,Dt as FileUploadInput,Mr as FilterBar,jr as FilterBtn,Nr as FilterClear,Fr as FilterOperator,Ar as FilterProvider,Ft as FormItem,Ir as Heading,Gr as InfoBox,xr as Input,Ht as InputList,Hr as Label,Br as LanguageSwitcher,Ut as Link,sr as MenuGroup,cr as MenuItem,Wt as MenuList,Ur as MessageBox,wn as Modal,En as ModalBody,Cn as ModalContextProvider,Dn as ModalFooter,Tn as ModalTitle,Oi as ModeOption,ki as ModeToggle,Jt as NumberInput,Xe as OptionAdapter,Yt as Overlay,ri as Panel,Z as Popover,fr as PopoverAnchor,pr as PopoverClose,$ as PopoverContent,ur as PopoverContext,Q as PopoverTrigger,Je as Popup,We as PopupController,$t as Portal,ut as PortalContainerContext,ft as PortalContainerProvider,Ki as Property,oi as RadioGroup,ai as RadioGroupAdapter,ii as RadioGroupItem,ui as ResizableHandle,li as ResizablePanel,si as ResizablePanelGroup,Vi as RowSkeleton,Lr as SelectBox,ji as SelectList,vr as SelectionCombobox,di as Separator,ra as SharedState,ba as SharedValue,Ni as SidePanel,ct as SimpleCombobox,fi as Slider,Ji as Slot,Gi as SortableTableHeaderCell,Ii as Spinner,yr as StringListCombobox,Ze as StringOptionAdapter,Qe as StringOptionAdapterWithCreate,Kt as Styles,qr as SuccessBox,Me as SvgAvatar,mi as Switch,Hi as TBody,Bi as THead,Ui as TR,zi as Table,Wi as TableHeaderCell,gi as Tabs,_i as TabsBar,xi as TabsContent,yi as TabsList,vi as TabsPanel,bi as TabsTrigger,Ri as TagsInput,Ci as Text,Sr as TextCombobox,wi as Textarea,Ei as ThemeProvider,Ti as ThemeProviderContext,Zr as ToastContext,ti as ToastProvider,ht as Tooltip,_t as TooltipContent,mt as TooltipProvider,gt as TooltipTrigger,vt as VTooltip,Kr as WarningBox,xt as buttonVariants,Sa as cn,ze as computePosition,qi as createCompositeStateProvider,wa as errorMessage,$e as getDefaultComboBoxLayout,Ta as insertNewlineAtCursor,It as onActivateKey,aa as useClickOutside,it as useComboboxCtrl,Yi as useCompositeState,oa as useCopyToClipboard,sa as useDarkMode,ca as useDebounce,ya as useDefaultScrollableSearch,ta as useDefineSlot,Mt as useDropZone,ua as useEventSource,fa as useFetch,pa as useFetchOnce,ma as useFlag,Xi as useGetCompositeStateProperty,ha as useIntersectionObserver,ga as useIsFirstRendering,Sn as useIsInModal,mr as usePopoverContext,Ke as usePopupController,pt as usePortalContainer,_a as useSafeLayoutEffect,va as useScrollableSearch,Zi as useSetCompositeStateProperty,xa as useSharedValue,$i as useSlot,Di as useTheme,Xr as useToast,Qi as useWatchCompositeStateProperty,ia as useWatchSharedState,ea as useWatchSlot};
|
|
94
|
+
`,e),...i,children:n})}function Vi({children:e}){return t(`thead`,{className:`sticky top-0 bg-background z-10 after:absolute after:bottom-0 after:start-0 after:w-full after:h-px after:bg-muted/20`,children:e})}function Hi({columns:e}){return t(`tr`,{className:`hover:bg-muted`,children:Array(e).fill(0).map((e,n)=>t(`td`,{children:t(`div`,{className:`animate-pulse rounded-xs h-5 bg-muted`})},`skeleton-cell-${n}`))})}function Ui({isLoading:e=!1,columns:n,rows:r=3,children:i}){let a=Array.from({length:r},(e,t)=>`skeleton-row-${t}`);return t(`tbody`,{children:e?a.map(e=>t(Hi,{columns:n},e)):i})}function Wi({className:e,children:n,...i}){return t(`tr`,{className:r(`hover:bg-muted hover:cursor-pointer`,e),...i,children:n})}function Gi({scope:e=`col`,children:n,...r}){return t(`th`,{scope:e,...r,children:n})}function Ki({sortDirection:e=`none`,onSort:r,sortIndicator:i,disabled:a=!1,children:o,className:s,scope:c=`col`,...l}){return t(`th`,{scope:c,"aria-sort":e,className:s,...l,children:a?n(`span`,{className:`inline-flex items-center gap-1`,children:[o,i?.(e)]}):n(`button`,{type:`button`,onClick:r,className:`inline-flex items-center gap-1 bg-transparent border-0 p-0 m-0 text-inherit font-inherit cursor-pointer hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm`,children:[o,i?.(e)]})})}var qi=class{_value;watchers=[];name;constructor(e,t){this._value=e,this.name=t}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function Ji(e){let t=N.createContext(void 0);return e.Context=t,t.Provider}var Yi=class{consume=void 0;_current;constructor(e){this._current=e}set current(e){e!==this._current&&(this._current=e,this.consume?.(e))}get current(){return this._current}withConsumer(e){return this.consume=e,e?.(this.current),this}};function Xi(e){let t=e.Context;if(!t)throw Error(`Context not defined for ${e.name}`);return P(t)}function Zi(e){let[t,n]=L(e.value);return F(()=>e.watch(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function Qi(e,t){return F(()=>(e.value=t,()=>{e.value=void 0}),[e,t]),t}function $i(e,t){F(()=>e.watch(t),[e,t])}function ea(e){let[t,n]=L(e.current);return F(()=>(e.withConsumer(n),()=>{e.withConsumer(void 0)}),[e]),t}function ta(e,t){F(()=>(e.withConsumer(t),()=>{e.withConsumer(void 0)}),[e,t])}function na(e,t){F(()=>(e.current=t,()=>{e.current=void 0}),[e,t])}var ra=class{compute;_value;watchers=[];unsubscribers=[];name;constructor(e,t,n){this.compute=e,this.name=n,this.recalculate();for(let e of t)this.unsubscribers.push(e.watch(()=>this.recalculate()))}recalculate(){let e=this.compute();if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}get value(){return this._value}watch(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}dispose(){for(let e of this.unsubscribers)e();this.watchers=[]}},ia=class{_value;watchers=[];constructor(e){this._value=e}get value(){return this._value}set value(e){if(e!==this._value){this._value=e;for(let t of this.watchers)t(e)}}addWatcher(e){return this.watchers.push(e),()=>{this.watchers=this.watchers.filter(t=>t!==e)}}};function aa(e){let[t,n]=L(e.value);return F(()=>e.addWatcher(e=>{n(typeof e==`function`?()=>e:e)}),[e]),t}function oa(e,t){let n=I(null);return F(()=>{let r=r=>{n.current&&!n.current.contains(r.target)&&(t?.(r)||e(r))},i=window.setTimeout(()=>{document.addEventListener(`click`,r)},0);return()=>{window.clearTimeout(i),document.removeEventListener(`click`,r)}},[e,t]),n}function sa(){let[e,t]=L(null);return[e,async e=>{if(!navigator?.clipboard)return console.warn(`Clipboard not supported`),!1;try{return await navigator.clipboard.writeText(e),t(e),!0}catch(e){return console.warn(`Copy failed`,e),t(null),!1}}]}function ca(e){F(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=t=>e(t.matches);return t.addEventListener(`change`,n),e(t.matches),()=>t.removeEventListener(`change`,n)},[e])}function la(e,t){let[n,r]=L(e);return F(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}function ua(e,t,n){let r=[],i=new EventSource(e);return i.addEventListener(`message`,e=>{let n=JSON.parse(e.data);n&&(r.push(n),t(r.join(``)))}),i.addEventListener(`close`,e=>{i.close(),n(JSON.parse(e.data))}),()=>{i.close()}}function da(e,t,n){let r=I(t),i=I(n);r.current=t,i.current=n,F(()=>{let t,n=!1,a=e=>r.current(e),o=e=>i.current(e);return typeof e==`function`?e().then(e=>{n||(t=ua(e,a,o))}):t=ua(e,a,o),()=>{n=!0,t?.()}},[e])}function fa(e){return e instanceof Error?e:Error(String(e))}function pa(e,t){Array.isArray(t)&&(t={deps:t});let n=t||{},[r,i]=L(void 0),[a,o]=L(!1),[s,c]=L(n.defaultValue),l=I(e);l.current=e;let u=I(n);u.current=n;let d=ce(()=>{let e=u.current;return e.start?.(),o(!0),l.current().then(t=>{c(t),e.onSuccess?.(t)}).catch(t=>{let n=fa(t);i(n),e.onError?.(n)}).finally(()=>{o(!1),e.end?.()})},[]);return F(()=>{let e=u.current;(!e.condition||e.condition())&&d()},[d,...n.deps??[]]),{data:s,isLoading:a,error:r,setData:c,refetch:d}}function ma(e,t){return!t||Array.isArray(t)?t={deps:[]}:t&&(t.deps=[]),pa(e,t)}function ha(e=!1){let[t,n]=L(e);return{isOn:t,isOff:!t,set:e=>n(e),on:()=>n(!0),off:()=>n(!1),toggle:()=>n(!t)}}function ga(e,t,n={}){let r=I(t);r.current=t;let i=I(n);i.current=n;let a=n.threshold||1;F(()=>{let t=e.current,n=new IntersectionObserver(e=>{let t=e[0].isIntersecting;i.current.leave?t||r.current(e[0]):t&&r.current(e[0])},{threshold:a});return t&&n.observe(t),()=>{t&&n.unobserve(t)}},[e,a,...n.deps??[]])}function _a(){let e=I(!0);return F(t=>(t&&e.current&&t(),e.current=!1,()=>{e.current=!0}),[]),e.current}const va=typeof window<`u`?ue:F;function ya(e,t=[]){let n=e.pageSize||50,[r,i]=L(null),[a,o]=L(e.payload),[s,c]=L(null),[l,u]=L([]),[d,f]=L(null),[p,m]=L(!1),h=I(0),g=e=>{i(null),u([]),f(null),o(e)},_=()=>{d!==null&&i(d)};return F(()=>{h.current+=1;let t=h.current;m(!0),e.search(a,r,n).then(e=>{t===h.current&&(u(r===null?e.result:t=>[...t,...e.result]),f(e.nextPage),c(null))}).catch(e=>{t===h.current&&c(e)}).finally(()=>{t===h.current&&m(!1)})},[...t,a,e.search,r,n]),ga(e.nextPageTrigger,()=>{!p&&d&&_()},{threshold:.1,deps:[d,p]}),{search:g,refresh:()=>g(a),searchMore:_,result:l,page:r,hasMore:d!==null,error:s,isSearching:p}}function ba(e,t=[]){return ya({...e,async search(t,n,r){let i=n??0,a=i*r,o=await e.search(t,a,r);return{result:o,nextPage:o.length===0?null:i+1}}},t)}var xa=class{state;constructor(e){this.state=e}get(){return this.state[0]}set(e){this.state[1](e)}};function Sa(e){return new xa(L(e))}function Ca(...e){return ge(i(e))}function wa(e){return typeof e==`object`&&!!e&&`message`in e}function Ta(e,t=`An error occurred`){return e instanceof Error?e.message:typeof e==`string`?e:wa(e)&&typeof e.message==`string`?e.message:t}function Ea(e,t){let n=e.selectionStart,r=e.selectionEnd,i=e.value,a=`${i.slice(0,n)}\n${i.slice(r)}`;t?.(a),requestAnimationFrame(()=>{e.selectionStart=e.selectionEnd=n+1})}export{ur as AnimateChangeInHeight,je as Avatar,zt as Badge,tn as Breadcrumbs,J as Button,dn as Card,hn as CardContent,mn as CardDescription,gn as CardFooter,fn as CardHeader,pn as CardTitle,Ne as Center,_n as Checkbox,vn as Collapsible,bn as CollapsibleContent,yn as CollapsibleTrigger,et as ComboBox,Ln as Command,Rn as CommandDialog,Vn as CommandEmpty,Y as CommandGroup,zn as CommandInput,X as CommandItem,Bn as CommandList,Hn as CommandSeparator,Un as CommandShortcut,ra as ComputedProperty,Xr as ConfirmModal,Ct as CopyButton,qe as DOMPopup,_r as DateCombobox,Yr as DefaultBox,ri as DeleteModal,kn as Dialog,Mn as DialogClose,Pn as DialogContent,Fn as DialogDescription,Nn as DialogOverlay,jn as DialogPortal,In as DialogTitle,An as DialogTrigger,lt as Divider,Ht as DotBadge,kt as DropZone,sr as Dropdown,Gn as DropdownMenu,Zn as DropdownMenuCheckboxItem,Jn as DropdownMenuContent,Yn as DropdownMenuGroup,Xn as DropdownMenuItem,er as DropdownMenuLabel,Kn as DropdownMenuPortal,Qn as DropdownMenuRadioGroup,$n as DropdownMenuRadioItem,tr as DropdownMenuSeparator,nr as DropdownMenuShortcut,rr as DropdownMenuSub,ar as DropdownMenuSubContent,ir as DropdownMenuSubTrigger,qn as DropdownMenuTrigger,wt as EmptyCollection,Gr as ErrorBox,Ot as FileUploadInput,Nr as FilterBar,Mr as FilterBtn,Pr as FilterClear,Ir as FilterOperator,jr as FilterProvider,It as FormItem,Lr as Heading,Kr as InfoBox,Sr as Input,Ut as InputList,Ur as Label,Vr as LanguageSwitcher,Wt as Link,cr as MenuGroup,lr as MenuItem,Gt as MenuList,Wr as MessageBox,Tn as Modal,Dn as ModalBody,wn as ModalContextProvider,On as ModalFooter,En as ModalTitle,ki as ModeOption,Ai as ModeToggle,Yt as NumberInput,Xe as OptionAdapter,Xt as Overlay,ii as Panel,Z as Popover,pr as PopoverAnchor,mr as PopoverClose,$ as PopoverContent,dr as PopoverContext,Q as PopoverTrigger,Je as Popup,We as PopupController,en as Portal,ut as PortalContainerContext,ft as PortalContainerProvider,qi as Property,si as RadioGroup,oi as RadioGroupAdapter,ai as RadioGroupItem,di as ResizableHandle,ui as ResizablePanel,ci as ResizablePanelGroup,Hi as RowSkeleton,Rr as SelectBox,Mi as SelectList,yr as SelectionCombobox,fi as Separator,ia as SharedState,xa as SharedValue,Pi as SidePanel,ct as SimpleCombobox,pi as Slider,Yi as Slot,Ki as SortableTableHeaderCell,Li as Spinner,br as StringListCombobox,Ze as StringOptionAdapter,Qe as StringOptionAdapterWithCreate,qt as Styles,Jr as SuccessBox,Me as SvgAvatar,hi as Switch,Ui as TBody,Vi as THead,Wi as TR,Bi as Table,Gi as TableHeaderCell,_i as Tabs,vi as TabsBar,Si as TabsContent,bi as TabsList,yi as TabsPanel,xi as TabsTrigger,zi as TagsInput,wi as Text,Cr as TextCombobox,Ti as Textarea,Di as ThemeProvider,Ei as ThemeProviderContext,Qr as ToastContext,ni as ToastProvider,ht as Tooltip,_t as TooltipContent,mt as TooltipProvider,gt as TooltipTrigger,vt as VTooltip,qr as WarningBox,St as buttonVariants,Ca as cn,ze as computePosition,Ji as createCompositeStateProvider,Ta as errorMessage,$e as getDefaultComboBoxLayout,Ea as insertNewlineAtCursor,Lt as onActivateKey,oa as useClickOutside,it as useComboboxCtrl,Xi as useCompositeState,sa as useCopyToClipboard,ca as useDarkMode,la as useDebounce,ba as useDefaultScrollableSearch,na as useDefineSlot,Nt as useDropZone,da as useEventSource,pa as useFetch,ma as useFetchOnce,ha as useFlag,Zi as useGetCompositeStateProperty,ga as useIntersectionObserver,_a as useIsFirstRendering,Cn as useIsInModal,hr as usePopoverContext,Ke as usePopupController,pt as usePortalContainer,va as useSafeLayoutEffect,ya as useScrollableSearch,Qi as useSetCompositeStateProperty,Sa as useSharedValue,ea as useSlot,Oi as useTheme,Zr as useToast,$i as useWatchCompositeStateProperty,aa as useWatchSharedState,ta as useWatchSlot};
|
|
95
95
|
//# sourceMappingURL=vertesia-ui-core.js.map
|