xertica-ui 2.1.2 → 2.1.4

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.
Files changed (181) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +1 -1
  3. package/bin/cli.ts +1 -1
  4. package/bin/generate-tokens.ts +13 -7
  5. package/components/assistant/xertica-assistant/index.ts +2 -0
  6. package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +97 -0
  7. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -0
  8. package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -0
  9. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +86 -0
  10. package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +77 -0
  11. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +573 -0
  12. package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +65 -0
  13. package/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.tsx +41 -0
  14. package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +98 -0
  15. package/components/assistant/xertica-assistant/parts/index.ts +16 -0
  16. package/components/assistant/xertica-assistant/types.ts +139 -0
  17. package/components/assistant/xertica-assistant/use-assistant.ts +559 -0
  18. package/components/assistant/xertica-assistant/xertica-assistant.stories.tsx +200 -0
  19. package/components/assistant/xertica-assistant/xertica-assistant.tsx +198 -1460
  20. package/components/brand/theme-toggle/ThemeToggle.tsx +8 -27
  21. package/components/hooks/index.ts +3 -0
  22. package/components/hooks/use-layout-shortcuts.ts +46 -0
  23. package/components/layout/sidebar/index.ts +2 -0
  24. package/components/layout/sidebar/sidebar.stories.tsx +160 -8
  25. package/components/layout/sidebar/sidebar.tsx +606 -497
  26. package/components/layout/sidebar/use-sidebar.ts +104 -0
  27. package/components/media/audio-player/AudioPlayer.tsx +131 -206
  28. package/components/media/audio-player/use-audio-player.ts +298 -0
  29. package/components/pages/home-page/HomePage.tsx +1 -1
  30. package/components/pages/template-content/TemplateContent.tsx +5 -5
  31. package/components/pages/template-page/TemplatePage.tsx +5 -5
  32. package/components/shared/CustomTooltipContent.tsx +52 -0
  33. package/components/shared/layout-constants.ts +1 -1
  34. package/components/ui/chart/chart.stories.tsx +966 -7
  35. package/components/ui/chart/chart.tsx +918 -45
  36. package/components/ui/file-upload/file-upload.stories.tsx +100 -0
  37. package/components/ui/file-upload/file-upload.tsx +14 -74
  38. package/components/ui/file-upload/index.ts +1 -0
  39. package/components/ui/file-upload/use-file-upload.ts +181 -0
  40. package/components/ui/pagination/index.ts +2 -0
  41. package/components/ui/pagination/pagination.stories.tsx +94 -0
  42. package/components/ui/pagination/use-pagination.ts +194 -0
  43. package/components/ui/rich-text-editor/index.ts +2 -0
  44. package/components/ui/rich-text-editor/rich-text-editor.stories.tsx +129 -1
  45. package/components/ui/rich-text-editor/rich-text-editor.tsx +86 -305
  46. package/components/ui/rich-text-editor/use-rich-text-editor.ts +439 -0
  47. package/components/ui/stepper/index.ts +3 -1
  48. package/components/ui/stepper/stepper.stories.tsx +116 -0
  49. package/components/ui/stepper/stepper.tsx +4 -4
  50. package/components/ui/stepper/use-stepper.ts +137 -0
  51. package/components/ui/tree-view/index.ts +4 -1
  52. package/components/ui/tree-view/tree-view.stories.tsx +110 -4
  53. package/components/ui/tree-view/tree-view.tsx +17 -125
  54. package/components/ui/tree-view/use-tree-view.ts +229 -0
  55. package/contexts/AssistenteContext.tsx +17 -54
  56. package/contexts/BrandColorsContext.tsx +6 -17
  57. package/contexts/LayoutContext.tsx +5 -31
  58. package/dist/AssistantChart-BAudAfne.cjs +3591 -0
  59. package/dist/AssistantChart-BP8upjMk.js +3565 -0
  60. package/dist/AudioPlayer-1ypwE2Wh.cjs +936 -0
  61. package/dist/AudioPlayer-DuKXrCfy.js +937 -0
  62. package/dist/CustomTooltipContent-DHjkY0ww.js +40 -0
  63. package/dist/CustomTooltipContent-c_K-DWRr.cjs +56 -0
  64. package/dist/LanguageContext-BwhwC3G2.js +657 -0
  65. package/dist/LanguageContext-DvUt5jBg.cjs +656 -0
  66. package/dist/LayoutContext-BDmcZfMH.cjs +84 -0
  67. package/dist/LayoutContext-dbQvdC4O.js +85 -0
  68. package/dist/ThemeContext-RTy1m2Uq.js +82 -0
  69. package/dist/ThemeContext-bSzuOit2.cjs +81 -0
  70. package/dist/VerifyEmailPage-C_ihbcth.js +2828 -0
  71. package/dist/VerifyEmailPage-Dt7zgA4w.cjs +2827 -0
  72. package/dist/XerticaProvider-CW9hpCdF.cjs +39 -0
  73. package/dist/XerticaProvider-siSt9uG2.js +40 -0
  74. package/dist/XerticaXLogo-D8jf0SNv.cjs +214 -0
  75. package/dist/XerticaXLogo-fAJMy3H4.js +215 -0
  76. package/dist/assistant.cjs.js +2 -1
  77. package/dist/assistant.es.js +3 -2
  78. package/dist/brand.cjs.js +2 -2
  79. package/dist/brand.es.js +2 -2
  80. package/dist/cli.js +14 -8
  81. package/dist/components/assistant/xertica-assistant/index.d.ts +2 -0
  82. package/dist/components/assistant/xertica-assistant/parts/AssistantCollapsedView.d.ts +13 -0
  83. package/dist/components/assistant/xertica-assistant/parts/AssistantConversationList.d.ts +16 -0
  84. package/dist/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.d.ts +17 -0
  85. package/dist/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.d.ts +19 -0
  86. package/dist/components/assistant/xertica-assistant/parts/AssistantHeader.d.ts +11 -0
  87. package/dist/components/assistant/xertica-assistant/parts/AssistantMessageBubble.d.ts +29 -0
  88. package/dist/components/assistant/xertica-assistant/parts/AssistantTabBar.d.ts +13 -0
  89. package/dist/components/assistant/xertica-assistant/parts/AssistantTypingIndicator.d.ts +4 -0
  90. package/dist/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.d.ts +17 -0
  91. package/dist/components/assistant/xertica-assistant/parts/index.d.ts +16 -0
  92. package/dist/components/assistant/xertica-assistant/types.d.ts +106 -0
  93. package/dist/components/assistant/xertica-assistant/use-assistant.d.ts +125 -0
  94. package/dist/components/assistant/xertica-assistant/xertica-assistant.d.ts +8 -97
  95. package/dist/components/hooks/index.d.ts +3 -0
  96. package/dist/components/hooks/use-layout-shortcuts.d.ts +22 -0
  97. package/dist/components/layout/sidebar/index.d.ts +2 -0
  98. package/dist/components/layout/sidebar/sidebar.d.ts +80 -0
  99. package/dist/components/layout/sidebar/use-sidebar.d.ts +22 -0
  100. package/dist/components/media/audio-player/AudioPlayer.d.ts +4 -1
  101. package/dist/components/media/audio-player/use-audio-player.d.ts +72 -0
  102. package/dist/components/shared/CustomTooltipContent.d.ts +20 -0
  103. package/dist/components/shared/layout-constants.d.ts +1 -1
  104. package/dist/components/ui/alert/alert.d.ts +1 -1
  105. package/dist/components/ui/badge/badge.d.ts +1 -1
  106. package/dist/components/ui/button/button.d.ts +2 -2
  107. package/dist/components/ui/chart/chart.d.ts +162 -5
  108. package/dist/components/ui/file-upload/file-upload.d.ts +2 -0
  109. package/dist/components/ui/file-upload/index.d.ts +1 -0
  110. package/dist/components/ui/file-upload/use-file-upload.d.ts +49 -0
  111. package/dist/components/ui/pagination/index.d.ts +2 -0
  112. package/dist/components/ui/pagination/use-pagination.d.ts +78 -0
  113. package/dist/components/ui/rich-text-editor/index.d.ts +2 -0
  114. package/dist/components/ui/rich-text-editor/use-rich-text-editor.d.ts +107 -0
  115. package/dist/components/ui/stepper/index.d.ts +3 -1
  116. package/dist/components/ui/stepper/stepper.d.ts +2 -2
  117. package/dist/components/ui/stepper/use-stepper.d.ts +60 -0
  118. package/dist/components/ui/tree-view/index.d.ts +4 -1
  119. package/dist/components/ui/tree-view/tree-view.d.ts +4 -6
  120. package/dist/components/ui/tree-view/use-tree-view.d.ts +60 -0
  121. package/dist/contexts/AssistenteContext.d.ts +10 -49
  122. package/dist/hooks.cjs.js +30 -10
  123. package/dist/hooks.es.js +25 -4
  124. package/dist/index.cjs.js +20 -9
  125. package/dist/index.es.js +38 -27
  126. package/dist/layout.cjs.js +82 -1
  127. package/dist/layout.es.js +83 -2
  128. package/dist/media.cjs.js +1 -1
  129. package/dist/media.es.js +1 -1
  130. package/dist/pages.cjs.js +1 -1
  131. package/dist/pages.es.js +1 -1
  132. package/dist/rich-text-editor-BmsjY03B.js +2949 -0
  133. package/dist/rich-text-editor-GS2kpTAK.cjs +2966 -0
  134. package/dist/sidebar-CVUGHOS_.cjs +756 -0
  135. package/dist/sidebar-CmvwjnVb.js +757 -0
  136. package/dist/ui.cjs.js +12 -2
  137. package/dist/ui.es.js +24 -14
  138. package/dist/use-audio-player-Bkh23vQ3.js +177 -0
  139. package/dist/use-audio-player-Dn1NR9xN.cjs +176 -0
  140. package/dist/utils/color-utils.d.ts +51 -0
  141. package/dist/xertica-assistant-BMqdyRVi.js +2082 -0
  142. package/dist/xertica-assistant-Bj3vBCq_.cjs +2081 -0
  143. package/dist/xertica-ui.css +1 -1
  144. package/docs/ai-usage.md +28 -10
  145. package/docs/architecture-improvements.md +463 -0
  146. package/docs/architecture.md +77 -1
  147. package/docs/components/assistant-chart.md +1 -1
  148. package/docs/components/assistant.md +159 -0
  149. package/docs/components/audio-player.md +46 -0
  150. package/docs/components/branding.md +251 -0
  151. package/docs/components/chart.md +354 -39
  152. package/docs/components/code-block.md +108 -0
  153. package/docs/components/file-upload.md +119 -2
  154. package/docs/components/formatted-document.md +113 -0
  155. package/docs/components/hooks.md +430 -0
  156. package/docs/components/image-with-fallback.md +106 -0
  157. package/docs/components/map-layers.md +140 -0
  158. package/docs/components/modern-chat-input.md +163 -0
  159. package/docs/components/pages.md +351 -0
  160. package/docs/components/pagination.md +187 -0
  161. package/docs/components/rich-text-editor.md +164 -0
  162. package/docs/components/sidebar.md +153 -4
  163. package/docs/components/stepper.md +157 -12
  164. package/docs/components/tree-view.md +164 -6
  165. package/docs/doc-audit.md +223 -0
  166. package/docs/getting-started.md +155 -1
  167. package/docs/guidelines.md +14 -8
  168. package/docs/layout.md +2 -2
  169. package/docs/llms.md +29 -9
  170. package/docs/patterns/detail-page.md +276 -0
  171. package/docs/patterns/settings.md +346 -0
  172. package/docs/patterns/wizard.md +217 -0
  173. package/guidelines/Guidelines.md +5 -3
  174. package/llms.txt +1 -1
  175. package/package.json +10 -10
  176. package/styles/xertica/tokens.css +41 -12
  177. package/templates/CLAUDE.md +16 -6
  178. package/templates/guidelines/Guidelines.md +16 -4
  179. package/templates/package.json +3 -3
  180. package/templates/src/styles/xertica/tokens.css +39 -10
  181. package/utils/color-utils.ts +72 -0
@@ -0,0 +1,937 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect, useRef, useCallback } from "react";
3
+ import { Maximize2, GripHorizontal, X, Play, Pause, VolumeX, Volume2, Maximize, PictureInPicture, Radio, ExternalLink, PauseCircle, PlayCircle, RotateCcw, Info, Gauge, Download, MoreHorizontal, MoreVertical } from "lucide-react";
4
+ import { S as Slider } from "./slider-C0JKA9k3.js";
5
+ import { B as Button, c as cn } from "./button-qkz7Icqf.js";
6
+ import { createPortal } from "react-dom";
7
+ import { b as TooltipProvider, T as Tooltip, c as TooltipTrigger, a as TooltipContent } from "./tooltip-CTyZCD8h.js";
8
+ import { D as DropdownMenu, n as DropdownMenuTrigger, b as DropdownMenuContent, d as DropdownMenuItem, i as DropdownMenuSeparator } from "./dropdown-menu-nc_Lvg-u.js";
9
+ import { u as useAudioPlayer } from "./use-audio-player-Bkh23vQ3.js";
10
+ function FloatingMediaWrapper({
11
+ children,
12
+ isFloating,
13
+ setIsFloating,
14
+ title,
15
+ onClose,
16
+ onCloseMedia,
17
+ aspectRatio = 16 / 9,
18
+ className,
19
+ minWidth = 320,
20
+ minHeight = 110,
21
+ colorVariant = "default",
22
+ playerId = "default",
23
+ enablePadding = false
24
+ }) {
25
+ const [isMounted, setIsMounted] = useState(false);
26
+ useEffect(() => {
27
+ setIsMounted(true);
28
+ return () => setIsMounted(false);
29
+ }, []);
30
+ if (isFloating) {
31
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
32
+ /* @__PURE__ */ jsxs(
33
+ "div",
34
+ {
35
+ className: cn(
36
+ "w-full rounded-[var(--radius-card)] bg-muted/20 border border-dashed border-muted-foreground/20 flex items-center justify-center flex-col gap-2 p-8 text-muted-foreground transition-all",
37
+ className
38
+ ),
39
+ style: { aspectRatio },
40
+ children: [
41
+ /* @__PURE__ */ jsx(Maximize2, { className: "w-8 h-8 opacity-50" }),
42
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Reproduzindo em janela flutuante" }),
43
+ /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: () => setIsFloating(false), children: "Restaurar para a página" })
44
+ ]
45
+ }
46
+ ),
47
+ isMounted && createPortal(
48
+ /* @__PURE__ */ jsx(
49
+ FloatingContainer,
50
+ {
51
+ setIsFloating,
52
+ onClose,
53
+ onCloseMedia,
54
+ title,
55
+ aspectRatio,
56
+ minWidth,
57
+ minHeight,
58
+ colorVariant,
59
+ playerId,
60
+ enablePadding,
61
+ children
62
+ }
63
+ ),
64
+ document.body
65
+ )
66
+ ] });
67
+ }
68
+ return /* @__PURE__ */ jsx("div", { className: cn("relative w-full overflow-hidden rounded-[var(--radius-card)]", className), children });
69
+ }
70
+ function FloatingContainer({
71
+ children,
72
+ setIsFloating,
73
+ onClose,
74
+ onCloseMedia,
75
+ title,
76
+ aspectRatio,
77
+ minWidth,
78
+ minHeight,
79
+ colorVariant,
80
+ playerId = "default",
81
+ enablePadding = false
82
+ }) {
83
+ const minPlayerHeight = minWidth / aspectRatio;
84
+ const containerRef = useRef(null);
85
+ const resizeHandleRef = useRef(null);
86
+ const getInitialState = useCallback(() => {
87
+ var _a;
88
+ const storageKey = `xertica-media-player-${playerId}`;
89
+ const stored = typeof window !== "undefined" ? (_a = window.localStorage) == null ? void 0 : _a.getItem(storageKey) : null;
90
+ if (stored) {
91
+ try {
92
+ return JSON.parse(stored);
93
+ } catch {
94
+ }
95
+ }
96
+ return {
97
+ position: {
98
+ x: typeof window !== "undefined" ? window.innerWidth - minWidth - 24 : 0,
99
+ y: typeof window !== "undefined" ? window.innerHeight - minPlayerHeight - 24 : 0
100
+ },
101
+ size: {
102
+ width: minWidth,
103
+ height: minPlayerHeight
104
+ }
105
+ };
106
+ }, [minWidth, minPlayerHeight, playerId]);
107
+ const [state, setState] = useState(getInitialState);
108
+ const { position, size } = state;
109
+ const [isDragging, setIsDragging] = useState(false);
110
+ const [isResizing, setIsResizing] = useState(false);
111
+ const dragStartPos = useRef({ x: 0, y: 0 });
112
+ const dragStartOffset = useRef({ x: 0, y: 0 });
113
+ const resizeStartState = useRef({ position: { x: 0, y: 0 }, size: { width: 0, height: 0 } });
114
+ const saveState = useCallback((newPosition, newSize) => {
115
+ var _a;
116
+ if (typeof window === "undefined") return;
117
+ const storageKey = `xertica-media-player-${playerId}`;
118
+ (_a = window.localStorage) == null ? void 0 : _a.setItem(storageKey, JSON.stringify({ position: newPosition, size: newSize }));
119
+ }, [playerId]);
120
+ const handleMouseDown = (e) => {
121
+ setIsDragging(true);
122
+ dragStartPos.current = { x: e.clientX, y: e.clientY };
123
+ dragStartOffset.current = { x: position.x, y: position.y };
124
+ };
125
+ const handleResizeStart = (e, direction) => {
126
+ e.stopPropagation();
127
+ setIsResizing(true);
128
+ resizeHandleRef.current = direction;
129
+ dragStartPos.current = { x: e.clientX, y: e.clientY };
130
+ resizeStartState.current = { position: { ...position }, size: { ...size } };
131
+ };
132
+ const handleMouseMove = useCallback((e) => {
133
+ if (isDragging) {
134
+ const deltaX = e.clientX - dragStartPos.current.x;
135
+ const deltaY = e.clientY - dragStartPos.current.y;
136
+ const newPos = {
137
+ x: dragStartOffset.current.x + deltaX,
138
+ y: dragStartOffset.current.y + deltaY
139
+ };
140
+ setState((prev) => ({ ...prev, position: newPos }));
141
+ saveState(newPos, state.size);
142
+ }
143
+ if (isResizing && resizeHandleRef.current) {
144
+ const deltaX = e.clientX - dragStartPos.current.x;
145
+ const deltaY = e.clientY - dragStartPos.current.y;
146
+ const direction = resizeHandleRef.current;
147
+ let newPos = { ...resizeStartState.current.position };
148
+ let newSize = { ...resizeStartState.current.size };
149
+ if (direction.includes("right")) {
150
+ newSize.width = Math.max(minWidth, resizeStartState.current.size.width + deltaX);
151
+ }
152
+ if (direction.includes("left")) {
153
+ const newW = Math.max(minWidth, resizeStartState.current.size.width - deltaX);
154
+ newPos.x = resizeStartState.current.position.x + (resizeStartState.current.size.width - newW);
155
+ newSize.width = newW;
156
+ }
157
+ if (direction.includes("bottom")) {
158
+ newSize.height = Math.max(minHeight, resizeStartState.current.size.height + deltaY);
159
+ }
160
+ if (direction.includes("top")) {
161
+ const newH = Math.max(minHeight, resizeStartState.current.size.height - deltaY);
162
+ newPos.y = resizeStartState.current.position.y + (resizeStartState.current.size.height - newH);
163
+ newSize.height = newH;
164
+ }
165
+ setState({ position: newPos, size: newSize });
166
+ saveState(newPos, newSize);
167
+ }
168
+ }, [isDragging, isResizing, state.size, minWidth, minHeight, saveState]);
169
+ const handleMouseUp = useCallback(() => {
170
+ setIsDragging(false);
171
+ setIsResizing(false);
172
+ resizeHandleRef.current = null;
173
+ }, []);
174
+ useEffect(() => {
175
+ if (!isDragging && !isResizing) return;
176
+ document.addEventListener("mousemove", handleMouseMove);
177
+ document.addEventListener("mouseup", handleMouseUp);
178
+ return () => {
179
+ document.removeEventListener("mousemove", handleMouseMove);
180
+ document.removeEventListener("mouseup", handleMouseUp);
181
+ };
182
+ }, [isDragging, isResizing, handleMouseMove, handleMouseUp]);
183
+ return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 pointer-events-none z-50 overflow-hidden", children: /* @__PURE__ */ jsx(
184
+ "div",
185
+ {
186
+ ref: containerRef,
187
+ className: "pointer-events-auto absolute",
188
+ style: {
189
+ transform: `translate(${position.x}px, ${position.y}px)`,
190
+ width: size.width,
191
+ height: size.height
192
+ },
193
+ role: "dialog",
194
+ "aria-label": title || "Reproduzindo Mídia",
195
+ children: /* @__PURE__ */ jsxs("div", { className: cn(
196
+ "shadow-2xl rounded-[var(--radius-card)] overflow-hidden border backdrop-blur-sm",
197
+ colorVariant === "primary" ? "bg-primary border-primary-foreground/20 text-primary-foreground" : "border-border bg-card/95 text-card-foreground"
198
+ ), children: [
199
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full w-full", children: [
200
+ /* @__PURE__ */ jsxs(
201
+ "div",
202
+ {
203
+ className: cn(
204
+ "h-9 backdrop-blur-sm border-b flex items-center justify-between px-2 cursor-move select-none",
205
+ colorVariant === "primary" ? "bg-primary-foreground/10 border-primary-foreground/10" : "bg-muted/20 border-border/40"
206
+ ),
207
+ onMouseDown: handleMouseDown,
208
+ style: { touchAction: "none", userSelect: "none" },
209
+ children: [
210
+ /* @__PURE__ */ jsxs("div", { className: cn(
211
+ "flex items-center gap-2 text-[10px] uppercase tracking-wider font-bold truncate flex-1",
212
+ colorVariant === "primary" ? "text-primary-foreground" : "text-muted-foreground"
213
+ ), children: [
214
+ /* @__PURE__ */ jsx(GripHorizontal, { className: "w-3.5 h-3.5" }),
215
+ /* @__PURE__ */ jsx("span", { className: "truncate max-w-[150px]", children: title || "Reproduzindo Mídia" })
216
+ ] }),
217
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx(
218
+ Button,
219
+ {
220
+ variant: "ghost",
221
+ size: "icon",
222
+ className: cn(
223
+ "h-7 w-7 rounded-full transition-colors",
224
+ colorVariant === "primary" ? "text-primary-foreground/70 hover:bg-destructive/20 hover:text-destructive-foreground" : "text-muted-foreground hover:bg-destructive/10 hover:text-destructive"
225
+ ),
226
+ onClick: onCloseMedia || onClose,
227
+ title: "Fechar",
228
+ "aria-label": "Fechar player",
229
+ children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
230
+ }
231
+ ) })
232
+ ]
233
+ }
234
+ ),
235
+ /* @__PURE__ */ jsx("div", { className: cn("flex-1 relative overflow-hidden group", enablePadding && "p-2", colorVariant === "primary" ? "bg-primary" : "bg-card"), children })
236
+ ] }),
237
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute top-0 left-0 w-2 h-full cursor-ew-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "left") }),
238
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute top-0 right-0 w-2 h-full cursor-ew-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "right") }),
239
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute top-0 left-0 w-full h-2 cursor-ns-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "top") }),
240
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute bottom-0 left-0 w-full h-2 cursor-ns-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "bottom") }),
241
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute top-0 left-0 w-4 h-4 cursor-nwse-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "top-left") }),
242
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute top-0 right-0 w-4 h-4 cursor-nesw-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "top-right") }),
243
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute bottom-0 left-0 w-4 h-4 cursor-nesw-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "bottom-left") }),
244
+ /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize hover:bg-primary/20 transition-colors", onMouseDown: (e) => handleResizeStart(e, "bottom-right") })
245
+ ] })
246
+ }
247
+ ) });
248
+ }
249
+ function VideoPlayer({
250
+ src,
251
+ poster,
252
+ title = "Untitled Video",
253
+ autoPlay = false,
254
+ enableAutoFloat = true,
255
+ className
256
+ }) {
257
+ const videoRef = useRef(null);
258
+ const containerRef = useRef(null);
259
+ const [isPlaying, setIsPlaying] = useState(false);
260
+ const [progress, setProgress] = useState(0);
261
+ const [volume, setVolume] = useState(1);
262
+ const [isMuted, setIsMuted] = useState(false);
263
+ const [currentTime, setCurrentTime] = useState(0);
264
+ const [duration, setDuration] = useState(0);
265
+ const [isFloating, setIsFloating] = useState(false);
266
+ const [isManualFloating, setIsManualFloating] = useState(false);
267
+ const [showControls, setShowControls] = useState(true);
268
+ const [enableAutoFloatLocal, setEnableAutoFloatLocal] = useState(enableAutoFloat);
269
+ let controlsTimeout;
270
+ const handleSetFloating = (floating) => {
271
+ if (videoRef.current) {
272
+ setCurrentTime(videoRef.current.currentTime);
273
+ }
274
+ setIsFloating(floating);
275
+ if (!floating) {
276
+ setIsManualFloating(false);
277
+ }
278
+ };
279
+ useEffect(() => {
280
+ const video = videoRef.current;
281
+ if (video) {
282
+ if (Math.abs(video.currentTime - currentTime) > 0.5) {
283
+ video.currentTime = currentTime;
284
+ }
285
+ if (isPlaying) {
286
+ const playPromise = video.play();
287
+ if (playPromise !== void 0) {
288
+ playPromise.catch((error) => {
289
+ console.log("Playback interrupted during switch:", error);
290
+ });
291
+ }
292
+ }
293
+ }
294
+ }, [isFloating]);
295
+ useEffect(() => {
296
+ const container = containerRef.current;
297
+ if (!container || !enableAutoFloatLocal) return;
298
+ const observer = new IntersectionObserver(
299
+ (entries) => {
300
+ const entry = entries[0];
301
+ if (!entry) return;
302
+ if (isPlaying && !entry.isIntersecting && !isFloating) {
303
+ if (videoRef.current) setCurrentTime(videoRef.current.currentTime);
304
+ setIsFloating(true);
305
+ } else if (entry.isIntersecting && isFloating && !isManualFloating) {
306
+ if (videoRef.current) setCurrentTime(videoRef.current.currentTime);
307
+ handleSetFloating(false);
308
+ }
309
+ },
310
+ { threshold: 0.2 }
311
+ );
312
+ observer.observe(container);
313
+ return () => observer.disconnect();
314
+ }, [isPlaying, isFloating, isManualFloating, enableAutoFloatLocal]);
315
+ useEffect(() => {
316
+ const video = videoRef.current;
317
+ if (!video) return;
318
+ const updateTime = () => {
319
+ setCurrentTime(video.currentTime);
320
+ };
321
+ const updateDuration = () => setDuration(video.duration);
322
+ const onPlay = () => setIsPlaying(true);
323
+ const onPause = () => setIsPlaying(false);
324
+ video.addEventListener("timeupdate", updateTime);
325
+ video.addEventListener("loadedmetadata", updateDuration);
326
+ video.addEventListener("play", onPlay);
327
+ video.addEventListener("pause", onPause);
328
+ video.volume = volume;
329
+ video.muted = isMuted;
330
+ return () => {
331
+ video.removeEventListener("timeupdate", updateTime);
332
+ video.removeEventListener("loadedmetadata", updateDuration);
333
+ video.removeEventListener("play", onPlay);
334
+ video.removeEventListener("pause", onPause);
335
+ };
336
+ }, [isFloating]);
337
+ const togglePlay = () => {
338
+ if (videoRef.current) {
339
+ if (isPlaying) {
340
+ videoRef.current.pause();
341
+ } else {
342
+ videoRef.current.play();
343
+ }
344
+ }
345
+ };
346
+ const handleSeek = (value) => {
347
+ if (videoRef.current) {
348
+ videoRef.current.currentTime = value[0];
349
+ setCurrentTime(value[0]);
350
+ }
351
+ };
352
+ const handleVolumeChange = (value) => {
353
+ const newVolume = value[0];
354
+ if (videoRef.current) {
355
+ videoRef.current.volume = newVolume;
356
+ setVolume(newVolume);
357
+ setIsMuted(newVolume === 0);
358
+ }
359
+ };
360
+ const toggleMute = () => {
361
+ if (videoRef.current) {
362
+ const newMutedState = !isMuted;
363
+ videoRef.current.muted = newMutedState;
364
+ setIsMuted(newMutedState);
365
+ if (newMutedState) {
366
+ setVolume(0);
367
+ } else {
368
+ setVolume(1);
369
+ videoRef.current.volume = 1;
370
+ }
371
+ }
372
+ };
373
+ const handleMouseMove = () => {
374
+ setShowControls(true);
375
+ clearTimeout(controlsTimeout);
376
+ controlsTimeout = setTimeout(() => {
377
+ if (isPlaying) setShowControls(false);
378
+ }, 2500);
379
+ };
380
+ const formatTime = (time) => {
381
+ const minutes = Math.floor(time / 60);
382
+ const seconds = Math.floor(time % 60);
383
+ return `${minutes}:${seconds < 10 ? "0" : ""}${seconds}`;
384
+ };
385
+ return /* @__PURE__ */ jsx("div", { ref: containerRef, className, children: /* @__PURE__ */ jsx(
386
+ FloatingMediaWrapper,
387
+ {
388
+ isFloating,
389
+ setIsFloating: handleSetFloating,
390
+ onClose: () => handleSetFloating(false),
391
+ onCloseMedia: () => {
392
+ setIsFloating(false);
393
+ setEnableAutoFloatLocal(false);
394
+ },
395
+ title,
396
+ aspectRatio: 16 / 9,
397
+ className: "w-full h-full",
398
+ playerId: "video-player",
399
+ children: /* @__PURE__ */ jsxs(
400
+ "div",
401
+ {
402
+ className: "relative w-full h-full bg-black group overflow-hidden",
403
+ onMouseMove: handleMouseMove,
404
+ onMouseLeave: () => isPlaying && setShowControls(false),
405
+ children: [
406
+ /* @__PURE__ */ jsx(
407
+ "video",
408
+ {
409
+ ref: videoRef,
410
+ src,
411
+ poster,
412
+ className: "w-full h-full object-contain",
413
+ onClick: togglePlay,
414
+ autoPlay,
415
+ title: title || "Vídeo"
416
+ }
417
+ ),
418
+ !isPlaying && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none", children: /* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-black/40 backdrop-blur-sm flex items-center justify-center border border-white/20 shadow-2xl", children: /* @__PURE__ */ jsx(Play, { className: "w-8 h-8 text-white ml-1", fill: "white" }) }) }),
419
+ /* @__PURE__ */ jsxs(
420
+ "div",
421
+ {
422
+ className: cn(
423
+ "absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 via-black/30 to-transparent pt-12 pb-4 px-4 transition-opacity duration-300",
424
+ showControls ? "opacity-100" : "opacity-0"
425
+ ),
426
+ children: [
427
+ /* @__PURE__ */ jsx("div", { className: "mb-4 group/slider", children: /* @__PURE__ */ jsx(
428
+ Slider,
429
+ {
430
+ value: [currentTime],
431
+ max: duration || 100,
432
+ step: 1,
433
+ onValueChange: handleSeek,
434
+ className: "cursor-pointer [&_[data-slot=slider-track]]:bg-white/30 [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:bg-white [&_[data-slot=slider-thumb]]:border-white",
435
+ "aria-label": "Progresso do vídeo"
436
+ }
437
+ ) }),
438
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
439
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
440
+ /* @__PURE__ */ jsx(
441
+ Button,
442
+ {
443
+ variant: "ghost",
444
+ size: "icon",
445
+ className: "text-white hover:text-white hover:bg-black/50 h-8 w-8",
446
+ onClick: togglePlay,
447
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
448
+ children: isPlaying ? /* @__PURE__ */ jsx(Pause, { className: "w-5 h-5", fill: "currentColor" }) : /* @__PURE__ */ jsx(Play, { className: "w-5 h-5", fill: "currentColor" })
449
+ }
450
+ ),
451
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 group/vol", children: [
452
+ /* @__PURE__ */ jsx(
453
+ Button,
454
+ {
455
+ variant: "ghost",
456
+ size: "icon",
457
+ className: "text-white hover:text-white hover:bg-black/50 h-8 w-8",
458
+ onClick: toggleMute,
459
+ "aria-label": isMuted || volume === 0 ? "Ativar som" : "Desativar som",
460
+ children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-5 h-5" })
461
+ }
462
+ ),
463
+ /* @__PURE__ */ jsx("div", { className: "w-0 overflow-hidden group-hover/vol:w-20 transition-all duration-300", children: /* @__PURE__ */ jsx(
464
+ Slider,
465
+ {
466
+ value: [isMuted ? 0 : volume],
467
+ max: 1,
468
+ step: 0.01,
469
+ onValueChange: handleVolumeChange,
470
+ className: "w-20 [&_[data-slot=slider-track]]:bg-white/30 [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:bg-white [&_[data-slot=slider-thumb]]:border-white",
471
+ "aria-label": "Volume"
472
+ }
473
+ ) })
474
+ ] }),
475
+ /* @__PURE__ */ jsxs("div", { className: "text-white text-xs font-medium tabular-nums select-none drop-shadow-md", children: [
476
+ formatTime(currentTime),
477
+ " / ",
478
+ formatTime(duration)
479
+ ] })
480
+ ] }),
481
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
482
+ Button,
483
+ {
484
+ variant: "ghost",
485
+ size: "icon",
486
+ className: "text-white hover:text-white hover:bg-black/50 h-8 w-8",
487
+ onClick: () => {
488
+ setEnableAutoFloatLocal(true);
489
+ if (!isFloating) setIsManualFloating(true);
490
+ handleSetFloating(!isFloating);
491
+ },
492
+ title: isFloating ? "Restaurar" : "Pop-out Player",
493
+ "aria-label": isFloating ? "Restaurar" : "Pop-out Player",
494
+ children: isFloating ? /* @__PURE__ */ jsx(Maximize, { className: "w-4 h-4" }) : /* @__PURE__ */ jsx(PictureInPicture, { className: "w-4 h-4" })
495
+ }
496
+ ) })
497
+ ] })
498
+ ]
499
+ }
500
+ )
501
+ ]
502
+ }
503
+ )
504
+ }
505
+ ) });
506
+ }
507
+ function AudioPlayer({
508
+ src,
509
+ title = "Áudio",
510
+ artist,
511
+ subtitle,
512
+ autoPlay = false,
513
+ className,
514
+ variant = "card",
515
+ isOpen = true,
516
+ onClose,
517
+ duration: initialDuration,
518
+ currentTime: initialTime = 0,
519
+ colorVariant = "default",
520
+ enableAutoFloat = true,
521
+ onCloseFloating
522
+ }) {
523
+ const {
524
+ audioRef,
525
+ containerRef,
526
+ isPlaying,
527
+ currentTime,
528
+ duration,
529
+ volume,
530
+ isMuted,
531
+ playbackSpeed,
532
+ isFloating,
533
+ isManualFloating,
534
+ isVisible,
535
+ isMobile,
536
+ enableAutoFloatLocal,
537
+ sidebarExpanded,
538
+ sidebarWidth,
539
+ assistenteExpanded,
540
+ togglePlay,
541
+ toggleMute,
542
+ handleSeek,
543
+ handleVolumeChange,
544
+ handleSetFloating,
545
+ handleEnableManualFloat,
546
+ setPlaybackSpeed,
547
+ resetAudio,
548
+ formatTime,
549
+ onPlay,
550
+ onPause,
551
+ onEnded,
552
+ onTimeUpdate,
553
+ onLoadedMetadata
554
+ } = useAudioPlayer({
555
+ src,
556
+ autoPlay,
557
+ initialTime,
558
+ initialDuration,
559
+ variant,
560
+ isOpen,
561
+ enableAutoFloat,
562
+ onCloseFloating
563
+ });
564
+ const audioElement = /* @__PURE__ */ jsx(
565
+ "audio",
566
+ {
567
+ ref: audioRef,
568
+ src,
569
+ autoPlay,
570
+ className: "hidden",
571
+ onTimeUpdate,
572
+ onLoadedMetadata,
573
+ onPlay,
574
+ onPause,
575
+ onEnded
576
+ }
577
+ );
578
+ const desktopLayout = /* @__PURE__ */ jsxs("div", { className: cn("px-6 flex items-center justify-between gap-4", colorVariant === "primary" ? "h-[80px] gap-6" : "h-[80px]"), children: [
579
+ /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col min-w-0 shrink-0 relative z-10", colorVariant === "primary" ? "w-[280px]" : "w-[280px]"), children: [
580
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-0.5", children: [
581
+ colorVariant === "primary" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-[var(--chart-4)] animate-pulse shrink-0" }) : /* @__PURE__ */ jsx(Radio, { className: "w-3 h-3 text-[var(--chart-4)] animate-pulse shrink-0" }),
582
+ /* @__PURE__ */ jsx("h4", { className: cn("truncate", colorVariant === "primary" ? "font-semibold text-base tracking-tight" : "font-medium text-base"), title, children: title })
583
+ ] }),
584
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-1 text-xs text-muted-foreground", colorVariant === "primary" && "opacity-80"), children: [
585
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle || artist }),
586
+ /* @__PURE__ */ jsx(ExternalLink, { className: cn("w-3 h-3 cursor-pointer hover:text-foreground ml-1 transition-opacity", colorVariant === "primary" ? "opacity-60 hover:opacity-100" : "opacity-70 hover:opacity-100") })
587
+ ] })
588
+ ] }),
589
+ /* @__PURE__ */ jsxs("div", { className: cn("flex-1 flex items-center justify-center gap-4 min-w-0 max-w-xl relative z-10", colorVariant === "primary" && "gap-4"), children: [
590
+ /* @__PURE__ */ jsx(
591
+ "button",
592
+ {
593
+ onClick: togglePlay,
594
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
595
+ className: cn("transition-all focus:outline-none shrink-0", colorVariant === "primary" ? "hover:scale-110" : "text-muted-foreground hover:text-foreground hover:scale-110 active:scale-95 transform duration-100"),
596
+ children: isPlaying ? /* @__PURE__ */ jsx(PauseCircle, { className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"), strokeWidth: colorVariant === "primary" ? 1 : 1.5 }) : /* @__PURE__ */ jsx(PlayCircle, { className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"), strokeWidth: colorVariant === "primary" ? 1 : 1.5 })
597
+ }
598
+ ),
599
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 flex items-center gap-3 max-w-lg", children: [
600
+ /* @__PURE__ */ jsx("span", { className: cn("text-xs font-mono shrink-0 w-10 text-right", colorVariant === "primary" ? "text-[11px] w-12 opacity-80" : "text-muted-foreground"), children: formatTime(currentTime) }),
601
+ /* @__PURE__ */ jsx(
602
+ Slider,
603
+ {
604
+ value: [currentTime],
605
+ max: duration || 100,
606
+ onValueChange: handleSeek,
607
+ className: "cursor-pointer"
608
+ }
609
+ ),
610
+ /* @__PURE__ */ jsx("span", { className: cn("text-xs font-mono shrink-0 w-10", colorVariant === "primary" ? "text-[11px] w-12 opacity-80" : "text-muted-foreground"), children: formatTime(duration) })
611
+ ] })
612
+ ] }),
613
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0 relative z-10", children: [
614
+ /* @__PURE__ */ jsxs("div", { className: "hidden lg:flex items-center gap-2 w-28 mr-2 group", children: [
615
+ /* @__PURE__ */ jsx(
616
+ "button",
617
+ {
618
+ onClick: toggleMute,
619
+ className: "text-muted-foreground hover:text-foreground",
620
+ "aria-label": isMuted || volume === 0 ? "Ativar som" : "Desativar som",
621
+ children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-5 h-5" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-5 h-5" })
622
+ }
623
+ ),
624
+ /* @__PURE__ */ jsx(
625
+ Slider,
626
+ {
627
+ value: [isMuted ? 0 : volume * 100],
628
+ max: 100,
629
+ onValueChange: (val) => handleVolumeChange([val[0] / 100]),
630
+ className: "w-full opacity-60 group-hover:opacity-100 transition-opacity"
631
+ }
632
+ )
633
+ ] }),
634
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
635
+ /* @__PURE__ */ jsxs("div", { className: "hidden md:flex", children: [
636
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
637
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "rounded-full h-9 w-9", onClick: resetAudio, "aria-label": "Recomecar audio", children: /* @__PURE__ */ jsx(RotateCcw, { className: "w-4 h-4" }) }) }),
638
+ /* @__PURE__ */ jsx(TooltipContent, { className: "z-[1001]", children: "Recomeçar" })
639
+ ] }) }),
640
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
641
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "text-[var(--chart-3)] hover:bg-accent rounded-full h-9 w-9", "aria-label": "Informacoes do audio", children: /* @__PURE__ */ jsx(Info, { className: "w-4 h-4 fill-current" }) }) }),
642
+ /* @__PURE__ */ jsx(TooltipContent, { className: "z-[1001]", children: "Informações" })
643
+ ] }) })
644
+ ] }),
645
+ /* @__PURE__ */ jsxs("div", { className: "hidden xl:flex items-center gap-1", children: [
646
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
647
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "rounded-full h-9 w-9", "aria-label": "Selecionar velocidade", children: /* @__PURE__ */ jsx(Gauge, { className: "w-4 h-4" }) }) }),
648
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "center", className: "w-32 z-[1001]", children: [0.5, 1, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs(
649
+ DropdownMenuItem,
650
+ {
651
+ onClick: () => setPlaybackSpeed(speed),
652
+ className: cn("cursor-pointer", playbackSpeed === speed && "bg-accent font-bold"),
653
+ children: [
654
+ speed,
655
+ "x"
656
+ ]
657
+ },
658
+ speed
659
+ )) })
660
+ ] }),
661
+ /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
662
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "rounded-full h-9 w-9", "aria-label": "Baixar audio", children: /* @__PURE__ */ jsx(Download, { className: "w-4 h-4" }) }) }),
663
+ /* @__PURE__ */ jsx(TooltipContent, { className: "z-[1001]", children: "Baixar Áudio" })
664
+ ] }) })
665
+ ] }),
666
+ /* @__PURE__ */ jsx("div", { className: "xl:hidden", children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
667
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "rounded-full h-9 w-9", "aria-label": "Mais opcoes", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "w-5 h-5" }) }) }),
668
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 p-2 z-[1001]", children: [
669
+ /* @__PURE__ */ jsxs("div", { className: "lg:hidden", children: [
670
+ /* @__PURE__ */ jsxs("div", { className: "px-2 py-3", children: [
671
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-3 px-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
672
+ isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-4 h-4 text-muted-foreground" }),
673
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70", children: "Volume" })
674
+ ] }) }),
675
+ /* @__PURE__ */ jsx(Slider, { value: [isMuted ? 0 : volume * 100], max: 100, onValueChange: (val) => handleVolumeChange([val[0] / 100]) })
676
+ ] }),
677
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1" })
678
+ ] }),
679
+ /* @__PURE__ */ jsxs("div", { className: "md:hidden", children: [
680
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: resetAudio, className: "cursor-pointer py-2.5", children: [
681
+ /* @__PURE__ */ jsx(RotateCcw, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
682
+ " Recomeçar"
683
+ ] }),
684
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "cursor-pointer py-2.5", children: [
685
+ /* @__PURE__ */ jsx(Info, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
686
+ " Informações"
687
+ ] }),
688
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1" })
689
+ ] }),
690
+ /* @__PURE__ */ jsxs("div", { className: "xl:hidden", children: [
691
+ /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 flex flex-col gap-2", children: [
692
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
693
+ /* @__PURE__ */ jsx(Gauge, { className: "w-4 h-4 text-muted-foreground" }),
694
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Velocidade" })
695
+ ] }),
696
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: [0.5, 1, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs(
697
+ "button",
698
+ {
699
+ onClick: () => setPlaybackSpeed(speed),
700
+ className: cn(
701
+ "px-2 py-0.5 text-[10px] rounded border transition-colors",
702
+ playbackSpeed === speed ? "bg-primary text-primary-foreground border-primary" : "bg-transparent border-border hover:bg-accent"
703
+ ),
704
+ children: [
705
+ speed,
706
+ "x"
707
+ ]
708
+ },
709
+ speed
710
+ )) })
711
+ ] }),
712
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-1" }),
713
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "cursor-pointer py-2.5", children: [
714
+ /* @__PURE__ */ jsx(Download, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
715
+ " Baixar Áudio"
716
+ ] })
717
+ ] })
718
+ ] })
719
+ ] }) }),
720
+ /* @__PURE__ */ jsx("div", { className: "w-px h-8 bg-border mx-1" }),
721
+ /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "ghost", size: "icon", className: "rounded-full h-9 w-9", "aria-label": "Fechar player", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
722
+ ] })
723
+ ] })
724
+ ] });
725
+ const mobileLayout = /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col py-3 px-4 gap-3", colorVariant === "primary" && "py-4 px-5 gap-4"), children: [
726
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
727
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0 flex-1", children: [
728
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
729
+ colorVariant === "primary" ? /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-[var(--chart-4)] animate-pulse shrink-0" }) : /* @__PURE__ */ jsx(Radio, { className: "w-3 h-3 text-[var(--chart-4)] animate-pulse shrink-0" }),
730
+ /* @__PURE__ */ jsx("h4", { className: cn("truncate", colorVariant === "primary" ? "font-semibold text-sm tracking-tight" : "font-medium text-sm"), children: title })
731
+ ] }),
732
+ /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-1.5 text-xs text-muted-foreground", colorVariant === "primary" && "opacity-70"), children: /* @__PURE__ */ jsx("span", { className: "truncate", children: subtitle || artist }) })
733
+ ] }),
734
+ /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "ghost", size: "icon", className: "rounded-full h-8 w-8 shrink-0", "aria-label": "Fechar player", children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" }) })
735
+ ] }),
736
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
737
+ /* @__PURE__ */ jsx("button", { onClick: togglePlay, "aria-label": isPlaying ? "Pausar" : "Reproduzir", className: "shrink-0 transition-transform active:scale-95", children: isPlaying ? /* @__PURE__ */ jsx(PauseCircle, { className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"), strokeWidth: colorVariant === "primary" ? 1 : 1.5 }) : /* @__PURE__ */ jsx(PlayCircle, { className: cn(colorVariant === "primary" ? "w-12 h-12" : "w-10 h-10"), strokeWidth: colorVariant === "primary" ? 1 : 1.5 }) }),
738
+ /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center gap-2", children: /* @__PURE__ */ jsx(
739
+ Slider,
740
+ {
741
+ value: [currentTime],
742
+ max: duration || 100,
743
+ onValueChange: handleSeek,
744
+ className: "cursor-pointer",
745
+ "aria-label": "Progresso da reprodução"
746
+ }
747
+ ) }),
748
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
749
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-9 w-9 rounded-full", "aria-label": "Mais opcoes", children: /* @__PURE__ */ jsx(MoreVertical, { className: "w-5 h-5" }) }) }),
750
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 p-2 z-[1001]", children: [
751
+ /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: resetAudio, children: "Recomeçar" }),
752
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
753
+ "Velocidade (",
754
+ playbackSpeed,
755
+ "x)"
756
+ ] })
757
+ ] })
758
+ ] })
759
+ ] })
760
+ ] });
761
+ const desktopLayoutCompact = /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 w-full", isFloating ? "px-3 py-1 text-foreground" : "px-4 py-3"), children: [
762
+ /* @__PURE__ */ jsx(
763
+ Button,
764
+ {
765
+ onClick: togglePlay,
766
+ size: "icon",
767
+ variant: "outline",
768
+ className: cn(
769
+ "shrink-0 rounded-full border-border text-foreground hover:bg-accent transition-colors",
770
+ colorVariant === "primary" && "border-primary-foreground/20 hover:bg-primary-foreground/10 text-primary-foreground",
771
+ isFloating ? "h-8 w-8" : "h-10 w-10"
772
+ ),
773
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
774
+ children: isPlaying ? /* @__PURE__ */ jsx(Pause, { className: cn(isFloating ? "w-3 h-3" : "w-4 h-4", "fill-current") }) : /* @__PURE__ */ jsx(Play, { className: cn(isFloating ? "w-3 h-3" : "w-4 h-4", "fill-current ml-0.5") })
775
+ }
776
+ ),
777
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 flex flex-col justify-center gap-1.5", children: [
778
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs leading-none", children: [
779
+ /* @__PURE__ */ jsx("span", { className: cn("font-medium truncate", colorVariant === "primary" ? "text-primary-foreground" : "text-foreground"), children: title }),
780
+ /* @__PURE__ */ jsxs("span", { className: cn("font-medium tabular-nums text-[10px] sm:text-xs", colorVariant === "primary" ? "text-primary-foreground/70" : "text-muted-foreground"), children: [
781
+ formatTime(currentTime),
782
+ " / ",
783
+ formatTime(duration)
784
+ ] })
785
+ ] }),
786
+ /* @__PURE__ */ jsx(
787
+ Slider,
788
+ {
789
+ value: [currentTime],
790
+ max: duration || 100,
791
+ step: 1,
792
+ onValueChange: handleSeek,
793
+ className: "w-full",
794
+ "aria-label": "Progresso da reprodução"
795
+ }
796
+ )
797
+ ] }),
798
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
799
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
800
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
801
+ Button,
802
+ {
803
+ variant: "ghost",
804
+ size: "icon",
805
+ className: cn(
806
+ "rounded-full",
807
+ colorVariant === "primary" ? "text-primary-foreground/80 hover:text-primary-foreground hover:bg-primary-foreground/10" : "text-muted-foreground hover:text-foreground",
808
+ isFloating ? "h-7 w-7" : "h-8 w-8"
809
+ ),
810
+ "aria-label": "Mais opções",
811
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: isFloating ? "w-4 h-4" : "w-5 h-5" })
812
+ }
813
+ ) }),
814
+ /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-56 p-2 z-[1001]", children: [
815
+ /* @__PURE__ */ jsxs("div", { className: "px-2 py-3", children: [
816
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mb-3 px-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
817
+ isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "w-4 h-4 text-muted-foreground" }) : /* @__PURE__ */ jsx(Volume2, { className: "w-4 h-4 text-muted-foreground" }),
818
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70", children: "Volume" })
819
+ ] }) }),
820
+ /* @__PURE__ */ jsx(
821
+ Slider,
822
+ {
823
+ value: [isMuted ? 0 : volume * 100],
824
+ max: 100,
825
+ onValueChange: (val) => handleVolumeChange([val[0] / 100]),
826
+ "aria-label": "Volume"
827
+ }
828
+ )
829
+ ] }),
830
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-2" }),
831
+ /* @__PURE__ */ jsxs("div", { className: "px-2 py-1 flex flex-col gap-2", children: [
832
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
833
+ /* @__PURE__ */ jsx(Gauge, { className: "w-4 h-4 text-muted-foreground" }),
834
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Velocidade" })
835
+ ] }),
836
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: [0.5, 1, 1.5, 2].map((speed) => /* @__PURE__ */ jsxs(
837
+ "button",
838
+ {
839
+ onClick: () => setPlaybackSpeed(speed),
840
+ className: cn(
841
+ "px-2 py-1 text-[10px] rounded border transition-colors",
842
+ playbackSpeed === speed ? "bg-primary text-primary-foreground border-primary" : "bg-transparent border-border hover:bg-accent"
843
+ ),
844
+ children: [
845
+ speed,
846
+ "x"
847
+ ]
848
+ },
849
+ speed
850
+ )) })
851
+ ] }),
852
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "my-2" }),
853
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: resetAudio, className: "cursor-pointer py-2.5", children: [
854
+ /* @__PURE__ */ jsx(RotateCcw, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
855
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Recomeçar áudio" })
856
+ ] }),
857
+ /* @__PURE__ */ jsxs(DropdownMenuItem, { className: "cursor-pointer py-2.5", children: [
858
+ /* @__PURE__ */ jsx(Download, { className: "w-4 h-4 mr-3 text-muted-foreground" }),
859
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Baixar arquivo" })
860
+ ] })
861
+ ] })
862
+ ] }),
863
+ !isFloating && /* @__PURE__ */ jsx(
864
+ Button,
865
+ {
866
+ variant: "ghost",
867
+ size: "icon",
868
+ className: cn(
869
+ "h-8 w-8",
870
+ colorVariant === "primary" ? "text-primary-foreground/80 hover:text-primary-foreground hover:bg-primary-foreground/10" : "text-muted-foreground hover:text-foreground"
871
+ ),
872
+ onClick: handleEnableManualFloat,
873
+ title: "Modo Flutuante",
874
+ "aria-label": "Abrir modo flutuante",
875
+ children: /* @__PURE__ */ jsx(Maximize2, { className: "w-4 h-4" })
876
+ }
877
+ )
878
+ ] })
879
+ ] });
880
+ if (!isVisible) return null;
881
+ if (variant === "bar" && isVisible && typeof document !== "undefined") {
882
+ return createPortal(
883
+ /* @__PURE__ */ jsxs(
884
+ "div",
885
+ {
886
+ className: cn(
887
+ "fixed bottom-0 z-[100] border-t transition-all duration-300 ease-in-out",
888
+ colorVariant === "primary" ? "bg-primary/95 text-primary-foreground border-primary/20 backdrop-blur-sm [&_.text-muted-foreground]:text-primary-foreground/70 [&_.text-foreground]:text-primary-foreground [&_button]:text-primary-foreground [&_[data-slot=slider-track]]:bg-primary-foreground/30 [&_[data-slot=slider-range]]:bg-primary-foreground [&_[data-slot=slider-thumb]]:border-primary-foreground [&_[data-slot=slider-thumb]]:bg-primary-foreground" : "bg-card/95 text-card-foreground border-border backdrop-blur-md shadow-[var(--elevation-sm)]",
889
+ isOpen ? "translate-y-0 opacity-100" : "translate-y-full opacity-0",
890
+ className
891
+ ),
892
+ style: {
893
+ left: isMobile ? 0 : sidebarExpanded ? sidebarWidth : 80,
894
+ right: isMobile ? 0 : assistenteExpanded ? 420 : 80
895
+ },
896
+ children: [
897
+ audioElement,
898
+ !isMobile ? desktopLayout : mobileLayout
899
+ ]
900
+ }
901
+ ),
902
+ document.body
903
+ );
904
+ }
905
+ return /* @__PURE__ */ jsxs("div", { ref: containerRef, className, children: [
906
+ audioElement,
907
+ /* @__PURE__ */ jsx(
908
+ FloatingMediaWrapper,
909
+ {
910
+ isFloating,
911
+ setIsFloating: handleSetFloating,
912
+ onClose: () => handleSetFloating(false),
913
+ onCloseMedia: () => {
914
+ handleSetFloating(false);
915
+ },
916
+ title: "Reproduzindo Mídia",
917
+ aspectRatio: 320 / 110,
918
+ minHeight: 110,
919
+ minWidth: 320,
920
+ colorVariant,
921
+ className: "w-full",
922
+ playerId: "audio-player",
923
+ enablePadding: true,
924
+ children: /* @__PURE__ */ jsx("div", { className: cn(
925
+ "w-full overflow-hidden flex flex-col justify-center",
926
+ colorVariant === "primary" ? "bg-primary text-primary-foreground [&_[data-slot=slider-track]]:bg-white/20 [&_[data-slot=slider-range]]:bg-white [&_[data-slot=slider-thumb]]:border-white [&_[data-slot=slider-thumb]]:bg-white" : "bg-card text-card-foreground",
927
+ isFloating ? "h-full bg-transparent" : "border rounded-md shadow-sm"
928
+ ), children: desktopLayoutCompact })
929
+ }
930
+ )
931
+ ] });
932
+ }
933
+ export {
934
+ AudioPlayer as A,
935
+ FloatingMediaWrapper as F,
936
+ VideoPlayer as V
937
+ };