xertica-ui 2.5.0 → 2.5.2

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 (536) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +56 -17
  3. package/assets/xertica-logo.svg +37 -37
  4. package/assets/xertica-x-logo.svg +20 -20
  5. package/bin/cli.ts +14 -2
  6. package/bin/generate-tokens.ts +262 -262
  7. package/bin/language-config.ts +359 -358
  8. package/components/assistant/code-block/CodeBlock.tsx +268 -268
  9. package/components/assistant/formatted-document/FormattedDocument.tsx +147 -147
  10. package/components/assistant/modern-chat-input/ModernChatInput.tsx +564 -564
  11. package/components/assistant/xertica-assistant/parts/AssistantCollapsedView.tsx +99 -99
  12. package/components/assistant/xertica-assistant/parts/AssistantConversationList.tsx +104 -104
  13. package/components/assistant/xertica-assistant/parts/AssistantDocumentEditor.tsx +81 -81
  14. package/components/assistant/xertica-assistant/parts/AssistantFeedbackDialog.tsx +88 -88
  15. package/components/assistant/xertica-assistant/parts/AssistantHeader.tsx +75 -75
  16. package/components/assistant/xertica-assistant/parts/AssistantMessageBubble.tsx +564 -564
  17. package/components/assistant/xertica-assistant/parts/AssistantTabBar.tsx +67 -67
  18. package/components/assistant/xertica-assistant/parts/AssistantWelcomeScreen.tsx +103 -103
  19. package/components/assistant/xertica-assistant/use-assistant.ts +615 -615
  20. package/components/assistant/xertica-assistant/xertica-assistant.tsx +611 -611
  21. package/components/blocks/card-patterns/ActivityCard.tsx +100 -100
  22. package/components/blocks/card-patterns/ActivityCardSkeleton.tsx +56 -56
  23. package/components/blocks/card-patterns/FeatureCardSkeleton.tsx +58 -58
  24. package/components/blocks/card-patterns/NotificationCard.tsx +140 -140
  25. package/components/blocks/card-patterns/NotificationCardSkeleton.tsx +81 -81
  26. package/components/blocks/card-patterns/ProfileCard.tsx +112 -112
  27. package/components/blocks/card-patterns/ProfileCardSkeleton.tsx +69 -69
  28. package/components/blocks/card-patterns/ProjectCard.tsx +123 -123
  29. package/components/blocks/card-patterns/ProjectCardSkeleton.tsx +67 -67
  30. package/components/blocks/card-patterns/QuickActionCardSkeleton.tsx +44 -44
  31. package/components/blocks/card-patterns/card-patterns.stories.tsx +594 -594
  32. package/components/blocks/card-patterns/index.ts +29 -29
  33. package/components/brand/language-selector/LanguageSelector.tsx +102 -102
  34. package/components/brand/language-selector/language-selector.stories.tsx +111 -111
  35. package/components/brand/language-selector/language-selector.test.tsx +101 -101
  36. package/components/brand/theme-toggle/ThemeToggle.tsx +74 -74
  37. package/components/brand/xertica-provider/xertica-provider.mdx +61 -61
  38. package/components/index.ts +86 -86
  39. package/components/layout/sidebar/sidebar.mdx +1 -1
  40. package/components/layout/sidebar/sidebar.stories.tsx +1033 -787
  41. package/components/layout/sidebar/sidebar.tsx +338 -1
  42. package/components/media/FloatingMediaWrapper.tsx +371 -371
  43. package/components/media/audio-player/AudioPlayer.tsx +768 -768
  44. package/components/media/video-player/VideoPlayer.tsx +310 -310
  45. package/components/pages/home-content/HomeContent.tsx +120 -120
  46. package/components/pages/home-content/home-content.mdx +62 -62
  47. package/components/pages/home-page/HomePage.tsx +78 -78
  48. package/components/pages/home-page/home-page.mdx +53 -53
  49. package/components/pages/template-content/TemplateContent.tsx +1354 -1354
  50. package/components/pages/template-content/template-content.mdx +61 -61
  51. package/components/pages/template-page/TemplatePage.stories.tsx +32 -32
  52. package/components/pages/template-page/template-page.mdx +53 -53
  53. package/components/shared/error-boundary.stories.tsx +114 -114
  54. package/components/shared/error-boundary.tsx +150 -150
  55. package/components/shared/error-fallbacks.tsx +222 -222
  56. package/components/ui/accordion/accordion.mdx +8 -8
  57. package/components/ui/alert/alert.mdx +8 -8
  58. package/components/ui/alert-dialog/alert-dialog.mdx +8 -8
  59. package/components/ui/aspect-ratio/aspect-ratio.mdx +8 -8
  60. package/components/ui/assistant-chart/assistant-chart.mdx +8 -8
  61. package/components/ui/avatar/avatar.mdx +8 -8
  62. package/components/ui/badge/badge.mdx +8 -8
  63. package/components/ui/breadcrumb/breadcrumb.mdx +8 -8
  64. package/components/ui/button/button.mdx +8 -8
  65. package/components/ui/calendar/calendar.mdx +8 -8
  66. package/components/ui/card/card.mdx +8 -8
  67. package/components/ui/carousel/carousel.mdx +8 -8
  68. package/components/ui/chart/chart.mdx +8 -8
  69. package/components/ui/chart/chart.test.tsx +178 -178
  70. package/components/ui/chart/chart.tsx +2245 -2239
  71. package/components/ui/checkbox/checkbox.mdx +8 -8
  72. package/components/ui/collapsible/collapsible.mdx +8 -8
  73. package/components/ui/command/command.mdx +8 -8
  74. package/components/ui/context-menu/context-menu.mdx +8 -8
  75. package/components/ui/dialog/dialog.mdx +8 -8
  76. package/components/ui/drawer/drawer.mdx +8 -8
  77. package/components/ui/dropdown-menu/dropdown-menu.mdx +8 -8
  78. package/components/ui/empty/empty.mdx +8 -8
  79. package/components/ui/file-upload/file-upload.mdx +8 -8
  80. package/components/ui/hover-card/hover-card.mdx +8 -8
  81. package/components/ui/input/input.mdx +8 -8
  82. package/components/ui/input-otp/input-otp.mdx +8 -8
  83. package/components/ui/label/label.mdx +8 -8
  84. package/components/ui/map/map.mdx +8 -8
  85. package/components/ui/menubar/menubar.mdx +8 -8
  86. package/components/ui/navigation-menu/navigation-menu.mdx +8 -8
  87. package/components/ui/notification-badge/notification-badge.mdx +8 -8
  88. package/components/ui/pagination/pagination.mdx +8 -8
  89. package/components/ui/popover/popover.mdx +8 -8
  90. package/components/ui/progress/progress.mdx +8 -8
  91. package/components/ui/radio-group/radio-group.mdx +8 -8
  92. package/components/ui/rating/rating.mdx +8 -8
  93. package/components/ui/resizable/resizable.mdx +8 -8
  94. package/components/ui/route-map/route-map.mdx +8 -8
  95. package/components/ui/scroll-area/scroll-area.mdx +8 -8
  96. package/components/ui/search/search.mdx +8 -8
  97. package/components/ui/select/select.mdx +8 -8
  98. package/components/ui/separator/separator.mdx +8 -8
  99. package/components/ui/sheet/sheet.mdx +8 -8
  100. package/components/ui/simple-map/simple-map.mdx +8 -8
  101. package/components/ui/skeleton/skeleton.mdx +8 -8
  102. package/components/ui/slider/slider.mdx +8 -8
  103. package/components/ui/sonner/sonner.mdx +8 -8
  104. package/components/ui/stats-card/index.ts +2 -2
  105. package/components/ui/stats-card/stats-card-skeleton.tsx +60 -60
  106. package/components/ui/stats-card/stats-card.mdx +8 -8
  107. package/components/ui/stats-card/stats-card.tsx +109 -109
  108. package/components/ui/stepper/stepper.mdx +8 -8
  109. package/components/ui/switch/switch.mdx +8 -8
  110. package/components/ui/table/table.mdx +8 -8
  111. package/components/ui/tabs/tabs.mdx +8 -8
  112. package/components/ui/textarea/textarea.mdx +8 -8
  113. package/components/ui/timeline/timeline.mdx +8 -8
  114. package/components/ui/toggle/toggle.mdx +8 -8
  115. package/components/ui/toggle-group/toggle-group.mdx +8 -8
  116. package/components/ui/tooltip/tooltip.mdx +8 -8
  117. package/components/ui/tree-view/tree-view.mdx +8 -8
  118. package/components.json +511 -511
  119. package/contexts/AuthContext.tsx +121 -121
  120. package/contexts/BrandColorsContext.tsx +282 -282
  121. package/contexts/LanguageContext.test.tsx +121 -121
  122. package/contexts/LanguageContext.tsx +250 -250
  123. package/contexts/theme-data.ts +391 -391
  124. package/dist/{AssistantChart-DoZCyS5r.cjs → AssistantChart-9w31gdAb.cjs} +4 -4
  125. package/dist/{AssistantChart-CldVCVDe.cjs → AssistantChart-BAudAfne.cjs} +5 -5
  126. package/dist/{AssistantChart-Bdd44uBn.cjs → AssistantChart-BAx9VQvb.cjs} +127 -388
  127. package/dist/{AssistantChart-Cu3m7RBo.js → AssistantChart-BP8upjMk.js} +5 -5
  128. package/dist/{AssistantChart-CFhDdGyU.js → AssistantChart-CVko2A1W.js} +130 -391
  129. package/dist/{AssistantChart-C_hwFRRr.js → AssistantChart-CVzmmhx4.js} +4 -4
  130. package/dist/{AudioPlayer-IAU5q5T1.cjs → AudioPlayer-1ypwE2Wh.cjs} +1 -1
  131. package/dist/{AudioPlayer-CGRUtUdN.js → AudioPlayer-DuKXrCfy.js} +1 -1
  132. package/dist/{LanguageContext-CS14yCpi.js → LanguageContext-BwhwC3G2.js} +2 -2
  133. package/dist/{LanguageContext-B_KFTCzT.cjs → LanguageContext-DvUt5jBg.cjs} +2 -2
  134. package/dist/{ThemeContext-C2EwAPDt.js → ThemeContext-BbBNoFTG.js} +2 -2
  135. package/dist/{ThemeContext-Bmod0Cg2.cjs → ThemeContext-BblcjQup.cjs} +13 -8
  136. package/dist/{ThemeContext-BWq9ACPo.js → ThemeContext-Bo-W2WZH.js} +13 -8
  137. package/dist/{ThemeContext-j5aGtPky.cjs → ThemeContext-CP3a0jxy.cjs} +193 -262
  138. package/dist/{ThemeContext-vTjumZeM.cjs → ThemeContext-Cmr8Ex8H.cjs} +2 -2
  139. package/dist/ThemeContext-CpqYShLq.cjs +324 -0
  140. package/dist/{ThemeContext-CQSo4Iwc.js → ThemeContext-D3LzacmG.js} +8 -1
  141. package/dist/ThemeContext-Du2nE1PL.js +325 -0
  142. package/dist/ThemeContext-GeEBTJ3q.cjs +1621 -0
  143. package/dist/ThemeContext-JyLK9B1o.js +1622 -0
  144. package/dist/{ThemeContext-CGk3KK0k.cjs → ThemeContext-U4dEYc6C.cjs} +8 -1
  145. package/dist/{ThemeContext-BXjrgUjW.js → ThemeContext-ept8jhXI.js} +200 -261
  146. package/dist/{VerifyEmailPage-CGIwmWrm.js → VerifyEmailPage-B31mCrMc.js} +1 -1
  147. package/dist/{VerifyEmailPage-C0c2e5n0.js → VerifyEmailPage-BE-L9mB7.js} +7 -7
  148. package/dist/{VerifyEmailPage-DSBMRHtl.js → VerifyEmailPage-BIBOKV7Z.js} +41 -36
  149. package/dist/{VerifyEmailPage-DgIid028.js → VerifyEmailPage-BJjAMUTW.js} +4 -4
  150. package/dist/{VerifyEmailPage--1Vurewl.cjs → VerifyEmailPage-BRSP-Pwt.cjs} +3 -3
  151. package/dist/{VerifyEmailPage-Cwi3kbol.cjs → VerifyEmailPage-Bae2cBXT.cjs} +7 -7
  152. package/dist/{VerifyEmailPage-De6bQjrz.cjs → VerifyEmailPage-BiRm7Nh4.cjs} +41 -36
  153. package/dist/{VerifyEmailPage-ByerOcm4.cjs → VerifyEmailPage-Bv8Ah_TK.cjs} +23 -20
  154. package/dist/VerifyEmailPage-Bvfv8HVQ.js +3214 -0
  155. package/dist/{VerifyEmailPage-BComraR7.cjs → VerifyEmailPage-CR7kb5df.cjs} +22 -12
  156. package/dist/{VerifyEmailPage-CpqqpLpo.cjs → VerifyEmailPage-C_Zk6Gen.cjs} +1 -1
  157. package/dist/{VerifyEmailPage-MTD7AG1Z.js → VerifyEmailPage-C_ihbcth.js} +4 -4
  158. package/dist/{VerifyEmailPage-1WwWczAn.js → VerifyEmailPage-CbgjOF0v.js} +22 -12
  159. package/dist/{VerifyEmailPage-DvMLZgFt.js → VerifyEmailPage-CdYPSJoO.js} +1 -1
  160. package/dist/{VerifyEmailPage-By3Jf__L.cjs → VerifyEmailPage-CkBYfsNy.cjs} +4 -4
  161. package/dist/{VerifyEmailPage-CJLz3jrn.js → VerifyEmailPage-Cyl55sJb.js} +23 -20
  162. package/dist/VerifyEmailPage-D-FRj5TU.cjs +3213 -0
  163. package/dist/{VerifyEmailPage-B4peJjAT.cjs → VerifyEmailPage-DF2ilhum.cjs} +334 -356
  164. package/dist/{VerifyEmailPage-CYXtbKi3.cjs → VerifyEmailPage-DMBh4NM9.cjs} +1 -1
  165. package/dist/{VerifyEmailPage-CgMxRb4z.js → VerifyEmailPage-DTtFfC-J.js} +3 -3
  166. package/dist/{VerifyEmailPage-CFLMls1p.cjs → VerifyEmailPage-Dt7zgA4w.cjs} +4 -4
  167. package/dist/{VerifyEmailPage-C5TNQTBa.js → VerifyEmailPage-EhudUdqF.js} +343 -355
  168. package/dist/{VerifyEmailPage-DGhuIqkb.js → VerifyEmailPage-X14vhdyl.js} +4 -4
  169. package/dist/VerifyEmailPage-hdB8JQGv.cjs +3213 -0
  170. package/dist/{VerifyEmailPage-Bp1XXl3H.cjs → VerifyEmailPage-u_Dn7t1U.cjs} +4 -4
  171. package/dist/VerifyEmailPage-vYHbYK3q.js +3214 -0
  172. package/dist/{XerticaProvider-CBGc4EMA.cjs → XerticaProvider-AChwphCO.cjs} +4 -4
  173. package/dist/{XerticaProvider-BIrqfZ-i.cjs → XerticaProvider-AbWlr7Af.cjs} +8 -11
  174. package/dist/{XerticaProvider-D-yNhF94.cjs → XerticaProvider-B8CaV7xu.cjs} +1 -1
  175. package/dist/{XerticaProvider-CEoWMTxu.js → XerticaProvider-BITjgC5p.js} +2 -2
  176. package/dist/{XerticaProvider-CllrbMEJ.cjs → XerticaProvider-By8q3Roe.cjs} +2 -2
  177. package/dist/{XerticaProvider-C1DKnvLh.js → XerticaProvider-CUYJZc32.js} +4 -4
  178. package/dist/{XerticaProvider-ET0ihewn.cjs → XerticaProvider-CW9hpCdF.cjs} +2 -2
  179. package/dist/{XerticaProvider-Dt5HEzbQ.js → XerticaProvider-CWgby5mY.js} +10 -10
  180. package/dist/XerticaProvider-CWs6EwNa.js +49 -0
  181. package/dist/XerticaProvider-CjQAQPcn.cjs +48 -0
  182. package/dist/XerticaProvider-D5lLumH-.js +49 -0
  183. package/dist/{XerticaProvider-DYq4JWtg.js → XerticaProvider-DQtvJU7m.js} +1 -1
  184. package/dist/XerticaProvider-qQUDop71.cjs +48 -0
  185. package/dist/{XerticaProvider-B7EVH-NF.js → XerticaProvider-siSt9uG2.js} +2 -2
  186. package/dist/{XerticaXLogo-Zw2B276b.cjs → XerticaXLogo-8TTzBjHw.cjs} +1 -1
  187. package/dist/{XerticaXLogo-B7xQ5dhi.js → XerticaXLogo-BWaag64t.js} +1 -1
  188. package/dist/{XerticaXLogo-DZbo4vOE.js → XerticaXLogo-CFuIlYFH.js} +12 -12
  189. package/dist/{XerticaXLogo-bvZSgwGF.cjs → XerticaXLogo-CU-U-GP4.cjs} +7 -13
  190. package/dist/XerticaXLogo-ChryA6xj.js +252 -0
  191. package/dist/{XerticaXLogo-CQUUjXoH.cjs → XerticaXLogo-CziKMQil.cjs} +8 -8
  192. package/dist/XerticaXLogo-DHz5SugF.js +252 -0
  193. package/dist/XerticaXLogo-DTee_y8X.cjs +251 -0
  194. package/dist/{XerticaXLogo-Cmsp-Eey.js → XerticaXLogo-DfUvz-lD.js} +9 -9
  195. package/dist/XerticaXLogo-kslQ8Tk_.cjs +251 -0
  196. package/dist/{alert-dialog-s-vmNkJ_.js → alert-dialog-iDe5VE5o.js} +3 -3
  197. package/dist/{alert-dialog-DSKByiKZ.cjs → alert-dialog-yckpaOpy.cjs} +3 -3
  198. package/dist/cli.js +16 -6
  199. package/dist/components/ui/chart/chart.d.ts +7 -5
  200. package/dist/{google-maps-loader-Y-QkD-Li.cjs → google-maps-loader-BqsYL48U.cjs} +0 -5
  201. package/dist/{google-maps-loader-CTYySAun.js → google-maps-loader-t2IlYBzw.js} +0 -4
  202. package/dist/index-CkTUgOwX.js +8 -0
  203. package/dist/{index-COtD8bRW.cjs → index-D3RLKRAs.cjs} +1 -1
  204. package/dist/index.cjs.js +2 -2
  205. package/dist/index.es.js +2 -2
  206. package/dist/index.umd.js +454 -1027
  207. package/dist/layout.cjs.js +1 -1
  208. package/dist/layout.es.js +1 -1
  209. package/dist/pages.cjs.js +1 -1
  210. package/dist/pages.es.js +1 -1
  211. package/dist/{sidebar-DAaY8bRU.cjs → sidebar-B3EYhli0.cjs} +33 -24
  212. package/dist/{sidebar-nzPoVHBQ.cjs → sidebar-B9NR0lCe.cjs} +46 -41
  213. package/dist/{sidebar-CeTMuzOx.cjs → sidebar-BvF5I2Ue.cjs} +47 -128
  214. package/dist/{sidebar-q7P2Godd.cjs → sidebar-C5B_LHek.cjs} +1 -1
  215. package/dist/{sidebar-CrQDDdcz.js → sidebar-CA6_ek3f.js} +33 -24
  216. package/dist/sidebar-CLmIjgNd.cjs +1136 -0
  217. package/dist/{sidebar-BxGXsDAd.cjs → sidebar-CVUGHOS_.cjs} +8 -16
  218. package/dist/{sidebar-BViy8Eeu.js → sidebar-CmvwjnVb.js} +9 -17
  219. package/dist/{sidebar-B6SlKZYN.js → sidebar-CplprZpM.js} +49 -40
  220. package/dist/sidebar-Duermn32.js +1133 -0
  221. package/dist/{sidebar-BbVIQvlP.js → sidebar-Dz7bd3zP.js} +1 -1
  222. package/dist/{sidebar-0ocFLSks.js → sidebar-KIS0C2JH.js} +50 -127
  223. package/dist/sidebar-OTO_up7Z.js +801 -0
  224. package/dist/sidebar-zowjejT2.cjs +800 -0
  225. package/dist/{use-audio-player-nv8ZSGa1.js → use-audio-player-Bkh23vQ3.js} +3 -7
  226. package/dist/{use-audio-player-NKsWyjWu.cjs → use-audio-player-Dn1NR9xN.cjs} +3 -7
  227. package/dist/{xertica-assistant-dyP7KHM5.cjs → xertica-assistant-B1IaHXnB.cjs} +388 -529
  228. package/dist/{xertica-assistant-ciJaWqm1.js → xertica-assistant-BMqdyRVi.js} +10 -28
  229. package/dist/{xertica-assistant-V_IdW4WF.cjs → xertica-assistant-Bj3vBCq_.cjs} +9 -27
  230. package/dist/{xertica-assistant-yX1CFBBo.js → xertica-assistant-DPsESB6t.js} +390 -531
  231. package/dist/{CodeBlock-7TTgmdGG.cjs → xertica-assistant-Qp3ydksa.cjs} +51 -263
  232. package/dist/{CodeBlock-BeSt1h5P.js → xertica-assistant-gnCJdcZY.js} +7 -219
  233. package/dist/xertica-ui.css +2 -2
  234. package/docs/architecture-improvements.md +456 -456
  235. package/docs/architecture.md +312 -312
  236. package/docs/components/assistant.md +428 -428
  237. package/docs/components/branding.md +252 -252
  238. package/docs/components/card-patterns.md +447 -447
  239. package/docs/components/error-boundary.md +201 -201
  240. package/docs/components/hooks.md +432 -432
  241. package/docs/components/language-selector.md +176 -176
  242. package/docs/components/pages.md +323 -323
  243. package/docs/components/sidebar.md +331 -331
  244. package/docs/components/stats-card.md +138 -138
  245. package/docs/doc-audit.md +244 -244
  246. package/docs/getting-started.md +616 -616
  247. package/docs/guidelines.md +330 -330
  248. package/docs/i18n.md +480 -480
  249. package/docs/installation.md +268 -268
  250. package/docs/llms.md +295 -295
  251. package/docs/state-management.md +289 -289
  252. package/guidelines/Guidelines.md +409 -409
  253. package/llms-compact.txt +1 -1
  254. package/llms-full.txt +10688 -10688
  255. package/llms.txt +1 -1
  256. package/package.json +1 -1
  257. package/styles/xertica/base.css +90 -90
  258. package/styles/xertica/tokens.css +240 -240
  259. package/templates/.prettierignore +4 -4
  260. package/templates/.prettierrc +10 -10
  261. package/templates/CLAUDE.md +180 -180
  262. package/templates/package.json +2 -2
  263. package/templates/src/app/App.tsx +46 -46
  264. package/templates/src/app/components/AuthGuard.tsx +131 -131
  265. package/templates/src/features/assistant/data/mock.ts +75 -75
  266. package/templates/src/features/assistant/hooks/useAssistantConfig.ts +20 -20
  267. package/templates/src/features/assistant/index.ts +5 -5
  268. package/templates/src/features/auth/ui/ForgotPasswordContent.tsx +70 -70
  269. package/templates/src/features/auth/ui/LoginContent.tsx +92 -92
  270. package/templates/src/features/auth/ui/ResetPasswordContent.tsx +183 -183
  271. package/templates/src/features/auth/ui/SocialLoginButtons.tsx +78 -78
  272. package/templates/src/features/auth/ui/VerifyEmailContent.tsx +80 -80
  273. package/templates/src/features/home/data/mock.ts +41 -41
  274. package/templates/src/features/home/hooks/useFeatureCards.ts +20 -20
  275. package/templates/src/features/home/index.ts +11 -11
  276. package/templates/src/features/home/ui/HomeContent.tsx +117 -117
  277. package/templates/src/features/template/ui/CrudTemplate.tsx +112 -112
  278. package/templates/src/features/template/ui/DashboardTemplate.tsx +110 -110
  279. package/templates/src/features/template/ui/FormTemplate.tsx +117 -117
  280. package/templates/src/features/template/ui/LoginTemplate.tsx +59 -59
  281. package/templates/src/features/template/ui/TemplateContent.tsx +1322 -1322
  282. package/templates/src/i18n.ts +124 -124
  283. package/templates/src/locales/en/common.json +21 -21
  284. package/templates/src/locales/en/components/activityCard.json +10 -10
  285. package/templates/src/locales/en/components/assistant.json +119 -119
  286. package/templates/src/locales/en/components/media.json +29 -29
  287. package/templates/src/locales/en/components/notificationCard.json +5 -5
  288. package/templates/src/locales/en/components/profileCard.json +8 -8
  289. package/templates/src/locales/en/components/projectCard.json +10 -10
  290. package/templates/src/locales/en/components/sidebar.json +14 -14
  291. package/templates/src/locales/en/components/stats.json +8 -8
  292. package/templates/src/locales/en/components/team.json +14 -14
  293. package/templates/src/locales/en/errors.json +9 -9
  294. package/templates/src/locales/en/languageSelector.json +7 -7
  295. package/templates/src/locales/en/nav.json +6 -6
  296. package/templates/src/locales/en/pages/crudTemplate.json +25 -25
  297. package/templates/src/locales/en/pages/dashboardTemplate.json +20 -20
  298. package/templates/src/locales/en/pages/forgotPassword.json +10 -10
  299. package/templates/src/locales/en/pages/formTemplate.json +16 -16
  300. package/templates/src/locales/en/pages/home.json +7 -7
  301. package/templates/src/locales/en/pages/login.json +15 -15
  302. package/templates/src/locales/en/pages/loginTemplate.json +9 -9
  303. package/templates/src/locales/en/pages/resetPassword.json +18 -18
  304. package/templates/src/locales/en/pages/templates.json +317 -317
  305. package/templates/src/locales/en/pages/verifyEmail.json +12 -12
  306. package/templates/src/locales/en/themeToggle.json +6 -6
  307. package/templates/src/locales/es/common.json +21 -21
  308. package/templates/src/locales/es/components/activityCard.json +10 -10
  309. package/templates/src/locales/es/components/assistant.json +119 -119
  310. package/templates/src/locales/es/components/media.json +29 -29
  311. package/templates/src/locales/es/components/notificationCard.json +5 -5
  312. package/templates/src/locales/es/components/profileCard.json +8 -8
  313. package/templates/src/locales/es/components/projectCard.json +10 -10
  314. package/templates/src/locales/es/components/sidebar.json +14 -14
  315. package/templates/src/locales/es/components/stats.json +8 -8
  316. package/templates/src/locales/es/components/team.json +14 -14
  317. package/templates/src/locales/es/errors.json +9 -9
  318. package/templates/src/locales/es/languageSelector.json +7 -7
  319. package/templates/src/locales/es/nav.json +6 -6
  320. package/templates/src/locales/es/pages/crudTemplate.json +25 -25
  321. package/templates/src/locales/es/pages/dashboardTemplate.json +20 -20
  322. package/templates/src/locales/es/pages/forgotPassword.json +10 -10
  323. package/templates/src/locales/es/pages/formTemplate.json +16 -16
  324. package/templates/src/locales/es/pages/home.json +7 -7
  325. package/templates/src/locales/es/pages/login.json +15 -15
  326. package/templates/src/locales/es/pages/loginTemplate.json +9 -9
  327. package/templates/src/locales/es/pages/resetPassword.json +18 -18
  328. package/templates/src/locales/es/pages/templates.json +317 -317
  329. package/templates/src/locales/es/pages/verifyEmail.json +12 -12
  330. package/templates/src/locales/es/themeToggle.json +6 -6
  331. package/templates/src/locales/pt-BR/common.json +21 -21
  332. package/templates/src/locales/pt-BR/components/activityCard.json +10 -10
  333. package/templates/src/locales/pt-BR/components/assistant.json +119 -119
  334. package/templates/src/locales/pt-BR/components/media.json +29 -29
  335. package/templates/src/locales/pt-BR/components/notificationCard.json +5 -5
  336. package/templates/src/locales/pt-BR/components/profileCard.json +8 -8
  337. package/templates/src/locales/pt-BR/components/projectCard.json +10 -10
  338. package/templates/src/locales/pt-BR/components/sidebar.json +14 -14
  339. package/templates/src/locales/pt-BR/components/stats.json +8 -8
  340. package/templates/src/locales/pt-BR/components/team.json +14 -14
  341. package/templates/src/locales/pt-BR/errors.json +9 -9
  342. package/templates/src/locales/pt-BR/languageSelector.json +7 -7
  343. package/templates/src/locales/pt-BR/nav.json +6 -6
  344. package/templates/src/locales/pt-BR/pages/crudTemplate.json +25 -25
  345. package/templates/src/locales/pt-BR/pages/dashboardTemplate.json +20 -20
  346. package/templates/src/locales/pt-BR/pages/forgotPassword.json +10 -10
  347. package/templates/src/locales/pt-BR/pages/formTemplate.json +16 -16
  348. package/templates/src/locales/pt-BR/pages/home.json +7 -7
  349. package/templates/src/locales/pt-BR/pages/login.json +15 -15
  350. package/templates/src/locales/pt-BR/pages/loginTemplate.json +9 -9
  351. package/templates/src/locales/pt-BR/pages/resetPassword.json +18 -18
  352. package/templates/src/locales/pt-BR/pages/templates.json +317 -317
  353. package/templates/src/locales/pt-BR/pages/verifyEmail.json +12 -12
  354. package/templates/src/locales/pt-BR/themeToggle.json +6 -6
  355. package/templates/src/pages/AssistantPage.tsx +470 -470
  356. package/templates/src/pages/HomePage.tsx +53 -53
  357. package/templates/src/shared/error-boundary.tsx +150 -150
  358. package/templates/src/shared/error-fallbacks.tsx +222 -222
  359. package/templates/src/styles/xertica/tokens.css +240 -240
  360. package/templates/vite.config.js +20 -20
  361. package/templates/vite.config.ts +55 -55
  362. package/dist/AssistantChart-BKVtGUKF.js +0 -3383
  363. package/dist/AssistantChart-CxGjH7Qk.js +0 -3477
  364. package/dist/AssistantChart-DIpshm3i.js +0 -4784
  365. package/dist/AssistantChart-D_PTeu8P.cjs +0 -3503
  366. package/dist/AssistantChart-WeycT5Pd.cjs +0 -3551
  367. package/dist/AssistantChart-zjsy2GaZ.cjs +0 -4810
  368. package/dist/AudioPlayer-B1lt5cPl.cjs +0 -989
  369. package/dist/AudioPlayer-BZ7bibzU.cjs +0 -982
  370. package/dist/AudioPlayer-BpRPS4-1.cjs +0 -1277
  371. package/dist/AudioPlayer-C12BjQBV.cjs +0 -997
  372. package/dist/AudioPlayer-CFeV8t-5.cjs +0 -936
  373. package/dist/AudioPlayer-Coly3q5R.js +0 -1278
  374. package/dist/AudioPlayer-CySJIyvL.js +0 -937
  375. package/dist/AudioPlayer-DMcG_c7L.js +0 -990
  376. package/dist/AudioPlayer-DcFKRJE_.js +0 -998
  377. package/dist/AudioPlayer-e8LfNoqO.js +0 -983
  378. package/dist/BrandColorsContext-565dDHd5.js +0 -660
  379. package/dist/BrandColorsContext-BcJbtkqn.cjs +0 -659
  380. package/dist/CodeBlock-BgfYL_rD.cjs +0 -2094
  381. package/dist/CodeBlock-BlcqlA9M.cjs +0 -2094
  382. package/dist/CodeBlock-Bnmeu5ez.cjs +0 -2094
  383. package/dist/CodeBlock-BtfPlbAI.js +0 -2078
  384. package/dist/CodeBlock-CIySIuYr.js +0 -2078
  385. package/dist/CodeBlock-CuPtUM-7.cjs +0 -2094
  386. package/dist/CodeBlock-D6ffWXgc.js +0 -2078
  387. package/dist/CodeBlock-D8dcwbit.cjs +0 -2094
  388. package/dist/CodeBlock-DMZrFnlw.cjs +0 -2094
  389. package/dist/CodeBlock-DlBehYN8.js +0 -2078
  390. package/dist/CodeBlock-DnYNI8rQ.js +0 -2078
  391. package/dist/CodeBlock-DvKWbSnE.cjs +0 -2094
  392. package/dist/CodeBlock-DwMCfkFY.js +0 -2078
  393. package/dist/CodeBlock-Dy6CNYyj.js +0 -2078
  394. package/dist/CodeBlock-U1pPOQI7.cjs +0 -2094
  395. package/dist/CodeBlock-f_GpNhEB.js +0 -2078
  396. package/dist/CodeBlock-oB6u8nI1.js +0 -2078
  397. package/dist/CodeBlock-tZC31B73.cjs +0 -2094
  398. package/dist/FeatureCard-CxC-7C-C.cjs +0 -300
  399. package/dist/FeatureCard-DbHWCb4E.js +0 -301
  400. package/dist/ImageWithFallback-CGtidP6B.cjs +0 -4542
  401. package/dist/ImageWithFallback-lsg3pdFg.js +0 -4508
  402. package/dist/LanguageSelector-B5YfbHra.js +0 -231
  403. package/dist/LanguageSelector-D6uacAIM.cjs +0 -230
  404. package/dist/LayoutContext-B45-e9DI.cjs +0 -93
  405. package/dist/LayoutContext-BAql6ZRY.js +0 -97
  406. package/dist/LayoutContext-Bav3UMEA.js +0 -94
  407. package/dist/LayoutContext-BvK-ggDa.cjs +0 -96
  408. package/dist/ThemeContext-BoH4NLfN.js +0 -734
  409. package/dist/ThemeContext-r69W20Xg.cjs +0 -733
  410. package/dist/VerifyEmailPage-COiyNl1y.js +0 -2825
  411. package/dist/VerifyEmailPage-CqKsR2v8.js +0 -2827
  412. package/dist/VerifyEmailPage-DjQKRlUS.cjs +0 -2824
  413. package/dist/VerifyEmailPage-s-1X3LDJ.cjs +0 -2826
  414. package/dist/XerticaOrbe-KL1RBHzw.cjs +0 -1354
  415. package/dist/XerticaOrbe-zwS1p2a8.js +0 -1355
  416. package/dist/XerticaProvider-6btlAlzc.js +0 -17
  417. package/dist/XerticaProvider-BNoNOxQ5.cjs +0 -16
  418. package/dist/XerticaProvider-BlY2limY.cjs +0 -38
  419. package/dist/XerticaProvider-DDuiIcKo.js +0 -39
  420. package/dist/XerticaProvider-cI9hSs27.cjs +0 -38
  421. package/dist/XerticaProvider-hSwhNQex.js +0 -39
  422. package/dist/alert-dialog-BOje--vD.js +0 -847
  423. package/dist/alert-dialog-BtEuQqrg.cjs +0 -870
  424. package/dist/breadcrumb-CqJ7bHY5.js +0 -161
  425. package/dist/breadcrumb-m9Hb2_XN.cjs +0 -177
  426. package/dist/components/assistant/xertica-assistant/hooks/index.d.ts +0 -6
  427. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-conversations.d.ts +0 -21
  428. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-messages.d.ts +0 -49
  429. package/dist/components/assistant/xertica-assistant/hooks/use-assistant-suggestions.d.ts +0 -16
  430. package/dist/components/blocks/audio-player/AudioPlayer.d.ts +0 -35
  431. package/dist/components/blocks/audio-player/index.d.ts +0 -1
  432. package/dist/components/blocks/document-editor/DocumentEditor.d.ts +0 -26
  433. package/dist/components/blocks/document-editor/index.d.ts +0 -1
  434. package/dist/components/blocks/podcast-player/PodcastPlayer.d.ts +0 -41
  435. package/dist/components/blocks/podcast-player/index.d.ts +0 -1
  436. package/dist/components/ui/chart/parts/chart-dashboard.d.ts +0 -113
  437. package/dist/components/ui/chart/parts/chart-metric.d.ts +0 -118
  438. package/dist/components/ui/chart/parts/chart-primitives.d.ts +0 -101
  439. package/dist/components/ui/chart/parts/chart-shared.d.ts +0 -20
  440. package/dist/components/ui/chart/parts/chart-utils.d.ts +0 -12
  441. package/dist/components/ui/chart/parts/index.d.ts +0 -5
  442. package/dist/dropdown-menu-BDB5CmQs.cjs +0 -247
  443. package/dist/dropdown-menu-DQidbKBD.js +0 -231
  444. package/dist/google-maps-loader-BFWp6VPd.js +0 -287
  445. package/dist/google-maps-loader-BKcdgFbu.cjs +0 -312
  446. package/dist/google-maps-loader-CumCNXeG.js +0 -312
  447. package/dist/google-maps-loader-eS3uQ5TA.cjs +0 -287
  448. package/dist/header-Cgy6vYPk.cjs +0 -731
  449. package/dist/header-DRlT4jgI.js +0 -715
  450. package/dist/header-Dux00SI4.cjs +0 -731
  451. package/dist/header-EkGKXPsD.js +0 -715
  452. package/dist/header-WfEywpyc.cjs +0 -731
  453. package/dist/header-tifNQn2U.js +0 -715
  454. package/dist/index-BhapVLVj.js +0 -8
  455. package/dist/index-D6fxYEY8.cjs +0 -7
  456. package/dist/index-DAIp0_HK.js +0 -8
  457. package/dist/index-DW5tYe26.js +0 -8
  458. package/dist/index-GA__GvnG.cjs +0 -7
  459. package/dist/input-2R4loU86.js +0 -127
  460. package/dist/input-DWANSKGb.cjs +0 -145
  461. package/dist/progress-DPtzoVV8.js +0 -175
  462. package/dist/progress-EeaoqqUs.cjs +0 -191
  463. package/dist/rich-text-editor-0mraWT5y.cjs +0 -2376
  464. package/dist/rich-text-editor-B-IkcPD0.js +0 -2874
  465. package/dist/rich-text-editor-B6jMRLzk.cjs +0 -1939
  466. package/dist/rich-text-editor-B8_oYcIR.js +0 -1730
  467. package/dist/rich-text-editor-B9UbSXNb.js +0 -1203
  468. package/dist/rich-text-editor-BYuRBNBU.js +0 -2373
  469. package/dist/rich-text-editor-Bb9pySTs.cjs +0 -2374
  470. package/dist/rich-text-editor-BcL6L3cm.cjs +0 -2374
  471. package/dist/rich-text-editor-BoVZYtTs.cjs +0 -2391
  472. package/dist/rich-text-editor-Bp3zQqMC.js +0 -2954
  473. package/dist/rich-text-editor-CMgSN_w2.js +0 -1189
  474. package/dist/rich-text-editor-CPV1lEPH.cjs +0 -1748
  475. package/dist/rich-text-editor-CeucBdIv.cjs +0 -2971
  476. package/dist/rich-text-editor-CoKqbCtu.cjs +0 -1799
  477. package/dist/rich-text-editor-Cw56T_mB.js +0 -2356
  478. package/dist/rich-text-editor-Cyt8qs2b.js +0 -1921
  479. package/dist/rich-text-editor-D6H84OcX.cjs +0 -1220
  480. package/dist/rich-text-editor-D76gD-QI.js +0 -2328
  481. package/dist/rich-text-editor-DKkokOnA.js +0 -1781
  482. package/dist/rich-text-editor-DNsdpN64.cjs +0 -2359
  483. package/dist/rich-text-editor-DfG8bCyY.js +0 -2358
  484. package/dist/rich-text-editor-Dxjw31Z4.js +0 -2341
  485. package/dist/rich-text-editor-DzP0Epmb.js +0 -2356
  486. package/dist/rich-text-editor-bRkNoeZY.cjs +0 -2891
  487. package/dist/rich-text-editor-lyYE2ZG5.cjs +0 -1207
  488. package/dist/rich-text-editor-skplNlBM.cjs +0 -2345
  489. package/dist/select-Bkbr0f-Z.cjs +0 -162
  490. package/dist/select-CvIVdX2n.js +0 -145
  491. package/dist/sidebar-CK_0ZQHj.cjs +0 -803
  492. package/dist/sidebar-CUuOvYhK.js +0 -787
  493. package/dist/sidebar-DQj1z3jG.cjs +0 -758
  494. package/dist/sidebar-Djn5syhi.cjs +0 -786
  495. package/dist/sidebar-LluMXfam.js +0 -759
  496. package/dist/sidebar-_rT7rBMk.js +0 -787
  497. package/dist/slider-Bc5Hd0y1.js +0 -56
  498. package/dist/slider-N7hFFj6X.cjs +0 -73
  499. package/dist/tooltip-Ded96neP.cjs +0 -137
  500. package/dist/tooltip-HDOoD2-0.js +0 -120
  501. package/dist/use-audio-player-B31J-aqh.cjs +0 -187
  502. package/dist/use-audio-player-BkmEmj8Q.js +0 -185
  503. package/dist/use-audio-player-CLFTWFW1.cjs +0 -184
  504. package/dist/use-audio-player-CLLn00I6.js +0 -188
  505. package/dist/use-file-upload-BcjEo2S5.js +0 -404
  506. package/dist/use-file-upload-CRJR68Tj.cjs +0 -403
  507. package/dist/use-mobile-B0hNy_Y6.cjs +0 -4303
  508. package/dist/use-mobile-BXuYROXM.js +0 -4202
  509. package/dist/use-mobile-Bbd51ASU.cjs +0 -4392
  510. package/dist/use-mobile-Bk6CX-TC.js +0 -4359
  511. package/dist/use-mobile-BvYdisLP.js +0 -4202
  512. package/dist/use-mobile-BzuxjzNX.cjs +0 -4392
  513. package/dist/use-mobile-CG2-SdXV.cjs +0 -4235
  514. package/dist/use-mobile-CKb5pqTs.js +0 -4269
  515. package/dist/use-mobile-CYuAuGDl.js +0 -4202
  516. package/dist/use-mobile-CaENcqm-.js +0 -4508
  517. package/dist/use-mobile-CbrYgJGJ.js +0 -4203
  518. package/dist/use-mobile-Cd4xPrKq.cjs +0 -46
  519. package/dist/use-mobile-DMOvImGQ.cjs +0 -4542
  520. package/dist/use-mobile-DRB3BQgD.cjs +0 -4235
  521. package/dist/use-mobile-DZvv7QMR.js +0 -4359
  522. package/dist/use-mobile-DdI_TXam.cjs +0 -4235
  523. package/dist/use-mobile-DlceKf8a.js +0 -4359
  524. package/dist/use-mobile-DsOnow1o.cjs +0 -4236
  525. package/dist/use-mobile-Kcj6jSnK.cjs +0 -4392
  526. package/dist/use-mobile-bnKcua_i.js +0 -4202
  527. package/dist/use-mobile-j4w2Jrf1.js +0 -30
  528. package/dist/use-mobile-ncXBeE2z.cjs +0 -4235
  529. package/dist/use-rich-text-editor-DjiddBGv.js +0 -282
  530. package/dist/use-rich-text-editor-lpeswbCs.cjs +0 -281
  531. package/dist/xertica-assistant-BdiZag0h.js +0 -2187
  532. package/dist/xertica-assistant-CrgTb6Hs.cjs +0 -2155
  533. package/dist/xertica-assistant-DCsnQyi5.js +0 -2156
  534. package/dist/xertica-assistant-DUBpmEgo.cjs +0 -2186
  535. package/dist/{rich-text-editor-DgF8s7xW.js → rich-text-editor-BmsjY03B.js} +26 -26
  536. package/dist/{rich-text-editor-mWoaSCE4.cjs → rich-text-editor-GS2kpTAK.cjs} +26 -26
@@ -1,2094 +0,0 @@
1
- "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
- const React = require("react");
4
- const framerMotion = require("framer-motion");
5
- const lucideReact = require("lucide-react");
6
- const RechartsPrimitive = require("recharts");
7
- const richTextEditor = require("./rich-text-editor-CoKqbCtu.cjs");
8
- const dropdownMenu = require("./dropdown-menu-BDB5CmQs.cjs");
9
- const tooltip = require("./tooltip-Ded96neP.cjs");
10
- const input = require("./input-DWANSKGb.cjs");
11
- const sonner = require("sonner");
12
- const XerticaOrbe = require("./XerticaOrbe-KL1RBHzw.cjs");
13
- const TooltipPrimitive = require("@radix-ui/react-tooltip");
14
- const reactSyntaxHighlighter = require("react-syntax-highlighter");
15
- function _interopNamespaceDefault(e) {
16
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
17
- if (e) {
18
- for (const k in e) {
19
- if (k !== "default") {
20
- const d = Object.getOwnPropertyDescriptor(e, k);
21
- Object.defineProperty(n, k, d.get ? d : {
22
- enumerable: true,
23
- get: () => e[k]
24
- });
25
- }
26
- }
27
- }
28
- n.default = e;
29
- return Object.freeze(n);
30
- }
31
- const TooltipPrimitive__namespace = /* @__PURE__ */ _interopNamespaceDefault(TooltipPrimitive);
32
- function MarkdownMessage({ content, className = "" }) {
33
- const convertMarkdownToHtml = (markdown) => {
34
- let html = markdown;
35
- html = html.replace(/</g, "<").replace(/>/g, ">");
36
- html = html.replace(/^### (.*$)/gim, '<h3 class="font-medium text-sm mt-2 mb-1 break-words">$1</h3>');
37
- html = html.replace(/^## (.*$)/gim, '<h2 class="font-medium text-base mt-3 mb-1.5 break-words">$1</h2>');
38
- html = html.replace(/^# (.*$)/gim, '<h1 class="font-medium text-lg mt-3 mb-2 break-words">$1</h1>');
39
- html = html.replace(/\*\*(.*?)\*\*/g, '<strong class="font-medium">$1</strong>');
40
- html = html.replace(/\*(.*?)\*/g, '<em class="italic">$1</em>');
41
- html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" class="text-[var(--chart-4)] hover:underline break-all" target="_blank" rel="noopener noreferrer">$1</a>');
42
- html = html.replace(/`([^`]+)`/g, '<code class="px-1.5 py-0.5 rounded bg-muted text-xs font-mono break-all inline-block max-w-full">$1</code>');
43
- html = html.replace(/((?:^[•\-] .*$(?:\n|$))+)/gim, (match) => {
44
- const items = match.trim().split("\n").map(
45
- (item) => `<li class="ml-4 mb-1 list-disc break-words">${item.replace(/^[•\-]\s+/, "")}</li>`
46
- ).join("");
47
- return `<ul class="list-disc my-2">${items}</ul>`;
48
- });
49
- html = html.replace(/((?:^\d+\. .*$(?:\n|$))+)/gim, (match) => {
50
- const items = match.trim().split("\n").map(
51
- (item) => `<li class="ml-4 mb-1 list-decimal break-words">${item.replace(/^\d+\.\s+/, "")}</li>`
52
- ).join("");
53
- return `<ol class="list-decimal my-2">${items}</ol>`;
54
- });
55
- html = html.replace(/\n\n/g, '</p><p class="mb-2 break-words">');
56
- html = html.replace(/\n/g, "<br/>");
57
- html = '<p class="mb-2 break-words">' + html + "</p>";
58
- html = html.replace(/<p[^>]*>\s*<\/p>/g, "");
59
- return html;
60
- };
61
- const htmlContent = convertMarkdownToHtml(content);
62
- return /* @__PURE__ */ jsxRuntime.jsx(
63
- "div",
64
- {
65
- className: `text-sm leading-relaxed break-words overflow-wrap-anywhere max-w-full ${className}`,
66
- dangerouslySetInnerHTML: { __html: htmlContent }
67
- }
68
- );
69
- }
70
- function FormattedDocument({ content, maxPreviewLength = 500, className = "" }) {
71
- const [isExpanded, setIsExpanded] = React.useState(false);
72
- const convertMarkdownToHtml = (markdown) => {
73
- let html = markdown;
74
- html = html.replace(/^### (.*$)/gim, '<h3 class="text-base font-medium mt-2 mb-1 text-foreground">$1</h3>');
75
- html = html.replace(/^## (.*$)/gim, '<h2 class="text-lg font-medium mt-2 mb-1 text-foreground">$1</h2>');
76
- html = html.replace(/^# (.*$)/gim, '<h1 class="text-xl font-medium mt-3 mb-2 text-foreground">$1</h1>');
77
- html = html.replace(/\*\*(.*?)\*\*/g, '<strong class="font-medium text-foreground">$1</strong>');
78
- html = html.replace(/\*(.*?)\*/g, '<em class="italic">$1</em>');
79
- html = html.replace(/^[-*+] \[ \] (.*$)/gim, '<div class="flex items-center gap-2 ml-4 my-0.5"><input type="checkbox" disabled class="rounded w-3.5 h-3.5 accent-primary" aria-label="$1" /> <span class="text-sm">$1</span></div>');
80
- html = html.replace(/^[-*+] \[x\] (.*$)/gim, '<div class="flex items-center gap-2 ml-4 my-0.5"><input type="checkbox" checked disabled class="rounded w-3.5 h-3.5 accent-primary" aria-label="$1" /> <span class="text-sm">$1</span></div>');
81
- html = html.replace(/((?:^[-*+] .*$(?:\n|$))+)/gim, (match) => {
82
- const items = match.trim().split("\n").map(
83
- (item) => `<li class="ml-6 my-0.5 list-disc">${item.replace(/^[-*+] /i, "")}</li>`
84
- ).join("");
85
- return `<ul class="list-disc my-2">${items}</ul>`;
86
- });
87
- html = html.replace(/((?:^\d+\. .*$(?:\n|$))+)/gim, (match) => {
88
- const items = match.trim().split("\n").map(
89
- (item) => `<li class="ml-6 my-0.5 list-decimal">${item.replace(/^\d+\. /i, "")}</li>`
90
- ).join("");
91
- return `<ol class="list-decimal my-2">${items}</ol>`;
92
- });
93
- html = html.replace(/^---$/gim, '<hr class="my-2 border-border" />');
94
- html = html.replace(/\n\n+/g, '</p><p class="my-0.5">');
95
- html = html.replace(/\n/g, " ");
96
- html = '<p class="my-0.5">' + html + "</p>";
97
- return html;
98
- };
99
- const htmlContent = convertMarkdownToHtml(content);
100
- const isLong = content.length > maxPreviewLength;
101
- const displayContent = !isLong || isExpanded ? htmlContent : convertMarkdownToHtml(content.substring(0, maxPreviewLength) + "...");
102
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
103
- /* @__PURE__ */ jsxRuntime.jsx(
104
- "div",
105
- {
106
- className: "max-w-none text-sm text-foreground leading-relaxed break-words overflow-hidden",
107
- dangerouslySetInnerHTML: { __html: displayContent }
108
- }
109
- ),
110
- isLong && /* @__PURE__ */ jsxRuntime.jsx(
111
- tooltip.Button,
112
- {
113
- variant: "ghost",
114
- size: "sm",
115
- onClick: () => setIsExpanded(!isExpanded),
116
- className: "mt-2 w-full text-xs hover:bg-accent text-muted-foreground",
117
- children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
118
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "w-3 h-3 mr-1" }),
119
- "See less"
120
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
121
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "w-3 h-3 mr-1" }),
122
- "See more"
123
- ] })
124
- }
125
- )
126
- ] });
127
- }
128
- function ModernChatInput({
129
- value,
130
- onChange,
131
- onSubmit,
132
- placeholder = "Mande uma mensagem para o Xertica",
133
- disabled = false,
134
- onFileUpload,
135
- onAudioUpload,
136
- onVoiceRecording,
137
- isFullPage = false,
138
- enableAudioInput = true,
139
- enableFileAttachment = true,
140
- enableDocumentCreation = true,
141
- enablePodcastGeneration = true,
142
- enableSearch = true
143
- }) {
144
- const textareaRef = React.useRef(null);
145
- const [isFocused, setIsFocused] = React.useState(false);
146
- const [textareaHeight, setTextareaHeight] = React.useState(20);
147
- const [selectedAction, setSelectedAction] = React.useState(null);
148
- const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
149
- const [isRecording, setIsRecording] = React.useState(false);
150
- const [recordingTime, setRecordingTime] = React.useState(0);
151
- const recordingIntervalRef = React.useRef(null);
152
- const adjustHeight = () => {
153
- const textarea = textareaRef.current;
154
- if (textarea) {
155
- textarea.style.height = "20px";
156
- const scrollHeight = textarea.scrollHeight;
157
- const newHeight = Math.min(Math.max(scrollHeight, 20), 100);
158
- setTextareaHeight(newHeight);
159
- textarea.style.height = newHeight + "px";
160
- }
161
- };
162
- React.useEffect(() => {
163
- const textarea = textareaRef.current;
164
- if (textarea) {
165
- textarea.style.height = "20px";
166
- setTextareaHeight(20);
167
- if (value) {
168
- setTimeout(adjustHeight, 0);
169
- }
170
- }
171
- }, []);
172
- React.useEffect(() => {
173
- if (value === "") {
174
- const textarea = textareaRef.current;
175
- if (textarea) {
176
- textarea.style.height = "20px";
177
- setTextareaHeight(20);
178
- }
179
- } else {
180
- const timeoutId = setTimeout(adjustHeight, 0);
181
- return () => clearTimeout(timeoutId);
182
- }
183
- }, [value]);
184
- const handleKeyDown = (e) => {
185
- if (e.key === "Enter" && !e.shiftKey) {
186
- e.preventDefault();
187
- if (value.trim() && !disabled) {
188
- onSubmit(selectedAction);
189
- setSelectedAction(null);
190
- }
191
- }
192
- };
193
- const handleActionSelect = (action) => {
194
- setSelectedAction(action);
195
- setIsPopoverOpen(false);
196
- };
197
- const handleRemoveAction = () => {
198
- setSelectedAction(null);
199
- };
200
- const handleVoiceRecording = () => {
201
- if (isRecording) {
202
- if (recordingIntervalRef.current) {
203
- clearInterval(recordingIntervalRef.current);
204
- recordingIntervalRef.current = null;
205
- }
206
- const transcricoes = [
207
- "Como posso analisar os dados de vendas do último trimestre?",
208
- "Me ajude a criar um relatório de performance do time",
209
- "Quais são as principais tendências do mercado atual?",
210
- "Preciso de insights sobre a satisfação dos clientes",
211
- "Como posso melhorar a produtividade da minha equipe?",
212
- "Me mostre um resumo das métricas mais importantes",
213
- "Crie um documento sobre técnicas de marketing digital",
214
- "Analise os dados de engajamento das redes sociais"
215
- ];
216
- const transcricaoAleatoria = transcricoes[Math.floor(Math.random() * transcricoes.length)];
217
- if (onVoiceRecording) {
218
- onVoiceRecording(transcricaoAleatoria);
219
- }
220
- setIsRecording(false);
221
- setRecordingTime(0);
222
- } else {
223
- setIsRecording(true);
224
- setRecordingTime(0);
225
- sonner.toast.info("Gravação iniciada", {
226
- description: "Fale sua dúvida ou comando. A gravação parará automaticamente em 60s.",
227
- duration: 3e3
228
- });
229
- recordingIntervalRef.current = setInterval(() => {
230
- setRecordingTime((prev) => prev + 1);
231
- }, 1e3);
232
- }
233
- };
234
- React.useEffect(() => {
235
- if (recordingTime >= 60 && isRecording) {
236
- handleVoiceRecording();
237
- }
238
- }, [recordingTime, isRecording]);
239
- React.useEffect(() => {
240
- return () => {
241
- if (recordingIntervalRef.current) {
242
- clearInterval(recordingIntervalRef.current);
243
- }
244
- };
245
- }, []);
246
- const getActionInfo = (action) => {
247
- switch (action) {
248
- case "document":
249
- return { label: "Criar documento", icon: lucideReact.FileText, color: "bg-[var(--chart-4)]" };
250
- case "podcast":
251
- return { label: "Gerar podcast", icon: lucideReact.Radio, color: "bg-[var(--chart-1)]" };
252
- case "search":
253
- return { label: "Pesquisar", icon: lucideReact.Search, color: "bg-[var(--chart-2)]" };
254
- default:
255
- return null;
256
- }
257
- };
258
- const handleFocus = () => setIsFocused(true);
259
- const handleBlur = () => setIsFocused(false);
260
- const hasContent = value.trim().length > 0;
261
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-4 ${isFullPage ? "mx-auto w-full max-w-6xl" : ""}`, children: [
262
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isRecording && /* @__PURE__ */ jsxRuntime.jsx(
263
- framerMotion.motion.div,
264
- {
265
- initial: { opacity: 0, y: 10 },
266
- animate: { opacity: 1, y: 0 },
267
- exit: { opacity: 0, y: 10 },
268
- className: "mb-3 p-4 bg-destructive/10 border border-destructive/30 rounded-[var(--radius-card)]",
269
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
270
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
271
- /* @__PURE__ */ jsxRuntime.jsx(
272
- framerMotion.motion.div,
273
- {
274
- animate: {
275
- scale: [1, 1.2, 1],
276
- opacity: [1, 0.7, 1]
277
- },
278
- transition: {
279
- duration: 1.5,
280
- repeat: Infinity,
281
- ease: "easeInOut"
282
- },
283
- className: "w-3 h-3 bg-destructive rounded-full"
284
- }
285
- ),
286
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1", children: [0, 1, 2, 3, 4].map((i) => /* @__PURE__ */ jsxRuntime.jsx(
287
- framerMotion.motion.div,
288
- {
289
- animate: {
290
- height: ["8px", "20px", "8px"]
291
- },
292
- transition: {
293
- duration: 0.8,
294
- repeat: Infinity,
295
- ease: "easeInOut",
296
- delay: i * 0.1
297
- },
298
- className: "w-1 bg-destructive rounded-full h-2"
299
- },
300
- i
301
- )) }),
302
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-destructive", children: "Gravando áudio" })
303
- ] }),
304
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
305
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-destructive font-mono tabular-nums", children: [
306
- Math.floor(recordingTime / 60),
307
- ":",
308
- (recordingTime % 60).toString().padStart(2, "0")
309
- ] }),
310
- /* @__PURE__ */ jsxRuntime.jsx(
311
- tooltip.Button,
312
- {
313
- onClick: handleVoiceRecording,
314
- size: "sm",
315
- variant: "outline",
316
- className: "h-7 px-3 text-xs border-destructive/30 text-destructive hover:bg-destructive/10 rounded-[var(--radius-button)]",
317
- children: "Parar gravação"
318
- }
319
- )
320
- ] })
321
- ] })
322
- }
323
- ) }),
324
- /* @__PURE__ */ jsxRuntime.jsxs(
325
- framerMotion.motion.div,
326
- {
327
- className: `relative bg-card rounded-[var(--radius)] border shadow-sm transition-all duration-300 ${isFocused || hasContent ? "border-primary shadow-lg shadow-primary/10" : "border-border"}`,
328
- initial: false,
329
- animate: {
330
- scale: isFocused ? 1.01 : 1
331
- },
332
- transition: { duration: 0.2, ease: "easeOut" },
333
- children: [
334
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 pt-[14px] pr-[10px] pb-[8px] pl-[10px] rounded-[var(--radius)]", children: [
335
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: selectedAction && /* @__PURE__ */ jsxRuntime.jsx(
336
- framerMotion.motion.div,
337
- {
338
- initial: { opacity: 0, y: -10, height: 0 },
339
- animate: { opacity: 1, y: 0, height: "auto" },
340
- exit: { opacity: 0, y: -10, height: 0 },
341
- transition: { duration: 0.2 },
342
- className: "mb-2",
343
- children: (() => {
344
- const actionInfo = getActionInfo(selectedAction);
345
- if (!actionInfo) return null;
346
- const Icon = actionInfo.icon;
347
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `inline-flex items-center gap-2 px-3 py-1.5 rounded-full ${actionInfo.color} text-white text-xs font-medium shadow-sm`, children: [
348
- /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "w-3.5 h-3.5" }),
349
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: actionInfo.label }),
350
- /* @__PURE__ */ jsxRuntime.jsx(
351
- "button",
352
- {
353
- onClick: handleRemoveAction,
354
- className: "ml-1 hover:bg-white/20 rounded-full p-0.5 transition-colors",
355
- "aria-label": "Remover ação",
356
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-3 h-3" })
357
- }
358
- )
359
- ] });
360
- })()
361
- }
362
- ) }),
363
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(
364
- "textarea",
365
- {
366
- ref: textareaRef,
367
- value,
368
- onChange: (e) => onChange(e.target.value),
369
- onKeyDown: handleKeyDown,
370
- onFocus: handleFocus,
371
- onBlur: handleBlur,
372
- placeholder,
373
- "aria-label": placeholder || "Mensagem para o Xertica",
374
- disabled,
375
- className: "w-full bg-transparent border-0 outline-none resize-none text-foreground placeholder-muted-foreground text-sm leading-5 min-h-[20px] max-h-[100px] overflow-y-auto scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",
376
- style: {
377
- height: `${textareaHeight}px`,
378
- minHeight: "20px",
379
- maxHeight: "100px"
380
- },
381
- rows: 1
382
- }
383
- ) }),
384
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
385
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
386
- (enableDocumentCreation || enablePodcastGeneration || enableSearch) && /* @__PURE__ */ jsxRuntime.jsxs(input.Popover, { open: isPopoverOpen, onOpenChange: setIsPopoverOpen, children: [
387
- /* @__PURE__ */ jsxRuntime.jsx(input.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
388
- tooltip.Button,
389
- {
390
- variant: "ghost",
391
- size: "sm",
392
- className: "h-8 w-8 p-0 rounded-full text-muted-foreground hover:bg-accent hover:text-foreground transition-all duration-200",
393
- "aria-label": "Ver ações",
394
- children: /* @__PURE__ */ jsxRuntime.jsx(
395
- framerMotion.motion.div,
396
- {
397
- whileHover: { scale: 1.05 },
398
- whileTap: { scale: 0.95 },
399
- className: "flex items-center justify-center w-full h-full",
400
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-4 h-4" })
401
- }
402
- )
403
- }
404
- ) }),
405
- /* @__PURE__ */ jsxRuntime.jsx(
406
- input.PopoverContent,
407
- {
408
- className: "w-56 p-2",
409
- align: "start",
410
- side: "top",
411
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
412
- enableDocumentCreation && /* @__PURE__ */ jsxRuntime.jsxs(
413
- "button",
414
- {
415
- onClick: () => handleActionSelect("document"),
416
- className: "w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent transition-colors text-left group",
417
- children: [
418
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full bg-[var(--chart-4)]/20 flex items-center justify-center group-hover:bg-[var(--chart-4)] transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "w-4 h-4 text-[var(--chart-4)] group-hover:text-white" }) }),
419
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
420
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Criar documento" }),
421
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: "Gere um documento completo" })
422
- ] })
423
- ]
424
- }
425
- ),
426
- enablePodcastGeneration && /* @__PURE__ */ jsxRuntime.jsxs(
427
- "button",
428
- {
429
- onClick: () => handleActionSelect("podcast"),
430
- className: "w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent transition-colors text-left group",
431
- children: [
432
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full bg-[var(--chart-1)]/20 flex items-center justify-center group-hover:bg-[var(--chart-1)] transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Radio, { className: "w-4 h-4 text-[var(--chart-1)] group-hover:text-white" }) }),
433
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
434
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Gerar podcast" }),
435
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: "Crie um podcast de áudio" })
436
- ] })
437
- ]
438
- }
439
- ),
440
- enableSearch && /* @__PURE__ */ jsxRuntime.jsxs(
441
- "button",
442
- {
443
- onClick: () => handleActionSelect("search"),
444
- className: "w-full flex items-center gap-3 px-3 py-2.5 rounded-lg hover:bg-accent transition-colors text-left group",
445
- children: [
446
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full bg-[var(--chart-2)]/20 flex items-center justify-center group-hover:bg-[var(--chart-2)] transition-colors", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "w-4 h-4 text-[var(--chart-2)] group-hover:text-white" }) }),
447
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
448
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Pesquisar" }),
449
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: "Busque por informações relevantes" })
450
- ] })
451
- ]
452
- }
453
- )
454
- ] })
455
- }
456
- )
457
- ] }),
458
- enableFileAttachment && /* @__PURE__ */ jsxRuntime.jsx(
459
- framerMotion.motion.div,
460
- {
461
- whileHover: { scale: 1.05 },
462
- whileTap: { scale: 0.95 },
463
- children: /* @__PURE__ */ jsxRuntime.jsx(
464
- tooltip.Button,
465
- {
466
- variant: "ghost",
467
- size: "sm",
468
- onClick: onFileUpload,
469
- className: "h-8 w-8 p-0 rounded-full text-muted-foreground hover:bg-accent hover:text-foreground transition-all duration-200",
470
- "aria-label": "Anexar arquivo",
471
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Paperclip, { className: "w-4 h-4" })
472
- }
473
- )
474
- }
475
- )
476
- ] }),
477
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
478
- enableAudioInput && /* @__PURE__ */ jsxRuntime.jsx(
479
- framerMotion.motion.div,
480
- {
481
- whileHover: { scale: 1.05 },
482
- whileTap: { scale: 0.95 },
483
- children: /* @__PURE__ */ jsxRuntime.jsx(
484
- tooltip.Button,
485
- {
486
- variant: "ghost",
487
- size: "sm",
488
- onClick: handleVoiceRecording,
489
- className: `h-8 w-8 p-0 rounded-full transition-all duration-200 ${isRecording ? "bg-destructive hover:bg-destructive/90 text-white animate-pulse" : "text-muted-foreground hover:bg-accent hover:text-foreground"}`,
490
- "aria-label": isRecording ? "Parar gravação" : "Sugerir com voz",
491
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "w-4 h-4" })
492
- }
493
- )
494
- }
495
- ),
496
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsx(
497
- framerMotion.motion.div,
498
- {
499
- initial: { scale: 0.8, opacity: 0 },
500
- animate: { scale: 1, opacity: 1 },
501
- exit: { scale: 0.8, opacity: 0 },
502
- transition: { duration: 0.2, ease: "easeInOut" },
503
- whileHover: hasContent ? { scale: 1.05 } : {},
504
- whileTap: hasContent ? { scale: 0.95 } : {},
505
- children: /* @__PURE__ */ jsxRuntime.jsx(
506
- tooltip.Button,
507
- {
508
- onClick: () => {
509
- onSubmit(selectedAction);
510
- setSelectedAction(null);
511
- },
512
- size: "sm",
513
- disabled: !hasContent || disabled,
514
- className: `h-8 w-8 p-0 rounded-full transition-all duration-300 ${hasContent && !disabled ? "bg-primary hover:bg-primary/90 text-primary-foreground shadow-lg shadow-primary/30 hover:shadow-primary/40" : "bg-muted text-muted-foreground cursor-not-allowed"}`,
515
- "aria-label": "Enviar mensagem",
516
- children: /* @__PURE__ */ jsxRuntime.jsx(
517
- framerMotion.motion.div,
518
- {
519
- animate: {
520
- rotate: hasContent ? 0 : -45
521
- },
522
- transition: { duration: 0.2 },
523
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "w-4 h-4" })
524
- }
525
- )
526
- }
527
- )
528
- },
529
- hasContent ? "active" : "inactive"
530
- ) })
531
- ] })
532
- ] })
533
- ] }),
534
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isFocused && /* @__PURE__ */ jsxRuntime.jsx(
535
- framerMotion.motion.div,
536
- {
537
- className: "absolute inset-0 rounded-[var(--radius)] bg-gradient-to-r from-primary/5 via-transparent to-primary/5 pointer-events-none",
538
- initial: { opacity: 0 },
539
- animate: { opacity: 1 },
540
- exit: { opacity: 0 },
541
- transition: { duration: 0.3 }
542
- }
543
- ) })
544
- ]
545
- }
546
- ),
547
- /* @__PURE__ */ jsxRuntime.jsx(
548
- framerMotion.motion.div,
549
- {
550
- className: "mt-2 text-center",
551
- initial: { opacity: 0, y: 5 },
552
- animate: { opacity: 1, y: 0 },
553
- transition: { delay: 0.1 },
554
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "O assistente Xertica pode cometer erros. Considere verificar informações importantes." })
555
- }
556
- )
557
- ] });
558
- }
559
- [
560
- { id: "rich-1", text: "Ver exemplo de Gráfico", icon: React.createElement(lucideReact.BarChart3, { className: "w-4 h-4 mr-2" }) },
561
- { id: "rich-2", text: "Ver exemplo de Imagem", icon: React.createElement(lucideReact.ImageIcon, { className: "w-4 h-4 mr-2" }) },
562
- { id: "rich-3", text: "Ver exemplo de Tabela", icon: React.createElement(lucideReact.Table, { className: "w-4 h-4 mr-2" }) },
563
- { id: "rich-4", text: "Ver exemplo de Documento", icon: React.createElement(lucideReact.FileText, { className: "w-4 h-4 mr-2" }) }
564
- ];
565
- const gerarResposta = (mensagemUsuario, customResponses) => {
566
- const mensagemLower = mensagemUsuario.toLowerCase();
567
- if (customResponses && customResponses.length > 0) {
568
- for (const mock of customResponses) {
569
- const trigger = mock.trigger;
570
- let match = false;
571
- if (trigger instanceof RegExp) {
572
- match = trigger.test(mensagemUsuario);
573
- } else {
574
- match = mensagemLower.includes(trigger.toLowerCase());
575
- }
576
- if (match) {
577
- return mock.response;
578
- }
579
- }
580
- }
581
- const mensagemOriginal = mensagemUsuario;
582
- if (mensagemLower.includes("o que") && (mensagemLower.includes("fazer") || mensagemLower.includes("pedir"))) {
583
- return "Posso ajudar você com diversas tarefas! Posso:\n\n• Analisar dados e métricas dos seus projetos\n• Responder perguntas sobre performance e resultados\n• Sugerir otimizações e melhorias\n• Gerar relatórios e documentação\n• Ajudar no planejamento de sprints\n• E muito mais!\n\nQual tarefa você gostaria de realizar primeiro?";
584
- }
585
- if (mensagemLower.includes("o que você faz") || mensagemLower.includes("quem é você")) {
586
- return "Olá! Sou o Assistente Xertica, uma IA desenvolvida para ajudar você a gerenciar projetos, analisar dados e otimizar processos. Estou aqui 24/7 para responder suas perguntas e auxiliar nas suas tarefas diárias.\n\nPosso processar documentos, analisar áudios e imagens, além de fornecer insights baseados nos dados da plataforma.";
587
- }
588
- if (mensagemLower.includes("projeto") && (mensagemLower.includes("preocupar") || mensagemLower.includes("atenção"))) {
589
- return "Com base na análise dos seus projetos ativos, recomendo focar nos seguintes:\n\n1. **Projeto Alpha** - 15% acima do prazo, requer atenção imediata\n2. **Sistema Beta** - Performance crítica, necessita otimização\n3. **Mobile Gamma** - Aguardando aprovações há 5 dias\n\nGostaria de mais detalhes sobre algum deles?";
590
- }
591
- if (mensagemLower.includes("próximo projeto") || mensagemLower.includes("próxima tarefa")) {
592
- return "Seu próximo projeto prioritário é o **Sistema de Analytics V2**.\n\n📅 Início previsto: Próxima segunda-feira\n👥 Time: 5 desenvolvedores\n⏱️ Duração estimada: 3 sprints\n\nJá preparei um roadmap inicial. Gostaria de revisar?";
593
- }
594
- if (mensagemLower.includes("desempenho") || mensagemLower.includes("performance") || mensagemLower.includes("melhor")) {
595
- return "Analisando os dados de performance dos últimos 30 dias:\n\n🏆 **Melhor Performance:**\n• Projeto Dashboard 2.0: +35% eficiência\n• Sistema CRM: -40% tempo de resposta\n• App Mobile: 4.8★ rating (+0.5)\n\n📊 Todos estão acima das metas estabelecidas. Parabéns!\n\nQuer ver métricas detalhadas?";
596
- }
597
- if (mensagemLower.includes("olá") || mensagemLower.includes("oi") || mensagemLower.includes("bom dia") || mensagemLower.includes("boa tarde") || mensagemLower.includes("boa noite")) {
598
- return "Olá! 👋 Como posso ajudar você hoje? Estou pronto para auxiliar com análises, relatórios ou responder suas dúvidas sobre os projetos.";
599
- }
600
- if (mensagemLower.includes("obrigado") || mensagemLower.includes("obrigada")) {
601
- return "Por nada! Estou aqui sempre que precisar. 😊 Se tiver mais alguma dúvida ou precisar de ajuda, é só chamar!";
602
- }
603
- if (mensagemLower.includes("criar documento")) {
604
- const tema = mensagemOriginal.replace(/📄 \[Criar documento\]/gi, "").trim() || "Novo Documento";
605
- return {
606
- content: `📝 Documento criado com sucesso!
607
-
608
- Gerei um documento completo sobre "${tema}". O documento está pronto para revisão e pode ser editado conforme necessário.`,
609
- attachmentType: "document",
610
- attachmentName: `Documento - ${tema}.md`,
611
- documentTitle: tema,
612
- documentContent: `# ${tema}
613
-
614
- ## Introdução
615
- Este é um documento gerado automaticamente sobre ${tema}.
616
-
617
- ## Detalhes
618
- - Item 1
619
- - Item 2
620
-
621
- ## Conclusão
622
- Documento finalizado.`
623
- };
624
- }
625
- if (mensagemLower.includes("gráfico") || mensagemLower.includes("chart")) {
626
- return {
627
- content: "Aqui está a análise de performance solicitada:",
628
- chartData: [
629
- { month: "Jan", desktop: 186, mobile: 80 },
630
- { month: "Fev", desktop: 305, mobile: 200 },
631
- { month: "Mar", desktop: 237, mobile: 120 },
632
- { month: "Abr", desktop: 73, mobile: 190 },
633
- { month: "Mai", desktop: 209, mobile: 130 },
634
- { month: "Jun", desktop: 214, mobile: 140 }
635
- ],
636
- chartConfig: {
637
- desktop: { label: "Desktop", color: "hsl(var(--primary))" },
638
- mobile: { label: "Mobile", color: "hsl(var(--destructive))" }
639
- }
640
- };
641
- }
642
- if (mensagemLower.includes("tabela") || mensagemLower.includes("table")) {
643
- return {
644
- content: "Aqui estão os dados estruturados conforme solicitado:",
645
- tableData: {
646
- caption: "Lista de Projetos Ativos",
647
- headers: ["Projeto", "Status", "Prazo"],
648
- rows: [
649
- ["Alpha", "Em andamento", "15/05"],
650
- ["Beta", "Concluido", "02/04"],
651
- ["Gamma", "Atrasado", "10/01"]
652
- ]
653
- }
654
- };
655
- }
656
- if (mensagemLower.includes("exemplo de documento")) {
657
- return {
658
- content: "Com certeza! Aqui está um exemplo de documento profissional que acabei de gerar:",
659
- attachmentType: "document",
660
- attachmentName: "Proposta_Comercial_Xertica.md",
661
- documentTitle: "Proposta Comercial Xertica",
662
- documentContent: "# Proposta Comercial\n\n## 1. Visão Geral\nNossa solução oferece o melhor desempenho para sua empresa.\n\n## 2. Investimento\nO valor total é de R$ 50.000,00."
663
- };
664
- }
665
- if (mensagemLower.includes("arquivo") || mensagemLower.includes("documento")) {
666
- return "Entendi que você deseja trabalhar com arquivos. Posso analisar diversos tipos de documentos:\n\n📄 Documentos de texto (PDF, DOCX)\n📊 Planilhas (XLSX, CSV)\n📈 Relatórios e apresentações\n\nBasta enviá-los usando o botão de anexo (📎) e terei prazer em analisá-los para você!";
667
- }
668
- const respostasGenericas = [
669
- "Entendo sua questão. Com base nos dados disponíveis na plataforma Xertica, posso fornecer análises detalhadas sobre esse tema. Poderia me dar mais contexto para que eu possa ajudá-lo melhor?",
670
- "Interessante! Deixe-me processar isso... Com base no seu histórico e nos dados do sistema, recomendo que possamos explorar essa questão em mais detalhes. O que especificamente você gostaria de saber?",
671
- "Ótima pergunta! Para te dar a melhor resposta possível, preciso entender melhor o contexto. Você pode me fornecer mais informações sobre o que está buscando?",
672
- "Estou analisando sua solicitação. Baseado nos dados do sistema Xertica, posso te ajudar com isso. Você gostaria de uma análise rápida ou um relatório completo?"
673
- ];
674
- return respostasGenericas[Math.floor(Math.random() * respostasGenericas.length)];
675
- };
676
- function AssistantTooltipContent({
677
- className,
678
- sideOffset = 0,
679
- children,
680
- ...props
681
- }) {
682
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
683
- TooltipPrimitive__namespace.Content,
684
- {
685
- "data-slot": "tooltip-content",
686
- sideOffset,
687
- className: tooltip.cn(
688
- "bg-popover text-popover-foreground shadow-lg 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
689
- className
690
- ),
691
- ...props,
692
- children: [
693
- children,
694
- /* @__PURE__ */ jsxRuntime.jsx(
695
- TooltipPrimitive__namespace.Arrow,
696
- {
697
- className: "fill-popover z-50 drop-shadow-sm",
698
- width: 8,
699
- height: 4
700
- }
701
- )
702
- ]
703
- }
704
- ) });
705
- }
706
- function XerticaAssistant({
707
- mode = "expanded",
708
- isExpanded: controlledIsExpanded,
709
- onToggle,
710
- defaultTab = "chat",
711
- demoMode = true,
712
- onNavigateSettings,
713
- onNavigateFullPage,
714
- userName = "Usuário",
715
- initialMessages = [],
716
- savedConversations = [],
717
- suggestions: propSuggestions,
718
- onSendMessage,
719
- onFileAttach,
720
- isProcessing = false,
721
- width,
722
- height,
723
- className = "",
724
- mobileFloating = false,
725
- customResponses = [],
726
- responseGenerator,
727
- richSuggestions = [],
728
- onRichAction,
729
- onEvaluation,
730
- feedbackOptions,
731
- // Feature flags — all default to true for backward compatibility
732
- showHistory = true,
733
- showFavorites = true,
734
- enableAudioInput = true,
735
- enableFileAttachment = true,
736
- enableDocumentCreation = true,
737
- enablePodcastGeneration = true,
738
- enableSearch = true
739
- }) {
740
- const isFullPage = mode === "fullPage";
741
- const [internalIsExpanded, setInternalIsExpanded] = React.useState(controlledIsExpanded ?? true);
742
- const isExpanded = controlledIsExpanded ?? internalIsExpanded;
743
- const [isMobile, setIsMobile] = React.useState(false);
744
- React.useEffect(() => {
745
- const handleResize = () => setIsMobile(window.innerWidth < 768);
746
- handleResize();
747
- window.addEventListener("resize", handleResize);
748
- return () => window.removeEventListener("resize", handleResize);
749
- }, []);
750
- const [abaSelecionada, setAbaSelecionada] = React.useState(defaultTab);
751
- const [mensagens, setMensagens] = React.useState(initialMessages);
752
- const [mensagem, setMensagem] = React.useState("");
753
- const [conversas, setConversas] = React.useState(savedConversations);
754
- const [conversaAtual, setConversaAtual] = React.useState(null);
755
- const [copiedId, setCopiedId] = React.useState(null);
756
- const [generatingPodcastId, setGeneratingPodcastId] = React.useState(null);
757
- const [executingCommand, setExecutingCommand] = React.useState(null);
758
- const [savedSearches, setSavedSearches] = React.useState([]);
759
- const [editingDocument, setEditingDocument] = React.useState(null);
760
- const [showMoreSuggestions, setShowMoreSuggestions] = React.useState(false);
761
- const [evaluationState, setEvaluationState] = React.useState({
762
- isOpen: false,
763
- messageId: null,
764
- type: null,
765
- category: null,
766
- reason: ""
767
- });
768
- const messagesEndRef = React.useRef(null);
769
- const fileInputRef = React.useRef(null);
770
- const audioInputRef = React.useRef(null);
771
- const defaultSuggestions = [
772
- { id: "1", text: "Me ajude a criar um documento profissional" },
773
- { id: "2", text: 'Buscar nos meus arquivos por "relatório"' },
774
- { id: "3", text: "Resuma as conversas importantes desta semana" },
775
- { id: "4", text: "Crie um podcast sobre o último projeto" }
776
- ];
777
- const sugestoes = propSuggestions ?? defaultSuggestions;
778
- React.useEffect(() => {
779
- if (messagesEndRef.current && abaSelecionada === "chat") {
780
- messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
781
- }
782
- }, [mensagens, abaSelecionada]);
783
- React.useEffect(() => {
784
- if (initialMessages && initialMessages.length > 0) {
785
- setMensagens(initialMessages);
786
- }
787
- }, [initialMessages]);
788
- const handleToggle = () => {
789
- if (onToggle) {
790
- onToggle();
791
- } else {
792
- setInternalIsExpanded(!internalIsExpanded);
793
- }
794
- };
795
- const handleExpandWithTab = (tab) => {
796
- setAbaSelecionada(tab);
797
- if (onToggle) {
798
- onToggle();
799
- } else {
800
- setInternalIsExpanded(true);
801
- }
802
- };
803
- const handleEnviarMensagem = async (arg) => {
804
- let msgToSend = mensagem;
805
- if (typeof arg === "string" && !["document", "podcast", "search"].includes(arg)) {
806
- msgToSend = arg;
807
- }
808
- if (!msgToSend.trim() || isProcessing) return;
809
- const novaMensagem = {
810
- id: `msg-${Date.now()}`,
811
- type: "user",
812
- content: msgToSend,
813
- timestamp: /* @__PURE__ */ new Date(),
814
- isFavorite: false
815
- };
816
- setMensagens((prev) => [...prev, novaMensagem]);
817
- if (onSendMessage) {
818
- onSendMessage(msgToSend);
819
- }
820
- if (demoMode || responseGenerator) {
821
- const mensagemAtual = msgToSend;
822
- setTimeout(async () => {
823
- let resposta;
824
- if (responseGenerator) {
825
- resposta = await responseGenerator(mensagemAtual);
826
- } else {
827
- resposta = gerarResposta(mensagemAtual, customResponses);
828
- }
829
- let novaMensagemIA = {
830
- id: `msg-${Date.now()}-ia`,
831
- type: "assistant",
832
- content: "",
833
- timestamp: /* @__PURE__ */ new Date(),
834
- isFavorite: false
835
- };
836
- if (typeof resposta === "string") {
837
- novaMensagemIA.content = resposta;
838
- } else {
839
- novaMensagemIA = { ...novaMensagemIA, ...resposta };
840
- }
841
- setMensagens((prev) => [...prev, novaMensagemIA]);
842
- }, 1e3 + Math.random() * 1e3);
843
- }
844
- setMensagem("");
845
- };
846
- const handleCopyMessage = async (content, messageId) => {
847
- try {
848
- if (navigator.clipboard && navigator.clipboard.writeText) {
849
- try {
850
- await navigator.clipboard.writeText(content);
851
- setCopiedId(messageId);
852
- setTimeout(() => setCopiedId(null), 2e3);
853
- } catch (clipboardError) {
854
- if (clipboardError.name === "NotAllowedError" || clipboardError.message.includes("permissions policy")) {
855
- throw new Error("Clipboard permission denied, falling back");
856
- }
857
- throw clipboardError;
858
- }
859
- } else {
860
- throw new Error("Clipboard API not available");
861
- }
862
- } catch (err) {
863
- try {
864
- const textArea = document.createElement("textarea");
865
- textArea.value = content;
866
- textArea.style.position = "fixed";
867
- textArea.style.left = "-999999px";
868
- textArea.style.top = "-999999px";
869
- document.body.appendChild(textArea);
870
- textArea.focus();
871
- textArea.select();
872
- const successful = document.execCommand("copy");
873
- document.body.removeChild(textArea);
874
- if (successful) {
875
- setCopiedId(messageId);
876
- setTimeout(() => setCopiedId(null), 2e3);
877
- } else {
878
- console.error("Falha ao copiar: execCommand returned false");
879
- }
880
- } catch (fallbackErr) {
881
- console.error("Falha ao copiar:", fallbackErr);
882
- }
883
- }
884
- };
885
- const handleGeneratePodcast = async (messageId, content) => {
886
- setGeneratingPodcastId(messageId);
887
- setTimeout(() => {
888
- setMensagens(
889
- (prev) => prev.map(
890
- (msg) => msg.id === messageId ? {
891
- ...msg,
892
- attachmentType: "podcast",
893
- attachmentName: "Podcast - " + content.substring(0, 30) + "...",
894
- audioUrl: "data:audio/mpeg;base64,//uQx..."
895
- // Mock
896
- } : msg
897
- )
898
- );
899
- setGeneratingPodcastId(null);
900
- }, 2e3);
901
- };
902
- const handleDownloadDocument = (content, fileName) => {
903
- const blob = new Blob([content], { type: "text/markdown" });
904
- const url = URL.createObjectURL(blob);
905
- const a = document.createElement("a");
906
- a.href = url;
907
- a.download = fileName.endsWith(".md") ? fileName : fileName + ".md";
908
- document.body.appendChild(a);
909
- a.click();
910
- document.body.removeChild(a);
911
- URL.revokeObjectURL(url);
912
- };
913
- const handleDownloadPodcast = (audioUrl, fileName) => {
914
- const a = document.createElement("a");
915
- a.href = audioUrl;
916
- a.download = fileName.endsWith(".mp3") ? fileName : fileName + ".mp3";
917
- document.body.appendChild(a);
918
- a.click();
919
- document.body.removeChild(a);
920
- };
921
- const handleEditDocument = (content, title) => {
922
- setEditingDocument({ content, title });
923
- };
924
- const handleNovaConversa = () => {
925
- setMensagens([]);
926
- setConversaAtual(null);
927
- setAbaSelecionada("chat");
928
- };
929
- const handleSelecionarConversa = (conversaId) => {
930
- const conversa = conversas.find((c) => c.id === conversaId);
931
- if (conversa) {
932
- setMensagens(conversa.messages);
933
- setConversaAtual(conversaId);
934
- setAbaSelecionada("chat");
935
- }
936
- };
937
- const handleToggleFavoritaConversa = (conversaId) => {
938
- setConversas(
939
- (prev) => prev.map(
940
- (conv) => conv.id === conversaId ? { ...conv, isFavorite: !conv.isFavorite } : conv
941
- )
942
- );
943
- };
944
- const handleOpenSearchResult = (result) => {
945
- console.log("Abrir resultado:", result);
946
- };
947
- const handleExecuteSearchCommand = async (commandId, searchTerm, results, messageId) => {
948
- setExecutingCommand(commandId);
949
- setTimeout(() => {
950
- if (commandId === "5") {
951
- setSavedSearches((prev) => [...prev, messageId]);
952
- }
953
- setExecutingCommand(null);
954
- }, 1500);
955
- };
956
- const handleRichSuggestionClick = (suggestion) => {
957
- if (onRichAction) {
958
- onRichAction(suggestion.id, suggestion.text);
959
- } else {
960
- handleEnviarMensagem(suggestion.text);
961
- }
962
- setShowMoreSuggestions(false);
963
- };
964
- const handleEvaluationClick = (messageId, type) => {
965
- {
966
- if (onEvaluation) onEvaluation(messageId, "like");
967
- setMensagens((prev) => prev.map((m) => m.id === messageId ? { ...m, evaluation: "like" } : m));
968
- sonner.toast.success("Obrigado por avaliar positivamente!");
969
- }
970
- };
971
- const openFeedbackDialog = (messageId, category) => {
972
- setEvaluationState({
973
- isOpen: true,
974
- messageId,
975
- type: "dislike",
976
- category,
977
- reason: ""
978
- });
979
- };
980
- const handleSubmitDislike = () => {
981
- if (evaluationState.messageId) {
982
- const finalReason = evaluationState.category ? evaluationState.reason ? `${evaluationState.category}: ${evaluationState.reason}` : evaluationState.category : evaluationState.reason;
983
- if (onEvaluation) {
984
- onEvaluation(evaluationState.messageId, "dislike", finalReason);
985
- }
986
- setMensagens((prev) => prev.map((m) => m.id === evaluationState.messageId ? { ...m, evaluation: "dislike", evaluationReason: finalReason } : m));
987
- sonner.toast.success("Obrigado pelo seu feedback. Vamos melhorar.");
988
- }
989
- setEvaluationState({ isOpen: false, messageId: null, type: null, category: null, reason: "" });
990
- };
991
- const conversasFiltradas = conversas.filter((conversa) => {
992
- if (abaSelecionada === "favoritos") {
993
- return conversa.isFavorite;
994
- }
995
- return true;
996
- });
997
- const containerWidth = width ?? (isFullPage ? "100%" : isExpanded ? editingDocument ? "420px" : "420px" : "80px");
998
- const containerHeight = height ?? "h-full";
999
- if (isMobile && !isExpanded) {
1000
- return /* @__PURE__ */ jsxRuntime.jsxs(
1001
- tooltip.Button,
1002
- {
1003
- onClick: handleToggle,
1004
- className: tooltip.cn(
1005
- "fixed bottom-4 right-4 h-14 rounded-full shadow-lg pl-3 pr-5 gap-3 bg-white text-zinc-900 hover:bg-zinc-50 border border-zinc-200 z-50 transition-all duration-300",
1006
- className
1007
- ),
1008
- children: [
1009
- /* @__PURE__ */ jsxRuntime.jsx(XerticaOrbe.XerticaOrbe, { size: 32 }),
1010
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-base tracking-wide", children: "Assistente" })
1011
- ]
1012
- }
1013
- );
1014
- }
1015
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1016
- /* @__PURE__ */ jsxRuntime.jsx(
1017
- "input",
1018
- {
1019
- ref: fileInputRef,
1020
- type: "file",
1021
- accept: ".pdf,.doc,.docx,.txt,.md",
1022
- className: "hidden",
1023
- onChange: (e) => {
1024
- var _a;
1025
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
1026
- if (file && onFileAttach) {
1027
- onFileAttach(file);
1028
- }
1029
- },
1030
- "aria-label": "Upload de documento"
1031
- }
1032
- ),
1033
- /* @__PURE__ */ jsxRuntime.jsx(
1034
- "input",
1035
- {
1036
- ref: audioInputRef,
1037
- type: "file",
1038
- accept: "audio/*",
1039
- className: "hidden",
1040
- onChange: (e) => {
1041
- var _a;
1042
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
1043
- if (file && onFileAttach) {
1044
- onFileAttach(file);
1045
- }
1046
- },
1047
- "aria-label": "Upload de áudio"
1048
- }
1049
- ),
1050
- /* @__PURE__ */ jsxRuntime.jsxs(
1051
- "div",
1052
- {
1053
- className: tooltip.cn(
1054
- `${containerHeight} flex flex-col bg-background relative`,
1055
- !isFullPage && "border-l border-border shadow-sm",
1056
- isMobile && isExpanded && "fixed inset-0 z-[100] h-[100dvh] w-full border-l-0 shadow-2xl",
1057
- className
1058
- ),
1059
- style: !(isMobile && isExpanded) ? {
1060
- width: isFullPage ? "100%" : containerWidth
1061
- } : void 0,
1062
- children: [
1063
- editingDocument && !isFullPage && /* @__PURE__ */ jsxRuntime.jsx(
1064
- "div",
1065
- {
1066
- className: tooltip.cn(
1067
- "flex flex-col border-border bg-background overflow-hidden transition-all duration-300",
1068
- isMobile ? "fixed inset-0 z-[110] w-full h-[100dvh]" : "absolute top-0 bottom-0 right-full w-[800px] border-l border-r border-border shadow-[-25px_0_50px_-15px_rgba(0,0,0,0.15)] z-[90]"
1069
- ),
1070
- style: { maxWidth: isMobile ? "none" : `calc(100vw - ${containerWidth})` },
1071
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full flex flex-col", children: [
1072
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 h-[64px] border-b border-border bg-card flex items-center justify-between", children: [
1073
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
1074
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 bg-primary/10 rounded-md", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "w-4 h-4 text-primary" }) }),
1075
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-card-foreground text-sm", children: editingDocument.title })
1076
- ] }),
1077
- /* @__PURE__ */ jsxRuntime.jsx(
1078
- tooltip.Button,
1079
- {
1080
- variant: "ghost",
1081
- size: "icon",
1082
- className: "h-8 w-8 rounded-full",
1083
- onClick: () => setEditingDocument(null),
1084
- "aria-label": "Fechar editor de documento",
1085
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-4 h-4" })
1086
- }
1087
- )
1088
- ] }),
1089
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 bg-muted/20 p-0 sm:p-6 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
1090
- richTextEditor.RichTextEditor,
1091
- {
1092
- value: editingDocument.content || "",
1093
- onChange: (newVal) => setEditingDocument((prev) => prev ? { ...prev, content: newVal } : null),
1094
- placeholder: "Comece a digitar o conteúdo do seu documento aqui...",
1095
- className: "max-w-4xl mx-auto h-full",
1096
- actionButton: /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Button, { size: "sm", className: "gap-2 h-8", children: [
1097
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5" }),
1098
- "Salvar"
1099
- ] })
1100
- }
1101
- ) })
1102
- ] })
1103
- }
1104
- ),
1105
- !isFullPage && /* @__PURE__ */ jsxRuntime.jsxs(
1106
- "div",
1107
- {
1108
- className: tooltip.cn(
1109
- "border-b border-border flex items-center h-[64px]",
1110
- isExpanded ? "justify-between px-4" : "justify-center px-0"
1111
- ),
1112
- children: [
1113
- isExpanded && /* @__PURE__ */ jsxRuntime.jsxs(
1114
- framerMotion.motion.div,
1115
- {
1116
- initial: { opacity: 0, x: -10 },
1117
- animate: { opacity: 1, x: 0 },
1118
- exit: { opacity: 0, x: -10 },
1119
- className: "flex items-center gap-2 overflow-hidden",
1120
- children: [
1121
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(XerticaOrbe.XerticaOrbe, { size: 32 }) }),
1122
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium truncate", children: "Assistente Xertica" })
1123
- ]
1124
- }
1125
- ),
1126
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1127
- isExpanded && onNavigateFullPage && /* @__PURE__ */ jsxRuntime.jsx(
1128
- tooltip.Button,
1129
- {
1130
- variant: "ghost",
1131
- size: "sm",
1132
- onClick: onNavigateFullPage,
1133
- className: "h-8 w-8 p-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-full",
1134
- title: "Expandir assistente",
1135
- "aria-label": "Expandir assistente",
1136
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize2, { className: "w-4 h-4" })
1137
- }
1138
- ),
1139
- /* @__PURE__ */ jsxRuntime.jsx(
1140
- tooltip.Button,
1141
- {
1142
- variant: "ghost",
1143
- size: "sm",
1144
- onClick: handleToggle,
1145
- className: tooltip.cn(
1146
- "h-8 w-8 p-0 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-full",
1147
- !isExpanded && "w-10 h-10"
1148
- // Slightly larger touch target when collapsed if desired, or keep consistent
1149
- ),
1150
- "aria-label": isExpanded ? "Recolher assistente" : "Expandir assistente",
1151
- children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "w-4 h-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelRight, { className: "w-4 h-4" })
1152
- }
1153
- )
1154
- ] })
1155
- ]
1156
- }
1157
- ),
1158
- !isExpanded && !isFullPage && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center p-4 space-y-4", children: [
1159
- /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1160
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1161
- "button",
1162
- {
1163
- onClick: handleToggle,
1164
- className: "w-10 h-10 rounded-full flex items-center justify-center hover:bg-accent/50 transition-colors duration-200 cursor-pointer mx-auto",
1165
- "aria-label": "Abrir assistente",
1166
- children: /* @__PURE__ */ jsxRuntime.jsx(XerticaOrbe.XerticaOrbe, { size: 32 })
1167
- }
1168
- ) }),
1169
- /* @__PURE__ */ jsxRuntime.jsx(
1170
- AssistantTooltipContent,
1171
- {
1172
- side: "left",
1173
- sideOffset: 8,
1174
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Assistente Xertica" })
1175
- }
1176
- )
1177
- ] }),
1178
- /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1179
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1180
- tooltip.Button,
1181
- {
1182
- variant: "ghost",
1183
- size: "sm",
1184
- onClick: () => handleExpandWithTab("chat"),
1185
- className: "w-8 h-8 p-0 text-muted-foreground",
1186
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquare, { className: "w-4 h-4" })
1187
- }
1188
- ) }),
1189
- /* @__PURE__ */ jsxRuntime.jsx(
1190
- AssistantTooltipContent,
1191
- {
1192
- side: "left",
1193
- sideOffset: 8,
1194
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Chat" })
1195
- }
1196
- )
1197
- ] }),
1198
- showFavorites && /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1199
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1200
- tooltip.Button,
1201
- {
1202
- variant: "ghost",
1203
- size: "sm",
1204
- onClick: () => handleExpandWithTab("favoritos"),
1205
- className: "w-8 h-8 p-0 text-muted-foreground",
1206
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heart, { className: "w-4 h-4" })
1207
- }
1208
- ) }),
1209
- /* @__PURE__ */ jsxRuntime.jsx(
1210
- AssistantTooltipContent,
1211
- {
1212
- side: "left",
1213
- sideOffset: 8,
1214
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Favoritos" })
1215
- }
1216
- )
1217
- ] }),
1218
- showHistory && /* @__PURE__ */ jsxRuntime.jsxs(tooltip.Tooltip, { children: [
1219
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1220
- tooltip.Button,
1221
- {
1222
- variant: "ghost",
1223
- size: "sm",
1224
- onClick: () => handleExpandWithTab("historico"),
1225
- className: "w-8 h-8 p-0 text-muted-foreground",
1226
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.History, { className: "w-4 h-4" })
1227
- }
1228
- ) }),
1229
- /* @__PURE__ */ jsxRuntime.jsx(
1230
- AssistantTooltipContent,
1231
- {
1232
- side: "left",
1233
- sideOffset: 8,
1234
- children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Histórico" })
1235
- }
1236
- )
1237
- ] })
1238
- ] }),
1239
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: (isExpanded || isFullPage) && /* @__PURE__ */ jsxRuntime.jsxs(
1240
- framerMotion.motion.div,
1241
- {
1242
- initial: isFullPage ? false : { opacity: 0, x: 50 },
1243
- animate: { opacity: 1, x: 0 },
1244
- exit: isFullPage ? void 0 : { opacity: 0, x: 50 },
1245
- transition: { duration: 0.2 },
1246
- className: "flex-1 flex flex-col overflow-hidden",
1247
- children: [
1248
- !isFullPage && /* @__PURE__ */ jsxRuntime.jsx(
1249
- "div",
1250
- {
1251
- className: "px-4 py-2 border-b border-border",
1252
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
1253
- /* @__PURE__ */ jsxRuntime.jsxs(
1254
- tooltip.Button,
1255
- {
1256
- variant: abaSelecionada === "chat" ? "default" : "ghost",
1257
- size: "sm",
1258
- onClick: () => setAbaSelecionada("chat"),
1259
- className: "flex-1 h-8",
1260
- "aria-label": "Ver chat",
1261
- children: [
1262
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquare, { className: "w-3 h-3 mr-1" }),
1263
- "Chat"
1264
- ]
1265
- }
1266
- ),
1267
- showHistory && /* @__PURE__ */ jsxRuntime.jsxs(
1268
- tooltip.Button,
1269
- {
1270
- variant: abaSelecionada === "historico" ? "default" : "ghost",
1271
- size: "sm",
1272
- onClick: () => setAbaSelecionada("historico"),
1273
- className: "flex-1 h-8",
1274
- "aria-label": "Ver histórico de conversas",
1275
- children: [
1276
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.History, { className: "w-3 h-3 mr-1" }),
1277
- "Histórico"
1278
- ]
1279
- }
1280
- ),
1281
- showFavorites && /* @__PURE__ */ jsxRuntime.jsxs(
1282
- tooltip.Button,
1283
- {
1284
- variant: abaSelecionada === "favoritos" ? "default" : "ghost",
1285
- size: "sm",
1286
- onClick: () => setAbaSelecionada("favoritos"),
1287
- className: "flex-1 h-8",
1288
- "aria-label": "Ver mensagens favoritas",
1289
- children: [
1290
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heart, { className: "w-3 h-3 mr-1" }),
1291
- "Favoritos"
1292
- ]
1293
- }
1294
- )
1295
- ] })
1296
- }
1297
- ),
1298
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-hidden flex flex-col", children: [
1299
- abaSelecionada === "chat" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-1 flex flex-col min-h-0 ${isFullPage ? "mx-auto w-full max-w-6xl" : ""}`, children: mensagens.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto min-h-0", children: [
1300
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 text-center", children: [
1301
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto mb-4 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(XerticaOrbe.XerticaOrbe, { size: 64 }) }),
1302
- /* @__PURE__ */ jsxRuntime.jsxs("h3", { className: "mb-2 text-foreground", children: [
1303
- "Olá, ",
1304
- userName
1305
- ] }),
1306
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground", children: "Como posso ajudar?" })
1307
- ] }),
1308
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 pb-4 space-y-2", children: [
1309
- sugestoes.map((sugestao) => /* @__PURE__ */ jsxRuntime.jsx(
1310
- "button",
1311
- {
1312
- onClick: () => handleEnviarMensagem(sugestao.text),
1313
- className: "w-full p-3 text-left rounded-[var(--radius-card)] bg-muted text-foreground transition-colors duration-200 hover:bg-muted/80",
1314
- children: sugestao.text
1315
- },
1316
- sugestao.id
1317
- )),
1318
- !showMoreSuggestions ? /* @__PURE__ */ jsxRuntime.jsxs(
1319
- tooltip.Button,
1320
- {
1321
- variant: "ghost",
1322
- size: "sm",
1323
- onClick: () => setShowMoreSuggestions(true),
1324
- className: "w-full justify-start text-muted-foreground",
1325
- children: [
1326
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "w-4 h-4 mr-2" }),
1327
- "Mais sugestões"
1328
- ]
1329
- }
1330
- ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 pt-2 border-t border-border mt-2 animate-in slide-in-from-top-2", children: [
1331
- richSuggestions.length > 0 ? richSuggestions.map((sugestao) => /* @__PURE__ */ jsxRuntime.jsx(
1332
- "button",
1333
- {
1334
- onClick: () => handleRichSuggestionClick(sugestao),
1335
- className: "w-full p-3 text-left rounded-[var(--radius-card)] bg-muted/50 border border-border text-foreground transition-all duration-200 hover:bg-primary/5 hover:border-primary/50 group",
1336
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1337
- sugestao.id.includes("chart") && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.BarChart3, { className: "w-4 h-4 text-primary" }),
1338
- sugestao.id.includes("table") && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { className: "w-4 h-4 text-primary" }),
1339
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: sugestao.text })
1340
- ] })
1341
- },
1342
- sugestao.id
1343
- )) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground text-center py-2", children: "Nenhuma sugestão extra." }),
1344
- /* @__PURE__ */ jsxRuntime.jsxs(
1345
- tooltip.Button,
1346
- {
1347
- variant: "ghost",
1348
- size: "sm",
1349
- onClick: () => setShowMoreSuggestions(false),
1350
- className: "w-full justify-center text-muted-foreground mt-2",
1351
- children: [
1352
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "w-4 h-4 mr-2" }),
1353
- "Voltar"
1354
- ]
1355
- }
1356
- )
1357
- ] })
1358
- ] })
1359
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(input.ScrollArea, { className: "flex-1 min-h-0 overflow-x-hidden [&_[data-radix-scroll-area-viewport]>div]:!block", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 px-4 py-4 max-w-6xl mx-auto !block !w-full", children: [
1360
- mensagens.map((msg) => /* @__PURE__ */ jsxRuntime.jsxs(
1361
- framerMotion.motion.div,
1362
- {
1363
- initial: { opacity: 0, y: 10 },
1364
- animate: { opacity: 1, y: 0 },
1365
- className: `flex gap-2 w-full min-w-0 ${msg.type === "user" ? "justify-end" : "justify-start"}`,
1366
- children: [
1367
- msg.type === "assistant" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(XerticaOrbe.XerticaOrbe, { size: 32 }) }),
1368
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tooltip.cn(
1369
- "flex flex-col min-w-0 transition-all duration-300",
1370
- msg.type === "user" ? "max-w-[85%] md:max-w-[70%] items-end w-fit" : tooltip.cn(
1371
- "items-start",
1372
- msg.tableData || msg.chartData || msg.searchResults || msg.attachmentType === "document" ? "w-full max-w-full" : "w-fit max-w-[95%] md:max-w-[90%]"
1373
- )
1374
- ), children: [
1375
- /* @__PURE__ */ jsxRuntime.jsxs(
1376
- "div",
1377
- {
1378
- className: tooltip.cn(
1379
- "px-4 py-2 break-words overflow-hidden overflow-x-hidden w-full min-w-0 rounded-2xl",
1380
- msg.type === "user" ? "bg-primary text-primary-foreground shadow-sm" : "bg-muted text-foreground"
1381
- ),
1382
- children: [
1383
- msg.attachmentType === "document" && /* @__PURE__ */ jsxRuntime.jsxs(
1384
- "div",
1385
- {
1386
- className: "flex items-center justify-between mb-2 pb-2 border-b border-border min-w-0 overflow-hidden",
1387
- children: [
1388
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1 overflow-hidden", children: [
1389
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "w-4 h-4 flex-shrink-0" }),
1390
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium break-words", children: msg.attachmentName })
1391
- ] }),
1392
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
1393
- /* @__PURE__ */ jsxRuntime.jsx(
1394
- tooltip.Button,
1395
- {
1396
- variant: "ghost",
1397
- size: "sm",
1398
- onClick: () => msg.documentContent && msg.attachmentName && handleDownloadDocument(msg.documentContent, msg.attachmentName),
1399
- className: "h-6 px-2",
1400
- title: "Baixar",
1401
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "w-3 h-3" })
1402
- }
1403
- ),
1404
- /* @__PURE__ */ jsxRuntime.jsxs(
1405
- tooltip.Button,
1406
- {
1407
- variant: "ghost",
1408
- size: "sm",
1409
- onClick: () => msg.documentContent && msg.documentTitle && handleEditDocument(msg.documentContent, msg.documentTitle),
1410
- className: "h-6 px-2",
1411
- children: [
1412
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { className: "w-3 h-3 mr-1" }),
1413
- "Editar"
1414
- ]
1415
- }
1416
- )
1417
- ] })
1418
- ]
1419
- }
1420
- ),
1421
- msg.attachmentType && msg.attachmentType !== "podcast" && msg.attachmentType !== "document" && /* @__PURE__ */ jsxRuntime.jsxs(
1422
- "div",
1423
- {
1424
- className: "flex items-center gap-2 mb-2 pb-2 border-b border-border min-w-0 overflow-hidden",
1425
- children: [
1426
- msg.attachmentType === "file" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "w-4 h-4 flex-shrink-0" }),
1427
- msg.attachmentType === "audio" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Music, { className: "w-4 h-4 flex-shrink-0" }),
1428
- msg.attachmentType === "image" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Image, { className: "w-4 h-4 flex-shrink-0" }),
1429
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-small break-words", children: msg.attachmentName })
1430
- ]
1431
- }
1432
- ),
1433
- msg.type === "user" ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap break-words", children: msg.content }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1434
- (msg.content.includes("🔐") || msg.content.includes("❌")) && /* @__PURE__ */ jsxRuntime.jsx(
1435
- "div",
1436
- {
1437
- className: "mb-3 p-3 border rounded-[var(--radius)] overflow-hidden bg-[var(--toast-error-bg)]/20 border-[var(--toast-error-border)]/30",
1438
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 min-w-0", children: [
1439
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "w-5 h-5 flex-shrink-0 mt-0.5 text-[var(--toast-error-icon)]" }),
1440
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
1441
- MarkdownMessage,
1442
- {
1443
- content: msg.content,
1444
- className: "text-foreground"
1445
- }
1446
- ) })
1447
- ] })
1448
- }
1449
- ),
1450
- !(msg.content.includes("🔐") || msg.content.includes("❌")) && /* @__PURE__ */ jsxRuntime.jsx(
1451
- MarkdownMessage,
1452
- {
1453
- content: msg.content,
1454
- className: "text-foreground"
1455
- }
1456
- )
1457
- ] }),
1458
- msg.chartData && msg.chartConfig && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 w-full h-[300px] min-w-[300px]", children: /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.ChartContainer, { config: msg.chartConfig, className: "h-full w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive.BarChart, { accessibilityLayer: true, data: msg.chartData, children: [
1459
- /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive.CartesianGrid, { vertical: false }),
1460
- /* @__PURE__ */ jsxRuntime.jsx(
1461
- RechartsPrimitive.XAxis,
1462
- {
1463
- dataKey: "month",
1464
- tickLine: false,
1465
- tickMargin: 10,
1466
- axisLine: false,
1467
- tickFormatter: (value) => value.slice(0, 3)
1468
- }
1469
- ),
1470
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.ChartTooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.ChartTooltipContent, {}) }),
1471
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.ChartLegend, { content: /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.ChartLegendContent, {}) }),
1472
- Object.keys(msg.chartConfig).map((key) => /* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive.Bar, { dataKey: key, fill: `var(--color-${key})`, radius: 4 }, key))
1473
- ] }) }) }),
1474
- msg.tableData && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 w-full max-w-full border rounded-[var(--radius)] overflow-x-auto custom-scrollbar relative", children: /* @__PURE__ */ jsxRuntime.jsxs(richTextEditor.Table, { children: [
1475
- msg.tableData.caption && /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableCaption, { children: msg.tableData.caption }),
1476
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableRow, { children: msg.tableData.headers.map((header, i) => /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableHead, { children: header }, i)) }) }),
1477
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableBody, { children: msg.tableData.rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableRow, { children: row.map((cell, j) => /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.TableCell, { children: cell }, j)) }, i)) })
1478
- ] }) }),
1479
- msg.attachmentType === "document" && msg.documentContent && /* @__PURE__ */ jsxRuntime.jsx(
1480
- "div",
1481
- {
1482
- className: "mt-3 pt-3 border-t border-border overflow-hidden",
1483
- children: /* @__PURE__ */ jsxRuntime.jsx(
1484
- FormattedDocument,
1485
- {
1486
- content: msg.documentContent,
1487
- maxPreviewLength: 250
1488
- }
1489
- )
1490
- }
1491
- ),
1492
- msg.attachmentType === "podcast" && msg.audioUrl && /* @__PURE__ */ jsxRuntime.jsxs(
1493
- "div",
1494
- {
1495
- className: "mt-3 pt-3 border-t border-border overflow-hidden",
1496
- children: [
1497
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3 min-w-0 overflow-hidden", children: [
1498
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1 overflow-hidden", children: [
1499
- /* @__PURE__ */ jsxRuntime.jsx(
1500
- "div",
1501
- {
1502
- className: "w-6 h-6 flex items-center justify-center flex-shrink-0 rounded-[var(--radius-button)] bg-gradient-to-br from-[var(--chart-1)] via-[var(--chart-4)] to-[var(--chart-1)]",
1503
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Radio, { className: "w-3 h-3 text-white" })
1504
- }
1505
- ),
1506
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium break-words", children: msg.attachmentName })
1507
- ] }),
1508
- /* @__PURE__ */ jsxRuntime.jsx(
1509
- tooltip.Button,
1510
- {
1511
- variant: "ghost",
1512
- size: "sm",
1513
- onClick: () => msg.audioUrl && msg.attachmentName && handleDownloadPodcast(msg.audioUrl, msg.attachmentName),
1514
- className: "h-6 px-2 flex-shrink-0",
1515
- title: "Baixar",
1516
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Download, { className: "w-3 h-3" })
1517
- }
1518
- )
1519
- ] }),
1520
- /* @__PURE__ */ jsxRuntime.jsx(
1521
- "div",
1522
- {
1523
- className: "rounded-[var(--radius)] p-2 overflow-hidden bg-gradient-to-r from-[var(--chart-1)]/10 to-[var(--chart-4)]/10",
1524
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1525
- "audio",
1526
- {
1527
- controls: true,
1528
- className: "w-full max-w-full h-10 outline-none",
1529
- children: [
1530
- /* @__PURE__ */ jsxRuntime.jsx("source", { src: msg.audioUrl, type: "audio/mpeg" }),
1531
- "Seu navegador não suporta o elemento de áudio."
1532
- ]
1533
- }
1534
- )
1535
- }
1536
- )
1537
- ]
1538
- }
1539
- ),
1540
- msg.attachmentType === "search" && msg.searchResults && /* @__PURE__ */ jsxRuntime.jsxs(
1541
- "div",
1542
- {
1543
- className: "mt-3 pt-3 border-t border-border space-y-4 overflow-hidden",
1544
- children: [
1545
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-hidden", children: [
1546
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-3", children: [
1547
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "w-4 h-4 text-[var(--chart-4)]" }),
1548
- /* @__PURE__ */ jsxRuntime.jsxs("h4", { className: "text-foreground", children: [
1549
- "Resultados Encontrados (",
1550
- msg.searchResults.length,
1551
- ")"
1552
- ] })
1553
- ] }),
1554
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2 overflow-hidden", children: msg.searchResults.map((result) => /* @__PURE__ */ jsxRuntime.jsx(
1555
- "div",
1556
- {
1557
- onClick: () => handleOpenSearchResult(result),
1558
- className: "p-3 rounded-[var(--radius)] border border-border transition-all cursor-pointer group overflow-hidden hover:bg-muted/50",
1559
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-2 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 flex-1 min-w-0 overflow-hidden", children: [
1560
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-0.5 flex-shrink-0", children: [
1561
- result.type === "document" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "w-4 h-4 text-[var(--chart-4)]" }),
1562
- result.type === "project" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FolderOpen, { className: "w-4 h-4 text-[var(--chart-1)]" }),
1563
- result.type === "conversation" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquare, { className: "w-4 h-4 text-[var(--chart-2)]" }),
1564
- result.type === "file" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Folder, { className: "w-4 h-4 text-[var(--chart-3)]" }),
1565
- result.type === "contact" && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Users, { className: "w-4 h-4 text-[var(--chart-5)]" })
1566
- ] }),
1567
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0 overflow-hidden", children: [
1568
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 min-w-0", children: [
1569
- /* @__PURE__ */ jsxRuntime.jsx("h5", { className: "text-sm font-medium break-words flex-1 min-w-0 text-foreground", children: result.title }),
1570
- /* @__PURE__ */ jsxRuntime.jsxs(
1571
- "span",
1572
- {
1573
- className: "px-1.5 py-0.5 rounded-sm flex-shrink-0 self-start bg-[var(--chart-4)]/10 text-[var(--chart-4)]",
1574
- children: [
1575
- result.relevance,
1576
- "%"
1577
- ]
1578
- }
1579
- )
1580
- ] }),
1581
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1 line-clamp-2 break-words", children: result.description }),
1582
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 mt-2 flex-wrap min-w-0", children: [
1583
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground flex items-center gap-1 min-w-0 max-w-full", children: [
1584
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "w-3 h-3 flex-shrink-0" }),
1585
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: result.path })
1586
- ] }),
1587
- result.lastModified && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground flex items-center gap-1 flex-shrink-0", children: [
1588
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "w-3 h-3" }),
1589
- result.lastModified
1590
- ] })
1591
- ] })
1592
- ] })
1593
- ] }) })
1594
- },
1595
- result.id
1596
- )) })
1597
- ] }),
1598
- msg.searchSources && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1599
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "mb-2 text-foreground", children: "Fontes Consultadas" }),
1600
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 overflow-hidden", children: msg.searchSources.map((source, index) => /* @__PURE__ */ jsxRuntime.jsxs(
1601
- "div",
1602
- {
1603
- className: "px-3 py-1.5 border max-w-full rounded-[var(--radius-button)] bg-muted border-border",
1604
- children: [
1605
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground break-words", children: source.name }),
1606
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground ml-1 whitespace-nowrap", children: [
1607
- "(",
1608
- source.count,
1609
- ")"
1610
- ] })
1611
- ]
1612
- },
1613
- index
1614
- )) })
1615
- ] }),
1616
- msg.searchCommands && msg.searchResults && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1617
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "mb-2 text-foreground", children: "O que você pode fazer com estes resultados" }),
1618
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-2", children: msg.searchCommands.map((command) => /* @__PURE__ */ jsxRuntime.jsxs(
1619
- "button",
1620
- {
1621
- onClick: () => handleExecuteSearchCommand(
1622
- command.id,
1623
- msg.content.replace("🔍 Pesquisa realizada com sucesso!", "").split('"')[1] || "pesquisa",
1624
- msg.searchResults,
1625
- msg.id
1626
- ),
1627
- disabled: executingCommand === command.id,
1628
- className: tooltip.cn(
1629
- "flex items-start gap-2 p-2 rounded-[var(--radius)] border transition-all text-left disabled:opacity-50 disabled:cursor-not-allowed",
1630
- savedSearches.includes(msg.id) && command.id === "5" ? "border-[var(--toast-warning-border)] bg-[var(--toast-warning-bg)]/20" : "border-border bg-transparent hover:bg-muted/50"
1631
- ),
1632
- children: [
1633
- executingCommand === command.id ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-5 h-5 animate-spin flex-shrink-0 text-primary" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: command.icon }),
1634
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0 overflow-hidden", children: [
1635
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium text-foreground break-words", children: command.id === "5" && savedSearches.includes(msg.id) ? "⭐ Pesquisa salva" : command.label }),
1636
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground break-words", children: executingCommand === command.id ? "Processando..." : command.description })
1637
- ] })
1638
- ]
1639
- },
1640
- command.id
1641
- )) })
1642
- ] })
1643
- ]
1644
- }
1645
- )
1646
- ]
1647
- }
1648
- ),
1649
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-1 px-2", children: [
1650
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: msg.timestamp.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" }) }),
1651
- enablePodcastGeneration && msg.type === "assistant" && msg.attachmentType !== "podcast" && /* @__PURE__ */ jsxRuntime.jsx(
1652
- tooltip.Button,
1653
- {
1654
- variant: "ghost",
1655
- size: "sm",
1656
- onClick: () => handleGeneratePodcast(msg.id, msg.content),
1657
- disabled: generatingPodcastId === msg.id,
1658
- className: "h-6 w-6 p-0 disabled:opacity-50 text-muted-foreground",
1659
- title: "Gerar Podcast",
1660
- "aria-label": "Gerar Podcast",
1661
- children: generatingPodcastId === msg.id ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-3 h-3 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Radio, { className: "w-3 h-3" })
1662
- }
1663
- ),
1664
- msg.type === "assistant" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 border-l border-border pl-2 ml-1", children: [
1665
- /* @__PURE__ */ jsxRuntime.jsx(
1666
- tooltip.Button,
1667
- {
1668
- variant: "ghost",
1669
- size: "icon",
1670
- className: tooltip.cn(
1671
- "h-6 w-6 rounded-full hover:bg-green-100 dark:hover:bg-green-900/20 hover:text-green-600",
1672
- msg.evaluation === "like" && "text-green-600 bg-green-100 dark:bg-green-900/20"
1673
- ),
1674
- onClick: () => handleEvaluationClick(msg.id),
1675
- title: "Gostei",
1676
- "aria-label": "Gostei",
1677
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ThumbsUp, { className: "h-3.5 w-3.5" })
1678
- }
1679
- ),
1680
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenu, { children: [
1681
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1682
- tooltip.Button,
1683
- {
1684
- variant: "ghost",
1685
- size: "icon",
1686
- className: tooltip.cn(
1687
- "h-6 w-6 rounded-full hover:bg-red-100 dark:hover:bg-red-900/20 hover:text-red-600",
1688
- msg.evaluation === "dislike" && "text-red-600 bg-red-100 dark:bg-red-900/20"
1689
- ),
1690
- title: "Não gostei",
1691
- "aria-label": "Não gostei",
1692
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ThumbsDown, { className: "h-3.5 w-3.5" })
1693
- }
1694
- ) }),
1695
- /* @__PURE__ */ jsxRuntime.jsxs(dropdownMenu.DropdownMenuContent, { align: "start", children: [
1696
- feedbackOptions && feedbackOptions.length > 0 ? feedbackOptions.map((option, idx) => /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { onClick: () => openFeedbackDialog(msg.id, option), children: option }, idx)) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1697
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { onClick: () => openFeedbackDialog(msg.id, "Não era o que eu procurava"), children: "Não era o que eu procurava" }),
1698
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { onClick: () => openFeedbackDialog(msg.id, "Informação incorreta"), children: "Informação incorreta" }),
1699
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { onClick: () => openFeedbackDialog(msg.id, "Resposta incompleta"), children: "Resposta incompleta" })
1700
- ] }),
1701
- /* @__PURE__ */ jsxRuntime.jsx(dropdownMenu.DropdownMenuItem, { onClick: () => openFeedbackDialog(msg.id, null), children: "Outros..." })
1702
- ] })
1703
- ] })
1704
- ] }),
1705
- /* @__PURE__ */ jsxRuntime.jsx(
1706
- tooltip.Button,
1707
- {
1708
- variant: "ghost",
1709
- size: "sm",
1710
- onClick: () => handleCopyMessage(msg.content, msg.id),
1711
- className: `h-6 w-6 p-0 ${copiedId === msg.id ? "text-[var(--toast-success-icon)]" : "text-muted-foreground"}`,
1712
- "aria-label": copiedId === msg.id ? "Copiado" : "Copiar mensagem",
1713
- children: copiedId === msg.id ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3 h-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-3 h-3" })
1714
- }
1715
- )
1716
- ] })
1717
- ] })
1718
- ]
1719
- },
1720
- msg.id
1721
- )),
1722
- isProcessing && /* @__PURE__ */ jsxRuntime.jsxs(
1723
- framerMotion.motion.div,
1724
- {
1725
- initial: { opacity: 0, y: 10 },
1726
- animate: { opacity: 1, y: 0 },
1727
- className: "flex gap-2 justify-start",
1728
- children: [
1729
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(XerticaOrbe.XerticaOrbe, { size: 32 }) }),
1730
- /* @__PURE__ */ jsxRuntime.jsx(
1731
- "div",
1732
- {
1733
- className: "px-4 py-3 bg-muted rounded-2xl",
1734
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1", children: [
1735
- /* @__PURE__ */ jsxRuntime.jsx(
1736
- framerMotion.motion.div,
1737
- {
1738
- className: "w-2 h-2 rounded-full bg-muted-foreground",
1739
- animate: { y: [0, -8, 0] },
1740
- transition: { repeat: Infinity, duration: 0.6, delay: 0 }
1741
- }
1742
- ),
1743
- /* @__PURE__ */ jsxRuntime.jsx(
1744
- framerMotion.motion.div,
1745
- {
1746
- className: "w-2 h-2 rounded-full bg-muted-foreground",
1747
- animate: { y: [0, -8, 0] },
1748
- transition: { repeat: Infinity, duration: 0.6, delay: 0.2 }
1749
- }
1750
- ),
1751
- /* @__PURE__ */ jsxRuntime.jsx(
1752
- framerMotion.motion.div,
1753
- {
1754
- className: "w-2 h-2 rounded-full bg-muted-foreground",
1755
- animate: { y: [0, -8, 0] },
1756
- transition: { repeat: Infinity, duration: 0.6, delay: 0.4 }
1757
- }
1758
- )
1759
- ] })
1760
- }
1761
- )
1762
- ]
1763
- }
1764
- ),
1765
- /* @__PURE__ */ jsxRuntime.jsx("div", { ref: messagesEndRef })
1766
- ] }) }) }),
1767
- (abaSelecionada === "historico" && showHistory || abaSelecionada === "favoritos" && showFavorites) && /* @__PURE__ */ jsxRuntime.jsx(input.ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `p-4 ${isFullPage ? "mx-auto w-full max-w-6xl" : ""}`, children: [
1768
- /* @__PURE__ */ jsxRuntime.jsxs(
1769
- tooltip.Button,
1770
- {
1771
- variant: "outline",
1772
- size: "sm",
1773
- onClick: handleNovaConversa,
1774
- className: "w-full mb-4 justify-start",
1775
- children: [
1776
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "w-4 h-4 mr-2" }),
1777
- "Nova Conversa"
1778
- ]
1779
- }
1780
- ),
1781
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: conversasFiltradas.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-8", children: [
1782
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Heart, { className: "w-12 h-12 mx-auto text-muted-foreground/50 mb-2" }),
1783
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground", children: abaSelecionada === "favoritos" ? "Nenhuma conversa favorita ainda" : "Nenhuma conversa no histórico" })
1784
- ] }) : conversasFiltradas.map((conversa) => /* @__PURE__ */ jsxRuntime.jsxs(
1785
- "div",
1786
- {
1787
- onClick: () => handleSelecionarConversa(conversa.id),
1788
- className: tooltip.cn(
1789
- "p-3 rounded-[var(--radius)] cursor-pointer transition-colors duration-200 border",
1790
- conversa.id === conversaAtual ? "border-primary bg-primary/10" : "border-border hover:bg-muted"
1791
- ),
1792
- children: [
1793
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between mb-1", children: [
1794
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-sm font-medium text-foreground truncate flex-1", children: conversa.title }),
1795
- /* @__PURE__ */ jsxRuntime.jsx(
1796
- tooltip.Button,
1797
- {
1798
- variant: "ghost",
1799
- size: "sm",
1800
- onClick: (e) => {
1801
- e.stopPropagation();
1802
- handleToggleFavoritaConversa(conversa.id);
1803
- },
1804
- className: "h-6 w-6 p-0 flex-shrink-0 ml-1",
1805
- children: /* @__PURE__ */ jsxRuntime.jsx(
1806
- lucideReact.Heart,
1807
- {
1808
- className: tooltip.cn(
1809
- "w-3 h-3",
1810
- conversa.isFavorite ? "text-destructive fill-current" : "text-muted-foreground"
1811
- )
1812
- }
1813
- )
1814
- }
1815
- )
1816
- ] }),
1817
- conversa.lastMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground truncate mb-1", children: conversa.lastMessage }),
1818
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: conversa.timestamp })
1819
- ]
1820
- },
1821
- conversa.id
1822
- )) })
1823
- ] }) })
1824
- ] }),
1825
- abaSelecionada === "chat" && /* @__PURE__ */ jsxRuntime.jsx(
1826
- ModernChatInput,
1827
- {
1828
- value: mensagem,
1829
- onChange: setMensagem,
1830
- onSubmit: handleEnviarMensagem,
1831
- onFileUpload: enableFileAttachment ? () => {
1832
- var _a;
1833
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
1834
- } : void 0,
1835
- onAudioUpload: enableAudioInput ? () => {
1836
- var _a;
1837
- return (_a = audioInputRef.current) == null ? void 0 : _a.click();
1838
- } : void 0,
1839
- placeholder: "Envie uma mensagem para Xertica",
1840
- disabled: isProcessing,
1841
- isFullPage,
1842
- enableAudioInput,
1843
- enableFileAttachment,
1844
- enableDocumentCreation,
1845
- enablePodcastGeneration,
1846
- enableSearch
1847
- }
1848
- )
1849
- ]
1850
- }
1851
- ) })
1852
- ]
1853
- }
1854
- ),
1855
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.Dialog, { open: evaluationState.isOpen, onOpenChange: (open) => !open && setEvaluationState((prev) => ({ ...prev, isOpen: false })), children: /* @__PURE__ */ jsxRuntime.jsxs(richTextEditor.DialogContent, { className: "sm:max-w-[600px]", children: [
1856
- /* @__PURE__ */ jsxRuntime.jsxs(richTextEditor.DialogHeader, { children: [
1857
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.DialogTitle, { className: "pr-8", children: evaluationState.category ? `Enviar feedback: ${evaluationState.category}` : "Enviar feedback" }),
1858
- /* @__PURE__ */ jsxRuntime.jsx(richTextEditor.DialogDescription, { children: evaluationState.category ? "Gostaria de adicionar algum comentário? (Opcional)" : "Conte-nos por que essa resposta não foi útil para que possamos melhorar." })
1859
- ] }),
1860
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 py-4 px-6", children: /* @__PURE__ */ jsxRuntime.jsx(
1861
- richTextEditor.Textarea,
1862
- {
1863
- className: "min-h-[100px]",
1864
- placeholder: evaluationState.category ? "Comentário adicional..." : "Descreva o motivo...",
1865
- "aria-label": evaluationState.category ? "Comentário adicional" : "Descreva o motivo",
1866
- value: evaluationState.reason,
1867
- onChange: (e) => setEvaluationState((prev) => ({ ...prev, reason: e.target.value })),
1868
- rows: 4
1869
- }
1870
- ) }),
1871
- /* @__PURE__ */ jsxRuntime.jsxs(richTextEditor.DialogFooter, { children: [
1872
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.Button, { variant: "outline", onClick: () => setEvaluationState((prev) => ({ ...prev, isOpen: false })), children: "Cancelar" }),
1873
- /* @__PURE__ */ jsxRuntime.jsx(tooltip.Button, { onClick: handleSubmitDislike, disabled: !evaluationState.category && !evaluationState.reason.trim(), children: evaluationState.category ? "Confirmar e Enviar" : "Enviar Feedback" })
1874
- ] })
1875
- ] }) })
1876
- ] });
1877
- }
1878
- const elegantTheme = {
1879
- 'code[class*="language-"]': {
1880
- color: "var(--foreground)",
1881
- fontFamily: "var(--font-mono)",
1882
- fontSize: "0.875rem",
1883
- textAlign: "left",
1884
- whiteSpace: "pre",
1885
- wordSpacing: "normal",
1886
- wordBreak: "normal",
1887
- lineHeight: "1.6",
1888
- tabSize: 2,
1889
- hyphens: "none"
1890
- },
1891
- 'pre[class*="language-"]': {
1892
- color: "var(--foreground)",
1893
- fontFamily: "var(--font-mono)",
1894
- fontSize: "0.875rem",
1895
- textAlign: "left",
1896
- whiteSpace: "pre",
1897
- wordSpacing: "normal",
1898
- wordBreak: "normal",
1899
- lineHeight: "1.6",
1900
- tabSize: 2,
1901
- hyphens: "none",
1902
- padding: "1rem",
1903
- margin: 0,
1904
- overflow: "auto",
1905
- background: "transparent"
1906
- },
1907
- "comment": {
1908
- color: "var(--muted-foreground)",
1909
- fontStyle: "italic"
1910
- },
1911
- "prolog": {
1912
- color: "var(--muted-foreground)"
1913
- },
1914
- "doctype": {
1915
- color: "var(--muted-foreground)"
1916
- },
1917
- "cdata": {
1918
- color: "var(--muted-foreground)"
1919
- },
1920
- "punctuation": {
1921
- color: "var(--muted-foreground)"
1922
- },
1923
- "property": {
1924
- color: "var(--chart-4)"
1925
- },
1926
- "tag": {
1927
- color: "var(--chart-1)"
1928
- },
1929
- "boolean": {
1930
- color: "var(--chart-5)"
1931
- },
1932
- "number": {
1933
- color: "var(--chart-5)"
1934
- },
1935
- "constant": {
1936
- color: "var(--chart-5)"
1937
- },
1938
- "symbol": {
1939
- color: "var(--chart-5)"
1940
- },
1941
- "deleted": {
1942
- color: "var(--chart-5)"
1943
- },
1944
- "selector": {
1945
- color: "var(--chart-2)"
1946
- },
1947
- "attr-name": {
1948
- color: "var(--chart-4)"
1949
- },
1950
- "string": {
1951
- color: "var(--chart-2)"
1952
- },
1953
- "char": {
1954
- color: "var(--chart-2)"
1955
- },
1956
- "builtin": {
1957
- color: "var(--chart-4)"
1958
- },
1959
- "inserted": {
1960
- color: "var(--chart-2)"
1961
- },
1962
- "operator": {
1963
- color: "var(--primary)"
1964
- },
1965
- "entity": {
1966
- color: "var(--chart-4)"
1967
- },
1968
- "url": {
1969
- color: "var(--chart-1)"
1970
- },
1971
- ".language-css .token.string": {
1972
- color: "var(--chart-2)"
1973
- },
1974
- ".style .token.string": {
1975
- color: "var(--chart-2)"
1976
- },
1977
- "atrule": {
1978
- color: "var(--chart-3)"
1979
- },
1980
- "attr-value": {
1981
- color: "var(--chart-2)"
1982
- },
1983
- "keyword": {
1984
- color: "var(--chart-3)"
1985
- },
1986
- "function": {
1987
- color: "var(--chart-1)"
1988
- },
1989
- "class-name": {
1990
- color: "var(--chart-4)"
1991
- },
1992
- "regex": {
1993
- color: "var(--chart-5)"
1994
- },
1995
- "important": {
1996
- color: "var(--chart-5)",
1997
- fontWeight: "bold"
1998
- },
1999
- "variable": {
2000
- color: "var(--chart-5)"
2001
- }
2002
- };
2003
- const CodeBlock = ({
2004
- code,
2005
- language = "tsx",
2006
- filename,
2007
- showLineNumbers = false
2008
- }) => {
2009
- const [copied, setCopied] = React.useState(false);
2010
- const handleCopy = async () => {
2011
- try {
2012
- if (navigator.clipboard && navigator.clipboard.writeText) {
2013
- try {
2014
- await navigator.clipboard.writeText(code);
2015
- } catch (clipboardError) {
2016
- if (clipboardError.name === "NotAllowedError" || clipboardError.message.includes("permissions policy")) {
2017
- throw new Error("Clipboard permission denied, falling back");
2018
- }
2019
- throw clipboardError;
2020
- }
2021
- } else {
2022
- throw new Error("Clipboard API not available");
2023
- }
2024
- setCopied(true);
2025
- setTimeout(() => setCopied(false), 2e3);
2026
- } catch (err) {
2027
- try {
2028
- const textArea = document.createElement("textarea");
2029
- textArea.value = code;
2030
- textArea.style.position = "fixed";
2031
- textArea.style.left = "-999999px";
2032
- textArea.style.top = "-999999px";
2033
- document.body.appendChild(textArea);
2034
- textArea.focus();
2035
- textArea.select();
2036
- const successful = document.execCommand("copy");
2037
- document.body.removeChild(textArea);
2038
- if (successful) {
2039
- setCopied(true);
2040
- setTimeout(() => setCopied(false), 2e3);
2041
- } else {
2042
- console.error("Failed to copy text: execCommand returned false");
2043
- }
2044
- } catch (fallbackErr) {
2045
- console.error("All copy methods failed:", fallbackErr);
2046
- }
2047
- }
2048
- };
2049
- const codeString = typeof code === "string" ? code : String(code || "");
2050
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative group rounded-[var(--radius)] border border-border overflow-hidden bg-muted/30", children: [
2051
- filename && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 bg-muted border-b border-border", children: [
2052
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground font-mono", children: filename }),
2053
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground uppercase", children: language })
2054
- ] }),
2055
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
2056
- /* @__PURE__ */ jsxRuntime.jsx(
2057
- tooltip.Button,
2058
- {
2059
- variant: "ghost",
2060
- size: "icon",
2061
- className: "absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity z-10 bg-background/80 hover:bg-background",
2062
- onClick: handleCopy,
2063
- "aria-label": copied ? "Copiado" : "Copiar código",
2064
- children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-4 h-4 text-[var(--toast-success-icon)]", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "w-4 h-4", "aria-hidden": "true" })
2065
- }
2066
- ),
2067
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto w-full max-w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
2068
- reactSyntaxHighlighter.Prism,
2069
- {
2070
- language,
2071
- style: elegantTheme,
2072
- showLineNumbers,
2073
- wrapLines: true,
2074
- customStyle: {
2075
- margin: 0,
2076
- padding: "1rem",
2077
- background: "transparent",
2078
- fontSize: "inherit"
2079
- },
2080
- codeTagProps: {
2081
- className: "text-[length:inherit]"
2082
- },
2083
- children: codeString
2084
- }
2085
- ) })
2086
- ] })
2087
- ] });
2088
- };
2089
- exports.CodeBlock = CodeBlock;
2090
- exports.FormattedDocument = FormattedDocument;
2091
- exports.MarkdownMessage = MarkdownMessage;
2092
- exports.ModernChatInput = ModernChatInput;
2093
- exports.XerticaAssistant = XerticaAssistant;
2094
- exports.gerarResposta = gerarResposta;